Compare commits

..

4695 Commits

Author SHA1 Message Date
Codex 749a3ee382 docs: refresh planner priorities for 4248
Harness (E2E) / Harnesses (mock LLM) (push) Waiting to run
Harness (E2E) / Provider harnesses (live LLM conformance) (push) Waiting to run
Lint / golangci-lint (push) Waiting to run
Run Tests / Unit Tests (push) Waiting to run
Run Tests / Etcd Integration Tests (push) Waiting to run
2026-07-07 13:56:07 +00:00
Asim Aslam 5dc2a32233 fix atlascloud minimax tool fallback (#4247)
Co-authored-by: Codex <codex@openai.com>
2026-07-07 14:30:38 +01:00
Asim Aslam d8562edcf6 docs: refresh planner priorities for 4240 (#4242)
Co-authored-by: Codex <codex@openai.com>
2026-07-07 14:02:07 +01:00
Asim Aslam 5a85cba982 docs: add examples wayfinding index (#4239)
Co-authored-by: Codex <codex@openai.com>
2026-07-07 13:34:38 +01:00
Asim Aslam 019420c123 docs: refresh planner priorities for 4233 (#4234)
Co-authored-by: Codex <codex@openai.com>
2026-07-07 12:13:53 +01:00
Asim Aslam 5b32014de1 agent: trace tool retry attempts (#4232)
Co-authored-by: Codex <codex@openai.com>
2026-07-07 10:58:59 +01:00
Asim Aslam 32e522a2a9 docs: refresh planner priorities for 4229 (#4230)
Co-authored-by: Codex <codex@openai.com>
2026-07-07 10:18:29 +01:00
Asim Aslam 811d617b46 docs: refresh coherence changelog (#4228)
Co-authored-by: Codex <codex@openai.com>
2026-07-07 09:15:15 +01:00
Asim Aslam 32d0c46676 agent: cancel stream ask on close (#4226)
Co-authored-by: Codex <codex@openai.com>
2026-07-07 09:05:08 +01:00
Asim Aslam 34e7cf1f5f docs: refresh planner priorities for 4222 (#4224)
Co-authored-by: Codex <codex@openai.com>
2026-07-07 08:26:57 +01:00
Asim Aslam 091fb1d4df agent: add resume pending helper (#4221)
Co-authored-by: Codex <codex@openai.com>
2026-07-07 07:05:27 +01:00
Asim Aslam 1c56d77c86 docs: refresh planner priorities for 4216 (#4219)
Co-authored-by: Codex <codex@openai.com>
2026-07-07 06:32:27 +01:00
Asim Aslam 6f220089d5 test agent retry side-effect dedupe (#4215)
Co-authored-by: Codex <codex@openai.com>
2026-07-07 04:57:01 +01:00
Asim Aslam 58249e4a2f docs: refresh planner priorities for 4212 (#4213)
Co-authored-by: Codex <codex@openai.com>
2026-07-07 04:19:05 +01:00
Asim Aslam e51cbfba01 agent: harden conformance delegate retry (#4211)
Co-authored-by: Codex <codex@openai.com>
2026-07-07 03:30:56 +01:00
Asim Aslam e68d0e0018 docs: refresh planner priorities for 4208 (#4209)
Co-authored-by: Codex <codex@openai.com>
2026-07-07 02:48:36 +01:00
Asim Aslam e96898d362 test: verify installed on-ramp wayfinding (#4207)
Co-authored-by: Codex <codex@openai.com>
2026-07-07 02:20:46 +01:00
Asim Aslam c88a090d10 docs: refresh planner priorities for 4201 (#4203)
Co-authored-by: Codex <codex@openai.com>
2026-07-07 01:53:07 +01:00
Asim Aslam f6951d2bb0 Enforce idempotent delegate notifications (#4200)
Co-authored-by: Codex <codex@openai.com>
2026-07-07 01:03:54 +01:00
Asim Aslam 94286204ad docs: refresh planner priorities for 4196 (#4198)
Co-authored-by: Codex <codex@openai.com>
2026-07-07 00:41:56 +01:00
Asim Aslam d54139c02d Harden agent conformance retry prompts (#4195)
goreleaser / goreleaser (push) Waiting to run
Co-authored-by: Codex <codex@openai.com>
2026-07-07 00:00:00 +01:00
Asim Aslam 5ff3760cd4 Harden agent conformance retry completion (#4191)
Co-authored-by: Codex <codex@openai.com>
2026-07-06 23:10:09 +01:00
Asim Aslam 69ab520360 docs: refresh planner priorities for 4186 (#4187)
Co-authored-by: Codex <codex@openai.com>
2026-07-06 22:38:08 +01:00
Asim Aslam 0c4ea84ee3 harness: dedupe delegated notify paraphrases (#4185)
Co-authored-by: Codex <codex@openai.com>
2026-07-06 22:17:10 +01:00
Asim Aslam e6a6c72038 docs: refresh planner priorities for 4180 (#4181)
Co-authored-by: Codex <codex@openai.com>
2026-07-06 21:59:09 +01:00
Asim Aslam 7c036459cf docs: add micro loop quickstart wayfinding (#4179)
Co-authored-by: Codex <codex@openai.com>
2026-07-06 21:23:10 +01:00
Asim Aslam 83cb4ff1a9 docs: refresh planner priorities for 4174 (#4176)
Co-authored-by: Codex <codex@openai.com>
2026-07-06 20:47:02 +01:00
Asim Aslam 941d43bdf5 harness: dedupe delegated owner notifications (#4173)
Co-authored-by: Codex <codex@openai.com>
2026-07-06 20:16:40 +01:00
Asim Aslam bb3e40ade7 docs: refresh planner priorities for 4168 (#4170)
Co-authored-by: Codex <codex@openai.com>
2026-07-06 19:51:18 +01:00
Asim Aslam dbce523437 agent: cover durable checkpoint resume smoke (#4167)
Co-authored-by: Codex <codex@openai.com>
2026-07-06 19:29:11 +01:00
Asim Aslam 98125cd770 Stabilize AtlasCloud follow-up tool fallback (#4165)
Co-authored-by: Codex <codex@openai.com>
2026-07-06 18:37:42 +01:00
Asim Aslam 3454a08079 docs: refresh planner priorities for 4160 (#4161)
Co-authored-by: Codex <codex@openai.com>
2026-07-06 18:10:32 +01:00
Asim Aslam decfa7c63e Fix AtlasCloud tool schema normalization (#4159)
Co-authored-by: Codex <codex@openai.com>
2026-07-06 16:58:24 +01:00
Asim Aslam b6980e27a9 docs: refresh planner priorities for 4154 (#4155)
Co-authored-by: Codex <codex@openai.com>
2026-07-06 16:17:30 +01:00
Asim Aslam d92d63943c Add no-secret agent debugging smoke (#4153)
Co-authored-by: Codex <codex@openai.com>
2026-07-06 15:08:34 +01:00
Asim Aslam ec1d46526c docs: refresh planner priorities for 4147 (#4149)
Co-authored-by: Codex <codex@openai.com>
2026-07-06 14:28:46 +01:00
Asim Aslam 40308cf779 Preserve delegated notification plan completion (#4146)
Co-authored-by: Codex <codex@openai.com>
2026-07-06 13:03:39 +01:00
Asim Aslam e198810390 docs: refresh planner priorities for 4141 (#4143)
Co-authored-by: Codex <codex@openai.com>
2026-07-06 12:44:39 +01:00
Asim Aslam 3ec50d1a7d Add first-agent tutorial smoke harness (#4140)
Co-authored-by: Codex <codex@openai.com>
2026-07-06 11:06:12 +01:00
Asim Aslam 327f99cd19 docs: refresh coherence changelog (#4135)
Co-authored-by: Codex <codex@openai.com>
2026-07-06 09:40:01 +01:00
Asim Aslam 498aac59f4 Stabilize duplicate plan-delegate notify replays (#4133)
Co-authored-by: Codex <codex@openai.com>
2026-07-06 09:12:58 +01:00
Asim Aslam 6833b3c73c docs: refresh planner priorities for 4127 (#4131)
Co-authored-by: Codex <codex@openai.com>
2026-07-06 08:46:21 +01:00
Asim Aslam ec27ce2e25 Fix first-agent quickstart numbering (#4125)
Co-authored-by: Codex <codex@openai.com>
2026-07-06 07:18:03 +01:00
Asim Aslam 45cf24162b Add first-agent examples CLI wayfinding (#4124)
Co-authored-by: Codex <codex@openai.com>
2026-07-06 07:17:16 +01:00
Asim Aslam 2778472096 docs: refresh planner priorities for 4121 (#4122)
Co-authored-by: Codex <codex@openai.com>
2026-07-06 06:39:18 +01:00
Asim Aslam 9dfb35d85a Guard provider conformance workflow scheduling (#4120)
Co-authored-by: Codex <codex@openai.com>
2026-07-06 04:59:35 +01:00
Asim Aslam ac230b57ee docs: refresh planner priorities for 4114 (#4116)
Co-authored-by: Codex <codex@openai.com>
2026-07-06 04:18:25 +01:00
Asim Aslam 96eea598fc docs: align first-agent inspect command (#4113)
Co-authored-by: Codex <codex@openai.com>
2026-07-06 03:30:28 +01:00
Asim Aslam 97391e9a92 docs: refresh planner priorities for 4109 (#4111)
Co-authored-by: Codex <codex@openai.com>
2026-07-06 02:48:05 +01:00
Asim Aslam 6f2fefc1e1 Make plan-delegate notify replay idempotent (#4108)
Co-authored-by: Codex <codex@openai.com>
2026-07-06 02:22:20 +01:00
Asim Aslam 224446b948 docs: refresh planner priorities for 4103 (#4105)
Co-authored-by: Codex <codex@openai.com>
2026-07-06 01:44:17 +01:00
Asim Aslam eb16370f03 Add zero-to-hero CLI entrypoint (#4102)
Co-authored-by: Codex <codex@openai.com>
2026-07-06 01:02:09 +01:00
Asim Aslam 3262034698 docs: refresh planner priorities for 4096 (#4098)
Co-authored-by: Codex <codex@openai.com>
2026-07-06 00:31:40 +01:00
Asim Aslam 2963ac3fa6 docs: align architecture with agent lifecycle (#4095)
goreleaser / goreleaser (push) Waiting to run
Co-authored-by: Codex <codex@openai.com>
2026-07-05 23:59:15 +01:00
Asim Aslam eaff193569 docs: refresh planner priorities for 4091 (#4093)
Co-authored-by: Codex <codex@openai.com>
2026-07-05 23:35:22 +01:00
Asim Aslam 36fd5b7bcd Promote first-agent doctor recovery (#4090)
Co-authored-by: Codex <codex@openai.com>
2026-07-05 22:59:00 +01:00
Asim Aslam 2e89b01295 docs: refresh planner priorities for 4085 (#4087)
Co-authored-by: Codex <codex@openai.com>
2026-07-05 22:34:11 +01:00
Asim Aslam e95d565502 docs: add install troubleshooting on-ramp (#4084)
Co-authored-by: Codex <codex@openai.com>
2026-07-05 21:59:12 +01:00
Asim Aslam a826e01dd4 docs: refresh planner queue for 4081 (#4082)
Co-authored-by: Codex <codex@openai.com>
2026-07-05 21:33:35 +01:00
Asim Aslam f8619d89b6 docs: align website quickstart on-ramp (#4080)
Co-authored-by: Codex <codex@openai.com>
2026-07-05 21:06:30 +01:00
Asim Aslam 8ddb71143a docs: refresh planner priorities for 4076 (#4078)
Co-authored-by: Codex <codex@openai.com>
2026-07-05 20:35:10 +01:00
Asim Aslam 3699c88e10 Make config close idempotent (#4075)
Co-authored-by: Codex <codex@openai.com>
2026-07-05 20:08:06 +01:00
Asim Aslam a2145cc3a9 docs: refresh planner priorities for 4070 (#4072)
Co-authored-by: Codex <codex@openai.com>
2026-07-05 19:39:21 +01:00
Asim Aslam d0dce12797 test docs wayfinding link targets (#4069)
Co-authored-by: Codex <codex@openai.com>
2026-07-05 19:01:31 +01:00
Asim Aslam 2cfa776a66 docs: refresh planner priorities for 4063 (#4065)
Co-authored-by: Codex <codex@openai.com>
2026-07-05 18:43:42 +01:00
Asim Aslam 24a64aadb0 test examples lifecycle map (#4062)
Co-authored-by: Codex <codex@openai.com>
2026-07-05 18:01:38 +01:00
Asim Aslam 5d3d570c4f docs: refresh planner priorities for 4058 (#4060)
Co-authored-by: Codex <codex@openai.com>
2026-07-05 17:36:44 +01:00
Asim Aslam 304d14331c docs: lead getting started with no-secret path (#4057)
Co-authored-by: Codex <codex@openai.com>
2026-07-05 17:09:01 +01:00
Asim Aslam 5429ff0f08 docs: refresh planner priorities for 4053 (#4055)
Co-authored-by: Codex <codex@openai.com>
2026-07-05 16:39:33 +01:00
Asim Aslam 8c9521cc63 docs: surface agent demo after scaffolding (#4052)
Co-authored-by: Codex <codex@openai.com>
2026-07-05 16:11:07 +01:00
Asim Aslam 621aa68f13 Lead CLI docs with agent demo (#4049)
Co-authored-by: Codex <codex@openai.com>
2026-07-05 15:17:24 +01:00
Asim Aslam 32a337509b docs: refresh planner priorities for 4045 (#4047)
Co-authored-by: Codex <codex@openai.com>
2026-07-05 14:43:29 +01:00
Asim Aslam 4a6ab4016d docs: add agent demo to first-agent on-ramp (#4044)
Co-authored-by: Codex <codex@openai.com>
2026-07-05 14:04:27 +01:00
Asim Aslam ce7cff7409 docs: refresh planner priorities for 4040 (#4042)
Co-authored-by: Codex <codex@openai.com>
2026-07-05 13:40:25 +01:00
Asim Aslam 84e37e413e feat(cli): surface no-secret agent demo (#4039)
Co-authored-by: Codex <codex@openai.com>
2026-07-05 13:08:42 +01:00
Asim Aslam 49dfdffbb7 docs: refresh planner priorities for 4035 (#4037)
Co-authored-by: Codex <codex@openai.com>
2026-07-05 12:43:06 +01:00
Asim Aslam 9cc49f7718 Add first-agent recovery doctor (#4034)
Co-authored-by: Codex <codex@openai.com>
2026-07-05 12:23:30 +01:00
Asim Aslam a18050d910 docs: refresh planner priorities for 4030 (#4032)
Co-authored-by: Codex <codex@openai.com>
2026-07-05 11:55:29 +01:00
Asim Aslam 9db77ac265 docs: route security reports through GitHub advisories (#4029)
Co-authored-by: Codex <codex@openai.com>
2026-07-05 11:41:11 +01:00
Asim Aslam d4bfb4db5a agent: record otel events before ending spans (#4027)
Co-authored-by: Codex <codex@openai.com>
2026-07-05 10:41:35 +01:00
Asim Aslam 75bf15a7d6 docs: refresh planner priorities for 4023 (#4024)
Co-authored-by: Codex <codex@openai.com>
2026-07-05 10:14:52 +01:00
Asim Aslam 153f178db6 docs: refresh coherence changelog (#4021)
Co-authored-by: Codex <codex@openai.com>
2026-07-05 09:10:28 +01:00
Asim Aslam 15af99f587 agent: extend checkpoint plan continuations (#4019)
Co-authored-by: Codex <codex@openai.com>
2026-07-05 08:48:44 +01:00
Asim Aslam f4f0bcc459 docs: refresh planner priorities for 4016 (#4017)
Co-authored-by: Codex <codex@openai.com>
2026-07-05 08:18:35 +01:00
Asim Aslam 5ed66e550d Stabilize AtlasCloud follow-up tool calls (#4015)
Co-authored-by: Codex <codex@openai.com>
2026-07-05 07:05:00 +01:00
Asim Aslam 7f4c7d6771 docs: refresh planner priorities for 4010 (#4011)
Co-authored-by: Codex <codex@openai.com>
2026-07-05 06:31:47 +01:00
Asim Aslam 3f5547e781 ai: add anthropic streaming (#4009)
Co-authored-by: Codex <codex@openai.com>
2026-07-05 04:57:58 +01:00
Asim Aslam 12144d66a6 docs: refresh planner priorities for 4004 (#4005)
Co-authored-by: Codex <codex@openai.com>
2026-07-05 04:16:13 +01:00
Asim Aslam f2096bf0cf Guard plan delegation ordering (#4003)
Co-authored-by: Codex <codex@openai.com>
2026-07-05 03:30:56 +01:00
Asim Aslam f758297265 docs: refresh planner priorities for 3999 (#4000)
Co-authored-by: Codex <codex@openai.com>
2026-07-05 02:50:30 +01:00
Asim Aslam f16b23cf76 agent: run mixed text tool calls after structured calls (#3998)
Co-authored-by: Codex <codex@openai.com>
2026-07-05 02:18:18 +01:00
Asim Aslam 9d4133c666 docs: refresh planner priorities for 3994 (#3995)
Co-authored-by: Codex <codex@openai.com>
2026-07-05 01:49:26 +01:00
Asim Aslam 6ecfcd5cdf cli: surface first-agent next steps (#3993)
Co-authored-by: Codex <codex@openai.com>
2026-07-05 00:59:18 +01:00
Asim Aslam 3ceb23e9cb docs: refresh planner queue for 3987 (#3988)
Co-authored-by: Codex <codex@openai.com>
2026-07-05 00:32:58 +01:00
Asim Aslam af4d81cba3 harness: require notify inside plan delegate flow (#3986)
goreleaser / goreleaser (push) Waiting to run
Co-authored-by: Codex <codex@openai.com>
2026-07-05 00:00:26 +01:00
Asim Aslam 021e3e1bd9 docs: refresh planner priorities for 3982 (#3984)
Co-authored-by: Codex <codex@openai.com>
2026-07-04 23:33:46 +01:00
Asim Aslam 3f17f7b106 Stabilize first-agent broker isolation (#3981)
Co-authored-by: Codex <codex@openai.com>
2026-07-04 23:01:12 +01:00
Asim Aslam 4ed4fca47d docs: align planner queue after 3975 (#3979)
Co-authored-by: Codex <codex@openai.com>
2026-07-04 22:31:56 +01:00
Asim Aslam c2b11a1d31 docs: refresh planner queue for 3974 (#3978)
Co-authored-by: Codex <codex@openai.com>
2026-07-04 22:30:50 +01:00
Asim Aslam f7c2ff0a74 docs: surface first-agent example path (#3975)
Co-authored-by: Codex <codex@openai.com>
2026-07-04 22:22:42 +01:00
Asim Aslam ddf26acc47 docs: refresh planner priorities for 3968 (#3970)
Co-authored-by: Codex <codex@openai.com>
2026-07-04 21:30:07 +01:00
Asim Aslam 54a80bc930 harness: verify first-agent on-ramp (#3967)
Co-authored-by: Codex <codex@openai.com>
2026-07-04 21:05:30 +01:00
Asim Aslam 76f309f253 agent: alias text tool create calls to add (#3964)
Co-authored-by: Codex <codex@openai.com>
2026-07-04 19:59:32 +01:00
Asim Aslam 9a3e6b7e5e docs(priorities): refresh planner queue for 3960 (#3961)
Co-authored-by: Codex <codex@openai.com>
2026-07-04 19:28:25 +01:00
Asim Aslam eb76367b0b Stabilize agent conformance marker retry (#3959)
Co-authored-by: Codex <codex@openai.com>
2026-07-04 19:02:09 +01:00
Asim Aslam 58b8eb3e6b docs(priorities): refresh planner queue for 3954 (#3956)
Co-authored-by: Codex <codex@openai.com>
2026-07-04 18:29:59 +01:00
Asim Aslam f12788bd80 Preserve completed agent plan steps (#3953)
Co-authored-by: Codex <codex@openai.com>
2026-07-04 17:59:30 +01:00
Asim Aslam 47997134af docs(priorities): refresh planner queue for 3949 (#3950)
Co-authored-by: Codex <codex@openai.com>
2026-07-04 17:31:21 +01:00
Asim Aslam f35274af00 agent: harden AtlasCloud delegate conformance prompt (#3948)
Co-authored-by: Codex <codex@openai.com>
2026-07-04 17:01:03 +01:00
Asim Aslam fefe3e5b4a docs(priorities): refresh planner queue for 3943 (#3944)
Co-authored-by: Codex <codex@openai.com>
2026-07-04 16:36:35 +01:00
Asim Aslam b01fd477b5 agent: parse tagged text tool calls (#3942)
Co-authored-by: Codex <codex@openai.com>
2026-07-04 16:13:07 +01:00
Asim Aslam dbca408982 docs(priorities): refresh planner queue for 3938 (#3939)
Co-authored-by: Codex <codex@openai.com>
2026-07-04 15:42:04 +01:00
Asim Aslam fa9806c5a6 agent: retry missing delegate conformance (#3937)
Co-authored-by: Codex <codex@openai.com>
2026-07-04 15:20:36 +01:00
Asim Aslam 95e7c387b2 docs(priorities): refresh planner queue for 3932 (#3933)
Co-authored-by: Codex <codex@openai.com>
2026-07-04 14:36:37 +01:00
Asim Aslam cc54ae988d agent: retry conformance when tool is skipped (#3931)
Co-authored-by: Codex <codex@openai.com>
2026-07-04 14:01:46 +01:00
Asim Aslam 6b86bbb27e docs(priorities): refresh planner queue for 3927 (#3928)
Co-authored-by: Codex <codex@openai.com>
2026-07-04 13:34:42 +01:00
Asim Aslam 45624a25e0 Stabilize plan-delegate notify wait (#3926)
Co-authored-by: Codex <codex@openai.com>
2026-07-04 13:06:43 +01:00
Asim Aslam e71e0a79fb docs(priorities): refresh planner queue for 3921 (#3922)
Co-authored-by: Codex <codex@openai.com>
2026-07-04 12:41:51 +01:00
Asim Aslam ebc315505b examples: add smallest first agent (#3920)
Co-authored-by: Codex <codex@openai.com>
2026-07-04 12:13:08 +01:00
Asim Aslam 100c7e11b9 docs(priorities): refresh planner queue for 3913 (#3915)
Co-authored-by: Codex <codex@openai.com>
2026-07-04 11:41:35 +01:00
Asim Aslam 96ecf67573 agent: surface checkpoint resume hints in inspect (#3912)
Co-authored-by: Codex <codex@openai.com>
2026-07-04 11:26:58 +01:00
Asim Aslam 71f4f6ac05 docs(priorities): refresh planner queue for 3907 (#3909)
Co-authored-by: Codex <codex@openai.com>
2026-07-04 10:51:37 +01:00
Asim Aslam 0dd5ebe789 test(agent): broaden provider conformance scenario (#3906)
Co-authored-by: Codex <codex@openai.com>
2026-07-04 10:32:49 +01:00
Asim Aslam b29c8c95b1 docs(priorities): refresh planner queue for 3900 (#3904)
Co-authored-by: Codex <codex@openai.com>
2026-07-04 10:06:16 +01:00
Asim Aslam 47ff1bc6f5 Add AP2 mandate foundation for A2A (#3899)
Co-authored-by: Codex <codex@openai.com>
2026-07-04 09:35:01 +01:00
Asim Aslam 6c6ce0e2a7 docs: update coherence changelog (#3897)
Co-authored-by: Codex <codex@openai.com>
2026-07-04 09:14:57 +01:00
Asim Aslam d91ac00da9 agent: add operational failure guidance (#3895)
Co-authored-by: Codex <codex@openai.com>
2026-07-04 08:38:33 +01:00
Asim Aslam ff94e8b316 docs(priorities): refresh planner queue for 3890 (#3892)
Co-authored-by: Codex <codex@openai.com>
2026-07-04 08:15:25 +01:00
Asim Aslam ab0bf29c79 feat(loop): add a security role that vets for vulnerabilities (#3818)
Adds an opt-in `security` role to `micro loop` and wires it into go-micro's own
loop. On a schedule it dispatches the agent to audit the codebase for real,
exploitable vulnerabilities and file them.

Security gets a deliberately more conservative policy than the other roles,
encoded in .github/loop/prompts/security.md:
- NEVER auto-merges a security change (fixes stay human-reviewed).
- NEVER publishes exploit detail / PoC in a public issue — novel exploitable
  findings get a concise `security` + `needs-human` issue (class, location,
  impact) routed to private disclosure; only known/public dep CVEs get a
  bump PR (no auto-merge).
- Weekly by default (`--security-cron`, 0 6 * * 1); tunable.

The go-micro prompt targets its real attack surface: MCP/A2A gateways, x402
payments, JWT/wrapper auth, provider BaseURL SSRF + key leakage, the agent
tool loop (prompt injection / guardrail bypass), TLS defaults, the loop's own
PAT, and dependency CVEs via govulncheck.

Note: an agent review is not a gate. The deterministic companion — govulncheck
as a required CI check — is a recommended follow-up so known-vulnerable deps
can't merge at all.


Claude-Session: https://claude.ai/code/session_01CmdEY7pYmV5zzwCjNJ4ykL

Co-authored-by: Claude <noreply@anthropic.com>
2026-07-04 07:03:08 +01:00
Asim Aslam 96e822d656 Add no-secret debug transcript checkpoint (#3889)
Co-authored-by: Codex <codex@openai.com>
2026-07-04 06:57:18 +01:00
Asim Aslam c60c03d485 docs(priorities): refresh planner queue for 3885 (#3886)
Co-authored-by: Codex <codex@openai.com>
2026-07-04 06:25:38 +01:00
Asim Aslam 7963342999 docs: test first-agent wayfinding (#3884)
Co-authored-by: Codex <codex@openai.com>
2026-07-04 04:55:59 +01:00
Asim Aslam 593846093f docs(priorities): refresh planner queue for 3878 (#3881)
Co-authored-by: Codex <codex@openai.com>
2026-07-04 04:10:29 +01:00
Asim Aslam 5b27c5b239 Fix plan-delegate notify completion race (#3877)
Co-authored-by: Codex <codex@openai.com>
2026-07-04 03:29:05 +01:00
Asim Aslam 0a10655231 docs(priorities): refresh planner queue for 3873 (#3874)
Co-authored-by: Codex <codex@openai.com>
2026-07-04 02:49:04 +01:00
Asim Aslam cc3502d156 Trace agent model streams (#3872)
Co-authored-by: Codex <codex@openai.com>
2026-07-04 02:17:16 +01:00
Asim Aslam 014a6431f2 docs(priorities): refresh planner queue for 3866 (#3868)
Co-authored-by: Codex <codex@openai.com>
2026-07-04 01:46:02 +01:00
Asim Aslam 3725a53bf9 Record streamed agent replies in memory (#3865)
Co-authored-by: Codex <codex@openai.com>
2026-07-04 01:01:04 +01:00
Asim Aslam b24b19f191 docs(priorities): refresh planner queue for 3862 (#3863)
Co-authored-by: Codex <codex@openai.com>
2026-07-04 00:34:46 +01:00
Asim Aslam bc732bb513 docs: surface durable agent example (#3861)
goreleaser / goreleaser (push) Waiting to run
Co-authored-by: Codex <codex@openai.com>
2026-07-04 00:02:40 +01:00
Asim Aslam 522786d21d docs(priorities): refresh planner queue for 3856 (#3858)
Co-authored-by: Codex <codex@openai.com>
2026-07-03 23:25:03 +01:00
Asim Aslam 84cc4c6e8d Trace agent run event kinds (#3855)
Co-authored-by: Codex <codex@openai.com>
2026-07-03 23:00:08 +01:00
Asim Aslam f96b1014a2 docs(priorities): refresh planner queue for 3852 (#3853)
Co-authored-by: Codex <codex@openai.com>
2026-07-03 22:34:49 +01:00
Asim Aslam 3cafff8789 Make agent preflight failures actionable (#3851)
Co-authored-by: Codex <codex@openai.com>
2026-07-03 22:00:02 +01:00
Asim Aslam 69e23eb1f6 docs(priorities): refresh planner queue for 3846 (#3848)
Co-authored-by: Codex <codex@openai.com>
2026-07-03 21:34:55 +01:00
Asim Aslam 1841599980 Ensure canceled agent runs fail after tool calls (#3845)
Co-authored-by: Codex <codex@openai.com>
2026-07-03 21:07:58 +01:00
Asim Aslam 6f9994b3ea docs(priorities): refresh planner queue for 3840 (#3842)
Co-authored-by: Codex <codex@openai.com>
2026-07-03 20:33:13 +01:00
Asim Aslam 55070f1597 Harden A2A fallback stream validation (#3839)
Co-authored-by: Codex <codex@openai.com>
2026-07-03 20:03:40 +01:00
Asim Aslam b3940860b6 docs(priorities): refresh planner queue for 3835 (#3836)
Co-authored-by: Codex <codex@openai.com>
2026-07-03 19:39:51 +01:00
Asim Aslam 5c38a23fe4 Classify plan-delegate timeout side effects (#3834)
Co-authored-by: Codex <codex@openai.com>
2026-07-03 19:07:08 +01:00
Asim Aslam 9e7273dde1 docs(priorities): refresh planner queue for 3829 (#3830)
Co-authored-by: Codex <codex@openai.com>
2026-07-03 18:42:19 +01:00
Asim Aslam 42080b6d6d Stabilize file store suffix expiry test (#3828)
Co-authored-by: Codex <codex@openai.com>
2026-07-03 18:18:26 +01:00
Asim Aslam c3df8b833d docs(priorities): refresh planner queue for 3823 (#3824)
Co-authored-by: Codex <codex@openai.com>
2026-07-03 17:38:33 +01:00
Asim Aslam 8694e3a20c test(store): isolate file store tests (#3822)
Co-authored-by: Codex <codex@openai.com>
2026-07-03 17:18:57 +01:00
Asim Aslam 9def03d4e3 docs(priorities): refresh planner queue for 3817 (#3819)
Co-authored-by: Codex <codex@openai.com>
2026-07-03 16:51:21 +01:00
Asim Aslam bd7625f947 Tighten delegated notify harness prompt (#3816)
Co-authored-by: Codex <codex@openai.com>
2026-07-03 16:25:49 +01:00
Asim Aslam 0a547fbe17 docs(priorities): refresh planner queue for 3812 (#3813)
Co-authored-by: Codex <codex@openai.com>
2026-07-03 15:55:48 +01:00
Asim Aslam 331e3f32bd Fix universe concierge notify handoff (#3811)
Co-authored-by: Codex <codex@openai.com>
2026-07-03 15:31:48 +01:00
Asim Aslam 7db1d986ab docs(priorities): refresh planner queue for 3808 (#3809)
Co-authored-by: Codex <codex@openai.com>
2026-07-03 14:48:47 +01:00
Asim Aslam 6042a6c5f5 Add CLI docs wayfinding (#3807)
Co-authored-by: Codex <codex@openai.com>
2026-07-03 14:21:34 +01:00
Asim Aslam bff916a3ac docs(priorities): refresh planner queue for 3800 (#3802)
Co-authored-by: Codex <codex@openai.com>
2026-07-03 13:42:57 +01:00
Asim Aslam b8c03dafa2 Stabilize plan-delegate notify recovery (#3799)
Co-authored-by: Codex <codex@openai.com>
2026-07-03 13:30:58 +01:00
Asim Aslam 04bcef47ac docs(priorities): refresh planner queue for 3795 (#3796)
Co-authored-by: Codex <codex@openai.com>
2026-07-03 12:58:27 +01:00
Asim Aslam e92978f3eb Add minimax to provider conformance (#3794)
Co-authored-by: Codex <codex@openai.com>
2026-07-03 12:30:56 +01:00
Asim Aslam 695a24432a docs(priorities): refresh planner queue for 3790 (#3791)
Co-authored-by: Codex <codex@openai.com>
2026-07-03 12:00:11 +01:00
Asim Aslam 2889b98dcf store: de-flake TestFileStoreTable timing windows (#3789)
TestFileStoreTable failed intermittently on CI ("Expected 2 items, got 1"):
the same commit passed the Unit Tests job on a PR run and failed on the master
push. Cause: records written with a 100ms expiry are read back immediately and
expected to still be present, but under `-race` on a loaded runner the write
loop + file I/O + read can exceed 100ms, so a record expires before the read.

Widen the expiry/TTL windows (100ms -> 1s) and the paired post-expiry sleeps
(-> 2s). The "read before expiry" reads happen in well under 200ms, so they stay
inside the 1s window on any runner; the "read after expiry" waits comfortably
exceed it. Test-only; the store's expiry behavior is unchanged.

Verified: `go test -race -count=5 -run TestFileStoreTable ./store/` green.


Claude-Session: https://claude.ai/code/session_01CmdEY7pYmV5zzwCjNJ4ykL

Co-authored-by: Claude <noreply@anthropic.com>
2026-07-03 11:35:56 +01:00
Asim Aslam a356ab36a8 ai/minimax: complete provider surface (matrix, conformance, changelog) (#3784)
* ai/minimax: complete provider surface (matrix, conformance, changelog)

Follow-up after merging the MiniMax provider (#3769), mirroring the Ollama
completeness pass (#3637):

- Add the `minimax` row to the AI provider capability matrix and blank-import
  ai/minimax in provider_capabilities_test.go so the matrix stays enforced
  against the registry.
- Add minimax to the stream-conformance allowlist (+ import) so its streaming
  is actually exercised against the OpenAI-compatible SSE contract, not just
  registered. It passes via the shared ai/internal/openaiapi path.
- Record the provider in CHANGELOG [Unreleased].

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CmdEY7pYmV5zzwCjNJ4ykL

* ai: update capabilities_test provider assertions for minimax

Adding the minimax blank-import to the shared ai_test binary (for stream
conformance) also registers it for TestRegisteredProviders / TestCapabilityRows
/ TestCapabilityMatrix in capabilities_test.go, which pin the exact provider
set. Update those assertions to include minimax. (Fixes the Unit Tests failure
my scoped `-run TestStreamProviders` check missed — go compiles all _test.go in
a package into one binary.)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CmdEY7pYmV5zzwCjNJ4ykL

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-07-03 11:10:29 +01:00
Octopus 2078748e7f feat: add MiniMax provider (#3769)
Co-authored-by: octo-patch <266937838+octo-patch@users.noreply.github.com>
2026-07-03 10:56:12 +01:00
Asim Aslam d283f9b08b Accept order-scoped buyer notifications (#3783)
Co-authored-by: Codex <codex@openai.com>
2026-07-03 10:45:47 +01:00
Asim Aslam af7b4f3d50 docs(priorities): refresh planner queue for 3777 (#3778)
Co-authored-by: Codex <codex@openai.com>
2026-07-03 10:17:04 +01:00
Asim Aslam 954f8fa79e docs: update changelog for coherence audit (#3776)
Co-authored-by: Codex <codex@openai.com>
2026-07-03 09:07:28 +01:00
Asim Aslam cdfe9c0947 Fix plan-delegate timeout completion (#3774)
Co-authored-by: Codex <codex@openai.com>
2026-07-03 08:49:33 +01:00
Asim Aslam c645c5faa7 docs(priorities): refresh planner queue for 3768 (#3770)
Co-authored-by: Codex <codex@openai.com>
2026-07-03 08:18:32 +01:00
Asim Aslam 8bde01bdac docs(priorities): refresh planner queue for 3763 (#3764)
Co-authored-by: Codex <codex@openai.com>
2026-07-03 06:31:05 +01:00
Asim Aslam 1373ceec21 harness: parse multi-event A2A SSE (#3762)
Co-authored-by: Codex <codex@openai.com>
2026-07-03 04:53:40 +01:00
Asim Aslam 838b7f73f8 docs(priorities): refresh planner queue for 3757 (#3758)
Co-authored-by: Codex <codex@openai.com>
2026-07-03 04:20:35 +01:00
Asim Aslam c56423a33c Require harness notification side effects (#3756)
Co-authored-by: Codex <codex@openai.com>
2026-07-03 03:29:12 +01:00
Asim Aslam 6edc0de7bd docs(priorities): refresh planner queue for 3752 (#3753)
Co-authored-by: Codex <codex@openai.com>
2026-07-03 02:46:16 +01:00
Asim Aslam 3d31fe37db fix atlascloud tool-call request diagnostics (#3749)
Co-authored-by: Codex <codex@openai.com>
2026-07-03 02:30:44 +01:00
Asim Aslam 6840ae0fb1 docs(priorities): refresh planner queue for 3745 (#3746)
Co-authored-by: Codex <codex@openai.com>
2026-07-03 01:45:59 +01:00
Asim Aslam af61d6327a atlascloud: fall back to tool results (#3744)
Co-authored-by: Codex <codex@openai.com>
2026-07-03 01:00:20 +01:00
Asim Aslam 79d443839d docs(priorities): refresh planner queue for 3739 (#3740)
Co-authored-by: Codex <codex@openai.com>
2026-07-03 00:33:57 +01:00
Asim Aslam 5770a2f4cb fix atlascloud stream tool fallback (#3738)
goreleaser / goreleaser (push) Waiting to run
Co-authored-by: Codex <codex@openai.com>
2026-07-03 00:06:42 +01:00
Asim Aslam 9f1f0aa191 docs(priorities): refresh planner queue for 3732 (#3733)
Co-authored-by: Codex <codex@openai.com>
2026-07-02 23:28:01 +01:00
Asim Aslam 69ffee329e Detect duplicate plan-delegate notifications (#3731)
Co-authored-by: Codex <codex@openai.com>
2026-07-02 23:03:37 +01:00
Asim Aslam d2c3c5e715 docs(priorities): refresh planner queue for 3727 (#3728)
Co-authored-by: Codex <codex@openai.com>
2026-07-02 22:35:19 +01:00
Asim Aslam 11f81f40fd harness: accept order-scoped buyer notifications (#3726)
Co-authored-by: Codex <codex@openai.com>
2026-07-02 21:59:07 +01:00
Asim Aslam a057df54f5 docs(priorities): refresh planner queue (#3722)
Co-authored-by: Codex <codex@openai.com>
2026-07-02 21:38:35 +01:00
Asim Aslam 0da1c739fb test plan-delegate unknown tool recovery (#3720)
Co-authored-by: Codex <codex@openai.com>
2026-07-02 21:15:09 +01:00
Asim Aslam 9ec9bf906c docs(priorities): refresh planner queue (#3716)
Co-authored-by: Codex <codex@openai.com>
2026-07-02 20:41:47 +01:00
Asim Aslam cf790048ad loop: triage watches Lint + Run Tests too, not just the harness (#3714)
Backstop for the gate: previously loop-triage only fired on Harness (E2E)
failures, so a red lint or test on master (e.g. the misspell that slipped past
because golangci-lint isn't a required check) produced no fix issue. Now triage
watches all the gate workflows.

- micro loop: `--ci-workflow` accepts a comma-separated list of workflow names,
  rendered into the triage workflow_run trigger as a YAML array; the issue names
  the actual failed workflow via github.event.workflow_run.name. (generic CLI)
- go-micro: regenerate loop-triage.yml to watch "Harness (E2E)", "Lint",
  "Run Tests"; generalize the triage prompt beyond the harness (a lint/test
  failure on master is a real regression to fix, not a flake to ignore).
- Docs: update CONTINUOUS_IMPROVEMENT.md triage description.

Note: this is defense-in-depth. The primary fix is making golangci-lint a
required status check so red lint can't merge in the first place — that stays
with the human (branch protection).


Claude-Session: https://claude.ai/code/session_01CmdEY7pYmV5zzwCjNJ4ykL

Co-authored-by: Claude <noreply@anthropic.com>
2026-07-02 20:21:07 +01:00
Asim Aslam 11d1711619 docs: add no-secret first-agent transcript (#3713)
Co-authored-by: Codex <codex@openai.com>
2026-07-02 20:16:39 +01:00
Asim Aslam 7d464e8a32 docs(priorities): refresh planner queue (#3709)
Co-authored-by: Codex <codex@openai.com>
2026-07-02 19:43:47 +01:00
Asim Aslam 8880168edd agent: continue unfinished plan steps (#3706)
Co-authored-by: Codex <codex@openai.com>
2026-07-02 19:20:52 +01:00
Asim Aslam 33b6ab5eea docs(priorities): refresh planner queue (#3703)
Co-authored-by: Codex <codex@openai.com>
2026-07-02 18:45:41 +01:00
Asim Aslam 32d1683d0b harness: accept buyer alias notifications (#3701)
Co-authored-by: Codex <codex@openai.com>
2026-07-02 18:15:19 +01:00
Asim Aslam 917d60f9f8 docs(priorities): refresh planner queue (#3697)
Co-authored-by: Codex <codex@openai.com>
2026-07-02 17:38:37 +01:00
Asim Aslam e41a80c92f docs: map examples to first-agent path (#3695)
Co-authored-by: Codex <codex@openai.com>
2026-07-02 17:24:27 +01:00
Asim Aslam c25fe16260 docs(priorities): drop completed universe item (#3691)
Co-authored-by: Codex <codex@openai.com>
2026-07-02 17:01:49 +01:00
Asim Aslam d240466d6d Constrain universe notify recipients (#3689)
Co-authored-by: Codex <codex@openai.com>
2026-07-02 16:29:14 +01:00
Asim Aslam 33a4af3984 docs(priorities): refresh planner queue (#3686)
Co-authored-by: Codex <codex@openai.com>
2026-07-02 16:00:17 +01:00
Asim Aslam 274c3b2646 Fail checkpointed runs with unfinished plans (#3684)
Co-authored-by: Codex <codex@openai.com>
2026-07-02 15:27:52 +01:00
Asim Aslam 6b6100340b docs(priorities): refresh planner queue (#3680)
Co-authored-by: Codex <codex@openai.com>
2026-07-02 14:40:53 +01:00
Asim Aslam 35b68b11f9 wrapper/x402: fix misspell lint failure (honour -> honor) (#3678)
golangci-lint's misspell linter fails on master: x402_settle_test.go used
British spellings ("honoured"/"honour"). Switch to US spelling to match the
linter's en_US locale. Introduced by #3676.


Claude-Session: https://claude.ai/code/session_01CmdEY7pYmV5zzwCjNJ4ykL

Co-authored-by: Claude <noreply@anthropic.com>
2026-07-02 14:39:18 +01:00
Asim Aslam 13d618ba66 test: make universe A2A reachability deterministic (#3677)
Co-authored-by: Codex <codex@openai.com>
2026-07-02 14:20:21 +01:00
Asim Aslam b60952cbfe wrapper/x402: settle payments, CDP auth, and conformance fixes (#3676)
The x402 wrapper could advertise a 402 and verify a payment, but never
settled it (the "exact" scheme needs verify + settle to actually move
funds), and its HTTPFacilitator sent no auth, so it could not use the
Coinbase CDP facilitator — the only one that settles Base mainnet. It
also passed the raw base64 X-PAYMENT string where facilitators expect the
decoded payload object.

- Add an optional Settler interface; HTTPFacilitator now implements
  Verify and Settle (POST /verify then /settle), and Require settles a
  verified payment and emits the settlement reference.
- HTTPFacilitator.Authorize hook + x402.CDP(keyID, secret) constructor:
  mint a short-lived Ed25519 Bearer JWT (stdlib crypto only, no chain
  code, no new dependency) so verify/settle authenticate to CDP.
- Decode the X-PAYMENT payload to the object facilitators expect, with
  passthrough for non-JSON payloads.
- Requirements gains extra (EIP-712 domain) and mimeType; the asset and
  its {name,version} are auto-filled for known networks so clients can
  sign. NormalizeNetwork maps base/base-sepolia to CAIP-2 ids.
- Accept the v2 PAYMENT-SIGNATURE request header and emit both
  X-PAYMENT-RESPONSE and PAYMENT-RESPONSE.

Backward compatible: the default network stays "base", the Facilitator
interface is unchanged (Settler is additive), and gateway/mcp builds and
tests unchanged. Adds tests for settle, CDP JWT, header aliases, extra,
and payload decoding.
2026-07-02 14:18:53 +01:00
Asim Aslam c13ff9fc98 docs(priorities): refresh planner queue (#3672)
Co-authored-by: Codex <codex@openai.com>
2026-07-02 13:52:31 +01:00
Asim Aslam 6e010706ec harness: suppress duplicate universe notifications (#3669)
Co-authored-by: Codex <codex@openai.com>
2026-07-02 13:26:43 +01:00
Asim Aslam 75615e81ca docs(priorities): refresh planner queue (#3666)
Co-authored-by: Codex <codex@openai.com>
2026-07-02 13:02:25 +01:00
Asim Aslam 097a4f6f9f harness: make plan delegate side effects idempotent (#3664)
Co-authored-by: Codex <codex@openai.com>
2026-07-02 12:33:08 +01:00
Asim Aslam 898853d948 docs(priorities): refresh planner queue (#3660)
Co-authored-by: Codex <codex@openai.com>
2026-07-02 11:29:28 +01:00
Asim Aslam 573e043cb1 blog: introduce micro loop (#33) (#3659)
A detailed post on `micro loop` — the autonomous loop that builds Go Micro,
now shippable as a command. Covers the mechanism/policy split (Actions as the
runtime, prompt files as editable policy), the five roles, the quickstart and
the two things the CLI can't do (token + branch protection), the load-bearing
decisions and the gotchas we hit (fresh-issue-per-run, bot-comment gating, the
persist-credentials 403), and the dogfood: Go Micro now runs on it. Sequel to
/blog/31 "How Go Micro Builds Itself".


Claude-Session: https://claude.ai/code/session_01CmdEY7pYmV5zzwCjNJ4ykL

Co-authored-by: Claude <noreply@anthropic.com>
2026-07-02 11:19:09 +01:00
Asim Aslam 76961d503a feat(loop): go-micro runs on micro loop (dogfood its own tool) (#3657)
* feat(loop): go-micro now runs on `micro loop` (dogfood its own tool)

Replace go-micro's five hand-written loop workflows with ones generated by
`micro loop init --roles all`, making "go-micro builds itself with micro loop"
literally true rather than aspirational.

- Generate loop-planner/builder/triage/coherence/release.yml via the CLI with
  go-micro's cadence and wiring (planner :59, builder :29, coherence 07:00,
  release 23:00; CI gate "Harness (E2E)"; token CODEX_TRIGGER_TOKEN; base master;
  tag prefix v). The old loop-architect.yml and loop-devrel.yml become
  loop-planner.yml and loop-coherence.yml.
- Move the queue to .github/loop/PRIORITIES.md and add .github/loop/NORTH_STAR.md
  (a concise steer pointing to internal/docs/THESIS.md), adopting the loop's
  convention.
- Preserve go-micro's rich instructions as editable policy in
  .github/loop/prompts/{planner,builder,triage,coherence}.md — the architect
  founder-lens + adoption steer, the increment builder, harness-failure triage,
  and the DevRel changelog/blog pass — faithfully ported from the old inline
  prompts. Behavior is preserved; only the mechanism is now generated.
- CLI refinement the migration surfaced: prompts (and NORTH_STAR/PRIORITIES) are
  now write-once — `micro loop init --force` refreshes workflow MECHANICS but
  never clobbers customized POLICY. Added renderKeep + a test.
- Update internal/docs/CONTINUOUS_IMPROVEMENT.md (renamed workflows, moved queue,
  the prompt-file model, and a note that these files are generated by micro loop).

Verified: build, go test ./cmd/micro/loop/..., golangci-lint (0 issues), gofmt;
`micro loop verify` passes; all generated workflows are valid YAML; re-running
init --force is idempotent and preserves policy.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CmdEY7pYmV5zzwCjNJ4ykL

* loop: strip prompt editorial comments before posting to the agent

Verification of the migration surfaced that a dispatch workflow posted the
prompt file's leading <!-- editorial --> header to the agent, and __ISSUE__
inside it got substituted too (e.g. "Keep 4242 literal"). Harmless (invisible
in rendered markdown) but unclean and mildly confusing. The dispatch and triage
body construction now strips <!-- --> blocks with `sed '/<!--/,/-->/d'` before
substituting runtime tokens. Regenerated go-micro's workflows; added a test.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CmdEY7pYmV5zzwCjNJ4ykL

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-07-02 11:14:21 +01:00
Asim Aslam f839ca7427 feat(cli): prompt-file-driven micro loop + coherence & release roles (#3655)
Rework `micro loop` so the workflows are the mechanism and each dispatch role's
instruction is an editable .github/loop/prompts/<role>.md file (the policy).
That split lets any repo — including go-micro itself — customize behavior by
editing prompt files instead of forking the CLI, which is the prerequisite for
go-micro consuming its own tool without losing its richer prompts.

- Add two opt-in roles: `coherence` (README/docs/CHANGELOG alignment) and
  `release` (cut the next patch tag on new commits; bakes in the
  persist-credentials:false fix so the PAT push isn't clobbered by the
  checkout token — the 403 we hit on the live release action).
- `--roles` selects which roles to scaffold (default planner,builder,triage;
  `all` for everything); `--tag-prefix`, `--release-cron`, `--coherence-cron`
  added. Templates keep the << >> delimiters so GHA ${{ }} passes through;
  prompts leave __ISSUE__/__RUNURL__ as runtime tokens the workflow substitutes.
- `micro loop verify` now checks each present role workflow has its prompt.
- README updated with the five roles and a copy-pasteable flag example
  (folds in the readability fix from the now-closed #3651).

Verified: build, `go test ./cmd/micro/loop/...`, vet, golangci-lint (0 issues),
gofmt; and an end-to-end `micro loop init --roles all` whose generated
workflows all parse as valid YAML and pass `micro loop verify`.


Claude-Session: https://claude.ai/code/session_01CmdEY7pYmV5zzwCjNJ4ykL

Co-authored-by: Claude <noreply@anthropic.com>
2026-07-02 10:47:49 +01:00
Asim Aslam fb1888efb7 docs: connect quickstart to first agent path (#3656)
Co-authored-by: Codex <codex@openai.com>
2026-07-02 10:47:19 +01:00
Asim Aslam 5f3244d09e feat(cli): add micro loop to scaffold a self-improving repo loop (#3649)
`micro loop init` writes an autonomous improvement loop into any repository —
the same planner/builder/triage loop that maintains go-micro, generalized:

- planner (loop-planner.yml): keeps a ranked queue in .github/loop/PRIORITIES.md
- builder (loop-builder.yml): builds the top open item as a single-concern PR,
  auto-merged on green CI
- triage (loop-triage.yml): turns CI failures into scoped fix issues

plus .github/loop/NORTH_STAR.md (direction) and PRIORITIES.md (queue).

The agent adapter is mention-based, not hardcoded to Codex: `--agent @codex`
(or any @mention agent that responds on an issue and can run gh), `--token-secret`,
`--branch`, `--ci-workflow`, and cron flags are the whole config-vs-core boundary.
Templates use << >> delimiters so GitHub Actions' own ${{ }} expressions pass
through untouched. `micro loop verify` checks the wiring and flags the two things
the CLI can't: the token secret and branch protection (the green-CI gate).

Built inside go-micro with the config/core split already drawn, so the workflows
can later be extracted to a standalone reusable-workflows repo without a rewrite.


Claude-Session: https://claude.ai/code/session_01CmdEY7pYmV5zzwCjNJ4ykL

Co-authored-by: Claude <noreply@anthropic.com>
2026-07-02 10:12:12 +01:00
Asim Aslam 1e932321c8 docs(priorities): refresh architect queue (#3650)
Co-authored-by: Codex <codex@openai.com>
2026-07-02 10:11:01 +01:00
Asim Aslam a24eaad1c9 docs: roll changelog for v6.3.12 (#3646)
Co-authored-by: Codex <codex@openai.com>
2026-07-02 09:16:05 +01:00
Asim Aslam 357fdf2777 docs: surface first agent on-ramp (#3644)
Co-authored-by: Codex <codex@openai.com>
2026-07-02 08:52:09 +01:00
Asim Aslam a66fb4ff2c docs(priorities): refresh architect adoption queue (#3641)
Co-authored-by: Codex <codex@openai.com>
2026-07-02 08:16:31 +01:00
Asim Aslam 8e3ba68d58 loop-release: fix 403 on tag push (checkout token clobbered the PAT) (#3638)
goreleaser / goreleaser (push) Waiting to run
* docs: complete Ollama provider surface (capability matrix, README, example fixes)

Follow-up cleanup after merging the Ollama provider (#3636):

- Add the `ollama` row to the AI provider capability matrix in the provider
  guide, and blank-import `ai/ollama` in provider_capabilities_test.go so the
  matrix stays enforced against the registry (the provider registers a stream
  but wasn't imported in that test, so its row went unchecked).
- README: bump "7 LLM providers" → 8 and list Ollama (local + cloud); add its
  default model (`llama3.2`) to the model table.
- Fix a fictional model name shipped in the example and package doc:
  `gemma4:31b-cloud` → `gpt-oss:120b`. gemma4 doesn't exist, and the `-cloud`
  suffix is for cloud models proxied through a local Ollama, not the direct
  ollama.com/v1 endpoint the example uses.
- Record the provider and the new agent.BaseURL/micro.AgentBaseURL option in
  the CHANGELOG [Unreleased] section.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CmdEY7pYmV5zzwCjNJ4ykL

* loop-release: don't let checkout's persisted GITHUB_TOKEN clobber the PAT push

The daily release job computed the next tag correctly but the tag push 403'd:
"Permission to micro/go-micro.git denied to github-actions[bot]" (run
28554612450). Cause: actions/checkout persists the default GITHUB_TOKEN as an
http.extraheader Authorization credential for github.com, which git sends on
ALL requests to that host — including our manual
`git push https://x-access-token:${PAT}@github.com/...`. The persisted header
overrides the URL-embedded PAT, so the push authenticates as
github-actions[bot], which can't push tags (the job only grants
contents: read).

Set persist-credentials: false so no extraheader is written and the PAT in the
push URL is the only credential used.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CmdEY7pYmV5zzwCjNJ4ykL

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-07-02 07:51:31 +01:00
Asim Aslam 6e04f1afb5 docs: complete Ollama provider surface (capability matrix, README, example fixes) (#3637)
Follow-up cleanup after merging the Ollama provider (#3636):

- Add the `ollama` row to the AI provider capability matrix in the provider
  guide, and blank-import `ai/ollama` in provider_capabilities_test.go so the
  matrix stays enforced against the registry (the provider registers a stream
  but wasn't imported in that test, so its row went unchecked).
- README: bump "7 LLM providers" → 8 and list Ollama (local + cloud); add its
  default model (`llama3.2`) to the model table.
- Fix a fictional model name shipped in the example and package doc:
  `gemma4:31b-cloud` → `gpt-oss:120b`. gemma4 doesn't exist, and the `-cloud`
  suffix is for cloud models proxied through a local Ollama, not the direct
  ollama.com/v1 endpoint the example uses.
- Record the provider and the new agent.BaseURL/micro.AgentBaseURL option in
  the CHANGELOG [Unreleased] section.


Claude-Session: https://claude.ai/code/session_01CmdEY7pYmV5zzwCjNJ4ykL

Co-authored-by: Claude <noreply@anthropic.com>
2026-07-02 07:44:58 +01:00
YongSoo Park 110cb44d41 feat: add Ollama provider with local and cloud support (#3636)
Add a dedicated Ollama AI provider (ai/ollama/) that auto-detects
local vs cloud mode based on the base URL:

- Local Ollama: native /api/chat endpoint with NDJSON streaming
- Ollama Cloud: OpenAI-compatible /v1/chat/completions with SSE streaming

Both modes support tool calls with a multi-round execution loop.

Add agent.BaseURL option so agents can point at non-default LLM
endpoints (e.g. local Ollama, proxies). Wire it through micro.AgentBaseURL
at the top level.

Include a complete example (examples/agent-ollama/) demonstrating a
knowledge-base service with auto-discovered tools, a custom time tool,
streaming, and env-var configuration for local vs cloud.

Closes #3632
2026-07-02 07:37:36 +01:00
Asim Aslam f06e7467ce ci: smoke test installer first-run CLI (#3635)
Co-authored-by: Codex <codex@openai.com>
2026-07-02 07:00:45 +01:00
Asim Aslam 412491568f docs(priorities): refresh architect adoption queue (#3631)
Co-authored-by: Codex <codex@openai.com>
2026-07-02 06:28:17 +01:00
Asim Aslam d2e1520a14 Verify zero-to-hero reference app in harness (#3628)
Co-authored-by: Codex <codex@openai.com>
2026-07-02 04:56:41 +01:00
Asim Aslam 0a18ac6c15 docs(priorities): refresh architect queue (#3624)
Co-authored-by: Codex <codex@openai.com>
2026-07-02 04:15:41 +01:00
Asim Aslam 45a23a3417 test first-agent walkthrough boundaries (#3621)
Co-authored-by: Codex <codex@openai.com>
2026-07-02 03:31:30 +01:00
Asim Aslam ae239b0102 docs(priorities): refresh architect queue (#3619)
Co-authored-by: Codex <codex@openai.com>
2026-07-02 02:53:21 +01:00
Asim Aslam 3a2d21f1ac agent: dedupe plan delegate tool side effects (#3616)
Co-authored-by: Codex <codex@openai.com>
2026-07-02 02:35:18 +01:00
Asim Aslam 40a559e8db Harden universe notify finalization (#3612)
Co-authored-by: Codex <codex@openai.com>
2026-07-02 01:08:12 +01:00
Asim Aslam 28320fc1d4 cli: add first-agent preflight diagnostics (#3608)
Co-authored-by: Codex <codex@openai.com>
2026-07-02 00:02:53 +01:00
Asim Aslam cbc8fc62c7 docs(priorities): refresh architect adoption queue (#3605)
Co-authored-by: Codex <codex@openai.com>
2026-07-01 23:39:48 +01:00
Asim Aslam 1f93fa8b1b docs: expose zero-to-hero on-ramp (#3602)
Co-authored-by: Codex <codex@openai.com>
2026-07-01 23:09:17 +01:00
Asim Aslam c6f9940ab2 docs(priorities): refresh architect adoption queue (#3599)
Co-authored-by: Codex <codex@openai.com>
2026-07-01 22:42:02 +01:00
Asim Aslam 9c66455d2a docs: add agent debugging guide (#3596)
Co-authored-by: Codex <codex@openai.com>
2026-07-01 22:13:48 +01:00
Asim Aslam 2215065a2e docs(priorities): refresh architect queue (#3593)
Co-authored-by: Codex <codex@openai.com>
2026-07-01 21:45:21 +01:00
Asim Aslam f8b8b90a3b docs: lead guides nav with hands-on path (#3591)
Co-authored-by: Codex <codex@openai.com>
2026-07-01 21:21:39 +01:00
Asim Aslam 1bcf0e1ae9 docs(priorities): drop completed examples task (#3587)
Co-authored-by: Codex <codex@openai.com>
2026-07-01 20:41:31 +01:00
Asim Aslam b49f5072b1 loop: have DevRel maintain CHANGELOG.md and draft a changelog blog post (#3584)
The DevRel pass now keeps the changelog living instead of letting it drift:
each daily run reconciles a Keep-a-Changelog `[Unreleased]` section against the
PRs that actually merged (user-facing entries only; internal loop/CI churn
skipped) and rolls it into a dated version heading whenever loop-release cuts a
new v6.MINOR.PATCH tag. When enough user-facing work has accumulated (roughly a
week's worth, not a near-empty post every day) it also drafts a "what's new"
changelog blog post narrating what shipped.

Autonomy boundary preserved: CHANGELOG.md upkeep is a safe factual change and
rides the auto-merged DevRel PR; the changelog blog post is opened as its own
PR but left for the human to review/merge, since blog voice stays with the human.

Also fix the CHANGELOG preamble: it claimed calendar versions (YYYY.MM) while
tags are semver (v6.MINOR.PATCH). Correct it, add an `[Unreleased]` section
seeded from real recent work, and note the historical 2026.0x headings.


Claude-Session: https://claude.ai/code/session_01CmdEY7pYmV5zzwCjNJ4ykL

Co-authored-by: Claude <noreply@anthropic.com>
2026-07-01 20:29:53 +01:00
Asim Aslam 63ebe6ab9c docs: surface runnable lifecycle examples (#3585)
Co-authored-by: Codex <codex@openai.com>
2026-07-01 20:25:33 +01:00
Asim Aslam f192c4947c docs(priorities): drop completed install task (#3581)
Co-authored-by: Codex <codex@openai.com>
2026-07-01 19:46:45 +01:00
Asim Aslam 7fd749b475 docs: lead v6 installs with latest (#3579)
Co-authored-by: Codex <codex@openai.com>
2026-07-01 19:24:10 +01:00
Asim Aslam dfe9e436e8 docs(priorities): remove completed first-agent task (#3576)
Co-authored-by: Codex <codex@openai.com>
2026-07-01 18:42:38 +01:00
Asim Aslam 72902ee6fb docs: add your first agent walkthrough (#3574)
Co-authored-by: Codex <codex@openai.com>
2026-07-01 18:27:36 +01:00
Asim Aslam 819403e940 docs(priorities): prioritize adoption on-ramp (#3571)
Co-authored-by: Codex <codex@openai.com>
2026-07-01 17:58:27 +01:00
Asim Aslam 58284c6230 harness: extend live provider deadlines (#3569)
Co-authored-by: Codex <codex@openai.com>
2026-07-01 17:33:29 +01:00
Asim Aslam 66ce68a93f community: add Discord to nav/footer/README/landing; fix stale invite code (#3567)
There was no working, prominent Discord link. Update the stale invite code
(WeMU5AGxD → G8Gk5j3uXr) everywhere it appeared (README, docs, blog, landing,
SECURITY, issue templates, contrib), and add the link prominently: the site
nav and footer includes (so it shows on every landing/docs/blog page), a
Discord badge + a Community line in the README, and a "Join Discord" button on
the landing.

Co-authored-by: Claude <noreply@anthropic.com>
2026-07-01 17:01:29 +01:00
Asim Aslam 4bd181fc21 loop: point the architect at adoption + add a daily release action (#3566)
The framework's depth is strong but the on-ramp is the adoption gap, and the
architect queue had filled entirely with internal hardening. Steer the
architect to weight the developer on-ramp/DX (first-agent tutorial,
discoverable examples, docs wayfinding, install friction, debugging) at least
as highly as internal work — a developer succeeding on their first agent
matters more than another conformance/observability increment. Adoption issues
filed: #3561-#3565.

Also add loop-release.yml: a daily patch release that tags v6.MINOR.PATCH+1
when master has new commits (pushed with the PAT so goreleaser fires), so the
installable framework tracks the loop's daily improvements instead of lapsing.
Minor/major bumps stay with the human.

Co-authored-by: Claude <noreply@anthropic.com>
2026-07-01 16:38:28 +01:00
Asim Aslam 3143767d78 docs(priorities): refresh architect queue (#3557)
goreleaser / goreleaser (push) Waiting to run
Co-authored-by: Codex <codex@openai.com>
2026-07-01 16:05:37 +01:00
Asim Aslam 666fc4b794 ci+docs: name the loop workflows by role (planner/generator/evaluator) (#3556)
Rename the autonomous-loop workflows so the Actions list maps to the
long-running-agent harness pattern (planner → generator → evaluator):
  architecture-review.yml   -> loop-architect.yml   "Loop: Architect (Planner)"
  continuous-improvement.yml -> loop-builder.yml     "Loop: Builder (Generator)"
  devrel-review.yml          -> loop-devrel.yml      "Loop: DevRel"
  harness-triage.yml         -> loop-triage.yml      "Loop: Triage (Evaluator feedback)"
harness.yml stays the shared Evaluator/CI gate (triage still matches it by the
"Harness (E2E)" name). Document the pipeline + role mapping in
CONTINUOUS_IMPROVEMENT.md, and point to it from CONTRIBUTING so the development
process is discoverable. No behavior change — schedules, gates, and required
checks are unaffected.

Co-authored-by: Claude <noreply@anthropic.com>
2026-07-01 15:59:46 +01:00
Asim Aslam 7af73b06d7 ci: auto-triage harness failures into fix issues (hill-climbing loop) (#3549)
Close the loop's feedback path: when the live provider-conformance harness
fails, harness-triage.yml dispatches Codex to triage the failing run — read
logs, root-cause, dedupe against open issues, and file scoped codex/enhancement
issues that the hourly increment loop then fixes and the next harness run
verifies. Transient flakes are ignored; breaking/architectural fixes are
escalated as needs-human rather than auto-built. No human in the middle short
of a genuine judgment call. Documented in CONTINUOUS_IMPROVEMENT.md.

Co-authored-by: Claude <noreply@anthropic.com>
2026-07-01 15:51:55 +01:00
Asim Aslam 0811234f3e agent: execute text tool call fallbacks (#3554)
Co-authored-by: Codex <codex@openai.com>
2026-07-01 15:27:14 +01:00
Asim Aslam b64a7d248d docs(priorities): refresh architect queue (#3551)
Co-authored-by: Codex <codex@openai.com>
2026-07-01 14:55:43 +01:00
Asim Aslam e7b08d914f docs(priorities): refresh architect queue (#3545)
Co-authored-by: Codex <codex@openai.com>
2026-07-01 14:03:04 +01:00
Asim Aslam 3a9455f28c harness: label provider conformance phases (#3542)
Co-authored-by: Codex <codex@openai.com>
2026-07-01 12:46:11 +01:00
Asim Aslam 05e53ec38c ci: run the live provider-conformance harness hourly, not daily (#3540)
Match the real-model conformance cadence to the dev/loop velocity so live
regressions and provider drift surface within the hour instead of up to 24h.
The mock harness already runs on every push/PR; this only changes the live
(credentialed) schedule.

Co-authored-by: Claude <noreply@anthropic.com>
2026-07-01 12:35:36 +01:00
Asim Aslam dbdd0e1d6f atlascloud: run provider conformance on a stronger (env-selectable) model (#3538)
* atlascloud: env-selectable chat model; run conformance on a stronger model

The daily provider-conformance harness fails 4/5 harnesses on Atlas Cloud —
its default chat model answers agent/tool-use conformance prompts
conversationally instead of performing the task. Atlas is currently the only
provider with a key configured, so the whole live run is red.

Make the Atlas Cloud provider honor an ATLASCLOUD_MODEL env override (falling
back to the existing default), and set it in the harness workflow to a
stronger tool-use model (Qwen3, overridable via an Actions variable). No
change to the default for normal use.

* atlascloud: use minimaxai/minimax-m3 for conformance model

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-07-01 12:17:12 +01:00
Asim Aslam 8146e29f7e docs(priorities): refresh architect queue (#3539)
Co-authored-by: Codex <codex@openai.com>
2026-07-01 12:10:17 +01:00
Asim Aslam c110774dc7 Add opt-in retries for agent tool calls (#3535)
Co-authored-by: Codex <codex@openai.com>
2026-07-01 10:57:33 +01:00
Asim Aslam c0a5775fb5 docs(priorities): refresh architect queue (#3533)
Co-authored-by: Codex <codex@openai.com>
2026-07-01 10:12:45 +01:00
Asim Aslam f844a23bb2 docs: align public AI harness facts (#3531)
Co-authored-by: Codex <codex@openai.com>
2026-07-01 09:40:28 +01:00
Asim Aslam 04e8759d41 test agent checkpoint resume after restart (#3529)
Co-authored-by: Codex <codex@openai.com>
2026-07-01 09:06:46 +01:00
Asim Aslam 78725135aa docs(priorities): refresh architect queue (#3527)
Co-authored-by: Codex <codex@openai.com>
2026-07-01 08:33:01 +01:00
Asim Aslam 2ff64ff0b2 Document canonical 0-to-hero reference path (#3522)
Co-authored-by: Codex <codex@openai.com>
2026-07-01 07:12:17 +01:00
Asim Aslam 7a8e7cd9ae docs(priorities): advance queue to 0-to-hero reference (#3520)
Co-authored-by: Codex <codex@openai.com>
2026-07-01 06:37:15 +01:00
Asim Aslam b58eed1698 Add retrieval-backed agent memory (#3518)
Co-authored-by: Codex <codex@openai.com>
2026-07-01 04:59:16 +01:00
Asim Aslam c92c9cc244 docs(priorities): refresh architect queue (#3516)
Co-authored-by: Codex <codex@openai.com>
2026-07-01 04:06:59 +01:00
Asim Aslam a2bf43e9ef test: broaden stream provider conformance (#3512)
Co-authored-by: Codex <codex@openai.com>
2026-07-01 03:37:26 +01:00
Asim Aslam 49bac7e4a8 trace scheduled flow dispatch metadata (#3510)
Co-authored-by: Codex <codex@openai.com>
2026-07-01 02:42:31 +01:00
Asim Aslam 5aac7e3ca0 docs(priorities): refresh architect queue after scheduling (#3507)
Co-authored-by: Codex <codex@openai.com>
2026-07-01 01:51:21 +01:00
Asim Aslam d86585bf5c Add scheduled flow agent harness (#3505)
Co-authored-by: Codex <codex@openai.com>
2026-07-01 01:02:29 +01:00
Asim Aslam 88e2b58711 docs(priorities): refresh architect queue (#3503)
Co-authored-by: Codex <codex@openai.com>
2026-07-01 00:38:51 +01:00
Asim Aslam d259383645 Harden agent terminal failure statuses (#3499)
Co-authored-by: Codex <codex@openai.com>
2026-07-01 00:03:21 +01:00
Asim Aslam 2d7ee300a4 docs(priorities): refresh architect queue after conformance (#3497)
Co-authored-by: Codex <codex@openai.com>
2026-06-30 23:40:19 +01:00
Asim Aslam 57fa4e3b7a Add mock provider conformance target (#3495)
Co-authored-by: Codex <codex@openai.com>
2026-06-30 23:09:19 +01:00
Asim Aslam 0f1917f26b docs(priorities): refresh architect queue after verification (#3493)
Co-authored-by: Codex <codex@openai.com>
2026-06-30 22:40:05 +01:00
Asim Aslam 6e9c5e87e9 Add flow step verification loop (#3489)
Co-authored-by: Codex <codex@openai.com>
2026-06-30 22:18:01 +01:00
Asim Aslam d8bb892425 docs(priorities): refresh architect queue after a2a continuity (#3487)
Co-authored-by: Codex <codex@openai.com>
2026-06-30 21:37:56 +01:00
Asim Aslam 064a112c6b a2a: expose resubscribe and input-required support (#3484)
Co-authored-by: Codex <codex@openai.com>
2026-06-30 21:23:43 +01:00
Asim Aslam 24d103c658 docs(priorities): refresh architect queue after memory (#3482)
Co-authored-by: Codex <codex@openai.com>
2026-06-30 20:47:39 +01:00
Asim Aslam 2d8e3da943 blog: expand /blog/32 into a field guide on agent frameworks (#3478)
* blog+docs: drop the word "bet" from the tRPC-Agent-Go comparison

Reword "two bets" / "opposite bet" / "the bet is" to approaches / premise /
principle across blog/32 and the comparison guide.

* blog: expand /blog/32 into a field guide on agent frameworks

Roughly double the length with deeper context: the first wave (LangChain &
co.), the two layers of a harness (intra-agent vs operational), loop
engineering and the move to scheduled/looping/work-performing agents, a
survey of where the frameworks are going (LangGraph, CrewAI, AutoGen, ADK,
tRPC-Agent-Go), then Go Micro's "an agent is a service" position, the honest
tRPC-Agent-Go contrast, and MCP/A2A interop. Drops the word "bet" throughout.

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-06-30 20:20:14 +01:00
Asim Aslam 3081dab246 Add agent memory summarizer hook (#3479)
Co-authored-by: Codex <codex@openai.com>
2026-06-30 20:18:23 +01:00
Asim Aslam fdc422c16e blog+docs: position go-micro vs tRPC-Agent-Go (agent = service) (#3475)
Add a fair, honest positioning piece on the architectural fork with
tRPC-Agent-Go (an agent SDK alongside your services / graph DSL) vs Go Micro
(one runtime where an agent is a service, every endpoint a tool, durable
flows not a graph DSL). New blog post /blog/32 + a parallel section in the
existing comparison guide; honest about where tRPC-Agent-Go is ahead
(eval, self-evolution, RAG) and that they interoperate over MCP/A2A.

Co-authored-by: Claude <noreply@anthropic.com>
2026-06-30 19:45:52 +01:00
Asim Aslam 5e3f8db193 docs(priorities): refresh architect queue for memory (#3476)
Co-authored-by: Codex <codex@openai.com>
2026-06-30 19:41:17 +01:00
Asim Aslam f5bf5f7987 Wire A2A streaming through agent StreamAsk (#3471)
Co-authored-by: Codex <codex@openai.com>
2026-06-30 19:18:23 +01:00
Asim Aslam 3ec12b7c72 Trace agent checkpoint resume events (#3468)
Co-authored-by: Codex <codex@openai.com>
2026-06-30 18:22:00 +01:00
Asim Aslam fa4d4b7f6a docs(priorities): refresh architect queue after failure hardening (#3466)
Co-authored-by: Codex <codex@openai.com>
2026-06-30 17:50:23 +01:00
Asim Aslam 43beaafab5 flow: classify workflow failure kinds (#3464)
Co-authored-by: Codex <codex@openai.com>
2026-06-30 17:30:45 +01:00
Asim Aslam 21a20005cb docs(priorities): refresh architect queue (#3462)
Co-authored-by: Codex <codex@openai.com>
2026-06-30 16:51:07 +01:00
Asim Aslam e1b3c587aa Add configurable provider conformance dispatch (#3459)
Co-authored-by: Codex <codex@openai.com>
2026-06-30 16:31:49 +01:00
Asim Aslam da2bbab80c docs(priorities): refresh architect queue (#3457)
Co-authored-by: Codex <codex@openai.com>
2026-06-30 15:55:52 +01:00
Asim Aslam 5a59e1ece4 agent: verify durable resume example (#3452)
Co-authored-by: Codex <codex@openai.com>
2026-06-30 15:26:32 +01:00
Asim Aslam aea03ba9e7 priorities: queue the flow verification/grader loop (#3435) (#3436)
Add the verification loop as a ranked priority — the one missing layer from
the four-loop framing (agent / verification / event-driven / hill-climbing):
flow.Verify + flow.LLMGrader to grade a step's output against a rubric and
retry with feedback. The architect will re-rank on its next pass.

Co-authored-by: Claude <noreply@anthropic.com>
2026-06-30 15:17:18 +01:00
Asim Aslam 54bc05e48f docs(priorities): advance agent durability queue (#3450)
Co-authored-by: Codex <codex@openai.com>
2026-06-30 14:40:14 +01:00
Asim Aslam 3ef0d98a16 flow: analyze run traces for optimization (#3447)
Co-authored-by: Codex <codex@openai.com>
2026-06-30 14:25:15 +01:00
Asim Aslam 5a6c8d8b30 docs(priorities): advance architect queue (#3445)
Co-authored-by: Codex <codex@openai.com>
2026-06-30 13:41:58 +01:00
Asim Aslam 1cd918c2b9 flow: add verification grader loop (#3443)
Co-authored-by: Codex <codex@openai.com>
2026-06-30 13:28:53 +01:00
Asim Aslam e96d4a67bc docs(priorities): refresh architect queue (#3441)
Co-authored-by: Codex <codex@openai.com>
2026-06-30 13:09:37 +01:00
Asim Aslam 8994fd03f6 Add A2A fallback provider conformance harness (#3438)
Co-authored-by: Codex <codex@openai.com>
2026-06-30 12:37:40 +01:00
Asim Aslam 0595130f16 run: surface MCP tools in the micro run banner by default (#3434)
The gateway already serves /mcp/tools on :8080 unconditionally (every
endpoint is an AI-callable tool), but the startup banner only printed an MCP
line when --mcp-address was set — so the live `micro run` experience hid the
harness's signature feature even though it was running, and didn't match the
README. Always advertise MCP Tools on the gateway address; keep the optional
standalone MCP-protocol server (--mcp-address) as a clearly separate line.
No behavior change — banner output only.

Co-authored-by: Claude <noreply@anthropic.com>
2026-06-30 11:21:26 +01:00
Asim Aslam 37eccc425e docs(priorities): advance provider conformance queue (#3433)
Co-authored-by: Codex <codex@openai.com>
2026-06-30 11:14:39 +01:00
Asim Aslam 010e0fe57c Classify agent run failure summaries (#3430)
Co-authored-by: Codex <codex@openai.com>
2026-06-30 10:55:14 +01:00
Asim Aslam 113f268268 docs: align DevRel public surface facts (#3428)
Co-authored-by: Codex <codex@openai.com>
2026-06-30 09:26:20 +01:00
Asim Aslam c10697f08d docs(priorities): advance resilience queue (#3427)
Co-authored-by: Codex <codex@openai.com>
2026-06-30 09:25:32 +01:00
Asim Aslam f61f3dc04d test: add AI stream provider conformance (#3423)
Co-authored-by: Codex <codex@openai.com>
2026-06-30 08:56:12 +01:00
Asim Aslam d9e6c68938 docs(priorities): refresh architect queue (#3421)
Co-authored-by: Codex <codex@openai.com>
2026-06-30 07:40:48 +01:00
Asim Aslam 8847668c83 Improve agent telemetry error classification (#3418)
Co-authored-by: Codex <codex@openai.com>
2026-06-30 07:06:38 +01:00
Asim Aslam e45bf3d114 docs(priorities): remove completed durable resume item (#3416)
Co-authored-by: Codex <codex@openai.com>
2026-06-30 05:50:51 +01:00
Asim Aslam 98d1f58cd6 Add durable agent resume example (#3414)
Co-authored-by: Codex <codex@openai.com>
2026-06-30 04:56:14 +01:00
Asim Aslam 51158ed2a7 docs(priorities): refresh architect queue (#3412)
Co-authored-by: Codex <codex@openai.com>
2026-06-30 04:04:11 +01:00
Asim Aslam 09bf82d4f6 fix a2a stream fallback (#3410)
Co-authored-by: Codex <codex@openai.com>
2026-06-30 03:26:42 +01:00
Asim Aslam 7d77f31ae2 docs(priorities): advance architect queue (#3408)
Co-authored-by: Codex <codex@openai.com>
2026-06-30 02:47:16 +01:00
Asim Aslam 2dbf70d0ed Guard terminal agent checkpoints on resume (#3406)
Co-authored-by: Codex <codex@openai.com>
2026-06-30 02:34:43 +01:00
Asim Aslam 136c24ad5f docs(priorities): advance architect queue (#3404)
Co-authored-by: Codex <codex@openai.com>
2026-06-30 01:28:16 +01:00
Asim Aslam dc93addb10 ci: consolidate developer flow harness (#3399)
Co-authored-by: Codex <codex@openai.com>
2026-06-30 00:59:24 +01:00
Asim Aslam 09b4b8cc85 docs(priorities): drop shipped reliability item (#3397)
Co-authored-by: Codex <codex@openai.com>
2026-06-30 00:29:11 +01:00
Asim Aslam 7b8139ca3c Harden agent tool execution timeouts (#3395)
Co-authored-by: Codex <codex@openai.com>
2026-06-29 23:55:43 +01:00
Asim Aslam ea6f7f6976 docs(priorities): refresh architect queue (#3393)
Co-authored-by: Codex <codex@openai.com>
2026-06-29 23:32:10 +01:00
Asim Aslam b25a9171c5 ci: fold agent checks into provider conformance (#3389)
Co-authored-by: Codex <codex@openai.com>
2026-06-29 23:08:09 +01:00
Asim Aslam 2fe4eb71d1 docs(priorities): refresh architect queue (#3387)
Co-authored-by: Codex <codex@openai.com>
2026-06-29 22:37:54 +01:00
Asim Aslam c4e110c77f Add deploy dry-run harness checkpoint (#3384)
Co-authored-by: Codex <codex@openai.com>
2026-06-29 22:14:28 +01:00
Asim Aslam e4bb9d6bc7 docs(priorities): refresh architect queue (#3382)
Co-authored-by: Codex <codex@openai.com>
2026-06-29 21:43:53 +01:00
Asim Aslam 562deb0557 docs(examples): maintain zero-to-hero support path (#3379)
Co-authored-by: Codex <codex@openai.com>
2026-06-29 21:24:45 +01:00
Asim Aslam 551beb0858 docs(priorities): remove completed A2A skill item (#3377)
Co-authored-by: Codex <codex@openai.com>
2026-06-29 20:44:39 +01:00
Asim Aslam d831ba2c45 Add typed A2A skill endpoints (#3375)
Co-authored-by: Codex <codex@openai.com>
2026-06-29 20:21:41 +01:00
Asim Aslam a14633b9e8 docs(priorities): remove completed human-input item (#3373)
Co-authored-by: Codex <codex@openai.com>
2026-06-29 19:45:54 +01:00
Asim Aslam 4cc1ebb315 Document canceled human-input resumes (#3371)
Co-authored-by: Codex <codex@openai.com>
2026-06-29 19:24:26 +01:00
Asim Aslam 38ff084756 docs(priorities): refresh architect queue (#3369)
Co-authored-by: Codex <codex@openai.com>
2026-06-29 19:07:01 +01:00
Asim Aslam 585dd789a4 Redact agent run inputs from traces (#3366)
Co-authored-by: Codex <codex@openai.com>
2026-06-29 18:31:20 +01:00
Asim Aslam 971bfdb954 agent: reuse tools instance in setupWithToolHandler (fix StreamAsk tool resolution) (#3365)
goreleaser / goreleaser (push) Waiting to run
2026-06-29 18:24:21 +01:00
Asim Aslam 57873cc5a5 docs(priorities): refresh architect queue (#3363)
Co-authored-by: Codex <codex@openai.com>
2026-06-29 18:04:52 +01:00
Asim Aslam 86bfced452 Wire getting-started harness into make (#3360)
Co-authored-by: Codex <codex@openai.com>
2026-06-29 16:58:29 +01:00
Asim Aslam 8863d27623 events: WithStore option for a durable, replayable stream (#3357)
goreleaser / goreleaser (push) Waiting to run
* events: add WithStore option for a durable stream

* events: honor injected store in NewStream
2026-06-29 15:25:14 +01:00
Asim Aslam efb4b3d191 docs(priorities): refresh architect queue (#3355)
Co-authored-by: Codex <codex@openai.com>
2026-06-29 14:27:42 +01:00
Asim Aslam b83b8d164f Add stream resume for agent checkpoints (#3352)
Co-authored-by: Codex <codex@openai.com>
2026-06-29 13:19:17 +01:00
Asim Aslam 11ff58fec7 docs(priorities): refresh architect queue (#3350)
Co-authored-by: Codex <codex@openai.com>
2026-06-29 12:41:44 +01:00
Asim Aslam f1504507a3 agent: add tool-aware stream ask (#3347)
Co-authored-by: Codex <codex@openai.com>
2026-06-29 11:13:52 +01:00
Asim Aslam a2a7ee17e0 docs(priorities): drop shipped memory item (#3345)
Co-authored-by: Codex <codex@openai.com>
2026-06-29 10:38:20 +01:00
Asim Aslam e704b0e61b docs(priorities): seed streaming-tools (#3341) and multi-skill a2a (#3342) (#3343)
Queue the Next-phase agent streaming item and the a2a multi-skill gap that
block a real consumer from retiring its bespoke planner / A2A handler. The
architecture-review pass re-ranks from here.
2026-06-29 10:26:14 +01:00
Asim Aslam 317bb300ae agent: harden compacted memory resume (#3339)
Co-authored-by: Codex <codex@openai.com>
2026-06-29 09:25:59 +01:00
Asim Aslam ca82b85955 Update architecture priorities after tracing (#3337)
Co-authored-by: Codex <codex@openai.com>
2026-06-29 08:44:29 +01:00
Asim Aslam a99c776880 gateway/mcp: configurable initialize (serverInfo, protocol version) + named not-found (#3335)
goreleaser / goreleaser (push) Waiting to run
* gateway/mcp: configurable initialize + named not-found

NewHandler takes HandlerOptions: WithServerInfo(name, version) and WithProtocolVersion set the initialize response so a product can brand the endpoint instead of advertising go-micro-mcp/2024-11-05. ManualResolver's not-found error now includes the tool name.

* gateway/mcp: configurable initialize + named not-found

NewHandler takes HandlerOptions: WithServerInfo(name, version) and WithProtocolVersion set the initialize response so a product can brand the endpoint instead of advertising go-micro-mcp/2024-11-05. ManualResolver's not-found error now includes the tool name.
2026-06-29 07:22:07 +01:00
Asim Aslam b8ca921ae8 gateway/mcp: richer resolver Call (CallResult/isError, coded errors) + notifications (#3334)
goreleaser / goreleaser (push) Waiting to run
* gateway/mcp: richer resolver Call + spec-correct HTTP handler

Resolver.Call now returns (*CallResult, error): a tool that ran but failed sets CallResult.IsError (returned as a tools/call result with isError:true, per the MCP spec), while a protocol/pre-check failure returns an error -- an *RPCError carries a specific JSON-RPC code. The HTTP handler also answers notifications/* (and id-less requests) with 204 and no body.

* gateway/mcp: richer resolver Call + spec-correct HTTP handler

Resolver.Call now returns (*CallResult, error): a tool that ran but failed sets CallResult.IsError (returned as a tools/call result with isError:true, per the MCP spec), while a protocol/pre-check failure returns an error -- an *RPCError carries a specific JSON-RPC code. The HTTP handler also answers notifications/* (and id-less requests) with 204 and no body.

* gateway/mcp: richer resolver Call + spec-correct HTTP handler

Resolver.Call now returns (*CallResult, error): a tool that ran but failed sets CallResult.IsError (returned as a tools/call result with isError:true, per the MCP spec), while a protocol/pre-check failure returns an error -- an *RPCError carries a specific JSON-RPC code. The HTTP handler also answers notifications/* (and id-less requests) with 204 and no body.
2026-06-29 07:19:39 +01:00
Asim Aslam 159963ab39 agent: trace model attempt metadata (#3333)
Co-authored-by: Codex <codex@openai.com>
2026-06-29 07:16:19 +01:00
Asim Aslam 59397834b4 gateway/mcp: swappable Resolver + mountable JSON-RPC HTTP handler (#3331)
goreleaser / goreleaser (push) Waiting to run
* gateway/mcp: swappable Resolver + mountable JSON-RPC HTTP handler

Adds a Resolver interface (Manual/Registry) so the tool source is
pluggable, and NewHandler(resolver) serving standard MCP JSON-RPC over
HTTP as an http.Handler you can mount on your own server. Neither
resolver exposes the internal store/broker tools. Additive — the
existing Serve() path is unchanged.

* gateway/mcp: swappable Resolver + mountable JSON-RPC HTTP handler

Adds a Resolver interface (Manual/Registry) so the tool source is
pluggable, and NewHandler(resolver) serving standard MCP JSON-RPC over
HTTP as an http.Handler you can mount on your own server. Neither
resolver exposes the internal store/broker tools. Additive — the
existing Serve() path is unchanged.

* gateway/mcp: swappable Resolver + mountable JSON-RPC HTTP handler

Adds a Resolver interface (Manual/Registry) so the tool source is
pluggable, and NewHandler(resolver) serving standard MCP JSON-RPC over
HTTP as an http.Handler you can mount on your own server. Neither
resolver exposes the internal store/broker tools. Additive — the
existing Serve() path is unchanged.
2026-06-29 07:03:23 +01:00
Asim Aslam ee996afd39 Update architecture priorities after streaming (#3330)
Co-authored-by: Codex <codex@openai.com>
2026-06-29 06:36:13 +01:00
Asim Aslam 236c5851c2 Add OpenAI-compatible streaming providers (#3327)
Co-authored-by: Codex <codex@openai.com>
2026-06-29 05:01:51 +01:00
Asim Aslam 5ee3a5224f ai/atlascloud: replace stale Stream_NotImplemented test (#3324)
goreleaser / goreleaser (push) Waiting to run
Streaming is implemented now (v6.3.3); the old test expected
ErrStreamingUnsupported and failed. Replace it with a real SSE streaming
test (httptest) that also asserts stream_options.include_usage and the
final usage chunk.
2026-06-29 03:36:39 +01:00
Asim Aslam c9f1ac921f Update architect priorities after agent resume (#3322)
Harness (E2E) / Harnesses (mock LLM) (push) Waiting to run
Harness (E2E) / Provider harnesses (live LLM conformance) (push) Waiting to run
Lint / golangci-lint (push) Waiting to run
Run Tests / Unit Tests (push) Waiting to run
Run Tests / Etcd Integration Tests (push) Waiting to run
Co-authored-by: Codex <codex@openai.com>
2026-06-29 02:49:27 +01:00
Asim Aslam c395010565 Expose durable agent resume APIs (#3319)
Co-authored-by: Codex <codex@openai.com>
2026-06-29 02:36:07 +01:00
Asim Aslam dca263f301 Update architect priorities after CLI inspection (#3317)
Co-authored-by: Codex <codex@openai.com>
2026-06-29 01:27:51 +01:00
Asim Aslam 3540bf5a50 Add CLI inspect command for run history (#3313)
Co-authored-by: Codex <codex@openai.com>
2026-06-29 00:57:40 +01:00
Asim Aslam 0d86fd5bcd Update architect priorities after failure hardening (#3311)
Co-authored-by: Codex <codex@openai.com>
2026-06-29 00:33:17 +01:00
Asim Aslam 205d6a55a3 Respect provider retry-after backoff hints (#3309)
Co-authored-by: Codex <codex@openai.com>
2026-06-28 23:57:17 +01:00
Asim Aslam 7588a427cc Update architect priorities (#3307)
Co-authored-by: Codex <codex@openai.com>
2026-06-28 23:28:55 +01:00
Asim Aslam 7b9937068d ai: surface token usage on streaming responses (#3304)
goreleaser / goreleaser (push) Waiting to run
* ai/atlascloud: surface token usage on streams

Request stream_options.include_usage and return the final usage chunk
as a Response with Usage set, so streaming callers can record usage.

* ai/openai: surface token usage on streams

Request stream_options.include_usage and return the final usage chunk
as a Response with Usage set, so streaming callers can record usage.
2026-06-28 23:13:25 +01:00
Asim Aslam f8d8cb39a7 Document provider conformance scheduling (#3303)
Co-authored-by: Codex <codex@openai.com>
2026-06-28 22:55:49 +01:00
Asim Aslam 87a0c0c93b ai/atlascloud: implement streaming (#3301)
goreleaser / goreleaser (push) Waiting to run
Atlas exposes an OpenAI-compatible SSE chat endpoint; emit content
deltas as they arrive instead of returning ErrStreamingUnsupported.
2026-06-28 22:42:03 +01:00
Copilot f31a7acf0b fix: gofmt formatting in ai/anthropic/anthropic.go (#3299)
* Initial plan

* fix: remove extra blank line in ai/anthropic/anthropic.go (gofmt)

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
2026-06-28 22:38:32 +01:00
Asim Aslam 4279a5eed3 ai: add WithMaxTokens option (#3300)
goreleaser / goreleaser (push) Waiting to run
* ai: add WithMaxTokens option

Let callers cap response length; providers send max_tokens when set
(anthropic keeps its 8192 default otherwise).

* ai: add WithMaxTokens option

Let callers cap response length; providers send max_tokens when set
(anthropic keeps its 8192 default otherwise).

* ai: add WithMaxTokens option

Let callers cap response length; providers send max_tokens when set
(anthropic keeps its 8192 default otherwise).

* ai: add WithMaxTokens option

Let callers cap response length; providers send max_tokens when set
(anthropic keeps its 8192 default otherwise).
2026-06-28 22:37:50 +01:00
Asim Aslam c39a846d3b Update architecture priorities (#3298)
Co-authored-by: Codex <codex@openai.com>
2026-06-28 22:31:33 +01:00
Asim Aslam b707c7e305 ai: thread Request.Messages into provider requests (#3293)
goreleaser / goreleaser (push) Waiting to run
* ai/atlascloud: thread Request.Messages into the request

Fold conversation history (req.Messages) between the system prompt and
the final user prompt so multi-turn context reaches the model.

Refs #3292

* ai/openai: thread Request.Messages into the request

Fold conversation history (req.Messages) between the system prompt and
the final user prompt so multi-turn context reaches the model.

Refs #3292

* ai/anthropic: thread Request.Messages into the request

Fold conversation history (req.Messages) between the system prompt and
the final user prompt so multi-turn context reaches the model.

Refs #3292
2026-06-28 22:19:59 +01:00
Asim Aslam 5bfc37708d Add support example smoke test (#3291)
Co-authored-by: Codex <codex@openai.com>
2026-06-28 21:58:56 +01:00
Asim Aslam 4d852c5e36 Update architect priorities after deploy contract (#3289)
Co-authored-by: Codex <codex@openai.com>
2026-06-28 21:32:15 +01:00
Asim Aslam f7a3e8461e test deploy inner-loop contract (#3287)
Co-authored-by: Codex <codex@openai.com>
2026-06-28 21:07:20 +01:00
Asim Aslam 87eb540a04 Update architect priorities for DX gaps (#3285)
Co-authored-by: Codex <codex@openai.com>
2026-06-28 20:35:29 +01:00
Asim Aslam 48e05385c7 Add agent human input pause resume (#3281)
Co-authored-by: Codex <codex@openai.com>
2026-06-28 20:04:25 +01:00
Asim Aslam cb10149f54 Update architect priorities after memory work (#3279)
Co-authored-by: Codex <codex@openai.com>
2026-06-28 19:24:54 +01:00
Asim Aslam 66438697b3 Improve compacting memory recall ranking (#3276)
Co-authored-by: Codex <codex@openai.com>
2026-06-28 19:03:39 +01:00
Asim Aslam 6e1c11ca74 Update architect priorities after A2A handoffs (#3274)
Co-authored-by: Codex <codex@openai.com>
2026-06-28 18:33:59 +01:00
Asim Aslam 44c08a6bd2 Add A2A resubscribe and input-required handoffs (#3271)
Co-authored-by: Codex <codex@openai.com>
2026-06-28 17:59:49 +01:00
Asim Aslam 9c01202599 Update architect priorities after OTel spans (#3269)
Co-authored-by: Codex <codex@openai.com>
2026-06-28 17:32:36 +01:00
Asim Aslam b4cfe51115 Emit agent run events on OTel spans (#3267)
Co-authored-by: Codex <codex@openai.com>
2026-06-28 17:04:26 +01:00
Asim Aslam 2221834707 Update architect priorities after streaming conformance (#3265)
Co-authored-by: Codex <codex@openai.com>
2026-06-28 16:33:06 +01:00
Asim Aslam 5813f53117 test ai streaming conformance (#3263)
Co-authored-by: Codex <codex@openai.com>
2026-06-28 16:17:23 +01:00
Asim Aslam 72e6161b02 Update architect priorities after agent checkpointing (#3261)
Co-authored-by: Codex <codex@openai.com>
2026-06-28 15:41:44 +01:00
Asim Aslam 1789819c39 Add agent tool checkpoint replay protection (#3259)
Co-authored-by: Codex <codex@openai.com>
2026-06-28 15:22:11 +01:00
Asim Aslam 8676dcacf2 Update architect priority queue after 0-to-hero (#3257)
Co-authored-by: Codex <codex@openai.com>
2026-06-28 14:38:08 +01:00
Asim Aslam 22b3b9ca22 Add zero-to-hero CI reference scenario (#3252)
Co-authored-by: Codex <codex@openai.com>
2026-06-28 14:09:17 +01:00
Asim Aslam 4ca8948ba4 Update architect priorities after 0-to-1 verification (#3250)
Co-authored-by: Codex <codex@openai.com>
2026-06-28 13:34:18 +01:00
Asim Aslam 28cbf0be7e test: verify scaffolded service run and call contract (#3248)
Co-authored-by: Codex <codex@openai.com>
2026-06-28 13:14:22 +01:00
Asim Aslam e8e6cb1210 Update architect priorities after conformance (#3246)
Co-authored-by: Codex <codex@openai.com>
2026-06-28 12:40:00 +01:00
Asim Aslam 2a06a043bd ci: run live agent provider conformance (#3244)
Co-authored-by: Codex <codex@openai.com>
2026-06-28 12:23:04 +01:00
Asim Aslam 6eef58f815 Update architect priorities (#3242)
Co-authored-by: Codex <codex@openai.com>
2026-06-28 11:13:36 +01:00
Asim Aslam 6da799d64f Classify AI retry failures (#3238)
Co-authored-by: Codex <codex@openai.com>
2026-06-28 10:42:37 +01:00
Asim Aslam 220b370641 Update architect priorities (#3236)
Co-authored-by: Codex <codex@openai.com>
2026-06-28 10:08:20 +01:00
Asim Aslam ac2163ef49 docs: align public TLS and A2A status (#3231)
Co-authored-by: Codex <codex@openai.com>
2026-06-28 09:20:26 +01:00
Asim Aslam 9d6814f5ae docs: refresh roadmap after A2A task support (#3229)
Co-authored-by: Codex <codex@openai.com>
2026-06-28 08:55:36 +01:00
Asim Aslam 929cd1ab1d Add A2A task continuation and push callbacks (#3226)
Co-authored-by: Codex <codex@openai.com>
2026-06-28 07:09:03 +01:00
Asim Aslam fe651b4d01 Update architect priorities after x402 (#3224)
Co-authored-by: Codex <codex@openai.com>
2026-06-28 06:35:10 +01:00
Asim Aslam 05ee980bf5 Harden x402 spend caps (#3222)
Co-authored-by: Codex <codex@openai.com>
2026-06-28 04:54:15 +01:00
Asim Aslam e1d19c4cb5 Update architect priorities after memory and HITL (#3220)
Co-authored-by: Codex <codex@openai.com>
2026-06-28 04:08:37 +01:00
Asim Aslam 61f873174c Add durable approval pause for agents (#3218)
Co-authored-by: Codex <codex@openai.com>
2026-06-28 03:37:50 +01:00
Asim Aslam 71581e9a61 Add agent memory compaction controls (#3216)
Co-authored-by: Codex <codex@openai.com>
2026-06-28 02:39:06 +01:00
Asim Aslam 892b4f185d Update architect priority queue after lifecycle hooks (#3213)
Co-authored-by: Codex <codex@openai.com>
2026-06-28 01:30:09 +01:00
Asim Aslam 30f53e42a7 Expose model retry attempt metadata (#3207)
Co-authored-by: Codex <codex@openai.com>
2026-06-28 00:56:21 +01:00
Asim Aslam 016eb82a32 Update architect priorities after streaming (#3205)
Co-authored-by: Codex <codex@openai.com>
2026-06-28 00:29:03 +01:00
Asim Aslam a576f65b08 Improve A2A streaming task lifecycle (#3203)
Co-authored-by: Codex <codex@openai.com>
2026-06-27 23:57:24 +01:00
Asim Aslam 07f0d30aea Update architect priority queue after observability (#3201)
Co-authored-by: Codex <codex@openai.com>
2026-06-27 23:26:33 +01:00
Asim Aslam 3db9617f43 Add agent trace provider helper (#3198)
Co-authored-by: Codex <codex@openai.com>
2026-06-27 23:02:09 +01:00
Asim Aslam c19e4829ba Update architect priority queue (#3196)
Co-authored-by: Codex <codex@openai.com>
2026-06-27 22:28:28 +01:00
Asim Aslam f37ed42bf3 Add registry service readiness check (#3194)
Co-authored-by: Codex <codex@openai.com>
2026-06-27 21:56:22 +01:00
Asim Aslam 114cd7e19e Update architect priorities after conformance (#3192)
Co-authored-by: Codex <codex@openai.com>
2026-06-27 21:30:21 +01:00
Asim Aslam 28fc2ea340 Add agent provider conformance matrix (#3190)
Co-authored-by: Codex <codex@openai.com>
2026-06-27 21:08:04 +01:00
Asim Aslam 38f5c13e65 Update architect priority queue (#3188)
Co-authored-by: Codex <codex@openai.com>
2026-06-27 20:37:32 +01:00
Asim Aslam 27f5e2be52 Add OpenAI streaming path (#3185)
Co-authored-by: Codex <codex@openai.com>
2026-06-27 20:01:45 +01:00
Asim Aslam 1fa7584be8 Update architect priority queue (#3183)
Co-authored-by: Codex <codex@openai.com>
2026-06-27 19:34:11 +01:00
Asim Aslam e8c632456a Add checkpointed agent run resume (#3180)
Co-authored-by: Codex <codex@openai.com>
2026-06-27 19:00:18 +01:00
Asim Aslam 9a410cbe8b Update architect priority queue (#3176)
Co-authored-by: Codex <codex@openai.com>
2026-06-27 17:46:45 +01:00
Asim Aslam 620374ef22 Add zero-to-hero harness test contract (#3174)
Co-authored-by: Codex <codex@openai.com>
2026-06-27 17:08:04 +01:00
Asim Aslam 31556b310e loop: continuous architect + lead the North Star with the mission/canon (#3172)
* ci: run the architect continuously as the founder lens

Make the architect a continuous overseer (hourly at :59, just before the :29
increment) instead of an every-few-days check-in. Each run it tracks live state
(what merged, what's in flight), keeps the roadmap priorities live, and judges
cohesion across harness/framework/dev-UX plus missing pieces and realignment —
re-ranking internal/docs/PRIORITIES.md to match reality. It only opens a PR when
the ranking actually changes (otherwise it just posts an assessment and closes
its issue), to avoid churn.

* thesis: lead the North Star with the mission, grounded in the canon

Instill the years of context the loop was missing: the vision lives in the
corpus (blog, README, website), not a single doc. Lead THESIS.md with an
explicit Mission — "what problem we solve" (make building an agent as easy as
building a service, on one runtime, because an agent is a distributed system),
distilled from the corpus — and name the blog/README/website as the canon the
North Star is a distillation of and must stay faithful to. Wire the architect to
judge every priority against the mission and re-derive alignment from the canon,
flagging drift in either direction (work vs mission, or thesis vs the blog).

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-06-27 16:58:24 +01:00
Asim Aslam 0e67971c53 ci: couple architect and increment loop through a ranked priority queue (#3171)
The architect now prioritizes the roadmap + an internal scan into a single
ranked, issue-linked queue in internal/docs/PRIORITIES.md (re-ranked each run),
and the hourly increment loop works the top open item from that queue instead
of independently guessing each hour — falling back to its own judgment only
when the queue is empty. So work is roadmap-driven by default and the human can
redirect by reordering the file or its issues.

- New internal/docs/PRIORITIES.md (seeded from the roadmap + open issues).
- architecture-review.yml: architect owns/re-ranks PRIORITIES.md and keeps each
  top item backed by a scoped issue.
- continuous-improvement.yml: pick the top open queue item; close both the
  priority issue and the run tracker.
- CONTINUOUS_IMPROVEMENT.md: document the architect → queue → increment pipeline.

Co-authored-by: Claude <noreply@anthropic.com>
2026-06-27 16:18:03 +01:00
Asim Aslam 2af5e6ae8f Record A2A agent replies in task history (#3170)
Co-authored-by: Codex <codex@openai.com>
2026-06-27 16:09:30 +01:00
Asim Aslam 656c4ea1e7 flow: tag single-step run info as flow (#3168)
Co-authored-by: Codex <codex@openai.com>
2026-06-27 15:16:38 +01:00
Asim Aslam 4a09b4469a Add flow execution timeout option (#3164)
Co-authored-by: Codex <codex@openai.com>
2026-06-27 14:04:58 +01:00
Alexander Serheyev 25d66f737d fix: retract phantom modules for cmd paths (#3154)
* fix: retract phantom modules for cmd and cmd/micro

* fix: remove temporary go.mod files to restore build
2026-06-27 13:19:53 +01:00
Asim Aslam 45d68c932e Track parent run IDs for durable flows (#3162)
Co-authored-by: Codex <codex@openai.com>
2026-06-27 13:07:18 +01:00
Asim Aslam c5c08e24d8 test: cover micro new no-mcp contract (#3160)
Co-authored-by: Codex <codex@openai.com>
2026-06-27 12:17:19 +01:00
Asim Aslam 8a0f4a7636 Add flow step context to run info (#3158)
Co-authored-by: Codex <codex@openai.com>
2026-06-27 11:22:23 +01:00
Asim Aslam bcf2c92931 Add A2A completed-task streaming (#3156)
Co-authored-by: Codex <codex@openai.com>
2026-06-27 10:29:01 +01:00
Asim Aslam 57ca94a88b docs: align public x402 flag examples (#3153)
Co-authored-by: Codex <codex@openai.com>
2026-06-27 09:08:38 +01:00
Asim Aslam ba231efe71 Update README.md 2026-06-27 07:08:08 +01:00
Asim Aslam f755eadd47 Propagate flow checkpoint failures (#3150)
Co-authored-by: Codex <codex@openai.com>
2026-06-27 06:55:56 +01:00
Asim Aslam 467c937873 Improve flow run history validation (#3148)
Co-authored-by: Codex <codex@openai.com>
2026-06-27 04:55:49 +01:00
Asim Aslam 3f45771840 Publish provider conformance summaries (#3146)
Co-authored-by: Codex <codex@openai.com>
2026-06-27 03:29:12 +01:00
Asim Aslam c9e045961d Add flow run stage filtering (#3144)
Co-authored-by: Codex <codex@openai.com>
2026-06-27 02:28:39 +01:00
Asim Aslam 590aacb518 docs: keep AI provider capability matrix verified (#3142)
Co-authored-by: Codex <codex@openai.com>
2026-06-27 00:58:39 +01:00
Asim Aslam 87eb5ce665 Add filters for flow run history (#3140)
Co-authored-by: Codex <codex@openai.com>
2026-06-27 00:00:58 +01:00
Asim Aslam ed904aa6ad Propagate flow run lineage to agent chats (#3138)
Co-authored-by: Codex <codex@openai.com>
2026-06-26 23:04:18 +01:00
Asim Aslam 59d028b8e1 test ai retry policy semantics (#3136)
Co-authored-by: Codex <codex@openai.com>
2026-06-26 22:16:59 +01:00
Asim Aslam 19818ad638 Expose streaming in provider capabilities (#3134)
Co-authored-by: Codex <codex@openai.com>
2026-06-26 21:18:38 +01:00
Asim Aslam 993ce668b2 Add provider capability markdown export (#3132)
Co-authored-by: Codex <codex@openai.com>
2026-06-26 20:20:08 +01:00
Asim Aslam 1d412fa6f5 Trigger test workflow on PR updates (#3130)
Co-authored-by: Codex <codex@openai.com>
2026-06-26 19:14:39 +01:00
Asim Aslam 271c27c44f Validate durable flow step names (#3128)
Co-authored-by: Codex <codex@openai.com>
2026-06-26 18:18:06 +01:00
Asim Aslam cefc9438c4 Add JSON output for AI provider capabilities (#3126)
Co-authored-by: Codex <codex@openai.com>
2026-06-26 17:31:18 +01:00
Asim Aslam af39aac297 Add provider conformance JSON summary (#3124)
Co-authored-by: Codex <codex@openai.com>
2026-06-26 16:31:25 +01:00
Asim Aslam 41717aaa9a ci: run 0-to-1 scaffold contract in harness (#3122)
Co-authored-by: Codex <codex@openai.com>
2026-06-26 15:26:25 +01:00
Asim Aslam 5d1137d8f9 docs: add provider conformance matrix (#3106)
Co-authored-by: Codex <codex@openai.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
2026-06-26 14:30:51 +01:00
Asim Aslam a14b3e79e2 docs: add provider conformance matrix (#3120)
Co-authored-by: Codex <codex@openai.com>
2026-06-26 14:23:56 +01:00
Asim Aslam 130022e544 Record full agent timelines without tracing (#3118)
Co-authored-by: Codex <codex@openai.com>
2026-06-26 13:27:08 +01:00
Asim Aslam 0d3f3f2be5 Record agent run timelines without tracing (#3116)
Co-authored-by: Codex <codex@openai.com>
2026-06-26 12:35:03 +01:00
Asim Aslam ae91863343 Add trace filter for agent runs (#3114)
Co-authored-by: Codex <codex@openai.com>
2026-06-26 10:50:49 +01:00
Asim Aslam 72f8067e57 docs: finish constructor example cleanup (#3112)
Co-authored-by: Codex <codex@openai.com>
2026-06-26 09:30:58 +01:00
Asim Aslam 8533306e64 docs: align service constructor examples (#3111)
Co-authored-by: Codex <codex@openai.com>
2026-06-26 09:29:36 +01:00
Asim Aslam 384987da9f docs: align service constructor examples (#3110)
Co-authored-by: Codex <codex@openai.com>
2026-06-26 09:26:40 +01:00
Asim Aslam ddde9472fc Expose agent chat run identifiers (#3108)
Co-authored-by: Codex <codex@openai.com>
2026-06-26 08:53:33 +01:00
Asim Aslam d7a74735c8 Add AI provider capability command (#3104)
Co-authored-by: Codex <codex@openai.com>
2026-06-26 04:55:16 +01:00
Asim Aslam 581b2120a3 Verify zero-to-hero harness via workflow (#3102)
Co-authored-by: Codex <codex@openai.com>
2026-06-26 03:29:00 +01:00
Asim Aslam 871af7e6d3 Add pending filter for flow run history (#3100)
Co-authored-by: Codex <codex@openai.com>
2026-06-26 02:35:50 +01:00
Asim Aslam 9d39ed3292 Add OpenTelemetry spans for stepped flows (#3098)
Co-authored-by: Codex <codex@openai.com>
2026-06-26 01:10:11 +01:00
Asim Aslam d8f711431f agent: stop canceled tool execution (#3096)
Co-authored-by: Codex <codex@openai.com>
2026-06-26 00:07:26 +01:00
Asim Aslam 5d22cd4a5b Correlate agent trace spans (#3094)
Co-authored-by: Codex <codex@openai.com>
2026-06-25 23:09:39 +01:00
Asim Aslam f1f987cb8d provider conformance: print capability matrix (#3092)
Co-authored-by: Codex <codex@openai.com>
2026-06-25 22:18:34 +01:00
Asim Aslam 7b9c583dcf blog: "How Go Micro Builds Itself" — the autonomous Codex loop (#3090)
A post on how the framework is increasingly built by an autonomous loop of
two AI agents (Codex implementing scoped increments, Claude Code
orchestrating, the human setting direction): the dispatch→build→auto-merge
mechanism, the three altitudes (architect/increment/DevRel), the failure
modes we hit wiring it up, and the concrete increments it produces.


Claude-Session: https://claude.ai/code/session_01CmdEY7pYmV5zzwCjNJ4ykL

Co-authored-by: Claude <noreply@anthropic.com>
2026-06-25 21:59:00 +01:00
Asim Aslam b7f1ac6d6d Add flow run correlation to step contexts (#3089)
Co-authored-by: Codex <codex@openai.com>
2026-06-25 21:20:38 +01:00
Asim Aslam fb14ccbc17 Add deterministic AI capability rows (#3087)
Co-authored-by: Codex <codex@openai.com>
2026-06-25 20:21:00 +01:00
Asim Aslam 5f40cae7af ci: add DevRel + Architect overseer passes to the loop (#3085)
The hourly loop ships increments but nothing watches the whole. Add two
periodic high-altitude passes, same dispatch mechanism (fresh issue → @codex):

- devrel-review.yml (daily): audits README, website, docs, blog for coherence
  with the North Star, README crispness, and blog-worthy material. Safe
  alignment/crispness fixes auto-merge; brand/positioning copy and blog drafts
  are surfaced in a report for the human, never auto-merged.
- architecture-review.yml (every ~3 days): reviews the framework/harness against
  the thesis and files scoped follow-up issues that feed the increment loop. It
  does not make breaking/architectural changes itself.

Documented both in CONTINUOUS_IMPROVEMENT.md (Overseer passes).


Claude-Session: https://claude.ai/code/session_01CmdEY7pYmV5zzwCjNJ4ykL

Co-authored-by: Claude <noreply@anthropic.com>
2026-06-25 19:42:58 +01:00
Asim Aslam 496d5b7644 Show parent agent runs in CLI history (#3084)
Co-authored-by: Codex <codex@openai.com>
2026-06-25 19:28:32 +01:00
Asim Aslam 44e62f5e8b flow: honor canceled checkpoint contexts (#3082)
Co-authored-by: Codex <codex@openai.com>
2026-06-25 18:24:35 +01:00
Asim Aslam 18ae00dad0 Harden agent harness contracts (#3080)
Co-authored-by: Codex <codex@openai.com>
2026-06-25 17:36:36 +01:00
Asim Aslam 6f9adfd375 ai: expose unsupported streaming sentinel (#3078)
Co-authored-by: Codex <codex@openai.com>
2026-06-25 16:38:14 +01:00
Asim Aslam 8fc4f58a17 Add AI provider capability matrix (#3076)
Co-authored-by: Codex <codex@openai.com>
2026-06-25 15:26:49 +01:00
Asim Aslam 19ad28e04b Propagate A2A request cancellation (#3074)
Co-authored-by: Codex <codex@openai.com>
2026-06-25 14:32:06 +01:00
Asim Aslam 319ff1972b ci: require live provider conformance keys (#3072)
Co-authored-by: Codex <codex@openai.com>
2026-06-25 13:28:57 +01:00
Asim Aslam 03791759ef Add filtered agent run summaries (#3070)
Co-authored-by: Codex <codex@openai.com>
2026-06-25 12:35:39 +01:00
Asim Aslam 5e3cef7cd9 Add agent run summary status and duration (#3068)
Co-authored-by: Codex <codex@openai.com>
2026-06-25 10:50:49 +01:00
Asim Aslam 751530aaec website: refresh Developer Experience copy for the harness DX (#3066)
The section only mentioned micro run (services) and micro deploy. Update it
to the current lifecycle DX: micro new scaffolds a service or agent (every
endpoint an MCP tool), micro run starts everything with hot reload + gateway
+ console, and micro chat talks to agents and services. Drops micro deploy.


Claude-Session: https://claude.ai/code/session_01CmdEY7pYmV5zzwCjNJ4ykL

Co-authored-by: Claude <noreply@anthropic.com>
2026-06-25 10:33:34 +01:00
Asim Aslam 3a9f45750b docs + website: loop mechanics doc; landing "Features" + subtitle trim (#3065)
* ci: self-merge Codex PRs via native auto-merge; retire the sweep

With branch protection + "Allow auto-merge" now enabled on master, Codex
enables GitHub auto-merge on its own PR (gh pr merge --squash --auto) right
after opening it, so the PR lands the moment the required CI checks pass —
no polling sweep, and the green-CI gate is enforced by GitHub instead of by
gh pr checks in a cron. Removes auto-merge-codex.yml and updates the dispatch
and AGENTS.md accordingly.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CmdEY7pYmV5zzwCjNJ4ykL

* docs: document the durable loop mechanics (stub→gh, branch, auto-merge)

Capture the hard-won wiring of the autonomous loop so it isn't re-derived:
fresh issue per increment, user-PAT dispatch (Codex ignores the bot), Codex
opening the PR via gh (make_pr is a no-op stub), unique codex/ branch + label,
and native auto-merge gated by branch protection with 0 approvals. Adds a
"do-not-break" list (don't re-add approvals, don't reuse one tracker issue,
don't use make_pr, don't re-implement during the summary→PR lag).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CmdEY7pYmV5zzwCjNJ4ykL

* website: rename section to "Features"; trim subtitle

Rename the feature-grid heading from "The Runtime Around the Agent" to
"Features", and drop "once they leave the demo." from the subtitle.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CmdEY7pYmV5zzwCjNJ4ykL

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-06-25 10:22:51 +01:00
Asim Aslam 2def581408 ci: self-merge Codex PRs via native auto-merge; retire the sweep (#3064)
With branch protection + "Allow auto-merge" now enabled on master, Codex
enables GitHub auto-merge on its own PR (gh pr merge --squash --auto) right
after opening it, so the PR lands the moment the required CI checks pass —
no polling sweep, and the green-CI gate is enforced by GitHub instead of by
gh pr checks in a cron. Removes auto-merge-codex.yml and updates the dispatch
and AGENTS.md accordingly.


Claude-Session: https://claude.ai/code/session_01CmdEY7pYmV5zzwCjNJ4ykL

Co-authored-by: Claude <noreply@anthropic.com>
2026-06-25 10:13:24 +01:00
Asim Aslam 95ee402c8b ci: pin Codex PRs to a unique codex/ branch + codex label (#3063)
Codex was pushing to a generic branch (e.g. "work"), which the auto-merge
sweep ignores (it only matches codex/* branches with the codex label) and
which collides across runs. The dispatch and AGENTS.md now instruct Codex to
create a unique codex/increment-<issue> branch and pass --label codex to
gh pr create, so every increment is isolated and actually swept.


Claude-Session: https://claude.ai/code/session_01CmdEY7pYmV5zzwCjNJ4ykL

Co-authored-by: Claude <noreply@anthropic.com>
2026-06-25 09:48:25 +01:00
Asim Aslam 8aeba56839 Harden provider conformance selection (#3061)
Co-authored-by: Codex <codex@openai.com>
2026-06-25 09:47:55 +01:00
Asim Aslam 42fdad439c docs: AGENTS.md — open PRs via gh, not the make_pr stub (#3062)
The initial AGENTS.md instructed Codex tasks to use the make_pr tool and
said a shell GitHub token "is not a substitute" — but make_pr in the Codex
sandbox is a no-op stub that only records metadata and never opens a PR, so
that guidance steers every run back into the broken path. Replace it with
the working flow: push the branch and open the PR with the gh CLI
(git push + gh pr create), which is what actually creates PRs now.


Claude-Session: https://claude.ai/code/session_01CmdEY7pYmV5zzwCjNJ4ykL

Co-authored-by: Claude <noreply@anthropic.com>
2026-06-25 09:32:50 +01:00
Asim Aslam b45c94e201 ci: instruct Codex to open the PR via gh, not the make_pr stub (#3059)
Codex's make_pr tool in the Cloud sandbox is a no-op stub — it records the
PR title/body and returns them "for downstream consumption" (the manual
"Create PR" click), but never pushes a branch or calls the GitHub API. That
is why "make_pr called, nothing happened": the tool literally cannot open a
PR. With the gh CLI now installed in the Codex setup and origin pointed at
the repo, the dispatch tells Codex to push and open the PR itself
(git push + gh pr create) instead of relying on make_pr.


Claude-Session: https://claude.ai/code/session_01CmdEY7pYmV5zzwCjNJ4ykL

Co-authored-by: Claude <noreply@anthropic.com>
2026-06-25 08:02:23 +01:00
Asim Aslam 23051459d8 docs: require Codex PR creation step (#3058) 2026-06-25 07:35:06 +01:00
Asim Aslam 4c7e6e96eb agent: correlate run timelines with traces (#3057) 2026-06-25 07:20:11 +01:00
Asim Aslam ef21ac6494 Add JSON output for agent run inspection (#3055) 2026-06-25 06:51:06 +01:00
Asim Aslam 53193fbbe7 agent: mark successful run timelines complete (#3054) 2026-06-25 06:50:51 +01:00
Asim Aslam 105cc9d2fb Add flow retry backoff (#3053) 2026-06-25 06:50:36 +01:00
Asim Aslam d369cf290c Improve agent run index summaries (#3049) 2026-06-25 01:31:08 +01:00
Asim Aslam 949542fa65 flow: add pending run resume helper (#3048) 2026-06-25 01:30:29 +01:00
Asim Aslam 1421ccbea6 Improve flow run inspection (#3047) 2026-06-25 01:30:01 +01:00
Asim Aslam 7a0ca65b68 Expose agent run IDs on responses (#3044) 2026-06-24 23:10:45 +01:00
Asim Aslam 28433f2db8 docs: align continuous improvement scheduler notes (#3043) 2026-06-24 23:09:49 +01:00
Asim Aslam cb61ccb9d7 Make flow checkpoint listing deterministic (#3040) 2026-06-24 21:51:18 +01:00
Asim Aslam fbb5fd46ae ci: open a fresh issue per increment so Codex opens a new PR each run (#3039)
Codex derives its PR branch name from the triggering issue's context, so
re-commenting on a single tracker issue (#3024) every hour collapsed every
increment onto one branch name. The first increment opened a PR; the rest
collided on the occupied branch and silently failed to open one — which is
why repeated runs produced "make_pr called, nothing happened."

Open a unique issue per run and dispatch Codex there, so each increment gets
its own branch and a clean PR. The dispatch asks Codex to "Closes #<issue>"
so each tracking issue auto-closes when its PR merges. The explicit
branch-name request (which Codex ignored in favor of the issue-derived name)
is dropped.


Claude-Session: https://claude.ai/code/session_01CmdEY7pYmV5zzwCjNJ4ykL

Co-authored-by: Claude <noreply@anthropic.com>
2026-06-24 21:46:44 +01:00
Asim Aslam ff6af5d46b Make agent run timelines deterministic (#3038) 2026-06-24 20:42:38 +01:00
Asim Aslam 89ae0a10eb website: h1 → "An Agent Harness for Go" (#3037)
Claude-Session: https://claude.ai/code/session_01CmdEY7pYmV5zzwCjNJ4ykL

Co-authored-by: Claude <noreply@anthropic.com>
2026-06-24 20:29:41 +01:00
Asim Aslam 666e1f765e ci: give each Codex dispatch a unique branch to avoid collisions (#3036)
* fix: harden flow step execution against nil Run and cancellation

A step with no Run function panicked the run; it now returns a clear
configuration error. The retry loop also kept retrying after the run's
context was canceled or its deadline passed — it now stops immediately
and surfaces the context error, preserving cancellation/deadline
semantics for durable workflow runs. Adds regression coverage for both.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CmdEY7pYmV5zzwCjNJ4ykL

* ci: give each Codex dispatch a unique branch to avoid collisions

Codex derives its PR branch name from the dispatch text. The hourly loop
posted an identical generic prompt every run, so every increment resolved
to the same branch name — the previous increment's branch (until auto-
merged and deleted) blocked the next PR from opening. Include the run
number in the prompt and explicitly request a fresh
codex/improvement-<run_number> branch, so each increment is isolated.
auto-merge-codex.yml still matches (codex/* prefix) and deletes on merge.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CmdEY7pYmV5zzwCjNJ4ykL

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-06-24 20:26:29 +01:00
Asim Aslam 5a0df7991e fix: harden flow step execution against nil Run and cancellation (#3034)
A step with no Run function panicked the run; it now returns a clear
configuration error. The retry loop also kept retrying after the run's
context was canceled or its deadline passed — it now stops immediately
and surfaces the context error, preserving cancellation/deadline
semantics for durable workflow runs. Adds regression coverage for both.


Claude-Session: https://claude.ai/code/session_01CmdEY7pYmV5zzwCjNJ4ykL

Co-authored-by: Claude <noreply@anthropic.com>
2026-06-24 18:49:32 +01:00
Asim Aslam 631c58cb75 ci: gate Codex dispatch on CODEX_TRIGGER_TOKEN secret (#3033)
goreleaser / goreleaser (push) Waiting to run
* thesis: position Go Micro as complementary to LangChain, not competing

Add a 'Where we fit' section: 'harness' has two layers — the intra-agent
harness (single-model runtime: prompts, tools, context, sandbox, the Ralph
loop) that LangChain/LangGraph/deepagents/Claude Code own and we do NOT
compete with, and the operational harness (the distributed substrate agents
operate inside: services-as-tools, discovery, durable runs, observability,
interop, the services->agents->workflows lifecycle) which is our focus. They
stack and interoperate via MCP/A2A; we make those agents better neighbours,
not obsolete.

* ci: gate Codex dispatch on CODEX_TRIGGER_TOKEN secret

Codex ignores @codex comments authored by the github-actions bot, so the
hourly dispatch was producing no PRs while still posting to the tracker
issue. Gate the comment step on the presence of CODEX_TRIGGER_TOKEN: the
workflow now no-ops until a PAT for a Codex-followed account is set, then
activates automatically with no further change.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CmdEY7pYmV5zzwCjNJ4ykL

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-06-24 17:39:44 +01:00
Asim Aslam 57e83ca9a0 thesis: position Go Micro as complementary to LangChain, not competing (#3032)
Add a 'Where we fit' section: 'harness' has two layers — the intra-agent
harness (single-model runtime: prompts, tools, context, sandbox, the Ralph
loop) that LangChain/LangGraph/deepagents/Claude Code own and we do NOT
compete with, and the operational harness (the distributed substrate agents
operate inside: services-as-tools, discovery, durable runs, observability,
interop, the services->agents->workflows lifecycle) which is our focus. They
stack and interoperate via MCP/A2A; we make those agents better neighbours,
not obsolete.

Co-authored-by: Claude <noreply@anthropic.com>
2026-06-24 15:54:56 +01:00
Asim Aslam 8d59779465 website: fix mobile horizontal overflow on the landing page (#3031)
Grid items defaulted to min-width:auto, so the wide <pre> blocks (install
command, the 'micro run' sample) forced their row past the viewport —
clipped by overflow-x:hidden, so no scroll but not fitting either. Let
grid items shrink (.two-col > * { min-width:0 }) and wrap the code blocks
on mobile (white-space:pre-wrap; overflow-wrap:anywhere) so every section
fits the screen with no overflow or scroll.

Co-authored-by: Claude <noreply@anthropic.com>
2026-06-24 15:48:35 +01:00
Asim Aslam 3d0c5237f0 docs: burger (☰) sidebar toggle on the left on mobile (#3030)
Replace the docs header 'Menu' button with a ☰ burger icon and move it to the
left next to the wordmark (where the logo used to be), grouped in a .nav-left
container. Keeps id=menuToggle so the existing sidebar-toggle JS still works;
desktop is unchanged (toggle hidden).

Co-authored-by: Claude <noreply@anthropic.com>
2026-06-24 15:31:52 +01:00
Asim Aslam cf1f42d15b website: text-only 'Go Micro' brand, drop the nav logo (#3029)
Remove the logo image from the nav-brand in the marketing nav include and the
docs and blog layouts; the brand is now just the 'Go Micro' wordmark.

Co-authored-by: Claude <noreply@anthropic.com>
2026-06-24 15:27:47 +01:00
Asim Aslam 728ea5eae7 loop: add the thesis / North Star and make the loop align to it (#3028)
Add internal/docs/THESIS.md — the vision the autonomous loop steers by: a
holistic agent harness AND service framework encapsulating the lifecycle of
services -> agents -> workflows (workloads come after agents; the value is in
composing it into systems that do real work, on schedules and in loops).

Wire it in as the alignment criterion: the continuous-improvement charter and
the Codex dispatch prompt now require every increment to advance the North Star,
so improvements compound toward the thesis instead of drifting locally.

Co-authored-by: Claude <noreply@anthropic.com>
2026-06-24 15:23:01 +01:00
Asim Aslam 5e9accfd45 Add agent OpenTelemetry run observability (#3027) 2026-06-24 14:57:25 +01:00
Asim Aslam 0adb4f0aac loop: hourly Codex dispatch + auto-merge green Codex PRs (#3026)
- continuous-improvement: cadence 12h -> hourly.
- add auto-merge-codex workflow: every 15 min, merge open PRs that are
  codex-labelled AND from a codex/* branch once all checks are green
  (gh pr checks). CI (build/test/lint/harnesses) is the only gate — no
  human involvement. Scoped tightly so nothing else auto-merges.

Co-authored-by: Claude <noreply@anthropic.com>
2026-06-24 14:26:31 +01:00
Asim Aslam ee44926191 loop: drive the scheduled backbone via Codex, not an Anthropic key (#3025)
A Claude Max subscription exposes no API key for CI, and Atlas Cloud models
can't run a coding agent — so the durable scheduler triggers Codex instead:
on a cadence it posts an @codex instruction on the tracker issue (#3024) to
run one improvement increment. Prefers a CODEX_TRIGGER_TOKEN PAT if set
(in case Codex ignores the Actions bot), else the default token.

Co-authored-by: Claude <noreply@anthropic.com>
2026-06-24 14:15:41 +01:00
Asim Aslam 09cf00b5ec docs: mark harness Resilience as shipped (#3023)
* loop: establish the continuous-improvement charter + scheduled backbone

Define the autonomous improvement loop (internal/docs/CONTINUOUS_IMPROVEMENT.md):
full autonomy with correctness (build/test/lint) as the only gate, work sourced
from roadmap + issues + an improvement radar + dogfooding, Claude Code driving
and Codex executing scoped tasks, with brand/positioning and breaking API kept
with the human.

Add a durable scheduled GitHub Action (.github/workflows/continuous-improvement.yml)
as the session-independent backbone — a safe no-op until an ANTHROPIC_API_KEY
secret is added.

* docs: mark harness Resilience as shipped

Resilience (per-call timeout + context propagation + opt-in retry/backoff)
landed in #3017/#3021; update the agent-harness status table from
'In progress' to 'Shipped'.

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-06-24 13:58:02 +01:00
Asim Aslam da5fa1f27c loop: establish the continuous-improvement charter + scheduled backbone (#3022)
Define the autonomous improvement loop (internal/docs/CONTINUOUS_IMPROVEMENT.md):
full autonomy with correctness (build/test/lint) as the only gate, work sourced
from roadmap + issues + an improvement radar + dogfooding, Claude Code driving
and Codex executing scoped tasks, with brand/positioning and breaking API kept
with the human.

Add a durable scheduled GitHub Action (.github/workflows/continuous-improvement.yml)
as the session-independent backbone — a safe no-op until an ANTHROPIC_API_KEY
secret is added.

Co-authored-by: Claude <noreply@anthropic.com>
2026-06-24 13:56:38 +01:00
Asim Aslam a8ea60120e agent: make model retries opt-in and harden retry backoff (#3021)
Follow-up to #3017. A Generate runs the whole tool-execution turn, so
auto-retrying it re-runs already-executed (possibly side-effecting) tool
calls. Default ModelMaxAttempts 3 -> 1: retries are now opt-in via
ModelRetry. The timeout stays as a safety net.

Also harden ai.GenerateWithRetry: always back off between retries
(exponential, capped at 30s, default 200ms if unset) so an opt-in retry
can't busy-loop the provider even with Backoff=0.

Verified: go build, go test -race ./agent/... ./ai/, golangci-lint.

Co-authored-by: Claude <noreply@anthropic.com>
2026-06-24 12:42:15 +01:00
Asim Aslam d7050e9cc2 website: size hero image to 600px (#3020)
Co-authored-by: Claude <noreply@anthropic.com>
2026-06-24 12:39:22 +01:00
Asim Aslam 536806119e website: tighten hero — drop 'in Go', simpler tagline, image in-hero at 800px (#3019)
- h1: 'An Agent Harness and Service Framework' (drop 'in Go')
- tagline: 'Build agents, services, and workflows on one runtime'
- move the hero image into the hero block (between tagline and the install
  line), capped at 800px to fit the hero column, and remove the separate
  full-width image section

Co-authored-by: Claude <noreply@anthropic.com>
2026-06-24 12:33:58 +01:00
Asim Aslam ab2c092693 Add agent model retry and timeout resilience (#3017) 2026-06-24 12:30:58 +01:00
Asim Aslam 7144cddc00 website: new hero image + reframe landing as harness AND service framework (#3018)
- Regenerate the hero image (text-free, via the framework's own Atlas Cloud
  image model) — an agent orchestrating service nodes. The old one had baked-in
  'AI native microservices framework' text that contradicts the positioning;
  text-free so copy changes can't invalidate it again.
- h1 -> 'An Agent Harness and Service Framework in Go' (both, not harness-only).
- Tagline reframed around agents, services, and flows on one runtime.
- Drop the 'moved from a service framework to an agent harness' line — it's
  additive (both in one), not a pivot away from services.

Co-authored-by: Claude <noreply@anthropic.com>
2026-06-24 12:27:09 +01:00
Asim Aslam 9f28cc4c86 docs: bake cross-agent coordination rules into CLAUDE.md and CODEX.md (#3016)
Add matching 'Coordination' sections so Claude Code and Codex self-coordinate:
lane/branch ownership (claude/* vs codex/*, never share a branch), base PRs
on master (don't stack on an in-flight branch — the #3007 orphan lesson),
one concern per PR, cross-review before merge, the @codex dispatch
conventions (review reserved, serial, fix-in-place), and CI as the gate.

Co-authored-by: Claude <noreply@anthropic.com>
2026-06-24 12:13:21 +01:00
Asim Aslam 8a19dc2d7c docs/blog: anchor the agent-harness positioning (#3015)
- Add the canonical concept doc 'The Agent Harness' (docs/guides/agent-harness.md)
  + nav entry: what the harness is, each piece mapped to a feature, honest
  about shipped vs in-progress.
- Add blog post /blog/30 'Go Micro is an Agent Harness' (the public articulation;
  precise about what ships today vs the Now/Next roadmap).
- Align the ROADMAP.md opening line to the agent-harness framing.


Claude-Session: https://claude.ai/code/session_01CmdEY7pYmV5zzwCjNJ4ykL

Co-authored-by: Claude <noreply@anthropic.com>
2026-06-24 11:59:42 +01:00
Asim Aslam daacd4830f harness/new: make conformance timeout honest and contract test cheaper (#3008)
Follow-up to #3006:

- provider-conformance: build each harness to a temp binary and run that
  instead of 'go run'. 'go run' launches the harness as a child it doesn't
  kill on context cancellation, so a timed-out harness (which starts local
  services) could be orphaned and outlive the run. Running the built binary
  makes the per-run timeout actually terminate the work.
- contract test: skip under -short, and use 'go build ./...' instead of
  'go test ./...' (the contract is that the generated service builds). This
  keeps the default unit-test suite from shelling out to the toolchain and
  the network on every run.


Claude-Session: https://claude.ai/code/session_01CmdEY7pYmV5zzwCjNJ4ykL

Co-authored-by: Claude <noreply@anthropic.com>
2026-06-24 11:48:40 +01:00
Asim Aslam 844ab4a14b Add provider-conformance harness, contract test, and reframe docs to 'agent harness' (#3006)
* docs: reposition go micro as agent harness

* ci: rename universe workflow to harness
2026-06-24 11:37:43 +01:00
Asim Aslam 156b051191 docs: fix service quickstart snippets (#3005) 2026-06-24 08:21:38 +01:00
Asim Aslam 21a6746d86 docs: add codex maintainer playbook (#3004) 2026-06-24 07:58:48 +01:00
Asim Aslam 2c04f61331 blog: announce OpenAI Codex for Open Source grant (/blog/29) (#3003)
Add a blog post for the OpenAI Codex for Open Source grant, list it on
the blog index, and repoint the OpenAI sponsor logo (README + landing) to
the post — matching how the Anthropic (/blog/3) and Atlas Cloud (/blog/8)
sponsor logos link to their posts.

Co-authored-by: Claude <noreply@anthropic.com>
2026-06-23 18:35:51 +01:00
Asim Aslam 634fc9bced sponsors: add OpenAI (Codex for Open Source) (#3002)
Go Micro received an OpenAI Codex for Open Source grant. Add the OpenAI
logo to the README and landing-page sponsors, alongside Anthropic and
Atlas Cloud.

Co-authored-by: Claude <noreply@anthropic.com>
2026-06-23 18:21:35 +01:00
Asim Aslam a503628ef1 flow: add Loop — run a step until done, with a guaranteed ceiling (#3001)
Adds the agentic 'loop' to flows: flow.Loop(body, opts...) is a StepFunc
that runs a body step repeatedly, carrying State across passes, until a
stop condition fires or a hard iteration cap is reached.

- Stop modes: flow.Until (code-defined predicate) and flow.UntilLLM (the
  model judges the goal met after each pass — the supervised 'Ralph'
  loop). Either firing stops the loop.
- flow.LoopMax is the guardrail: the body never runs more than n times, so
  the loop always terminates and can't run up an unbounded bill. Hitting
  the cap returns the latest state rather than erroring.
- flow.OnIteration reports per-pass progress.
- Composes as a normal flow step (checkpointed by the step engine).
- Exposed at the top level as micro.FlowLoop / FlowUntil / FlowUntilLLM /
  FlowLoopMax / FlowOnIteration, symmetric with the other Flow* helpers.

Includes tests, an offline runnable example (examples/flow-loop), an
'Agent Loops' guide, and a CHANGELOG entry.


Claude-Session: https://claude.ai/code/session_01CmdEY7pYmV5zzwCjNJ4ykL

Co-authored-by: Claude <noreply@anthropic.com>
2026-06-23 12:39:17 +01:00
Asim Aslam 3f40028a7f website: deduplicate header/footer via Jekyll includes (#3000)
Extract the nav and footer link lists into _includes/nav-links.html and
_includes/footer-links.html, and the full marketing nav/footer into
_includes/marketing-nav.html and _includes/marketing-footer.html.

- index.html and support.html now pull their nav/footer from the shared
  marketing includes (and gain Liquid front matter so includes resolve).
- The docs and blog layouts pull the same link lists, so a nav/footer
  link lives in exactly one place site-wide. This also adds the missing
  Support link to the blog nav and fixes the blog footer's Support link
  (it still pointed at the question template).
- Active nav state is driven by a per-page nav_active flag.

Verified with a local jekyll build: landing, support, docs, and blog
pages all render the shared nav/footer correctly.

Co-authored-by: Claude <noreply@anthropic.com>
2026-06-23 05:45:09 +01:00
Asim Aslam b9665ad196 website: add Support to top nav (landing + docs layout) (#2999)
* website: add Support to top nav (landing + docs layout)

Link /docs/support.html from the nav bar on the landing page and the
shared docs layout, and point the docs-layout footer Support link there
too (was the question issue template).

* website: add a dedicated marketing /support page

New top-level /support.html styled like the landing site (hero, tier
cards, community links, CTAs) — separate from the docs reference at
/docs/support.html. Repoint the site nav, footer, landing 'Commercial
support' button, and the FUNDING button to it.

* website: serve the support page at a clean /support URL

Add 'permalink: /support' to support.html (same mechanism the blog uses)
and point all nav/footer/CTA/FUNDING links at /support instead of
/support.html.

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-06-22 22:42:10 +01:00
Asim Aslam 053103fb7f website: trim landing tagline and use 'workflows' (#2998)
Drop the 'Every service is an MCP tool; every agent speaks A2A' sentence
and use 'workflows' (clearer than 'flows') in the one-liner.

Co-authored-by: Claude <noreply@anthropic.com>
2026-06-22 19:54:35 +01:00
Asim Aslam 0ba2253357 website: trim landing tagline to the one-liner (#2997)
Drop the 'Every service is an MCP tool; every agent speaks A2A' sentence.

Co-authored-by: Claude <noreply@anthropic.com>
2026-06-22 19:52:05 +01:00
Asim Aslam 2339155ff2 Enforce blocking golangci-lint in CI and clear lint backlog (#2996)
goreleaser / goreleaser (push) Waiting to run
* lint: clear the golangci-lint backlog and enforce a blocking lint in CI

Fixes #2988. Brings 'golangci-lint run ./...' to zero issues (was ~373):

- errcheck: explicitly ignore fire-and-forget calls with '_ =' (and a small
  errcheck.exclude-functions list for response writes — json Encoder.Encode,
  http ResponseWriter.Write, fmt.Fprint*); genuine cases handled.
- unused: remove dead code (unexported decls and dead test helpers) and the
  imports they orphaned.
- staticcheck: ST1005 error strings, ST1016 receiver names, S1000/S1017/S1019/
  S1023 simplifications, SA4004/SA4006/SA4010 dead code, SA1021 net.IP.Equal,
  SA6002 (store *[]byte in sync.Pool).
- govet: fix a context leak (lostcancel) in internal/util/mdns and move
  t.Fatal/Fatalf out of goroutines (testinggoroutine) in tests.
- ineffassign, unconvert: mechanical fixes.

CI: the Lint workflow now runs a blocking full-tree 'golangci-lint run' on
pushes and PRs (dropped only-new-issues now that the tree is clean).

Verified: go build, go vet, test compilation, and unit tests for the
behaviourally-touched packages all pass.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CmdEY7pYmV5zzwCjNJ4ykL

* website: emit go-source meta for /vN paths

pkg.go.dev uses go-source to link to the right files and lines. The /vN
go-get response now returns go-source alongside go-import. Does not affect
go install resolution.

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-06-22 19:48:09 +01:00
Asim Aslam 3e885308a0 lint: clear the golangci-lint backlog and enforce a blocking lint in CI (#2995)
Fixes #2988. Brings 'golangci-lint run ./...' to zero issues (was ~373):

- errcheck: explicitly ignore fire-and-forget calls with '_ =' (and a small
  errcheck.exclude-functions list for response writes — json Encoder.Encode,
  http ResponseWriter.Write, fmt.Fprint*); genuine cases handled.
- unused: remove dead code (unexported decls and dead test helpers) and the
  imports they orphaned.
- staticcheck: ST1005 error strings, ST1016 receiver names, S1000/S1017/S1019/
  S1023 simplifications, SA4004/SA4006/SA4010 dead code, SA1021 net.IP.Equal,
  SA6002 (store *[]byte in sync.Pool).
- govet: fix a context leak (lostcancel) in internal/util/mdns and move
  t.Fatal/Fatalf out of goroutines (testinggoroutine) in tests.
- ineffassign, unconvert: mechanical fixes.

CI: the Lint workflow now runs a blocking full-tree 'golangci-lint run' on
pushes and PRs (dropped only-new-issues now that the tree is clean).

Verified: go build, go vet, test compilation, and unit tests for the
behaviourally-touched packages all pass.


Claude-Session: https://claude.ai/code/session_01CmdEY7pYmV5zzwCjNJ4ykL

Co-authored-by: Claude <noreply@anthropic.com>
2026-06-22 18:51:30 +01:00
Asim Aslam 4311b73361 Enhance ADK vs Go Micro comparison and apply lint fixes (#2994)
* docs: compare Go Micro with Google ADK in the comparison guide

Adds a 'vs Agent Frameworks (Google ADK)' section: ADK builds an agent,
Go Micro builds the distributed system the agent lives in (agents are
services in the mesh). Covers the category difference, a feature table,
when to choose each, and MCP/A2A interoperability.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CmdEY7pYmV5zzwCjNJ4ykL

* docs: replace ADK comparison slogan with concrete explanation

State plainly what each tool provides (ADK builds an agent process; Go Micro
builds the surrounding service mesh) instead of marketing phrasing.

* lint: apply golangci-lint autofixes; exclude ST1003 and demo errcheck

Mechanical, behaviour-preserving fixes applied by 'golangci-lint run --fix':
gofmt, misspell (US spelling), usestdlibvars (http.Method*/Status*), unconvert,
and the auto-fixable staticcheck simplifications (QF*, S1017/S1019/S1023/S1039).

Config: exclude ST1003 (remaining offenders are exported API renames, e.g.
web.Id, which would break compatibility) and skip errcheck for examples/ and
internal/harness/ (demo code where fire-and-forget is intentional).

Build and test compilation verified.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CmdEY7pYmV5zzwCjNJ4ykL

* lint: WIP cleanup checkpoint (errcheck config + partial fixes)

Checkpoint of an in-progress golangci-lint cleanup (background pass). Builds
cleanly; lint is not yet zero. Follow-up commit will complete the cleanup and
switch CI to a blocking full-tree lint.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CmdEY7pYmV5zzwCjNJ4ykL

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-06-22 17:21:47 +01:00
Asim Aslam c3542127dd Enhance comparison guide for Go Micro and Google ADK (#2993)
* docs: compare Go Micro with Google ADK in the comparison guide

Adds a 'vs Agent Frameworks (Google ADK)' section: ADK builds an agent,
Go Micro builds the distributed system the agent lives in (agents are
services in the mesh). Covers the category difference, a feature table,
when to choose each, and MCP/A2A interoperability.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CmdEY7pYmV5zzwCjNJ4ykL

* docs: replace ADK comparison slogan with concrete explanation

State plainly what each tool provides (ADK builds an agent process; Go Micro
builds the surrounding service mesh) instead of marketing phrasing.

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-06-22 17:07:45 +01:00
Asim Aslam 06659032a9 docs: install the CLI with @v6 instead of @latest (#2991)
Plain 'go install go-micro.dev/v6/cmd/micro@latest' fails on the public
module proxy with a version-constraints conflict: the proxy has cached the
sub-paths go-micro.dev/v6/cmd and .../cmd/micro as standalone v0/v1 modules
(from old github.com/micro/go-micro tags, surfaced during an earlier vanity
meta bug), so @latest resolves to v1.18.0 with a mismatched module path.

A version-prefix query (@v6) sidesteps it: those cached sub-path modules
have no v6.x.x versions, so Go falls back to the go-micro.dev/v6 root
module and builds correctly. Verified against proxy.golang.org.


Claude-Session: https://claude.ai/code/session_01CmdEY7pYmV5zzwCjNJ4ykL

Co-authored-by: Claude <noreply@anthropic.com>
2026-06-22 16:39:04 +01:00
Asim Aslam 8cad95cc29 website: add commercial support to the landing page (#2990)
The Sponsors section now also points production users to commercial
support & consulting, and the footer Support link routes to the support
page (community + commercial) instead of the question issue template.


Claude-Session: https://claude.ai/code/session_01CmdEY7pYmV5zzwCjNJ4ykL

Co-authored-by: Claude <noreply@anthropic.com>
2026-06-22 15:50:23 +01:00
Asim Aslam 2cbd6264d7 support: advertise commercial support, consulting, and sponsorship (#2989)
* support: advertise commercial support, consulting, and sponsorship

Adds a clear path to fund the project and pay for help, surfaced where
people look:
- SUPPORT.md + website /docs/support.html with a tier ladder (community,
  sponsor, support retainer, consulting)
- Commercial Support / Consulting issue template (the GitHub inbound funnel)
  and an issue-chooser config linking Sponsors and docs
- FUNDING.yml custom link to the support page; README section + nav entry

Community support stays free via issues; paid support and consulting are
scoped per engagement.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CmdEY7pYmV5zzwCjNJ4ykL

* ci: migrate golangci-lint to v2 config and enforce in CI (#2988)

- Rewrite .golangci.yaml for the v2 schema: start from the standard linter
  set (errcheck, govet, ineffassign, staticcheck, unused) plus bodyclose,
  misspell, unconvert, usestdlibvars. Sensible exclusions: generated code,
  built-in presets, looser tests, SA1019 deprecations (coordinated migration
  is separate), and the ported protoc-gen-micro generator for unused.
- Add a Lint workflow running golangci/golangci-lint-action with
  only-new-issues, so linting is enforced on new/changed code without a
  flag-day cleanup of the existing backlog.

The pre-existing backlog (errcheck/unused/naming and a few real bugs the
linter surfaces) is left for a dedicated follow-up so it can be reviewed on
its own rather than buried in this wiring change.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CmdEY7pYmV5zzwCjNJ4ykL

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-06-22 14:39:28 +01:00
Asim Aslam aa7cd6dc3b Enhance support agent example and fix protoless service scaffolding (#2986)
goreleaser / goreleaser (push) Waiting to run
* examples: support desk agent + blog walkthrough

A real-world, runnable example (examples/support): customers/tickets/notify
services become the agent's tools, a flow turns a ticket.created event into
the agent's work, and an approval gate guards the one action that touches a
customer. Runs with no API key (mock model) or against a live provider.

Adds blog/28 'Building a Support Agent in Go' and indexes both.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CmdEY7pYmV5zzwCjNJ4ykL

* fix(new): protoless services by default; fix @latest install (#2985)

micro new now scaffolds a reflection-based service by default — plain Go
types registered via service.Handle, no .proto, no Makefile proto target.
The generated project builds and runs with 'go run .' and zero external
tooling. Protocol Buffers move behind --proto (the crud/pubsub/api
templates imply it). When the proto workflow is used and protoc /
protoc-gen-go / protoc-gen-micro are missing, print exact install
instructions instead of failing with a cryptic plugin error.

Also fixes the 'go install go-micro.dev/v6/cmd/micro@latest' version
constraint conflict: the vanity go-import meta still advertised /v5, so Go
fell back to the bare module and resolved an ancient v1.x tag. Advertise
/v6 (keeping /v5 for existing users) and add a version-pin fallback note to
the install docs.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CmdEY7pYmV5zzwCjNJ4ykL

* fix(new,install): pin generated go.mod to current go-micro; lead install with prebuilt binary (#2985)

- micro new now requires the exact go-micro version the CLI was built from
  (via build info), falling back to 'latest' for dev builds. An explicit
  require is also more robust than a bare import: 'go mod tidy' reliably
  resolves it, where a requireless go.mod could fail vanity discovery.
- Make the precompiled binary (curl install.sh) the recommended install in
  the docs; demote 'go install' to a from-source option with the version-pin
  fallback note.
- Sync the stale internal/scripts/install.sh to the working website script
  (it expected an old micro-OS-ARCH asset name; releases ship
  micro_OS_ARCH.tar.gz).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CmdEY7pYmV5zzwCjNJ4ykL

* website: add corrected nginx vanity-import config (#2985)

The live go-micro.dev handler echoed the full request path into the
go-import prefix ($host$1), so go install go-micro.dev/v6/cmd/micro@latest
got prefix go-micro.dev/v6/cmd/micro — a package, not the module root — and
Go fell back to the ancient v1.x tags (version constraints conflict).

Add a dedicated /vN location that emits the module root (go-micro.dev/vN)
for any sub-path, and make the catch-all advertise the current module roots
instead of echoing arbitrary paths.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CmdEY7pYmV5zzwCjNJ4ykL

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-06-22 10:22:25 +01:00
Asim Aslam 456ff18176 examples: support desk agent + blog walkthrough (#2984)
A real-world, runnable example (examples/support): customers/tickets/notify
services become the agent's tools, a flow turns a ticket.created event into
the agent's work, and an approval gate guards the one action that touches a
customer. Runs with no API key (mock model) or against a live provider.

Adds blog/28 'Building a Support Agent in Go' and indexes both.


Claude-Session: https://claude.ai/code/session_01CmdEY7pYmV5zzwCjNJ4ykL

Co-authored-by: Claude <noreply@anthropic.com>
2026-06-20 10:23:24 +01:00
Asim Aslam cdc6ee9aa1 examples: support desk agent + blog walkthrough (#2983)
A real-world, runnable example (examples/support): customers/tickets/notify
services become the agent's tools, a flow turns a ticket.created event into
the agent's work, and an approval gate guards the one action that touches a
customer. Runs with no API key (mock model) or against a live provider.

Adds blog/28 'Building a Support Agent in Go' and indexes both.


Claude-Session: https://claude.ai/code/session_01CmdEY7pYmV5zzwCjNJ4ykL

Co-authored-by: Claude <noreply@anthropic.com>
2026-06-19 21:55:50 +01:00
Asim Aslam e5bf72abd8 docs: consolidate to a single agentic/DX roadmap (#2982)s
Replace the drifted, contradictory roadmap set (two public roadmaps, the
AI-native-era business-model doc, stale status snapshots) with one
canonical roadmap focused on agentic development and developer experience.

- internal/website/docs/roadmap.md — the single source of truth: where we
  are (v6), the principles (build into what people run; CLI-first; the
  0->1 and 0->hero getting-started contract; interaction; battle-tested),
  and prioritized work (cross-provider conformance + resilience now;
  durable agent loop, streaming, observability next).
- ROADMAP.md — concise, points to the canonical.
- roadmap-2026 + the internal ROADMAP_2026/STATUS docs — collapsed to
  pointers (keeps blog/CLAUDE links alive, removes drift).
- CLAUDE.md — references the single roadmap + CHANGELOG for status.

Co-authored-by: Claude <noreply@anthropic.com>
2026-06-19 20:11:02 +01:00
Asim Aslam 232126476a Revise acknowledgment for sponsorship and Discord invite
Updated the acknowledgment section to reflect sponsorship and invite discussion.
2026-06-19 19:27:13 +01:00
Asim Aslam 358b2ffd27 Update blog post to refine 'Flows' definition
Clarified the definition of 'Flows' to include agents and corrected minor wording issues.
2026-06-19 17:53:44 +01:00
Asim Aslam 45346337e2 Update V3 description for clarity and accuracy
Clarified the description of V3 and its market reception.
2026-06-19 17:50:21 +01:00
Asim Aslam 4b8b4d7bab Fix typo in blog post about Go Micro development 2026-06-19 17:35:57 +01:00
Asim Aslam 97f932a2e7 Revise blog post on Go Micro's revival and evolution
Updated the blog post to reflect the journey of Go Micro, including its revival and the integration of agents into the framework. Enhanced clarity and structure throughout the text.
2026-06-19 17:23:15 +01:00
Asim Aslam ca87efef2f feat(agent): expose run metadata + structured guardrail reasons to tool wrappers (#2981)
goreleaser / goreleaser (push) Waiting to run
Closes the remaining ask in #2980 without adding a parallel callback API.
ToolResult.Refused tags a guardrail block with a reason (ai.RefusedLoop /
RefusedMaxSteps / RefusedApproval) so a wrapper can switch on it instead of
parsing the message. ai.RunInfo (RunID, ParentID, Agent) rides on the
context passed to the tool handler, giving wrappers run correlation and
delegation lineage. Before/after/retry/failure were already covered by
AgentWrapTool; this adds the metadata. Docs + tests included.

Co-authored-by: Claude <noreply@anthropic.com>
2026-06-19 08:09:22 +01:00
Asim Aslam d54cfab1bd blog: Bringing an Open Source Project Back from the Dead (#27) (#2979)
A first-person journey of Go Micro from January 2015 through the
VC/company era, the platform pivot, the quiet years, and the revival via
the Claude Code grant — into v6 and the services/agents/flows model.

Co-authored-by: Claude <noreply@anthropic.com>
2026-06-18 19:41:08 +01:00
Asim Aslam 46c56ef7df test(natsjs): fix flaky TempDir cleanup race + vet-unsafe Fatalf (#2978)
TestSingleEvent intermittently failed on cleanup with 'directory not
empty': the embedded NATS JetStream server was still releasing files when
t.TempDir's RemoveAll ran at test end. Own the store dir (os.MkdirTemp)
and remove it only after server.Shutdown()+WaitForShutdown(). Also report
setup errors with Errorf instead of Fatalf/require, which are unsafe from
the non-test goroutine (go vet).

Co-authored-by: Claude <noreply@anthropic.com>
2026-06-18 12:06:19 +01:00
Asim Aslam c7657f73f4 Refactor agent plan storage, update docs, and release v6 (#2977)
goreleaser / goreleaser (push) Waiting to run
* test(harness): read agent plan from the scoped store

The store-scoping change moved an agent's plan from the default table
key agent/{name}/plan to its own table (database "agent", table {name},
key "plan"). The plan-delegate harness tests still read the old key and
failed with 'not found'; read through store.Scope(mem, "agent", name)
like the agent does.

* docs: orient agents-first across README, landing, and docs overview

Lead with agents (then services and flows), surface MCP + A2A as the
interop story, and frame agents as services. Landing hero and feature
grid reordered agents-first with an A2A gateway card.

* v6: module path go-micro.dev/v6, TLS secure by default, NewService

Cut v6. Three breaking changes, bundled so the major bump is paid once:

- Module path go-micro.dev/v5 -> go-micro.dev/v6 across all imports + go.mod.
- TLS verification on by default (was off). MICRO_TLS_SECURE removed;
  MICRO_TLS_INSECURE=true opts out for self-signed/dev.
- micro.NewService(name, opts...) is the canonical service constructor,
  symmetric with NewAgent/NewFlow; micro.New kept as a deprecated alias;
  the old name-less NewService(opts...) removed. Generators emit NewService.

Also ports the JWT auth token provider in-module (go-micro.dev/v6/auth/jwt/token
on golang-jwt/jwt/v5), dropping the v5-pinned github.com/micro/plugins/v5/auth/jwt
and the deprecated dgrijalva/jwt-go.

Docs/README/landing updated to v6 and @latest; v5->v6 migration guide added;
CHANGELOG cut as [6.0.0]. Blog posts left at their historical versions.

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-06-18 11:55:35 +01:00
Asim Aslam b9586f920b test(harness): read agent plan from the scoped store (#2976)
The store-scoping change moved an agent's plan from the default table
key agent/{name}/plan to its own table (database "agent", table {name},
key "plan"). The plan-delegate harness tests still read the old key and
failed with 'not found'; read through store.Scope(mem, "agent", name)
like the agent does.

Co-authored-by: Claude <noreply@anthropic.com>
2026-06-18 11:04:14 +01:00
Asim Aslam f42c9d1d69 feat(a2a): agents can serve A2A directly, no gateway required (#2975)
Refactor the A2A handler into a reusable dispatcher + Invoke seam and
expose NewAgentHandler(card, invoke) + Card(). An agent now serves its
own A2A endpoint with AgentA2A(addr) / WithA2A — handling tasks
in-process (no RPC hop, no separate gateway). The gateway and embedded
agent share the same handler; the only difference is RPC vs in-process
invocation. Docs, README, and changelog cover both deployment modes.

Co-authored-by: Claude <noreply@anthropic.com>
2026-06-18 10:57:38 +01:00
Asim Aslam 307b94aab7 Implement A2A protocol gateway and update documentation (#2974)
goreleaser / goreleaser (push) Waiting to run
* feat(a2a): Agent2Agent protocol gateway

Add gateway/a2a — exposes registered agents over the open A2A protocol so
agents on other frameworks can discover and call them. Agent Cards are
generated from registry metadata (the same way the MCP gateway derives
tools from service endpoints); incoming A2A tasks translate to the
agent's existing Agent.Chat RPC, so there's no per-agent code.

v1 is the synchronous JSON-RPC binding: message/send returns a completed
Task, tasks/get retrieves it, and Agent Cards are served for discovery;
streaming and push notifications are advertised as unsupported. Run with
'micro a2a serve' (cmd/micro/a2a). Tests cover card generation,
message/send, tasks/get, listing, and unknown-method errors.

* docs: A2A guide, README contents + A2A section, universe A2A check

- Add a Contents table of contents at the top of the README and an A2A
  subsection under Building Agents.
- Add the Agent2Agent (A2A) guide and register it in the docs nav.
- Exercise the A2A gateway in the universe harness: the concierge agent
  is reached over A2A (message/send -> Agent.Chat -> completed task).

* feat(a2a): outbound client — call external A2A agents

Add a2a.Client (Send/Card) so a Go Micro agent or flow can call an agent
on any framework by URL — the outbound counterpart to the gateway. Wired
in two places: flow.A2A(url) as a workflow step (the cross-framework
Dispatch), and agent delegate to an http(s) URL routes over A2A. The
universe harness now drives the gateway through the client, exercising
both directions. Tests cover client send/card and the round trip.

* docs: A2A both-directions — guide, README, changelog, blog #26

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-06-17 20:33:20 +01:00
Asim Aslam 7ee32e8721 Update changelog and enhance retrospective blog on agentic features (#2973)
* docs: changelog catch-up + retrospective blog (agentic development)

Add the headline agentic features that shipped this quarter but were
never logged (agents, plan/delegate, guardrails, workflows, x402) to the
changelog, and add blog #25 — a three-month progress reflection on Go
Micro becoming a framework for agentic development.

* docs: tighten retrospective post — cut slogans, triads, and filler

* docs: tighten retrospective intro, bridge, and conclusion for a single through-line

* docs: frame Go Micro as how you build a distributed system, not run one

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-06-17 12:29:25 +01:00
Asim Aslam 9fdcc24cce Implement durable execution and scoped state management for flows (#2972)
* docs: design note for flow steps + Checkpoint durable execution

* docs: fold in durable-execution decisions (State struct, single Step, run retention, retry)

* docs: rename State.Payload to State.Data

* feat(flow): ordered steps + Checkpoint durable execution

A flow can now be an ordered list of steps (a task with stages) instead
of a single LLM turn. State carries typed Data plus a Stage marker; each
step is checkpointed before and after via a pluggable Checkpoint
(store-backed by default), so a run survives a crash and resumes where it
stopped without re-running completed steps. Flow-level Retry with a
per-step override; runs retained for audit unless DeleteOnSuccess.

Step actions: Call (RPC), LLM (augmented turn), Dispatch (to an agent),
or any StepFunc. Single-step and agent-dispatch flows are unchanged.

* feat(flow): top-level re-exports + durable flow example

Expose the step/checkpoint API from the micro package (FlowSteps,
FlowStep, FlowState, FlowRetry, FlowWithCheckpoint, FlowCall/LLM/Dispatch,
Checkpoint, StoreCheckpoint) and add a runnable, key-free example
demonstrating crash + resume.

* docs: document durable flow steps (guide, README, CLI help)

* docs: blog post + changelog for durable workflows

* fix(flow): scope checkpoint keys by flow name (flow/{name}/runs/{id})

Run keys were flow/runs/{id} — a single global keyspace shared by every
flow on the default store. Namespace them by flow name so each flow's
state is kept apart. StoreCheckpoint now takes a scope argument (the flow
passes its name by default).

* feat(store): Scope handle; scope agent and flow state by name

Add store.Scope(s, database, table) — a store handle that confines every
operation to a database/table without mutating the shared store, so
co-located components don't clobber each other's table (the failure mode
of the global Init(Table(...)) approach).

Use it to keep each agent's memory and plan in its own table
(agent/{name}) and each flow's runs in its own (flow/{name}), instead of
one global table partitioned only by key prefix. Services already scope
by service name.

* feat: consistent state model — service store scoping, flow registry, list/history CLI

- service: scope store via store.Scope (database service / table name),
  retiring the Init(store.Table(name)) global-mutation hack; bridge the
  default store so handlers using store.DefaultStore stay isolated.
- flow: register in the registry as type=flow while running (with trigger
  and step count), deregister on Stop. Live discovery, like agents.
- cli: micro flow list (registry), micro flow runs <name> (durable store),
  micro agent history <name> (durable store). list = running, runs/history
  = durable, mirroring the service model.

* test: mini-universe end-to-end harness + scheduled GitHub Action

internal/harness/universe boots a small but real go-micro world — four
services, a durable checkout flow that crashes at payment and resumes,
and a guardrailed agent with a tool wrapper reached over RPC — drives the
scenario, asserts the end state (10 checks), and shuts down. Everything
is real except the LLM (mocked), so it's deterministic and needs no key;
-provider anthropic runs it live. Exits non-zero on failure, so it's an
end-to-end test, not just a demo.

Adds .github/workflows/universe.yml (push/PR/daily/dispatch) running the
universe + existing harnesses on the mock provider, plus an opt-in job
that runs live when ANTHROPIC_API_KEY is set. 'make harness' runs them
locally.

* ci: run the live universe job against AtlasCloud (ATLASCLOUD_API_KEY)

* ci: run the live universe job only on schedule or manual dispatch

The deterministic mock job still runs on push/PR/daily; the live
(AtlasCloud) job runs daily and on manual workflow_dispatch only, so
changes don't burn API credits on every PR but can still be checked
against a real model on demand.

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-06-17 12:02:47 +01:00
Asim Aslam 6b4ce55a7c Implement tool-execution wrappers and update documentation (#2971)
* feat(agent): tool-execution wrappers via WrapTool

Restructure ai.ToolHandler to the structured, ctx-carrying shape that
mirrors a go-micro RPC handler:

    func(ctx context.Context, call ai.ToolCall) ai.ToolResult

This reuses the existing ToolCall (with its correlation ID) and
ToolResult types instead of the flat (name, input)->(any, string)
signature, and adds ToolCall.Scan for typed argument access.

Add ai.ToolWrapper and the agent option WrapTool / micro.AgentWrapTool —
the tool-side analogue of client.CallWrapper and server.HandlerWrapper.
Reframe the built-in guardrails (MaxSteps, LoopLimit, ApproveTool) as
composed wrappers around a base handler; developer wrappers compose
outermost, so they observe every call and result, including refusals.

Update all provider call sites, the MCP server and chat handlers, the
integration harnesses, and docs to the new signature.

* examples: add agent-wrap-tool showing AgentWrapTool

A runnable example of tool-execution middleware: an observe wrapper that
times calls and records per-tool metrics (correlated by call ID), and a
retry wrapper that recovers a flaky service call before the model sees
it. Demonstrates outermost-first composition and the wrapper/guardrail
interaction (retries are seen by loop detection).

* docs: note AgentWrapTool in README capabilities and CHANGELOG

* fix(generate): pin scaffolded go.mod to one version constant

The two generators pinned different, stale go-micro versions (v5.24.0
for services, v5.25.0 for agents). Centralize on a single
goMicroVersion constant (v5.29.0) so generated services and agents stay
in sync with the framework and there's one place to bump on release.

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-06-17 09:52:27 +01:00
Asim Aslam ce0741a80c Implement tool-execution wrappers and restructure ToolHandler (#2970)
* feat(agent): tool-execution wrappers via WrapTool

Restructure ai.ToolHandler to the structured, ctx-carrying shape that
mirrors a go-micro RPC handler:

    func(ctx context.Context, call ai.ToolCall) ai.ToolResult

This reuses the existing ToolCall (with its correlation ID) and
ToolResult types instead of the flat (name, input)->(any, string)
signature, and adds ToolCall.Scan for typed argument access.

Add ai.ToolWrapper and the agent option WrapTool / micro.AgentWrapTool —
the tool-side analogue of client.CallWrapper and server.HandlerWrapper.
Reframe the built-in guardrails (MaxSteps, LoopLimit, ApproveTool) as
composed wrappers around a base handler; developer wrappers compose
outermost, so they observe every call and result, including refusals.

Update all provider call sites, the MCP server and chat handlers, the
integration harnesses, and docs to the new signature.

* examples: add agent-wrap-tool showing AgentWrapTool

A runnable example of tool-execution middleware: an observe wrapper that
times calls and records per-tool metrics (correlated by call ID), and a
retry wrapper that recovers a flaky service call before the model sees
it. Demonstrates outermost-first composition and the wrapper/guardrail
interaction (retries are seen by loop detection).

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-06-16 17:26:30 +01:00
Asim Aslam 5e5d253abd feat(agent): tool-execution wrappers via WrapTool (#2969)
Restructure ai.ToolHandler to the structured, ctx-carrying shape that
mirrors a go-micro RPC handler:

    func(ctx context.Context, call ai.ToolCall) ai.ToolResult

This reuses the existing ToolCall (with its correlation ID) and
ToolResult types instead of the flat (name, input)->(any, string)
signature, and adds ToolCall.Scan for typed argument access.

Add ai.ToolWrapper and the agent option WrapTool / micro.AgentWrapTool —
the tool-side analogue of client.CallWrapper and server.HandlerWrapper.
Reframe the built-in guardrails (MaxSteps, LoopLimit, ApproveTool) as
composed wrappers around a base handler; developer wrappers compose
outermost, so they observe every call and result, including refusals.

Update all provider call sites, the MCP server and chat handlers, the
integration harnesses, and docs to the new signature.

Co-authored-by: Claude <noreply@anthropic.com>
2026-06-16 16:26:56 +01:00
Asim Aslam e079e083da feat(agent): loop detection guardrail + document/blog agent guardrails (#2968)
Add LoopLimit: refuse a tool call repeated with identical arguments in
one Ask, with a self-heal message so the model changes approach. Catches
the no-progress loop that MaxSteps (count) and the gateway circuit
breaker (failures) miss. Enforced at the same tool-handler choke point as
MaxSteps/ApproveTool; on by default (lenient 3); AgentLoopLimit(0) to
disable. Tests cover repeats, distinct calls, disabled, and default-on.

Docs: new Agent Guardrails guide (MaxSteps/LoopLimit/ApproveTool, the
ApproveTool integration seam for external policy engines, and the
gateway's RateLimit/CircuitBreaker), nav + README + AGENT_DESIGN updates,
and blog/23 'Agent Guardrails'.

Co-authored-by: Claude <noreply@anthropic.com>
2026-06-16 14:40:05 +01:00
Asim Aslam a1a57799c3 Add payment requirements to tool catalog and implement x402 client (#2966)
* feat(mcp): advertise x402 payment requirements in the tool catalog

/mcp/tools now includes each priced tool's payment requirements (amount,
network, asset, payTo) when payments are enabled, so an agent can see the
cost before calling and choose by price — a shoppable catalog, the
foundation for a tool marketplace. Free tools carry no payment block; the
shared Tool struct is copied when pricing so it isn't mutated. Tests cover
priced/free tools and payments-disabled. Documented in the payments guide.

* feat(x402): consumer client with a spend budget (pay-and-retry)

Add x402.Client, the consumer counterpart to Middleware: it settles 402
challenges automatically via a pluggable Payer, up to a spend Budget. A
call that would exceed the budget is refused before any payment is made,
and spend accumulates across calls — the spend cap that keeps an
autonomous, paying caller in bounds. Tests cover pay-within-budget,
refuse-over-budget, budget accumulation, and free endpoints, end to end
against the server Middleware with a mock facilitator and payer. Guide
documents the consumer side; agent-level AgentMaxSpend is the next step.

* chore: gofmt gateway/mcp/benchmark_test.go (trailing newline)

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-06-15 21:12:29 +01:00
Asim Aslam e4d2a41c32 refactor(x402): Amount/Amounts naming + per-tool amounts + docs (#2965)
goreleaser / goreleaser (push) Waiting to run
Follow-up to the merged x402 integration (#2964). Drop the commerce-y
'price' vocabulary for the protocol's own 'amount', and add per-tool
pricing as an operator concern (the way scopes/rate-limits are set at the
gateway).

- x402.Config: Price -> Amount (default), plus Amounts map for per-tool
  overrides; AmountFor(tool) resolves per-tool -> default. Add a Require
  primitive (per-request enforcement) and LoadConfig for an operator
  config file.
- MCP gateway: enforce payment per-tool inside /mcp/call (where scopes
  are enforced) using AmountFor, instead of a flat path-based middleware.
- CLI: --x402-price -> --x402-amount; add --x402-config (per-tool file)
  to micro mcp serve and micro-mcp-gateway.
- docs: new Payments (x402) guide + nav + README section; blog/22
  updated to Amount/Amounts and the config-file model.

Co-authored-by: Claude <noreply@anthropic.com>
2026-06-15 17:04:34 +01:00
Asim Aslam 9deac487cb feat(x402): opt-in agent-native payments for tools (#2964)
Integrate the x402 payment protocol (HTTP 402) so a tool can require a
stablecoin payment and an agent can settle it — the next step after
autonomous agents (blog 21): agents that act, and pay.

- wrapper/x402: HTTP middleware enforcing the 402 challenge/verify flow,
  with a pluggable Facilitator interface. Go Micro carries no chain or
  crypto code — verification/settlement is delegated to a facilitator
  (Coinbase CDP, Alchemy, self-hosted), so Base and Solana are just
  different facilitators behind one interface. HTTPFacilitator default;
  tests cover challenge / accept / reject via a mock facilitator.
- MCP gateway: optional Options.Payment gates /mcp/call (listing tools
  and health stay free); off unless configured.
- micro mcp serve and micro-mcp-gateway: opt-in --x402-pay-to/-price/
  -network/-facilitator flags (env vars on the standalone binary).
- blog/22 'Integrating x402: Payments for Agents'; README feature row.

Pricing is flat per call for now; richer models and an agent-side spend
cap (next to MaxSteps/ApproveTool) are follow-ups.

Co-authored-by: Claude <noreply@anthropic.com>
2026-06-15 16:41:25 +01:00
Asim Aslam 6eec83a045 blog: 'When the Event Is the Prompt' (#21) + autonomous agent-flow harness (#2962)
The autonomy direction: agents that run on events, not human prompts.

- internal/harness/agent-flow: a runnable, deterministic demo — a
  user.created broker event drives a Flow that hands off to a registered
  agent (FlowAgent), which creates a workspace and sends a welcome over
  real RPC. Only the LLM is mocked; passes under -race.
- blog/21: 'When the Event Is the Prompt' — the shift from agents you
  talk to, to agents that act on their own; where microagents become
  real; and the honest bar autonomy raises (guardrails, observability,
  durable/resumable execution — the next things to build).

Co-authored-by: Claude <noreply@anthropic.com>
2026-06-15 12:16:08 +01:00
Asim Aslam 9dae4e34b7 Enhance README with sponsorship CTA and improve agent architecture (#2961)
* docs: add 'become a sponsor' call-to-action linking to Discord

Now that there are a couple of sponsors, invite more: a short CTA under
the Sponsors section in the README and on the landing page, pointing to
the Discord to get in touch.

* fix(health): remove duplicate RegistryCheck declaration

Two PRs (#2957 and #2958) each added a RegistryCheck to the health
package, leaving the package uncompilable on master (RegistryCheck
redeclared: health/registry.go vs health/health.go). Keep the
health.go implementation — it honors the check's context timeout so a
hung registry (e.g. an unreachable etcd) reports down instead of
blocking the probe — and remove the duplicate registry.go and its test.
registry_check_test.go already covers healthy/down/nil/timeout/not-ready.

* feat(agent): pluggable memory and custom tools

Make agents compose the way services do — pluggable pieces with working
defaults — by adding the two abstractions an agent needs beyond the model:

- Memory: a pluggable interface for conversation memory. The default is
  store-backed and durable across restarts (the previous hardcoded
  behavior, now behind an interface); supply your own with WithMemory
  (in-memory, database, semantic store). NewMemory / NewInMemory provided.
- Custom tools: WithTool registers any function as a tool the agent can
  call, so agents are no longer limited to orchestrating RPC services.

Both exposed at the micro package (AgentMemory, AgentTool, NewMemory,
NewInMemory). Behavior-preserving refactor of the agent's history into
the default Memory; tests cover persistence, in-memory, clear, custom
tool dispatch and errors. README + AGENT_DESIGN document the pluggable
composition (model / memory / tools / guardrails).

* blog: 'Doubling Down on Agents' (#20)

The vision post for making agents a first-class framework the way
services were: opinionated, batteries-included, pluggable. Frames an
agent as a composition of model + memory + tools + guardrails with
working defaults; introduces the new pluggable memory and custom tools;
makes the microagents argument (an agent for everything, distributed
like microservices); and lays out the three primitives — services,
agents, workflows — as one substrate, with an honest list of the gaps
still to fill (knowledge/retrieval, streaming, explicit loop).

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-06-10 11:04:23 +01:00
Asim Aslam b41dfa02f2 docs: add 'become a sponsor' call-to-action linking to Discord (#2960)
Now that there are a couple of sponsors, invite more: a short CTA under
the Sponsors section in the README and on the landing page, pointing to
the Discord to get in touch.

Co-authored-by: Claude <noreply@anthropic.com>
2026-06-10 10:30:10 +01:00
Copilot 0b41c71681 feat(health): add RegistryCheck for registry connectivity health checks (#2957)
goreleaser / goreleaser (push) Waiting to run
* Initial plan

* feat(health): add RegistryCheck for registry connectivity health checks

Add a RegistryCheck function to the health package that creates a health
check verifying connectivity to the service registry. This enables
Kubernetes readiness probes to detect when a service loses its connection
to the registry (e.g. etcd).

Usage:
  health.Register("registry", health.RegistryCheck(reg))

* fix(health): simplify error assertion in registry check test

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
2026-06-10 08:25:23 +01:00
Asim Aslam 550033dcce Optimize image formats and fix lease re-registration issue (#2959)
* perf: convert generated PNGs to optimized JPEGs (12MB -> 1.5MB)

The landing and docs loaded 18 AI-generated PNGs at 0.5-1MB each. They're
1200x800 RGB illustrations with no transparency, so they recompress ~8x
as progressive JPEG (quality 82) with no visible loss. Convert all,
update every reference (.png -> .jpg), and drop the originals (including
the unused hero.png). Generated images: 12.3MB -> 1.5MB.

* fix(registry/etcd): re-register when a lease silently expires (#2956)

The keepalive rework (long-lived KeepAlive instead of KeepAliveOnce)
moved lease renewal entirely onto the keepalive goroutine; the 30s
periodic Register now skips on the 'unchanged' check. The goroutine only
reacted to the keepalive channel closing, so a lease that expired
server-side without a prompt channel close (e.g. a partition that
outlasted the 90s TTL) left the node de-registered from etcd while the
cache still believed it was registered — and nothing re-registered it.
That is the hidden-failure mode reported in #2956.

React to a non-positive TTL keepalive response the same as a channel
close: drop the cached lease/hash so the next Register performs a full
re-registration. Extract the loop into keepAliveLoop and unit-test the
TTL-expired, channel-closed, and healthy paths (no etcd required).

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-06-10 08:24:49 +01:00
Asim Aslam 584a9f2132 feat(health): add RegistryCheck for registry connectivity (#2956) (#2958)
A go-micro service can keep running while it has silently lost its
connection to the registry (etcd, Consul, …) — the process looks healthy
but other services can no longer discover it, and Kubernetes sees the
pod as fine. health.RegistryCheck(reg) probes connectivity via
ListServices and, registered as a critical check, makes /health/ready
report not-ready so a readiness probe can pull the pod from rotation.

- Works with any registry implementation (no interface change).
- Honors the check timeout: an unreachable/hung registry is reported
  down rather than blocking the probe.
- Tests cover healthy, down, timeout, nil, and the not-ready integration.
- Documented in the health guide with the Kubernetes readiness example.

Co-authored-by: Claude <noreply@anthropic.com>
2026-06-10 08:18:00 +01:00
Asim Aslam 6488d8402d Organize README features, enhance testing, and update docs (#2955)
* docs: group README features by section (AI / Framework / DX)

The features table repeated 'AI' down the Category column. Split into
three grouped tables — AI, Framework, Developer experience & deployment —
dropping the repetitive column. Adds a Guardrails row (MaxSteps,
ApproveTool).

* test: flow-to-agent end-to-end in the harness

Proves 'Flow triggers, Agent reasons': a workflow with FlowAgent hands an
event to the registered conductor agent over RPC, which plans, creates
tasks, and delegates to comms — the whole chain over real RPC with only
the LLM mocked. Deterministic (shared in-memory registry, no sleeps),
passes under -race.

* blog: 'The Evolution of Microservices' (#19)

A technical history of distributed-systems eras — the monolith's
coordination cost, the distributed-systems tax, containers and
declarative orchestration, the service mesh, and the modular-monolith
correction — establishing the durable unit (named, typed, discoverable,
independently deployable) that every runtime wave required. Then the
technical argument for agents: an LLM tool call needs exactly a service
interface, so the caller shifts from deterministic code to a reasoner
that composes typed capabilities from intent, with the honest caveats
(non-determinism, cost, guardrails). Not a product pitch.

* docs: bump install version to v5.27.0

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-06-08 10:16:05 +01:00
Asim Aslam d3be610367 Refactor README features and add end-to-end flow testing (#2954)
goreleaser / goreleaser (push) Waiting to run
* docs: group README features by section (AI / Framework / DX)

The features table repeated 'AI' down the Category column. Split into
three grouped tables — AI, Framework, Developer experience & deployment —
dropping the repetitive column. Adds a Guardrails row (MaxSteps,
ApproveTool).

* test: flow-to-agent end-to-end in the harness

Proves 'Flow triggers, Agent reasons': a workflow with FlowAgent hands an
event to the registered conductor agent over RPC, which plans, creates
tasks, and delegates to comms — the whole chain over real RPC with only
the LLM mocked. Deterministic (shared in-memory registry, no sleeps),
passes under -race.

* blog: 'The Evolution of Microservices' (#19)

A technical history of distributed-systems eras — the monolith's
coordination cost, the distributed-systems tax, containers and
declarative orchestration, the service mesh, and the modular-monolith
correction — establishing the durable unit (named, typed, discoverable,
independently deployable) that every runtime wave required. Then the
technical argument for agents: an LLM tool call needs exactly a service
interface, so the caller shifts from deterministic code to a reasoner
that composes typed capabilities from intent, with the honest caveats
(non-determinism, cost, guardrails). Not a product pitch.

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-06-08 09:09:48 +01:00
Asim Aslam 35bc58e5d2 Enhance onboarding experience and clarify workflows vs agents (#2953)
* blog: 'Not Everything Should Be an Agent' (#18) on workflows

The workflow counterpart to the plan/delegate post: when the path is
known, use a deterministic Flow, not an autonomous agent. Frames flow vs
agent as two modes of the same building blocks, covers flow-triggers-
agent dispatch and the agent guardrails, and gives the simplest-first
guidance (single call -> workflow -> agent). Continues the arc from
blog 14/16/17; references Building Effective Agents in passing.

* docs: fix new-user onboarding friction

- README: lead Quick Start with a no-key 30-second path (micro new ->
  micro run -> curl), then the AI --prompt path with an explicit
  'export ANTHROPIC_API_KEY' so the headline command no longer fails
  silently for users without a key.
- Unify all install versions to v5.26.0 (README + docs were split across
  v5.16.0 / v5.25.0).
- Refresh the docs landing overview from the old 'microservices
  framework' framing to 'services and agents', matching the README.
- getting-started: add Prerequisites (Go 1.21+, and that a provider key
  is only needed for AI features).
- README features: Flows -> Workflows wording.

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-06-08 08:52:11 +01:00
Asim Aslam e416ea4a75 Enhance agent workflows with guardrails and documentation updates (#2952)
* docs: map go-micro onto Anthropic's workflows-vs-agents taxonomy

- new guide 'Agents and Workflows': adopts Anthropic's Building Effective
  Agents vocabulary — workflow (predefined path) = flow, agent (dynamic
  self-direction) = agent — maps the augmented-LLM building block and the
  five workflow patterns onto go-micro, and shows routing (chat router)
  and orchestrator-workers (conductor + plan/delegate) are already native.
- flow package doc reframed as a workflow (predefined path) per the same
  taxonomy, with guidance on flow vs agent.
- nav + README link the new guide.

* feat: agent guardrails — step limit and tool approval hook

Anthropic's Building Effective Agents stresses stopping conditions and
human-in-the-loop checkpoints for autonomous agents. Add both as plain
options enforced at the tool-handler choke point — no provider changes,
no new abstraction:

- MaxSteps(n): bound tool executions per Ask; beyond the limit, actions
  are refused and the model is told to stop and summarize.
- ApproveTool(fn): gate each action before it runs; returning false
  blocks it and surfaces the reason to the model. The internal plan tool
  is never gated.

Exposed at the micro package (AgentMaxSteps, AgentApproveTool, ApproveFunc).
Tests cover the limit, blocking, and that plan is not gated. Guardrails
section of the agents-and-workflows guide updated from 'active work' to
documented options.

* feat: flow can dispatch to an agent (flow triggers, agent reasons)

Unify the engine without collapsing the workflow/agent distinction. A
Flow with Agent set hands each event's rendered prompt to a named
registered agent over RPC (Agent.Chat) instead of running its own LLM
step — so the workflow stays the deterministic trigger and the agent is
the reasoning engine, with its plan, delegate, memory, and guardrails.
A plain flow is unchanged (single augmented-LLM step).

- flow.Agent(name) / micro.FlowAgent(name); flow stores the client and
  skips model setup when dispatching.
- test: dispatch routes to comms.Agent.Chat with the rendered prompt and
  records the reply.
- guide: 'Flow triggers, Agent reasons' section.

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-06-08 08:32:32 +01:00
Asim Aslam 830c8d84c2 Claude/loving meitner 3 etoi (#2951)
* rename coordinator agent to conductor in example and docs

* add plan & delegate integration harness

Runs the real go-micro stack end to end — services, registry, RPC, the
agent loop, store, and delegate-first routing — with only the LLM mocked
by a deterministic provider. Proves discovery, tool execution, plan
persistence, and agent-to-agent delegation over RPC work without an API
key; swap the provider to run the same flow against a live model.

* test: deterministic CI integration test + provider flag for harness

- main_test.go: TestPlanDelegateEndToEnd drives the full real stack
  (services, RPC, agent loop, store, delegate-first routing) over a
  shared in-memory registry — no mDNS, no sleeps. Asserts 3 tasks
  created via RPC, plan persisted to the store, and delegation reaching
  the comms agent (notify called once). Passes under -race, ~0.03s.
- main.go: add -provider flag (defaults to mock) and key detection so the
  same harness runs against a live model with no code change.

* chore: gitignore built harness/example binaries

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-06-07 19:28:24 +01:00
Asim Aslam 6a73608e9c rename coordinator agent to conductor in example and docs (#2950)
Co-authored-by: Claude <noreply@anthropic.com>
2026-06-07 18:33:04 +01:00
Asim Aslam cb33decd97 Add built-in plan and delegate tools for agents with examples (#2949)
* feat: add plan and delegate as built-in agent tools

Give agents two self-capabilities, expressed as plain tools wired into
the existing tool handler — no harness or graph, consistent with
"services are the only abstraction":

- plan: record/update an ordered plan, persisted to store-backed memory
  and surfaced in the system prompt on later turns (externalized
  planning).
- delegate: hand a self-contained subtask to another agent.
  Delegate-first — if the target names a registered agent it is called
  via RPC; otherwise a focused ephemeral sub-agent is created with
  agent.New + Ask in a fresh, isolated context (loads/persists no
  history, no built-in tools, so it cannot re-delegate).

Both are added automatically to any non-ephemeral agent, so existing
micro.NewAgent services and micro chat routing get them for free.
Tests are hermetic (memory store + memory registry).

* feat: add agent-plan-delegate example and document plan/delegate

- examples/agent-plan-delegate: coordinator that plans multi-step work,
  creates tasks with its own tools, and delegates notification to a
  separate registered comms agent over RPC.
- integration tests driving the full Ask loop through a fake provider:
  plan tool exposure + persistence, ephemeral delegation with isolated
  context, delegate-first RPC routing to a registered agent.
- docs: README (Building Agents + features + examples), AGENT_DESIGN
  (Built-in Capabilities), agent-patterns guide (Pattern 9), CLAUDE.md.

* docs: blog post and guide for plan & delegate

- blog/17: "Plan & Delegate: Deep Agents in Go" — what the feature is,
  how plan and delegate work, and a runnable getting-started path.
- guides/plan-delegate: reference guide with the smallest-agent snippet,
  plan/delegate semantics, and the multi-agent example; linked in nav.
- example: auto-detect provider/key from common env vars (ANTHROPIC_API_KEY,
  OPENAI_API_KEY, ...) so 'export KEY && go run main.go' just works.
- onboarding: getting-started paths now include go mod init / go get and a
  clone-and-run path, so a reader can actually run it from a cold start.

* refactor: reframe plan/delegate blog and clean up sub-agent construction

- blog/17 retitled "Agents That Plan and Delegate" and reframed around
  intent (plan = state intent, delegate = direct it), positioned as the
  next beat after blog 15/16 and tied to the existing store + agent RPC
  rather than re-announcing them. "Deep agents" now a single in-passing
  nod, matching how blog 14 references LangChain.
- agent: add unexported newEphemeral constructor for sub-agents instead
  of type-asserting the public Agent interface to set an internal field;
  matches the options-only construction idiom used elsewhere.

* feat: expose plan & delegate in the micro chat fallback

Add agent.Builtins(opts...) — returns the built-in tools plus a handler,
so the plan/delegate capabilities can be wired into a tool loop that
isn't a running Agent. micro chat's direct-service fallback now reuses
it (single source of truth, no duplicated handler logic), so planning
and delegation are available there too, not just for registered agents.
Adds a test for the accessor; notes CLI availability in the guide.

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-06-07 10:55:34 +01:00
Asim Aslam 9bed04ced0 Enhance micro run with interactive console and image compression (#2948)
Run Tests / Unit Tests (push) Waiting to run
Run Tests / Etcd Integration Tests (push) Waiting to run
goreleaser / goreleaser (push) Waiting to run
* perf: compress hero image — 1.4MB to 80KB

Resized from 1536px to 1200px, converted to JPEG at quality 80.
80KB loads instantly vs 1.4MB stalling on slower connections.

https://claude.ai/code/session_01QTp4SshuVmLAvvEGJe4TJd

* docs: micro run drops into interactive console

One command does everything — generate, start, and chat. No
separate micro chat step. The landing page shows micro run
dropping straight into the > prompt.

https://claude.ai/code/session_01QTp4SshuVmLAvvEGJe4TJd

* feat: interactive console in micro run, -d for detached mode

micro run now drops into an interactive chat console after services
start. The console discovers services, exposes them as tools, and
lets you talk to them through an LLM — same as micro chat but
built into the run experience.

- Detects MICRO_AI_PROVIDER and MICRO_AI_API_KEY from environment
- Falls back to provider-specific env vars (ANTHROPIC_API_KEY, etc.)
- If no API key, prints hint and blocks on Ctrl-C (no console)
- -d / --detach flag skips the console (background mode)
- Ctrl-C always shuts everything down

Removed adopters section from README.

https://claude.ai/code/session_01QTp4SshuVmLAvvEGJe4TJd

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-06-05 20:49:25 +01:00
Asim Aslam 2e89961386 perf: compress hero image — 1.4MB to 80KB (#2947)
Resized from 1536px to 1200px, converted to JPEG at quality 80.
80KB loads instantly vs 1.4MB stalling on slower connections.

https://claude.ai/code/session_01QTp4SshuVmLAvvEGJe4TJd

Co-authored-by: Claude <noreply@anthropic.com>
2026-06-05 14:38:02 +01:00
Asim Aslam 39e8dc7311 Reposition hero section and optimize hero image for landing page (#2946)
* docs: reposition hero — framework for services and agents

Landing page: "Build Services and Agents in Go" — positions as a
framework, not a code generator. Tagline: "A framework for
microservices that AI agents can discover, use, and manage."

Hero command reverts to go get (the framework) instead of
micro run --prompt (a feature).

README matches: "framework for building services and agents in Go."

https://claude.ai/code/session_01QTp4SshuVmLAvvEGJe4TJd

* perf: compress hero image — 1.4MB to 80KB

Resized from 1536px to 1200px, converted to JPEG at quality 80.
80KB loads instantly vs 1.4MB stalling on slower connections.

https://claude.ai/code/session_01QTp4SshuVmLAvvEGJe4TJd

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-06-05 14:32:35 +01:00
Asim Aslam c93bcdf4d3 Update landing page documentation and fix flow CLI import (#2945)
* docs: remove code references from landing page feature grid

Landing page describes concepts, not APIs. Removed micro.NewAgent()
and micro.NewFlow() code references. Features described in plain
language — what they do, not how to code them.

https://claude.ai/code/session_01QTp4SshuVmLAvvEGJe4TJd

* fix: update micro flow CLI to import from go-micro.dev/v5/flow

The flow package moved to top-level but the CLI still imported
from the old ai/flow path. Fixed to use go-micro.dev/v5/flow.

https://claude.ai/code/session_01QTp4SshuVmLAvvEGJe4TJd

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-06-05 11:20:40 +01:00
Asim Aslam cd760a29f1 Update landing page content and fix CLI import path (#2944)
* docs: remove code references from landing page feature grid

Landing page describes concepts, not APIs. Removed micro.NewAgent()
and micro.NewFlow() code references. Features described in plain
language — what they do, not how to code them.

https://claude.ai/code/session_01QTp4SshuVmLAvvEGJe4TJd

* fix: update micro flow CLI to import from go-micro.dev/v5/flow

The flow package moved to top-level but the CLI still imported
from the old ai/flow path. Fixed to use go-micro.dev/v5/flow.

https://claude.ai/code/session_01QTp4SshuVmLAvvEGJe4TJd

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-06-05 11:12:00 +01:00
Asim Aslam e45d3df0ad docs: remove code references from landing page feature grid (#2943)
Landing page describes concepts, not APIs. Removed micro.NewAgent()
and micro.NewFlow() code references. Features described in plain
language — what they do, not how to code them.

https://claude.ai/code/session_01QTp4SshuVmLAvvEGJe4TJd

Co-authored-by: Claude <noreply@anthropic.com>
2026-06-05 11:08:17 +01:00
Asim Aslam 6731ee2f0c Update documentation and blogs for RPC-based agent architecture (#2942)
* docs: update blog posts 15 and 16 to reflect RPC-based agents

Blog 15: replaced broker-based agent communication with RPC —
agents are services, they communicate via standard RPC, no pub/sub
hacks. Updated the framework mapping section.

Blog 16: added proto definition, micro call example, and explanation
that agents are real services with proto-defined endpoints. Updated
Ask() method name.

https://claude.ai/code/session_01QTp4SshuVmLAvvEGJe4TJd

* docs: update agent design doc and blog posts for RPC-based agents

Rewrote AGENT_DESIGN.md — agents are services with proto-defined
Agent.Chat endpoints, communicate via RPC, no broker dependency.
Includes proto definition, CLI examples, generation output.

Blog 15: replaced broker references with RPC.
Blog 16: added proto definition and micro call example.

https://claude.ai/code/session_01QTp4SshuVmLAvvEGJe4TJd

* docs: purge all stale broker-based agent references

Updated across all surfaces:
- README: agents described as services with RPC, Ask() not Chat(),
  micro call example instead of micro agent chat
- Blog 15: replaced broker communication with RPC description
- Blog 16: replaced "coordinate through the broker" with RPC
- Getting started: agent is a service with proto endpoint, Ask()
  not Chat(), added micro flow CLI commands (run/exec), expanded
  CLI workflow table

https://claude.ai/code/session_01QTp4SshuVmLAvvEGJe4TJd

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-06-05 11:02:45 +01:00
Asim Aslam f7c042ef26 docs: update blog posts 15 and 16 to reflect RPC-based agents (#2941)
Blog 15: replaced broker-based agent communication with RPC —
agents are services, they communicate via standard RPC, no pub/sub
hacks. Updated the framework mapping section.

Blog 16: added proto definition, micro call example, and explanation
that agents are real services with proto-defined endpoints. Updated
Ask() method name.

https://claude.ai/code/session_01QTp4SshuVmLAvvEGJe4TJd

Co-authored-by: Claude <noreply@anthropic.com>
2026-06-05 10:31:02 +01:00
Asim Aslam 1bc886fa82 Introduce Agent abstraction and integrate with chat router (#2939)
* docs: Agent interface design sketch

Proposes Agent as a top-level abstraction alongside Service in the
micro package. Agent manages services — scoped tools, system prompt,
conversation memory, registry-discoverable.

Design only, no implementation.

https://claude.ai/code/session_01QTp4SshuVmLAvvEGJe4TJd

* feat: Agent as a first-class abstraction

Introduce micro.NewAgent() alongside micro.New() — Agent is to
intelligence what Service is to capability.

Agent interface:
- Chat(ctx, message) (*Response, error) — core interaction method
- Run() — registers in registry, subscribes to broker, blocks
- Stop() — graceful shutdown
- Scoped tools — only sees endpoints of its assigned services
- Persistent memory — conversation history stored in store
- Agent-to-agent — communication via broker topics

Top-level API:
  agent := micro.NewAgent("task-mgr",
      micro.AgentServices("task"),
      micro.AgentPrompt("You manage tasks."),
      micro.AgentProvider("anthropic"),
  )
  agent.Run()

https://claude.ai/code/session_01QTp4SshuVmLAvvEGJe4TJd

* feat: wire agents into chat router, add micro agent CLI, expose Flow

Three top-level abstractions:
  micro.New("task")              — Service (capability)
  micro.NewAgent("task-mgr")     — Agent (intelligence)
  micro.NewFlow("onboard-user")  — Flow (event-driven orchestration)

micro chat as router:
- Discovers agents from registry on startup
- Single agent: routes directly
- Multiple agents: LLM classifies intent, dispatches to right agent
  via route_to_agent tool
- No agents: falls back to current direct-service behaviour
- Banner shows discovered agents

micro agent CLI:
- micro agent list — shows registered agents and their services
- micro agent describe <name> — shows agent details from registry

https://claude.ai/code/session_01QTp4SshuVmLAvvEGJe4TJd

* feat: move flow to top level, update docs for three abstractions

Package structure now consistent:
  service/   — Service (capability)
  agent/     — Agent (intelligence)
  flow/      — Flow (event-driven orchestration)

ai/flow/ kept as backward-compatible re-export.

Updated across all surfaces:
- CLAUDE.md: added agent/ and flow/ to project structure
- README: added "Building Agents" section with NewAgent() examples,
  updated features table (Agents, Flows, Chat router), CLI table
  (agent list, agent describe), docs links
- Website: features grid shows Services, Agents, Flows as the three
  pillars alongside generation, MCP, and pluggable architecture
- micro.go: Flow imported from top-level flow/ package

https://claude.ai/code/session_01QTp4SshuVmLAvvEGJe4TJd

* docs: rewrite getting-started, fix ai-integration import paths

Getting started now covers all three abstractions:
- Service (write handlers, micro run, templates)
- Agent (micro.NewAgent, scoped tools, memory, CLI)
- Flow (event-driven LLM orchestration)
Leads with prompt-based generation, then manual service creation.

ai-integration.md: fixed flow import path from go-micro.dev/v5/ai/flow
to go-micro.dev/v5/flow, updated stack diagram to show agent/flow/chat.

https://claude.ai/code/session_01QTp4SshuVmLAvvEGJe4TJd

* blog: Introducing micro.NewAgent()

Post 16 — announces Agent as a first-class abstraction. Shows the
API (NewAgent, AgentServices, AgentPrompt, AgentProvider), scoped
tools, persistent memory, multi-service agents, multi-agent systems,
and the three-abstraction comparison table (Service/Agent/Flow).

https://claude.ai/code/session_01QTp4SshuVmLAvvEGJe4TJd

* feat: fix agent registration, blog post 16

Agent registration:
- Add node with address so mDNS can discover agents
- Store type and services in node metadata (mDNS requirement)
- Connect broker before subscribing, non-fatal if broker unavailable
- Print registration confirmation on Run()

Agent/chat discovery:
- Check both service-level and node-level metadata for type=agent
  (mDNS stores metadata on nodes, not services)

Blog post 16: "Introducing micro.NewAgent()" — announces the Agent
abstraction with code examples, comparison table, multi-agent patterns.

Tested end-to-end: micro run → micro agent list discovers the agent →
micro chat routes to it → agent calls service endpoints.

https://claude.ai/code/session_01QTp4SshuVmLAvvEGJe4TJd

* feat: agents are proper services with RPC Chat endpoint

Refactored agent to use server.Server instead of fake registry entries.
An agent now:
- Creates a real RPC server with server.Name(agentName)
- Registers an Agent.Chat handler callable via standard RPC
- Sets server metadata type=agent, services=x,y for discovery
- No more fake addresses or broker hacks

micro chat calls agents via RPC (client.Call) instead of creating
local agent instances. The registry stays clean — agents are real
services with real endpoints.

Removed broker dependency from agent options. Agent-to-agent
communication is just RPC like everything else.

https://claude.ai/code/session_01QTp4SshuVmLAvvEGJe4TJd

* feat: agent uses proto-defined RPC interface

Added agent/proto/agent.proto with Agent service definition:
  rpc Chat(ChatRequest) returns (ChatResponse)

Agent now implements the generated AgentHandler interface and
registers via pb.RegisterAgentHandler. The Chat endpoint is a
standard proto-based RPC callable by any go-micro client.

Renamed the programmatic API from Chat() to Ask() to avoid
collision with the proto handler method name.

micro chat calls agents via standard RPC with JSON-encoded
request/response — no special types needed on the caller side.

https://claude.ai/code/session_01QTp4SshuVmLAvvEGJe4TJd

* feat: generate agent alongside services, update all docs

micro run --prompt now generates an agent binary that manages all
the generated services. The agent reads MICRO_AI_PROVIDER and
MICRO_AI_API_KEY from the environment. micro run propagates these
when started with --prompt.

Run banner shows services and agents separately.

Updated README, getting-started guide, and landing page to show
the complete flow: generate → services + agent start → micro chat
routes to agent → agent orchestrates services.

https://claude.ai/code/session_01QTp4SshuVmLAvvEGJe4TJd

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-06-05 10:25:14 +01:00
Asim Aslam 844ac5bc52 Revamp landing hero and introduce agent-based microservices model (#2938)
* docs: update landing hero — describe it, run it, talk to it

Lead with the AI-first experience instead of "write services in Go."
The entry point is now describing what you need, not writing code.

https://claude.ai/code/session_01QTp4SshuVmLAvvEGJe4TJd

* blog: Agents for Services — a new model for microservices

Post 15 — explores the concept of distributed agents managing
services. Each service has an agent assigned to it (not embedded
in it). Agents are the intelligence layer; services are the
capability layer. Multi-service agents span domain boundaries.
Agent-to-agent communication through the broker.

https://claude.ai/code/session_01QTp4SshuVmLAvvEGJe4TJd

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-06-04 20:05:45 +01:00
Asim Aslam bc570d674f docs: update landing hero — describe it, run it, talk to it (#2937)
Lead with the AI-first experience instead of "write services in Go."
The entry point is now describing what you need, not writing code.

https://claude.ai/code/session_01QTp4SshuVmLAvvEGJe4TJd

Co-authored-by: Claude <noreply@anthropic.com>
2026-06-04 18:51:41 +01:00
Asim Aslam e59d056f97 Update Discord invite link and enhance landing hero description (#2936)
* chore: update Discord invite link everywhere

Replace discord.gg/jwTYuUVAGh and discord.gg/go-micro with
discord.gg/WeMU5AGxD across all docs, blog posts, issue templates,
security policy, and contrib READMEs.

https://claude.ai/code/session_01QTp4SshuVmLAvvEGJe4TJd

* docs: update landing hero — describe it, run it, talk to it

Lead with the AI-first experience instead of "write services in Go."
The entry point is now describing what you need, not writing code.

https://claude.ai/code/session_01QTp4SshuVmLAvvEGJe4TJd

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-06-04 17:50:11 +01:00
Asim Aslam e13ef7eed5 chore: update Discord invite link everywhere (#2935)
Replace discord.gg/jwTYuUVAGh and discord.gg/go-micro with
discord.gg/WeMU5AGxD across all docs, blog posts, issue templates,
security policy, and contrib READMEs.

https://claude.ai/code/session_01QTp4SshuVmLAvvEGJe4TJd

Co-authored-by: Claude <noreply@anthropic.com>
2026-06-04 13:46:30 +01:00
Asim Aslam 23f682181c Update section title from 'The Bet' to 'The next step' 2026-06-04 11:53:31 +01:00
Asim Aslam bc1092b18a Restructure README for AI experience and framework clarity (#2934)
* docs: restructure README — AI story completes before manual code

Quick Start now flows through the full AI experience: generate →
review → run → chat → grow (mid-conversation service generation).
The reader sees the complete prompt-to-production story without
interruption.

"Writing Services" is a separate section below for developers who
want to understand the framework underneath. Shows Go code, doc
comments, @example tags, micro run, and scaffolding templates.

Features table and CLI table reordered: AI first, then framework.

https://claude.ai/code/session_01QTp4SshuVmLAvvEGJe4TJd

* blog: Going All In on AI

Post 14 — the strategic case for making AI the primary direction.
Covers the evolution from microservices framework to AI-native
platform, why the timing is right (tool calling works, MCP is real,
sponsors align), and what's not changing (framework still works,
no agent framework complexity).

https://claude.ai/code/session_01QTp4SshuVmLAvvEGJe4TJd

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-06-04 11:52:48 +01:00
Asim Aslam 16918669ca docs: restructure README — AI story completes before manual code (#2933)
Quick Start now flows through the full AI experience: generate →
review → run → chat → grow (mid-conversation service generation).
The reader sees the complete prompt-to-production story without
interruption.

"Writing Services" is a separate section below for developers who
want to understand the framework underneath. Shows Go code, doc
comments, @example tags, micro run, and scaffolding templates.

Features table and CLI table reordered: AI first, then framework.

https://claude.ai/code/session_01QTp4SshuVmLAvvEGJe4TJd

Co-authored-by: Claude <noreply@anthropic.com>
2026-06-04 11:35:57 +01:00
Asim Aslam a357d1870d Update README and landing page with new AI-native hero image (#2932)
* docs: add binary install option to README quick start

Show curl install.sh first (no Go required), go install second.
Uses the existing install script at go-micro.dev/install.sh which
downloads pre-built binaries from GitHub releases.

https://claude.ai/code/session_01QTp4SshuVmLAvvEGJe4TJd

* docs: regenerate hero image for new AI-native positioning

New hero shows terminal running micro run with service generation,
an AI agent orchestrating, and task/shipping/category service nodes.
Matches the "Microservices That AI Agents Can Use" headline.

https://claude.ai/code/session_01QTp4SshuVmLAvvEGJe4TJd

* fix: replace video with hero image on landing page

The old video autoplayed and covered the new hero image. Replace
the video element with a static img tag showing the new AI-native
hero graphic.

https://claude.ai/code/session_01QTp4SshuVmLAvvEGJe4TJd

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-06-04 11:27:21 +01:00
Asim Aslam 91a545c6f2 Enhance README with binary install option and update hero image (#2931)
* docs: add binary install option to README quick start

Show curl install.sh first (no Go required), go install second.
Uses the existing install script at go-micro.dev/install.sh which
downloads pre-built binaries from GitHub releases.

https://claude.ai/code/session_01QTp4SshuVmLAvvEGJe4TJd

* docs: regenerate hero image for new AI-native positioning

New hero shows terminal running micro run with service generation,
an AI agent orchestrating, and task/shipping/category service nodes.
Matches the "Microservices That AI Agents Can Use" headline.

https://claude.ai/code/session_01QTp4SshuVmLAvvEGJe4TJd

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-06-04 11:21:47 +01:00
Asim Aslam 00392aa1f2 docs: add binary install option to README quick start (#2930)
Show curl install.sh first (no Go required), go install second.
Uses the existing install script at go-micro.dev/install.sh which
downloads pre-built binaries from GitHub releases.

https://claude.ai/code/session_01QTp4SshuVmLAvvEGJe4TJd

Co-authored-by: Claude <noreply@anthropic.com>
2026-06-04 11:15:40 +01:00
Asim Aslam b54507710d Revise README with new install command and examples
Updated installation command and added usage examples.
2026-06-04 11:14:40 +01:00
Asim Aslam d541625e32 docs: unify README and website around one story (#2929)
Both surfaces now lead with the same line: "Go Micro is a framework
for building microservices that AI agents can use."

README:
- Leads with prompt generation + chat (the differentiator)
- Features as a compact table instead of paragraph-per-feature
- CLI workflow table
- Removed redundant sections, tightened to ~150 lines

Website:
- Hero: "Microservices That AI Agents Can Use"
- Hero command: micro run --prompt instead of go get
- Features grid reordered: AI tools, orchestration, generation first
- First two-col section: describe/generate/run/chat story
- Architecture and DX sections follow

Both tell the same story in the same order:
1. What it is (microservices framework)
2. What makes it different (every service is an AI tool)
3. How you use it (prompt → run → chat)
4. What's underneath (registry, RPC, store — all pluggable)

https://claude.ai/code/session_01QTp4SshuVmLAvvEGJe4TJd

Co-authored-by: Claude <noreply@anthropic.com>
2026-06-04 11:13:03 +01:00
Asim Aslam 7662b26b07 syntax highlighting (#2928)
* docs: add blog post 13 to blog index

https://claude.ai/code/session_01QTp4SshuVmLAvvEGJe4TJd

* docs: add syntax highlighting to blog post 13 code blocks

Add language tags (bash, go, text) to all fenced code blocks so
Rouge highlights them correctly.

https://claude.ai/code/session_01QTp4SshuVmLAvvEGJe4TJd

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-06-04 08:19:52 +01:00
Asim Aslam 397010a82a docs: add blog post 13 to blog index (#2927)
https://claude.ai/code/session_01QTp4SshuVmLAvvEGJe4TJd

Co-authored-by: Claude <noreply@anthropic.com>
2026-06-03 22:16:06 +01:00
Asim Aslam d3c4981326 Enhance AI service generation with prompt-based architecture and logic (#2926)
goreleaser / goreleaser (push) Waiting to run
* feat: add micro new --prompt and micro run --prompt

Add AI-powered service generation: describe a system in natural
language and get real go-micro services with proto definitions,
handlers, doc comments, and MCP support.

micro new --prompt "a contact book with notes and tags" \
  --provider anthropic

Generates:
  contacts/ — CRUD service with name, email, phone fields
  notes/    — notes linked to contacts
  tags/     — tagging system

Each service gets:
  proto/{name}.proto   — domain model + CRUD endpoints
  handler/{name}.go    — in-memory store, @example tags for MCP
  main.go              — MCP-enabled, proper imports
  go.mod + Makefile     — compiles with go mod tidy + make proto

micro run --prompt does the same then starts all services.

The LLM designs the architecture (service names, fields, endpoints,
descriptions) and returns structured JSON. Code generation uses
the existing template patterns — the output is standard go-micro
code that compiles, runs, and is immediately callable via MCP
and micro chat. No AI dependency at runtime.

* feat: LLM generates real business logic with compile-fix loop

Rebuild the generate package so the LLM writes actual handler
code with business logic, not just CRUD scaffolding.

The flow is now:
1. LLM designs architecture (service names, fields, endpoints)
   → returns structured JSON
2. Proto, main.go, go.mod, Makefile generated deterministically
   from the design (guaranteed to be correct)
3. go mod tidy + make proto compiles the protos
4. LLM generates handler code with REAL business logic
   → given the proto, endpoint descriptions, and go-micro patterns
5. go build — does it compile?
6. If no: feed errors back to LLM, get fixed code (up to 3 attempts)
7. If yes: service is ready

The handler prompt instructs the LLM to:
- Use sync.RWMutex for thread-safe in-memory state
- Include validation, edge cases, meaningful errors
- Write doc comments with @example tags for MCP
- Implement actual domain logic, not just map operations

Proto generation still uses deterministic templates (CRUD +
custom endpoints from the design spec) to guarantee correctness.
The compile-fix loop catches LLM mistakes automatically.

Both micro new --prompt and micro run --prompt use this flow.

* fix: handle edge cases in prompt-based generation

- Fix PATH for protoc-gen-micro in child processes
- Handle existing directories: skip structural files (main.go,
  go.mod, Makefile) if dir exists, always regenerate proto,
  only write placeholder handler if none exists
- Allow re-running micro new --prompt on same directory to
  iterate on business logic without clobbering user edits

Tested end-to-end: "a simple todo list with tasks and categories"
generates 2 services (task-service, category-service) with real
business logic (validation, toggle complete, etc.), compiles
after 1 fix iteration, and runs with 6 MCP tools discovered.

* feat: auto-detect modified handlers on regeneration

Instead of requiring a --keep-handlers flag, the generate package now
tracks a SHA-256 hash of each generated handler in a .micro metadata
file. On re-run, if the user has edited the handler since generation,
it's left untouched. Unmodified handlers are regenerated normally.

https://claude.ai/code/session_01QTp4SshuVmLAvvEGJe4TJd

* feat: add tests, fix go.mod, gitignore, proto tracking, spinner

- Add 12 tests covering helpers, proto generation, hash tracking
- Fix go.mod: write minimal module file, let go mod tidy resolve deps
- Add .gitignore to prompt-generated services
- Protect user-edited proto files (same hash tracking as handlers)
- Add spinner during LLM calls so it doesn't look hung

https://claude.ai/code/session_01QTp4SshuVmLAvvEGJe4TJd

* feat: signal handling, existing service discovery, help text

- Ctrl+C during generation now cancels LLM calls immediately via
  signal-aware context; re-run picks up where it left off
- Design() scans for existing services in the working directory and
  includes their proto definitions in the prompt, so the LLM extends
  the system rather than redesigning from scratch
- Updated --prompt help text with usage examples on both new and run
- Listed all supported providers in flag descriptions
- Added discoverExisting test

https://claude.ai/code/session_01QTp4SshuVmLAvvEGJe4TJd

* feat: show endpoints in run --prompt output, add micro chat hint

Print endpoint names and descriptions when designing services so users
see what was built. Add a micro chat hint to the run banner so users
know how to interact with their services after startup.

https://claude.ai/code/session_01QTp4SshuVmLAvvEGJe4TJd

* fix: generated go.mod uses go 1.24 with explicit go-micro require

go 1.22 with no explicit require caused Go to resolve sub-packages
(gateway/mcp, client, server) as separate modules, hitting stale v1.18
tags. Pin to go 1.24 + require go-micro.dev/v5 v5.24.0 so go mod tidy
resolves all sub-packages from the root module correctly.

Tested end-to-end: 4 services generated and compiled successfully.

https://claude.ai/code/session_01QTp4SshuVmLAvvEGJe4TJd

* fix: skip handler regeneration when proto unchanged

Compare proto hash before and after structure generation. If the proto
didn't change and the handler wasn't edited by the user, skip go mod
tidy, make proto, LLM handler generation, and compile-fix entirely.
Prints "(unchanged)" instead.

Reduces re-run of 4-service project from ~2 minutes to ~10 seconds.

https://claude.ai/code/session_01QTp4SshuVmLAvvEGJe4TJd

* feat: confirm design before generating code

Show the service design (names, endpoints) and prompt "Generate? [Y/n]"
before spending LLM time on handler generation. Applies to both
micro new --prompt and micro run --prompt. Default is yes (enter).

https://claude.ai/code/session_01QTp4SshuVmLAvvEGJe4TJd

* fix: use port :0 for MCP in generated multi-service projects

Each generated service had mcp.WithMCP(":3001") hardcoded, causing
port conflicts when running multiple services. Use :0 to auto-assign
a free port. micro run's central gateway handles unified MCP access.

https://claude.ai/code/session_01QTp4SshuVmLAvvEGJe4TJd

* feat: truncation detection, tool result display in chat

- Detect truncated LLM responses (unbalanced braces, doesn't end
  with '}') and retry with a conciseness hint before falling through
  to compile-fix
- Show tool call results in micro chat output (← for success, ✗ for
  errors) so users can see what the LLM did
- Add Result/Error fields to ToolCall, populated by Anthropic provider
  after tool execution
- Add isTruncated tests

Tested end-to-end with Anthropic: services generate, compile, start,
register, respond to RPC calls, and micro chat discovers and calls
tools correctly.

https://claude.ai/code/session_01QTp4SshuVmLAvvEGJe4TJd

* fix: Anthropic tool loop, service naming, chat tool results

Anthropic provider:
- Fix tool execution loop to properly iterate (was re-processing all
  tool calls instead of only new ones each round)
- Clean assistant content blocks before sending back (strip 'id' from
  text blocks that Anthropic rejects on input)
- Include tools in follow-up requests so model can make additional calls
- Loop up to 10 rounds until model responds with text only

Service naming:
- Strip '-service' suffix from micro.New() name so services register
  as 'task', 'category' instead of 'taskservice', 'categoryservice'

Chat:
- Show tool results (← for success) and errors (✗) in chat output

Tested end-to-end: create task → list tasks works as multi-step
orchestration through micro chat with Anthropic Claude.

https://claude.ai/code/session_01QTp4SshuVmLAvvEGJe4TJd

* feat: blog post 13 — from prompt to production

Covers the full micro run --prompt flow: design, generate, compile-fix,
run, and chat orchestration. Positions agent-as-orchestrator as the
answer to service coordination.

https://claude.ai/code/session_01QTp4SshuVmLAvvEGJe4TJd

* fix: timeouts, max_tokens, TTY detection, smaller services

- Add 60s timeout on design, 90s on handler generation, 60s on
  compile-fix LLM calls so hung providers don't block forever
- Bump Anthropic max_tokens from 4096 to 8192 to reduce truncation
- Add TTY detection: spinner prints static message in non-TTY (CI/pipes)
  instead of ANSI escape codes
- Tighten prompts: max 200 lines per handler, 2-4 services, 5-8 fields,
  explicit "services don't call each other" rule

https://claude.ai/code/session_01QTp4SshuVmLAvvEGJe4TJd

* feat: chat suggests creating services when capabilities are missing

Update system prompt with the list of available services. When the user
asks for something no existing service can handle, the agent explains
what's available and suggests the exact micro new --prompt command to
create the missing service.

This is the natural evolution path: start with a few services, talk to
them via chat, and when the domain grows, the agent tells you what to
add. Each service stays small and focused.

https://claude.ai/code/session_01QTp4SshuVmLAvvEGJe4TJd

* feat: chat generates and starts services inline, drop -service suffix

Chat agent now has a micro_generate_service tool. When the user asks
for a capability that doesn't exist, the agent generates the service,
compiles it, starts it as a background process, waits for registration,
re-discovers tools, and uses the new endpoints immediately — all within
the conversation.

Service naming: design prompt now instructs LLM to return names without
'-service' suffix (e.g. 'task' not 'task-service'). buildMain keeps
TrimSuffix as safety net for backward compatibility.

Spawned processes are cleaned up when chat exits.

https://claude.ai/code/session_01QTp4SshuVmLAvvEGJe4TJd

* docs: rewrite blog post 13 with inline service generation

Updated to reflect the full UX: services generate and start within
the chat conversation. Added the shipping example showing the agent
creating a service mid-conversation. Removed -service suffix from
all examples. Tightened the narrative around agent-as-orchestrator.

https://claude.ai/code/session_01QTp4SshuVmLAvvEGJe4TJd

* feat: persistent storage, README quickstart, auto-detect new services

Storage: generated handlers now use go-micro's store package instead
of in-memory maps. Data persists across restarts. The handler prompt
includes store API examples so the LLM generates correct store usage.

README: added "Generate From a Prompt" section with micro run --prompt
and micro chat examples, linking to blog post 13.

Watcher: micro run now scans for new service directories every 5s. When
micro chat generates a service, micro run detects the new directory,
builds it, starts it, and adds it to the watcher — fully automatic.
Added AddDir/Dirs methods to the watcher.

Blog: updated post 13 with persistent storage example and watcher note.

https://claude.ai/code/session_01QTp4SshuVmLAvvEGJe4TJd

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-06-03 20:31:01 +01:00
Asim Aslam 96280678ee Expose framework primitives via API gateway and MCP with auth control (#2925)
* feat: expose framework primitives via API gateway and MCP

Add registry, store, and broker as both HTTP routes and MCP tools
so AI agents and HTTP clients can inspect and operate the framework.

API gateway (/micro/* namespace):
  GET  /micro/registry         List registered services
  GET  /micro/registry/{name}  Describe a service
  GET  /micro/store            List store keys
  GET  /micro/store/{key}      Read a record
  POST /micro/store/{key}      Write a record
  POST /micro/broker/{topic}   Publish a message

MCP gateway (micro_* tool prefix):
  micro_registry_list    List services
  micro_registry_get     Describe a service
  micro_store_list       List keys
  micro_store_read       Read a record
  micro_store_write      Write a record
  micro_broker_publish   Publish a message

Framework tools use a Handler field on the MCP Tool struct for
direct dispatch (no RPC). Service tools continue to use RPC.
Rate limiters and circuit breakers are applied to framework
tools the same as service tools.

* fix: make framework internals opt-in on API and MCP gateways

Framework primitives (registry, broker, store) are now only
exposed when explicitly enabled:

API gateway:  micro api --internal
MCP gateway:  Options{Internal: true}

Off by default — user services are always exposed, framework
internals require the flag. Banner output only shows framework
routes when enabled.

* fix: always expose framework internals, gate by auth in production

Revert the --internal flag approach. Framework primitives (registry,
broker, store) are now always exposed:

- micro api: /micro/* routes always available (dev tool)
- MCP gateway: micro_* tools always registered. When Auth is
  configured (production), they require micro:admin scope.
  Without Auth (dev), they're open — same as all other tools.

This follows the existing pattern: micro run/api = dev (open),
micro server = production (auth + scopes). Framework internals
follow the same security model as user services.

Remove the Internal option from MCP Options. Remove --internal
flag from micro api.

Note: scope persistence depends on the store backend. The default
in-memory store does not survive restarts. Use MICRO_STORE=file
for persistent scopes in production.

* fix: correct DefaultStore comment — it's file-backed, not memory

* fix(server): don't recreate deleted admin user on restart

When the default admin account is deleted via the dashboard, set
a marker key (auth/.admin-deleted) in the store. On startup, skip
admin creation if the marker exists. This prevents the default
admin/micro credentials from reappearing after restart when the
user has intentionally removed them.

* fix: improve agent playground first-run UX and fix doc 404s

Agent playground:
- Add setup hint in empty state explaining how to get started
  (click Settings, enter API key, type a prompt)
- Hide hint automatically when API key is already configured
- Add all 7 providers to dropdown (was only OpenAI + Anthropic)
- Include CLI fallback suggestion (micro chat)

Docs:
- Fix .md links to .html across all doc pages — Jekyll serves
  .html files, not .md. Fixes 404s including the micro run guide.

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-06-03 11:05:51 +01:00
Asim Aslam 69fc228c73 Enhance CLI color output and expose framework primitives via API (#2924)
* feat: expose framework primitives via API gateway and MCP

Add registry, store, and broker as both HTTP routes and MCP tools
so AI agents and HTTP clients can inspect and operate the framework.

API gateway (/micro/* namespace):
  GET  /micro/registry         List registered services
  GET  /micro/registry/{name}  Describe a service
  GET  /micro/store            List store keys
  GET  /micro/store/{key}      Read a record
  POST /micro/store/{key}      Write a record
  POST /micro/broker/{topic}   Publish a message

MCP gateway (micro_* tool prefix):
  micro_registry_list    List services
  micro_registry_get     Describe a service
  micro_store_list       List keys
  micro_store_read       Read a record
  micro_store_write      Write a record
  micro_broker_publish   Publish a message

Framework tools use a Handler field on the MCP Tool struct for
direct dispatch (no RPC). Service tools continue to use RPC.
Rate limiters and circuit breakers are applied to framework
tools the same as service tools.

* fix: make framework internals opt-in on API and MCP gateways

Framework primitives (registry, broker, store) are now only
exposed when explicitly enabled:

API gateway:  micro api --internal
MCP gateway:  Options{Internal: true}

Off by default — user services are always exposed, framework
internals require the flag. Banner output only shows framework
routes when enabled.

* fix: always expose framework internals, gate by auth in production

Revert the --internal flag approach. Framework primitives (registry,
broker, store) are now always exposed:

- micro api: /micro/* routes always available (dev tool)
- MCP gateway: micro_* tools always registered. When Auth is
  configured (production), they require micro:admin scope.
  Without Auth (dev), they're open — same as all other tools.

This follows the existing pattern: micro run/api = dev (open),
micro server = production (auth + scopes). Framework internals
follow the same security model as user services.

Remove the Internal option from MCP Options. Remove --internal
flag from micro api.

Note: scope persistence depends on the store backend. The default
in-memory store does not survive restarts. Use MICRO_STORE=file
for persistent scopes in production.

* fix: correct DefaultStore comment — it's file-backed, not memory

* fix(server): don't recreate deleted admin user on restart

When the default admin account is deleted via the dashboard, set
a marker key (auth/.admin-deleted) in the store. On startup, skip
admin creation if the marker exists. This prevents the default
admin/micro credentials from reappearing after restart when the
user has intentionally removed them.

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-06-03 08:26:47 +01:00
Asim Aslam 5d7609027b Enhance CLI with color output and add teardown blog post (#2923)
* feat(cli): add color output to micro chat and micro api

micro chat:
- Startup banner matching micro run style: bold header, cyan
  provider/model, green dots for each discovered tool endpoint
- Cyan bold prompt (> ) instead of plain
- Yellow arrow (→) with dimmed tool name for tool calls
- Red "error:" prefix for errors
- Dimmed "(history cleared)" for reset

micro api:
- Startup banner matching micro run style: bold header, cyan
  address, colored HTTP methods (green GET, yellow POST)

Brings the CLI UX closer to what the generated terminal
screenshot depicts — color-coded, professional, readable.

* feat(cli): adopt consistent color output across all commands

Apply the same banner/output style across the remaining commands:

micro new:    bold header, cyan service name, green ✓, cyan URLs
micro build:  green ✓ checkmarks, cyan file paths
micro deploy: bold header, cyan target
micro mcp:    bold header, green dots per tool, dimmed count
micro flow:   bold header, cyan flow/topic/provider

All commands now follow the micro run/chat/api pattern:
bold header, cyan values, green status indicators, dimmed hints.

* docs: add "Tools as Services" blog post

Write blog/12 — connects the AI story back to Go Micro's original
design: services were always self-describing, named, and uniformly
callable. The path from API gateway to MCP to LLM tools is the
same pattern — read the registry, present services in a format
the consumer understands, route calls back.

Covers the access layer pattern (HTTP, web, CLI, MCP, chat),
why doc comments became functional in the AI era, and how the
framework primitives (registry, broker, store) could all become
tools using the same mechanism.

Add to blog index, link forward from blog/11.

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-06-02 22:15:18 +01:00
Asim Aslam 5601be009a docs: add "Build Your Own AI Agent CLI" teardown blog post (#2921)
Write blog/11 — a teardown of micro chat showing how to build an
LLM tool-calling agent in ~150 lines. Walks through the four pieces:
discover tools, create the model, track conversation, run the loop.
Uses the actual chat.go source. Ends with extension ideas and a
"make it yours" framing.

Add to blog index, link forward from blog/10.

Co-authored-by: Claude <noreply@anthropic.com>
2026-06-02 12:06:22 +01:00
Asim Aslam 888dbbca4a Refactor AI tool handling and enhance CLI command documentation (#2920)
goreleaser / goreleaser (push) Waiting to run
* refactor(ai): rename ToolSet to Tools, simplify wiring with WithTools

Move tool discovery/execution fully into the ai package as ai.Tools
(formerly ai.ToolSet), and simplify the usage model:

- NewTools(reg, ai.ToolClient(c)) takes the execution client as an
  option instead of threading it through Handler(c) per call
- New ai.WithTools(tools) option wires the tool handler into a model
  in one call, replacing ai.WithToolHandler(set.Handler(c))
- ai.DiscoverTools(reg) for one-shot discovery

Before:
  set := ai.NewToolSet(reg)
  list, _ := set.Discover()
  m := ai.New(p, ai.WithToolHandler(set.Handler(client)))

After:
  tools := ai.NewTools(reg, ai.ToolClient(client))
  list, _ := tools.Discover()
  m := ai.New(p, ai.WithTools(tools))

Update ai/flow, micro chat, README, ai integration doc, Atlas Cloud
guide, and blog posts 3/8/9/10.

* feat(cli): add per-interface commands (registry, broker, store, config)

Map go-micro's core interfaces onto the CLI so the framework's
building blocks are inspectable and manipulable from the terminal:

  micro registry list/get/watch       service discovery
  micro broker publish/subscribe      pub/sub messaging
  micro store read/write/delete/list  persistence
  micro config get/dump               dynamic config (from env)

Structured pluggably in cmd/micro/resource: each interface is one
file exposing a Command() func, all wired through a commandFuncs
slice in resource.go. Adding a new resource command is a single
file plus one slice entry. Shared printJSON/fail helpers keep
output and errors consistent across commands.

Each command's verbs mirror the interface methods. Output is JSON
for structured data, raw for single values. Update README and
getting-started with an "inspecting the framework" section.

* docs: update CLI README with all new commands

Add documentation for commands that were missing from the CLI README:
- micro new --template (crud, pubsub, api)
- micro api (standalone HTTP gateway)
- micro registry list/get/watch
- micro broker publish/subscribe
- micro store read/write/delete/list
- micro config get/dump
- micro chat (interactive LLM agent)
- micro flow run/exec (event-driven orchestration)
- micro mcp serve/list/test

Organized into sections: API Gateway, Inspecting the Framework
(registry, broker, store, config), and AI & Agents (chat, flow, mcp).

* refactor(ai): move History from caller to Request field

History is now pure state (no Generate method). Instead, pass it
via Request.History and call ai.Generate(ctx, model, req):

Before:
  hist := ai.NewHistory("system prompt", 50)
  resp, _ := hist.Generate(ctx, model, prompt, tools)

After:
  hist := ai.NewHistory(50)
  resp, _ := ai.Generate(ctx, model, &ai.Request{
      Prompt:       prompt,
      SystemPrompt: "system prompt",
      Tools:        tools,
      History:      hist,
  })

The model is always the thing you call. History is context you
pass in. ai.Generate() handles the bookkeeping: prepends
accumulated messages before the call, records the exchange after.

NewHistory no longer takes a system prompt (it belongs on the
Request, where it always did).

Update micro chat, ai/flow, and all blog posts/docs.

* refactor(ai): make History a plain message accumulator

History no longer has Generate or touches the model. It's just
Add/Messages/Reset/Len with truncation — a helper for building
Request.Messages across turns.

Before:
  hist := ai.NewHistory(50)
  resp, _ := ai.Generate(ctx, m, &ai.Request{History: hist, ...})

After:
  hist := ai.NewHistory(50)
  hist.Add("user", prompt)
  resp, _ := m.Generate(ctx, &ai.Request{Messages: hist.Messages(), ...})
  hist.Add("assistant", resp.Reply)

Remove History field from Request. Remove package-level
ai.Generate(ctx, model, req) wrapper — users call m.Generate()
directly, which is the interface method. History is a convenience
for accumulating messages, not a participant in generation.

Update micro chat, ai/flow, blog posts 9 and 10.

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-05-30 16:20:38 +01:00
Asim Aslam f48d81c760 Cli commands (#2919)
* refactor(ai): rename ToolSet to Tools, simplify wiring with WithTools

Move tool discovery/execution fully into the ai package as ai.Tools
(formerly ai.ToolSet), and simplify the usage model:

- NewTools(reg, ai.ToolClient(c)) takes the execution client as an
  option instead of threading it through Handler(c) per call
- New ai.WithTools(tools) option wires the tool handler into a model
  in one call, replacing ai.WithToolHandler(set.Handler(c))
- ai.DiscoverTools(reg) for one-shot discovery

Before:
  set := ai.NewToolSet(reg)
  list, _ := set.Discover()
  m := ai.New(p, ai.WithToolHandler(set.Handler(client)))

After:
  tools := ai.NewTools(reg, ai.ToolClient(client))
  list, _ := tools.Discover()
  m := ai.New(p, ai.WithTools(tools))

Update ai/flow, micro chat, README, ai integration doc, Atlas Cloud
guide, and blog posts 3/8/9/10.

* feat(cli): add per-interface commands (registry, broker, store, config)

Map go-micro's core interfaces onto the CLI so the framework's
building blocks are inspectable and manipulable from the terminal:

  micro registry list/get/watch       service discovery
  micro broker publish/subscribe      pub/sub messaging
  micro store read/write/delete/list  persistence
  micro config get/dump               dynamic config (from env)

Structured pluggably in cmd/micro/resource: each interface is one
file exposing a Command() func, all wired through a commandFuncs
slice in resource.go. Adding a new resource command is a single
file plus one slice entry. Shared printJSON/fail helpers keep
output and errors consistent across commands.

Each command's verbs mirror the interface methods. Output is JSON
for structured data, raw for single values. Update README and
getting-started with an "inspecting the framework" section.

* docs: update CLI README with all new commands

Add documentation for commands that were missing from the CLI README:
- micro new --template (crud, pubsub, api)
- micro api (standalone HTTP gateway)
- micro registry list/get/watch
- micro broker publish/subscribe
- micro store read/write/delete/list
- micro config get/dump
- micro chat (interactive LLM agent)
- micro flow run/exec (event-driven orchestration)
- micro mcp serve/list/test

Organized into sections: API Gateway, Inspecting the Framework
(registry, broker, store, config), and AI & Agents (chat, flow, mcp).

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-05-30 14:52:22 +01:00
Asim Aslam 3acf74a29a Refactor tool management and add CLI commands for interfaces (#2918)
* refactor(ai): rename ToolSet to Tools, simplify wiring with WithTools

Move tool discovery/execution fully into the ai package as ai.Tools
(formerly ai.ToolSet), and simplify the usage model:

- NewTools(reg, ai.ToolClient(c)) takes the execution client as an
  option instead of threading it through Handler(c) per call
- New ai.WithTools(tools) option wires the tool handler into a model
  in one call, replacing ai.WithToolHandler(set.Handler(c))
- ai.DiscoverTools(reg) for one-shot discovery

Before:
  set := ai.NewToolSet(reg)
  list, _ := set.Discover()
  m := ai.New(p, ai.WithToolHandler(set.Handler(client)))

After:
  tools := ai.NewTools(reg, ai.ToolClient(client))
  list, _ := tools.Discover()
  m := ai.New(p, ai.WithTools(tools))

Update ai/flow, micro chat, README, ai integration doc, Atlas Cloud
guide, and blog posts 3/8/9/10.

* feat(cli): add per-interface commands (registry, broker, store, config)

Map go-micro's core interfaces onto the CLI so the framework's
building blocks are inspectable and manipulable from the terminal:

  micro registry list/get/watch       service discovery
  micro broker publish/subscribe      pub/sub messaging
  micro store read/write/delete/list  persistence
  micro config get/dump               dynamic config (from env)

Structured pluggably in cmd/micro/resource: each interface is one
file exposing a Command() func, all wired through a commandFuncs
slice in resource.go. Adding a new resource command is a single
file plus one slice entry. Shared printJSON/fail helpers keep
output and errors consistent across commands.

Each command's verbs mirror the interface methods. Output is JSON
for structured data, raw for single values. Update README and
getting-started with an "inspecting the framework" section.

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-05-30 14:43:09 +01:00
Asim Aslam c4b4cbef25 refactor(ai): rename ToolSet to Tools, simplify wiring with WithTools (#2917)
Move tool discovery/execution fully into the ai package as ai.Tools
(formerly ai.ToolSet), and simplify the usage model:

- NewTools(reg, ai.ToolClient(c)) takes the execution client as an
  option instead of threading it through Handler(c) per call
- New ai.WithTools(tools) option wires the tool handler into a model
  in one call, replacing ai.WithToolHandler(set.Handler(c))
- ai.DiscoverTools(reg) for one-shot discovery

Before:
  set := ai.NewToolSet(reg)
  list, _ := set.Discover()
  m := ai.New(p, ai.WithToolHandler(set.Handler(client)))

After:
  tools := ai.NewTools(reg, ai.ToolClient(client))
  list, _ := tools.Discover()
  m := ai.New(p, ai.WithTools(tools))

Update ai/flow, micro chat, README, ai integration doc, Atlas Cloud
guide, and blog posts 3/8/9/10.

Co-authored-by: Claude <noreply@anthropic.com>
2026-05-30 14:21:35 +01:00
Asim Aslam a9421e5b7e Update logo design, add AI integration documentation and blog post (#2916)
* feat: update Go Micro logo to interconnected nodes design

Replace the text-on-blue-square logo with a modern icon: three
teal nodes connected in a triangle, representing distributed
systems. Generated via Atlas Cloud. Clean at all sizes — works
as GitHub avatar, favicon, and nav bar icon.

* feat: new logo, AI integration architecture doc, and landing page CTA

Update logo to triangle-nodes icon + "Go Micro" text wordmark.
Save icon-only variant for favicon/avatar use.

Add docs/ai-integration.md — a single page that explains how the
AI stack fits together: services → registry → MCP gateway →
ai/tools → ai.Model → micro chat. Layer-by-layer with code
examples, provider table, and "what you don't need" section.

Add AI Integration to docs sidebar navigation (after Getting
Started). Update the landing page AI section with a direct CTA
button linking to the new doc.

* fix: restore original logo and add border-radius to all renders

Revert logo to original. Add border-radius: 8px to the logo img
in the landing page nav, docs layout nav, and blog layout nav
so the square logo renders with rounded corners everywhere.
Remove unused icon.png.

* docs: add micro chat blog post

Write blog/10 — a dedicated post for micro chat covering:
- What it does (interactive LLM agent for services)
- How it works (ai/tools → ai.History → ai.Model stack)
- Multi-turn conversation examples
- All provider options and env vars
- Single prompt mode for scripting
- Why it works (registry metadata + doc comments = tool descriptions)
- Programmatic usage with the same building blocks
- Link to micro flow as the event-driven counterpart

Add to blog index. Update blog 9 nav to link forward.

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-05-30 13:46:05 +01:00
Asim Aslam 03f912f68a Add AtlasCloud sponsor logo to README 2026-05-30 09:58:44 +01:00
Asim Aslam 594ee107b7 Clean up README.md formatting
Removed unnecessary whitespace and line breaks in README.
2026-05-30 09:58:08 +01:00
Asim Aslam 2f164595f2 Add Atlas Cloud logo link to README
Added an image link for Atlas Cloud to the README.
2026-05-30 09:49:55 +01:00
Asim Aslam 740980a9cc Clean up whitespace in README.md
Removed extra whitespace before the second image link.
2026-05-30 09:49:33 +01:00
Asim Aslam 3d2d9acd68 Fix formatting issues in README.md 2026-05-30 09:46:28 +01:00
Asim Aslam 88aa0cc666 Update logo, add AI integration docs, and enhance CLI features (#2915)
* feat: update Go Micro logo to interconnected nodes design

Replace the text-on-blue-square logo with a modern icon: three
teal nodes connected in a triangle, representing distributed
systems. Generated via Atlas Cloud. Clean at all sizes — works
as GitHub avatar, favicon, and nav bar icon.

* feat: new logo, AI integration architecture doc, and landing page CTA

Update logo to triangle-nodes icon + "Go Micro" text wordmark.
Save icon-only variant for favicon/avatar use.

Add docs/ai-integration.md — a single page that explains how the
AI stack fits together: services → registry → MCP gateway →
ai/tools → ai.Model → micro chat. Layer-by-layer with code
examples, provider table, and "what you don't need" section.

Add AI Integration to docs sidebar navigation (after Getting
Started). Update the landing page AI section with a direct CTA
button linking to the new doc.

* fix: restore original logo and add border-radius to all renders

Revert logo to original. Add border-radius: 8px to the logo img
in the landing page nav, docs layout nav, and blog layout nav
so the square logo renders with rounded corners everywhere.
Remove unused icon.png.

* feat(ai): add ai/flow package and micro flow CLI

Add ai/flow — event-driven LLM orchestration for go-micro. A Flow
subscribes to a broker topic, discovers services as tools, and
feeds each event into an LLM that decides which RPCs to call.

Key types:
- flow.New(name, opts...) creates a flow with trigger topic,
  prompt template, provider config
- flow.Register(registry, broker, client) wires it into a service
- flow.Execute(ctx, data) runs the flow once (for testing/CLI)
- flow.Results() returns execution history

Add micro flow CLI with two subcommands:
- micro flow run: subscribe to a topic and react to events
- micro flow exec: one-shot execution with inline data

Both output JSON results with flow name, prompt, tool calls,
reply, answer, duration, and errors.

Example:
  micro flow run --trigger events.user.created \
    --prompt "New user: {{.Data}}. Send welcome email." \
    --provider anthropic

  micro flow exec --prompt "List all users" --provider anthropic

* docs: update flows blog post with ai/flow package and CLI examples

Add "Update: We Built It" section to blog/9 showing the ai/flow
package API, CLI usage for both event-driven and one-shot modes,
and what it does/doesn't do. Links the conceptual discussion to
the shipped implementation.

* feat(cli): add micro api gateway command, clarify run vs server

Add 'micro api' — a standalone lightweight HTTP-to-RPC gateway:
- POST /{service}/{endpoint} proxies to RPC calls
- GET / lists all services and endpoints
- GET /{service} describes a service
- GET /health returns ok
- Supports Micro-Endpoint header for endpoint routing
- No dashboard, no auth, no hot reload — just the proxy

Update help text to clarify the three gateway modes:
- micro api: bare HTTP-to-RPC proxy
- micro run: development mode (hot reload + gateway + agent playground)
- micro server: production mode (dashboard + auth + JWT)

* docs: update README, getting started, and AI integration for all new features

Update the development workflow table in both README and getting
started to include all CLI commands: micro new --template,
micro api, micro chat, micro flow, micro call.

Getting started:
- Add CRUD template example to quick start
- Update workflow table with 8 stages
- Add AI Integration, MCP, and gRPC Interop to Next Steps

README:
- Add template flag to quick start example
- Update workflow table
- Reorder User Guides with AI Integration prominent

AI Integration doc:
- Update stack diagram to include micro api and ai/flow
- Add micro flow section with Go API and CLI examples
- Add micro api section
- Renumber layers (now 8 instead of 7)

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-05-29 22:49:37 +01:00
Asim Aslam 601c67675f Update logo, add AI integration docs, and enhance CLI features (#2914)
* feat: update Go Micro logo to interconnected nodes design

Replace the text-on-blue-square logo with a modern icon: three
teal nodes connected in a triangle, representing distributed
systems. Generated via Atlas Cloud. Clean at all sizes — works
as GitHub avatar, favicon, and nav bar icon.

* feat: new logo, AI integration architecture doc, and landing page CTA

Update logo to triangle-nodes icon + "Go Micro" text wordmark.
Save icon-only variant for favicon/avatar use.

Add docs/ai-integration.md — a single page that explains how the
AI stack fits together: services → registry → MCP gateway →
ai/tools → ai.Model → micro chat. Layer-by-layer with code
examples, provider table, and "what you don't need" section.

Add AI Integration to docs sidebar navigation (after Getting
Started). Update the landing page AI section with a direct CTA
button linking to the new doc.

* fix: restore original logo and add border-radius to all renders

Revert logo to original. Add border-radius: 8px to the logo img
in the landing page nav, docs layout nav, and blog layout nav
so the square logo renders with rounded corners everywhere.
Remove unused icon.png.

* feat(ai): add ai/flow package and micro flow CLI

Add ai/flow — event-driven LLM orchestration for go-micro. A Flow
subscribes to a broker topic, discovers services as tools, and
feeds each event into an LLM that decides which RPCs to call.

Key types:
- flow.New(name, opts...) creates a flow with trigger topic,
  prompt template, provider config
- flow.Register(registry, broker, client) wires it into a service
- flow.Execute(ctx, data) runs the flow once (for testing/CLI)
- flow.Results() returns execution history

Add micro flow CLI with two subcommands:
- micro flow run: subscribe to a topic and react to events
- micro flow exec: one-shot execution with inline data

Both output JSON results with flow name, prompt, tool calls,
reply, answer, duration, and errors.

Example:
  micro flow run --trigger events.user.created \
    --prompt "New user: {{.Data}}. Send welcome email." \
    --provider anthropic

  micro flow exec --prompt "List all users" --provider anthropic

* docs: update flows blog post with ai/flow package and CLI examples

Add "Update: We Built It" section to blog/9 showing the ai/flow
package API, CLI usage for both event-driven and one-shot modes,
and what it does/doesn't do. Links the conceptual discussion to
the shipped implementation.

* feat(cli): add micro api gateway command, clarify run vs server

Add 'micro api' — a standalone lightweight HTTP-to-RPC gateway:
- POST /{service}/{endpoint} proxies to RPC calls
- GET / lists all services and endpoints
- GET /{service} describes a service
- GET /health returns ok
- Supports Micro-Endpoint header for endpoint routing
- No dashboard, no auth, no hot reload — just the proxy

Update help text to clarify the three gateway modes:
- micro api: bare HTTP-to-RPC proxy
- micro run: development mode (hot reload + gateway + agent playground)
- micro server: production mode (dashboard + auth + JWT)

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-05-29 18:13:06 +01:00
Asim Aslam b97f45106d Update logo, add AI integration docs, and implement ai/flow package (#2913)
* feat: update Go Micro logo to interconnected nodes design

Replace the text-on-blue-square logo with a modern icon: three
teal nodes connected in a triangle, representing distributed
systems. Generated via Atlas Cloud. Clean at all sizes — works
as GitHub avatar, favicon, and nav bar icon.

* feat: new logo, AI integration architecture doc, and landing page CTA

Update logo to triangle-nodes icon + "Go Micro" text wordmark.
Save icon-only variant for favicon/avatar use.

Add docs/ai-integration.md — a single page that explains how the
AI stack fits together: services → registry → MCP gateway →
ai/tools → ai.Model → micro chat. Layer-by-layer with code
examples, provider table, and "what you don't need" section.

Add AI Integration to docs sidebar navigation (after Getting
Started). Update the landing page AI section with a direct CTA
button linking to the new doc.

* fix: restore original logo and add border-radius to all renders

Revert logo to original. Add border-radius: 8px to the logo img
in the landing page nav, docs layout nav, and blog layout nav
so the square logo renders with rounded corners everywhere.
Remove unused icon.png.

* feat(ai): add ai/flow package and micro flow CLI

Add ai/flow — event-driven LLM orchestration for go-micro. A Flow
subscribes to a broker topic, discovers services as tools, and
feeds each event into an LLM that decides which RPCs to call.

Key types:
- flow.New(name, opts...) creates a flow with trigger topic,
  prompt template, provider config
- flow.Register(registry, broker, client) wires it into a service
- flow.Execute(ctx, data) runs the flow once (for testing/CLI)
- flow.Results() returns execution history

Add micro flow CLI with two subcommands:
- micro flow run: subscribe to a topic and react to events
- micro flow exec: one-shot execution with inline data

Both output JSON results with flow name, prompt, tool calls,
reply, answer, duration, and errors.

Example:
  micro flow run --trigger events.user.created \
    --prompt "New user: {{.Data}}. Send welcome email." \
    --provider anthropic

  micro flow exec --prompt "List all users" --provider anthropic

* docs: update flows blog post with ai/flow package and CLI examples

Add "Update: We Built It" section to blog/9 showing the ai/flow
package API, CLI usage for both event-driven and one-shot modes,
and what it does/doesn't do. Links the conceptual discussion to
the shipped implementation.

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-05-29 17:13:16 +01:00
Asim Aslam 28fa44b2ca Update logo design, enhance AI integration docs, and simplify navigation (#2912)
* feat: update Go Micro logo to interconnected nodes design

Replace the text-on-blue-square logo with a modern icon: three
teal nodes connected in a triangle, representing distributed
systems. Generated via Atlas Cloud. Clean at all sizes — works
as GitHub avatar, favicon, and nav bar icon.

* feat: new logo, AI integration architecture doc, and landing page CTA

Update logo to triangle-nodes icon + "Go Micro" text wordmark.
Save icon-only variant for favicon/avatar use.

Add docs/ai-integration.md — a single page that explains how the
AI stack fits together: services → registry → MCP gateway →
ai/tools → ai.Model → micro chat. Layer-by-layer with code
examples, provider table, and "what you don't need" section.

Add AI Integration to docs sidebar navigation (after Getting
Started). Update the landing page AI section with a direct CTA
button linking to the new doc.

* fix: restore original logo and add border-radius to all renders

Revert logo to original. Add border-radius: 8px to the logo img
in the landing page nav, docs layout nav, and blog layout nav
so the square logo renders with rounded corners everywhere.
Remove unused icon.png.

* fix: trim nav to 3 links across all layouts

Remove Reference and Home links from nav across landing page,
docs layout, and blog layout. Keep only Docs, Blog, GitHub —
the three things people actually need. Fixes crowded nav on
mobile where 5 links plus a menu button didn't fit.

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-05-29 16:55:36 +01:00
Asim Aslam 985621f4b4 AI integration updates (#2911)
* feat: update Go Micro logo to interconnected nodes design

Replace the text-on-blue-square logo with a modern icon: three
teal nodes connected in a triangle, representing distributed
systems. Generated via Atlas Cloud. Clean at all sizes — works
as GitHub avatar, favicon, and nav bar icon.

* feat: new logo, AI integration architecture doc, and landing page CTA

Update logo to triangle-nodes icon + "Go Micro" text wordmark.
Save icon-only variant for favicon/avatar use.

Add docs/ai-integration.md — a single page that explains how the
AI stack fits together: services → registry → MCP gateway →
ai/tools → ai.Model → micro chat. Layer-by-layer with code
examples, provider table, and "what you don't need" section.

Add AI Integration to docs sidebar navigation (after Getting
Started). Update the landing page AI section with a direct CTA
button linking to the new doc.

* fix: restore original logo and add border-radius to all renders

Revert logo to original. Add border-radius: 8px to the logo img
in the landing page nav, docs layout nav, and blog layout nav
so the square logo renders with rounded corners everywhere.
Remove unused icon.png.

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-05-29 16:30:23 +01:00
Asim Aslam 7a1ab14847 docs: rewrite Anthropic blog post with updated content and new header image (#2910)
goreleaser / goreleaser (push) Waiting to run
Rewrite blog/3 to reflect current state of the project:
- Update numbers (7 providers, image/video support, micro chat)
- Add "What Came After" section covering everything shipped since
- Tighten prose, remove stale roadmap percentages
- Replace generic MCP image with Claude-themed header generated
  via Atlas Cloud (orange AI orb connecting to service nodes)
- Streamline code examples
- Update star count and Try It section

Co-authored-by: Claude <noreply@anthropic.com>
2026-05-29 15:57:39 +01:00
Asim Aslam c26d74a8a1 Add CRUD, pub/sub, and API gateway templates; update AI features (#2909)
* feat(website): redesign docs and blog layouts, add blog header images

Redesign both layouts to match the new landing page:
- Consistent nav bar with logo, Docs, Blog, GitHub, Reference, Home
- Consistent footer with copyright and links
- CSS custom properties for theming
- Updated typography, spacing, and code block styling
- Active sidebar link highlighting in docs
- Dark mode support preserved

Generate 4 blog header images via Atlas Cloud:
- blog-deploy.png for post 1 (micro deploy)
- blog-mcp.png for posts 2, 3, 7 (MCP-related)
- blog-agents-demo.png for post 4 (agents demo)
- blog-dx.png for post 5 (DX cleanup)
- Reuse data-model.png for post 6 (model package)

All 7 existing blog posts now have header images.

* fix(website): prevent horizontal scroll on mobile landing page

Add overflow-x: hidden on html and body. Set max-width: 100% and
height: auto on all section and two-col images. Add overflow:
hidden to .two-col grid. Constrain hero pre with max-width and
overflow-x. Reduce font sizes and padding at mobile breakpoint.

* feat(website): add images to remaining core doc pages

Generate 5 more images via Atlas Cloud for docs:
- registry.png: service discovery diagram
- broker.png: pub/sub message broker pattern
- transport.png: multi-transport layers (HTTP, gRPC, NATS)
- config.png: dynamic configuration from multiple sources
- observability.png: monitoring dashboard with metrics/traces

Add images to registry.md, broker.md, transport.md, config.md,
observability.md, and architecture.md. All 11 main doc pages
now have header images.

* feat: add sponsor logos to landing page, README images, and flows blog post

Add Anthropic and Atlas Cloud sponsor logos to the landing page
with links to their respective blog posts. Logos display at 0.7
opacity with hover effect.

Add architecture and MCP agent images to the GitHub README for
the Overview and MCP sections.

Write blog post 9: "From Chat to Flows" — explores the concept
of LLM-powered service orchestration. Compares micro chat's
interactive model with persistent event-driven flows, shows how
the existing building blocks (ai/tools, History, broker) could
compose into a flow engine, discusses tradeoffs vs traditional
orchestration (Step Functions, Temporal), and includes a working
15-line code example. Explicitly positions it as a concept for
community feedback, not an announcement.

* feat(website): add animated hero video to landing page

Generate a 6-second hero video via Atlas Cloud's image-to-video
API (gemini-omni-flash). Shows the microservices network diagram
animating with data flowing between nodes.

Replace the static hero image with an autoplay muted looping
video element. Falls back to the static image via poster
attribute and img fallback for browsers without video support.

* feat(ai): add VideoModel interface with Atlas Cloud provider

Add ai.VideoModel interface for video generation alongside Model
and ImageModel. Supports text-to-video and image-to-video via
VideoRequest with prompt, reference images, duration, aspect
ratio, and resolution fields.

Implement GenerateVideo for Atlas Cloud using their async API:
POST /api/v1/model/generateVideo → poll /api/v1/model/prediction.
Default model is gemini-omni-flash image-to-video. Polls every
5 seconds until completion or context cancellation.

Register Atlas Cloud as a video provider via ai.RegisterVideo.
Add 3 tests: registration, no-key error, compile-time interface
check. Update ai/README.md with VideoModel docs.

The ai package now covers all three modalities:
- Model (text) — 7 providers
- ImageModel (image) — 2 providers (Atlas Cloud, OpenAI)
- VideoModel (video) — 1 provider (Atlas Cloud)

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-05-29 15:52:35 +01:00
Asim Aslam 669481224c Enhance AI features with ImageModel, History, and website updates (#2907)
* feat(cli): add CRUD, pub/sub, and API gateway templates for micro new

Add --template flag to 'micro new' with three preset templates:

- crud: CRUD service with Create/Read/Update/Delete/List, in-memory
  store with sync.RWMutex, UUID generation, pagination, and doc
  comments with @example tags for MCP tool discovery.

- pubsub: Event-driven service with Publish/Stats RPCs and a
  Subscribe method that hooks into the broker. Includes event
  types with ID, type, source, data, and timestamp.

- api: API gateway service with Health and Endpoint RPCs, an
  internal HTTP route table, and a response recorder for
  proxying requests through RPC.

All templates include MCP-ready doc comments and work with
--no-mcp. The default template (no flag) is unchanged.

Usage:
  micro new myservice --template crud
  micro new myservice --template pubsub
  micro new myservice --template api

* fix(ai): update Atlas Cloud provider to use actual API formats

Fix the Atlas Cloud image generation to use their real async API:
POST /api/v1/model/generateImage → poll /api/v1/model/prediction/{id}
instead of the OpenAI-compatible endpoint which doesn't exist.

Add Quality and OutputFormat fields to ai.ImageRequest for
provider-specific image parameters.

Update default text model from llama-3.3-70b (doesn't exist) to
deepseek-ai/DeepSeek-V3-0324 (their flagship model). Update
default image model to openai/gpt-image-2/text-to-image.

* feat(website): add AI-generated images to landing page, docs, and blog

Generate 5 images via Atlas Cloud's image API (gpt-image-2) to
elevate the website experience:

- hero.png: microservices network graph for landing page
- architecture.png: registry + broker architecture diagram
- mcp-agent.png: AI agent calling services via MCP
- developer-experience.png: terminal showing micro run/chat
- blog-atlas.png: Atlas Cloud unified API illustration

Add visual sections to the landing page with architecture,
MCP integration, and developer experience showcases. Add
images to docs index, MCP docs, and Atlas Cloud blog post.

All images resized to 1200px wide and optimized for web.
Generated using Atlas Cloud sponsor credits.

* feat(website): redesign landing page and add images to docs

Redesign the landing page from a centered card layout to a
full-width modern site with:
- Top navigation bar
- Hero section with gradient background and CTA buttons
- Full-width image showcase sections
- Two-column layout for architecture, MCP, and DX sections
- Feature grid with 6 capabilities
- Footer with links
- Responsive breakpoints for mobile

Generate 3 more images via Atlas Cloud for docs:
- getting-started.png for the getting started guide
- deployment.png for the deployment guide
- data-model.png for the data model docs

Add images to getting-started.md, model.md, and deployment.md.

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-05-29 15:16:05 +01:00
Asim Aslam 86782e6d77 Add ImageModel interface and multi-turn conversation support (#2906)
* feat(ai): add ImageModel interface with Atlas Cloud and OpenAI support

Add ai.ImageModel interface for text-to-image generation alongside
the existing ai.Model for text. Uses the same options pattern
(WithAPIKey, WithBaseURL) and the same provider registration
system (RegisterImage/NewImage).

Implement GenerateImage for Atlas Cloud and OpenAI providers via
the OpenAI-compatible /v1/images/generations endpoint. Default
image model is gpt-image-1. Responses return images as URL,
base64, or both depending on the provider.

Update Atlas Cloud blog post and integration guide with image
generation examples. Update ai/README.md with ImageModel docs.

* fix(website): widen docs content by reducing layout max-width to 1100px

Remove the 800px max-width on .content (which left empty space on
the right) and reduce the overall .layout and footer from 1400px
to 1100px. With the 230px sidebar this gives ~830px of content
width — readable and fills the page properly on desktop.

* feat(ai): add History for multi-turn conversation state

Add ai.History — a lightweight message accumulator that tracks
user prompts, assistant replies, and tool call/result pairs
across turns. FIFO truncation when message count exceeds the
configured limit. System prompt is passed through on every
Generate call.

Wire History into micro chat so conversations are multi-turn by
default (limit 50 messages). Add 'reset' command to clear
history mid-session.

5 unit tests covering accumulation, truncation, reset, snapshot
isolation, and tool call recording.

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-05-28 14:44:46 +01:00
Asim Aslam 1e2901ad0e feat(ai): add ImageModel interface with Atlas Cloud and OpenAI support (#2905)
goreleaser / goreleaser (push) Waiting to run
Add ai.ImageModel interface for text-to-image generation alongside
the existing ai.Model for text. Uses the same options pattern
(WithAPIKey, WithBaseURL) and the same provider registration
system (RegisterImage/NewImage).

Implement GenerateImage for Atlas Cloud and OpenAI providers via
the OpenAI-compatible /v1/images/generations endpoint. Default
image model is gpt-image-1. Responses return images as URL,
base64, or both depending on the provider.

Update Atlas Cloud blog post and integration guide with image
generation examples. Update ai/README.md with ImageModel docs.

Co-authored-by: Claude <noreply@anthropic.com>
2026-05-28 12:21:46 +01:00
Asim Aslam 426d7e4e6c fix: align sponsor logos with fixed height and clean SVG sources (#2903)
goreleaser / goreleaser (push) Waiting to run
Use height="26" on both logos for consistent alignment. Switch
Anthropic to the Wikimedia wordmark SVG (no padding) instead of
the logo.wine version which had excessive whitespace.

Co-authored-by: Claude <noreply@anthropic.com>
2026-05-28 11:07:38 +01:00
Asim Aslam 5968fce2d6 docs: add Atlas Cloud sponsorship blog post and integration guide (#2902)
Add blog/8 announcing Atlas Cloud as an official Go Micro sponsor.
Covers the sponsorship, Atlas Cloud's platform (300+ models, OpenAI
compatibility, enterprise compliance), and how the integration
works with the ai package, ai/tools, micro chat, and micro run.

Add guides/atlascloud-integration.md with full setup instructions:
quick start, configuration options, environment variables, model
selection, tool calling with services, and provider swapping.

Add Atlas Cloud and AI Provider guides to the docs sidebar
navigation. Add sponsorship link to README header.

Co-authored-by: Claude <noreply@anthropic.com>
2026-05-28 11:04:04 +01:00
Asim Aslam 415b0a76c2 Fix README header formatting
Removed a redundant pipe character from the README header.
2026-05-28 10:55:54 +01:00
Asim Aslam 7ef9a60441 Update README with documentation link and cleanup
Added documentation link to the README header and removed redundant documentation line.
2026-05-28 10:53:53 +01:00
Asim Aslam be156ecb95 Adjust logo width in README
Reduce the width of the Anthropic logo in sponsors section.
2026-05-28 10:53:01 +01:00
Asim Aslam 713dabbb5a Update Anthropic logo URL in README 2026-05-28 10:52:34 +01:00
Asim Aslam bbea48da78 Add sponsors section to README
Added sponsors section with Anthropic logo to README.
2026-05-28 10:52:03 +01:00
Asim Aslam a0ad9ee566 Claude/fix issue 2893 x3rpd (#2901)
* docs: add AI provider integration guide and Supported AI Providers section

Add a step-by-step guide for AI infrastructure companies to implement
ai.Model and contribute a provider to go-micro. Covers the full
lifecycle: skeleton, tool call handling, tests, registration, and PR
checklist.

Add a "Supported AI Providers" section to the project README that lists
current providers (Anthropic, OpenAI) in a table and links to the
integration guide with a call-to-action for new providers and sponsors.

Streamline the "Adding a New Provider" section in ai/README.md to point
to the new guide instead of duplicating a full code listing.

* fix: remove nonexistent Discord link from README

* fix(website): set content container width to 800px on desktop

Move the 800px max-width from .markdown-body up to .content so
the entire content pane (not just the inner body) is sized
correctly. The container now fills up to 800px beside the sidebar.

* feat(ai): wire Atlas Cloud into server and auto-detection

Import atlascloud provider in the micro server so it is available
when running micro run / micro server. Add atlascloud to
AutoDetectProvider so --ai_base_url with an atlascloud domain
selects the right provider automatically.

* feat(ai): add Google Gemini provider

Add ai/gemini implementing ai.Model for Google's Gemini API. Uses
the native generateContent endpoint with system_instruction,
contents/parts, and functionDeclarations — not an OpenAI shim.
Default model gemini-2.5-flash, auth via x-goog-api-key header.

Wire into micro server imports and AutoDetectProvider (matches
googleapis.com and google in base URL).

Update README.md and ai/README.md with provider listing.

* feat(ai): add Groq, Mistral, and Together AI providers

Add three new OpenAI-compatible providers:

- ai/groq: ultra-fast inference, default model llama-3.3-70b-versatile
- ai/mistral: Mistral AI, default model mistral-large-latest
- ai/together: Together AI, default model Llama-3.3-70B-Instruct-Turbo

All three are wired into the micro server imports and
AutoDetectProvider. README and ai/README updated with the full
provider table.

* feat(ai): add ai/tools helper and 'micro chat' interactive agent

Extract the registry-discovery + RPC-execution loop from the web
agent playground into a reusable ai/tools package:

- tools.New(reg) creates a Set bound to a registry
- Set.Discover() walks the registry and returns []ai.Tool with
  LLM-safe (underscored) names, remembering the mapping back to
  the original dotted form
- Set.Handler(client) returns an ai.ToolHandler that resolves
  the safe name and issues the RPC

Add cmd/micro/chat — an interactive 'micro chat' REPL that uses
ai/tools to let users talk to their services through any
registered AI provider. Supports --prompt for single-shot use,
auto-detects the provider from --base_url, and falls back to the
provider's conventional env var (ANTHROPIC_API_KEY, etc).

Update README with the new command and the programmatic example.

* feat(examples): add gRPC interop example

Add examples/grpc-interop showing that any standard gRPC client can
call a go-micro service — no go-micro SDK required on the client
side. Includes:

- proto/greeter.proto with generated Go, gRPC, and micro stubs
- server/ using go-micro gRPC transport
- client/ using stock google.golang.org/grpc (no go-micro imports)
- README with Python example and explanation of how routing works

Addresses the confusion from issue #2818 where users didn't know
that go-micro gRPC services are callable by any gRPC client.

* fix: strip /api prefix from MCP routes

Change /api/mcp/tools and /api/mcp/call to /mcp/tools and
/mcp/call. MCP is a first-class feature, not a sub-path of the
API proxy. Update server routes, playground template, scopes
template, run.go output, README, CLI README, and all docs.

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-05-26 12:19:26 +01:00
Asim Aslam f5e33317b3 Remove Micro app platform promotion from README
Removed the promotion for the Micro app platform from the README.
2026-05-24 18:17:31 +01:00
Asim Aslam 081e375f29 Add AI provider integration guide and new providers support (#2900)
* docs: add AI provider integration guide and Supported AI Providers section

Add a step-by-step guide for AI infrastructure companies to implement
ai.Model and contribute a provider to go-micro. Covers the full
lifecycle: skeleton, tool call handling, tests, registration, and PR
checklist.

Add a "Supported AI Providers" section to the project README that lists
current providers (Anthropic, OpenAI) in a table and links to the
integration guide with a call-to-action for new providers and sponsors.

Streamline the "Adding a New Provider" section in ai/README.md to point
to the new guide instead of duplicating a full code listing.

* fix: remove nonexistent Discord link from README

* fix(website): set content container width to 800px on desktop

Move the 800px max-width from .markdown-body up to .content so
the entire content pane (not just the inner body) is sized
correctly. The container now fills up to 800px beside the sidebar.

* feat(ai): wire Atlas Cloud into server and auto-detection

Import atlascloud provider in the micro server so it is available
when running micro run / micro server. Add atlascloud to
AutoDetectProvider so --ai_base_url with an atlascloud domain
selects the right provider automatically.

* feat(ai): add Google Gemini provider

Add ai/gemini implementing ai.Model for Google's Gemini API. Uses
the native generateContent endpoint with system_instruction,
contents/parts, and functionDeclarations — not an OpenAI shim.
Default model gemini-2.5-flash, auth via x-goog-api-key header.

Wire into micro server imports and AutoDetectProvider (matches
googleapis.com and google in base URL).

Update README.md and ai/README.md with provider listing.

* feat(ai): add Groq, Mistral, and Together AI providers

Add three new OpenAI-compatible providers:

- ai/groq: ultra-fast inference, default model llama-3.3-70b-versatile
- ai/mistral: Mistral AI, default model mistral-large-latest
- ai/together: Together AI, default model Llama-3.3-70B-Instruct-Turbo

All three are wired into the micro server imports and
AutoDetectProvider. README and ai/README updated with the full
provider table.

* feat(ai): add ai/tools helper and 'micro chat' interactive agent

Extract the registry-discovery + RPC-execution loop from the web
agent playground into a reusable ai/tools package:

- tools.New(reg) creates a Set bound to a registry
- Set.Discover() walks the registry and returns []ai.Tool with
  LLM-safe (underscored) names, remembering the mapping back to
  the original dotted form
- Set.Handler(client) returns an ai.ToolHandler that resolves
  the safe name and issues the RPC

Add cmd/micro/chat — an interactive 'micro chat' REPL that uses
ai/tools to let users talk to their services through any
registered AI provider. Supports --prompt for single-shot use,
auto-detects the provider from --base_url, and falls back to the
provider's conventional env var (ANTHROPIC_API_KEY, etc).

Update README with the new command and the programmatic example.

* feat(examples): add gRPC interop example

Add examples/grpc-interop showing that any standard gRPC client can
call a go-micro service — no go-micro SDK required on the client
side. Includes:

- proto/greeter.proto with generated Go, gRPC, and micro stubs
- server/ using go-micro gRPC transport
- client/ using stock google.golang.org/grpc (no go-micro imports)
- README with Python example and explanation of how routing works

Addresses the confusion from issue #2818 where users didn't know
that go-micro gRPC services are callable by any gRPC client.

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-05-24 18:17:04 +01:00
Asim Aslam 2f78103fed Claude/fix issue 2893 x3rpd (#2899)
* docs: add AI provider integration guide and Supported AI Providers section

Add a step-by-step guide for AI infrastructure companies to implement
ai.Model and contribute a provider to go-micro. Covers the full
lifecycle: skeleton, tool call handling, tests, registration, and PR
checklist.

Add a "Supported AI Providers" section to the project README that lists
current providers (Anthropic, OpenAI) in a table and links to the
integration guide with a call-to-action for new providers and sponsors.

Streamline the "Adding a New Provider" section in ai/README.md to point
to the new guide instead of duplicating a full code listing.

* feat(ai): add Atlas Cloud provider

Add ai/atlascloud implementing ai.Model for Atlas Cloud's
OpenAI-compatible chat completions API. Registers as "atlascloud"
with default model llama-3.3-70b and base URL
https://api.atlascloud.ai. Supports tool calling via ToolHandler.

Includes 7 unit tests covering registration, defaults, init,
generate-without-key, and stream-not-implemented.

Update the Supported AI Providers table in README.md and the
Supported Providers section in ai/README.md.

* fix: remove nonexistent Discord link from README

* fix(website): remove Micro app banner and widen content to 800px

Remove the "Try Micro" promotional banner from the homepage. Set
the docs content max-width to 800px for better readability on
desktop.

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-05-24 13:49:32 +01:00
Asim Aslam 60527e1fe8 Add AI provider integration guide and Atlas Cloud support (#2898)
* docs: add AI provider integration guide and Supported AI Providers section

Add a step-by-step guide for AI infrastructure companies to implement
ai.Model and contribute a provider to go-micro. Covers the full
lifecycle: skeleton, tool call handling, tests, registration, and PR
checklist.

Add a "Supported AI Providers" section to the project README that lists
current providers (Anthropic, OpenAI) in a table and links to the
integration guide with a call-to-action for new providers and sponsors.

Streamline the "Adding a New Provider" section in ai/README.md to point
to the new guide instead of duplicating a full code listing.

* feat(ai): add Atlas Cloud provider

Add ai/atlascloud implementing ai.Model for Atlas Cloud's
OpenAI-compatible chat completions API. Registers as "atlascloud"
with default model llama-3.3-70b and base URL
https://api.atlascloud.ai. Supports tool calling via ToolHandler.

Includes 7 unit tests covering registration, defaults, init,
generate-without-key, and stream-not-implemented.

Update the Supported AI Providers table in README.md and the
Supported Providers section in ai/README.md.

* fix: remove nonexistent Discord link from README

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-05-24 13:31:44 +01:00
Asim Aslam defb2786ef update AI provider documentation (#2897)
goreleaser / goreleaser (push) Waiting to run
* feat: add prometheus monitoring wrapper

Reintroduces the Prometheus metrics wrapper previously available in the
plugins repository, updated for go-micro v5. Exposes request count and
latency histograms for handlers, subscribers, and outgoing client calls
via NewHandlerWrapper, NewSubscriberWrapper, NewCallWrapper and
NewClientWrapper, labelled with service/endpoint/status.

Options cover namespace, subsystem, const labels, histogram buckets and
a custom registerer; duplicate collectors (e.g. from multiple wrappers
sharing the same config) are reused transparently via a cached
metrics bundle.

Fixes #2893

* fix(registry/etcd): clear lease/register caches on KeepAlive channel closure

When the etcd client's long-lived KeepAlive channel closes (e.g. because
the lease expired on the server side during a network partition), the
previous cleanup only removed the channel bookkeeping. The stale entries
in `leases` and `register` caused the next registerNode() heartbeat to
hit the "unchanged hash" short-circuit and skip re-registration entirely,
so the service permanently disappeared from etcd.

Extract the cleanup into handleKeepAliveClosed and also drop the cached
lease id and hash so the next heartbeat performs a full Grant+Put and
the service recovers within one RegisterInterval.

Regression introduced by #2822; fix is symmetric with the existing
synchronous KeepAliveOnce recovery path that propagates
rpctypes.ErrLeaseNotFound.

* docs: add AI provider integration guide and Supported AI Providers section

Add a step-by-step guide for AI infrastructure companies to implement
ai.Model and contribute a provider to go-micro. Covers the full
lifecycle: skeleton, tool call handling, tests, registration, and PR
checklist.

Add a "Supported AI Providers" section to the project README that lists
current providers (Anthropic, OpenAI) in a table and links to the
integration guide with a call-to-action for new providers and sponsors.

Streamline the "Adding a New Provider" section in ai/README.md to point
to the new guide instead of duplicating a full code listing.

* Update contribution guidelines in README.md

Removed Discord contact information for platform contributions.

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-05-10 17:14:04 +01:00
Asim Aslam 15cc876848 Emphasize 'Micro' in README link 2026-05-10 17:01:53 +01:00
Asim Aslam d3cfb3a99a Update app platform name from 'Mu' to 'Micro' 2026-05-10 17:01:23 +01:00
Asim Aslam b1680ca2da Update app platform link from Mu.xyz to Micro 2026-05-10 16:21:41 +01:00
Asim Aslam 90f7617fac Claude/fix issue 2893 x3rpd (#2895)
* feat: add prometheus monitoring wrapper

Reintroduces the Prometheus metrics wrapper previously available in the
plugins repository, updated for go-micro v5. Exposes request count and
latency histograms for handlers, subscribers, and outgoing client calls
via NewHandlerWrapper, NewSubscriberWrapper, NewCallWrapper and
NewClientWrapper, labelled with service/endpoint/status.

Options cover namespace, subsystem, const labels, histogram buckets and
a custom registerer; duplicate collectors (e.g. from multiple wrappers
sharing the same config) are reused transparently via a cached
metrics bundle.

Fixes #2893

* fix(registry/etcd): clear lease/register caches on KeepAlive channel closure

When the etcd client's long-lived KeepAlive channel closes (e.g. because
the lease expired on the server side during a network partition), the
previous cleanup only removed the channel bookkeeping. The stale entries
in `leases` and `register` caused the next registerNode() heartbeat to
hit the "unchanged hash" short-circuit and skip re-registration entirely,
so the service permanently disappeared from etcd.

Extract the cleanup into handleKeepAliveClosed and also drop the cached
lease id and hash so the next heartbeat performs a full Grant+Put and
the service recovers within one RegisterInterval.

Regression introduced by #2822; fix is symmetric with the existing
synchronous KeepAliveOnce recovery path that propagates
rpctypes.ErrLeaseNotFound.

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-04-20 14:55:01 +01:00
Asim Aslam 79722e0c27 feat: add prometheus monitoring wrapper (#2894)
Reintroduces the Prometheus metrics wrapper previously available in the
plugins repository, updated for go-micro v5. Exposes request count and
latency histograms for handlers, subscribers, and outgoing client calls
via NewHandlerWrapper, NewSubscriberWrapper, NewCallWrapper and
NewClientWrapper, labelled with service/endpoint/status.

Options cover namespace, subsystem, const labels, histogram buckets and
a custom registerer; duplicate collectors (e.g. from multiple wrappers
sharing the same config) are reused transparently via a cached
metrics bundle.

Fixes #2893

Co-authored-by: Claude <noreply@anthropic.com>
2026-04-15 09:24:43 +01:00
jejefferson 49070afa8c server/grpc: improve graceful stop behavior (#2892)
* server/grpc: improve graceful stop behavior

* server/grpc: add graceful stop example and test

* examples/graceful-stop: document verification steps
2026-04-10 08:10:10 +01:00
Asim Aslam 03f4759474 Fix inline style attribute in index.html 2026-04-08 07:42:12 +01:00
Asim Aslam f6fb541ace Enhance Mu.xyz promotion with styled div
Updated the promotional text for Mu.xyz with enhanced styling.
2026-04-08 07:40:51 +01:00
Asim Aslam 1426c8f349 Update README to use emoji for Mu.xyz link 2026-04-08 07:34:54 +01:00
Asim Aslam 5aedb601ba Add Mu.xyz promotional link to README
Added a promotional link for Mu.xyz app platform.
2026-04-08 07:34:25 +01:00
Asim Aslam bd13975acf Update container width and add promotional text
Increased the maximum width of the container and added a promotional paragraph for Mu.xyz.
2026-04-08 07:33:47 +01:00
Asim Aslam 213a09276e Update default.html 2026-03-26 10:11:00 +00:00
Asim Aslam f4291957e8 Remove Blog link from index.html
Removed the Blog link from the website index.
2026-03-26 10:09:12 +00:00
Asim Aslam 07411b1ef6 Remove article on chat app from blog index
Removed an article about building a chat app from the blog.
2026-03-26 10:08:54 +00:00
Asim Aslam 544496eec6 Delete internal/website/blog/8.md 2026-03-26 10:08:26 +00:00
Asim Aslam 2e95c4c610 Remove showcase section from index.html
Removed the showcase section for Go Micro projects.
2026-03-26 10:08:01 +00:00
BombartSimon 7b785df302 feat: add connection timeout call option (#2891) 2026-03-16 13:34:24 +00:00
Asim Aslam d96f12f57b Claude/update docs roadmap f zd2 j (#2889)
* feat: add agent platform showcase and blog post

Add a complete platform example (Users, Posts, Comments, Mail) that
mirrors micro/blog, demonstrating how existing microservices become
AI-accessible through MCP with zero code changes.

Includes blog post "Your Microservices Are Already an AI Platform"
walking through real agent workflows: signup, content creation,
commenting, tagging, and cross-service messaging.

https://claude.ai/code/session_01GkduEhcrqcG45rdfYh8dAc

* refactor: rename handler types to drop redundant Service suffix

UserService → Users, PostService → Posts, CommentService → Comments,
MailService → Mail. Matches micro/blog naming convention.

https://claude.ai/code/session_01GkduEhcrqcG45rdfYh8dAc

* refactor: consolidate top-level directories, reduce framework bloat

Move internal/non-public packages behind internal/ or into their
parent packages where they belong:

- deploy/ → gateway/mcp/deploy/ (Helm charts belong with the gateway)
- profile/ → service/profile/ (preset plugin profiles are a service concern)
- scripts/ → internal/scripts/ (install script is not public API)
- test/ → internal/test/ (test harness is not public API)
- util/ → internal/util/ (internal helpers shouldn't be imported externally)

Also fixes CLAUDE.md merge conflict markers and updates project
structure documentation.

All import paths updated. Build and tests pass.

https://claude.ai/code/session_01GkduEhcrqcG45rdfYh8dAc

* refactor: redesign model package to match framework conventions

Rename model.Database interface to model.Model (consistent with
client.Client, server.Server, store.Store). Remove generics in
favor of interface{}-based API with reflection.

Key changes:
- model.Model interface: Register once, CRUD infers table from type
- DefaultModel + NewModel() + package-level convenience functions
- Schema registered via Register(&User{}), no per-call schema passing
- Memory implementation as default (in model package, like store)
- memory/sqlite/postgres backends updated for new interface
- protoc-gen-micro generates RegisterXModel() instead of generic factory
- All docs, blog, and README updated

https://claude.ai/code/session_01GkduEhcrqcG45rdfYh8dAc

* docs: clarify blog post 7 uses modular monolith, not multi-service

Blog post 7 demonstrated all handlers in a single process but framed
it as microservices without acknowledging the architectural difference.

- Add "A Note on Architecture" section explaining this is a modular
  monolith demo and pointing to micro/blog for multi-service
- Clarify that handlers can be broken out into separate services later
- Fix "service registry" language to match single-process reality
- Restructure "Adding MCP to Existing Services" to distinguish the
  in-process approach from registry-based gateway options
- Update closing to acknowledge both paradigms
- Fix README type names (&CommentService{} -> &Comments{}, etc.)

https://claude.ai/code/session_01GkduEhcrqcG45rdfYh8dAc

* docs: add Micro Chat to website showcase

https://claude.ai/code/session_01GkduEhcrqcG45rdfYh8dAc

* feat: github artifact release CI (#2886)

* 👷feat(ci): add artifact and docker releases

* 💚fix(ci): build issues

* 💚fix(ci): add permissions

* 💚fix(ci): multiple artifacts

* 💚fix(ci): split archives

* 💚fix(ci): cross platform list

* 🚧chore(ci): package name

* 🐛fix(script): install script extract arch

* 👷fix(ci): docker origin go-micro

* Update image reference in goreleaser configuration (#2887)

Fix wrong order `user/repo`

* Add blog post on building a chat app with Go Micro

Added a blog post detailing the development of a full chat app using Go Micro, outlining features, architecture, and lessons learned.

* docs: add blog post 8 to index, put Blog before Docs on homepage

- Add "We Built a Full Chat App in a Day" (blog/8) to blog index
- Reorder homepage links: Blog first (primary), Docs second
- Rename "Documentation" to "Docs"

https://claude.ai/code/session_01GkduEhcrqcG45rdfYh8dAc

---------

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Alexander Serheyev <74361701+alex-dna-tech@users.noreply.github.com>
2026-03-07 13:00:22 +00:00
Asim Aslam 8608c15fbb Add blog post on building a chat app with Go Micro
Added a blog post detailing the development of a full chat app using Go Micro, outlining features, architecture, and lessons learned.
2026-03-07 12:49:39 +00:00
Asim Aslam 9823f6df5c Add platform showcase, blog post, and refactor project structure (#2888)
* feat: add agent platform showcase and blog post

Add a complete platform example (Users, Posts, Comments, Mail) that
mirrors micro/blog, demonstrating how existing microservices become
AI-accessible through MCP with zero code changes.

Includes blog post "Your Microservices Are Already an AI Platform"
walking through real agent workflows: signup, content creation,
commenting, tagging, and cross-service messaging.

https://claude.ai/code/session_01GkduEhcrqcG45rdfYh8dAc

* refactor: rename handler types to drop redundant Service suffix

UserService → Users, PostService → Posts, CommentService → Comments,
MailService → Mail. Matches micro/blog naming convention.

https://claude.ai/code/session_01GkduEhcrqcG45rdfYh8dAc

* refactor: consolidate top-level directories, reduce framework bloat

Move internal/non-public packages behind internal/ or into their
parent packages where they belong:

- deploy/ → gateway/mcp/deploy/ (Helm charts belong with the gateway)
- profile/ → service/profile/ (preset plugin profiles are a service concern)
- scripts/ → internal/scripts/ (install script is not public API)
- test/ → internal/test/ (test harness is not public API)
- util/ → internal/util/ (internal helpers shouldn't be imported externally)

Also fixes CLAUDE.md merge conflict markers and updates project
structure documentation.

All import paths updated. Build and tests pass.

https://claude.ai/code/session_01GkduEhcrqcG45rdfYh8dAc

* refactor: redesign model package to match framework conventions

Rename model.Database interface to model.Model (consistent with
client.Client, server.Server, store.Store). Remove generics in
favor of interface{}-based API with reflection.

Key changes:
- model.Model interface: Register once, CRUD infers table from type
- DefaultModel + NewModel() + package-level convenience functions
- Schema registered via Register(&User{}), no per-call schema passing
- Memory implementation as default (in model package, like store)
- memory/sqlite/postgres backends updated for new interface
- protoc-gen-micro generates RegisterXModel() instead of generic factory
- All docs, blog, and README updated

https://claude.ai/code/session_01GkduEhcrqcG45rdfYh8dAc

* docs: clarify blog post 7 uses modular monolith, not multi-service

Blog post 7 demonstrated all handlers in a single process but framed
it as microservices without acknowledging the architectural difference.

- Add "A Note on Architecture" section explaining this is a modular
  monolith demo and pointing to micro/blog for multi-service
- Clarify that handlers can be broken out into separate services later
- Fix "service registry" language to match single-process reality
- Restructure "Adding MCP to Existing Services" to distinguish the
  in-process approach from registry-based gateway options
- Update closing to acknowledge both paradigms
- Fix README type names (&CommentService{} -> &Comments{}, etc.)

https://claude.ai/code/session_01GkduEhcrqcG45rdfYh8dAc

* docs: add Micro Chat to website showcase

https://claude.ai/code/session_01GkduEhcrqcG45rdfYh8dAc

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-03-07 09:33:18 +00:00
Alexander Serheyev 28f7f53143 Update image reference in goreleaser configuration (#2887)
goreleaser / goreleaser (push) Waiting to run
Fix wrong order `user/repo`
2026-03-06 15:30:53 +00:00
Alexander Serheyev 0842431050 feat: github artifact release CI (#2886)
goreleaser / goreleaser (push) Waiting to run
* 👷feat(ci): add artifact and docker releases

* 💚fix(ci): build issues

* 💚fix(ci): add permissions

* 💚fix(ci): multiple artifacts

* 💚fix(ci): split archives

* 💚fix(ci): cross platform list

* 🚧chore(ci): package name

* 🐛fix(script): install script extract arch

* 👷fix(ci): docker origin go-micro
2026-03-06 14:49:18 +00:00
Asim Aslam 7a5d86a2a4 Claude/update docs roadmap f zd2 j (#2885)
* feat: add agent platform showcase and blog post

Add a complete platform example (Users, Posts, Comments, Mail) that
mirrors micro/blog, demonstrating how existing microservices become
AI-accessible through MCP with zero code changes.

Includes blog post "Your Microservices Are Already an AI Platform"
walking through real agent workflows: signup, content creation,
commenting, tagging, and cross-service messaging.

https://claude.ai/code/session_01GkduEhcrqcG45rdfYh8dAc

* refactor: rename handler types to drop redundant Service suffix

UserService → Users, PostService → Posts, CommentService → Comments,
MailService → Mail. Matches micro/blog naming convention.

https://claude.ai/code/session_01GkduEhcrqcG45rdfYh8dAc

* refactor: consolidate top-level directories, reduce framework bloat

Move internal/non-public packages behind internal/ or into their
parent packages where they belong:

- deploy/ → gateway/mcp/deploy/ (Helm charts belong with the gateway)
- profile/ → service/profile/ (preset plugin profiles are a service concern)
- scripts/ → internal/scripts/ (install script is not public API)
- test/ → internal/test/ (test harness is not public API)
- util/ → internal/util/ (internal helpers shouldn't be imported externally)

Also fixes CLAUDE.md merge conflict markers and updates project
structure documentation.

All import paths updated. Build and tests pass.

https://claude.ai/code/session_01GkduEhcrqcG45rdfYh8dAc

* refactor: redesign model package to match framework conventions

Rename model.Database interface to model.Model (consistent with
client.Client, server.Server, store.Store). Remove generics in
favor of interface{}-based API with reflection.

Key changes:
- model.Model interface: Register once, CRUD infers table from type
- DefaultModel + NewModel() + package-level convenience functions
- Schema registered via Register(&User{}), no per-call schema passing
- Memory implementation as default (in model package, like store)
- memory/sqlite/postgres backends updated for new interface
- protoc-gen-micro generates RegisterXModel() instead of generic factory
- All docs, blog, and README updated

https://claude.ai/code/session_01GkduEhcrqcG45rdfYh8dAc

* docs: clarify blog post 7 uses modular monolith, not multi-service

Blog post 7 demonstrated all handlers in a single process but framed
it as microservices without acknowledging the architectural difference.

- Add "A Note on Architecture" section explaining this is a modular
  monolith demo and pointing to micro/blog for multi-service
- Clarify that handlers can be broken out into separate services later
- Fix "service registry" language to match single-process reality
- Restructure "Adding MCP to Existing Services" to distinguish the
  in-process approach from registry-based gateway options
- Update closing to acknowledge both paradigms
- Fix README type names (&CommentService{} -> &Comments{}, etc.)

https://claude.ai/code/session_01GkduEhcrqcG45rdfYh8dAc

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-03-05 13:13:31 +00:00
Asim Aslam 8ecdf07e6b Update description of the blogging platform example 2026-03-05 12:03:26 +00:00
Asim Aslam 1bb25d6e7f Add agent platform showcase and refactor project structure (#2884)
* feat: add agent platform showcase and blog post

Add a complete platform example (Users, Posts, Comments, Mail) that
mirrors micro/blog, demonstrating how existing microservices become
AI-accessible through MCP with zero code changes.

Includes blog post "Your Microservices Are Already an AI Platform"
walking through real agent workflows: signup, content creation,
commenting, tagging, and cross-service messaging.

https://claude.ai/code/session_01GkduEhcrqcG45rdfYh8dAc

* refactor: rename handler types to drop redundant Service suffix

UserService → Users, PostService → Posts, CommentService → Comments,
MailService → Mail. Matches micro/blog naming convention.

https://claude.ai/code/session_01GkduEhcrqcG45rdfYh8dAc

* refactor: consolidate top-level directories, reduce framework bloat

Move internal/non-public packages behind internal/ or into their
parent packages where they belong:

- deploy/ → gateway/mcp/deploy/ (Helm charts belong with the gateway)
- profile/ → service/profile/ (preset plugin profiles are a service concern)
- scripts/ → internal/scripts/ (install script is not public API)
- test/ → internal/test/ (test harness is not public API)
- util/ → internal/util/ (internal helpers shouldn't be imported externally)

Also fixes CLAUDE.md merge conflict markers and updates project
structure documentation.

All import paths updated. Build and tests pass.

https://claude.ai/code/session_01GkduEhcrqcG45rdfYh8dAc

* refactor: redesign model package to match framework conventions

Rename model.Database interface to model.Model (consistent with
client.Client, server.Server, store.Store). Remove generics in
favor of interface{}-based API with reflection.

Key changes:
- model.Model interface: Register once, CRUD infers table from type
- DefaultModel + NewModel() + package-level convenience functions
- Schema registered via Register(&User{}), no per-call schema passing
- Memory implementation as default (in model package, like store)
- memory/sqlite/postgres backends updated for new interface
- protoc-gen-micro generates RegisterXModel() instead of generic factory
- All docs, blog, and README updated

https://claude.ai/code/session_01GkduEhcrqcG45rdfYh8dAc

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-03-05 11:21:41 +00:00
Asim Aslam b8fc0902d7 Claude/update docs roadmap f zd2 j (#2883)
* feat: add agent platform showcase and blog post

Add a complete platform example (Users, Posts, Comments, Mail) that
mirrors micro/blog, demonstrating how existing microservices become
AI-accessible through MCP with zero code changes.

Includes blog post "Your Microservices Are Already an AI Platform"
walking through real agent workflows: signup, content creation,
commenting, tagging, and cross-service messaging.

https://claude.ai/code/session_01GkduEhcrqcG45rdfYh8dAc

* refactor: rename handler types to drop redundant Service suffix

UserService → Users, PostService → Posts, CommentService → Comments,
MailService → Mail. Matches micro/blog naming convention.

https://claude.ai/code/session_01GkduEhcrqcG45rdfYh8dAc

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-03-05 08:56:24 +00:00
Asim Aslam 524e16296b Update documentation, add agent demo, and enhance service API (#2882)
* docs: update all four documentation guides and mark Q2 complete

- ai-native-services: add WithMCP one-liner, standalone gateway,
  WebSocket client example, and OpenTelemetry observability section
- mcp-security: add OTel distributed tracing, WebSocket authentication
  (connection-level and per-message), DeniedReason audit field
- tool-descriptions: add manual overrides with WithEndpointDocs and
  export formats section
- agent-patterns: add LangChain/LlamaIndex SDK pattern and standalone
  gateway production pattern with Docker example
- Update roadmap: mark Q2 documentation as complete, Q2 at 100%
- Update status: reflect all recent completions, shift priorities

https://claude.ai/code/session_01GkduEhcrqcG45rdfYh8dAc

* feat: add agent demo example and blog post

Add examples/agent-demo with a multi-service project management app
(projects, tasks, team) that demonstrates AI agents interacting with
Go Micro services through MCP. Includes seed data and example prompts.

Add blog post 4 "Agents Meet Microservices: A Hands-On Demo" walking
through the example code and showing cross-service agent workflows.

https://claude.ai/code/session_01GkduEhcrqcG45rdfYh8dAc

* feat: enable multiple services in a single binary

Remove global state mutations from service and cmd option functions so
that configuring one service no longer overwrites another's settings.

Key changes:
- service/options.go: remove all DefaultXxx global writes from option
  functions; newOptions() now creates fresh Server, Client, Store, and
  Cache per service while sharing Registry, Broker, and Transport
- cmd/cmd.go: newCmd() uses local copies instead of pointers to package
  globals; Before() no longer mutates DefaultXxx vars
- cmd/options.go: remove global mutations from all option functions
- service/service.go: export ServiceImpl type for cross-package use
- service/group.go: new Group type for multi-service lifecycle
- micro.go: add Start/Stop to Service interface, expose Group and
  NewGroup convenience function
- examples/multi-service: working example with two services

https://claude.ai/code/session_01GkduEhcrqcG45rdfYh8dAc

* docs: highlight multi-service binary support

Add multi-service section to README with code example, update features
list, add to examples index, and note in status summary.

https://claude.ai/code/session_01GkduEhcrqcG45rdfYh8dAc

* feat: unify service API and clean up developer experience

- Unified service creation: micro.New("name", opts...) as canonical API
- Clean handler registration: service.Handle(handler, opts...) accepts
  server.HandlerOption args directly, no need to reach through Server()
- Unexported serviceImpl: users interact through Service interface only
- Service groups use Service interface (not concrete type)
- Fixed Stop() to properly propagate BeforeStop/AfterStop errors
- Fixed store init: error-level log instead of fatal on init failure
- Updated all examples to use consistent patterns
- Updated README, getting-started, MCP docs, and guides
- Added blog post about the DX cleanup

https://claude.ai/code/session_01GkduEhcrqcG45rdfYh8dAc

* fix: add blog post 5 to blog index

Blog post 5 (Developer Experience Cleanup) existed as a file but was
missing from the blog index page.

https://claude.ai/code/session_01GkduEhcrqcG45rdfYh8dAc

* feat: make micro new generate MCP-enabled services by default

- main.go template includes mcp.WithMCP(":3001") by default
- Handler template has agent-friendly doc comments with @example tags
- Proto template has descriptive field comments
- README includes MCP usage, Claude Code config, and tool description tips
- Makefile adds mcp-tools, mcp-test, mcp-serve targets
- go.mod updated to Go 1.22
- Added --no-mcp flag to opt out of MCP integration
- Post-create output shows MCP endpoint URLs

https://claude.ai/code/session_01GkduEhcrqcG45rdfYh8dAc

* docs: add MCP migration guide and troubleshooting guide

- Migration guide: 3 approaches to add MCP to existing services
  (WithMCP one-liner, standalone gateway, CLI)
- Troubleshooting guide: common issues with agents, WebSocket,
  Claude Code, auth, rate limiting, and performance

https://claude.ai/code/session_01GkduEhcrqcG45rdfYh8dAc

* refactor: rename model/ package to ai/ for AI model providers

The model/ package name conflicted with the conventional use of "model"
for data models. Renamed to ai/ which better describes the package's
purpose (AI provider abstraction for Anthropic, OpenAI, etc.) and frees
up model/ for future data model layer use.

- Rename model/ → ai/ with package name change
- Update all Go imports from go-micro.dev/v5/model to go-micro.dev/v5/ai
- Update cmd/micro/server/server.go references (model.X → ai.X)
- Update all documentation and roadmap references
- All tests pass, CLI builds successfully

https://claude.ai/code/session_01GkduEhcrqcG45rdfYh8dAc

* feat: add model package for typed data access with CRUD and queries

New model/ package provides a typed data model layer using Go generics.
Supports structured CRUD operations, WHERE filters, ordering, pagination,
and automatic schema creation from struct tags.

Three backends:
- memory: in-memory for development and testing
- sqlite: embedded SQL for dev and single-node production
- postgres: full PostgreSQL for production deployments

Key features:
- Generic Model[T] with Create/Read/Update/Delete/List/Count
- Query builder: Where(), WhereOp(), OrderAsc/Desc(), Limit(), Offset()
- Struct tags: model:"key" for primary key, model:"index" for indexes
- Auto table creation from struct schema
- 19 tests passing across memory and sqlite backends

https://claude.ai/code/session_01GkduEhcrqcG45rdfYh8dAc

* feat: add model code generation to protoc-gen-micro

Extend the micro plugin to generate model structs from proto messages
annotated with // @model. Generated alongside client/server code in
the same .pb.micro.go file.

For a proto message like:
  // @model
  message User { string id = 1; string name = 2; }

Generates:
- UserModel struct with model:"key" and json tags
- NewUserModel(db) factory returning *model.Model[UserModel]
- UserModelFromProto(*User) *UserModel converter
- (*UserModel).ToProto() *User converter

Supports @model(table=custom_table, key=custom_field) options.
Adds GetComments() to generator for plugin comment inspection.

https://claude.ai/code/session_01GkduEhcrqcG45rdfYh8dAc

* feat: add Model() to Service interface for Client/Server/Model trifecta

Every service now exposes Client(), Server(), and Model() — call services,
handle requests, and save/query data from the same interface. Includes
README docs, blog post, and a full model guide on the docs site.

https://claude.ai/code/session_01GkduEhcrqcG45rdfYh8dAc

* feat: add Helm chart for MCP gateway Kubernetes deployment

Adds official Helm chart at deploy/helm/mcp-gateway/ with:
- Deployment, Service, ServiceAccount templates
- HPA for auto-scaling based on CPU/memory
- Ingress with TLS support
- Configurable registry (consul, etcd, mdns), rate limiting,
  JWT auth, audit logging, and per-tool scopes
- Security context (non-root, read-only rootfs, drop all caps)
- NOTES.txt with post-install connection instructions

Updates roadmap and status docs to reflect Helm Charts as delivered.

https://claude.ai/code/session_01GkduEhcrqcG45rdfYh8dAc

* docs: add Helm chart entry to changelog

https://claude.ai/code/session_01GkduEhcrqcG45rdfYh8dAc

* feat: add per-tool circuit breakers to MCP gateway

Protects downstream services from cascading failures. When a tool's
RPC calls fail repeatedly, the circuit opens and rejects requests
immediately until the service recovers (half-open probe pattern).

- CircuitBreakerConfig with MaxFailures, Timeout, MaxHalfOpen
- Per-tool breakers created during service discovery
- Integrated into HTTP call path with 503 response when open
- Records success/failure after each RPC call
- --circuit-breaker and --circuit-breaker-timeout CLI flags
- 8 unit tests covering all state transitions

https://claude.ai/code/session_01GkduEhcrqcG45rdfYh8dAc

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-03-05 08:32:59 +00:00
Asim Aslam d91812b476 Update documentation and add multi-service support with examples (#2881)
* docs: update all four documentation guides and mark Q2 complete

- ai-native-services: add WithMCP one-liner, standalone gateway,
  WebSocket client example, and OpenTelemetry observability section
- mcp-security: add OTel distributed tracing, WebSocket authentication
  (connection-level and per-message), DeniedReason audit field
- tool-descriptions: add manual overrides with WithEndpointDocs and
  export formats section
- agent-patterns: add LangChain/LlamaIndex SDK pattern and standalone
  gateway production pattern with Docker example
- Update roadmap: mark Q2 documentation as complete, Q2 at 100%
- Update status: reflect all recent completions, shift priorities

https://claude.ai/code/session_01GkduEhcrqcG45rdfYh8dAc

* feat: add agent demo example and blog post

Add examples/agent-demo with a multi-service project management app
(projects, tasks, team) that demonstrates AI agents interacting with
Go Micro services through MCP. Includes seed data and example prompts.

Add blog post 4 "Agents Meet Microservices: A Hands-On Demo" walking
through the example code and showing cross-service agent workflows.

https://claude.ai/code/session_01GkduEhcrqcG45rdfYh8dAc

* feat: enable multiple services in a single binary

Remove global state mutations from service and cmd option functions so
that configuring one service no longer overwrites another's settings.

Key changes:
- service/options.go: remove all DefaultXxx global writes from option
  functions; newOptions() now creates fresh Server, Client, Store, and
  Cache per service while sharing Registry, Broker, and Transport
- cmd/cmd.go: newCmd() uses local copies instead of pointers to package
  globals; Before() no longer mutates DefaultXxx vars
- cmd/options.go: remove global mutations from all option functions
- service/service.go: export ServiceImpl type for cross-package use
- service/group.go: new Group type for multi-service lifecycle
- micro.go: add Start/Stop to Service interface, expose Group and
  NewGroup convenience function
- examples/multi-service: working example with two services

https://claude.ai/code/session_01GkduEhcrqcG45rdfYh8dAc

* docs: highlight multi-service binary support

Add multi-service section to README with code example, update features
list, add to examples index, and note in status summary.

https://claude.ai/code/session_01GkduEhcrqcG45rdfYh8dAc

* feat: unify service API and clean up developer experience

- Unified service creation: micro.New("name", opts...) as canonical API
- Clean handler registration: service.Handle(handler, opts...) accepts
  server.HandlerOption args directly, no need to reach through Server()
- Unexported serviceImpl: users interact through Service interface only
- Service groups use Service interface (not concrete type)
- Fixed Stop() to properly propagate BeforeStop/AfterStop errors
- Fixed store init: error-level log instead of fatal on init failure
- Updated all examples to use consistent patterns
- Updated README, getting-started, MCP docs, and guides
- Added blog post about the DX cleanup

https://claude.ai/code/session_01GkduEhcrqcG45rdfYh8dAc

* fix: add blog post 5 to blog index

Blog post 5 (Developer Experience Cleanup) existed as a file but was
missing from the blog index page.

https://claude.ai/code/session_01GkduEhcrqcG45rdfYh8dAc

* feat: make micro new generate MCP-enabled services by default

- main.go template includes mcp.WithMCP(":3001") by default
- Handler template has agent-friendly doc comments with @example tags
- Proto template has descriptive field comments
- README includes MCP usage, Claude Code config, and tool description tips
- Makefile adds mcp-tools, mcp-test, mcp-serve targets
- go.mod updated to Go 1.22
- Added --no-mcp flag to opt out of MCP integration
- Post-create output shows MCP endpoint URLs

https://claude.ai/code/session_01GkduEhcrqcG45rdfYh8dAc

* docs: add MCP migration guide and troubleshooting guide

- Migration guide: 3 approaches to add MCP to existing services
  (WithMCP one-liner, standalone gateway, CLI)
- Troubleshooting guide: common issues with agents, WebSocket,
  Claude Code, auth, rate limiting, and performance

https://claude.ai/code/session_01GkduEhcrqcG45rdfYh8dAc

* refactor: rename model/ package to ai/ for AI model providers

The model/ package name conflicted with the conventional use of "model"
for data models. Renamed to ai/ which better describes the package's
purpose (AI provider abstraction for Anthropic, OpenAI, etc.) and frees
up model/ for future data model layer use.

- Rename model/ → ai/ with package name change
- Update all Go imports from go-micro.dev/v5/model to go-micro.dev/v5/ai
- Update cmd/micro/server/server.go references (model.X → ai.X)
- Update all documentation and roadmap references
- All tests pass, CLI builds successfully

https://claude.ai/code/session_01GkduEhcrqcG45rdfYh8dAc

* feat: add model package for typed data access with CRUD and queries

New model/ package provides a typed data model layer using Go generics.
Supports structured CRUD operations, WHERE filters, ordering, pagination,
and automatic schema creation from struct tags.

Three backends:
- memory: in-memory for development and testing
- sqlite: embedded SQL for dev and single-node production
- postgres: full PostgreSQL for production deployments

Key features:
- Generic Model[T] with Create/Read/Update/Delete/List/Count
- Query builder: Where(), WhereOp(), OrderAsc/Desc(), Limit(), Offset()
- Struct tags: model:"key" for primary key, model:"index" for indexes
- Auto table creation from struct schema
- 19 tests passing across memory and sqlite backends

https://claude.ai/code/session_01GkduEhcrqcG45rdfYh8dAc

* feat: add model code generation to protoc-gen-micro

Extend the micro plugin to generate model structs from proto messages
annotated with // @model. Generated alongside client/server code in
the same .pb.micro.go file.

For a proto message like:
  // @model
  message User { string id = 1; string name = 2; }

Generates:
- UserModel struct with model:"key" and json tags
- NewUserModel(db) factory returning *model.Model[UserModel]
- UserModelFromProto(*User) *UserModel converter
- (*UserModel).ToProto() *User converter

Supports @model(table=custom_table, key=custom_field) options.
Adds GetComments() to generator for plugin comment inspection.

https://claude.ai/code/session_01GkduEhcrqcG45rdfYh8dAc

* feat: add Model() to Service interface for Client/Server/Model trifecta

Every service now exposes Client(), Server(), and Model() — call services,
handle requests, and save/query data from the same interface. Includes
README docs, blog post, and a full model guide on the docs site.

https://claude.ai/code/session_01GkduEhcrqcG45rdfYh8dAc

* feat: add Helm chart for MCP gateway Kubernetes deployment

Adds official Helm chart at deploy/helm/mcp-gateway/ with:
- Deployment, Service, ServiceAccount templates
- HPA for auto-scaling based on CPU/memory
- Ingress with TLS support
- Configurable registry (consul, etcd, mdns), rate limiting,
  JWT auth, audit logging, and per-tool scopes
- Security context (non-root, read-only rootfs, drop all caps)
- NOTES.txt with post-install connection instructions

Updates roadmap and status docs to reflect Helm Charts as delivered.

https://claude.ai/code/session_01GkduEhcrqcG45rdfYh8dAc

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-03-05 07:28:30 +00:00
Asim Aslam 76bfeae456 Claude/update docs roadmap f zd2 j (#2880)
* docs: update all four documentation guides and mark Q2 complete

- ai-native-services: add WithMCP one-liner, standalone gateway,
  WebSocket client example, and OpenTelemetry observability section
- mcp-security: add OTel distributed tracing, WebSocket authentication
  (connection-level and per-message), DeniedReason audit field
- tool-descriptions: add manual overrides with WithEndpointDocs and
  export formats section
- agent-patterns: add LangChain/LlamaIndex SDK pattern and standalone
  gateway production pattern with Docker example
- Update roadmap: mark Q2 documentation as complete, Q2 at 100%
- Update status: reflect all recent completions, shift priorities

https://claude.ai/code/session_01GkduEhcrqcG45rdfYh8dAc

* feat: add agent demo example and blog post

Add examples/agent-demo with a multi-service project management app
(projects, tasks, team) that demonstrates AI agents interacting with
Go Micro services through MCP. Includes seed data and example prompts.

Add blog post 4 "Agents Meet Microservices: A Hands-On Demo" walking
through the example code and showing cross-service agent workflows.

https://claude.ai/code/session_01GkduEhcrqcG45rdfYh8dAc

* feat: enable multiple services in a single binary

Remove global state mutations from service and cmd option functions so
that configuring one service no longer overwrites another's settings.

Key changes:
- service/options.go: remove all DefaultXxx global writes from option
  functions; newOptions() now creates fresh Server, Client, Store, and
  Cache per service while sharing Registry, Broker, and Transport
- cmd/cmd.go: newCmd() uses local copies instead of pointers to package
  globals; Before() no longer mutates DefaultXxx vars
- cmd/options.go: remove global mutations from all option functions
- service/service.go: export ServiceImpl type for cross-package use
- service/group.go: new Group type for multi-service lifecycle
- micro.go: add Start/Stop to Service interface, expose Group and
  NewGroup convenience function
- examples/multi-service: working example with two services

https://claude.ai/code/session_01GkduEhcrqcG45rdfYh8dAc

* docs: highlight multi-service binary support

Add multi-service section to README with code example, update features
list, add to examples index, and note in status summary.

https://claude.ai/code/session_01GkduEhcrqcG45rdfYh8dAc

* feat: unify service API and clean up developer experience

- Unified service creation: micro.New("name", opts...) as canonical API
- Clean handler registration: service.Handle(handler, opts...) accepts
  server.HandlerOption args directly, no need to reach through Server()
- Unexported serviceImpl: users interact through Service interface only
- Service groups use Service interface (not concrete type)
- Fixed Stop() to properly propagate BeforeStop/AfterStop errors
- Fixed store init: error-level log instead of fatal on init failure
- Updated all examples to use consistent patterns
- Updated README, getting-started, MCP docs, and guides
- Added blog post about the DX cleanup

https://claude.ai/code/session_01GkduEhcrqcG45rdfYh8dAc

* fix: add blog post 5 to blog index

Blog post 5 (Developer Experience Cleanup) existed as a file but was
missing from the blog index page.

https://claude.ai/code/session_01GkduEhcrqcG45rdfYh8dAc

* feat: make micro new generate MCP-enabled services by default

- main.go template includes mcp.WithMCP(":3001") by default
- Handler template has agent-friendly doc comments with @example tags
- Proto template has descriptive field comments
- README includes MCP usage, Claude Code config, and tool description tips
- Makefile adds mcp-tools, mcp-test, mcp-serve targets
- go.mod updated to Go 1.22
- Added --no-mcp flag to opt out of MCP integration
- Post-create output shows MCP endpoint URLs

https://claude.ai/code/session_01GkduEhcrqcG45rdfYh8dAc

* docs: add MCP migration guide and troubleshooting guide

- Migration guide: 3 approaches to add MCP to existing services
  (WithMCP one-liner, standalone gateway, CLI)
- Troubleshooting guide: common issues with agents, WebSocket,
  Claude Code, auth, rate limiting, and performance

https://claude.ai/code/session_01GkduEhcrqcG45rdfYh8dAc

* refactor: rename model/ package to ai/ for AI model providers

The model/ package name conflicted with the conventional use of "model"
for data models. Renamed to ai/ which better describes the package's
purpose (AI provider abstraction for Anthropic, OpenAI, etc.) and frees
up model/ for future data model layer use.

- Rename model/ → ai/ with package name change
- Update all Go imports from go-micro.dev/v5/model to go-micro.dev/v5/ai
- Update cmd/micro/server/server.go references (model.X → ai.X)
- Update all documentation and roadmap references
- All tests pass, CLI builds successfully

https://claude.ai/code/session_01GkduEhcrqcG45rdfYh8dAc

* feat: add model package for typed data access with CRUD and queries

New model/ package provides a typed data model layer using Go generics.
Supports structured CRUD operations, WHERE filters, ordering, pagination,
and automatic schema creation from struct tags.

Three backends:
- memory: in-memory for development and testing
- sqlite: embedded SQL for dev and single-node production
- postgres: full PostgreSQL for production deployments

Key features:
- Generic Model[T] with Create/Read/Update/Delete/List/Count
- Query builder: Where(), WhereOp(), OrderAsc/Desc(), Limit(), Offset()
- Struct tags: model:"key" for primary key, model:"index" for indexes
- Auto table creation from struct schema
- 19 tests passing across memory and sqlite backends

https://claude.ai/code/session_01GkduEhcrqcG45rdfYh8dAc

* feat: add model code generation to protoc-gen-micro

Extend the micro plugin to generate model structs from proto messages
annotated with // @model. Generated alongside client/server code in
the same .pb.micro.go file.

For a proto message like:
  // @model
  message User { string id = 1; string name = 2; }

Generates:
- UserModel struct with model:"key" and json tags
- NewUserModel(db) factory returning *model.Model[UserModel]
- UserModelFromProto(*User) *UserModel converter
- (*UserModel).ToProto() *User converter

Supports @model(table=custom_table, key=custom_field) options.
Adds GetComments() to generator for plugin comment inspection.

https://claude.ai/code/session_01GkduEhcrqcG45rdfYh8dAc

* feat: add Model() to Service interface for Client/Server/Model trifecta

Every service now exposes Client(), Server(), and Model() — call services,
handle requests, and save/query data from the same interface. Includes
README docs, blog post, and a full model guide on the docs site.

https://claude.ai/code/session_01GkduEhcrqcG45rdfYh8dAc

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-03-04 13:13:34 +00:00
Asim Aslam f07a49e0d9 docs: add CHANGELOG.md with structured release history (#2878)
Keep a Changelog format covering 2026.01 through current unreleased
work. Includes all MCP gateway features, CLI commands, agent SDKs,
developer experience improvements, and documentation additions.

This replaces ad-hoc blog posts as the canonical "what changed" reference.

https://claude.ai/code/session_01GkduEhcrqcG45rdfYh8dAc

Co-authored-by: Claude <noreply@anthropic.com>
2026-03-04 12:05:06 +00:00
Asim Aslam 6247b1d065 chore: move internal status docs out of top level (#2879)
Move Claude-context working documents to internal/docs/:
- CURRENT_STATUS_SUMMARY.md
- PROJECT_STATUS_2026.md
- ROADMAP_2026.md
- IMPLEMENTATION_SUMMARY.md

These are session-tracking docs, not useful to most contributors.
Top level now only has standard files: README, CHANGELOG,
CONTRIBUTING, SECURITY, CLAUDE.md, and ROADMAP.

Updated all cross-references in CLAUDE.md, ROADMAP.md, and
website docs.

https://claude.ai/code/session_01GkduEhcrqcG45rdfYh8dAc

Co-authored-by: Claude <noreply@anthropic.com>
2026-03-04 11:59:52 +00:00
Asim Aslam c800dd3729 feat: add deployment example, workflow example, and MCP benchmarks (#2877)
Docker Compose deployment example (examples/deployment/):
- docker-compose.yml with Consul, MCP gateway, Jaeger tracing
- Dockerfile and Dockerfile.gateway for multi-stage builds
- README with architecture diagram and customization guide

Cross-service workflow example (examples/mcp/workflow/):
- Inventory, Orders, Notifications services
- Shows agents orchestrating multi-step workflows from natural language
- Stock check → reserve → order → notify in a single agent conversation

MCP gateway benchmark suite (gateway/mcp/benchmark_test.go):
- ListTools: ~20μs (10 tools), ~48μs (100 tools)
- Tool lookup: ~19ns (zero-alloc, scales to 500+ tools)
- Auth inspect: ~7ns, scope check: ~16ns
- Rate limiter: ~111ns per check
- JSON encode/decode: ~1.5-2μs per tool

Updated examples README with new examples index.

https://claude.ai/code/session_01GkduEhcrqcG45rdfYh8dAc

Co-authored-by: Claude <noreply@anthropic.com>
2026-03-04 11:40:10 +00:00
Asim Aslam 870b540922 Claude/mcp dx improvements f zd2 j (#2876)
* docs: add MCP migration guide and troubleshooting guide

- Migration guide: 3 approaches to add MCP to existing services
  (WithMCP one-liner, standalone gateway, CLI)
- Troubleshooting guide: common issues with agents, WebSocket,
  Claude Code, auth, rate limiting, and performance

https://claude.ai/code/session_01GkduEhcrqcG45rdfYh8dAc

* feat: add CRUD example, error handling guide, and status updates

- CRUD contact book example (examples/mcp/crud/) with 6 operations,
  rich doc comments, @example tags, and description struct tags
- Error handling guide for writing agent-friendly error responses
  using typed errors, actionable messages, and idempotency patterns
- Updated MCP examples index, CLAUDE.md, and status summary

https://claude.ai/code/session_01GkduEhcrqcG45rdfYh8dAc

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-03-04 11:32:27 +00:00
Asim Aslam fad2fd7af4 Claude/update docs roadmap f zd2 j (#2875)
* docs: update all four documentation guides and mark Q2 complete

- ai-native-services: add WithMCP one-liner, standalone gateway,
  WebSocket client example, and OpenTelemetry observability section
- mcp-security: add OTel distributed tracing, WebSocket authentication
  (connection-level and per-message), DeniedReason audit field
- tool-descriptions: add manual overrides with WithEndpointDocs and
  export formats section
- agent-patterns: add LangChain/LlamaIndex SDK pattern and standalone
  gateway production pattern with Docker example
- Update roadmap: mark Q2 documentation as complete, Q2 at 100%
- Update status: reflect all recent completions, shift priorities

https://claude.ai/code/session_01GkduEhcrqcG45rdfYh8dAc

* feat: add agent demo example and blog post

Add examples/agent-demo with a multi-service project management app
(projects, tasks, team) that demonstrates AI agents interacting with
Go Micro services through MCP. Includes seed data and example prompts.

Add blog post 4 "Agents Meet Microservices: A Hands-On Demo" walking
through the example code and showing cross-service agent workflows.

https://claude.ai/code/session_01GkduEhcrqcG45rdfYh8dAc

* feat: enable multiple services in a single binary

Remove global state mutations from service and cmd option functions so
that configuring one service no longer overwrites another's settings.

Key changes:
- service/options.go: remove all DefaultXxx global writes from option
  functions; newOptions() now creates fresh Server, Client, Store, and
  Cache per service while sharing Registry, Broker, and Transport
- cmd/cmd.go: newCmd() uses local copies instead of pointers to package
  globals; Before() no longer mutates DefaultXxx vars
- cmd/options.go: remove global mutations from all option functions
- service/service.go: export ServiceImpl type for cross-package use
- service/group.go: new Group type for multi-service lifecycle
- micro.go: add Start/Stop to Service interface, expose Group and
  NewGroup convenience function
- examples/multi-service: working example with two services

https://claude.ai/code/session_01GkduEhcrqcG45rdfYh8dAc

* docs: highlight multi-service binary support

Add multi-service section to README with code example, update features
list, add to examples index, and note in status summary.

https://claude.ai/code/session_01GkduEhcrqcG45rdfYh8dAc

* feat: unify service API and clean up developer experience

- Unified service creation: micro.New("name", opts...) as canonical API
- Clean handler registration: service.Handle(handler, opts...) accepts
  server.HandlerOption args directly, no need to reach through Server()
- Unexported serviceImpl: users interact through Service interface only
- Service groups use Service interface (not concrete type)
- Fixed Stop() to properly propagate BeforeStop/AfterStop errors
- Fixed store init: error-level log instead of fatal on init failure
- Updated all examples to use consistent patterns
- Updated README, getting-started, MCP docs, and guides
- Added blog post about the DX cleanup

https://claude.ai/code/session_01GkduEhcrqcG45rdfYh8dAc

* fix: add blog post 5 to blog index

Blog post 5 (Developer Experience Cleanup) existed as a file but was
missing from the blog index page.

https://claude.ai/code/session_01GkduEhcrqcG45rdfYh8dAc

* feat: make micro new generate MCP-enabled services by default

- main.go template includes mcp.WithMCP(":3001") by default
- Handler template has agent-friendly doc comments with @example tags
- Proto template has descriptive field comments
- README includes MCP usage, Claude Code config, and tool description tips
- Makefile adds mcp-tools, mcp-test, mcp-serve targets
- go.mod updated to Go 1.22
- Added --no-mcp flag to opt out of MCP integration
- Post-create output shows MCP endpoint URLs

https://claude.ai/code/session_01GkduEhcrqcG45rdfYh8dAc

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-03-04 11:24:33 +00:00
Asim Aslam 19892f2c67 Claude/update docs roadmap f zd2 j (#2874)
* docs: update all four documentation guides and mark Q2 complete

- ai-native-services: add WithMCP one-liner, standalone gateway,
  WebSocket client example, and OpenTelemetry observability section
- mcp-security: add OTel distributed tracing, WebSocket authentication
  (connection-level and per-message), DeniedReason audit field
- tool-descriptions: add manual overrides with WithEndpointDocs and
  export formats section
- agent-patterns: add LangChain/LlamaIndex SDK pattern and standalone
  gateway production pattern with Docker example
- Update roadmap: mark Q2 documentation as complete, Q2 at 100%
- Update status: reflect all recent completions, shift priorities

https://claude.ai/code/session_01GkduEhcrqcG45rdfYh8dAc

* feat: add agent demo example and blog post

Add examples/agent-demo with a multi-service project management app
(projects, tasks, team) that demonstrates AI agents interacting with
Go Micro services through MCP. Includes seed data and example prompts.

Add blog post 4 "Agents Meet Microservices: A Hands-On Demo" walking
through the example code and showing cross-service agent workflows.

https://claude.ai/code/session_01GkduEhcrqcG45rdfYh8dAc

* feat: enable multiple services in a single binary

Remove global state mutations from service and cmd option functions so
that configuring one service no longer overwrites another's settings.

Key changes:
- service/options.go: remove all DefaultXxx global writes from option
  functions; newOptions() now creates fresh Server, Client, Store, and
  Cache per service while sharing Registry, Broker, and Transport
- cmd/cmd.go: newCmd() uses local copies instead of pointers to package
  globals; Before() no longer mutates DefaultXxx vars
- cmd/options.go: remove global mutations from all option functions
- service/service.go: export ServiceImpl type for cross-package use
- service/group.go: new Group type for multi-service lifecycle
- micro.go: add Start/Stop to Service interface, expose Group and
  NewGroup convenience function
- examples/multi-service: working example with two services

https://claude.ai/code/session_01GkduEhcrqcG45rdfYh8dAc

* docs: highlight multi-service binary support

Add multi-service section to README with code example, update features
list, add to examples index, and note in status summary.

https://claude.ai/code/session_01GkduEhcrqcG45rdfYh8dAc

* feat: unify service API and clean up developer experience

- Unified service creation: micro.New("name", opts...) as canonical API
- Clean handler registration: service.Handle(handler, opts...) accepts
  server.HandlerOption args directly, no need to reach through Server()
- Unexported serviceImpl: users interact through Service interface only
- Service groups use Service interface (not concrete type)
- Fixed Stop() to properly propagate BeforeStop/AfterStop errors
- Fixed store init: error-level log instead of fatal on init failure
- Updated all examples to use consistent patterns
- Updated README, getting-started, MCP docs, and guides
- Added blog post about the DX cleanup

https://claude.ai/code/session_01GkduEhcrqcG45rdfYh8dAc

* fix: add blog post 5 to blog index

Blog post 5 (Developer Experience Cleanup) existed as a file but was
missing from the blog index page.

https://claude.ai/code/session_01GkduEhcrqcG45rdfYh8dAc

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-03-04 11:19:43 +00:00
Asim Aslam d2036b880d Claude/update docs roadmap f zd2 j (#2873)
* docs: update all four documentation guides and mark Q2 complete

- ai-native-services: add WithMCP one-liner, standalone gateway,
  WebSocket client example, and OpenTelemetry observability section
- mcp-security: add OTel distributed tracing, WebSocket authentication
  (connection-level and per-message), DeniedReason audit field
- tool-descriptions: add manual overrides with WithEndpointDocs and
  export formats section
- agent-patterns: add LangChain/LlamaIndex SDK pattern and standalone
  gateway production pattern with Docker example
- Update roadmap: mark Q2 documentation as complete, Q2 at 100%
- Update status: reflect all recent completions, shift priorities

https://claude.ai/code/session_01GkduEhcrqcG45rdfYh8dAc

* feat: add agent demo example and blog post

Add examples/agent-demo with a multi-service project management app
(projects, tasks, team) that demonstrates AI agents interacting with
Go Micro services through MCP. Includes seed data and example prompts.

Add blog post 4 "Agents Meet Microservices: A Hands-On Demo" walking
through the example code and showing cross-service agent workflows.

https://claude.ai/code/session_01GkduEhcrqcG45rdfYh8dAc

* feat: enable multiple services in a single binary

Remove global state mutations from service and cmd option functions so
that configuring one service no longer overwrites another's settings.

Key changes:
- service/options.go: remove all DefaultXxx global writes from option
  functions; newOptions() now creates fresh Server, Client, Store, and
  Cache per service while sharing Registry, Broker, and Transport
- cmd/cmd.go: newCmd() uses local copies instead of pointers to package
  globals; Before() no longer mutates DefaultXxx vars
- cmd/options.go: remove global mutations from all option functions
- service/service.go: export ServiceImpl type for cross-package use
- service/group.go: new Group type for multi-service lifecycle
- micro.go: add Start/Stop to Service interface, expose Group and
  NewGroup convenience function
- examples/multi-service: working example with two services

https://claude.ai/code/session_01GkduEhcrqcG45rdfYh8dAc

* docs: highlight multi-service binary support

Add multi-service section to README with code example, update features
list, add to examples index, and note in status summary.

https://claude.ai/code/session_01GkduEhcrqcG45rdfYh8dAc

* feat: unify service API and clean up developer experience

- Unified service creation: micro.New("name", opts...) as canonical API
- Clean handler registration: service.Handle(handler, opts...) accepts
  server.HandlerOption args directly, no need to reach through Server()
- Unexported serviceImpl: users interact through Service interface only
- Service groups use Service interface (not concrete type)
- Fixed Stop() to properly propagate BeforeStop/AfterStop errors
- Fixed store init: error-level log instead of fatal on init failure
- Updated all examples to use consistent patterns
- Updated README, getting-started, MCP docs, and guides
- Added blog post about the DX cleanup

https://claude.ai/code/session_01GkduEhcrqcG45rdfYh8dAc

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-03-04 11:13:27 +00:00
Asim Aslam cad0ff1e49 Claude/update docs roadmap f zd2 j (#2872)
* docs: update all four documentation guides and mark Q2 complete

- ai-native-services: add WithMCP one-liner, standalone gateway,
  WebSocket client example, and OpenTelemetry observability section
- mcp-security: add OTel distributed tracing, WebSocket authentication
  (connection-level and per-message), DeniedReason audit field
- tool-descriptions: add manual overrides with WithEndpointDocs and
  export formats section
- agent-patterns: add LangChain/LlamaIndex SDK pattern and standalone
  gateway production pattern with Docker example
- Update roadmap: mark Q2 documentation as complete, Q2 at 100%
- Update status: reflect all recent completions, shift priorities

https://claude.ai/code/session_01GkduEhcrqcG45rdfYh8dAc

* feat: add agent demo example and blog post

Add examples/agent-demo with a multi-service project management app
(projects, tasks, team) that demonstrates AI agents interacting with
Go Micro services through MCP. Includes seed data and example prompts.

Add blog post 4 "Agents Meet Microservices: A Hands-On Demo" walking
through the example code and showing cross-service agent workflows.

https://claude.ai/code/session_01GkduEhcrqcG45rdfYh8dAc

* feat: enable multiple services in a single binary

Remove global state mutations from service and cmd option functions so
that configuring one service no longer overwrites another's settings.

Key changes:
- service/options.go: remove all DefaultXxx global writes from option
  functions; newOptions() now creates fresh Server, Client, Store, and
  Cache per service while sharing Registry, Broker, and Transport
- cmd/cmd.go: newCmd() uses local copies instead of pointers to package
  globals; Before() no longer mutates DefaultXxx vars
- cmd/options.go: remove global mutations from all option functions
- service/service.go: export ServiceImpl type for cross-package use
- service/group.go: new Group type for multi-service lifecycle
- micro.go: add Start/Stop to Service interface, expose Group and
  NewGroup convenience function
- examples/multi-service: working example with two services

https://claude.ai/code/session_01GkduEhcrqcG45rdfYh8dAc

* docs: highlight multi-service binary support

Add multi-service section to README with code example, update features
list, add to examples index, and note in status summary.

https://claude.ai/code/session_01GkduEhcrqcG45rdfYh8dAc

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-03-04 10:50:00 +00:00
Asim Aslam ffe43e0e6d Claude/update docs roadmap f zd2 j (#2871)
* docs: update all four documentation guides and mark Q2 complete

- ai-native-services: add WithMCP one-liner, standalone gateway,
  WebSocket client example, and OpenTelemetry observability section
- mcp-security: add OTel distributed tracing, WebSocket authentication
  (connection-level and per-message), DeniedReason audit field
- tool-descriptions: add manual overrides with WithEndpointDocs and
  export formats section
- agent-patterns: add LangChain/LlamaIndex SDK pattern and standalone
  gateway production pattern with Docker example
- Update roadmap: mark Q2 documentation as complete, Q2 at 100%
- Update status: reflect all recent completions, shift priorities

https://claude.ai/code/session_01GkduEhcrqcG45rdfYh8dAc

* feat: add agent demo example and blog post

Add examples/agent-demo with a multi-service project management app
(projects, tasks, team) that demonstrates AI agents interacting with
Go Micro services through MCP. Includes seed data and example prompts.

Add blog post 4 "Agents Meet Microservices: A Hands-On Demo" walking
through the example code and showing cross-service agent workflows.

https://claude.ai/code/session_01GkduEhcrqcG45rdfYh8dAc

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-03-04 10:16:17 +00:00
Asim Aslam ec9473f86f Update sponsorship information in README.md 2026-03-04 10:10:46 +00:00
Asim Aslam 4c673f61b1 Fix formatting in README.md links section 2026-03-04 10:10:18 +00:00
Asim Aslam bed94bfa95 Update sponsorship information in README
Updated sponsorship link and removed sponsor text.
2026-03-04 10:10:04 +00:00
Asim Aslam d02ff2ecfa feat: add standalone MCP gateway binary (#2870)
Add cmd/micro-mcp-gateway for production MCP gateway deployment
independent of micro run. Supports:

- Registry selection: mdns, consul, etcd (via --registry flag)
- Rate limiting per tool (--rate-limit, --rate-burst)
- JWT authentication (--auth)
- Per-tool scope requirements (--scope tool=scope1,scope2)
- Audit logging to stdout (--audit)
- Environment variable configuration for all flags
- Dockerfile for containerized deployment

Usage:
  micro-mcp-gateway --address :3000 --registry consul --registry-address consul:8500

https://claude.ai/code/session_01GkduEhcrqcG45rdfYh8dAc

Co-authored-by: Claude <noreply@anthropic.com>
2026-03-04 10:08:09 +00:00
Asim Aslam 6d9645adce feat: polish agent playground UI (#2869)
Redesign the /agent playground with improved UX:
- Chat-focused layout with full-height message area and sticky input
- Collapsible tool call cards showing name, input, result, and timing
- Thinking indicator while waiting for agent response
- Settings panel collapsed by default (auto-opens if no API key)
- Empty state with available tools preview
- Clear chat button
- Better visual hierarchy with distinct message styles

Co-authored-by: Claude <noreply@anthropic.com>
2026-03-04 09:38:04 +00:00
Asim Aslam beeaad748e Claude/update docs roadmap f zd2 j (#2868)
* feat: add LlamaIndex SDK for Go Micro services

Add LlamaIndex integration package that enables LlamaIndex agents to
discover and call Go Micro microservices through the MCP gateway.
Follows the same pattern as the existing LangChain SDK.

- GoMicroToolkit with from_gateway() factory and tool filtering
- FunctionTool integration via llama_index.core.tools
- Auth support, error handling, and retry configuration
- Examples for basic agent and RAG + microservices workflows
- Unit tests with mocked gateway responses

https://claude.ai/code/session_01GkduEhcrqcG45rdfYh8dAc

* docs: update status for OTel, WebSocket, and LlamaIndex SDK completion

Reflect recently completed work in roadmap and status documents:
- Q2 progress: 85% -> 95% (WebSocket, LlamaIndex SDK done)
- Q3 progress: 40% -> 50% (OpenTelemetry integration done)
- Transports: 2 -> 3 (added WebSocket)
- Agent SDKs: 1 -> 2 (added LlamaIndex)
- Test coverage: 568 -> 1,000+ lines

https://claude.ai/code/session_01GkduEhcrqcG45rdfYh8dAc

* feat: add WithMCP convenience option, improve startup banner, and blog post

- Add mcp.WithMCP(":3000") service option for one-line MCP setup
- Improve `micro run` startup banner to show Agent playground, MCP
  tools, and WebSocket endpoints prominently
- Add blog post: "Building the AI-Native Future of Go Micro with Claude"
  covering WebSocket transport, OTel integration, LlamaIndex SDK, and
  Anthropic's Claude Max sponsorship
- Update blog index and navigation links

https://claude.ai/code/session_01GkduEhcrqcG45rdfYh8dAc

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-03-04 09:28:07 +00:00
Asim Aslam 076b7c37be feat: add WebSocket transport for MCP gateway (#2867)
Add bidirectional WebSocket transport at /mcp/ws using JSON-RPC 2.0
protocol (same as stdio). This enables persistent connections for
real-time AI agents that need streaming tool interactions.

New files:
- gateway/mcp/websocket.go: WebSocketTransport with connection-level
  auth, per-message auth fallback, write serialization, OTel tracing
- gateway/mcp/websocket_test.go: 14 tests covering initialize,
  tools/list, tool calls, auth (header + param), scopes, rate
  limiting, audit, concurrent requests, multiple connections,
  error handling, and connection persistence

Changes:
- gateway/mcp/mcp.go: Register /mcp/ws handler in serveHTTP
- go.mod: Added github.com/gorilla/websocket v1.5.3

Auth supports two modes:
- Connection-level: Bearer token in WebSocket upgrade request headers
- Per-message: _token field in JSON-RPC params (same as stdio)

https://claude.ai/code/session_01GkduEhcrqcG45rdfYh8dAc

Co-authored-by: Claude <noreply@anthropic.com>
2026-03-04 08:26:09 +00:00
Asim Aslam ab6f027741 Claude/update docs roadmap f zd2 j (#2866)
* Update docs and roadmap to March 2026 with focus priorities

- ROADMAP.md: Updated from Nov 2025 to reflect Q1 completions and current state
- ROADMAP_2026.md: Updated status to March 2026, added model package as delivered
- CURRENT_STATUS_SUMMARY.md: Rewrote with March 2026 status and clear next priorities
- PROJECT_STATUS_2026.md: Added model package section, updated recommendations
- Website roadmap: Updated Q3 security status and timestamps

Key focus areas identified: documentation guides, multi-protocol MCP,
LlamaIndex SDK, and OpenTelemetry integration.

https://claude.ai/code/session_01GkduEhcrqcG45rdfYh8dAc

* Add CLAUDE.md and four documentation guides to fill doc gaps

- CLAUDE.md: Project guide with structure, build commands, and priorities
- ai-native-services.md: End-to-end tutorial building an MCP-enabled task service
- mcp-security.md: Production security guide (auth, scopes, rate limiting, audit)
- tool-descriptions.md: Best practices for writing Go comments that help agents
- agent-patterns.md: Six integration patterns from single-agent to event-driven
- Updated docs index with new "AI & Agents" section linking all four guides

These were the highest priority gaps identified in the roadmap analysis:
the framework has solid features that were under-documented.

https://claude.ai/code/session_01GkduEhcrqcG45rdfYh8dAc

* feat: add OpenTelemetry tracing to MCP gateway

Integrate OpenTelemetry spans into the MCP gateway for both HTTP and
stdio transports. Each tool call now creates a server span with rich
attributes (tool name, account ID, auth outcome, transport type).
Trace context is propagated to downstream RPC calls via metadata,
enabling end-to-end distributed tracing through Jaeger, Grafana, etc.

New files:
- gateway/mcp/otel.go: Span creation, attribute constants, metadata carrier
- gateway/mcp/otel_test.go: 8 tests covering span creation, auth denied/allowed,
  rate limiting, trace propagation, noop provider, and missing token

Changes:
- Options.TraceProvider: Optional trace.TracerProvider field
- handleCallTool (HTTP): Creates OTel spans with auth/rate-limit attributes
- handleToolsCall (stdio): Same instrumentation for stdio transport
- go.mod: Added go.opentelemetry.io/otel/sdk v1.35.0 (test dependency)

The existing MCP trace ID (UUID) is preserved for backward compatibility
and recorded as a span attribute alongside the W3C trace context.

https://claude.ai/code/session_01GkduEhcrqcG45rdfYh8dAc

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-03-04 08:16:06 +00:00
Asim Aslam 14ec9b955f Update status docs: March 2026 progress and roadmap refinement (#2865)
* Update docs and roadmap to March 2026 with focus priorities

- ROADMAP.md: Updated from Nov 2025 to reflect Q1 completions and current state
- ROADMAP_2026.md: Updated status to March 2026, added model package as delivered
- CURRENT_STATUS_SUMMARY.md: Rewrote with March 2026 status and clear next priorities
- PROJECT_STATUS_2026.md: Added model package section, updated recommendations
- Website roadmap: Updated Q3 security status and timestamps

Key focus areas identified: documentation guides, multi-protocol MCP,
LlamaIndex SDK, and OpenTelemetry integration.

https://claude.ai/code/session_01GkduEhcrqcG45rdfYh8dAc

* Add CLAUDE.md and four documentation guides to fill doc gaps

- CLAUDE.md: Project guide with structure, build commands, and priorities
- ai-native-services.md: End-to-end tutorial building an MCP-enabled task service
- mcp-security.md: Production security guide (auth, scopes, rate limiting, audit)
- tool-descriptions.md: Best practices for writing Go comments that help agents
- agent-patterns.md: Six integration patterns from single-agent to event-driven
- Updated docs index with new "AI & Agents" section linking all four guides

These were the highest priority gaps identified in the roadmap analysis:
the framework has solid features that were under-documented.

https://claude.ai/code/session_01GkduEhcrqcG45rdfYh8dAc

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-03-04 07:33:19 +00:00
Asim Aslam a789c9e94b Update Go Micro version in README 2026-02-21 05:22:24 +00:00
Copilot e110ccb5ff Refactor model interface to high-level idiomatic Go API (#2863)
* Initial plan

* Add model package with provider abstraction interface

Co-authored-by: asim <17530+asim@users.noreply.github.com>

* Add unit tests for model providers

Co-authored-by: asim <17530+asim@users.noreply.github.com>

* Refactor server to use model package abstraction

Co-authored-by: asim <17530+asim@users.noreply.github.com>

* Use strings.Contains instead of custom substring search

Co-authored-by: asim <17530+asim@users.noreply.github.com>

* Add comprehensive documentation for model package

Co-authored-by: asim <17530+asim@users.noreply.github.com>

* Refactor model interface to be more idiomatic Go

Co-authored-by: asim <17530+asim@users.noreply.github.com>

* Simplify server code to use new high-level Generate API

Co-authored-by: asim <17530+asim@users.noreply.github.com>

* Update documentation for new high-level model API

Co-authored-by: asim <17530+asim@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: asim <17530+asim@users.noreply.github.com>
2026-02-14 18:15:07 +00:00
Copilot e3337efd81 Update 2026 roadmap to reflect Q2 completions (85% → docs only) (#2862)
* Initial plan

* Update 2026 roadmap to reflect Q2 completions (CLI exports and LangChain SDK)

Co-authored-by: asim <17530+asim@users.noreply.github.com>

* Update PROJECT_STATUS and roadmap docs to reflect Q2 85% completion

Co-authored-by: asim <17530+asim@users.noreply.github.com>

* Fix CLI integration status table to show all commands as complete

Co-authored-by: asim <17530+asim@users.noreply.github.com>

* Address code review feedback: fix duplicates and add missing metrics

Co-authored-by: asim <17530+asim@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: asim <17530+asim@users.noreply.github.com>
2026-02-13 17:36:25 +00:00
Copilot 13d1116dee Implement Q2 2026 roadmap: MCP CLI export commands and LangChain SDK (#2861)
* Initial plan

* Implement micro mcp docs and export commands (Q2 2026 roadmap)

Co-authored-by: asim <17530+asim@users.noreply.github.com>

* Add comprehensive CLI examples and documentation for new MCP commands

Co-authored-by: asim <17530+asim@users.noreply.github.com>

* Add LangChain Python SDK for Go Micro (Q2 2026 roadmap)

Co-authored-by: asim <17530+asim@users.noreply.github.com>

* Update PROJECT_STATUS to reflect LangChain SDK completion

Co-authored-by: asim <17530+asim@users.noreply.github.com>

* Add implementation summary for Roadmap 2026 session

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: asim <17530+asim@users.noreply.github.com>
2026-02-13 14:39:48 +00:00
Copilot 1db7903010 [WIP] Implement missing features from documentation (#2859)
* Initial plan

* Add --header and --metadata flags to micro call command

Co-authored-by: asim <17530+asim@users.noreply.github.com>

* Apply code formatting with gofmt

Co-authored-by: asim <17530+asim@users.noreply.github.com>

* Add clarifying comments for dual metadata handling paths

Co-authored-by: asim <17530+asim@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: asim <17530+asim@users.noreply.github.com>
2026-02-13 14:20:34 +00:00
Copilot 5e1042e5ae Implement micro mcp test command (#2857)
* Initial plan

* Implement micro mcp test command

Co-authored-by: asim <17530+asim@users.noreply.github.com>

* Add test for parseTool function

Co-authored-by: asim <17530+asim@users.noreply.github.com>

* Address code review feedback - simplify parseTool

Co-authored-by: asim <17530+asim@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: asim <17530+asim@users.noreply.github.com>
2026-02-13 14:19:41 +00:00
Copilot 0f6453488e Implement missing --service flag for micro deploy command (#2858)
* Initial plan

* Implement --service flag for micro deploy command

Co-authored-by: asim <17530+asim@users.noreply.github.com>

* Address code review feedback - optimize validation and add comments

Co-authored-by: asim <17530+asim@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: asim <17530+asim@users.noreply.github.com>
2026-02-13 14:19:03 +00:00
Copilot abc7e3e052 Add MCP tools registry and agent playground to README and docs navigation (#2856)
* Initial plan

* Add MCP tools registry and agent playground to README and docs navigation

Co-authored-by: asim <17530+asim@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: asim <17530+asim@users.noreply.github.com>
2026-02-12 17:56:02 +00:00
Asim Aslam 759ad1de50 x 2026-02-12 10:59:51 +00:00
Asim Aslam 92b9f84d79 x 2026-02-12 10:55:13 +00:00
Asim Aslam 3a605c461d x 2026-02-12 10:45:13 +00:00
Asim Aslam de615e0573 x 2026-02-12 10:34:53 +00:00
Asim Aslam 9d9968d66b scopes 2026-02-12 10:33:15 +00:00
Asim Aslam 9c3e883dff add safe names for tools 2026-02-12 10:15:57 +00:00
Asim Aslam 33e828acdd x 2026-02-12 10:11:58 +00:00
Asim Aslam a2442fa72e x 2026-02-12 10:07:20 +00:00
Asim Aslam c9a3584656 update docs 2026-02-12 10:01:26 +00:00
Asim Aslam 22fa349d5f . 2026-02-12 09:56:19 +00:00
Asim Aslam 2c7f612178 . 2026-02-12 09:55:18 +00:00
Copilot 06608d354e Add Anthropic model support to the agent (#2855)
* Initial plan

* Add MCP Playground page to web UI with tool discovery and calling

- Add playground.html template with chat-style agent prompt interface
- Add /playground route handler in server
- Add /api/mcp/tools endpoint to list available MCP tools
- Add /api/mcp/call endpoint to invoke MCP tools via RPC
- Add Playground link to sidebar navigation
- Playground auto-discovers services from registry and renders them as
  callable tools with input forms and activity logging

Co-authored-by: asim <17530+asim@users.noreply.github.com>

* Add playground.html template and fix .gitignore micro pattern

Fix .gitignore pattern 'micro' -> '/micro' to only ignore root-level
binary, not paths containing 'micro' as a component.

Co-authored-by: asim <17530+asim@users.noreply.github.com>

* Address code review: use crypto/rand for trace IDs, fix var redecl, remove dup comment

Co-authored-by: asim <17530+asim@users.noreply.github.com>

* Rename Playground to Agent, fix styling, add LLM-powered prompt

- Rename /playground to /agent, move Agent link to top of sidebar menu
- Fix template styling: use existing form/input/button CSS from styles.css
  instead of inline styles and form-plain class
- Add /api/agent/settings GET/POST endpoints for model API key, model
  name, and base URL configuration (stored in server store)
- Add /api/agent/prompt POST endpoint that sends user prompt to
  OpenAI-compatible LLM API with tool definitions from registry,
  executes any tool calls via RPC, and returns results with a
  follow-up LLM summary
- Show available tools in a table using existing table styles
- Prompt section is placed above settings for primary workflow

Co-authored-by: asim <17530+asim@users.noreply.github.com>

* Address code review: handle unmarshal errors, extract system prompt, improve param descriptions

Co-authored-by: asim <17530+asim@users.noreply.github.com>

* Add Anthropic model support to the agent

Support both OpenAI and Anthropic APIs in the agent prompt handler:
- Add provider selector (OpenAI/Anthropic) to settings UI and backend
- Auto-detect provider from base URL when not explicitly set
- Anthropic: use /v1/messages endpoint, x-api-key header, input_schema
  format for tools, content blocks for responses, tool_use/tool_result
  message format for follow-ups
- OpenAI: unchanged /v1/chat/completions with Bearer auth
- Default models: gpt-4o (OpenAI), claude-sonnet-4-20250514 (Anthropic)
- Provider-specific defaults for base URLs

Co-authored-by: asim <17530+asim@users.noreply.github.com>

* Remove duplicate Anthropic follow-up message construction

Co-authored-by: asim <17530+asim@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: asim <17530+asim@users.noreply.github.com>
2026-02-12 09:32:27 +00:00
Copilot d8269fbdfb Document MCP integration and tool scopes implementation status (#2852)
* Initial plan

* Add comprehensive project status analysis and update roadmap

Co-authored-by: asim <17530+asim@users.noreply.github.com>

* Add executive summary of project status

Co-authored-by: asim <17530+asim@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: asim <17530+asim@users.noreply.github.com>
2026-02-12 07:24:31 +00:00
Copilot ac47a4650a MCP gateway: add per-tool scopes, tracing, rate limiting, and audit logging (#2850)
* Initial plan

* Add MCP per-tool scopes, tracing, rate limiting, and audit logging

- Add Scopes field to Tool struct for per-tool scope requirements
- Add Auth (auth.Auth) integration to Options for token inspection
- Add trace ID generation (UUID) propagated via metadata to downstream RPCs
- Add per-tool rate limiting with configurable requests/sec and burst
- Add AuditFunc callback for immutable tool-call audit records
- Extract tool scopes from registry endpoint metadata ("scopes" key)
- Update both HTTP and stdio transports with auth/trace/rate/audit
- Add comprehensive tests for all new functionality

Co-authored-by: asim <17530+asim@users.noreply.github.com>

* Revert unrelated example go.mod changes

Co-authored-by: asim <17530+asim@users.noreply.github.com>

* Remove auto-generated example go.sum files

Co-authored-by: asim <17530+asim@users.noreply.github.com>

* Add WithEndpointScopes helper, gateway-level ToolScopes, and documentation

- Add server.WithEndpointScopes() for declaring per-endpoint auth scopes at
  handler registration time
- Add mcp.Options.ToolScopes for gateway-level scope overrides without
  changing individual services
- Update documented example to show WithEndpointScopes usage
- Update examples/mcp/README.md with scopes, tracing, and rate-limiting docs
- Update gateway/mcp/DOCUMENTATION.md with scopes section and FAQ
- Add tests for both new features

Co-authored-by: asim <17530+asim@users.noreply.github.com>

* Fix ToolScopes doc comment: clarify override (not merge) semantics

Co-authored-by: asim <17530+asim@users.noreply.github.com>

* Revert unrelated example go.mod/go.sum changes

Co-authored-by: asim <17530+asim@users.noreply.github.com>

* Rename ToolScopes to Scopes in MCP Options

The field name "Scopes" is more universal and consistent with how
auth scopes are used throughout go-micro. Updated all code references,
tests, and documentation.

Co-authored-by: asim <17530+asim@users.noreply.github.com>

* MCP gateway: add per-tool scopes, tracing, rate limiting, and audit logging

Co-authored-by: asim <17530+asim@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: asim <17530+asim@users.noreply.github.com>
2026-02-11 21:01:31 +00:00
asim f1cba0d617 update index 2026-02-11 15:30:35 +00:00
asim c658126b28 update index 2026-02-11 15:28:16 +00:00
asim 0d69e24a24 further mcp integrations 2026-02-11 14:29:26 +00:00
asim fe76f3ddb5 further mcp integrations 2026-02-11 14:12:21 +00:00
asim 3986738e2c stdio MCP transport and gateway refactor
Implement Q2 2026 roadmap items for AI-native microservices:

MCP stdio transport:
- JSON-RPC 2.0 over stdio for Claude Code integration
- Methods: initialize, tools/list, tools/call
- Auto-detection: stdio (no address) vs HTTP/SSE (with address)

micro mcp command:
- 'micro mcp serve' - start MCP server (stdio or HTTP)
- 'micro mcp list' - list available tools
- 'micro mcp test' - test a tool (placeholder)
- Enables Claude Code users to add microservices as tools

Gateway refactor:
- Created gateway/api package (reusable, 150 lines)
- Moved gateway logic from cmd/micro/server/gateway.go
- HandlerRegistrar pattern for flexibility
- cmd/micro/server/gateway.go now compatibility wrapper (72 lines)
- 50% code reduction, better separation of concerns
- Library users can now use gateway in custom apps

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-11 13:38:27 +00:00
asim e58d51c3ef update version in readme 2026-02-11 13:15:16 +00:00
asim bed7c4cc57 fix tests 2026-02-11 12:59:18 +00:00
asim e7335f945a noop auth fixed 2026-02-11 11:46:02 +00:00
asim 46e9940443 new 2026 roadmap 2026-02-11 11:37:14 +00:00
asim c9e582b966 go fmt 2026-02-11 11:25:43 +00:00
asim 7da9e58c81 fully functioning auth 2026-02-11 11:25:36 +00:00
Asim Aslam b1c63fa4ef Add MCP Integration section to README 2026-02-11 11:13:06 +00:00
asim e311586bd2 update mcp doc location 2026-02-11 11:09:04 +00:00
asim bc9d8c9a2b update mcp doc location 2026-02-11 11:03:13 +00:00
asim e2e0a9126f update mcp doc location 2026-02-11 11:00:49 +00:00
asim 4acb55733d update mcp doc location 2026-02-11 10:59:50 +00:00
asim 42efe1862a fix mcp exampl 2026-02-11 10:46:47 +00:00
asim 8d0180aef1 v5.15.0: Unified Gateway Architecture + MCP Support
Major Features:
- Unified gateway architecture (micro run + micro server use same code)
- MCP (Model Context Protocol) integration as library package
- AI-accessible microservices with 3 lines of code

Gateway Unification:
- Created reusable gateway module (cmd/micro/server/gateway.go)
- Updated micro run to use unified gateway (removed duplicate code)
- Conditional authentication (disabled in dev, required in prod)
- Reduced code duplication, simplified maintenance

MCP Integration:
- New library package: gateway/mcp
- Automatic service discovery → MCP tools
- HTTP/SSE transport support (stdio coming soon)
- Works for both library users and CLI users
- CLI flags: --mcp-address for micro run and micro server

Documentation:
- ADR-010: Unified Gateway Architecture
- CLI & Gateway Guide for users
- MCP Gateway README and examples
- Blog post: Making Your Microservices AI-Native with MCP

Breaking Changes: None (fully backward compatible)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-11 10:43:14 +00:00
asim ee76eb6d2c v5.15.0: Unified Gateway Architecture + MCP Support
Major Features:
- Unified gateway architecture (micro run + micro server use same code)
- MCP (Model Context Protocol) integration as library package
- AI-accessible microservices with 3 lines of code

Gateway Unification:
- Created reusable gateway module (cmd/micro/server/gateway.go)
- Updated micro run to use unified gateway (removed duplicate code)
- Conditional authentication (disabled in dev, required in prod)
- Reduced code duplication, simplified maintenance

MCP Integration:
- New library package: gateway/mcp
- Automatic service discovery → MCP tools
- HTTP/SSE transport support (stdio coming soon)
- Works for both library users and CLI users
- CLI flags: --mcp-address for micro run and micro server

Documentation:
- ADR-010: Unified Gateway Architecture
- CLI & Gateway Guide for users
- MCP Gateway README and examples
- Blog post: Making Your Microservices AI-Native with MCP

Breaking Changes: None (fully backward compatible)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-11 10:40:48 +00:00
Copilot 8d7eb01fb3 Add hosting.md documentation for go-micro services (#2848)
* Initial plan

* Add hosting.md documentation for go-micro services hosting options

Co-authored-by: asim <17530+asim@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: asim <17530+asim@users.noreply.github.com>
2026-02-11 10:10:05 +00:00
asim a38d7df106 go fmt 2026-02-04 14:37:40 +00:00
asim f9ba48897a fix build 2026-02-04 14:37:29 +00:00
Asim Aslam 547507b1a2 x 2026-02-04 14:14:41 +00:00
Asim Aslam 3bf02c634c x 2026-02-04 14:14:14 +00:00
Asim Aslam bab115a0bf dev UX optimisations 2026-02-04 14:12:59 +00:00
Asim Aslam 29ea3a21d6 update docs for dev UX 2026-02-04 14:01:16 +00:00
Asim Aslam bce53ce15e move all docs 2026-02-04 13:57:33 +00:00
Asim Aslam b867e490a0 fix docs reference points 2026-02-04 13:55:43 +00:00
Asim Aslam 48da4d3559 Removing genai as not relevant to microservices. 2026-02-04 13:42:59 +00:00
Asim Aslam 0cb85bf103 Add Discord link to README
Added Discord link to the README for community engagement.
2026-02-04 13:25:22 +00:00
Copilot a100a47340 Fix google.protobuf.Any JSON marshaling missing @type field (#2845)
* Initial plan

* Update JSON codec to use modern protojson for proper Any type support

Co-authored-by: asim <17530+asim@users.noreply.github.com>

* Add comprehensive tests for google.protobuf.Any JSON marshaling

Co-authored-by: asim <17530+asim@users.noreply.github.com>

* Revert codec/proto to old protobuf package for backward compatibility

Co-authored-by: asim <17530+asim@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: asim <17530+asim@users.noreply.github.com>
2026-02-04 09:33:27 +00:00
Copilot 4ba40ea579 Replace custom logger with log/slog (#2844)
* Initial plan

* Replace custom logger with slog implementation

Co-authored-by: asim <17530+asim@users.noreply.github.com>

* Fix linting issues in slog implementation

Co-authored-by: asim <17530+asim@users.noreply.github.com>

* Address code review feedback: fix locking and use copyFields

Co-authored-by: asim <17530+asim@users.noreply.github.com>

* Restore debug/log buffer functionality with slog

Co-authored-by: asim <17530+asim@users.noreply.github.com>

* Address code review feedback: extract helper and remove dead code

Co-authored-by: asim <17530+asim@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: asim <17530+asim@users.noreply.github.com>
2026-02-03 15:55:46 +00:00
Copilot 50ce1a5e83 TLS certificate verification: opt-in security to preserve backward compatibility (#2843)
* Initial plan

* Fix insecure TLS configuration - make secure by default

- Changed util/tls/Config() to be secure by default (InsecureSkipVerify=false)
- Added MICRO_TLS_INSECURE=true environment variable for development/testing
- Updated documentation to emphasize security-first approach
- Added comprehensive tests for TLS configuration
- All existing broker tests pass

Co-authored-by: asim <17530+asim@users.noreply.github.com>

* Revert to backward-compatible TLS defaults to avoid breaking changes

- Reverted default to InsecureSkipVerify=true for backward compatibility
- Changed environment variable to MICRO_TLS_SECURE=true (opt-in security)
- Added deprecation warning that logs once per process
- Updated tests to reflect backward-compatible behavior
- Added comprehensive migration guide
- No breaking changes - production systems safe to upgrade
- Security improvement is opt-in via environment variable
- Planned breaking change for v6 with proper major version bump

Co-authored-by: asim <17530+asim@users.noreply.github.com>

* Add TLS security update documentation

Co-authored-by: asim <17530+asim@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: asim <17530+asim@users.noreply.github.com>
2026-02-03 15:53:03 +00:00
Copilot 3094947953 [WIP] Remove reflect usage and improve performance (#2842)
* Initial plan

* Add comprehensive analysis documents on reflection usage

Co-authored-by: asim <17530+asim@users.noreply.github.com>

* Fix performance numbers for consistency

Co-authored-by: asim <17530+asim@users.noreply.github.com>

* Add evaluation summary for reflection removal analysis

Co-authored-by: asim <17530+asim@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: asim <17530+asim@users.noreply.github.com>
2026-02-03 15:34:46 +00:00
Copilot 75e32f4d87 Implement NATS connection pooling and fix connection leaks (#2840)
* Initial plan

* Implement NATS connection pool with configuration options

Co-authored-by: asim <17530+asim@users.noreply.github.com>

* Implement connection pool for transport/nats

Co-authored-by: asim <17530+asim@users.noreply.github.com>

* Fix connection leaks in events/natsjs and config/source/nats

Co-authored-by: asim <17530+asim@users.noreply.github.com>

* Fix race condition in connection pool lastUsed field access

Co-authored-by: asim <17530+asim@users.noreply.github.com>

* Remove unused maxIdle field from connection pools

Co-authored-by: asim <17530+asim@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: asim <17530+asim@users.noreply.github.com>
2026-02-03 11:43:45 +00:00
Copilot adc90b4d2d Apply rate limiting before singleflight to prevent goroutine blocking on etcd timeout (#2841)
* Initial plan

* Apply rate limiting before singleflight to prevent blocking

- Check rate limiting BEFORE entering singleflight
- If rate-limited AND stale cache exists, return stale cache immediately
- This prevents all goroutines from blocking when etcd is down/slow
- Maintains stampede prevention via singleflight for non-rate-limited requests
- All existing tests pass

Co-authored-by: asim <17530+asim@users.noreply.github.com>

* Fix variable shadowing in rate limiting check

- Rename shadowed variables to currentLastRefresh and currentMinimumRetryInterval
- Improves code clarity and prevents potential bugs
- All tests still pass

Co-authored-by: asim <17530+asim@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: asim <17530+asim@users.noreply.github.com>
2026-02-03 11:35:34 +00:00
Copilot 87cf988e03 Fix go install @latest failures by documenting specific version (#2839)
* Initial plan

* Update documentation to use @v5.13.0 instead of @latest for go install commands

Co-authored-by: asim <17530+asim@users.noreply.github.com>

* Add explanatory notes about version pinning in documentation

Co-authored-by: asim <17530+asim@users.noreply.github.com>

* Add consistent explanatory notes across all documentation files

Co-authored-by: asim <17530+asim@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: asim <17530+asim@users.noreply.github.com>
2026-01-29 10:19:55 +00:00
Asim Aslam 109ff2169a Add blog link to homepage (#2837)
Link to /blog/ from the main navigation, replacing the badge link.

Co-authored-by: Shelley <shelley@exe.dev>
2026-01-27 14:08:32 +00:00
Shelley 82b7fdbec4 Add install.sh to website for curl install
Co-authored-by: Shelley <shelley@exe.dev>
2026-01-27 14:02:38 +00:00
Shelley fea8c911be Fix blog post markdown rendering
Co-authored-by: Shelley <shelley@exe.dev>
2026-01-27 13:54:31 +00:00
Shelley cf9629c41f Add blog section with first post: Introducing micro deploy
- /blog/ - Blog index page
- /blog/1 - First post announcing micro deploy
- /docs/deployment.md - Deployment guide in website docs
- Updated navigation to include Blog link
- New blog layout template

Co-authored-by: Shelley <shelley@exe.dev>
2026-01-27 13:52:09 +00:00
Asim Aslam a5bef7af29 Add systemd-based deployment support (#2836)
* Add systemd-based deployment support

- micro init --server: Initialize server to receive deployments
  - Creates /opt/micro/{bin,data,config} directories
  - Generates systemd template unit (micro@.service)
  - Creates 'micro' system user

- micro deploy: Deploy services via SSH + systemd
  - Builds linux/amd64 binaries automatically
  - Copies via rsync/scp to server
  - Manages services via systemctl
  - Helpful error messages for common issues

- micro status --remote: Check remote service status
- micro logs --remote: Stream remote logs via journalctl
- micro stop --remote: Stop services on remote server

- Config: Added 'deploy' blocks to micro.mu for named targets

The deployment model:
- systemd is the process supervisor (battle-tested)
- SSH is the transport (standard, secure)
- No custom daemons or platforms needed

Co-authored-by: Shelley <shelley@exe.dev>

* Add deployment documentation

- docs/deployment.md: Comprehensive guide for server deployment
- README.md: Updated deployment section with full workflow

Co-authored-by: Shelley <shelley@exe.dev>

* Add deployment section to CLI documentation

Co-authored-by: Shelley <shelley@exe.dev>

* Fix systemd template escaping and rsync permission warnings

- Fix %i escaping in systemd template (was being interpreted by fmt.Sprintf)
- Handle rsync exit code 23/24 gracefully (metadata permission warnings)
- Add --omit-dir-times to rsync to avoid directory timestamp errors

Co-authored-by: Shelley <shelley@exe.dev>

* Add install script for micro CLI

Co-authored-by: Shelley <shelley@exe.dev>

* Fix non-constant format string in deploy error

Co-authored-by: Shelley <shelley@exe.dev>

---------

Co-authored-by: Shelley <shelley@exe.dev>
2026-01-27 13:27:59 +00:00
Asim Aslam 239dbfc27e fix: make build/deploy Go-native, Docker optional (#2835)
micro build:
  - Default: builds Go binaries to ./bin/
  - Cross-compile with --os and --arch
  - Docker is optional via --docker flag

micro deploy:
  - Requires --ssh user@host
  - Copies pre-built binaries (if ./bin/ exists)
  - Or syncs source and builds on remote
  - No Docker dependency

Go binaries are self-contained. No runtime needed.

Co-authored-by: Shelley <shelley@exe.dev>
2026-01-27 12:47:07 +00:00
Asim Aslam de2b3031f3 feat: add micro build and micro deploy commands (#2834)
micro build:
  - Generates Dockerfiles for services (if not present)
  - Builds container images for all services in micro.mu
  - Supports --tag, --registry, --push flags
  - --compose flag generates docker-compose.yml

micro deploy:
  - Default: deploys with docker-compose
  - --ssh user@host: deploys via SSH (rsync + build on remote)
  - --build: rebuild images before deploying

Complete workflow:
  micro run          # Develop locally
  micro build        # Build images
  micro deploy       # Deploy

Or for simple SSH deploys:
  micro deploy --ssh user@host

Co-authored-by: Shelley <shelley@exe.dev>
2026-01-27 12:40:04 +00:00
Asim Aslam 40c3ec0e32 feat: add testing package for in-process service testing (#2833)
Provides a test harness for running micro services in isolation:

  h := testing.NewHarness(t)
  defer h.Stop()

  h.Name("users").Register(new(UsersHandler))
  h.Start()

  var rsp Response
  h.Call("UsersHandler.Create", &req, &rsp)

Features:
- Isolated registry, transport, and broker per harness
- Simple API: Name(), Register(), Start(), Stop()
- Call helpers: Call(), CallContext()
- Assertions: AssertServiceRunning(), AssertCallSucceeds(), AssertCallFails()
- Access to underlying Client(), Server(), Registry()

Note: Due to go-micro's global defaults, each harness tests one service.
For multi-service testing, use integration tests or mocks.

Also fixes README.md example showing conflicting port 8080.

Co-authored-by: Shelley <shelley@exe.dev>
2026-01-27 12:35:05 +00:00
Asim Aslam 139e70e880 feat(run): integrate HTTP gateway with micro run (#2832)
micro run now starts an HTTP gateway alongside your services:

  - Web dashboard at http://localhost:8080
  - API proxy at /api/{service}/{method}
  - Health checks at /health
  - Service listing at /services

The experience is now:
  $ micro new helloworld
  $ cd helloworld
  $ micro run

  Open http://localhost:8080 to see and call your services.

New flags:
  --address :3000    # Custom gateway port
  --no-gateway       # Disable gateway (services only)

Updated documentation to make this the central experience.

Co-authored-by: Shelley <shelley@exe.dev>
2026-01-27 12:22:45 +00:00
Asim Aslam 94e83e57f8 feat: add health check package for K8s-style probes (#2831)
Adds a new health package providing:
- /health endpoint for overall health status
- /health/live for Kubernetes liveness probes
- /health/ready for Kubernetes readiness probes
- Built-in checks: PingCheck, TCPCheck, HTTPCheck, DNSCheck
- Critical vs non-critical checks
- Concurrent check execution
- Configurable timeouts
- Service info metadata

Integrates with micro run's health check waiting when services
specify a port in their micro.mu configuration.

Example usage:

    health.Register("database", health.PingCheck(db.Ping))
    health.Register("redis", health.TCPCheck("localhost:6379", time.Second))
    health.RegisterHandlers(mux)

Co-authored-by: Shelley <shelley@exe.dev>
2026-01-27 12:10:38 +00:00
Asim Aslam 39484560ea docs: add micro run documentation with hot reload and config file guide (#2830)
- Update main README with micro run quick start
- Expand cmd/micro/README.md with configuration options
- Add detailed guide at internal/website/docs/guides/micro-run.md

Documents:
- Hot reload with file watching
- micro.mu DSL configuration
- micro.json alternative
- Dependency ordering
- Environment management
- Graceful shutdown

Co-authored-by: Shelley <shelley@exe.dev>
2026-01-27 12:04:15 +00:00
Asim Aslam 7690c41d5f feat(run): add hot reload, config files, and dependency ordering (#2829)
- Add micro.mu DSL and micro.json config file support
- Implement hot reload with file watching (--no-watch to disable)
- Start services in dependency order (topological sort)
- Environment management (--env flag, MICRO_ENV var)
- Health check waiting before starting dependents
- Graceful shutdown in reverse dependency order

Config file example (micro.mu):

    service users
        path ./users
        port 8081

    service posts
        path ./posts
        port 8082
        depends users

    env development
        STORE_ADDRESS file://./data

Closes #2828

Co-authored-by: Shelley <shelley@exe.dev>
2026-01-27 12:01:47 +00:00
Asim Aslam cae6fbbe76 Framework hardening: security, reliability, and developer experience improvements (#2826)
* fix: remove deprecated rand.Seed calls

Go 1.20+ automatically seeds the global random number generator.
These calls are no-ops and generate warnings with newer Go versions.

Removed from:
- selector/strategy.go
- registry/cache/cache.go
- broker/memory.go
- broker/http.go
- cmd/cmd.go
- transport/memory.go

Co-authored-by: Shelley <shelley@exe.dev>

* fix: handle previously ignored errors

- MySQL store: properly handle prepared statement errors in initDB()
- Consul registry: handle client creation errors in Client() method

These silent failures could cause hard-to-debug issues in production.

Co-authored-by: Shelley <shelley@exe.dev>

* feat(genai): improve provider interface with context and streaming

Breaking changes:
- Generate() and Stream() now require context.Context as first parameter
- Stream.Close() added for proper resource cleanup

Improvements:
- Proper context support for cancellation and timeouts
- Real SSE streaming for OpenAI and Gemini text generation
- Better error handling with wrapped errors and API error responses
- Thread-safe provider registry with sync.RWMutex
- New options: WithMaxTokens, WithTemperature, WithTimeout
- Stream has proper Close() method for cleanup
- Results can include Error field for per-chunk errors

Provider updates:
- OpenAI: true streaming with SSE parsing, proper HTTP client with timeout
- Gemini: true streaming with streamGenerateContent endpoint
- Default model updated to gpt-4o-mini (OpenAI) and gemini-2.0-flash (Gemini)

Co-authored-by: Shelley <shelley@exe.dev>

* feat(tls): make TLS secure by default, configurable via environment

BREAKING: TLS now verifies certificates by default. Set MICRO_TLS_INSECURE=true
to restore previous behavior (NOT recommended for production).

Changes:
- Add util/tls.Config(), SecureConfig(), InsecureConfig(), ConfigFromEnv() helpers
- Update all components to use ConfigFromEnv() instead of hardcoded InsecureSkipVerify
- Set MinVersion to TLS 1.2 for all TLS configs

Affected components:
- broker/http
- broker/rabbitmq
- registry/etcd
- registry/consul
- transport/grpc

This improves security posture while allowing opt-out for development environments.

Co-authored-by: Shelley <shelley@exe.dev>

* feat(tls): add TLS helpers with opt-in secure mode

NOT a breaking change - keeps InsecureSkipVerify=true as default for
local development compatibility.

New util/tls helpers:
- Config() - returns config based on MICRO_TLS_SECURE env var
- SecureConfig() - certificate verification enabled
- InsecureConfig() - certificate verification disabled (dev only)

For production security, use one of:
- Set MICRO_TLS_SECURE=true with proper CA-signed certs
- Use a service mesh (Istio, Linkerd) for automatic mTLS
- Configure TLSConfig directly with your certificates

Also: Changed CLI alias from 'g' to 'gen' for clarity
- micro generate handler -> micro gen handler

Co-authored-by: Shelley <shelley@exe.dev>

* refactor(cli): rename generate directory to gen for consistency

Directory name now matches the command alias:
  cmd/micro/cli/gen/ -> micro gen handler

Co-authored-by: Shelley <shelley@exe.dev>

---------

Co-authored-by: Shelley <shelley@exe.dev>
2026-01-27 10:39:25 +00:00
Asim Aslam a32cdbc117 feat(web): add SSE broadcaster for real-time event streaming (#2825)
This adds Server-Sent Events (SSE) support to the web package, enabling
real-time updates in web applications built with go-micro.

Features:
- SSEBroadcaster manages connected clients and broadcasts events
- Integrates with events.Stream for subscribing to topics
- Supports JSON events and raw HTML (for htmx/datastar)
- Keep-alive mechanism for long-lived connections
- Thread-safe client management

Usage:
  broadcaster := web.NewSSEBroadcaster(
    web.WithStream(stream),
    web.WithTopics("posts", "comments"),
  )
  broadcaster.Start()
  router.GET("/events", broadcaster.Handler())

This enables real-time features requested in #2788, including:
- Live updates without page refresh
- htmx/datastar integration
- Foundation for MCP (Model Context Protocol) support

Closes #2788

Co-authored-by: Shelley <shelley@exe.dev>
2026-01-27 06:29:34 +00:00
Copilot baeb282cf1 Enhance cache rate limiting to prevent registry overload during rolling deployments (#2824)
* Initial plan

* Enhance cache rate limiting to protect against rolling deployment scenarios

Per @asim's feedback, rate limiting now applies to ALL cache refresh attempts
(not just error cases) to prevent registry overload during rolling deployments.

Changes:
- Rate limit ALL refresh attempts using lastRefreshAttempt tracking
- Always return stale cache if available (even if expired) when rate limiting
- Only return ErrNotFound when no cache exists during rate limit period
- Rate limiting happens inside singleflight to avoid race conditions
- Update test to reflect new behavior (no retry when stale cache + rate limit)
- Enhanced documentation with rolling deployment scenario examples

This addresses the scenario where all upstream services expire their cache
simultaneously during a downstream rolling deployment, which would previously
cause a stampede to the registry under high QPS.

Co-authored-by: asim <17530+asim@users.noreply.github.com>

* Remove unused failedAttempts and consecutiveFailures fields

Per @asim's feedback, these fields are no longer needed since the new
rate limiting strategy uses lastRefreshAttempt to track ALL refresh
attempts, not just failed ones.

Removed:
- failedAttempts map[string]time.Time
- consecutiveFailures int
- All code that sets these fields

The rate limiting logic now only uses lastRefreshAttempt, making these
fields redundant. All tests continue to pass.

Co-authored-by: asim <17530+asim@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: asim <17530+asim@users.noreply.github.com>
2026-01-14 10:57:14 +00:00
Copilot 2869cc16d1 Add adaptive throttling to registry cache to prevent penetration when no stale cache exists (#2823)
* Initial plan

* Add adaptive throttling to prevent cache penetration without stale cache

Implement rate limiting mechanism to protect etcd when:
- Cache is empty (no stale data available)
- Registry is failing/overloaded
- Multiple sequential requests arrive

Changes:
- Add MinimumRetryInterval option (default 5s)
- Track last failed attempt time per service
- Throttle requests within retry interval when no cache exists
- Clear throttling on successful lookup
- Add comprehensive tests validating throttling behavior

Co-authored-by: asim <17530+asim@users.noreply.github.com>

* Fix WaitGroup race condition in events stream tests

The WaitGroup.Add() calls were happening after goroutines started,
causing a race where Done() could be called before Add(), resulting
in "negative WaitGroup counter" panics.

Fixes:
- Move wg.Add(1) before goroutine in TestConsumeTopic
- Move wg.Add(2) before first goroutine in TestConsumeGroup

Co-authored-by: asim <17530+asim@users.noreply.github.com>

* Update registry cache documentation with adaptive throttling feature

Document the new adaptive throttling feature that prevents cache
penetration when registry is failing and no stale cache exists.

Includes:
- Feature overview
- Usage examples with configuration options
- Explanation of throttling behavior
- Example scenario demonstrating protection

Co-authored-by: asim <17530+asim@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: asim <17530+asim@users.noreply.github.com>
2026-01-09 12:27:55 +00:00
Copilot dbb66ec938 Fix etcd auth overload and cache stampede with KeepAlive channels (#2822)
* Initial plan

* Replace KeepAliveOnce with KeepAlive to reduce etcd auth requests

Co-authored-by: asim <17530+asim@users.noreply.github.com>

* Add tests to verify cache penetration protection via singleflight

Co-authored-by: asim <17530+asim@users.noreply.github.com>

* Add etcd integration tests to CI workflow

Co-authored-by: asim <17530+asim@users.noreply.github.com>

* Fix race conditions and improve code quality based on review feedback

Co-authored-by: asim <17530+asim@users.noreply.github.com>

* Add workflow permissions to fix security scan finding

Co-authored-by: asim <17530+asim@users.noreply.github.com>

* Add comprehensive documentation for performance improvements

Co-authored-by: asim <17530+asim@users.noreply.github.com>

* Fix memory store limit/offset bug causing events test failure

Co-authored-by: asim <17530+asim@users.noreply.github.com>

* Fix memory store to filter before limiting in prefix/suffix reads

The previous fix had a logic error where limit/offset were applied before
prefix/suffix filtering. This could cause incorrect results when the first
N items in the unfiltered list don't match the search criteria.

Now filters first to get all matching keys, then applies limit/offset to
the filtered results. This ensures ReadLimit(1) always returns 1 matching
record if available, regardless of map iteration order.

Co-authored-by: asim <17530+asim@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: asim <17530+asim@users.noreply.github.com>
2026-01-09 11:12:06 +00:00
Copilot 80345fe63d docs: clarify gRPC server option ordering and service name usage (#2820)
* Initial plan

* docs: clarify gRPC server option ordering and service name usage

- Fix all examples to show Server option before Name option
- Add note explaining why option ordering matters
- Add new section on "Option Ordering Issue" in Common Errors
- Add new section on "Service Name vs Package Name" in Common Errors
- Update transport.md to show proper ordering with comment

Co-authored-by: asim <17530+asim@users.noreply.github.com>

* docs: refine comments based on code review feedback

- Clarify that Server ordering before Name is mandatory
- Remove confusing comment about Client ordering being for consistency

Co-authored-by: asim <17530+asim@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: asim <17530+asim@users.noreply.github.com>
2025-11-25 09:26:59 +00:00
Copilot 00a119496e Add documentation for native gRPC compatibility vs transport (#2819)
* Initial plan

* Add documentation for native gRPC compatibility with grpc client/server packages

Co-authored-by: asim <17530+asim@users.noreply.github.com>

* Fix go_package path in proto example to use relative path

Co-authored-by: asim <17530+asim@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: asim <17530+asim@users.noreply.github.com>
2025-11-25 07:28:48 +00:00
Asim Aslam 3e25be984d x 2025-11-13 20:48:01 +00:00
Asim Aslam 4e8934c230 Get Badge 2025-11-13 20:46:20 +00:00
Asim Aslam a368be82cd add showcase 2025-11-13 20:42:45 +00:00
Asim Aslam 43386d4ec1 x 2025-11-13 20:37:54 +00:00
Asim Aslam a84f92c907 mobile hamburger menu 2025-11-13 20:34:09 +00:00
Asim Aslam 751de9e7c0 fix mobile rendering for website 2025-11-13 20:31:29 +00:00
Asim Aslam be1cf9c9d8 x 2025-11-13 20:06:28 +00:00
Asim Aslam d7699845bb Add docs link 2025-11-13 20:01:32 +00:00
Asim Aslam 520a0fa140 Update features 2025-11-13 19:59:28 +00:00
Asim Aslam 8a1591af0c x 2025-11-13 19:58:38 +00:00
Asim Aslam 1f1d9875a2 update landing 2025-11-13 19:56:01 +00:00
Asim Aslam cd4c881db5 x 2025-11-13 19:52:06 +00:00
Asim Aslam de03bbbf81 x 2025-11-13 19:49:34 +00:00
Asim Aslam ee4f656fa5 fix typo in search documentation 2025-11-13 19:26:19 +00:00
Asim Aslam 2cce3e5e1a fix links 2025-11-13 19:21:27 +00:00
Asim Aslam 0526a42efa changes to theme 2025-11-13 19:14:01 +00:00
Asim Aslam dc1e1eb45c fix config file 2025-11-13 19:04:30 +00:00
Asim Aslam 06b31f545a update the docs to easily navigate 2025-11-13 18:59:34 +00:00
Asim Aslam 8cda829320 major docs overhaul 2025-11-13 18:34:40 +00:00
Asim Aslam e755e4a823 updates for syntax highlighting 2025-11-13 18:17:45 +00:00
Asim Aslam eef06fcf01 server docs 2025-11-13 18:12:15 +00:00
Asim Aslam 9e36df224b new copilot generated documentation 2025-11-13 18:11:29 +00:00
Asim Aslam 2da1cc0edd Delete .github/PULL_REQUEST_TEMPLATE.md 2025-11-13 17:19:17 +00:00
Asim Aslam 0ef0143537 Delete .github/ISSUE_TEMPLATE/question.md 2025-11-13 17:19:04 +00:00
Asim Aslam 30dc01523a Delete .github/ISSUE_TEMPLATE/feature-request---enhancement.md 2025-11-13 17:18:54 +00:00
Asim Aslam 4a0648536f Delete .github/ISSUE_TEMPLATE/bug_report.md 2025-11-13 17:18:43 +00:00
nswdewy 01ed999b2a Change template paths from 'html' to 'web' (#2816) 2025-11-06 10:17:30 +00:00
Asim Aslam acfb4e2639 Update README.md 2025-10-29 10:46:41 +00:00
Asim Aslam cd735aba56 Update sponsorship link in README.md 2025-10-29 10:46:14 +00:00
Asim Aslam 8c995ea8ac Update sponsorship link in README 2025-10-29 10:45:28 +00:00
Asim Aslam e9ce3487b6 Update README.md 2025-10-29 10:44:16 +00:00
Asim Aslam 79f5a7a7f6 Fix README formatting and sponsor button placement 2025-10-29 10:43:48 +00:00
Asim Aslam 48c310f70b Update README.md 2025-10-29 10:43:32 +00:00
Asim Aslam 5ffb711dfe Add funding configuration for GitHub 2025-10-29 10:42:01 +00:00
Asim Aslam de5057e35d Update README to remove install script section
Removed mention of install script from README.
2025-10-22 21:19:31 +01:00
Asim Aslam 91d91eef1f Fix for https://github.com/micro/go-micro/issues/2687 2025-10-22 06:38:16 +00:00
asim 48479228b1 Fixes https://github.com/micro/go-micro/issues/2738 2025-10-22 07:18:37 +01:00
asim 5a07370970 Fix https://github.com/micro/go-micro/issues/2769 2025-10-22 07:10:41 +01:00
Asim Aslam db9b1e8d79 Update installation command to specific version 2025-10-20 11:41:26 +01:00
Asim Aslam 3e05108882 Update installation command to specific version 2025-10-20 11:41:04 +01:00
Asim Aslam 85cd80a467 Delete cmd/README.md 2025-10-14 19:34:27 +01:00
Eng Zer Jun bc40df0c9e Update github.com/imdario/mergo to dario.cat/mergo (#2810)
Mergo v1 is released with a new module path URL. No breaking changes,
only the module path update and bug fixes.

Reference: https://github.com/darccio/mergo/releases/tag/v1.0.0
Reference: https://github.com/darccio/mergo/releases/tag/v1.0.1
Reference: https://github.com/darccio/mergo/releases/tag/v1.0.2

Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
2025-10-14 11:18:28 +01:00
asim 66014eac68 . 2025-10-14 11:17:03 +01:00
asim 26b9d56165 . 2025-10-14 11:15:52 +01:00
asim 6574180b0d . 2025-10-14 11:14:36 +01:00
asim e6c9f4fa39 . 2025-10-14 11:13:53 +01:00
asim 1dde737b64 move micro cli and protoc-gen-micro to cmd/ 2025-10-14 11:13:35 +01:00
Asim Aslam 26adf49e55 Remove Command Line section from README
Removed command line section from README.
2025-10-14 10:33:20 +01:00
Eng Zer Jun 7a9c445321 Update github.com/streadway/amqp to github.com/rabbitmq/amqp091-go (#2811)
The `github.com/streadway/amqp` module is no longer actively maintained.
The new module is now maintained by the RabbitMQ core team under a
different package name.

Reference: https://github.com/rabbitmq/amqp091-go

Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
2025-10-13 21:34:07 +01:00
Asim Aslam 44cc31345d use buf pool 2025-10-07 16:38:09 +00:00
Asim Aslam aa2ed9aa91 Patch for potential deadlock 2025-10-07 16:20:45 +00:00
Asim Aslam 3d6b6521ab fix atomic int alignment bug 2025-10-07 15:57:43 +00:00
Kenley Wang 7b0fa8b6ae fix: new pool cannot customize closetimeout (#2808) 2025-10-02 14:28:06 +01:00
asim 059d317969 . 2025-09-29 10:28:59 +01:00
Asim Aslam e0af3b61a5 Change 'Toolkit' to 'Command Line' in README
Updated section headers in README for clarity.
2025-09-28 09:55:43 +01:00
Asim Aslam 5bbc24abe1 Clarify micro CLI usage and genai package details
Updated the README to clarify the usage of the micro CLI and the genai package.
2025-09-28 08:51:30 +01:00
Asim Aslam dfcaae7bf8 Update link text from 'Docs' to 'Go Doc' 2025-09-27 09:45:52 +01:00
Ak-Army 9070b3befd [feature] ability to use wildcard in topic name (factory-events.*.*) (#2804) 2025-09-09 12:51:39 +01:00
ExtinctPatronageDeodorize e5cd820c71 fix data race in memory.update (#2802)
Co-authored-by: ExtinctPatronageDeodorize <ExtinctPatronageDeodorize@users.noreply.github.com>
2025-08-29 14:14:11 +01:00
Tsln 479bd58c3f fix consul context key mismatch (#2801) 2025-08-29 07:39:20 +01:00
Byron Silvers 95540b7859 fix consul watcher address handling (#2800) 2025-08-19 09:27:34 +01:00
Asim Aslam be2559c555 Update index.html 2025-08-05 14:15:06 +01:00
Asim Aslam 6e53f541d3 Update README.md 2025-08-05 14:14:28 +01:00
Asim Aslam a6ede13f73 Update index.html 2025-08-04 11:56:59 +01:00
Asim Aslam 31d2d39f76 Update README.md 2025-07-24 21:24:04 +01:00
Roman Perekhod ad73add529 fix the concurrent map writes error (#2794) 2025-07-16 07:27:45 +01:00
asim f99a205b2b add string function 2025-07-15 20:43:58 +01:00
Asim Aslam 3cf5540b0f Update README.md 2025-07-08 19:24:19 +01:00
Asim Aslam 2a140858a8 Update README.md 2025-07-08 19:23:49 +01:00
Asim Aslam 2d19a304fc Update README.md 2025-07-08 19:23:15 +01:00
asim 7b48449a85 fix options 2025-07-07 10:23:23 +01:00
asim 680987aeeb . 2025-07-02 09:56:34 +01:00
Asim Aslam ee9f3afe37 GenAI interface (#2790)
* genai interface

* x

* x

* text to speech

* Re-add events package (#2761)

* Re-add events package

* run redis as a dep

* remove redis events

* fix: data race on event subscriber

* fix: data race in tests

* fix: store errors

* fix: lint issues

* feat: default stream

* Update file.go

---------

Co-authored-by: Brian Ketelsen <bketelsen@gmail.com>

* .

* copilot couldn't make it compile so I did

* copilot couldn't make it compile so I did

* x

---------

Co-authored-by: Brian Ketelsen <bketelsen@gmail.com>
2025-06-20 10:24:31 +01:00
Asim Aslam 7e1bba2baf Re-add events package (#2761)
* Re-add events package

* run redis as a dep

* remove redis events

* fix: data race on event subscriber

* fix: data race in tests

* fix: store errors

* fix: lint issues

* feat: default stream

* Update file.go

---------

Co-authored-by: Brian Ketelsen <bketelsen@gmail.com>
2025-06-18 17:12:02 +01:00
blacksheepaul dd0944bf68 Update getting-started.md (#2787) 2025-06-12 09:56:34 +01:00
Ak-Army 88f38eaef6 Subscribe error handling (#2785)
* [fix] etcd config source prefix issue (#2389)

* http transport data race issue (#2436)

* [fix] #2431 http transport data race issue

* [feature] Ability to close connection while receiving.
Ability to send messages while receiving.
Icreased r channel limit to 100 to more fluently communication.
Do not dropp sent request if r channel is full.

* [feature] always subscribes to all topics and if there is an error in one of them, the unsuccessful topics will be subscribed to again

---------

Co-authored-by: Johnson C <chengqiaosheng@gmail.com>
2025-06-04 08:55:17 +01:00
Asim Aslam 0e45edf439 Set service name as table name (#2780)
* add docs layout

* update all to use _layouts

* update the styling

* always use service name as table name
2025-05-21 22:43:29 +01:00
Asim Aslam 788dcd05b2 Docs (#2779)
* add docs layout

* update all to use _layouts

* update the styling
2025-05-21 13:48:03 +01:00
Asim Aslam 456cd7e092 Add links to readme contents 2025-05-21 12:06:25 +00:00
Asim Aslam 3fd52c66e7 Generated docs for the following files: 2025-05-21 12:03:24 +00:00
Asim Aslam 3c3ba55c45 Create README.md (#2778) 2025-05-21 11:22:11 +01:00
Asim Aslam 1a8074467a Update and rename docs.yml to website.yml (#2777) 2025-05-21 11:18:54 +01:00
Asim Aslam b9665e32c5 Move whole website (#2776)
* adding docs

* minor getting started typo

* move the whole website
2025-05-21 11:17:04 +01:00
Asim Aslam 11b7eb0727 Docs (#2775)
* minor getting started typo
2025-05-21 10:59:04 +01:00
Asim Aslam 5a409f2607 Create docs.yml 2025-05-21 10:49:59 +01:00
Asim Aslam 8e771c57e1 adding docs (#2774) 2025-05-21 10:47:47 +01:00
Brian Ketelsen ddc34801ee Plugins and profiles (#2764)
* feat: more plugins

* chore(ci): split out benchmarks

Attempt to resolve too many open files in ci

* chore(ci): split out benchmarks

* fix(ci): Attempt to resolve too many open files in ci

* fix: set DefaultX for cli flag and service option

* fix: restore http broker

* fix: default http broker

* feat: full nats profile

* chore: still ugly, not ready

* fix: better initialization for profiles

* fix(tests): comment out flaky listen tests

* fix: disable benchmarks on gha

* chore: cleanup, comments

* chore: add nats config source
2025-05-20 13:24:06 -04:00
Brian Ketelsen e12504ce3a feat: re-add profiles (#2772)
* feat: re-add profiles

* fix: make profile separate package

* fix: make profile separate package

* fix: profile flag

* fix: defaults
2025-05-19 13:59:28 -04:00
asim a03ab5f601 switch location of store dir to home dir 2025-05-19 09:28:13 +01:00
Asim Aslam 44ff301d2d syntactically easy way to register commands (#2770) 2025-05-18 09:45:49 +01:00
Asim Aslam 37bb1a8ab6 Revert "WIP: move file store (do not merge) (#2766)" (#2768)
This reverts commit 97275d3db9.
2025-05-16 19:06:45 +01:00
BombartSimon 1fe2638298 Implement MDNS Registry (#2767)
- Removed existing mDNS test file and replaced it with a new implementation.
- Added a new `mdns_registry.go` file that contains the MDNS registry logic.
- Updated the default registry to use the new MDNS registry.
- Refactored tests to accommodate the new MDNS registry implementation.
- Implemented service registration, deregistration, and service discovery using mDNS.
- Added encoding and decoding functions for mDNS TXT records.
- Implemented a watcher for monitoring service changes in the MDNS registry.
2025-05-16 19:03:36 +01:00
Asim Aslam 97275d3db9 WIP: move file store (do not merge) (#2766)
* move file store

* fix build
2025-05-16 15:08:13 +01:00
BombartSimon e29159e836 Rename 'Users' section to 'Adopters' in README (#2765) 2025-05-15 22:20:10 +01:00
Asim Aslam caba761c7b fix extraction field naming with standard Go types (#2763) 2025-05-15 18:59:10 +01:00
Brian Ketelsen cd2b40ca4a Add a selection of plugins to the core repo (#2755)
* WIP

* fix: default memory registry, add registrations for mdns, nats

* fix: same for broker

* fix: add more

* fix: http port

* rename redis

* chore: linting
2025-05-15 18:47:35 +01:00
Asim Aslam 7c04b7cfd6 Update README.md (#2762) 2025-05-15 16:13:27 +01:00
Asim Aslam b4a87d05f7 Update README.md (#2759) 2025-05-15 09:37:12 +01:00
asim 0e47cbf1a2 fix conflicting port range test 2025-05-14 22:11:23 +01:00
asim 12dfa797dc drop the separate go mods 2025-05-14 22:03:38 +01:00
Asim Aslam 230505bf5a Add grpc plugin (#2758)
* Add grpc plugin

* remove stale readmes
2025-05-14 21:04:42 +01:00
Asim Aslam 01b8394c81 Update README.md 2025-05-07 19:39:11 +01:00
Asim Aslam f9d08a14f3 Update README.md (#2756) 2025-05-07 19:35:20 +01:00
Asim Aslam a997f738dd Update README.md 2025-05-07 19:34:21 +01:00
Asim Aslam 46db7df218 Update README.md 2025-05-07 17:07:20 +01:00
Brian Ketelsen 17c04258a4 fix: go version breaking unit tests (#2754) 2025-05-05 21:12:34 -04:00
asim 8eb280126a add go mod 2025-05-05 22:02:32 +01:00
asim f51cd8d883 default to file store 2025-05-05 22:02:11 +01:00
asim ef4dc8b5b0 add json.NewValues to config 2025-05-05 14:39:54 +01:00
asim 23b14123ea errors for go 1.24wq 2025-05-04 21:48:02 +01:00
asim 2388f662cf break config.Get and return error with value 2025-05-04 21:31:17 +01:00
asim 60474ed38f add store encode/decode for record 2025-05-04 20:13:58 +01:00
asim 484eb3d15e public functions for store 2025-05-04 20:00:44 +01:00
asim c51095a074 store.NewRecord 2025-05-04 19:55:10 +01:00
Asim Aslam 03782bc9b3 move service to service dir to make life not suck (#2753) 2025-05-04 19:44:56 +01:00
Asim Aslam 1040b7c58e Update README.md 2025-05-01 10:27:59 +01:00
Asim Aslam bd0e9ca7cb Update README.md 2025-05-01 10:27:37 +01:00
Asim Aslam f5399d56c3 Update README.md 2025-05-01 10:25:44 +01:00
Asim Aslam 0f4c238804 protoc-gen-micro has moved to micro/micro/cmd/protoc-gen-micro (#2751) 2025-04-30 16:50:27 +01:00
Asim Aslam 66c169076c Update README.md 2025-04-25 09:43:41 +01:00
Asim Aslam 280eb5b46d Update README.md 2025-04-25 09:42:43 +01:00
Asim Aslam 4ead4ff953 Update README.md (#2750) 2025-04-25 09:41:35 +01:00
Asim Aslam 200a3cb0ce Update README.md (#2749) 2025-04-23 16:04:24 +01:00
Asim Aslam 049dea6804 Update README.md 2025-04-23 15:56:47 +01:00
asim 3fa2a38d76 syntatic sugar for micro.New("helloworld") 2025-04-23 12:21:21 +01:00
asim 65af48823f yolo development is bad 2025-04-23 12:16:34 +01:00
asim 156a968253 directly support handler in the service interface 2025-04-23 12:13:23 +01:00
Morya 517b2b0855 Update README.md (#2748)
go install github.com/micro/go-micro/cmd/protoc-gen-micro@latest

should be used, instand of 

`go install github.com/micro/go-micro/cmd/protoc-gen-micro`
2025-04-22 17:09:21 +01:00
Pavel Ivanov 4702afe57d Fix http transport client blocking recv (#2744)
* reproduce blocking recv

* fix blocking recv call on httpTransportClient

* prevent race condition

* refactoring
2025-04-10 15:24:54 +01:00
Jörn Friedrich Dreyer e032a6aafd update ttl for updated nodes only (#2740)
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
2024-11-15 14:08:17 +00:00
Jörn Friedrich Dreyer 14a1791011 invalidate service if node was not updated (#2736)
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
2024-10-28 15:34:38 +00:00
Morya b318b7f097 go mod tidy (#2730) 2024-08-26 07:20:29 +01:00
Ak-Army 0433e98dbc Better connection pool handling (#2725)
* [fix] etcd config source prefix issue (#2389)

* http transport data race issue (#2436)

* [fix] #2431 http transport data race issue

* [feature] Ability to close connection while receiving.
Ability to send messages while receiving.
Icreased r channel limit to 100 to more fluently communication.
Do not dropp sent request if r channel is full.

* [fix] Use pool connection close timeout

* [fix] replace Close with private function

* [fix] Do not close the transport client twice in stream connection , the transport client is closed in the rpc codec

* [fix] tests

---------

Co-authored-by: Johnson C <chengqiaosheng@gmail.com>
2024-07-23 12:19:43 +01:00
Asim Aslam 1c6c1ff1a3 Update README.md (#2722) 2024-07-15 11:55:17 +01:00
Asim Aslam 4c34451125 Fix data race (#2721) 2024-07-12 09:36:43 +01:00
asim 9a7cd8ce66 update readme 2024-07-08 18:52:06 +01:00
asim dd0145fa18 unused packages 2024-07-08 18:48:52 +01:00
asim 72df27b7d1 remove util/sync 2024-07-08 18:46:34 +01:00
asim e9a52070e6 k8s not needed 2024-07-08 18:44:42 +01:00
asim 6e393f6abf move cmd package back to top level. Strip grpc plugin 2024-07-07 22:38:11 +01:00
asim 90531337db . 2024-07-07 19:14:04 +01:00
asim e756fd32e6 Fix panic 2024-07-07 19:09:19 +01:00
asim 7c3f272001 remove sync package 2024-07-07 19:03:18 +01:00
asim 66b3fd8893 fix retry test 2024-07-07 19:01:43 +01:00
asim c64cb1cb03 more references to runtime 2024-07-07 18:50:52 +01:00
asim 8876002e57 more references to runtime 2024-07-07 18:49:39 +01:00
asim a3809afbdf more references to runtime 2024-07-07 18:44:18 +01:00
asim 563e0d265d meh 2024-07-07 18:40:24 +01:00
asim 3d5f87c01b no one is using that 2024-07-07 18:40:15 +01:00
asim bac34aaec1 still more fixes 2024-07-07 18:36:04 +01:00
asim db0fa9fe1f fix bugs 2024-07-07 18:32:26 +01:00
asim 3676232df1 strip runtime 2024-07-07 18:30:48 +01:00
asim 29d79d748d remove runtime that no one uses 2024-07-07 18:28:38 +01:00
asim 627066baf9 remove events entirely 2024-07-07 18:26:30 +01:00
asim d84da9a8eb meh 2024-07-07 18:19:50 +01:00
asim 6c0a073e33 Merge branch 'master' of ssh://github.com/micro/go-micro 2024-07-07 18:19:19 +01:00
asim 12e8fcd057 Fix parallel test 2024-07-07 18:18:43 +01:00
Asim Aslam 4dcf2e58c0 Update README.md (#2720) 2024-07-07 08:05:08 +01:00
Asim Aslam b56cfaf818 Revert license to Apache 2 2024-07-07 08:04:29 +01:00
Asim Aslam ff52e9f5d0 Delete .github/FUNDING.yml 2024-07-07 07:18:47 +01:00
Asim Aslam c05c11e0c3 Update README.md (#2719) 2024-07-04 10:29:05 +01:00
asim fc614aef2d add back generator 2024-07-04 09:18:52 +01:00
Ak-Army 1515db5240 Fix stream eos error (#2716)
* [fix] etcd config source prefix issue (#2389)

* http transport data race issue (#2436)

* [fix] #2431 http transport data race issue

* [feature] Ability to close connection while receiving.
Ability to send messages while receiving.
Icreased r channel limit to 100 to more fluently communication.
Do not dropp sent request if r channel is full.

* [fix] Do not send error when stream send eos header, just close the connection

* [fix] Do not overwrite the error in http client

---------

Co-authored-by: Johnson C <chengqiaosheng@gmail.com>
2024-07-02 13:06:14 +01:00
littlecoderonway 4d5b3b084f Fix registry cache broken (#2715)
* services is shared between routines, when application change services returned by get function may lead to other routine set a changed services to cache

* services is shared between routines, when application change services returned by get function may lead to other routine set a changed services to cache

---------

Co-authored-by: Shuaihu Liu <shuaihu.liu@shopee.com>
2024-07-02 09:30:51 +01:00
Asim Aslam e9ceb66e32 Update README.md 2024-06-05 18:28:17 +01:00
asim 610c00859f v5 2024-06-04 21:40:43 +01:00
Asim Aslam e11395c8f5 Update LICENSE (#2712)
BSL license
2024-06-04 21:37:52 +01:00
Di Wu 63f2507944 fix(sec): CVE-2024-24786 (#2699) 2024-06-04 20:23:15 +01:00
Asim Aslam 0c6c907c58 Delete CHANGELOG.md
Not being maintained
2024-06-04 20:21:45 +01:00
Asim Aslam 53f691da30 Update README.md (#2711) 2024-06-04 20:21:05 +01:00
Asim Aslam 8f43ae86dd Update FUNDING.yml (#2710) 2024-06-04 20:01:41 +01:00
dependabot[bot] f9ce51c522 chore(deps): bump github.com/opencontainers/runc from 1.1.5 to 1.1.12 (#2706)
Bumps [github.com/opencontainers/runc](https://github.com/opencontainers/runc) from 1.1.5 to 1.1.12.
- [Release notes](https://github.com/opencontainers/runc/releases)
- [Changelog](https://github.com/opencontainers/runc/blob/main/CHANGELOG.md)
- [Commits](https://github.com/opencontainers/runc/compare/v1.1.5...v1.1.12)

---
updated-dependencies:
- dependency-name: github.com/opencontainers/runc
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-04-19 18:51:46 +01:00
dependabot[bot] 08d98adcd2 chore(deps): bump golang.org/x/net from 0.17.0 to 0.23.0 (#2705)
Bumps [golang.org/x/net](https://github.com/golang/net) from 0.17.0 to 0.23.0.
- [Commits](https://github.com/golang/net/compare/v0.17.0...v0.23.0)

---
updated-dependencies:
- dependency-name: golang.org/x/net
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-04-19 13:56:58 +01:00
guangwu 186b8351dc fix: close dockerfile (#2703) 2024-04-17 07:45:39 +01:00
Z.Q.K b1e58a1fe8 fix typo (#2701) 2024-03-26 03:39:45 +00:00
Ak-Army f1a8b39309 Fix double close in stream client (#2693)
* [fix] etcd config source prefix issue (#2389)

* http transport data race issue (#2436)

* [fix] #2431 http transport data race issue

* [feature] Ability to close connection while receiving.
Ability to send messages while receiving.
Icreased r channel limit to 100 to more fluently communication.
Do not dropp sent request if r channel is full.

* [fix] Do not close the transport client twice in stream connection , the transport client is closed in the rpc codec

---------

Co-authored-by: Johnson C <chengqiaosheng@gmail.com>
Co-authored-by: Hunyadvári Péter <peter.hunyadvari@vcc.live>
2024-02-15 20:26:36 +00:00
Asim Aslam 6e55bb1a0e Update README.md (#2692) 2024-02-10 18:47:38 +00:00
Morya f28468a59c feat: allow to set API listen address (#2680) 2023-12-18 10:29:47 +00:00
Asim Aslam 3a4790b3c5 Update tests.yaml (#2681) 2023-12-18 10:28:44 +00:00
Eng Zer Jun cbd45b12dc Avoid allocations with (*regexp.Regexp).MatchString (#2679)
We should use `(*regexp.Regexp).MatchString` instead of
`(*regexp.Regexp).Match([]byte(...))` when matching string to avoid
unnecessary `[]byte` conversions and reduce allocations.

func BenchmarkMatch(b *testing.B) {
	for i := 0; i < b.N; i++ {
		if match := versionRe.Match([]byte("v1")); !match {
			b.Fail()
		}
	}
}

func BenchmarkMatchString(b *testing.B) {
	for i := 0; i < b.N; i++ {
		if match := versionRe.MatchString("v1"); !match {
			b.Fail()
		}
	}
}

goos: linux
goarch: amd64
pkg: go-micro.dev/v4/api/handler/event
cpu: AMD Ryzen 7 PRO 4750U with Radeon Graphics
BenchmarkMatch-16          	11430127	       127.4 ns/op	       2 B/op	       1 allocs/op
BenchmarkMatchString-16    	12220628	        97.54 ns/op	       0 B/op	       0 allocs/op
PASS
ok  	go-micro.dev/v4/api/handler/event	3.822s

Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
2023-12-04 16:00:01 +00:00
guangwu 252385e39c chore: replace for loop with call to copy (#2678) 2023-11-30 11:18:05 +00:00
ChengDaqi2023 68c026c5d8 update golang.org/x/net v0.8.0 to 0.17.0 (#2677) 2023-11-29 10:24:36 +00:00
Elmut ca6190f5f2 append to subscribers (#2640)
* append to subscribers

* Update rpc_router.go

error correction log
2023-11-26 11:08:28 +01:00
Guillaume Bour 674b9822e0 util/addr: Fixes findIP to return public IP if present. (#2673) 2023-11-26 11:06:55 +01:00
Christian Richter 7392705af8 bump urfave cli & fix race condition (#2659)
* bump urfave cli

Signed-off-by: Christian Richter <crichter@owncloud.com>

* Fix race condition

Co-authored-by: André Duffeck <andre.duffeck@firondu.de>

Signed-off-by: Christian Richter <crichter@owncloud.com>

---------

Signed-off-by: Christian Richter <crichter@owncloud.com>
2023-10-09 10:33:57 +01:00
Asim Aslam 27c488712e Update README.md (#2652) 2023-08-07 09:46:15 +01:00
Asim Aslam c3d7c65c88 Update README.md (#2650) 2023-07-20 07:49:53 +01:00
Asim Aslam 384814c885 Update README.md (#2648) 2023-07-17 09:33:34 +01:00
Asim Aslam 8a3a98a8b8 Update README.md (#2647) 2023-07-16 12:02:53 +01:00
asim 416f65e814 rename test dir 2023-07-11 09:25:35 +01:00
clearcode 8020303017 Update README.md (#2635) 2023-05-06 21:39:24 +02:00
mamadeusia 67d48b205e Add Context in event options (#2634)
Co-authored-by: mamadeusia <timadues7775@gmail.com>
2023-05-03 13:24:36 +01:00
dependabot[bot] 31135d4696 Bump github.com/docker/docker from 20.10.7+incompatible to 20.10.24+incompatible (#2625)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-04-26 02:22:47 +02:00
Coder 1478a8e46d fix(config/source/cli): mergo.Map error, src and dst must be of same … (#2628) 2023-04-26 02:21:08 +02:00
Mohamed MHAMDI ad8fca255b fix(config): fix file source watcher stop behavior when Stop is called (#2630)
Co-authored-by: Mohamed MHAMDI <mmhamdi@hubside.com>
2023-04-26 02:19:52 +02:00
Lukasz Raczylo a7522e7d6c fix: struct field alignment (#2632) 2023-04-26 02:16:34 +02:00
Asim Aslam 0f9b2f00c9 Update README.md 2023-04-12 11:09:56 +01:00
Asim Aslam 7fe95e8732 Update README.md 2023-04-12 11:09:40 +01:00
Asim Aslam d44ed328d1 Add Handle option (#2627) 2023-04-11 10:29:03 +01:00
Thomas Chandelle d392e72021 fix(api/handler): avoid zombie goroutine when connection unexpectedly closes (#2624) 2023-04-05 22:50:24 +02:00
dependabot[bot] 683e2729b4 Bump github.com/opencontainers/runc from 1.1.4 to 1.1.5 (#2623)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-03-30 20:19:21 +02:00
asim 6f8930926f gofmt 2023-03-22 16:42:54 +00:00
Asim Aslam 2117672933 Update FUNDING.yml 2023-03-21 20:51:42 +00:00
Asim Aslam d7e692b5d1 Update README.md 2023-03-21 15:19:07 +00:00
asim d949258b2f update the logo 2023-03-20 16:48:44 +00:00
fuyou d376656528 fix(sec): upgrade github.com/containerd/containerd to 1.6.18 (#2617)
* update github.com/containerd/containerd v1.4.3 to 1.6.18

* fix(sec): upgrade containerd

* fix(sec): go mod tidy

---------

Co-authored-by: Davincible <david.brouwer.99@gmail.com>
2023-03-07 17:28:22 +01:00
dependabot[bot] 415b3e3a2f Bump golang.org/x/net from 0.0.0-20210510120150-4163338589ed to 0.7.0 (#2615)
Bumps [golang.org/x/net](https://github.com/golang/net) from 0.0.0-20210510120150-4163338589ed to 0.7.0.
- [Release notes](https://github.com/golang/net/releases)
- [Commits](https://github.com/golang/net/commits/v0.7.0)

---
updated-dependencies:
- dependency-name: golang.org/x/net
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-03-07 17:11:10 +01:00
Hellis e337eb2c3d fix(api): add WithRegistry option for api (#2618) 2023-03-07 17:05:25 +01:00
dependabot[bot] 521e6b644c Bump golang.org/x/crypto from 0.0.0-20210513164829-c07d793c2f9a to 0.1.0 (#2619)
Bumps [golang.org/x/crypto](https://github.com/golang/crypto) from 0.0.0-20210513164829-c07d793c2f9a to 0.1.0.
- [Release notes](https://github.com/golang/crypto/releases)
- [Commits](https://github.com/golang/crypto/commits/v0.1.0)

---
updated-dependencies:
- dependency-name: golang.org/x/crypto
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-03-07 17:04:20 +01:00
Stanislav ad0b4f103d feat(errors): append errors use variadic arguments (#2606) 2023-01-03 12:58:03 +01:00
Davincible 68a6425ad8 fix(service): profile stop error scope 2022-11-16 05:07:41 +01:00
leoujz 0a91ba7b5d api gateway handing http request adds Content-Type application/x-www-form-urlencoded, and extract endpoints from path if no endpoint matched (#2592)
Co-authored-by: l <l@x>
2022-11-09 04:28:39 +01:00
645775992 a17eaf64da update gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b to 3.0.0 (#2589) 2022-11-04 12:06:13 +01:00
645775992 6df085fd6d update github.com/opencontainers/runc v0.1.1 to 1.1.2 (#2590) 2022-11-04 12:05:41 +01:00
David Brouwer 697ea1b21e Update README.md 2022-11-02 21:45:35 +01:00
JellyTony b442dbb56b fix: fix configuration version data competition (#2586)
Co-authored-by: JeffreyBool <zhanggaoyuan@mediatrack.cn>
2022-10-26 12:12:44 +02:00
Sagan Yaroslav b988a78bae fix: store table initialization (#2584) 2022-10-20 14:59:08 +02:00
David Brouwer a3980c2308 feat: add test framework & refactor RPC server (#2579)
Co-authored-by: Rene Jochum <rene@jochum.dev>
2022-10-20 13:00:50 +02:00
keepstep c25dee7c8a fix(registry/cache): do not watch when ttl=0 eg: some custom registry no s… (#2580)
Co-authored-by: keep <keep@pa.com>
2022-10-08 15:19:48 +02:00
Rene Jochum 24dfcef49a fix(transport/memory): Improve the memory transport, 4x speed (#2581) 2022-10-07 23:54:09 +02:00
Rene Jochum 065f9714e9 fix: easy lint fixes to api/ (#2567) 2022-10-01 10:50:11 +02:00
Rene Jochum 010b1d9f11 fix: linting issues (#2566) 2022-09-30 20:32:55 +02:00
David Brouwer 85c0b0b8eb fix: some linting issues (#2563) 2022-09-30 16:27:07 +02:00
David Brouwer 47e6a8d725 feat(CI): add linting and pretty test output (#2562) 2022-09-30 02:08:42 +02:00
Mohamed MHAMDI 1db36357d5 feat(logger): add logger option to all micro components (override DefaultLogger) closes #2556 (#2559)
Run tests / Test repo (push) Waiting to run
* feat(logger): add logger option to all components

* fix: refactor api/rpc.go

* fix: refactor api/stream.go

* fix: api/options.go comment

* fix(logger): do not use logger.Helper internally

* fix(logger): fix comments

* fix(logger): use level.Enabled method

* fix: rename mlogger to log

* fix: run go fmt

* fix: log level

* fix: factories

Co-authored-by: Mohamed MHAMDI <mmhamdi@hubside.com>
Co-authored-by: Davincible <david.brouwer.99@gmail.com>
2022-09-29 16:44:53 +02:00
David Brouwer 57a0ef5a0f docs: update README shields (#2558)
* docs: add badges to README.md

* docs: new discord badge

* docs: update discord badge

* docs: update discord badge

* docs: remove shield
2022-09-24 03:40:48 +02:00
Mohamed MHAMDI 39e00f11a8 feat(config): add withFs option to file source (#2557)
Co-authored-by: Mohamed MHAMDI <mmhamdi@hubside.com>
2022-09-24 02:46:18 +02:00
David Bereza 34b6434791 fix: prevent returning empty strings for list (#2553) 2022-09-06 20:03:23 +01:00
Asim Aslam a702a1b097 Update README.md 2022-08-17 10:02:52 +01:00
asim d32c8bd0eb move logo
Run tests / Test repo (push) Waiting to run
2022-08-17 09:50:32 +01:00
刘志铭 d7d8123bc7 Fix a problem with the Register Memory component (#2545) 2022-08-13 11:23:42 +01:00
David Bereza f40cfdda82 feat(sync): Add additional context option to sync (#2544) 2022-08-11 13:09:25 +08:00
Arvin 51250bf248 fix: Fix a logic judgment bug. (#2540)
Signed-off-by: Arvin <1458070668@qq.com>
2022-08-02 17:54:51 +01:00
Arvin 63a9b94820 support use of listen options (#2536)
* feat: support use of listen options

* style: Adjust the import order of packages.
2022-07-30 10:56:14 +01:00
Asim Aslam adcc1761d0 Update README.md 2022-07-24 06:39:24 +01:00
Asim Aslam cc53b5e7d7 Update README.md 2022-07-23 11:25:07 +01:00
asim 4d63d61c20 remove function
Run tests / Test repo (push) Waiting to run
2022-07-22 20:12:24 +01:00
asim 678c227061 remove deprecated function 2022-07-22 20:11:27 +01:00
asim ec847fa60c remove generate file 2022-07-22 20:10:06 +01:00
asim 616060876f remove file 2022-07-22 20:08:37 +01:00
asim 641be04fc0 remove plugins dir 2022-07-22 20:07:34 +01:00
Asim Aslam 28f36e8fd6 strip debug handler (#2532)
* strip debug handler

* fix tests
2022-07-22 20:03:27 +01:00
asim a8224e1c67 Merge branch 'master' of ssh://github.com/asim/go-micro 2022-07-22 10:22:58 +01:00
asim 38293f479a strip wrappers for trace/stats 2022-07-22 10:22:50 +01:00
Ak-Army 48eae3b968 Fix http transport panic (#2531)
* [fix] etcd config source prefix issue (#2389)

* http transport data race issue (#2436)

* [fix] #2431 http transport data race issue

* [feature] Ability to close connection while receiving.
Ability to send messages while receiving.
Icreased r channel limit to 100 to more fluently communication.
Do not dropp sent request if r channel is full.

* [fix] Read buff before reset it, when the connection is closed

Co-authored-by: Johnson C <chengqiaosheng@gmail.com>
Co-authored-by: Hunyadvári Péter <peter.hunyadvari@vcc.live>
2022-07-22 08:40:58 +01:00
Asim Aslam e28f5b97f6 Update README.md 2022-07-20 10:34:27 +01:00
Asim Aslam 140f90b354 Update README.md 2022-07-20 10:12:05 +01:00
Asim Aslam 467c8a34e3 Update README.md 2022-07-18 11:40:43 +01:00
Ak-Army 582e3f9310 Http transport stream (#2529)
* [fix] etcd config source prefix issue (#2389)

* http transport data race issue (#2436)

* [fix] #2431 http transport data race issue

* [feature] Ability to close connection while receiving.
Ability to send messages while receiving.
Icreased r channel limit to 100 to more fluently communication.
Do not dropp sent request if r channel is full.

Co-authored-by: Johnson C <chengqiaosheng@gmail.com>
Co-authored-by: Hunyadvári Péter <peter.hunyadvari@vcc.live>
2022-07-15 11:04:41 +01:00
Asim Aslam 98375c7ae5 api honours naming convention of other interfaces 2022-07-11 15:49:30 +01:00
Asim Aslam 7e903d80b6 Update README.md 2022-07-11 15:41:03 +01:00
Asim Aslam 6cf2b02f0f move cmd to util (#2527)
* move cmd to util

* go fmt
2022-07-11 14:37:34 +01:00
Asim Aslam b36949f2c1 Update README.md 2022-07-11 13:08:54 +01:00
Asim Aslam 995abaaea6 go mod tidy 2022-07-11 09:51:48 +01:00
Asim Aslam 97d59fbf78 remove generator and move to github.com/go-micro 2022-07-11 09:11:59 +01:00
Asim Aslam ff1312438c Update README.md 2022-07-07 12:49:56 +01:00
Asim Aslam edaa353826 strip body from gateway 2022-07-04 10:15:14 +01:00
Asim Aslam 48d6650f28 rename api to gateway 2022-07-02 14:42:12 +01:00
Asim Aslam 3381a9f3db Remove body from endpoint 2022-07-02 14:38:58 +01:00
Asim Aslam 63d1f9de4a minor changes 2022-07-02 14:25:21 +01:00
Asim Aslam e313863a2a make router configurable in api 2022-07-02 14:15:02 +01:00
Asim Aslam 73dc3723c7 Update api.go 2022-07-02 13:50:45 +01:00
Asim Aslam 667ee9b85e rename field to Versions 2022-07-02 12:35:57 +01:00
Asim Aslam b6b866c0b2 api package (#2522)
* api gateway

* add comment
2022-07-02 12:11:59 +01:00
Johnson C 28298a30e4 feat: remove plugins and related docs (#2521)
* feat: redis implementation of cache

* Revert "feat: redis implementation of cache"

This reverts commit 4b3f25c1fc494d934613992d8a762024fafad7b6.

* feat: remove plugins
2022-07-02 10:25:57 +01:00
Johnson C b884a68347 feat: update out of date docs (#2520)
Run tests / Test repo (push) Waiting to run
* feat: redis implementation of cache

* Revert "feat: redis implementation of cache"

This reverts commit 4b3f25c1fc494d934613992d8a762024fafad7b6.

* feat: update out of date docs
2022-07-02 08:44:32 +01:00
Asim Aslam bfcdfc3c7f remove m3o
Run tests / Test repo (push) Waiting to run
2022-07-01 11:37:13 +01:00
Asim Aslam 392610022a Update README.md 2022-07-01 08:38:57 +01:00
Asim Aslam 34a51c9f29 Update README.md 2022-07-01 08:34:20 +01:00
Asim Aslam a5fb3fab66 Update README.md 2022-07-01 08:33:53 +01:00
JellyTony 96576a612a feat(web): add start and stop functions to the web (#2519) 2022-07-01 08:06:27 +01:00
Thomas Chandelle 87c96bc4d0 Correctly check error on redis command XTRIM (#2518)
Also:
 - add comment about version requirement
 - move minID to var for code readability
2022-06-30 18:24:27 +08:00
JellyTony 65a2e4ed02 fix(registry): fix watch services only first time (#2517) 2022-06-29 08:49:22 +01:00
Abdul Hadi 9960cd1d36 typo siza #2429 (#2515) 2022-06-24 19:18:47 +01:00
David Brouwer 107bd74187 fix: allow event subscribers to use pointers (#2514)
When a subscriber would use a pointer as event type, panics would occur.
2022-06-22 09:01:13 +08:00
Johnson C 7a6a2b6373 feat: redis implementation of cache (#2513)
* feat: redis implementation of cache

* Revert "feat: redis implementation of cache"

This reverts commit 4b3f25c1fc494d934613992d8a762024fafad7b6.

* feat: redis implementation of cache
2022-06-21 20:05:00 +01:00
Asim Aslam cf51ddeb26 Update README.md 2022-05-30 08:50:02 +01:00
Asim Aslam 13b76331ec Update README.md
Run tests / Test repo (push) Waiting to run
2022-05-11 09:55:41 +01:00
Asim Aslam de0b456b46 Update README.md 2022-05-10 06:59:08 +01:00
yulian 072547201c remove unused variable in loop (#2495) 2022-05-03 11:06:13 +08:00
bosima 8293988499 fix: consume and publish blocked after rabbitmq reconnecting (#2492)
* Support direct generation of grpc method when package and service names of proto files are different.

* fix req.Interface() return nil.

* Get rid of dependence on 'Micro-Topic'

* Revert "Get rid of dependence on 'Micro-Topic'"

This reverts commit 3ff69443364d39f5fda3a32fc2249826e2d207dd.

* Revert "fix req.Interface() return nil."

This reverts commit 90a1b34195e07772fa6f2074e1cf22237ac2a87f.

* Revert "Revert "fix req.Interface() return nil.""

This reverts commit e64737b7da8d1767c4456881f6730f1c196cea60.

* Revert "Revert "Get rid of dependence on 'Micro-Topic'""

This reverts commit 141bb0a557c81cb6d1c651b085b3e65483d5e681.

* fix: consume and publish blocked after reconnecting

Co-authored-by: maxinglun <maxinglun@zhijiaxing.net>
2022-04-28 17:55:06 +08:00
Asim Aslam 367771923c Update README.md 2022-04-19 15:47:45 +01:00
Asim Aslam 4ca75f3ab3 Update README.md 2022-04-19 15:47:31 +01:00
Asim Aslam 4a7c16419e Update README.md 2022-04-19 15:31:23 +01:00
Asim Aslam 1d396bdd64 Update README.md 2022-04-19 15:31:11 +01:00
Sergey Galkin ca807e36c5 option to disable file watcher (#2485)
Co-authored-by: Sergey Galkin <v.sergey.galkin@reddit.com>
2022-04-18 19:30:14 +01:00
Asim Aslam cce02927e7 Update README.md 2022-04-18 19:20:45 +01:00
Wang 034ba9a0de typo fix; (#2480) 2022-04-15 09:55:30 +08:00
bosima 1919048c8f Support direct generation of grpc method (#2474)
* Support direct generation of grpc method when package and service names of proto files are different.
* fix req.Interface() return nil.
2022-04-10 22:12:39 +08:00
Asim Aslam 62c2981baf remove cli 2022-04-07 11:46:07 +01:00
Asim Aslam efa2c4f2d2 remove dashboard 2022-04-07 11:45:58 +01:00
Asim Aslam 27b98c450e Remove examples 2022-04-07 11:45:39 +01:00
Asim Aslam e8604f065c remove services 2022-04-07 11:45:22 +01:00
Asim Aslam aaca7c27da Update README.md 2022-04-07 11:44:47 +01:00
Asim Aslam 664ee31b1a Update README.md 2022-04-07 08:20:57 +01:00
Wang 6dedee5d8c Add header suppor for Kafka broker plugin; (#2470) 2022-04-04 19:54:19 +01:00
Wang d1806e2883 Fix codec/bytes (#2466)
* Update marshaler.go

Byes codec always return error "invalid message" now.

* Update go.mod

Update package name

* Update go.mod
2022-04-02 18:11:12 +01:00
Morya 1f086a3002 fix https://github.com/asim/go-micro/issues/2344 (#2462)
fix https://github.com/asim/go-micro/issues/2344
2022-04-01 07:10:51 +01:00
Muhammad Iqbal Alaydrus 73eda3346d Add Wait option support for sync/etcd plugins (#2459)
* Add Wait support for sync/etcd plugins

* Use ErrLockTimeout if context deadline exceeded
2022-03-25 10:28:19 +08:00
Chris Moran c6d352c832 #2453 Fix with associated test update (#2454) 2022-03-17 10:22:05 +08:00
baerwang 356448017f style:arrays pre-allocation (#2449) 2022-03-14 14:03:14 +08:00
dependabot[bot] d6a74c1a8e Bump github.com/nats-io/nats-server/v2 in /plugins/events/natsjs (#2447)
Bumps [github.com/nats-io/nats-server/v2](https://github.com/nats-io/nats-server) from 2.6.2 to 2.7.4.
- [Release notes](https://github.com/nats-io/nats-server/releases)
- [Changelog](https://github.com/nats-io/nats-server/blob/main/.goreleaser.yml)
- [Commits](https://github.com/nats-io/nats-server/compare/v2.6.2...v2.7.4)

---
updated-dependencies:
- dependency-name: github.com/nats-io/nats-server/v2
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-03-14 12:02:12 +08:00
Willy Kloucek e5a35d38f9 fix natsjs syntax error, remove TODOs and enable tests (#2446) 2022-03-11 16:03:35 +08:00
Willy Kloucek a2f6fac852 add NATS JetStream events plugin (#2433)
* add NATS JetStream plugin

* add notes about de-duplication and inprogress call

* fix typo
2022-03-04 14:53:15 +00:00
Ak-Army dca3a3b553 [fix] http transport deadlock (#2441)
Co-authored-by: Hunyadvári Péter <peter.hunyadvari@vcc.live>
2022-02-24 09:32:09 +00:00
AlkaidChen 4154ed6a80 add tls option for sync etcd plugin (#2440) 2022-02-24 17:07:14 +08:00
Chris Moran 69b4b5d1c6 Support for -micro_out=module=<module_prefix> for protoc-gen-micro (#2435) 2022-02-23 13:14:50 +08:00
Asim Aslam d47c2d984b add new services 2022-02-16 08:43:36 +00:00
Asim Aslam 91cfd18373 Update README.md 2022-02-16 08:35:22 +00:00
Asim Aslam 9e0be6c85d add service updates (#2418)
Run tests / Test repo (push) Waiting to run
2022-01-18 15:27:36 +00:00
Asim Aslam 23f1de80c5 Update README.md 2022-01-17 13:35:01 +00:00
Asim Aslam 6bc97c16ee Update README.md 2022-01-17 13:34:30 +00:00
Asim Aslam a612e09a34 Add files via upload 2022-01-15 20:26:27 +00:00
Asim Aslam 1e2d197c7d default the content type to json (#2412) 2022-01-11 13:36:20 +00:00
Asim Aslam 3a999a0db6 Add files via upload 2022-01-11 12:07:54 +00:00
Asim Aslam b8c2eb2b28 Update README.md 2022-01-11 08:35:55 +00:00
Asim Aslam 6f15174a2f Update README.md 2022-01-11 08:35:16 +00:00
Asim Aslam 748fb39cac Add files via upload 2022-01-11 08:34:58 +00:00
simon 5f2251cfad Add Kafka asynchronous send support (#2409)
* Add Kafka asynchronous send support

* Add Kafka asynchronous send support

* Upgrade sarama to 1.30.1

* Example
2022-01-09 14:12:10 +00:00
Amir Khazaie ef7528ebdb use read lock and unlock instead of write ones (#2410)
Co-authored-by: Amir Khazaie <a.khazaie@digikala.com>
2022-01-09 10:20:08 +00:00
Asim Aslam 696a0ba714 Merge branch 'master' of ssh://github.com/asim/go-micro 2022-01-03 11:21:29 +00:00
Asim Aslam 267da35259 move the api client 2022-01-03 11:21:20 +00:00
Asim Aslam d152870bdb Update client_test.go 2021-12-31 12:39:12 +00:00
Asim Aslam da41ab146e switch services client 2021-12-31 10:11:49 +00:00
Asim Aslam 757d0fe343 fix client 2021-12-30 09:47:40 +00:00
Asim Aslam c8d94c44f0 remove the client 2021-12-30 09:42:08 +00:00
Asim Aslam 5fa6e89f4f fix go mod 2021-12-30 09:35:21 +00:00
Asim Aslam 85f1c44000 Delete go.sum 2021-12-30 08:58:45 +00:00
Asim Aslam 3ba69f11ff Delete go.mod 2021-12-30 08:58:34 +00:00
Asim Aslam af5e70a1d6 add service interfaces 2021-12-30 08:44:34 +00:00
Johnson C 5fe884e59f [FEATURE] add changelog (#2400)
change logs for release history
2021-12-29 11:01:40 +08:00
isfk 415016c6e4 nats config plugin (#2397) 2021-12-28 11:27:36 +08:00
Asim Aslam e0de23c546 Update and rename m3o.go to services.go 2021-12-24 11:43:20 +00:00
Asim Aslam 7af0eb4b7a Update services/ (#2392) 2021-12-21 13:18:29 +00:00
isfk 8e52761edb fix context value nil (#2391) 2021-12-20 16:31:48 +08:00
Johnson C 37de747d19 [fix] nats deregister issue (#2384)
Run tests / Test repo (push) Waiting to run
2021-12-10 19:32:21 +08:00
Johnson C a40f6e8fae [fix] fixing f.IsExported undefined issue (#2382)
IsExported needs go1.17, replace with PkgPath
2021-12-07 17:30:48 +08:00
Johnson C b00c8368b9 [feat] dashboard update (#2381)
* [feature] dashboard update
2021-12-07 10:42:31 +08:00
Ak-Army 97f169c424 fix http_transport Recv and Close race condition on buff (#2374)
fix rpc_stream panic override with the "Unlock of unlocked RWMutex" panic

Co-authored-by: Hunyadvári Péter <peter.hunyadvari@vcc.live>
2021-12-05 11:56:17 +00:00
Ak-Army 81244a41f1 Extend client mock with ability to test publish, and a few useful method like SetResponse and SetSubscriber (#2375)
Co-authored-by: Hunyadvári Péter <peter.hunyadvari@vcc.live>
2021-12-05 11:55:54 +00:00
JeffreyBool 229b369702 [fix] update protoc-gen-micro install doc 2021-12-04 12:52:02 +08:00
Johnson C c0e0b2b225 [FEATURE] dashboard support publish messages (#2373)
* [feature] dashboard

* [feat] support publish message
2021-12-02 13:15:38 +08:00
Johnson C 1e4dd94b71 [fix] zookeeper registry delete event (#2372)
* [fix] #2358 zookeeper delete event
2021-12-01 16:26:31 +08:00
zhaoyang b25d744f5c feat: delete redundant lines (#2364) 2021-11-24 17:41:54 +00:00
zhaoyang 685f9979a1 feat: modify the dependencies urls (#2363) 2021-11-24 16:43:05 +00:00
Asim Aslam 6fc5e45626 Update README.md 2021-11-24 07:32:51 +00:00
Asim Aslam 2c6515152a Update load.go 2021-11-24 07:32:20 +00:00
Johnson C 70d2bd8a6b [feature] dashboard (#2361) 2021-11-24 11:27:23 +08:00
Johnson C 90b3e4af0b [fix] ignore unexported field (#2354)
ignore unexported field when register endpoints
2021-11-18 17:07:00 +08:00
Niek den Breeje 4f1a571704 Fix Micro CLI's proto comments (#2353) 2021-11-18 06:10:43 +01:00
陈杨文 799b8d6a65 upgrade to go 1.17 (#2346)
Run tests / Test repo (push) Waiting to run
2021-11-11 14:03:34 +00:00
Asim Aslam 8e312801a1 Update README.md 2021-11-08 09:03:37 +00:00
Asim Aslam 335c4e54a1 Merge branch 'master' of ssh://github.com/asim/go-micro 2021-11-08 09:01:56 +00:00
Asim Aslam e6d17257b0 add nats and redis events plugins 2021-11-08 08:59:14 +00:00
Asim Aslam 0c2041e439 add events package (#2341)
* add events package

* update go version
2021-11-08 08:52:39 +00:00
Johnson C c5be9f560c fix(#2333): etcd grpc marshal issue (#2334)
make protocodec compatible with legacy proto message type
2021-11-03 10:58:05 +08:00
Asim Aslam 62b985f49c Update README.md 2021-11-01 21:44:52 +00:00
Asim Aslam 2b9a6f9aeb flatten cli (#2332)
Run tests / Test repo (push) Waiting to run
2021-11-01 14:34:09 +00:00
Asim Aslam 3c70d23a1d m3o client changed 2021-11-01 11:00:21 +00:00
Asim Aslam adaa98e6cf use vanity url for cli command 2021-11-01 09:00:14 +00:00
无相 ed90a65783 fix broker nsq plugin nil pointer error (#2329)
Co-authored-by: longhaoteng <longhaoteng@kingsoft.com>
2021-11-01 08:47:22 +00:00
无相 268278c53e fix config json slice parsing (#2330)
Co-authored-by: longhaoteng <longhaoteng@kingsoft.com>
2021-11-01 08:47:00 +00:00
Benjamin 5d5aee1f08 replace ioutil with io and os (#2327)
set the go version to 1.16 in pr.yml and tests.yml, so as to be consistent with the version in go.mod.
2021-10-30 19:24:40 +01:00
Johnson C ed690ed838 fixing #2308 (#2326)
IPV6 too many colons in address
net.SplitHostPort need ipv6 address in [host]:port format
2021-10-28 17:03:48 +08:00
Niek den Breeje e155029a4b Fix Micro CLI by removing replace line in go.mod 2021-10-27 17:40:26 +02:00
Asim Aslam 880d751df4 Update README.md 2021-10-27 16:34:55 +01:00
Niek den Breeje a3202b00ee Rename gomu to micro (#2325)
* Rename Gomu to Micro

* docs: Remove license reference in CLI's README
2021-10-27 16:31:29 +01:00
Asim Aslam efcda9a48c Update README.md 2021-10-26 20:17:07 +01:00
Asim Aslam 2c73c7fcf3 strip protoc-gen-micro go mod 2021-10-26 19:46:25 +01:00
Johnson C d2a51d05c4 [feature] stream CloseSend (#2323)
* support stream CloseSend

* move CloseSend into Closer
2021-10-26 15:07:08 +01:00
Johnson C af3cfa0a4c remove unnecessary dependencies between plugins
remove unnecessary dependencies between plugins
upgrade go-micro.dev/v4 to v4.2.1
2021-10-23 16:20:42 +08:00
Johnson C f96b48dad9 1. use default memory registry in grpc plugins (#2317)
2. try fixing grpc plugin failed to get issue
use v4.0.0-v4.0.0-00010101000000-000000000000 instead of specific version
3. kafka panic on disconnect
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xc0000005 code=0x0 addr=0x18 pc=0x1266c50]

goroutine 31 [running]:
github.com/asim/go-micro/plugins/broker/kafka/v3.(*kBroker).Disconnect(0xc0002400c0)
        C:/Workshop/Go/pkg/mod/github.com/asim/go-micro/plugins/broker/kafka/v3@v3.7.0/kafka.go:130 +0xd0
github.com/asim/go-micro/plugins/server/grpc/v3.(*grpcServer).Start.func2()
        C:/Workshop/Go/pkg/mod/github.com/asim/go-micro/plugins/server/grpc/v3@v3.0.0-20210712061837-0532fd9de8ae/grpc.go:998 +0xc8d
created by github.com/asim/go-micro/plugins/server/grpc/v3.(*grpcServer).Start
        C:/Workshop/Go/pkg/mod/github.com/asim/go-micro/plugins/server/grpc/v3@v3.0.0-20210712061837-0532fd9de8ae/grpc.go:917 +0xcaf
exit status 2
2021-10-22 22:30:28 +08:00
Niek den Breeje 9edc569e68 Add update rule to Makefile (#2315)
I realized that when writing `require go-micro.dev/v4 v4.1.0` in the
`go.mod` file, `go mod tidy` will install that exact version of
`go-micro.dev/v4`. As of right now, v4.1.0 is an outdated version, and
preferably we shouldn't be updating gomu's Go Modules template everytime
a new release is tagged, but still want gomu users to generate projects
using the latest Go Micro version.

In an attempt to solve this problem, I'm opting to add a new Makefile
rule for new projects generated by gomu, `update` that runs `go get -u`.
This aggressively updates any dependencies your Go Modules project may
have.  `go mod tidy` is then able to prune the `go.mod` and `go.sum`
files by removing the unnecessary checksums and transitive dependencies
(e.g. `// indirect`), that were added to by go get -u due to newer
semver available.

Put one and one together and you get two. In addition to adding an
`update` rule to the Makefile generated for new projects by gomu, I'm
also updating the proto and client comments printed when new projects
have been generated to promote the `update` rule.

References:

- https://stackoverflow.com/questions/67201708/go-update-all-modules
2021-10-19 21:12:42 +02:00
Johnson C 29fefbad4e Plugins (#2311)
* release plugins

* add window plugins release bat script

Co-authored-by: Johnson C <johnson.cheng@scenestek.com>
2021-10-16 05:56:51 +01:00
Asim Aslam 9f4770e7fd fix generation (#2312)
Run tests / Test repo (push) Waiting to run
2021-10-15 14:03:40 +01:00
Asim Aslam e7dbda689e fix gomu
Run tests / Test repo (push) Waiting to run
2021-10-14 08:09:21 +01:00
Asim Aslam 00f461141a fix examples go mod
Run tests / Test repo (push) Waiting to run
2021-10-13 13:37:24 +01:00
Asim Aslam 8cad88edae update go sums 2021-10-13 13:35:17 +01:00
Asim Aslam 62801c3d68 update 2021-10-13 13:31:23 +01:00
Asim Aslam 7136c61dbd rename to go-micro.dev 2021-10-13 09:52:05 +01:00
Asim Aslam a87f9a808c move to go-micro.dev 2021-10-13 09:44:24 +01:00
Asim Aslam ca594b922c Merge branch 'master' of ssh://github.com/asim/go-micro 2021-10-13 09:42:31 +01:00
Asim Aslam aa4a87ed9a move to v4 in protoc-gen-micro 2021-10-13 09:42:21 +01:00
justcy 690facdb5c update model template (#2307) 2021-10-13 08:07:48 +01:00
Asim Aslam f63e46a7d1 use 4.1.0 2021-10-12 13:22:08 +01:00
Asim Aslam 1cd7cfaa6c go-micro.dev/v4 (#2305)
Run tests / Test repo (push) Waiting to run
2021-10-12 12:55:53 +01:00
jxlwqq d9a6faeb7a Add latest version (#2303)
Run tests / Test repo (push) Waiting to run
2021-10-11 15:15:42 +01:00
Asim Aslam 4cb6168780 Update README.md 2021-10-11 09:21:06 +01:00
Asim Aslam b8d7f87d17 remove file 2021-10-11 09:19:20 +01:00
Asim Aslam b2e17a89e5 rename file 2021-10-11 09:19:01 +01:00
Asim Aslam 4ae2528cbe add m3o services (#2301)
* add m3o services

* update readme
2021-10-11 09:18:28 +01:00
Asim Aslam 043a82bce2 Update README.md 2021-10-11 08:38:31 +01:00
Asim Aslam 99e0b182b7 Update README.md 2021-10-11 08:38:07 +01:00
Asim Aslam ab1b10f13d Update README.md 2021-10-11 08:37:38 +01:00
jxlwqq 86eabf4a4c Use go install (#2300)
go get: installing executables with 'go get' in module mode is deprecated.
        To adjust and download dependencies of the current module, use 'go get -d'.
        To install using requirements of the current module, use 'go install'.
        To install ignoring the current module, use 'go install' with a version,
        like 'go install example.com/cmd@latest'.
        For more information, see https://golang.org/doc/go-get-install-deprecation
        or run 'go help get' or 'go help install'.
2021-10-11 06:32:13 +01:00
Qalifah a99a1e9356 add MultiError type (#2297) 2021-10-06 17:55:14 +01:00
Asim Aslam 2ef523a7eb Delete index.html 2021-10-02 13:13:22 +01:00
Asim Aslam a1da40d9aa Delete CNAME 2021-10-01 20:23:38 +01:00
Defoo Li a315fc2dda Fix missing content type (#2289) 2021-09-30 12:15:09 +01:00
Johnson C 6dc25053ea Errors (#2290)
* add errors.As

convert target err to *Error, return false if err don't match *Error

* update errors.As to (*Error, bool)

* fixing FromError panic issue when err is nil
2021-09-30 07:45:10 +01:00
Qiu Yu 4612baa7f8 zap plugin: allow injecting zap logger options (#2287)
Though some of the Zap logger option can be customized through
plugins/logger/zap.Options, this change allows go.uber.org/zap.Option be
be injected directly for deeper customization.
2021-09-29 07:12:16 +01:00
Johnson C 44ecd6a457 Hystrix filter (#2286)
* support hystrix filter

* filter function should return true of false
2021-09-28 11:23:04 +01:00
Asim Aslam 8c39b1e120 Update index.html 2021-09-24 09:10:04 +01:00
Asim Aslam 12eff1cc60 go fmt 2021-09-24 09:08:39 +01:00
Asim Aslam 9deb715ebb Update go.mod 2021-09-24 09:08:16 +01:00
Arsen 3b60db0dcd logger helper: add "inject" method, to make a pair with "extract" (#2283) 2021-09-23 16:48:08 +01:00
Asim Aslam af22cbb108 Update README.md 2021-09-22 14:48:20 +01:00
Asim Aslam 9d7131a512 Update README.md 2021-09-22 14:43:37 +01:00
Asim Aslam bca9ab165d Update README.md 2021-09-22 14:42:17 +01:00
Asim Aslam d111f96993 Update README.md 2021-09-22 14:41:29 +01:00
Asim Aslam 2f223c276c Update README.md 2021-09-22 14:32:06 +01:00
Asim Aslam 33acb4a956 update readme 2021-09-22 14:31:21 +01:00
Asim Aslam b515785637 add services dir 2021-09-22 14:30:40 +01:00
Asim Aslam 3dcdcdad32 Update README.md 2021-09-22 13:37:07 +01:00
Arsen 916ed6b8ee logger: caller's skip correction (#2280) 2021-09-22 09:01:03 +01:00
gregkv b8fbe87e1f Use context to log "panic recovered" errors in grpc-server plugin (#2278) 2021-09-20 10:50:13 +01:00
Asim Aslam cb3db7dd83 Update options.go 2021-09-19 17:22:28 +01:00
simon 066ce5045b Command Option add NewConfig,NewProfile func (#2276)
* Add grpc,memory,quic transport automatically discover

* Add grpc,memory,quic transport automatically discover

* Add jwt auth automatically discover

* Add jwt auth automatically discover

* Add config command option automatically discover

* Add AuthCall wrapper func

* Add NewConfig func

* Add NewProfile func
2021-09-19 17:21:55 +01:00
Asim Aslam a65932ff82 Create CNAME 2021-09-19 15:10:47 +01:00
Asim Aslam 5496086916 Create index.html 2021-09-19 14:44:03 +01:00
Kurisu_Amatist efd4ef0e62 fix(cache): only watch calling service in registry (#2273) 2021-09-19 10:40:21 +01:00
gregkv 00d819a199 Remove fields map from Helper, add Extract method and fix for defaultLogger.Fields (#2274) 2021-09-19 10:40:09 +01:00
helloword ad532522ea Config CORS (#2270)
* Added cors.config for CORS

* Added cors.config for CORS

* Added cors.config for CORS

Co-authored-by: 于海洋 <yhy@iothinking.com>
2021-09-17 10:17:12 +01:00
Christoffer Åström 4c7d2e28eb test(api): fix randomly failing rpc test (#2268) 2021-09-13 21:56:36 +01:00
Branden Horiuchi d78d35078c Consul sync plugin (#2267)
* adding consul sync provider

* adding logging options

Co-authored-by: Branden Horiuchi <Branden.Horiuchi@blackline.com>
2021-09-13 19:08:05 +01:00
Johnson C 22409c8ff3 support hystrix filter (#2265) 2021-09-13 09:23:26 +01:00
binbin.zhang 6c3a5c161f upgrade nacos sdk version (#2264)
Co-authored-by: binbin <binbin@didiglobal.com>
2021-09-12 22:16:46 +01:00
Niek den Breeje fa27250605 Add generate kubernetes command (#2261) 2021-09-10 18:56:51 +01:00
Niek den Breeje ac21bb5b19 Document Gomu's generator package (#2262) 2021-09-10 18:48:09 +01:00
Niek den Breeje 5b8d22a463 Add Kubernetes flag to new command (#2263)
To remain consistent with the Gomu's generate command, we add a
Kubernetes flag to Gomu's new command as well.
2021-09-10 18:47:55 +01:00
Niek den Breeje 56d5143557 Document Gomu's generate command (#2260) 2021-09-10 14:30:46 +01:00
Niek den Breeje 5772697752 Make generator package a first class citizen (#2259)
There's really no point in having the `generator` be embedded in a
`file` package so we remove the `file` package and make the `generator`
package a first class citizen instead.
2021-09-10 13:31:52 +01:00
Niek den Breeje e23006b1a5 Generate Gomu files after the fact (#2258)
* Move file generation to new package

* Use text/template instead of html/template

* Make config variables more consistent

* Combine generate files and print comments there

* Add gomu generate command

* Refactor project templating to file library

* Determine client earlier
2021-09-10 13:20:57 +01:00
Niek den Breeje 01b7b4409b Fix generating Dockerfile with Gomu (#2254)
Somehow I didn't test this and managed to forget to properly close a
template control structure. This change fixes that.
2021-09-08 14:43:52 +01:00
Niek den Breeje 0dd6afe128 Optimize Dockerfile generated by Gomu (#2253)
This change prevents having to rebuild the entire Docker image when your
source code changes.
2021-09-08 12:50:30 +01:00
Niek den Breeje a36f52c6d2 Fix Gomu's call response (#2251)
Gomu expects a `map[string]string` type response back, but this isn't
always the case. When Gomu calls a service endpoint that responds with,
let's say, a key where its value is a map or a list, Gomu would be
unable to decode that response. By expecting a `map[string]interface{}`
type response, Gomu is able to decode those responses as well.
2021-09-08 08:30:53 +01:00
simon 440aa4a1ce Add AuthCall wrapper func (#2250)
* Add grpc,memory,quic transport automatically discover

* Add grpc,memory,quic transport automatically discover

* Add jwt auth automatically discover

* Add jwt auth automatically discover

* Add config command option automatically discover

* Add AuthCall wrapper func
2021-09-07 07:13:56 +01:00
Niek den Breeje f77c91b7ae Simplify gomu cmd registering (#2249)
* Use internal runtime package for gomu run

This change refactors the `gomu run` command to use Go Micro's internal
runtime package in order to run services. Not only does this clean up
duplicate functionality between Go Micro and Gomu, but also adds the
feature to Gomu to run remote projects. For example, the following
command pulls in a remote project and runs it locally.

```bash
gomu run github.com/auditemarlow/helloworld
```

The `gomu run` command remains backwards compatible. By invoking `gomu
run` in a Go Micro project directory, Gomu will simply run that project.

* Simplify Gomu's command registering

By leveraging Go's `init()` function, we can simplify registering
commands just a tad.
2021-09-06 14:12:27 +01:00
Niek den Breeje a58b8883f8 Use internal runtime package for gomu run (#2248)
This change refactors the `gomu run` command to use Go Micro's internal
runtime package in order to run services. Not only does this clean up
duplicate functionality between Go Micro and Gomu, but also adds the
feature to Gomu to run remote projects. For example, the following
command pulls in a remote project and runs it locally.

```bash
gomu run github.com/auditemarlow/helloworld
```

The `gomu run` command remains backwards compatible. By invoking `gomu
run` in a Go Micro project directory, Gomu will simply run that project.
2021-09-06 14:01:29 +01:00
simon 270d910b73 Add config command option automatically discover (#2246)
* Add grpc,memory,quic transport automatically discover

* Add grpc,memory,quic transport automatically discover

* Add jwt auth automatically discover

* Add jwt auth automatically discover

* Add config command option automatically discover
2021-09-04 07:17:21 +01:00
Niek den Breeje 77bf39f2cd Fix client gRPC plugin (#2245)
The helloworld examples found in the `google.golang.org/grpc/examples`
package were imported multiple times as different versions, resulting in
package conflicts. By running `go mod tidy`, these conflicts are
resolved and the gRPC client plugin can now be imported again.
2021-09-03 14:16:56 +01:00
Niek den Breeje c45073a308 Fix Skaffold pipelines for client projects (#2244)
* Update greeter references to helloworld

* Add new client command

With this change, Gomu users will be able to generate template projects
for clients to services. Additionally vendor support has been built in
so Gomu users can now generate projects using fully qualified package
names, for example:

```bash
gomu new service github.com/auditemarlow/helloworld
```

This will create a new service project `helloworld` with its module name
already set to `github.com/auditemarlow/helloworld`. Likewise, Gomu
users can then generate client projects in the same manner:

```bash
gomu new client github.com/auditemarlow/helloworld
```

This will create a `helloworld-client` project that uses the protobufs
found in the `github.com/auditemarlow/helloworld` service. This removes
at least some strain in configuring these module dependencies yourself;
you can just scaffold them outright from the start.

Although the default client project is highly opinionated, it works
straight out of the box and has Skaffold in mind. Gomu users should be
able to get going in a matter of seconds.

* Update README

* Fix Skaffold pipeline for generated client projects
2021-09-03 13:26:34 +01:00
Niek den Breeje 86de031adc [WIP] Add new client cmd (#2243)
* Update greeter references to helloworld

* Add new client command

With this change, Gomu users will be able to generate template projects
for clients to services. Additionally vendor support has been built in
so Gomu users can now generate projects using fully qualified package
names, for example:

```bash
gomu new service github.com/auditemarlow/helloworld
```

This will create a new service project `helloworld` with its module name
already set to `github.com/auditemarlow/helloworld`. Likewise, Gomu
users can then generate client projects in the same manner:

```bash
gomu new client github.com/auditemarlow/helloworld
```

This will create a `helloworld-client` project that uses the protobufs
found in the `github.com/auditemarlow/helloworld` service. This removes
at least some strain in configuring these module dependencies yourself;
you can just scaffold them outright from the start.

Although the default client project is highly opinionated, it works
straight out of the box and has Skaffold in mind. Gomu users should be
able to get going in a matter of seconds.

* Update README
2021-09-03 12:33:10 +01:00
simon 80dbe51077 Add jwt auth automatically discover (#2242)
* Add grpc,memory,quic transport automatically discover

* Add grpc,memory,quic transport automatically discover

* Add jwt auth automatically discover

* Add jwt auth automatically discover
2021-09-03 07:49:49 +01:00
Johnson C f444dadd50 fixing #2235 win10 install failed issue (#2239) 2021-09-03 07:49:39 +01:00
Christoffer Åström e080791787 chore(gomu): tweak makefile template (#2238) 2021-09-02 18:24:28 +01:00
simon a159598f36 Add grpc,memory,quic transport automatically discover (#2237)
* Add grpc,memory,quic transport automatically discover

* Add grpc,memory,quic transport automatically discover
2021-09-02 18:10:24 +01:00
Niek den Breeje 993e2f55bd Add Kubernetes resources (#2236)
* Refact new command implementation

Everytime I want to add or modify files in the new command, I will have
to do so in 2 places. This change will consolidate functionality so
there's only a single place to modify.

* Move Kubernetes resources to its own file

* Add Kubernetes resources
2021-09-02 13:35:00 +01:00
Niek den Breeje ed9053ed94 Add cache example (#2232) 2021-09-01 10:08:43 +01:00
Niek den Breeje 05a299b76c Add simple in-memory cache (#2231)
* Add simple in-memory cache

* Support configuring cache expiration duration

* Support preinitializing cache with items

* Register cache
2021-08-31 15:31:16 +01:00
Asim Aslam dd0a7746ff update the gomu gomod 2021-08-31 15:19:45 +01:00
Asim Aslam 088ccb5001 Update README.md 2021-08-31 09:27:36 +01:00
Niek den Breeje 4363678e48 Exit when help flag is provided on service run (#2225) 2021-08-31 09:13:35 +01:00
Niek den Breeje 9a77c06b44 Move from micro/cli/v2 to urfave/cli/v2 (#2224)
* Use urfave/cli/v2 instead of micro/cli/v2

Wherever possible we may want to eliminate the use of github.com/micro
imports.

* Fix broken cli test
2021-08-31 09:05:08 +01:00
Niek den Breeje 78bea87690 Add gomu CLI tool (#2223) 2021-08-30 15:48:57 +01:00
Johnson C 49eccbc85a fixing proto3 optional unsupported error (#2213)
add supported features
2021-08-24 08:14:33 +01:00
Asim Aslam 7f1ebaa572 Update README.md 2021-08-23 16:45:04 +01:00
Qiu Yu c7195aae98 Grpc server injection (#2208)
Run tests / Test repo (push) Waiting to run
* plugin: update grpc server readme

* plugin: refactor gprc server test

This is a no-op change to enable test logic reuse for different
combinations.

* plugin: grpc server test Init after New

* plugin: allow grpc.Server to be injected
2021-08-12 18:26:26 +01:00
Arsen ffb0a2f896 grpc client: fix grpc code to micro http status conversion for the fallback case with empty Details (#2206) 2021-08-12 12:15:49 +01:00
Qiu Yu b977a51253 Examples: fix grpc config (#2207)
This change fixes grpc config example code which is currently broken.

Several pieces in the change:
- use yaml encoder to read config files
- rename *.yml to *.yaml to fix format (file suffix) for encoder lookup
- replace util/log package with logger as the former one is deprecated
2021-08-12 06:27:04 +01:00
dependabot[bot] 046d0785c9 Bump github.com/gin-gonic/gin from 1.6.3 to 1.7.0 in /examples (#2205)
Bumps [github.com/gin-gonic/gin](https://github.com/gin-gonic/gin) from 1.6.3 to 1.7.0.
- [Release notes](https://github.com/gin-gonic/gin/releases)
- [Changelog](https://github.com/gin-gonic/gin/blob/master/CHANGELOG.md)
- [Commits](https://github.com/gin-gonic/gin/compare/v1.6.3...v1.7.0)

---
updated-dependencies:
- dependency-name: github.com/gin-gonic/gin
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-08-11 13:57:15 +01:00
Qiu Yu 828d3f2b74 loader: avoid overwriting values if error happens (#2204) 2021-08-11 13:33:58 +01:00
Qiu Yu a46dc0b856 Add yaml config example (#2203)
* examples: add yaml config

* examples: update go mod for yaml plugin
2021-08-11 13:31:29 +01:00
Johnson C 3e0411a3f6 fixing mem.pprof issue: (#2198)
parsing profile: concatenated profiles detected
fixing web service not start profile issue
fixing no default profile options issue
2021-08-04 09:39:01 +01:00
bacndcmc c3107e6843 fix code proto return invalid message (#2196)
Co-authored-by: ben <norton0395@gmail.com>
2021-07-26 06:25:21 +01:00
Asim Aslam e1bc7e3028 Update README.md 2021-07-21 09:06:34 +01:00
Asim Aslam 992418236e Update README.md 2021-07-21 09:05:38 +01:00
Asim Aslam 27a792790b Update README.md 2021-07-21 09:05:20 +01:00
Asim Aslam bd9821111e remove tidy file 2021-07-19 17:57:33 +01:00
Asim Aslam dbba07e7ed Delete tidy.md 2021-07-19 17:55:08 +01:00
xshytikx 753022d2ae fix: imported and not used (log, os) (#2195)
github.com/asim/go-micro/plugins/registry/consul/v3@v3.0.0-20210716165540-546225f1d8db/watcher.go:5:2: imported and not used: "log"
github.com/asim/go-micro/plugins/registry/consul/v3@v3.0.0-20210716165540-546225f1d8db/watcher.go:5:2: imported and not used: "log"
2021-07-18 07:18:11 +01:00
JeffreyBool 546225f1d8 Not Recommended Function Correction (#2194)
* Update http.go

Exit before deregister is executed

* Create http.go

Exit before deregister is executed

* Solve the problem that the resources have not been fully released due to early exit

* Optimize some code

* Optimize some code

* Optimize some code

* fix service default logger

* Not Recommended Function Correction
2021-07-16 17:55:40 +01:00
JeffreyBool 0532fd9de8 fix logger v3 (#2193)
* Update http.go

Exit before deregister is executed

* Create http.go

Exit before deregister is executed

* Solve the problem that the resources have not been fully released due to early exit

* Optimize some code

* Optimize some code

* Optimize some code

* fix service default logger

* Repair mq asynchronous send, mq write failure without error output

* Repair mq asynchronous send, mq write failure without error output

* fix logger v3
2021-07-12 07:18:37 +01:00
lanrion 3fbf2c304f Optimize prometheus wrapper,removed mutex,initialize MetricVec at init() (#2192)
Co-authored-by: dylan.deng <dylan.deng@yijinin.com>
2021-07-09 12:52:08 +01:00
JeffreyBool 6cdf28270f Repair mq asynchronous send, mq write failure without error output (#2191)
* Update http.go

Exit before deregister is executed

* Create http.go

Exit before deregister is executed

* Solve the problem that the resources have not been fully released due to early exit

* Optimize some code

* Optimize some code

* Optimize some code

* fix service default logger

* Repair mq asynchronous send, mq write failure without error output

* Repair mq asynchronous send, mq write failure without error output
2021-07-09 06:19:09 +01:00
Johnson C 7f1de77e8c try fixing staticcheck warning (#2190)
Run tests / Test repo (push) Waiting to run
https://github.com/golang/protobuf/issues/1077
package github.com/golang/protobuf/proto is deprecated: Use the "google.golang.org/protobuf/proto" package instead.  (SA1019)
2021-07-06 12:51:28 +01:00
Asim Aslam 1c482e8922 add web package 2021-07-06 11:12:19 +01:00
wangYue 70ed9bf154 fix missing error (#2189)
Co-authored-by: wangyue <wangyue@actiontech.com>
2021-06-30 10:13:05 +01:00
Jerry 93ba8cd0df continue fix pre version go get bug that unknown v3.5.1 (#2188)
* 1.fix plugins go get bug.
2.update all mode.
3.add tidy tools

* continue fix pre version go get bug that unknown v3.5.1
2021-06-30 09:24:00 +01:00
Jerry c13bb07171 1.fix plugins go get bug. (#2187)
2.update all mode.
3.add tidy tools
2021-06-30 07:21:03 +01:00
Jerry 4929a7c16e update etcd version (#2186)
Remove missing gRPC example from README.md (#2112)

Delete docker.yml

Delete Dockerfile

update plugins version & remove replace (#2118)

* update memory registry plugins version & remove replace

* update plugins version & remove replace

Co-authored-by: 申法宽 <shenfakuan@163.com>

update client/grpc plugins version & remove replace (#2119)

* update memory registry plugins version & remove replace

* update plugins version & remove replace

* update plugins/client/grpc/v3 version

Co-authored-by: 申法宽 <shenfakuan@163.com>

update etcd version (#2120)

update mod version

update

update pulgin registry mod version (#2121)

* update etcd version

* update mod version

* update

fix store delete

support for tls on http plugin (#2126)

improve code quality (#2128)

* Fix inefficient string comparison

* Fix unnecessary calls to Printf

* Canonicalize header key

* Replace `t.Sub(time.Now())` with `time.Until`

* Remove unnecessary blank (_) identifier

* Remove unnecessary use of slice

* Remove unnecessary comparison with bool

Update README.md

Update README.md

remove network package

update quic go mod

remove indirects

update etcd mod version

Update registry plugins mod version (#2130)

* update etcd version

* update mod version

* update

* update etcd mod version

Update README.md

Update README.md

Update README.md

fixing etcd stack in getToken (#2145)

when provide username and password, etcd will try to get auth token from server
if server is unavailble, etcd client will stack in
when dial timeout is set, it will return err instead of stack in

Update README.md

add http demo; http client can call http server; http client can call rpc server (#2149)

Add etcd to default registries when plugin is loaded (#2150)

Co-authored-by: Andrew Jones <andrew@gotoblink.com>

Update README.md

make rpcClient compatible with 32bit arm systems (#2156)

On ARM, 386, and 32-bit MIPS, it is the caller's responsibility to
arrange for 64-bit alignment of 64-bit words accessed
atomically. Only the first word in an allocated struct can
be relied upon to be 64-bit aligned.

optimize the process of switching grpc error to micro error (#2158)

Fix util/log/log.Infof format didn't work (#2160)

Co-authored-by: Cui Gang <cuigang@yunpbx.com>

fixing string field contains invalid UTF-8 issue (#2164)

fix k8s api memory leak (#2166)

fix http No release Broker (#2167)

* Update http.go

Exit before deregister is executed

* Create http.go

Exit before deregister is executed

fix: "Solve the problem that the resources have not been fully released due to early exit" (#2168)

* Update http.go

Exit before deregister is executed

* Create http.go

Exit before deregister is executed

* Solve the problem that the resources have not been fully released due to early exit

* Optimize some code

* Optimize some code

fix service default logger (#2171)

* Update http.go

Exit before deregister is executed

* Create http.go

Exit before deregister is executed

* Solve the problem that the resources have not been fully released due to early exit

* Optimize some code

* Optimize some code

* Optimize some code

* fix service default logger

Update README.md

get k8s pod (#2173)

Update README.md

fix:field (#2176)

* get k8s pod

* fix: filed

* field

Update README.md

add rmq message properties (#2177)

Co-authored-by: dtitov <dtitov@might24.ru>

Update README.md

grpc server add RegisterCheck (#2178)

fix 404 bug (#2179)

fix undefined: err (#2181)

Add registry and config/source plugins based on nacos/v2 (#2182)

* Add registry plugins implement by nacos/v2

* Add config/source plugins implement by nacos/v2

support hystrix fallback (#2183)

Windows event log plugin (#2180)

* add rmq message properties

* eventlog start

* start eventlog

* windows event logger

* readme

* readme

Co-authored-by: dtitov <dtitov@might24.ru>

support etcd auth with env args (#2184)

* support etcd auth with env args
set default registry address with env arg instead of 127.0.0.1

* fixing MICRO_REGISTRY_ADDRESS may empty issue

update mod version
2021-06-29 13:40:54 +01:00
Johnson C 212df8e6c3 support etcd auth with env args (#2184)
* support etcd auth with env args
set default registry address with env arg instead of 127.0.0.1

* fixing MICRO_REGISTRY_ADDRESS may empty issue
2021-06-23 07:45:01 +01:00
Dmitry Titov 8dc9bf49a1 Windows event log plugin (#2180)
* add rmq message properties

* eventlog start

* start eventlog

* windows event logger

* readme

* readme

Co-authored-by: dtitov <dtitov@might24.ru>
2021-06-20 09:28:30 +01:00
qm012 4daa499912 support hystrix fallback (#2183) 2021-06-20 09:28:15 +01:00
Yusan Kurban 939f346d83 Add registry and config/source plugins based on nacos/v2 (#2182)
* Add registry plugins implement by nacos/v2

* Add config/source plugins implement by nacos/v2
2021-06-18 14:23:03 +01:00
qm012 08216ccf31 fix undefined: err (#2181) 2021-06-17 11:11:38 +01:00
qm012 4deeaff8ad fix 404 bug (#2179) 2021-06-16 07:56:41 +01:00
dudu b892efa25f grpc server add RegisterCheck (#2178) 2021-06-11 09:57:44 +01:00
Asim Aslam 4af9e245fb Update README.md 2021-06-09 10:31:10 +01:00
Dmitry Titov 52bb3845f6 add rmq message properties (#2177)
Co-authored-by: dtitov <dtitov@might24.ru>
2021-06-08 10:34:47 +01:00
Asim Aslam a1e9b88495 Update README.md 2021-06-04 10:17:30 +01:00
biubiubiu-ljd ed44e9acc3 fix:field (#2176)
* get k8s pod

* fix: filed

* field
2021-06-03 07:01:26 +01:00
Asim Aslam 86d8d8f07e Update README.md 2021-06-02 14:02:58 +01:00
biubiubiu-ljd 62112b015f get k8s pod (#2173) 2021-06-02 13:54:02 +01:00
Asim Aslam ca2014bf8e Update README.md 2021-06-01 06:23:33 +01:00
JeffreyBool acc3f5479f fix service default logger (#2171)
* Update http.go

Exit before deregister is executed

* Create http.go

Exit before deregister is executed

* Solve the problem that the resources have not been fully released due to early exit

* Optimize some code

* Optimize some code

* Optimize some code

* fix service default logger
2021-05-23 08:38:20 +01:00
JeffreyBool f48911d2c3 fix: "Solve the problem that the resources have not been fully released due to early exit" (#2168)
* Update http.go

Exit before deregister is executed

* Create http.go

Exit before deregister is executed

* Solve the problem that the resources have not been fully released due to early exit

* Optimize some code

* Optimize some code
2021-05-17 08:16:52 +01:00
JeffreyBool 4c1f81dadb fix http No release Broker (#2167)
* Update http.go

Exit before deregister is executed

* Create http.go

Exit before deregister is executed
2021-05-13 13:07:25 +01:00
Tt yo 32cb1b435b fix k8s api memory leak (#2166) 2021-05-11 08:58:19 +01:00
Johnson C 8c9c7a5927 fixing string field contains invalid UTF-8 issue (#2164) 2021-05-10 11:25:31 +01:00
Cui Gang 9e9157d878 Fix util/log/log.Infof format didn't work (#2160)
Co-authored-by: Cui Gang <cuigang@yunpbx.com>
2021-05-06 06:43:05 +01:00
Scout Wang 1b5d372b5b optimize the process of switching grpc error to micro error (#2158) 2021-04-29 13:03:40 +01:00
Tobias Wellnitz b11a2f17e9 make rpcClient compatible with 32bit arm systems (#2156)
On ARM, 386, and 32-bit MIPS, it is the caller's responsibility to
arrange for 64-bit alignment of 64-bit words accessed
atomically. Only the first word in an allocated struct can
be relied upon to be 64-bit aligned.
2021-04-25 06:54:00 +01:00
Asim Aslam a91d1f7a3d Update README.md
Run tests / Test repo (push) Waiting to run
2021-04-16 17:34:42 +01:00
Andrew 0d57213d3f Add etcd to default registries when plugin is loaded (#2150)
Co-authored-by: Andrew Jones <andrew@gotoblink.com>
2021-04-08 18:31:39 +01:00
orange-jacky 6ae252b892 add http demo; http client can call http server; http client can call rpc server (#2149) 2021-04-08 18:31:15 +01:00
Asim Aslam e7a7e3a050 Update README.md 2021-04-03 08:39:40 +01:00
Johnson C bed53b605f fixing etcd stack in getToken (#2145)
when provide username and password, etcd will try to get auth token from server
if server is unavailble, etcd client will stack in
when dial timeout is set, it will return err instead of stack in
2021-04-01 09:55:21 +01:00
Asim Aslam 9b41d1bf08 Update README.md 2021-03-29 11:33:59 +01:00
Asim Aslam 0a41e6d80f Update README.md 2021-03-17 09:37:20 +00:00
Asim Aslam b636a4bfe3 Update README.md 2021-03-17 07:52:35 +00:00
Jerry df90f2ca63 Update registry plugins mod version (#2130)
* update etcd version

* update mod version

* update

* update etcd mod version
2021-02-27 06:48:44 +00:00
Asim Aslam 0bf3719a9a remove indirects 2021-02-26 08:34:03 +00:00
Asim Aslam bfa9e7c88c update quic go mod 2021-02-26 08:14:11 +00:00
Asim Aslam 57003414be remove network package 2021-02-26 08:13:12 +00:00
Asim Aslam a54f40baa7 Update README.md 2021-02-25 10:32:47 +00:00
Asim Aslam 56c779f9df Update README.md 2021-02-25 10:31:55 +00:00
Shubhendra Singh Chauhan 26b859c4f9 improve code quality (#2128)
* Fix inefficient string comparison

* Fix unnecessary calls to Printf

* Canonicalize header key

* Replace `t.Sub(time.Now())` with `time.Until`

* Remove unnecessary blank (_) identifier

* Remove unnecessary use of slice

* Remove unnecessary comparison with bool
2021-02-25 08:30:35 +00:00
Alex Unger 0f0ace1a44 support for tls on http plugin (#2126) 2021-02-17 18:20:06 +00:00
Asim Aslam f9f5e7422d fix store delete 2021-02-10 07:14:49 +00:00
Jerry 2653e7a977 update pulgin registry mod version (#2121)
* update etcd version

* update mod version

* update
2021-02-08 08:56:39 +00:00
Jerry 55b477ba07 update etcd version (#2120) 2021-02-07 12:15:06 +00:00
isfk 6f666d63c8 update client/grpc plugins version & remove replace (#2119)
* update memory registry plugins version & remove replace

* update plugins version & remove replace

* update plugins/client/grpc/v3 version

Co-authored-by: 申法宽 <shenfakuan@163.com>
2021-02-05 09:50:42 +00:00
isfk e8167a8b79 update plugins version & remove replace (#2118)
* update memory registry plugins version & remove replace

* update plugins version & remove replace

Co-authored-by: 申法宽 <shenfakuan@163.com>
2021-02-05 09:09:25 +00:00
Asim Aslam 0702501552 Delete Dockerfile 2021-02-02 14:58:31 +00:00
Asim Aslam 89fe31310e Delete docker.yml 2021-02-02 14:58:19 +00:00
Josemy Duarte ca3dfc4580 Remove missing gRPC example from README.md (#2112) 2021-01-30 18:13:56 +00:00
francescocarzaniga bba3107ae1 Remove hpcloud/tail in favour of nxadm/tail (#2109)
Docker / build (push) Waiting to run
Run tests / Test repo (push) Waiting to run
2021-01-25 07:51:17 +00:00
Asim Aslam 60010e82e2 update protoc-gen-micro
Docker / build (push) Waiting to run
Run tests / Test repo (push) Waiting to run
2021-01-20 21:36:17 +00:00
Asim Aslam ad94eeb635 Update README.md
Docker / build (push) Waiting to run
Run tests / Test repo (push) Waiting to run
2021-01-20 21:30:26 +00:00
Asim Aslam 88be70a6af Update README.md 2021-01-20 21:30:10 +00:00
Asim Aslam 226833c4ab Update README.md 2021-01-20 21:29:36 +00:00
Asim Aslam 8e3b7a57d9 examples at v3 2021-01-20 21:28:48 +00:00
Asim Aslam dc8236ec05 update v3 plugins (#2105) 2021-01-20 21:01:10 +00:00
Asim Aslam d94936f6c9 v3 (#2104)
* v3

* revert plugins

* fixup some issues
2021-01-20 13:54:31 +00:00
Goober bf4ab679e1 Fix zk watchDir (#2102)
Signed-off-by: Goober <chenhao86899@gmail.com>
2021-01-05 17:32:17 +00:00
Asim Aslam 20b5755788 move encoders out to plugins 2020-12-30 08:46:31 +00:00
Asim Aslam f64ffdbab1 remove indirects in go mod 2020-12-30 08:26:26 +00:00
Asim Aslam eb1e22bd10 strip grpc 2020-12-30 08:21:30 +00:00
Asim Aslam 18fb7a5d62 move certmagic 2020-12-29 20:12:10 +00:00
Asim Aslam ee8b369a19 add initialisers 2020-12-29 16:50:18 +00:00
Asim Aslam f4f6feafb3 remove etcd store 2020-12-29 16:32:06 +00:00
Asim Aslam 9ddfe696a4 go fmt 2020-12-29 16:29:58 +00:00
Asim Aslam 762fff8a51 Merge branch 'master' of ssh://github.com/asim/go-micro 2020-12-29 16:28:21 +00:00
Asim Aslam 36bcd8317b remove micro deps 2020-12-29 16:28:12 +00:00
Asim Aslam 10005db702 Rename default.go to noop.go 2020-12-29 16:24:31 +00:00
Asim Aslam 1b610403ba go mod tidy 2020-12-29 15:50:14 +00:00
Asim Aslam 2fde8a76eb Merge branch 'master' of ssh://github.com/asim/go-micro 2020-12-29 15:49:33 +00:00
Asim Aslam a7c31a0d2b refactor all the things 2020-12-29 15:49:26 +00:00
Asim Aslam 35d72660c8 Update README.md 2020-12-26 15:42:10 +00:00
Asim Aslam d197438e16 Merge branch 'master' of ssh://github.com/asim/go-micro 2020-12-26 15:32:54 +00:00
Asim Aslam 7fc0b7ef72 add all the plugins 2020-12-26 15:32:45 +00:00
Asim Aslam f44b832bac Update README.md 2020-12-26 15:23:06 +00:00
Asim Aslam 5fe144bda8 Update README.md 2020-12-26 15:22:41 +00:00
Asim Aslam df2dab0169 Update README.md 2020-12-26 15:22:14 +00:00
Asim Aslam 7ab46b0850 rename imports 2020-12-26 15:21:29 +00:00
Asim Aslam c3fe6eb3ac update readme 2020-12-26 15:18:11 +00:00
Asim Aslam a34c70de0e Add examples 2020-12-26 15:17:20 +00:00
Asim Aslam 273bab5dd7 update readme 2020-12-26 15:15:39 +00:00
Asim Aslam f8fc9d0304 Add protoc-gen-micro 2020-12-26 15:13:09 +00:00
Hao b5431de2e8 Use singleflight to prevent registry cache breakdown (#2098) 2020-12-21 14:34:59 +00:00
Asim Aslam dc0cac9ba4 Update README.md 2020-12-18 18:45:14 +00:00
Asim Aslam 8628dc0fc4 Update FUNDING.yml 2020-12-13 08:18:02 +00:00
Asim Aslam b57f56fb0b Merge branch 'master' of ssh://github.com/asim/go-micro 2020-12-12 20:51:40 +00:00
Asim Aslam 690169f6e5 remove k8s logs 2020-12-12 20:51:32 +00:00
Asim Aslam a543157f50 Delete debug.go 2020-12-12 20:50:53 +00:00
Asim Aslam 15a62ae0b9 move debug handler 2020-12-12 20:50:36 +00:00
Asim Aslam 28afbf164f Merge branch 'master' of ssh://github.com/asim/go-micro 2020-12-12 20:44:45 +00:00
Asim Aslam 4ce77373c0 remove auth cruft 2020-12-12 20:44:32 +00:00
Asim Aslam 8de1ede0f0 Update network.go 2020-12-12 20:35:43 +00:00
Asim Aslam 8054478cc3 remove util/scope 2020-12-12 20:28:09 +00:00
Asim Aslam 167fcd0d78 fix wrapper test 2020-12-12 20:25:29 +00:00
Asim Aslam 206bf8cd0a remove web 2020-12-12 20:15:59 +00:00
Asim Aslam df687fe5d4 move selector 2020-12-12 20:14:50 +00:00
Asim Aslam de4f3ee4a2 separate rules and auth 2020-12-12 20:08:39 +00:00
Asim Aslam 202338bd2d update all the things to go 1.15 2020-12-12 19:51:18 +00:00
Asim Aslam e2034b2438 Merge branch 'master' of ssh://github.com/asim/go-micro 2020-12-12 19:39:14 +00:00
Asim Aslam 0ec2399a2c fix command 2020-12-12 19:39:04 +00:00
Asim Aslam df5f158cef Delete .golangci.yml 2020-12-12 19:09:48 +00:00
Asim Aslam 19ac4fbcaf move rules 2020-12-12 19:08:36 +00:00
Asim Aslam d07de3751e remove auth provider 2020-12-12 19:06:43 +00:00
Asim Aslam 4977aca09c move router 2020-12-12 19:04:19 +00:00
Asim Aslam 43ff2a540d move proxy 2020-12-12 19:02:04 +00:00
Asim Aslam 35c59042bf refactor network 2020-12-12 18:59:40 +00:00
Asim Aslam f8f84b42ac Merge branch 'master' of ssh://github.com/asim/go-micro 2020-12-11 21:42:43 +00:00
Asim Aslam 1dc9b40b90 move network/tunnel 2020-12-11 21:42:31 +00:00
Asim Aslam 345845ec16 Delete CNAME 2020-12-11 11:22:37 +00:00
Asim Aslam dbe8c93e20 remove service implementations (#2094) 2020-12-11 11:12:44 +00:00
Asim Aslam 4d481b0363 Update README.md 2020-12-09 21:52:18 +00:00
Asim Aslam 88d954cf97 Update README.md 2020-12-09 18:35:07 +00:00
Asim Aslam 71883f1b04 Update tests.yml 2020-12-09 18:19:37 +00:00
Asim Aslam bfc212f7ed remove service package 2020-12-09 18:11:10 +00:00
Asim Aslam 43f80b1b0d Delete build-micro.sh 2020-12-09 18:09:02 +00:00
Asim Aslam f83d64d092 Delete build-all-examples.sh 2020-12-09 18:08:55 +00:00
Asim Aslam e67b9f0cc1 Delete micro-main.yml 2020-12-09 18:08:39 +00:00
Asim Aslam 134c5f0e41 Delete micro-examples.yml 2020-12-09 18:08:26 +00:00
Asim Aslam e761aa1940 move cmd 2020-12-09 18:07:01 +00:00
Asim Aslam 8c8380dcd4 delete agent package 2020-12-09 18:03:00 +00:00
Asim Aslam dd5eca2561 Update README.md 2020-12-09 17:05:05 +00:00
Dominic Wong 94bd1025a6 push tags to docker hub (#1766)
Docker / build (push) Waiting to run
Run tests / Test repo (push) Waiting to run
2020-07-03 11:30:59 +01:00
Dominic Wong 7be4a67673 MDNS registry fix for users on VPNs (#1759)
* filter out unsolicited responses
* send to local ip in case
* allow ip func to be passed in. add option for sending to 0.0.0.0
2020-07-03 11:30:59 +01:00
Di Wu 3e6ac73cfe Fix invalid usage for sync.WaitGroup (#1752)
* Custom private blocks

* Fix invalid usage for sync.WaitGroup

Co-authored-by: Asim Aslam <asim@aslam.me>
2020-07-03 11:30:59 +01:00
Colin Hoglund aef6878ee0 config: use configured reader by default (#1717) 2020-07-03 11:30:59 +01:00
sunfuze 81aa8e0231 Fix config watch (#1670)
* add dirty overrite test case

* need version to figure out if config need update or not

* using nanosecond as version for two goroutine can run in same second

* config should check snapshot version when update

* set checksum of ChangeSet

Co-authored-by: Asim Aslam <asim@aslam.me>
2020-07-03 11:30:59 +01:00
Di Wu c28f625cd4 Custom private blocks (#1705)
Co-authored-by: Asim Aslam <asim@aslam.me>
2020-07-03 11:30:59 +01:00
Dmitry Kozlov 5b161b88f7 Split long discord output message into the chunks by 2000 characters (#1704)
Signed-off-by: Dmitry Kozlov <dmitry.f.kozlov@gmail.com>
2020-07-03 11:30:59 +01:00
ben-toogood cca8826a1f registry/mdns: fix nil host bug (#1703) 2020-07-03 11:30:59 +01:00
Dominic Wong 0327f30e3c Fix regex detection. Fixes #1663 (#1696)
Docker / build (push) Waiting to run
Run tests / Test repo (push) Waiting to run
2020-06-12 10:42:52 +01:00
Dominic Wong 0ce132eb8f Fix race condition when updating process being waited on (#1694) 2020-06-12 10:42:52 +01:00
Janos Dobronszki 00b76e0a64 Initialize selector before we make an auth.Generate call (#1693) 2020-06-12 10:42:52 +01:00
Dominic Wong aec27be9b4 Fix race when opening DB for first time (#1691) 2020-06-12 10:42:52 +01:00
Dominic Wong 86dfcb819b Ignore "no such process" error (#1686)
* Cleanup how status is updated for service. Ignore "no such process" error as it could be that the pid died

* add nice error log to record process error exit
2020-06-12 10:42:52 +01:00
Janos Dobronszki d613804b0a Sigterm instead of Sigkill (#1687)
Co-authored-by: Dominic Wong <domwongemail@googlemail.com>
Co-authored-by: Asim Aslam <asim@aslam.me>
2020-06-12 10:42:52 +01:00
Vasiliy Tolstov 92e9d05432 api/handler/rpc: dont log error on normal websocket error code (#1688)
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-06-12 10:42:52 +01:00
ben-toogood 8dfd93e915 util/wrapper: Add Static Client wrapper (#1685)
* util/wrapper: Add Static Client wrapper

* util/wrapper/static: pass address to stream too

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>

* add static client wrapper tests

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>

* server: fix error message spaces between words

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>

* server/{rpc,grpc}: replace log.Error with log.Errorf

* server/grpc: fix log typo

* server/rpc: fix log typo

Co-authored-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-06-12 10:42:52 +01:00
Dominic Wong e5136332e3 Add build and test of micro to pre-release testing (#1684)
* fix up example test build

* build and test micro when cutting a new release
2020-06-12 10:42:52 +01:00
Dominic Wong f10fd4b479 Build all micro/examples for release-X.X.X branches (#1683)
* Build all the examples on push to any release branch
2020-06-12 10:42:52 +01:00
ben-toogood 74368026a5 Fix incorrect namespace variable name (merge conflict) (#1677) 2020-06-12 10:42:52 +01:00
ben-toogood fde1aa9d6a Move auth account creation to config/cmd (#1676) 2020-06-12 10:42:52 +01:00
ben-toogood f45cdba9ba Apply wrappers to gRPC streams (#1675)
* Add wrappers to grpc streams

* Fix typo
2020-06-12 10:42:52 +01:00
Asim Aslam b270860b79 Update README.md (#1695) 2020-06-10 10:22:53 +01:00
Asim Aslam e7ba930236 Update FUNDING.yml (#1692) 2020-06-08 18:12:19 +01:00
Dominic Wong aa679f7a73 Create PULL_REQUEST_TEMPLATE.md 2020-06-03 10:32:28 +01:00
Asim Aslam 7b379bf1f1 WIP: Add metadata to store record (#1604)
* Add metadata to store record

* Add metadata to cockroach store

* add metadata to store service implementation

* fix breaking cache test

* Test/fix cockroach metadata usage

* fix store memory metadata bug
2020-06-03 09:45:08 +01:00
Dominic Wong e4e56b0f3f Merge pull request #1671 from sadwxqezc/fix-jwt
Fix jwt revoke
2020-06-02 09:27:14 +01:00
huanghuan.27@bytedance.com 219d29f664 fix jwt revoke 2020-06-02 10:26:33 +08:00
Asim Aslam 8fb138af06 Update README.md 2020-05-31 11:56:55 +01:00
Asim Aslam a39e6515da Update README.md
Docker / build (push) Waiting to run
Run tests / Test repo (push) Waiting to run
2020-05-31 11:35:09 +01:00
Asim Aslam 2c7fd286de Update README.md 2020-05-31 11:34:49 +01:00
Asim Aslam 8aa2712b4d Delete README.zh-cn.md 2020-05-31 11:33:31 +01:00
Asim Aslam b5c2121cef Update README.md 2020-05-31 11:31:41 +01:00
Asim Aslam ca9b877646 Update README.md 2020-05-31 11:28:32 +01:00
Asim Aslam ff49b4fc71 Update README.md 2020-05-31 11:27:54 +01:00
Asim Aslam 222431b57a Update README.md 2020-05-31 11:26:46 +01:00
Asim Aslam ddb51529a7 Update README.md 2020-05-31 11:26:18 +01:00
Asim Aslam 7c048f331a Update README.md 2020-05-31 11:21:55 +01:00
Asim Aslam 8475183bbb Update README.md 2020-05-31 11:19:26 +01:00
Asim Aslam 10f35db3ed Update README.md 2020-05-31 11:16:20 +01:00
Asim Aslam b68af8ab63 run go fmt 2020-05-30 11:00:43 +01:00
Asim Aslam 266602a3d6 Update README.md 2020-05-30 10:59:59 +01:00
mlboy 15d5142d9b fix: misspell (#1667) 2020-05-29 17:49:22 +01:00
Máximo Cuadros 0d88650511 go modules cleanup and remove wrong self import to v1 (#1658)
* Runtime local git, simply go-git code
* go modules cleanup and remove wrong self import to v1
* pin mergo v0.3.8 to avoid panics

Signed-off-by: Máximo Cuadros <mcuadros@gmail.com>
Co-authored-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-05-29 14:32:11 +03:00
Dominic Wong 8660370dc9 Merge pull request #1657 from xpunch/master
logger caller not trim in windows
2020-05-29 10:35:03 +01:00
Dominic Wong 73339dde85 Merge branch 'master' into master 2020-05-29 10:27:20 +01:00
Dominic Wong 3f354f3c30 Merge pull request #1661 from micro/bugfix/sock_pool_threads
fix locking of socket pool
2020-05-28 08:31:47 +01:00
potato c08eb5f892 Merge branch 'master' into master 2020-05-28 10:19:53 +08:00
Dominic Wong 27e41c4ad5 fix locking of socket pool 2020-05-27 20:18:26 +01:00
Dominic Wong 1da8a640da Merge pull request #1660 from micro/bugfix/mdns_nil_host
Check ipv4 or ipv6 address is valid before assigning
2020-05-27 15:53:27 +01:00
Dominic Wong e7ad031eb8 Check ipv4 or ipv6 address is valid before assigning 2020-05-27 15:47:12 +01:00
ben-toogood 192f548c83 Merge pull request #1659 from micro/config-srv-not-found
Handle config service not found errors
2020-05-27 12:24:33 +01:00
Ben Toogood d85b4197b4 Return nil changeset and not blank 2020-05-27 12:20:31 +01:00
Ben Toogood bb5f2e5525 Handle config service not found errors 2020-05-27 12:12:34 +01:00
ben-toogood f00b696282 Merge pull request #1654 from micro/auth-scopes
Auth Improvements
2020-05-27 10:52:07 +01:00
Ben Toogood e2d662608c Fix tests 2020-05-27 09:14:16 +01:00
Ben Toogood 9e9773c9c7 Only use namespace for cache key 2020-05-27 09:07:59 +01:00
potato 2f8e2487f7 Merge branch 'master' into master 2020-05-27 09:32:27 +08:00
Ben Toogood d6c1fbf841 Fix web service auth name 2020-05-26 17:43:45 +01:00
Ben Toogood c3b404bab0 Fix server calling across namespace 2020-05-26 17:35:06 +01:00
Ben Toogood cd283654eb Cache Rules 2020-05-26 15:53:28 +01:00
Ben Toogood 5712cc9c62 Merge master 2020-05-26 15:52:21 +01:00
ben-toogood be5a10a4d4 Merge pull request #1656 from micro/client-cache
Client Cache
2020-05-26 15:38:30 +01:00
Ben Toogood b53a2c67f1 Merge branch 'master' of https://github.com/micro/go-micro into auth-scopes 2020-05-26 15:37:31 +01:00
johnson cc79692d68 make caller filepath package/file style
this code is from zap
https://github.com/uber-go/zap/blob/9a9fa7d4b5f07a9b634983678a65b5525f81e58b/zapcore/entry.go#L101
2020-05-26 14:33:56 +08:00
potato 796a598b37 Merge pull request #7 from micro/master
go micro v2
2020-05-26 14:18:25 +08:00
Ben Toogood 73b4423682 Merge branch 'master' of https://github.com/micro/go-micro into client-cache 2020-05-24 20:36:22 +01:00
Ben Toogood 198e942889 Remove redundant test 2020-05-24 20:32:22 +01:00
Ben Toogood 95703e4565 Fixes and improved test coverage 2020-05-24 20:26:37 +01:00
Ben Toogood 2729569f66 Add Debug.Cache method 2020-05-24 18:45:57 +01:00
Ben Toogood 67146ecdc2 Client Cache tests 2020-05-24 18:05:23 +01:00
Asim Aslam bd049a51e6 Update README.md 2020-05-23 16:47:23 +01:00
Asim Aslam ffd89599a0 Update README.md 2020-05-23 16:46:50 +01:00
Ben Toogood 496293afa1 Use hash/fnv, add tests, fix request bug 2020-05-23 11:34:44 +01:00
Ben Toogood 7d7f4046e8 Client Cache 2020-05-22 16:52:24 +01:00
Ben Toogood c800070477 Check for error before loading rules 2020-05-22 14:03:12 +01:00
Ben Toogood 877fe5fb0a Update web wildcard to enable /foo/bar/baz/* to verify /foo/bar/baz 2020-05-22 14:02:02 +01:00
Ben Toogood dad011cab4 Fix noop issuer bug 2020-05-22 12:40:34 +01:00
Ben Toogood f939200b34 Improve service auth log 2020-05-22 12:24:37 +01:00
Ben Toogood 9c072a372c Add auth scope constants 2020-05-22 11:37:12 +01:00
Ben Toogood fbb91c6cb7 Auth wrapper tests 2020-05-22 10:44:18 +01:00
Ben Toogood b2cf501952 Auth Rules tests & bug fixes 2020-05-22 09:31:15 +01:00
Ben Toogood 1fce0f02b6 Verify Namespace 2020-05-21 18:11:35 +01:00
Ben Toogood 12061bd006 Add account issuers 2020-05-21 16:41:55 +01:00
Ben Toogood 856c73b341 Remove roles (replaced with scope) 2020-05-21 14:56:17 +01:00
Ben Toogood 4de19805ba Remove redundant test 2020-05-21 12:33:58 +01:00
Ben Toogood c09b871a6b Merge branch 'master' of https://github.com/micro/go-micro into auth-scopes 2020-05-21 12:32:52 +01:00
Ben Toogood e876cb917d auth/service support for micro clients (rules from mutltiple namespaces 2020-05-21 12:25:47 +01:00
Ben Toogood 8f5ef012ff Update Rules.Delete proto 2020-05-21 12:07:22 +01:00
Ben Toogood 287992cef3 Fix service => service namespace bug 2020-05-21 11:35:07 +01:00
Ben Toogood 344ce061ce Verify Options 2020-05-20 16:49:52 +01:00
Ben Toogood 5d14970a55 Fix nil account bug 2020-05-20 16:11:34 +01:00
Janos Dobronszki 0615fe825f Auth invalid token fix (#1650) 2020-05-20 16:18:05 +02:00
Asim Aslam 6a661fd08c check if the db conn is nil before doing anything (#1652) 2020-05-20 14:03:38 +01:00
Ben Toogood f6d9416a9e Add Rule to Auth interface 2020-05-20 11:59:01 +01:00
Asim Aslam a29676b86a Registration Retry / Interval (#1651)
* Change the default ttl to 90 seconds

* add retries to registration

* Add retry to web register
2020-05-20 11:49:09 +01:00
Ben Toogood dc10f88c12 Replace auth account.Namespace with account.Scopes 2020-05-19 18:17:17 +01:00
ben-toogood e61edf6280 Merge pull request #1645 from micro/runtime-multitenancy
Runtime multi-tenancy
2020-05-19 17:06:11 +01:00
ben-toogood 3410a0949b Merge branch 'master' into runtime-multitenancy 2020-05-19 17:00:51 +01:00
Jake Sanders 9216a47724 fix client race (#1647) 2020-05-19 14:44:46 +01:00
ben-toogood cf37d64819 Merge branch 'master' into runtime-multitenancy 2020-05-19 13:24:35 +01:00
Patrik Lindahl f0c0f3d4c4 Fixes for #1560 (#1644)
close #1560

This fixes one of the reported data races and also allows for
having a different name on the micro.Service and web.Service.
This makes it possible to discover the two service variants separately.

Co-authored-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-05-19 14:11:26 +03:00
Ben Toogood c4e3f8c336 Merge branch 'master' of https://github.com/micro/go-micro into runtime-multitenancy 2020-05-19 11:02:40 +01:00
Ben Toogood 8875719619 Default Runtime multi-tenancy 2020-05-19 11:01:06 +01:00
Ben Toogood c19b349e96 Update runtime.Event struct 2020-05-19 10:14:07 +01:00
Ben Toogood 14155c7e02 Add runtime ErrNotFound 2020-05-19 09:28:00 +01:00
Maarten Bezemer 3d36398818 Fix client RPC stream close mutex (#1643)
Docker / build (push) Waiting to run
Run tests / Test repo (push) Waiting to run
2020-05-18 17:22:33 +01:00
Asim Aslam 56a7897c91 update readme 2020-05-17 12:39:20 +01:00
ben-toogood 5efb386224 Merge pull request #1640 from micro/auth/public-rule
Auth: setup a public rule
2020-05-15 10:28:52 +01:00
Ben Toogood 4d2de923cd Auth: setup a public rule 2020-05-15 10:24:30 +01:00
ben-toogood f64b1468a5 Merge pull request #1639 from micro/registy-not-found
Registry service: return not found error
2020-05-14 19:43:19 +01:00
ben-toogood 56f281002b Merge branch 'master' into registy-not-found 2020-05-14 19:39:43 +01:00
Ben Toogood 0d7250352f Registry service: return not found error 2020-05-14 19:38:56 +01:00
ben-toogood ef43f01da4 Merge pull request #1638 from micro/registry-addrs-fix
Fix registry address option unused
2020-05-14 18:07:14 +01:00
ben-toogood c9e5ae6a2b Merge branch 'master' into registry-addrs-fix 2020-05-14 18:03:46 +01:00
Ben Toogood 8a802d8f7a Fix registry address option unused 2020-05-14 18:00:13 +01:00
ben-toogood 331ab3715c Merge pull request #1636 from micro/auth-util
Refactor auth setup to util/auth
2020-05-14 16:15:47 +01:00
Ben Toogood 6b451a2197 Refactor auth setup to util/auth 2020-05-14 16:10:14 +01:00
ben-toogood b4c0224746 Merge pull request #1635 from micro/auth-fixes
Auth: Move token generation logic out the client wrappers
2020-05-14 14:00:55 +01:00
Ben Toogood 500d793fc4 Merge branch 'auth-fixes' of https://github.com/micro/go-micro into auth-fixes 2020-05-14 13:57:00 +01:00
Ben Toogood 16af265e8b Seperate JWT refresh / access tokens 2020-05-14 13:56:51 +01:00
ben-toogood b222cf8e13 Merge branch 'master' into auth-fixes 2020-05-14 13:47:26 +01:00
Ben Toogood f549e20fa2 tidy go mdo 2020-05-14 13:33:11 +01:00
Ben Toogood 83e9c1fad2 Remove unnecessary change 2020-05-14 13:32:42 +01:00
Ben Toogood c220686c29 Fix token bug 2020-05-14 13:30:21 +01:00
Ben Toogood 1b18730d54 Custom micro client 2020-05-14 11:25:19 +01:00
Ben Toogood 5764519f5b Refactor auth to load token outside wrappers 2020-05-14 11:06:22 +01:00
ben-toogood 957001f8ad Merge pull request #1634 from micro/disable-clients
Disable Clients
2020-05-13 18:54:34 +01:00
Ben Toogood 0955671e45 Merge branch 'disable-clients' of https://github.com/micro/go-micro into disable-clients 2020-05-13 18:49:47 +01:00
Ben Toogood 57b060bac5 Disable Addresses 2020-05-13 18:49:36 +01:00
ben-toogood 3136e1409e Merge branch 'master' into disable-clients 2020-05-13 18:48:24 +01:00
Ben Toogood ca791d7e8d Disable Clients 2020-05-13 18:47:53 +01:00
Dominic Wong 05858b746c kill all processes correctly for micro kill command (#1633) 2020-05-13 18:36:45 +01:00
ben-toogood 09d1450d7d Merge pull request #1632 from micro/fix-auth-bug
Auth: Fix recursive bug
2020-05-13 18:18:39 +01:00
Ben Toogood 1ca1fd411a Auth: Fix recursive bug 2020-05-13 18:17:04 +01:00
ben-toogood a2d4d62f1c Merge pull request #1631 from micro/auth-address
Auth: Set address
2020-05-13 18:02:10 +01:00
Ben Toogood 8ab20f501c Fix merge conflicts 2020-05-13 17:58:03 +01:00
Ben Toogood 366fb228e5 Auth: Set address 2020-05-13 17:54:47 +01:00
Asim Aslam bba8c254d7 fix auth initialisation (#1630) 2020-05-13 17:35:57 +01:00
ben-toogood ebd53794af Merge pull request #1629 from micro/auth/rules-fix
Auth: Load rules if not present
2020-05-13 17:27:53 +01:00
Ben Toogood 2299244332 Auth: Load rules if not present 2020-05-13 17:07:46 +01:00
ben-toogood cf61d98635 Merge pull request #1628 from micro/registry
Misc Muti-Tenancy / Auth Fixes
2020-05-13 16:53:39 +01:00
ben-toogood 15d1967aaf Merge branch 'master' into registry 2020-05-13 16:50:12 +01:00
Ben Toogood 410fec8ee4 Fix auth bug 2020-05-13 16:49:17 +01:00
Ben Toogood c831b6c03a Fix 2020-05-13 16:35:57 +01:00
Asim Aslam 290595f88e Strip down router code (#1627) 2020-05-13 16:13:36 +01:00
ben-toogood ba64518ebd Merge pull request #1626 from PieterVoorwinden/master
Check if auth is nil to prevent nilpointer
2020-05-13 15:18:58 +01:00
Pieter Voorwinden b14d63b4a1 Check if auth is nil to prevent nilpointer 2020-05-13 16:13:23 +02:00
x1nchen af2db0a0d9 fix: update dependency certmagic (#1625)
module github.com/mholt/certmagic has been renamed github.com/caddyserver/certmagic,
so upgrade on this module will fail.

fix: micro/micro#835

caddyserver/certmagic@v0.10.6 is Maximum upgradeable version with go version 1.13

Higher version use *tls.ClientHelloInfo.SupportsCertificate which only supported in go 1.14
2020-05-13 15:00:13 +01:00
ben-toogood fb255a7e5a Merge pull request #1622 from micro/registry-multi-tenancy
Registry mutli-tenancy
2020-05-13 13:54:39 +01:00
Ben Toogood 47c1cb433e Store account credentials 2020-05-13 13:48:25 +01:00
Ben Toogood 3fac7d79ab Remove service type role 2020-05-13 13:42:56 +01:00
Ben Toogood 25c937fd0e Naming changes 2020-05-13 13:38:13 +01:00
Ben Toogood e5c1fbc591 Merge branch 'master' of https://github.com/micro/go-micro into registry-multi-tenancy 2020-05-13 13:35:47 +01:00
Ben Toogood d781c9ae2d Remove namespace specific logic 2020-05-13 13:35:34 +01:00
Ben Toogood 54951740bf Authenticate on service start 2020-05-13 13:13:11 +01:00
Janos Dobronszki 0fb4734e67 Upload local source code to micro server (#1613) 2020-05-13 12:07:53 +02:00
Ben Toogood 346e034d0a Add mutli-tenancy support to the registry 2020-05-13 10:40:08 +01:00
Asim Aslam 116cc1e9ee Stop parsing proxy address (#1619) 2020-05-12 17:38:22 +01:00
ben-toogood 762a5bc9e8 Merge pull request #1618 from micro/auth-namespace-flag
Auth Namespace Flag
2020-05-12 16:45:42 +01:00
Ben Toogood d39b723511 Auth Namespace Flag 2020-05-12 16:41:29 +01:00
ben-toogood 5494e935f4 Merge pull request #1617 from micro/k8s/secret-type
K8s: Add Secret Type to yaml template
2020-05-12 14:21:30 +01:00
Ben Toogood e0863bb7eb K8s: Add Secret Type to yaml template 2020-05-12 14:10:39 +01:00
ben-toogood 89f86167ad Merge pull request #1616 from micro/k8s/secret-template-fix
Fix k8s secret template (yaml)
2020-05-12 11:45:12 +01:00
ben-toogood dfec1ad6b1 Merge branch 'master' into k8s/secret-template-fix 2020-05-12 11:41:41 +01:00
Ben Toogood 66d3e4a595 Fix k8s secret template (yaml) 2020-05-12 11:40:54 +01:00
Asim Aslam 19a03babc4 Update server.go 2020-05-12 11:32:01 +01:00
ben-toogood ee24b4f083 Merge pull request #1615 from micro/disable-auth-client
Disable auth service client
2020-05-11 20:38:49 +01:00
Ben Toogood 937ecc8d2f Disable auth service client 2020-05-11 20:38:05 +01:00
ben-toogood 6078adb8bc Merge pull request #1614 from micro/runtime-clients
Runtime Options: Replace client.DefaultClient
2020-05-11 20:05:00 +01:00
ben-toogood 39f18b0b70 Merge branch 'master' into runtime-clients 2020-05-11 18:03:11 +01:00
Ben Toogood efb64b7dbb Pass client to more of the runtime 2020-05-11 17:57:39 +01:00
Ben Toogood f892b41299 Add runtime to service.Options() 2020-05-11 17:09:28 +01:00
Janos Dobronszki 1eb63635b5 Adding file upload and download capabilities (#1610) 2020-05-11 14:08:27 +02:00
ben-toogood 688228377b Merge pull request #1612 from micro/auth-options
Auth: pass options in service RPC
2020-05-11 11:53:38 +01:00
Ben Toogood 506006f0fa Auth Options 2020-05-11 11:47:59 +01:00
ben-toogood 22de001a80 Merge pull request #1611 from micro/auth-has-role
Auth account.HasRole
2020-05-11 11:40:20 +01:00
ben-toogood d90cc8bf2f Merge branch 'master' into auth-has-role 2020-05-11 11:36:06 +01:00
Ben Toogood 5a8f19589b Auth account.HasRole 2020-05-11 11:34:22 +01:00
gggwvg d61df6363b web: fix advertise address (#1608)
* web: fix advertise address
* web: fix test

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
Co-authored-by: Asim Aslam <asim@aslam.me>
Co-authored-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-05-08 12:31:03 +03:00
ben-toogood f062013a7b Merge pull request #1607 from micro/k8s-debug
Log k8s Requests
2020-05-07 11:41:43 +01:00
Ben Toogood fea93a5b7a Log k8s Requests 2020-05-07 11:35:56 +01:00
fztcjjl 30dc29e17f fix ring buffer (#1606) 2020-05-07 10:45:48 +01:00
ben-toogood 5387f73b5d Handle cockroach createDB error (#1603) 2020-05-06 10:58:14 +01:00
Vasiliy Tolstov 90dd1f63c8 api/handler/rpc: fix encoding of inner message (#1601)
* api/handler/rpc: fix encoding of inner message

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-05-04 15:50:53 +03:00
Asim Aslam 38cdb9cc2f Set table name in store
Docker / build (push) Waiting to run
Run tests / Test repo (push) Waiting to run
2020-05-01 18:24:35 +01:00
Asim Aslam b3915b6020 Add store to options (#1600) 2020-05-01 18:05:09 +01:00
Asim Aslam 08a2de1ef5 Account for missing options database/table in cockroach store 2020-05-01 15:31:55 +01:00
Asim Aslam 7a2dea6cc2 Set database/table from init first 2020-05-01 15:22:44 +01:00
Asim Aslam 2a14feed93 force codec on call not on dial (#1599) 2020-05-01 14:59:50 +01:00
Asim Aslam e8105d22ad cruft 2020-05-01 00:25:17 +01:00
Asim Aslam c76a5e608d sql fixes 2020-04-30 23:53:54 +01:00
Asim Aslam 359b8bc503 Add opts to service proto (#1517)
* Add opts to service proto

* Support database/table opts
2020-04-30 22:51:25 +01:00
Janos Dobronszki fccab8ad27 Runtime name should be base folder outside repos (#1598) 2020-04-30 18:20:51 +02:00
Socket 46d09ec2bc unsubscribe can async (#1596)
Co-authored-by: huangshaojie <huangshaojie@corp.netease.com>
Co-authored-by: Asim Aslam <asim@aslam.me>
2020-04-30 10:42:13 +01:00
Asim Aslam 7792dbc34d Update FUNDING.yml 2020-04-29 18:45:55 +01:00
ben-toogood 1d29f126f9 Merge pull request #1595 from micro/auth-client-wrapper
Auth Client Wrapper
2020-04-29 15:43:30 +01:00
Ben Toogood bcddb98867 Fix Tests 2020-04-29 15:37:02 +01:00
Ben Toogood f48dec1fb0 Use Server ID in account name 2020-04-29 15:27:18 +01:00
Ben Toogood ef9f65c78b Improve Comments 2020-04-29 15:15:38 +01:00
Ben Toogood 99f8be5b3d Auth Client Wrapper 2020-04-29 15:11:06 +01:00
ben-toogood 9d2fdb84be Merge pull request #1592 from micro/jwt-auth
JWT auth implementation
2020-04-29 14:10:05 +01:00
ben-toogood 8b004feb9a Merge branch 'master' into jwt-auth 2020-04-29 13:33:47 +01:00
Ben Toogood 70736e24c0 Set RefreshToken 2020-04-29 13:33:22 +01:00
Vasiliy Tolstov d44adafca5 api/router: avoid unneeded loops and fix path match (#1594)
* api/router: avoid unneeded loops and fix path match

* if match found in google api path syntax, not try pcre loop
* if path is not ending via $ sign, append it to pcre to avoid matching other strings like
  /api/account/register can be matched to /api/account
* api: add tests and validations

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-04-29 15:23:10 +03:00
ben-toogood e57b20c1f8 Merge branch 'master' into jwt-auth 2020-04-29 13:22:09 +01:00
Ben Toogood 94971aee77 Complete JWT implementation 2020-04-29 13:21:51 +01:00
Ben Toogood 0ed66d0664 Fix Typo 2020-04-29 09:38:39 +01:00
Ben Toogood 7e27c97c6c Remove Comment 2020-04-29 09:22:15 +01:00
Ben Toogood 669364985e JWT auth implementation 2020-04-29 09:21:17 +01:00
Asim Aslam c7440274dd touch 2020-04-28 19:35:13 +01:00
Asim Aslam 8ccbf53dfc secret cookie unused 2020-04-28 18:12:07 +01:00
Asim Aslam f908110fb6 swap out context access for account (#1589) 2020-04-28 17:35:18 +01:00
Vasiliy Tolstov 9bb1904a38 broker: add publish context (#1590)
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-04-28 19:29:00 +03:00
Vasiliy Tolstov 06220ab8c8 client: add context publish option (#1588)
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-04-28 19:03:37 +03:00
Janos Dobronszki da66561d1e Fixing too large offsets for default runtime logs (#1587) 2020-04-28 13:42:15 +01:00
Dmitry Kozlov 52861310b0 fix HTTP 401 Unauthorized, {"message": "401: Unauthorized", "code": 0} (#1586)
fix file=bot.go:426 level=error service=bot error starting bot HTTP 401 Unauthorized, {"message": "401: Unauthorized", "code": 0}
see https://github.com/bwmarrin/discordgo#usage
2020-04-28 13:06:01 +01:00
Vasiliy Tolstov 414b2ec5f8 web: fix deadlock (#1585)
* web: fix deadlock

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>

* add web tests

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-04-28 12:23:52 +01:00
Janos Dobronszki b875868a39 Don't ignore errors from checkout source code (#1584)
Don't check out code for builtin services.
2020-04-28 10:51:39 +02:00
Janos Dobronszki 8148e0a0f8 Micro log fixes (#1570) 2020-04-28 09:49:39 +02:00
ben-toogood 25c82245b1 Merge pull request #1582 from micro/k8s-srv-accounts
Runtime: Add Kubernetes ServiceAccounts & Remove imagePullSecrets
2020-04-27 15:24:16 +01:00
ben-toogood 95a7e21f5f Merge branch 'master' into k8s-srv-accounts 2020-04-27 15:08:24 +01:00
Asim Aslam 83ab47333f rename Codec to Secrets (#1581) 2020-04-27 14:57:57 +01:00
Ben Toogood 8d7d6ef358 Add k8s secrets 2020-04-27 14:37:28 +01:00
Ben Toogood 494e0b5060 Runtime: Add Kubernetes ServiceAccounts & Remove imagePullSecrets 2020-04-27 14:13:51 +01:00
Janos Dobronszki 434997e676 Display only logging file name as opposed to path in logs (#1580) 2020-04-27 09:55:50 +01:00
Janos Dobronszki ec44b67e9f Fixing log file path in logs (#1578) 2020-04-27 09:36:09 +01:00
Vasiliy Tolstov e0c9234c0e web: use default logger (#1577)
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-04-27 00:03:05 +03:00
Vasiliy Tolstov 980b772801 fix races in web and logger (#1576)
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-04-26 17:41:36 +03:00
Vasiliy Tolstov a22da39e1c logger: add caller info to default implementation (#1575)
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-04-26 17:11:53 +03:00
徐旭 7253635cd3 delete invalid copy (#1573)
* prealloc

* delete invalid copy
2020-04-26 12:44:59 +01:00
Asim Aslam 0a030f3d8a strip unused list endpoint 2020-04-24 18:05:38 +01:00
Asim Aslam edee3b6765 Add proxy env test (#1569) 2020-04-24 11:26:46 +01:00
Asim Aslam d62ae23a9c Strip label 2020-04-23 20:20:48 +01:00
Asim Aslam c68226e9b0 only do namespace check if not default 2020-04-23 19:19:13 +01:00
ben-toogood 041d68b1ce Merge pull request #1566 from micro/image-pull-secret-fix
Fix Runtime Namespace List
2020-04-23 18:16:38 +01:00
ben-toogood 85a8f36565 Merge branch 'master' into image-pull-secret-fix 2020-04-23 18:15:04 +01:00
Ben Toogood f34d58cfbd Remove Debug 2020-04-23 18:14:06 +01:00
Asim Aslam e0a651bfc3 set namespace on create 2020-04-23 18:10:13 +01:00
Ben Toogood cd35f503a0 Remove hardcoded labels 2020-04-23 18:08:02 +01:00
Ben Toogood 8b3d223fc0 Remove hardcoded labels: 2020-04-23 18:05:58 +01:00
Ben Toogood bb25bd94c8 Log k8s requests 2020-04-23 17:56:00 +01:00
ben-toogood 986e3d3c35 Merge pull request #1565 from micro/image-pull-secret-fix
Runtime: Fix ImagePullSecret
2020-04-23 17:53:09 +01:00
Ben Toogood 616db3442a Debugging 2020-04-23 17:44:40 +01:00
Ben Toogood 5fe3c0bfe5 Merge branch 'image-pull-secret-fix' of https://github.com/micro/go-micro into image-pull-secret-fix 2020-04-23 17:37:33 +01:00
Ben Toogood 8849b85a7f Merge branch 'master' of https://github.com/micro/go-micro into image-pull-secret-fix 2020-04-23 17:37:15 +01:00
ben-toogood 893bbafa03 Merge branch 'master' into image-pull-secret-fix 2020-04-23 17:28:06 +01:00
Ben Toogood 4c05623a3c Image pull secret fix 2020-04-23 17:26:59 +01:00
Asim Aslam ec929b3d2f log error and ensure we pass through namespace 2020-04-23 17:14:30 +01:00
Asim Aslam 2299559397 Check for namespace (#1564) 2020-04-23 16:22:41 +01:00
ben-toogood 6be53536d3 Merge pull request #1562 from micro/git-secrets
Runtime - Image Pull Secrets
2020-04-23 15:45:32 +01:00
ben-toogood 99d4b2b31a Merge branch 'master' into git-secrets 2020-04-23 15:39:37 +01:00
Janos Dobronszki ff8ad7d4ca Default runtime now checks out code on demand (#1563)
* Default runtime now checks out code on demand

* Go mod tidy
2020-04-23 16:30:43 +02:00
ben-toogood b692c045b5 Merge branch 'master' into git-secrets 2020-04-23 15:01:47 +01:00
Ben Toogood b5f53595ca Pass image_pull_secrets in runtime service 2020-04-23 14:22:23 +01:00
Ben Toogood 88176dca53 Remove debugging 2020-04-23 14:13:07 +01:00
Ben Toogood 020476614c Tweak CreateImagePullSecret 2020-04-23 14:06:33 +01:00
Ben Toogood 0f42346976 Additonal Debugging 2020-04-23 14:03:04 +01:00
ben-toogood 692b27578c Runtime Namespace (#1547)
* Add context option to runtime; Add dynamic namespace to kubectl client

* Add namespace runtime arg

* Fixes & Debugging

* Pass options in k8s runtime

* Set namespace on k8s resources

* Additional Logging

* More debugging

* Remove Debugging

* Ensure namespace exists

* Add debugging

* Refactor namespaceExists check

* Fix

* Fix

* Fix

* Fix

* Change the way we check for namespace

* Fix

* Tidying Up

* Fix Test

* Fix merge bugs

* Serialize k8s namespaces

* Add namespace to watch

* Serialize namespace when creating k8s namespace

Co-authored-by: Ben Toogood <ben@micro.mu>
Co-authored-by: Asim Aslam <asim@aslam.me>
2020-04-23 13:53:42 +01:00
Micro 316b81f790 Debugging 2020-04-23 13:11:00 +01:00
Micro 5e3262a62c Passs img pull secrets using name key 2020-04-23 12:52:59 +01:00
Micro 053fa0e457 Fix template syntax 2020-04-23 12:38:00 +01:00
Micro 501a6bf3ea Add imagePullSecrets to PodSpec 2020-04-23 12:27:36 +01:00
Asim Aslam 7345ce9192 change logging for service startup 2020-04-23 11:24:39 +01:00
Vasiliy Tolstov 6fa27373ed bundle qson lib in util (#1561)
* copy qson from https://github.com/joncalhoun/qson
  as author not want to maintain repo
* latest code contains our fix to proper decode strings
  with escaped & symbol
* replace package in api/handler/rpc

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-04-23 11:08:09 +03:00
徐旭 e55c23164a fix prealloc in trace (#1558) 2020-04-22 16:10:59 +03:00
Asim Aslam e25ab9f4ca Fix typo for proxy 2020-04-22 10:44:34 +01:00
Vasiliy Tolstov bea092f082 server: set registered only after configuring subscribers (#1557)
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-04-21 23:01:59 +03:00
Asim Aslam d7ecb58f6c Add network proxying (#1556)
* Add network proxying

* go fmt
2020-04-21 15:54:40 +01:00
Jake Sanders 05d2b34e10 Add util/pki for creating and signing certificates (#1555) 2020-04-21 15:03:33 +01:00
ben-toogood 211fd9b9a3 Merge pull request #1554 from micro/oauth-login-hint
Add oauth login hint param
2020-04-21 13:40:47 +01:00
Ben Toogood 19f0836e70 Add oauth login hint param 2020-04-21 13:37:26 +01:00
Janos Dobronszki 075d7d4fef Renaming ShutdownSignals -> Shutdown (#1553) 2020-04-21 14:14:20 +02:00
Janos Dobronszki e5c215556e Add SIGKILL to shutdown signals (#1552)
* Add SIGKILL to shutdown signals

* go mod tidy

* Add missing file
2020-04-21 14:00:12 +02:00
Janos Dobronszki 7c31edd5f8 Enabling default runtime to run multiple versions (#1545)
* Enabling default runtime to run multiple versions

* Trigger build

* Fix

* Sprintf
2020-04-20 15:54:29 +02:00
Asim Aslam c4acf3c2cb Static serving disabled 2020-04-19 20:30:38 +01:00
Asim Aslam 53db26a614 Use go.micro.mu 2020-04-19 17:03:25 +01:00
Asim Aslam dde8f18b52 Update readme 2020-04-19 00:46:33 +01:00
Asim Aslam 6071b74fb5 Update readme 2020-04-19 00:45:29 +01:00
Asim Aslam ab041012b2 Update readme 2020-04-19 00:44:52 +01:00
Asim Aslam 226d6ad22b log whats happening in http handler 2020-04-19 00:41:03 +01:00
Asim Aslam a08ff90976 fix this bs logging issue 2020-04-18 23:36:00 +01:00
Asim Aslam ae8404d760 Log listening port 2020-04-18 23:32:20 +01:00
Vasiliy Tolstov f00fd7a49e api/router: support pcre and google.api pattern matching (#1549)
* api/router: support pcre and google.api pattern matching

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-04-19 00:31:34 +03:00
Asim Aslam ecbc42755c set network nodes in http resolver 2020-04-18 21:00:00 +01:00
Asim Aslam 16db76bee2 remove list endpoint from runtime and stop checking type in update 2020-04-17 17:54:34 +01:00
Asim Aslam dca5305e8a replaced build with updated timestamp in runtime 2020-04-17 16:29:05 +01:00
Asim Aslam c0b0f63757 Update docker workflow to push releases 2020-04-17 10:50:44 +01:00
Janos Dobronszki ac5822f1ee Fix local runtime updates (#1543) 2020-04-16 17:50:24 +02:00
ben-toogood ae56becbbd Merge pull request #1542 from micro/stream-auth
Set authorization header on grpc stream
2020-04-16 15:06:19 +01:00
ben-toogood 5bb18e685e Merge branch 'master' into stream-auth 2020-04-16 15:03:12 +01:00
Ben Toogood 2dfaab439c Set authorization header on grpc stream 2020-04-16 15:01:16 +01:00
Vasiliy Tolstov 62cedf64da api/router/registry: extract path based parameters from url to req (#1530)
Run tests / Test repo (push) Waiting to run
* api/router/registry: extract path based parameters from url to req
* api/handler/rpc: fix empty body request parsing
* bundle grpc-gateway util funcs

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-04-15 17:50:51 +03:00
ben-toogood 9961ebb46e Merge pull request #1538 from micro/rule-priority
Add priority to auth.CreateRequest and auth.DeleteRequest
2020-04-15 11:54:01 +01:00
Ben Toogood fe31a71557 Fix formatting 2020-04-15 11:50:52 +01:00
Ben Toogood c9a6b07c52 Add priority to auth.CreateRequest and auth.DeleteRequest 2020-04-15 11:49:24 +01:00
ben-toogood f1e6eff303 Merge pull request #1537 from micro/rule-priority
Add Priority to auth rules
2020-04-15 11:42:53 +01:00
Ben Toogood 2de03e5fd7 Tidy go mod 2020-04-15 11:39:53 +01:00
Ben Toogood 234c192faf Update protoc-gen-micro 2020-04-15 11:39:12 +01:00
Ben Toogood ea29920afb Add Priority to auth rules 2020-04-15 11:31:19 +01:00
Vasiliy Tolstov 4d177a782e vendor proto files from google (#1536)
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-04-15 13:22:32 +03:00
Vasiliy Tolstov b700d425a4 api/handler/rpc: improvements and fixes (#1535)
* api/handler/rpc: fix empty body case
* api/handler/rpc: copy all request headers to metadata

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-04-15 01:37:15 +03:00
Asim Aslam 9a5b8ff50d use api 2020-04-14 22:14:55 +01:00
Asim Aslam c787fd0483 fix missing pointer 2020-04-14 17:13:38 +01:00
Asim Aslam 1134ea5ff3 make proto.Message compatible with raw json 2020-04-14 16:59:24 +01:00
ben-toogood fd16cd298f Merge pull request #1532 from micro/registry-namespace
Registry Namespace
2020-04-14 16:14:18 +01:00
ben-toogood 67e7aa223a Merge branch 'master' into registry-namespace 2020-04-14 16:03:29 +01:00
Asim Aslam 9d0381306d add a proto message without serialisation 2020-04-14 15:54:25 +01:00
ben-toogood f8837bfcbd Merge branch 'master' into registry-namespace 2020-04-14 15:37:44 +01:00
Vasiliy Tolstov 268651df18 regenerate all proto based files (#1531)
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-04-14 16:25:09 +03:00
Ben Toogood e17825474f Add context options to the runtime 2020-04-14 12:32:59 +01:00
Ben Toogood 0c75a0306b Merge master into registry-namespace 2020-04-14 09:15:13 +01:00
Ben Toogood d61d30ef66 Inject Namespace into Context 2020-04-14 09:14:07 +01:00
Asim Aslam 71d4253927 Merge branch 'master' of ssh://github.com/micro/go-micro 2020-04-13 23:05:47 +01:00
Asim Aslam e515005083 Remove only allowing certain methods 2020-04-13 23:05:39 +01:00
Asim Aslam 4bdc18d64a Update README.md 2020-04-13 22:15:21 +01:00
Asim Aslam f840a5003e Remove runtime List 2020-04-12 23:46:06 +01:00
Asim Aslam 5ef1698632 remove readme 2020-04-12 23:43:55 +01:00
Asim Aslam 1bb6967a38 reorder 2020-04-12 23:41:21 +01:00
Asim Aslam a056bdce7c fix metadata parsing 2020-04-12 14:40:37 +01:00
Asim Aslam b08c636b44 fixup handler tests 2020-04-12 14:29:38 +01:00
Asim Aslam d03a02f2e4 fix import 2020-04-12 11:25:12 +01:00
Asim Aslam 08ca61c121 add metadata set 2020-04-12 11:17:23 +01:00
Asim Aslam 962588b649 Strip MetadataKey global var 2020-04-12 11:16:08 +01:00
Asim Aslam cf67d460b7 strip down mdns watcher 2020-04-12 11:01:09 +01:00
Asim Aslam 4e539361fa strip file 2020-04-12 10:58:12 +01:00
Vasiliy Tolstov 3ce2ab88f5 broker/nats: remove embed nats server reference (#1527)
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-04-11 22:37:29 +03:00
Vasiliy Tolstov 0a2363b49b api minor improvements (#1526)
* api/handler/rpc: unblock all http methods and set Host meta
* api/router/static: add debug log

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-04-11 22:21:55 +03:00
Asim Aslam ec80ceb8c2 Update readme 2020-04-11 18:23:37 +01:00
Asim Aslam ea2bb0275c Strip external use of mdns 2020-04-11 13:02:53 +01:00
Asim Aslam 51d4f737b8 fixup store cache# 2020-04-11 12:10:19 +01:00
Asim Aslam 3f81f685df Move sync 2020-04-11 12:00:34 +01:00
Asim Aslam bb1ccf09e8 prefix store dir 2020-04-11 11:23:41 +01:00
Asim Aslam c878237567 fix log file creation 2020-04-11 11:22:02 +01:00
Asim Aslam ac8b6f944e Prefix logs dir micro/logs for runtime 2020-04-11 11:15:01 +01:00
Asim Aslam 0f2006ac50 fix compilation issues 2020-04-11 11:02:06 +01:00
Asim Aslam c697eed1be Update comments 2020-04-11 10:48:32 +01:00
Asim Aslam b887d91f94 remove readme 2020-04-11 10:38:13 +01:00
Asim Aslam 39470c1b11 Completely replace sync implementation 2020-04-11 10:37:54 +01:00
Asim Aslam 6d553cb6fe add whitespace 2020-04-11 09:34:04 +01:00
Asim Aslam c612d86480 Move sync store 2020-04-11 09:33:10 +01:00
Asim Aslam 3f3d2f5027 fixup broker http address 2020-04-11 01:51:26 +01:00
Vasiliy Tolstov bc71640fd9 broker: swap default broker from eats to http (#1524)
* broker: swap default broker from eats to http

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-04-11 03:46:54 +03:00
Asim Aslam b979db6d9d remove sync event 2020-04-10 23:29:15 +01:00
Asim Aslam 57b758db7e push 2020-04-10 22:09:06 +01:00
Asim Aslam b5f546b137 go mod tidy 2020-04-10 19:55:45 +01:00
Asim Aslam d4b2c948dd Remove cloudflare store 2020-04-10 19:50:57 +01:00
Asim Aslam b9a5e9d610 fixup sync map 2020-04-10 17:47:13 +01:00
Asim Aslam 57853b2849 remove etcd store 2020-04-10 17:43:02 +01:00
Asim Aslam e5268dd0a6 move reg util to own package (#1523)
* move reg util to own package

* fix test

* fix broken static router
2020-04-10 17:41:10 +01:00
Asim Aslam 4fd12430d0 cleanup mdns files 2020-04-10 17:19:26 +01:00
Asim Aslam d134b469be rename file 2020-04-10 17:17:24 +01:00
Asim Aslam 9a685b2df5 delete k8s registry (#1522) 2020-04-10 17:15:20 +01:00
Jake Sanders 6a666c9c7d Add json tags to store.Record (#1518) 2020-04-09 19:38:43 +01:00
Asim Aslam 53549b6b30 Add options for Database/Table (#1516)
* Add options for Database/Table

* fix opts
2020-04-09 17:56:13 +01:00
Jake Sanders 0a27a08184 Add Databases and Tables endpoints to store RPC proto (#1515)
* Add Databases and Tables to store RPC

* add Database to TablesRequest
2020-04-09 16:37:32 +01:00
Janos Dobronszki 77f0abb0ba Enabling micro run for subfolders (#1510)
* Enabling micro run for subfolders

* Use source instead of os.Args[2]

* Works now

* PR comments

* WorkDir -> Dir
2020-04-09 15:44:39 +01:00
Asim Aslam 29cccd0b4a minor tweak add log line to proxy and basic auth provider by default (#1513) 2020-04-09 14:10:17 +01:00
ben-toogood bf65dc71c7 Merge pull request #1505 from micro/resover-refactor
Extract Micro Resolver (Namespace)
2020-04-09 13:14:49 +01:00
Asim Aslam 5bc8ee39f7 Merge branch 'master' into resover-refactor 2020-04-09 13:07:05 +01:00
Vasiliy Tolstov 8c1b477279 store/cockroach: fixup test (#1512)
* store/cockroach: fixup test

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-04-09 14:58:50 +03:00
Ben Toogood f9cfbe96c0 Merge master into resover-refactor 2020-04-09 12:42:34 +01:00
Jake Sanders 2e379ca7d0 Don't break the build! 2020-04-09 12:18:02 +01:00
Jake Sanders 2659215d5e cockroachDB doesn't support this syntax (#1509) 2020-04-09 12:11:24 +01:00
Vasiliy Tolstov 1063b954de dont display t.Log/t.Logf as errors in github actions (#1508)
* fix tests and github action annotations

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-04-09 14:05:46 +03:00
Ben Toogood 4ff959ef50 Dynamic Namespace 2020-04-09 11:03:33 +01:00
Janos Dobronszki bc1c8223e6 Remove ugly unneeded log in runtime local (#1507) 2020-04-09 11:50:12 +02:00
Ben Toogood 27eb7db1c2 Add default resolver to api router 2020-04-09 10:34:21 +01:00
Ben Toogood 3ede494945 Change import name 2020-04-09 10:32:08 +01:00
Ben Toogood f102aba4c1 Fix HTTP tests 2020-04-09 10:28:38 +01:00
Asim Aslam f2dd091ec0 strip log 2020-04-09 10:28:16 +01:00
Asim Aslam c1ad6d6c7c set service name in web 2020-04-09 09:41:50 +01:00
Jake Sanders 1e7cd8c484 Make the constraint explicit rather than inferred (#1506) 2020-04-08 23:52:35 +01:00
Asim Aslam bf8ebf8ad2 add namespace 2020-04-08 23:27:32 +01:00
Asim Aslam 1768958af7 fix typo 2020-04-08 22:50:56 +01:00
Asim Aslam bf41d8d28e fix store table env var 2020-04-08 19:44:49 +01:00
Asim Aslam 45700eaabe set database/table in header 2020-04-08 19:25:57 +01:00
Asim Aslam 48dd30c4c2 fix http test 2020-04-08 19:20:43 +01:00
Ben Toogood 8ff86ae08b Extract micro resolver 2020-04-08 16:21:53 +01:00
Asim Aslam b2079669f7 Strip namespace from router 2020-04-08 15:39:01 +01:00
Asim Aslam 2c1d1afd71 Strip namespace from registry router 2020-04-08 15:38:02 +01:00
Asim Aslam 9a73828782 Remove unused handlers 2020-04-08 15:34:11 +01:00
ben-toogood c5d085cff8 Merge pull request #1496 from micro/namespace
Configurable Namespace & Public Suffix Domain Resolution
2020-04-08 13:48:50 +01:00
ben-toogood 9f4286fc4e Merge branch 'master' into namespace 2020-04-08 13:44:46 +01:00
Jake Sanders 77f5cc5023 Fix nil dereference in cloudflare store (#1504) 2020-04-08 13:00:30 +01:00
Vasiliy Tolstov 8400aba81c broker/memory: small memory improvements (#1501)
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-04-08 14:56:54 +03:00
Jake Sanders cc027d900e Close statements, add default table if the store was not initialised through service.Init() (#1502) 2020-04-08 12:08:08 +01:00
Edward bc0dc2e509 fix :no syscall.Kill on windows #1474 (#1474) 2020-04-08 10:50:44 +01:00
Vasiliy Tolstov 1fbc056dd4 minimize allocations (#1472)
* server: minimize allocations on re-register

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>

* server: stop old instance before Init()

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>

* client/grpc: fix allocations in protobuf marshal

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>

* codec/json: fix allocations in protobuf marshal

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>

* remove stop from init

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>

* codec/grpc: expose MaxMessageSize

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>

* codec: use buffer pool

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>

* metadata: minimize reallocations

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>

* util/wrapper: use metadata helper

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>

* registry/cache: move logs to debug level

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>

* server: move logs to debug level

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>

* server: cache service only when Advertise is ip addr

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>

* server: use metadata.Copy

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-04-08 10:50:19 +01:00
Asim Aslam 98fc3dfbad use single data bucket 2020-04-08 09:57:51 +01:00
Asim Aslam 4b0e27413e add Store Close method (#1500)
* add Store Close method

* Update sync store build failure
2020-04-08 09:51:10 +01:00
ben-toogood 6b524e2c55 Merge branch 'master' into namespace 2020-04-08 09:12:28 +01:00
Asim Aslam 4cac7dcc48 fix file tests 2020-04-07 19:45:27 +01:00
Ben Toogood e907d24e3b API Wrappers 2020-04-07 19:29:26 +01:00
Asim Aslam 39c352f210 Remove the test that takes 30 seconds sleeping 2020-04-07 18:22:40 +01:00
Ben Toogood 67cd59d7bc Rename namespace from Resolver.Endpoint 2020-04-07 16:27:59 +01:00
Ben Toogood 3735b0e529 Remove global namespace option 2020-04-07 16:27:01 +01:00
Ben Toogood 4362a885eb Refactor Namespace Resolver 2020-04-07 16:24:51 +01:00
Janos Dobronszki 038b936ce9 Setting up file store in constructor and not in init which is o… (#1499) 2020-04-07 16:43:43 +02:00
Vasiliy Tolstov 6aaad7d63f api/router/static: allow to specify body dst (#1486)
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-04-07 15:38:27 +01:00
Janos Dobronszki aaee01b1a7 Use file store by default (as opposed to memory store) (#1498)
* Use file store by default (as opposed to memory store)

* Default table for file store
2020-04-07 15:19:45 +02:00
Jake Sanders 71538adfdc Explicitly set the table name during service init (#1497) 2020-04-07 13:00:05 +01:00
Janos Dobronszki 2ea5b33955 Disk backed local store (#1491) 2020-04-07 13:53:22 +02:00
Ben Toogood 3df87510a1 Add namespace 2020-04-07 12:46:44 +01:00
Ben Toogood 9d598836c3 Fix Tests 2020-04-07 11:37:04 +01:00
Ben Toogood 05ac3ff274 Tweak 2020-04-07 11:24:13 +01:00
Ben Toogood 76f6f80318 Default to Hostname 2020-04-07 11:23:21 +01:00
Ben Toogood cb96949551 Merge branch 'master' of https://github.com/micro/go-micro into namespace 2020-04-07 10:58:54 +01:00
ben-toogood 87cc4f273b Merge pull request #1495 from micro/log-level
Change cross namespace request err level
2020-04-07 10:58:22 +01:00
Ben Toogood f0980e9b30 Change cross namespace request err level 2020-04-07 10:54:27 +01:00
Ben Toogood 977934f8fd ServiceNamespace => ServicePrefix in api server 2020-04-07 10:39:27 +01:00
Ben Toogood 9e116731b1 ServiceNamespace => ServicePrefix in api server 2020-04-07 10:38:27 +01:00
Ben Toogood 316424f0f7 Fix comments typo 2020-04-07 10:35:57 +01:00
Ben Toogood bd23dc1f18 Improve micro.mu check 2020-04-07 10:34:26 +01:00
Ben Toogood 501fc5c059 Refactor to use publicsuffix 2020-04-07 10:28:39 +01:00
Ben Toogood 11e1e9120a Remove debugging 2020-04-07 10:10:37 +01:00
Ben Toogood a81d86ed08 Merge Asim's Fixes 2020-04-07 10:08:06 +01:00
Ben Toogood 7206d5f964 Add Namespace to CombinedAuthHandler 2020-04-07 09:40:40 +01:00
Asim Aslam b5f5027549 Move store scope to util 2020-04-07 02:23:16 +01:00
Asim Aslam e8a86585da contains missing host port 2020-04-07 00:54:27 +01:00
Asim Aslam 5374896ed0 clone request 2020-04-07 00:29:35 +01:00
Asim Aslam b6348ba59a Fix cruft 2020-04-07 00:25:11 +01:00
Asim Aslam ca11c4a672 Few nitpicks 2020-04-07 00:19:49 +01:00
Lars Lehtonen 900b2d24f9 config/secrets/box: fix dropped test error (#1494) 2020-04-06 23:09:42 +01:00
Jake Sanders 3324d140c0 Rename store Namespace / Prefix options to Database and Table (#1492)
* Rename Namespace to DB, Rename Prefix to table, Remove Suffix Option

* Rename options

* Rename options

* Add store_table option

* Table per service, not Database per service
2020-04-06 16:45:55 +01:00
ben-toogood 3a378eb7d6 Merge pull request #1493 from micro/auth-encode-endpoint
Encode Endpoint in API auth wrapper
2020-04-06 16:21:14 +01:00
Ben Toogood 574bf5ac69 Set value in context, not metadata 2020-04-06 16:10:08 +01:00
Ben Toogood 774c0d30a7 Encode Endpoint in API auth wrapper 2020-04-06 16:01:42 +01:00
ben-toogood 0f570d98e1 Merge pull request #1475 from micro/auth-resolver
Auth integrate resolver to support micro web & api
2020-04-06 14:57:41 +01:00
ben-toogood 7f07e1a642 Merge branch 'master' into auth-resolver 2020-04-06 14:43:22 +01:00
ben-toogood 9b546a7242 Change auth namespace log level (#1490)
Co-authored-by: Ben Toogood <ben@micro.mu>
2020-04-06 13:51:28 +01:00
Asim Aslam c4442a7533 Don't set the registry in new options for web services (#1489) 2020-04-06 13:40:40 +01:00
ben-toogood bea7c3f7e7 Merge pull request #1488 from micro/disable-warn-log
Change namespace error log level
2020-04-06 12:55:47 +01:00
ben-toogood cca9773269 Merge branch 'master' into disable-warn-log 2020-04-06 12:51:47 +01:00
Ben Toogood 600b20fb81 Change namespace error log level 2020-04-06 12:50:04 +01:00
Edward 31a1ea6fae fix: use registry from opts not use default directly:(#1436) (#1468)
web: use passed user registry, or default
2020-04-05 13:15:38 +03:00
Vasiliy Tolstov bc7579f1d8 api/handler/rpc: fix panic on invalid error conversation (#1483)
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-04-04 00:55:15 +03:00
Vasiliy Tolstov 38aed6f0f6 api/handler/rpc: not log error on client disconnect (#1482)
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-04-04 00:37:18 +03:00
ben-toogood 7f8b35e295 Merge pull request #1480 from micro/host-fix
Add Debugging
2020-04-03 15:07:22 +01:00
ben-toogood b09dd9a689 Merge branch 'master' into host-fix 2020-04-03 15:03:49 +01:00
Ben Toogood a82ce4d1ae Add Debug 2020-04-03 15:03:18 +01:00
ben-toogood 34234fc486 Merge pull request #1479 from micro/host-fix
Auth host fix
2020-04-03 14:43:35 +01:00
Ben Toogood 4a850ff8a0 Auth host fix 2020-04-03 14:40:24 +01:00
ben-toogood 350dd41732 Merge branch 'master' into auth-resolver 2020-04-03 14:19:03 +01:00
ben-toogood d8cca31738 Merge pull request #1478 from micro/auth-hosts-fix
Fix auth hosts bug
2020-04-03 14:13:51 +01:00
Ben Toogood b864b3e350 Fix auth hosts bug 2020-04-03 14:09:25 +01:00
ben-toogood 41b746e435 Merge pull request #1477 from micro/fix
Hotfix
2020-04-03 13:37:50 +01:00
Ben Toogood 906263291b Hotfix 2020-04-03 13:37:02 +01:00
ben-toogood 46f0bda31e Merge pull request #1476 from micro/namespace-fix
Namespace Fix
2020-04-03 13:30:30 +01:00
Ben Toogood d0e47206cc Fix 2020-04-03 13:29:48 +01:00
ben-toogood ed6fe67880 Merge pull request #1471 from micro/namespace
Detect & Propagate Namespace
2020-04-03 13:07:26 +01:00
Ben Toogood 1374a9e528 Fix namespace bug in auth wrapper 2020-04-03 13:03:27 +01:00
Ben Toogood a9c0e043d2 Fix nil grpc server auth bug 2020-04-03 12:50:50 +01:00
Ben Toogood 49a568e9c0 Set default server auth 2020-04-03 12:33:19 +01:00
Ben Toogood dea2d7ab9f Fix go-micro auth wrapper init 2020-04-03 12:27:01 +01:00
Ben Toogood ebb1a42d48 Merge branch 'namespace' of https://github.com/micro/go-micro into namespace 2020-04-03 12:14:26 +01:00
Ben Toogood 1096c8fb39 Fix failing test 2020-04-03 10:16:19 +01:00
Ben Toogood 91b9c3f92e Add defaults 2020-04-03 10:08:39 +01:00
Ben Toogood 183c8bfb81 Apply fix for apis 2020-04-03 09:45:39 +01:00
Ben Toogood 49a1130281 Merge branch 'auth-resolver' of https://github.com/micro/go-micro into auth-resolver 2020-04-03 09:34:57 +01:00
Ben Toogood 760233b858 Reverse Change 2020-04-03 09:34:52 +01:00
ben-toogood ede076e899 Merge branch 'master' into auth-resolver 2020-04-03 09:33:13 +01:00
Ben Toogood fdcb013f24 Fix web registry compatability bugs 2020-04-03 09:18:30 +01:00
Ben Toogood ce23ab36cb Improve Err Handling 2020-04-02 18:41:06 +01:00
ben-toogood 61f0619e97 Merge branch 'master' into namespace 2020-04-02 18:05:21 +01:00
Ben Toogood cfde3ec3d9 Remove resolver logic 2020-04-02 18:03:57 +01:00
Ben Toogood 4a4c666528 Remove resolver logic 2020-04-02 18:03:21 +01:00
Ben Toogood 8b35c264eb Pass resolver to api auth handler 2020-04-02 17:44:48 +01:00
Ben Toogood 4999f6dfd4 Namespace requests coming via api & web 2020-04-02 17:01:06 +01:00
Asim Aslam 31c4452fc7 delete monitor (#1470) 2020-04-02 14:05:17 +01:00
Janos Dobronszki 2cafa289b6 Stop LogStream if there is an error in k8s pod log streaming (#1469)
* Stop LogStream if there is an error in k8s pod log streaming

* Locking stream Stops

* PR comment
2020-04-02 12:16:35 +01:00
Vasiliy Tolstov 0241197c6a api/handler/rpc: binary streaming support (#1466)
* api/handler/rpc: binary streaming support

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>

* fixup

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>

* fix

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>

* fix sec webscoekt protol

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-04-02 10:13:04 +01:00
Asim Aslam 0a15ae9b9d Move String method (#1467) 2020-04-01 23:27:15 +01:00
Janos Dobronszki d2b6d35220 log.Errorf when pod streaming fails (#1463)
* log.Errorf when pod streaming fails

* Error method added for loggers

Co-authored-by: Asim Aslam <asim@aslam.me>
2020-04-01 23:03:26 +01:00
Asim Aslam e1bc0f6288 replace strings for store prefix (#1465)
Co-authored-by: ben-toogood <bentoogood@gmail.com>
2020-04-01 20:19:21 +01:00
ben-toogood cd3d704aa5 Merge pull request #1459 from micro/auth-interface-update
Auth Interface Iteration
2020-04-01 17:56:38 +01:00
Ben Toogood 9de69529ce Fix token tests 2020-04-01 17:29:17 +01:00
ben-toogood 623f0c0c90 Merge branch 'master' into auth-interface-update 2020-04-01 17:24:01 +01:00
Ben Toogood c766679687 Fix typo 2020-04-01 17:22:01 +01:00
Ben Toogood df8c0bb5e1 Auth Generate, make secret optional 2020-04-01 17:20:02 +01:00
Ben Toogood d577c32563 Add back auth.PrivateKey 2020-04-01 17:17:40 +01:00
Ben Toogood 365dfe9df5 Code => State 2020-04-01 17:11:46 +01:00
Ben Toogood ae15793fc3 Support oauth codes 2020-04-01 15:36:22 +01:00
Janos Dobronszki 15fcd5ecef Remove Go micro 1.18 dependency (#1462) 2020-04-01 16:14:08 +02:00
Ben Toogood 1750fd8d10 Merge branch 'auth-interface-update' of https://github.com/micro/go-micro into auth-interface-update 2020-04-01 14:42:37 +01:00
Ben Toogood 525ab094c8 Remove LoginOptions 2020-04-01 14:42:11 +01:00
Janos Dobronszki bb51b8203e Runtime logs (#1447)
* Runtime logs

* Slightly broken

* Pushing for diff

* Log trailing works locally

* LogsOptions

* Comments and streamcount support for local logs

* Adding kubernetes logs

* Fixing k8s logs

* K8s fixes

* StreamCount is now nuked

* PR comments

* PR comments again

* Fix typo
2020-04-01 15:40:15 +02:00
ben-toogood 75a75c56ad Merge branch 'master' into auth-interface-update 2020-04-01 14:37:06 +01:00
Ben Toogood 26cb6bf5b9 Remove Legacy JWT fields 2020-04-01 14:27:56 +01:00
Ben Toogood 9cbbd71855 Remove default login 2020-04-01 14:26:24 +01:00
Ben Toogood f7655b71ea Merge branch 'auth-interface-update' of https://github.com/micro/go-micro into auth-interface-update 2020-04-01 14:25:07 +01:00
Ben Toogood 8e4d9e1702 Further Refactoring 2020-04-01 14:25:00 +01:00
Asim Aslam 20c95d94cd api completeness (#1460) 2020-04-01 12:07:50 +01:00
ben-toogood 0a7d8afe67 Merge branch 'master' into auth-interface-update 2020-04-01 09:42:45 +01:00
Vasiliy Tolstov 7b7a859a03 api: use http request Clone (#1458)
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-04-01 01:50:37 +03:00
Vasiliy Tolstov 8a8742f867 api/handler/rpc: dont change types of url fields (#1457)
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-04-01 01:26:58 +03:00
Asim Aslam 68b0238a5d add stream timeout option which defaults to 0 (#1456)
* add stream timeout option which defaults to 0

* fix option
2020-03-31 23:22:11 +01:00
Vasiliy Tolstov 1490aff38e api/handler/rpc: correctly parse nested url vars (#1455)
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-04-01 00:23:17 +03:00
Vasiliy Tolstov 3a22efbd7d metadata: change method name (#1454)
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-03-31 23:39:18 +03:00
Vasiliy Tolstov 5e65a46be3 metadata: allow to remove key from metadata (#1453)
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-03-31 22:55:33 +03:00
Vasiliy Tolstov 18061723bb fix api metadata extract from context (#1452)
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-03-31 22:36:51 +03:00
Vasiliy Tolstov d6bef84de0 api/handler/rpc: fix metadata cleanup (#1451)
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-03-31 21:59:35 +03:00
Ben Toogood 82bc3cbf8d Update interface to add provider and make secret optional 2020-03-31 19:01:43 +01:00
Ben Toogood cffb0a1eae Remove ContextWithToken 2020-03-31 18:34:31 +01:00
Ben Toogood 134bc1c68a Implement new interface 2020-03-31 18:17:01 +01:00
Asim Aslam 6c6c5359b1 Add options to config (#1450) 2020-03-31 17:13:21 +01:00
Ben Toogood 8dbb5153f4 Tweak Auth Interface 2020-03-31 17:01:51 +01:00
ben-toogood 2674790694 Service => Service Auth (#1448)
* Service => Service Auth

* WithServicePrivileges => ServicePrivileges

* Fixes for CLI login

* ServicePrivileges => ServiceToken

* Fallback to service token

Co-authored-by: Ben Toogood <ben@micro.mu>
2020-03-31 16:18:04 +01:00
ben-toogood 9fb1d476a2 Merge branch 'master' into auth-srv-srv 2020-03-31 16:15:17 +01:00
Ben Toogood 36386354d7 Fallback to service token 2020-03-31 13:51:32 +01:00
Ben Toogood bd70820b6b ServicePrivileges => ServiceToken 2020-03-31 13:48:28 +01:00
Ben Toogood 956029ae3d Fixes for CLI login 2020-03-31 13:30:14 +01:00
Ben Toogood e0c7f48d20 WithServicePrivileges => ServicePrivileges 2020-03-31 12:57:38 +01:00
Ben Toogood d659e435c6 Service => Service Auth 2020-03-31 12:44:34 +01:00
Jake Sanders 3d274ab6a2 Add namespace support to Kubernetes client (#1446)
* Add namespace support to Kubernetes client

* Fix LastUpdateTime Condition
2020-03-31 12:03:32 +01:00
Asim Aslam 1222d076f2 There can be only one! (#1445)
Run tests / Test repo (push) Waiting to run
* There can be only one

* fix proto?
2020-03-31 10:18:50 +01:00
ben-toogood 76ade7efd9 Auth - Swap Refresh to Token and change secrets to be strings, not tokens (#1444)
* Refresh => Token

* Secret is no longer a token

Co-authored-by: Ben Toogood <ben@micro.mu>
2020-03-31 10:06:13 +01:00
Vasiliy Tolstov c706ebe3fb auth proto: provide help to protoc-gen-go (#1442)
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-03-31 00:35:11 +03:00
Vasiliy Tolstov 9e6db79860 regenerate all proto (#1440)
* regenerate all proto

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>

* regenerate from proto

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>

* regenerate from proto

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-03-30 21:58:32 +01:00
Vasiliy Tolstov 756b346672 auth/service: move all proto files to single dir (#1439)
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-03-30 18:23:00 +03:00
ben-toogood 4db2f5e79d Add Namespace to Auth (#1438)
Co-authored-by: Ben Toogood <ben@micro.mu>
2020-03-30 09:51:37 +01:00
Vasiliy Tolstov 3d7d5ce6b4 api: add static router and improve path parser in rpc handler (#1437)
* api: add static router and improve path parser in rpc handler

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>

* expose metadata context key to be able to get unmodified map keys

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>

* server/grpc: fix jsonpb codec for protobuf msg

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>

* api/handler/rpc: write 204 status code when rsp is nil

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>

* api/handler/rpc: add check for nil response for non javascript

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-03-30 09:04:59 +01:00
Socket 8282e781e4 grpc pool should check state (#1435)
Co-authored-by: huangshaojie <huangshaojie@corp.netease.com>
2020-03-28 08:48:25 +00:00
Vasiliy Tolstov e4acc63d5f add mdns registry debug (#1434)
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-03-27 22:33:49 +03:00
Asim Aslam 45ee5e9ad1 Move error for api validation to trace level (#1432)
* remove error on endpoint validation

* trace level
2020-03-27 14:01:47 +00:00
Asim Aslam b60fde0e64 Pass through source and metadata in Update and Delete calls to runtime (#1431) 2020-03-27 11:37:12 +00:00
Lars Lehtonen 011a783a9e store/cockroach: fix dropped test errors (#1419)
Co-authored-by: Asim Aslam <asim@aslam.me>
2020-03-27 10:15:37 +00:00
ben-toogood 6723d17b22 Default auth, return account secret on Inspect (#1430)
Co-authored-by: Ben Toogood <ben@micro.mu>
2020-03-27 09:54:29 +00:00
ben-toogood 47c7181d41 Default Auth: Add blank secret to account to prevent nil errors (#1429)
* Remove debug auth logs

* Default auth, return account secret on Inspect

Co-authored-by: Ben Toogood <ben@micro.mu>
2020-03-27 09:46:17 +00:00
Vasiliy Tolstov b38da6ced0 api/handler/rpc: process all methods and merge url params to json body (#1427)
* api/handler/rpc: process all methods and merge url params to json body

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>

* add merge json test

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-03-27 07:59:31 +00:00
ben-toogood 1a53307a78 Remove debug auth logs (#1426)
Co-authored-by: Ben Toogood <ben@micro.mu>
2020-03-26 19:00:24 +00:00
Asim Aslam e204f3e2e8 Add metadata Get method (#1425) 2020-03-26 18:50:00 +00:00
ben-toogood 329bd09f93 Fix Auth Init bug (#1424)
Co-authored-by: Ben Toogood <ben@micro.mu>
2020-03-26 18:09:51 +00:00
ben-toogood 4648fd0d09 Auth debugging (#1423)
* More auth debugging

* More auth debugging

* Increase auth debugging

Co-authored-by: Ben Toogood <ben@micro.mu>
2020-03-26 17:55:35 +00:00
ben-toogood c905df3be6 Log auth verify requests (#1422)
* More auth debugging

* More auth debugging

Co-authored-by: Ben Toogood <ben@micro.mu>
2020-03-26 17:35:28 +00:00
Asim Aslam 62f9a054a4 100mb (#1421) 2020-03-26 16:57:31 +00:00
ben-toogood 00e7804f96 Auth - Add debugging to loading rules (#1420)
* Fix auth multi-rule edgecase

* Add logging to auth rules

Co-authored-by: Ben Toogood <ben@micro.mu>
2020-03-26 16:30:31 +00:00
ben-toogood 42b6bf5bbf Fix auth multi-rule edgecase (#1418)
Co-authored-by: Ben Toogood <ben@micro.mu>
2020-03-26 15:52:48 +00:00
ben-toogood 844c456839 Refactor Auth Service Protos, Add Access Rules (#1411)
* Refactor auth/service into two protos

* Accounts Proto

* Store Prefixes

* Misc

* Tweak Protos

Co-authored-by: Ben Toogood <ben@micro.mu>
Co-authored-by: Asim Aslam <asim@aslam.me>
2020-03-26 13:12:43 +00:00
Asim Aslam 7182ca1fd0 fix server logging (#1417) 2020-03-26 13:08:06 +00:00
Vasiliy Tolstov 02839cfba5 api/handler: use http.MaxBytesReader and buffer pool (#1415)
* api/handler: use http.MaxBytesReader

protect api handlers from OOM cases

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-03-26 14:29:28 +03:00
Asim Aslam 776a7d6cd6 Update filter comment for proxy (#1416) 2020-03-26 08:05:00 +00:00
Vasiliy Tolstov beaa434610 logger: fix reading env var (#1414)
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-03-25 22:00:43 +00:00
Asim Aslam 6efc5556e5 use requested service (#1413) 2020-03-25 20:59:37 +00:00
Asim Aslam 8d0826a031 Add check for k8s condition (#1412) 2020-03-25 19:32:41 +00:00
ben-toogood 378d03eb66 Tidying up auth (#1410)
* Don't clear auth rules if request fails

* Add jitter to auth service loading rules

* Remove unused error from ContextWithToken result

Co-authored-by: Ben Toogood <ben@micro.mu>
2020-03-25 18:34:13 +00:00
ben-toogood 56af826230 Update auth to pass seconds and not nanoseconds (#1409)
Co-authored-by: Ben Toogood <ben@micro.mu>
2020-03-25 17:03:45 +00:00
ben-toogood 511ebd8ec2 Fix Token Expiry Bug (#1408)
Co-authored-by: Ben Toogood <ben@micro.mu>
2020-03-25 14:40:37 +00:00
ben-toogood 1057ef6acb Add ContextWithToken (#1407)
* Add ContextWithToken

* Tidying up BearerScheme

Co-authored-by: Ben Toogood <ben@micro.mu>
2020-03-25 11:20:53 +00:00
ben-toogood 35e2a68a98 Fix auth bug restricting access to unauthorised endpoints (#1405)
Co-authored-by: Ben Toogood <ben@micro.mu>
2020-03-25 10:31:33 +00:00
ben-toogood 0e56382107 Fix service level auth, add improved error descriptions to aid with debugging (#1403)
Co-authored-by: Ben Toogood <ben@micro.mu>
2020-03-25 09:35:29 +00:00
Jake Sanders dff98355be Missing ; in SQL query 2020-03-24 23:49:09 +00:00
Vasiliy Tolstov 8100d26430 api/router/registry: use logger (#1402)
* api/router/registry: use logger

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>

* api/server/acme: use logger

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-03-24 20:45:11 +00:00
Jake Sanders 397a8638f4 Cockroach Store bugfix (#1401) 2020-03-24 17:16:38 +00:00
Jake Sanders eb4d2ae6aa Remove useless variable from cockroach store (#1400) 2020-03-24 15:37:30 +00:00
Jake Sanders 914340585c Trim space from env variables (#1399) 2020-03-24 14:51:43 +00:00
ben-toogood 84b4eb5404 Fix missing loop (#1398)
* WithRoles variadic args

* Load Rules

* Timer => Ticker

* Add missing for loop in auth service

Co-authored-by: Ben Toogood <ben@micro.mu>
2020-03-24 14:16:57 +00:00
ben-toogood fd664f4392 Auth load rules (#1397)
* WithRoles variadic args

* Load Rules

* Timer => Ticker

Co-authored-by: Ben Toogood <ben@micro.mu>
2020-03-24 13:48:37 +00:00
ben-toogood 86272a3064 WithRoles variadic args (#1395)
Co-authored-by: Ben Toogood <ben@micro.mu>
2020-03-24 10:18:34 +00:00
ben-toogood c1978265ab Auth Wildcard Endpoints (#1394)
* Auth Wildcard Endpoints

* Fix joinkey bug, improve tests

* Change joinKey

Co-authored-by: Ben Toogood <ben@micro.mu>
2020-03-24 09:39:33 +00:00
ben-toogood e0e77f3983 Updated auth interface (#1384)
* Updated  auth interface

* Add Rule

* Remove Rule

* Return token from Renew

* Renew => Refresh

* Implement Tokens & Default Auth Implementation

* Change default auth to noop

* Change default auth to noop

* Move token.Token to auth.Token

* Remove Token from Account

* Auth service implementation

* Decode JWT locally

* Cookie for secret

* Move string to bottom of interface definition

* Depricate auth_exclude

* Update auth wrappers

* Update go.sum

Co-authored-by: Ben Toogood <ben@micro.mu>
2020-03-23 16:19:30 +00:00
Vasiliy Tolstov 9826ddbd64 api/handler/rpc: log errors (#1390)
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-03-23 10:31:35 +03:00
0987363 87617be227 Add client header to rpcRequest header; issue #957 (#1378)
Co-authored-by: Asim Aslam <asim@aslam.me>
2020-03-21 23:25:23 +00:00
Vasiliy Tolstov d559587807 client/grpc: remove json-iterator usage (#1387)
* minimize external deps and binary size
* if user wants json-iterator codec it must be used in server and
  client code. so best to use it via go-plugins

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-03-21 09:40:58 +00:00
Janos Dobronszki 9501512219 Auth util func RequestToContext (#1386) 2020-03-20 15:23:12 +00:00
Asim Aslam d2f153d795 Add type of service (#1385) 2020-03-20 12:48:12 +00:00
Asim Aslam e49be1da42 fix local runtime (#1383) 2020-03-19 22:38:37 +00:00
Jake Sanders 4c6f68d537 Implement store read cache (#1366)
* Implement store read cache

* Added cache tests and fixed a bug in memory store
2020-03-19 18:19:07 +00:00
Vasiliy Tolstov cbb958def5 config: fix panic on multiple Close() (#1374)
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-03-19 12:54:59 +03:00
Asim Aslam 40ff6ddfcf sigh, further status changes (#1371) 2020-03-18 22:47:03 +00:00
Asim Aslam 5ad7c36bd4 Fix labels for k8s (#1370) 2020-03-18 22:13:21 +00:00
Asim Aslam 99c3fe2bb8 fix status parsing (#1368) 2020-03-18 21:50:52 +00:00
Asim Aslam 1bd340701b add k8s service ip to metadata (#1367)
* add k8s service ip to metadata

* go fmt

* use same port as container
2020-03-18 18:27:29 +00:00
Jake Sanders c91bf7e9e7 [WIP] Store Sync (#1365)
* Initial cache implementation

* Write queue implementation

* Accidentally started writing the storage sync service
2020-03-18 16:39:36 +00:00
Vasiliy Tolstov 41f8a8cb00 errors: add FromError func (#1362)
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-03-18 03:10:38 +03:00
ben-toogood cd04111e3d Pass redirect_to param on auth (#1361)
Co-authored-by: Ben Toogood <ben@micro.mu>
2020-03-17 20:04:16 +00:00
ben-toogood 00cd2448a4 Fix bug where auth token is not set from cookie when excluded endpoint (#1360)
Co-authored-by: Ben Toogood <ben@micro.mu>
2020-03-17 19:24:10 +00:00
ben-toogood 8a41d369f2 Auth JWT ID Fix (#1359)
* Auth JWT ID Fix

* Remove unused ID in jwt claims

Co-authored-by: Ben Toogood <ben@micro.mu>
2020-03-17 16:59:57 +00:00
Jake Sanders 638c219736 Cockroach store feature completion (#1358)
* Start fixing cockroach store

* Add prefix, suffix, limit, offset for cockroachdb store
2020-03-17 16:15:23 +00:00
ben-toogood b3c631dd38 Support Wildcard Auth Excludes (#1357)
Co-authored-by: Ben Toogood <ben@micro.mu>
2020-03-17 16:03:49 +00:00
Vasiliy Tolstov ab73127063 grpc client/server fixes (#1355)
Run tests / Test repo (push) Waiting to run
* grpc client/server fixes

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-03-17 14:27:20 +03:00
Asim Aslam 03031a694d use pod phase/status (#1356) 2020-03-16 23:47:34 +00:00
li.peng 5712aafba9 fix: context cancel (#1350)
Co-authored-by: Asim Aslam <asim@aslam.me>
2020-03-16 10:45:33 +00:00
Vasiliy Tolstov ac333d9d47 client/grpc: unwrap error after call (#1352)
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-03-16 13:33:38 +03:00
ben-toogood 247707f583 Return store.ErrNotFound if not found when calling over rpc (#1353)
Co-authored-by: Ben Toogood <ben@micro.mu>
2020-03-16 10:30:56 +00:00
ben-toogood d91c14eb30 grpc client error fix (#1351)
Co-authored-by: Ben Toogood <ben@micro.mu>
2020-03-16 12:53:15 +03:00
Asim Aslam ca8684a886 fix k8s issues (#1349) 2020-03-15 15:09:18 +00:00
Asim Aslam 0449138f61 fix panic (#1348) 2020-03-14 21:18:41 +00:00
Vasiliy Tolstov 609f4826b3 server: remove duplicate code (#1346)
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-03-13 22:15:09 +00:00
Vasiliy Tolstov 60993e6275 config/source/service: base64 fix (#1345)
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-03-13 21:44:55 +00:00
Asim Aslam e803fb0855 Runtime hacks (#1344)
* Add Args/Image to runtime

* remove the hacks
2020-03-13 18:39:59 +00:00
Vasiliy Tolstov 3543b275e0 fix log level helper (#1342)
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-03-13 17:36:42 +03:00
Vasiliy Tolstov fbde872e7f Revert "server/grpc: fix ordering of register and check for registered (#1338)" (#1341)
This reverts commit 62a644ddd8.
2020-03-13 09:30:44 +00:00
Asim Aslam 078dd4eb9b fix etcd (#1340)
* fix etcd

* update go mod
2020-03-13 08:55:23 +00:00
Vasiliy Tolstov 62a644ddd8 server/grpc: fix ordering of register and check for registered (#1338)
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-03-12 22:04:11 +00:00
Asim Aslam d8cfa7a295 add config to cmd (#1337)
* add config to cmd

* fix build
2020-03-12 18:47:40 +00:00
ben-toogood 47f1203e97 Add Config to service options (#1336)
Co-authored-by: Ben Toogood <ben@micro.mu>
Co-authored-by: Asim Aslam <asim@aslam.me>
2020-03-12 18:13:03 +00:00
Jake Sanders 1b4e881d74 Rewrite the store interface (#1335)
* WIP store rewrite

* Fix memory store tests

* Store hard expiry times rather than duration!

* Clarify memory test

* Add limit to store interface

* Implement suffix option

* Don't return nils from noop store

* Fix syncmap

* Start fixing store service

* wip service and cache

* Use _ for special characters in cockroachdb namespace

* Improve cockroach namespace comment

* Use service name as default store namespace

* Fixes

* Implement Store Scope

* Start fixing etcd

* implement read and write with expiry and prefix

* Fix etcd tests

* Fix cockroach store

* Fix cloudflare interface

* Fix certmagic / cloudflare store

* comment lint

* cache isn't implemented yet

* Only prepare DB staements once

Co-authored-by: Ben Toogood <ben@micro.mu>
Co-authored-by: ben-toogood <bentoogood@gmail.com>
2020-03-12 13:41:30 +00:00
ben-toogood 20ce61da5a Oauth google fixes (#1330)
* Fix Auth Headers

* Tweak Oauth to work for Google

Co-authored-by: Ben Toogood <ben@micro.mu>
Co-authored-by: Asim Aslam <asim@aslam.me>
2020-03-12 13:11:35 +00:00
chengguoqiang eef4825be4 Update etcd.go (#1334)
add leaseId to the trace log
2020-03-12 10:09:38 +00:00
Asim Aslam be9c6141f5 delete options (#1333) 2020-03-12 09:05:09 +00:00
Asim Aslam 1ca4619506 return store.ErrNotFound (#1332) 2020-03-11 23:09:42 +00:00
Asim Aslam f55493993c set namespace rather than key (#1331) 2020-03-11 22:31:24 +00:00
Vasiliy Tolstov 7b385bf163 minimize allocations in logger and tunnel code (#1323)
* logs alloc

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>

* fix allocs

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>

* fix allocs

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>

* tunnel allocs

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>

* try to fix tunnel

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>

* cache cipher for send

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>

* more logger

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>

* more logger

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>

* more logger

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>

* more logger

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>

* more logger

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>

* more logger

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>

* more logger

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-03-11 17:55:39 +00:00
Jake Sanders 4125ae8d53 Add secrets interface to config/secrets (#1325)
* Interface for secrets

* Add secretbox secrets implementation

* Start working on box

* typo

* Add asymmetric encryption implementation

* go mod tidy

* Fix review comments

Co-authored-by: Asim Aslam <asim@aslam.me>
2020-03-10 22:52:06 +00:00
ben-toogood 48b2a5c37c Fix Auth Headers (#1324)
Co-authored-by: Ben Toogood <ben@micro.mu>
2020-03-10 16:47:01 +00:00
Asim Aslam ed83c27f0e add websocket streaming to api rpc handler (#1326) 2020-03-10 15:21:43 +00:00
Vasiliy Tolstov 241614ff68 add helper function to determine logger level (#1321)
* add helper function to determine logger level

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-03-09 23:43:05 +03:00
mlboy 1a4f608ed1 add: auth add generate options Expiry for set token expires (#1319)
Co-authored-by: mlboy <ml3@meitu.com>
Co-authored-by: Asim Aslam <asim@aslam.me>
2020-03-09 17:16:31 +00:00
Vasiliy Tolstov 43b0dbb123 tunnel: reduce allocation and improve performance (#1320)
* tunnel: reduce allocation and improve performance

BenchmarkSha256Old-16 100000 156748 ns/op 11835 B/op 168 allocs/op
BenchmarkSha256Old-16 100000 156229 ns/op 11819 B/op 168 allocs/op

BenchmarkSha256New-16 100000 154751 ns/op 11107 B/op 161 allocs/op
BenchmarkSha256New-16 100000 154263 ns/op 11110 B/op 161 allocs/op

simple change lowers allocations and brings performance

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>

* fix

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>

* tunnel: reuse buf in Decrypt

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>

* fix unneeded conversations

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>

* base32 string is smaller than hex string

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-03-09 17:10:08 +00:00
ben-toogood b344171c80 URL Encode Provider.Endpoint() (#1317)
Co-authored-by: Ben Toogood <ben@micro.mu>
2020-03-09 10:21:49 +00:00
ben-toogood e3ce45495a os.Exit on log.Fatal (#1316)
* os.Exit on log.Fatal

* Fix TestOptions

Co-authored-by: Ben Toogood <ben@micro.mu>
2020-03-09 09:23:42 +00:00
Vasiliy Tolstov f01664a551 Merge pull request #1313 from micro/upstream
fix ipv6 address usage in mdns registry and util/addr
2020-03-07 23:50:03 +03:00
Vasiliy Tolstov 8ecbdc1cd6 registry/mdns: add logging for invalid endpoint
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-03-07 23:19:48 +03:00
Vasiliy Tolstov 55c19afb0b registry/mdns: fix ipv6 addr in mdns registry
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-03-07 23:17:00 +03:00
Vasiliy Tolstov 077063c212 util/addr: check ip addrs before return
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-03-07 23:13:56 +03:00
ben-toogood 9a7a65f05e Auth Provider (#1309)
* auth provider mock interface

* Auth Provider Options

* Implement API Server Auth Package

* Add weh utils

* Add Login URL

* Auth Provider Options

* Add auth provider scope and setting token in cookie

* Remove auth_login_url flag

Co-authored-by: Asim Aslam <asim@aslam.me>
Co-authored-by: Ben Toogood <ben@micro.mu>
2020-03-07 11:06:57 +00:00
Vasiliy Tolstov 8ee5607254 [WIP]: broker ErrorHandler option (#1296)
* broker ErrorHandler option

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>

* rewrite Event interface, add error

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>

* implement new interface

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>

* change ErrorHandler func to broker.Handler

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>

* fix

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-03-06 21:25:16 +00:00
Vasiliy Tolstov 11be2c68b9 util/stream: fix imports (#1310)
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-03-06 21:17:57 +00:00
Vasiliy Tolstov a864f812f1 web: fix ipv6 address issue (#1308)
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-03-06 18:44:56 +03:00
Asim Aslam ae60bea8d8 add stream fix (#1305) 2020-03-06 14:40:47 +00:00
Jake Sanders a851b9db7a Comment typo in gRPC subscriber (#1304) 2020-03-05 14:55:46 +00:00
Vasiliy Tolstov d807dac2a7 server/grpc: avoid panic in case of nil Header (#1303)
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-03-05 17:45:31 +03:00
Vasiliy Tolstov ce2ba71002 server: subscribe to topic with own name if router not nil (#1295)
* server: subscribe to topic with own name if router not nil

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-03-05 10:29:50 +03:00
Asim Aslam 67c26c71b6 add jitter (#1298) 2020-03-04 15:37:17 +00:00
ben-toogood 9386f36a13 Exit on log.Fatal (#1297) 2020-03-04 13:46:01 +00:00
ben-toogood 6d803d9e45 Implement api/server/cors (#1294) 2020-03-04 11:40:53 +00:00
ben-toogood 6a9001bdb1 Set auth account in context (#1293) 2020-03-04 09:54:52 +00:00
Jake Sanders 3f0c28a815 Expiration is actually a unix timestamp (#1290)
* Expiration is actually a unix timestamp

* int -> int64
2020-03-03 18:15:50 +00:00
Asim Aslam 49ffc60afb Use Foo.Call on /foo (#1286)
Co-authored-by: Jake Sanders <i@am.so-aweso.me>
2020-03-03 16:47:15 +00:00
Jake Sanders beb5e80e87 Fix nil pointer dereference (#1289) 2020-03-03 13:54:56 +00:00
Jake Sanders eebd69c995 Change from renekroon/ttlcache to patrickmn/go-cache (#1288) 2020-03-03 13:35:49 +00:00
Jake Sanders bc71989e2c int64 -> time.Duration (#1287) 2020-03-03 13:15:26 +00:00
Vasiliy Tolstov 89ba602e17 logger fixes and improvements (#1285)
* fix helper fields
* add metadata output for default logger

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-03-03 11:07:37 +03:00
Jake Sanders f6102bde70 Add a cache to workers KV storage implementation (#1284)
* cloudflare-cache

* go mod tidy
2020-03-02 18:14:25 +00:00
Pieter Voorwinden 7cad77bfc0 Initialize header to prevent assignment to entry in nil map error (#1282)
Co-authored-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-03-02 19:17:26 +03:00
ben-toogood 1f2e067f71 k8s runtime - get status from pods (#1283) 2020-03-02 15:49:10 +00:00
Vasiliy Tolstov b555269b1b copy fields in helper (#1281)
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-03-02 14:18:36 +00:00
ben-toogood 9200c70202 Replace validation error with regex for cockroach namespace (#1270)
Co-authored-by: Asim Aslam <asim@aslam.me>
2020-03-01 22:09:06 +00:00
Sumanth Chinthagunta d8377e09c9 feat(dockerfile): adding dumb-init to base image (#1278) 2020-02-29 21:55:15 +00:00
Vasiliy Tolstov 0754229878 broker/memory: add codec support (#1276)
allow easy testing of other services with memory broker
and also allows to more deeply simulate real brokers

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-02-29 23:00:29 +03:00
Vasiliy Tolstov 6b8930a960 add new helper method to logger (#1273)
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-02-29 00:39:41 +00:00
Vasiliy Tolstov d0a978bd50 redesign logger (#1272)
* redesign logger

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-02-29 03:31:59 +03:00
ben-toogood afe6861e2f Update the k8s deployment to use metadata labels & custom source (#1271)
Run tests / Test repo (push) Waiting to run
2020-02-28 15:07:55 +00:00
ben-toogood 962567ef42 Implement config singleton (#1268)
* Implement config singleton

* Pass token in grpc request headers

* Refactor BearerScheme

* Fix typo
2020-02-28 12:58:27 +00:00
Asim Aslam e21ed3a183 gen account on base32 decode failure (#1269) 2020-02-27 16:11:05 +00:00
Vasiliy Tolstov 64a5ce9607 various fixes (#1267)
* logger: remove Panic log level

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>

* server/grpc: add missing Unlock in Subscribe error

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>

* server: minor code change

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>

* server/grpc: extend test suite with pub/sub testing

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>

* server/grpc: fix invalid check and allow subscriber error to be returned

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>

* server/grpc: add pubsub tests

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>

* client/grpc: check for nil req/rsp

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-02-26 18:34:40 +00:00
Asim Aslam d651b16acd generate pseudo accounts (#1264)
* generate pseudo accounts

* when you think you're being clever

* return garbage pseudo account when no token
2020-02-26 13:42:32 +00:00
Eric 1034837f69 Adjusting the BeforeStart () position (#1263)
Co-authored-by: Asim Aslam <asim@aslam.me>
2020-02-26 11:44:10 +03:00
Lars Lehtonen 80f2bfd5d0 config: remove unused sep variable (#1262) 2020-02-26 08:25:33 +00:00
Asim Aslam 6aaaf54275 add MICRO_AUTH_TOKEN, parse token in wrapper, preload config and othe… (#1261)
* add MICRO_AUTH_TOKEN, parse token in wrapper, preload config and other things

* fix wrapper panic
2020-02-25 22:15:44 +00:00
Di Wu 603d37b135 Set option and cli args to the service profile (#1259) 2020-02-25 16:42:42 +00:00
Eric 53c3bff819 add Panic & Panicf to logger (#1258)
* add Panic & Panicf to logger
2020-02-25 17:44:29 +03:00
ben-toogood dcf859098b Fix k8s commands for github (#1257) 2020-02-25 11:39:03 +00:00
Vasiliy Tolstov b4a743898e fix router panic (#1254)
Run tests / Test repo (push) Waiting to run
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-02-24 23:15:59 +00:00
ben-toogood f1e7ea3020 Handle non IsNotExist errors in config (#1251)
Co-authored-by: Asim Aslam <asim@aslam.me>
2020-02-24 18:07:11 +00:00
ben-toogood 5e8d5834eb Dynamic Runtime source for k8s with github packages (#1252)
* Dynamic Runtime source for k8s

* Still check for source

* Replace / with - for k8s service names

* Simplify sourceForName function
2020-02-24 17:47:47 +00:00
ben-toogood ffdf986aac Refactor auth: add token and store implementations (#1230)
* Refactor auth: add token and memory implementations

* Fix typo

* Remove memory auth (implemented already by the store implementation), revert default to noop

* Add grpc header

* Global Config

* config/global => util/config

* Rename package to remove confict

* Tweak

* Improve Error Handling
2020-02-24 15:07:27 +00:00
Jake Sanders 56f8115ea8 Rename PR job (#1250) 2020-02-24 14:16:51 +00:00
Vasiliy Tolstov 5b0175c2e5 allocations improvements and tunnel fixes (#1248)
* reduce allocations in tunnel code

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>

* another allocation fix

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>

* allocate maps with len if it known

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>

* allocate key for send once

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-02-24 14:15:20 +00:00
Jake Sanders 01d88601c0 Split PR and merge tests (#1249) 2020-02-24 14:11:17 +00:00
Lars Lehtonen d467236f8f broker/nats: remove unused setPublishOption() (#1234)
broker/nats: remove unused setSubscribeOption()
2020-02-24 13:49:27 +00:00
Vasiliy Tolstov 24d574ae71 server/grpc: add MaxConn option to limit max inflight requests (#1247)
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-02-24 13:48:56 +00:00
Vasiliy Tolstov cf0b39eaac logger fixes (#1244)
* logger: fix race conditions

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>

* restore util/log for compatibility

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-02-24 13:07:40 +00:00
Vasiliy Tolstov 1f767ba18c update go modules (#1240)
Run tests / Test repo (push) Waiting to run
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-02-23 20:47:44 +00:00
Asim Aslam 915c424213 Add docker build (#1239) 2020-02-23 15:57:21 +00:00
Vasiliy Tolstov 117f56ebf7 prune util/log and user logger (#1237)
* prune util/log and user logger

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>

* plaintext logger

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>

* add newline

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-02-23 13:45:20 +00:00
Gao.QiLin ceed8942fc Update README.md change godoc => go.dev (#1236)
* Update README.md add go dev

* Update README.zh-cn.md add go dev
2020-02-22 08:56:42 +00:00
Vasiliy Tolstov d1e25e7ead add metadata set method (#1232)
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-02-21 23:04:47 +03:00
Jake Sanders 7e24c0c1cf Also run tests on PR (#1233) 2020-02-21 17:57:07 +00:00
Jake Sanders ca251ba111 Switch from Travis CI to GitHub Actions (#1231)
* Create Github Action to run tests on push

* -v

* Update tests.yml

* TODO: Fix tests

* Fix colours

* Delete .travis.yml

* Update tests.yml

* builds -> build
2020-02-21 17:43:50 +00:00
Asim Aslam 116855572b Add log level helper funtions (#1229) 2020-02-21 08:43:23 +00:00
Asim Aslam ee977acfef strip SetGlobalLevel (#1228) 2020-02-21 08:28:21 +00:00
Sumanth Chinthagunta 3fa7c26946 logger with helper methods (#1216)
* support unix daemon socket

* refactor(logger): logger fields changed to map[string]interface{}

* improvement(logger): adding string to Level Parser

* improvement(logger): rename ParseLevel to GetLevel

* refactor(logger): adding basic logger

adding micro default logger, and refactor logger interface

* refactor(logger): moved basic logger to top level package

* refactor(logger): adding default logger
2020-02-21 07:57:59 +00:00
Lars Lehtonen 88457b812e tunnel: Prune Unused Functions (#1224)
* tunnel: remove unused link.setLoopback()

* tunnel: remove unused link.accept()

* tunnel: remove unused link.connect()
2020-02-20 17:05:49 +00:00
Asim Aslam 78df154a4d move log level setting to option (#1222) 2020-02-20 08:26:12 +00:00
Lars Lehtonen c7eed618c2 server/grpc: Prune Unused Code (#1220)
* server/grpc: remove unused grpcServer.newCodec()

* server/grpc: remove unused defaultRPCCodecs
2020-02-19 20:58:22 +00:00
ben-toogood 36bcd3bd82 Improve JWT Package Errors (#1206)
Co-authored-by: Asim Aslam <asim@aslam.me>
2020-02-19 09:51:43 +01:00
Asim Aslam f4118dc357 secure the grpc client (#1215)
* secure the grpc client

* make compile

* Add system cert pool

* Revert manually adding ca certs

* Tweak comment

Co-authored-by: ben-toogood <bentoogood@gmail.com>
2020-02-19 08:44:35 +00:00
Vasiliy Tolstov 58598d0fe0 fixes for safe conversation and avoid panics (#1213)
* fixes for safe convertation

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>

* fix client publish panic

If broker connect returns error we dont check it status and use
it later to publish message, mostly this is unexpected because
broker connection failed and we cant use it.
Also proposed solution have benefit - we flag connection status
only when we have succeseful broker connection

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>

* api/handler/broker: fix possible broker publish panic

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-02-18 23:05:38 +00:00
Vasiliy Tolstov 6248f05f74 add missing option to client.NewMessage (#1212)
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-02-18 14:18:59 +03:00
ben-toogood aa9a0a8d23 Fix Micro Proxy nil Transport Bug (#1208) 2020-02-17 12:28:48 +03:00
ben-toogood 1e40c86dfe Ignore gRPC Proxy (#1205) 2020-02-17 08:14:45 +00:00
Asim Aslam 9696efde02 reorder auth interface (#1204) 2020-02-16 19:36:45 +00:00
Asim Aslam b3fc8be24e normalise proxy name (#1203) 2020-02-15 21:57:30 +00:00
Sumanth Chinthagunta fc5339a368 [W.I.P] refactor(logger): logger fields changed to map[string]interface{} (#1198)
* support unix daemon socket

* refactor(logger): logger fields changed to map[string]interface{}

* improvement(logger): adding string to Level Parser

* improvement(logger): rename ParseLevel to GetLevel
2020-02-15 18:19:28 +00:00
Asim Aslam 964b7dee3f add tls config to server (#1202)
* add tls config

* add TLSConfig to acme provider
2020-02-15 15:10:26 +00:00
Asim Aslam 158949d0d0 accept Listen option in grpc server (#1201) 2020-02-15 14:09:24 +00:00
Asim Aslam eed8a0bf50 delete proxy cached route before updating (#1200) 2020-02-15 12:05:22 +00:00
Asim Aslam c691d116ab when the stream errors cleanup the connection (#1199) 2020-02-15 11:35:08 +00:00
Eric cbe8b7dd09 Removed redundant spaces (#1196) 2020-02-14 10:32:02 +03:00
Asim Aslam 203486fd31 check for etcd watcher canceled value 2020-02-13 22:34:56 +00:00
Asim Aslam d9b3b17582 set dial timeout in stream 2020-02-13 18:51:32 +00:00
ben-toogood e080ecb43a Auth Improvements (#1195)
* Exclude Stats & Trace from Auth

* Update Excluded Endpoints Format

* Tweak Implementation
2020-02-13 14:07:14 +00:00
ben-toogood ea70711dd3 Exclude Stats & Trace from Auth (#1192) 2020-02-13 12:02:29 +00:00
Vasiliy Tolstov 6dc942bc19 client/grpc: fix panic on invalid message (#1191)
* client/grpc: fix panic on invalid message
* travis: disable lint and race for now

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-02-13 14:57:21 +03:00
Janos Dobronszki d76baf59de Trace type is now being recorded (#1188) 2020-02-12 10:57:17 +00:00
Vasiliy Tolstov 79ad1e6fe3 various fixes for broker and messaging in server (#1187)
* provide broker disconnect messages in server

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>

* broker/eats: another fix

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-02-11 18:41:23 +00:00
Vasiliy Tolstov 2764de9a1a broker/eats: broker disconnect fix (#1186)
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-02-11 15:46:50 +00:00
Asim Aslam d1d6eada98 parse url encoded form in rpc handler (#1183)
* parse url encoded form in rpc handler

* Remove comment
2020-02-11 11:27:16 +00:00
ben-toogood 4a03183481 Return a 401 error on invalid auth tokens (#1184) 2020-02-11 11:22:22 +00:00
Asim Aslam 8ea84ac3eb Fix router panic for nil watcher 2020-02-10 15:38:41 +00:00
ben-toogood 4401c12e6c Auth Wrapper (#1174)
* Auth Wrapper

* Tweak cmd flag

* auth_excludes => auth_exclude

* Make Auth.Excludes variadic

* Use metadata.Get (passes through http and http2 it will go through various case formats)

* fix auth wrapper auth.Auth interface initialisation

Co-authored-by: Asim Aslam <asim@aslam.me>
2020-02-10 08:26:28 +00:00
Vasiliy Tolstov c706afcf04 logger helper to pass down it via context (#1180)
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-02-09 21:26:46 +00:00
Lars Lehtonen ca1d0b94c3 config/cmd: remove 8 unused variables (#1175) 2020-02-08 11:19:10 +00:00
Vasiliy Tolstov 67acd9288b config/source/cli: fix tests (#1179)
* config/source/cli: fix tests
* skip mdns test in travis

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-02-08 02:45:32 +03:00
Vasiliy Tolstov 0bf6c9fc08 config/source/cli: fix default flag value loading (#1178)
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-02-08 02:14:34 +03:00
Vasiliy Tolstov 99807a680c strip Micro-Topic header from incoming context in client.Call (#1177)
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-02-07 22:09:52 +00:00
Vasiliy Tolstov f0f7f860d6 add some docs (#1176)
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-02-07 21:48:24 +00:00
Asim Aslam ef537270ad Don't store traces for Debug endpoints 2020-02-07 20:58:03 +00:00
Asim Aslam c7f075d157 rename file 2020-02-07 14:00:27 +00:00
Asim Aslam 812ea78604 Fix runtime deadlock 2020-02-07 14:00:09 +00:00
Asim Aslam 0755084a59 fix deadlock 2020-02-07 13:55:55 +00:00
ben-toogood fe7f5a4134 Runtime Retries Limit (#1163)
* Implement Runtime Retries

* Remove Debug

* Action Feedback

* Refactor Retries

* Fix WithRetires Typo
2020-02-07 12:02:41 +00:00
ben-toogood 19c454ec4b Fix Local Runtime Default Command (#1173)
* Auth API Proto

* Fix local runtime bug

* Add Platform Proto

* Restructuring
2020-02-07 11:39:26 +00:00
Asim Aslam 0e9b4c26a4 import with braces 2020-02-06 21:39:08 +00:00
Asim Aslam d40b13a045 mux to mtx 2020-02-06 21:37:17 +00:00
Asim Aslam 4079b22c1e reorder logger methods 2020-02-06 21:36:33 +00:00
Shu xian fdfb2bc4c1 [WIP] logger first (#1161)
* logger first

* log->logger

* update comment

* add context in Options

* add Fields

* remove logfi

* add field encode

* add common Field Types

* update logger field
2020-02-06 21:35:46 +00:00
Asim Aslam dbeb7cfe9c remove errors import 2020-02-06 18:45:12 +00:00
Asim Aslam 512df2628f trim source url if its set to github.com/ 2020-02-06 18:34:16 +00:00
Janos Dobronszki 92571db693 Tracing: traces now correctly form a tree (#1170)
* First cut of trace

* Dial it back yo

* Defensive programming
2020-02-06 17:22:16 +00:00
ben-toogood 16552620e0 Runtime Custom Source (Part 2) (#1169) 2020-02-06 16:16:01 +00:00
Ben Toogood 5414195dc3 Add Args 2020-02-06 12:31:54 +00:00
Ben Toogood 0591760932 Arg => Args 2020-02-06 12:17:16 +00:00
Ben Toogood 48b9f3f5e9 Fix 2020-02-06 11:28:34 +00:00
Ben Toogood e46278a766 Test 2020-02-06 11:24:56 +00:00
Ben Toogood 2925b1615c Fix 2020-02-06 11:15:30 +00:00
Ben Toogood fc4191c647 Fix 2020-02-06 11:12:40 +00:00
Ben Toogood 111126c780 Debugging 2020-02-06 11:00:14 +00:00
Ben Toogood 54371bba6a Debugging 2020-02-06 10:55:41 +00:00
Ben Toogood c28737e88e Debugging 2020-02-06 10:54:11 +00:00
Ben Toogood c7d922fac2 Debugging 2020-02-06 10:49:01 +00:00
Ben Toogood f8e696bd30 Debugging 2020-02-06 10:44:12 +00:00
Ben Toogood 6aef28dad2 Runtime set service source 2020-02-06 10:33:23 +00:00
Vasiliy Tolstov 7105e4099c pass micro errors from grpc server to grpc client (#1167)
* pass micro errors from grpc server to grpc client

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>

* wrap micro errors.Error to grpc status

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-02-06 10:18:33 +00:00
Ben Toogood f0762bbb6b Improve Logging 2020-02-06 10:16:32 +00:00
Ben Toogood 243c6a4246 Debug 2020-02-06 10:08:56 +00:00
Ben Toogood 9983aea928 Tidying Up 2020-02-06 09:29:27 +00:00
Ben Toogood aa58a9749b Action Asim's Feedback 2020-02-06 09:17:10 +00:00
ben-toogood d8110b70a3 Runtime custom docker img (#1168)
* Add DeploymentOptions to K8s Client

* WithBaseImage for  Runtime

* Revert Change

* Fix sequencing
2020-02-06 08:52:25 +00:00
Vasiliy Tolstov a44dc90d45 fix ctx.Done issue #720 (#1166)
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-02-05 21:13:14 +00:00
Shu xian 12181bd441 fix LevelInfo > LevelWarn (#1162) 2020-02-05 18:16:57 +00:00
Ben Toogood 8d44f7226f Merge branch 'master' of https://github.com/micro/go-micro 2020-02-05 13:59:51 +00:00
ben-toogood bf747a86f4 Runtime (#1160)
* Add String to Runtime interface

* Setup Dynamic Runtime Configuration
2020-02-05 13:59:35 +00:00
Lars Lehtonen 4333f00a43 runtime/kubernetes: remove unused constants (#1159) 2020-02-04 21:02:05 +00:00
Vasiliy Tolstov 7ab3a31ac4 update micro/cli, tidy mod (#1156)
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-02-03 23:29:44 +00:00
Ben Toogood a1d5d6831f Add String to Runtime interface 2020-02-03 15:56:16 +00:00
ben-toogood 1b9cabd654 Update Micro Auth Protocol Buffer to use V2 (#1155) 2020-02-03 08:26:57 +00:00
ben-toogood d621548120 Auth (#1147)
Implement the Auth interface, with JWT and service implementations.

* Update Auth Interface

* Define Auth Service Implementation

* Support Service Auth

* Add Auth Service Proto

* Remove erronious files

* Implement Auth Service Package

* Update Auth Interface

* Update Auth Interface. Add Validate, remove Add/Remove roles

* Make Revoke interface more explicit

* Refactor serializing and deserializing service accounts

* Fix srv name & update interface to be more explicit

* Require jwt public key for auth

* Rename Variables (Resource.ID => Resource.Name & ServiceAccount => Account)

* Implement JWT Auth Package

* Remove parent, add ID

* Update auth imports to v2. Add String() to auth interface
2020-02-03 08:16:02 +00:00
tpam28 449bcb46fe New backoff (#1153)
* new backoff function

* use backoff from util/backoff

* remove reset atemts

* change comment

* fmt
2020-02-02 20:32:55 +00:00
Asim Aslam 079102ea59 Merge branch 'master' of ssh://github.com/micro/go-micro 2020-02-02 19:50:09 +00:00
Asim Aslam a9d371e727 fatal on command error 2020-02-02 19:49:59 +00:00
Asim Aslam 27efbc8779 Merge pull request #1150 from unistack-org/grpc_race
fix map race condition in grpc server
2020-02-01 00:10:46 +00:00
Vasiliy Tolstov efb59d9709 fix map race condition in grpc server
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-02-01 02:52:53 +03:00
Asim Aslam 003f00b483 Merge branch 'master' of ssh://github.com/micro/go-micro 2020-01-30 23:24:54 +00:00
Asim Aslam 0be22c98c6 add tracing 2020-01-30 23:24:46 +00:00
Asim Aslam bafedf1aad Merge pull request #1149 from alrs/remove-unused-kubernetes-variable
runtime/kubernetes: remove unused name variable
2020-01-30 17:30:43 +00:00
Lars Lehtonen 98d55545fd runtime/kubernetes: remove unused name variable 2020-01-30 09:25:50 -08:00
Asim Aslam 5f6271b044 Merge pull request #1148 from tpam28/master
fix test and description
2020-01-30 17:09:41 +00:00
Evgeniy 87753ad289 format results in TestBacloff 2020-01-30 20:08:03 +03:00
Evgeniy ffb9da0230 fix test and description 2020-01-30 19:43:03 +03:00
Asim Aslam 50ac642666 Merge pull request #1146 from tpam28/master
exponentialBackoff was changed from power function to exponential
2020-01-30 14:35:17 +00:00
Evgeniy f6fcfcb8fc exponentialBackoff was changed from power function to exponential function 2020-01-30 17:25:07 +03:00
Asim Aslam 21e0932339 Merge pull request #1144 from unistack-org/v2
fix import paths for v2 release
2020-01-30 11:46:29 +00:00
Vasiliy Tolstov f23638c036 fix import paths for v2 release
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-01-30 14:44:40 +03:00
Asim Aslam 2b1e0a6fd6 go mod tidy 2020-01-30 10:33:40 +00:00
Asim Aslam 0889b814bb Merge pull request #1143 from crufter/bump-dep
Bump dep to fix platform web using new debug.Stats proto fields
2020-01-30 10:31:12 +00:00
Janos Dobronszki a648c0d99c Bump dep to fix platform web using new debug.Stats proto fields 2020-01-30 10:27:21 +00:00
Asim Aslam a291af59c4 Merge pull request #1142 from micro/tracing
Fix null tracer bug
2020-01-30 07:55:58 +00:00
Ben Toogood d9f12731e1 Fix null tracer bug 2020-01-30 07:53:31 +00:00
Asim Aslam 4a838a8210 Merge branch 'master' of ssh://github.com/micro/go-micro 2020-01-29 23:14:16 +00:00
Asim Aslam 5969cc358e nats-e => eats 2020-01-29 23:14:05 +00:00
Asim Aslam 9f1a7e1139 Merge pull request #1127 from Allenxuxu/master
handle Loader.Load  return value error
2020-01-29 22:44:29 +00:00
Asim Aslam dc257f5066 update to fix tracer 2020-01-29 22:43:40 +00:00
Asim Aslam 49b86c56e3 go fmt 2020-01-29 22:40:43 +00:00
Asim Aslam 1be8258721 fix initialisation 2020-01-29 22:39:31 +00:00
Asim Aslam b2980aecb7 fix debug handler in proxy 2020-01-29 22:31:57 +00:00
Asim Aslam de3c3b27b2 Merge pull request #1140 from micro/tracing
Tracing by Ben Toogood
2020-01-29 22:28:49 +00:00
Micro a09eea8d4d Update the Debug Handler to use the servers tracer 2020-01-29 16:05:58 +00:00
Micro 62c067adcd Refactor debug/trace ready for Jaeger 2020-01-29 15:45:11 +00:00
Asim Aslam 59f6ca5564 Merge pull request #1139 from alrs/prune-unused-config-reader-func
config/reader/json: remove unused newValue()
2020-01-28 19:50:03 +00:00
Lars Lehtonen 895aa896bc config/reader/json: remove unused newValue() 2020-01-28 11:38:55 -08:00
Asim Aslam 74762edc42 Merge pull request #1138 from printfcoder/master
cockroach store supports URL connection string
2020-01-28 17:59:49 +00:00
shu xian 101017a29c cockroach supports URL connection string 2020-01-29 00:47:41 +08:00
Shu xian c725b4c797 Merge pull request #3 from micro/master
merge
2020-01-29 00:45:27 +08:00
Asim Aslam 1108cc5e91 Merge pull request #1136 from unistack-org/flags
update micro/cli to urfave/cli/v2 and fix go-micro
2020-01-26 19:12:06 +00:00
Asim Aslam 6a9f5fac61 fire send in a go routine to prevent blocking other requests 2020-01-25 23:16:00 +00:00
Vasiliy Tolstov e6a34bcbe7 update micro/cli to urfave/cli/v2 and fix go-micro
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-01-25 15:57:08 +03:00
Asim Aslam 1d00f2f771 add trace handler 2020-01-24 22:02:35 +00:00
Asim Aslam 4a6570a772 trace wrapper 2020-01-24 21:58:29 +00:00
Asim Aslam a997a86e49 add trace context 2020-01-24 21:44:48 +00:00
Asim Aslam 2d28ff72d7 add trace 2020-01-24 21:32:07 +00:00
Asim Aslam 2b1844971c go fmt 2020-01-24 21:31:57 +00:00
Asim Aslam 49cc022ca2 add trace to handler 2020-01-24 21:29:29 +00:00
Asim Aslam 8d2dc8a822 trace Read endpoint 2020-01-24 21:24:51 +00:00
Asim Aslam eeb6944ce5 Merge pull request #1133 from alrs/drop-unused-broker-code
broker: drop unused registryKey variable
2020-01-23 21:57:58 +00:00
Lars Lehtonen add78f2967 broker: drop unused registryKey variable 2020-01-23 12:51:57 -08:00
Shu xian bd6a5af2b5 Merge pull request #2 from micro/master
merge
2020-01-23 22:17:54 +08:00
Asim Aslam ae08e9c106 check if event is nil 2020-01-23 12:41:22 +00:00
Asim Aslam 77c2a021da Add event id to router events 2020-01-23 11:44:06 +00:00
Asim Aslam 1c19678d04 Update proto Service => Config 2020-01-23 11:37:54 +00:00
Asim Aslam 6d636b7ab3 whoa bad commit, bad asim 2020-01-22 17:07:56 +00:00
Asim Aslam 009c598049 Change version to latest 2020-01-22 17:03:38 +00:00
Asim Aslam 5cceb00df2 Merge pull request #1131 from micro/router-refactor
refactor and cleanup some router code
2020-01-22 16:54:20 +00:00
Asim Aslam 3e24276eb1 fix break 2020-01-22 16:44:34 +00:00
Asim Aslam 29c1076950 refactor and cleanup some router code 2020-01-22 16:33:31 +00:00
Asim Aslam 8dbacb34f8 Merge pull request #1118 from printfcoder/master
add mucp for config/source
2020-01-21 22:35:35 +00:00
Asim Aslam 8b306780ee Merge pull request #1130 from micro/net-noloop
avoid connecting to self
2020-01-21 15:05:33 +00:00
Asim Aslam 9f7d374691 avoid connecting to self 2020-01-21 12:36:05 +00:00
Asim Aslam a18e53f028 Merge branch 'master' of ssh://github.com/micro/go-micro 2020-01-20 21:31:16 +00:00
Asim Aslam 2208839027 Merge pull request #1129 from alrs/remove-unused-server-var
server: remove unused invalidRequest
2020-01-20 18:24:42 +00:00
Lars Lehtonen 7a17a221ff server: remove unused invalidRequest 2020-01-20 10:09:27 -08:00
Shu xian 8e1ff80b9e Merge pull request #1 from micro/master
merge
2020-01-20 20:08:21 +08:00
shu xian 94bb0f4c08 watch supports path 2020-01-20 18:31:18 +08:00
Allenxuxu dbe209ebe4 Merge branch 'master' of https://github.com/micro/go-micro 2020-01-20 08:37:34 +08:00
Asim Aslam fa0d884cfe fix bad import 2020-01-19 23:31:09 +00:00
Asim Aslam ed2bd68d28 fix break in router service 2020-01-19 23:22:41 +00:00
Asim Aslam 97928e88f8 stop watcher 2020-01-19 23:15:57 +00:00
Asim Aslam 04cf86070c close stream 2020-01-19 22:55:57 +00:00
Asim Aslam 9df19e826e cancel stream 2020-01-19 22:53:56 +00:00
Asim Aslam 3f3c1919f4 strip certain plugins 2020-01-19 17:56:59 +00:00
Asim Aslam d918694346 reorganise runtime 2020-01-19 17:47:27 +00:00
Asim Aslam 54fb61bba4 Move proto to service/ 2020-01-19 17:31:24 +00:00
Asim Aslam fac75866d9 Move pool to util 2020-01-19 17:30:49 +00:00
Asim Aslam a47ff65529 remove mock client 2020-01-19 17:24:22 +00:00
Asim Aslam 093bcedfe7 remove http broker 2020-01-19 17:21:55 +00:00
Asim Aslam 7b6d560bec Update README.md 2020-01-19 13:55:23 +00:00
Asim Aslam 43aa4e23bd update readme 2020-01-19 13:51:31 +00:00
Asim Aslam bdd9ec560b strip sub comments 2020-01-19 13:47:14 +00:00
Asim Aslam 0c03bf064b only connect broker if there are subscribers 2020-01-19 13:45:28 +00:00
Asim Aslam 9a8c1b7ab8 update broker 2020-01-19 13:35:23 +00:00
Asim Aslam e1ca40c1fc go fmt 2020-01-19 13:32:30 +00:00
Asim Aslam e75b99f89c go fmt 2020-01-19 13:32:24 +00:00
Allenxuxu ee7304a795 NewConfig return value error 2020-01-19 16:42:05 +08:00
Allenxuxu a82fd19209 handle Loader.Load return value error 2020-01-19 16:31:02 +08:00
Asim Aslam 1983d607f3 set nats-e 2020-01-19 01:47:30 +00:00
Asim Aslam 10093a0ea2 set to nats-e 2020-01-19 01:29:00 +00:00
Asim Aslam fc08a9146c Add broker comments on server subscribe 2020-01-19 01:16:36 +00:00
Asim Aslam cafd280718 Default to grpc in registry service for now 2020-01-19 01:13:14 +00:00
Asim Aslam 11b104677a Shift embedded nats to the default 2020-01-19 00:55:01 +00:00
Asim Aslam 105596a0e5 use mucp server 2020-01-18 20:48:08 +00:00
Asim Aslam 0a37767127 Fix service registration with registry service 2020-01-18 19:53:51 +00:00
Asim Aslam 31e195bac7 strip image pull policy always 2020-01-18 18:37:38 +00:00
Asim Aslam bdf1d20f4e extract an ip that can be advertised in embedded nats 2020-01-18 15:39:26 +00:00
shu xian 8d6f82707a update to standard name convention 2020-01-18 23:16:23 +08:00
Asim Aslam 058fd8adbf trace 1 2020-01-18 10:20:46 +00:00
Asim Aslam 13d1d2fa08 hard stop if graceful stop fails after 1 second 2020-01-18 10:18:23 +00:00
Asim Aslam e666d0b807 add missing commit 2020-01-18 02:28:44 +00:00
Asim Aslam 39d7938405 Extract k8s run error 2020-01-18 02:13:24 +00:00
Asim Aslam 65df711b01 move nats local logic 2020-01-18 01:29:53 +00:00
Asim Aslam fd6eb23307 do not wait to stop 2020-01-18 00:58:27 +00:00
Asim Aslam fb3927fb8c Merge pull request #1126 from milosgajdos83/metric-update
Update route metric when receiving Sync routes
2020-01-17 18:29:55 +00:00
Milos Gajdos 891af703be Update route metric when receiving Sync routes 2020-01-17 18:24:36 +00:00
Asim Aslam 474472eedd Merge pull request #1124 from milosgajdos83/flush-advert-query
Use the same logic for advertising routes in Router and Network
2020-01-17 16:49:11 +00:00
Milos Gajdos 23d65145e6 Use the same logic for advertising routes in Router and Network
router.Query() allows to query the routes with given router.Strategy.
It uses the same logic as was implemented in flushRoutes but the code
was never updated. This way we are consistent across both router and
network packages.
2020-01-17 16:25:18 +00:00
shu xian 9ea4919b9b rename mucp source directory to service 2020-01-17 23:53:33 +08:00
Asim Aslam f78e30770e Merge pull request #1123 from milosgajdos83/sync-metric
Update route metric before sending the Sync message
2020-01-17 15:44:49 +00:00
Milos Gajdos bf9f319cdf Update route metric before sending the Sync message 2020-01-17 15:38:28 +00:00
shu xian ad28b72dd3 rename mucpSource to service 2020-01-17 23:27:41 +08:00
Asim Aslam 8425ae77f8 Merge pull request #1122 from micro/blocking
don't block forever
2020-01-17 15:24:03 +00:00
Asim Aslam d7b9b2713b don't block forever 2020-01-17 15:23:10 +00:00
Asim Aslam be788415ad minor runtime fixes 2020-01-17 14:14:47 +00:00
shu xian a03791c581 set DefaultClient 2020-01-17 21:32:00 +08:00
Asim Aslam ee922a3da6 Merge pull request #1121 from milosgajdos83/no-routes-found
Continue processing Sync if no routes were returned from router Query
2020-01-17 13:05:47 +00:00
Milos Gajdos 624f1c1980 Continue processing Sync if no routes were returned from router Query 2020-01-17 12:58:13 +00:00
Milos Gajdos 607a226e34 Updated debug logs to make them less verbose 2020-01-17 12:14:56 +00:00
Asim Aslam bac1bbfd97 Merge pull request #1120 from milosgajdos83/remove-solicit
Remove Solicitation from the network
2020-01-16 20:02:05 +00:00
Milos Gajdos 7f9b3b5556 Remove Solicitation from the network
Instead, when a new peer is discovered it is sent a sync message i.e. we
do the full sync when discovering peers
2020-01-16 19:43:10 +00:00
Asim Aslam ba12513199 Merge pull request #1119 from milosgajdos83/sync-best-routes-only
Send only best routes via Sync. Only apply best routes.
2020-01-16 18:17:26 +00:00
Milos Gajdos 8fcfbc0d20 Strip unnecessary continue statement 2020-01-16 17:33:53 +00:00
Milos Gajdos 472186c1be Code consistency. Small bug fix. 2020-01-16 17:04:04 +00:00
Milos Gajdos 60c05bd899 Find the best routes in the routes we would advertise based on Strategy 2020-01-16 16:53:39 +00:00
Milos Gajdos 793e6013e5 Advertise routes with configured strategy. Simplify Sync apply logic 2020-01-16 16:42:23 +00:00
shu xian 071ab7aede add mucp for config/source 2020-01-17 00:10:15 +08:00
Milos Gajdos eda8b00f84 Send only best routes via Sync. Only apply best routes. 2020-01-16 16:08:49 +00:00
Asim Aslam eac2ab3c28 Merge pull request #1117 from micro/scheduler
Switch notifier to scheduler
2020-01-16 13:41:13 +00:00
Asim Aslam 76fba34c2f Merge pull request #1116 from milosgajdos83/query-strategy
QueryStrategy to allow querying routes based on Advertising Strategy
2020-01-16 13:39:39 +00:00
Asim Aslam 491a42d352 Switch notifier to scheduler 2020-01-16 13:34:04 +00:00
Milos Gajdos 5e85194a13 QueryStrategy to allow querying routes based on Advertising Strategy 2020-01-16 12:48:36 +00:00
Asim Aslam 689ae7cfc7 Storing tunnel.Session rather than transport.Client 2020-01-16 00:28:58 +00:00
Asim Aslam 19dbd77402 fix net masking in listed routes 2020-01-16 00:12:38 +00:00
Asim Aslam b194b3adc9 Merge pull request #1115 from micro/net-mask
mask the route before sending
2020-01-15 23:13:53 +00:00
Asim Aslam 33a9b3bc17 mask the route before sending 2020-01-15 23:06:58 +00:00
Asim Aslam 6562154573 Fix the next panic 2020-01-15 21:38:37 +00:00
Asim Aslam b32ebddf85 update nlopes/slack dep 2020-01-15 21:22:07 +00:00
Asim Aslam b3e3dac975 Merge branch 'master' of ssh://github.com/micro/go-micro 2020-01-15 21:02:58 +00:00
Asim Aslam f20e4daa60 fix rand panic 2020-01-15 21:02:53 +00:00
Asim Aslam f67d87e99d Merge pull request #1114 from milosgajdos83/network-backward-compatibility
Fixed bug:m network.proto backwards compatibility unmarshal
2020-01-15 19:57:57 +00:00
Milos Gajdos 36928b716c Fixed bug:m network.proto backwards compatibility unmarshal 2020-01-15 19:45:43 +00:00
Asim Aslam 7c7b0ced5f Merge pull request #1104 from milosgajdos83/network-hackery
[WIP] Network hackery
2020-01-14 20:28:32 +00:00
Milos Gajdos c67ef7e017 Bug fix: skip sending sync message if the peer is not in our graph 2020-01-14 19:37:50 +00:00
Milos Gajdos dcd925f1e5 Code cleanup; Indentation. 2020-01-14 18:48:42 +00:00
Milos Gajdos 0ea56a5ffe Fixed tests 2020-01-14 18:22:58 +00:00
Milos Gajdos 821fda41ae Added Status method to network.Node fixed random segfaults. 2020-01-14 18:12:36 +00:00
Asim Aslam 1d311ab457 Embedded NATS Broker (#1110)
* if the address is produced by a default route don't hash it

* embedded nats

* fix url parsing

* don't override help

* add ready flag
2020-01-14 13:23:16 +00:00
Asim Aslam b699d969e4 if the address is produced by a default route don't hash it (#1108) 2020-01-14 11:20:13 +00:00
Milos Gajdos 994d371ff1 Removed redundant comments. Add proper PruneStalePeers test. 2020-01-14 10:49:34 +00:00
Milos Gajdos a91dad04ee Increment node error count and prune when Max limit is hit 2020-01-13 22:22:12 +00:00
Milos Gajdos b4261e8cf9 Updated log and comments 2020-01-13 20:14:30 +00:00
Milos Gajdos efcac3d009 Define tunnel errors 2020-01-13 20:14:30 +00:00
Milos Gajdos 770c7686ba Fix nasty bug when graph action may not have been executed in some
branches
2020-01-13 20:14:30 +00:00
Milos Gajdos 11904e1137 Regular sync with network every 5 minutes. Apply routes before peering. 2020-01-13 20:14:29 +00:00
Milos Gajdos 1e009e52dd Avoid having the same log statements in initNodes and resolveNodes 2020-01-13 20:14:29 +00:00
Milos Gajdos bf42c028fb Added sync message. Refactored connect flow. Adverts are gossipped.
This commit adds a Sync message which is sent as a reply to Connect
message. This should in theory speed up convergence of a (re)connecting
node.

We respond to Sync message by sending a peer message back to the peer
origin of the Sync message. We consequently update our routing table and
peer graph with the data sent in via Sync message.

We now gossip advertse to up to 3 randomly selected peers instead of
sending a multicast message to the network.

Equally, Solicitation i.e. full table adverts are gossipped to a
randomly selected peer. If that fails we send a multicast message to the
network.
2020-01-13 20:14:29 +00:00
Milos Gajdos 0a4bd02503 Add RefreshSync method for Sync bookkeeping 2020-01-13 20:14:29 +00:00
Milos Gajdos 63edfaa852 Added Sync message
Sync message will be sent between peers when a new node connects/joins
the network
2020-01-13 20:14:29 +00:00
Milos Gajdos 802cc8239a Send solicit message properly. Updated comments. 2020-01-13 20:14:29 +00:00
Matthew Costa 75b1a62af3 Replace service prefix with FQDN style prefix (#1107)
* Replace service prefix with FQDN style prefix

According to the k8s documentation, the label and annotation prefixes should be in the format of a FQDN, with dot separated labels of no more than 63 characters. The current label and annotation paramteres are rejected by the k8s api, most likely because they have two forward slashes in them.

* Use go.micro as service and annotation prefix
2020-01-12 14:37:12 +00:00
Maarten Bezemer 50b20413d3 RPC stream client/server mutex fix (#884)
* Unlock RPC client while actually receiving a message

As receiving a message might block for a long time, unblocking the client allows to let it send messages in the meanwhile without using 'tricks'

* Unlock RPC server while actually receiving a message

As receiving a message might block for a long time, unblocking the client allows to let it send messages in the meanwhile without using 'tricks'

* Protect Close() against race conditions

* Concurrency and Sequence tests
2020-01-12 09:13:14 +00:00
Shu xian fa5b3ee9d9 config/reader.Values add Set for specific path merge (#1099)
* add Set for specific path merge

* add Set

* add Del
2020-01-11 20:50:09 +00:00
Asim Aslam f50a50eeb3 go fmt 2020-01-10 21:54:36 +00:00
Asim Aslam e1e6199743 normalise runtime service status 2020-01-10 21:54:28 +00:00
Asim Aslam 61dd2b8489 Merge branch 'master' of ssh://github.com/micro/go-micro 2020-01-10 19:13:59 +00:00
Asim Aslam 6ca298c61d set default store, fix store options bug, add String method 2020-01-10 19:13:55 +00:00
Vasiliy Tolstov f4fb923fb2 pass additional context for broker subscribe (#1105)
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-01-10 15:04:15 +00:00
shikbupt 32a2005f6d add option for web service signal handler (#1091) 2020-01-10 14:25:28 +00:00
Asim Aslam 37d1139a57 ensure we close the grpc stream (#1098)
* ensure we close the grpc stream

* use g.Close

* use closed bool flag for checking connection close
2020-01-09 17:00:14 +00:00
Asim Aslam a90a74c9e2 Change the store interface to remove variadic args (#1095) 2020-01-08 22:23:14 +00:00
Milos Gajdos 78aed5beed Fixed tunnel race conditions. (#1094) 2020-01-08 14:48:38 +00:00
Milos Gajdos 59fccb82ec Updated comments. Tiny cleanup changes. (#1093) 2020-01-08 13:18:11 +00:00
Asim Aslam 048065fe96 support ability to set store, address and namespace via flags and env vars (#1092) 2020-01-08 12:11:31 +00:00
Asim Aslam 0b8ff3a8bb fix grpc json streaming by setting content sub type (#1089) 2020-01-07 18:37:34 +00:00
Asim Aslam 1892bd05a5 only add api endpoint metadata if it exists (#1087) 2020-01-06 22:22:36 +00:00
Asim Aslam be6e8a7c78 add store to defaults (#1086) 2020-01-06 17:44:32 +00:00
Asim Aslam df9055f69c continue to process messages even after the connection is closed 2020-01-03 20:43:53 +00:00
Asim Aslam 649dd235c3 Merge branch 'master' of ssh://github.com/micro/go-micro 2020-01-03 19:46:24 +00:00
Asim Aslam 1af82df8b1 Check link is grpc 2020-01-03 19:46:14 +00:00
Eagle Wu 7098e59b5c remove ignore error in method publish (#1075) 2020-01-03 17:24:19 +00:00
Shu xian 31362bc331 prevent resource leak (#1080) 2020-01-03 13:31:47 +00:00
Asim Aslam 4e2339749c Merge branch 'master' of ssh://github.com/micro/go-micro 2020-01-02 21:19:50 +00:00
Asim Aslam 9cecf2e097 make grpc proxy streaming work 2020-01-02 21:11:25 +00:00
Lars Lehtonen fe9c68238f runtime/kubernetes: remove unused name variable (#1078) 2020-01-02 20:42:46 +00:00
Asim Aslam 225b17559b fix log streaming 2020-01-02 18:23:43 +00:00
Asim Aslam e697912ee5 don't panic on nil 2020-01-01 21:56:29 +00:00
Asim Aslam 6358b9277d don't write anything if theres no data 2019-12-31 22:58:14 +00:00
Asim Aslam 45c986c5f1 don't marshal frame values 2019-12-31 21:36:22 +00:00
Asim Aslam fa01ff6604 update ctx test 2019-12-31 13:53:48 +00:00
Asim Aslam fe1e018e8e update wrapper test 2019-12-31 13:45:49 +00:00
Asim Aslam 60ea537bbc upper case the metadata 2019-12-31 13:37:29 +00:00
Asim Aslam 488dc31743 log when starting the service 2019-12-31 12:07:52 +00:00
Asim Aslam b6915f0898 set grpc by default (#1070) 2019-12-30 18:33:21 +00:00
Asim Aslam 04dfe4e867 fix breaking test 2019-12-30 17:39:02 +00:00
Asim Aslam d8fe030a4b go fmt 2019-12-30 17:29:57 +00:00
Asim Aslam f40d4578d5 go fmt 2019-12-30 17:29:45 +00:00
Asim Aslam e0078bbcd5 Remove use of config/cmd in api 2019-12-30 17:29:20 +00:00
Asim Aslam c145f355dd Moving to gRPC by default (#1069)
* Step 1

* Fix the test panics
2019-12-29 21:07:55 +00:00
Vasiliy Tolstov 943445270f fix registry check issue (#1067)
fix #1066

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2019-12-28 11:11:46 +00:00
Asim Aslam 61cde4a9f4 Kubernetes Registry (#1064)
* add teh k8s registry

* add k8s reg config/cmd

* go mod update
2019-12-27 20:08:46 +00:00
jamsonzan 22aa7d14b3 support streams pool for grpc (#1062)
* Update grpc_pool.go

* Update options.go

* Update grpc.go

* Update grpc_pool_test.go

* streams pool for grpc

* use busy list to speed up allocate while pool is very busy

* fix idle bug
2019-12-27 12:25:58 +00:00
Eagle Wu a09b6729cc Fix missing recover while occur panic in handler (#1063) 2019-12-27 10:53:11 +00:00
Asim Aslam 2fe64001c0 Start runtime services inline 2019-12-24 17:51:30 +00:00
Asim Aslam 14c9c412cd Move and rename 2019-12-24 17:45:17 +00:00
Asim Aslam 361fdfba04 move around k8s api 2019-12-24 17:42:22 +00:00
Asim Aslam 5c8d1ae2b9 Update k8s log options 2019-12-24 17:33:05 +00:00
Asim Aslam 81e20160f5 reorder 2019-12-23 08:49:53 +00:00
Asim Aslam ef95b28e3d add Write method to config source 2019-12-23 08:42:57 +00:00
shikbupt 1781542964 fix etcd LogConfig bug (#1056) 2019-12-23 07:29:13 +00:00
Asim Aslam 45208992b5 NewLog 2019-12-20 23:36:16 +00:00
Asim Aslam 847a01df82 Cleanup k8s logs 2019-12-20 23:34:08 +00:00
Jake Sanders ce33e3b072 Kubernetes logging (#1054)
* wip

* Implementation of Kubernetes Logger

* Missing file

* Skip test in Travis
2019-12-20 23:16:05 +00:00
Asim Aslam ae12fd1021 update crap logging 2019-12-19 18:25:22 +00:00
Asim Aslam 95ae2688a2 add formatters 2019-12-19 12:29:03 +00:00
Asim Aslam 2bcfb85613 Add log Format option 2019-12-19 12:20:33 +00:00
Asim Aslam d52a111735 add requests/errors to stats 2019-12-18 18:36:42 +00:00
Asim Aslam d4bec24eb7 Add os log buffer 2019-12-18 17:06:29 +00:00
Asim Aslam 2338e7c9d2 Cleanup go mod 2019-12-18 16:12:25 +00:00
Asim Aslam f0e841595c move to structured logging 2019-12-18 16:02:11 +00:00
Asim Aslam a82af19d43 strip newline 2019-12-18 15:19:20 +00:00
Asim Aslam 5d7254e79a fix the os logger 2019-12-18 15:06:25 +00:00
Asim Aslam 7c21a1b92a go fmt 2019-12-18 15:06:02 +00:00
Asim Aslam 587f64a87a Merge pull request #1051 from micro/event
publisher => event
2019-12-18 15:04:38 +00:00
Asim Aslam cb9c4c3aef publisher => event 2019-12-17 23:05:46 +00:00
Asim Aslam dda96cb87e Merge pull request #976 from micro/auth
First interface for auth
2019-12-17 21:38:11 +00:00
Asim Aslam ebae497a72 use service rather than resource 2019-12-17 21:37:20 +00:00
Asim Aslam 515014fbeb update with resource 2019-12-17 21:27:05 +00:00
Asim Aslam e9efcbe8dc strip logger 2019-12-17 18:34:21 +00:00
Asim Aslam 5a52593e66 go fmt 2019-12-17 18:24:00 +00:00
Asim Aslam c61e12d5ee add event proto for runtiem 2019-12-17 18:17:32 +00:00
Asim Aslam c2d59c1f4d Move logger 2019-12-17 18:16:45 +00:00
Jake Sanders 812fe9e640 Merge pull request #1049 from micro/kubernetes-logging
Kubernetes logging
2019-12-17 17:44:24 +00:00
Jake Sanders f95bccce84 Use UTC in tests 2019-12-17 17:36:01 +00:00
Jake Sanders 81e7edd666 Adhere to new interfaces 2019-12-17 17:24:01 +00:00
Asim Aslam 46fd205eda rename files 2019-12-17 17:08:38 +00:00
Jake Sanders c2b307e5bb Merge branch master of https://github.com/micro/go-micro into kubernetes-logging 2019-12-17 17:08:31 +00:00
Jake Sanders b7ac62f7d2 Merge branch 'master' of https://github.com/micro/go-micro into kubernetes-logging 2019-12-17 17:06:07 +00:00
Asim Aslam 50d5c6402b Merge pull request #1048 from micro/logging
Move stream to interface
2019-12-17 17:05:13 +00:00
Asim Aslam d2a3fd0b04 Move stream to interface 2019-12-17 16:56:55 +00:00
Jake Sanders 51f4bc6d56 Add logs to Interface 2019-12-17 16:30:09 +00:00
Jake Sanders c3607c23e7 Fix after merge 2019-12-17 16:27:17 +00:00
Jake Sanders 34b1c403bb Merge branch 'master' of https://github.com/micro/go-micro into kubernetes-logging 2019-12-17 16:13:36 +00:00
Asim Aslam 91e057440d Merge pull request #1047 from micro/decruft-logger
Decruft logger
2019-12-17 16:13:20 +00:00
Jake Sanders 53ca742c66 Update the util/kubernetes client to retrieve logs 2019-12-17 16:09:51 +00:00
Asim Aslam b35dfb1086 fix further breaks 2019-12-17 15:56:49 +00:00
Asim Aslam d502e2f58a fix breaks 2019-12-17 15:46:09 +00:00
Asim Aslam bc30efcf70 Decruft the debug logger interface 2019-12-17 15:38:03 +00:00
Jake Sanders 0415ead504 First commit for Kubernetes logger 2019-12-17 12:11:26 +00:00
Jake Sanders e95f44d3f8 Move runtime/kubernetes/client to util/kubernetes/client 2019-12-17 11:32:38 +00:00
Asim Aslam 0489ae91e9 Merge pull request #1021 from unistack-org/registry_check
add RegisterCheck web server option for internal health checks
2019-12-17 08:49:00 +00:00
Asim Aslam 4e02f444fd Merge pull request #1024 from unistack-org/server
add server Context option to pass own context
2019-12-17 08:48:39 +00:00
Asim Aslam 6027a81f06 Update router comments 2019-12-17 08:28:45 +00:00
Asim Aslam 01f0e70213 add some commented out stuff 2019-12-16 17:37:11 +00:00
Asim Aslam cb15fadcee go fmt 2019-12-16 17:36:47 +00:00
Asim Aslam 1c8d15fe4b Merge pull request #1046 from micro/storefix
Fix cockroachdb store implementation
2019-12-16 17:24:53 +00:00
Jake Sanders 55f5937c8b Remove debug 2019-12-16 17:16:10 +00:00
Jake Sanders 56619f2745 Fix cockroachdb store implemetation 2019-12-16 17:11:13 +00:00
Asim Aslam 0b59e2ce3d Merge pull request #1028 from Astone-Chou/fix
named return value for error defer modify.
2019-12-16 15:39:58 +00:00
Asim Aslam 1ea6390eae Add proxy string method 2019-12-16 15:18:20 +00:00
Asim Aslam 303adca500 rename postgres to cockroach 2019-12-16 15:09:59 +00:00
Asim Aslam 03700ae6c0 Replace proxy options 2019-12-16 14:55:47 +00:00
Asim Aslam a1ddfa827e Merge pull request #1045 from micro/store-options
change store options
2019-12-16 14:46:15 +00:00
Asim Aslam 59751c02e6 change store options 2019-12-16 14:38:51 +00:00
Jake Sanders e8e112144f Create database should take the name of the database 2019-12-16 14:15:30 +00:00
Asim Aslam 59246e0412 Merge pull request #1044 from micro/store-namespace
change use of store namespace/prefix in sql store
2019-12-16 12:20:57 +00:00
Asim Aslam 0131e9468f change use of store namespace/prefix in sql store 2019-12-16 12:13:18 +00:00
Asim Aslam d5951f1d7c Merge pull request #1042 from ZGeomantic/feat-client-mock
support ctx as input params, error as output for MockClient.Call
2019-12-15 15:12:17 +00:00
Asim Aslam f33b562c16 Merge pull request #1043 from jamsonzan/branch0
comment
2019-12-15 10:50:52 +00:00
jamsonzan 572fe58314 comment 2019-12-15 15:05:19 +08:00
gemantic 5602b93d7a support ctx as input params, error as output for MockClient.Call 2019-12-14 10:36:12 +08:00
Asim Aslam 64e438a8d4 Merge pull request #1038 from micro/tun
Next level tunnel optimisation
2019-12-13 15:34:03 +00:00
Asim Aslam b0b6b8fce2 final updates 2019-12-13 15:27:47 +00:00
Asim Aslam 417a05db60 Merge pull request #1039 from xpunch/etcdLogConfig
Etcd log config
2019-12-13 09:23:54 +00:00
johnson 11e42aac69 etcd can set log config
default log level is info, which will log o log of unused logs
2019-12-13 11:22:05 +08:00
potato 885ba8f905 Merge pull request #6 from micro/master
Pull latest go-micro
2019-12-13 11:10:29 +08:00
Asim Aslam caa74d1b5f fix build 2019-12-12 23:29:44 +00:00
Asim Aslam f6b4a9da1c strip some code 2019-12-12 23:20:31 +00:00
Asim Aslam 74c5102e41 strip a couple things 2019-12-12 21:49:39 +00:00
Asim Aslam 7bd50cd251 fix more broken cruft 2019-12-12 17:10:32 +00:00
Asim Aslam df728aaddd remove go routines from tunnel, fire network messages in go routines 2019-12-12 13:34:08 +00:00
Asim Aslam ae934c19f1 fix tunnel test 2019-12-12 13:04:34 +00:00
Asim Aslam e260cc4a24 save cruft 2019-12-12 12:27:46 +00:00
Asim Aslam 631faff7b8 Merge pull request #1035 from alrs/fix-grpc-test-goroutines
Fix service/grpc Test Goroutines
2019-12-11 16:39:22 +00:00
Lars Lehtonen fd531349d7 service/grpc: t.Fatal out of TestGRPCTLSService() goroutine 2019-12-11 08:29:23 -08:00
Lars Lehtonen 27bab29e3c service/grpc: t.Fatal out of TestGRPCService() goroutine 2019-12-11 08:29:14 -08:00
Asim Aslam 27af221fd2 batch metric updates 2019-12-11 15:23:08 +00:00
Asim Aslam 6e28e7a86f Save current state of the world 2019-12-11 14:37:03 +00:00
Asim Aslam ff69d46c98 strip some cruft from config/cmd 2019-12-10 18:12:29 +00:00
Asim Aslam e966944ae5 sort resolved node list in network by lowest priority 2019-12-10 17:57:04 +00:00
Asim Aslam 8da77a3ddc use fixed port names for runtime k8s 2019-12-10 14:05:05 +00:00
Asim Aslam 8289dbabc4 Merge pull request #1034 from micro/strip-handlers
Strip handlers
2019-12-10 11:54:06 +00:00
Asim Aslam d50f30d743 strip handlers 2019-12-10 11:46:13 +00:00
Asim Aslam f8533551a4 move debug to trace for network peer refresh 2019-12-10 09:09:24 +00:00
Asim Aslam 7e46ff5d92 strip some more logging down 2019-12-10 09:08:03 +00:00
Asim Aslam 6b1eef5354 Merge branch 'master' of ssh://github.com/micro/go-micro 2019-12-09 22:56:33 +00:00
Asim Aslam b29da80539 Move a few things around 2019-12-09 22:56:26 +00:00
Asim Aslam a725ab2c94 Merge pull request #1032 from jankremlacek/patch-1
nlopes/slack dep update to fix broken unmarshal
2019-12-09 21:17:34 +00:00
Jan Kremlacek 1582aa1572 proper go.mod, go.sum 2019-12-09 22:08:57 +01:00
Jan Kremlacek 5352d53346 nlopes/slack dep update to fix broken unmarshal
About a month ago Slack introduced the updated structure of RTM messages which resulted in an inability to unmarshal received msg (original issue: https://github.com/nlopes/slack/issues/630). It's not an issue of micro itself, but of the github.com/nlopes/slack lib. The fix was already merged into master (https://github.com/nlopes/slack/pull/618), but the lib has not been released in any new version.

Thus so I propose to update directly to the commit:

go get github.com/nlopes/slack@d06c2a2b3249b44a9c5dee8485f5a87497beb9ea

The MicroBot does now work now with any Slack client newer than around a month old.
2019-12-09 21:52:28 +01:00
Asim Aslam 7d884eff9d Merge pull request #1031 from alrs/fix-web-test-goroutines
web: fix test goroutines
2019-12-09 18:03:07 +00:00
Lars Lehtonen c9af88184b web: fix test goroutine in TestService() 2019-12-09 09:44:14 -08:00
Lars Lehtonen f25ad35f0a web: fix test goroutine in TestTLS() 2019-12-09 09:28:42 -08:00
Asim Aslam 55ab44c8be Merge branch 'master' of ssh://github.com/micro/go-micro 2019-12-09 09:32:33 +00:00
Asim Aslam 59c1680594 Move Debug to Trace in router 2019-12-09 09:32:17 +00:00
Asim Aslam b804303aa0 Merge pull request #1029 from Astone-Chou/lint_fix_fix
fix tiny error in linting fixes
2019-12-09 07:47:46 +00:00
Astone 55a15ecf12 fix tiny error in linting fixes 2019-12-09 11:18:45 +08:00
Astone caa1bcf9fe named return value for error defer modify. 2019-12-09 11:08:21 +08:00
Asim Aslam e2b2a30668 add net/http/pprof profiler 2019-12-08 20:31:16 +00:00
Asim Aslam a9be1288d2 Merge pull request #1026 from micro/tun
Network & Tunnel refactor
2019-12-08 16:01:46 +00:00
Asim Aslam 679214e598 just return filtered routes 2019-12-08 15:39:45 +00:00
Asim Aslam 6064e1426c fix some potential go routine leaks 2019-12-08 15:02:54 +00:00
Asim Aslam d28a868e46 Fix network startup connect 2019-12-08 14:37:17 +00:00
Asim Aslam 398acc67ca fix broken test 2019-12-08 13:45:24 +00:00
Asim Aslam ce578800d0 n.initNodes 2019-12-08 12:17:31 +00:00
Asim Aslam 6307d6ba51 further cleanup of tunnel/network 2019-12-08 12:12:20 +00:00
Asim Aslam 283c85d256 done 2019-12-08 00:53:55 +00:00
Asim Aslam 9bd0fb9125 save changes 2019-12-07 23:28:39 +00:00
Asim Aslam c445aed6b1 Cleanup and speedup network convergence along with direct messaging for connect and solicit 2019-12-07 19:54:29 +00:00
Asim Aslam 1d8c66780e save working solution 2019-12-06 00:18:40 +00:00
Asim Aslam 219efd27e9 Optimise the multicast to use one session in the tunnel 2019-12-05 23:11:42 +00:00
Asim Aslam ac9001ac74 advert ttl inline with router table tick 2019-12-05 17:50:32 +00:00
Asim Aslam 2896614595 Merge pull request #1025 from milosgajdos83/router-knobs
Changed a few router knobs to avoid storms ⛈
2019-12-05 17:50:02 +00:00
Milos Gajdos bca12a7003 Changed a few router knobs to avoid storms ⛈ 2019-12-05 17:11:17 +00:00
Vasiliy Tolstov 1c5a4c470f add server Context option to pass own context
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2019-12-05 19:37:03 +03:00
Asim Aslam 744b19d625 Merge pull request #1023 from milosgajdos83/dead-code
Fixing dead code and go vet moaning
2019-12-05 16:18:13 +00:00
Milos Gajdos 5865e89bed Fixing dead code and go vet moaning 2019-12-05 16:10:49 +00:00
Asim Aslam 3a10b1cdde Merge pull request #1022 from milosgajdos83/tunnel-races
This PR fixes various tunnel race conditions
2019-12-05 15:59:29 +00:00
Milos Gajdos 5db7514a91 This PR fixes various tunnel race conditions 2019-12-05 15:50:32 +00:00
Vasiliy Tolstov a957e90ca8 add RegisterCheck web server option for internal health checks
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2019-12-05 17:28:11 +03:00
Asim Aslam 18cf025056 Merge pull request #1020 from Allenxuxu/master
Avoid excessive memory usage
2019-12-05 11:56:44 +00:00
Allenxuxu b55b7d6b20 replace map with list 2019-12-05 19:29:48 +08:00
Asim Aslam 26b5d1994a Merge pull request #1019 from tboerger/no-newlin
No newlines at end of log messages
2019-12-05 10:08:16 +00:00
Thomas Boerger 30aec5b872 No newlines at end of log messages
Log messages should not end with a new line, this should be entirely
handled by the underlying log library.

Signed-off-by: Thomas Boerger <thomas@webhippie.de>
2019-12-05 10:56:45 +01:00
Asim Aslam b0626089f3 Merge pull request #1016 from unistack-org/lint
lint fixes mostly for prealloc also remove deadcode from grpc client
2019-12-05 08:33:52 +00:00
Asim Aslam af3d4e595f in memory stats buffer 2019-12-05 00:08:46 +00:00
Asim Aslam 40c09eed1c Logs to Log 2019-12-05 00:01:17 +00:00
Asim Aslam fe46e7a9e9 Logs to Log 2019-12-04 23:58:29 +00:00
Asim Aslam 78647c7027 add timestamp to stats 2019-12-04 23:51:07 +00:00
Asim Aslam 26755f86b1 Merge pull request #1018 from micro/debug-service
Debug service
2019-12-04 14:40:58 +00:00
Asim Aslam 898848795b tab indent 2019-12-04 12:28:16 +00:00
Asim Aslam 24efbe6a41 Move debug handler to service dir 2019-12-04 12:27:30 +00:00
Asim Aslam 97433f716f add service name to debug proto 2019-12-04 12:02:44 +00:00
Asim Aslam 5200febaea add stats debug interface 2019-12-04 11:53:20 +00:00
Vasiliy Tolstov a1eaf9cc20 linting fixes
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2019-12-04 00:22:02 +03:00
Asim Aslam 3f8af8c1e0 Merge branch 'master' of ssh://github.com/micro/go-micro 2019-12-03 20:32:10 +00:00
Asim Aslam becaeefcba Revert. DO NOT peer solicit until we know better 2019-12-03 20:32:02 +00:00
Vasiliy Tolstov 7d5bdcf993 fix pointer dereference in memory registry
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2019-12-03 23:05:03 +03:00
Asim Aslam 81a7cf458c Merge pull request #1013 from unistack-org/linting
add golanglint-ci
2019-12-03 16:57:00 +00:00
Asim Aslam a4ea61334b Merge pull request #1015 from milosgajdos83/router-race
Fix router race condition
2019-12-03 16:55:56 +00:00
Asim Aslam 3fbba9f83d Merge pull request #1014 from milosgajdos83/memreg-race
Fix memory registry race
2019-12-03 16:51:36 +00:00
Milos Gajdos 4a11a4c546 Fix router race condition 2019-12-03 15:22:54 +00:00
Milos Gajdos 265233517e Fix memory registry race 2019-12-03 14:53:07 +00:00
Vasiliy Tolstov c581ceb1dc add golanglint-ci
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2019-12-03 16:31:43 +03:00
Asim Aslam bb1a1358b7 Merge pull request #1012 from Astone-Chou/lint
improve code quality
2019-12-03 13:10:04 +00:00
Astone 29fb58db39 improve code quality 2019-12-03 20:59:02 +08:00
Asim Aslam b6f0164501 Merge branch 'master' of ssh://github.com/micro/go-micro 2019-12-03 08:11:46 +00:00
Asim Aslam 2c0801fc1c couple bug fixes in tunnel 2019-12-03 08:11:36 +00:00
Asim Aslam 34c92f4964 Merge pull request #1011 from Astone-Chou/master
optimize: a better way for return error
2019-12-03 07:48:21 +00:00
Astone f9b900b2ca optimize: a better way for return error 2019-12-03 12:47:29 +08:00
Asim Aslam b5d65305db Merge pull request #1009 from unistack-org/panics
recover panics
2019-12-02 23:30:17 +00:00
Vasiliy Tolstov b8e96f45d4 add recovery in case of panics
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2019-12-03 02:25:40 +03:00
Vasiliy Tolstov 90f9b0d0c9 initialize client options context if not provided
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2019-12-03 01:35:59 +03:00
Asim Aslam 972c0989af Merge pull request #1008 from micro/connect-fast
Optimizations to connect fast
2019-12-02 19:09:56 +00:00
Asim Aslam 5f04fd58ab optimizations to connect fast 2019-12-02 18:48:19 +00:00
Asim Aslam da04aa8ae8 Switch to AdvertiseLocal by default 2019-12-02 17:36:20 +00:00
Asim Aslam 62bf0df864 Merge pull request #1007 from micro/ultra-hacks
ultra hacks to make debug handler work in proxy
2019-12-02 15:11:56 +00:00
Asim Aslam 91e9c0cb62 ultra hacks to make debug handler work in proxy 2019-12-02 14:55:35 +00:00
Asim Aslam 3356b83f24 register debug handler 2019-12-01 21:04:09 +00:00
Asim Aslam 795ec509fd Merge branch 'master' of ssh://github.com/micro/go-micro 2019-12-01 19:43:45 +00:00
Asim Aslam 93d66afe8c fix that broken logic 2019-12-01 19:43:36 +00:00
Asim Aslam c840cee404 A variety of fixes to try combat the multicast issue 2019-12-01 19:36:16 +00:00
Milos Gajdos e48cce6485 Merge pull request #1005 from milosgajdos83/nano-seconds
Time resolution change to be in line with debug/handler.Handler
2019-12-01 18:39:59 +00:00
Milos Gajdos b2ecd93404 Time resolution change to be in line with debug/handler.Handler 2019-12-01 18:33:08 +00:00
Asim Aslam 2928c66624 Merge pull request #1004 from milosgajdos83/debug-logs
[WIP] Debug logs
2019-12-01 17:40:40 +00:00
Milos Gajdos 4613a820ca Small refactoring og logs
* log.Write now accepts log.Record
* we stream last 10 records first
* regenerate proto because of the above
2019-12-01 13:16:44 +00:00
Milos Gajdos ecdadef633 Added hack support for logs streaming cruft 2019-12-01 13:16:44 +00:00
Milos Gajdos 7f1dea72f2 Simplified Logs RPC. Cleaned up code. Added comments. 2019-12-01 13:16:44 +00:00
Milos Gajdos 612f872f76 Server should not close the stream when done 2019-12-01 13:16:44 +00:00
Milos Gajdos 13d2a9ec7a Register proto handler properly 2019-12-01 13:16:44 +00:00
Milos Gajdos 9fab47ecdb Added DefaultLog variables 2019-12-01 13:16:44 +00:00
Milos Gajdos 265e8ade05 Embed DebugHandler proto 2019-12-01 13:16:44 +00:00
Milos Gajdos 60e0e81523 Added debug/service to grab the logs from a service 2019-12-01 13:16:43 +00:00
Milos Gajdos b01357058a Regenerate proto cruft 2019-12-01 13:16:43 +00:00
Milos Gajdos 7deafbc5ce Added ReadOptions; Changed proto; Reimplemented Log(er) 2019-12-01 13:16:43 +00:00
Milos Gajdos 9e177be560 Embed logger into debug.Handler 2019-12-01 13:16:43 +00:00
Milos Gajdos ee9776e7b2 Added debug.Logger interface 2019-12-01 13:16:43 +00:00
Milos Gajdos 3f7f2afc7b Dont be stupid -- stream does not require pointer. 2019-12-01 13:16:43 +00:00
Milos Gajdos 4e965e4ce5 First commit. Modified proto. Added empty handler method. 2019-12-01 13:16:43 +00:00
Asim Aslam 6f1c30aef5 remove unused value in router 2019-11-30 21:39:03 +00:00
Asim Aslam 00bbb3ac61 revert some protocol changes for now 2019-11-30 21:20:33 +00:00
Asim Aslam ce1942c578 why didn't we think of this before...single service name for http broker 2019-11-30 21:00:36 +00:00
Asim Aslam df7169c9f2 Merge branch 'master' of ssh://github.com/micro/go-micro 2019-11-30 01:16:53 +00:00
Asim Aslam 5e59db4c6d revert mdns timeout 2019-11-30 01:16:32 +00:00
Asim Aslam 25b3fda25b Merge pull request #1002 from micro/tun-fix
fix bug in the tunnel which causes multicast connections to be closed
2019-11-30 01:16:12 +00:00
Asim Aslam 9678daeafa fix bug in the tunnel which causes multicast connections to be closed 2019-11-30 01:14:40 +00:00
Asim Aslam 9ed257f151 Merge pull request #1001 from micro/storm
Changes for the storm
2019-11-29 17:33:23 +00:00
Asim Aslam 107124e5dc Changes for the storm 2019-11-29 17:27:29 +00:00
Asim Aslam ce4acfa892 fix type filtering for k8s runtime 2019-11-29 13:05:18 +00:00
Asim Aslam 6bf4828296 triple the mdns timeout 2019-11-29 13:05:07 +00:00
Asim Aslam 76b4e78a6a fix command to accept variadic args 2019-11-29 11:55:25 +00:00
Asim Aslam 8b6475b8d4 Merge pull request #1000 from micro/runtime-type
Support service types in runtime
2019-11-29 11:46:21 +00:00
Asim Aslam c3ed83dfba Support service types in runtime 2019-11-29 11:35:00 +00:00
Asim Aslam 114bc1e18b Merge pull request #995 from micro/rpc-leak
Fix rpc go routine leak
2019-11-27 17:24:19 +00:00
Asim Aslam af94899b54 Fix rpc go routine leak 2019-11-27 17:12:07 +00:00
Asim Aslam 266b6dbc64 add debug buffer time based access 2019-11-27 13:57:19 +00:00
Asim Aslam 5932dd753c Merge pull request #981 from unistack-org/subscriber
subscriber recovery
2019-11-27 10:28:51 +00:00
Vasiliy Tolstov 86a6328254 subscriber recovery
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2019-11-27 13:21:20 +03:00
Asim Aslam 0d33c029a9 Merge pull request #994 from milosgajdos83/validator-regexp
Remove validator regexp as its no longer needed.
2019-11-27 08:10:00 +00:00
Milos Gajdos 8ecd2381a4 Remove validator regexp as its no longer needed. 2019-11-26 23:10:45 +00:00
Asim Aslam 7318807dce Merge pull request #993 from micro/k8s-fixes
Add fixes for label selector and skipping things that don't match
2019-11-26 22:32:58 +00:00
Asim Aslam 811275be26 Add fixes for label selector and skipping things that don't match 2019-11-26 22:28:08 +00:00
Asim Aslam 3f3fd38601 Add spec.template.metadata.annotations to the k8s template 2019-11-26 18:14:49 +00:00
Asim Aslam 44dd0b1302 Merge pull request #991 from micro/k8s-update
Patch spec template annotations and use event timestmap
2019-11-26 17:38:56 +00:00
Asim Aslam 6475c1f3ad Patch spec template annotations and use event timestmap 2019-11-26 17:33:41 +00:00
Asim Aslam deabf0b8c9 fix entry into nil map 2019-11-26 14:56:23 +00:00
Asim Aslam 04ee4b04ad Merge pull request #990 from micro/buffer
Add debug/buffer package as a simple ring buffer
2019-11-26 14:27:39 +00:00
Asim Aslam 2892686c5f Merge pull request #988 from micro/k8s-update
Change the k8s runtime notifier update to get the deployment and upda…
2019-11-26 14:21:42 +00:00
Asim Aslam 8ee31a63f1 Add debug/buffer package as a simple ring buffer 2019-11-26 14:20:45 +00:00
Asim Aslam 4e363da91f Merge pull request #989 from micro/proto
Regenerate the protos
2019-11-26 13:57:49 +00:00
Asim Aslam 8b63df7a98 regenerate the protos 2019-11-26 13:53:33 +00:00
Asim Aslam b06854b0d5 Change the k8s runtime notifier update to get the deployment and update build 2019-11-26 13:49:52 +00:00
Jake Sanders 39bf71376a Add some more issue templates (#987)
* Add some more issue templates

* Update bug_report.md

* Update bug_report.md
2019-11-26 11:48:14 +00:00
Jake Sanders 12d9c5b187 Merge pull request #986 from micro/bug-report-template
Create Bug Report Issue Template
2019-11-26 11:25:42 +00:00
Jake Sanders d2eba3f8f9 Create Bug Report Issue Template
To encourage users to provide context with bug reports
2019-11-26 11:17:32 +00:00
Milos Gajdos 19f2f8b161 Merge pull request #982 from xmlking/master
go-micro docker now includes unprivileged user
2019-11-26 10:54:18 +00:00
Sumanth Chinthagunta d41185eb84 go-micro docker now includes unprivileged user 2019-11-25 18:42:24 -08:00
Asim Aslam c420fa2dec Merge pull request #979 from milosgajdos83/tunnel-encrypt
[WIP] Tunnel encryption
2019-11-25 19:12:24 +00:00
Asim Aslam db03a564fb Merge pull request #980 from unistack-org/issue-940
grpc client goroutine leak fix
2019-11-25 19:10:34 +00:00
Vasiliy Tolstov 9763820c75 grpc client goroutine leak fix
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2019-11-25 22:02:24 +03:00
Milos Gajdos 9095b99f6b Token has been stripped; Headers are encrypted 2019-11-25 18:56:00 +00:00
Asim Aslam 080363e8c4 The mega cruft proxy PR (#974)
* the mega cruft proxy PR

* Rename broker id

* add protocol=grpc

* fix compilation breaks

* Add the tunnel broker to the network

* fix broker id

* continue to be backwards compatible in the protocol
2019-11-25 16:31:43 +00:00
Asim Aslam 252667398e Update the runtime for k8s name formatting and move Get to Read endpoint (#978)
* Update the runtime for k8s name formatting and move Get to Read endpoint

* strip regex validation
2019-11-25 16:31:14 +00:00
Milos Gajdos f82c267d81 Encrypt session communication 2019-11-25 15:37:38 +00:00
Milos Gajdos 61fe552ac4 First commit: Outline of tunnel encryption code 2019-11-25 14:58:12 +00:00
Asim Aslam 7013e7467f Undefined time 2019-11-25 09:33:30 +00:00
Asim Aslam dbc537007d First interface for auth 2019-11-25 09:30:26 +00:00
Asim Aslam 95045be83d Merge branch 'master' of ssh://github.com/micro/go-micro 2019-11-23 22:50:45 +00:00
Asim Aslam 52ccd900c7 reorder service struct fields 2019-11-23 22:50:13 +00:00
罗泽轩 64a251d69a improve the syncMap.Iterate test to make it 100% reproducible (#970)
* improve the syncMap.Iterate test to make it 100% reproducible

* rename store/mocks/Store.go

* rename mocks/store to mock/store
2019-11-23 14:13:17 +00:00
Asim Aslam cae4148594 Fix platform specific os/process build 2019-11-23 08:25:56 +00:00
Milos Gajdos 38e29c5101 Svc metadata (#972)
* Added service metadata

* Added metadata to runtime service

* Add Annotations metadata to service metadata

* Add micro/micro as default service owners

* Update runtime/kubernetes/client/kubernetes.go

Change comment

Co-Authored-By: Jake Sanders <i@am.so-aweso.me>
2019-11-22 17:10:00 +00:00
Milos Gajdos 8dc3fb964e Pass source of service to Deployment API; render templates properly (#969)
* Pass source of service to Deployment API; render templates properly

* Enable Go modules by default. Honor runtime.Service.Exec

* Make sure you remove go.mod and go.sum
2019-11-21 17:31:13 +00:00
Asim Aslam 212144d658 fix windows compilation error 2019-11-21 11:19:52 +00:00
Milos Gajdos 11d81221cc Runtime service implementation (#965) 2019-11-20 14:54:42 +00:00
Milos Gajdos 55252cbc32 Fix the router test; get rid of time dependency (#964) 2019-11-20 14:53:12 +00:00
Asim Aslam c87a58db0a add ability to set web icon 2019-11-20 12:43:43 +00:00
Vasiliy Tolstov 49d73faa5f return error to caller on grpc server request processing (#962)
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2019-11-20 10:28:30 +00:00
Vasiliy Tolstov da6c1be607 dont panic on missing headers in broker event (#963)
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2019-11-20 07:55:47 +00:00
Milos Gajdos 94d409b180 Change DefaultImage to micro/go-micro 2019-11-19 20:49:01 +00:00
Milos Gajdos d6e97c5970 Service.Exec is a slice of strings (#960) 2019-11-19 19:36:29 +00:00
Asim Aslam 64d5a528ca fix broken build 2019-11-19 16:55:33 +00:00
Milos Gajdos 538d3752f9 Added Dockerfile for go-micro (#959) 2019-11-19 16:50:31 +00:00
Asim Aslam fb5b358ae2 fix mdns test 2019-11-19 16:50:16 +00:00
Milos Gajdos 6a0082741c Packager is now builder (#958) 2019-11-19 16:09:43 +00:00
Shu xian 5744050943 api event supports for GET url params (#956) 2019-11-18 16:37:45 +00:00
Asim Aslam 168cc06827 increase timeout on travis 2019-11-18 12:58:06 +00:00
Asim Aslam fa01cadc35 lower the mdns timeout to 10ms (#955) 2019-11-18 12:50:51 +00:00
Asim Aslam 342c29de7d fix TestMemoryRegistryTTLConcurrent test 2019-11-16 21:13:06 +00:00
Asim Aslam eeed493766 move test data 2019-11-16 18:52:27 +00:00
Asim Aslam 90d7a87914 Move wrapper internally since its not top level relevant 2019-11-16 18:48:24 +00:00
Erik Hollensbe a1c6cdf193 Now specify HandleSignal as an option to toggle signal handling. (#948)
Signed-off-by: Erik Hollensbe <github@hollensbe.org>
2019-11-16 11:13:34 +00:00
Erik Hollensbe bec13a45cd Attempt to fix the timing error in the memory concurrency test (#952)
Only shows in travis

Signed-off-by: Erik Hollensbe <github@hollensbe.org>
2019-11-16 11:11:13 +00:00
Erik Hollensbe 4107733453 Memory registry from #801 with additional tweaks (#951)
* PoC: memory registry using maps instead of slice madness

* Updated proto and handlers. Fixed tests across codebase.

* Implemented ttl pruning for memory registry

* Added extensive memory registry tests

* Squased a bunch of bugs

* Proto indent; memory.Registry.String() returns "memory"

* Write a test to prove memory registry TTLs are busted

Signed-off-by: Erik Hollensbe <github@hollensbe.org>

* Additional memory testing and fixups:

* DefaultTTL removed
* When TTL == 0, it is automatically removed from expiry conditions
* Additional improvements to new tests

Signed-off-by: Erik Hollensbe <github@hollensbe.org>
2019-11-16 10:55:11 +00:00
Milos Gajdos 97c1300f53 [WIP] Micro Runtime (#947)
* Add Get() and GetOptions.

* Removed watcher. Outline of client. YAML templates

* Added default service and deployment templates and types

* Added API tests and cleaned up errors.

* Small refactoring. Template package is no more.

* Ripped out existing code in preparation to small rework

* Reshuffled the source code to make it organized better

* Create service and deployment in kubernetes runtime

* Major cleanup and refactoring of Kubernetes runtime

* Service now handles low level K8s API calls across both K8s deployment
an service API objects
* Runtime has a task queue that serves for queueing runtime action
requests
* General refactoring

* No need for Lock in k8s service

* Added kubernetes runtime env var to default deployment

* Enable running different versions of the same service

* Can't delete services through labels

* Proto cruft. Added runtime.CreateOptions implementation in proto

* Removed proxy service from default env variables

* Make service name mandatory param to Get method

* Get Delete changes from https://github.com/micro/go-micro/pull/945

* Replaced template files with global variables

* Validate service names before sending K8s API request

* Refactored Kubernetes API client. Fixed typos.

* Added client.Resource to make API resources more explicit in code
2019-11-15 13:41:40 +00:00
mirwaisx 0af8be35bb -bugfix #889 set body corretly in case of missing content-type (#950) 2019-11-15 13:03:45 +00:00
Asim Aslam a91b3f3e8b windows specific os tag 2019-11-15 08:20:05 +00:00
Asim Aslam 383658edf2 Fix a runtime deadlock as well as fixing some graceful exiting issues (#945) 2019-11-14 14:26:21 +00:00
Asim Aslam 16754a7477 Set theme jekyll-theme-architect 2019-11-14 11:55:07 +00:00
Asim Aslam 58b25d7241 Update CNAME 2019-11-14 11:54:16 +00:00
Asim Aslam 1c7d44282e Set theme jekyll-theme-minimal 2019-11-14 11:17:02 +00:00
Asim Aslam 8e9eef794f Set theme jekyll-theme-minimal 2019-11-14 11:15:50 +00:00
Asim Aslam 920c026f14 Create CNAME 2019-11-14 11:01:36 +00:00
Asim Aslam 946c76cb03 Delete CNAME 2019-11-14 11:01:27 +00:00
Asim Aslam 43d11a9b8d Create CNAME 2019-11-14 10:50:51 +00:00
Asim Aslam 9f481542f3 Fix a codec race by locking the buffers. Include a buffer pool for perf. (#941)
* Fix a codec race by locking the buffers. Include a buffer pool for perf.

* Read Lock on buffer Read
2019-11-13 11:05:53 +00:00
Asim Aslam cffa5b6b50 Make use of cloudflare 1.0.0.1 by default to resolve addresses 2019-11-12 15:46:30 +00:00
Asim Aslam 8867539d78 Update FUNDING.yml 2019-11-12 12:35:09 +00:00
Asim Aslam 671408b3a5 Create FUNDING.yml 2019-11-12 12:27:51 +00:00
Lars Lehtonen bdb62e8ed1 store/postgresql: fix dropped error (#938) 2019-11-12 07:54:33 +00:00
Asim Aslam 72522a869a fix endpoint extractor panic 2019-11-11 17:37:48 +00:00
Asim Aslam fd5c29addc Add the ability to only advertise local routes or don't advertise at all (#932)
* Add the ability to only advertise local routes or don't advertise at all

* Reorder processing to shortcircuit no advertising
2019-11-11 15:28:37 +00:00
Asim Aslam 65b1283459 add metadata.Get(context, key) as short hand 2019-11-11 09:13:02 +00:00
Huang.X 5ffe367cae fix# Change the Log level and add WarnLevel (#935)
* fix# Change the Log level and add WarnLevel

* fix# Change the Log level and add WarnLevel
2019-11-11 07:57:13 +00:00
Till Knuesting 5ae3e179b9 preallocated slices (#934) 2019-11-11 00:03:51 +00:00
Vasiliy Tolstov c696a859be fix data race for server Wait option (#931)
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2019-11-09 21:52:41 +00:00
Asim Aslam 174b01ca29 update link in readme 2019-11-09 16:20:54 +00:00
Asim Aslam c433de80cd Update go mod 2019-11-09 15:44:52 +00:00
Asim Aslam f2b4c07a00 Merge branch 'master' of ssh://github.com/micro/go-micro 2019-11-09 15:37:54 +00:00
Asim Aslam 929ffdcc42 Update readme 2019-11-09 15:37:30 +00:00
Lars Lehtonen 5aa28dfb0d store/cloudflare: fix dropped error (#930) 2019-11-09 15:18:51 +00:00
Asim Aslam a9e8fc6039 Don't set stream unless its true 2019-11-09 10:32:52 +00:00
Milos Gajdos 0b1e6d7eaf Simplified k8s API Body watcher code and test. (#923) 2019-11-08 15:57:32 +00:00
Milos Gajdos 1ffa289d39 Make build timestamp parsing errors clearer (#929) 2019-11-08 15:57:07 +00:00
Milos Gajdos 68419cc024 Patch deployment spec metadata (#928) 2019-11-08 14:12:03 +00:00
Vasiliy Tolstov 8227206208 use service id in profile file name (#925)
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2019-11-08 09:11:55 +00:00
Milos Gajdos 6f28852e1b K8s list deployments (#921)
* Outline of ListDeployments method

* Added implementation of DeploymentList
2019-11-07 07:44:57 +00:00
Asim Aslam 0e3550229b update readme 2019-11-06 22:04:02 +00:00
Asim Aslam f9400ba713 update readme 2019-11-06 22:03:35 +00:00
Asim Aslam ce080d76c6 add debug/profile package (#920)
* add debug/profile package

* set service+version for profile
2019-11-06 19:36:04 +00:00
Asim Aslam 254045e9f3 Remove go routines for mdns watcher and cache registry (#919) 2019-11-06 15:49:40 +00:00
Milos Gajdos b84134581c Flap detection vol2 (#915)
* We now purge flapping routes before regular tick processes them

* Updated comments

* Record the timestamp as soon as you receive the event

* Set route Address to routing table test

* Fixed a bunch of deadlocks. Added basic Router tests.
2019-11-05 17:44:24 +00:00
Till Knuesting f67c5e779f preallocated slices (#917) 2019-11-05 17:43:12 +00:00
Milos Gajdos 4a694c9d02 Change flap detection configuration (#914)
* Change flap detection configuration

* Make PenaltyHalfLife a float, not int 🤦‍♂️

* Lower event suppression to 200
2019-11-04 19:01:52 +00:00
Till Knuesting 24b8d2a315 preallocating slices (#904)
* preallocated some slices when size is known

* gofmt

* gofmt
2019-11-04 10:33:53 +00:00
Asim Aslam 2f3c251b00 Recovery should be < 500 2019-11-03 17:10:00 +00:00
Asim Aslam c1b0a968ae Augment the router penalty and decay as a hack fix (#912)
* Augment the router penalty and decay as a hack fix

* increase recovery cost
2019-11-03 16:29:10 +00:00
Asim Aslam 81e9298be6 Merge branch 'master' of ssh://github.com/micro/go-micro 2019-11-03 16:12:24 +00:00
Asim Aslam 45cd14c4b7 Suppress log messages 2019-11-03 16:12:17 +00:00
罗泽轩 8579c8b321 avoid deadlock in syncMap.Iterate (#909)
Previously, when syncMap iterates a list of records which have the same
content in different order, a deadlock might happen. By enforcing a certain
order, the deadlock can be avoided.
2019-11-03 08:18:48 +00:00
罗泽轩 bd37e67839 fix a typo in sync/lock/memory package (#910) 2019-11-03 08:17:01 +00:00
Asim Aslam d3151f1f0f Merge branch 'master' of ssh://github.com/micro/go-micro 2019-11-02 23:13:10 +00:00
Asim Aslam c45ea62ea8 Do not deregister services in the monitor unless Reap is called 2019-11-02 23:13:01 +00:00
Yang Shi c14bf5dc4e improve the log of panic recovering (#906) 2019-11-02 23:08:54 +00:00
Asim Aslam 292da40886 runtime handler/proto placeholder 2019-11-02 22:54:35 +00:00
Milos Gajdos 6f7702a093 [WIP] K8s update and runtime package changes (#895)
* First commit: outline of K8s runtime package

* Added poller. Added auto-updater into default runtime

* Added build and updated Poller interface

* Added comments and NewRuntime that accepts Options

* DefaultPoller; Runtime options

* First commit to add Kubernetes cruft

* Add comments

* Add micro- prefix to K8s runtime service names

* Get rid of import cycles. Move K8s runtime into main runtime package

* Major refactoring: Poller replaced by Notifier

POller has been replaced by Notifier which returns a channel of events
that can be consumed and acted upon.

* Added runtime configuration options

* K8s runtime is now Kubernetes runtime in dedicated pkg. Naming kung-fu.

* Fix typo in command.

* Fixed typo

* Dont Delete service when runtime stops.

runtime.Stop stops services; no need to double-stop

* Track runtime services

* Parse Unix timestamps properly

* Added deployments into K8s client. Debug logging
2019-11-02 13:25:10 +00:00
Asim Aslam a94a95ab55 Merge pull request #908 from hb-chen/fix-907
fix-907
2019-11-02 08:59:14 +00:00
Hobo86 e8d2f207d8 fix-907
web service need modify registry service nodes while register interval
2019-11-02 16:39:56 +08:00
Asim Aslam bd1918900e Merge pull request #901 from micro/sqlstore
Implementation of PostgreSQL for micro store
2019-11-01 15:48:47 +00:00
Asim Aslam cf3af68e31 Merge pull request #903 from tegk/gofmt
used gofmt with -s flag on whole project
2019-11-01 15:25:53 +00:00
Jake Sanders 15e3b9b4c0 Let people connect with just a hostname 2019-11-01 15:16:05 +00:00
Asim Aslam 107a7ab07f Merge pull request #902 from micro/runtime-panic
Fix panic caused when ctrl+c a non started service
2019-11-01 15:12:33 +00:00
Asim Aslam e9dfccc616 Fix panic caused when ctrl+c a non started service 2019-11-01 15:08:01 +00:00
tegk f88518d994 used gofmt with -s flag on whole project 2019-11-01 15:07:53 +00:00
Jake Sanders ee35fe61af update go.mod for postgres 2019-11-01 14:13:47 +00:00
Jake Sanders dee63b2b2c Implementation of postgres store 2019-11-01 14:13:21 +00:00
Asim Aslam 0aa01b2ebf Output the build error in plugin 2019-11-01 08:33:14 +00:00
Asim Aslam f089a89e8a Merge pull request #897 from micro/route-filtering
add ability to filter routes based on headers
2019-11-01 08:15:23 +00:00
Asim Aslam 174fbde049 add ability to filter routes based on headers 2019-10-31 22:34:06 +00:00
Asim Aslam 967d7ecda7 fix runtime panic 2019-10-31 22:30:21 +00:00
Asim Aslam fb76755684 Merge branch 'master' of ssh://github.com/micro/go-micro 2019-10-31 17:22:45 +00:00
Asim Aslam cf593e7c50 fix link panic 2019-10-31 17:22:38 +00:00
Asim Aslam 74286c2939 Merge pull request #893 from yandd/master
fix rcache ttl
2019-10-30 21:31:08 +00:00
yandd f9c639af4e fix rcache ttl 2019-10-30 14:01:51 +08:00
Asim Aslam dab0f3223f Add Update/List endpoints to runtime 2019-10-29 12:29:21 +00:00
Asim Aslam d89256d8d5 add network resolver record priority field 2019-10-28 15:31:46 +00:00
Asim Aslam 99b410c81b fix metadata test 2019-10-25 23:28:43 +01:00
Asim Aslam 92b7d2db3b Rename to Merge 2019-10-25 23:27:59 +01:00
Asim Aslam 20c6c36bc4 Merge pull request #883 from xmlking/master
PatchContext method added
2019-10-25 23:23:37 +01:00
Asim Aslam 1f626a55ed Merge pull request #887 from micro/collapse-routes
hash address based on service name + node address
2019-10-25 23:12:56 +01:00
Asim Aslam b42d242ec1 hash address based on service name + node address 2019-10-25 23:06:49 +01:00
Asim Aslam 51922c1763 Refresh route metrics in the proxy 2019-10-25 22:46:43 +01:00
Sumanth Chinthagunta 1c6b85e05d AppendContext with overwrite flag 2019-10-25 08:27:28 -07:00
Asim Aslam e85863d6cc Merge pull request #886 from micro/tunnel-error
Don't error where the connection is not unicast
2019-10-25 15:48:09 +01:00
Asim Aslam 5d7bf53f78 don't error where the connection is not unicast 2019-10-25 15:41:37 +01:00
Asim Aslam 44c0f1946d Merge pull request #882 from micro/link-state
A few changes for the network / tunnel link state
2019-10-25 14:28:43 +01:00
Asim Aslam 1c9ada6413 Reorder setChannel method 2019-10-25 14:24:37 +01:00
Asim Aslam c170189efb We need the message back to set the link 2019-10-25 14:22:38 +01:00
Asim Aslam 3831199600 Use best link in tunnel, loop waiting for announce and accept messages, cleanup some code 2019-10-25 14:16:22 +01:00
Sumanth Chinthagunta 1f658cfbff adding PatchContext - this will create new context with original + patch metadata 2019-10-24 17:51:54 -07:00
Asim Aslam f26d470db1 A few changes for the network / tunnel link state 2019-10-24 17:51:41 +01:00
Asim Aslam f5b8a12106 Merge pull request #880 from milosgajdos83/tunnel-sessionlink
Make sure we pick some link when Dialling
2019-10-24 16:14:32 +01:00
Milos Gajdos 494eb13534 Make sure we pick some link when Dialling 2019-10-24 16:07:31 +01:00
Asim Aslam 4db1e09798 change options to be trimmed down 2019-10-23 23:12:45 +01:00
Asim Aslam 232c8ac7a1 More cleanup of store cf 2019-10-23 23:10:44 +01:00
Asim Aslam 68d0efbeaa Move api types in cf store 2019-10-23 22:57:11 +01:00
Asim Aslam 70aaca9876 further cleanup 2019-10-23 22:54:55 +01:00
Asim Aslam 3ce71e12ff Don't recall vals everywhere 2019-10-23 22:51:08 +01:00
Asim Aslam fb3d729681 sync map uses store list 2019-10-23 22:35:28 +01:00
Asim Aslam d65658c890 Update options usage in store/api 2019-10-23 22:31:36 +01:00
Asim Aslam 3fc04f4dff fixup some acme related things 2019-10-23 22:15:15 +01:00
Asim Aslam 82f94c7861 Change store.Sync to store.List 2019-10-23 22:05:39 +01:00
Asim Aslam ecac392dbe unexport api response/message in cloudflare store 2019-10-23 21:54:37 +01:00
Asim Aslam 4e5a568063 races, race conditions everywhere 2019-10-23 21:24:31 +01:00
Asim Aslam 87de2ecaa0 Merge pull request #876 from milosgajdos83/peerlink-route-metric
Peerlink route metric
2019-10-23 20:31:21 +01:00
Milos Gajdos 4f1dd3f965 Fixed a small messup when printing logs 2019-10-23 20:01:45 +01:00
Milos Gajdos 71122836b8 Use event.Route.Link for getting the route metrics 2019-10-23 19:55:01 +01:00
Milos Gajdos b67be88952 Check for local links and empty gateways 2019-10-23 19:48:26 +01:00
Asim Aslam 83b232ae26 Merge pull request #879 from micro/cloudflareexpiry
Throw away cloudflare-go library and reimplement workers KV
2019-10-23 17:44:13 +01:00
Milos Gajdos 776284b187 Make sure you dont overflow MaxInt64 2019-10-23 17:42:04 +01:00
Jake Sanders 53ee4ee482 goodbye cloudflare-go 2019-10-23 17:33:20 +01:00
Milos Gajdos 35729092e0 Unexport network.Message 2019-10-23 17:32:45 +01:00
Jake Sanders 4f5db08238 Remove cloudflare-go and reimplement workers KV 2019-10-23 17:31:15 +01:00
Milos Gajdos 68789af4ea Prune peerlinks of pruned nodes 2019-10-23 17:29:03 +01:00
Milos Gajdos b3d4a7f740 If no link found, return max possible value 2019-10-23 16:51:22 +01:00
Milos Gajdos f4f178c130 Set metric on egress. Increment metric on ingress. 2019-10-23 16:51:22 +01:00
Milos Gajdos 1ff65e140a Change router.Route metric to int64. Set the route metric properly 2019-10-23 16:51:22 +01:00
Milos Gajdos 326156671d Set route metric to link Length 2019-10-23 16:51:22 +01:00
Milos Gajdos 6353b2b894 Keep track of peer links 2019-10-23 16:51:22 +01:00
Asim Aslam caca93f65b Merge pull request #877 from micro/tun-delay
Tunnel Delay and link buffers
2019-10-23 16:49:18 +01:00
Asim Aslam bf4a73d5c0 Close the socket in the link 2019-10-23 16:39:26 +01:00
Asim Aslam fe180148a1 rearrange where we account for errors and data sent 2019-10-23 16:15:39 +01:00
Asim Aslam 842fc01568 add send/recv queues for link 2019-10-23 16:05:21 +01:00
Asim Aslam d4832e8f34 Remove consul registry (#818) 2019-10-23 15:53:28 +01:00
Asim Aslam 5ac5865154 add comment 2019-10-23 10:55:53 +01:00
Asim Aslam f07a6ac29b Merge pull request #875 from micro/tun-measure
Measure roundtrip times on link
2019-10-22 21:20:57 +01:00
Asim Aslam d64f8c665e add rate measure 2019-10-22 19:38:29 +01:00
Asim Aslam 407694232a Measure roundtrip times on link 2019-10-22 18:43:09 +01:00
Asim Aslam 418b8648bb Merge pull request #874 from micro/tun-metrics
Add placeholders for link metrics
2019-10-22 17:03:07 +01:00
Asim Aslam 85e273afa5 reorder methods 2019-10-22 17:02:22 +01:00
Asim Aslam ab9fa20a50 Update comments 2019-10-22 16:53:47 +01:00
Asim Aslam 4fddd69229 Add placeholders for link metrics 2019-10-22 16:50:00 +01:00
Asim Aslam 317cf76566 Merge pull request #872 from micro/round-robin
Round robin routes we've sorted by metric
2019-10-22 11:58:44 +01:00
Asim Aslam f792fac1cc Round robin routes we've sorted by metric 2019-10-22 11:53:49 +01:00
Asim Aslam a89d1edc41 fix divide by zero bug 2019-10-19 08:11:05 +01:00
Asim Aslam d3140c0fc2 Merge pull request #867 from milosgajdos83/rlock-mess
Avoid recursive RLock()
2019-10-18 11:35:08 +01:00
Milos Gajdos 3d5d9be02a Avoid recursive calls to RLock()
Topology calls itsel recursively invoking RLock. This, according to go
documentation is wrong. This commit moves the body of Topology function
to a non-thread safe unexported function to keep locsk at check!
2019-10-18 11:26:43 +01:00
Asim Aslam 5c38f38dd9 No need to lock here since Topology read locks and makes copies 2019-10-18 11:26:43 +01:00
Asim Aslam 63fd8b9d1b Merge pull request #864 from micro/strip-topic
strip topic from http broker subscribe service name
2019-10-17 18:48:46 +01:00
Asim Aslam 3aedea4c56 strip topic from http broker subscribe service name 2019-10-17 18:37:37 +01:00
Asim Aslam 0da9dff077 Merge pull request #863 from micro/certmagice2e
E2E tests for certmagic ACME provider
2019-10-17 16:42:33 +01:00
Jake Sanders 05774f2c76 Don't touch go.mod 2019-10-17 16:35:09 +01:00
Jake Sanders 4885bba2ac E2E tests for certmagic ACME provider
* Actually set the CA
* Fix the certmangic.storage interface to return the correct error type
* Write an e2e test for certmagic against the let's encrypt staging CA
2019-10-17 16:31:02 +01:00
Asim Aslam 9d559848c2 Merge pull request #862 from milosgajdos83/tunnel-cleanup
Cleanup of tunnel.Dial(). Clean up network channel processors
2019-10-16 21:19:30 +01:00
Milos Gajdos 2ae583ce94 Cleanup of tunnel dial code. Clean up network channel processors 2019-10-16 20:44:22 +01:00
Asim Aslam 7c1e22b607 Merge pull request #861 from micro/certmagicstorage
Distributed storage for certmagic
2019-10-16 14:10:02 +01:00
Jake Sanders 7d2afa34a0 Implementation and tests for certmagic.Storage interface 2019-10-16 12:58:14 +01:00
Jake Sanders a6e95d389f Implementation of certmagic storage using micro's store and sync packages 2019-10-15 19:32:20 +01:00
Asim Aslam b1d5dc20fa Merge pull request #860 from micro/tunnel-mode
Tunnel mode
2019-10-15 16:14:38 +01:00
Asim Aslam be5093798b Use DialMode/ListenMode 2019-10-15 16:08:38 +01:00
Asim Aslam 3759c9c091 Merge pull request #859 from milosgajdos83/handle-channel-conn-errors
Handle tunnel session Accept errors gracefully
2019-10-15 16:05:19 +01:00
Milos Gajdos 4936a2e1a5 Exponential backoff for failed accept connections 2019-10-15 15:58:33 +01:00
Asim Aslam ca934951ad Use multicast on network/control channels 2019-10-15 15:57:13 +01:00
Asim Aslam ca18089382 Fix bugs related to needing to send Broadcast 2019-10-15 15:55:08 +01:00
Asim Aslam 7b1f5584ab Tunnel mode 2019-10-15 15:40:04 +01:00
Milos Gajdos fed5af68e6 Handle Accept errors gracefully.
Originally when Accept fails we log the error and let the program flow
continue. This can lead to us spawning handling connection go routines
on nil connections which in turn leads to Go panics.
2019-10-15 15:07:28 +01:00
Asim Aslam fdfeb437f9 Merge pull request #856 from micro/cloudflare
Cloudflare Store implementation for workers KV
2019-10-15 14:29:34 +01:00
Jake Sanders a46133f059 cloudflare workers KV Store implementation 2019-10-15 12:35:45 +01:00
Jake Sanders 9bd0a8f3b5 Update go.mod for cloudflare 2019-10-15 12:35:20 +01:00
Asim Aslam 44b794722e rcache becomes cache 2019-10-14 22:39:26 +01:00
Asim Aslam 247249050b move mutex to memory 2019-10-14 22:38:22 +01:00
Asim Aslam b1fed01752 add network name to node 2019-10-14 22:26:23 +01:00
Asim Aslam df1e680256 Merge pull request #854 from micro/lock-http
Lock http
2019-10-14 22:01:25 +01:00
Asim Aslam 854b01c20c Add acquire/release to http path 2019-10-14 21:52:18 +01:00
Asim Aslam 745299bce5 add http lock implementation 2019-10-14 21:39:25 +01:00
Asim Aslam 607fdb3fcb Merge pull request #852 from micro/mutex
add mutex lock implementation
2019-10-14 15:23:59 +01:00
Asim Aslam a1342c23fb add mutex lock implementation 2019-10-14 15:17:25 +01:00
Asim Aslam 1cea2f5bba Merge pull request #850 from micro/acmetypo
TLS -> ToS
2019-10-14 12:10:55 +01:00
Jake Sanders a1b4786682 TLS -> ToS 2019-10-14 12:04:49 +01:00
Asim Aslam b701da6d69 Merge pull request #849 from micro/connect-init
Connect init
2019-10-13 18:40:11 +01:00
Asim Aslam f77df51f60 Support reconnects 2019-10-13 18:36:22 +01:00
Asim Aslam d6c6e7815e Spaces not tabs 2019-10-13 12:40:53 +01:00
Asim Aslam 01492997ea add Network.Init method 2019-10-13 12:38:13 +01:00
Asim Aslam 174f1b857c Network handler moves to service/handler 2019-10-13 12:37:56 +01:00
Asim Aslam 5029d80e68 add Network.Connect handler and network/metadata fields to node 2019-10-13 12:37:39 +01:00
Asim Aslam b59c5a4488 move network handler to service/handler 2019-10-13 12:37:13 +01:00
Asim Aslam f7f65b82e6 Cleanup registry handler/service 2019-10-13 12:23:13 +01:00
Asim Aslam 2e47fdc6f5 Check the node map to avoid dupes in resolved nodes 2019-10-12 20:26:06 +01:00
Asim Aslam 18ea19a122 Regenerate go.mod 2019-10-12 12:04:55 +01:00
Asim Aslam 4d75b936f8 Merge pull request #846 from theophanous/master
fix: bumped quic-go version to v0.12.1
2019-10-11 18:24:45 +01:00
Peter Theophanous 62aaa72715 fix: bumped quic-go version to v0.12.1 2019-10-11 18:16:56 +01:00
Asim Aslam 8c344ed55b Merge pull request #839 from theophanous/master
bumped quic-go version to v0.12.1
2019-10-11 17:26:48 +01:00
Peter Theophanous db843c8d87 reset orig 2019-10-11 17:15:20 +01:00
Asim Aslam dd7677e6cc Add nil check for acme provider 2019-10-11 16:52:57 +01:00
Asim Aslam a4f0dd8939 Merge pull request #845 from micro/certmagic
Implementation of CertMagic as the ACME provider
2019-10-11 16:52:21 +01:00
Jake Sanders 591e87448b Travis doesn't let us bind :443 2019-10-11 16:47:12 +01:00
Jake Sanders 09a202ccf0 Merge branch 'master' of https://github.com/micro/go-micro into certmagic 2019-10-11 16:25:28 +01:00
Jake Sanders 723c17fdd7 Implementation of certmagic as an ACME provider 2019-10-11 16:25:15 +01:00
Jake Sanders 9bd96d4cc1 Update go.mod for ACME changes 2019-10-11 16:24:25 +01:00
Asim Aslam 9bfe4d9bf7 Merge pull request #844 from micro/store
Store service implementation
2019-10-11 14:49:44 +01:00
Asim Aslam 76eee089e3 Add store service client 2019-10-11 14:44:42 +01:00
Asim Aslam cfa2b668e2 go fmt 2019-10-11 14:44:34 +01:00
Asim Aslam a96f6adf07 store handler implementation 2019-10-11 14:08:50 +01:00
Asim Aslam 49fe5d9fd5 Merge pull request #843 from milosgajdos83/dead-code
Clean up dead tunnel code
2019-10-11 11:15:29 +01:00
Milos Gajdos 21469a0427 Clean up dead tunnel code
Running go vet on tunnel package returns:
$ go vet ./...
./default.go:929:2: unreachable code
./link.go:104:2: unreachable code
./listener.go:184:2: unreachable code
./session.go:241:2: unreachable code
2019-10-11 11:02:45 +01:00
Asim Aslam e351e9518f Merge pull request #842 from milosgajdos83/cache-status
Check cache status error
2019-10-11 10:55:35 +01:00
Milos Gajdos fc89c9831e heck cache status error 2019-10-11 10:47:42 +01:00
Peter Theophanous 5e5d57d954 bumped quic-go version to v0.12.1 2019-10-10 22:23:33 +01:00
Asim Aslam 98e1f2c2d3 Merge pull request #838 from micro/etcd
Use etcd serializable option
2019-10-10 19:22:10 +01:00
Asim Aslam 59a3e7d4f4 Use etcd serializable option 2019-10-10 19:16:31 +01:00
Asim Aslam 1be6ec9b3c Merge pull request #837 from milosgajdos83/prune-dead-router-peers
Prune routes from routers that are not in your peer graph
2019-10-10 16:12:56 +01:00
Milos Gajdos f6931f3da7 Prune routes from routers that are not in your peer graph 2019-10-10 15:28:27 +01:00
Asim Aslam b2f99a27b7 Visit all the nodes in flatten 2019-10-10 14:35:11 +01:00
Asim Aslam 1f5ebf330d Merge pull request #836 from micro/prune-address
Prune the peer address
2019-10-10 11:43:19 +01:00
Asim Aslam 0dee11e006 Prune the peer address 2019-10-10 11:25:28 +01:00
Asim Aslam b55018eaa1 Merge pull request #833 from orbli/patch-1
Add dialoptions and calloptions
2019-10-10 07:40:48 +01:00
orb li 77108771db Conceptual deliverable 2019-10-10 13:55:16 +08:00
Asim Aslam 5a6e73d4a8 Merge pull request #835 from milosgajdos83/router-strategy
Router strategy
2019-10-09 19:18:59 +01:00
Milos Gajdos 7a4bff4e9f Changed names of some variables. 2019-10-09 19:08:24 +01:00
Milos Gajdos d5ce96da24 Avoid locking on reading strategy for now 2019-10-09 18:19:48 +01:00
Milos Gajdos 837597fe6f Make Optimal strategy default. Collapse routing tables based on strategy 2019-10-09 17:24:38 +01:00
Milos Gajdos 96e564e402 Add router advertisement Strategy option to router. 2019-10-09 17:24:38 +01:00
Asim Aslam fe94237448 Update router querying method (#834)
* Add address to router query options. Drop Query interface for QueryOptions

* Cleanup isMatch function

* Update network proto
2019-10-09 17:13:52 +01:00
Jake Sanders 107b7419b7 Start abstracting away the ACME provider (#830)
* Start abstracting away the ACME provider

* Move ACME to interface with sub-package implementations

* Addressing comments

* Library -> Provider

* Missed a couple of Library -> Provider

* One more Library -> Provider

* remove constants
2019-10-09 16:42:05 +01:00
orb li 226d55d752 Adding dependency 2019-10-09 16:48:45 +08:00
orb li 88ef785127 Add dialoptions and calloptions 2019-10-09 15:56:39 +08:00
Asim Aslam 44473f954f Merge pull request #829 from milosgajdos83/limit-net-connections
Limit the number of outbound connections to MaxConnections
2019-10-08 15:56:45 +01:00
Milos Gajdos fe5846603a Only limit the number of nodes returned by network resolver. 2019-10-08 15:48:52 +01:00
Milos Gajdos 61800fb7d7 Fix typo: MaxCconnections -> MaxConnections 2019-10-08 15:15:50 +01:00
Milos Gajdos ec2fbde979 Limit the number of outbound connections to MaxConnections
This commit also fixes control channel shenanigans:
- recover error in control channel accept
2019-10-08 14:48:04 +01:00
Asim Aslam b886dd4b8f Merge pull request #828 from micro/net-lookup
Use dns resolver on peer nodes
2019-10-08 10:36:04 +01:00
Asim Aslam 94adeebed4 Use dns resolver on peer nodes 2019-10-08 09:25:23 +01:00
Asim Aslam d043ca15c1 Merge pull request #827 from micro/resolver
Add dns net.LookupHost resolver!
2019-10-08 09:08:34 +01:00
Asim Aslam ad823d5177 Add dns net.LookupHost resolver! 2019-10-08 09:04:13 +01:00
Asim Aslam 89d71417f5 Merge pull request #825 from milosgajdos83/net-chan-nodes
Recover net channel Accept() errors. Init tunnel nodes before tunnel.Connect()
2019-10-07 20:29:45 +01:00
Milos Gajdos 9d9683b6f9 Recover net channel Accept errors. Init tunnel nodes before Connect 2019-10-07 19:09:04 +01:00
Asim Aslam 0edcd5c8dc Merge pull request #824 from micro/tunnel
wait for response on accept message
2019-10-07 18:33:00 +01:00
Asim Aslam 2e1432d5dc wait for response on accept message 2019-10-07 18:29:49 +01:00
Asim Aslam e4f8b5de70 Merge pull request #823 from micro/list-services
Support listing full service info in etcd
2019-10-07 16:15:30 +01:00
Asim Aslam e9dcff49e0 Support listing full service info in etcd 2019-10-07 16:11:52 +01:00
Asim Aslam fa6590f999 Merge pull request #822 from micro/service
Add Name to Service
2019-10-07 08:43:07 +01:00
Asim Aslam fd8a0fb2f5 Update internal service definition 2019-10-07 08:34:15 +01:00
Asim Aslam b594547408 Add service Name 2019-10-07 08:32:28 +01:00
Asim Aslam 2c00e726b6 Decode and hash the existing node 2019-10-06 13:43:41 +01:00
Asim Aslam 68a3fc7996 Merge pull request #820 from micro/etcd-reg
Fix etcd registry lease processing and suppression
2019-10-06 10:03:38 +01:00
Asim Aslam 2fb2d7145e Fix etcd registry lease processing and suppression 2019-10-06 09:54:26 +01:00
Asim Aslam 6fe9f2a958 Merge pull request #815 from micro/broker
Add broker service implementation
2019-10-04 17:23:29 +01:00
Asim Aslam 86984a8a8a Extend the stream timeout 2019-10-04 16:44:21 +01:00
Asim Aslam cfb846ee7e Fix race in cache 2019-10-04 16:40:21 +01:00
Asim Aslam e36960612a go fmt 2019-10-04 16:40:16 +01:00
Asim Aslam 04320d69ff Fix and comment broker service 2019-10-04 16:30:03 +01:00
Asim Aslam c4b6d0f3a8 fix major deadlock in registry cache 2019-10-04 16:29:56 +01:00
Asim Aslam 3c6b6553fb Use peerAddress as the thing to listen on 2019-10-03 18:35:54 +01:00
Asim Aslam d5658ab0b0 Merge pull request #816 from micro/net-advertise
Advertise your peer address as advertised address
2019-10-03 17:42:11 +01:00
Asim Aslam 2244eb8597 Advertise your peer address as advertised address 2019-10-03 17:37:29 +01:00
Asim Aslam 05eacd74c8 Add logging for broker handler 2019-10-03 17:30:37 +01:00
Asim Aslam b80654bf7e Add broker service to config/cmd 2019-10-03 16:22:26 +01:00
Asim Aslam 0941a0f031 Merge pull request #814 from milosgajdos83/etcd-port
Append a port to address if it does not exist
2019-10-03 16:20:43 +01:00
Asim Aslam 4de346920f Add broker service implementation 2019-10-03 16:19:02 +01:00
Milos Gajdos b8815dff14 Append a port to address if it does not exist 2019-10-03 16:16:25 +01:00
Asim Aslam b1163b9dee Fix breaking import 2019-10-03 11:26:24 +01:00
Asim Aslam af5d7a3420 Move the remaining consul cruft to go-plugins 2019-10-03 11:22:35 +01:00
Asim Aslam b5f33b2aaa Rename Dump to Sync 2019-10-03 09:56:25 +01:00
Asim Aslam a9c85eda68 Merge pull request #813 from micro/store
Move out consul sync/lock and store. Move data/store to store
2019-10-03 09:51:21 +01:00
Asim Aslam b5ca40a91a Move out consul sync/lock and store. Move data/store to store 2019-10-03 09:46:20 +01:00
Asim Aslam b81bb07afc Merge pull request #812 from micro/gossip
Remove gossip registry
2019-10-03 09:36:14 +01:00
Asim Aslam 8d2b12258f Remove gossip registry 2019-10-03 09:29:48 +01:00
Asim Aslam 31026da2a1 Update etcd.go
Use /micro/registry as the etcd key prefix
2019-10-02 20:33:59 +01:00
Asim Aslam 1129803bcb Merge pull request #810 from milosgajdos83/etcd
First commit to add etcd registry support
2019-10-02 20:27:38 +01:00
Milos Gajdos 25148af44c First commit to add etcd registry support 2019-10-02 18:56:53 +01:00
Asim Aslam 36675aff1e Merge pull request #809 from micro/log-prefix
Add ability to set log prefix
2019-10-02 17:47:27 +01:00
Asim Aslam b6db0d2663 Add ability to set log prefix 2019-10-02 17:42:34 +01:00
Asim Aslam 2370fb1209 Set gateway to node address rather than id 2019-10-02 15:52:31 +01:00
Asim Aslam 519e8a7213 Merge pull request #808 from micro/net-address
Hash the network address
2019-10-02 15:27:07 +01:00
Asim Aslam 308424488b Hash the network address 2019-10-02 15:22:44 +01:00
Asim Aslam 5d77ce9e9b Rename rcache file to cache 2019-10-02 12:35:20 +01:00
Asim Aslam 9eb6262168 Merge pull request #807 from unistack-org/fixup
some spelling fixes in memory and gossip registry
2019-10-02 10:47:59 +01:00
Vasiliy Tolstov b722798caa some spelling fixes in memory and gossip registry
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2019-10-02 03:54:04 +03:00
Asim Aslam 0cf7b70423 Merge pull request #806 from milosgajdos83/go-mod-shrink
Update go.mod
2019-10-01 20:13:26 +01:00
Milos Gajdos 03b8ceab5c Update go.mod 2019-10-01 19:33:23 +01:00
Asim Aslam e8a53610f1 Update go mod to use 1.13 2019-10-01 19:09:29 +01:00
Asim Aslam e48155118f Update go mod 2019-10-01 18:55:03 +01:00
Asim Aslam 6477c3afff Bump travis 2019-10-01 18:33:26 +01:00
Asim Aslam 57647772c8 Merge pull request #790 from milosgajdos83/memreg-ttl
[WIP] Memory registry TTL expiry
2019-09-30 15:35:57 +01:00
Milos Gajdos 4b73ac9dc5 Simplified code. Small bug fix the used to lead to multi-registry loop. 2019-09-30 12:48:59 +01:00
Milos Gajdos 3f3f1272b3 Turn regular logs to Debug logs; annotate with Registry "tag" 2019-09-30 12:48:59 +01:00
Milos Gajdos 859ecb1872 Dont set default TTL. Stop tracking nodes with no TTL 2019-09-30 12:48:59 +01:00
Milos Gajdos 204c7d1fcf Fixed options bug and proto indenting 2019-09-30 12:48:59 +01:00
Milos Gajdos 8417361bce Set registry TTL to seconds, not the nanoseconds 2019-09-30 12:48:59 +01:00
Milos Gajdos d85ca7abd2 Set registry TTL properly via protobuf Options 2019-09-30 12:48:59 +01:00
Milos Gajdos e973bfaa25 Add TTL options to memory registry. 2019-09-30 12:48:59 +01:00
Milos Gajdos 27bd9581bf Refresh TTL; prune expired nodes. 2019-09-30 12:48:59 +01:00
Milos Gajdos 16c7b3a390 Added Registry TTL to memory registry. Tracking node lifetimes. 2019-09-30 12:48:59 +01:00
potato f933457cc1 Merge pull request #5 from micro/master
pull request from go-micro
2019-09-30 17:22:51 +08:00
Asim Aslam 219d759f1d Merge pull request #802 from micro/services
Add Network.Services handler
2019-09-30 07:55:03 +01:00
Asim Aslam b90871c241 Add Network.Services handler 2019-09-30 07:51:13 +01:00
Asim Aslam 1322fb0d9d Merge pull request #800 from kordenlu/master
fix rcache node overwrited issue
2019-09-30 07:17:46 +01:00
lubaoquan 0eb69e4f9a Undo go.mod go.sum change,fixes https://github.com/micro/go-micro/issues/793 2019-09-30 10:57:35 +08:00
lubaoquan 1ed73d0f91 fixes https://github.com/micro/go-micro/issues/793 2019-09-30 10:38:53 +08:00
lubaoquan 866631df1d fixes https://github.com/micro/go-micro/issues/793 2019-09-30 10:36:43 +08:00
lubaoquan d5e962c4a8 fixes https://github.com/micro/go-micro/issues/793 2019-09-29 10:27:38 +08:00
Asim Aslam 9ec27392de Merge pull request #799 from milosgajdos83/go1.13-fix-tests
Fix tests to make go-micro work on Go 1.13
2019-09-27 18:14:54 +01:00
Milos Gajdos de1d9122ea Remove 1.13 support because go-quic reasons nobody understands 2019-09-27 17:19:38 +01:00
Milos Gajdos 87a5e85062 Add 1.13 support. Fix tests to enable 1.13 support 2019-09-27 17:14:24 +01:00
Asim Aslam da572041ca Merge pull request #797 from RichardLindhout/patch-1
Do not log error when EOS is being written on an EOF socket
2019-09-27 15:18:35 +01:00
Richard Lindhout a725998c0a Update rpc_server.go 2019-09-27 16:01:16 +02:00
Richard Lindhout f3b723ca44 Do nog log error when EOS is being written on an EOF socket 2019-09-27 15:02:21 +02:00
Asim Aslam e1bb4d7379 Merge pull request #795 from milosgajdos83/advert-events
Rather than append to list of events just keep the last event
2019-09-26 18:13:28 +01:00
Milos Gajdos 2d7975a7ce Rather than append to list of events just keep the last event for a route hash 2019-09-26 17:54:55 +01:00
Asim Aslam 8b77d62ed4 Merge pull request #794 from micro/hash
Don't shutdown old nodes in mdns registry
2019-09-26 16:50:17 +01:00
Asim Aslam ef7bb46884 Don't shutdown old nodes in mdns registry 2019-09-26 16:46:09 +01:00
Asim Aslam 06975f64b7 Merge pull request #792 from milosgajdos83/router-fixes
Simplified table code. Fixed event dedup
2019-09-26 12:53:40 +01:00
Milos Gajdos a4c04d8f50 Only emit Update event if a route was updated/added 2019-09-26 12:45:10 +01:00
Milos Gajdos b2577e6022 Update log statement 2019-09-26 12:19:00 +01:00
Milos Gajdos 77f3e7ef48 Simplified table code. Fixed event dedup. 2019-09-26 11:56:30 +01:00
Asim Aslam 6f2a8298ef Fix router log messages 2019-09-25 20:29:25 +01:00
Asim Aslam 9e33637213 Do not log send/recv body 2019-09-25 20:24:56 +01:00
Asim Aslam 99dbed0b67 Merge pull request #789 from micro/cache
Preserve cache in the face of failure
2019-09-25 19:49:21 +01:00
Asim Aslam 2b8210a106 Preserve cache in the face of failure 2019-09-25 19:44:46 +01:00
Asim Aslam dfcedbab1e In case of non 200 response return error 2019-09-25 16:53:06 +01:00
Asim Aslam 140e3d576c Merge pull request #788 from micro/stream
Revert to creating new connections for stream
2019-09-25 15:26:09 +01:00
Asim Aslam afa1f50435 Revert to creating new connections for stream 2019-09-25 15:21:21 +01:00
Asim Aslam cb22136a35 Merge pull request #787 from micro/solicit
only solicit the first time seeing a peer
2019-09-25 14:35:09 +01:00
Asim Aslam ae40553bad only solicit the first time seeing a peer 2019-09-25 14:30:35 +01:00
Asim Aslam 855cd5ecf4 Merge pull request #786 from micro/net
Do not embed proxy/router/tunnel
2019-09-25 13:00:36 +01:00
Asim Aslam f23c6d91ba Do not embed proxy/router/tunnel 2019-09-25 12:56:52 +01:00
Asim Aslam c3b430af53 Merge pull request #785 from micro/link
Keep track of errors and delete beyond error count > 3
2019-09-25 12:36:23 +01:00
Asim Aslam 3d2bf7d4f6 Add log message 2019-09-25 12:36:07 +01:00
Asim Aslam 6c2b9d7636 Keep track of errors and delete beyond error count > 3 2019-09-25 12:14:09 +01:00
Asim Aslam be5799b09f Merge pull request #783 from micro/service
Add flag for registry service client
2019-09-25 11:14:17 +01:00
Asim Aslam 7fe64192a7 Add flag for registry service client 2019-09-25 11:09:19 +01:00
Asim Aslam 624d37cf13 Merge pull request #781 from milosgajdos83/hash-reg-service
Emit memory registry event only when it actually happens
2019-09-25 07:44:55 +01:00
Milos Gajdos 1f23c8a85a Emit memory registry event only when it actually happens 2019-09-25 01:58:28 +01:00
Asim Aslam 96e79c4498 Add runtime output 2019-09-24 19:00:11 +01:00
Asim Aslam 1b08036a0b add create options 2019-09-24 18:32:35 +01:00
Asim Aslam c52651c4d0 Move runtime.Start to be non blocking 2019-09-24 18:05:51 +01:00
Asim Aslam 9f880a1215 Merge pull request #780 from milosgajdos83/registry-event
[WIP] Registry event
2019-09-24 14:48:38 +01:00
Milos Gajdos 39755721d0 Fix proto formatting 2019-09-24 14:39:51 +01:00
Milos Gajdos ccda1d3559 Remove rpc Sync method from registry handler 2019-09-24 10:41:48 +01:00
Milos Gajdos 61ee436cc4 Added Sync RPC call; it's identical to ListServices for now 2019-09-23 21:08:31 +01:00
Milos Gajdos 04a5d884da Move global vars to the top of the src file: conventions 2019-09-23 20:48:25 +01:00
Milos Gajdos 0ec1b840fd Add registry event to registry package 2019-09-23 20:48:25 +01:00
Asim Aslam 71ab35e055 Merge pull request #778 from micro/register-interval
Set register ttl and interval by default
2019-09-23 18:04:52 +01:00
Asim Aslam fa0d020556 Set register ttl and interval by default 2019-09-23 17:59:34 +01:00
Asim Aslam d8dc713e2d Fix the http resolver to use micro.mu url 2019-09-23 17:50:53 +01:00
Asim Aslam d38c8b23f2 Merge pull request #777 from micro/net-nodes
Set rpc methods as Network.Graph/Nodes/Routes
2019-09-23 15:47:49 +01:00
Asim Aslam 4260913b45 Set rpc methods as Network.Graph/Nodes/Routes 2019-09-23 15:41:05 +01:00
Asim Aslam ac5eb5da47 Remove fmt 2019-09-22 15:31:07 +01:00
Asim Aslam 2434c7b2a7 replace version format 2019-09-22 15:21:22 +01:00
Asim Aslam 9fbc88a60f Provide a way to get status now 2019-09-20 17:55:02 +01:00
Asim Aslam 444cc59250 Ensure transport matches for monitoring service 2019-09-20 17:20:15 +01:00
Asim Aslam 95e4ed8ee9 Merge pull request #775 from micro/proxy-watcher
Fix the proxy watcher
2019-09-20 16:36:00 +01:00
Asim Aslam 4eb1aaae85 Fix the proxy watcher 2019-09-20 16:25:29 +01:00
Asim Aslam 46450ba507 Merge pull request #773 from micro/net-hash
Only hash address if its a local route
2019-09-20 10:50:35 +01:00
Asim Aslam f13887f604 Only hash address if its a local route 2019-09-20 09:40:55 +01:00
Asim Aslam 66769e671f Merge pull request #772 from micro/peers
Replace Nodes with Peers
2019-09-19 16:53:17 +01:00
Asim Aslam 7e05d2c440 Replace Nodes with Peers 2019-09-19 16:32:15 +01:00
Asim Aslam 0abeb3f660 Merge pull request #771 from milosgajdos83/peers-race
Remove data race; Unlock once done pruning/deleting
2019-09-19 11:59:03 +01:00
Milos Gajdos a38482ffcb Remove data race; Unlock once done pruning/deleting 2019-09-19 11:53:13 +01:00
Asim Aslam ee74e26582 Merge pull request #769 from micro/advertise
allow setting advertise address
2019-09-18 19:06:24 +01:00
Asim Aslam 6222bc2a1e only set tunnel address if advertise is blank 2019-09-18 19:04:22 +01:00
Asim Aslam 05e62a2b95 allow setting advertise address 2019-09-18 18:56:02 +01:00
Asim Aslam cdbab3df66 Merge pull request #766 from milosgajdos83/hash-service
Hash the service before advertising it to the network.
2019-09-17 18:39:17 +01:00
Milos Gajdos 38d6ffdf9a Hash the service address before advertising it to the network. 2019-09-17 18:34:06 +01:00
Asim Aslam e586763301 Merge pull request #761 from milosgajdos83/delete-peer-gw
Delete dead peer [gateway] routes
2019-09-17 16:54:35 +01:00
Milos Gajdos 3201b4cb36 Gateway is now set to node Id, hence we prune peer.id Gateway 2019-09-17 16:31:33 +01:00
Asim Aslam 837cb4fc11 Merge pull request #763 from milosgajdos83/gateway-addressing
Fix gateway addressing
2019-09-17 16:27:35 +01:00
Milos Gajdos 21dc7bcccf Fix gateway addressing
- Set Gateway as node.ID when advertising
- Set server.Address as node.ID to listen on
- Set server.Advertise as node.Address
2019-09-17 16:11:02 +01:00
Asim Aslam a811b4be3d Merge pull request #762 from micro/net-address
Set node address to tunnel address
2019-09-17 15:44:13 +01:00
Asim Aslam 9147d378bc Set node address to tunnel address 2019-09-17 15:40:00 +01:00
Asim Aslam b7b968ad74 remove the funding thing 2019-09-17 12:43:20 +01:00
Asim Aslam 8e8a4c1a9d Update FUNDING.yml 2019-09-17 12:42:50 +01:00
Asim Aslam bc29164f77 Update FUNDING.yml 2019-09-17 12:39:41 +01:00
Asim Aslam e161b2fa84 Create FUNDING.yml 2019-09-17 12:36:36 +01:00
Milos Gajdos a72a2f717d Prune stale nodes in the whole topology. 2019-09-16 19:22:55 +01:00
Milos Gajdos 2599ee8591 Prune routes routable via dead node. 2019-09-15 12:17:12 +01:00
Asim Aslam 364c5a4861 Immediately start services 2019-09-14 08:07:36 -07:00
Asim Aslam c8a675249d Merge pull request #759 from micro/runtime
update runtime to function
2019-09-13 22:01:52 -07:00
Asim Aslam 0cdfc7b9ea add create/delete/start/stop to runtime 2019-09-13 21:58:03 -07:00
Asim Aslam 0fc4c180ee update runtime to function 2019-09-13 21:33:14 -07:00
Asim Aslam e5f6480f8a Merge pull request #757 from milosgajdos83/empty-advert
Skip processing Advert which carries no events
2019-09-13 17:29:36 -07:00
Milos Gajdos ccb6778f7f Skip processing Advert which carries no events 2019-09-13 20:46:14 +01:00
Asim Aslam ef86c9625b Merge pull request #750 from milosgajdos83/node-peers
[WIP] Neighbour is now Peer. Peer is a node in network topology.
2019-09-13 12:00:16 -07:00
Asim Aslam b23ee58865 Update default.go 2019-09-13 11:55:53 -07:00
Milos Gajdos 323a72be34 Small refactoring; Split horizon loop break. 2019-09-13 18:46:24 +01:00
Milos Gajdos d72e91fb38 Unlock on return from network.Connect 2019-09-13 03:31:58 +01:00
Milos Gajdos b91c3147e7 Node API allows us to drop all network locks
Network locks are now needed only when accessing client map. node map
access is serialied with the node mutex.
2019-09-13 03:03:56 +01:00
Milos Gajdos ef91d836eb Implement Solicit method for handler.Router 2019-09-13 03:03:56 +01:00
Milos Gajdos 77c6c9781b getProtoTopology has been replaced by PeersToProto
This helps us remove redundant code across node and handler
2019-09-13 03:03:56 +01:00
Milos Gajdos fa4ff8921e Removed redundant lock. Simplified proto topology 2019-09-13 03:03:56 +01:00
Milos Gajdos d6be91e8af Changed RPC methods. Changed Network interface.
* Nodes/Topology removed from public methods from Network interface
* Peers() returns max depth 3 topology
* handler.Topology rpc endpoint removed
* handler.Peers rpc endpoint accept "depth" param to return max depth peers
2019-09-13 03:03:56 +01:00
Milos Gajdos 588484c3bf Fixed some races. Added more tests. 2019-09-13 03:03:56 +01:00
Milos Gajdos d58eb51976 Code change to make Solicit router.proto message 2019-09-13 03:03:55 +01:00
Milos Gajdos 35cf2a5739 Make topology test more generic 2019-09-13 03:03:55 +01:00
Milos Gajdos 2dfbe93d65 Added more node tests. Small refactoring of Netowkr and handler. 2019-09-13 03:03:55 +01:00
Milos Gajdos 16fcf1fbda Nodes, Peers and Topology methods for node
Topology accepts an argument to define the depth of the topology
requested from the network. proto definitions have been modified
accordingly, too.
2019-09-13 03:03:55 +01:00
Milos Gajdos cbce5490d7 Lock the Nodes method properly when collecting them. 2019-09-13 03:03:55 +01:00
Milos Gajdos 4c709f7ac1 Write Lock() advert update: we are writing into peers map here 2019-09-13 03:03:55 +01:00
Milos Gajdos baf4c05663 Send solicit message to ControlChannel 2019-09-13 03:03:55 +01:00
Milos Gajdos 195c6a8c90 Neighbour is now peer. Neighbourhood is Peers. Small refactor. 2019-09-13 03:03:54 +01:00
Milos Gajdos f91d0408ab Moved node implementation into dedicated source file 2019-09-13 03:03:54 +01:00
Milos Gajdos eec780aaa7 Update neighbours when neighbour message is received 2019-09-13 03:03:54 +01:00
Milos Gajdos f0a1031e97 Adding new peers up to given depth. Outline of node gaph Update 2019-09-13 03:03:54 +01:00
Asim Aslam a6668ae057 Move delete link log message 2019-09-12 17:40:47 -07:00
Asim Aslam af5421c2cf Merge pull request #756 from micro/tunnel
Missing fixes for the tunnel
2019-09-12 17:17:33 -07:00
Asim Aslam 2406ef9999 Missing fixes for the tunnel 2019-09-12 17:12:49 -07:00
Asim Aslam af585d3a57 Merge pull request #755 from micro/tunnel
Add tunnel fixes for quic and keepalive
2019-09-12 16:35:53 -07:00
Asim Aslam 97cf478f71 Add tunnel fixes for quic and keepalive 2019-09-12 16:22:43 -07:00
Asim Aslam ec6a30be37 Links above Dial/Listen in interface 2019-09-11 12:49:27 -07:00
Asim Aslam 634c55e2d7 Merge pull request #753 from micro/link
Option to set Link
2019-09-11 12:16:07 -07:00
Asim Aslam cb0de43dba add link status 2019-09-11 12:12:11 -07:00
Asim Aslam 63d535aea9 Add link field to session 2019-09-11 12:07:43 -07:00
Asim Aslam 6819386e05 Remove dead link code 2019-09-11 12:00:55 -07:00
Asim Aslam 988603f87e Merge pull request #752 from printfcoder/master
recover gPRC handler if panic
2019-09-11 09:10:30 -07:00
Asim Aslam 9ca7d90f11 link crufT 2019-09-11 07:11:40 -07:00
Asim Aslam 6ec32805d0 Don't allow socket close while writing h2 headers 2019-09-10 18:26:12 -07:00
Shu Xian c1c173dfe5 recover handler if panic 2019-09-11 00:40:40 +08:00
Shu Xian ce18de2647 Merge branch 'master' of github.com:micro/go-micro 2019-09-11 00:39:19 +08:00
Asim Aslam 3e3bbe3fd0 Merge pull request #751 from micro/link
Move link to tunnel/
2019-09-10 08:16:35 -07:00
Asim Aslam b5eea02f7a Move link to tunnel/ 2019-09-10 08:12:28 -07:00
Asim Aslam 08c6f60b0f Merge pull request #746 from micro/plugin
Support plugin loading
2019-09-10 05:38:10 -07:00
Asim Aslam 065c7d5616 fix plugin init 2019-09-10 05:32:49 -07:00
Asim Aslam a5ce3e32da Support plugin loading on service.Init 2019-09-09 20:17:36 -07:00
Asim Aslam 3bfbcd5e6a Add default plugin loader 2019-09-09 19:43:13 -07:00
Asim Aslam b6c6b13277 Support plugin loading 2019-09-09 19:09:28 -07:00
Asim Aslam 04b31d374c Merge pull request #745 from micro/registry-service
Add service registry
2019-09-09 13:05:46 -07:00
Asim Aslam e828a099c5 Merge pull request #744 from micro/mdns-domain
Use .micro domain for mdns
2019-09-09 11:59:37 -07:00
Asim Aslam 2c16c7e62f Fix build breaks 2019-09-09 09:25:47 -07:00
Asim Aslam 1f44d7a4a1 Add registry handler 2019-09-09 09:20:17 -07:00
Asim Aslam b076ef906a Add service registry 2019-09-09 08:57:57 -07:00
Asim Aslam c669a2b155 Use .micro domain for mdns 2019-09-09 05:11:25 -07:00
Asim Aslam 48a3e51aca Merge pull request #742 from micro/unlock
unlock before sending the message to avoid deadlock
2019-09-06 17:06:39 +01:00
Asim Aslam e8aaca27d3 unlock before sending the message to avoid deadlock 2019-09-06 16:57:17 +01:00
Asim Aslam 5596407144 Merge pull request #741 from milosgajdos83/list-nodes
List nodes now works properly. Send solicit message on ControlChannel
2019-09-06 15:18:25 +01:00
Milos Gajdos 7971b1b7f9 Remove debug logs 2019-09-06 15:12:23 +01:00
Milos Gajdos dafbacbdcb Properly handle the list of the nodes. Send solicit on ControlChannel 2019-09-06 15:09:49 +01:00
Asim Aslam df5657dcd1 Merge pull request #737 from milosgajdos83/buffered-advertchan
Lets make advert channel buffered so we don't lose adverts
2019-09-05 19:19:03 +01:00
Milos Gajdos bb595c85b2 Lets make advert channel buffered so we don't lose adverts 2019-09-05 19:05:47 +01:00
Asim Aslam bc6187ea89 Merge pull request #734 from micro/tunnel
Update tunnel to send discovery on connect and multicast messages. An…
2019-09-05 18:19:37 +01:00
Asim Aslam ed1faa7a5c Add a discover ticker, announce on connect and refactor 2019-09-05 18:13:02 +01:00
Asim Aslam 1d9298ae2b Merge pull request #736 from milosgajdos83/solicit-routes
Solicit routes when new node is discovered
2019-09-05 18:08:49 +01:00
Milos Gajdos dddfb6f878 Fixed typos and simplified map iteration 2019-09-05 17:59:14 +01:00
Milos Gajdos ec354934e3 Move Errors to separate init block 2019-09-05 17:44:47 +01:00
Milos Gajdos b01c8e06e0 Update error name to ErrClientNotFound 2019-09-05 17:43:59 +01:00
Asim Aslam 97b1071f7e Merge pull request #735 from huangzhhui/patch-1
Fixed the link of Chinese documentation
2019-09-05 17:43:03 +01:00
Asim Aslam 1527a84297 Shorten multicast discovery 2019-09-05 17:40:41 +01:00
Milos Gajdos 5ddfd911ba Replace send message code by one network method 2019-09-05 17:18:16 +01:00
黄朝晖 2310ee424c Update README.zh-cn.md 2019-09-05 23:52:54 +08:00
Milos Gajdos 2522d8cb96 Send solicit message when new neighbour is discovered 2019-09-05 16:04:44 +01:00
Asim Aslam d198765c6c Put back close of listener 2019-09-05 15:23:19 +01:00
Asim Aslam 1840b5bd74 Update tunnel to send discovery on connect and multicast messages. Announce as broadcast 2019-09-05 15:16:11 +01:00
Milos Gajdos 9161b20d6b Add Solicit method to router interface
When calling Solicit, router lists all the routes and advertise them
straight away
2019-09-05 13:23:33 +01:00
Asim Aslam a1ba1482c5 Only set link if not multicast 2019-09-05 07:41:19 +01:00
Asim Aslam d0761e0a1b Merge pull request #733 from milosgajdos83/freeze-graph
Freeze network graph when building full network topology
2019-09-05 07:21:53 +01:00
Milos Gajdos 4b1a7abb42 Freeze network graph when building full network topology
Also added some comments and debug logs
2019-09-05 00:16:22 +01:00
Asim Aslam e33bd17894 Merge pull request #732 from micro/massive-cruft
Fix massive cruft in tunnel dial to set the link on discovered
2019-09-04 20:27:07 +01:00
Asim Aslam cc5d811a83 add comment to tunnel link selection 2019-09-04 20:19:53 +01:00
Asim Aslam e15389febb Fix massive cruft in tunnel dial to set the link on discovered 2019-09-04 20:18:26 +01:00
Asim Aslam 6d63c3777f Merge pull request #731 from micro/tunnel
Add some fixes
2019-09-04 18:53:48 +01:00
Asim Aslam d8a1b47954 Remove lock from link 2019-09-04 18:48:43 +01:00
Asim Aslam b9a2f719a0 Add some fixes 2019-09-04 18:46:20 +01:00
Asim Aslam 46a9767648 Merge pull request #730 from milosgajdos83/advert-lastseen
Update node.lastSeen properly. Set node.lastSeen when processing advert
2019-09-04 18:13:43 +01:00
Milos Gajdos dd9f42e3b9 Update lastSeen timestamp properly. Set lastSeen when processing advert 2019-09-04 18:02:13 +01:00
Asim Aslam f2c8492c77 Merge pull request #729 from micro/tunnel
Tunnel session management and unicast/multicast
2019-09-04 16:25:38 +01:00
Asim Aslam 407381912b Don't try discover on multicast, don't block existing sessions on listen 2019-09-04 15:55:37 +01:00
Asim Aslam d559ce9da2 Provide Links() method in Tunnel 2019-09-04 15:41:57 +01:00
Asim Aslam 7ab3934eb7 add message comment 2019-09-04 12:18:37 +01:00
Asim Aslam 0075477df0 make tunnel broker use multicast 2019-09-04 12:18:31 +01:00
Asim Aslam d5be2136ad cleanup new message creation 2019-09-04 12:16:31 +01:00
Asim Aslam c718b8bf93 Move vars and comment 2019-09-04 12:00:11 +01:00
Asim Aslam a24818ee54 Fix typo 2019-09-04 11:58:25 +01:00
Asim Aslam 66db0ac52c Move announce into session 2019-09-04 11:58:03 +01:00
Asim Aslam b9c437fbfe Tunnel discover/announce/open/session/close 2019-09-04 09:48:05 +01:00
Asim Aslam 147899283c Merge pull request #728 from wuyumin/master
Update config source README file
2019-09-04 09:16:04 +01:00
Yumin Wu 5b991cd2c2 Update config source README file 2019-09-04 15:49:58 +08:00
Yumin Wu bb64f94313 .gitignore file for develop tools 2019-09-04 15:47:46 +08:00
Milos Gajdos 4f4b3d3bae Send connect message to NetworkChannel once we are not at caller mercy 2019-09-03 19:51:52 +01:00
Asim Aslam eb4a709195 Merge branch 'master' of ssh://github.com/micro/go-micro into tunnel 2019-09-03 17:20:39 +01:00
Asim Aslam 6c21b31226 Merge pull request #727 from milosgajdos83/bug-overhaul
Major bug overhaul in how we handle network.Nodes and related handler
2019-09-03 17:20:15 +01:00
Milos Gajdos 6eb6d050ed Major bug overhaul in how we handle network.Nodes and related handler 2019-09-03 16:39:27 +01:00
Asim Aslam 6c7582a6be Move message to session 2019-09-03 15:56:37 +01:00
Milos Gajdos 3ea4490d6c Don't preallocate the slice if you don't index later on. 2019-09-03 15:02:30 +01:00
Asim Aslam b50c44a758 Merge pull request #726 from milosgajdos83/prune-nodes
Prune nodes that have not announced themselves for certain time period.
2019-09-03 10:28:31 +01:00
Milos Gajdos ec6318befc Prune nodes that have not announced themselves for certain time period. 2019-09-03 10:00:14 +01:00
Asim Aslam 5440325a18 Merge pull request #724 from milosgajdos83/efficient-bfs-queue
Make Nodes() BFS implementation efficient
2019-09-03 07:43:37 +01:00
Milos Gajdos fb13877904 Make Nodes() BFS implementation efficient 2019-09-03 02:58:17 +01:00
Asim Aslam 2f5e3c66b9 Merge pull request #723 from milosgajdos83/sort-nodes-search
Sort the returned slice of nodes before searching
2019-09-02 20:13:20 +01:00
Milos Gajdos a8d4299df9 Sort the returned slice of nodes before searching
See docs:
https://golang.org/pkg/sort/#Search
2019-09-02 20:00:52 +01:00
Asim Aslam 90745c14f2 Merge pull request #722 from milosgajdos83/net-handler
[WIP] Network handler
2019-09-02 17:15:38 +01:00
Milos Gajdos 86665454e7 Implementation of Nodes method. First take on full handler 2019-09-02 17:06:21 +01:00
Milos Gajdos 4f5a849211 Added Nodes method to Network interface 2019-09-02 12:40:05 +01:00
Milos Gajdos bf53c16e4b Rough outline of Network introspection interface 2019-09-02 12:40:05 +01:00
Asim Aslam 6c3631728b Merge pull request #721 from micro/tunnel
Separate lookup nodes and setup nodes
2019-09-02 12:10:24 +01:00
Asim Aslam 2cdfed359f Separate lookup nodes and setup nodes 2019-09-02 12:05:47 +01:00
Asim Aslam 956be5c59d Merge pull request #717 from micro/client-stream
use with stream for client connection
2019-09-02 07:36:41 +01:00
Asim Aslam 52d9d75dfa use with stream for client connection 2019-08-31 18:26:48 +01:00
Asim Aslam 0d94784e72 Add some tunnel comments 2019-08-31 17:32:20 +01:00
Asim Aslam 65c2de5a79 Merge pull request #716 from micro/tunnel
Rename Tunnel ID to Channel
2019-08-31 16:32:41 +01:00
Asim Aslam 6fa9d7270f Rename Tunnel ID to Channel 2019-08-30 20:05:00 +01:00
Asim Aslam 140c830af1 Merge pull request #715 from milosgajdos83/net-debug
Add proto definitions for network introspection.
2019-08-30 12:38:24 +01:00
Milos Gajdos b37837ad92 Add proto definitions for network introspection. 2019-08-30 12:29:26 +01:00
Asim Aslam 10b64af0b3 Merge pull request #713 from milosgajdos83/route-loop-break
Avoid setting routes that route back to the node without its being direct GW to dest
2019-08-30 11:33:17 +01:00
Asim Aslam 5d01284574 Merge pull request #714 from wuyumin/master
Load consul source
2019-08-30 10:15:37 +01:00
Yumin Wu ff81e4b246 Load consul source 2019-08-30 16:20:58 +08:00
Milos Gajdos e955e3f798 Avoid routes that route back to node without its being direct GW to dest 2019-08-30 00:04:46 +01:00
Asim Aslam a17a8b3372 Merge branch 'master' of ssh://github.com/micro/go-micro 2019-08-29 17:21:49 +01:00
Asim Aslam e1d56fbf58 switch warn to error logging 2019-08-29 17:21:43 +01:00
Milos Gajdos e7d8cdda44 Avoid duplicate debug logs. 2019-08-29 16:58:07 +01:00
Asim Aslam 690640eeeb Merge pull request #712 from milosgajdos83/route-update
Only emit table event if table.Update actually happens
2019-08-29 16:30:27 +01:00
Milos Gajdos 4f788c6fc7 Only emit the events when actually deleting the route 2019-08-29 16:25:21 +01:00
Milos Gajdos f50bd400f8 Only emit event if Update actually happens 2019-08-29 16:21:30 +01:00
Asim Aslam b457ec1990 Merge pull request #711 from milosgajdos83/node-neighbours
Don't override the neighbours.
2019-08-29 15:48:13 +01:00
Milos Gajdos ffa6b551f4 Don't override the neighbours. 2019-08-29 15:42:07 +01:00
Asim Aslam 3d03fe4076 Fix panic for nil slice 2019-08-29 15:09:01 +01:00
Asim Aslam 6eecb199e9 Merge pull request #710 from micro/nodes
add the ability to provide seed nodes to the network
2019-08-29 15:00:51 +01:00
Asim Aslam 7479515099 add the ability to provide seed nodes to the network 2019-08-29 14:53:30 +01:00
Asim Aslam 6e3d53e1ee Merge pull request #709 from micro/tunnel-arp
Tunnel Direction Fix
2019-08-29 13:13:25 +01:00
Asim Aslam 721c5e6857 fix broken build 2019-08-29 13:11:20 +01:00
Asim Aslam 7d033818cf if the service name is blank, barf 2019-08-29 13:10:06 +01:00
Asim Aslam 00ab58f61b Fix loopback cruft 2019-08-29 12:42:27 +01:00
Asim Aslam b3aef71fdb Merge pull request #708 from milosgajdos83/route-metric
Set the route.Metric before updating routing table
2019-08-29 12:28:43 +01:00
Milos Gajdos 8606f1e143 Set the route.Metric before updating routing table 2019-08-29 11:45:47 +01:00
Asim Aslam 927fac2cec Merge pull request #706 from milosgajdos83/neighbour-map
Broadcast neighbourhood
2019-08-28 23:16:42 +01:00
Asim Aslam 6ab86c9e57 Don't process unless connected, and only fire loopback messages back up the loopback 2019-08-28 23:12:22 +01:00
Milos Gajdos db8e2620cb Make tunnel channel clients key-able. Neighbour map simplified.
tunClient is a map of tunnel clients keyed on tunnel channel name.
Neighbour map is now a cimple map of nodes which contains its nodes.
2019-08-28 23:11:26 +01:00
Milos Gajdos d09b7dbbef Broadcast neighbourhood; fix critical bugs in channel connections
This commit introduces neighbourhood announcements which allows to
maintaing neighbour map if each next-hop node.

It also fixes a critical bug when accepting connections for a particular
tunnel channel.
2019-08-28 20:11:19 +01:00
Asim Aslam a4f5772555 add network field to the routes 2019-08-28 08:41:19 +01:00
Asim Aslam 731f6f74dd Merge pull request #703 from milosgajdos83/net-id
Adds network id. Skips processing routes when router is the origin.
2019-08-28 08:05:19 +01:00
Milos Gajdos 5e7208119e Adds network id. Skips processing routes when router is the origin. 2019-08-27 23:08:35 +01:00
Asim Aslam 470304ef87 Merge pull request #701 from h-hy/master
Check last for the address binded in lo interface (LVS , DR mode)
2019-08-27 18:08:52 +01:00
huanghaoyan a6ab4d7b4b check last for the address bind in lo interface. 2019-08-27 23:35:27 +08:00
Asim Aslam 87b56d46ac Use tunnel transport and set server address 2019-08-27 13:21:36 +01:00
Milos Gajdos 371b23d055 Introduce DefaultLink; dont hardcode name of the link 2019-08-27 11:36:46 +01:00
Asim Aslam f97565ef0a Merge pull request #685 from milosgajdos83/default-network
Default network implementation
2019-08-27 11:02:55 +01:00
Asim Aslam 0888d2fbbc Add grpc content-type 2019-08-27 08:13:58 +01:00
Shu xian 75e20b5bf7 Merge pull request #1 from micro/master
merge
2019-08-27 09:38:18 +08:00
Asim Aslam 443fc0ebde Merge pull request #700 from micro/h2-grpc
H2 grpc
2019-08-26 15:55:31 +01:00
huanghaoyan 35e7b9551f ignore Loopback Address (LVS,DR mode) 2019-08-26 21:48:40 +08:00
Asim Aslam 6daf4fda72 Full support for grpc server side 2019-08-26 12:33:59 +01:00
Asim Aslam 36623bfe50 Improve stream processing 2019-08-25 19:30:22 +01:00
Asim Aslam 6128d18ee0 checkpoint fixing data race to process h2 and grpc requests 2019-08-24 20:12:04 +01:00
Asim Aslam abadb2211e Merge pull request #698 from micro/tunnel-broker
Add a tunnel broker
2019-08-24 14:37:20 +01:00
Asim Aslam ca267f73de add a tunnel broker 2019-08-24 09:46:55 +01:00
Asim Aslam d8608b2343 Merge pull request #697 from micro/static-resolver
Add a static network node resolver
2019-08-23 22:05:02 +01:00
Milos Gajdos ed8d28c9ab Set Route.Link to "network" not Route.Network. Oops! 2019-08-23 21:08:18 +01:00
Milos Gajdos 88e47b9b06 Dont bail when unable to resolve network nodes. 2019-08-23 17:48:14 +01:00
Asim Aslam 1b0295de0d Add a static network node resolver 2019-08-23 17:24:21 +01:00
Milos Gajdos 9448d7c164 Set Route.Network to "network" and Router.Gateway to network.Address 2019-08-23 16:01:57 +01:00
Milos Gajdos 8c3eec9f2a Set the default resolver to registry 2019-08-23 15:14:16 +01:00
Milos Gajdos e53484302c Added ControlChannel tunnel.Listener to process incoming messages 2019-08-23 15:14:16 +01:00
Milos Gajdos db89fc4efe Set server name to the correct value. 2019-08-23 15:14:16 +01:00
Milos Gajdos e1599b0f17 Set server name. Set default network name. 2019-08-23 15:14:16 +01:00
Milos Gajdos a09d5d2e9a Add Address method. Start and Stop router/server. 2019-08-23 15:14:16 +01:00
Milos Gajdos 6c1f1d66f7 Switch received messages on the right header 2019-08-23 15:14:16 +01:00
Milos Gajdos a6e1287b27 Replaced incorrect proto import path 2019-08-23 15:14:15 +01:00
Milos Gajdos fcec6e8eae First attempt to implement default network interface 2019-08-23 15:14:15 +01:00
Milos Gajdos 30dd3f54f0 Make router.Table docs consistent 2019-08-23 15:14:15 +01:00
Milos Gajdos 6beae23afd First commit. Outline of the default network. 2019-08-23 15:14:15 +01:00
Asim Aslam 718780367e Merge pull request #696 from milosgajdos83/server-idempotent
Make server Start() and Stop() idempotent
2019-08-23 15:12:33 +01:00
Milos Gajdos ba99f037fb Lock started flag when changing it. 2019-08-23 15:07:08 +01:00
Milos Gajdos 80dc0b97a9 Make server starts and stops idempotent 2019-08-23 15:00:57 +01:00
Asim Aslam 1a32e3a11d Merge pull request #695 from micro/proxy-link
Support multiple clients in the proxy as Links
2019-08-23 14:48:49 +01:00
Asim Aslam 955dc2a23d change where we order the routes 2019-08-23 14:11:53 +01:00
Asim Aslam 934b8eb86d Error as link not found 2019-08-23 14:09:57 +01:00
Asim Aslam b7f510ff64 support links in the proxy 2019-08-23 14:05:11 +01:00
Asim Aslam 353eade6c3 Update client proto 2019-08-23 12:06:11 +01:00
Asim Aslam a133e61c2d Merge pull request #694 from milosgajdos83/tunnel-loopback-sleep
Lock when setting loopback flag and receiving keepalives
2019-08-22 17:35:03 +01:00
Milos Gajdos 99d39e743b Lock when setting loopback flag and receiving keepalives 2019-08-22 16:31:37 +01:00
Asim Aslam 0cdac2aa36 Merge pull request #689 from milosgajdos83/router-stop
Make router.Stop idempotent
2019-08-21 21:25:48 +01:00
Milos Gajdos 75871287a1 Make stop idempotent. Small refactoring. Router name is memory. 2019-08-21 21:10:42 +01:00
Asim Aslam fb750a0bb1 Don't start the router if its already running 2019-08-21 18:58:56 +01:00
Asim Aslam c6e15ef2d1 rename server, set version to timestamp 2019-08-21 15:43:46 +01:00
Asim Aslam f787cc0ee0 Merge pull request #687 from micro/tunnel
Add tunnel address
2019-08-21 13:01:28 +01:00
Asim Aslam c2d85a6e1f Add tunnel address 2019-08-21 12:55:10 +01:00
Milos Gajdos 86f0c06fac Removed filewatch counter test. 2019-08-21 11:26:41 +01:00
Asim Aslam 0aea8e3163 Merge pull request #686 from milosgajdos83/config-watcher
Introduce ErrStoppedWatcher for source.Source Watchers and fixed test
2019-08-21 11:06:14 +01:00
Milos Gajdos 4ea27517b5 Source watcher ErrStoppedWatcher and fixed test 2019-08-20 22:32:47 +01:00
Asim Aslam f8e68ae101 Add string method to tunnel 2019-08-20 17:21:35 +01:00
Asim Aslam f848041c49 Add a message type to the tunnel 2019-08-20 17:20:21 +01:00
Asim Aslam dfbd730b8c Fix mucp service option passing 2019-08-20 16:48:09 +01:00
Asim Aslam ac2a5a04a2 Merge pull request #681 from unistack-org/fix_wg
fix panic: negative WaitGroup counter
2019-08-19 12:06:45 +01:00
Vasiliy Tolstov f1d08f251f fix panic: negative WaitGroup counter
avoid double wait group Done()

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2019-08-19 13:58:57 +03:00
Asim Aslam 718ae42808 Merge pull request #680 from printfcoder/master
fix file watcher event bug on Linux
2019-08-19 08:34:21 +01:00
Shu Xian 2413cbcd80 fix file watcher event bug on Linux
the watcher can not normally get events of file changes on linux. it just can get the first two changes.
2019-08-19 15:28:24 +08:00
Asim Aslam 9c820445a4 Merge pull request #679 from micro/grpc-codec
Force grpc client/server to use grpc codec for broker
2019-08-18 11:37:38 +01:00
Asim Aslam c44fd63301 Force grpc client/server to use grpc codec for broker 2019-08-18 11:28:21 +01:00
Asim Aslam d9a699ae6f Merge pull request #673 from micro/multiplex
Stream Multiplexing
2019-08-16 17:41:45 +01:00
Asim Aslam 4495ca3839 Use client.Call for non streaming requests 2019-08-16 17:24:17 +01:00
Asim Aslam 0b0eee41d0 functioning proxy code 2019-08-16 16:46:29 +01:00
Asim Aslam e18f8defde Merge pull request #672 from milosgajdos83/tunnel-ping
Monitor outbound links and delete them when disconnected
2019-08-16 16:09:14 +01:00
Milos Gajdos 7abdc68049 Fixed the race. Made wait channel boolean. 2019-08-16 15:40:35 +01:00
Milos Gajdos c90e1ccb99 Fixed reconnect code; refactor tunnel tests. 2019-08-16 15:18:34 +01:00
Asim Aslam 991142cd57 No need to set request in the buffer 2019-08-16 14:42:45 +01:00
Asim Aslam 5a5b1b8f6e only continue to stream when its a stream 2019-08-15 20:54:28 +01:00
Asim Aslam 58bc4c103f go fmt 2019-08-15 20:54:09 +01:00
Asim Aslam 88817dc53f Strip some dead code 2019-08-15 20:54:00 +01:00
Asim Aslam ef04331b86 multiplexing cruft 2019-08-15 20:08:49 +01:00
Milos Gajdos 67215ae5da Changed nodeLink to setupLink 2019-08-15 19:24:24 +01:00
Milos Gajdos f120452d28 Monitor outbound links periodically and reconnect the failed links. 2019-08-15 18:18:58 +01:00
Milos Gajdos 740cfab8d0 Monitor outbound links and delete them when disconnected 2019-08-15 16:52:16 +01:00
Asim Aslam f6b8045dd5 send client error if it exists 2019-08-15 15:22:53 +01:00
Asim Aslam b776fbb766 add a pseudo socket implementation 2019-08-15 15:09:56 +01:00
Asim Aslam a42de29f67 Do same for host port on deregister 2019-08-15 08:59:50 +01:00
Asim Aslam 0f6d09af33 go fmt 2019-08-15 08:47:32 +01:00
Asim Aslam 2dd5109eee Merge pull request #669 from printfcoder/master
fix registry addr error for mq-rpc
2019-08-15 07:36:06 +01:00
Shu xian e609095ba4 Merge pull request #2 from micro/master
merge
2019-08-15 08:38:08 +08:00
Asim Aslam 4843f09afa Merge pull request #670 from milosgajdos83/loopback-msg-fix
Fixing the tunnel loopback messaging
2019-08-14 17:28:15 +01:00
Milos Gajdos f9eddf1e6f Fixing the tunnel loopback messaging 2019-08-14 17:14:39 +01:00
Shu xian f19308f1e6 Merge pull request #1 from micro/master
merge
2019-08-14 22:02:41 +08:00
Asim Aslam 8f0c2e0412 add a better tunnel test 2019-08-14 14:38:17 +01:00
Shu Xian bf0e46dc0d fix registry addr error for mq-rpc 2019-08-14 21:32:28 +08:00
Asim Aslam 15975d2903 Merge pull request #668 from milosgajdos83/tun-token-loopback
[WIP] Tunnel loopback connections
2019-08-14 14:32:18 +01:00
Milos Gajdos 9f2f0e3cea Moved Close method to the bottom 2019-08-14 13:26:23 +01:00
Milos Gajdos 151bcf0ea1 Send and receive on loopback tunnel interface 2019-08-14 13:00:10 +01:00
Asim Aslam dc0fbfc3c0 Merge pull request #666 from unistack-org/log
export log levels and reverse log level order
2019-08-14 07:41:01 +01:00
Milos Gajdos e607485c6b Check for token in every received message. 2019-08-14 01:23:03 +01:00
Vasiliy Tolstov 70d0029658 add warn log level
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2019-08-14 02:26:51 +03:00
Vasiliy Tolstov a606813fdf export log levels and reverse log level order
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2019-08-14 02:18:22 +03:00
Milos Gajdos 750267b308 first commit to draft up a way for Sending messages to loopback 2019-08-13 20:11:23 +01:00
Asim Aslam 7ce0305db4 only operate on clients that are the same as the server 2019-08-13 16:08:56 +01:00
Asim Aslam c39591af0e add a mux package for the proxy 2019-08-13 15:21:51 +01:00
Asim Aslam fedc6be3e6 Merge pull request #663 from milosgajdos83/router-start
Add Start method to router
2019-08-13 08:12:56 +01:00
Milos Gajdos cb1679fd8d Add Start method to router
Added Start to router packages.
Fixed potential deadlocks.
2019-08-12 22:23:46 +01:00
Asim Aslam c0a676bfa9 Only check the router status if the lookup fails 2019-08-12 17:06:08 +01:00
Asim Aslam cb4e376c64 Update go mod 2019-08-12 12:35:09 +01:00
Asim Aslam c2c8182a5b delete tunnel headers and add some TODOs 2019-08-11 21:53:40 +01:00
Asim Aslam 01cb146e0d send message once after creating socket 2019-08-11 18:24:16 +01:00
Asim Aslam d0d729a789 fix the tunnel execution 2019-08-11 18:11:33 +01:00
Asim Aslam 113d87d855 Merge branch 'master' of ssh://github.com/micro/go-micro 2019-08-11 16:15:30 +01:00
Asim Aslam 56df10f68b use keepalive in quic by default 2019-08-11 16:12:31 +01:00
Asim Aslam 3a5428fb36 Merge pull request #660 from xpunch/serviceNotFoundIssue
Service not found issue
2019-08-11 12:44:27 +01:00
johnson 178a3b3d8e Merge remote-tracking branch 'origin/master' into serviceNotFoundIssue
# Conflicts:
#	client/grpc/grpc.go
2019-08-11 19:34:00 +08:00
johnson de34f259ba update service not found error tooltip
fixing test failed issue

change back error type
change registry.ErrNotFound back to selector.ErrNotFound

change back error type
change registry.ErrNotFound back to selector.ErrNotFound

remove the single node tunnel test

Fix read yaml config from memory

package main

import (
	"fmt"

	"github.com/micro/go-micro/config"
	"github.com/micro/go-micro/config/source/memory"
)

var configData = []byte(`
---
a: 1234
`)

func main() {
	memorySource := memory.NewSource(
		memory.WithYAML(configData),
	)
	// Create new config
	conf := config.NewConfig()

	// Load file source
	conf.Load(memorySource)

	fmt.Println(string(conf.Bytes()))
}
2019-08-11 19:31:22 +08:00
potato 81b68a1d7f Merge pull request #4 from micro/master
update fork
2019-08-11 19:05:49 +08:00
Asim Aslam 1a600810a7 Merge pull request #661 from XiaoLer/patch-2
Fix read yaml config from memory
2019-08-11 12:03:18 +01:00
potato 94127ae1aa Merge pull request #3 from micro/master
update fork
2019-08-11 18:24:57 +08:00
刘小乐 cd2ac648ff Fix read yaml config from memory
package main

import (
	"fmt"

	"github.com/micro/go-micro/config"
	"github.com/micro/go-micro/config/source/memory"
)

var configData = []byte(`
---
a: 1234
`)

func main() {
	memorySource := memory.NewSource(
		memory.WithYAML(configData),
	)
	// Create new config
	conf := config.NewConfig()

	// Load file source
	conf.Load(memorySource)

	fmt.Println(string(conf.Bytes()))
}
2019-08-11 18:05:35 +08:00
Asim Aslam e613b0c205 remove the single node tunnel test 2019-08-11 09:54:02 +01:00
potato 57dacf1831 Merge pull request #2 from micro/master
update fork
2019-08-11 10:22:33 +08:00
Asim Aslam 8986b3135f Strip logging 2019-08-10 18:46:54 +01:00
Asim Aslam 6dd3ea1853 Remove listen check 2019-08-10 18:44:50 +01:00
Asim Aslam 2c66e94045 fix some tunnel bugs like races and duplicate messages... 2019-08-10 16:37:49 +01:00
Asim Aslam c1ff3ceee4 Add more verbose not found error 2019-08-09 12:31:29 +01:00
potato b13604fb4b Merge pull request #1 from micro/master
Update forks to latest
2019-08-09 18:46:28 +08:00
Asim Aslam 057adb2b2e Merge pull request #658 from XiaoLer/patch-1
no more `WithData` method, instead of  `WithJSON`
2019-08-09 11:37:35 +01:00
刘小乐 7bd6d1b549 no more WithData method, instead of WithJSON 2019-08-09 12:45:59 +08:00
Asim Aslam 37988b596d Merge pull request #656 from milosgajdos83/tun-listener
Close the tunnel listener when the tunnel is cloed.
2019-08-08 15:25:19 +01:00
Milos Gajdos 9eb45dac82 Close the tunnel listener when the tunnel is cloed. 2019-08-08 15:20:53 +01:00
Asim Aslam 59b13aef22 tunnel skip zero length nodes 2019-08-08 13:15:30 +01:00
Asim Aslam 1e496938b7 more tunnel logging 2019-08-08 13:07:13 +01:00
Asim Aslam fbc1d523d7 add ability to set log level via env var 2019-08-08 13:07:04 +01:00
Asim Aslam 11795071fb Fix panic 2019-08-08 12:45:37 +01:00
Asim Aslam c7e8a2aeb9 Merge pull request #651 from magodo/master
wait nats drain since it's asynchronous
2019-08-08 00:30:01 +01:00
Asim Aslam cb1c1afc84 add quic to defaults 2019-08-08 00:19:30 +01:00
Asim Aslam 3fc7d9ea50 Quic requires an initial message to start the session so we need connect 2019-08-08 00:19:16 +01:00
Asim Aslam abc2ace409 Merge pull request #653 from micro/tunnel
Add back the old tunnel interface
2019-08-07 22:36:15 +01:00
Asim Aslam 243d43df92 Strip master from travis 2019-08-07 22:32:16 +01:00
Asim Aslam 9c2b882008 Bump travis go 2019-08-07 22:27:03 +01:00
Asim Aslam 4370f03e04 update go modules 2019-08-07 22:11:52 +01:00
Asim Aslam a3b962f37b Fix travis test? 2019-08-07 22:02:58 +01:00
Asim Aslam a894b4f354 add tunnel/transport package 2019-08-07 21:58:25 +01:00
Asim Aslam fc379f2d2c Remove other accept 2019-08-07 19:03:45 +01:00
Asim Aslam dcf4fed6a3 Add a second test for two tunnels 2019-08-07 18:56:21 +01:00
Asim Aslam 117376a922 Add back the old tunnel interface 2019-08-07 18:44:33 +01:00
Asim Aslam 380d9790e6 add io.ReadWriteCloser ontop of transport.Socket 2019-08-07 15:02:00 +01:00
magodo 0baea58938 wait nats drain since it's asynchronous
1. nats subscription draining is removed, since it is asynchronous,
   and there is no reliable way to detect when it is finished.
   Remove this option to avoid confusion.
2. nats connection draining is kept, and use 2 callbacks to detect
   draining timeout (timeout is set via `nats.Options`) or finish.
3. Also honour options passed in `broker.Init()` (previously only
   `broker.New()` is honoured).
2019-08-07 17:58:45 +08:00
Asim Aslam edb0fe4b16 fix the consul setup code 2019-08-06 19:43:46 +01:00
Asim Aslam eae32176c4 Monitor all services in the monitor 2019-08-06 19:02:57 +01:00
Asim Aslam bc751c55fb Merge pull request #650 from micro/monitor
Add monitor/debug/service packages
2019-08-06 18:09:57 +01:00
Asim Aslam 91f2af91de Fix bugs in monitor 2019-08-06 18:05:05 +01:00
Asim Aslam 3adce58eb2 Add monitor/debug packages 2019-08-06 17:53:14 +01:00
Asim Aslam bb01b3ed78 Don't extract repeated value 2019-08-06 14:52:15 +01:00
Asim Aslam c3ea25225c Don't check value name on extraction 2019-08-06 14:49:42 +01:00
Asim Aslam beffa625f8 fix broker log line 2019-08-06 12:25:51 +01:00
Asim Aslam 0d85e35da0 Merge pull request #649 from milosgajdos83/tun-types
Rough outline of tunnel types
2019-08-06 11:54:54 +01:00
Milos Gajdos 4074cce397 Rough outline of tunnel types 2019-08-06 11:46:47 +01:00
Asim Aslam 000431f489 Nats addr fix https://github.com/micro/go-micro/pull/648 2019-08-06 09:15:54 +01:00
Asim Aslam e16420fdbd Consul config fix https://github.com/micro/go-micro/pull/641 2019-08-06 09:15:38 +01:00
Milos Gajdos 52d8d26018 Transport() will return tunnel (pseudo) Transport 2019-08-05 21:09:46 +01:00
Asim Aslam 6649012af3 Merge pull request #645 from milosgajdos83/transport-out
Tunnel no longer embeds transport
2019-08-05 19:57:22 +01:00
Milos Gajdos 6b5dcbf814 Tunnel no longer embeds transport 2019-08-05 19:41:48 +01:00
Asim Aslam 34381213e7 Package comment 2019-08-05 18:04:47 +01:00
Asim Aslam 767292906a Merge pull request #644 from milosgajdos83/tunnel
Adds outline of go-micro Tunnel interface
2019-08-05 17:54:40 +01:00
Milos Gajdos e1ecd728c5 Adds outline of go-micro Tunnel interface 2019-08-05 17:52:57 +01:00
Asim Aslam f1b6709722 Fix breaking api changes 2019-08-05 17:47:50 +01:00
Asim Aslam 4030ccc27b Move proxy/router 2019-08-05 17:44:33 +01:00
Asim Aslam 2e67e23a23 Update .travis.yml 2019-08-03 15:16:30 +01:00
Asim Aslam be229438bc Merge pull request #640 from unistack-org/deadline
transport memory: add Send/Recv Timeout
2019-08-03 13:51:01 +01:00
Vasiliy Tolstov e1709026e4 transport memory: add Send/Recv Timeout
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2019-08-03 15:39:44 +03:00
Asim Aslam d250ac736f In the event watchRegistry or watchTable exit then close the go routines 2019-08-02 15:17:48 +01:00
Asim Aslam 6719f8d655 Remove the table watcher when stopped 2019-08-02 14:59:08 +01:00
Asim Aslam d7929ef8f3 Stop the ticker when exiting 2019-08-02 14:44:11 +01:00
Asim Aslam 04404441a4 Merge pull request #634 from micro/rcache-stop
Stop a goroutine leak in registy
2019-08-01 23:17:39 +01:00
Asim Aslam b806e7bdf5 Stop a goroutine leak in registy 2019-08-01 23:03:11 +01:00
Milos Gajdos 2720c6f28e Removed trailing white characters 2019-08-01 13:32:55 +01:00
Asim Aslam cdf0f14d58 remove this code 2019-07-31 17:19:49 +01:00
Asim Aslam 679c5f0ccd Fix some connection bugs 2019-07-31 16:49:48 +01:00
Asim Aslam 873bfcc73c Process/Stop router 2019-07-31 16:46:55 +01:00
Asim Aslam 7884e889f4 Don't publish the process rpc call and embed the router handler in the network 2019-07-31 16:36:53 +01:00
Asim Aslam b1c49a0ddc Add router handler 2019-07-31 16:10:04 +01:00
Asim Aslam 318367cd71 move NewNetwork 2019-07-31 15:37:12 +01:00
Asim Aslam 2d09e74b0e add address/advertise 2019-07-31 15:35:51 +01:00
Asim Aslam 3e90d32f29 Add proxy/router 2019-07-31 15:30:51 +01:00
Asim Aslam fca89e06ef Some network inspiration 2019-07-31 15:22:57 +01:00
Asim Aslam 89fc142e47 Update to use mdns 0.2.0 2019-07-31 13:16:57 +01:00
Asim Aslam 0b2c8ee523 Add top level data package comment 2019-07-30 16:47:18 +01:00
Asim Aslam 852abcaaed yolo commit functioning router code. all credit to the milos gajdos 2019-07-29 18:57:40 +01:00
Asim Aslam 11f80708ce move lock 2019-07-29 12:52:52 +01:00
Asim Aslam 104778e5e5 move lock 2019-07-29 12:52:32 +01:00
Asim Aslam ae99b9a887 syntactic changes 2019-07-29 12:44:59 +01:00
Asim Aslam 8fdc050e2e syntactic changes 2019-07-29 12:44:28 +01:00
Asim Aslam 8855beb62d syntactic changes 2019-07-29 12:43:20 +01:00
Asim Aslam 47acdf6a4b move Table to table 2019-07-29 12:40:13 +01:00
Asim Aslam 4fc9b9821a Merge pull request #621 from milosgajdos83/no-table-package
[WIP] No table package. router/service package introduced
2019-07-29 12:36:40 +01:00
Asim Aslam a5fb124b22 update the mdns version 2019-07-29 12:34:00 +01:00
Asim Aslam 5b327ce723 change id to name in resolver 2019-07-28 20:00:09 +01:00
Asim Aslam 2b5bf1154a rename config tests 2019-07-28 19:52:01 +01:00
Asim Aslam b7b8f8bf11 remove agent readme 2019-07-28 19:47:25 +01:00
Asim Aslam a63dcda003 Strip the verbosity of the debug handler 2019-07-28 19:43:50 +01:00
Asim Aslam 1db98ee0f0 move all the buffer references to util/buf 2019-07-28 19:33:24 +01:00
Asim Aslam f2669e7b1e Move connection pool to own package 2019-07-28 18:56:18 +01:00
Asim Aslam adb6760e21 readd the resolver 2019-07-28 12:14:40 +01:00
Asim Aslam 2b3a87a212 Merge pull request #617 from three-zhang/master
fix bug
2019-07-27 18:08:32 +01:00
Milos Gajdos 3d2ec5dbb1 Regenerated proto because proto reasons. 2019-07-27 16:12:44 +01:00
Milos Gajdos 96f9ce1bd3 Proper router stopping. Printable router status. 2019-07-27 16:11:06 +01:00
Milos Gajdos cb3052ce04 Proper stopping of service router 2019-07-27 16:11:06 +01:00
Milos Gajdos 2f1658c213 Table package is no more, hence removed references to it 2019-07-27 16:11:06 +01:00
Milos Gajdos d8b00e801d Stop watcher when router stops. Drain advert channel when stopping. 2019-07-27 16:11:06 +01:00
Milos Gajdos 002abca61f Finished Advertise(). Implemented Process() 2019-07-27 16:11:06 +01:00
Milos Gajdos c5740ae031 Outline of Advertise, Watch and start of the router. 2019-07-27 16:11:05 +01:00
Milos Gajdos ddad43bd77 Added service.Router Route CRUD. Outlined watcher and run() 2019-07-27 16:11:05 +01:00
Milos Gajdos b6fb969ab9 Add List and Lookup implementation. Default error for not implement. 2019-07-27 16:11:05 +01:00
Milos Gajdos 22d0f1f08f Changed documentation. 2019-07-27 16:08:14 +01:00
Milos Gajdos c3a8146d99 Added outline of router/service package. 2019-07-27 16:08:14 +01:00
Milos Gajdos 2338780a61 Full router RPC coverage 2019-07-27 16:08:14 +01:00
Milos Gajdos e22c4b4c07 table package is no more. Cleaned up unnecessary code, too. 2019-07-27 16:04:08 +01:00
张三 100cb9db6b fix bug
https://github.com/micro/micro/issues/293
Send request failed using micro Content-Type application/grpc+json
2019-07-27 11:11:16 +08:00
Asim Aslam 4e27aac398 regen router proto 2019-07-26 18:07:36 -07:00
Asim Aslam 7ca06f0c1d set router proto package name to go.micro.router 2019-07-26 18:07:14 -07:00
Asim Aslam 7ca8f8f0ab Merge pull request #611 from milosgajdos83/rpc-router
Adds new RPC methods to router service interface
2019-07-24 13:30:29 -07:00
Milos Gajdos 9ad5ae6644 Adds new RPC methods to router service interface
We have added Advertise() and Process() RPCs in this commit.
2019-07-24 21:07:04 +01:00
Asim Aslam 220a8fafb1 Merge pull request #610 from milosgajdos83/proxy-watch
Adds route watcher to mucp.Proxy
2019-07-24 11:19:52 -07:00
Milos Gajdos 809de7a052 Mutex Unlock when we fail to store route in cache. 2019-07-24 19:13:05 +01:00
Milos Gajdos 23f0231a09 Adds route watcher to mucp.Proxy 2019-07-24 19:03:13 +01:00
Asim Aslam 74cbce72df Merge pull request #609 from milosgajdos83/proxy-router-interface
mucp Proxy no longer uses RPC interface of router.Router directly
2019-07-24 10:40:33 -07:00
Milos Gajdos b55adc0c30 mucp Proxy no longer uses RPC interface of router.Router directly 2019-07-24 18:32:39 +01:00
Asim Aslam 388ac34b7c Merge pull request #608 from milosgajdos83/router-cleanup
Small router refactoring
2019-07-24 09:46:48 -07:00
Milos Gajdos 13a8cfe7f3 Small function documentation update 2019-07-24 17:22:27 +01:00
Milos Gajdos 1e94d9fe5a Router cleanup and refactoring for win and profit.
This commit adds the following changes to router package:
* it refactors Advertise() function which now does only what
it claims to do: advertising
* various router packages functions/methods have been renamed to make
their functionality more obvious and more in line with what they actually do
* function documentation changes related to the above bullet points
2019-07-24 17:16:52 +01:00
Asim Aslam 49dcc3d1bd Remove readme and examples from web repo 2019-07-22 09:57:34 -07:00
Milos Gajdos 481ebe9d4f Merge pull request #604 from BruceWangNo1/patch-1
Update client.go
2019-07-22 10:55:55 +01:00
Bruce Wang 502f6d3e9f Update client.go
fixed one typo
2019-07-22 15:41:14 +08:00
Asim Aslam 8f2585724c Merge pull request #598 from unistack-org/ipv6fix
bunch of other ipv6 fixes
2019-07-18 07:24:47 -07:00
Vasiliy Tolstov 1217ca94b1 bunch of other ipv6 fixes
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2019-07-18 08:59:53 +03:00
Asim Aslam 96cf14ed53 Merge pull request #591 from milosgajdos83/advert-damp
[WIP] Fixes advert route event dampening behaviour
2019-07-17 08:12:35 -07:00
Asim Aslam 3a8edd705c Merge pull request #594 from unistack-org/ipv6
fix ipv6 addr parsing
2019-07-17 07:51:17 -07:00
Milos Gajdos 94b6455577 Increment WaitGroup before launching advertiseEvents goroutine 2019-07-17 13:02:47 +01:00
Vasiliy Tolstov e688ab0a45 fix ipv6 addr parsing and using
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2019-07-17 12:20:29 +03:00
Milos Gajdos 2803146673 Renaming rampage
Addressing the comments in #591, router.String() now returns "default"

Furthermore, a tonne of other renaming has been included in this commit
as a result of running go vet ./... inside the router package.
2019-07-17 00:06:11 +01:00
Asim Aslam d4fefc4b76 Merge pull request #592 from unistack-org/speedup
changes to minimize allocations and provide useful info
2019-07-16 14:41:11 -07:00
Vasiliy Tolstov a3bddf5839 changes to minimize allocations and provide useful info
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2019-07-17 00:21:03 +03:00
Milos Gajdos 92495d22db Fixes advert dampening behaviour.
This commit adds the following changes:
* advert now stores a list of route events as opposed to just last one
* attempt to dedup route events before appending them to advert
* have max suppress threshold for long time suppressed adverts
* decaying events on every advert tick

Originally we werent decaying penalties on every advert tick.
That was incorrect behaviour. Furthermore some events would end up being
accumulated potentially causing memory leaks.

We were also overriding the last received router event which was causing
incorrect sequence of events to be applied when received by a receiver:
Create, Delete would be "squashed" into Delete only which would be
nonsensical since the Create event would never be delivered hence we
would be deleting nonexistent routes.

Not Decaying the events on every tick or not having the max suppression
threshold could lead to DoS by growing the router memory infinitely.
2019-07-16 19:00:25 +01:00
Asim Aslam 8c7e35c3c6 Merge pull request #587 from milosgajdos83/registry-copy-perf
Preallocate slices in registry.Copy() to avoid append() reallocations when copying data
2019-07-15 07:04:49 -07:00
Milos Gajdos c108188d65 Preallocate nodes slice in addNodes before populating it 2019-07-15 14:47:33 +01:00
Milos Gajdos 609934ce99 Preallocate slices; avoide append() reallocations when copying data 2019-07-15 11:13:58 +01:00
Asim Aslam aa79c41fc5 update tunnel comment 2019-07-14 18:34:32 -07:00
Asim Aslam a549f92dec Merge pull request #585 from unistack-org/transport2
transport memory: fix races
2019-07-13 19:38:22 -07:00
Vasiliy Tolstov 81d2259fac transport memory: fix races
* fix race with rand.Intn for non default source
* increase random interval to avoid issues when many services
  running on the host

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2019-07-13 23:47:57 +03:00
Asim Aslam 2fecde1dbb Merge pull request #583 from unistack-org/broker
broker memory: fix issue with publish/subscribe
2019-07-13 00:16:28 +01:00
Vasiliy Tolstov 008749b2b0 broker memory: fix issue with publish/subscribe
mutex locking have errors, so when two service (one pub, other sub)
try to use this broker it waits for mutex release and nothing works

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2019-07-13 00:04:53 +03:00
Asim Aslam 3ccb900bca Merge pull request #582 from unistack-org/memory2
memory transport: use write mutex lock when close
2019-07-12 10:29:46 +01:00
Vasiliy Tolstov a72e1185da memory transport: use write mutex lock when close
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2019-07-12 12:11:08 +03:00
Asim Aslam 5157241c88 Merge branch 'master' of ssh://github.com/micro/go-micro 2019-07-11 21:46:33 +01:00
Asim Aslam 70d811c47a don't use quic in the test 2019-07-11 21:46:27 +01:00
Asim Aslam b371704444 Merge pull request #581 from milosgajdos83/proto-update
Added proto.Advert, proto.TableEvent is now proto.Event
2019-07-11 21:44:10 +01:00
Asim Aslam a5f21e69ad Merge branch 'master' of ssh://github.com/micro/go-micro 2019-07-11 21:41:00 +01:00
Asim Aslam 6b984136f7 update go mod 2019-07-11 21:40:52 +01:00
Milos Gajdos 9c851f297b Added proto.Advert type to protobuf definitions 2019-07-11 21:14:34 +01:00
Asim Aslam dac8a13a77 Merge pull request #580 from milosgajdos83/advertise-table
Advertise full table every minute.
2019-07-11 12:49:02 +01:00
Asim Aslam 360e193a01 update go mod 2019-07-11 12:47:50 +01:00
Milos Gajdos 35a1de91a9 Advertise full table every minute. 2019-07-11 12:39:20 +01:00
Asim Aslam 7631463b94 fix compilation errors 2019-07-11 10:47:02 +01:00
Asim Aslam 6581586226 Make tunnel test use quic 2019-07-11 10:34:01 +01:00
Asim Aslam 06c29302d7 Merge branch 'master' of ssh://github.com/micro/go-micro 2019-07-11 09:38:27 +01:00
Asim Aslam dab0e9e9bc Set next protos in quic 2019-07-11 09:38:20 +01:00
Asim Aslam 47d91a1f64 Merge pull request #579 from magodo/magodo/store_get_reset_expiry
`memoryStore.Read()` returns honor `Record.Expiry`
2019-07-11 08:39:46 +01:00
magodo bdeae91063 condense code 2019-07-11 14:13:58 +08:00
magodo c8d57032bc update expiry only if it is non-zero 2019-07-11 12:58:20 +08:00
magodo 3abe3aa28b store.Read() returns honor Record.Expiry 2019-07-11 12:51:55 +08:00
Asim Aslam 9b1cb4ef0e functioning tunnel with test 2019-07-11 00:55:50 +01:00
Asim Aslam b4796724d9 Merge branch 'master' of ssh://github.com/micro/go-micro 2019-07-11 00:14:43 +01:00
Asim Aslam ae5376cc0e functioning tunnel/link code 2019-07-11 00:14:36 +01:00
Asim Aslam 7bee0629c2 Merge pull request #578 from unistack-org/memory
memory transport: fix race cond on channel close
2019-07-10 23:30:46 +01:00
Vasiliy Tolstov 29fa8de98e memory transport: fix race cond on channel close
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2019-07-11 01:21:03 +03:00
Asim Aslam 382fbecd40 Merge pull request #577 from milosgajdos83/update-events
Added update action to handle update registry events. Table.Update inserts when no route found.
2019-07-10 21:54:48 +01:00
Milos Gajdos a0ee7d2092 Added update action to manageServiceRoutes. Table is embedded; skip opts 2019-07-10 21:28:32 +01:00
Asim Aslam 1f744b31a4 Return the dead node when deleting the service 2019-07-10 21:03:53 +01:00
Asim Aslam 998a23c963 Functional code for link 2019-07-10 20:04:01 +01:00
Asim Aslam e17ecf66b1 Fix breaking code 2019-07-10 20:03:55 +01:00
Asim Aslam c5dd737568 Add back in broker address 2019-07-10 19:58:30 +01:00
Asim Aslam 7c29be288b Update a tunnel top level comment 2019-07-10 19:33:34 +01:00
Asim Aslam 217f540601 The listener has no session id 2019-07-10 19:17:36 +01:00
Asim Aslam ffae0f0fab Add a comment for tunnel processor 2019-07-10 19:13:50 +01:00
Asim Aslam 4cca2b43a3 Add further link comments 2019-07-10 19:11:32 +01:00
Asim Aslam 8c157c1d5f update link comments 2019-07-10 19:09:22 +01:00
Asim Aslam 1f218f7b48 Allow the socket to be specified 2019-07-10 19:07:18 +01:00
Asim Aslam 7e0d4fe0cf Merge branch 'master' of ssh://github.com/micro/go-micro 2019-07-10 19:01:38 +01:00
Asim Aslam 0a39fe39c3 Update tunnel to use id+session for the key 2019-07-10 19:01:24 +01:00
Milos Gajdos 163b917ec7 proto.EventType Insert is now Create to mirror table.Event 2019-07-10 18:37:46 +01:00
Asim Aslam 0f16eb2858 add further comments to tunnel 2019-07-10 18:35:10 +01:00
Asim Aslam 89231f701b Add comments and session 2019-07-10 18:26:11 +01:00
Asim Aslam 196e76e350 Merge branch 'master' of ssh://github.com/micro/go-micro 2019-07-10 18:24:12 +01:00
Asim Aslam f3d9177233 Add sessions to tunnel 2019-07-10 18:24:03 +01:00
Asim Aslam 8b7ac8a3f9 Merge pull request #576 from milosgajdos83/router-rpc
Added List and Watch rpc calls.
2019-07-10 17:55:23 +01:00
Milos Gajdos 8f5aed707e Table.Add is now Table.Create. Insesrt event is now Create event. 2019-07-10 17:46:22 +01:00
Asim Aslam c71576a538 Update link Id comment 2019-07-10 17:43:36 +01:00
Asim Aslam 27cfc06828 Cleanup and move around the link code 2019-07-10 17:42:41 +01:00
Asim Aslam 717ba4b3c0 Add tunnel comments 2019-07-10 17:41:17 +01:00
Asim Aslam 4e3a230356 top level package comment 2019-07-10 17:40:14 +01:00
Asim Aslam 66c2519696 Add Tunnel: an interface for stream duplexing over a link 2019-07-10 17:36:04 +01:00
Milos Gajdos 86dfa82dfa Added List and Watch rpc calls. 2019-07-10 17:21:55 +01:00
Asim Aslam 55f8045a70 Add link: a layer ontop of a transport socket 2019-07-10 17:12:51 +01:00
Asim Aslam b23d955536 Use gateway if available 2019-07-10 08:26:33 +01:00
Asim Aslam 5b565f9f10 update comment 2019-07-10 07:56:52 +01:00
Asim Aslam 9955ed2034 move table 2019-07-10 07:56:18 +01:00
Asim Aslam c36107e811 cleanup consts 2019-07-10 07:51:24 +01:00
Asim Aslam a08b64c8ab remove the string methods 2019-07-10 07:50:33 +01:00
Asim Aslam 64ec0633a3 Fix breaks and go fmt 2019-07-10 07:47:17 +01:00
Asim Aslam 0a1b657221 visual cleanup of router code 2019-07-10 07:45:27 +01:00
Asim Aslam 34967e8e33 Merge pull request #573 from milosgajdos83/flap-detection
Router rework. Flap detection. Table package.
2019-07-10 07:12:18 +01:00
Asim Aslam eda380284c remove network 2019-07-09 18:45:14 +01:00
Asim Aslam 0bf54c122f move transport back 2019-07-09 18:41:26 +01:00
Asim Aslam 97282a5377 remove resolver 2019-07-09 16:54:44 +01:00
Asim Aslam b642d5e1c0 remove proto dir 2019-07-09 16:53:30 +01:00
Asim Aslam c5a282ddd3 remove the tunnel 2019-07-09 16:52:44 +01:00
Milos Gajdos 6cf8bde612 Router selector and proxy modifications due to Route struct changes. 2019-07-09 16:45:31 +01:00
Asim Aslam 327029beff fix string method 2019-07-09 16:44:43 +01:00
Asim Aslam c5214c931f reorder and reword 2019-07-09 16:38:44 +01:00
Asim Aslam d725980444 add some initialisers 2019-07-09 16:37:59 +01:00
Milos Gajdos 23cb811f60 Removed fmt.Stringer artistry from all roouter and table structs 2019-07-09 16:17:18 +01:00
Milos Gajdos c5fb409760 Removed debug logs 2019-07-09 15:55:39 +01:00
Milos Gajdos 70665e5a7d Route has changed to accomodate Link, Service and Address 2019-07-09 15:46:32 +01:00
Milos Gajdos 449aa0a339 Collect ANNOUNCE mesage events before adding default gateway. 2019-07-09 15:46:31 +01:00
Milos Gajdos 265271008e Simplified processEvents loop; Added router Announcement. 2019-07-09 15:46:31 +01:00
Milos Gajdos b82245429e Simplified table logic. Lookup tests. mucp/cient update 2019-07-09 15:46:31 +01:00
Milos Gajdos cc590f5f2c Table now has a dedicated package inside router package. 2019-07-09 15:46:31 +01:00
Milos Gajdos 0c1a28a9b6 Router routing table management. Table route hashes. Status codes changed.
We now manage routing table actions using dedicated functions run on
either registry or services in the registry.

Routing table now uses Route.Hash() instead of maintaining its own hash
struct filed which previously performed these operations.

Various names of variables have been changed to make them more concise.
2019-07-09 15:46:31 +01:00
Milos Gajdos 30d05e34a9 Read and remove routes based on registry event deltas 2019-07-09 15:46:31 +01:00
Milos Gajdos b68f0e237f Removed event from eventMap once sent to be advertised 2019-07-09 15:46:31 +01:00
Milos Gajdos 72ef032162 First shot at flapping detection and event advertising.
This commit also adds Route hash function, lots of debug messages for
now and String() methods for various API objects.
2019-07-09 15:46:30 +01:00
Milos Gajdos d6c07dfb16 Update is now Advert 2019-07-09 15:46:30 +01:00
Milos Gajdos ea872f6900 Updated error statements; Update ships list of events. 2019-07-09 15:46:30 +01:00
Asim Aslam 6bdc23a3aa add comments 2019-07-08 16:32:12 +01:00
Asim Aslam fa54db5ba5 rename network name to go.micro 2019-07-08 16:27:02 +01:00
Asim Aslam 8015a1daaf Merge branch 'master' of ssh://github.com/micro/go-micro 2019-07-08 16:25:41 +01:00
Asim Aslam 608a1f8add remove node code 2019-07-08 16:25:04 +01:00
Asim Aslam 4a02e1ff2f rewrite network interface 2019-07-08 16:24:57 +01:00
Asim Aslam 5cd1e81ba9 Merge pull request #570 from sunfuze/grpc-json-marshal
grpc: using jsonpb.Marshaler to do Marshal, map to jsonpb.Unmarsh
2019-07-08 08:44:51 +01:00
Asim Aslam d3edad474e Merge pull request #571 from micro/remove-port
Remove Port from registry
2019-07-08 08:18:26 +01:00
Asim Aslam e0bf1c2283 Remove Port from registry 2019-07-08 08:01:42 +01:00
Joe b655f7f55a grpc: using jsonpb.Marshaler to do Marshal, map to jsonpb.Unmarsh 2019-07-08 10:32:10 +08:00
Asim Aslam 5b7454e5a8 update transport package comments 2019-07-07 15:04:07 +01:00
Asim Aslam 0b732b2c49 update transport package comments 2019-07-07 15:03:08 +01:00
Asim Aslam be33d9204a Merge pull request #569 from micro/event
Change Publication to Event
2019-07-07 12:45:37 +01:00
Asim Aslam 4b4ad68eb9 Change Publication to Event 2019-07-07 12:44:09 +01:00
Asim Aslam 79b03a6825 add broker args 2019-07-07 12:36:14 +01:00
Asim Aslam 777a203f96 gofmt 2019-07-07 12:33:54 +01:00
Asim Aslam c1097a4509 strip broker address 2019-07-07 12:33:47 +01:00
Asim Aslam 5f664faeba Add transport options comments 2019-07-07 12:23:03 +01:00
Asim Aslam d2d6841f02 Move transport to network/transport 2019-07-07 10:37:34 +01:00
Asim Aslam eafc930f84 Change network id to name 2019-07-07 10:10:38 +01:00
Asim Aslam d1fc3c361e Merge pull request #566 from unistack-org/speed
codec grpc: fix extra allocations on message unmarshal
2019-07-04 17:29:32 +01:00
Vasiliy Tolstov e40307c567 codec grpc: fix extra allocations on message unmarshal
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2019-07-04 14:06:29 +03:00
Asim Aslam a412486c39 Update registry util semantics 2019-07-04 11:36:49 +01:00
Asim Aslam 59a0e727e4 Merge pull request #563 from unistack-org/race
export registry util function to safe copy registry data
2019-07-04 11:16:54 +01:00
Asim Aslam b35f227f7a Merge pull request #565 from sunfuze/grpc-json-unmarshal
grpc: if unmarshal target is proto.Message, using jsonpb
2019-07-04 11:16:11 +01:00
Asim Aslam 00ba1655ca remove some readmes 2019-07-04 11:15:54 +01:00
Joe e88041dc26 if unmarshal target is proto.Message, using jsonpb 2019-07-04 16:43:36 +08:00
Vasiliy Tolstov 0e34c572b4 export registry util function to safe copy registry data
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2019-07-04 11:39:43 +03:00
Asim Aslam 2644497ccb Fix some link connection logic 2019-07-03 19:51:40 +01:00
Asim Aslam e54de56376 Functional loopback code 2019-07-03 19:26:24 +01:00
Asim Aslam 7008809eff Make the link use debug 2019-07-02 20:57:23 +01:00
Asim Aslam f619e46def Some functioning network code 2019-07-02 20:54:21 +01:00
Asim Aslam c3611aead2 go fmt 2019-07-02 20:53:42 +01:00
Asim Aslam 686aa3aa05 log levels 2019-07-02 19:21:43 +01:00
Asim Aslam 543dc0166c Restructure network things before moving 2019-07-02 08:45:00 +01:00
Asim Aslam 372ad949ff Rename to mucp transport 2019-07-02 00:48:15 +01:00
Asim Aslam a0c2d18c40 Merge pull request #559 from milosgajdos83/table-tests
Default routing table tests
2019-07-02 00:28:52 +01:00
Asim Aslam b4236f4430 Add network transport 2019-07-02 00:27:53 +01:00
Milos Gajdos 0e1fcc4f28 Stop hardcoding table sizes; increment as you move on. 2019-07-01 23:38:49 +01:00
Milos Gajdos 8f22e61a8b List test function properly named. 2019-07-01 23:38:48 +01:00
Milos Gajdos 956902f641 Added List tests. 2019-07-01 23:38:48 +01:00
Milos Gajdos ffac0b9a18 First batch of Add/Del/Update tests. 2019-07-01 23:38:48 +01:00
Asim Aslam c108b51d2a add network to Node proto 2019-07-01 23:12:05 +01:00
Asim Aslam 5fd798c9b6 add resolver comment 2019-07-01 23:11:55 +01:00
Asim Aslam ebe3633082 move network initialiser code 2019-07-01 22:59:11 +01:00
Asim Aslam 032c3134c6 update comment 2019-07-01 22:54:26 +01:00
Asim Aslam 8ccf61ebaf Strip Link methods 2019-07-01 22:52:28 +01:00
Asim Aslam fbbc33d0f9 Set Network() to string 2019-07-01 22:41:27 +01:00
Milos Gajdos da299ea26b Simmplified RT Lookup. No more Metric in Query. 2019-07-01 20:33:08 +01:00
Asim Aslam d3e200575c Merge branch 'master' of ssh://github.com/micro/go-micro 2019-07-01 18:37:45 +01:00
Asim Aslam ddee8412ff Add tunnel interface 2019-07-01 18:37:39 +01:00
Asim Aslam c84f101e17 Merge pull request #553 from milosgajdos83/router-network
Changed router interface. Added table watcher. Advertise routes
2019-07-01 16:17:02 +01:00
Milos Gajdos f6e064cdbd Fixed router idempotency. Return registry.ErrWatchStopped from mdns reg 2019-07-01 15:46:26 +01:00
Milos Gajdos cff46c3fd8 Added Init state. Recreate exit and advertise channels when recovering
In order to differentiate between intialized and other states we
introduced a new state: Init. The router is in this state only when it's
created.

We have cleaned up router status management which is now handled by
manageStatus function only.
2019-07-01 15:46:26 +01:00
Milos Gajdos 32300eadc1 Added Router Status which allows to track router status 2019-07-01 15:46:25 +01:00
Milos Gajdos 8ad2f73ad6 Advertisement is now Update; started bit is now running. 2019-07-01 15:46:25 +01:00
Milos Gajdos 9d7420658d Changed router interface. Added table watcher. Advertise routes
* Changed router interface to return Advertisement channel
* Added default gateway route to the routing table if supplied
* Watch table for updates and advertise to the network
* We hash the routes on 3-tuple (Destination, Gateway, Network)
2019-07-01 15:46:25 +01:00
Asim Aslam 0971deb9cc Merge pull request #558 from micro/network
Networking code
2019-07-01 12:12:23 +01:00
Asim Aslam 0899282277 Checkpoint networking code 2019-07-01 11:55:15 +01:00
Asim Aslam d8e998ad85 add peer in context 2019-06-27 14:53:01 +01:00
Asim Aslam b4b76d452a Call advertise 2019-06-27 14:38:12 +01:00
Asim Aslam 67e3d560fe Lookup every service. FML 2019-06-27 14:37:52 +01:00
Asim Aslam 9630e153a5 fix grpc proto wrapper 2019-06-27 13:08:06 +01:00
Asim Aslam 43297f731c Add default router 2019-06-27 12:57:23 +01:00
Asim Aslam f6f6e1b561 Use the router to get routes 2019-06-27 12:56:52 +01:00
Asim Aslam 4bee5c1b2b Merge pull request #546 from lpxxn/master
pass parameter to anonymous function
2019-06-27 07:02:45 +01:00
lpxxn 3b0ef425b6 pass parameter to anonymous function 2019-06-27 13:06:53 +08:00
李鹏 5334203435 Merge pull request #4 from micro/master
pull
2019-06-27 13:01:14 +08:00
Asim Aslam 0da8256426 Accept a range of addresses 2019-06-26 20:51:13 +01:00
Asim Aslam 940ea94a96 Lookup router via registry 2019-06-26 19:56:40 +01:00
Asim Aslam b904f383c1 go fmt 2019-06-26 19:28:30 +01:00
Asim Aslam cedcef032d Add remote lookup via router selector 2019-06-26 19:27:38 +01:00
Milos Gajdos 76011b151d Bugfix: Set gateway to node.Address
gw has not been initialized; it was basically an empty string and only
got populated by Sprintf-ing the addr:port IF the port has been set.
This commit sets the gw to node.Address to it's never an empty string.
2019-06-26 16:28:33 +01:00
Asim Aslam 27b145f968 add router proto 2019-06-26 16:23:10 +01:00
Asim Aslam ac098e4d78 add router selector and network defaults 2019-06-26 16:12:57 +01:00
Asim Aslam 1a62c11166 Merge pull request #544 from milosgajdos83/router-rework
Router rework
2019-06-26 16:08:12 +01:00
Milos Gajdos fe84a2d726 Route per service node. No Network Registry for now. 2019-06-26 16:03:19 +01:00
李鹏 c282125f09 Merge pull request #3 from micro/master
update
2019-06-26 11:56:00 +08:00
Asim Aslam 4cad7697cc Merge pull request #542 from magodo/config_consul_source_opt
Add consul-specific option for config (as registry)
2019-06-25 16:14:03 +01:00
magodo a8dbca756c rename stuff per feedback 2019-06-25 22:41:31 +08:00
magodo 8e4fd16aff Add consul-specific option for config (as registry) 2019-06-25 18:31:32 +08:00
Asim Aslam 68764ebafc Add registry resolver 2019-06-24 15:30:17 +01:00
Asim Aslam 4d08618517 fix typo 2019-06-24 15:22:12 +01:00
Asim Aslam e5959f80d6 add http resolver 2019-06-24 15:21:24 +01:00
Asim Aslam b89423bf37 add resolver 2019-06-24 15:11:11 +01:00
Asim Aslam 9a56c4e0b2 Merge branch 'master' of ssh://github.com/micro/go-micro 2019-06-24 14:49:26 +01:00
Asim Aslam 4f982bb9cd Default to json content-type in api 2019-06-24 14:49:19 +01:00
Asim Aslam 1277f2478d Merge pull request #541 from milosgajdos83/gossip-del-service-revert
Reverts c0a628d
2019-06-22 20:05:10 +01:00
Asim Aslam dffbe045e4 move node functions 2019-06-22 19:02:57 +01:00
Milos Gajdos c3d2043caf Reverts c0a628d65b
Fixes #540
2019-06-22 19:01:03 +01:00
Asim Aslam 79cc8e34b0 Merge branch 'master' of ssh://github.com/micro/go-micro 2019-06-22 16:51:28 +01:00
Asim Aslam 2d91ba411e update the network interface 2019-06-22 16:51:20 +01:00
Asim Aslam 5ee7140aa3 Merge pull request #536 from magodo/config_source_consul_support_array
Config source consul support 1st array
2019-06-22 08:39:17 +01:00
magodo 6ef838c9aa Merge branch 'master' of https://github.com/micro/go-micro into config_source_consul_support_array 2019-06-22 07:14:15 +08:00
Asim Aslam 1b4005e9a5 Go fmt everything 2019-06-21 17:20:41 +01:00
Asim Aslam 3f97743e34 Move router and proxy into network package 2019-06-21 17:20:31 +01:00
Asim Aslam 7936d74602 Update comments 2019-06-21 16:17:12 +01:00
Asim Aslam 6db720b197 Merge branch 'master' of ssh://github.com/micro/go-micro 2019-06-21 15:14:08 +01:00
Asim Aslam ca5acba0c6 Move selector to client/selector 2019-06-21 15:13:54 +01:00
Asim Aslam b4acb9bb58 Merge pull request #538 from magodo/consul_path_prefix_leading_slash
config consul source supports slash as prefix
2019-06-21 14:23:53 +01:00
Asim Aslam c350e19552 Move cmd => config/cmd 2019-06-21 13:36:11 +01:00
Asim Aslam 4aa0192eba Update go mod 2019-06-21 12:55:31 +01:00
magodo 3c82b2e9e8 Merge branch 'consul_path_prefix_leading_slash' into dev 2019-06-21 16:53:21 +08:00
magodo 9514bd7b2a Merge branch 'config_source_consul_support_array' into dev 2019-06-21 16:52:01 +08:00
magodo 7acd249147 config consul source supports slash as prefix
`config.NewConfig()` with consul source will both read from consul
and watch consul for changes. Hence, the `prefix` is used in these
2 cases:

- read case: it is used to strip path based on the `KVPair` returned
from consul `kv.List()` method
- watch case: it is used as the `key` of watch query (`keyprefix` type)

So for *watch case*, the `key` is leagal to be `/` for watching change
on root. While for *read case*, because `KVPair.Key` is always stripped
off the leading slash, so if user specified some `prefix` with leading
slash, we should strip it also.

An extream case would be: user want's to read & watch node in root dir.
One would specify `prefix` as `/`, and it should work then.
2019-06-21 16:35:48 +08:00
magodo 1983b4ae92 variable rename to abstract encoder 2019-06-21 15:30:45 +08:00
magodo 92b998c3ab consul config source support 1st-level array
Check whetehr the 1st level encoded json is array or not, to
support 1st level array in consul config.

During debug, i suspected the incapability of arrray is caused by
json reader, so i added test for array. I think it makes no harm
to also check that in.
2019-06-21 00:25:39 +08:00
Milos Gajdos 1765be049b router.Start() is now router.Advertise(). Updated code documentation. 2019-06-20 13:04:58 +01:00
Asim Aslam 8d5d812e32 Fix a streaming bug 2019-06-20 12:44:51 +01:00
Asim Aslam 3f910038a3 Move store to data/store 2019-06-19 22:04:13 +01:00
Asim Aslam a8042adac1 Merge pull request #528 from milosgajdos83/router
Adds router package
2019-06-19 21:33:39 +01:00
Milos Gajdos 10a3636a9f Renamed variables, options and functions 2019-06-19 21:22:14 +01:00
Milos Gajdos 4e5fbbf7eb Replaced the debug network string by the correct router local address. 2019-06-19 18:11:16 +01:00
Milos Gajdos 59035ab801 Removed debug logs. advertiseToNetwork() replaced watchTable().
Debug logs that were helpful when squashing bugs have been removed.

advertiseToNetwork replaced the watchTable which originally watched the
routing table entries. We now take a different approach to propagating
the local registry services into the network registry.
2019-06-19 18:03:43 +01:00
Milos Gajdos d3525ebab3 Debug messages. Squashed Add Route bugs and few others. 2019-06-19 18:03:43 +01:00
Milos Gajdos 2674294cbe Delete route when no node is available. 2019-06-19 18:03:43 +01:00
Milos Gajdos b20dd16f92 Watcher now emits events instead of results. 2019-06-19 18:03:43 +01:00
Milos Gajdos 5088c9d916 Increased Network registry TTL. Routing Table remove is now delete.
Remove has been renamed to Delete to be more in line with the framework.

A bunch of comments have been added/updated for the future generations

We have increased the Network Registry TTL to 2 minutes.
2019-06-19 18:03:42 +01:00
Milos Gajdos f62fcaad76 Added router ID. Deregister remote services when router is stopped.
Added ID function to router interface.

Network registry addresses are deregistered when the router is stopped.

Query has been updated to search for particular GW in lookups.
2019-06-19 18:03:42 +01:00
Milos Gajdos 322eaae529 Small code refactoring. Added more comments and parseToNode func 2019-06-19 18:03:42 +01:00
Milos Gajdos 6a33b7576b Removed router watcher code duplication. Small code refactor. 2019-06-19 18:03:42 +01:00
Milos Gajdos 6e669d4611 Reorganised source. Renamed files. No Code change. 2019-06-19 18:03:42 +01:00
Milos Gajdos 95fc625e99 Big refactor. New Registry watchers. New options. New names. 2019-06-19 18:03:42 +01:00
Milos Gajdos 338e0fdf18 Lots of refactoring. We now have basic routing table watcher. 2019-06-19 18:03:42 +01:00
Milos Gajdos 5899134b66 Simplified API. Correct Router initialization. Debug printing. 2019-06-19 18:03:41 +01:00
Milos Gajdos da18ea4ab5 Changed default router table modifications. Entry is now Route. 2019-06-19 18:03:41 +01:00
Milos Gajdos 459f4c8387 Added Router ID and query options to limit number of results 2019-06-19 18:03:41 +01:00
Milos Gajdos 9c57f32f58 Added Entry type. Basic implementation of Router and Table 2019-06-19 18:03:41 +01:00
Milos Gajdos ad92e6821e Removed DefaultTable() from global vars
We will not initialize DefaultTable as global var unless the users asks
for it explicitly.
2019-06-19 18:03:41 +01:00
Milos Gajdos d7f0db04ec Added network ID option. Added mutex to routing table. 2019-06-19 18:03:41 +01:00
Milos Gajdos e4311c3a10 Redefined and polished some interfaces and data structures. 2019-06-19 18:03:41 +01:00
Milos Gajdos ee8b6b3114 Redefeind interfaces; Added better modelled data strauctures
Router interface has been redefined which fits better with what we are
looking for.

Routing table now offers a comprehensive set of information about its
entries which will make up for rich queries in the future

Query interface has been defined to enable current basic and more
advanced queries in the future.
2019-06-19 18:03:41 +01:00
Milos Gajdos 08da7c1283 First commit: Outline of Router interface 2019-06-19 18:03:40 +01:00
Asim Aslam 6587ae07be Merge pull request #523 from micro/grpc
GRPC Proxy
2019-06-19 15:31:45 +01:00
Asim Aslam 1c1dae0642 Fix the grpc test 2019-06-19 12:34:45 +01:00
Asim Aslam a0cb105cf6 Merge pull request #525 from magodo/consul_config_prefix_no_leading_slash
`prefix` in consul api starts with no leading slash
2019-06-19 08:12:35 +01:00
magodo 606b1ff7cf prefix in consul api starts with no leading slash
When `consul.StripPrefix(true)` is set, current impl. will pass the
specified prefix (or default prefix) when calling consul api.

However, `prefix` in consul api starts with no leading slash, so
the default prefix (`/micro/config`) doesn't actually work.

I avoid code changes (esp. the one in `util.go`) to eliminate
impact on users who already notice it.
2019-06-19 14:42:09 +08:00
Asim Aslam 73a8b14145 Merge pull request #524 from milosgajdos83/gosssip-remove-node
Properly delete service nodes
2019-06-19 07:11:27 +01:00
Milos Gajdos c0a628d65b Simplified delService code; properly delete service nodes 2019-06-18 21:39:00 +01:00
Asim Aslam e9c2df775a Merge branch 'master' into grpc 2019-06-18 18:51:55 +01:00
Asim Aslam d3a6297b17 Add working grpc proxy config 2019-06-18 18:51:52 +01:00
Asim Aslam 7266c62d09 remove comment 2019-06-18 15:33:31 +01:00
Asim Aslam 6459cdfc21 propagate updates to local watchers 2019-06-18 14:42:56 +01:00
Asim Aslam ed54384bf4 Update network 2019-06-18 11:56:11 +01:00
Asim Aslam 51560009d2 go fmt 2019-06-18 11:04:36 +01:00
Asim Aslam cf2f8a9a55 Merge branch 'master' of ssh://github.com/micro/go-micro 2019-06-18 11:04:16 +01:00
Asim Aslam 97cf2cd7c3 go fmt 2019-06-18 11:04:06 +01:00
Asim Aslam d9fe8f802b Merge pull request #522 from xpunch/grpcMessageIssue
grpc message should be able to set
2019-06-18 10:45:11 +01:00
johnson b754c33549 grpc message should be able to set 2019-06-18 17:07:31 +08:00
Asim Aslam 59eaa89bac Node is a network 2019-06-17 21:11:39 +01:00
Asim Aslam f65694670e add cruft 2019-06-17 20:05:58 +01:00
Asim Aslam 1a571b8c82 Add network transport 2019-06-17 18:25:42 +01:00
Asim Aslam 308673b393 add network package 2019-06-17 16:57:53 +01:00
Asim Aslam 3a454d870a Merge pull request #520 from xpunch/grpcSubscriberIssues
grpc server subscriber missing some bug fixings
2019-06-17 11:57:37 +01:00
johnson baaa386e27 a. add default context type when header not found
b. return subscribe error after handler finished
2019-06-17 17:54:37 +08:00
Asim Aslam a619321b64 Merge pull request #519 from xpunch/master
missing nil check for grpc WaitGroup
2019-06-17 10:30:28 +01:00
johnson 363fb551af missing nil check for grpc WaitGroup 2019-06-17 17:07:55 +08:00
Asim Aslam 7a87ae0efa Merge pull request #514 from unistack-org/cleanup
remove mock data from memory registry
2019-06-13 07:50:08 +01:00
Vasiliy Tolstov ab692ff590 remove mock data from memory registry
memory registry can be used as fast inprocess registry,
so mock data needs to be in tests only

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2019-06-13 00:51:56 +03:00
Asim Aslam 2b18b11ab1 Merge pull request #513 from micro/crufting
Crufting
2019-06-12 13:03:17 +01:00
Asim Aslam af096951fc update import names for mucp 2019-06-12 12:54:45 +01:00
Asim Aslam 97967cbe14 move options under config 2019-06-12 12:45:42 +01:00
Asim Aslam a6e09c9249 Merge branch 'master' into crufting 2019-06-12 12:29:57 +01:00
Asim Aslam 000e25a4b2 use the router 2019-06-12 12:05:34 +01:00
Asim Aslam 7a1cef46b0 fix broken links 2019-06-12 07:50:04 +01:00
Asim Aslam a5412dd4a0 Move data to store 2019-06-12 07:46:20 +01:00
Asim Aslam f81f66c98b Move DB to Map 2019-06-11 18:21:33 +01:00
Asim Aslam 43ed8f58f0 change wording 2019-06-11 18:15:18 +01:00
Asim Aslam 7727b359c8 Add memory data store 2019-06-11 17:49:34 +01:00
Asim Aslam 8e4e710e15 Move data to top level 2019-06-11 17:20:52 +01:00
Asim Aslam 4d4686d9be Merge branch 'master' into crufting 2019-06-11 15:38:12 +01:00
Asim Aslam 6d06ee8078 Update go.mod to strip etcd 2019-06-11 11:40:37 +01:00
Asim Aslam aec1ca6635 remove etcd source 2019-06-11 09:53:06 +01:00
Asim Aslam 235a653f78 check in cruft 2019-06-11 09:52:35 +01:00
Asim Aslam d030c78d1c Merge pull request #509 from outshow/master
fix etcd error
2019-06-11 09:52:21 +01:00
outshow 90a9df9b8c 1. use github.com/coreos instead of go.etcd.io in etcd related import path; 2. add dialtimeout to etcd client 2019-06-11 16:18:37 +08:00
Asim Aslam 070bd40b4c Merge branch 'master' into crufting 2019-06-10 12:44:27 +01:00
Asim Aslam 46de3ae9a9 Fix text codec 2019-06-10 12:42:43 +01:00
Asim Aslam b6833e478d Merge pull request #506 from milosgajdos83/consul-close-watcher
Return registry.ErrWatcherStopped when consul watcher stops
2019-06-09 16:03:06 +01:00
Milos Gajdos 73b0a0ed0e Return registry.ErrWatcherStopped when consul watcher stops.
The original code returns "result chan closed" errors.Error which does
not carry higher semantics signal to downstream despite go-micro having
a clearly defined Error for this behaviour. This commit fixes that and
lets the downstream i.e. consumer of this code to act based on different
errors.
2019-06-09 15:51:27 +01:00
Asim Aslam 7c4515d748 Merge pull request #504 from magodo/json_pb_support
unmarshal json with `jsonpb` if accepter is pb
2019-06-09 08:57:55 +01:00
magodo 748c20c979 use package level func for unmarshal 2019-06-09 11:55:36 +08:00
magodo 3573ac818f unmarshal json with jsonpb if accepter is pb 2019-06-09 11:50:50 +08:00
Asim Aslam ed4bce3285 check in this cruft 2019-06-08 19:40:44 +01:00
Asim Aslam 95b8147fa1 Merge pull request #501 from micro/wrap
add the wrappers back into the core router
2019-06-07 15:22:16 +01:00
Asim Aslam f5ac238231 Include the decoded body 2019-06-07 15:15:22 +01:00
Asim Aslam bfdec9e2e3 add the wrappers back into the core router 2019-06-07 15:02:19 +01:00
Asim Aslam a2fbf19341 Move sync deps, change uuid to google and update go.mod 2019-06-07 13:53:42 +01:00
Asim Aslam 9e23855c37 Fixup the proxy, strip down go.mod. Win bigly 2019-06-07 13:42:39 +01:00
Asim Aslam d65393a799 add top level options comment 2019-06-07 11:18:08 +01:00
Asim Aslam ef67dc7ceb Merge pull request #500 from leaxoy/clean-mod
cleanup go.mod remove replace section
2019-06-07 11:14:53 +01:00
Asim Aslam c317daf6b8 update proxy/options 2019-06-06 21:45:28 +01:00
lixiaohui 1152c7cb03 cleanup go.mod remove replace section 2019-06-07 03:05:33 +08:00
Asim Aslam 2cc18d6edc fix errors 2019-06-06 17:58:21 +01:00
Asim Aslam a58bc8e75c add proxy interface and move router packages 2019-06-06 17:55:32 +01:00
Asim Aslam 64459c54a1 move init to options 2019-06-06 17:54:30 +01:00
Asim Aslam c60b5a45bb Add proxy interface 2019-06-06 17:49:41 +01:00
Asim Aslam 94772a8cc7 remove the proto from proxy package 2019-06-06 17:38:05 +01:00
Asim Aslam 52613190b0 remove micro.png 2019-06-06 17:08:04 +01:00
Milos Gajdos a29ce20e31 Changed default NATS address to nats://127.0.0.1:4222 in nats test 2019-06-06 12:06:14 +01:00
Asim Aslam d59b693fa6 update interface 2019-06-06 11:46:13 +01:00
Asim Aslam deee4dcd6a Merge branch 'master' of ssh://github.com/micro/go-micro 2019-06-06 11:32:42 +01:00
Asim Aslam ab7d036697 add init package 2019-06-06 11:32:38 +01:00
Milos Gajdos de87dfb6a0 Added gitignore file to avoid committing unnecessary files 2019-06-06 10:56:20 +01:00
Asim Aslam 0f70281e28 remove swp file 2019-06-06 09:52:22 +01:00
Asim Aslam 9d5cde42a3 Add top level proxy comment 2019-06-06 09:50:25 +01:00
Asim Aslam 83f46d9c9d top level package comment for service 2019-06-06 09:02:00 +01:00
Asim Aslam 19de02646e Merge pull request #497 from unistack-org/logf
server fix log.Log -> log.Logf
2019-06-05 14:33:51 +01:00
Vasiliy Tolstov 695c546385 server fix log.Log -> log.Logf
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2019-06-05 15:09:26 +03:00
Asim Aslam 953f41aeab Fix go mod issues 2019-06-05 10:22:28 +01:00
Asim Aslam 512d719470 fix imports 2019-06-05 06:39:56 +01:00
Asim Aslam 319608ca7f update readme 2019-06-03 19:32:31 +01:00
Asim Aslam d2857a7b16 Add web and update deps 2019-06-03 19:30:43 +01:00
Asim Aslam 49f669df66 update grpc readme 2019-06-03 19:16:43 +01:00
Asim Aslam 1cd844bea4 update go mod 2019-06-03 19:07:21 +01:00
Asim Aslam 44b17b7e4b strip use of cmd 2019-06-03 19:07:09 +01:00
Asim Aslam 056e7e3c32 Merge pull request #486 from micro/quic
add quic transport
2019-06-03 18:50:55 +01:00
Asim Aslam eec9a95a42 Merge pull request #485 from micro/grpc
Add grpc transport
2019-06-03 18:48:13 +01:00
Asim Aslam b30fcd6a0f remove travis files 2019-06-03 18:45:37 +01:00
Asim Aslam b42b6fa0fc Further consolidate the libraries 2019-06-03 18:44:43 +01:00
Asim Aslam fe060b2d0b gofmt 2019-06-03 15:56:22 +01:00
Asim Aslam d864c98aca Merge branch 'master' of ssh://github.com/micro/go-micro 2019-06-03 15:55:54 +01:00
Asim Aslam f80f0eb38e fix broken pipe error 2019-06-03 15:55:47 +01:00
Asim Aslam e73ed88008 Merge pull request #492 from ZichooleLongGui/patch-1
Update marshaler.go of codec/proto.
2019-06-01 10:26:27 +01:00
Zich Liew 1948e8a0d7 Update marshaler.go
Modify "Name()" to "String()" of proto.Marshaler
2019-06-01 16:14:06 +08:00
Asim Aslam 850f8bafdf update go.mod 2019-05-31 16:19:38 +01:00
Asim Aslam fcf11011b8 remove rcache 2019-05-31 16:19:31 +01:00
Asim Aslam 2aba26d4d1 change logger 2019-05-31 16:03:50 +01:00
Asim Aslam 7a3a7e2eaf remove rcache reference 2019-05-31 16:00:44 +01:00
Asim Aslam f9f893fa85 update source 2019-05-31 15:59:21 +01:00
Asim Aslam 30627c32c9 the garbage commit of go.mod vault deps 2019-05-31 15:24:15 +01:00
Asim Aslam fd9021ad6a update go.mod 2019-05-31 15:07:27 +01:00
Asim Aslam 1374c5b14a update syntax 2019-05-31 13:45:28 +01:00
Asim Aslam 082d0b9f05 add memory config source options for json/yaml 2019-05-31 13:44:28 +01:00
Asim Aslam ca769444e7 set localhost for nats 2019-05-31 13:18:22 +01:00
Asim Aslam aeeb2b0010 Merge pull request #489 from micro/nats
Add nats broker as a default
2019-05-31 13:12:38 +01:00
Asim Aslam 7e07c9bc23 Merge pull request #490 from micro/stdlib
The move to a standard library for microservices
2019-05-31 13:11:32 +01:00
Asim Aslam d5f6f82d5c update travis 2019-05-31 13:05:03 +01:00
Asim Aslam 508d181f60 update go.mod 2019-05-31 12:38:55 +01:00
Asim Aslam ef9c223ac8 add vault/etcd 2019-05-31 12:38:49 +01:00
Asim Aslam f8c880c39e Merge branch 'master' of ssh://github.com/micro/go-micro into stdlib 2019-05-31 12:36:05 +01:00
Asim Aslam 0f47569714 update go.mod 2019-05-31 12:35:43 +01:00
Asim Aslam e41a461c8b update agent readme 2019-05-31 12:10:41 +01:00
Asim Aslam 02d580600d remove debug for now 2019-05-31 11:52:43 +01:00
Asim Aslam 66e02d4ab8 Merge pull request #491 from lpxxn/master
loop goroutines need pass the variable as a parameter to the anonymous function
2019-05-31 10:33:44 +01:00
lpxxn a86c26d485 fix bug need pass the variable as a parameter to the anonymous function 2019-05-31 14:24:37 +08:00
李鹏 9a1115001c Merge pull request #2 from micro/master
update
2019-05-31 14:16:22 +08:00
Asim Aslam f2139e2a16 Add debug => go-debug 2019-05-31 01:22:19 +01:00
Asim Aslam 95d134b57e Add sync => go-sync 2019-05-31 00:43:23 +01:00
Asim Aslam 4035ab5c7b Change go-log links 2019-05-31 00:38:05 +01:00
Asim Aslam 5595a8e0e4 Add log => go-log 2019-05-31 00:35:04 +01:00
Asim Aslam c90d0eff0a update links 2019-05-31 00:27:41 +01:00
Asim Aslam c567d1ceb3 Add runtime => run 2019-05-31 00:26:34 +01:00
Asim Aslam a353c83f47 Add rcache => cache 2019-05-31 00:22:43 +01:00
Asim Aslam ddd08377e6 remove travis file from agent 2019-05-31 00:19:05 +01:00
Asim Aslam 7faab93f9e Add agent => bot 2019-05-31 00:18:41 +01:00
Asim Aslam b4874806df Add util 2019-05-30 23:52:10 +01:00
Asim Aslam 8618183508 bump go.mod 2019-05-30 23:20:20 +01:00
Asim Aslam 5e6491b7b0 add config 2019-05-30 23:11:13 +01:00
Asim Aslam 1200386097 Add nats broker as a default 2019-05-29 16:46:57 +01:00
Asim Aslam b4dc822ae3 Change context key to string 2019-05-29 10:58:41 +01:00
Asim Aslam 9f037eafd2 fix waitgroup bug which crashes subscriber 2019-05-29 09:28:04 +01:00
Asim Aslam 58a70562d8 Merge pull request #488 from magodo/wait_accept_custom_wg
`Wait()` option now accept *sync.WaitGroup
2019-05-27 15:02:09 +01:00
magodo ebc479ef2c Wait() option now accept *sync.WaitGroup
The original signature accept a boolean, and it feel like a little
verbose, since when people pass in this option, he/she always want to
pass a `true`.

Now if input `wg` is nil, it has same effect as passing `true` in
original code. Furthermore, if user want's finer grained control during
shutdown, one can pass in a predefined `wg`, so that server will wait
against it during shutdown.
2019-05-27 21:17:57 +08:00
Asim Aslam e035664a8c Merge pull request #487 from lpxxn/master
fix streamming error io.ErrUnexpectedEOF
2019-05-27 09:29:48 +01:00
lpxxn 7da6ff1c4b fix:# #476 need send error info 2019-05-27 13:14:31 +08:00
李鹏 de270314d9 Merge pull request #1 from micro/master
update
2019-05-27 13:09:34 +08:00
Asim Aslam ff1c325391 remove commented lines 2019-05-24 18:44:57 +01:00
Asim Aslam e1578e93c7 add quic transport 2019-05-24 18:39:26 +01:00
Asim Aslam 25a0d05ac9 Add grpc transport 2019-05-24 17:15:59 +01:00
Asim Aslam b926ae81bb Merge branch 'master' of ssh://github.com/micro/go-micro 2019-05-24 17:07:32 +01:00
Asim Aslam f5d37d92af set nextprotos 2019-05-24 17:05:31 +01:00
Asim Aslam e7eb74bf09 Merge pull request #484 from printfcoder/master
add AutoAck support for Server
2019-05-24 15:13:06 +01:00
shu xian fac42bc1a9 add AutoAck support for Server 2019-05-24 20:06:27 +08:00
Asim Aslam 0a3df1b2f3 Update README.md 2019-05-23 00:35:02 +01:00
Asim Aslam 6de3d9eb24 Update go mod 2019-05-22 16:11:06 +00:00
Asim Aslam 0016752fc1 accept publisher options 2019-05-21 07:49:30 +00:00
Asim Aslam 92ab814138 remove sponsors 2019-05-19 15:38:49 +00:00
Asim Aslam dc5ec0cdb2 Merge pull request #478 from sneat/fix-watcher-across-datacenters
Use existing consul client for watcher
2019-05-16 08:12:40 +01:00
Blair McMillan 389d141c5a Use existing consul client for watcher 2019-05-16 12:37:48 +10:00
Asim Aslam 3dfe7d8703 Merge pull request #473 from unistack-org/health
add RegisterCheck server option for internal health checks
2019-05-15 15:11:27 +01:00
Vasiliy Tolstov a13cdfcc34 add RegisterCheck server option for internal health checks
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2019-05-15 15:34:34 +03:00
Asim Aslam 4f5ff076d4 Merge pull request #472 from unistack-org/gossip2
fix race with rcache
2019-05-09 21:24:27 +01:00
Vasiliy Tolstov 58775249c5 fix race with rcache
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2019-05-09 23:02:32 +03:00
Asim Aslam 8d21dd456c Merge pull request #471 from unistack-org/gossip
fix data races in gossip registry
2019-05-09 20:37:04 +01:00
Vasiliy Tolstov 1a151a3348 fix data races in gossip registry
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2019-05-09 22:32:21 +03:00
Asim Aslam dc2e150a58 Merge pull request #466 from Ak-Army/master
send requestBody to mock function if it can handle it
2019-05-07 14:16:04 +01:00
Hunyadvári Péter aaf4a5c51a rename reqBody variable to request 2019-05-02 18:06:43 +02:00
Hunyadvári Péter 08d70c9d0a fix and add tests 2019-05-02 18:02:24 +02:00
Hunyadvári Péter c1c0a8fb30 send requestBody to mock function if it can handle it 2019-05-02 17:14:41 +02:00
Asim Aslam e4704a8f41 Merge pull request #461 from moorepatrick/patch-1
Update consul/watch import
2019-04-26 19:22:33 +01:00
Patrick Moore afd1f9f50f Update consul/watch import
The watch package was moved from github.com/hashicorp/consul/watch to github.com/hashicorp/consul/api/watch to live in the API module.
Per: https://github.com/hashicorp/consul/commit/6c885d383a7f303cc6c625108d3e7fc1a35d715d
2019-04-26 10:40:10 -07:00
Asim Aslam 46f44fd8f8 update go mod 2019-04-23 07:15:03 +00:00
Asim Aslam df6561165a gofmt 2019-04-23 07:13:21 +00:00
Asim Aslam 96ed20de7b Merge pull request #458 from leaxoy/master
cleanup deps
2019-04-22 15:02:04 +01:00
lixiaohui c43d7137cf cleanup deps 2019-04-22 21:39:02 +08:00
Asim Aslam a97a1009ae Merge pull request #455 from tongjichao/fix/client_retries
fix: client retries will be 0 when not set
2019-04-18 18:16:53 +01:00
tongjichao fd2ca3a13a fix: client retries will be 0 when not set
fix: client retries will be 0 when not set
2019-04-19 00:05:02 +08:00
Asim Aslam f824ba0779 non-blocking call chan when retries are 0 2019-04-18 09:05:22 +00:00
Asim Aslam 722a3682c8 Update go mod 2019-03-28 17:01:56 +00:00
Asim Aslam ca77773fbf fix json tag parsing 2019-03-19 00:21:25 +00:00
Asim Aslam dbe83c0fff bump travis 2019-03-07 20:29:40 +00:00
Asim Aslam 98108d6297 Update README.md 2019-03-05 13:13:56 +00:00
Asim Aslam 2a70aef658 Merge pull request #429 from printfcoder/master
add Chinese version guide
2019-03-03 13:46:12 +00:00
shuxian 598de823ba add Chinese version guide 2019-03-03 21:36:44 +08:00
shuxian 6802de63ff readme zh-cn version 2019-02-28 16:57:31 +08:00
Asim Aslam 99c80d0878 Merge pull request #426 from printfcoder/master
solve consul.NewRegistry httpclient 'nil pointer dereference' bug
2019-02-28 07:10:23 +00:00
shuxian d3f447a732 solve NewRegistry httpclient 'nil pointer dereference' bug 2019-02-28 09:56:57 +08:00
Asim Aslam b8f20924cc proxy publish 2019-02-23 17:06:17 +00:00
Asim Aslam f1df0f6dfe update go modules 2019-02-23 16:29:15 +00:00
Asim Aslam 58adaef339 Add Exchange option 2019-02-23 10:50:53 +00:00
Asim Aslam 7db2912d90 add more verbose output 2019-02-15 17:20:09 +00:00
Asim Aslam 6819989195 change default name/version 2019-02-15 16:14:41 +00:00
Asim Aslam b63213a225 Merge pull request #420 from unistack-org/race_transport
fix race in http transport
2019-02-15 15:58:49 +00:00
Vasiliy Tolstov 0a8f9b0a62 fix race in http transport
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2019-02-15 17:20:00 +03:00
Asim Aslam e29ca94a93 Update go modules 2019-02-13 14:41:01 +00:00
Asim Aslam f4be7d018d delete context file 2019-02-13 14:39:38 +00:00
Asim Aslam 7cb466359f rework gossip registry 2019-02-13 14:39:20 +00:00
Asim Aslam c3722877c1 Merge pull request #417 from unistack-org/gossip
registry: [gossip] fix panic
2019-02-13 13:41:28 +00:00
Vasiliy Tolstov f961c571bd registry: [gossip] fix panic
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x88 pc=0xd1b215]

goroutine 8 [running]:
sync.(*RWMutex).RLock(...)
        /var/home/vtolstov/sdk/go1.12beta2/src/sync/rwmutex.go:48
github.com/hashicorp/memberlist.(*Memberlist).LocalNode(0x0, 0x0)
        /home/vtolstov/devel/projects/centralv2/vendor/github.com/hashicorp/memberlist/memberlist.go:417 +0x35
github.com/micro/go-micro/registry/gossip.(*gossipRegistry).run.func3(0xc000155880)
        /home/vtolstov/devel/projects/centralv2/vendor/github.com/micro/go-micro/registry/gossip/gossip.go:565 +0xf5
created by github.com/micro/go-micro/registry/gossip.(*gossipRegistry).run
        /home/vtolstov/devel/projects/centralv2/vendor/github.com/micro/go-micro/registry/gossip/gossip.go:553 +0xa25

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2019-02-13 16:36:38 +03:00
Asim Aslam d2fdbcc742 Update go modules 2019-02-13 13:32:55 +00:00
Asim Aslam 0cdae40f04 Merge pull request #416 from jiyeyuran/patch-4
reuse rcache
2019-02-13 09:58:49 +00:00
xinfei.wu a56929d1b8 reuse rcache 2019-02-13 17:47:31 +08:00
Asim Aslam c9bcdc8438 Merge pull request #415 from unistack-org/rejoin
registry: gossip add Reconnect and Timeout
2019-02-12 14:37:45 +00:00
Vasiliy Tolstov 36532c94b2 registry: [gossip] add ConnectRetry and ConnectTimeout
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2019-02-12 17:16:35 +03:00
Asim Aslam 3580cd1b1e no sponsors 2019-02-11 18:37:40 +00:00
Asim Aslam a3ecd36763 add ability to set address 2019-02-11 18:37:25 +00:00
Asim Aslam 78b7ee9078 update readme 2019-02-09 12:25:34 +00:00
Asim Aslam 82bcb8748e update go modules 2019-02-07 12:42:45 +00:00
Asim Aslam 31fc8df2ba add server request body 2019-02-04 13:13:03 +00:00
Asim Aslam baf7de76bf Merge branch 'master' of github.com:micro/go-micro 2019-02-04 10:29:26 +00:00
Asim Aslam 31b6cad47b make copy before writing 2019-02-04 10:29:10 +00:00
Asim Aslam 686171c26d Merge pull request #413 from qkzsky/qkzsky-rpc-fix
client close: rpc: unable to write error response
2019-02-03 13:13:10 +00:00
kuangzhiqiang 6be205fd40 client close: rpc: unable to write error response
when client close notice: "rpc: unable to write error response..."
2019-02-03 19:12:13 +08:00
Asim Aslam 89014160fc Merge pull request #411 from unistack-org/gossip
registry: gossip unify registry option passing, optimize
2019-02-01 22:21:08 +00:00
Vasiliy Tolstov 422e2002a0 registry: gossip unify registry option passing, optimize
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2019-02-02 01:12:39 +03:00
Asim Aslam cead99ac44 fix nil pointer 2019-02-01 16:01:51 +00:00
Asim Aslam c03d935ffd fallback for 0.14.0 and older 2019-02-01 15:57:34 +00:00
Asim Aslam 88e12347d0 update mdns to remove race condition 2019-02-01 13:41:11 +00:00
Asim Aslam 652b1067f5 fix data race 2019-02-01 09:05:03 +00:00
Asim Aslam 7888d3e13d use official h2c server 2019-01-31 17:14:36 +00:00
Asim Aslam b1a31134bd Support micro proxy 2019-01-30 18:42:11 +00:00
Asim Aslam 107b571019 Add go mod 2019-01-30 11:43:40 +00:00
Asim Aslam 89c8e1f4a7 update readme 2019-01-29 09:20:34 +00:00
Asim Aslam a06cd72337 update image 2019-01-29 09:08:14 +00:00
Asim Aslam e22fa01935 fix ticker 2019-01-24 16:08:04 +00:00
Asim Aslam a5015692e3 Merge pull request #400 from micro/interval
Move RegisterInterval into the server
2019-01-24 13:55:05 +00:00
Asim Aslam 539b8c1a3b Move RegisterInterval into the server 2019-01-24 13:22:17 +00:00
Asim Aslam 67a738b504 Merge pull request #399 from unistack-org/master
add context to SubscriberOptions
2019-01-24 13:11:33 +00:00
Vasiliy Tolstov ac1afea7fc add context to server.SubscriberOptions and broker.SubscribeOption
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2019-01-24 15:36:01 +03:00
Asim Aslam 8090f9968d Update headers to remove X- prefix 2019-01-24 10:11:02 +00:00
Asim Aslam 7542aafd29 Update package comment 2019-01-23 18:15:17 +00:00
Asim Aslam 13de868b21 Rename 2019-01-23 18:14:36 +00:00
Asim Aslam d090a97a3d Merge pull request #396 from micro/error
Fix #394 invalid error handling in rpc_router ServeRequest
2019-01-22 14:28:41 +00:00
Asim Aslam 8a0d5f0489 log if we can't even respond 2019-01-22 13:55:04 +00:00
Asim Aslam 2ed676acf4 handle errors differently 2019-01-22 13:52:18 +00:00
Asim Aslam d8ba18deff change logging 2019-01-22 12:18:33 +00:00
Asim Aslam 1321782785 in case of reload return nil 2019-01-19 10:20:16 +00:00
Asim Aslam 48b80dd051 replace memory registry 2019-01-18 17:29:17 +00:00
Asim Aslam 943219f203 Merge pull request #393 from micro/legacy
Evolution of Codecs and Methods
2019-01-18 12:40:05 +00:00
Asim Aslam 6468733d98 Use protocol from node metadata 2019-01-18 12:30:39 +00:00
Asim Aslam 9bd32645be Account for old target 2019-01-18 10:43:41 +00:00
Asim Aslam f41be53ff8 Add ability to process legacy requests 2019-01-18 10:23:36 +00:00
Asim Aslam 2cd2258731 For the legacy 2019-01-18 10:12:57 +00:00
Asim Aslam 9ce9977d21 Don't read unless we have b 2019-01-17 12:09:04 +00:00
Asim Aslam 617db003d4 Copy metadata 2019-01-17 09:40:49 +00:00
Asim Aslam 7b89b36e37 add benchmarks 2019-01-16 18:54:43 +00:00
Asim Aslam e2e426b90c Increase default pool size 2019-01-16 18:54:32 +00:00
Asim Aslam 5b95ce7f26 Silence broker during tests 2019-01-16 18:54:04 +00:00
Asim Aslam 082f57fcad We can just check nil vals 2019-01-16 15:42:42 +00:00
Asim Aslam cc5629fb6b Don't return zero length services 2019-01-16 15:41:37 +00:00
Asim Aslam 784a89b488 Allow bytes.Frame to be set to sent just bytes 2019-01-16 15:27:57 +00:00
Asim Aslam a9c0b95603 update readme 2019-01-16 13:12:21 +00:00
Asim Aslam 7bd0bd14c8 Merge pull request #386 from micro/mdns
Set MDNS as default registry
2019-01-15 16:59:07 +00:00
Asim Aslam 7314af347b Set MDNS as default registry 2019-01-15 16:50:37 +00:00
Asim Aslam 00661f8a99 Clarify log message 2019-01-15 15:17:30 +00:00
Asim Aslam e362466e8a use default router 2019-01-14 21:45:43 +00:00
Asim Aslam c1d0237370 Add client response 2019-01-14 21:30:43 +00:00
Asim Aslam f2ac73eae5 only log error if its plus 3 2019-01-14 16:09:51 +00:00
Asim Aslam 39c24baca9 rename mock things to memory 2019-01-14 15:27:25 +00:00
Asim Aslam c17d0fcc0f grpc request 2019-01-13 19:54:07 +00:00
Asim Aslam e1bc240a14 Respond with error type 2019-01-13 12:15:35 +00:00
Asim Aslam 01f6683035 Add router option 2019-01-13 12:15:13 +00:00
Asim Aslam bfd341a269 Execute wrappers before router 2019-01-11 15:49:54 +00:00
Asim Aslam 9897c630ae remove request/response 2019-01-11 14:04:37 +00:00
Asim Aslam 36788487a7 set headers as appropriate 2019-01-11 13:44:47 +00:00
Asim Aslam 3043841cf5 Don't process nil 2019-01-10 22:14:32 +00:00
Asim Aslam 04103fe048 Merge pull request #379 from micro/endpoint
Rename method to endpoint
2019-01-10 22:12:28 +00:00
Asim Aslam 9adebfcf1e rename method to endpoint 2019-01-10 21:25:31 +00:00
Asim Aslam f853f88bcd gofmt 2019-01-10 20:35:20 +00:00
Asim Aslam 40ff5b749b Set topic header 2019-01-10 20:35:10 +00:00
Asim Aslam 59d82b0abe Add response 2019-01-10 11:43:36 +00:00
Asim Aslam 648da5494f Change a few things 2019-01-10 11:39:39 +00:00
Asim Aslam bb31480f1a downgrade code generated stuff 2019-01-10 10:57:04 +00:00
Asim Aslam c086c33bb3 remove codecs 2019-01-10 09:42:02 +00:00
Asim Aslam 6e0e4a684c Further crufting 2019-01-09 19:28:13 +00:00
Asim Aslam 873fc6d663 rewriting a lot 2019-01-09 19:11:47 +00:00
Asim Aslam 1561ccbc14 remove clientCodec 2019-01-09 17:33:28 +00:00
Asim Aslam d004c9624b Add router modifications 2019-01-09 16:20:57 +00:00
Asim Aslam ee380c6b7a reorder 2019-01-09 09:06:30 +00:00
Asim Aslam 7a1f735825 remove server codec 2019-01-09 09:02:30 +00:00
Asim Aslam 69119cc622 Merge pull request #376 from jiyeyuran/patch-3
add locker
2019-01-09 08:42:08 +00:00
xinfei.wu eec1726f1d add package comment 2019-01-09 16:31:23 +08:00
xinfei.wu 453ce2fcbe add locker 2019-01-09 14:24:12 +08:00
Asim Aslam d5df31eeb8 Merge pull request #375 from micro/codec
further codec changes
2019-01-08 21:04:22 +00:00
Asim Aslam f46828be33 Add Router interface 2019-01-08 20:32:47 +00:00
Asim Aslam 4cb41721f1 further codec changes 2019-01-08 15:38:25 +00:00
Asim Aslam 216dbb771a rename requestHeader 2019-01-07 18:25:31 +00:00
Asim Aslam c9963cb870 rename 2019-01-07 18:20:47 +00:00
Asim Aslam e8b431c5ff rename codec interface 2019-01-07 18:17:13 +00:00
Asim Aslam 9544058af3 Merge pull request #372 from micro/codec
Switch default codec and add default codec for server
2019-01-07 17:54:28 +00:00
Asim Aslam c717af21ac Some router changes 2019-01-07 17:17:06 +00:00
Asim Aslam 46ece968d4 rename service to router 2019-01-07 14:44:40 +00:00
Asim Aslam fcc730931c Merge pull request #371 from micro/dns
Add dns selector
2019-01-07 13:56:24 +00:00
Asim Aslam d519180806 Merge branch 'master' into dns 2019-01-07 13:52:37 +00:00
Asim Aslam 78af321790 Merge pull request #367 from micro/static
Add static selector
2019-01-07 13:51:47 +00:00
Asim Aslam d179c971af Switch default codec and add default codec for server 2019-01-07 13:48:38 +00:00
Asim Aslam d6a5ff432c add net.LookupHost for dns 2019-01-07 09:34:07 +00:00
Asim Aslam 5aeb28dfee Add error header 2019-01-07 09:11:36 +00:00
Asim Aslam f9da55e8a9 Add dns selector 2019-01-07 07:41:26 +00:00
Asim Aslam 4692af4393 Add static selector 2019-01-06 21:12:02 +00:00
Asim Aslam 4adc31e62d add bytes codec, still unused 2019-01-04 14:07:16 +00:00
Asim Aslam 461df8d464 Merge pull request #364 from micro/inbox
Add inbox feature to http broker
2019-01-03 11:27:46 +00:00
Asim Aslam 7c2cbe2ad2 better error handling 2019-01-03 11:23:06 +00:00
Asim Aslam abbeb6d068 add inbox feature to http broker 2019-01-02 19:27:46 +00:00
Asim Aslam ce36d0156d Merge pull request #362 from micro/codec
Make json/protobuf/grpc codecs
2019-01-02 18:01:34 +00:00
Asim Aslam 29ef3676b2 Merge pull request #363 from micro/proxy
Add support for http proxy
2019-01-02 15:28:57 +00:00
Asim Aslam 2761b8e0f5 Add support for http proxy 2019-01-02 15:24:17 +00:00
Asim Aslam ed580204a8 Add grpc codec 2019-01-02 12:55:06 +00:00
Asim Aslam 7cf94162b8 remove fmt comment 2019-01-02 12:50:25 +00:00
Asim Aslam e2623d8ef5 Make json/protobuf codecs 2018-12-31 22:01:16 +00:00
Asim Aslam b3b4bc6059 remove Plus 2018-12-31 20:51:22 +00:00
Asim Aslam 386ced576a Process header/body in one call 2018-12-31 17:53:16 +00:00
Asim Aslam dcf7a56f9b rename codec 2018-12-31 17:28:19 +00:00
Asim Aslam 460fb3e70c update package comments 2018-12-29 16:18:05 +00:00
Asim Aslam 5cae330732 Update selector race, rename cache selector 2018-12-29 15:44:51 +00:00
Asim Aslam ff982b5fd1 add method 2018-12-28 21:27:08 +00:00
Asim Aslam 28324412a4 Add X-Micro-Target header 2018-12-26 14:46:15 +00:00
Asim Aslam 5f2ce6fac4 nitpick readme 2018-12-26 12:03:08 +00:00
Asim Aslam 8b54a850f7 run gossip updater first 2018-12-19 19:04:44 +00:00
Asim Aslam fae8c5eb4c fix context 2018-12-19 09:27:53 +00:00
Asim Aslam 3bc6556d36 Merge pull request #353 from unistack-org/gossip
implement some gossip options
2018-12-19 09:27:10 +00:00
Vasiliy Tolstov 5bcdf189de implement some gossip options
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2018-12-19 12:25:16 +03:00
Asim Aslam f2efc685d3 Merge pull request #352 from micro/rwmutex
move to using rwmutex for selector
2018-12-18 18:10:19 +00:00
Asim Aslam 67d10e5f39 simplify get code 2018-12-18 18:06:34 +00:00
Asim Aslam 770c16a66d move to using rwmutex for selector 2018-12-18 16:51:42 +00:00
Asim Aslam c2cc03a472 update readme 2018-12-06 18:46:02 +00:00
Asim Aslam b02e1e04fc Add gossip readme 2018-12-06 18:26:51 +00:00
Asim Aslam cf8c059711 Merge pull request #345 from micro/gossip
Gossip
2018-12-06 18:22:52 +00:00
Asim Aslam b343420af6 update the gossiper 2018-12-06 18:19:05 +00:00
Asim Aslam 1ed2b589a2 log to dev null 2018-12-04 17:33:11 +00:00
Asim Aslam 72d8dc89fb add cmd and bug fix 2018-12-04 17:22:20 +00:00
Asim Aslam 8706aa4a46 Remove file 2018-12-04 16:43:05 +00:00
Asim Aslam 57dcba666e gossip registry 2018-12-04 16:41:40 +00:00
Asim Aslam 489573afb9 Merge pull request #341 from sneat/consul-read-write-map
Prevent read/write map concurrency issue
2018-12-03 06:24:31 +00:00
Blair McMillan a9593bad66 Prevent read/write map concurrency issue 2018-12-03 14:59:31 +10:00
Asim Aslam d0d8db7c45 update 2018-12-02 13:26:38 +00:00
Asim Aslam a07150b6dd update 2018-12-02 13:23:46 +00:00
Asim Aslam 519f091fe8 update 2018-12-02 10:23:19 +00:00
Asim Aslam 9c2689301c add mock package comments 2018-12-01 12:56:21 +00:00
Asim Aslam a1665ab37a Add consul package comment 2018-12-01 12:54:46 +00:00
Asim Aslam 1be0e8776f add wrap call comment 2018-12-01 11:10:37 +00:00
Asim Aslam 92082ac927 NewSubscribeOptions 2018-11-30 17:32:48 +00:00
Asim Aslam c622f3a8d6 Force http2 usage of broker client 2018-11-29 12:10:33 +00:00
Asim Aslam f1817c9c6b Add image to readme 2018-11-29 09:02:15 +00:00
Asim Aslam 16e97cce9b update readme 2018-11-27 19:46:00 +00:00
Asim Aslam bc404c9a82 update readme 2018-11-27 19:43:57 +00:00
Asim Aslam 29bb63b717 add mdns package comment 2018-11-26 16:13:17 +00:00
Asim Aslam 0d917bbf37 move location of handler 2018-11-26 14:51:42 +00:00
Asim Aslam 45c05c4e2b Add timeout error 2018-11-25 09:41:28 +00:00
Asim Aslam 77b1a25faf Merge branch 'master' of github.com:micro/go-micro 2018-11-23 20:06:13 +00:00
Asim Aslam 34ed5235a3 rename rpc codec 2018-11-23 20:05:31 +00:00
Asim Aslam 5996a91dde Merge pull request #335 from sneat/consul-options
Add ability to specify Consul options
2018-11-23 08:42:23 +00:00
Blair McMillan 7171c00e42 Add ability to specify Consul options and default to AllowStale for all gets 2018-11-23 17:11:37 +10:00
Asim Aslam 4dc593eca3 Merge branch 'master' of github.com:micro/go-micro 2018-11-22 10:40:33 +00:00
Asim Aslam f1984650f4 use the request header 2018-11-22 10:39:36 +00:00
Asim Aslam 33ae45ad65 Merge pull request #333 from sneat/tcpcheck-interval
Only check if the service is in Consul once every deregister interval
2018-11-22 08:38:11 +00:00
Blair McMillan e3a2fe52cd Only check if the service is in Consul once every deregister interval 2018-11-22 13:34:08 +10:00
Asim Aslam 5fd7da9de7 update readme 2018-11-21 13:10:09 +00:00
Asim Aslam edc8a8b771 nitpick 2018-11-21 11:15:34 +00:00
Asim Aslam 1ce0df4e63 Merge pull request #331 from shuLhan/master
all: replace "pborman/uuid" with "google/uuid"
2018-11-21 10:48:36 +00:00
Shulhan 415fb3a730 all: replace "pborman/uuid" with "google/uuid"
Internally, "pborman/uuid.NewUUID()" is calling "google/uuid.New()"
that return nil when there is an error [1].

Both package use the same license.

[1] https://github.com/pborman/uuid/blob/master/version1.go#L17
2018-11-21 17:29:21 +07:00
Asim Aslam 172ffee8c3 add rpc package comments 2018-11-20 10:30:53 +00:00
Asim Aslam 48c068d88d add codec package comments 2018-11-20 10:06:13 +00:00
Asim Aslam 3f7152a4f5 update doc link 2018-11-19 12:30:23 +00:00
Asim Aslam 54f58a15d3 update readme 2018-11-19 12:29:26 +00:00
Asim Aslam bcb6c12aa1 Merge pull request #329 from micro/http
add http handler option for broker
2018-11-18 20:44:16 +00:00
Asim Aslam 1cb40831a4 add http handler option for broker 2018-11-18 20:40:43 +00:00
Asim Aslam d9fc2c922d update package comment 2018-11-18 18:38:46 +00:00
Asim Aslam 212c6c5ae9 Merge pull request #328 from micro/http
add option to set http handlers
2018-11-18 18:32:01 +00:00
Asim Aslam 1d8047a272 add option to set http handlers 2018-11-18 16:32:53 +00:00
Asim Aslam 98bb4a69c2 Merge pull request #325 from micro/accept_loop
make accept loop
2018-11-15 21:23:16 +00:00
Asim Aslam e69413b763 add continue 2018-11-15 21:13:33 +00:00
Asim Aslam 45f18042b7 make accept loop 2018-11-15 19:55:13 +00:00
Asim Aslam 0672b051cc Add Local/Remote ip to metadata 2018-11-14 20:27:58 +00:00
Asim Aslam 3c496720cc Merge pull request #324 from micro/ip
Ip
2018-11-14 20:15:56 +00:00
Asim Aslam 881cb570d5 reorder 2018-11-14 19:49:04 +00:00
Asim Aslam c6a2c8de6c add local/remote to testsocket 2018-11-14 19:45:46 +00:00
Asim Aslam 71bacf6991 add local/remote ip to socket 2018-11-14 19:41:13 +00:00
Asim Aslam a0b257b572 remove line 2018-11-14 15:19:23 +00:00
Asim Aslam a082c151f0 remove example section 2018-11-14 15:18:47 +00:00
Asim Aslam 302ab42a97 strip down readme 2018-11-14 15:18:13 +00:00
Asim Aslam 531d4dd24a Merge pull request #322 from mgrachev/fix-linter-issues
Fix some linter issues
2018-11-13 09:38:19 +00:00
Asim Aslam 1c401a852e Merge pull request #321 from mgrachev/errors-check
Add errors check
2018-11-13 09:36:54 +00:00
Mikhail Grachev 25e6dcc9b6 Fix some linter issues 2018-11-13 11:57:42 +03:00
Mikhail Grachev 4006d9f102 Add errors check 2018-11-13 11:56:21 +03:00
Asim Aslam 4c821baab4 go fmt 2018-11-03 12:17:11 +00:00
Asim Aslam c8a35afc92 Merge pull request #313 from lovelly/master
Fix tcp check no ttl error
2018-11-03 12:16:56 +00:00
Asim Aslam 54f67db275 Merge pull request #289 from micro/http2
http2 support
2018-11-03 12:07:23 +00:00
lovelly fd04722706 Fix tcp check no ttl error 2018-10-09 10:40:24 +08:00
Asim Aslam 4cee1f19f6 Merge pull request #309 from fireyang/master
fix rpc client call WARNING: DATA RACE
2018-09-20 07:39:45 +01:00
fireyang ef8b5e28b0 fix rpc client call WARNING: DATA RACE 2018-09-20 10:08:00 +08:00
Asim Aslam 818f150b25 Merge pull request #308 from fireyang/master
fix bug: loop variable i captured by func literal
2018-09-19 15:13:19 +01:00
fireyang 446d3fc72e fix bug: loop variable i captured by func literal 2018-09-19 21:58:20 +08:00
Asim Aslam 240052246f Merge pull request #306 from DexterHD/fix-go-config-panic
fix bug with go-config panic
2018-09-13 19:26:57 +01:00
Anton Kucherov 156a51ab10 fix bug with go-config panic
See: https://github.com/micro/go-config/issues/49
2018-09-13 19:02:08 +03:00
Asim Aslam 52a4beb072 Merge pull request #305 from ahmadnurus/add_method_not_allowed_error
errors: Added 405 Method Not Allowed helper function
2018-09-13 07:39:42 +01:00
ahmadnurus 395d70cf01 errors: Added 405 Method Not Allowed helper function 2018-09-12 21:42:34 +07:00
Asim Aslam 3732dc2f42 bump travis 2018-08-28 16:00:04 +01:00
Asim Aslam 9d3cb65daa set broker address on Init 2018-08-18 17:28:58 +01:00
Asim Aslam a0d3917832 Merge pull request #292 from micro/init
Add Init to all things, use init in cmd package to initialise
2018-08-09 18:30:36 +01:00
Asim Aslam 9968c7d007 Add Init to all things, use init in cmd package to initialise 2018-08-08 18:57:29 +01:00
Asim Aslam 68f5e71153 Merge pull request #290 from micro/connect
Support connect native registration
2018-08-06 17:20:37 +01:00
Asim Aslam af328ee7b4 Support connect native registration 2018-08-06 17:12:34 +01:00
Asim Aslam eebaa64d8c phase 1 2018-07-29 10:55:46 +01:00
Asim Aslam 88505388c1 Add verbosity to errors 2018-07-26 09:33:50 +01:00
Asim Aslam 8a778644cf Merge pull request #281 from micro/retry
retry only on timeout or internal server error
2018-07-22 17:52:12 +01:00
Asim Aslam d3a76e646a retry only on timeout or internal server error 2018-07-22 17:41:58 +01:00
Asim Aslam cfa824bc5f Merge pull request #280 from jiyeyuran/master
Allow client_retries to be 0
2018-07-19 23:24:57 -07:00
武新飞 39be61685c client_retries can be 0 2018-07-20 14:20:23 +08:00
Asim Aslam ac2106ced7 strip deadline from stream 2018-07-17 16:39:07 -07:00
Asim Aslam 1b4f7d8a68 a stream should not timeout 2018-07-17 16:32:35 -07:00
Asim Aslam 5eb2e79b86 go fmt 2018-07-17 16:31:09 -07:00
Asim Aslam a2eff9918e Merge pull request #269 from Ak-Army/master
handle function in mock response
2018-06-13 16:54:10 +01:00
Hunyadvári Péter 52a470532d handle function in mock response 2018-06-13 17:46:30 +02:00
Asim Aslam cd9441fafb Merge pull request #268 from jasimmk/fix-connect-lock
Fixing httpBroker dead lock; If publish is called from a subscription #267
2018-06-13 16:21:24 +01:00
Jasim Muhammed 356cf82af5 Fixing httpBroker dead lock; If publish is called from a subscription 2018-06-13 10:28:39 +04:00
Asim Aslam 5372707d0e Strip flag setting 2018-05-30 11:49:50 +01:00
Asim Aslam a1deb5c44e Merge pull request #264 from micro/register
set register ttl and interval by default
2018-05-30 11:31:13 +01:00
Asim Aslam 956b1c6867 set register ttl and interval by default 2018-05-29 12:28:55 +01:00
Asim Aslam 55aca8b0bf Merge pull request #262 from micro/retries
Retry requests
2018-05-29 11:52:47 +01:00
Asim Aslam ba8582a47a change retries to actually mean retries 2018-05-28 16:01:04 +01:00
Asim Aslam f409468ccd Merge branch 'master' of github.com:micro/go-micro 2018-05-28 15:51:52 +01:00
Asim Aslam d982225a54 restructure test 2018-05-28 15:40:28 +01:00
Asim Aslam 217190c4d6 Merge pull request #261 from micro/pool
Set the default pool size to 1
2018-05-26 09:58:16 +01:00
Asim Aslam a56e97b47d Change waitgroup processing 2018-05-26 09:41:41 +01:00
Asim Aslam b4f47b1cc9 Set the default pool size to 1 2018-05-26 09:10:29 +01:00
Asim Aslam 070cebd605 Merge pull request #260 from elebore/master
just update the pool configuration of rpcClient  if the options changed
2018-05-26 09:03:16 +01:00
bogle 541e894507 just update the pool configuration if the options changed, because recreating the pool,existed idleconnection, if any, will be dropped without closing 2018-05-26 15:38:41 +08:00
Asim Aslam c666558f8c make the broker/transport listen on new addr when stop/started with addr :0 2018-05-25 15:19:25 +01:00
Asim Aslam 6444b7e24c context cancellation is not required 2018-05-25 15:03:15 +01:00
Asim Aslam 023245a7ba shutdown broker once done 2018-05-25 14:43:32 +01:00
Asim Aslam 2a2ad553a1 reorder testing functions 2018-05-25 14:39:50 +01:00
Asim Aslam 909e13a24a Merge pull request #254 from micro/message
add message options
2018-05-10 17:42:46 +01:00
Asim Aslam b17a802675 update mock 2018-05-10 17:39:13 +01:00
Asim Aslam c3c0543733 add message options 2018-05-10 17:33:54 +01:00
Asim Aslam b39ec4472c Return subscriber errors 2018-04-26 10:47:13 +01:00
Asim Aslam b33489e481 update readme 2018-04-25 16:03:22 +01:00
Asim Aslam 8fb5e20a22 Merge pull request #248 from micro/rework
Rework Interfaces
2018-04-17 11:25:25 +01:00
Asim Aslam 0315b4480f revert some changes 2018-04-17 11:00:22 +01:00
Asim Aslam ccbc1b9cf3 Fix broker registry issue 2018-04-17 08:30:36 +01:00
Asim Aslam 19fdfba0bf move wrapper files 2018-04-14 19:24:17 +01:00
Asim Aslam d00ac200dd remove registry and transport default funcs 2018-04-14 18:43:54 +01:00
Asim Aslam 173f7107e2 remove broker default funcs 2018-04-14 18:26:54 +01:00
Asim Aslam d00d76bf7c Move publication to message 2018-04-14 18:21:02 +01:00
Asim Aslam 65068e8b82 rename Streamer to Stream 2018-04-14 18:15:09 +01:00
Asim Aslam c2cfe5310c Rework client interface 2018-04-14 18:06:52 +01:00
Asim Aslam 07068379c6 remove remote func methods 2018-04-14 16:16:58 +01:00
Asim Aslam 528b5f58de update sponsor area 2018-04-12 12:09:36 +01:00
Asim Aslam 378af01f77 update readme 2018-04-08 15:20:10 +01:00
Asim Aslam c317547e4d bump travis 2018-04-08 12:53:57 +01:00
Asim Aslam e55437698b misc moved to util 2018-04-08 12:37:45 +01:00
Asim Aslam e365cad930 Merge pull request #245 from micro/register
add flags for register ttl and interval
2018-04-06 14:14:11 +01:00
Asim Aslam 56735b4427 add flags for register ttl and interval 2018-04-06 14:03:39 +01:00
Asim Aslam 73e22eb5b1 gofmt 2018-04-06 14:03:00 +01:00
Asim Aslam c04b974311 nitpick the readme 2018-04-05 13:50:10 +01:00
Asim Aslam 75be57d6e4 syntax highlight code 2018-03-22 17:32:16 +00:00
Asim Aslam 270e9118c4 nitpick 2018-03-22 16:46:34 +00:00
Asim Aslam 5d3d61855c nitpick 2018-03-22 16:44:40 +00:00
Asim Aslam 7e0ee9ec08 include pubsub in the readme 2018-03-22 16:43:57 +00:00
Asim Aslam 2ae4214215 Merge pull request #238 from myabuyllc/registry-tcp-check
Add option to enable TCP check with Consul registry
2018-03-21 19:07:56 +00:00
Asim Aslam edaa0a0719 Merge pull request #240 from Leon2012/master
fix bug #239
2018-03-21 18:54:52 +00:00
Shulhan 44b934d458 registry: rename context key "consul_register_tcp_check" to "consul_tcp_check" 2018-03-21 21:57:04 +07:00
Shulhan 65a90f5a21 registry.Register: use local variable to get context value 2018-03-21 18:18:48 +07:00
Shulhan 1eb4398b6c registry/consul: rename "RegisterTCPCheck" to "TCPCheck" 2018-03-21 18:17:56 +07:00
leon.peng 9b99d50396 fix bug #239 2018-03-21 03:17:38 +00:00
Shulhan 68ab671bd0 Use registry.options.Context to set Consul TCP check option 2018-03-19 20:34:56 +07:00
Shulhan f4cdfaf27f Fix TCP address and port on service check registration 2018-03-19 20:34:12 +07:00
Asim Aslam d486125d07 update readme 2018-03-19 10:21:46 +00:00
Shulhan 1599d717af Add option to enable TCP check with Consul registry
One disadvantage of using TTL based health check is the high network
traffic between Consul agent (either between servers, or between server
and client).

In order for the services considered alive by Consul, microservices must
send an update TTL to Consul every n seconds (currently 30 seconds).

Here is the explanation about TTL check from Consul documentation [1]

    Time to Live (TTL) - These checks retain their last known state for a
    given TTL. The state of the check must be updated periodically over
    the HTTP interface. If an external system fails to update the status
    within a given TTL, the check is set to the failed state. This
    mechanism, conceptually similar to a dead man's switch, relies on the
    application to directly report its health. For example, a healthy app
    can periodically PUT a status update to the HTTP endpoint; if the app
    fails, the TTL will expire and the health check enters a critical
    state. The endpoints used to update health information for a given
    check are the pass endpoint and the fail endpoint. TTL checks also
    persist their last known status to disk. This allows the Consul agent
    to restore the last known status of the check across restarts.
    Persisted check status is valid through the end of the TTL from the
    time of the last check.


Hint:

    TTL checks also persist their last known status to disk. This allows
    the Consul agent to restore the last known status of the check
    across restarts.

When microservices update the TTL, Consul will write to disk. Writing to
disk means all other slaves need to replicate it, which means master need
to inform other standby Consul to pull the new catalog. Hence, the
increased traffic.

More information about this issue can be viewed at Consul mailing list [2].

[1] https://www.consul.io/docs/agent/checks.html
[2] https://groups.google.com/forum/#!topic/consul-tool/84h7qmCCpjg
2018-03-14 19:40:59 +07:00
Asim Aslam a941a4772b parallel test causes deadlock 2018-03-13 18:50:58 +00:00
Asim Aslam dca078f30b Merge pull request #235 from shuLhan/dev-shulhan
Fix warnings from linter output
2018-03-13 18:25:37 +00:00
Shulhan cbbf9f7e3b [test] service.TestService: run subtest in parallel
Reason: the t.Fatalf and t.Fatal must be invoked by test routine, not by
other routine, or the the test will not stopped [1].

[1] megacheck SA2002
2018-03-13 18:12:42 +07:00
Shulhan a54dee31de [lint] service.Init: ignore error by assigning it to blank identifier 2018-03-13 17:51:33 +07:00
Shulhan 1bd541b69e service.Run: replace signal SIGKILL with SIGQUIT
According to "os/signal" documentation [1] and libc manual [2], SIGKILL
may not be caught by a program.

[1] https://godoc.org/os/signal
[2] https://www.gnu.org/software/libc/manual/html_node/Termination-Signals.html
2018-03-13 17:45:34 +07:00
Shulhan e769802939 service.Run: simplify return statement 2018-03-13 17:40:13 +07:00
Asim Aslam a3741f8a11 strip namespace from readme 2018-03-09 19:11:42 +00:00
Asim Aslam 6246fa2bcb Merge pull request #233 from micro/context
switch to stdlib context
2018-03-04 09:15:25 +00:00
Asim Aslam c9b40cb33b switch to stdlib context 2018-03-03 11:53:52 +00:00
Asim Aslam 982e6068cf support services without version 2018-03-01 17:35:13 +00:00
Asim Aslam e8b050ffd5 update travis 2018-03-01 10:07:48 +00:00
Asim Aslam 13f8e4fef7 nitpick 2018-02-28 15:40:41 +00:00
Asim Aslam 1fe528c411 update readme 2018-02-28 15:38:50 +00:00
Asim Aslam d0d9582b81 Merge pull request #206 from darren-west/master
Added Options() to registry interface
2018-02-19 20:52:28 +00:00
Asim Aslam 42bdca63da Merge pull request #230 from micro/watch
Add watch options
2018-02-19 20:29:17 +00:00
Asim Aslam 02260dcaa3 Add watch options 2018-02-19 17:12:37 +00:00
Asim Aslam eb7788ce25 Merge pull request #229 from tudurom/add_conflict_error
errors: Added 409 Conflict helper function
2018-02-13 08:33:22 +00:00
Tudor Roman 3b6f38a45c errors: Added 409 Conflict helper function 2018-02-11 15:51:33 +02:00
Asim Aslam 94ea766c9e syntax highlight 2018-02-01 13:54:37 +00:00
Asim Aslam ff9ad875af update readme 2018-01-30 16:18:11 +00:00
Asim Aslam 45420d8413 Merge pull request #224 from dh1tw/rpc-server-subscribe-deadlock
fix possible deadlock since code can return without unlocking the Mutex
2018-01-02 10:22:13 +00:00
Tobias Wellnitz, DH1TW 0dcea05fb8 fix possible deadlock since code can return without unlocking the Mutex 2018-01-01 19:57:13 +01:00
Asim Aslam b0b0338128 add option to set selector 2017-12-20 21:43:24 +00:00
Asim Aslam 11d75dae1b remove version from example 2017-11-30 12:28:20 +00:00
Asim Aslam fc0bbcd339 change the blurb 2017-11-30 09:16:54 +00:00
Asim Aslam c82dadfa55 Merge pull request #221 from gaxxx/master
add https support for consul
2017-11-28 07:11:48 +00:00
Siyun Wu 7c8d6087de add https support for consul
using enviroment variables

for example:
export CONSUL_HTTP_SSL=1
export CONSUL_HTTP_ADDR="https://example.com"
export CONSUL_CLIENT_CERT="/Users/foo/.ssh/consul/consul.cert"
export CONSUL_CLIENT_KEY="/Users/foo/.ssh/consul/consul.key"
export CONSUL_CACERT="/Users/foo/.ssh/consul/ca.cert"
2017-11-20 15:34:52 +08:00
Asim Aslam 1f03681d82 set test to use localhost 2017-11-09 14:21:26 +00:00
Asim Aslam 1c1d46e1ac Add some test logging 2017-11-09 14:16:35 +00:00
Asim Aslam a545091c36 update go versions for travis build 2017-11-09 13:52:51 +00:00
Asim Aslam ada9ef48cf Remove whitespace 2017-11-09 13:51:40 +00:00
Asim Aslam a7c4afac54 Merge pull request #213 from weisd/master
add log when register err
2017-11-09 13:50:38 +00:00
Asim Aslam 043e4aa979 please stack overflow 2017-11-03 17:30:16 +00:00
Asim Aslam 78da1fde94 Merge pull request #217 from micro/perf
Performance upgrades
2017-10-29 14:48:23 +00:00
Asim Aslam e7104d609a return the not found error 2017-10-28 16:21:32 +01:00
Asim Aslam 1890ec7044 rc is not used 2017-10-28 13:55:59 +01:00
Asim Aslam d48735793d remove ticker 2017-10-26 21:12:48 +01:00
Asim Aslam 6fb652f78a lazily start watcher 2017-10-26 20:55:52 +01:00
Asim Aslam bd46e60c13 optimise http broker with rcache 2017-10-26 20:48:11 +01:00
Asim Aslam 42235bc973 Merge branch 'master' into perf 2017-10-26 13:47:09 +01:00
Asim Aslam c07b3636c0 update readme 2017-10-26 12:19:42 +01:00
Asim Aslam 2f09d5830c update readme 2017-10-26 12:18:14 +01:00
Asim Aslam 48513c78b6 further readme culling 2017-10-26 12:16:17 +01:00
Asim Aslam bd34d39401 update readme 2017-10-26 12:02:52 +01:00
Asim Aslam 59685a4ff9 update readme 2017-10-26 12:02:10 +01:00
weisd 6385bf743c add log when register err 2017-10-25 14:23:58 +08:00
Asim Aslam 8fd8d9bd35 Enable connection pooling and selector caching by default 2017-10-24 15:35:25 +01:00
Asim Aslam 53554d98cd Merge pull request #209 from uffy/master
use sync.Once instead of chan
2017-10-09 14:09:56 +01:00
Uffy f6165f35c0 import sorting 2017-10-09 20:55:03 +08:00
Uffy ae3f59a2f5 use sync.Once instead of chan
sync.Once is more clear and faster than chan.
2017-10-09 15:47:28 +08:00
Asim Aslam 0703c514a9 Merge pull request #208 from uffy/master
remove redundant rand.Seed
2017-10-09 07:32:18 +01:00
Uffy b92130eeee remove redundant rand.Seed 2017-10-09 14:22:15 +08:00
Asim Aslam e0e4596be0 update readme 2017-10-03 11:19:03 +01:00
Asim Aslam 5f60f7518d update readme 2017-10-03 11:14:39 +01:00
Asim Aslam f2d4226817 update readme 2017-10-03 11:05:54 +01:00
Asim Aslam 236cfd6a3b update readme 2017-10-03 11:03:46 +01:00
darren-west d970586a29 Added Options() to registry interface 2017-09-28 11:16:56 +01:00
Asim Aslam d29b5e2fab Merge pull request #203 from wzhliang/master
fixing typo
2017-08-25 11:00:18 +01:00
Wenzhi Liang 7f173dfc63 fixing typo 2017-08-25 17:56:57 +08:00
Asim Aslam 8be72b676d Merge pull request #202 from freman/mapsorting
Fix hashing of the service definition
2017-08-24 12:16:32 +01:00
Shannon Wynter 0e696f4907 Fix hashing of the service definition
Maps are sorted randomly, order the keys as a slice
2017-08-24 18:25:05 +10:00
Asim Aslam 1748328f14 Merge pull request #201 from vans9/register-subscriber-pass-opts
Pass options to the s.NewSubscriber
2017-08-24 08:53:50 +01:00
Pavel Arefiev eff39083ca Pass options to the s.NewSubscriber 2017-08-24 10:47:32 +03:00
Asim Aslam e3f818d18e Merge pull request #197 from sarbash/fix-tls-consul-registry
Check for uninitialized *config.HttpClient
2017-08-15 08:51:50 +01:00
Sergey Sarbash db0df07fd6 Check for uninitialized *config.HttpClient 2017-08-15 10:49:24 +03:00
Asim Aslam 87c39542b0 Merge pull request #196 from sarbash/fix-tls-consul-registry
Fixes nil pointer dereferencing for Consul TLS transport
2017-08-15 08:08:03 +01:00
Sergey Sarbash fd01ead575 Fixes nil pointer dereferencing for Consul TLS transport 2017-08-15 09:27:39 +03:00
Asim Aslam 382abbf28b update travis go versions 2017-08-09 13:01:41 +01:00
Asim Aslam 8264e90bce Merge pull request #189 from hlian/master
server/rpc_codec: friendlier behavior if c.codec.Write fails
2017-07-18 14:18:12 +01:00
Hao Lian d4b149046f server/rpc_codec: if c.codec.Write fails, reset write buffer and encode an error message about the encoding failure
When developing go-micro services, it is frequently possible to set invalid results in the response pointer. When this happens (as I and @trushton personally experienced), `sendResponse()` returns an error correctly explaining what happened (e.g. protobuf refused to encode a bad struct) but the `call()` function one above it in the stack ignores the returned error object.

Thus, invalid structs go un-encoded and the _client side times out_. @trushton and I first caught this in our CI builds when we left a protobuf.Empty field uninitialized (nil) instead of setting it to `&ptypes.Empty{}`. This resulted in an `proto: oneof field has nil value` error, but it was dropped and became a terribly confusing client timeout instead.

This patch is two independent changes:

* In rpc_codec, when a serialization failure occurs serialize an error message, which will correctly become a 500 for HTTP services, about the encoding failure. This means rpc_codec only returns an `error` when a socket failure occurs, which I believe is the behavior that rpc_service is expecting anyway.

* In rpc_service, log any errors returned by sendResponse instead of dropping the error object. This will make debugging client timeouts less of a hassle.
2017-07-17 14:21:43 -04:00
Asim Aslam e0b3a48323 brevity is key 2017-07-16 14:58:31 +01:00
Asim Aslam f4ea9787a9 Strip readme comments 2017-07-14 08:24:46 +01:00
Asim Aslam 9438fae607 long standing typo 2017-06-15 19:57:27 +01:00
Asim Aslam 3812cbbcb6 defer wg.Done so it's called even if there's a panic 2017-06-12 14:18:59 +01:00
Asim Aslam 32b7ebcfbc use updated error formatting 2017-06-11 13:02:08 +01:00
Asim Aslam 097395c5cb Merge pull request #172 from micro/func
Function
2017-06-01 12:50:58 +01:00
Asim Aslam eecf26619b Set register ttl/interval by default for functions since they are more ephemeral 2017-06-01 12:44:18 +01:00
Asim Aslam 1932bc805b update readme 2017-06-01 12:26:57 +01:00
Asim Aslam e870bffef2 add function test 2017-06-01 12:11:52 +01:00
Asim Aslam 3e9f556e4a working function solution 2017-05-31 20:45:36 +01:00
Asim Aslam 0f1ec6ea0f Merge branch 'master' into func 2017-05-31 19:55:03 +01:00
Asim Aslam 334efcf212 Merge pull request #171 from micro/wait
Wait for requests to finish before closing transport
2017-05-31 19:54:37 +01:00
Asim Aslam e1a1f1c0f0 add wait option 2017-05-31 19:47:50 +01:00
Asim Aslam f7a9207c7a wait for subscribers to complete 2017-05-31 19:47:41 +01:00
Asim Aslam 2ee22f5336 strip init of wg 2017-05-31 19:35:16 +01:00
Asim Aslam 276a0118da be pedantic 2017-05-31 19:33:11 +01:00
Asim Aslam 726793b6fa Wait for requests to finish before closing transport 2017-05-31 19:21:41 +01:00
Asim Aslam d5809d2d70 function interface 2017-05-31 15:03:24 +01:00
Asim Aslam ce37d7fbe8 Merge pull request #170 from svanharmelen/f-errors
Improve the UX for users of the errors package.
2017-05-31 15:02:58 +01:00
Sander van Harmelen 4bc44d79c6 Improve the UX for users of the errors package.
By making the error helper functions variadic functions, you can pass either a string (like the existing behaviour) or a format and verbs that will then be formatted for you.

This doesn’t break any existing API’s, but it prevents people using this package to have to call `fmt.Sprintf` whenever they would like to format the error detail.
2017-05-31 15:29:03 +02:00
Asim Aslam a7312f5c7e log panics 2017-05-16 19:14:00 +01:00
Asim Aslam 4cb22b5969 Merge pull request #167 from micro/log
make use of micro/go-log
2017-05-12 17:02:55 +01:00
Asim Aslam 5bce20627f Switch that back to Fatal since we've added the convenience method 2017-05-12 15:14:54 +01:00
Asim Aslam bab586b71e make use of micro/go-log 2017-05-11 20:43:42 +01:00
Asim Aslam 39fb03fba6 Merge pull request #165 from foxliu20/master
fix version option in cmd
2017-05-09 12:25:36 +01:00
xueyun.liu 4edb8650e5 fix version option in cmd 2017-05-09 15:49:59 +08:00
Asim Aslam e55e5033b8 Merge pull request #160 from emilh91/patch-1
Update consul_watcher.go
2017-04-26 08:54:24 +01:00
Emil Huseynaliev 9e1550db53 Update consul_watcher.go
`WatchPlan` was renamed to `Plan` in the consul `watch` package in commit https://github.com/hashicorp/consul/commit/d7e23857ad1943edeaa7e490e0642019d44812e6
2017-04-25 16:38:35 -04:00
Asim Aslam 90ed1390ee fix broken test 2017-04-17 15:31:50 +01:00
Asim Aslam 33b1cea29d Don't create new options 2017-04-17 14:57:43 +01:00
Asim Aslam 742b83cbb1 Merge pull request #158 from Taik/master
Add Retry option for clients
2017-04-13 13:26:15 +01:00
Thinh Nguyen ea34e23118 Add Retry option for clients 2017-04-12 16:47:40 -04:00
Asim Aslam d7dc4e618b process opts on multiple init calls 2017-03-30 19:44:01 +01:00
Asim Aslam b43985401a on service.Init only process options once 2017-03-30 17:15:59 +01:00
Asim Aslam a933aa79c6 Merge pull request #155 from micro/sugar
Syntactic sugar for pubsub
2017-03-30 14:44:26 +01:00
Asim Aslam d226bdf2d4 Syntactic sugar for pubsub 2017-03-18 19:00:11 +00:00
Asim Aslam 0c2c53e9af Merge pull request #151 from wangkechun/fix-fmt
fix fmt str
2017-02-25 15:03:17 +00:00
wangkechun 059b9d36d7 fix fmt str 2017-02-25 22:53:25 +08:00
Asim Aslam 0f75420692 switch tip to 1.8rc3 2017-02-15 15:21:36 +00:00
Asim Aslam bd36b302c1 force build 2017-02-15 15:17:10 +00:00
Asim Aslam 47039fc625 update ja-micro links 2017-02-15 14:31:20 +00:00
Asim Aslam d76ed89f03 update blog links 2017-02-11 14:26:47 +00:00
Asim Aslam 9f17b91fcb add link to docs 2017-02-10 12:36:42 +00:00
Asim Aslam 6f509c0645 update readme 2017-02-07 18:33:50 +00:00
Asim Aslam 06624ea7e4 further nitpick 2017-01-22 14:16:16 +00:00
Asim Aslam e9d5057417 nitpick readme 2017-01-22 14:12:53 +00:00
Asim Aslam 238c99d228 rename file to please the OCD gods 2017-01-12 20:38:43 +00:00
Asim Aslam 66ef6b67ca add support for port range in http broker 2017-01-12 14:11:25 +00:00
Asim Aslam a47d916b50 move ip func 2017-01-12 13:52:49 +00:00
Asim Aslam a9889730d6 move addr extractor to misc 2017-01-12 13:20:34 +00:00
Asim Aslam fd78e1d432 add comments for registration 2017-01-07 22:51:34 +00:00
Asim Aslam 4d4db84d5d fix for godoc 2017-01-07 15:05:51 +00:00
Asim Aslam 942985ce51 add service test and shutdown based on context 2017-01-07 14:52:23 +00:00
Asim Aslam e84e5ae303 make features a bullet list 2017-01-06 20:06:58 +00:00
Asim Aslam 21bb57417d fix links 2017-01-05 15:12:30 +00:00
Asim Aslam d1c12e4302 move go-micro examples links 2017-01-05 15:09:27 +00:00
Asim Aslam d4a0b2801f update examples link 2017-01-05 14:34:08 +00:00
Asim Aslam a61cd39d09 fix import 2017-01-04 16:43:43 +00:00
Asim Aslam 8d2e2e5dbe add plugin build section 2017-01-04 14:54:31 +00:00
Asim Aslam 19b3ad97a6 update travis 2017-01-01 18:51:33 +00:00
Asim Aslam dc89b56bd0 update readme 2016-12-25 20:57:27 +00:00
Asim Aslam 299a7de381 update readme 2016-12-25 20:53:08 +00:00
Asim Aslam d606d00f35 superfluous logging 2016-12-15 20:45:27 +00:00
Asim Aslam 71d717a06d strip doc.go files 2016-12-14 15:41:48 +00:00
Asim Aslam 4a1e5b34ee update service example readme 2016-12-08 12:34:02 +00:00
Asim Aslam 3a1d33f553 nitpick readme 2016-12-07 16:54:19 +00:00
Asim Aslam 475e584e15 Merge pull request #143 from micro/codec
Add configurable codecs for broker/transport
2016-12-06 19:44:45 +00:00
Asim Aslam 095793ee96 handle codec and transport errors 2016-12-06 19:40:44 +00:00
Asim Aslam 369c02c900 Remove the duplication of this codec code 2016-12-06 19:07:11 +00:00
Asim Aslam 25a6849609 move broker codec 2016-12-06 18:59:41 +00:00
Asim Aslam 49e5636bcd add transport codec 2016-12-06 18:56:57 +00:00
Asim Aslam bd3c798fd9 Add configurable codecs for broker/transport 2016-12-06 18:37:35 +00:00
Asim Aslam e10259940b add WrapCall option at top level 2016-12-06 17:01:53 +00:00
Asim bee9f03e11 switch image link to blog post 2016-12-03 10:35:35 +00:00
Asim d3bfdc79ba update slack invite link 2016-11-29 11:44:06 +00:00
Asim c289f6acaa Make use of consul 0.7 deregister field. Now auto reaps dead services 2016-11-25 11:23:37 +01:00
Asim b05b42eccd Differentiate between request and call timeouts 2016-11-22 10:44:32 +01:00
Asim Aslam 22f212c274 Merge pull request #141 from simplechris/consul-configuration
Remove consul token helper method.
2016-11-21 17:39:28 +01:00
chriss fabdd4a704 Remove consul token helper method.
A Consul config struct can be passed using the `Config` helper making this helper redundant.
2016-11-21 16:16:24 +00:00
Asim 19be4ea2fd continue on unsubscribe/deregister 2016-11-21 16:51:30 +01:00
Asim 8873e6ad08 we need to not return after processing broadcast, still gotta process the other queues 2016-11-21 15:58:39 +01:00
Asim 0be3256d25 fix protoc comment 2016-11-20 15:02:05 +00:00
Asim ab7f7d6693 update package level comment 2016-11-20 14:59:09 +00:00
Asim 25ae5c2e5f Clarify service discovery 2016-11-19 14:31:07 +00:00
Asim 20feb95e18 Add the ability to switch out client/server 2016-11-18 17:29:26 +00:00
Asim f9709ffa6e ensure the code does not panic 2016-11-18 07:30:50 +00:00
Asim Aslam 1688329049 Merge pull request #139 from simplechris/feature/consul-config
Add ability to pass consul client config via registry options.
2016-11-18 07:28:01 +00:00
chriss 8a25723fe0 Set consul token via registry options.
Optionally configure a token to use with the consul client.
2016-11-18 00:07:12 +00:00
chriss 3d7187f405 Add the ability to pass consul client config via registry options.
This can be used when you need to configure the consul client to use a specific configuration (E.G to pass a Token if consul is using ACL policies)
2016-11-17 23:24:14 +00:00
Asim Aslam 74d8ea6817 Merge pull request #136 from micro/wrapper
Call Wrapper
2016-11-09 18:12:36 +00:00
Asim 99a3ba7358 wrap before the call, we don't want to rewrap on retry 2016-11-09 18:02:41 +00:00
Asim c277a3ecc0 Add example of client call func wrap 2016-11-07 20:11:58 +00:00
Asim 2df46131eb fix test 2016-11-07 18:54:44 +00:00
Asim 0d84fb1913 Add wrapper test 2016-11-07 18:51:25 +00:00
Asim 7ee35f50b1 WrapCall rather than WrapCallFunc 2016-11-07 18:06:15 +00:00
Asim f3b591d722 Strip stream func and rename call wrappers... 2016-11-07 17:58:34 +00:00
Asim 5ee585e77d Rename to CallFuncWrappers 2016-11-07 17:52:19 +00:00
Asim c6b5237cce Add call func wrapper 2016-11-07 17:49:35 +00:00
Asim d1d41b5a67 Fix comment 2016-11-07 16:51:28 +00:00
Asim Aslam 3b75e94e02 Merge pull request #133 from ynori7/master
Adding the ability to specify a function to check if micro should retry a failed rpc call
2016-11-07 16:50:45 +00:00
Scott Finlay 1ab59094eb Fixing return value and gofmt 2016-11-07 17:46:12 +01:00
Scott Finlay a6812ba332 Adjusting the logic around the returned error from the retry function 2016-11-07 17:41:51 +01:00
Scott Finlay c6737ac64c Adjusting import because of failed build 2016-11-07 17:15:11 +01:00
Scott Finlay a66bce0e4b Adjusting arguments and return value of retry function and adding new retry logic to stream 2016-11-07 17:10:40 +01:00
Scott Finlay 092d17a74e Adjusting names 2016-11-07 09:40:11 +01:00
Asim 7868d5a2cb Use Socket in the Client interface 2016-11-05 11:44:02 +00:00
Scott Finlay d7e4062a0e Adding the ability to specify a function to check if micro should retry a failed rpc call 2016-11-03 10:51:47 +01:00
Asim Aslam 2c65a38ba9 Merge pull request #132 from micro/ctx
Make copy of metadata in setHeaders
2016-11-02 17:50:34 +00:00
Asim 7635bd9753 Make copy of metadata in setHeaders 2016-11-02 17:21:53 +00:00
Asim a36e042983 We don't need numcalls, save us a mutex lock 2016-11-01 19:40:36 +00:00
Asim 1b1fb71e44 move function 2016-10-29 21:34:15 +01:00
Asim 6d35a663a4 Don't create new message 2016-10-29 21:33:04 +01:00
Asim b3cdbaae1a Use random starting index for roundrobin 2016-10-29 09:31:32 +01:00
Asim db948d0dc3 Include talk link 2016-10-14 22:17:39 +01:00
Asim 32bf930ea1 update dockerfile 2016-10-08 10:26:11 +01:00
Asim cfbcf2efbe move section down 2016-10-04 17:34:45 +01:00
Asim 3442f76989 reorder readme to get started first 2016-10-04 17:33:58 +01:00
Asim 3d922b82d1 MQTT broker has been moved to go-plugins 2016-10-01 16:56:09 +01:00
Asim Aslam 419b952fb3 Merge pull request #119 from jelmersnoeck/jelmer/consul-registry-node-health
ConsulRegistry: use health checks to select nodes.
2016-08-26 12:13:47 +01:00
Jelmer Snoeck e59f7a7ace ConsulRegistry: use health checks to select nodes.
Consul sees a healthcheck that is in the warning state as a "failed"
node. This means that when we ask Consul for services that are passing,
it would not return nodes that have warning healthchecks.

In the cache, we only check on critical to skip for nodes. This makes
the cache out of sync with the non-cache implementation.

This patch reworks the non-cache implementation to ask for all nodes
(even unhealthy ones) and does the same check as within the cache, skip
nodes that have critical healthchecks.

We've noticed this issue when we deployed custom healthchecks where the
cache was acting properly, but after 1 minute we saw "None Available"
errors. This is due to the TTL expiry on the cache, which is then
followed by doing a non cached request.
2016-08-26 08:36:45 +01:00
Asim b8241f3026 specify the Accept header along with Content-Type 2016-08-25 13:34:47 +01:00
Asim 71d64f911f make a copy of services for handle method 2016-08-24 18:37:11 +01:00
Asim 0afaaeec8d make a copy of services 2016-08-24 18:27:15 +01:00
Asim Aslam 321358ae1f Merge pull request #115 from jelmersnoeck/jelmer/deregister-node-if-checks-fail
ConsulWatcher: deregister if service checks fail.
2016-08-11 16:13:49 +01:00
Jelmer Snoeck 81231c0b6f ConsulWatcher: deregister if service checks fail. 2016-08-11 15:18:50 +01:00
Asim 66c38b75aa Name timeout rather than deadline 2016-08-01 16:31:27 +01:00
Asim Aslam 56aaeff042 Merge pull request #114 from micro/extractor
Use struct tags if available
2016-08-01 13:03:32 +01:00
Asim 15f19b700f Use struct tags if available 2016-07-30 19:01:42 +01:00
Asim 2d6c403992 don't close next chan, instead use exit chan 2016-07-30 11:58:10 +01:00
Asim Aslam 720bda1439 Merge pull request #112 from micro/deadline
Transport Deadline Support
2016-07-29 16:29:14 +01:00
Asim 9d08a7955d add deadline test 2016-07-29 15:30:51 +01:00
Asim e7903c65ce use deadline within http transport 2016-07-28 19:12:56 +01:00
Asim 5b034ba253 Add deadline option 2016-07-28 18:38:17 +01:00
Asim 32f9546ed5 nitpick 2016-07-03 02:52:04 +01:00
Asim 65d6e45707 update readme 2016-07-03 02:49:13 +01:00
Asim db087eff3b update mailing list link 2016-07-03 02:05:19 +01:00
Asim 5827e1ab2b nitpick that blurb 2016-07-03 02:02:17 +01:00
Asim 2460132391 add link to greeter 2016-07-03 02:00:22 +01:00
Asim 6aac602b31 return error when zero services in mock registry 2016-06-30 20:11:04 +01:00
Asim 0190b1ab3a Don't unmarshal if result is nil 2016-06-30 16:45:30 +01:00
Asim 02481c4446 request panic catch all 2016-06-30 16:19:02 +01:00
Asim 7640a76d88 Change help messages 2016-06-28 22:41:44 +01:00
Asim 1cdf98418f add http broker benchmark so we can test codec changes 2016-06-25 03:15:56 +01:00
Asim 0348d0eed9 Concurrent use of message and we modify it, bad practice, copy it 2016-06-25 03:15:42 +01:00
Asim 7968a8eb6d Update table 2016-06-21 03:27:08 +01:00
Asim fe89a7633f Update table 2016-06-21 03:26:22 +01:00
Asim 5447a7ae7c Update table 2016-06-21 03:25:27 +01:00
Asim 619517a611 Update table 2016-06-21 03:24:49 +01:00
Asim 2df23e4371 reword some more 2016-06-20 02:55:36 +01:00
Asim 03f1a4e6d4 change travis link 2016-06-20 02:54:06 +01:00
Asim d0f67931d0 reword readme 2016-06-20 02:52:38 +01:00
Asim 5b381f13f0 Add comments 2016-06-19 16:02:14 +01:00
Asim 30e0fef615 Strip blacklist 2016-06-19 14:41:33 +01:00
Asim 95f1e80af4 Add alternative mdns comment 2016-06-18 23:19:52 +01:00
Asim 02a0eb29d2 Temporarily disable blacklisting 2016-06-17 15:41:29 +01:00
Asim Aslam d31cd76b8c Merge pull request #86 from micro/pool
Connection Pooling
2016-06-07 01:35:25 +01:00
Asim ff0bd76905 Add a pool test 2016-06-07 01:18:54 +01:00
Asim 58ad01e3e1 Don't log that cruft 2016-06-07 00:48:34 +01:00
Asim 89401cbb95 Make pool configurable 2016-06-07 00:46:14 +01:00
Asim 38a66817e6 Add a conn lifetime for the pool 2016-06-06 23:37:52 +01:00
Asim 6669248291 gofmt 2016-06-06 23:37:07 +01:00
Asim 739b094cd2 Merge branch 'master' into pool 2016-06-06 14:06:03 +01:00
Asim 69aa8537d3 Add some comments 2016-06-06 14:05:02 +01:00
Asim Aslam 05596cfae4 Merge pull request #99 from xujinzheng/master
improve self-signed host list
2016-06-06 14:02:16 +01:00
Zeal d8ecd42868 rename getIPAddrList() to getIPAddrs and improve code format 2016-06-06 20:56:53 +08:00
Zeal eb0422cee1 improve self-signed host list 2016-06-05 23:13:29 +08:00
Asim 34365812d8 Fix double close 2016-06-03 11:08:58 +01:00
Asim 702072f177 Make mock listen on random port if 0 is specified 2016-06-01 15:22:27 +01:00
Asim 93c1ae6221 Add debug stats handler 2016-05-28 22:30:47 +01:00
Asim Aslam 824d2a850c Merge pull request #95 from ThatsMrTalbot/patch-1
MockClient.CallRemote now returns nil on success
2016-05-28 21:00:09 +01:00
Mr Talbot 6de507b7b5 MockClient.CallRemote now returns nil on success
CallRemote was not returning nil on success as it should due to a missing return
2016-05-28 20:52:59 +01:00
Asim Aslam 257333a0a3 Merge pull request #93 from micro/endpoint_metadata
Support endpoint metadata
2016-05-26 20:43:29 +01:00
Asim 7a5a9013ef move the option 2016-05-26 20:43:05 +01:00
Asim ee3ae89ca8 naming nitpick 2016-05-26 20:25:00 +01:00
Asim 4d24f4e30c Blacklist for longer to ensure it works 2016-05-26 18:26:02 +01:00
Asim 8245390b5a Support endpoint metadata 2016-05-26 18:01:02 +01:00
Asim 1254a87286 Add package comments 2016-05-24 22:22:46 +01:00
Asim 9d50d51c40 Ugh slack on heroku sucks 2016-05-23 14:13:03 +01:00
Asim 0a6d1ff0ab Add slack badge 2016-05-22 19:33:41 +01:00
Asim 04bc20798d Don't strip decode because its good to be backwards compatible still 2016-05-22 18:43:47 +01:00
Asim 2708f9c04b No longer need to test old encoding 2016-05-22 18:41:06 +01:00
Asim 06ee80fd0a Strip old encoding 2016-05-22 18:34:47 +01:00
Asim 98f295b6b0 Noobed the deadlock 2016-05-13 18:24:01 +01:00
Asim 2e9f4271a8 Pool first attempt 2016-05-13 15:58:53 +01:00
Asim Aslam c0eac7dda8 Merge pull request #85 from micro/timeout
Add cascading timeouts
2016-05-13 15:54:01 +01:00
Asim b6f5e15362 Fix the error returns from done and bail early if we dont have time 2016-05-12 23:56:25 +01:00
Asim 00a26677b8 Continue to return our error types 2016-05-12 23:52:29 +01:00
Asim 8c8573426c Add cascading timeouts 2016-05-12 23:32:58 +01:00
Asim d504abb7e2 Add readme to examples 2016-05-11 22:58:59 +01:00
Asim 2254578760 We don't need sync.Once, we can just select 2016-05-11 00:01:32 +01:00
Asim a0a4ab4c15 Don't throw fatal on EOF 2016-05-10 11:23:30 +01:00
Asim 9d629b5365 Don't return 2016-05-10 11:17:48 +01:00
Asim aea81315d0 Change QueueName to Queue 2016-05-10 10:55:18 +01:00
Asim 0d21b08928 Run method is obsolete 2016-05-07 03:08:43 +01:00
Asim Aslam 24220fe615 Merge pull request #81 from micro/selector
Make Selector pluggable with Strategy's, Filters, etc.
2016-05-07 00:24:57 +01:00
Asim 75f2706fd0 Use ErrNoneAvailable and test blacklisting 2016-05-07 00:04:08 +01:00
Asim 63c6e82192 Strip blacklist 2016-05-06 23:18:47 +01:00
Asim 639172f755 Merge branch 'master' into selector 2016-05-06 23:16:07 +01:00
Asim 8353b7b865 Add blacklist to cache 2016-05-06 23:15:40 +01:00
Asim 77e4d4d9c4 Next phase of selector 2016-05-06 23:12:37 +01:00
Asim 07687b9595 Since we send 200 response from the Listener, we should expect 200 response from the Client 2016-05-06 15:44:32 +01:00
Asim 8b76e277bc Make it possible to call service.Init multiple times 2016-05-06 12:21:41 +01:00
Asim ba391e228c Add default to selector list 2016-05-05 21:14:57 +01:00
Asim 6070e235eb remove comment 2016-05-05 21:13:07 +01:00
Asim 670ed74a13 Use del method 2016-05-05 21:12:59 +01:00
Asim 818d500f98 Fix compile error 2016-05-03 22:11:42 +01:00
Asim 0a4484b406 First commit in strategy rework 2016-05-03 22:06:19 +01:00
Asim b13361d010 Add cache ttl 2016-05-03 19:26:50 +01:00
Asim e541d45f38 When the TTL flips to critical we should issue a delete event 2016-05-03 18:34:57 +01:00
Asim d3de45409f Simplify watcher test 2016-05-01 22:30:33 +01:00
Asim 7996785195 Try a different way of testing 2016-05-01 22:05:21 +01:00
Asim 3709831d8e Watch results may be unordered 2016-05-01 21:38:22 +01:00
Asim 50eb97129e Add watcher test 2016-05-01 21:30:14 +01:00
Asim 96104aa209 Add mdns test and fix the bug it revealed 2016-05-01 21:21:15 +01:00
Asim Aslam a53fc54b70 Merge pull request #79 from micro/mdns
mdns: zero dependency registry using multicast dns
2016-05-01 19:49:04 +01:00
Asim e14f9a0380 Add watcher.... OH YEAAA 2016-05-01 19:31:03 +01:00
Asim 59f1a9a07b Use mdns-sd service 2016-04-30 00:22:31 +01:00
Asim 5b94e4672d Failed to gofmt 2016-04-30 00:20:05 +01:00
Asim ae8c948202 Use our fork of mdns with all the updates 2016-04-30 00:15:00 +01:00
Asim 67e464b34d Eliminate a data race by copying the services 2016-04-29 19:29:24 +01:00
Asim c26f989bbb Fix encoding so we split across txt records 2016-04-28 18:36:59 +01:00
Asim 796dba3aac Fix up the http broker so it works concurrently and pubs async 2016-04-28 00:16:11 +01:00
Asim 1340e81235 Remove logging 2016-04-28 00:07:25 +01:00
Asim 6c108d95b2 First attempt at mdns 2016-04-27 18:21:05 +01:00
Asim Aslam 65a880fadd Merge pull request #78 from micro/cache
Caching Selector
2016-04-26 20:06:03 +01:00
Asim 04e0864df4 Add the link to cmd 2016-04-26 18:54:35 +01:00
Asim 1152b63c5d Merge branch 'master' into cache 2016-04-26 18:53:39 +01:00
Asim e8b5cebb52 Remove that link 2016-04-26 18:52:17 +01:00
Asim 9d8e5d1e15 Add caching selector 2016-04-26 18:49:29 +01:00
Asim 3d3044404e Don't add to defaults in func init, just add them to cmd 2016-04-26 18:49:02 +01:00
Asim f7c57fd4f4 Mock watcher that just blocks 2016-04-26 18:32:43 +01:00
Asim decb70b97c Response type for Stream is an interface 2016-04-26 15:52:08 +01:00
Asim b0bc806a57 Add sponsors 2016-04-26 12:18:18 +01:00
Asim Aslam 6f81b48f8e Merge pull request #75 from micro/mqtt
MQTT Broker
2016-04-25 22:19:40 +01:00
Asim 545cd22daf Commit fixes for MQTT 2016-04-25 22:15:01 +01:00
Asim 48d191c3eb Test to the best of our ability 2016-04-24 20:07:24 +01:00
Asim Aslam 2fd476a16f Merge pull request #76 from micro/selector
Add Label and Version based Filters
2016-04-23 21:42:53 +01:00
Asim d6fdfc252e Make it easier to add select filters 2016-04-23 21:37:26 +01:00
Asim ed764ca0b2 Add endpoint filter 2016-04-23 21:24:07 +01:00
Asim febe87dfb8 Switch around method names 2016-04-23 21:09:48 +01:00
Asim 7c3ce60ce6 Add label and version filters 2016-04-23 20:57:46 +01:00
Asim 4d4f842702 Change SelectFilter to Filter 2016-04-23 20:15:01 +01:00
Asim eecdeaae99 Fix the mqtt broker connect. Add to default brokers in cmd 2016-04-23 00:38:45 +01:00
Asim d74cf95278 First for mqtt broker 2016-04-23 00:06:29 +01:00
Asim a4c05fd6ad update image 2016-04-22 10:34:32 +01:00
Asim 03b3a53407 add the image itself\! 2016-04-22 10:33:08 +01:00
Asim 7a081e5514 Add image 2016-04-22 10:32:46 +01:00
Asim Aslam f27b2b8c73 Merge pull request #74 from micro/convenience
Convenience settings for Broker, Registry, Transport and Wrappers
2016-04-19 18:56:23 +01:00
Asim 47d146daa4 That should be i-1 2016-04-19 00:47:15 +01:00
Asim d1a6126350 Convenience settings for Broker, Registry, Transport and Wrappers 2016-04-18 21:41:03 +01:00
Asim ca91a8383e Add mock server 2016-04-16 00:02:55 +01:00
Asim 089c457d6c Appending to metadata is a side effect. Let's not do that anymore. 2016-04-15 16:45:59 +01:00
Asim 0410508385 add link to blog post 2016-04-13 11:30:17 +01:00
Asim Aslam 0e93f0772a Merge pull request #73 from micro/consul_register
Don't re-register if the state hasn't changed
2016-04-10 23:07:29 +01:00
Asim e2855c4bc2 Fix some mapping issues while we're at it 2016-04-09 22:19:03 +01:00
Asim 9d7bd3f424 God damn you nil map 2016-04-09 21:34:45 +01:00
Asim b3fbd36ba7 Don't re-register if the state hasn't changed 2016-04-09 21:30:31 +01:00
Asim 7739e23401 Call it mock TestResponse 2016-04-06 18:38:33 +01:00
Asim 9d060bf6e1 Test struct works with mock client 2016-04-06 18:37:46 +01:00
Asim ac6b8b730b First stab at mock client 2016-04-06 18:33:57 +01:00
Asim bfe20d81d0 More linting fun 2016-04-06 18:03:27 +01:00
Asim 2f50c74f41 Satisfy the golint gods a little 2016-04-06 17:53:16 +01:00
Asim Aslam 5fb1051e0b Merge pull request #70 from micro/backoff
Add Backoff func option
2016-04-06 17:43:39 +01:00
Asim 7167f998ce First crack at backoff function 2016-04-05 20:04:37 +01:00
Asim 56c6993eb8 Set CallOptions as struct in Options. Can then be overridden easily during Call/Stream 2016-04-05 18:07:07 +01:00
Asim Aslam c462d7776c Merge pull request #63 from micro/encoding
Fix Consul WARN issues for tags
2016-04-05 16:14:28 +01:00
Asim Aslam de2f407e3d Merge pull request #69 from jelmersnoeck/fix-accept-return
HTTPTransport: implement queue for listener.
2016-04-01 13:39:38 +01:00
Jelmer Snoeck af0028d821 HTTPTransport: implement queue for listener.
Before this patch, when an error occurs in trying to accept a connection
from the listener, the error would be returned. This also happened on
temporary issues like `too many open files`.

Temporary issues are "self-healing" and will resolve over time. This
means that we can put the requests in a queue to wait until the issue is
resolved and start processing the connections once it is resolved.

This patch implements such mechanism, as copied from the standard
library http package. It will retry temporary errors but will return
permanent errors (or errors that are not from the net.Error type).
2016-04-01 13:10:18 +01:00
Asim Aslam ce283ab233 Merge pull request #68 from boyand/master
Avoid unsafe dereferencing
2016-04-01 09:42:17 +01:00
Boyan Dimitrov 5718ce5697 Avoid unsafe dereferencing 2016-04-01 10:28:52 +02:00
Asim 17a97e2ef1 Set ver 2016-03-29 18:32:16 +01:00
Asim cb89b2ebca update encoding test 2016-03-29 18:16:55 +01:00
Asim 61178d1b45 Update encoding to be backwards compatible. 2016-03-29 17:44:46 +01:00
Asim 844979be06 Add flags client request timeout and client retries 2016-03-29 17:18:39 +01:00
Asim 2c2edcad2f Update go versions 2016-03-23 18:34:20 +00:00
Asim 97860a0488 Fix duplicate registraton of sub handler 2016-03-22 18:02:50 +00:00
Asim f10935ad2e http bench test 2016-03-19 15:29:04 +00:00
Asim 646d80f222 That should be a listener exit 2016-03-18 19:24:44 +00:00
Asim 10a67fe7de Ugly comments, fix them 2016-03-18 19:23:44 +00:00
Asim da22d5b161 Mock transport 2016-03-18 18:41:26 +00:00
Asim dcb3fad476 Add error test 2016-03-18 11:01:55 +00:00
Asim 31f67317e9 Add apache license icon 2016-03-18 09:29:09 +00:00
Asim 0a81cb1190 unexport mock registry 2016-03-17 22:54:18 +00:00
Asim 01a642410f We don't need to export those things 2016-03-17 22:52:49 +00:00
Asim 771ff7fbff Add mock broker 2016-03-17 22:46:20 +00:00
Asim e941796234 Add encoding that does not throw warns 2016-03-16 21:23:41 +00:00
Asim 7126dc1238 Merge pull request #60 from micro/init
Strip string slice from New[Thing] for addrs
2016-03-16 10:05:57 +00:00
Asim 5a6ff655db Transport init 2016-03-15 22:25:32 +00:00
Asim f088074f29 Registry init 2016-03-15 22:20:21 +00:00
Asim 64220dc0c5 Broker init 2016-03-15 22:12:28 +00:00
Asim fe4362be5a Merge pull request #57 from micro/log
remove use of glog
2016-03-15 20:56:11 +00:00
Asim 46da892e5f Remove glog from example too 2016-03-15 20:48:09 +00:00
Asim c48f711aab Merge pull request #59 from micro/tests
Tests round 2
2016-03-14 21:56:38 +00:00
Asim 1f8003b6ac extractor tests 2016-03-14 20:09:07 +00:00
Asim 1ef58d63d4 Merge pull request #58 from micro/tests
Tests
2016-03-14 19:50:53 +00:00
Asim f8fcb74f79 broker test 2016-03-14 19:37:51 +00:00
Asim 15db053bc6 update mock tests 2016-03-14 19:15:42 +00:00
Asim bbcbd2a446 Basic metadata retrieval test 2016-03-14 18:32:08 +00:00
Asim fe1fde8c59 go 1.4 doesn't like closed connection, check we closed the listener 2016-03-14 18:20:38 +00:00
Asim 77177508ce Don't bother closing the socket 2016-03-14 17:57:49 +00:00
Asim 6028c2f9e8 Add transport comms tests 2016-03-14 17:50:18 +00:00
Asim 4da744ebde Add goreport 2016-03-14 17:50:03 +00:00
Asim ee8b3c8e52 Merge pull request #56 from micro/defaults
Add packages for the defaults
2016-03-14 15:44:14 +00:00
Asim d1eae8fabe remove use of glog 2016-03-14 11:01:10 +00:00
Asim 71764564e7 Add packages for the defaults 2016-03-14 10:45:38 +00:00
Asim c0b25e7a65 Add contributing section 2016-03-12 21:25:46 +00:00
Asim 3662cd4e49 Fix that comment 2016-03-12 00:10:40 +00:00
Asim f03afb9343 Add final comment 2016-03-12 00:07:14 +00:00
Asim ddf68ed23b Add a few more comments 2016-03-12 00:04:33 +00:00
Asim 891064931b Add a bit more commenting to the API 2016-03-11 23:58:55 +00:00
Asim 669505be4c Specifically get protoc and protoc-gen-gowq 2016-03-06 12:03:45 +00:00
Asim 52a20244d7 Merge pull request #52 from jelmersnoeck/range-tests
Implement tests for the port range.
2016-03-02 16:04:25 +00:00
Jelmer Snoeck 0cf396756c Implement tests for the port range. 2016-03-02 15:54:20 +00:00
Asim 74999eee66 Merge pull request #51 from micro/range
Internally handle server port range
2016-03-02 15:07:46 +00:00
Asim 4ef44db161 Internally handle port range 2016-03-02 14:20:28 +00:00
Asim 1adcb237d9 Only log registering if not registered 2016-02-27 22:14:25 +00:00
Asim adc24dfc51 gofmt 2016-02-27 22:13:57 +00:00
Asim ad0744a95f make the mock sliggghtly more useful 2016-02-26 00:09:06 +00:00
Asim 93b923261c Add ErrNotFound 2016-02-25 12:42:31 +00:00
Asim 1d1b26c545 Quick hack, account for nil header 2016-02-21 23:52:08 +00:00
Asim 8e61057bc9 Allow init of wrappers and name. Set server.name for rpc request 2016-02-18 18:08:43 +00:00
Asim 8cd906e75e Set TTL on first registration of http broker. Also dont resubscribe 2016-02-15 22:20:54 +00:00
Asim f4bd7f707c Extract address for broker 2016-02-15 21:57:17 +00:00
Asim 1cc32f6259 strip platform services out of readme 2016-02-14 01:22:37 +00:00
Asim c53a51c959 Update readme for consul syntax changes 2016-02-07 21:30:18 +00:00
Asim de2ee66cda update the readme 2016-02-06 13:32:01 +00:00
Asim 984a546708 Rename monitor 2016-02-03 17:20:32 +00:00
Asim 9f0dd3dc8c Add transport comment 2016-01-30 21:19:55 +00:00
Asim a53979dfed Add broker comment 2016-01-30 21:18:57 +00:00
Asim 8b9faefd92 Add metadata comment 2016-01-30 21:17:44 +00:00
Asim 0bdd3bc1b6 Add error comment 2016-01-30 21:16:45 +00:00
Asim 8edb0c4b06 Add client comment 2016-01-30 21:15:08 +00:00
Asim 146701eeaa Add some comments 2016-01-30 21:13:34 +00:00
Asim 6b7f2f3bd3 Merge pull request #45 from micro/metadata
Move context to metadata
2016-01-28 18:30:53 +00:00
Asim b9f4e17d4c Meta key change 2016-01-28 18:24:56 +00:00
Asim 1cc621e2d6 FromContext/NewContext methods 2016-01-28 18:23:24 +00:00
Asim d306559d8f Nitpick Headers to Header 2016-01-28 18:11:13 +00:00
Asim 9ae0956cea Move context to metadata 2016-01-28 17:55:28 +00:00
Asim cd9801891e Merge pull request #44 from micro/ttl
TTL for Service Registration
2016-01-27 20:25:29 +00:00
Asim dd9067ff4e Ensure the broker also expires registry entries 2016-01-27 20:17:31 +00:00
Asim 013d1de2c4 Prefer RegisterTTL set through Init 2016-01-27 12:23:18 +00:00
Asim ef1b9bfe50 Allow setting registry address, broker address and transport address without specifying registry flag 2016-01-27 01:13:31 +00:00
Asim 61094fefe8 If TTL is nil it might bail 2016-01-27 00:32:16 +00:00
Asim 7183601d3b Strip the classic aslam comments 2016-01-27 00:26:29 +00:00
Asim 47bfdbe49e Fix mock 2016-01-27 00:18:44 +00:00
Asim 55145d08a1 Use agent service for this 2016-01-27 00:15:46 +00:00
Asim 5ec9d561a6 meh 2016-01-26 23:32:27 +00:00
Asim ce0c5908a6 Update the watcher 2016-01-26 21:10:27 +00:00
Asim d1d9daa572 Merge pull request #43 from micro/node
Node
2016-01-26 20:49:30 +00:00
Asim cd13f0389f Fix this cruft 2016-01-26 20:44:29 +00:00
Asim 822cc0e5da Use ServiceID as node.ID rather than Node.... in time remove Node/Address completely 2016-01-26 20:30:05 +00:00
Asim 1cbe06413e Moving mercury example to plugins 2016-01-26 01:07:18 +00:00
Asim 51d2ce2b4f Support setting subscriber queue name 2016-01-22 21:48:43 +00:00
Asim 93ea171b31 We need the right sequence number for the stream 2016-01-21 01:03:27 +00:00
Asim 8724e68ae4 Initialise registry for broker 2016-01-20 15:22:44 +00:00
Asim a1c22ce78a Add transport tls 2016-01-18 00:10:04 +00:00
Asim a6ce435a07 If secure or tlsconfig not nil then secure 2016-01-17 00:33:07 +00:00
Asim 48798027d0 Move options over 2016-01-17 00:28:57 +00:00
Asim ae2ab911ed Access tls config 2016-01-16 23:39:47 +00:00
Asim f7c4304ac3 Don't create new options, update 2016-01-16 23:10:14 +00:00
Asim 6a44ebfd1f Add secure option. This is only really for development in the http broker 2016-01-16 23:05:11 +00:00
Asim 36e709c9f7 Fix the broker and add secure option 2016-01-16 22:13:02 +00:00
Asim 60ee085cbc Add secure option to registry 2016-01-16 20:25:18 +00:00
Asim fb25558142 Merge pull request #42 from micro/internal_handler
Add implementation for internal handlers and subscribers.
2016-01-08 15:00:53 +00:00
Asim f812613973 Add implementation for internal handlers and subscribers. They are not advertised to discovery 2016-01-08 14:02:32 +00:00
Asim db8c24a971 Merge pull request #37 from jelmersnoeck/debug-interface
Debug: use the DebugHandler interface.
2016-01-07 17:55:54 +00:00
Jelmer Snoeck 3cefc39aff Debug: use the DebugHandler interface.
Without specifying the interface, DefaultDebugHandler has to be of type
*"github.com/micro/go-micro/server/debug".debug.
2016-01-07 10:15:30 +00:00
Asim 7401c44973 This is actually a useless error 2016-01-07 01:58:38 +00:00
Asim 76918fc703 Make the debug handler an actual thing that can be set by users 2016-01-06 19:24:54 +00:00
Asim 66107fd304 Merge pull request #36 from jelmersnoeck/extendable-health-checker
DebugHandler: add default health checker.
2016-01-06 17:14:59 +00:00
Jelmer Snoeck 0d749eb732 DebugHandler: add default health checker.
By using a DefaultHealthChecker - as with a DefaultName, DefaultServer,
... - it is possible to overwrite the default implementation. This means
we can now do extra actions in our health check that is necessary for
the applications specific needs.
2016-01-06 17:05:22 +00:00
Asim 8bf72a3325 Replace map[string]string with Context for extra options. map[string]string is essentially useless. Context can store anything 2016-01-06 16:25:12 +00:00
Asim f467902304 update the example to message the naming of code generated protos 2016-01-06 12:37:35 +00:00
Asim dee9cbb763 Merge pull request #35 from micro/codec
Reworking codec interface
2016-01-06 00:50:56 +00:00
Asim ad4637d89b Lets strip out the rpcplus code 2016-01-05 21:13:20 +00:00
Asim 40cd086543 Strip some code from the client 2016-01-05 20:38:01 +00:00
Asim f6a7ef7bc0 Add examples here too 2016-01-05 00:27:58 +00:00
Asim bdab0cc18f Fuck my life, why do I even do this to myself 2016-01-04 23:27:54 +00:00
Asim 3e84c23591 Tell me what the registry is too 2016-01-04 23:27:44 +00:00
Asim 897115ed31 Fix some issues with initialisation 2016-01-04 23:07:56 +00:00
Asim 9ecbf0d71b Let me do some stuff with the global command 2016-01-04 11:25:58 +00:00
Asim 227adc490c Add broker and server to metadata 2016-01-04 01:27:05 +00:00
Asim ecdaea7a67 syntax highlight the proto 2016-01-03 23:36:14 +00:00
Asim d43d3e8efa Add transport dial timeout 2016-01-03 21:25:03 +00:00
Asim 332a229169 Add request timeout 2016-01-03 21:14:33 +00:00
Asim 1037663acf Add retries 2016-01-02 23:16:15 +00:00
Asim b11e5789fe update client 2016-01-02 23:15:57 +00:00
Asim 3df078ce4e So much to configure, this is an ugly hack 2016-01-02 22:52:59 +00:00
Asim 6bf0affc75 Example of how to use wrappers with top level service 2016-01-02 22:32:23 +00:00
Asim c4dabe2652 Merge pull request #30 from micro/micro
Experimental top level init
2016-01-02 19:22:56 +00:00
Asim 7a02bda06b Set package to micro 2016-01-02 19:14:56 +00:00
Asim 3b56a62589 Update the way flags are used 2016-01-02 19:12:17 +00:00
Asim 1f1bc27421 Make command internal 2016-01-02 00:38:57 +00:00
Asim 59a667130c Update help printer 2016-01-01 02:45:15 +00:00
Asim 9e7e8742b4 Don't need server flag 2016-01-01 02:36:47 +00:00
Asim 210b810096 Fix the selectors 2016-01-01 01:29:40 +00:00
Asim 0d50b2eb32 Update top level init 2016-01-01 01:16:21 +00:00
Asim d705d3fe50 Merge branch 'master' into micro 2015-12-31 18:56:05 +00:00
Asim 851b62c904 Merge pull request #34 from micro/options
Public Options so people can actually implement the interfaces
2015-12-31 18:19:12 +00:00
Asim 191e835aa9 Add extra options to be used by others that need them 2015-12-31 18:14:40 +00:00
Asim 64b45f7846 Update options to be public. This means people can implement the interfaces and actually use the options 2015-12-31 18:11:46 +00:00
Asim c2154fd5cc Remove the ping 2015-12-31 18:11:26 +00:00
Asim 24e6840ea4 Merge branch 'master' into micro 2015-12-30 21:27:04 +00:00
Asim bffd55f500 Channel rather than mutex to check is closed 2015-12-28 19:11:10 +00:00
Asim 10d2ad0de9 remove the print statements 2015-12-27 01:51:52 +00:00
Asim d0b2b612f3 Fix http broker to allow multiple nodes for subscription, total hack 2015-12-27 01:17:53 +00:00
Asim 3dd911fb33 Stop recursive loop where its a recursive type 2015-12-25 01:06:51 +00:00
Asim 4f15d823c9 go fmt 2015-12-25 01:06:32 +00:00
Asim 34947f1be7 Merge pull request #32 from micro/broker
Update the broker interface to support acking and queue distribution
2015-12-24 20:03:24 +00:00
Asim a941ff8fdb Blurgh compilation issues with main redeclared many times 2015-12-24 19:56:40 +00:00
Asim 6ac36e1cf6 Fix build 2015-12-24 19:52:27 +00:00
Asim 74714876f2 Add producer/consumer example with use of queue name for distribution of messages 2015-12-24 19:39:37 +00:00
Asim 8f3f0ed4b6 Merge pull request #33 from iheitlager/master
Reverse the ping option
2015-12-24 11:48:17 +00:00
Asim c3e9ba6b85 Allow setting of actions 2015-12-23 22:45:40 +00:00
Asim 1da6de05ee Fix server panic 2015-12-23 22:45:32 +00:00
Ilja Heitlager d747e9b435 Reverse the ping option 2015-12-23 21:43:49 +01:00
Asim 5e1a618415 Screw num handlers, this adds complexity for concurrency which we dont need 2015-12-23 20:26:13 +00:00
Asim 6097c3296c Shared queue distribution of messages 2015-12-23 20:05:47 +00:00
Asim 536216fd01 Fix the rest of the code 2015-12-23 19:16:55 +00:00
Asim 02aca819d7 Update the broker interface 2015-12-23 19:07:26 +00:00
Asim 651e9f8836 rename wrap 2015-12-23 00:02:42 +00:00
Asim 6226a80e78 Print stack when panic 2015-12-21 17:18:04 +00:00
Asim 0072b6e8f2 actually wait on the signal 2015-12-21 01:41:36 +00:00
Asim 4f1a1c6783 add ability to set the options 2015-12-21 01:13:29 +00:00
Asim 45dcffcaaf Remove default service 2015-12-21 01:12:29 +00:00
Asim cc720dd125 update the comment 2015-12-20 23:52:58 +00:00
Asim 2c983ef021 Experimental top level init 2015-12-20 23:50:16 +00:00
Asim b9898ef45f Add server side codegen example 2015-12-19 23:38:46 +00:00
Asim be43d827c7 Add String method to all interfaces 2015-12-19 21:56:14 +00:00
Asim d7b3765c71 Allow setting of timeout for registry 2015-12-19 18:28:08 +00:00
Asim 539b3d045c Merge pull request #29 from micro/stream
Stream
2015-12-19 17:48:02 +00:00
Asim 24d56f0035 Update comments in client 2015-12-19 16:54:47 +00:00
Asim 310a84d059 udpate the examples 2015-12-18 21:51:51 +00:00
Asim 3b295b16e7 Working bidirectional streaming example 2015-12-18 20:28:50 +00:00
Asim a5be9ca585 switchup init 2015-12-18 01:21:56 +00:00
Asim 4cba0c57ab Checkpoint the world 2015-12-18 01:01:59 +00:00
Asim 6ae48c9f29 checkpoint 2015-12-17 20:37:35 +00:00
Asim c73a88e801 Merge pull request #28 from micro/mercury
Mercury
2015-12-16 10:42:35 +00:00
Asim 1e9b615907 update so builds in travis ci 2015-12-16 02:23:22 +00:00
Asim b5903de1aa Update readme 2015-12-16 02:20:26 +00:00
Asim be567a9a2b add mercury example 2015-12-16 02:15:20 +00:00
Asim ba3b056e76 add headers 2015-12-16 02:15:09 +00:00
Asim 271b827aa9 add changes for mercury 2015-12-16 01:18:05 +00:00
Asim ed75f84584 add json tags to registry service 2015-12-15 21:02:43 +00:00
Asim 8cfad5db33 Update 2015-12-09 21:41:55 +00:00
Asim 46687746a4 Travis integration 2015-12-09 19:59:52 +00:00
Asim b4e319ee65 Merge pull request #25 from micro/selector
Add selector interface and implementation
2015-12-09 19:55:11 +00:00
Asim 76307188cd update readme 2015-12-09 19:48:20 +00:00
Asim 8e2dbb8997 Initialise the command stuff 2015-12-09 19:38:50 +00:00
Asim 2753520ee4 Add command option 2015-12-09 19:32:10 +00:00
Asim eefb9c53d4 Move to a selector package 2015-12-09 19:23:16 +00:00
Asim 91405e5993 Add DC selector example 2015-12-09 15:14:10 +00:00
Asim 066c169845 Add example dc filter 2015-12-09 15:06:31 +00:00
Asim a2c862dd21 Add service random 2015-12-09 12:44:38 +00:00
Asim 29ee9e2753 Add error checking 2015-12-09 12:44:28 +00:00
Asim 46905347bb unblack list when err is nil 2015-12-09 02:42:02 +00:00
Asim f59787a906 add blacklist selector 2015-12-09 02:31:17 +00:00
Asim 1126050b37 remove node selector test from client 2015-12-09 00:21:24 +00:00
Asim e83bc43dfa Fix failing test 2015-12-09 00:18:06 +00:00
Asim 9072a944e2 Add selector code 2015-12-09 00:02:45 +00:00
Asim c00931a0b1 Update wrapper comment 2015-12-08 19:37:27 +00:00
Asim 02985c35d5 Add call and publish options 2015-12-08 19:25:42 +00:00
Asim 3d279ffcfd Select is a better method 2015-12-08 00:11:51 +00:00
Asim 727bba15b8 fix the test 2015-12-08 00:08:23 +00:00
Asim 6ef3b81a18 move this cruft 2015-12-08 00:08:17 +00:00
Asim 140febb081 Switch up the selector so it actually allows you to inform it how the node performed 2015-12-07 23:56:17 +00:00
Asim 4e6b9347d9 Add the notion of a node selector for routing 2015-12-07 21:09:10 +00:00
Asim 050fa26afb Gotta rejig the proto generator to move this 2015-12-07 16:12:59 +00:00
Asim dd73c1f0ac support slices in extractor, longer term need to look at all types 2015-12-07 16:12:46 +00:00
Asim 2f02119e21 Update the code generator initialisation 2015-12-06 22:44:17 +00:00
Asim 15d5299997 Add a ping function 2015-12-05 19:25:36 +00:00
Asim 011a3dc9e3 Add watcher comments 2015-12-05 02:05:06 +00:00
Asim 0b08f15010 gofmt 2015-12-05 01:13:13 +00:00
Asim d4f3a6070c Update the watch interface 2015-12-05 01:12:29 +00:00
Asim cc6555927d This should say rpc 2015-12-03 11:07:31 +00:00
Asim 645f12ff3f fix table 2015-12-03 01:28:20 +00:00
Asim b4011b32af fix table 2015-12-03 01:27:56 +00:00
Asim 11bc02112b fix table 2015-12-03 01:26:57 +00:00
Asim 1d7e2d8bec update readme 2015-12-03 01:25:25 +00:00
Asim 919bfed0c1 add comments 2015-12-03 01:05:16 +00:00
Asim 9e3f3bbc0e update comments 2015-12-03 01:02:14 +00:00
Asim 20114ccd87 move the comment 2015-12-03 00:59:32 +00:00
Asim a69811fc72 Fix the sub extractor 2015-12-03 00:49:58 +00:00
Asim 003c2d848e Its a hello proto 2015-12-02 23:19:59 +00:00
Asim 3be0672b82 package comment 2015-12-02 23:09:48 +00:00
Asim bc34008b65 fix that 2015-12-02 23:06:49 +00:00
Asim 76861edb88 Add readme 2015-12-02 23:05:52 +00:00
Asim 00d95203ba Add code generation example 2015-12-02 22:44:01 +00:00
Asim ab650630ce Merge pull request #24 from micro/server_wrapper
Experimental server side wrappers for handlers
2015-12-02 21:20:01 +00:00
Asim 9c17e64ef1 add comments for wrappers 2015-12-02 21:16:44 +00:00
Asim 5e364693ee Rename to hdlrWrappers for symmetry sake 2015-12-02 21:12:09 +00:00
Asim 96d7975052 make it clear that it flags streaming response 2015-12-02 21:02:46 +00:00
Asim a695e10d21 Send Request and Publication types 2015-12-02 20:56:50 +00:00
Asim 4b18b779aa Update to use actual values passed through the chain 2015-12-02 20:11:00 +00:00
Asim ef8303f11f add server publication wrapper example 2015-12-02 20:00:06 +00:00
Asim eef155490e Setup subscription wrappers 2015-12-02 19:56:57 +00:00
Asim cfa676af19 Only support single signature for subscriber and validate 2015-12-02 17:42:14 +00:00
Asim b1511ed813 Update wrapper and examples 2015-12-02 11:54:36 +00:00
Asim c5a08d3159 Some nitpicking 2015-12-02 01:38:56 +00:00
Asim 7a870dfbb1 Strip named registration 2015-12-02 01:18:32 +00:00
Asim dae745f30f Experimental server side wrappers for handlers 2015-12-02 00:47:52 +00:00
Asim 0c9f8411bb Pull rpcplus in local for the time being. We need to modify it for server side middleware 2015-12-01 23:32:23 +00:00
Asim 8825b5c0a8 rename debug handler 2015-12-01 19:13:48 +00:00
Asim bf01feb2e3 Fix comment for godoc 2015-12-01 18:45:52 +00:00
Asim d02986d1bd Add some comments 2015-12-01 18:41:43 +00:00
Asim 6ca2cbadfc rename client wrapper file 2015-12-01 17:37:41 +00:00
Asim 971c309ffa Rename the codec files to match directory and package 2015-11-30 18:46:40 +00:00
Asim 9952b42f2f update 2015-11-29 20:46:31 +00:00
Asim 0113304a13 fix typo 2015-11-29 20:45:43 +00:00
Asim 89719ba292 update readme 2015-11-29 20:45:11 +00:00
Asim 335bb66797 Reduce verbosity of the codec interface 2015-11-28 20:09:07 +00:00
Asim 6177bc2313 Don't loop the example forever 2015-11-28 20:08:41 +00:00
Asim 69ee0e4738 Merge pull request #22 from micro/codec
Codec
2015-11-28 19:44:50 +00:00
Asim dddcdc34ed rename to protorpc and jsonrpc 2015-11-28 18:54:38 +00:00
Asim 80f53ab176 Add json codec 2015-11-28 18:40:32 +00:00
Asim 609a59d3ab add local envelope 2015-11-28 16:39:25 +00:00
Asim c68984eccc log any stream close error 2015-11-28 16:34:48 +00:00
Asim 5488904404 Fix a data race issue with the buffer 2015-11-28 16:34:27 +00:00
Asim 654728027b Updated codec interface and code. Painful stuff 2015-11-28 11:22:29 +00:00
Asim f49922f6b3 experimental codec branch 2015-11-27 00:17:36 +00:00
Asim dc5f121c64 Fix the breaking build 2015-11-26 20:43:33 +00:00
Asim fb172df0ce Add wrapper implementation 2015-11-26 20:36:42 +00:00
Asim 4fa909a3c7 don't just overwrite the context metadata, append if already exists 2015-11-26 20:35:50 +00:00
Asim bcff71167c Remove unused roundtripper code 2015-11-26 16:51:39 +00:00
Asim 8ab77fc3d7 Comments for options 2015-11-26 12:51:53 +00:00
Asim 54b0be8d7e Update client comment 2015-11-26 12:23:42 +00:00
Asim ad6e8194ed Add client comments 2015-11-26 12:21:00 +00:00
Asim 24b8cd3d97 more comments 2015-11-26 00:23:36 +00:00
Asim bb360d5f2c add comment 2015-11-26 00:18:39 +00:00
Asim c4d8701d68 add comment 2015-11-26 00:17:05 +00:00
Asim 96955dbd53 add comments 2015-11-26 00:13:17 +00:00
Asim 40fea1ac24 nitpick ordering 2015-11-25 20:22:49 +00:00
Asim 12a1e1eeda Add pluggable codec support 2015-11-25 19:50:05 +00:00
Asim 04e07f4b39 Move plugins to go-plugins 2015-11-25 00:17:15 +00:00
Asim 469b12ecea Temporary stop gap for panicking server handlers 2015-11-24 00:52:59 +00:00
Asim 5d88115f2a update links from myodc to micro 2015-11-20 16:17:33 +00:00
Asim 9b23729eac add default port where none is specified 2015-11-16 12:11:03 +00:00
Asim fa3b66a5dd Merge pull request #18 from myodc/advertise
add advertising option
2015-11-11 19:18:00 +00:00
Asim 2041591033 add advertising option 2015-11-11 18:22:04 +00:00
Asim ec1601e2b3 add transport to the table 2015-11-11 15:05:18 +00:00
Asim 72fd498219 Merge pull request #17 from crackcomm/patch-1
Table godoc links
2015-11-11 09:48:35 +00:00
Łukasz Kurowski 3eb8d5515c Table godoc links
just useful
2015-11-11 03:04:17 +01:00
Asim c53880e24a Add table 2015-11-11 00:45:02 +00:00
Asim 3cf90d7825 Use direct reply queue 2015-11-08 23:16:14 +00:00
Asim 55ef1d4903 update readme blurbs 2015-11-08 11:12:09 +00:00
Asim 0320fc1b55 Update registry so version is surfaced 2015-11-08 01:48:48 +00:00
Asim 4e6d1df9ea Add extractor test 2015-11-05 12:39:08 +00:00
Asim 175efe7fb7 add invite link 2015-11-05 00:45:15 +00:00
Asim abbf163ab0 Add community links 2015-11-05 00:27:21 +00:00
Asim 0dbe14ad22 Extract private ip for registration when 0.0.0.0 is specified as bind address 2015-11-04 21:53:39 +00:00
Asim e00a57bb12 go fmt 2015-11-04 21:53:06 +00:00
Asim 42c0c91df7 Remove package 2015-10-27 19:09:08 +00:00
Asim 3302fab644 Move kubernetes registry to myodc/go-plugins because god damnit stop breaking you.... 2015-10-27 19:08:45 +00:00
Asim Aslam 4fad84f6c7 remove duplicate doc reference 2015-10-27 14:39:01 +00:00
Asim Aslam cf5601c300 update readme to include godoc and travis links 2015-10-27 14:22:44 +00:00
Asim Aslam 4bd529f523 Add travis file 2015-10-27 14:13:32 +00:00
Asim d9ae100524 Fix registry address usage 2015-10-26 20:23:57 +00:00
Asim 5e598d8ef0 Fix leaking go routine issue 2015-10-22 15:14:56 +01:00
Asim 9697dc503c Reset the buffer on close 2015-10-22 14:21:57 +01:00
Asim b1b316df77 Fix connection leak 2015-10-22 10:33:33 +01:00
Asim e2b849da29 Fix breaking build 2015-10-20 18:03:39 +01:00
Asim 975c6d4148 add kubernetes registry back since its being used... 2015-10-18 12:12:41 +01:00
Asim c961ef315e Update usage 2015-10-18 11:51:29 +01:00
Asim 1b1aa4915e Remove kubernetes registry. Add v1 of in memory registry using memberlist 2015-10-18 00:01:43 +01:00
Asim 6b8855a337 Fix client rpc codec 2015-10-16 11:15:17 +01:00
Asim 0adc0e3c00 Fix rpc codec issue stopping json requests from working 2015-10-15 22:06:43 +01:00
Asim 6ab6e9725d Add endpoints in etcd 2015-10-11 16:41:55 +01:00
Asim 763608854b Update subscriber name 2015-10-11 12:12:41 +01:00
Asim fcbd2acdde add endpoint data for consul registry 2015-10-11 12:05:20 +01:00
Asim ac995ba983 update etcd registry to use github.com/coreos/etcd/client 2015-09-26 17:09:03 +01:00
Asim 8b2ffc40d2 Fix screwed flag parsing 2015-08-30 21:22:35 +01:00
Asim b94c5d4026 Semi working solution for glog flags 2015-08-30 02:24:16 +01:00
Asim 558b060130 Change uuid library 2015-08-26 12:15:37 +01:00
Asim e89f31730b Fix imports 2015-08-26 12:10:10 +01:00
Asim 113cc8a9cb Remove service id so nodes are also removed from catalog 2015-08-15 23:03:50 +01:00
Asim b91af916f9 Add pub/sub to client/server and make broker more low level 2015-06-12 19:52:27 +01:00
Asim cdf2f2cbcd Change receiver to handler, breaking change, grrr 2015-06-03 01:25:37 +01:00
Asim 8cdc2b5f82 Not a todo 2015-06-01 18:55:53 +01:00
Asim 09c784d294 add support for streaming requests. cleanup watcher initilisation 2015-06-01 18:55:27 +01:00
Asim fa2c27b64f PortalIP no longer exists 2015-05-29 09:58:49 +01:00
Asim 5cc97151fc Add rabbitmq broker 2015-05-28 13:33:04 +01:00
Asim d23e46df3a Add basic etcd registry implementation 2015-05-27 22:22:02 +01:00
Asim bf3f55c5c0 Update readme 2015-05-26 22:42:41 +01:00
Asim 36b5ca46fe Change initialisation and add metadata 2015-05-26 22:39:48 +01:00
Asim 7aa2c82ced Service and node should be structs rather than interface 2015-05-25 22:14:28 +01:00
Asim d4a7deb594 move proto/health to server since its only relevant to that 2015-05-25 18:57:05 +01:00
Asim 5516f7ea1f Cleanup and move template 2015-05-25 18:16:42 +01:00
Asim 94dee7a459 update readme 2015-05-25 17:21:02 +01:00
Asim 23264dded0 Delete store, this is not a core requirement of microservices, will be included in go-platform 2015-05-25 17:19:13 +01:00
Asim 54ad8f253f Update readme 2015-05-23 23:51:31 +01:00
Asim 32928bfb67 Publish/Subscribe with context 2015-05-23 23:16:26 +01:00
Asim b5dcbbe998 Use concrete Item rather than an interface. Removes unnecessary dupe structs 2015-05-23 21:25:55 +01:00
Asim 74fd1fc989 Restructure go-micro layout and plugins 2015-05-23 20:04:16 +01:00
Asim 018183fa49 bail if you cant connect 2015-05-23 17:55:08 +01:00
Asim e192f335da Dont expose rpc client/server 2015-05-23 17:40:53 +01:00
Asim 3d8dd6e121 remove blank line 2015-05-23 16:24:52 +01:00
Asim 8948465b0c fix initialisation 2015-05-23 13:13:55 +01:00
Asim e6d63d9ff0 update readme output 2015-05-23 12:22:23 +01:00
Asim 3db51216b2 Rework use of context 2015-05-23 11:53:40 +01:00
Asim d67c1ba111 Fix health checker 2015-05-21 23:06:01 +01:00
Asim c9df1cf7d2 use send/recv semantics 2015-05-21 21:08:19 +01:00
Asim 4f909d0be4 Declare option not options 2015-05-21 19:28:57 +01:00
Asim 9d514f0e60 further transport rework 2015-05-21 19:24:57 +01:00
Asim b555109fbb Merge branch 'master' into transport 2015-05-21 01:00:26 +01:00
Asim 56c605a051 Merge pull request #8 from st3v/fix_cli_help_printer
Fix function signature for cli.HelpPrinter
2015-05-21 00:11:48 +01:00
Stev Witzel 0bdd0bf9c1 Fix function signature for cli.HelpPrinter
Necessary due to github.com/codegangsta/cli/commit/e8425
2015-05-20 23:41:44 +01:00
Asim 50e44726f5 transport cruft 2015-05-20 22:57:19 +01:00
Asim 4b51a55993 Update readme 2015-05-17 23:04:19 +01:00
Asim 0e7bd77f4c Allow configurable addresses for everything 2015-05-16 00:34:02 +01:00
Asim c77be7c571 Add grpc client and example 2015-05-16 00:33:43 +01:00
Asim e7355eaeb5 update example to use proto3 2015-05-09 00:42:07 +01:00
Asim 45a619c2c6 Fixup import paths 2015-05-05 19:05:06 +01:00
Asim 480165695c Switch to codegangsta/cli to be inline with micro 2015-04-27 22:21:56 +01:00
Asim 8bc2473989 Add pub sub example 2015-04-26 20:45:46 +01:00
Asim d99180ea37 Add broker package for message queue support. Include http and nats 2015-04-26 19:33:35 +01:00
Asim 52f140da5f Add support for listing services, very rough 2015-04-03 00:52:49 +02:00
Asim f2daa02256 Fix kubernetes compile issues 2015-04-03 00:30:18 +02:00
Asim c7e114fa19 Update README.md 2015-04-02 21:47:21 +02:00
Asim 5372f3a009 In memory store. Should have been here from the beginning. 2015-03-06 19:08:55 +00:00
Asim 87e2edbeb5 Allow setting of etcd store via flags 2015-03-06 18:59:24 +00:00
Asim Aslam de8ab21149 Add apache license 2015-02-27 09:38:47 +00:00
Asim 606255a7f3 Remove flags from server package. Create cmd package to parse flags and cli usage 2015-02-14 23:33:21 +00:00
Asim 4b494966fb Add consul watcher 2015-02-14 23:00:47 +00:00
Asim ed84c97a17 Update README.md 2015-02-14 17:34:35 +00:00
Asim b9e50324cb Add watcher and cache for kubernetes registry 2015-02-07 23:15:35 +00:00
Asim 9fb4385f6e Add etcd store 2015-02-07 20:12:57 +00:00
Asim 9af9140121 Update README.md 2015-02-02 18:53:16 +00:00
Asim 2aee2ce18d Merge pull request #5 from crackcomm/master
Move from seelog to glog
2015-01-31 16:12:23 +00:00
Łukasz Kurowski 323dfbc818 Move from seelog to glog 2015-01-31 16:49:21 +01:00
Asim 1ec39571a8 Merge pull request #4 from crackcomm/master
Fixes nil pointer dereference error
2015-01-30 17:34:30 +00:00
Łukasz Kurowski 35fd6796b1 Fixes nil pointer dereference error
Cannot unmarshal into nil struct
2015-01-30 16:03:17 +01:00
Asim 4a4bdcb83b Update the api in store package, github.com/armon/consul-api is deprecated 2015-01-19 20:05:00 +00:00
Asim 0e73a84857 github.com/armon/consul-api was deprecated, use official api 2015-01-19 19:37:28 +00:00
Asim Aslam 1f0f393d32 update compiled proto 2015-01-14 10:50:54 +00:00
Asim Aslam 2e64897c27 Update readme with example 2015-01-14 10:50:43 +00:00
Asim Aslam 109b7e5f7e update readme 2015-01-14 08:38:39 +00:00
Asim 5c219fb961 Rename readme 2015-01-13 23:32:11 +00:00
Asim 8e55cde513 First 2015-01-13 23:31:27 +00:00
154 changed files with 1171 additions and 9063 deletions
+21 -33
View File
@@ -1,41 +1,29 @@
# Priorities
The ranked work queue for the autonomous improvement loop. The **planner** owns
this file: each run it turns the [roadmap](../../ROADMAP.md) plus an internal scan
into a single ordered list — highest-value first — each item linked to a tracking
issue. The **builder** works the top item whose issue is still open. So the
planner decides *what*, the builder *builds* it.
The ranked work queue for the autonomous improvement loop. The
**architecture-review** pass (the *architect*) owns this file: each run it turns
the [roadmap](../../ROADMAP.md) plus an internal scan (gaps in the
services → agents → workflows lifecycle, API coherence, drift, tech debt, test and
DX friction) into a single ordered list — highest-value first — and links each
item to a tracking issue. The hourly **continuous-improvement** pass works the
**top item whose issue is still open**. So the architect decides *what*, and the
increment loop *builds* it.
**Bias to capability, not busy-work.** The top of this queue is net-new capability
from the roadmap's *Now/Next* items. Hardening/conformance/DX polish is background
work (roadmap *Ongoing*) — kept low here and capped, never allowed to crowd out
capability. If an area has had several increments with no user-visible gain, it is done
for now; rank real-headroom capability instead.
**Reading / editing.** An item is done when its linked issue closes (the increment
that builds it adds `Closes #<issue>`). Roadmap phase (Now → Next → Later) is the
primary ordering; internal findings are interleaved by value, not kept in a
separate list. The human can reorder this list — or the issues — at any time to
redirect the loop; direction always wins.
**Reading / editing.** An item is done when its linked issue closes (the PR that
builds it adds `Closes #<issue>`). The human can reorder this list or the issues at
any time — direction always wins.
**Off-limits to the loop** (planner proposes as notes, never auto-merged queue
items): brand/positioning copy, breaking public-API changes, architectural
rewrites.
**Off-limits to the loop** (the architect proposes these as notes, never as queue
items the loop can auto-merge): brand/positioning copy, breaking public-API
changes, architectural rewrites. Those go to the human.
## Work queue (ranked)
### Capability the headline (roadmap: Now / Next)
1. **Prevent duplicate delegated notifications in plan-delegate harness** ([#4245](https://github.com/micro/go-micro/issues/4245)) — Now-phase safety is the current red edge after the AtlasCloud 400 fallback shipped: the services → agents → workflows loop must not repeat delegated side effects while recovering or continuing a plan. Make the plan-delegate path idempotent and CI-verifiable before adding more depth.
2. **Make AtlasCloud guarded delegation pass reliably** ([#4244](https://github.com/micro/go-micro/issues/4244)) — keep cross-provider conformance close behind the side-effect fix: AtlasCloud now gets past the Minimax request-shape 400s, but the live agent harness still misses the required guarded delegate within the retry budget.
3. **Link examples wayfinding from website getting-started path** ([#4241](https://github.com/micro/go-micro/issues/4241)) — keep adoption weighted with hardening after the examples index shipped: the repo README and CLI now point at the first-agent/0→hero map, but go-micro.dev getting-started and quickstart pages should expose the same path with a CI-guarded docs smoke check.
1. **A2A external-client conformance** ([#4815](https://github.com/micro/go-micro/issues/4815)) — make the gateway easier for non-go-micro agents to discover and stream from by serving the well-known agent card path and spec SSE events.
2. **AP2 mandate foundation for agent payments** ([#4841](https://github.com/micro/go-micro/issues/4841)) — add opt-in checkout/payment mandate signing and verification so A2A-carried payment authority can settle over x402 without changing defaults.
3. **Kubernetes CRD reconciler foundation** ([#4842](https://github.com/micro/go-micro/issues/4842)) — turn the shipped alpha `Agent`, `Service`, and `Flow` CRDs into a minimally runnable native deployment path with workload reconciliation and status conditions.
### In flight — do not re-queue
_None right now._
### Background — hardening & DX (roadmap: Ongoing; capped)
_Background hardening is intentionally empty right now. Recent work covered first-agent
wayfinding, plan/delegate recovery, provider fallback repair, streaming, memory
compaction, retry controls, provider-failure inspection, x402 buyer safety, gRPC-reflection MCP,
MCP result conformance, and the alpha Kubernetes CRD surface. Further churn in those
areas should be marked `needs-human` unless it unlocks a clear user-visible capability._
_Seeded by Claude Code from the roadmap + open issues; thereafter maintained by the
architecture-review pass._
+4 -8
View File
@@ -7,14 +7,10 @@ Act as the architect — the founder lens — for go-micro, running continuously
(1) TRACK STATE — scan recently merged PRs and open `codex` PRs/issues to see what shipped and what is being built right now, so the queue reflects reality (drop done items, don't re-queue in-flight work).
(2) ASSESS against the North Star in `.github/loop/NORTH_STAR.md` — lead with its Mission (*make building an agent as easy as building a service, on one runtime*) and re-derive alignment from the CANON: the blog under `internal/website/blog`, the `README`, and the website (read these, don't rely on the North Star alone), then `ROADMAP.md` (Now → Next → Later). Judge every priority against the mission: does it make the services → agents → workflows lifecycle simpler, more cohesive, and more operable? Weight real user-facing capability and the developer on-ramp; do not let the queue fill with internal depth work. Look at coherence and seams across the core packages (agent, ai, flow, gateway/mcp, gateway/a2a, model, server, store, registry) and the dev inner loop (scaffold → run → chat → inspect → deploy).
(2) ASSESS against the North Star in `.github/loop/NORTH_STAR.md` — lead with its Mission (*make building an agent as easy as building a service, on one runtime*) and re-derive alignment from the CANON: the blog under `internal/website/blog`, the `README`, and the website (read these, don't rely on the North Star alone), then `ROADMAP.md` (Now → Next → Later). Judge every priority against the mission: does it make the services → agents → workflows lifecycle simpler, more cohesive, and more operable? CURRENT GOAL — developer adoption: weight the on-ramp (walkable first-agent tutorial, discoverable examples, docs wayfinding, install friction, debugging, 0→1 and 0→hero) at least as highly as internal hardening; do not let the queue fill entirely with internal depth work. Look at coherence and seams across the core packages (agent, ai, flow, gateway/mcp, gateway/a2a, model, server, store, registry) and the dev inner loop (scaffold → run → chat → inspect → deploy). Flag drift in either direction: work drifting from the mission, or the North Star/website drifting from the lived story in the blog.
AVOID DIMINISHING-RETURNS CHURN — this is the most important judgment you make. Before ranking anything, ask: *would a real user notice this, or is it the loop grooming itself?* Do NOT queue: another regression-guard/breadcrumb/"verify the docs stay linked" test around docs the loop already wrote; the Nth robustness workaround for a weak provider's malformed output (e.g. AtlasCloud text-tool-call repair) once the agent already tolerates that class; another variation of a subsystem that has been hardened several times recently (e.g. plan/delegate notify/side-effect edge cases). If an area has had several increments with no user-visible gain, it is DONE for now — mark further work there `needs-human` and rank something with real headroom instead (new capability in gateway/flow/model/store, interop depth, observability). A full queue is not the goal; a queue of things that matter is.
(3) MAINTAIN THE QUEUE in `.github/loop/PRIORITIES.md` — a SINGLE ordered list, highest-value first, each item linking a scoped, CI-verifiable issue (#N); roadmap phase is the primary ordering, internal findings (cohesion gaps, DX friction, missing pieces) interleaved by value. For any prioritized gap with no issue, file one: `gh issue create --label codex --label enhancement --title "<scoped task>" --body "<goal, scope, acceptance criteria>"`.
(3) MAINTAIN THE QUEUE in `.github/loop/PRIORITIES.md` — a SINGLE ordered list, highest-value first, each item linking a scoped, CI-verifiable issue (#N). For any prioritized gap with no issue, file one: `gh issue create --label codex --label enhancement --title "<scoped task>" --body "<goal, scope, acceptance criteria>"`.
OUTPUT: post a concise assessment as a comment on this issue (#__ISSUE__) — what shipped, what's in flight, the top risks/gaps, and the reasoning behind the ranking. If the ranking actually changed, open ONE PR for `.github/loop/PRIORITIES.md`: `git switch -c codex/planner-__ISSUE__`, `git push -u origin codex/planner-__ISSUE__`, `gh pr create --base master --label codex --title "<title>" --body "<summary, Closes #__ISSUE__>"`, then `gh pr merge --squash --auto --delete-branch`. If the queue is already accurate, just close this issue (`gh issue close __ISSUE__`).
OUTPUT — default to NOT committing. Post a concise assessment as a comment on this issue (#__ISSUE__): what shipped, what's in flight, the top real gaps, and — honestly — whether the recent increments have been high-value or busy-work. Then, in almost all cases, just close this issue (`gh issue close __ISSUE__`) with NO PR.
Open a PR for `.github/loop/PRIORITIES.md` ONLY when the change is MATERIAL — meaning it changes what the builder builds next: (a) the top open item changes, (b) an item is added or removed, or (c) a top item's issue closed and must be dropped. Do NOT open a PR to reorder items below the top, reword descriptions, refresh notes, or "keep it current" — a re-rank that doesn't change the next build is not worth a commit, and this churn is the loop's single biggest waste. When a PR IS warranted: `git switch -c codex/planner-__ISSUE__`, `git push -u origin codex/planner-__ISSUE__`, `gh pr create --base master --label codex --title "<title>" --body "<summary, Closes #__ISSUE__>"`, then `gh pr merge --squash --auto --delete-branch`.
Do NOT make breaking public-API or architectural changes yourself — surface those in the assessment as notes for the human. Open the PR yourself from the shell with `gh`; do not use the make_pr tool (it is a no-op stub).
Do NOT make breaking public-API or architectural changes yourself — surface those in the assessment as notes for the human, never as auto-merged changes. Open the PR yourself from the shell with `gh`; do not use the make_pr tool (it is a no-op stub).
+4 -9
View File
@@ -3,17 +3,12 @@ The TRIAGE prompt — go-micro's CI-failure feedback path. Editable policy; the
workflow prepends the agent @mention and substitutes __ISSUE__ (this tracking
issue) and __RUNURL__ (the failed run) before posting. Keep both literal.
-->
Triage the failed CI run at __RUNURL__. It may be the linter (Lint), the unit/integration tests (Run Tests), the vulnerability gate (govulncheck), or the provider-conformance harness (Harness (E2E)).
Triage the failed CI run at __RUNURL__. It may be the linter (Lint), the unit/integration tests (Run Tests), or the provider-conformance harness (Harness (E2E)).
Read the logs and root-cause each distinct failure. DEDUPE hard against open AND recently-closed issues — if a failure matches an existing or recurring one, comment "recurred" on that issue rather than filing a new one.
Read the logs and root-cause each distinct failure. DEDUPE against open issues — if a failure matches an existing issue, comment "recurred" there instead of filing a duplicate.
WHAT TO FILE:
- **Lint, Run Tests, or govulncheck failing on master** — a real regression. File a scoped issue (`gh issue create --label codex --label enhancement --title "<scoped fix>" --body "<root cause, where, acceptance>"`) so it is fixed promptly.
- **A genuinely NEW, distinct provider-conformance defect** — file it.
For each genuine, self-contained defect, file a scoped issue (`gh issue create --label codex --label enhancement --title "<scoped fix>" --body "<root cause, where, acceptance criteria>"`) so the increment loop builds it and the next CI/harness run verifies it. A lint or test failure on master is a real regression — file it so it is fixed promptly; do NOT ignore it.
WHAT NOT TO FILE (this cap matters):
- **Another instance of a class the agent already tolerates** — a weak provider (e.g. AtlasCloud) emitting malformed / text-rendered / partial tool calls, or another plan/delegate notify/side-effect edge case. These have been hardened repeatedly with diminishing returns. Do NOT auto-file yet another routine robustness patch. Comment "recurred — repeated class, capped" on the nearest existing issue and, if it seems genuinely worth more investment, label it `needs-human` for a human to decide. The loop should not keep chasing one weak provider's output shape.
- **Transient flakes** — live-model latency, provider outages, rate limits, network timeouts with no code cause. Ignore.
- **Anything needing a breaking or architectural change** — label `needs-human` and describe it.
IGNORE only genuine transient flakes — live-model latency, provider outages, rate limits, network timeouts with no code cause (mostly relevant to the harness). Anything needing a breaking or architectural change: file it as `needs-human` and describe it, rather than auto-queuing it as a routine fix.
Close this issue (`gh issue close __ISSUE__`) when triage is done. Open any PR yourself from the shell with `gh`; do not use the make_pr tool.
-65
View File
@@ -1,65 +0,0 @@
name: govulncheck
# Deterministic vulnerability gate: runs govulncheck (reachability-aware CVE
# scanner) on every push/PR. Fails on any reachable vulnerability EXCEPT the
# explicit ALLOWLIST of known-unfixable ones, so a new vuln breaks the build
# while tracked, no-upstream-fix ones don't. This is the gate the loop's
# `security` role sits on top of — the role audits; this blocks known CVEs.
#
# Make this a required status check on the default branch to enforce it.
on:
push:
branches: ["**"]
pull_request:
branches: ["**"]
permissions:
contents: read
jobs:
govulncheck:
name: govulncheck
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: "1.25"
check-latest: true
- name: Install govulncheck
run: go install golang.org/x/vuln/cmd/govulncheck@latest
- name: Scan
env:
# Reachable vulnerabilities with NO upstream fix, accepted for now and
# tracked for remediation. Remove an ID the moment its fix lands.
# GO-2026-5004 github.com/jackc/pgx/v4 -> pgx v5 migration (#4556)
# GO-2026-4518 github.com/jackc/pgproto3/v2 -> pgx v5 migration (#4556)
ALLOWLIST: "GO-2026-5004 GO-2026-4518"
run: |
out=$(mktemp)
govulncheck ./... >"$out" 2>&1 && code=0 || code=$?
cat "$out"
if [ "$code" -eq 0 ]; then
echo "govulncheck: no reachable vulnerabilities."
exit 0
fi
if [ "$code" -ne 3 ]; then
echo "::error::govulncheck failed to run (exit $code)."
exit 1
fi
found=$(grep -oE 'Vulnerability #[0-9]+: GO-[0-9]{4}-[0-9]+' "$out" | grep -oE 'GO-[0-9]{4}-[0-9]+' | sort -u)
unexpected=""
for id in $found; do
case " $ALLOWLIST " in
*" $id "*) ;;
*) unexpected="$unexpected $id" ;;
esac
done
if [ -n "$unexpected" ]; then
echo "::error::Unexpected reachable vulnerabilities:$unexpected"
echo "If a fix exists, bump the dependency/toolchain. If genuinely unfixable, add the ID to ALLOWLIST with a tracking issue."
exit 1
fi
echo "govulncheck: only allow-listed (known-unfixable) vulnerabilities present:$found"
echo "OK."
+1 -1
View File
@@ -21,7 +21,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "1.25"
go-version: 1.24
check-latest: true
cache: true
- name: golangci-lint
+2 -5
View File
@@ -14,11 +14,8 @@ name: "Loop: Builder"
on:
workflow_dispatch: {}
# PAUSED 2026-07-12: automatic schedule disabled while the team does focused
# 1:1 fixes. Still runnable on demand via workflow_dispatch. Re-enable by
# uncommenting the schedule below.
# schedule:
# - cron: "29 * * * *"
schedule:
- cron: "29 * * * *"
permissions:
issues: write
+2 -5
View File
@@ -14,11 +14,8 @@ name: "Loop: Coherence"
on:
workflow_dispatch: {}
# PAUSED 2026-07-12: automatic schedule disabled while the team does focused
# 1:1 fixes. Still runnable on demand via workflow_dispatch. Re-enable by
# uncommenting the schedule below.
# schedule:
# - cron: "0 7 * * *"
schedule:
- cron: "0 7 * * *"
permissions:
issues: write
+2 -5
View File
@@ -14,11 +14,8 @@ name: "Loop: Planner"
on:
workflow_dispatch: {}
# PAUSED 2026-07-12: automatic schedule disabled while the team does focused
# 1:1 fixes. Still runnable on demand via workflow_dispatch. Re-enable by
# uncommenting the schedule below.
# schedule:
# - cron: "59 * * * *"
schedule:
- cron: "59 * * * *"
permissions:
issues: write
+9 -33
View File
@@ -1,22 +1,17 @@
name: "Loop: Release"
# Generated by `micro loop init`. Cuts the next tag when the default branch has
# new commits since the latest one, and pushes it with a PAT (CODEX_TRIGGER_TOKEN)
# so any tag-triggered release workflow fires. The bump reflects what shipped,
# read from the CHANGELOG [Unreleased] section: new features (Added/Changed) cut
# a MINOR; fixes/docs only cut a PATCH; breaking changes are skipped so a MAJOR
# stays a human decision.
# Generated by `micro loop init`. Cuts the next PATCH tag
# (vMAJOR.MINOR.PATCH+1) when the default branch has new commits
# since the latest such tag, and pushes it with a PAT (CODEX_TRIGGER_TOKEN) so any
# tag-triggered release workflow fires. Minor/major bumps stay with a human.
#
# The tag MUST be pushed with a PAT, not the default GITHUB_TOKEN: a tag pushed
# by GITHUB_TOKEN does not trigger other workflows (Actions blocks that recursion).
on:
workflow_dispatch: {}
# PAUSED 2026-07-12: automatic nightly release disabled while the team does
# focused 1:1 fixes. Cut a release on demand via workflow_dispatch. Re-enable
# by uncommenting the schedule below.
# schedule:
# - cron: "0 23 * * *"
schedule:
- cron: "0 23 * * *"
permissions:
contents: read
@@ -71,30 +66,11 @@ jobs:
[0-9]*.[0-9]*.[0-9]*) ;;
*) echo "unexpected tag shape: $LATEST" ; exit 1 ;;
esac
# Choose the bump from what actually shipped, read from the CHANGELOG
# [Unreleased] section (kept current by the coherence role):
# new features (### Added / ### Changed) -> MINOR
# fixes/docs only -> PATCH
# breaking (### Removed / "(breaking)") -> skip; a major is a human call
UNRELEASED=""
if [ -f CHANGELOG.md ]; then
UNRELEASED=$(awk '/^## \[Unreleased\]/{f=1; next} /^## \[/{f=0} f' CHANGELOG.md)
fi
if printf '%s\n' "$UNRELEASED" | grep -qiE '^### Removed|^### Changed \(breaking\)|BREAKING'; then
echo "CHANGELOG [Unreleased] contains breaking changes — a major release is a human decision. Skipping."
exit 0
elif printf '%s\n' "$UNRELEASED" | grep -qE '^### (Added|Changed)'; then
NEXT="v${major}.$((minor + 1)).0"
KIND="minor (new features)"
else
NEXT="v${major}.${minor}.$((patch + 1))"
KIND="patch (fixes/docs only)"
fi
echo "cutting: $NEXT — $KIND ($COUNT commits since $LATEST)"
NEXT="v${major}.${minor}.$((patch + 1))"
echo "cutting: $NEXT ($COUNT commits since $LATEST)"
git config user.name "loop release bot"
git config user.email "noreply@users.noreply.github.com"
git tag -a "$NEXT" -m "Release $NEXT — automated $KIND ($COUNT commits since $LATEST)"
git tag -a "$NEXT" -m "Release $NEXT — automated patch ($COUNT commits since $LATEST)"
git push "https://x-access-token:${RELEASE_TOKEN}@github.com/${REPO}.git" "$NEXT"
echo "Pushed $NEXT."
+2 -5
View File
@@ -14,11 +14,8 @@ name: "Loop: Security"
on:
workflow_dispatch: {}
# PAUSED 2026-07-12: automatic schedule disabled while the team does focused
# 1:1 fixes. Still runnable on demand via workflow_dispatch. Re-enable by
# uncommenting the schedule below.
# schedule:
# - cron: "0 6 * * 1"
schedule:
- cron: "0 6 * * 1"
permissions:
issues: write
+3 -7
View File
@@ -7,13 +7,9 @@ name: "Loop: Triage"
# failures become fixes with no human in the middle. Gated on CODEX_TRIGGER_TOKEN.
on:
workflow_dispatch: {}
# PAUSED 2026-07-12: automatic CI-failure dispatch disabled while the team
# does focused 1:1 fixes, so failures don't auto-spawn agent tasks. Re-enable
# by uncommenting the workflow_run trigger below.
# workflow_run:
# workflows: ["Harness (E2E)", "Lint", "Run Tests", "govulncheck"]
# types: [completed]
workflow_run:
workflows: ["Harness (E2E)", "Lint", "Run Tests"]
types: [completed]
permissions:
issues: write
+2 -2
View File
@@ -19,7 +19,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: "1.25"
go-version: 1.24
check-latest: true
cache: true
- name: Get dependencies
@@ -56,7 +56,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: "1.25"
go-version: 1.24
check-latest: true
cache: true
- name: Get dependencies
+3 -158
View File
@@ -5,10 +5,9 @@ All notable changes to Go Micro are documented here.
Format follows [Keep a Changelog](https://keepachangelog.com/) and versions
follow [Semantic Versioning](https://semver.org/), matching the git tags and
[GitHub releases](https://github.com/micro/go-micro/releases) (`v6.MINOR.PATCH`).
Releases are cut automatically as the loop merges improvements — a **minor**
bump when new features land (`### Added`/`### Changed`), a **patch** when it's
fixes/docs only; major bumps stay a human decision. The `[Unreleased]` section
below is kept current between tags and rolled into the next version when it ships.
Patch releases are cut automatically as the loop merges improvements; the
`[Unreleased]` section below is kept current between tags and rolled into the
next version when it ships.
> Earlier `2026.0x` headings are historical calendar-style markers from before
> v6 tagging; they are kept for continuity and not reused.
@@ -17,166 +16,12 @@ below is kept current between tags and rolled into the next version when it ship
## [Unreleased]
### Added
- **Gemini streaming support** — the Gemini provider now supports streaming model responses. (`ai/gemini/`)
- **Model retry jitter controls** — model retry behavior can now use jitter controls to reduce synchronized retry bursts. (`ai/`, `agent/`)
- **Compacted memory summaries** — agent memory now exposes compacted run summaries for easier inspection and recovery. (`agent/`)
- **CLI input resume for agent runs** — the CLI can resume agent runs that require additional user input. (`cmd/micro/`, `agent/`)
### Changed
- **Remote agent chat streaming** — `micro chat` now streams replies from remote agents instead of waiting for the full response. (`cmd/micro/`, `agent/`)
- **A2A external-client conformance** — the A2A gateway now serves the Agent Card at the spec 0.3.0 `/.well-known/agent-card.json` (keeping `/.well-known/agent.json` as a legacy alias), and `message/stream` emits spec-shaped `status-update`/`artifact-update` events ending in a `final:true` status-update instead of repeated full `Task` snapshots — and never sends `result` and `error` together. Standard A2A clients (ADK, LangGraph, a2a-SDK) can now discover and stream from go-micro agents. (`gateway/a2a/`)
### Fixed
- **Provider failure inspection metadata** — provider failures recorded during agent runs now retain classification metadata for inspection. (`agent/`, `ai/`)
### Security
- **x402 spend-cap hardening** — the paying `Client` now refuses a 402 whose `maxAmountRequired` is not a positive integer (a swallowed parse error or negative amount previously bypassed the budget cap), and a new `Config.RequireSettlement` fails closed when a paid request is served by a verify-only facilitator that never captures funds. (`wrapper/x402/`)
---
## [6.7.0] - July 2026
### Added
- **A2A streaming conformance harness** — A2A streaming behavior is now covered by focused conformance checks. (`gateway/a2a/`, `internal/harness/`)
- **Agent x402 spend budget guardrail** — agents now have spend budget guardrails for x402-paid tool calls. (`agent/`, `gateway/`)
- **First-agent chat/inspect fixture** — the maintained first-agent CLI fixture now covers chat and inspect boundaries together. (`internal/harness/`, `cmd/micro/`)
- **Zero-to-hero inspect transcript check** — the 0→hero harness now verifies the inspect transcript path stays visible in the lifecycle walkthrough. (`internal/harness/zero-to-hero-ci/`, `internal/website/docs/`)
### Changed
- **Agent stream run context propagation** — agent streams now preserve run context through streaming paths for more complete tracing and inspection. (`agent/`)
- **Postgres store pgx v5 migration** — the Postgres store now uses pgx v5. (`store/postgres/`, `go.mod`)
- **Plan-delegate plan persistence** — plan/delegate runs now persist plan state more defensively across harness scenarios. (`agent/`, `internal/harness/`)
### Fixed
- **Nested tool-call markup rejection** — agent argument parsing now rejects nested tool-call markup instead of accepting ambiguous tool input. (`agent/`)
- **Retry cancellation during backoff** — retry backoff now respects cancellation more reliably. (`agent/`, `ai/`)
- **Plan-delegate mock recovery regression gate** — the harness now catches plan/delegate mock recovery regressions before they ship. (`internal/harness/`, `agent/`)
- **First-agent fixture registration wait** — first-agent fixture registration is less race-prone during harness runs. (`internal/harness/`)
- **Memory stream Nack ordering** — memory stream Nack handling now preserves ordering more reliably. (`broker/memory/`)
- **Zero-to-hero fixture output race** — 0→hero fixture output is less race-prone during harness runs. (`internal/harness/zero-to-hero-ci/`)
### Documentation
- **First-agent quickcheck wayfinding** — public docs now keep the quickcheck path discoverable from the first-agent route. (`README.md`, `internal/website/docs/`)
- **Ordered 0→hero transcript** — docs and harness checks now keep the 0→hero transcript order explicit. (`internal/website/docs/`, `internal/harness/`)
- **First-agent debug breadcrumbs** — docs now surface the first-agent debug smoke path more clearly. (`internal/website/docs/`)
- **README badge cleanup** — the README no longer shows the Go Report Card badge. (`README.md`)
---
## [6.6.0] - July 2026
### Added
- **First-agent guide chain contract** — the harness now verifies the install → demo → examples → 0→hero guide chain stays connected for new agent builders. (`internal/harness/`, `internal/website/docs/`)
- **First-agent docs wayfinding guard** — the local harness now includes a focused no-network check for first-agent and 0→hero docs links. (`Makefile`, `internal/harness/`)
- **First-agent quickcheck breadcrumbs** — first-agent docs now surface quickcheck wayfinding for install, scaffold, chat, inspect, and recovery paths. (`internal/website/docs/`, `README.md`)
- **First-agent chat wayfinding verification** — the harness now verifies first-agent chat wayfinding remains discoverable from the public docs route. (`internal/harness/`, `internal/website/docs/`)
### Changed
- **Universe A2A reachability probe** — the universe harness now exercises A2A reachability more defensively. (`internal/harness/`)
- **AtlasCloud workspace repair fallback** — AtlasCloud fallback handling now recovers workspace-repair tool calls more reliably. (`ai/atlascloud/`, `agent/`)
- **AtlasCloud empty-argument tool repair** — AtlasCloud text tool-call repair now handles empty-argument calls more consistently. (`ai/atlascloud/`, `agent/`)
### Removed
- **`go-micro.dev/v6/ai/flow`** — the alias-only backward-compatibility shim is removed; import the canonical [`go-micro.dev/v6/flow`](flow) instead (same types and functions). It had no internal callers. (`ai/flow/`)
### Fixed
- **A2A fallback artifact text** — A2A fallback responses now avoid leaking provider artifact text into agent-visible output. (`gateway/a2a/`, `agent/`)
- **Launch readiness notification replays** — launch-readiness notification replay paths now deduplicate repeated side effects. (`agent/`, `internal/harness/`)
- **Plan-delegate harness cleanup** — plan/delegate harness cleanup is more reliable after conformance runs. (`internal/harness/`)
- **AtlasCloud spoken notify replays** — AtlasCloud fallback handling now collapses spoken notification replays more consistently. (`ai/atlascloud/`, `agent/`)
- **Agent-flow onboarding side effects** — onboarding side-effect checks are more stable across the agent-flow harness. (`agent/`, `internal/harness/`)
- **Plan-delegate plan-only side effects** — plan/delegate recovery now preserves plan-only side effects more reliably. (`agent/`, `internal/harness/`)
- **Checkpointed tool result recording** — checkpoint resume paths now guard tool-result recording against duplicate or stale writes. (`agent/`)
- **Agent timeout notification completion** — universe runs now finalize observed notifications more reliably after agent timeouts. (`agent/`, `internal/harness/`)
- **Completed plan-delegate side effects** — completed plan/delegate side effects are accepted more consistently in recovery paths. (`agent/`, `internal/harness/`)
- **Agent-flow onboarding notifications** — agent-flow onboarding notification recovery is more reliable across replay scenarios. (`agent/`, `internal/harness/`)
### Documentation
- **Agent-agnostic mention model** — loop docs now describe the mention-driven agent model without binding it to one coding agent. (`internal/docs/`, `.github/loop/`)
- **First-agent quickcheck docs** — public docs now surface the first-agent quickcheck path for faster troubleshooting. (`internal/website/docs/`)
- **Agent resume breadcrumbs** — docs now add clearer resume breadcrumbs for checkpointed agent runs. (`internal/website/docs/`)
### Security
- **Govulncheck vulnerability gate** — CI now includes a govulncheck gate and wires vulnerability failures into loop triage. (`.github/workflows/`, `cmd/micro/loop/`)
- **Dependency vulnerability patches** — toolchain and dependency updates patch reachable CVEs across the project. (`go.mod`, `go.sum`)
---
## [6.5.0] - July 2026
### Added
- **Agent stream provider conformance** — provider conformance now covers agent streaming behavior so streaming-capable providers stay aligned with the harness contract. (`agent/`, `internal/harness/`)
- **First-agent docs CLI parity check** — the harness now verifies first-agent docs commands match the CLI wayfinding surface. (`internal/harness/`, `internal/website/docs/`)
- **Focused CLI inner-loop contract** — the local harness now covers scaffold, run/chat/inspect, and deploy dry-run boundaries in one first-run contract. (`internal/harness/`)
- **First-agent wayfinding breadcrumbs** — first-agent docs and examples now have locked breadcrumb coverage from the README through the runnable examples. (`README.md`, `internal/website/docs/`, `examples/`)
- **Offline `micro new` contract** — project scaffolding now has an offline contract so the first service path stays runnable without network access. (`cmd/micro/`, `internal/harness/`)
### Changed
- **Provider model call timeouts** — model call timeout enforcement now wraps provider calls more defensively, reducing hangs in agent and harness paths. (`agent/`, `ai/`)
- **First-agent harness diagnostics** — getting-started harness logs now make first-run and 0→hero failures easier to locate. (`internal/harness/`)
- **MiniMax streaming conformance** — MiniMax streaming coverage now exercises broader provider conformance behavior. (`ai/minimax/`, `internal/harness/`)
- **AtlasCloud streaming tool capability** — AtlasCloud tool-streaming capability detection is now aligned with provider fallback behavior. (`ai/atlascloud/`, `agent/`)
### Fixed
- **Partial text tool calls** — text tool-call recovery now repairs partial function-style calls more reliably before fallback parsing continues. (`agent/`)
- **Retry timeout test stability** — retry timeout coverage is less race-prone. (`agent/`)
- **Checkpointed tool-call resume** — resumed agent runs now preserve checkpointed tool calls across startup resume paths. (`agent/`)
- **Model retry backoff contracts** — retry backoff behavior now has focused contract coverage for model-call failures. (`agent/`, `ai/`)
- **AtlasCloud conformance markers** — AtlasCloud fallback paths now preserve conformance markers through tool-call recovery. (`ai/atlascloud/`, `agent/`)
- **AtlasCloud delegate text fallback** — delegate text fallback recovery is more reliable for AtlasCloud responses. (`ai/atlascloud/`, `agent/`)
- **AtlasCloud incomplete plan repairs** — incomplete plan repair paths now recover more consistently in AtlasCloud fallback handling. (`ai/atlascloud/`, `agent/`)
- **AtlasCloud partial text tool calls** — AtlasCloud fallback handling now repairs partial text-rendered tool calls more reliably. (`ai/atlascloud/`, `agent/`)
### Documentation
- **Roadmap agent status** — public roadmap docs now reflect the current agent lifecycle status more consistently. (`internal/website/docs/`)
- **Agent resume limits** — docs now describe checkpoint resume boundaries for agent runs. (`internal/website/docs/`)
- **Zero-to-hero harness boundaries** — docs now clarify which 0→hero lifecycle checks are maintained by the local harness. (`internal/website/docs/`, `internal/harness/`)
- **First-agent wayfinding guard** — first-agent docs wayfinding now has tighter guard coverage around the README, docs, and examples chain. (`README.md`, `internal/website/docs/`)
---
## [6.4.0] - July 2026
### Added
- **Provider HTTP retry signals** — provider failures now preserve HTTP status and `Retry-After` details so retry classification and backoff can respond to rate limits and unavailable providers. (`ai/`)
- **Zero-to-hero deploy dry-run verification** — the maintained 0→hero harness now covers deploy dry-run boundaries for the services → agents → workflows lifecycle. (`internal/harness/`)
- **First-agent CLI wayfinding verification** — the harness now checks that first-agent CLI wayfinding stays discoverable. (`internal/harness/`)
- **Agent startup resume verification** — agent startup resume now has focused checkpoint coverage. (`agent/`, `internal/harness/`)
- **Direct first-agent chat prompts** — first-agent flows can accept direct chat prompts, reducing friction in the first useful conversation. (`cmd/micro/`, `agent/`)
- **Workflow run info on tool spans** — agent tool spans now include workflow run details for easier trace correlation. (`agent/`, `flow/`)
### Fixed
- **Stream fallback memory** — unsupported streaming attempts no longer leave stale duplicate user turns before fallback paths continue with non-streaming agent calls. (`agent/`)
- **Function-style text tool calls** — agent fallback parsing now recognizes provider replies that render tools as function-style calls, including nested JSON arguments. (`agent/`)
- **Plan/delegate notify recovery** — plan-delegate recovery now waits for recovered notify side effects and routes retries through the communications agent that owns the notification. (`internal/harness/`)
- **Onboarding side-effect enforcement** — the agent-flow harness now fails when required onboarding side effects are missing, making lifecycle regressions visible. (`internal/harness/`)
- **Plan/delegate notify stability** — notify recovery is more deterministic across retry and replay paths. (`agent/`, `internal/harness/`)
- **AtlasCloud MiniMax tool fallback** — AtlasCloud MiniMax service-tool fallback now handles 400 responses and follow-up retries more reliably. (`ai/atlascloud/`, `agent/`)
### Documentation
- **First-agent docs wayfinding guard** — the local harness now includes a focused no-network check for first-agent and 0→hero docs links. (`Makefile`, `internal/harness/`)
---
## [6.3.18] - July 2026
### Added
- **StreamAsk close cancellation** — agent streaming calls now cancel promptly when their runner closes, avoiding orphaned stream work. (`agent/`)
- **Agent resume pending helper** — agent durability now has a focused helper for resuming pending checkpointed runs. (`agent/`)
- **Agent tool retry tracing** — agent traces now include tool retry attempts for easier debugging of retry/fallback behavior. (`agent/`)
- **Shared-broker universe harness** — the universe harness now runs against the shared broker path, improving coverage of the same runtime wiring used by services, agents, and workflows. (`internal/harness/`)
### Fixed
- **Plan/delegate retry idempotency** — agent retries now preserve side-effect and notification dedupe across conformance retry paths, including completion and owner-notification edge cases. (`agent/`, `internal/harness/`)
- **AtlasCloud text tool calls** — AtlasCloud fallback handling now recovers more text-rendered tool calls from OpenAI-compatible responses. (`ai/atlascloud/`, `agent/`)
- **OpenAI-compatible text tool calls** — OpenAI-compatible providers now recover text-rendered tool calls more reliably. (`agent/`)
- **AtlasCloud multi-step follow-ups** — AtlasCloud tool fallback handling now continues multi-step tool follow-up paths more reliably. (`ai/atlascloud/`, `agent/`)
### Documentation
- **Agent debugging quickcheck** — docs now include a focused quickcheck path for first-agent debugging. (`internal/website/docs/`)
- **Website first-agent examples map** — website docs now link the maintained examples wayfinding map for the first-agent route. (`internal/website/docs/`)
- **Examples wayfinding index** — examples docs now provide a central map for first-agent, support, and interop examples. (`examples/`, `internal/website/docs/`)
---
+5 -39
View File
@@ -8,7 +8,7 @@ LDFLAGS = -X $(GIT_IMPORT).BuildDate=$(BUILD_DATE) -X $(GIT_IMPORT).GitCommit=$(
# GORELEASER_DOCKER_IMAGE = ghcr.io/goreleaser/goreleaser-cross:v1.25.7
GORELEASER_DOCKER_IMAGE = ghcr.io/goreleaser/goreleaser:latest
.PHONY: test test-race test-coverage harness zero-to-hero-transcript inner-loop cli-wayfinding docs-wayfinding install-smoke provider-conformance-mock provider-conformance lint fmt install-tools proto clean help gorelease-dry-run gorelease-dry-run-docker
.PHONY: test test-race test-coverage harness install-smoke provider-conformance-mock provider-conformance lint fmt install-tools proto clean help gorelease-dry-run gorelease-dry-run-docker
# Default target
help:
@@ -19,10 +19,6 @@ help:
@echo " make test-coverage - Run tests with coverage"
@echo " make lint - Run linter"
@echo " make harness - Run deterministic getting-started and end-to-end harnesses"
@echo " make zero-to-hero-transcript - Verify the ordered 0→hero lifecycle transcript"
@echo " make inner-loop - Verify scaffold → run/chat/inspect → deploy dry-run contract"
@echo " make cli-wayfinding - Verify installed first-agent CLI wayfinding commands"
@echo " make docs-wayfinding - Verify first-agent docs/CLI wayfinding stays in sync"
@echo " make install-smoke - Verify the local install.sh and first-run CLI smoke path"
@echo " make provider-conformance-mock - Run cross-provider harness with deterministic mock provider"
@echo " make provider-conformance - Run harnesses against configured live providers"
@@ -53,43 +49,12 @@ test-coverage:
# This mirrors the default CI path so local dogfooding catches scaffold,
# run/chat/inspect, and 0→hero regressions before a PR is opened.
harness:
$(MAKE) cli-wayfinding
$(MAKE) inner-loop
$(MAKE) zero-to-hero-transcript
$(MAKE) install-smoke
go test ./cmd/micro/cli/new -run TestZeroToOne -count=1
./internal/harness/zero-to-hero-ci/run.sh
go run ./internal/harness/agent-flow
$(MAKE) provider-conformance-mock
# Verify the maintained 0→hero transcript in the same order documented for new
# developers: scaffold → run/chat/inspect → support-agent chat → flow history →
# deploy dry-run. This is the focused CI contract for the full lifecycle path.
zero-to-hero-transcript:
./internal/harness/zero-to-hero-ci/run.sh
# Focused provider-free CLI inner-loop contract: scaffold a service, keep the
# run/chat/inspect commands discoverable, and prove deploy dry-run reaches the
# documented boundary without remote side effects. Use this when README/docs/CLI
# drift is the concern and the full runtime harness is more than you need.
inner-loop:
go test ./cmd/micro/cli/new -run TestZeroToOne -count=1
go test ./cmd/micro -run 'TestFirstAgentWalkthroughCLIBoundaries|TestZeroToHeroCLIBoundaries|TestZeroToHeroCommandPrintsMaintainedNoSecretPath' -count=1
go test ./cmd/micro/cli/deploy -run TestDeployDryRun -count=1
go test ./internal/harness/zero-to-hero-ci -run 'TestZeroToHeroDeployDryRunCommandSmoke|TestNoSecretFirstAgentDebuggingSmoke|TestYourFirstAgentTutorialSmoke' -count=1
# Verify the installed CLI keeps the first-agent on-ramp commands discoverable.
# This guards the no-secret commands README/docs recommend (`micro agent demo`,
# `micro examples`, and `micro zero-to-hero`) as a CI contract.
cli-wayfinding:
go test ./cmd/micro -run 'TestFirstAgentWalkthroughCLIBoundaries|TestExamplesWayfindingIndexStaysLinked|TestExamplesCommandPointsAtWayfindingIndex|TestZeroToHeroCommandPrintsMaintainedNoSecretPath' -count=1
$(MAKE) docs-wayfinding
$(MAKE) install-smoke
# Verify the README and website first-agent/0→hero wayfinding links resolve to
# maintained local docs and examples. This is a focused no-network guard for the
# developer-adoption on-ramp.
docs-wayfinding:
go test ./internal/harness/zero-to-hero-ci -run 'TestFirstAgentWayfinding' -count=1
go test ./cmd/micro -run 'TestFirstAgentDocsMatchCLIOutput|TestFirstAgentWalkthroughCLIBoundaries' -count=1
# Verify the documented install script and first-run CLI command boundaries without
# provider keys or network access.
install-smoke:
@@ -145,3 +110,4 @@ gorelease-dry-run:
-w /$(NAME) \
$(GORELEASER_DOCKER_IMAGE) \
--clean --verbose --skip=publish,validate --snapshot
-514
View File
@@ -1,514 +0,0 @@
# Go Micro [![Go.Dev reference](https://img.shields.io/badge/go.dev-reference-007d9c?logo=go&logoColor=white&style=flat-square)](https://pkg.go.dev/go-micro.dev/v6?tab=doc) [![Discord](https://img.shields.io/badge/Discord-join-5865F2?logo=discord&logoColor=white&style=flat-square)](https://discord.gg/G8Gk5j3uXr)
Go Micro is an **agent harness** and service framework for Go.
**Community:** questions, ideas, or just want to build alongside us? [Join the Discord](https://discord.gg/G8Gk5j3uXr).
A harness is the runtime around an agent: the tools it can call, the memory it keeps, the guardrails that bound it, the workflows that trigger it, the services it depends on, and the protocols other agents use to reach it.
Go Micro gives you the harness as Go code. Build an agent and it gets a model, memory, tools, planning, delegation, guardrails, and service discovery; it is reachable over [MCP](https://modelcontextprotocol.io/) and [A2A](https://a2a-protocol.org). Write services and every endpoint becomes an AI-callable tool. Orchestrate the deterministic parts with durable flows. Agents, services, and flows share one runtime because an agent is a distributed system, and building one is building a service.
## Sponsors
<a href="https://go-micro.dev/blog/3"><img src="https://upload.wikimedia.org/wikipedia/commons/7/78/Anthropic_logo.svg" height="26" /></a>
&nbsp;&nbsp;
<a href="https://go-micro.dev/blog/29"><img src="https://upload.wikimedia.org/wikipedia/commons/4/4d/OpenAI_Logo.svg" height="26" /></a>
&nbsp;&nbsp;
<a href="https://go-micro.dev/blog/8"><img src="https://www.atlascloud.ai/logo.svg" height="26" /></a>
**Want to support Go Micro and see your logo here?** [Become a sponsor](https://discord.gg/G8Gk5j3uXr) — reach out on Discord.
## Commercial Support
Running Go Micro in production, or building on it and want help? Paid **support, consulting, training, and retainers** are available directly from the maintainer — and they're what keep the project maintained. See [**Support**](SUPPORT.md) for the tiers, or [open a request](https://github.com/micro/go-micro/issues/new?template=commercial_support.md).
## Contents
- [Quick Start](#quick-start)
- [First agent on-ramp](#first-agent-on-ramp)
- [Why an Agent Harness](#why-an-agent-harness)
- [Writing Services](#writing-services)
- [Building Agents](#building-agents) — [Plan & Delegate](#plan--delegate), [Pluggable](#batteries-included-pluggable), [Paid tools (x402)](#paid-tools-x402), [A2A](#reachable-by-other-agents-a2a)
- [Features](#features)
- [CLI](#cli)
- [Autonomous improvement loop](#autonomous-improvement-loop)
- [Multi-Service Projects](#multi-service-projects)
- [Data Model](#data-model)
- [AI Providers](#ai-providers)
- [Examples](#examples)
- [Commercial Support](#commercial-support)
- [Docs](#docs)
## Quick Start
Install the CLI:
```bash
# Binary (no Go required)
curl -fsSL https://go-micro.dev/install.sh | sh
# Or with Go
go install go-micro.dev/v6/cmd/micro@latest
```
If install or `PATH` checks fail, use the [install troubleshooting guide](internal/website/docs/guides/install-troubleshooting.md) before scaffolding your first service.
### Fastest start — no API key
Scaffold a service, run it, call it:
```bash
micro new helloworld
cd helloworld
micro run
```
Then in another terminal:
```bash
curl -X POST http://localhost:8080/api/helloworld/Helloworld.Call \
-H 'Content-Type: application/json' -d '{"name":"World"}'
```
This install → scaffold → run → call path is covered by no-secret CI harnesses. To
verify just the local installer and first-run CLI boundaries without network
access or provider keys, use:
```bash
make install-smoke
```
To verify the focused CLI inner-loop contract — scaffold → run/chat/inspect → deploy dry-run — use:
```bash
make inner-loop
```
To run only the ordered [0→hero services → agents → workflows transcript](internal/website/docs/guides/zero-to-hero.md) that CI guards, use:
```bash
make zero-to-hero-transcript
```
To run the broader local contract (including that transcript, chat/inspect CLI boundaries, and deploy dry-run), use:
```bash
make harness
```
### First agent on-ramp
After install and the first `micro new`/`micro run` smoke check, take the
walkable agent path in this order:
1. [Install troubleshooting](internal/website/docs/guides/install-troubleshooting.md) — verify the binary installer or `go install`, `PATH`, `micro --version`, and the no-secret smoke path before agent work.
Run `make docs-wayfinding` to verify the focused no-secret docs/CLI contract that keeps these README and website commands aligned with the installed CLI.
2. `micro agent demo` — print the provider-free first-agent demo command and next docs steps from the installed CLI.
3. `micro agent quickcheck` (or `micro agent debug`) — when scaffold → run → chat → inspect stalls, print the short recovery map before you dive into the full debugging guide.
4. `micro examples` — print the maintained provider-free runnable examples in copy/paste order.
5. `micro zero-to-hero` — print the maintained one-command no-secret lifecycle harness and runnable examples.
6. [Examples wayfinding index](examples/INDEX.md) — choose the smallest no-secret first-agent, maintained [0→hero support reference](examples/support/), and next interop examples from one map.
7. [Smallest first-agent example](examples/first-agent/) — run one service-backed agent with a mock model and no provider key.
8. [No-secret first-agent transcript](internal/website/docs/guides/no-secret-first-agent.md) — run the
maintained support agent with a mock model and see services → agents → workflows succeed without a key.
9. [Your First Agent](internal/website/docs/guides/your-first-agent.md) — build a
service-backed agent and talk to it with `micro chat`.
10. [Debugging your agent](internal/website/docs/guides/debugging-agents.md) — use
`micro agent preflight` before `micro run`, `micro agent doctor` after `micro run`,
then `micro chat` and `micro inspect agent <name>` to recover run history, memory,
and provider checks when the first conversation does something unexpected.
11. [0→hero Reference](internal/website/docs/guides/zero-to-hero.md) — complete the
services → agents → workflows loop with scaffold, run, chat, inspect, flow
history, and deploy dry-run commands that match the maintained harness.
### Autonomous improvement loop
Want the same services → agents → workflows lifecycle applied to your
repository? `micro loop` scaffolds the autonomous improvement loop used by Go
Micro itself: a North Star, ranked issue queue, role prompts, GitHub Actions
workflows, and verification for CI-gated PRs.
```bash
micro loop init --roles all
micro loop verify
```
Before turning on the schedule, configure a dispatch token such as
`CODEX_TRIGGER_TOKEN`, protect the default branch with required CI checks
(`go build ./...`, `go test ./...`, and `golangci-lint run ./...` for this
repository), and seed `.github/loop/PRIORITIES.md` with one scoped issue per
increment. See the [`micro loop` quickstart](internal/website/docs/guides/micro-loop.md)
for the setup checklist and operating model.
### Generate from a prompt — with an LLM key
Set a provider key, describe what you want, and the AI designs services, writes handlers, compiles, and starts them:
```bash
export ANTHROPIC_API_KEY=sk-ant-... # or OPENAI_API_KEY, GEMINI_API_KEY, ...
micro run --prompt "a task management system with categories" --provider anthropic
```
The AI designs the architecture, you review it, then it generates handlers with real business logic, compiles them, and starts them:
```
Services:
● task — Task management with status tracking
● project — Project organization
Generate? [Y/n]
Micro
Services:
● task
● project
Agents:
◆ agent
```
Then talk to your services from the console:
```
> Create a project called Launch, then add three tasks to it
→ project_Project_Create({"name":"Launch"})
← {"record":{"id":"p1..."},"success":true}
→ task_Task_Create({"title":"Design specs","project_id":"p1..."})
→ task_Task_Create({"title":"Write code","project_id":"p1..."})
→ task_Task_Create({"title":"Ship it","project_id":"p1..."})
Created project Launch and added three tasks to it.
```
When you need a capability that doesn't exist, the agent generates a new service mid-conversation:
```
> I need to track shipping. Create a shipment for order 123 to London.
⚡ generating shipping service...
✓ shipping
→ shipping_Shipping_Create({"order_id":"123","destination":"London"})
← {"record":{"id":"xyz...","status":"pending"}}
Created shipment for order 123 going to London.
```
Edit the generated code by hand at any time — re-running preserves your changes. [Read more](https://go-micro.dev/blog/13).
## Why an Agent Harness
The first wave of agent frameworks helped developers put a model in a loop. The next problem is operating that loop: connecting it to real tools, scoping what it can touch, preserving state, routing work to specialists, recovering from failures, observing what happened, and letting other agents call it. That is harness work.
Go Micro's answer is to make the harness the same thing you already deploy:
- **Tools are services** — endpoint metadata becomes tool schema; RPC executes the call.
- **Agents are services** — they register, discover, load-balance, and expose `Agent.Chat`.
- **Workflows are durable code paths** — use flows when the path is known; dispatch to agents when it is not.
- **Safety lives at execution** — `MaxSteps`, `LoopLimit`, `ApproveTool`, and tool wrappers run where actions happen.
- **Interop is built in** — MCP for tools, A2A for agents, x402 for paid tools.
Use Go Micro when the agent has to operate a system, not just answer a prompt.
## Writing Services
Under the hood, a service is a struct with methods. Doc comments and `@example` tags become tool descriptions for AI agents automatically.
```go
package main
import (
"context"
"go-micro.dev/v6"
)
type Request struct {
Name string `json:"name"`
}
type Response struct {
Message string `json:"message"`
}
type Say struct{}
// Hello greets a person by name.
// @example {"name": "Alice"}
func (h *Say) Hello(ctx context.Context, req *Request, rsp *Response) error {
rsp.Message = "Hello " + req.Name
return nil
}
func main() {
service := micro.NewService("greeter")
service.Handle(new(Say))
service.Run()
}
```
Run it and everything is accessible — REST, gRPC, MCP, agent playground:
```bash
micro run
# Dashboard: http://localhost:8080
# API: http://localhost:8080/api/{service}/{method}
# Agent: http://localhost:8080/agent
# MCP Tools: http://localhost:8080/mcp/tools
```
You can also scaffold a service from a template:
```bash
micro new helloworld
micro new contacts --template crud
```
## Building Agents
An Agent is a service with an LLM inside it. It has a proto-defined `Agent.Chat` RPC endpoint, registers in the registry, and is callable like any service:
```go
agent := micro.NewAgent("task-mgr",
micro.AgentServices("task", "project"),
micro.AgentPrompt("You manage tasks and projects. You understand deadlines and priorities."),
micro.AgentProvider("anthropic"),
)
agent.Run()
```
The agent discovers its services from the registry, scopes its tools to their endpoints, and maintains conversation memory in the store. It registers itself so `micro chat` and other agents can find it.
```go
// Programmatic interaction
resp, _ := agent.Ask(ctx, "What tasks are overdue?")
fmt.Println(resp.Reply)
```
Multiple agents coordinate via RPC — each is a service with an `Agent.Chat` endpoint. `micro chat` routes to the right one.
```bash
micro agent list # list registered agents
micro call task-mgr Agent.Chat '{"message": "What tasks are overdue?"}'
```
### Plan & Delegate
Every agent gets two built-in harness capabilities, exposed as tools — no extra setup or separate graph runtime:
- **`plan`** — for multi-step work, the agent records an ordered plan in its store-backed memory and stays oriented across turns.
- **`delegate`** — the agent hands a self-contained subtask to another agent. If a registered agent already owns the relevant services, the hand-off goes over RPC to that agent; otherwise a focused, short-lived sub-agent is created for the subtask with its own isolated context.
This keeps intelligence distributed: an agent doesn't need to know *how* to do everything, only *who* does. See [examples/agent-plan-delegate](examples/agent-plan-delegate/).
```go
// A sub-agent is just an agent — created with New, talked to with Ask.
// delegate-first: reuse a registered agent, or spin up a focused one.
resp, _ := agent.Ask(ctx, "Plan the launch, create the tasks, and have comms notify the owner.")
```
### Batteries included, pluggable
Just as a service composes pluggable abstractions (registry, broker, store), an agent composes a **model**, **memory**, and **tools** — sane defaults out of the box, each swappable.
```go
agent := micro.NewAgent("assistant",
micro.AgentProvider("anthropic"), // model — swap the provider
micro.AgentCompactMemory(40, 12), // memory — durable, summarized, recallable
micro.AgentTool("weather", "Get the weather for a city",
map[string]any{"city": map[string]any{"type": "string"}},
func(ctx context.Context, in map[string]any) (string, error) {
return getWeather(in["city"].(string)) // tools beyond your services — any function
}),
micro.AgentMaxSteps(8), // guardrails
)
```
**Memory** is durable and store-backed by default (Postgres, NATS KV, or file), so an agent picks up where it left off after a restart — or supply your own with `AgentMemory`. Long-running agents can opt into `AgentCompactMemory(maxMessages, keepRecent)`: older turns are collapsed into a deterministic summary, recent turns stay verbatim, and relevant archived turns are recalled on future asks without replaying the whole conversation. **Tools** are your services automatically, plus any function you register with `AgentTool`.
### Paid tools (x402)
Every endpoint is an AI-callable tool — and it can be a *paid* tool. Go Micro supports [x402](https://x402.org), the HTTP 402 payment standard for agents, so a tool can require a stablecoin payment and an agent can settle it autonomously. It's opt-in and carries no crypto in the framework: verification is delegated to a pluggable facilitator (Coinbase, Alchemy, self-hosted), so Base and Solana are just different facilitators.
```bash
# Charge for tool calls at the MCP gateway (off unless you set a pay-to address)
micro mcp serve --x402_pay_to 0xYourAddress --x402_network solana --x402_amount 10000
# Per-tool amounts via a config file
micro mcp serve --x402_config x402.json
```
See the [Payments (x402) guide](internal/website/docs/guides/x402-payments.md).
### Reachable by other agents (A2A)
Within a Go Micro system, agents reach each other over RPC. To make them reachable by agents on *other* frameworks, Go Micro speaks the [Agent2Agent (A2A) protocol](https://a2a-protocol.org). The A2A gateway discovers your agents from the registry, generates an Agent Card for each from its metadata — the same way the MCP gateway derives tools from service endpoints — and translates incoming A2A tasks to the agent's `Agent.Chat` RPC. No per-agent code: register an agent and it's reachable over A2A.
```bash
micro a2a serve --address :4000 # gateway: expose every registered agent over A2A
micro a2a list # agents and their Agent Card URLs
```
Or skip the gateway entirely — an agent can serve its own A2A endpoint directly, handling tasks in-process:
```go
micro.NewAgent("task-mgr", micro.AgentServices("task"), micro.AgentA2A(":4000"))
```
It works both ways. To call an agent on another framework, an `a2a.Client` is wired into the two places that hand off work: `flow.A2A(url)` as a workflow step (the cross-framework `Dispatch`), and `delegate` to an `http(s)` URL from inside an agent.
MCP exposes your services as tools; A2A exposes your agents as agents. See the [A2A guide](internal/website/docs/guides/a2a-protocol.md).
## Features
### AI
| Feature | Details |
|---------|---------|
| Agents | `micro.NewAgent()` — intelligent layer that manages services |
| Plan & delegate | Built-in agent tools — plan multi-step work, delegate subtasks to other agents |
| Pluggable memory | Durable store-backed conversation memory by default; swap with `AgentMemory` |
| Custom tools | `AgentTool` — give an agent any function as a tool, beyond its services |
| Guardrails | `MaxSteps` (stop on count), `LoopLimit` (stop repeated no-progress calls), `ApproveTool` (human-in-the-loop) |
| Tool middleware | `AgentWrapTool` — wrap tool execution for logging, metrics, or retries (like client/server wrappers) |
| Workflows | `micro.NewFlow()` — event-driven; one step, ordered durable steps, or triggers an agent |
| Durable execution | Checkpointed flow steps survive a crash and resume where they stopped; store-backed by default, pluggable backend |
| MCP gateway | Every endpoint is an AI tool automatically |
| A2A gateway | Every agent is reachable over the Agent2Agent protocol; cards generated from the registry (`micro a2a`) |
| Payments (x402) | Opt-in per-call payments for tools via the x402 standard; pluggable facilitator (Base, Solana, …) |
| 9 LLM providers | Anthropic, OpenAI, Gemini, Groq, Mistral, Together, Atlas Cloud, MiniMax, Ollama (local + cloud) |
| Interactive console | `micro run` includes a chat console for talking to services |
| Service generation | `micro run --prompt` — describe a system, get running services |
### Framework
| Feature | Details |
|---------|---------|
| Service registry | mDNS (default), Consul, etcd |
| RPC client/server | gRPC transport, load balancing, streaming |
| Pub/sub events | NATS, RabbitMQ, HTTP broker |
| Key-value store | File (bbolt), Postgres, NATS KV |
| Typed model layer | CRUD + queries, SQLite/Postgres backends |
| Everything swappable | All abstractions are Go interfaces |
### Developer experience & deployment
| Feature | Details |
|---------|---------|
| Hot reload | `micro run` watches files, rebuilds on change |
| Templates | `micro new --template crud/pubsub/api` |
| One-command deploy | `micro deploy user@server` — SSH + systemd, no Docker |
## CLI
| Command | Purpose |
|---------|---------|
| `micro run --prompt "..."` | Generate services + agent, start with interactive console |
| `micro run` | Dev mode: hot reload, gateway, interactive console |
| `micro run -d` | Detached mode (no console) |
| `micro chat` | Standalone chat (when not using micro run) |
| `micro agent list` | List registered agents |
| `micro new myservice` | Scaffold a service |
| `micro call service endpoint '{}'` | Call a service or agent from the CLI |
| `micro build` | Compile production binaries |
| `micro deploy user@server` | Deploy via SSH + systemd |
## Multi-Service Projects
Run multiple services together:
```go
users := micro.NewService("users", micro.Address(":9001"))
orders := micro.NewService("orders", micro.Address(":9002"))
users.Handle(new(Users))
orders.Handle(new(Orders))
g := micro.NewGroup(users, orders)
g.Run()
```
Or use a `micro.mu` config file:
```
service users
path ./users
service orders
path ./orders
depends users
```
## Data Model
Typed persistence with CRUD and queries:
```go
type User struct {
ID string `json:"id" model:"key"`
Name string `json:"name"`
Email string `json:"email" model:"index"`
}
db := service.Model()
db.Register(&User{})
db.Create(ctx, &User{ID: "1", Name: "Alice", Email: "alice@example.com"})
var results []*User
db.List(ctx, &results, model.Where("email", "alice@example.com"))
```
Backends: memory (default), SQLite, Postgres.
## AI Providers
Swap providers with a single import — same interface everywhere:
| Provider | Default Model |
|----------|---------------|
| Anthropic | `claude-sonnet-4-20250514` |
| OpenAI | `gpt-4o` |
| Google Gemini | `gemini-2.5-flash` |
| Groq | `llama-3.3-70b-versatile` |
| Mistral | `mistral-large-latest` |
| Together AI | `meta-llama/Llama-3.3-70B-Instruct-Turbo` |
| Atlas Cloud | `deepseek-ai/DeepSeek-V3-0324` |
| MiniMax | `MiniMax-M3` |
| Ollama | `llama3.2` (local) |
```go
m := ai.New("anthropic", ai.WithAPIKey(key))
resp, _ := m.Generate(ctx, &ai.Request{Prompt: "hello"})
```
## Examples
New to agents? Follow the [first-agent on-ramp](#first-agent-on-ramp), then use the [examples index](examples/README.md) for the full services → agents → workflows map.
- [hello-world](examples/hello-world/) — Basic RPC service
- [multi-service](examples/multi-service/) — Multiple services in one binary
- [mcp](examples/mcp/) — MCP integration with AI agents
- [first-agent](examples/first-agent/) — Smallest provider-free service-backed agent
- [agent-plan-delegate](examples/agent-plan-delegate/) — Agent planning and multi-agent delegation
- [agent-durable](examples/agent-durable/) — Checkpoint and resume an agent run without replaying completed tool side effects
- [grpc-interop](examples/grpc-interop/) — Call go-micro from any gRPC client
See [all examples](examples/README.md).
## Docs
- [Getting Started](internal/website/docs/getting-started.md)
- [AI Integration](internal/website/docs/ai-integration.md)
- [Your First Agent](internal/website/docs/guides/your-first-agent.md)
- [0→hero Reference](internal/website/docs/guides/zero-to-hero.md)
- [Agents and Workflows](internal/website/docs/guides/agents-and-workflows.md)
- [Agent Design](internal/docs/AGENT_DESIGN.md)
- [Plan & Delegate](internal/website/docs/guides/plan-delegate.md)
- [Agent Guardrails](internal/website/docs/guides/agent-guardrails.md)
- [Payments (x402)](internal/website/docs/guides/x402-payments.md)
- [MCP & AI Agents](internal/website/docs/mcp.md)
- [Data Model](internal/website/docs/model.md)
- [Deployment](internal/website/docs/deployment.md)
- [Plugins](internal/website/docs/plugins.md)
Package reference: https://pkg.go.dev/go-micro.dev/v6
+176 -188
View File
@@ -1,20 +1,14 @@
<!-- WEHUB_ZH_README -->
> [!NOTE]
> 本文档由 WeHub 基于上游 README 翻译整理,属于社区翻译,非官方中文文档。
> [English](./README.en.md) · [原始项目](https://github.com/micro/go-micro) · [上游 README](https://github.com/micro/go-micro/blob/HEAD/README.md)
> 原作者、版权与许可证归属以原始项目及本仓库 LICENSE 文件为准。
# Go Micro [![Go.Dev reference](https://img.shields.io/badge/go.dev-reference-007d9c?logo=go&logoColor=white&style=flat-square)](https://pkg.go.dev/go-micro.dev/v6?tab=doc) [![Go Report Card](https://goreportcard.com/badge/github.com/go-micro/go-micro)](https://goreportcard.com/report/github.com/go-micro/go-micro) [![Discord](https://img.shields.io/badge/Discord-join-5865F2?logo=discord&logoColor=white&style=flat-square)](https://discord.gg/G8Gk5j3uXr)
# Go Micro [![Go.Dev reference](https://img.shields.io/badge/go.dev-reference-007d9c?logo=go&logoColor=white&style=flat-square)](https://pkg.go.dev/go-micro.dev/v6?tab=doc) [![Discord](https://img.shields.io/badge/Discord-join-5865F2?logo=discord&logoColor=white&style=flat-square)](https://discord.gg/G8Gk5j3uXr)
Go Micro is an **agent harness** and service framework for Go.
Go Micro 是一个面向 Go 的 **agent harness(智能体运行时框架)** 与服务框架。
**Community:** questions, ideas, or just want to build alongside us? [Join the Discord](https://discord.gg/G8Gk5j3uXr).
**社区:** 有问题、有想法,或想与我们一起构建?[加入 Discord](https://discord.gg/G8Gk5j3uXr).
A harness is the runtime around an agent: the tools it can call, the memory it keeps, the guardrails that bound it, the workflows that trigger it, the services it depends on, and the protocols other agents use to reach it.
Harness 是围绕智能体的运行时:它能调用的工具、它保留的记忆、约束它的护栏、触发它的工作流、它依赖的服务,以及其他智能体与之通信所使用的协议。
Go Micro gives you the harness as Go code. Build an agent and it gets a model, memory, tools, planning, delegation, guardrails, and service discovery; it is reachable over [MCP](https://modelcontextprotocol.io/) and [A2A](https://a2a-protocol.org). Write services and every endpoint becomes an AI-callable tool. Orchestrate the deterministic parts with durable flows. Agents, services, and flows share one runtime because an agent is a distributed system, and building one is building a service.
Go Micro 以 Go 代码的形式提供该 harness。构建一个智能体即可获得模型、记忆、工具、规划、委派、护栏与服务发现;可通过 [MCP](https://modelcontextprotocol.io/) 和 [A2A](https://a2a-protocol.org). 被访问。编写服务后,每个端点都会成为 AI 可调用的工具。用持久化 flow 编排确定性部分。智能体、服务与 flow 共享同一运行时,因为智能体本质上是一个分布式系统,构建智能体就是在构建服务。
## 赞助商
## Sponsors
<a href="https://go-micro.dev/blog/3"><img src="https://upload.wikimedia.org/wikipedia/commons/7/78/Anthropic_logo.svg" height="26" /></a>
&nbsp;&nbsp;
@@ -22,32 +16,32 @@ Go Micro 以 Go 代码的形式提供该 harness。构建一个智能体即可
&nbsp;&nbsp;
<a href="https://go-micro.dev/blog/8"><img src="https://www.atlascloud.ai/logo.svg" height="26" /></a>
**想支持 Go Micro 并在此展示你的 logo** [成为赞助商](https://discord.gg/G8Gk5j3uXr) — 可通过 Discord 联系。
**Want to support Go Micro and see your logo here?** [Become a sponsor](https://discord.gg/G8Gk5j3uXr) — reach out on Discord.
## 商业支持
## Commercial Support
要在生产环境运行 Go Micro,或基于它进行开发并需要帮助?可直接向维护者购买 **支持、咨询、培训与 retainer(长期服务)** — 这些也是项目得以持续维护的支撑。详见 [**Support**](SUPPORT.md) 中的层级说明,或 [提交请求](https://github.com/micro/go-micro/issues/new?template=commercial_support.md).
Running Go Micro in production, or building on it and want help? Paid **support, consulting, training, and retainers** are available directly from the maintainer — and they're what keep the project maintained. See [**Support**](SUPPORT.md) for the tiers, or [open a request](https://github.com/micro/go-micro/issues/new?template=commercial_support.md).
## 目录
## Contents
- [快速开始](#quick-start)
- [首个智能体入门路径](#first-agent-on-ramp)
- [为何需要 Agent Harness](#why-an-agent-harness)
- [编写服务](#writing-services)
- [构建智能体](#building-agents) — [规划与委派](#plan--delegate)、[可插拔](#batteries-included-pluggable)、[付费工具 (x402)](#paid-tools-x402)[A2A](#reachable-by-other-agents-a2a)
- [功能特性](#features)
- [Quick Start](#quick-start)
- [First agent on-ramp](#first-agent-on-ramp)
- [Why an Agent Harness](#why-an-agent-harness)
- [Writing Services](#writing-services)
- [Building Agents](#building-agents) — [Plan & Delegate](#plan--delegate), [Pluggable](#batteries-included-pluggable), [Paid tools (x402)](#paid-tools-x402), [A2A](#reachable-by-other-agents-a2a)
- [Features](#features)
- [CLI](#cli)
- [自主改进循环](#autonomous-improvement-loop)
- [多服务项目](#multi-service-projects)
- [数据模型](#data-model)
- [AI 提供商](#ai-providers)
- [示例](#examples)
- [商业支持](#commercial-support)
- [文档](#docs)
- [Autonomous improvement loop](#autonomous-improvement-loop)
- [Multi-Service Projects](#multi-service-projects)
- [Data Model](#data-model)
- [AI Providers](#ai-providers)
- [Examples](#examples)
- [Commercial Support](#commercial-support)
- [Docs](#docs)
## 快速开始
## Quick Start
安装 CLI
Install the CLI:
```bash
# Binary (no Go required)
@@ -57,11 +51,11 @@ curl -fsSL https://go-micro.dev/install.sh | sh
go install go-micro.dev/v6/cmd/micro@latest
```
如果安装或 `PATH` 检查失败,在搭建第一个服务之前,请先参阅 [安装故障排除指南](internal/website/docs/guides/install-troubleshooting.md)
If install or `PATH` checks fail, use the [install troubleshooting guide](internal/website/docs/guides/install-troubleshooting.md) before scaffolding your first service.
### 最快上手无需 API key
### Fastest startno API key
搭建服务、运行并调用:
Scaffold a service, run it, call it:
```bash
micro new helloworld
@@ -69,85 +63,79 @@ cd helloworld
micro run
```
然后在另一个终端中:
Then in another terminal:
```bash
curl -X POST http://localhost:8080/api/helloworld/Helloworld.Call \
-H 'Content-Type: application/json' -d '{"name":"World"}'
```
这条 安装 → 搭建 → 运行 → 调用 路径由无密钥 CI harness 覆盖。若要在无网络访问或提供商密钥的情况下,仅验证本地安装器与首次运行 CLI 边界,请使用:
This install → scaffold → run → call path is covered by no-secret CI harnesses. To
verify just the local installer and first-run CLI boundaries without network
access or provider keys, use:
```bash
make install-smoke
```
若要验证聚焦的 CLI 内循环契约 — 搭建 → 运行/聊天/检查 → 部署 dry-run — 请使用:
```bash
make inner-loop
```
若仅运行 CI 守护的有序 [0→hero 服务 → 智能体 → 工作流 脚本](internal/website/docs/guides/zero-to-hero.md),请使用:
```bash
make zero-to-hero-transcript
```
若要运行更广泛的本地契约(包括该脚本、聊天/检查 CLI 边界以及部署 dry-run),请使用:
To run the broader local contract (including the [0→hero services → agents → workflows path](internal/website/docs/guides/zero-to-hero.md),
chat/inspect CLI boundaries, and deploy dry-run), use:
```bash
make harness
```
### 首个智能体入门路径
### First agent on-ramp
完成安装并进行首次 `micro new`/`micro run` 冒烟检查后,按以下顺序走可逐步跟进的智能体路径:
After install and the first `micro new`/`micro run` smoke check, take the
walkable agent path in this order:
1. [安装故障排除](internal/website/docs/guides/install-troubleshooting.md) — 在开始智能体相关工作前,验证二进制安装器或 `go install``PATH``micro --version`,以及无密钥冒烟路径。
1. [Install troubleshooting](internal/website/docs/guides/install-troubleshooting.md) — verify the binary installer or `go install`, `PATH`, `micro --version`, and the no-secret smoke path before agent work.
2. `micro agent demo` — print the provider-free first-agent demo command and next docs steps from the installed CLI.
3. `micro examples` — print the maintained provider-free runnable examples in copy/paste order.
4. `micro zero-to-hero` — print the maintained one-command no-secret lifecycle harness and runnable examples.
5. [Examples wayfinding index](examples/INDEX.md) — choose the smallest no-secret first-agent, maintained [0→hero support reference](examples/support/), and next interop examples from one map.
6. [Smallest first-agent example](examples/first-agent/) — run one service-backed agent with a mock model and no provider key.
7. [No-secret first-agent transcript](internal/website/docs/guides/no-secret-first-agent.md) — run the
maintained support agent with a mock model and see services → agents → workflows succeed without a key.
8. [Your First Agent](internal/website/docs/guides/your-first-agent.md) — build a
service-backed agent and talk to it with `micro chat`.
9. [Debugging your agent](internal/website/docs/guides/debugging-agents.md) — use
`micro inspect agent <name>`, run history, memory, and provider checks when the first
conversation does something unexpected.
10. [0→hero Reference](internal/website/docs/guides/zero-to-hero.md) — complete the
services → agents → workflows loop with scaffold, run, chat, inspect, flow
history, and deploy dry-run commands that match the maintained harness.
运行 `make docs-wayfinding` 以验证聚焦的无密钥 docs/CLI 契约,确保本 README 与网站命令与已安装的 CLI 保持一致。
### Autonomous improvement loop
2. `micro agent demo` — 从已安装的 CLI 打印无需提供商的首个智能体演示命令及后续文档步骤。
3. `micro agent quickcheck`(或 `micro agent debug`)— 当 搭建 → 运行 → 聊天 → 检查 流程卡住时,在深入完整调试指南前,先打印简短恢复路线图。
4. `micro examples` — 按可复制/粘贴顺序打印维护中的、无需提供商的可运行示例。
5. `micro zero-to-hero` — 打印维护中的一条命令无密钥生命周期 harness 与可运行示例。
6. [示例导航索引](examples/INDEX.md) — 从一张地图中选择最小的无密钥首个智能体示例、维护中的 [0→hero 支持参考](examples/support/),以及后续互操作示例。
7. [最小首个智能体示例](examples/first-agent/) — 使用 mock 模型且无需提供商密钥,运行一个由服务支撑的智能体。
8. [无密钥首个智能体脚本](internal/website/docs/guides/no-secret-first-agent.md) — 使用 mock 模型运行维护中的支持智能体,在无密钥情况下见证 服务 → 智能体 → 工作流 成功。
9. [你的第一个智能体](internal/website/docs/guides/your-first-agent.md) — 构建一个由服务支撑的智能体,并通过 `micro chat` 与之对话。
10. [调试你的智能体](internal/website/docs/guides/debugging-agents.md) — 在 `micro run` 之前使用 `micro agent preflight`,在 `micro run` 之后使用 `micro agent doctor`
然后使用 `micro chat``micro inspect agent <name>` 恢复运行历史、记忆
以及提供商检查,以应对首次对话出现意外行为的情况。
11. [0→hero 参考](internal/website/docs/guides/zero-to-hero.md) — 通过与服务维护 harness 一致的 搭建、运行、聊天、检查、flow
历史与部署 dry-run 命令,完成 服务 → 智能体 → 工作流 循环。
### 自主改进循环
想将同样的 服务 → 智能体 → 工作流 生命周期应用到你的仓库?`micro loop` 会搭建 Go
Micro 自身使用的自主改进循环:North Star、排序后的问题队列、角色提示词、GitHub Actions
工作流,以及面向 CI 门禁 PR 的验证。
Want the same services → agents → workflows lifecycle applied to your
repository? `micro loop` scaffolds the autonomous improvement loop used by Go
Micro itself: a North Star, ranked issue queue, role prompts, GitHub Actions
workflows, and verification for CI-gated PRs.
```bash
micro loop init --roles all
micro loop verify
```
在启用定时任务之前,请配置 dispatch token,例如
`CODEX_TRIGGER_TOKEN`,用必需的 CI 检查保护默认分支
(对本仓库为 `go build ./...``go test ./...` `golangci-lint run ./...`),
并在每个增量中为 `.github/loop/PRIORITIES.md` 填入一个范围明确的问题。设置清单与运行模型请参阅 [`micro loop` 快速开始](internal/website/docs/guides/micro-loop.md)。
Before turning on the schedule, configure a dispatch token such as
`CODEX_TRIGGER_TOKEN`, protect the default branch with required CI checks
(`go build ./...`, `go test ./...`, and `golangci-lint run ./...` for this
repository), and seed `.github/loop/PRIORITIES.md` with one scoped issue per
increment. See the [`micro loop` quickstart](internal/website/docs/guides/micro-loop.md)
for the setup checklist and operating model.
### 通过提示词生成 — 需要 LLM key
### Generate from a prompt — with an LLM key
设置提供商密钥,描述你的需求,AI 会设计服务、编写 handler、编译并启动它们:
Set a provider key, describe what you want, and the AI designs services, writes handlers, compiles, and starts them:
```bash
export ANTHROPIC_API_KEY=sk-ant-... # or OPENAI_API_KEY, GEMINI_API_KEY, ...
micro run --prompt "a task management system with categories" --provider anthropic
```
AI 设计架构,你进行评审,随后它会生成包含真实业务逻辑的 handler、编译并启动:
The AI designs the architecture, you review it, then it generates handlers with real business logic, compiles them, and starts them:
```
Services:
@@ -164,7 +152,7 @@ Micro
◆ agent
```
然后在控制台中与你的服务对话:
Then talk to your services from the console:
```
> Create a project called Launch, then add three tasks to it
@@ -178,7 +166,7 @@ Micro
Created project Launch and added three tasks to it.
```
当你需要尚不存在的能力时,代理会在对话过程中生成一项新服务:
When you need a capability that doesn't exist, the agent generates a new service mid-conversation:
```
> I need to track shipping. Create a shipment for order 123 to London.
@@ -191,25 +179,25 @@ Created project Launch and added three tasks to it.
Created shipment for order 123 going to London.
```
你可以随时手动编辑生成的代码——重新运行会保留你的修改。[了解更多](https://go-micro.dev/blog/13).
Edit the generated code by hand at any time — re-running preserves your changes. [Read more](https://go-micro.dev/blog/13).
## 为何需要 Agent Harness
## Why an Agent Harness
第一波代理框架帮助开发者让模型进入循环。下一个问题是如何运营这个循环:将其连接到真实工具、限定可触及范围、保留状态、将工作路由给专家、从故障中恢复、观测发生了什么,并让其他代理调用它。这就是 harness 工作。
The first wave of agent frameworks helped developers put a model in a loop. The next problem is operating that loop: connecting it to real tools, scoping what it can touch, preserving state, routing work to specialists, recovering from failures, observing what happened, and letting other agents call it. That is harness work.
Go Micro 的答案是:让 harness 与你已部署的东西合二为一:
Go Micro's answer is to make the harness the same thing you already deploy:
- **工具即服务** — 端点元数据成为工具 schemaRPC 执行调用。
- **代理即服务** — 它们注册、发现、负载均衡,并暴露 `Agent.Chat`
- **工作流即持久化代码路径** — 路径已知时使用 flows;未知时分派给代理。
- **安全落在执行层** — `MaxSteps``LoopLimit``ApproveTool` 以及工具包装器在动作发生处运行。
- **互操作内置** — 工具用 MCP,代理用 A2A,付费工具用 x402。
- **Tools are services** — endpoint metadata becomes tool schema; RPC executes the call.
- **Agents are services** — they register, discover, load-balance, and expose `Agent.Chat`.
- **Workflows are durable code paths** — use flows when the path is known; dispatch to agents when it is not.
- **Safety lives at execution** — `MaxSteps`, `LoopLimit`, `ApproveTool`, and tool wrappers run where actions happen.
- **Interop is built in** — MCP for tools, A2A for agents, x402 for paid tools.
当代理需要操作系统而不仅是回答提示时,使用 Go Micro。
Use Go Micro when the agent has to operate a system, not just answer a prompt.
## 编写服务
## Writing Services
底层而言,服务是带方法的 struct。文档注释和 `@example` 标签会自动成为 AI 代理的工具描述。
Under the hood, a service is a struct with methods. Doc comments and `@example` tags become tool descriptions for AI agents automatically.
```go
package main
@@ -244,7 +232,7 @@ func main() {
}
```
运行后一切皆可访问——RESTgRPCMCPagent playground
Run it and everything is accessible — REST, gRPC, MCP, agent playground:
```bash
micro run
@@ -254,16 +242,16 @@ micro run
# MCP Tools: http://localhost:8080/mcp/tools
```
你也可以从模板脚手架生成服务:
You can also scaffold a service from a template:
```bash
micro new helloworld
micro new contacts --template crud
```
## 构建代理
## Building Agents
代理是内置 LLM 的服务。它拥有 proto 定义的 `Agent.Chat` RPC 端点,在 registry 中注册,并可像任何服务一样被调用:
An Agent is a service with an LLM inside it. It has a proto-defined `Agent.Chat` RPC endpoint, registers in the registry, and is callable like any service:
```go
agent := micro.NewAgent("task-mgr",
@@ -274,7 +262,7 @@ agent := micro.NewAgent("task-mgr",
agent.Run()
```
代理从 registry 发现其服务,将工具限定到对应端点,并在 store 中维护对话记忆。它会自我注册,以便 `micro chat` 及其他代理能找到它。
The agent discovers its services from the registry, scopes its tools to their endpoints, and maintains conversation memory in the store. It registers itself so `micro chat` and other agents can find it.
```go
// Programmatic interaction
@@ -282,21 +270,21 @@ resp, _ := agent.Ask(ctx, "What tasks are overdue?")
fmt.Println(resp.Reply)
```
多个代理通过 RPC 协调——每个都是带有 `Agent.Chat` 端点的服务。`micro chat` 会路由到正确的那一个。
Multiple agents coordinate via RPC — each is a service with an `Agent.Chat` endpoint. `micro chat` routes to the right one.
```bash
micro agent list # list registered agents
micro call task-mgr Agent.Chat '{"message": "What tasks are overdue?"}'
```
### 规划与委托(Plan & Delegate
### Plan & Delegate
每个代理都具备两种内置 harness 能力,以工具形式暴露——无需额外设置或独立的图运行时:
Every agent gets two built-in harness capabilities, exposed as tools — no extra setup or separate graph runtime:
- **`plan`** — 对于多步骤工作,代理在其 store 支撑的记忆中记录有序计划,并在多轮对话中保持方向。
- **`delegate`** — 代理将自包含的子任务交给另一个代理。若已注册的代理已拥有相关服务,则通过 RPC 交接给该代理;否则会为该子任务创建一个专注、短命的子代理,并配备独立隔离的上下文。
- **`plan`** — for multi-step work, the agent records an ordered plan in its store-backed memory and stays oriented across turns.
- **`delegate`** — the agent hands a self-contained subtask to another agent. If a registered agent already owns the relevant services, the hand-off goes over RPC to that agent; otherwise a focused, short-lived sub-agent is created for the subtask with its own isolated context.
这让智能保持分布式:代理不必知道*如何*完成一切,只需知道*谁*来做。参见 [examples/agent-plan-delegate](examples/agent-plan-delegate/)
This keeps intelligence distributed: an agent doesn't need to know *how* to do everything, only *who* does. See [examples/agent-plan-delegate](examples/agent-plan-delegate/).
```go
// A sub-agent is just an agent — created with New, talked to with Ask.
@@ -304,9 +292,9 @@ micro call task-mgr Agent.Chat '{"message": "What tasks are overdue?"}'
resp, _ := agent.Ask(ctx, "Plan the launch, create the tasks, and have comms notify the owner.")
```
### 开箱即用,可插拔
### Batteries included, pluggable
正如服务组合可插拔抽象(registrybrokerstore),代理组合 **model****memory** 和 **tools**——开箱即用的合理默认,每一项都可替换。
Just as a service composes pluggable abstractions (registry, broker, store), an agent composes a **model**, **memory**, and **tools** — sane defaults out of the box, each swappable.
```go
agent := micro.NewAgent("assistant",
@@ -321,11 +309,11 @@ agent := micro.NewAgent("assistant",
)
```
**Memory(记忆)** 默认持久且由 store 支撑(PostgresNATS KV file),因此代理在重启后可从上次停下的地方继续——也可用 `AgentMemory` 提供你自己的实现。长期运行的代理可选用 `AgentCompactMemory(maxMessages, keepRecent)`:较早轮次被折叠为确定性摘要,最近轮次保持原文,相关归档轮次在未来请求时被召回,而无需重放整段对话。**Tools(工具)** 自动就是你的服务,加上你用 `AgentTool` 注册的任何函数。
**Memory** is durable and store-backed by default (Postgres, NATS KV, or file), so an agent picks up where it left off after a restart — or supply your own with `AgentMemory`. Long-running agents can opt into `AgentCompactMemory(maxMessages, keepRecent)`: older turns are collapsed into a deterministic summary, recent turns stay verbatim, and relevant archived turns are recalled on future asks without replaying the whole conversation. **Tools** are your services automatically, plus any function you register with `AgentTool`.
### 付费工具(x402
### Paid tools (x402)
每个端点都是 AI 可调用的工具——而且可以是*付费*工具。Go Micro 支持 [x402](https://x402.org), 面向代理的 HTTP 402 支付标准,因此工具可要求稳定币支付,代理可自主结算。这是可选功能,框架本身不携带加密货币逻辑:验证委托给可插拔的 facilitatorCoinbaseAlchemy、自托管),因此 Base Solana 只是不同的 facilitator
Every endpoint is an AI-callable tool — and it can be a *paid* tool. Go Micro supports [x402](https://x402.org), the HTTP 402 payment standard for agents, so a tool can require a stablecoin payment and an agent can settle it autonomously. It's opt-in and carries no crypto in the framework: verification is delegated to a pluggable facilitator (Coinbase, Alchemy, self-hosted), so Base and Solana are just different facilitators.
```bash
# Charge for tool calls at the MCP gateway (off unless you set a pay-to address)
@@ -334,84 +322,84 @@ micro mcp serve --x402_pay_to 0xYourAddress --x402_network solana --x402_amount
micro mcp serve --x402_config x402.json
```
参见 [Payments (x402) guide](internal/website/docs/guides/x402-payments.md)
See the [Payments (x402) guide](internal/website/docs/guides/x402-payments.md).
### 可被其他代理访问(A2A
### Reachable by other agents (A2A)
Go Micro 系统内,代理通过 RPC 相互访问。要让*其他*框架上的代理也能访问它们,Go Micro 使用 [Agent2Agent (A2A) protocol](https://a2a-protocol.org). A2A 网关从 registry 发现你的代理,根据其元数据为每个代理生成 Agent Card——与 MCP 网关从服务端点派生工具的方式相同——并将传入的 A2A 任务翻译为代理的 `Agent.Chat` RPC。无需为每个代理编写代码:注册代理即可通过 A2A 访问。
Within a Go Micro system, agents reach each other over RPC. To make them reachable by agents on *other* frameworks, Go Micro speaks the [Agent2Agent (A2A) protocol](https://a2a-protocol.org). The A2A gateway discovers your agents from the registry, generates an Agent Card for each from its metadata — the same way the MCP gateway derives tools from service endpoints — and translates incoming A2A tasks to the agent's `Agent.Chat` RPC. No per-agent code: register an agent and it's reachable over A2A.
```bash
micro a2a serve --address :4000 # gateway: expose every registered agent over A2A
micro a2a list # agents and their Agent Card URLs
```
或者完全跳过网关——代理可直接提供自己的 A2A 端点,在进程内处理任务:
Or skip the gateway entirely — an agent can serve its own A2A endpoint directly, handling tasks in-process:
```go
micro.NewAgent("task-mgr", micro.AgentServices("task"), micro.AgentA2A(":4000"))
```
双向皆可。要调用其他框架上的代理,`a2a.Client` 会接入两处交接工作的地方:作为工作流步骤的 `flow.A2A(url)`(跨框架的 `Dispatch`),以及从代理内部向 `http(s)` URL 发起的 `delegate`
It works both ways. To call an agent on another framework, an `a2a.Client` is wired into the two places that hand off work: `flow.A2A(url)` as a workflow step (the cross-framework `Dispatch`), and `delegate` to an `http(s)` URL from inside an agent.
MCP 将你的服务暴露为工具;A2A 将你的代理暴露为代理。参见 [A2A guide](internal/website/docs/guides/a2a-protocol.md)
MCP exposes your services as tools; A2A exposes your agents as agents. See the [A2A guide](internal/website/docs/guides/a2a-protocol.md).
## 功能特性
## Features
### AI
| 功能 | 详情 |
| Feature | Details |
|---------|---------|
| Agents(智能体) | `micro.NewAgent()`管理服务的智能层 |
| Plan & delegate(规划与委派) | 内置 agent 工具 — 规划多步骤工作,将子任务委派给其他 agent |
| Pluggable memory(可插拔记忆) | 默认基于持久化存储的对话记忆;可通过 `AgentMemory` 替换 |
| Custom tools(自定义工具) | `AgentTool`为 agent 提供除服务之外的任意函数作为工具 |
| Guardrails(护栏) | `MaxSteps`(按次数停止)、`LoopLimit`(停止重复的无进展调用)、`ApproveTool`human-in-the-loop,人在回路) |
| Tool middleware(工具中间件) | `AgentWrapTool`包装工具执行以实现日志、指标或重试(类似 client/server wrappers |
| Workflows(工作流) | `micro.NewFlow()`事件驱动;单步、有序持久化步骤,或触发 agent |
| Durable execution(持久化执行) | 带检查点的流程步骤可在崩溃后存活并从停止处恢复;默认基于存储,后端可插拔 |
| MCP gateway | 每个 endpoint 自动成为 AI 工具 |
| A2A gateway | 每个 agent 均可通过 Agent2Agent 协议访问;卡片由 registry`micro a2a`)生成 |
| Payments (x402) | 通过 x402 标准按调用选择性为工具付费;facilitator 可插拔(BaseSolana 等) |
| 9 LLM 提供商 | AnthropicOpenAIGeminiGroqMistralTogetherAtlas CloudMiniMaxOllama(本地 + 云端) |
| Interactive console(交互式控制台) | `micro run` 包含与服务对话的聊天控制台 |
| Service generation(服务生成) | `micro run --prompt`描述系统即可获得运行中的服务 |
| Agents | `micro.NewAgent()`intelligent layer that manages services |
| Plan & delegate | Built-in agent tools — plan multi-step work, delegate subtasks to other agents |
| Pluggable memory | Durable store-backed conversation memory by default; swap with `AgentMemory` |
| Custom tools | `AgentTool`give an agent any function as a tool, beyond its services |
| Guardrails | `MaxSteps` (stop on count), `LoopLimit` (stop repeated no-progress calls), `ApproveTool` (human-in-the-loop) |
| Tool middleware | `AgentWrapTool`wrap tool execution for logging, metrics, or retries (like client/server wrappers) |
| Workflows | `micro.NewFlow()`event-driven; one step, ordered durable steps, or triggers an agent |
| Durable execution | Checkpointed flow steps survive a crash and resume where they stopped; store-backed by default, pluggable backend |
| MCP gateway | Every endpoint is an AI tool automatically |
| A2A gateway | Every agent is reachable over the Agent2Agent protocol; cards generated from the registry (`micro a2a`) |
| Payments (x402) | Opt-in per-call payments for tools via the x402 standard; pluggable facilitator (Base, Solana, …) |
| 9 LLM providers | Anthropic, OpenAI, Gemini, Groq, Mistral, Together, Atlas Cloud, MiniMax, Ollama (local + cloud) |
| Interactive console | `micro run` includes a chat console for talking to services |
| Service generation | `micro run --prompt`describe a system, get running services |
### 框架
### Framework
| 功能 | 详情 |
| Feature | Details |
|---------|---------|
| Service registry(服务注册) | mDNS(默认)、Consuletcd |
| RPC client/server | gRPC 传输、负载均衡、流式传输 |
| Pub/sub events(发布/订阅事件) | NATSRabbitMQHTTP broker |
| Key-value store(键值存储) | File (bbolt)PostgresNATS KV |
| Typed model layer(类型化模型层) | CRUD + 查询,SQLite/Postgres 后端 |
| Everything swappable(一切皆可替换) | 所有抽象均为 Go interface |
| Service registry | mDNS (default), Consul, etcd |
| RPC client/server | gRPC transport, load balancing, streaming |
| Pub/sub events | NATS, RabbitMQ, HTTP broker |
| Key-value store | File (bbolt), Postgres, NATS KV |
| Typed model layer | CRUD + queries, SQLite/Postgres backends |
| Everything swappable | All abstractions are Go interfaces |
### 开发者体验与部署
### Developer experience & deployment
| 功能 | 详情 |
| Feature | Details |
|---------|---------|
| Hot reload(热重载) | `micro run` 监听文件变更并重新构建 |
| Templates(模板) | `micro new --template crud/pubsub/api` |
| One-command deploy(一键部署) | `micro deploy user@server` — SSH + systemd,无需 Docker |
| Hot reload | `micro run` watches files, rebuilds on change |
| Templates | `micro new --template crud/pubsub/api` |
| One-command deploy | `micro deploy user@server` — SSH + systemd, no Docker |
## CLI
| 命令 | 用途 |
| Command | Purpose |
|---------|---------|
| `micro run --prompt "..."` | 生成服务与 agent,并启动交互式控制台 |
| `micro run` | 开发模式:热重载、gateway、交互式控制台 |
| `micro run -d` | 分离模式(无控制台) |
| `micro chat` | 独立聊天(未使用 micro run 时) |
| `micro agent list` | 列出已注册的 agent |
| `micro new myservice` | 脚手架生成服务 |
| `micro call service endpoint '{}'` | 从 CLI 调用服务或 agent |
| `micro build` | 编译生产二进制文件 |
| `micro deploy user@server` | 通过 SSH + systemd 部署 |
| `micro run --prompt "..."` | Generate services + agent, start with interactive console |
| `micro run` | Dev mode: hot reload, gateway, interactive console |
| `micro run -d` | Detached mode (no console) |
| `micro chat` | Standalone chat (when not using micro run) |
| `micro agent list` | List registered agents |
| `micro new myservice` | Scaffold a service |
| `micro call service endpoint '{}'` | Call a service or agent from the CLI |
| `micro build` | Compile production binaries |
| `micro deploy user@server` | Deploy via SSH + systemd |
## 多服务项目
## Multi-Service Projects
同时运行多个服务:
Run multiple services together:
```go
users := micro.NewService("users", micro.Address(":9001"))
@@ -424,7 +412,7 @@ g := micro.NewGroup(users, orders)
g.Run()
```
或使用 `micro.mu` 配置文件:
Or use a `micro.mu` config file:
```
service users
@@ -435,9 +423,9 @@ service orders
depends users
```
## 数据模型
## Data Model
类型化持久化,支持 CRUD 与查询:
Typed persistence with CRUD and queries:
```go
type User struct {
@@ -454,13 +442,13 @@ var results []*User
db.List(ctx, &results, model.Where("email", "alice@example.com"))
```
后端:memory(默认)、SQLitePostgres
Backends: memory (default), SQLite, Postgres.
## AI 提供商
## AI Providers
单次 import 即可切换提供商 — 各处使用相同 interface
Swap providers with a single import — same interface everywhere:
| 提供商 | 默认模型 |
| Provider | Default Model |
|----------|---------------|
| Anthropic | `claude-sonnet-4-20250514` |
| OpenAI | `gpt-4o` |
@@ -477,34 +465,34 @@ m := ai.New("anthropic", ai.WithAPIKey(key))
resp, _ := m.Generate(ctx, &ai.Request{Prompt: "hello"})
```
## 示例
## Examples
初次接触 agent?请跟随 [first-agent on-ramp](#first-agent-on-ramp),然后使用 [examples index](examples/README.md) 查看完整的 services → agents → workflows 映射。
New to agents? Follow the [first-agent on-ramp](#first-agent-on-ramp), then use the [examples index](examples/README.md) for the full services → agents → workflows map.
- [hello-world](examples/hello-world/) — 基础 RPC 服务
- [multi-service](examples/multi-service/) — 单个二进制文件中运行多个服务
- [mcp](examples/mcp/) — 与 AI agent 的 MCP 集成
- [first-agent](examples/first-agent/) — 最小化、无需 provider 的服务支撑型 agent
- [agent-plan-delegate](examples/agent-plan-delegate/) — Agent 规划与多 agent 委派
- [agent-durable](examples/agent-durable/) — 检查点与恢复 agent 运行,无需重放已完成的工具副作用
- [grpc-interop](examples/grpc-interop/) — 从任意 gRPC 客户端调用 go-micro
- [hello-world](examples/hello-world/) — Basic RPC service
- [multi-service](examples/multi-service/) — Multiple services in one binary
- [mcp](examples/mcp/) — MCP integration with AI agents
- [first-agent](examples/first-agent/) — Smallest provider-free service-backed agent
- [agent-plan-delegate](examples/agent-plan-delegate/) — Agent planning and multi-agent delegation
- [agent-durable](examples/agent-durable/) — Checkpoint and resume an agent run without replaying completed tool side effects
- [grpc-interop](examples/grpc-interop/) — Call go-micro from any gRPC client
查看 [all examples](examples/README.md)
See [all examples](examples/README.md).
## 文档
## Docs
- [入门指南](internal/website/docs/getting-started.md)
- [AI 集成](internal/website/docs/ai-integration.md)
- [你的第一个 Agent](internal/website/docs/guides/your-first-agent.md)
- [0→hero 参考](internal/website/docs/guides/zero-to-hero.md)
- [Agent 与工作流](internal/website/docs/guides/agents-and-workflows.md)
- [Agent 设计](internal/docs/AGENT_DESIGN.md)
- [规划与委派](internal/website/docs/guides/plan-delegate.md)
- [Agent 护栏](internal/website/docs/guides/agent-guardrails.md)
- [支付(x402](internal/website/docs/guides/x402-payments.md)
- [MCP AI Agent](internal/website/docs/mcp.md)
- [数据模型](internal/website/docs/model.md)
- [部署](internal/website/docs/deployment.md)
- [插件](internal/website/docs/plugins.md)
- [Getting Started](internal/website/docs/getting-started.md)
- [AI Integration](internal/website/docs/ai-integration.md)
- [Your First Agent](internal/website/docs/guides/your-first-agent.md)
- [0→hero Reference](internal/website/docs/guides/zero-to-hero.md)
- [Agents and Workflows](internal/website/docs/guides/agents-and-workflows.md)
- [Agent Design](internal/docs/AGENT_DESIGN.md)
- [Plan & Delegate](internal/website/docs/guides/plan-delegate.md)
- [Agent Guardrails](internal/website/docs/guides/agent-guardrails.md)
- [Payments (x402)](internal/website/docs/guides/x402-payments.md)
- [MCP & AI Agents](internal/website/docs/mcp.md)
- [Data Model](internal/website/docs/model.md)
- [Deployment](internal/website/docs/deployment.md)
- [Plugins](internal/website/docs/plugins.md)
包参考:https://pkg.go.dev/go-micro.dev/v6
Package reference: https://pkg.go.dev/go-micro.dev/v6
-7
View File
@@ -1,7 +0,0 @@
# WeHub 来源说明
- 原始项目:`micro/go-micro`
- 原始仓库:https://github.com/micro/go-micro
- 导入方式:上游默认分支的最新快照
- 原作者、版权和许可证信息以原始仓库及本仓库 LICENSE 为准
- 本文件仅用于记录来源,不代表 WeHub 是原项目作者
+20 -45
View File
@@ -14,9 +14,8 @@ The full, current roadmap lives at **[go-micro.dev/docs/roadmap](https://go-micr
## Where we are (v6)
Services, agents (`plan`/`delegate`, guardrails, memory, tool middleware,
checkpoint/resume, and OpenTelemetry run spans), durable flows, the MCP and A2A
gateways (both directions, including A2A streaming,
Services, agents (`plan`/`delegate`, guardrails, memory, tool middleware), durable
flows, the MCP and A2A gateways (both directions, including A2A streaming,
push notifications, and multi-turn continuation), x402 paid tools, secure by
default.
@@ -32,55 +31,31 @@ default.
and history, end to end.
5. Battle-tested: works across every provider, fails safely, observable.
The forward work is **net-new capability**, not more hardening. Maintenance
(conformance, resilience, DX polish) continues in the background (see *Ongoing*
below) — but it is not the roadmap. This capability work is.
## Now — hardening
## Now — capability
- **Cross-provider conformance** — the same agent scenario across all seven
providers, gated on keys, on a schedule.
- **Failure & resilience** — timeouts, rate limits, cancellation, deadline/context
propagation, retry/backoff.
- **Getting-started contract** — define and CI-verify the 0→1 and 0→hero flows.
- **Agents that pay (x402 buyer in the runtime).** The seller side ships (paid
tools via the `wrapper/x402` middleware) and the buyer `x402.Client` (a
budget-capped `Payer` that turns a `402` into pay-and-retry) exists — but an
agent can't yet *autonomously* pay for a paid tool. Wire the buyer into the
agent tool loop: a budget-capped `AgentPayer` so an agent that hits a
payment-required tool settles it within budget and retries, with the spend
gated (like `ApproveTool`) and observable in `RunInfo`/traces. This makes
go-micro a runtime for **autonomous agent commerce**. *(flagship — decomposed
into issues in the loop queue)*
- **AP2 mandate foundation** ([#3552](https://github.com/micro/go-micro/issues/3552))
— verifiable payment **mandates** (a Checkout Mandate and a Payment Mandate),
signed and attached over A2A, with the Payment Mandate naming an x402 rail. The
authorization/audit layer above A2A + x402 that positions go-micro early in the
emerging agent-payments standard (Google's AP2, standardized via FIDO).
Additive and opt-in.
## Next — agentic depth
## Next — reach & deployment
- **Durable agent loop** — resume a long run via `Checkpoint` (flows already do).
- **Streaming** — broaden provider-backed `ai.Stream` coverage and keep chat/A2A streaming end to end.
- **Agent observability** — `RunInfo` → OpenTelemetry spans.
- **gRPC-reflection MCP** — derive MCP tools from *any* gRPC service via server
reflection, not just go-micro-native handlers. Point the gateway at an external
gRPC service and its methods become agent tools — a large jump in what an agent
can operate.
- **Kubernetes operator + CRDs** — `Agent`, `Service`, and `Flow` as first-class
Kubernetes resources; an operator reconciles them into Deployments wired to the
registry. The production deployment story for teams already on K8s.
## Later
## Later — exploratory
- Memory management (summarization, retrieval/RAG); human-in-the-loop pause/resume;
richer A2A live-stream reconnection (`tasks/resubscribe`) and `input-required`
handoffs.
- **Runtime-fitness loop** — a persistently-running dogfood app (Mu) plus an
operator/canary loop role, so the autonomous loop evolves go-micro against
**real runtime signal** (latency, errors, cost) with canary + rollback — not
just green CI. The demand signal the loop is missing today.
- **HTTP/3 transport**; richer A2A live-stream reconnection (`tasks/resubscribe`,
`input-required` handoffs); memory management (summarization, retrieval/RAG).
## Developer experience (ongoing)
## Ongoing — hardening & DX (background, not the headline)
Continuous but **capped** so it never crowds out capability: cross-provider
conformance, failure/resilience (timeouts, cancellation, retry/backoff), the
0→1 and 0→hero getting-started contract, streaming/observability coherence, and a
seamless CLI inner loop (scaffold → run → chat → inspect → deploy). Real, but
maintenance — the loop should spend the majority of its cycles on the capability above,
not here.
- A seamless CLI inner loop (scaffold → run → chat → inspect → deploy); UI
discipline (trim what isn't great); a maintained real-world example that doubles
as the 0→hero reference; docs kept in lockstep with the code.
## How it's sustained
+21 -65
View File
@@ -68,79 +68,35 @@ func TestA2AStreamUsesAgentChatPathWithTools(t *testing.T) {
t.Fatalf("stream body missing tool marker: %s", rr.Body.String())
}
// The spec-shaped stream carries the answer as append artifact-update
// deltas and closes with a completed status-update (final:true).
var (
text strings.Builder
finalState string
sawFinal bool
)
var final struct {
Result struct {
Status struct {
State string `json:"state"`
} `json:"status"`
Artifacts []struct {
Parts []struct {
Text string `json:"text"`
} `json:"parts"`
} `json:"artifacts"`
} `json:"result"`
Error any `json:"error"`
}
for _, line := range strings.Split(strings.TrimSpace(rr.Body.String()), "\n") {
line = strings.TrimSpace(strings.TrimPrefix(strings.TrimSpace(line), "data: "))
if line == "" {
continue
}
var ev struct {
Result json.RawMessage `json:"result"`
Error any `json:"error"`
}
if err := json.Unmarshal([]byte(line), &ev); err != nil {
if err := json.Unmarshal([]byte(line), &final); err != nil {
t.Fatalf("decode event %q: %v", line, err)
}
if ev.Error != nil {
t.Fatalf("event carried an error field: %+v", ev.Error)
}
var kind struct {
Kind string `json:"kind"`
}
_ = json.Unmarshal(ev.Result, &kind)
switch kind.Kind {
case "artifact-update":
var au struct {
Artifact struct {
Parts []struct {
Text string `json:"text"`
} `json:"parts"`
} `json:"artifact"`
}
_ = json.Unmarshal(ev.Result, &au)
for _, p := range au.Artifact.Parts {
text.WriteString(p.Text)
}
case "status-update":
var su struct {
Status struct {
State string `json:"state"`
} `json:"status"`
Final bool `json:"final"`
}
_ = json.Unmarshal(ev.Result, &su)
if su.Final {
sawFinal = true
finalState = su.Status.State
}
default: // opening "task" snapshot
var task struct {
Artifacts []struct {
Parts []struct {
Text string `json:"text"`
} `json:"parts"`
} `json:"artifacts"`
}
_ = json.Unmarshal(ev.Result, &task)
for _, a := range task.Artifacts {
for _, p := range a.Parts {
if p.Text != "" {
text.WriteString(p.Text)
}
}
}
}
}
if !sawFinal || finalState != "completed" {
t.Fatalf("want a completed final:true status-update; sawFinal=%v state=%q", sawFinal, finalState)
if final.Error != nil {
t.Fatalf("final event error: %+v", final.Error)
}
if !strings.Contains(text.String(), "a2a-stream-ok") {
t.Fatalf("reassembled stream text missing tool marker: %q", text.String())
if final.Result.Status.State != "completed" {
t.Fatalf("final state = %q, want completed", final.Result.Status.State)
}
if len(final.Result.Artifacts) != 1 || len(final.Result.Artifacts[0].Parts) != 1 || !strings.Contains(final.Result.Artifacts[0].Parts[0].Text, "a2a-stream-ok") {
t.Fatalf("final artifacts = %+v, want tool marker", final.Result.Artifacts)
}
}
+5 -95
View File
@@ -15,9 +15,7 @@ package agent
import (
"context"
"encoding/json"
"errors"
"fmt"
"io"
"net/http"
"strings"
"sync"
@@ -35,7 +33,6 @@ import (
_ "go-micro.dev/v6/ai/atlascloud"
_ "go-micro.dev/v6/ai/gemini"
_ "go-micro.dev/v6/ai/groq"
_ "go-micro.dev/v6/ai/minimax"
_ "go-micro.dev/v6/ai/mistral"
_ "go-micro.dev/v6/ai/ollama"
_ "go-micro.dev/v6/ai/openai"
@@ -83,8 +80,6 @@ type agentImpl struct {
// steps counts tool executions in the current Ask, for MaxSteps.
steps int
// spend counts reserved paid-tool spend in the current Ask, for MaxSpend.
spend int64
// calls counts identical tool calls (name+args) in the current Ask,
// for LoopLimit.
calls map[string]int
@@ -104,17 +99,6 @@ type agentImpl struct {
// holding mu. Tool execution updates it so resumed runs can reuse
// completed tool results without replaying side effects.
currentRun *flow.Run
// delegateCalls collapses concurrent equivalent delegate tool calls so a
// provider replay cannot fan out duplicate delegated side effects before the
// durable delegate-result cache is written.
delegateMu sync.Mutex
delegateCalls map[string]*delegateCall
// stopCh lets Stop unblock Run. Without this, tests and harnesses that
// start agents in goroutines can leave Run parked forever after the RPC
// server has been stopped.
stopCh chan struct{}
}
// New creates a new Agent.
@@ -230,9 +214,6 @@ func (a *agentImpl) Ask(ctx context.Context, message string) (*Response, error)
func (a *agentImpl) Stream(ctx context.Context, message string) (ai.Stream, error) {
a.mu.Lock()
defer a.mu.Unlock()
if err := ctx.Err(); err != nil {
return nil, err
}
if a.model == nil {
a.setup()
}
@@ -240,61 +221,19 @@ func (a *agentImpl) Stream(ctx context.Context, message string) (ai.Stream, erro
if err != nil {
return nil, fmt.Errorf("discover tools: %w", err)
}
runID := uuid.New().String()
ctx = ai.WithRunInfo(ctx, ai.RunInfo{
RunID: runID,
ParentID: a.parentRunID,
Agent: a.opts.Name,
})
messages := append([]ai.Message(nil), a.mem.Messages()...)
messages = append(messages, ai.Message{Role: "user", Content: message})
a.mem.Add("user", message)
stream, err := a.model.Stream(ctx, &ai.Request{
Prompt: message,
SystemPrompt: a.buildPrompt(),
Tools: toolList,
Messages: messages,
Messages: a.mem.Messages(),
})
if err != nil {
return nil, err
}
if err := ctx.Err(); err != nil {
_ = stream.Close()
return nil, err
}
a.mem.Add("user", message)
return &memoryRecordingStream{stream: stream, memory: a.mem}, nil
}
// StreamChat serves the Agent.StreamChat RPC endpoint by forwarding stream-capable
// remote clients to the agent streaming path. If the model cannot stream, the
// underlying error is returned so callers can fall back to Agent.Chat.
func (a *agentImpl) StreamChat(ctx context.Context, stream pb.Agent_StreamChatStream) error {
req, err := stream.Recv()
if err != nil {
return err
}
aiStream, err := a.streamAskAI(ctx, req.Message)
if err != nil {
return err
}
defer aiStream.Close()
for {
chunk, err := aiStream.Recv()
if errors.Is(err, io.EOF) {
return nil
}
if err != nil {
return err
}
if chunk == nil || chunk.Reply == "" {
continue
}
if err := stream.Send(&pb.ChatResponse{Reply: chunk.Reply, Agent: a.opts.Name}); err != nil {
return err
}
}
}
// Pending returns checkpointed agent runs that have not completed. It mirrors
// flow.Pending for startup recovery loops that drain durable agent work.
func Pending(ctx context.Context, ag Agent) ([]flow.Run, error) {
@@ -351,7 +290,6 @@ func (a *agentImpl) askLocked(ctx context.Context, runID, message, parentRunID s
a.mem.Add("user", message)
}
a.steps = 0
a.spend = 0
a.calls = map[string]int{}
a.pause = nil
@@ -400,12 +338,9 @@ func (a *agentImpl) askLocked(ctx context.Context, runID, message, parentRunID s
Timeout: a.opts.ModelTimeout,
MaxAttempts: a.opts.ModelMaxAttempts,
Backoff: a.opts.ModelRetryBackoff,
Jitter: a.opts.ModelRetryJitter,
})
if err != nil {
run.Status = agentRunFailureStatus(err)
failureKind := ai.ClassifyError(err)
attempts := agentRunFailureAttempts(err)
err = agentOperationalError(err)
if a.currentRun != nil {
run.Steps = a.currentRun.Steps
@@ -414,9 +349,7 @@ func (a *agentImpl) askLocked(ctx context.Context, runID, message, parentRunID s
run.Steps = []flow.StepRecord{{Name: agentAskStep}}
}
run.Steps[0].Status = run.Status
run.Steps[0].Attempts = attempts
run.Steps[0].Error = err.Error()
run.Steps[0].ErrorKind = string(failureKind)
_ = a.saveRun(ctx, run)
return nil, err
}
@@ -473,15 +406,6 @@ func (a *agentImpl) askLocked(ctx context.Context, runID, message, parentRunID s
continue
}
}
if toolName := partialTextToolCallName(resp.Reply, toolList); len(resp.ToolCalls) == 0 && toolName != "" && planCompletionTurn < maxPlanCompletionTurns {
if resp.Reply != "" {
a.mem.Add("assistant", resp.Reply)
}
message = fmt.Sprintf("Your previous response started a %q tool call but did not finish valid tool-call markup or JSON arguments, so no tool was executed. Retry the same step now by emitting one complete valid tool call for %q. Do not describe the action in prose, and do not claim completion until the tool call succeeds.", toolName, toolName)
a.mem.Add("user", message)
messages = a.mem.Messages()
continue
}
break
}
@@ -500,13 +424,9 @@ func (a *agentImpl) askLocked(ctx context.Context, runID, message, parentRunID s
reply += resp.Answer
}
completedToolCalls := checkpointToolCalls(run.Steps)
if a.currentRun != nil {
completedToolCalls = checkpointToolCalls(a.currentRun.Steps)
}
res := &Response{
Reply: reply,
ToolCalls: mergeCheckpointToolCalls(completedToolCalls, resp.ToolCalls),
ToolCalls: resp.ToolCalls,
Agent: a.opts.Name,
RunID: a.runID,
ParentID: parentRunID,
@@ -598,11 +518,6 @@ func (a *agentImpl) Run() error {
return fmt.Errorf("failed to start agent: %w", err)
}
stopCh := make(chan struct{})
a.mu.Lock()
a.stopCh = stopCh
a.mu.Unlock()
fmt.Printf("Agent %s registered (manages: %s)\n", a.opts.Name, strings.Join(a.opts.Services, ", "))
// Optionally serve the agent directly over the A2A protocol, calling
@@ -624,17 +539,12 @@ func (a *agentImpl) Run() error {
fmt.Printf("Agent %s serving A2A on %s\n", a.opts.Name, a.opts.A2AAddress)
}
<-stopCh
ch := make(chan struct{})
<-ch
return nil
}
func (a *agentImpl) Stop() error {
a.mu.Lock()
if a.stopCh != nil {
close(a.stopCh)
a.stopCh = nil
}
a.mu.Unlock()
if a.server != nil {
return a.server.Stop()
}
-10
View File
@@ -38,16 +38,6 @@ func TestNew(t *testing.T) {
}
}
func TestBundledProviderImportsIncludeMiniMaxForConformance(t *testing.T) {
if model := ai.New("minimax", ai.WithAPIKey("test-key")); model == nil {
t.Fatal("ai.New(\"minimax\") returned nil; agent live conformance cannot exercise MiniMax")
}
caps := ai.ProviderCapabilities("minimax")
if !caps.Stream || !caps.ToolStream {
t.Fatalf("MiniMax capabilities = %#v, want streaming and tool streaming registered", caps)
}
}
func TestChatResponseIncludesRunIDs(t *testing.T) {
fakeGen = func(ctx context.Context, opts ai.Options, req *ai.Request) (*ai.Response, error) {
return &ai.Response{Reply: "ok"}, nil
+6 -157
View File
@@ -5,8 +5,6 @@ import (
"crypto/sha256"
"encoding/json"
"fmt"
"io"
"net/http"
"strings"
"time"
@@ -14,7 +12,6 @@ import (
codecBytes "go-micro.dev/v6/codec/bytes"
"go-micro.dev/v6/gateway/a2a"
"go-micro.dev/v6/store"
"go-micro.dev/v6/wrapper/x402"
)
// Built-in agent tools. These are not service endpoints — they are
@@ -30,11 +27,6 @@ const (
toolHumanInput = "request_input"
)
type delegateCall struct {
done chan struct{}
res ai.ToolResult
}
// builtinTools returns the tool definitions exposed to the model in
// addition to the agent's scoped service tools.
func builtinTools() []ai.Tool {
@@ -131,11 +123,9 @@ func (a *agentImpl) toolHandler() ai.ToolHandler {
// so the result runs plan → step → loop → approve → checkpoint → base.
h := a.baseHandler()
h = a.toolTimeoutWrap(h)
h = a.x402PayWrap(h)
h = a.toolRetryWrap(h)
h = a.checkpointToolWrap(h)
h = a.approveWrap(h)
h = a.spendWrap(h)
h = a.loopWrap(h)
h = a.stepWrap(h)
h = a.planWrap(h)
@@ -177,64 +167,6 @@ func (a *agentImpl) toolTimeoutWrap(next ai.ToolHandler) ai.ToolHandler {
}
}
// x402PayWrap pays an x402 Payment Required tool result and retries the
// underlying HTTP tool once. Tools that proxy HTTP paid resources can return the
// raw x402 402 challenge body and include a "url" input; the agent then uses
// wrapper/x402.Client so payer and budget semantics stay in one place.
func (a *agentImpl) x402PayWrap(next ai.ToolHandler) ai.ToolHandler {
return func(ctx context.Context, call ai.ToolCall) ai.ToolResult {
res := next(ctx, call)
if res.Refused != "" || !isX402Challenge(res.Content) {
return res
}
url, _ := call.Input["url"].(string)
if url == "" {
return errResult(call.ID, "x402: payment required but tool result did not include a retryable url input")
}
budget := a.opts.Budget
if budget > 0 {
remaining := budget - a.spend
if remaining <= 0 {
return refused(call.ID, ai.RefusedSpendBudget, fmt.Sprintf(
"x402 spend budget exceeded: no budget remaining for %s (spent %d of %d)",
call.Name, a.spend, budget))
}
budget = remaining
}
client := &x402.Client{Payer: a.opts.Payer, Budget: budget}
req, err := http.NewRequestWithContext(ctx, http.MethodGet, url, nil)
if err != nil {
return errResult(call.ID, err.Error())
}
resp, err := client.Do(req)
if err != nil {
if strings.Contains(err.Error(), "would exceed budget") {
return refused(call.ID, ai.RefusedSpendBudget, err.Error())
}
return errResult(call.ID, err.Error())
}
defer resp.Body.Close()
body, err := io.ReadAll(resp.Body)
if err != nil {
return errResult(call.ID, err.Error())
}
a.spend += client.Spent()
var value any
if err := json.Unmarshal(body, &value); err != nil {
value = string(body)
}
return ai.ToolResult{ID: call.ID, Value: value, Content: string(body), Attempts: 2}
}
}
func isX402Challenge(content string) bool {
var ch struct {
X402Version int `json:"x402Version"`
Accepts []x402.Requirements `json:"accepts"`
}
return json.Unmarshal([]byte(content), &ch) == nil && ch.X402Version > 0 && len(ch.Accepts) > 0
}
// toolRetryWrap retries transient tool failures with bounded backoff. It is
// opt-in because tools can have side effects; guardrail refusals and caller
// cancellation are never retried.
@@ -359,9 +291,6 @@ func (a *agentImpl) planWrap(next ai.ToolHandler) ai.ToolHandler {
if call.Name == toolPlan {
return a.handlePlan(call)
}
if containsNestedTextToolCall(call.Input) {
return refused(call.ID, ai.RefusedApproval, "malformed tool call: nested text tool-call markup found inside arguments; call the intended tool directly with clean JSON arguments")
}
if call.Name == toolDelegate {
if blocked := a.unfinishedPlanStepsBeforeDelegation(); len(blocked) > 0 {
return refused(call.ID, ai.RefusedApproval, "complete these plan steps before delegating: "+strings.Join(blocked, ", "))
@@ -438,32 +367,6 @@ func (a *agentImpl) approveWrap(next ai.ToolHandler) ai.ToolHandler {
}
}
// spendWrap reserves a per-run x402 spend budget before paid tool execution.
func (a *agentImpl) spendWrap(next ai.ToolHandler) ai.ToolHandler {
return func(ctx context.Context, call ai.ToolCall) ai.ToolResult {
amount := a.opts.ToolSpend[call.Name]
if amount <= 0 || a.opts.MaxSpend <= 0 {
return next(ctx, call)
}
if a.spend+amount > a.opts.MaxSpend {
return refused(call.ID, ai.RefusedSpendBudget, fmt.Sprintf(
"x402 spend budget exceeded: paying %d for %s would exceed per-run budget (spent %d of %d)",
amount, call.Name, a.spend, a.opts.MaxSpend))
}
a.spend += amount
if info, ok := ai.RunInfoFrom(ctx); ok {
info.Spent = a.spend
info.ToolSpend = amount
ctx = ai.WithRunInfo(ctx, info)
}
res := next(ctx, call)
if res.Refused != "" || toolErrorMessage(res) != "" {
a.spend -= amount
}
return res
}
}
// handlePlan persists the supplied plan to the agent's memory and
// echoes it back so the model can see the stored state.
func (a *agentImpl) handlePlan(call ai.ToolCall) ai.ToolResult {
@@ -682,7 +585,7 @@ func (a *agentImpl) handleHumanInput(call ai.ToolCall) ai.ToolResult {
// if 'to' names a registered agent, it is called via RPC. Otherwise an
// ephemeral sub-agent is created with a fresh, isolated context, asked
// the subtask, and its reply returned.
func (a *agentImpl) handleDelegate(ctx context.Context, call ai.ToolCall) (res ai.ToolResult) {
func (a *agentImpl) handleDelegate(ctx context.Context, call ai.ToolCall) ai.ToolResult {
input := call.Input
task, _ := input["task"].(string)
if task == "" {
@@ -693,12 +596,6 @@ func (a *agentImpl) handleDelegate(ctx context.Context, call ai.ToolCall) (res a
return cached
}
key := delegateResultKey(to, task)
if cached, ok := a.joinDelegateCall(ctx, call.ID, key); ok {
return cached
}
defer func() { a.finishDelegateCall(key, res) }()
// An external agent on another framework, addressed by A2A URL.
if strings.HasPrefix(to, "http://") || strings.HasPrefix(to, "https://") {
reply, err := a2a.NewClient(to).Send(ctx, task)
@@ -750,38 +647,6 @@ func (a *agentImpl) handleDelegate(ctx context.Context, call ai.ToolCall) (res a
return a.storeDelegateResult(call.ID, to, task, map[string]any{"reply": resp.Reply})
}
func (a *agentImpl) joinDelegateCall(ctx context.Context, id, key string) (ai.ToolResult, bool) {
a.delegateMu.Lock()
if a.delegateCalls == nil {
a.delegateCalls = map[string]*delegateCall{}
}
if inFlight := a.delegateCalls[key]; inFlight != nil {
a.delegateMu.Unlock()
select {
case <-ctx.Done():
return errResult(id, ctx.Err().Error()), true
case <-inFlight.done:
return withToolResultID(inFlight.res, id), true
}
}
a.delegateCalls[key] = &delegateCall{done: make(chan struct{})}
a.delegateMu.Unlock()
return ai.ToolResult{}, false
}
func (a *agentImpl) finishDelegateCall(key string, res ai.ToolResult) {
a.delegateMu.Lock()
inFlight := a.delegateCalls[key]
if inFlight == nil {
a.delegateMu.Unlock()
return
}
inFlight.res = res
delete(a.delegateCalls, key)
close(inFlight.done)
a.delegateMu.Unlock()
}
func (a *agentImpl) cachedDelegateResult(id, to, task string) (ai.ToolResult, bool) {
recs, err := a.stateStore().Read(delegateResultKey(to, task))
if err != nil || len(recs) == 0 {
@@ -801,11 +666,6 @@ func (a *agentImpl) storeDelegateResult(id, to, task string, out map[string]any)
return ai.ToolResult{ID: id, Value: out, Content: string(b)}
}
func withToolResultID(res ai.ToolResult, id string) ai.ToolResult {
res.ID = id
return res
}
func delegateResultKey(to, task string) string {
fp := normalizeDelegateTarget(to) + "\x00" + normalizeDelegateTask(task)
sum := sha256.Sum256([]byte(fp))
@@ -829,28 +689,17 @@ func normalizeDelegateTask(task string) string {
}
}, task)
task = strings.Join(strings.Fields(task), " ")
if strings.Contains(task, "owner") &&
if strings.Contains(task, "notify") &&
strings.Contains(task, "owner") &&
strings.Contains(task, "acme") &&
isLaunchReadinessDelegateTask(task) {
strings.Contains(task, "launch") &&
strings.Contains(task, "plan") &&
(strings.Contains(task, "ready") || strings.Contains(task, "readiness") || strings.Contains(task, "prepared") || strings.Contains(task, "complete")) {
return "notify owner@acme.com launch-plan-ready"
}
return task
}
func isLaunchReadinessDelegateTask(task string) bool {
hasNotify := strings.Contains(task, "notify") || strings.Contains(task, "notification") || strings.Contains(task, "tell")
hasLaunch := strings.Contains(task, "launch")
hasPlanOrReadiness := strings.Contains(task, "plan") || strings.Contains(task, "readiness") || strings.Contains(task, "ready")
hasCompletion := strings.Contains(task, "ready") ||
strings.Contains(task, "readiness") ||
strings.Contains(task, "prepared") ||
strings.Contains(task, "complete") ||
strings.Contains(task, "finished") ||
strings.Contains(task, "done") ||
strings.Contains(task, "sent")
return hasNotify && hasLaunch && hasPlanOrReadiness && hasCompletion
}
// isAgent reports whether name resolves to a registered agent (a
// service advertising type=agent in its metadata).
func (a *agentImpl) isAgent(name string) bool {
+8 -53
View File
@@ -3,9 +3,7 @@ package agent
import (
"context"
"encoding/json"
"sync"
"testing"
"time"
"go-micro.dev/v6/ai"
"go-micro.dev/v6/registry"
@@ -196,59 +194,16 @@ func TestDelegateResultCacheReusesLaunchReadinessParaphrases(t *testing.T) {
t.Fatal("storeDelegateResult returned empty content")
}
replayedTasks := []string{
"Notify the plan owner at owner @ acme.com that launch readiness is prepared and complete.",
"Tell owner at acme dot com the launch readiness notification was sent and the plan is done.",
replayedTask := "Notify the plan owner at owner @ acme.com that launch readiness is prepared and complete."
cached, ok := a.cachedDelegateResult("delegate-2", " COMMS ", replayedTask)
if !ok {
t.Fatal("cachedDelegateResult missed equivalent launch-readiness delegate replay")
}
for i, replayedTask := range replayedTasks {
cached, ok := a.cachedDelegateResult("delegate-replay", " COMMS ", replayedTask)
if !ok {
t.Fatalf("cachedDelegateResult missed equivalent launch-readiness delegate replay %d", i)
}
if cached.ID != "delegate-replay" {
t.Fatalf("cached result ID = %q, want replay call ID", cached.ID)
}
if !containsStr(cached.Content, "Notified owner@acme.com") {
t.Fatalf("cached result content = %q, want original delegate reply", cached.Content)
}
if cached.ID != "delegate-2" {
t.Fatalf("cached result ID = %q, want replay call ID", cached.ID)
}
}
func TestDelegateInFlightReplaysShareFirstResult(t *testing.T) {
a := New(Name("planner"), WithStore(store.NewMemoryStore())).(*agentImpl)
key := delegateResultKey("comms", "Notify owner@acme.com that the launch plan is ready")
if _, joined := a.joinDelegateCall(context.Background(), "delegate-1", key); joined {
t.Fatal("first delegate call unexpectedly joined an existing in-flight call")
}
var wg sync.WaitGroup
wg.Add(1)
results := make(chan ai.ToolResult, 1)
go func() {
defer wg.Done()
res, joined := a.joinDelegateCall(context.Background(), "delegate-2", key)
if !joined {
t.Error("replayed delegate call did not join the in-flight call")
return
}
results <- res
}()
select {
case res := <-results:
t.Fatalf("replayed delegate returned before first call finished: %+v", res)
case <-time.After(25 * time.Millisecond):
}
first := ai.ToolResult{ID: "delegate-1", Content: `{"reply":"Notified owner@acme.com."}`}
a.finishDelegateCall(key, first)
wg.Wait()
replayed := <-results
if replayed.ID != "delegate-2" {
t.Fatalf("replayed result ID = %q, want delegate-2", replayed.ID)
}
if replayed.Content != first.Content {
t.Fatalf("replayed content = %q, want %q", replayed.Content, first.Content)
if !containsStr(cached.Content, "Notified owner@acme.com") {
t.Fatalf("cached result content = %q, want original delegate reply", cached.Content)
}
}
+12 -79
View File
@@ -3,9 +3,7 @@ package agent
import (
"context"
"encoding/json"
"errors"
"fmt"
"strings"
"time"
"go-micro.dev/v6/ai"
@@ -216,14 +214,6 @@ func (e *operationalError) Unwrap() error {
return e.err
}
func agentRunFailureAttempts(err error) int {
var retryErr *ai.RetryError
if err != nil && errors.As(err, &retryErr) && retryErr.Attempts > 0 {
return retryErr.Attempts
}
return 1
}
func agentOperationalError(err error) error {
if err == nil {
return nil
@@ -244,32 +234,28 @@ func agentOperationalError(err error) error {
func (a *agentImpl) checkpointToolWrap(next ai.ToolHandler) ai.ToolHandler {
return func(ctx context.Context, call ai.ToolCall) ai.ToolResult {
run := a.currentRun
if a.opts.Checkpoint == nil || run == nil {
if a.opts.Checkpoint == nil || a.currentRun == nil {
return next(ctx, call)
}
name := toolCheckpointName(call)
if rec, ok := findStep(run.Steps, name); ok && rec.Status == "done" {
if rec, ok := findStep(a.currentRun.Steps, name); ok && rec.Status == "done" {
return ai.ToolResult{ID: call.ID, Value: rec.Result, Content: rec.Result}
}
idx := upsertStep(&run.Steps, flow.StepRecord{Name: name, Status: "in_progress"})
_ = a.saveRun(ctx, *run)
idx := upsertStep(&a.currentRun.Steps, flow.StepRecord{Name: name, Status: "in_progress"})
_ = a.saveRun(ctx, *a.currentRun)
res := next(ctx, call)
if idx < 0 || idx >= len(run.Steps) || run.Steps[idx].Name != name {
idx = upsertStep(&run.Steps, flow.StepRecord{Name: name, Status: "in_progress"})
}
run.Steps[idx].Attempts++
a.currentRun.Steps[idx].Attempts++
if res.Refused != "" {
run.Steps[idx].Status = "failed"
run.Steps[idx].Error = res.Content
_ = a.saveRun(ctx, *run)
a.currentRun.Steps[idx].Status = "failed"
a.currentRun.Steps[idx].Error = res.Content
_ = a.saveRun(ctx, *a.currentRun)
return res
}
run.Steps[idx].Status = "done"
run.Steps[idx].Result = res.Content
run.Steps[idx].Error = ""
_ = a.saveRun(ctx, *run)
a.currentRun.Steps[idx].Status = "done"
a.currentRun.Steps[idx].Result = res.Content
a.currentRun.Steps[idx].Error = ""
_ = a.saveRun(ctx, *a.currentRun)
return res
}
}
@@ -302,56 +288,3 @@ func upsertStep(steps *[]flow.StepRecord, rec flow.StepRecord) int {
*steps = append(*steps, rec)
return len(*steps) - 1
}
func checkpointToolCalls(steps []flow.StepRecord) []ai.ToolCall {
calls := make([]ai.ToolCall, 0, len(steps))
for _, step := range steps {
call, ok := checkpointToolCall(step)
if !ok {
continue
}
calls = append(calls, call)
}
return calls
}
func checkpointToolCall(step flow.StepRecord) (ai.ToolCall, bool) {
if step.Status != "done" || !strings.HasPrefix(step.Name, "tool:") {
return ai.ToolCall{}, false
}
parts := strings.SplitN(strings.TrimPrefix(step.Name, "tool:"), ":", 2)
if len(parts) != 2 || parts[0] == "" {
return ai.ToolCall{}, false
}
input := map[string]any{}
if parts[1] != "null" && parts[1] != "" {
if err := json.Unmarshal([]byte(parts[1]), &input); err != nil {
return ai.ToolCall{}, false
}
}
return ai.ToolCall{Name: parts[0], Input: input, Result: step.Result}, true
}
func mergeCheckpointToolCalls(checkpointed, current []ai.ToolCall) []ai.ToolCall {
if len(checkpointed) == 0 {
return current
}
seen := make(map[string]struct{}, len(current))
for _, call := range current {
seen[toolCallKey(call.Name, call.Input)] = struct{}{}
}
merged := make([]ai.ToolCall, 0, len(checkpointed)+len(current))
for _, call := range checkpointed {
if _, ok := seen[toolCallKey(call.Name, call.Input)]; ok {
continue
}
merged = append(merged, call)
}
merged = append(merged, current...)
return merged
}
func toolCallKey(name string, input map[string]any) string {
b, _ := json.Marshal(input)
return name + ":" + string(b)
}
+1 -114
View File
@@ -21,7 +21,7 @@ func TestResumeCompletedCheckpointDoesNotReplayModel(t *testing.T) {
calls := 0
fakeGen = func(ctx context.Context, opts ai.Options, req *ai.Request) (*ai.Response, error) {
calls++
return &ai.Response{Reply: "done", ToolCalls: []ai.ToolCall{{ID: "call-1", Name: "external.lookup", Result: "cached"}}}, nil
return &ai.Response{Reply: "done"}, nil
}
defer func() { fakeGen = nil }()
@@ -49,9 +49,6 @@ func TestResumeCompletedCheckpointDoesNotReplayModel(t *testing.T) {
if resumed.RunID != resp.RunID {
t.Fatalf("resumed run id = %q, want %q", resumed.RunID, resp.RunID)
}
if len(resumed.ToolCalls) != 1 || resumed.ToolCalls[0].Name != "external.lookup" || resumed.ToolCalls[0].Result != "cached" {
t.Fatalf("resumed tool calls = %#v, want persisted completed call", resumed.ToolCalls)
}
if calls != 1 {
t.Fatalf("model calls after Resume = %d, want 1", calls)
}
@@ -104,12 +101,6 @@ func TestResumeFailedCheckpointDoesNotReplayCompletedTool(t *testing.T) {
if resp.Reply != "finished from checkpoint" {
t.Fatalf("Resume reply = %q", resp.Reply)
}
if len(resp.ToolCalls) != 1 || resp.ToolCalls[0].Name != "external.charge" || resp.ToolCalls[0].Result != "charged" {
t.Fatalf("resumed tool calls = %#v, want preserved completed charge call", resp.ToolCalls)
}
if got := resp.ToolCalls[0].Input["order"]; got != "42" {
t.Fatalf("resumed tool input order = %#v, want 42", got)
}
if toolRuns != 1 {
t.Fatalf("tool executions after Resume = %d, want completed tool was not replayed", toolRuns)
}
@@ -154,45 +145,6 @@ func TestCheckpointSkipsDuplicateToolWithinAsk(t *testing.T) {
}
}
func TestCheckpointToolWrapSurvivesClearedCurrentRun(t *testing.T) {
ctx := context.Background()
cp := flow.StoreCheckpoint(store.NewMemoryStore(), "tool-cleared-run-agent")
run := flow.Run{
ID: "run-1",
Flow: "tool-cleared-run-agent",
Status: "running",
Steps: []flow.StepRecord{{Name: agentAskStep, Status: "in_progress"}},
}
a := &agentImpl{
opts: newOptions(Name("tool-cleared-run-agent"), WithCheckpoint(cp)),
currentRun: &run,
}
handler := a.checkpointToolWrap(func(context.Context, ai.ToolCall) ai.ToolResult {
a.currentRun = nil
return ai.ToolResult{ID: "call-1", Content: "created"}
})
res := handler(ctx, ai.ToolCall{ID: "call-1", Name: "external.create", Input: map[string]any{"title": "Design"}})
if res.Content != "created" {
t.Fatalf("tool result = %q, want created", res.Content)
}
loaded, ok, err := cp.Load(ctx, "run-1")
if err != nil {
t.Fatalf("load checkpoint: %v", err)
}
if !ok {
t.Fatal("checkpoint missing")
}
rec, ok := findStep(loaded.Steps, `tool:external.create:{"title":"Design"}`)
if !ok {
t.Fatalf("checkpoint steps = %#v, want completed tool step", loaded.Steps)
}
if rec.Status != "done" || rec.Result != "created" || rec.Attempts != 1 {
t.Fatalf("tool checkpoint = %#v, want done result with one attempt", rec)
}
}
func TestCheckpointContinuesRunWithUnfinishedPlanStep(t *testing.T) {
ctx := context.Background()
cp := flow.StoreCheckpoint(store.NewMemoryStore(), "unfinished-plan-agent")
@@ -445,71 +397,6 @@ func TestResumeFailedCheckpointAfterFreshAgentRestart(t *testing.T) {
}
}
func TestResumePendingAfterFreshAgentRestartDoesNotReplayCompletedTool(t *testing.T) {
ctx := context.Background()
st := store.NewMemoryStore()
cp := flow.StoreCheckpoint(st, "startup-resume-agent")
toolRuns := 0
failFirst := true
fakeGen = func(ctx context.Context, opts ai.Options, req *ai.Request) (*ai.Response, error) {
if opts.ToolHandler != nil {
res := opts.ToolHandler(ctx, ai.ToolCall{ID: "call-1", Name: "external.allocate", Input: map[string]any{"cluster": "blue"}})
if res.Content != "allocated" {
t.Fatalf("tool result = %q, want allocated", res.Content)
}
}
if failFirst {
failFirst = false
return nil, errors.New("process stopped before final response")
}
return &ai.Response{Reply: "startup recovery complete"}, nil
}
defer func() { fakeGen = nil }()
newAgent := func() *agentImpl {
return newTestAgent(Name("startup-resume-agent"), WithStore(st), WithCheckpoint(cp),
WithTool("external.allocate", "allocate capacity once", nil, func(context.Context, map[string]any) (string, error) {
toolRuns++
return "allocated", nil
}))
}
first := newAgent()
_, err := first.Ask(ctx, "allocate blue capacity")
if err == nil {
t.Fatal("Ask succeeded, want simulated process stop")
}
if toolRuns != 1 {
t.Fatalf("tool executions after failed Ask = %d, want 1", toolRuns)
}
restarted := newAgent()
failedRun, err := ResumePending(ctx, restarted)
if err != nil {
t.Fatalf("ResumePending after restart: failedRun=%q err=%v", failedRun, err)
}
if failedRun != "" {
t.Fatalf("failed run = %q, want none", failedRun)
}
if toolRuns != 1 {
t.Fatalf("tool executions after ResumePending = %d, want completed tool not replayed", toolRuns)
}
runs, err := Pending(ctx, restarted)
if err != nil {
t.Fatalf("Pending after ResumePending: %v", err)
}
if len(runs) != 0 {
t.Fatalf("Pending after ResumePending = %#v, want none", runs)
}
summaries, err := ListRunSummaries(st, "startup-resume-agent")
if err != nil {
t.Fatalf("ListRunSummaries after ResumePending: %v", err)
}
if len(summaries) != 1 || summaries[0].Status != "done" || summaries[0].Checkpoint != "done" {
t.Fatalf("summary after ResumePending = %#v, want one done run", summaries)
}
}
func TestResumeFailedCheckpointDoesNotDuplicateCompactedMemory(t *testing.T) {
ctx := context.Background()
st := store.NewMemoryStore()
+11 -229
View File
@@ -4,7 +4,6 @@ import (
"context"
"errors"
"fmt"
"io"
"os"
"strings"
"testing"
@@ -22,20 +21,17 @@ type conformanceProvider struct {
live bool
}
var agentConformanceProviders = []conformanceProvider{
{name: "fake"},
{name: "openai", key: "OPENAI_API_KEY", model: "GO_MICRO_CONFORMANCE_OPENAI_MODEL", live: true},
{name: "anthropic", key: "ANTHROPIC_API_KEY", model: "GO_MICRO_CONFORMANCE_ANTHROPIC_MODEL", live: true},
{name: "atlascloud", key: "ATLASCLOUD_API_KEY", model: "GO_MICRO_CONFORMANCE_ATLASCLOUD_MODEL", live: true},
{name: "gemini", key: "GEMINI_API_KEY", model: "GO_MICRO_CONFORMANCE_GEMINI_MODEL", live: true},
{name: "groq", key: "GROQ_API_KEY", model: "GO_MICRO_CONFORMANCE_GROQ_MODEL", live: true},
{name: "minimax", key: "MINIMAX_API_KEY", model: "GO_MICRO_CONFORMANCE_MINIMAX_MODEL", live: true},
{name: "mistral", key: "MISTRAL_API_KEY", model: "GO_MICRO_CONFORMANCE_MISTRAL_MODEL", live: true},
{name: "together", key: "TOGETHER_API_KEY", model: "GO_MICRO_CONFORMANCE_TOGETHER_MODEL", live: true},
}
func TestAgentProviderConformanceMatrix(t *testing.T) {
providers := agentConformanceProviders
providers := []conformanceProvider{
{name: "fake"},
{name: "openai", key: "OPENAI_API_KEY", model: "GO_MICRO_CONFORMANCE_OPENAI_MODEL", live: true},
{name: "anthropic", key: "ANTHROPIC_API_KEY", model: "GO_MICRO_CONFORMANCE_ANTHROPIC_MODEL", live: true},
{name: "atlascloud", key: "ATLASCLOUD_API_KEY", model: "GO_MICRO_CONFORMANCE_ATLASCLOUD_MODEL", live: true},
{name: "gemini", key: "GEMINI_API_KEY", model: "GO_MICRO_CONFORMANCE_GEMINI_MODEL", live: true},
{name: "groq", key: "GROQ_API_KEY", model: "GO_MICRO_CONFORMANCE_GROQ_MODEL", live: true},
{name: "mistral", key: "MISTRAL_API_KEY", model: "GO_MICRO_CONFORMANCE_MISTRAL_MODEL", live: true},
{name: "together", key: "TOGETHER_API_KEY", model: "GO_MICRO_CONFORMANCE_TOGETHER_MODEL", live: true},
}
selected := selectedConformanceProviders(os.Getenv("GO_MICRO_AGENT_CONFORMANCE_PROVIDERS"))
for _, provider := range providers {
@@ -49,151 +45,6 @@ func TestAgentProviderConformanceMatrix(t *testing.T) {
}
}
func TestAgentProviderStreamConformanceMatrix(t *testing.T) {
providers := streamConformanceProviders()
selected := selectedConformanceProviders(os.Getenv("GO_MICRO_AGENT_CONFORMANCE_PROVIDERS"))
for _, provider := range providers {
provider := provider
if len(selected) > 0 && !selected[provider.name] {
continue
}
t.Run(provider.name, func(t *testing.T) {
runAgentStreamConformanceScenario(t, provider)
})
}
}
func streamConformanceProviders() []conformanceProvider {
providers := make([]conformanceProvider, 0, len(agentConformanceProviders))
for _, provider := range agentConformanceProviders {
// Gemini is covered by the non-streaming agent/tool matrix, but does not
// currently advertise streaming in the provider capability registry.
if provider.name == "gemini" {
continue
}
providers = append(providers, provider)
}
return providers
}
func TestAgentProviderConformanceMatrixIncludesEveryLiveProvider(t *testing.T) {
want := map[string]string{
"openai": "OPENAI_API_KEY",
"anthropic": "ANTHROPIC_API_KEY",
"atlascloud": "ATLASCLOUD_API_KEY",
"gemini": "GEMINI_API_KEY",
"groq": "GROQ_API_KEY",
"minimax": "MINIMAX_API_KEY",
"mistral": "MISTRAL_API_KEY",
"together": "TOGETHER_API_KEY",
}
got := map[string]string{}
for _, provider := range agentConformanceProviders {
if provider.live {
got[provider.name] = provider.key
}
}
for name, key := range want {
if got[name] != key {
t.Fatalf("agentConformanceProviders[%q] key = %q, want %q", name, got[name], key)
}
}
if len(got) != len(want) {
t.Fatalf("agentConformanceProviders live providers = %#v, want exactly %#v", got, want)
}
}
func runAgentStreamConformanceScenario(t *testing.T, provider conformanceProvider) {
t.Helper()
if provider.live {
if os.Getenv(provider.key) == "" {
t.Skipf("%s not set; skipping live %s stream conformance", provider.key, provider.name)
}
if os.Getenv("GO_MICRO_AGENT_CONFORMANCE_LIVE") == "" {
t.Skipf("GO_MICRO_AGENT_CONFORMANCE_LIVE not set; skipping live %s stream conformance", provider.name)
}
caps := ai.ProviderCapabilities(provider.name)
if !caps.Stream {
t.Fatalf("ProviderCapabilities(%q).Stream = false, want true for stream conformance", provider.name)
}
if !caps.ToolStream {
t.Skipf("ProviderCapabilities(%q).ToolStream = false; skipping live tool stream conformance", provider.name)
}
} else {
var sawToolSchema bool
fakeStream = func(ctx context.Context, opts ai.Options, req *ai.Request) (ai.Stream, error) {
if req.Prompt != "Stream exactly: agent-stream-conformance-ok" {
return nil, fmt.Errorf("prompt = %q", req.Prompt)
}
if len(req.Messages) == 0 || req.Messages[len(req.Messages)-1].Role != "user" || req.Messages[len(req.Messages)-1].Content != req.Prompt {
return nil, fmt.Errorf("messages = %#v, want current user turn", req.Messages)
}
for _, tool := range req.Tools {
if tool.Name == "conformance_echo" {
sawToolSchema = true
}
}
if !sawToolSchema {
return nil, errors.New("stream request omitted conformance tool schema")
}
return &sliceStream{chunks: []string{"agent-stream-", "conformance-ok"}}, nil
}
defer func() { fakeStream = nil }()
}
agentOpts := []Option{
Name("stream-conformance-" + provider.name),
Provider(provider.name),
APIKey(os.Getenv(provider.key)),
Prompt("Stream conformance: preserve the exact requested marker in the final answer."),
WithRegistry(registry.NewMemoryRegistry()),
WithStore(store.NewMemoryStore()),
WithMemory(NewInMemory(8)),
ModelCallTimeout(45 * time.Second),
WithTool("conformance_echo", "Echo a conformance value and return a deterministic marker.", map[string]any{
"value": map[string]any{"type": "string", "description": "value to echo"},
}, func(ctx context.Context, input map[string]any) (string, error) {
return `{"marker":"agent-stream-conformance-ok"}`, nil
}),
}
if provider.model != "" {
if model := os.Getenv(provider.model); model != "" {
agentOpts = append(agentOpts, Model(model))
}
}
stream, err := New(agentOpts...).Stream(context.Background(), "Stream exactly: agent-stream-conformance-ok")
if err != nil {
t.Fatalf("Stream: %v", err)
}
defer stream.Close()
var reply strings.Builder
deadline := time.After(45 * time.Second)
for {
select {
case <-deadline:
t.Fatal("timed out waiting for streamed final output")
default:
}
chunk, err := stream.Recv()
if errors.Is(err, io.EOF) {
break
}
if err != nil {
t.Fatalf("Recv: %v", err)
}
reply.WriteString(chunk.Reply)
if strings.Contains(reply.String(), "agent-stream-conformance-ok") {
return
}
}
if got := reply.String(); !strings.Contains(got, "agent-stream-conformance-ok") {
t.Fatalf("streamed reply %q does not include conformance marker", got)
}
}
func selectedConformanceProviders(csv string) map[string]bool {
out := map[string]bool{}
for _, part := range strings.Split(csv, ",") {
@@ -436,20 +287,6 @@ func TestAgentProviderConformanceFinalDelegateRetryUsesTaggedCall(t *testing.T)
}
}
func TestAgentProviderConformanceMarkerRetryRequiresExactMarkerReply(t *testing.T) {
prompt := nextConformanceRetryPrompt(true, true, false, 2)
for _, want := range []string{
"omitted the conformance marker",
"do not call more tools",
"do not summarize",
"Reply with exactly this sentence: agent-conformance-ok after guarded delegate refusal.",
} {
if !strings.Contains(prompt, want) {
t.Fatalf("marker retry prompt %q missing %q", prompt, want)
}
}
}
func nextConformanceRetryPrompt(sawTool, sawBlockedDelegate, hasMarker bool, attempt int) string {
if attempt >= 4 && sawTool && !sawBlockedDelegate {
return "Final conformance retry: emit exactly this tagged tool call so the harness can execute the guarded delegate refusal, then include agent-conformance-ok and the refusal in the final answer: " + conformanceDelegateTaggedCall
@@ -460,7 +297,7 @@ func nextConformanceRetryPrompt(sawTool, sawBlockedDelegate, hasMarker bool, att
case !sawBlockedDelegate:
return "The previous response called conformance_echo but did not attempt the required guarded delegation. Continue the same conformance check now: call delegate exactly once with input " + conformanceDelegateInputJSON + "; do not answer in prose until that delegate call has been attempted. If native tool_calls are unavailable, emit exactly " + conformanceDelegateTaggedCall + ". The delegate is expected to be refused by policy; include that refusal and the agent-conformance marker in the final answer."
case !hasMarker:
return "The previous response completed the required tool calls but omitted the conformance marker. Continue the same conformance check now: do not call more tools, do not summarize, and do not use synonyms. Reply with exactly this sentence: agent-conformance-ok after guarded delegate refusal."
return "The previous response completed the required tool calls but omitted the conformance marker. Continue the same conformance check now: do not call more tools; answer with the prior echo result marker agent-conformance-ok and mention the guarded delegate refusal."
default:
return "Retry the provider conformance check and include the agent-conformance marker in the final answer."
}
@@ -780,61 +617,6 @@ func TestAgentExecutesProviderTextToolCallFallback(t *testing.T) {
}
}
func TestAgentRepairsPartialTextToolCallFallback(t *testing.T) {
attempts := 0
fakeGen = func(ctx context.Context, opts ai.Options, req *ai.Request) (*ai.Response, error) {
if opts.ToolHandler == nil {
return nil, errors.New("missing tool handler")
}
attempts++
if attempts == 1 {
return &ai.Response{Reply: `<tool_call name="conformance_echo">`}, nil
}
if !strings.Contains(req.Prompt, "did not finish valid tool-call markup") {
return nil, fmt.Errorf("repair prompt = %q, want partial tool-call repair guidance", req.Prompt)
}
return &ai.Response{
Reply: `<tool_call name="conformance_echo">{"value":"agent-conformance"}</tool_call>`,
}, nil
}
defer func() { fakeGen = nil }()
var sawTool bool
a := New(
Name("conformance-partial-text-tool"),
Provider("fake"),
WithRegistry(registry.NewMemoryRegistry()),
WithStore(store.NewMemoryStore()),
WithMemory(NewInMemory(4)),
WithTool("conformance_echo", "Echo a conformance value.", map[string]any{
"value": map[string]any{"type": "string"},
}, func(ctx context.Context, input map[string]any) (string, error) {
sawTool = true
if input["value"] != "agent-conformance" {
return "", fmt.Errorf("unexpected value %v", input["value"])
}
return `{"marker":"agent-conformance-ok"}`, nil
}),
)
resp, err := a.Ask(context.Background(), "Run the partial text tool call fallback.")
if err != nil {
t.Fatalf("Ask: %v", err)
}
if attempts != 2 {
t.Fatalf("attempts = %d, want repair retry", attempts)
}
if !sawTool {
t.Fatal("repaired text tool call fallback did not execute the tool")
}
if len(resp.ToolCalls) != 1 || resp.ToolCalls[0].Name != "conformance_echo" {
t.Fatalf("ToolCalls = %+v, want conformance_echo", resp.ToolCalls)
}
if !strings.Contains(resp.Reply, "agent-conformance-ok") {
t.Fatalf("Reply = %q, want tool result marker", resp.Reply)
}
}
func TestAgentExecutesTextToolCallFallbackAfterStructuredToolCall(t *testing.T) {
fakeGen = func(ctx context.Context, opts ai.Options, req *ai.Request) (*ai.Response, error) {
if opts.ToolHandler == nil {
-225
View File
@@ -2,17 +2,12 @@ package agent
import (
"context"
"encoding/json"
"io"
"net/http"
"net/http/httptest"
"strings"
"testing"
"go-micro.dev/v6/ai"
"go-micro.dev/v6/registry"
"go-micro.dev/v6/store"
"go-micro.dev/v6/wrapper/x402"
)
// toolContent runs a tool call through a handler and returns the content
@@ -95,223 +90,3 @@ func TestApproveToolDoesNotGatePlan(t *testing.T) {
t.Error("plan should have been persisted despite the denying approver")
}
}
func TestMaxSpendAllowsPaidToolWithinBudget(t *testing.T) {
calls := 0
a := newTestAgent(Name("paid-within-budget"),
MaxSpend(10),
ToolSpend("paid.lookup", 7),
WithTool("paid.lookup", "paid lookup", nil, func(context.Context, map[string]any) (string, error) {
calls++
return `{"ok":true}`, nil
}),
)
res := a.toolHandler()(context.Background(), ai.ToolCall{ID: "paid-1", Name: "paid.lookup", Input: map[string]any{}})
if calls != 1 {
t.Fatalf("paid tool was not executed")
}
if res.Refused != "" {
t.Fatalf("paid tool was refused: %+v", res)
}
if res.Content != `{"ok":true}` {
t.Fatalf("content = %q, want paid result", res.Content)
}
}
func TestMaxSpendRefusesPaidToolBeforePaymentWhenBudgetExceeded(t *testing.T) {
calls := 0
a := newTestAgent(Name("paid-over-budget"),
MaxSpend(5),
ToolSpend("paid.lookup", 7),
WithTool("paid.lookup", "paid lookup", nil, func(context.Context, map[string]any) (string, error) {
calls++
return `{"ok":true}`, nil
}),
)
res := a.toolHandler()(context.Background(), ai.ToolCall{ID: "paid-1", Name: "paid.lookup", Input: map[string]any{}})
if calls != 0 {
t.Fatalf("paid tool ran despite budget refusal")
}
if res.Refused != ai.RefusedSpendBudget {
t.Fatalf("Refused = %q, want %q (result %+v)", res.Refused, ai.RefusedSpendBudget, res)
}
if !strings.Contains(res.Content, "x402 spend budget exceeded") {
t.Fatalf("content = %q, want inspectable budget refusal", res.Content)
}
}
func TestMaxSpendRollsBackFailedPaidToolReservation(t *testing.T) {
calls := 0
a := newTestAgent(Name("paid-rollback"),
MaxSpend(10),
ToolSpend("paid.lookup", 7),
WithTool("paid.lookup", "paid lookup", nil, func(context.Context, map[string]any) (string, error) {
calls++
if calls == 1 {
return "", context.Canceled
}
return `{"ok":true}`, nil
}),
)
h := a.toolHandler()
first := h(context.Background(), ai.ToolCall{ID: "paid-1", Name: "paid.lookup", Input: map[string]any{}})
if first.Refused != "" || !strings.Contains(first.Content, "context canceled") {
t.Fatalf("first result = %+v, want tool error without guardrail refusal", first)
}
second := h(context.Background(), ai.ToolCall{ID: "paid-2", Name: "paid.lookup", Input: map[string]any{}})
if second.Refused != "" || second.Content != `{"ok":true}` {
t.Fatalf("second result = %+v, want reservation rollback to allow retry", second)
}
}
func TestNestedTextToolCallArgumentsAreRefused(t *testing.T) {
called := false
a := newTestAgent(Name("nested-tool-arg"),
WithTool("task.add", "add task", nil, func(context.Context, map[string]any) (string, error) {
called = true
return "created", nil
}),
)
content := toolContent(a.toolHandler(), "task.add", map[string]any{
"title": `Continue the launch plan. <tool_call name="plan">{"steps":[{"task":"Design","status":"pending"}]}</tool_call>`,
})
if called {
t.Fatal("tool handler ran despite nested text tool-call markup in arguments")
}
if !strings.Contains(content, "nested text tool-call markup") {
t.Fatalf("content = %q, want nested tool-call refusal", content)
}
}
type agentMockPayer struct{ calls int }
func (p *agentMockPayer) Pay(ctx context.Context, req x402.Requirements) (string, error) {
p.calls++
return "paid", nil
}
func TestAgentPayerPaysX402ToolResultAndRetries(t *testing.T) {
paid := false
srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
if r.Header.Get(x402.PaymentHeader) == "paid" {
paid = true
_, _ = w.Write([]byte(`{"ok":true}`))
return
}
w.WriteHeader(http.StatusPaymentRequired)
json.NewEncoder(w).Encode(map[string]any{
"x402Version": x402.Version,
"accepts": []x402.Requirements{{Scheme: "exact", Network: "base", MaxAmountRequired: "7", Resource: r.URL.String(), PayTo: "0xmerchant"}},
})
}))
defer srv.Close()
payer := &agentMockPayer{}
st := store.NewMemoryStore()
a := newTestAgent(Name("x402-payer"), WithStore(st), Payer(payer), Budget(10), WithTool("paid.http", "paid http", nil, func(ctx context.Context, input map[string]any) (string, error) {
req, err := http.NewRequestWithContext(ctx, http.MethodGet, srv.URL, nil)
if err != nil {
return "", err
}
resp, err := http.DefaultClient.Do(req)
if err != nil {
return "", err
}
defer resp.Body.Close()
body, err := io.ReadAll(resp.Body)
if err != nil {
return "", err
}
return string(body), nil
}))
ctx := ai.WithRunInfo(context.Background(), ai.RunInfo{RunID: "run-paid", Agent: "x402-payer"})
res := a.toolHandler()(ctx, ai.ToolCall{ID: "pay-1", Name: "paid.http", Input: map[string]any{"url": srv.URL}})
if !paid || payer.calls != 1 {
t.Fatalf("payment not made: paid=%v payer.calls=%d", paid, payer.calls)
}
if res.Content != `{"ok":true}` || res.Attempts != 2 {
t.Fatalf("result = %+v, want paid response with retry attempt", res)
}
events, err := LoadRunEvents(st, "x402-payer", "run-paid")
if err != nil {
t.Fatal(err)
}
if len(events) != 1 || events[0].Spent != 7 || events[0].ToolSpend != 7 {
t.Fatalf("spend events = %#v, want one tool event with spent/tool_spend 7", events)
}
}
func TestAgentPayerRefusesX402OverBudget(t *testing.T) {
srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusPaymentRequired)
json.NewEncoder(w).Encode(map[string]any{
"x402Version": x402.Version,
"accepts": []x402.Requirements{{Scheme: "exact", Network: "base", MaxAmountRequired: "70", Resource: r.URL.String(), PayTo: "0xmerchant"}},
})
}))
defer srv.Close()
payer := &agentMockPayer{}
a := newTestAgent(Name("x402-over-budget"), Payer(payer), Budget(10), WithTool("paid.http", "paid http", nil, func(ctx context.Context, input map[string]any) (string, error) {
req, err := http.NewRequestWithContext(ctx, http.MethodGet, srv.URL, nil)
if err != nil {
return "", err
}
resp, err := http.DefaultClient.Do(req)
if err != nil {
return "", err
}
defer resp.Body.Close()
body, err := io.ReadAll(resp.Body)
if err != nil {
return "", err
}
return string(body), nil
}))
res := a.toolHandler()(context.Background(), ai.ToolCall{ID: "pay-1", Name: "paid.http", Input: map[string]any{"url": srv.URL}})
if payer.calls != 0 {
t.Fatalf("payer called despite over-budget refusal")
}
if res.Refused != ai.RefusedSpendBudget || !strings.Contains(res.Content, "would exceed budget") {
t.Fatalf("result = %+v, want budget refusal", res)
}
}
func TestAgentPayerRequiredWithoutPayerReturnsClearError(t *testing.T) {
srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusPaymentRequired)
json.NewEncoder(w).Encode(map[string]any{
"x402Version": x402.Version,
"accepts": []x402.Requirements{{Scheme: "exact", Network: "base", MaxAmountRequired: "7", Resource: r.URL.String(), PayTo: "0xmerchant"}},
})
}))
defer srv.Close()
a := newTestAgent(Name("x402-no-payer"), Budget(10), WithTool("paid.http", "paid http", nil, func(ctx context.Context, input map[string]any) (string, error) {
req, err := http.NewRequestWithContext(ctx, http.MethodGet, srv.URL, nil)
if err != nil {
return "", err
}
resp, err := http.DefaultClient.Do(req)
if err != nil {
return "", err
}
defer resp.Body.Close()
body, err := io.ReadAll(resp.Body)
if err != nil {
return "", err
}
return string(body), nil
}))
res := a.toolHandler()(context.Background(), ai.ToolCall{ID: "pay-1", Name: "paid.http", Input: map[string]any{"url": srv.URL}})
if !strings.Contains(res.Content, "no Payer configured") {
t.Fatalf("content = %q, want no payer error", res.Content)
}
}
-10
View File
@@ -68,8 +68,6 @@ func init() {
_ = m.Init(opts...)
return m
})
ai.RegisterStream("fake")
ai.RegisterToolStream("fake")
}
// fakeClient embeds the default client (so NewRequest works) and
@@ -248,12 +246,4 @@ func TestCompactingMemorySummarizesAndRecallsArchivedContext(t *testing.T) {
if !sawRecall {
t.Error("model request did not recall archived matching context")
}
summary := Summary(a.mem)
if !strings.Contains(summary, "Conversation memory summary") || !strings.Contains(summary, "alpha") {
t.Fatalf("inspectable memory summary = %q, want compacted alpha summary", summary)
}
a.mem.Clear()
if summary := Summary(a.mem); summary != "" {
t.Fatalf("summary after Clear = %q, want empty", summary)
}
}
-52
View File
@@ -46,27 +46,6 @@ type MemoryRecall interface {
Recall(query string, limit int) []ai.Message
}
// MemorySummary is implemented by memory backends that expose their current
// compacted summary for inspection. It lets long-running agents make memory
// compaction observable without coupling callers to a concrete store.
type MemorySummary interface {
Summary() string
}
// Summary returns the current compacted-memory summary for m, when supported.
// It returns an empty string for memory backends that have not compacted or do
// not expose an inspectable summary.
func Summary(m Memory) string {
if m == nil {
return ""
}
summarizer, ok := m.(MemorySummary)
if !ok {
return ""
}
return summarizer.Summary()
}
// NewMemory returns the default store-backed memory: an in-process
// conversation buffer (truncated to limit) that persists to the store
// under key, so an agent picks up where it left off after a restart.
@@ -137,7 +116,6 @@ type storeMemory struct {
hist *ai.History
compaction MemoryCompaction
archive []ai.Message
summary string
retrieveAll bool
}
@@ -162,20 +140,10 @@ func (m *storeMemory) Clear() {
m.mu.Lock()
m.hist.Reset()
m.archive = nil
m.summary = ""
m.mu.Unlock()
m.save()
}
// Summary returns the latest compacted summary text, if this memory has
// compacted older turns. The returned value is safe to show in debug UIs or
// checkpoints because it is exactly the summary retained in active context.
func (m *storeMemory) Summary() string {
m.mu.Lock()
defer m.mu.Unlock()
return m.summary
}
// Recall returns archived messages whose content contains words from query.
// It is deterministic and provider-neutral: no embeddings or model calls are
// required, but semantic/vector stores can replace Memory for richer retrieval.
@@ -234,16 +202,12 @@ func (m *storeMemory) load() {
}
m.mu.Lock()
m.archive = state.Archive
m.summary = state.Summary
if m.retrieveAll && len(m.archive) == 0 {
m.archive = append(m.archive, state.Messages...)
}
for _, msg := range state.Messages {
m.hist.Add(msg.Role, msg.Content)
}
if m.summary == "" {
m.summary = currentMemorySummary(state.Messages)
}
m.mu.Unlock()
}
@@ -255,7 +219,6 @@ func (m *storeMemory) save() {
data, err := json.Marshal(memoryState{
Messages: m.hist.Messages(),
Archive: m.archive,
Summary: m.summary,
})
m.mu.Unlock()
if err != nil {
@@ -293,7 +256,6 @@ func (m *storeMemory) compact() {
if summary.Role == "" {
summary.Role = "system"
}
m.summary = fmt.Sprint(summary.Content)
m.hist.Reset()
m.hist.Add(summary.Role, summary.Content)
for _, msg := range recent {
@@ -301,19 +263,6 @@ func (m *storeMemory) compact() {
}
}
func currentMemorySummary(msgs []ai.Message) string {
for _, msg := range msgs {
if msg.Role != "system" {
continue
}
text := fmt.Sprint(msg.Content)
if strings.HasPrefix(text, "Conversation memory summary:") {
return text
}
}
return ""
}
func defaultMemorySummary(msgs []ai.Message) ai.Message {
return ai.Message{
Role: "system",
@@ -368,5 +317,4 @@ func recallTerms(query string) []string {
type memoryState struct {
Messages []ai.Message `json:"messages"`
Archive []ai.Message `json:"archive,omitempty"`
Summary string `json:"summary,omitempty"`
}
-12
View File
@@ -132,14 +132,8 @@ func TestCompactingMemoryArchivePersistsAndReloads(t *testing.T) {
m.Add("assistant", "noted")
m.Add("user", "beta budget is 7")
m.Add("assistant", "noted")
if summary := Summary(m); !strings.Contains(summary, "alpha budget is 42") {
t.Fatalf("inspectable summary = %q, want alpha budget", summary)
}
reloaded := NewCompactingMemory(st, "agent/reload/history", 3, 1)
if summary := Summary(reloaded); !strings.Contains(summary, "alpha budget is 42") {
t.Fatalf("reloaded summary = %q, want alpha budget", summary)
}
recall, ok := reloaded.(MemoryRecall)
if !ok {
t.Fatal("compacting memory should support recall")
@@ -171,14 +165,8 @@ func TestCompactingMemoryUsesCustomSummarizerAndReloadsRecall(t *testing.T) {
if len(msgs) == 0 || msgs[0].Content != "custom summary count=3" {
t.Fatalf("summary = %#v, want custom summarizer output", msgs)
}
if summary := Summary(m); summary != "custom summary count=3" {
t.Fatalf("inspectable custom summary = %q, want custom summary count=3", summary)
}
reloaded := NewCompactingMemoryWithOptions(st, "agent/custom/history", MemoryCompaction{MaxMessages: 3, KeepRecent: 1})
if summary := Summary(reloaded); summary != "custom summary count=3" {
t.Fatalf("reloaded custom summary = %q, want custom summary count=3", summary)
}
recall := reloaded.(MemoryRecall)
recalled := recall.Recall("alpha budget", 1)
if len(recalled) != 1 {
-49
View File
@@ -10,7 +10,6 @@ import (
"go-micro.dev/v6/flow"
"go-micro.dev/v6/registry"
"go-micro.dev/v6/store"
"go-micro.dev/v6/wrapper/x402"
"go.opentelemetry.io/otel/trace"
)
@@ -60,9 +59,6 @@ type Options struct {
// ModelRetryBackoff is the base delay between transient provider failures
// (grows exponentially per attempt when retries are enabled).
ModelRetryBackoff time.Duration
// ModelRetryJitter adds up to this random delay to each provider retry
// backoff. Default 0 preserves deterministic timing unless explicitly set.
ModelRetryJitter time.Duration
// ToolTimeout bounds each tool execution (0 disables). The timeout is
// applied before custom tools, delegate, and service RPC calls so context
// deadlines propagate consistently through the agent loop.
@@ -102,14 +98,6 @@ type Options struct {
LoopLimit int
// Approve gates each action before it runs. Nil = allow all.
Approve ApproveFunc
// MaxSpend bounds paid x402 tool spend per Ask in the asset's smallest
// unit (0 = disabled). ToolSpend lists known paid tools and their prices.
MaxSpend int64
ToolSpend map[string]int64
// Payer lets the agent settle x402 Payment Required challenges from tools.
// Budget bounds autonomous x402 payments per Ask (0 = unlimited).
Payer x402.Payer
Budget int64
// A2AAddress, if set, makes Run serve this agent over the A2A protocol
// on that address directly (no separate gateway), e.g. ":4000".
@@ -236,37 +224,6 @@ func ApproveTool(fn ApproveFunc) Option {
return func(o *Options) { o.Approve = fn }
}
// MaxSpend bounds paid x402 tool spend per Ask, in the asset's smallest unit
// (0 = disabled). A paid tool that would exceed the cap is refused before the
// tool handler runs or any payment can be made.
func MaxSpend(amount int64) Option {
return func(o *Options) { o.MaxSpend = amount }
}
// ToolSpend records the x402 price for a tool, in the asset's smallest unit,
// so MaxSpend can reserve budget before execution. Non-positive amounts are
// treated as free.
func ToolSpend(tool string, amount int64) Option {
return func(o *Options) {
if o.ToolSpend == nil {
o.ToolSpend = map[string]int64{}
}
o.ToolSpend[tool] = amount
}
}
// Payer configures the wallet/signing hook used to settle x402-paid tools.
// Without a payer, payment-required tool results are returned as clear errors.
func Payer(p x402.Payer) Option {
return func(o *Options) { o.Payer = p }
}
// Budget bounds autonomous x402 payments per Ask, in the asset's smallest
// unit (0 = unlimited). The budget is enforced by wrapper/x402.Client.
func Budget(amount int64) Option {
return func(o *Options) { o.Budget = amount }
}
// LoopLimit sets how many times the agent may repeat the same tool call
// (same name and arguments) in one Ask before it is refused as a
// no-progress loop. 0 disables loop detection.
@@ -295,12 +252,6 @@ func ModelRetry(maxAttempts int, backoff time.Duration) Option {
}
}
// ModelRetryJitter adds bounded random jitter to provider retry backoff.
// Set 0 to disable.
func ModelRetryJitter(d time.Duration) Option {
return func(o *Options) { o.ModelRetryJitter = d }
}
// ToolRetry sets the tool retry budget and backoff for transient failures.
// Attempts include the first call. Retries are opt-in because tools may have
// side effects; keep handlers idempotent before enabling this.
+5 -40
View File
@@ -51,8 +51,6 @@ const (
AttrDispatch = "agent.dispatch"
AttrTrigger = "agent.trigger"
AttrRunEventKind = "agent.event.kind"
AttrSpend = "agent.spend"
AttrToolSpend = "agent.tool.spend"
)
type RunEvent struct {
@@ -75,8 +73,6 @@ type RunEvent struct {
Error string `json:"error,omitempty"`
ErrorKind string `json:"error_kind,omitempty"`
InputChars int `json:"input_chars,omitempty"`
Spent int64 `json:"spent,omitempty"`
ToolSpend int64 `json:"tool_spend,omitempty"`
}
type Usage = ai.Usage
@@ -86,8 +82,7 @@ type Usage = ai.Usage
type RunListOptions struct {
// Status, when set, keeps only runs with the matching status
// (for example "running", "done", "canceled", "timeout",
// "rate_limited", "auth", "configuration", "unavailable",
// "provider_error", "error", or "refused").
// "rate_limited", "error", or "refused").
Status string
// TraceID, when set, keeps only runs correlated with this trace id.
// A prefix is accepted so operators can paste the shortened trace id
@@ -115,7 +110,6 @@ type RunSummary struct {
LastKind string `json:"last_kind,omitempty"`
LastError string `json:"last_error,omitempty"`
LastErrorKind string `json:"last_error_kind,omitempty"`
Spent int64 `json:"spent,omitempty"`
}
func (a *agentImpl) tracer() trace.Tracer {
@@ -367,7 +361,6 @@ func (a *agentImpl) traceTool(next ai.ToolHandler) ai.ToolHandler {
return func(ctx context.Context, call ai.ToolCall) ai.ToolResult {
info, _ := ai.RunInfoFrom(ctx)
start := time.Now()
spentBefore := a.spend
if a.opts.TraceProvider == nil {
res := next(ctx, call)
@@ -377,21 +370,19 @@ func (a *agentImpl) traceTool(next ai.ToolHandler) ai.ToolHandler {
if toolAttempts <= 0 {
toolAttempts = 1
}
a.recordRunEvent(RunEvent{Time: time.Now(), RunID: info.RunID, ParentID: info.ParentID, Agent: info.Agent, Kind: "tool", Name: call.Name, Attempt: toolAttempts, MaxAttempts: a.opts.ToolMaxAttempts, LatencyMS: dur, Refused: res.Refused, Error: resErr, ErrorKind: classifyToolError(resErr), Spent: a.spend, ToolSpend: a.spend - spentBefore})
a.recordRunEvent(RunEvent{Time: time.Now(), RunID: info.RunID, ParentID: info.ParentID, Agent: info.Agent, Kind: "tool", Name: call.Name, Attempt: toolAttempts, MaxAttempts: a.opts.ToolMaxAttempts, LatencyMS: dur, Refused: res.Refused, Error: resErr, ErrorKind: classifyToolError(resErr)})
return res
}
spanAttrs := appendRunInfoAttributes([]attribute.KeyValue{
ctx, span := a.tracer().Start(ctx, spanNameToolCall, trace.WithAttributes(
attribute.String(AttrRunID, info.RunID),
attribute.String(AttrParentRunID, info.ParentID),
attribute.String(AttrAgentName, info.Agent),
attribute.String(AttrToolName, call.Name),
attribute.Bool(AttrDelegate, call.Name == toolDelegate),
}, info)
ctx, span := a.tracer().Start(ctx, spanNameToolCall, trace.WithAttributes(spanAttrs...))
))
res := next(ctx, call)
dur := time.Since(start).Milliseconds()
toolSpend := a.spend - spentBefore
attrs := []attribute.KeyValue{attribute.Int64(AttrLatencyMS, dur)}
toolAttempts := res.Attempts
if toolAttempts <= 0 {
@@ -401,9 +392,6 @@ func (a *agentImpl) traceTool(next ai.ToolHandler) ai.ToolHandler {
if a.opts.ToolMaxAttempts > 0 {
attrs = append(attrs, attribute.Int(AttrToolMaxAttempts, a.opts.ToolMaxAttempts))
}
if toolSpend > 0 {
attrs = append(attrs, attribute.Int64(AttrSpend, a.spend), attribute.Int64(AttrToolSpend, toolSpend))
}
if res.Refused != "" {
attrs = append(attrs, attribute.Bool(AttrGuardrailBlock, true), attribute.String(AttrRefusal, res.Refused))
}
@@ -419,7 +407,7 @@ func (a *agentImpl) traceTool(next ai.ToolHandler) ai.ToolHandler {
} else {
span.SetStatus(codes.Ok, "")
}
a.recordSpanEvent(span, RunEvent{Time: time.Now(), RunID: info.RunID, ParentID: info.ParentID, Agent: info.Agent, Kind: "tool", Name: call.Name, Attempt: toolAttempts, MaxAttempts: a.opts.ToolMaxAttempts, LatencyMS: dur, Refused: res.Refused, Error: resErr, ErrorKind: classifyToolError(resErr), Spent: a.spend, ToolSpend: toolSpend})
a.recordSpanEvent(span, RunEvent{Time: time.Now(), RunID: info.RunID, ParentID: info.ParentID, Agent: info.Agent, Kind: "tool", Name: call.Name, Attempt: toolAttempts, MaxAttempts: a.opts.ToolMaxAttempts, LatencyMS: dur, Refused: res.Refused, Error: resErr, ErrorKind: classifyToolError(resErr)})
span.End()
return res
}
@@ -506,12 +494,6 @@ func runEventAttributes(e RunEvent) []attribute.KeyValue {
if e.InputChars > 0 {
attrs = append(attrs, attribute.Int(AttrInputChars, e.InputChars))
}
if e.Spent > 0 {
attrs = append(attrs, attribute.Int64(AttrSpend, e.Spent))
}
if e.ToolSpend > 0 {
attrs = append(attrs, attribute.Int64(AttrToolSpend, e.ToolSpend))
}
attrs = appendUsage(attrs, e.Tokens)
if e.Refused != "" {
attrs = append(attrs, attribute.Bool(AttrGuardrailBlock, true), attribute.String(AttrRefusal, e.Refused))
@@ -546,12 +528,6 @@ func appendRunInfoAttributes(attrs []attribute.KeyValue, info ai.RunInfo) []attr
if info.Trigger != "" {
attrs = append(attrs, attribute.String(AttrTrigger, info.Trigger))
}
if info.Spent > 0 {
attrs = append(attrs, attribute.Int64(AttrSpend, info.Spent))
}
if info.ToolSpend > 0 {
attrs = append(attrs, attribute.Int64(AttrToolSpend, info.ToolSpend))
}
return attrs
}
@@ -638,9 +614,6 @@ func ListRunSummariesWithOptions(s store.Store, agentName string, opts RunListOp
if e.ErrorKind != "" {
summary.LastErrorKind = e.ErrorKind
}
if e.Spent > summary.Spent {
summary.Spent = e.Spent
}
}
if opts.Status != "" && summary.Status != opts.Status {
continue
@@ -688,14 +661,6 @@ func runErrorStatus(kind string) string {
return "timeout"
case ai.ErrorKindRateLimited:
return "rate_limited"
case ai.ErrorKindAuth:
return "auth"
case ai.ErrorKindConfiguration:
return "configuration"
case ai.ErrorKindUnavailable:
return "unavailable"
case ai.ErrorKindProvider:
return "provider_error"
default:
return "error"
}
+3 -104
View File
@@ -103,10 +103,8 @@ func TestAgentOpenTelemetrySpans(t *testing.T) {
t.Fatalf("model span missing model event: %#v", s.Events())
}
}
if s.Name() == spanNameToolCall {
if !spanEventHasRunInfo(s.Events(), "agent.tool", runID, "runner") {
t.Fatalf("tool span missing tool event: %#v", s.Events())
}
if s.Name() == spanNameToolCall && !spanEventHasRunInfo(s.Events(), "agent.tool", runID, "runner") {
t.Fatalf("tool span missing tool event: %#v", s.Events())
}
}
keys, err := store.Scope(st, "agent", "runner").List(store.ListPrefix("runs/"))
@@ -144,45 +142,6 @@ func TestAgentOpenTelemetrySpans(t *testing.T) {
}
}
func TestAgentOpenTelemetryToolSpanIncludesWorkflowRunInfo(t *testing.T) {
exp := tracetest.NewInMemoryExporter()
tp := trace.NewTracerProvider(trace.WithSyncer(exp))
st := store.NewMemoryStore()
a := New(Name("workflow-tool"), Provider("oteltest"), WithStore(st), TraceProvider(tp)).(*agentImpl)
handler := a.traceTool(func(context.Context, ai.ToolCall) ai.ToolResult {
return ai.ToolResult{Value: "ok"}
})
ctx := ai.WithRunInfo(context.Background(), ai.RunInfo{
RunID: "run-workflow-tool",
ParentID: "parent-run",
Agent: "workflow-tool",
Flow: "deploy",
Step: "notify",
Dispatch: "workflow",
Trigger: "manual",
})
res := handler(ctx, ai.ToolCall{ID: "call-1", Name: "notify", Input: map[string]any{"ok": true}})
if resultError(res) != "" {
t.Fatalf("tool returned error: %#v", res)
}
for _, span := range exp.GetSpans().Snapshots() {
if span.Name() != spanNameToolCall {
continue
}
attrs := spanAttributes(span.Attributes())
if attrs[AttrRunID] != "run-workflow-tool" || attrs[AttrParentRunID] != "parent-run" || attrs[AttrAgentName] != "workflow-tool" {
t.Fatalf("tool span missing run lineage: %#v", attrs)
}
if attrs[AttrFlowName] != "deploy" || attrs[AttrFlowStep] != "notify" || attrs[AttrDispatch] != "workflow" || attrs[AttrTrigger] != "manual" {
t.Fatalf("tool span missing workflow run info: %#v", attrs)
}
return
}
t.Fatalf("tool span not emitted; got %d spans", len(exp.GetSpans().Snapshots()))
}
func TestAgentOpenTelemetryToolRetryAttempts(t *testing.T) {
exp := tracetest.NewInMemoryExporter()
tp := trace.NewTracerProvider(trace.WithSyncer(exp))
@@ -421,63 +380,6 @@ func spanAttributes(attrs []attribute.KeyValue) map[string]string {
return out
}
func TestAgentOpenTelemetryToolSpanIncludesSpend(t *testing.T) {
exp := tracetest.NewInMemoryExporter()
tp := trace.NewTracerProvider(trace.WithSyncer(exp))
st := store.NewMemoryStore()
a := New(Name("spender"), Provider("oteltest"), Model("unit-model"), WithStore(st), TraceProvider(tp), MaxSpend(10), ToolSpend("probe", 7), WithTool("probe", "probe", nil, func(ctx context.Context, input map[string]any) (string, error) {
info, ok := ai.RunInfoFrom(ctx)
if !ok {
t.Fatal("RunInfo missing from paid tool context")
}
if info.Spent != 7 || info.ToolSpend != 7 {
t.Fatalf("RunInfo spend = (%d, %d), want (7, 7)", info.Spent, info.ToolSpend)
}
return "ok", nil
}))
if _, err := a.Ask(context.Background(), "hello"); err != nil {
t.Fatal(err)
}
var sawToolSpan bool
for _, s := range exp.GetSpans().Snapshots() {
if s.Name() != spanNameToolCall {
continue
}
sawToolSpan = true
attrs := spanAttributes(s.Attributes())
if attrs[AttrSpend] != "7" || attrs[AttrToolSpend] != "7" {
t.Fatalf("tool span missing spend attributes: %#v", attrs)
}
if !spanEventHasAttribute(s.Events(), "agent.tool", AttrToolSpend, "7") {
t.Fatalf("tool event missing spend attribute: %#v", s.Events())
}
}
if !sawToolSpan {
t.Fatal("tool span not emitted")
}
summaries, err := ListRunSummaries(st, "spender")
if err != nil {
t.Fatal(err)
}
if len(summaries) != 1 || summaries[0].Spent != 7 {
t.Fatalf("summary spend = %#v, want 7", summaries)
}
}
func spanEventHasAttribute(events []trace.Event, name, key, value string) bool {
for _, e := range events {
if e.Name != name {
continue
}
attrs := spanAttributes(e.Attributes)
if attrs[key] == value {
return true
}
}
return false
}
func TestAgentOpenTelemetrySpansDelegateLineage(t *testing.T) {
exp := tracetest.NewInMemoryExporter()
tp := trace.NewTracerProvider(trace.WithSyncer(exp))
@@ -720,10 +622,7 @@ func TestRunStatusClassifiesOperationalErrorKinds(t *testing.T) {
{name: "canceled", kind: ai.ErrorKindCanceled, want: "canceled"},
{name: "timeout", kind: ai.ErrorKindTimeout, want: "timeout"},
{name: "rate limited", kind: ai.ErrorKindRateLimited, want: "rate_limited"},
{name: "auth", kind: ai.ErrorKindAuth, want: "auth"},
{name: "configuration", kind: ai.ErrorKindConfiguration, want: "configuration"},
{name: "unavailable", kind: ai.ErrorKindUnavailable, want: "unavailable"},
{name: "provider", kind: ai.ErrorKindProvider, want: "provider_error"},
{name: "provider", kind: ai.ErrorKindProvider, want: "error"},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
-72
View File
@@ -29,7 +29,6 @@ var _ server.Option
type AgentService interface {
Chat(ctx context.Context, in *ChatRequest, opts ...client.CallOption) (*ChatResponse, error)
StreamChat(ctx context.Context, in *ChatRequest, opts ...client.CallOption) (Agent_StreamChatService, error)
}
type agentService struct {
@@ -54,40 +53,6 @@ func (c *agentService) Chat(ctx context.Context, in *ChatRequest, opts ...client
return out, nil
}
func (c *agentService) StreamChat(ctx context.Context, in *ChatRequest, opts ...client.CallOption) (Agent_StreamChatService, error) {
req := c.c.NewRequest(c.name, "Agent.StreamChat", in)
stream, err := c.c.Stream(ctx, req, opts...)
if err != nil {
return nil, err
}
if err := stream.Send(in); err != nil {
_ = stream.Close()
return nil, err
}
return &agentServiceStreamChat{stream}, nil
}
type Agent_StreamChatService interface {
Close() error
Recv() (*ChatResponse, error)
}
type agentServiceStreamChat struct {
stream client.Stream
}
func (x *agentServiceStreamChat) Close() error {
return x.stream.Close()
}
func (x *agentServiceStreamChat) Recv() (*ChatResponse, error) {
m := new(ChatResponse)
if err := x.stream.Recv(m); err != nil {
return nil, err
}
return m, nil
}
// Server API for Agent service
type AgentHandler interface {
@@ -97,7 +62,6 @@ type AgentHandler interface {
func RegisterAgentHandler(s server.Server, hdlr AgentHandler, opts ...server.HandlerOption) error {
type agent interface {
Chat(ctx context.Context, in *ChatRequest, out *ChatResponse) error
StreamChat(ctx context.Context, stream server.Stream) error
}
type Agent struct {
agent
@@ -113,39 +77,3 @@ type agentHandler struct {
func (h *agentHandler) Chat(ctx context.Context, in *ChatRequest, out *ChatResponse) error {
return h.AgentHandler.Chat(ctx, in, out)
}
func (h *agentHandler) StreamChat(ctx context.Context, stream server.Stream) error {
streamer, ok := h.AgentHandler.(interface {
StreamChat(context.Context, Agent_StreamChatStream) error
})
if !ok {
return fmt.Errorf("agent: StreamChat unsupported")
}
return streamer.StreamChat(ctx, &agentStreamChatStream{stream})
}
type Agent_StreamChatStream interface {
Close() error
Send(*ChatResponse) error
Recv() (*ChatRequest, error)
}
type agentStreamChatStream struct {
stream server.Stream
}
func (x *agentStreamChatStream) Close() error {
return x.stream.Close()
}
func (x *agentStreamChatStream) Send(m *ChatResponse) error {
return x.stream.Send(m)
}
func (x *agentStreamChatStream) Recv() (*ChatRequest, error) {
m := new(ChatRequest)
if err := x.stream.Recv(m); err != nil {
return nil, err
}
return m, nil
}
-1
View File
@@ -7,7 +7,6 @@ option go_package = "./proto;agent";
// Agent is the RPC interface for an AI agent.
service Agent {
rpc Chat(ChatRequest) returns (ChatResponse) {}
rpc StreamChat(ChatRequest) returns (stream ChatResponse) {}
}
message ChatRequest {
-55
View File
@@ -240,55 +240,6 @@ func TestAskCancellationDuringToolCallFailsRun(t *testing.T) {
}
}
func TestSlowProviderTimeoutPreventsLateToolSideEffects(t *testing.T) {
started := make(chan struct{})
release := make(chan struct{})
done := make(chan struct{})
fakeGen = func(ctx context.Context, opts ai.Options, req *ai.Request) (*ai.Response, error) {
close(started)
<-release
defer close(done)
if opts.ToolHandler == nil {
t.Fatal("missing tool handler")
}
res := opts.ToolHandler(ctx, ai.ToolCall{ID: "late-1", Name: "external.create", Input: map[string]any{"title": "too late"}})
if !strings.Contains(res.Content, context.DeadlineExceeded.Error()) {
t.Errorf("late tool result = %q, want deadline exceeded", res.Content)
}
return &ai.Response{Reply: "late", ToolCalls: []ai.ToolCall{{ID: "late-1", Name: "external.create", Input: map[string]any{"title": "too late"}, Result: res.Content}}}, nil
}
defer func() { fakeGen = nil }()
toolRuns := 0
a := newTestAgent(
Name("slow-provider-late-tool"),
ModelCallTimeout(10*time.Millisecond),
WithTool("external.create", "create once", nil, func(context.Context, map[string]any) (string, error) {
toolRuns++
return "created", nil
}),
)
_, err := a.Ask(context.Background(), "provider times out before tool")
if !errors.Is(err, context.DeadlineExceeded) {
t.Fatalf("Ask error = %v, want deadline exceeded", err)
}
select {
case <-started:
default:
t.Fatal("provider was not called")
}
close(release)
select {
case <-done:
case <-time.After(time.Second):
t.Fatal("late provider call did not finish")
}
if toolRuns != 0 {
t.Fatalf("late tool executions = %d, want 0", toolRuns)
}
}
func TestAskCheckpointRecordsTerminalOperationalFailureStatus(t *testing.T) {
tests := []struct {
name string
@@ -327,12 +278,6 @@ func TestAskCheckpointRecordsTerminalOperationalFailureStatus(t *testing.T) {
if len(runs[0].Steps) == 0 || runs[0].Steps[0].Status != tt.want {
t.Fatalf("step status = %#v, want %q", runs[0].Steps, tt.want)
}
if runs[0].Steps[0].Attempts != 1 {
t.Fatalf("step attempts = %d, want 1", runs[0].Steps[0].Attempts)
}
if got := runs[0].Steps[0].ErrorKind; got != string(ai.ClassifyError(tt.err)) {
t.Fatalf("step error kind = %q, want %q", got, ai.ClassifyError(tt.err))
}
if pending, err := Pending(context.Background(), a); err != nil || len(pending) != 0 {
t.Fatalf("Pending = %#v, %v; want no terminal run", pending, err)
}
-55
View File
@@ -118,14 +118,8 @@ func TestStreamAskHelperRejectsUnsupportedAgent(t *testing.T) {
func TestAgentStreamUsesProviderStreamingAndRecordsAssistantMemory(t *testing.T) {
var sawRequest bool
var sawRunInfo bool
fakeStream = func(ctx context.Context, opts ai.Options, req *ai.Request) (ai.Stream, error) {
sawRequest = true
info, ok := ai.RunInfoFrom(ctx)
if !ok || info.RunID == "" || info.Agent != "provider-stream" {
t.Fatalf("RunInfo = %#v, %v; want provider stream run metadata", info, ok)
}
sawRunInfo = true
if req.Prompt != "stream the answer" {
t.Fatalf("Prompt = %q, want stream the answer", req.Prompt)
}
@@ -159,9 +153,6 @@ func TestAgentStreamUsesProviderStreamingAndRecordsAssistantMemory(t *testing.T)
if !sawRequest {
t.Fatal("provider Stream was not called")
}
if !sawRunInfo {
t.Fatal("provider Stream did not receive RunInfo")
}
if reply != "hello" {
t.Fatalf("reply = %q, want hello", reply)
}
@@ -171,29 +162,6 @@ func TestAgentStreamUsesProviderStreamingAndRecordsAssistantMemory(t *testing.T)
}
}
func TestAgentStreamCanceledContextSkipsProviderCallAndMemory(t *testing.T) {
calls := 0
fakeStream = func(ctx context.Context, opts ai.Options, req *ai.Request) (ai.Stream, error) {
calls++
return &sliceStream{chunks: []string{"late"}}, nil
}
defer func() { fakeStream = nil }()
ctx, cancel := context.WithCancel(context.Background())
cancel()
a := newTestAgent(Name("provider-stream-cancel"))
_, err := a.Stream(ctx, "do not start")
if !errors.Is(err, context.Canceled) {
t.Fatalf("Stream error = %v, want context canceled", err)
}
if calls != 0 {
t.Fatalf("provider Stream calls = %d, want 0 after caller cancellation", calls)
}
if got := a.mem.Messages(); len(got) != 0 {
t.Fatalf("memory = %#v, want no recorded canceled stream turn", got)
}
}
func TestResumeStreamAskDoesNotReplayCompletedTool(t *testing.T) {
ctx := context.Background()
cp := flow.StoreCheckpoint(store.NewStore(), "stream-resume-agent")
@@ -275,29 +243,6 @@ func TestResumeStreamAskDoesNotReplayCompletedTool(t *testing.T) {
}
}
func TestAgentStreamDoesNotRecordUserWhenProviderStreamingUnsupported(t *testing.T) {
fakeStream = func(ctx context.Context, opts ai.Options, req *ai.Request) (ai.Stream, error) {
if len(req.Messages) == 0 || req.Messages[len(req.Messages)-1].Role != "user" || req.Messages[len(req.Messages)-1].Content != "stream fallback" {
t.Fatalf("stream request messages = %+v, want pending user message", req.Messages)
}
return nil, ai.ErrStreamingUnsupported
}
defer func() { fakeStream = nil }()
mem := NewInMemory(8)
a := newTestAgent(Name("stream-fallback"), WithMemory(mem), WithTool("echo", "echo text", nil, func(context.Context, map[string]any) (string, error) {
return "ok", nil
}))
_, err := a.Stream(context.Background(), "stream fallback")
if !errors.Is(err, ai.ErrStreamingUnsupported) {
t.Fatalf("Stream error = %v, want ErrStreamingUnsupported", err)
}
if got := mem.Messages(); len(got) != 0 {
t.Fatalf("memory after unsupported stream = %+v, want no recorded messages", got)
}
}
type unsupportedAgent struct{}
func (unsupportedAgent) Name() string { return "unsupported" }
+18 -218
View File
@@ -4,7 +4,6 @@ import (
"context"
"encoding/json"
"fmt"
"html"
"regexp"
"strings"
@@ -13,17 +12,14 @@ import (
var fencedJSONBlock = regexp.MustCompile("(?s)```(?:json)?\\s*(.*?)\\s*```")
var taggedToolCallBlock = regexp.MustCompile(`(?s)<[^<>]*(?:tool_call|tool_calls|function=)[^<>]*>(.*?)</[^<>]*>`)
var singleTaggedToolCall = regexp.MustCompile(`(?s)<(tool_call\b[^<>]*|[^<>]*function\s*=[^<>]*)>(.*?)</[^<>]*>`)
var taggedToolNameAttr = regexp.MustCompile(`(?i)(?:function|name|tool)\s*=\s*["\']?([^"\'\s>]+)`)
var openingTaggedToolCall = regexp.MustCompile(`(?i)<(tool_call\b[^<>]*|[^<>]*function\s*=[^<>]*)>`)
var singleTaggedToolCall = regexp.MustCompile(`(?s)<(tool_call\b[^<>]*|[^<>]*function=[^<>]*)>(.*?)</[^<>]*>`)
type textToolCall struct {
ID string `json:"id"`
Name string `json:"name"`
Tool string `json:"tool"`
Input map[string]any `json:"input"`
Arguments any `json:"arguments"`
Function *textToolCall `json:"function"`
Arguments map[string]any `json:"arguments"`
}
// executeTextToolCalls is a compatibility fallback for providers that return a
@@ -94,7 +90,6 @@ func textToolCallKey(call ai.ToolCall) string {
}
func parseTextToolCalls(text string, tools []ai.Tool) []ai.ToolCall {
text = html.UnescapeString(text)
allowed := textToolNames(tools)
if len(allowed) == 0 {
return nil
@@ -103,9 +98,6 @@ func parseTextToolCalls(text string, tools []ai.Tool) []ai.ToolCall {
if calls := decodeTaggedTextToolCalls(text, allowed); len(calls) > 0 {
return calls
}
if calls := decodeFunctionTextToolCalls(text, allowed); len(calls) > 0 {
return calls
}
for _, candidate := range jsonCandidates(text) {
if calls := decodeTextToolCalls(candidate, allowed); len(calls) > 0 {
return calls
@@ -114,37 +106,6 @@ func parseTextToolCalls(text string, tools []ai.Tool) []ai.ToolCall {
return nil
}
func partialTextToolCallName(text string, tools []ai.Tool) string {
text = html.UnescapeString(text)
allowed := textToolNames(tools)
if len(allowed) == 0 {
return ""
}
openMatches := openingTaggedToolCall.FindAllStringSubmatchIndex(text, -1)
if len(openMatches) == 0 {
return ""
}
closedMatches := singleTaggedToolCall.FindAllStringSubmatchIndex(text, -1)
for _, open := range openMatches {
closed := false
for _, match := range closedMatches {
if match[0] == open[0] {
closed = true
break
}
}
if closed {
continue
}
tag := text[open[2]:open[3]]
name := taggedToolName(tag)
if canonical := allowed[name]; canonical != "" {
return canonical
}
}
return ""
}
func textToolNames(tools []ai.Tool) map[string]string {
allowed := map[string]string{}
for _, tool := range tools {
@@ -215,7 +176,14 @@ func collectTextToolCalls(v any, allowed map[string]string) []ai.ToolCall {
return collectTextToolCalls(nested, allowed)
}
call := mapToTextToolCall(x)
name, input := textToolCallNameAndInput(call)
name := call.Name
if name == "" {
name = call.Tool
}
input := call.Input
if input == nil {
input = call.Arguments
}
if name == "" || allowed[name] == "" || input == nil {
return nil
}
@@ -229,61 +197,6 @@ func collectTextToolCalls(v any, allowed map[string]string) []ai.ToolCall {
}
}
func textToolCallNameAndInput(call textToolCall) (string, map[string]any) {
name := call.Name
if name == "" {
name = call.Tool
}
input := call.Input
if input == nil {
input = textToolArguments(call.Arguments)
}
if call.Function != nil {
fnName, fnInput := textToolCallNameAndInput(*call.Function)
if name == "" {
name = fnName
}
if input == nil {
input = fnInput
}
}
return name, input
}
func textToolArguments(raw any) map[string]any {
switch args := raw.(type) {
case map[string]any:
return args
case string:
var input map[string]any
if err := json.Unmarshal([]byte(args), &input); err == nil {
return input
}
}
return nil
}
func containsNestedTextToolCall(v any) bool {
switch x := v.(type) {
case string:
text := html.UnescapeString(x)
return openingTaggedToolCall.MatchString(text) || singleTaggedToolCall.MatchString(text)
case map[string]any:
for _, item := range x {
if containsNestedTextToolCall(item) {
return true
}
}
case []any:
for _, item := range x {
if containsNestedTextToolCall(item) {
return true
}
}
}
return false
}
func decodeTaggedTextToolCalls(text string, allowed map[string]string) []ai.ToolCall {
var out []ai.ToolCall
for _, match := range singleTaggedToolCall.FindAllStringSubmatch(text, -1) {
@@ -317,130 +230,17 @@ func decodeTaggedTextToolCalls(text string, allowed map[string]string) []ai.Tool
}
func taggedToolName(tag string) string {
match := taggedToolNameAttr.FindStringSubmatch(tag)
if len(match) < 2 {
return ""
}
return strings.Trim(match[1], `"'`)
}
func decodeFunctionTextToolCalls(text string, allowed map[string]string) []ai.ToolCall {
var out []ai.ToolCall
for alias, canonical := range allowed {
for _, body := range functionCallBodies(text, alias) {
var input map[string]any
if err := json.Unmarshal([]byte(body), &input); err != nil || input == nil {
continue
for _, marker := range []string{"function=", "name=", "tool="} {
if idx := strings.Index(tag, marker); idx >= 0 {
name := strings.TrimSpace(tag[idx+len(marker):])
name = strings.Trim(name, `"'`)
if end := strings.IndexAny(name, " \t\r\n>"); end >= 0 {
name = name[:end]
}
out = append(out, ai.ToolCall{
ID: fmt.Sprintf("text-call-%s", strings.ReplaceAll(alias, ".", "_")),
Name: canonical,
Input: input,
})
return strings.Trim(name, `"'`)
}
}
return out
}
func functionCallBodies(text, name string) []string {
if name == "" {
return nil
}
var bodies []string
for searchFrom := 0; searchFrom < len(text); {
idx := strings.Index(text[searchFrom:], name)
if idx < 0 {
break
}
start := searchFrom + idx
open := start + len(name)
if !isFunctionCallBoundary(text, start, open) {
searchFrom = start + len(name)
continue
}
bodyStart := open + 1
bodyEnd, ok := balancedJSONObjectEnd(text, bodyStart)
if !ok {
searchFrom = bodyStart
continue
}
bodies = append(bodies, strings.TrimSpace(text[bodyStart:bodyEnd]))
searchFrom = bodyEnd + 1
}
return bodies
}
func isFunctionCallBoundary(text string, start, open int) bool {
if open >= len(text) || text[open] != '(' {
return false
}
if start > 0 {
prev := text[start-1]
if prev == '_' || prev == '.' || prev == '-' || prev == '$' || ('0' <= prev && prev <= '9') || ('A' <= prev && prev <= 'Z') || ('a' <= prev && prev <= 'z') {
return false
}
}
for i := open + 1; i < len(text); i++ {
switch text[i] {
case ' ', '\n', '\r', '\t':
continue
case '{':
return true
default:
return false
}
}
return false
}
func balancedJSONObjectEnd(text string, start int) (int, bool) {
for start < len(text) {
switch text[start] {
case ' ', '\n', '\r', '\t':
start++
case '{':
depth := 0
inString := false
escaped := false
for i := start; i < len(text); i++ {
c := text[i]
if inString {
if escaped {
escaped = false
} else if c == '\\' {
escaped = true
} else if c == '"' {
inString = false
}
continue
}
switch c {
case '"':
inString = true
case '{':
depth++
case '}':
depth--
if depth == 0 {
for j := i + 1; j < len(text); j++ {
switch text[j] {
case ' ', '\n', '\r', '\t':
continue
case ')':
return i + 1, true
default:
return 0, false
}
}
}
}
}
return 0, false
default:
return 0, false
}
}
return 0, false
return ""
}
func firstNestedToolCalls(m map[string]any) (any, bool) {
-90
View File
@@ -56,93 +56,3 @@ func TestParseTextToolCallsCreateAliasForAddTool(t *testing.T) {
t.Fatalf("title = %v, want Design", got)
}
}
func TestParseTextToolCallsOpenAICompatibleFunctionArgumentsString(t *testing.T) {
tools := []ai.Tool{{Name: "delegate"}}
reply := `<tool_call>{"id":"call-2","type":"function","function":{"name":"delegate","arguments":"{\"task\":\"summarize the conformance marker\",\"to\":\"blocked-reviewer\"}"}}</tool_call>`
calls := parseTextToolCalls(reply, tools)
if len(calls) != 1 {
t.Fatalf("parseTextToolCalls returned %d calls, want 1: %+v", len(calls), calls)
}
if calls[0].Name != "delegate" {
t.Fatalf("call name = %q, want delegate", calls[0].Name)
}
if got := calls[0].Input["task"]; got != "summarize the conformance marker" {
t.Fatalf("task = %v, want summarize the conformance marker", got)
}
if got := calls[0].Input["to"]; got != "blocked-reviewer" {
t.Fatalf("to = %v, want blocked-reviewer", got)
}
}
func TestParseTextToolCallsTaggedMarkupWithSpacedNameAttribute(t *testing.T) {
tools := []ai.Tool{{Name: "delegate"}}
reply := `<tool_call name = "delegate">{"task":"summarize the conformance marker","to":"blocked-reviewer"}</tool_call>`
calls := parseTextToolCalls(reply, tools)
if len(calls) != 1 {
t.Fatalf("parseTextToolCalls returned %d calls, want 1: %+v", len(calls), calls)
}
if calls[0].Name != "delegate" {
t.Fatalf("call name = %q, want delegate", calls[0].Name)
}
if got := calls[0].Input["to"]; got != "blocked-reviewer" {
t.Fatalf("to = %v, want blocked-reviewer", got)
}
}
func TestParseTextToolCallsHTMLEscapedTaggedMarkup(t *testing.T) {
tools := []ai.Tool{{Name: "delegate"}}
reply := `&lt;tool_call name=&quot;delegate&quot;&gt;{"task":"summarize the conformance marker","to":"blocked-reviewer"}&lt;/tool_call&gt;`
calls := parseTextToolCalls(reply, tools)
if len(calls) != 1 {
t.Fatalf("parseTextToolCalls returned %d calls, want 1: %+v", len(calls), calls)
}
if calls[0].Name != "delegate" {
t.Fatalf("call name = %q, want delegate", calls[0].Name)
}
if got := calls[0].Input["task"]; got != "summarize the conformance marker" {
t.Fatalf("task = %v, want summarize the conformance marker", got)
}
}
func TestParseTextToolCallsFunctionCallSyntax(t *testing.T) {
tools := []ai.Tool{{Name: "delegate"}}
reply := `I will now call delegate({"task":"summarize the conformance marker","to":"blocked-reviewer"}) before answering.`
calls := parseTextToolCalls(reply, tools)
if len(calls) != 1 {
t.Fatalf("parseTextToolCalls returned %d calls, want 1: %+v", len(calls), calls)
}
if calls[0].Name != "delegate" {
t.Fatalf("call name = %q, want delegate", calls[0].Name)
}
if got := calls[0].Input["task"]; got != "summarize the conformance marker" {
t.Fatalf("task = %v, want summarize the conformance marker", got)
}
if got := calls[0].Input["to"]; got != "blocked-reviewer" {
t.Fatalf("to = %v, want blocked-reviewer", got)
}
}
func TestParseTextToolCallsFunctionCallSyntaxHandlesNestedJSON(t *testing.T) {
tools := []ai.Tool{{Name: "delegate"}}
reply := `delegate({
"task":"summarize the {escaped} marker",
"meta":{"note":"paren ) and brace } in string"},
"to":"blocked-reviewer"
})`
calls := parseTextToolCalls(reply, tools)
if len(calls) != 1 {
t.Fatalf("parseTextToolCalls returned %d calls, want 1: %+v", len(calls), calls)
}
if got := calls[0].Input["task"]; got != "summarize the {escaped} marker" {
t.Fatalf("task = %v, want nested JSON-safe task", got)
}
if got := calls[0].Input["to"]; got != "blocked-reviewer" {
t.Fatalf("to = %v, want blocked-reviewer", got)
}
}
+1 -2
View File
@@ -19,7 +19,6 @@ func init() {
return NewProvider(opts...)
})
ai.RegisterStream("anthropic")
ai.RegisterToolStream("anthropic")
}
// Provider implements the ai.Model interface for Anthropic Claude
@@ -298,7 +297,7 @@ func (p *Provider) callAPI(ctx context.Context, req map[string]any) (*ai.Respons
// Read response
respBody, _ := io.ReadAll(httpResp.Body)
if httpResp.StatusCode != http.StatusOK {
return nil, nil, ai.NewHTTPError(httpResp, respBody)
return nil, nil, fmt.Errorf("API error (%s): %s", httpResp.Status, string(respBody))
}
// Parse response
+64 -399
View File
@@ -96,7 +96,6 @@ func (p *Provider) String() string { return "atlascloud" }
func (p *Provider) Generate(ctx context.Context, req *ai.Request, opts ...ai.GenerateOption) (*ai.Response, error) {
tools := atlascloudTools(req.Tools)
compatTools, compatPrompt := atlascloudMinimaxCompatTools(p.opts.Model, req.Tools)
textToolPrompt := atlascloudMinimaxTextToolPrompt(p.opts.Model, req.Tools)
messages := []map[string]any{
{"role": "system", "content": req.SystemPrompt},
@@ -129,147 +128,92 @@ func (p *Provider) Generate(ctx context.Context, req *ai.Request, opts ...ai.Gen
apiReq["tools"] = compatTools
resp, rawMessage, err = p.callAPI(ctx, "chat-minimax-compat", apiReq)
}
if atlascloudShouldRetryMinimaxTextTools(err, textToolPrompt) {
delete(apiReq, "tools")
apiReq["messages"] = append(messages, map[string]any{"role": "system", "content": textToolPrompt})
resp, rawMessage, err = p.callAPI(ctx, "chat-minimax-text-tools", apiReq)
}
if err != nil {
return nil, err
}
}
if toolName := atlascloudPartialTextToolCallName(resp.Reply, req.Tools); toolName != "" {
repairReq := map[string]any{
"model": p.opts.Model,
"messages": append(append([]map[string]any(nil), messages...),
map[string]any{"role": "assistant", "content": resp.Reply},
map[string]any{"role": "user", "content": fmt.Sprintf("Your previous response started a %q tool call but did not finish valid tool-call markup or JSON arguments, so no tool was executed. Retry the same step now by emitting one complete valid tool call for %q. Do not describe the action in prose, and do not claim completion until the tool call succeeds.", toolName, toolName)},
),
}
if p.opts.MaxTokens > 0 {
repairReq["max_tokens"] = p.opts.MaxTokens
}
if len(tools) > 0 {
repairReq["tools"] = tools
}
resp, rawMessage, err = p.callAPI(ctx, "chat-partial-tool-repair", repairReq)
if err != nil {
return nil, fmt.Errorf("atlascloud partial text tool-call repair failed for %q: %w", toolName, err)
}
if atlascloudPartialTextToolCallName(resp.Reply, req.Tools) != "" && len(resp.ToolCalls) == 0 {
fallback := atlascloudFallbackTextToolCall(toolName, req)
if fallback == "" {
return nil, fmt.Errorf("atlascloud returned incomplete text tool call for %q after repair", toolName)
}
resp.Reply = fallback
}
}
if len(resp.ToolCalls) == 0 {
return resp, nil
}
if p.opts.ToolHandler != nil {
var allToolCalls []ai.ToolCall
allToolCalls := append([]ai.ToolCall(nil), resp.ToolCalls...)
var toolResults []string
pendingToolCalls := append([]ai.ToolCall(nil), resp.ToolCalls...)
followUpMessages := append(messages, map[string]any{
"role": "assistant",
"content": rawMessage["content"],
"tool_calls": rawMessage["tool_calls"],
})
for attempt := 0; len(pendingToolCalls) > 0 && attempt < 4; attempt++ {
for _, tc := range pendingToolCalls {
result := p.opts.ToolHandler(ctx, tc)
for _, tc := range resp.ToolCalls {
content := p.opts.ToolHandler(ctx, tc).Content
if content != "" {
toolResults = append(toolResults, content)
}
followUpMessages = append(followUpMessages, map[string]any{
"role": "tool",
"tool_call_id": tc.ID,
"content": content,
})
}
followUpReq := map[string]any{
"model": p.opts.Model,
"messages": followUpMessages,
}
if len(tools) > 0 {
// Keep the tool schema available during the follow-up turn. Minimax
// models behind Atlas Cloud sometimes call one required tool, inspect
// that result, and then issue a second tool call (for example a guarded
// delegate conformance check) instead of completing immediately.
followUpReq["tools"] = tools
}
followUpResp, _, err := p.callAPI(ctx, "tool-follow-up", followUpReq)
if err != nil {
if atlascloudShouldRetryWithoutTools(err, followUpReq) {
delete(followUpReq, "tools")
followUpResp, _, err = p.callAPI(ctx, "tool-follow-up-no-tools", followUpReq)
}
if err != nil {
return nil, err
}
}
if len(followUpResp.ToolCalls) > 0 {
for i := range followUpResp.ToolCalls {
result := p.opts.ToolHandler(ctx, followUpResp.ToolCalls[i])
if result.Refused != "" {
tc.Error = result.Refused
followUpResp.ToolCalls[i].Error = result.Refused
}
if result.Content != "" {
tc.Result = result.Content
followUpResp.ToolCalls[i].Result = result.Content
toolResults = append(toolResults, result.Content)
}
allToolCalls = append(allToolCalls, tc)
resp.ToolCalls = allToolCalls
followUpMessages = append(followUpMessages, map[string]any{
"role": "tool",
"tool_call_id": tc.ID,
"content": result.Content,
})
}
followUpReq := map[string]any{
"model": p.opts.Model,
"messages": followUpMessages,
allToolCalls = append(allToolCalls, followUpResp.ToolCalls...)
resp.ToolCalls = allToolCalls
}
if followUpResp.Reply != "" {
if strings.Contains(followUpResp.Reply, "<tool_call") || strings.Contains(followUpResp.Reply, "function=") {
// Preserve follow-up assistant content as Reply, not Answer, when
// it may contain a text-encoded tool call. The agent harness
// inspects Reply for text fallback calls after Generate returns,
// which covers AtlasCloud/minimax turns that emit a second
// required call (for example guarded delegate) as markup instead
// of native tool_calls.
resp.Reply = followUpResp.Reply
} else {
resp.Answer = followUpResp.Reply
}
if len(tools) > 0 {
// Keep the tool schema available during follow-up turns. Minimax
// models behind Atlas Cloud sometimes complete a multi-tool task
// one call at a time (plan, then service tools, then delegate).
followUpReq["tools"] = tools
}
followUpResp, followUpRawMessage, err := p.callAPI(ctx, "tool-follow-up", followUpReq)
if err != nil {
if atlascloudShouldRetryWithoutTools(err, followUpReq) {
delete(followUpReq, "tools")
followUpReq["messages"] = atlascloudFollowUpMessagesWithoutTools(p.opts.Model, followUpMessages)
followUpResp, followUpRawMessage, err = p.callAPI(ctx, "tool-follow-up-no-tools", followUpReq)
}
if err != nil {
return nil, err
}
}
if len(followUpResp.ToolCalls) == 0 {
if followUpResp.Reply != "" {
if strings.Contains(followUpResp.Reply, "<tool_call") || strings.Contains(followUpResp.Reply, "function=") {
// Preserve follow-up assistant content as Reply, not Answer, when
// it may contain a text-encoded tool call. The agent harness
// inspects Reply for text fallback calls after Generate returns.
resp.Reply = followUpResp.Reply
} else {
resp.Answer = atlascloudAnswerWithRequiredToolMarkers(followUpResp.Reply, toolResults, allToolCalls)
}
} else if len(toolResults) > 0 {
resp.Answer = strings.Join(toolResults, "\n")
}
break
}
followUpMessages = append(followUpMessages, map[string]any{
"role": "assistant",
"content": followUpRawMessage["content"],
"tool_calls": followUpRawMessage["tool_calls"],
})
pendingToolCalls = followUpResp.ToolCalls
} else if len(toolResults) > 0 {
resp.Answer = strings.Join(toolResults, "\n")
}
}
return resp, nil
}
func atlascloudAnswerWithRequiredToolMarkers(answer string, toolResults []string, toolCalls []ai.ToolCall) string {
if strings.Contains(answer, "agent-conformance") || !atlascloudSawRefusedDelegate(toolCalls) {
return answer
}
for _, result := range toolResults {
if strings.Contains(result, "agent-conformance") {
return strings.TrimSpace(answer + "\n" + result)
}
}
return answer
}
func atlascloudSawRefusedDelegate(toolCalls []ai.ToolCall) bool {
for _, call := range toolCalls {
if call.Name == "delegate" && call.Error != "" {
return true
}
}
return false
}
// Stream generates a streaming response from Atlas Cloud's OpenAI-compatible
// chat completions endpoint, emitting content deltas as they arrive.
func (p *Provider) Stream(ctx context.Context, req *ai.Request, opts ...ai.GenerateOption) (ai.Stream, error) {
@@ -382,32 +326,17 @@ func (s *atlasStream) Close() error {
}
type atlascloudAPIError struct {
Status string
Code int
Retry time.Duration
Phase string
Summary string
Body string
Status string
StatusCode int
Phase string
Summary string
Body string
}
func (e *atlascloudAPIError) Error() string {
return fmt.Sprintf("API error (%s) during atlascloud %s request (%s): %s", e.Status, e.Phase, e.Summary, e.Body)
}
func (e *atlascloudAPIError) StatusCode() int {
if e == nil {
return 0
}
return e.Code
}
func (e *atlascloudAPIError) RetryAfter() time.Duration {
if e == nil {
return 0
}
return e.Retry
}
func (p *Provider) callAPI(ctx context.Context, phase string, req map[string]any) (*ai.Response, map[string]any, error) {
reqBody, err := json.Marshal(req)
if err != nil {
@@ -431,12 +360,7 @@ func (p *Provider) callAPI(ctx context.Context, phase string, req map[string]any
respBody, _ := io.ReadAll(httpResp.Body)
if httpResp.StatusCode != http.StatusOK {
retryAfter := time.Duration(0)
var retryErr interface{ RetryAfter() time.Duration }
if errors.As(ai.NewHTTPError(httpResp, respBody), &retryErr) {
retryAfter = retryErr.RetryAfter()
}
return nil, nil, &atlascloudAPIError{Status: httpResp.Status, Code: httpResp.StatusCode, Retry: retryAfter, Phase: phase, Summary: atlascloudRequestSummary(req), Body: string(respBody)}
return nil, nil, &atlascloudAPIError{Status: httpResp.Status, StatusCode: httpResp.StatusCode, Phase: phase, Summary: atlascloudRequestSummary(req), Body: string(respBody)}
}
var chatResp struct {
@@ -481,239 +405,6 @@ func (p *Provider) callAPI(ctx context.Context, phase string, req map[string]any
return response, rawMessage, nil
}
func atlascloudFollowUpMessagesWithoutTools(model string, messages []map[string]any) []map[string]any {
if !atlascloudIsMinimaxModel(model) {
return messages
}
out := make([]map[string]any, 0, len(messages)+1)
for _, msg := range messages {
role, _ := msg["role"].(string)
switch role {
case "assistant":
converted := map[string]any{"role": "assistant"}
if content, _ := msg["content"].(string); content != "" {
converted["content"] = content
} else if calls, ok := msg["tool_calls"]; ok {
converted["content"] = "Tool call requested: " + atlascloudToolCallsText(calls)
} else {
converted["content"] = ""
}
out = append(out, converted)
case "tool":
toolID, _ := msg["tool_call_id"].(string)
content, _ := msg["content"].(string)
if toolID != "" {
content = "Tool result for " + toolID + ": " + content
} else {
content = "Tool result: " + content
}
out = append(out, map[string]any{"role": "user", "content": content})
default:
copyMsg := make(map[string]any, len(msg))
for k, v := range msg {
copyMsg[k] = v
}
out = append(out, copyMsg)
}
}
return out
}
func atlascloudToolCallsText(calls any) string {
b, err := json.Marshal(calls)
if err != nil {
return fmt.Sprint(calls)
}
return string(b)
}
func atlascloudPartialTextToolCallName(text string, tools []ai.Tool) string {
if !strings.Contains(text, "<tool_call") {
return ""
}
if strings.Contains(text, "</tool_call>") {
return ""
}
for _, tool := range tools {
for _, name := range []string{tool.Name, tool.OriginalName} {
if name == "" {
continue
}
if strings.Contains(text, `name="`+name+`"`) || strings.Contains(text, `name='`+name+`'`) {
return tool.Name
}
}
}
return ""
}
func atlascloudFallbackTextToolCall(toolName string, req *ai.Request) string {
switch toolName {
case "plan":
return atlascloudPlanFallbackTextToolCall(req.Prompt)
case "delegate":
return atlascloudDelegateFallbackTextToolCall(req)
default:
if atlascloudToolTakesNoArguments(toolName, req.Tools) {
return atlascloudEmptyArgumentFallbackTextToolCall(toolName)
}
return atlascloudServiceFallbackTextToolCall(toolName, req)
}
}
func atlascloudServiceFallbackTextToolCall(toolName string, req *ai.Request) string {
if req == nil {
return ""
}
for _, tool := range req.Tools {
if tool.Name != toolName {
continue
}
args := atlascloudFallbackArgsForProperties(tool.Properties, atlascloudRequestText(req))
if args == nil {
return ""
}
b, err := json.Marshal(args)
if err != nil {
return ""
}
return `<tool_call name="` + toolName + `">` + string(b) + `</tool_call>`
}
return ""
}
func atlascloudFallbackArgsForProperties(properties map[string]any, ctxText string) map[string]any {
if len(properties) == 0 {
return map[string]any{}
}
args := make(map[string]any, len(properties))
for name, schema := range properties {
value, ok := atlascloudFallbackArgValue(name, schema, ctxText)
if !ok {
return nil
}
args[name] = value
}
return args
}
func atlascloudFallbackArgValue(name string, schema any, ctxText string) (any, bool) {
typeName := "string"
if m, ok := schema.(map[string]any); ok {
if t, _ := m["type"].(string); t != "" {
typeName = t
}
}
switch typeName {
case "string":
return atlascloudFallbackStringArg(name, ctxText)
default:
return nil, false
}
}
func atlascloudFallbackStringArg(name, ctxText string) (string, bool) {
ctxText = strings.TrimSpace(ctxText)
if ctxText == "" {
return "", false
}
if strings.Contains(strings.ToLower(name), "email") || strings.Contains(strings.ToLower(name), "owner") {
if email := atlascloudFirstEmail(ctxText); email != "" {
return email, true
}
}
return ctxText, true
}
func atlascloudFirstEmail(text string) string {
for _, field := range strings.FieldsFunc(text, func(r rune) bool {
return strings.ContainsRune(" \t\n\r<>\"'(),;", r)
}) {
field = strings.Trim(field, ".:")
if strings.Contains(field, "@") && strings.Contains(field, ".") {
return field
}
}
return ""
}
func atlascloudToolTakesNoArguments(toolName string, tools []ai.Tool) bool {
for _, tool := range tools {
if tool.Name != toolName {
continue
}
return len(tool.Properties) == 0
}
return false
}
func atlascloudEmptyArgumentFallbackTextToolCall(toolName string) string {
if toolName == "" {
return ""
}
return `<tool_call name="` + toolName + `">{}</tool_call>`
}
func atlascloudPlanFallbackTextToolCall(prompt string) string {
task := strings.TrimSpace(prompt)
if task == "" {
task = "continue the requested work"
}
args, err := json.Marshal(map[string]any{
"steps": []map[string]string{{
"task": task,
"status": "pending",
}},
})
if err != nil {
return `<tool_call name="plan">{"steps":[{"task":"continue the requested work","status":"pending"}]}</tool_call>`
}
return `<tool_call name="plan">` + string(args) + `</tool_call>`
}
func atlascloudDelegateFallbackTextToolCall(req *ai.Request) string {
ctxText := atlascloudRequestText(req)
task := strings.TrimSpace(req.Prompt)
if task == "" {
task = strings.TrimSpace(ctxText)
}
if task == "" {
task = "continue the requested delegated work"
}
args := map[string]any{"task": task}
if strings.Contains(strings.ToLower(ctxText), "comms") {
args["to"] = "comms"
}
b, err := json.Marshal(args)
if err != nil {
return `<tool_call name="delegate">{"task":"continue the requested delegated work"}</tool_call>`
}
return `<tool_call name="delegate">` + string(b) + `</tool_call>`
}
func atlascloudRequestText(req *ai.Request) string {
if req == nil {
return ""
}
var parts []string
if req.SystemPrompt != "" {
parts = append(parts, req.SystemPrompt)
}
for _, msg := range req.Messages {
switch c := msg.Content.(type) {
case string:
parts = append(parts, c)
default:
parts = append(parts, fmt.Sprint(c))
}
}
if req.Prompt != "" {
parts = append(parts, req.Prompt)
}
return strings.Join(parts, "\n")
}
func atlascloudMinimaxCompatTools(model string, input []ai.Tool) ([]map[string]any, string) {
if !atlascloudIsMinimaxModel(model) || len(input) == 0 {
return nil, ""
@@ -737,32 +428,6 @@ func atlascloudMinimaxCompatTools(model string, input []ai.Tool) ([]map[string]a
return atlascloudTools(native), prompt
}
func atlascloudMinimaxTextToolPrompt(model string, input []ai.Tool) string {
if !atlascloudIsMinimaxModel(model) || len(input) == 0 {
return ""
}
names := make([]string, 0, len(input))
for _, tool := range input {
if tool.Name != "" {
names = append(names, tool.Name)
}
}
if len(names) == 0 {
return ""
}
return "AtlasCloud/minimax text-tool compatibility: the native tools payload was rejected. " +
"Call exactly one needed tool from this list by emitting exactly <tool_call name=\"tool_name\">{...}</tool_call>: " +
strings.Join(names, ", ") + ". Do not answer in prose instead of emitting the tag."
}
func atlascloudShouldRetryMinimaxTextTools(err error, prompt string) bool {
if prompt == "" {
return false
}
var apiErr *atlascloudAPIError
return errors.As(err, &apiErr) && apiErr.StatusCode() == http.StatusBadRequest
}
func atlascloudIsMinimaxModel(model string) bool {
model = strings.ToLower(model)
return strings.Contains(model, "minimax")
@@ -773,7 +438,7 @@ func atlascloudShouldRetryMinimaxCompat(err error, compatTools []map[string]any)
return false
}
var apiErr *atlascloudAPIError
return errors.As(err, &apiErr) && apiErr.StatusCode() == http.StatusBadRequest
return errors.As(err, &apiErr) && apiErr.StatusCode == http.StatusBadRequest
}
func atlascloudShouldRetryWithoutTools(err error, req map[string]any) bool {
@@ -781,7 +446,7 @@ func atlascloudShouldRetryWithoutTools(err error, req map[string]any) bool {
return false
}
var apiErr *atlascloudAPIError
return errors.As(err, &apiErr) && apiErr.StatusCode() == http.StatusBadRequest
return errors.As(err, &apiErr) && apiErr.StatusCode == http.StatusBadRequest
}
func atlascloudTools(input []ai.Tool) []map[string]any {
+2 -313
View File
@@ -355,8 +355,6 @@ func TestProvider_GenerateExecutesFollowUpToolCall(t *testing.T) {
_, _ = w.Write([]byte(`{"choices":[{"message":{"content":"","tool_calls":[{"id":"call-1","function":{"name":"conformance_echo","arguments":"{\"value\":\"agent-conformance\"}"}}]}}]}`))
case 2:
_, _ = w.Write([]byte(`{"choices":[{"message":{"content":"","tool_calls":[{"id":"call-2","function":{"name":"delegate","arguments":"{\"task\":\"summarize the conformance marker\",\"to\":\"blocked-reviewer\"}"}}]}}]}`))
case 3:
_, _ = w.Write([]byte(`{"choices":[{"message":{"content":"blocked by policy"}}]}`))
default:
t.Fatalf("unexpected API call %d", len(bodies))
}
@@ -403,78 +401,11 @@ func TestProvider_GenerateExecutesFollowUpToolCall(t *testing.T) {
if !strings.Contains(resp.Answer, "blocked by policy") {
t.Fatalf("Answer = %q, want follow-up tool result", resp.Answer)
}
if !strings.Contains(resp.Answer, "agent-conformance-ok") {
t.Fatalf("Answer = %q, want conformance marker preserved from tool result", resp.Answer)
}
if _, ok := bodies[1]["tools"].([]any); !ok {
t.Fatalf("follow-up request did not include tools: %#v", bodies[1])
}
}
func TestProvider_GenerateExecutesMultiStepFollowUpToolCalls(t *testing.T) {
var bodies []map[string]any
ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
var body map[string]any
if err := json.NewDecoder(r.Body).Decode(&body); err != nil {
t.Fatalf("decode request: %v", err)
}
bodies = append(bodies, body)
w.Header().Set("Content-Type", "application/json")
switch len(bodies) {
case 1:
_, _ = w.Write([]byte(`{"choices":[{"message":{"content":"","tool_calls":[{"id":"call-plan","function":{"name":"plan","arguments":"{\"steps\":[{\"task\":\"create tasks\"},{\"task\":\"notify owner\"}]}"}}]}}]}`))
case 2:
_, _ = w.Write([]byte(`{"choices":[{"message":{"content":"","tool_calls":[{"id":"call-add","function":{"name":"task_TaskService_Add","arguments":"{\"title\":\"Design\"}"}}]}}]}`))
case 3:
_, _ = w.Write([]byte(`{"choices":[{"message":{"content":"","tool_calls":[{"id":"call-delegate","function":{"name":"delegate","arguments":"{\"task\":\"notify owner@acme.com\",\"to\":\"comms\"}"}}]}}]}`))
case 4:
_, _ = w.Write([]byte(`{"choices":[{"message":{"content":"done"}}]}`))
default:
t.Fatalf("unexpected API call %d", len(bodies))
}
}))
defer ts.Close()
var calls []string
p := NewProvider(
ai.WithAPIKey("test-key"),
ai.WithBaseURL(ts.URL),
ai.WithToolHandler(func(ctx context.Context, call ai.ToolCall) ai.ToolResult {
calls = append(calls, call.Name)
return ai.ToolResult{ID: call.ID, Content: `{"ok":true}`}
}),
)
resp, err := p.Generate(context.Background(), &ai.Request{
Prompt: "plan, create tasks, and delegate notification",
Tools: []ai.Tool{
{Name: "plan", Description: "record a plan", Properties: map[string]any{"steps": map[string]any{"type": "array"}}},
{Name: "task_TaskService_Add", Description: "add task", Properties: map[string]any{"title": map[string]any{"type": "string"}}},
{Name: "delegate", Description: "delegate work", Properties: map[string]any{"task": map[string]any{"type": "string"}, "to": map[string]any{"type": "string"}}},
},
})
if err != nil {
t.Fatalf("Generate returned error: %v", err)
}
wantCalls := []string{"plan", "task_TaskService_Add", "delegate"}
if strings.Join(calls, ",") != strings.Join(wantCalls, ",") {
t.Fatalf("tool calls = %v, want %v", calls, wantCalls)
}
if len(resp.ToolCalls) != 3 {
t.Fatalf("ToolCalls = %+v, want all multi-step calls", resp.ToolCalls)
}
if resp.Answer != "done" {
t.Fatalf("Answer = %q, want final follow-up reply", resp.Answer)
}
if len(bodies) != 4 {
t.Fatalf("requests = %d, want initial plus three follow-ups", len(bodies))
}
for i := 1; i < 4; i++ {
if _, ok := bodies[i]["tools"].([]any); !ok {
t.Fatalf("follow-up request %d did not include tools: %#v", i+1, bodies[i])
}
}
}
func TestProvider_GeneratePreservesFollowUpTextToolCallInReply(t *testing.T) {
var bodies []map[string]any
ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
@@ -523,181 +454,6 @@ func TestProvider_GeneratePreservesFollowUpTextToolCallInReply(t *testing.T) {
}
}
func TestProvider_GenerateRepairsInitialPartialTextToolCall(t *testing.T) {
var bodies []map[string]any
ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
var body map[string]any
if err := json.NewDecoder(r.Body).Decode(&body); err != nil {
t.Fatalf("decode request: %v", err)
}
bodies = append(bodies, body)
w.Header().Set("Content-Type", "application/json")
switch len(bodies) {
case 1:
_, _ = w.Write([]byte(`{"choices":[{"message":{"content":"<tool_call name=\"plan\">"}}]}`))
case 2:
messages := body["messages"].([]any)
last := messages[len(messages)-1].(map[string]any)
if last["role"] != "user" || !strings.Contains(last["content"].(string), "did not finish valid tool-call markup") {
t.Fatalf("repair prompt = %#v, want partial tool-call guidance", last)
}
if _, ok := body["tools"]; !ok {
t.Fatalf("repair request did not keep tools available: %#v", body)
}
_, _ = w.Write([]byte(`{"choices":[{"message":{"content":"<tool_call name=\"plan\">{\"steps\":[{\"task\":\"create tasks\"}]}</tool_call>"}}]}`))
default:
t.Fatalf("unexpected API call %d", len(bodies))
}
}))
defer ts.Close()
p := NewProvider(
ai.WithAPIKey("test-key"),
ai.WithBaseURL(ts.URL),
ai.WithModel("minimaxai/minimax-m3"),
)
resp, err := p.Generate(context.Background(), &ai.Request{
Prompt: "plan and delegate",
Tools: []ai.Tool{
{Name: "plan", Description: "record a plan", Properties: map[string]any{"steps": map[string]any{"type": "array"}}},
{Name: "delegate", Description: "delegate work", Properties: map[string]any{"task": map[string]any{"type": "string"}}},
},
})
if err != nil {
t.Fatalf("Generate returned error: %v", err)
}
if !strings.Contains(resp.Reply, `<tool_call name="plan">`) || !strings.Contains(resp.Reply, `</tool_call>`) {
t.Fatalf("Reply = %q, want completed text tool call", resp.Reply)
}
if len(bodies) != 2 {
t.Fatalf("requests = %d, want initial plus repair", len(bodies))
}
}
func TestProvider_GenerateFallsBackAfterRepeatedPartialPlanTextToolCall(t *testing.T) {
ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "application/json")
_, _ = w.Write([]byte(`{"choices":[{"message":{"content":"<tool_call name=\"plan\">"}}]}`))
}))
defer ts.Close()
p := NewProvider(
ai.WithAPIKey("test-key"),
ai.WithBaseURL(ts.URL),
ai.WithModel("minimaxai/minimax-m3"),
)
resp, err := p.Generate(context.Background(), &ai.Request{
Prompt: "plan and delegate",
Tools: []ai.Tool{{Name: "plan", Description: "record a plan"}},
})
if err != nil {
t.Fatalf("Generate returned error: %v", err)
}
if !strings.Contains(resp.Reply, `<tool_call name="plan">`) || !strings.Contains(resp.Reply, `</tool_call>`) {
t.Fatalf("Reply = %q, want completed fallback plan text tool call", resp.Reply)
}
if !strings.Contains(resp.Reply, "plan and delegate") {
t.Fatalf("Reply = %q, want fallback plan seeded from prompt", resp.Reply)
}
}
func TestProvider_GenerateFallsBackAfterRepeatedPartialDelegateTextToolCall(t *testing.T) {
ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "application/json")
_, _ = w.Write([]byte(`{"choices":[{"message":{"content":"<tool_call name=\"delegate\">"}}]}`))
}))
defer ts.Close()
p := NewProvider(
ai.WithAPIKey("test-key"),
ai.WithBaseURL(ts.URL),
ai.WithModel("minimaxai/minimax-m3"),
)
resp, err := p.Generate(context.Background(), &ai.Request{
SystemPrompt: "You coordinate launch work and delegate readiness notifications to the comms agent.",
Prompt: "delegate the owner readiness notification to comms",
Tools: []ai.Tool{{Name: "delegate", Description: "delegate work"}},
})
if err != nil {
t.Fatalf("Generate returned error: %v", err)
}
for _, want := range []string{`<tool_call name="delegate">`, `"task":"delegate the owner readiness notification to comms"`, `"to":"comms"`, `</tool_call>`} {
if !strings.Contains(resp.Reply, want) {
t.Fatalf("Reply = %q, want delegate fallback containing %q", resp.Reply, want)
}
}
}
func TestProvider_GenerateFallsBackAfterRepeatedPartialNoArgumentServiceTextToolCall(t *testing.T) {
ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "application/json")
_, _ = w.Write([]byte(`{"choices":[{"message":{"content":"<tool_call name=\"task_TaskService_List\">"}}]}`))
}))
defer ts.Close()
p := NewProvider(
ai.WithAPIKey("test-key"),
ai.WithBaseURL(ts.URL),
ai.WithModel("minimaxai/minimax-m3"),
)
resp, err := p.Generate(context.Background(), &ai.Request{
Prompt: "list the current launch-readiness tasks",
Tools: []ai.Tool{{
Name: "task_TaskService_List",
OriginalName: "task.TaskService.List",
Description: "List persisted launch-readiness tasks",
Properties: map[string]any{},
}},
})
if err != nil {
t.Fatalf("Generate returned error: %v", err)
}
want := `<tool_call name="task_TaskService_List">{}</tool_call>`
if resp.Reply != want {
t.Fatalf("Reply = %q, want %q", resp.Reply, want)
}
}
func TestProvider_GenerateFallsBackAfterRepeatedPartialWorkspaceServiceTextToolCall(t *testing.T) {
var bodies []map[string]any
ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
var body map[string]any
if err := json.NewDecoder(r.Body).Decode(&body); err != nil {
t.Fatalf("decode request: %v", err)
}
bodies = append(bodies, body)
w.Header().Set("Content-Type", "application/json")
_, _ = w.Write([]byte(`{"choices":[{"message":{"content":"<tool_call name=\"workspace_WorkspaceService_Create\">"}}]}`))
}))
defer ts.Close()
p := NewProvider(
ai.WithAPIKey("test-key"),
ai.WithBaseURL(ts.URL),
ai.WithModel("minimaxai/minimax-m3"),
)
resp, err := p.Generate(context.Background(), &ai.Request{
SystemPrompt: "Create an onboarding workspace only if it is still needed.",
Prompt: "Onboard alice@acme.com. The workspace create side effect may already be complete; avoid failing the flow on a duplicate repaired call.",
Tools: []ai.Tool{{
Name: "workspace_WorkspaceService_Create",
OriginalName: "workspace.WorkspaceService.Create",
Description: "Create an onboarding workspace",
Properties: map[string]any{"owner": map[string]any{"type": "string"}},
}},
})
if err != nil {
t.Fatalf("Generate returned error: %v", err)
}
want := `<tool_call name="workspace_WorkspaceService_Create">{"owner":"alice@acme.com"}</tool_call>`
if resp.Reply != want {
t.Fatalf("Reply = %q, want %q", resp.Reply, want)
}
if len(bodies) != 2 {
t.Fatalf("requests = %d, want initial plus repair", len(bodies))
}
}
func TestProvider_GenerateRetriesMinimaxBuiltInsAsTextTools(t *testing.T) {
var bodies []map[string]any
ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
@@ -756,60 +512,6 @@ func TestProvider_GenerateRetriesMinimaxBuiltInsAsTextTools(t *testing.T) {
}
}
func TestProvider_GenerateRetriesMinimaxServiceToolsAsTextTools(t *testing.T) {
var bodies []map[string]any
ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
var body map[string]any
if err := json.NewDecoder(r.Body).Decode(&body); err != nil {
t.Fatalf("decode request: %v", err)
}
bodies = append(bodies, body)
w.Header().Set("Content-Type", "application/json")
switch len(bodies) {
case 1:
http.Error(w, `{"code":400,"msg":"bad request"}`, http.StatusBadRequest)
case 2:
if _, ok := body["tools"]; ok {
t.Fatalf("text-tool retry included native tools: %#v", body["tools"])
}
_, _ = w.Write([]byte(`{"choices":[{"message":{"content":"<tool_call name=\"conformance_echo\">{\"value\":\"agent-conformance\"}</tool_call>"}}]}`))
default:
t.Fatalf("unexpected API call %d", len(bodies))
}
}))
defer ts.Close()
p := NewProvider(ai.WithAPIKey("test-key"), ai.WithBaseURL(ts.URL), ai.WithModel("minimaxai/minimax-m3"))
resp, err := p.Generate(context.Background(), &ai.Request{
Prompt: "call a tool",
Tools: []ai.Tool{{
Name: "conformance_echo",
Description: "echo conformance marker",
Properties: map[string]any{"value": map[string]any{"type": "string"}},
}},
})
if err != nil {
t.Fatalf("Generate returned error: %v", err)
}
if !strings.Contains(resp.Reply, `<tool_call name="conformance_echo">`) {
t.Fatalf("Reply = %q, want text service-tool fallback", resp.Reply)
}
if len(bodies) != 2 {
t.Fatalf("requests = %d, want initial plus text-tool retry", len(bodies))
}
if _, ok := bodies[0]["tools"].([]any); !ok {
t.Fatalf("initial request did not include native tools: %#v", bodies[0])
}
msgs := bodies[1]["messages"].([]any)
compat := msgs[len(msgs)-1].(map[string]any)
content := compat["content"].(string)
for _, want := range []string{"native tools payload was rejected", `<tool_call name="tool_name">`, "conformance_echo"} {
if !strings.Contains(content, want) {
t.Fatalf("text-tool instruction %q missing %q", content, want)
}
}
}
func TestProvider_GenerateFollowUpRetriesWithoutToolsOnBadRequest(t *testing.T) {
var bodies []map[string]any
ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
@@ -828,19 +530,6 @@ func TestProvider_GenerateFollowUpRetriesWithoutToolsOnBadRequest(t *testing.T)
if _, ok := body["tools"]; ok {
t.Fatalf("no-tools retry still included tools: %#v", body["tools"])
}
messages := body["messages"].([]any)
last := messages[len(messages)-1].(map[string]any)
if last["role"] == "tool" {
http.Error(w, `{"code":400,"msg":"trailing tool message rejected"}`, http.StatusBadRequest)
return
}
if last["role"] != "user" || !strings.Contains(last["content"].(string), "Tool result for call-1") {
t.Fatalf("no-tools retry last message = %#v, want user-visible tool result", last)
}
assistant := messages[len(messages)-2].(map[string]any)
if _, ok := assistant["tool_calls"]; ok {
t.Fatalf("no-tools retry assistant still included tool_calls: %#v", assistant)
}
_, _ = w.Write([]byte(`{"choices":[{"message":{"content":"done"}}]}`))
default:
t.Fatalf("unexpected API call %d", len(bodies))
@@ -888,7 +577,7 @@ func TestProvider_GenerateToolCallHTTPErrorIncludesRequestContext(t *testing.T)
p := NewProvider(
ai.WithAPIKey("test-key"),
ai.WithBaseURL(ts.URL),
ai.WithModel("deepseek-ai/DeepSeek-V3-0324"),
ai.WithModel("minimaxai/minimax-m3"),
)
_, err := p.Generate(context.Background(), &ai.Request{
Prompt: "call a tool",
@@ -902,7 +591,7 @@ func TestProvider_GenerateToolCallHTTPErrorIncludesRequestContext(t *testing.T)
t.Fatal("Generate error = nil, want 400")
}
msg := err.Error()
for _, want := range []string{"400 Bad Request", "atlascloud chat request", "model=deepseek-ai/DeepSeek-V3-0324", "tools=1", "tool_names=conformance_echo"} {
for _, want := range []string{"400 Bad Request", "atlascloud chat request", "model=minimaxai/minimax-m3", "tools=1", "tool_names=conformance_echo"} {
if !strings.Contains(msg, want) {
t.Fatalf("error %q missing %q", msg, want)
}
+5 -24
View File
@@ -23,10 +23,6 @@ type Capabilities struct {
// Providers that only satisfy the Model interface with ErrStreamingUnsupported
// leave this false until their Stream implementation is usable.
Stream bool `json:"stream"`
// ToolStream reports whether the provider supports agent Stream requests that
// include tool schemas. Providers may support plain token streaming while
// leaving this false when their streaming API cannot accept tools.
ToolStream bool `json:"tool_stream"`
}
// ProviderCapabilities reports the capabilities registered for provider.
@@ -35,14 +31,12 @@ func ProviderCapabilities(provider string) Capabilities {
_, hasImage := imageProviders[provider]
_, hasVideo := videoProviders[provider]
_, hasStream := streamProviders[provider]
_, hasToolStream := toolStreamProviders[provider]
return Capabilities{
Model: hasModel,
Image: hasImage,
Video: hasVideo,
Stream: hasStream,
ToolStream: hasToolStream,
Model: hasModel,
Image: hasImage,
Video: hasVideo,
Stream: hasStream,
}
}
@@ -64,9 +58,6 @@ func CapabilityMatrix() map[string]Capabilities {
for name := range streamProviders {
names[name] = struct{}{}
}
for name := range toolStreamProviders {
names[name] = struct{}{}
}
matrix := make(map[string]Capabilities, len(names))
for name := range names {
@@ -97,18 +88,10 @@ func RegisterStream(provider string) {
streamProviders[provider] = struct{}{}
}
// RegisterToolStream records that provider can accept tool schemas in Stream
// requests. This is intentionally separate from RegisterStream because some
// providers can stream tokens but cannot expose tools while streaming.
func RegisterToolStream(provider string) {
toolStreamProviders[provider] = struct{}{}
}
var streamProviders = make(map[string]struct{})
var toolStreamProviders = make(map[string]struct{})
// RegisteredProviders returns the registered provider names in sorted order.
// kind may be "model", "image", "video", "stream", "tool_stream", or empty for the union of all
// kind may be "model", "image", "video", "stream", or empty for the union of all
// provider registries.
func RegisteredProviders(kind string) []string {
names := map[string]struct{}{}
@@ -138,8 +121,6 @@ func RegisteredProviders(kind string) []string {
add(providers)
case "stream":
add(streamProviders)
case "tool_stream":
add(toolStreamProviders)
case "image":
add(imageProviders)
case "video":
+10 -24
View File
@@ -35,7 +35,7 @@ func TestRegisteredProviders(t *testing.T) {
}
got = ai.RegisteredProviders("stream")
want = []string{"anthropic", "atlascloud", "gemini", "groq", "minimax", "mistral", "openai", "together"}
want = []string{"anthropic", "atlascloud", "groq", "minimax", "mistral", "openai", "together"}
if !reflect.DeepEqual(got, want) {
t.Fatalf("RegisteredProviders(stream) = %#v, want %#v", got, want)
}
@@ -44,14 +44,14 @@ func TestRegisteredProviders(t *testing.T) {
func TestCapabilityRows(t *testing.T) {
got := ai.CapabilityRows()
want := []ai.CapabilityRow{
{Provider: "anthropic", Capabilities: ai.Capabilities{Model: true, Stream: true, ToolStream: true}},
{Provider: "anthropic", Capabilities: ai.Capabilities{Model: true, Stream: true}},
{Provider: "atlascloud", Capabilities: ai.Capabilities{Model: true, Image: true, Video: true, Stream: true}},
{Provider: "gemini", Capabilities: ai.Capabilities{Model: true, Stream: true}},
{Provider: "groq", Capabilities: ai.Capabilities{Model: true, Stream: true, ToolStream: true}},
{Provider: "minimax", Capabilities: ai.Capabilities{Model: true, Stream: true, ToolStream: true}},
{Provider: "mistral", Capabilities: ai.Capabilities{Model: true, Stream: true, ToolStream: true}},
{Provider: "openai", Capabilities: ai.Capabilities{Model: true, Image: true, Stream: true, ToolStream: true}},
{Provider: "together", Capabilities: ai.Capabilities{Model: true, Stream: true, ToolStream: true}},
{Provider: "gemini", Capabilities: ai.Capabilities{Model: true}},
{Provider: "groq", Capabilities: ai.Capabilities{Model: true, Stream: true}},
{Provider: "minimax", Capabilities: ai.Capabilities{Model: true, Stream: true}},
{Provider: "mistral", Capabilities: ai.Capabilities{Model: true, Stream: true}},
{Provider: "openai", Capabilities: ai.Capabilities{Model: true, Image: true, Stream: true}},
{Provider: "together", Capabilities: ai.Capabilities{Model: true, Stream: true}},
}
if !reflect.DeepEqual(got, want) {
t.Fatalf("CapabilityRows() = %#v, want %#v", got, want)
@@ -71,7 +71,7 @@ func TestCapabilityMatrix(t *testing.T) {
}
}
if caps := ai.ProviderCapabilities("openai"); caps != (ai.Capabilities{Model: true, Image: true, Stream: true, ToolStream: true}) {
if caps := ai.ProviderCapabilities("openai"); caps != (ai.Capabilities{Model: true, Image: true, Stream: true}) {
t.Fatalf("ProviderCapabilities(openai) = %#v", caps)
}
if caps := ai.ProviderCapabilities("atlascloud"); caps != (ai.Capabilities{Model: true, Image: true, Video: true, Stream: true}) {
@@ -90,22 +90,8 @@ func TestRegisterStream(t *testing.T) {
}
got := ai.RegisteredProviders("stream")
want := []string{"anthropic", "atlascloud", "gemini", "groq", "minimax", "mistral", "openai", "test-stream", "together"}
want := []string{"anthropic", "atlascloud", "groq", "minimax", "mistral", "openai", "test-stream", "together"}
if !reflect.DeepEqual(got, want) {
t.Fatalf("RegisteredProviders(stream) = %#v, want %#v", got, want)
}
}
func TestRegisterToolStream(t *testing.T) {
ai.RegisterToolStream("test-tool-stream")
if caps := ai.ProviderCapabilities("test-tool-stream"); caps != (ai.Capabilities{ToolStream: true}) {
t.Fatalf("ProviderCapabilities(test-tool-stream) = %#v", caps)
}
got := ai.RegisteredProviders("tool_stream")
want := []string{"anthropic", "groq", "minimax", "mistral", "openai", "test-tool-stream", "together"}
if !reflect.DeepEqual(got, want) {
t.Fatalf("RegisteredProviders(tool_stream) = %#v, want %#v", got, want)
}
}
+22
View File
@@ -0,0 +1,22 @@
// Package flow is maintained for backward compatibility.
// The canonical import is go-micro.dev/v6/flow.
package flow
import "go-micro.dev/v6/flow"
// Re-export types for backward compatibility.
type Flow = flow.Flow
type Options = flow.Options
type Option = flow.Option
type Result = flow.Result
var New = flow.New
var Trigger = flow.Trigger
var Prompt = flow.Prompt
var SystemPrompt = flow.SystemPrompt
var Provider = flow.Provider
var APIKey = flow.APIKey
var Model = flow.Model
var BaseURL = flow.BaseURL
var HistoryLimit = flow.HistoryLimit
var OnResult = flow.OnResult
+5 -137
View File
@@ -10,7 +10,6 @@
package gemini
import (
"bufio"
"bytes"
"context"
"encoding/json"
@@ -26,7 +25,6 @@ func init() {
ai.Register("gemini", func(opts ...ai.Option) ai.Model {
return NewProvider(opts...)
})
ai.RegisterStream("gemini")
}
// Provider implements the ai.Model interface for Google Gemini.
@@ -71,7 +69,9 @@ func (p *Provider) Generate(ctx context.Context, req *ai.Request, opts ...ai.Gen
})
}
contents := geminiContents(req)
contents := []map[string]any{
{"role": "user", "parts": []map[string]any{{"text": req.Prompt}}},
}
apiReq := map[string]any{
"contents": contents,
@@ -135,121 +135,7 @@ func (p *Provider) Generate(ctx context.Context, req *ai.Request, opts ...ai.Gen
}
func (p *Provider) Stream(ctx context.Context, req *ai.Request, opts ...ai.GenerateOption) (ai.Stream, error) {
apiReq := map[string]any{
"contents": geminiContents(req),
}
if req.SystemPrompt != "" {
apiReq["system_instruction"] = map[string]any{
"parts": []map[string]any{{"text": req.SystemPrompt}},
}
}
if p.opts.MaxTokens > 0 {
apiReq["generationConfig"] = map[string]any{"maxOutputTokens": p.opts.MaxTokens}
}
reqBody, err := json.Marshal(apiReq)
if err != nil {
return nil, fmt.Errorf("failed to marshal stream request: %w", err)
}
apiURL := strings.TrimRight(p.opts.BaseURL, "/") +
"/v1beta/models/" + p.opts.Model + ":streamGenerateContent?alt=sse"
httpReq, err := http.NewRequestWithContext(ctx, http.MethodPost, apiURL, bytes.NewReader(reqBody))
if err != nil {
return nil, fmt.Errorf("failed to create stream request: %w", err)
}
httpReq.Header.Set("Content-Type", "application/json")
httpReq.Header.Set("Accept", "text/event-stream")
httpReq.Header.Set("x-goog-api-key", p.opts.APIKey)
httpResp, err := http.DefaultClient.Do(httpReq)
if err != nil {
return nil, fmt.Errorf("stream API request failed: %w", err)
}
if httpResp.StatusCode != http.StatusOK {
defer httpResp.Body.Close()
respBody, _ := io.ReadAll(httpResp.Body)
return nil, ai.NewHTTPError(httpResp, respBody)
}
return &streamReader{body: httpResp.Body, scanner: bufio.NewScanner(httpResp.Body)}, nil
}
type streamReader struct {
body io.ReadCloser
scanner *bufio.Scanner
closed bool
}
func (s *streamReader) Recv() (*ai.Response, error) {
for s.scanner.Scan() {
line := strings.TrimSpace(s.scanner.Text())
if line == "" || strings.HasPrefix(line, ":") || strings.HasPrefix(line, "event:") {
continue
}
if !strings.HasPrefix(line, "data:") {
continue
}
data := strings.TrimSpace(strings.TrimPrefix(line, "data:"))
if data == "[DONE]" {
return nil, io.EOF
}
var chunk struct {
Error *struct {
Code int `json:"code"`
Message string `json:"message"`
Status string `json:"status"`
} `json:"error"`
Candidates []struct {
Content struct {
Parts []struct {
Text string `json:"text"`
} `json:"parts"`
} `json:"content"`
} `json:"candidates"`
UsageMetadata *struct {
PromptTokenCount int `json:"promptTokenCount"`
CandidatesTokenCount int `json:"candidatesTokenCount"`
TotalTokenCount int `json:"totalTokenCount"`
} `json:"usageMetadata"`
}
if err := json.Unmarshal([]byte(data), &chunk); err != nil {
return nil, fmt.Errorf("failed to parse stream chunk: %w", err)
}
if chunk.Error != nil {
return nil, fmt.Errorf("gemini stream error (%s): %s", chunk.Error.Status, chunk.Error.Message)
}
for _, candidate := range chunk.Candidates {
var parts []string
for _, part := range candidate.Content.Parts {
if part.Text != "" {
parts = append(parts, part.Text)
}
}
if len(parts) > 0 {
return &ai.Response{Reply: strings.Join(parts, "")}, nil
}
}
if chunk.UsageMetadata != nil {
return &ai.Response{Usage: ai.Usage{
InputTokens: chunk.UsageMetadata.PromptTokenCount,
OutputTokens: chunk.UsageMetadata.CandidatesTokenCount,
TotalTokens: chunk.UsageMetadata.TotalTokenCount,
}}, nil
}
}
if err := s.scanner.Err(); err != nil {
return nil, err
}
return nil, io.EOF
}
func (s *streamReader) Close() error {
if s.closed {
return nil
}
s.closed = true
return s.body.Close()
return nil, fmt.Errorf("%w: gemini provider", ai.ErrStreamingUnsupported)
}
func (p *Provider) callAPI(ctx context.Context, req map[string]any) (*ai.Response, []map[string]any, error) {
@@ -277,7 +163,7 @@ func (p *Provider) callAPI(ctx context.Context, req map[string]any) (*ai.Respons
respBody, _ := io.ReadAll(httpResp.Body)
if httpResp.StatusCode != http.StatusOK {
return nil, nil, ai.NewHTTPError(httpResp, respBody)
return nil, nil, fmt.Errorf("API error (%s): %s", httpResp.Status, string(respBody))
}
var geminiResp struct {
@@ -338,21 +224,3 @@ type functionCallPB struct {
Name string `json:"name"`
Args map[string]any `json:"args"`
}
func geminiContents(req *ai.Request) []map[string]any {
contents := make([]map[string]any, 0, len(req.Messages)+1)
for _, m := range req.Messages {
role := m.Role
if role == "assistant" {
role = "model"
}
if role == "system" || role == "" {
continue
}
contents = append(contents, map[string]any{"role": role, "parts": []map[string]any{{"text": fmt.Sprint(m.Content)}}})
}
if req.Prompt != "" {
contents = append(contents, map[string]any{"role": "user", "parts": []map[string]any{{"text": req.Prompt}}})
}
return contents
}
+6 -103
View File
@@ -2,12 +2,7 @@ package gemini
import (
"context"
"encoding/json"
"errors"
"io"
"net/http"
"net/http/httptest"
"strings"
"testing"
"go-micro.dev/v6/ai"
@@ -86,108 +81,16 @@ func TestProvider_Generate_NoAPIKey(t *testing.T) {
}
}
func TestProvider_Stream(t *testing.T) {
var sawRequest bool
ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
sawRequest = true
if r.URL.Path != "/v1beta/models/gemini-2.5-flash:streamGenerateContent" {
t.Fatalf("path = %s, want streamGenerateContent", r.URL.Path)
}
if r.URL.Query().Get("alt") != "sse" {
t.Fatalf("alt = %q, want sse", r.URL.Query().Get("alt"))
}
if got := r.Header.Get("Accept"); got != "text/event-stream" {
t.Fatalf("Accept = %q, want text/event-stream", got)
}
if got := r.Header.Get("x-goog-api-key"); got != "test-key" {
t.Fatalf("x-goog-api-key = %q, want test-key", got)
}
func TestProvider_Stream_NotImplemented(t *testing.T) {
p := NewProvider()
var body map[string]any
if err := json.NewDecoder(r.Body).Decode(&body); err != nil {
t.Fatalf("decode request: %v", err)
}
contents, ok := body["contents"].([]any)
if !ok || len(contents) != 3 {
t.Fatalf("contents = %#v, want history + prompt", body["contents"])
}
second := contents[1].(map[string]any)
if second["role"] != "model" {
t.Fatalf("assistant history role = %#v, want model", second["role"])
}
w.Header().Set("Content-Type", "text/event-stream")
_, _ = w.Write([]byte("data: {\"candidates\":[{\"content\":{\"parts\":[{\"text\":\"hel\"}]}}]}\n\n"))
_, _ = w.Write([]byte("data: {\"candidates\":[{\"content\":{\"parts\":[{\"text\":\"lo\"}]}}],\"usageMetadata\":{\"promptTokenCount\":3,\"candidatesTokenCount\":2,\"totalTokenCount\":5}}\n\n"))
_, _ = w.Write([]byte("data: [DONE]\n\n"))
}))
defer ts.Close()
p := NewProvider(ai.WithAPIKey("test-key"), ai.WithBaseURL(ts.URL))
stream, err := p.Stream(context.Background(), &ai.Request{
Messages: []ai.Message{
{Role: "user", Content: "previous question"},
{Role: "assistant", Content: "previous answer"},
},
req := &ai.Request{
Prompt: "Hello",
})
if err != nil {
t.Fatalf("Stream returned error: %v", err)
}
defer stream.Close()
if !sawRequest {
t.Fatal("server did not receive stream request")
}
first, err := stream.Recv()
if err != nil || first.Reply != "hel" {
t.Fatalf("first chunk = %#v, %v; want hel", first, err)
}
second, err := stream.Recv()
if err != nil || second.Reply != "lo" {
t.Fatalf("second chunk = %#v, %v; want lo", second, err)
}
if _, err := stream.Recv(); !errors.Is(err, io.EOF) {
t.Fatalf("final error = %v, want EOF", err)
}
}
func TestProvider_StreamPropagatesMalformedChunk(t *testing.T) {
ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "text/event-stream")
_, _ = w.Write([]byte("data: {bad json}\n\n"))
}))
defer ts.Close()
p := NewProvider(ai.WithAPIKey("test-key"), ai.WithBaseURL(ts.URL))
stream, err := p.Stream(context.Background(), &ai.Request{Prompt: "Hello"})
if err != nil {
t.Fatalf("Stream returned error: %v", err)
}
defer stream.Close()
if _, err := stream.Recv(); err == nil {
t.Fatal("Recv returned nil error for malformed chunk")
}
}
func TestProvider_StreamPropagatesProviderError(t *testing.T) {
ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
http.Error(w, "quota exhausted", http.StatusTooManyRequests)
}))
defer ts.Close()
p := NewProvider(ai.WithAPIKey("test-key"), ai.WithBaseURL(ts.URL))
stream, err := p.Stream(context.Background(), &ai.Request{Prompt: "Hello"})
if err == nil {
_ = stream.Close()
t.Fatal("Stream returned nil error for provider failure")
}
if !strings.Contains(err.Error(), "429") || !strings.Contains(err.Error(), "quota exhausted") {
t.Fatalf("Stream error = %v, want provider status and body", err)
}
if strings.Contains(err.Error(), "test-key") {
t.Fatal("stream error leaked API key")
_, err := p.Stream(context.Background(), req)
if !errors.Is(err, ai.ErrStreamingUnsupported) {
t.Fatalf("Stream error = %v, want ErrStreamingUnsupported", err)
}
}
+1 -2
View File
@@ -30,7 +30,6 @@ func init() {
return NewProvider(opts...)
})
ai.RegisterStream("groq")
ai.RegisterToolStream("groq")
}
type Provider struct {
@@ -148,7 +147,7 @@ func (p *Provider) callAPI(ctx context.Context, req map[string]any) (*ai.Respons
respBody, _ := io.ReadAll(httpResp.Body)
if httpResp.StatusCode != http.StatusOK {
return nil, nil, ai.NewHTTPError(httpResp, respBody)
return nil, nil, fmt.Errorf("API error (%s): %s", httpResp.Status, string(respBody))
}
var chatResp struct {
+1 -2
View File
@@ -30,7 +30,6 @@ func init() {
return NewProvider(opts...)
})
ai.RegisterStream("minimax")
ai.RegisterToolStream("minimax")
}
type Provider struct {
@@ -148,7 +147,7 @@ func (p *Provider) callAPI(ctx context.Context, req map[string]any) (*ai.Respons
respBody, _ := io.ReadAll(httpResp.Body)
if httpResp.StatusCode != http.StatusOK {
return nil, nil, ai.NewHTTPError(httpResp, respBody)
return nil, nil, fmt.Errorf("API error (%s): %s", httpResp.Status, string(respBody))
}
var chatResp struct {
+1 -2
View File
@@ -30,7 +30,6 @@ func init() {
return NewProvider(opts...)
})
ai.RegisterStream("mistral")
ai.RegisterToolStream("mistral")
}
type Provider struct {
@@ -148,7 +147,7 @@ func (p *Provider) callAPI(ctx context.Context, req map[string]any) (*ai.Respons
respBody, _ := io.ReadAll(httpResp.Body)
if httpResp.StatusCode != http.StatusOK {
return nil, nil, ai.NewHTTPError(httpResp, respBody)
return nil, nil, fmt.Errorf("API error (%s): %s", httpResp.Status, string(respBody))
}
var chatResp struct {
-5
View File
@@ -109,9 +109,6 @@ const (
RefusedMaxSteps = "max_steps"
RefusedLoop = "loop"
RefusedApproval = "approval"
// RefusedSpendBudget means an agent refused a paid tool before execution
// because the configured per-run x402 spend budget would be exceeded.
RefusedSpendBudget = "spend_budget"
)
// RunInfo describes the agent run a tool call belongs to. The agent
@@ -135,8 +132,6 @@ type RunInfo struct {
VerificationFeedback string // feedback from the previous failed verifier attempt, when retrying a flow step
Dispatch string // how the run was dispatched (direct, broker, schedule, resume) when known
Trigger string // external trigger or schedule label that started the run, when known
Spent int64 // cumulative paid x402 spend in this run, in the asset's smallest unit
ToolSpend int64 // paid x402 spend attributed to the current tool call, in the asset's smallest unit
}
type runInfoKey struct{}
-1
View File
@@ -45,7 +45,6 @@ func init() {
return NewProvider(opts...)
})
ai.RegisterStream("ollama")
ai.RegisterToolStream("ollama")
}
// Provider implements the ai.Model interface for Ollama.
+1 -2
View File
@@ -22,7 +22,6 @@ func init() {
return NewProvider(opts...)
})
ai.RegisterStream("openai")
ai.RegisterToolStream("openai")
}
// Provider implements the ai.Model interface for OpenAI
@@ -286,7 +285,7 @@ func (p *Provider) callAPI(ctx context.Context, req map[string]any) (*ai.Respons
// Read response
respBody, _ := io.ReadAll(httpResp.Body)
if httpResp.StatusCode != http.StatusOK {
return nil, nil, ai.NewHTTPError(httpResp, respBody)
return nil, nil, fmt.Errorf("API error (%s): %s", httpResp.Status, string(respBody))
}
// Parse response
+8 -110
View File
@@ -4,9 +4,6 @@ import (
"context"
"errors"
"fmt"
"math/rand/v2"
"net/http"
"strconv"
"strings"
"time"
)
@@ -22,77 +19,17 @@ type RetryAfterCoder interface {
RetryAfter() time.Duration
}
// HTTPError describes a failed provider HTTP response while preserving the
// status code and Retry-After signal for retry classifiers.
type HTTPError struct {
Status string
Code int
Body string
Header http.Header
}
func (e *HTTPError) Error() string {
if e == nil {
return ""
}
return fmt.Sprintf("API error (%s): %s", e.Status, e.Body)
}
func (e *HTTPError) StatusCode() int {
if e == nil {
return 0
}
return e.Code
}
func (e *HTTPError) RetryAfter() time.Duration {
if e == nil {
return 0
}
return parseRetryAfter(e.Header.Get("Retry-After"), time.Now())
}
func NewHTTPError(resp *http.Response, body []byte) error {
if resp == nil {
return errors.New("API error: nil response")
}
return &HTTPError{Status: resp.Status, Code: resp.StatusCode, Body: string(body), Header: resp.Header.Clone()}
}
func parseRetryAfter(value string, now time.Time) time.Duration {
value = strings.TrimSpace(value)
if value == "" {
return 0
}
if seconds, err := strconv.Atoi(value); err == nil {
if seconds <= 0 {
return 0
}
return time.Duration(seconds) * time.Second
}
when, err := http.ParseTime(value)
if err != nil {
return 0
}
if delay := when.Sub(now); delay > 0 {
return delay
}
return 0
}
// ErrorKind classifies provider-boundary failures into stable buckets callers
// can inspect without parsing provider-specific error strings.
type ErrorKind string
const (
ErrorKindUnknown ErrorKind = "unknown"
ErrorKindCanceled ErrorKind = "canceled"
ErrorKindTimeout ErrorKind = "timeout"
ErrorKindRateLimited ErrorKind = "rate_limited"
ErrorKindUnavailable ErrorKind = "unavailable"
ErrorKindAuth ErrorKind = "auth"
ErrorKindConfiguration ErrorKind = "configuration"
ErrorKindProvider ErrorKind = "provider"
ErrorKindUnknown ErrorKind = "unknown"
ErrorKindCanceled ErrorKind = "canceled"
ErrorKindTimeout ErrorKind = "timeout"
ErrorKindRateLimited ErrorKind = "rate_limited"
ErrorKindUnavailable ErrorKind = "unavailable"
ErrorKindProvider ErrorKind = "provider"
)
// ClassifiedError is implemented by errors that expose a stable ErrorKind.
@@ -133,9 +70,6 @@ type GeneratePolicy struct {
Timeout time.Duration
MaxAttempts int
Backoff time.Duration
// Jitter adds up to this duration of random delay to retry backoff.
// It is opt-in so existing retry timing remains deterministic by default.
Jitter time.Duration
}
// GenerateWithRetry calls m.Generate with per-attempt timeout and bounded retry.
@@ -163,7 +97,7 @@ func GenerateWithRetry(ctx context.Context, m Model, req *Request, policy Genera
info.MaxAttempts = policy.MaxAttempts
callCtx = WithRunInfo(callCtx, info)
}
resp, err := generateAttempt(callCtx, m, req, opts...)
resp, err := m.Generate(callCtx, req, opts...)
cancel()
// Caller cancellation/deadline always wins and is not retried, even if
@@ -189,7 +123,7 @@ func GenerateWithRetry(ctx context.Context, m Model, req *Request, policy Genera
// Always back off between retries — exponential and capped — so an
// opt-in retry can never become a tight loop hammering the provider,
// even if Backoff was left at zero.
backoff := retryBackoffWithJitter(err, attempt, policy.Backoff, policy.Jitter)
backoff := retryBackoff(err, attempt, policy.Backoff)
t := time.NewTimer(backoff)
select {
case <-ctx.Done():
@@ -203,32 +137,7 @@ func GenerateWithRetry(ctx context.Context, m Model, req *Request, policy Genera
return nil, &RetryError{Attempts: policy.MaxAttempts, Kind: ClassifyError(last), Err: last}
}
func generateAttempt(ctx context.Context, m Model, req *Request, opts ...GenerateOption) (*Response, error) {
if err := ctx.Err(); err != nil {
return nil, err
}
type result struct {
resp *Response
err error
}
done := make(chan result, 1)
go func() {
resp, err := m.Generate(ctx, req, opts...)
done <- result{resp: resp, err: err}
}()
select {
case res := <-done:
return res.resp, res.err
case <-ctx.Done():
return nil, ctx.Err()
}
}
func retryBackoff(err error, attempt int, base time.Duration) time.Duration {
return retryBackoffWithJitter(err, attempt, base, 0)
}
func retryBackoffWithJitter(err error, attempt int, base, jitter time.Duration) time.Duration {
backoff := base
if backoff <= 0 {
backoff = 200 * time.Millisecond
@@ -246,9 +155,6 @@ func retryBackoffWithJitter(err error, attempt int, base, jitter time.Duration)
backoff = delay
}
}
if jitter > 0 {
backoff += time.Duration(rand.Int64N(int64(jitter) + 1))
}
if backoff > 30*time.Second {
return 30 * time.Second
}
@@ -278,10 +184,6 @@ func ClassifyError(err error) ErrorKind {
switch {
case code == 429:
return ErrorKindRateLimited
case code == 401 || code == 403:
return ErrorKindAuth
case code == 400 || code == 404:
return ErrorKindConfiguration
case code >= 500:
return ErrorKindUnavailable
case code > 0:
@@ -294,10 +196,6 @@ func ClassifyError(err error) ErrorKind {
return ErrorKindRateLimited
case strings.Contains(msg, "timeout") || strings.Contains(msg, "deadline"):
return ErrorKindTimeout
case strings.Contains(msg, "unauthorized") || strings.Contains(msg, "forbidden") || strings.Contains(msg, "invalid api key") || strings.Contains(msg, "api key") || strings.Contains(msg, "credential"):
return ErrorKindAuth
case strings.Contains(msg, "missing") || strings.Contains(msg, "not configured") || strings.Contains(msg, "configuration") || strings.Contains(msg, "unsupported model") || strings.Contains(msg, "model not found"):
return ErrorKindConfiguration
case strings.Contains(msg, "temporar") || strings.Contains(msg, "unavailable"):
return ErrorKindUnavailable
default:
+5 -223
View File
@@ -3,8 +3,6 @@ package ai
import (
"context"
"errors"
"net/http"
"sync/atomic"
"testing"
"time"
)
@@ -69,54 +67,10 @@ func TestGenerateWithRetryDoesNotRetryCallerCancellation(t *testing.T) {
}
}
func TestGenerateWithRetryCancellationDuringBackoffStopsRetry(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
attempts := 0
firstAttemptDone := make(chan struct{})
model := retryModel{generate: func(context.Context, *Request, ...GenerateOption) (*Response, error) {
attempts++
if attempts == 1 {
close(firstAttemptDone)
return nil, retryAfterErr{delay: time.Hour}
}
return &Response{Reply: "unexpected retry"}, nil
}}
errc := make(chan error, 1)
go func() {
_, err := GenerateWithRetry(ctx, model, &Request{Prompt: "hi"}, GeneratePolicy{
MaxAttempts: 3,
Backoff: time.Hour,
})
errc <- err
}()
select {
case <-firstAttemptDone:
case <-time.After(time.Second):
t.Fatal("first provider attempt did not run")
}
cancel()
select {
case err := <-errc:
if !errors.Is(err, context.Canceled) {
t.Fatalf("error = %v, want context.Canceled", err)
}
case <-time.After(time.Second):
t.Fatal("GenerateWithRetry did not stop after cancellation during backoff")
}
if attempts != 1 {
t.Fatalf("attempts = %d, want cancellation to prevent retry", attempts)
}
}
func TestGenerateWithRetryHonorsPerAttemptTimeout(t *testing.T) {
var attempts atomic.Int32
attempts := 0
model := retryModel{generate: func(ctx context.Context, _ *Request, _ ...GenerateOption) (*Response, error) {
attempts.Add(1)
attempts++
<-ctx.Done()
return nil, ctx.Err()
}}
@@ -136,8 +90,8 @@ func TestGenerateWithRetryHonorsPerAttemptTimeout(t *testing.T) {
if !errors.Is(err, context.DeadlineExceeded) {
t.Fatalf("error = %v, want context.DeadlineExceeded", err)
}
if got := attempts.Load(); got != 2 {
t.Fatalf("attempts = %d, want 2", got)
if attempts != 2 {
t.Fatalf("attempts = %d, want 2", attempts)
}
}
@@ -180,34 +134,6 @@ func TestGenerateWithRetryAddsAttemptMetadataToRunInfo(t *testing.T) {
}
}
func TestGenerateWithRetryReturnsWhenProviderIgnoresTimeout(t *testing.T) {
started := make(chan struct{})
release := make(chan struct{})
model := retryModel{generate: func(ctx context.Context, req *Request, opts ...GenerateOption) (*Response, error) {
close(started)
<-release
return &Response{Reply: "late"}, nil
}}
defer close(release)
start := time.Now()
_, err := GenerateWithRetry(context.Background(), model, &Request{Prompt: "hi"}, GeneratePolicy{
Timeout: 10 * time.Millisecond,
MaxAttempts: 1,
})
if !errors.Is(err, context.DeadlineExceeded) {
t.Fatalf("GenerateWithRetry error = %v, want deadline exceeded", err)
}
if elapsed := time.Since(start); elapsed > 200*time.Millisecond {
t.Fatalf("GenerateWithRetry took %s after deadline, want prompt return", elapsed)
}
select {
case <-started:
default:
t.Fatal("provider was not called")
}
}
type statusErr int
func (e statusErr) Error() string { return "provider status" }
@@ -230,13 +156,9 @@ func TestClassifyErrorDistinguishesOperationalOutcomes(t *testing.T) {
{name: "canceled", err: context.Canceled, want: ErrorKindCanceled},
{name: "timeout", err: context.DeadlineExceeded, want: ErrorKindTimeout},
{name: "rate limit status", err: statusErr(429), want: ErrorKindRateLimited},
{name: "auth status", err: statusErr(401), want: ErrorKindAuth},
{name: "configuration status", err: statusErr(400), want: ErrorKindConfiguration},
{name: "unavailable status", err: statusErr(503), want: ErrorKindUnavailable},
{name: "provider status", err: statusErr(409), want: ErrorKindProvider},
{name: "provider status", err: statusErr(400), want: ErrorKindProvider},
{name: "rate limit text", err: errors.New("rate limit exceeded"), want: ErrorKindRateLimited},
{name: "auth text", err: errors.New("invalid API key"), want: ErrorKindAuth},
{name: "configuration text", err: errors.New("model not found"), want: ErrorKindConfiguration},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
@@ -299,143 +221,3 @@ func TestGenerateWithRetryCapsRetryAfter(t *testing.T) {
t.Fatalf("retryBackoff() = %s, want 30s cap", got)
}
}
func TestGenerateWithRetryDoesNotRetryPermanentProviderErrors(t *testing.T) {
attempts := 0
model := retryModel{generate: func(context.Context, *Request, ...GenerateOption) (*Response, error) {
attempts++
return nil, statusErr(400)
}}
_, err := GenerateWithRetry(context.Background(), model, &Request{Prompt: "hi"}, GeneratePolicy{
MaxAttempts: 3,
Backoff: time.Millisecond,
})
if !errors.Is(err, statusErr(400)) {
t.Fatalf("error = %v, want original provider status", err)
}
var retryErr *RetryError
if errors.As(err, &retryErr) {
t.Fatalf("error = %T %[1]v, want permanent provider error without retry wrapper", err)
}
if attempts != 1 {
t.Fatalf("attempts = %d, want no retry for permanent provider errors", attempts)
}
}
func TestGenerateWithRetryDefaultsToSingleAttempt(t *testing.T) {
attempts := 0
model := retryModel{generate: func(context.Context, *Request, ...GenerateOption) (*Response, error) {
attempts++
return nil, errors.New("temporary provider outage")
}}
_, err := GenerateWithRetry(context.Background(), model, &Request{Prompt: "hi"}, GeneratePolicy{
Backoff: time.Millisecond,
})
var retryErr *RetryError
if !errors.As(err, &retryErr) {
t.Fatalf("error = %T %[1]v, want retry error for exhausted transient attempt", err)
}
if retryErr.Attempts != 1 {
t.Fatalf("retry attempts = %d, want default single attempt", retryErr.Attempts)
}
if attempts != 1 {
t.Fatalf("model attempts = %d, want default single attempt", attempts)
}
}
func TestGenerateWithRetryStopsDuringBackoffWhenCallerCancels(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
var attempts atomic.Int32
model := retryModel{generate: func(context.Context, *Request, ...GenerateOption) (*Response, error) {
attempts.Add(1)
return nil, statusErr(503)
}}
errc := make(chan error, 1)
go func() {
_, err := GenerateWithRetry(ctx, model, &Request{Prompt: "hi"}, GeneratePolicy{
MaxAttempts: 3,
Backoff: time.Hour,
})
errc <- err
}()
deadline := time.After(time.Second)
for attempts.Load() == 0 {
select {
case err := <-errc:
t.Fatalf("GenerateWithRetry returned before first attempt cancellation: %v", err)
case <-deadline:
t.Fatal("provider was not called")
default:
time.Sleep(time.Millisecond)
}
}
start := time.Now()
cancel()
select {
case err := <-errc:
if !errors.Is(err, context.Canceled) {
t.Fatalf("error = %v, want context.Canceled", err)
}
case <-time.After(200 * time.Millisecond):
t.Fatal("GenerateWithRetry did not stop promptly during backoff cancellation")
}
if elapsed := time.Since(start); elapsed > 200*time.Millisecond {
t.Fatalf("backoff cancellation took %s, want prompt return", elapsed)
}
if got := attempts.Load(); got != 1 {
t.Fatalf("attempts = %d, want cancellation before retry", got)
}
}
func TestRetryBackoffUsesExponentialBaseAndCap(t *testing.T) {
if got := retryBackoff(statusErr(503), 1, 10*time.Millisecond); got != 10*time.Millisecond {
t.Fatalf("attempt 1 backoff = %s, want 10ms", got)
}
if got := retryBackoff(statusErr(503), 2, 10*time.Millisecond); got != 20*time.Millisecond {
t.Fatalf("attempt 2 backoff = %s, want 20ms", got)
}
if got := retryBackoff(statusErr(503), 3, 10*time.Millisecond); got != 40*time.Millisecond {
t.Fatalf("attempt 3 backoff = %s, want 40ms", got)
}
if got := retryBackoff(statusErr(503), 20, time.Second); got != 30*time.Second {
t.Fatalf("large backoff = %s, want 30s cap", got)
}
}
func TestHTTPErrorExposesStatusAndRetryAfter(t *testing.T) {
resp := &http.Response{
Status: "429 Too Many Requests",
StatusCode: http.StatusTooManyRequests,
Header: http.Header{"Retry-After": []string{"2"}},
}
err := NewHTTPError(resp, []byte("slow down"))
if got := ClassifyError(err); got != ErrorKindRateLimited {
t.Fatalf("ClassifyError() = %q, want %q", got, ErrorKindRateLimited)
}
var retryAfter RetryAfterCoder
if !errors.As(err, &retryAfter) {
t.Fatalf("NewHTTPError does not expose RetryAfterCoder")
}
if got := retryAfter.RetryAfter(); got != 2*time.Second {
t.Fatalf("RetryAfter() = %s, want 2s", got)
}
}
func TestRetryBackoffAddsBoundedJitter(t *testing.T) {
const base = 10 * time.Millisecond
const jitter = 5 * time.Millisecond
for range 100 {
got := retryBackoffWithJitter(errors.New("temporary"), 1, base, jitter)
if got < base || got > base+jitter {
t.Fatalf("retryBackoffWithJitter() = %s, want in [%s, %s]", got, base, base+jitter)
}
}
}
+18 -1
View File
@@ -216,7 +216,6 @@ func TestConfiguredProviderStreamsSkipWithoutCredentials(t *testing.T) {
{provider: "together", keyEnv: "TOGETHER_API_KEY", modelEnv: "TOGETHER_MODEL"},
{provider: "atlascloud", keyEnv: "ATLASCLOUD_API_KEY", modelEnv: "ATLASCLOUD_MODEL"},
{provider: "anthropic", keyEnv: "ANTHROPIC_API_KEY", modelEnv: "ANTHROPIC_MODEL"},
{provider: "gemini", keyEnv: "GEMINI_API_KEY", modelEnv: "GEMINI_MODEL"},
} {
tc := tc
t.Run(tc.provider, func(t *testing.T) {
@@ -257,6 +256,24 @@ func TestConfiguredProviderStreamsSkipWithoutCredentials(t *testing.T) {
}
}
func TestUnsupportedProvidersReturnStreamingUnsupportedAndStayUnregistered(t *testing.T) {
for _, provider := range []string{"gemini"} {
provider := provider
t.Run(provider, func(t *testing.T) {
if caps := ai.ProviderCapabilities(provider); caps.Stream {
t.Fatalf("ProviderCapabilities(%q).Stream = true, want false", provider)
}
_, err := ai.New(provider, ai.WithAPIKey("test-key")).Stream(context.Background(), &ai.Request{Prompt: "Hello"})
if !errors.Is(err, ai.ErrStreamingUnsupported) {
t.Fatalf("Stream error = %v, want ErrStreamingUnsupported", err)
}
if err != nil && strings.Contains(err.Error(), "test-key") {
t.Fatal("streaming unsupported error leaked API key")
}
})
}
}
func conformingStreamProviders(t *testing.T) []string {
t.Helper()
providers := ai.RegisteredProviders("stream")
+1 -2
View File
@@ -30,7 +30,6 @@ func init() {
return NewProvider(opts...)
})
ai.RegisterStream("together")
ai.RegisterToolStream("together")
}
type Provider struct {
@@ -148,7 +147,7 @@ func (p *Provider) callAPI(ctx context.Context, req map[string]any) (*ai.Respons
respBody, _ := io.ReadAll(httpResp.Body)
if httpResp.StatusCode != http.StatusOK {
return nil, nil, ai.NewHTTPError(httpResp, respBody)
return nil, nil, fmt.Errorf("API error (%s): %s", httpResp.Status, string(respBody))
}
var chatResp struct {
+4 -6
View File
@@ -62,17 +62,15 @@ curl -X POST http://localhost:8080/api/helloworld/Helloworld.Call \
## First agent on-ramp
Once the scaffold → run → call path works, ask the installed CLI for the
provider-free agent path. The focused no-secret docs/CLI contract is
`make docs-wayfinding`:
provider-free agent path:
```
micro agent demo
micro agent quickcheck
micro examples
micro zero-to-hero
```
`micro agent quickcheck` (alias: `micro agent debug`) prints the short recovery map when scaffold → run → chat → inspect stalls. Those commands point at the smallest mock-model first-agent example, the no-secret transcript, and the 0→hero support app before you add provider-backed chat.
Those commands point at the smallest mock-model first-agent example, the no-secret
transcript, and the support app before you add provider-backed chat.
### Output
@@ -685,7 +683,7 @@ micro loop init \
```
- `--roles`: which roles to scaffold (`planner,builder,triage`, or `all`)
- `--agent`: how the workflows summon the agent any `@mention`-driven coding agent (e.g. `@codex`, `@claude`)
- `--agent`: how the workflows summon the agent (an `@mention`)
- `--token-secret`: repo secret holding the driving user PAT
- `--branch`: base branch for the loop's PRs
- `--ci-workflow`: `name:` of the CI workflow triage watches
+18 -71
View File
@@ -22,7 +22,6 @@ import (
"github.com/urfave/cli/v2"
"go-micro.dev/v6/agent"
agentpb "go-micro.dev/v6/agent/proto"
"go-micro.dev/v6/ai"
clt "go-micro.dev/v6/client"
"go-micro.dev/v6/cmd"
@@ -75,9 +74,7 @@ a new service automatically and start using it.
Examples:
ANTHROPIC_API_KEY=sk-ant-... micro chat --provider anthropic
micro chat --provider openai --prompt "list all users"
micro chat assistant --prompt "create a task"`,
ArgsUsage: "[agent]",
micro chat --provider openai --prompt "list all users"`,
Flags: []cli.Flag{
&cli.StringFlag{Name: "provider", Usage: "AI provider (anthropic, openai, gemini, groq, mistral, together, atlascloud)", EnvVars: []string{"MICRO_AI_PROVIDER"}},
&cli.StringFlag{Name: "api_key", Usage: "API key for the provider", EnvVars: []string{"MICRO_AI_API_KEY"}},
@@ -190,36 +187,6 @@ func (s *session) callAgent(ctx context.Context, name, message string) (*agent.R
return r, nil
}
// streamAgent calls an agent's StreamChat endpoint and prints chunks as they
// arrive. Agents that do not expose StreamChat return an error; callers use that
// signal to fall back to Agent.Chat.
func (s *session) streamAgent(ctx context.Context, name, message string) error {
stream, err := agentpb.NewAgentService(name, s.cl).StreamChat(ctx, &agentpb.ChatRequest{Message: message})
if err != nil {
return err
}
defer stream.Close()
var reply strings.Builder
for {
chunk, err := stream.Recv()
if errors.Is(err, io.EOF) {
break
}
if err != nil {
return err
}
if chunk == nil || chunk.Reply == "" {
continue
}
fmt.Print(chunk.Reply)
reply.WriteString(chunk.Reply)
}
if reply.Len() > 0 {
fmt.Println()
}
return nil
}
// buildRouterPrompt creates a system prompt for the router that
// knows about all available agents and can dispatch to them.
func (s *session) buildRouterPrompt() string {
@@ -349,7 +316,6 @@ func run(c *cli.Context) error {
baseURL := c.String("base_url")
singlePrompt := c.String("prompt")
streamOutput := c.Bool("stream")
targetAgent := c.Args().First()
if provider == "" {
provider = ai.AutoDetectProvider(baseURL)
@@ -357,36 +323,15 @@ func run(c *cli.Context) error {
if apiKey == "" {
apiKey = fallbackAPIKey(provider)
}
if apiKey == "" {
return fmt.Errorf("no API key configured; set --api_key or %s", envVarForProvider(provider))
}
reg := registry.DefaultRegistry
cl := clt.DefaultClient
tools := ai.NewTools(reg, ai.ToolClient(cl))
s := &session{
provider: provider,
apiKey: apiKey,
tools: tools,
reg: reg,
cl: cl,
hist: ai.NewHistory(50),
stream: streamOutput,
}
hasAgents := s.discoverAgents()
if targetAgent != "" {
if _, ok := s.agents[targetAgent]; !ok {
return fmt.Errorf("agent %q is not registered; run `micro agent list` to see available agents", targetAgent)
}
s.agents = map[string]agentInfo{targetAgent: s.agents[targetAgent]}
hasAgents = true
}
if targetAgent != "" && singlePrompt != "" {
return s.ask(c.Context, singlePrompt)
}
if apiKey == "" {
return fmt.Errorf("no API key configured; set --api_key or %s", envVarForProvider(provider))
}
// Built-in agent capabilities (plan, delegate), reused from the
// agent package so the direct-service fallback matches a real agent.
builtinTools, builtinHandle := agent.Builtins(
@@ -398,8 +343,17 @@ func run(c *cli.Context) error {
agent.APIKey(apiKey),
)
s.builtinTools = builtinTools
s.builtinHandle = builtinHandle
s := &session{
provider: provider,
apiKey: apiKey,
tools: tools,
reg: reg,
cl: cl,
hist: ai.NewHistory(50),
builtinTools: builtinTools,
builtinHandle: builtinHandle,
stream: streamOutput,
}
s.refreshTools()
// Wrap the tool handler to intercept generate calls
@@ -433,6 +387,9 @@ func run(c *cli.Context) error {
defer s.cleanup()
// Discover registered agents
hasAgents := s.discoverAgents()
if singlePrompt != "" {
return s.ask(c.Context, singlePrompt)
}
@@ -583,11 +540,6 @@ func (s *session) routeToAgent(ctx context.Context, prompt string) error {
if len(s.agents) == 1 {
for name := range s.agents {
fmt.Printf(" \033[35m◆\033[0m \033[2m%s\033[0m\n", name)
if s.stream {
if err := s.streamAgent(ctx, name, prompt); err == nil {
return nil
}
}
resp, err := s.callAgent(ctx, name, prompt)
if err != nil {
return err
@@ -626,11 +578,6 @@ func (s *session) routeToAgent(ctx context.Context, prompt string) error {
}
fmt.Printf(" \033[35m◆\033[0m \033[2m%s\033[0m\n", agentName)
if s.stream {
if err := s.streamAgent(ctx, agentName, message); err == nil {
return ai.ToolResult{ID: call.ID, Value: map[string]string{"agent": agentName, "streamed": "true"}, Content: `{"streamed":true}`}
}
}
resp, err := s.callAgent(ctx, agentName, message)
if err != nil {
return ai.ToolResult{ID: call.ID, Value: map[string]string{"error": err.Error()}, Content: `{"error":"` + err.Error() + `"}`}
+1 -169
View File
@@ -2,48 +2,18 @@
package agent
import (
"context"
"encoding/json"
"fmt"
"io"
"os"
"time"
"github.com/urfave/cli/v2"
goagent "go-micro.dev/v6/agent"
"go-micro.dev/v6/cmd"
aiflow "go-micro.dev/v6/flow"
"go-micro.dev/v6/registry"
"go-micro.dev/v6/store"
)
const firstAgentQuickChecksHelp = `First-agent failure-mode quick checks
Use this when scaffold -> run -> chat -> inspect stalls and you want the
smallest provider-free recovery loop before reading the full docs.
1. Confirm prerequisites before starting the gateway:
micro agent preflight
2. Start the project and keep it running in a separate terminal:
micro run
3. Check the agent is registered and the chat gateway is reachable:
micro agent doctor
4. If chat returns an answer or an error, inspect the latest run state:
micro inspect agent <name>
micro runs <name>
5. If provider chat is not configured yet, prove the no-secret path still works:
micro agent demo
go test ./internal/harness/zero-to-hero-ci -run TestNoSecretFirstAgentTranscript -count=1
go test ./internal/harness/zero-to-hero-ci -run TestNoSecretFirstAgentDebuggingSmoke -count=1
Recovery docs:
https://go-micro.dev/docs/guides/debugging-agents.html
https://go-micro.dev/docs/guides/no-secret-first-agent.html`
const noSecretDemoHelp = `No-secret first-agent demo
Use this when you want the fastest provider-free agent success path before
@@ -56,7 +26,6 @@ What this proves:
- service tools can be called by an agent
- chat behavior is exercised without contacting a live provider
- run history can be inspected after the prompt
- the debug smoke seeds a stalled-first-agent recovery transcript
After it passes:
- Build your own service-backed agent: https://go-micro.dev/docs/guides/your-first-agent.html
@@ -68,10 +37,7 @@ Use live-provider chat when you are ready for real model behavior:
micro run
micro chat
micro agent doctor # after micro run: chat/gateway/inspect recovery
micro inspect agent <name>
Debug transcript smoke:
go test ./internal/harness/zero-to-hero-ci -run TestNoSecretFirstAgentDebuggingSmoke -count=1`
micro inspect agent <name>`
func init() {
cmd.Register(&cli.Command{
@@ -106,18 +72,6 @@ for live-provider chat and inspect/debugging.`,
return nil
},
},
{
Name: "quickcheck",
Aliases: []string{"debug"},
Usage: "Print first-agent failure-mode quick checks",
Description: `Print provider-free recovery breadcrumbs for the scaffold -> run ->
chat -> inspect loop, including exact commands for registration, gateway, run
history, and no-secret fallback checks.`,
Action: func(c *cli.Context) error {
fmt.Fprintln(c.App.Writer, firstAgentQuickChecksHelp)
return nil
},
},
{
Name: "preflight",
Usage: "Check local prerequisites before the first provider-backed agent",
@@ -195,23 +149,6 @@ history, and no-secret fallback checks.`,
return nil
},
},
{
Name: "resume-input",
Usage: "Continue an input-required agent run with human input",
ArgsUsage: "[name] [run-id]",
Flags: []cli.Flag{
&cli.StringFlag{Name: "input", Usage: "Human input to provide to the paused run", Required: true},
},
Action: func(c *cli.Context) error {
name := c.Args().First()
runID := c.Args().Get(1)
if name == "" || runID == "" {
return fmt.Errorf("usage: micro agent resume-input [name] [run-id] --input <text>")
}
return resumeInputRun(context.Background(), c.App.Writer, name, runID, c.String("input"))
},
},
{
Name: "history",
Usage: "Show an agent's stored conversation and run history",
@@ -287,44 +224,14 @@ func writeRunIndex(w io.Writer, name string, runs []goagent.RunSummary, asJSON b
if run.TraceID != "" {
line += " trace=" + shortTraceID(run.TraceID)
}
if run.Checkpoint != "" {
line += " checkpoint=" + run.Checkpoint
}
if run.Stage != "" {
line += " stage=" + run.Stage
}
if run.LastError != "" {
line += " error=" + run.LastError
}
fmt.Fprintln(w, line)
writeRunIndexBreadcrumbs(w, name, run)
}
return nil
}
func writeRunIndexBreadcrumbs(w io.Writer, name string, run goagent.RunSummary) {
if run.Stage == "input-required" {
fmt.Fprintf(w, " inspect: micro agent history %s %s\n", name, run.RunID)
fmt.Fprintf(w, " input: micro agent resume-input %s %s --input <text>\n", name, run.RunID)
return
}
if !isResumableRunSummary(run) {
return
}
fmt.Fprintf(w, " inspect: micro agent history %s %s\n", name, run.RunID)
fmt.Fprintf(w, " resume: call micro.AgentResume(ctx, agent, %q) after recreating the agent with the same checkpoint store\n", run.RunID)
fmt.Fprintf(w, " stream: call micro.ResumeStreamAsk(ctx, agent, %q) to resume with streaming events\n", run.RunID)
}
func isResumableRunSummary(run goagent.RunSummary) bool {
switch run.Status {
case "running", "error", "failed", "refused":
return run.Checkpoint != "done" || run.Stage != ""
default:
return false
}
}
func printRunHistory(name, runID string, asJSON bool) error {
events, err := goagent.LoadRunEvents(store.DefaultStore, name, runID)
if err != nil {
@@ -390,78 +297,3 @@ func shortTraceID(id string) string {
}
return id[:12]
}
type cliInputPause struct {
OriginalMessage string `json:"original_message"`
Prompt string `json:"prompt"`
}
func resumeInputRun(ctx context.Context, w io.Writer, name, runID, input string) error {
if input == "" {
return fmt.Errorf("input required: pass --input <text>")
}
cp := aiflow.StoreCheckpoint(store.DefaultStore, name)
run, ok, err := cp.Load(ctx, runID)
if err != nil {
return err
}
if !ok {
return fmt.Errorf("agent run %s not found for %q", runID, name)
}
if run.Status != "paused" || run.State.Stage != "input-required" {
return fmt.Errorf("agent run %s is not waiting for human input", runID)
}
var pause cliInputPause
_ = run.State.Scan(&pause)
reply := "Human input recorded; recreate the agent with the same checkpoint store and call micro.AgentResumeInput to continue model execution."
resp := goagent.Response{Reply: reply, Agent: name, RunID: runID, ParentID: run.ParentID}
data, err := json.Marshal(resp)
if err != nil {
return err
}
run.Status = "done"
run.State.Stage = "done"
run.State.Data = data
for i := range run.Steps {
if run.Steps[i].Status == "paused" || run.Steps[i].Name == "ask" {
run.Steps[i].Status = "done"
run.Steps[i].Error = ""
run.Steps[i].Result = "human input: " + input
}
}
if len(run.Steps) == 0 {
run.Steps = []aiflow.StepRecord{{Name: "ask", Status: "done", Result: "human input: " + input}}
}
if err := cp.Save(ctx, run); err != nil {
return err
}
if err := recordCLIResumeEvents(name, runID, run.ParentID); err != nil {
return err
}
if pause.Prompt != "" {
fmt.Fprintf(w, " Prompt: %s\n", pause.Prompt)
}
fmt.Fprintf(w, " Recorded input for agent %q run %s.\n", name, runID)
fmt.Fprintf(w, " Inspect: micro inspect agent %s --limit 1\n", name)
return nil
}
func recordCLIResumeEvents(name, runID, parentID string) error {
now := time.Now()
scoped := store.Scope(store.DefaultStore, "agent", name)
events := []goagent.RunEvent{
{Time: now, RunID: runID, ParentID: parentID, Agent: name, Kind: "checkpoint", Name: "done", Status: "done"},
{Time: now.Add(time.Nanosecond), RunID: runID, ParentID: parentID, Agent: name, Kind: "done"},
}
for _, e := range events {
b, err := json.Marshal(e)
if err != nil {
return err
}
key := fmt.Sprintf("runs/%s/%020d-%s", runID, e.Time.UnixNano(), e.Kind)
if err := scoped.Write(&store.Record{Key: key, Value: b}); err != nil {
return err
}
}
return nil
}
-81
View File
@@ -2,7 +2,6 @@ package agent
import (
"bytes"
"context"
"encoding/json"
"strings"
"testing"
@@ -10,8 +9,6 @@ import (
goagent "go-micro.dev/v6/agent"
"go-micro.dev/v6/ai"
aiflow "go-micro.dev/v6/flow"
"go-micro.dev/v6/store"
)
func TestWriteRunIndexJSON(t *testing.T) {
@@ -62,46 +59,6 @@ func TestWriteRunIndexHumanIncludesStatusAndDuration(t *testing.T) {
}
}
func TestWriteRunIndexIncludesResumeBreadcrumbs(t *testing.T) {
runs := []goagent.RunSummary{{
RunID: "run-failed",
Agent: "runner",
UpdatedAt: time.Date(2026, 6, 25, 12, 34, 56, 0, time.UTC),
Events: 3,
Status: "error",
LastKind: "tool",
Checkpoint: "failed",
Stage: "ask",
}}
var out bytes.Buffer
if err := writeRunIndex(&out, "runner", runs, false); err != nil {
t.Fatal(err)
}
got := out.String()
for _, want := range []string{"checkpoint=failed", "stage=ask", `micro agent history runner run-failed`, `micro.AgentResume(ctx, agent, "run-failed")`, `micro.ResumeStreamAsk(ctx, agent, "run-failed")`} {
if !strings.Contains(got, want) {
t.Fatalf("output missing %q:\n%s", want, got)
}
}
}
func TestWriteRunIndexInputRequiredUsesResumeInput(t *testing.T) {
runs := []goagent.RunSummary{{RunID: "run-input", Agent: "runner", Status: "running", LastKind: "checkpoint", Checkpoint: "paused", Stage: "input-required"}}
var out bytes.Buffer
if err := writeRunIndex(&out, "runner", runs, false); err != nil {
t.Fatal(err)
}
got := out.String()
for _, want := range []string{`micro agent history runner run-input`, `micro agent resume-input runner run-input --input <text>`} {
if !strings.Contains(got, want) {
t.Fatalf("output missing %q:\n%s", want, got)
}
}
if strings.Contains(got, `micro.AgentResume(ctx, agent, "run-input")`) || strings.Contains(got, "ResumeStreamAsk") {
t.Fatalf("input-required run should point at ResumeInput only, got:\n%s", got)
}
}
func TestWriteRunHistoryHumanAndJSON(t *testing.T) {
events := []goagent.RunEvent{{
Time: time.Date(2026, 6, 25, 12, 34, 56, 7_000_000, time.UTC),
@@ -140,41 +97,3 @@ func TestWriteRunHistoryHumanAndJSON(t *testing.T) {
t.Fatalf("decoded events = %#v", got)
}
}
func TestResumeInputRunCompletesCheckpointAndInspectSummary(t *testing.T) {
oldStore := store.DefaultStore
store.DefaultStore = store.NewMemoryStore()
t.Cleanup(func() { store.DefaultStore = oldStore })
ctx := context.Background()
cp := aiflow.StoreCheckpoint(store.DefaultStore, "runner")
run := aiflow.Run{ID: "run-input", Flow: "runner", Status: "paused", State: aiflow.State{Stage: "input-required"}, Steps: []aiflow.StepRecord{{Name: "ask", Status: "paused", Error: "Which region?"}}}
if err := run.State.Set(cliInputPause{OriginalMessage: "deploy", Prompt: "Which region?"}); err != nil {
t.Fatalf("set pause: %v", err)
}
if err := cp.Save(ctx, run); err != nil {
t.Fatalf("save checkpoint: %v", err)
}
var out bytes.Buffer
if err := resumeInputRun(ctx, &out, "runner", "run-input", "us-east-1"); err != nil {
t.Fatalf("resumeInputRun: %v", err)
}
if got := out.String(); !strings.Contains(got, "Recorded input") || !strings.Contains(got, "micro inspect agent runner --limit 1") {
t.Fatalf("output missing continuation hints:\n%s", got)
}
loaded, ok, err := cp.Load(ctx, "run-input")
if err != nil || !ok {
t.Fatalf("load checkpoint ok=%v err=%v", ok, err)
}
if loaded.Status != "done" || loaded.State.Stage != "done" {
t.Fatalf("loaded run status/stage = %s/%s, want done/done", loaded.Status, loaded.State.Stage)
}
summaries, err := goagent.ListRunSummariesWithOptions(store.DefaultStore, "runner", goagent.RunListOptions{Status: "done"})
if err != nil {
t.Fatalf("summaries: %v", err)
}
if len(summaries) != 1 || summaries[0].RunID != "run-input" || summaries[0].Status != "done" {
t.Fatalf("summaries = %#v, want completed run-input", summaries)
}
}
-22
View File
@@ -73,25 +73,3 @@ func TestRunAgentDoctorReportsActionableRecoveryFailures(t *testing.T) {
}
}
}
func TestAgentQuickcheckPrintsProviderFreeFailureModeBreadcrumbs(t *testing.T) {
got := firstAgentQuickChecksHelp
for _, want := range []string{
"First-agent failure-mode quick checks",
"scaffold -> run -> chat -> inspect",
"micro agent preflight",
"micro run",
"micro agent doctor",
"micro inspect agent <name>",
"micro runs <name>",
"micro agent demo",
"go test ./internal/harness/zero-to-hero-ci -run TestNoSecretFirstAgentTranscript -count=1",
"go test ./internal/harness/zero-to-hero-ci -run TestNoSecretFirstAgentDebuggingSmoke -count=1",
"debugging-agents.html",
"no-secret-first-agent.html",
} {
if !strings.Contains(got, want) {
t.Fatalf("quickcheck output missing %q:\n%s", want, got)
}
}
}
+4 -4
View File
@@ -246,17 +246,17 @@ func Compose(c *cli.Context) error {
imageName = registry + "/" + imageName
}
fmt.Fprintf(&sb, " %s:\n", svc.Name)
fmt.Fprintf(&sb, " image: %s\n", imageName)
sb.WriteString(fmt.Sprintf(" %s:\n", svc.Name))
sb.WriteString(fmt.Sprintf(" image: %s\n", imageName))
if svc.Port > 0 {
fmt.Fprintf(&sb, " ports:\n - \"%d:%d\"\n", svc.Port, svc.Port)
sb.WriteString(fmt.Sprintf(" ports:\n - \"%d:%d\"\n", svc.Port, svc.Port))
}
if len(svc.Depends) > 0 {
sb.WriteString(" depends_on:\n")
for _, dep := range svc.Depends {
fmt.Fprintf(&sb, " - %s\n", dep)
sb.WriteString(fmt.Sprintf(" - %s\n", dep))
}
}
-3
View File
@@ -82,9 +82,6 @@ const docsWayfinding = `First-agent and 0→hero docs:
prove service tools, mock-model chat, and inspectable run history without
configuring a provider key.
If scaffold → run → chat → inspect stalls, print the short recovery map:
micro agent quickcheck
2. No-secret first-agent transcript
https://go-micro.dev/docs/guides/no-secret-first-agent.html
Run the maintained support agent without a provider key:
+1 -1
View File
@@ -93,7 +93,7 @@ func showDeployTargets(cfg *config.Config) error {
var sb strings.Builder
sb.WriteString("Available deploy targets:\n\n")
for name, dt := range cfg.Deploy {
fmt.Fprintf(&sb, " %s -> %s\n", name, dt.SSH)
sb.WriteString(fmt.Sprintf(" %s -> %s\n", name, dt.SSH))
}
sb.WriteString("\nDeploy with: micro deploy <target>")
return fmt.Errorf("%s", sb.String())
+14 -14
View File
@@ -502,18 +502,18 @@ func newModel(provider, apiKey, model string) ai.Model {
func buildProto(dehyphen, titleName string, svc ServiceSpec) string {
var b strings.Builder
fmt.Fprintf(&b, "syntax = \"proto3\";\n\npackage %s;\n\noption go_package = \"./proto;%s\";\n\n", dehyphen, dehyphen)
b.WriteString(fmt.Sprintf("syntax = \"proto3\";\n\npackage %s;\n\noption go_package = \"./proto;%s\";\n\n", dehyphen, dehyphen))
fmt.Fprintf(&b, "service %s {\n", titleName)
b.WriteString(fmt.Sprintf("service %s {\n", titleName))
for _, ep := range svc.Endpoints {
fmt.Fprintf(&b, "\trpc %s(%sRequest) returns (%sResponse) {}\n", ep.Name, ep.Name, ep.Name)
b.WriteString(fmt.Sprintf("\trpc %s(%sRequest) returns (%sResponse) {}\n", ep.Name, ep.Name, ep.Name))
}
b.WriteString("}\n\n")
// Record message
fmt.Fprintf(&b, "message %sRecord {\n", titleName)
b.WriteString(fmt.Sprintf("message %sRecord {\n", titleName))
for i, f := range svc.Fields {
fmt.Fprintf(&b, "\t%s %s = %d; // %s\n", protoType(f.Type), f.Name, i+1, f.Description)
b.WriteString(fmt.Sprintf("\t%s %s = %d; // %s\n", protoType(f.Type), f.Name, i+1, f.Description))
}
b.WriteString("}\n\n")
@@ -527,12 +527,12 @@ func buildProto(dehyphen, titleName string, svc ServiceSpec) string {
if f.Name == "id" || f.Name == "created" || f.Name == "updated" {
continue
}
fmt.Fprintf(&b, "\t%s %s = %d;\n", protoType(f.Type), f.Name, n)
b.WriteString(fmt.Sprintf("\t%s %s = %d;\n", protoType(f.Type), f.Name, n))
n++
}
fmt.Fprintf(&b, "}\n\nmessage CreateResponse {\n\t%sRecord record = 1;\n}\n\n", titleName)
b.WriteString(fmt.Sprintf("}\n\nmessage CreateResponse {\n\t%sRecord record = 1;\n}\n\n", titleName))
case "Read":
fmt.Fprintf(&b, "message ReadRequest {\n\tstring id = 1;\n}\n\nmessage ReadResponse {\n\t%sRecord record = 1;\n}\n\n", titleName)
b.WriteString(fmt.Sprintf("message ReadRequest {\n\tstring id = 1;\n}\n\nmessage ReadResponse {\n\t%sRecord record = 1;\n}\n\n", titleName))
case "Update":
b.WriteString("message UpdateRequest {\n\tstring id = 1;\n")
n := 2
@@ -540,26 +540,26 @@ func buildProto(dehyphen, titleName string, svc ServiceSpec) string {
if f.Name == "id" || f.Name == "created" || f.Name == "updated" {
continue
}
fmt.Fprintf(&b, "\t%s %s = %d;\n", protoType(f.Type), f.Name, n)
b.WriteString(fmt.Sprintf("\t%s %s = %d;\n", protoType(f.Type), f.Name, n))
n++
}
fmt.Fprintf(&b, "}\n\nmessage UpdateResponse {\n\t%sRecord record = 1;\n}\n\n", titleName)
b.WriteString(fmt.Sprintf("}\n\nmessage UpdateResponse {\n\t%sRecord record = 1;\n}\n\n", titleName))
case "Delete":
b.WriteString("message DeleteRequest {\n\tstring id = 1;\n}\n\nmessage DeleteResponse {\n\tbool deleted = 1;\n}\n\n")
case "List":
fmt.Fprintf(&b, "message ListRequest {\n\tint64 limit = 1;\n\tint64 offset = 2;\n\tstring query = 3;\n}\n\nmessage ListResponse {\n\trepeated %sRecord records = 1;\n\tint64 total = 2;\n}\n\n", titleName)
b.WriteString(fmt.Sprintf("message ListRequest {\n\tint64 limit = 1;\n\tint64 offset = 2;\n\tstring query = 3;\n}\n\nmessage ListResponse {\n\trepeated %sRecord records = 1;\n\tint64 total = 2;\n}\n\n", titleName))
default:
// Custom endpoint — use all fields as input, record as output
fmt.Fprintf(&b, "message %sRequest {\n", ep.Name)
b.WriteString(fmt.Sprintf("message %sRequest {\n", ep.Name))
n := 1
for _, f := range svc.Fields {
if f.Name == "created" || f.Name == "updated" {
continue
}
fmt.Fprintf(&b, "\t%s %s = %d;\n", protoType(f.Type), f.Name, n)
b.WriteString(fmt.Sprintf("\t%s %s = %d;\n", protoType(f.Type), f.Name, n))
n++
}
fmt.Fprintf(&b, "}\n\nmessage %sResponse {\n\t%sRecord record = 1;\n\tstring message = 2;\n\tbool success = 3;\n}\n\n", ep.Name, titleName)
b.WriteString(fmt.Sprintf("}\n\nmessage %sResponse {\n\t%sRecord record = 1;\n\tstring message = 2;\n\tbool success = 3;\n}\n\n", ep.Name, titleName))
}
}
return b.String()
+7 -7
View File
@@ -31,7 +31,7 @@ func TestZeroToOneContract(t *testing.T) {
}
}
generated.assertLocalModule(t)
generated.replaceModule(t)
generated.build(t)
generated.run(t)
generated.call(t, "Alice", "Hello Alice")
@@ -52,7 +52,7 @@ func TestZeroToOneNoMCPContract(t *testing.T) {
t.Fatalf("--no-mcp generated main.go with MCP wiring:\n%s", main)
}
generated.assertLocalModule(t)
generated.replaceModule(t)
generated.build(t)
generated.run(t)
generated.call(t, "Bob", "Hello Bob")
@@ -112,7 +112,6 @@ func generateService(t *testing.T, name string, args ...string) generatedService
if err != nil {
t.Fatal(err)
}
t.Setenv("MICRO_NEW_GO_MICRO_REPLACE", repoRoot)
tmp := t.TempDir()
oldwd, err := os.Getwd()
@@ -143,7 +142,7 @@ func generateService(t *testing.T, name string, args ...string) generatedService
return generatedService{dir: filepath.Join(tmp, name), repoRoot: repoRoot}
}
func (g generatedService) assertLocalModule(t *testing.T) {
func (g generatedService) replaceModule(t *testing.T) {
t.Helper()
modPath := filepath.Join(g.dir, "go.mod")
@@ -151,9 +150,10 @@ func (g generatedService) assertLocalModule(t *testing.T) {
if err != nil {
t.Fatal(err)
}
want := "replace go-micro.dev/v6 => " + filepath.ToSlash(g.repoRoot)
if !strings.Contains(string(mod), want) {
t.Fatalf("generated go.mod missing local replace %q:\n%s", want, mod)
modText := strings.Replace(string(mod), "go-micro.dev/v6 latest", "go-micro.dev/v6 v6.0.0", 1)
modText += "\nreplace go-micro.dev/v6 => " + filepath.ToSlash(g.repoRoot) + "\n"
if err := os.WriteFile(modPath, []byte(modText), 0644); err != nil {
t.Fatal(err)
}
}
-7
View File
@@ -39,8 +39,6 @@ type config struct {
UseGoPath bool
// MicroVersion is the go-micro version to require in go.mod
MicroVersion string
// MicroReplace optionally points generated services at a local go-micro checkout.
MicroReplace string
// Files
Files []file
// Comments
@@ -71,10 +69,6 @@ func microVersion() string {
return "latest"
}
func microReplace() string {
return filepath.ToSlash(os.Getenv("MICRO_NEW_GO_MICRO_REPLACE"))
}
type file struct {
Path string
Tmpl string
@@ -221,7 +215,6 @@ func Run(ctx *cli.Context) error {
GoPath: goPath,
UseGoPath: false,
MicroVersion: microVersion(),
MicroReplace: microReplace(),
}
if useProto {
+2 -6
View File
@@ -10,9 +10,7 @@ require (
github.com/golang/protobuf latest
google.golang.org/protobuf latest
)
{{if .MicroReplace}}
replace go-micro.dev/v6 => {{.MicroReplace}}
{{end}}`
`
// ModuleNoProto is the default go.mod: no protobuf dependencies.
// MicroVersion is the version this CLI was built from (or "latest"), so a
@@ -22,7 +20,5 @@ replace go-micro.dev/v6 => {{.MicroReplace}}
go 1.23
require go-micro.dev/v6 {{.MicroVersion}}
{{if .MicroReplace}}
replace go-micro.dev/v6 => {{.MicroReplace}}
{{end}}`
`
)
+1 -162
View File
@@ -2,8 +2,6 @@ package main
import (
"bytes"
"os"
"path/filepath"
"strings"
"testing"
@@ -38,15 +36,12 @@ func TestFirstAgentWalkthroughCLIBoundaries(t *testing.T) {
if !subcommands["agent"]["doctor"] {
t.Fatal("first-agent walkthrough missing recovery boundary: agent doctor")
}
if !subcommands["agent"]["quickcheck"] {
t.Fatal("first-agent walkthrough missing failure-mode boundary: agent quickcheck")
}
if !subcommands["inspect"]["agent"] {
t.Fatal("first-agent walkthrough missing inspect boundary: inspect agent")
}
chat := commandByName(t, "chat")
if !strings.Contains(chat.Description, "services") || !strings.Contains(chat.Description, "agent") || !strings.Contains(chat.Description, `micro chat assistant --prompt`) {
if !strings.Contains(chat.Description, "services") || !strings.Contains(chat.Description, "agent") {
t.Fatalf("micro chat should describe the service-to-agent walkthrough boundary; description was %q", chat.Description)
}
@@ -121,29 +116,6 @@ func TestFirstAgentWalkthroughCLIBoundaries(t *testing.T) {
}
}
quickcheck := subcommandByName(t, agent, "quickcheck")
out.Reset()
if err := quickcheck.Action(cli.NewContext(app, nil, nil)); err != nil {
t.Fatalf("micro agent quickcheck failed: %v", err)
}
for _, want := range []string{
"First-agent failure-mode quick checks",
"scaffold -> run -> chat -> inspect",
"micro agent preflight",
"micro run",
"micro agent doctor",
"micro inspect agent <name>",
"micro runs <name>",
"micro agent demo",
"go test ./internal/harness/zero-to-hero-ci -run TestNoSecretFirstAgentTranscript -count=1",
"go test ./internal/harness/zero-to-hero-ci -run TestNoSecretFirstAgentDebuggingSmoke -count=1",
"debugging-agents.html",
} {
if !strings.Contains(out.String(), want) {
t.Fatalf("micro agent quickcheck output missing %q:\n%s", want, out.String())
}
}
demo := subcommandByName(t, agent, "demo")
out.Reset()
if err := demo.Action(cli.NewContext(app, nil, nil)); err != nil {
@@ -152,9 +124,7 @@ func TestFirstAgentWalkthroughCLIBoundaries(t *testing.T) {
for _, want := range []string{
"No-secret first-agent demo",
"go test ./internal/harness/zero-to-hero-ci -run TestNoSecretFirstAgentTranscript -count=1",
"go test ./internal/harness/zero-to-hero-ci -run TestNoSecretFirstAgentDebuggingSmoke -count=1",
"provider-free",
"stalled-first-agent recovery transcript",
"micro agent preflight # before micro run: prerequisites",
"micro chat",
"micro agent doctor # after micro run: chat/gateway/inspect recovery",
@@ -169,137 +139,6 @@ func TestFirstAgentWalkthroughCLIBoundaries(t *testing.T) {
}
}
func TestFirstAgentDocsMatchCLIOutput(t *testing.T) {
root := filepath.Clean(filepath.Join("..", ".."))
outputs := map[string]string{
"micro docs": commandOutput(t, commandByName(t, "docs")),
"micro examples": commandOutput(t, commandByName(t, "examples")),
"micro zero-to-hero": commandOutput(t, commandByName(t, "zero-to-hero")),
}
agent := commandByName(t, "agent")
outputs["micro agent demo"] = commandOutput(t, subcommandByName(t, agent, "demo"))
outputs["micro agent quickcheck"] = commandOutput(t, subcommandByName(t, agent, "quickcheck"))
contracts := []struct {
name string
file string
markers []string
}{
{
name: "README first-agent on-ramp",
file: filepath.Join(root, "README.md"),
markers: []string{
"micro agent demo",
"micro agent quickcheck",
"micro agent preflight",
"micro agent doctor",
"micro inspect agent <name>",
"micro examples",
"micro zero-to-hero",
"make docs-wayfinding",
"examples/first-agent/",
"examples/support/",
"internal/website/docs/guides/no-secret-first-agent.md",
"internal/website/docs/guides/your-first-agent.md",
"internal/website/docs/guides/debugging-agents.md",
"internal/website/docs/guides/zero-to-hero.md",
},
},
{
name: "website getting-started first-agent on-ramp",
file: filepath.Join(root, "internal", "website", "docs", "getting-started.md"),
markers: []string{
"micro agent demo",
"micro agent quickcheck",
"micro agent preflight",
"micro agent doctor",
"micro inspect agent <name>",
"micro examples",
"micro zero-to-hero",
"make docs-wayfinding",
"github.com/micro/go-micro/tree/master/examples/first-agent",
"github.com/micro/go-micro/tree/master/examples/support",
"guides/no-secret-first-agent.html",
"guides/your-first-agent.html",
"guides/debugging-agents.html",
"guides/zero-to-hero.html",
},
},
}
for _, contract := range contracts {
doc := readTestFile(t, contract.file)
for _, marker := range contract.markers {
if !strings.Contains(doc, marker) {
t.Fatalf("%s missing documented first-agent marker %q", contract.name, marker)
}
if isCLIContractMarker(marker) && !cliOutputsContain(outputs, marker) {
t.Fatalf("%s documents %q, but none of the first-agent CLI outputs mention it; keep README/website breadcrumbs aligned with micro agent demo/examples/zero-to-hero", contract.name, marker)
}
assertMaintainedFirstAgentPath(t, root, marker)
}
}
}
func commandOutput(t *testing.T, command *cli.Command) string {
t.Helper()
var out bytes.Buffer
app := cli.NewApp()
app.Writer = &out
if err := command.Action(cli.NewContext(app, nil, nil)); err != nil {
t.Fatalf("%s failed: %v", command.Name, err)
}
return out.String()
}
func cliOutputsContain(outputs map[string]string, marker string) bool {
for command, out := range outputs {
if command == marker || strings.Contains(out, marker) {
return true
}
}
return false
}
func isCLIContractMarker(marker string) bool {
return strings.HasPrefix(marker, "micro ") || strings.HasPrefix(marker, "go run ") || strings.HasPrefix(marker, "go test ") || strings.Contains(marker, ".html")
}
func assertMaintainedFirstAgentPath(t *testing.T, root, marker string) {
t.Helper()
pathChecks := map[string]string{
"go run ./examples/first-agent": "examples/first-agent",
"examples/first-agent/": "examples/first-agent",
"examples/support/": "examples/support",
"internal/website/docs/guides/no-secret-first-agent.md": "internal/website/docs/guides/no-secret-first-agent.md",
"internal/website/docs/guides/your-first-agent.md": "internal/website/docs/guides/your-first-agent.md",
"internal/website/docs/guides/debugging-agents.md": "internal/website/docs/guides/debugging-agents.md",
"internal/website/docs/guides/zero-to-hero.md": "internal/website/docs/guides/zero-to-hero.md",
"guides/no-secret-first-agent.html": "internal/website/docs/guides/no-secret-first-agent.md",
"guides/your-first-agent.html": "internal/website/docs/guides/your-first-agent.md",
"guides/debugging-agents.html": "internal/website/docs/guides/debugging-agents.md",
"guides/zero-to-hero.html": "internal/website/docs/guides/zero-to-hero.md",
"github.com/micro/go-micro/tree/master/examples/first-agent": "examples/first-agent",
"github.com/micro/go-micro/tree/master/examples/support": "examples/support",
}
path, ok := pathChecks[marker]
if !ok {
return
}
if _, err := os.Stat(filepath.Join(root, filepath.FromSlash(path))); err != nil {
t.Fatalf("documented first-agent path %q from marker %q does not resolve: %v", path, marker, err)
}
}
func readTestFile(t *testing.T, path string) string {
t.Helper()
b, err := os.ReadFile(path)
if err != nil {
t.Fatalf("read %s: %v", path, err)
}
return string(b)
}
func commandByName(t *testing.T, name string) *cli.Command {
t.Helper()
for _, command := range microcmd.DefaultCmd.App().Commands {
+7 -22
View File
@@ -43,7 +43,7 @@ It reads durable local run history, so it works after the agent or flow has stop
func inspectAgentFlags() []cli.Flag {
return []cli.Flag{
&cli.BoolFlag{Name: "json", Usage: "Print run summaries as JSON for automation"},
&cli.StringFlag{Name: "status", Usage: "Only show runs with this status (running, done, canceled, timeout, rate_limited, auth, configuration, unavailable, provider_error, error, refused)"},
&cli.StringFlag{Name: "status", Usage: "Only show runs with this status (running, done, error, refused)"},
&cli.StringFlag{Name: "trace", Usage: "Only show runs whose trace id matches this full id or prefix"},
&cli.IntFlag{Name: "limit", Usage: "Show the most recently updated N runs"},
}
@@ -91,12 +91,6 @@ func writeAgentInspection(w io.Writer, name string, runs []goagent.RunSummary, a
if run.Stage != "" {
fmt.Fprintf(w, " stage=%s", run.Stage)
}
if run.LastErrorKind != "" {
fmt.Fprintf(w, " error_kind=%s", run.LastErrorKind)
}
if run.Spent > 0 {
fmt.Fprintf(w, " spent=%d", run.Spent)
}
if run.LastError != "" {
fmt.Fprintf(w, " error=%q", run.LastError)
}
@@ -104,25 +98,16 @@ func writeAgentInspection(w io.Writer, name string, runs []goagent.RunSummary, a
fmt.Fprintf(w, " trace=%s", shortID(run.TraceID))
}
fmt.Fprintln(w)
writeAgentRunBreadcrumbs(w, name, run)
if isResumableAgentRun(run) {
fmt.Fprintf(w, " resume: call micro.AgentResume(ctx, agent, %q) after recreating the agent with the same checkpoint store\n", run.RunID)
}
if run.Stage == "input-required" {
fmt.Fprintf(w, " input: call micro.AgentResumeInput(ctx, agent, %q, input) to continue the paused run\n", run.RunID)
}
}
return nil
}
func writeAgentRunBreadcrumbs(w io.Writer, name string, run goagent.RunSummary) {
if run.Stage == "input-required" {
fmt.Fprintf(w, " inspect: micro agent history %s %s\n", name, run.RunID)
fmt.Fprintf(w, " input: micro agent resume-input %s %s --input <text>\n", name, run.RunID)
return
}
if !isResumableAgentRun(run) {
return
}
fmt.Fprintf(w, " inspect: micro agent history %s %s\n", name, run.RunID)
fmt.Fprintf(w, " resume: call micro.AgentResume(ctx, agent, %q) after recreating the agent with the same checkpoint store\n", run.RunID)
fmt.Fprintf(w, " stream: call micro.ResumeStreamAsk(ctx, agent, %q) to resume with streaming events\n", run.RunID)
}
func isResumableAgentRun(run goagent.RunSummary) bool {
switch run.Status {
case "running", "error", "failed", "refused":
+3 -6
View File
@@ -11,13 +11,13 @@ import (
)
func TestWriteAgentInspectionIncludesActionableBreadcrumbs(t *testing.T) {
runs := []goagent.RunSummary{{RunID: "run-1", Status: "auth", Events: 4, LastKind: "model", LastError: "invalid API key", LastErrorKind: "auth", TraceID: "1234567890abcdef", Checkpoint: "failed", Stage: "ask", Spent: 7}}
runs := []goagent.RunSummary{{RunID: "run-1", Status: "error", Events: 4, LastKind: "tool", LastError: "boom", TraceID: "1234567890abcdef", Checkpoint: "failed", Stage: "ask"}}
var out bytes.Buffer
if err := writeAgentInspection(&out, "support", runs, false); err != nil {
t.Fatal(err)
}
got := out.String()
for _, want := range []string{"Agent \"support\" runs", "run-1", "status=auth", "events=4", "last=model", "checkpoint=failed", "stage=ask", "error_kind=auth", `error="invalid API key"`, "trace=1234567890ab", "spent=7"} {
for _, want := range []string{"Agent \"support\" runs", "run-1", "status=error", "events=4", "last=tool", "checkpoint=failed", "stage=ask", `error="boom"`, "trace=1234567890ab", `micro.AgentResume(ctx, agent, "run-1")`} {
if !strings.Contains(got, want) {
t.Fatalf("output missing %q:\n%s", want, got)
}
@@ -31,14 +31,11 @@ func TestWriteAgentInspectionIncludesInputResumeBreadcrumb(t *testing.T) {
t.Fatal(err)
}
got := out.String()
for _, want := range []string{"checkpoint=paused", "stage=input-required", `micro agent history support run-input`, `micro agent resume-input support run-input --input <text>`} {
for _, want := range []string{"checkpoint=paused", "stage=input-required", `micro.AgentResumeInput(ctx, agent, "run-input", input)`} {
if !strings.Contains(got, want) {
t.Fatalf("output missing %q:\n%s", want, got)
}
}
if strings.Contains(got, `micro.AgentResume(ctx, agent, "run-input")`) || strings.Contains(got, "ResumeStreamAsk") {
t.Fatalf("input-required run should point at ResumeInput only, got:\n%s", got)
}
}
func TestWriteAgentInspectionEmptyStateNamesInspectCommand(t *testing.T) {
+1 -1
View File
@@ -123,7 +123,7 @@ Examples:
&cli.StringFlag{Name: "dir", Usage: "Target repo directory", Value: "."},
&cli.StringFlag{Name: "roles", Usage: "Comma-separated roles, or 'all'", Value: "planner,builder,triage"},
&cli.StringFlag{Name: "branch", Usage: "Base branch for the loop's PRs (auto-detected if empty)"},
&cli.StringFlag{Name: "agent", Usage: "How the workflows summon the agent any @mention-driven coding agent (e.g. @codex, @claude)", Value: "@codex"},
&cli.StringFlag{Name: "agent", Usage: "How the workflows summon the agent (an @mention)", Value: "@codex"},
&cli.StringFlag{Name: "token-secret", Usage: "Repo secret holding the user PAT that drives dispatch", Value: "LOOP_TOKEN"},
&cli.StringFlag{Name: "ci-workflow", Usage: "CI workflow name(s) triage watches for failures (comma-separated)", Value: "CI"},
&cli.StringFlag{Name: "planner-cron", Usage: "Cron schedule for the planner", Value: "0 * * * *"},
+7 -28
View File
@@ -1,11 +1,9 @@
name: "Loop: Release"
# Generated by `micro loop init`. Cuts the next tag when the default branch has
# new commits since the latest one, and pushes it with a PAT (<< .TokenSecret >>)
# so any tag-triggered release workflow fires. The bump reflects what shipped,
# read from the CHANGELOG [Unreleased] section: new features (Added/Changed) cut
# a MINOR; fixes/docs only cut a PATCH; breaking changes are skipped so a MAJOR
# stays a human decision.
# Generated by `micro loop init`. Cuts the next PATCH tag
# (<< .TagPrefix >>MAJOR.MINOR.PATCH+1) when the default branch has new commits
# since the latest such tag, and pushes it with a PAT (<< .TokenSecret >>) so any
# tag-triggered release workflow fires. Minor/major bumps stay with a human.
#
# The tag MUST be pushed with a PAT, not the default GITHUB_TOKEN: a tag pushed
# by GITHUB_TOKEN does not trigger other workflows (Actions blocks that recursion).
@@ -68,30 +66,11 @@ jobs:
[0-9]*.[0-9]*.[0-9]*) ;;
*) echo "unexpected tag shape: $LATEST" ; exit 1 ;;
esac
# Choose the bump from what actually shipped, read from the CHANGELOG
# [Unreleased] section (kept current by the coherence role):
# new features (### Added / ### Changed) -> MINOR
# fixes/docs only -> PATCH
# breaking (### Removed / "(breaking)") -> skip; a major is a human call
UNRELEASED=""
if [ -f CHANGELOG.md ]; then
UNRELEASED=$(awk '/^## \[Unreleased\]/{f=1; next} /^## \[/{f=0} f' CHANGELOG.md)
fi
if printf '%s\n' "$UNRELEASED" | grep -qiE '^### Removed|^### Changed \(breaking\)|BREAKING'; then
echo "CHANGELOG [Unreleased] contains breaking changes — a major release is a human decision. Skipping."
exit 0
elif printf '%s\n' "$UNRELEASED" | grep -qE '^### (Added|Changed)'; then
NEXT="<< .TagPrefix >>${major}.$((minor + 1)).0"
KIND="minor (new features)"
else
NEXT="<< .TagPrefix >>${major}.${minor}.$((patch + 1))"
KIND="patch (fixes/docs only)"
fi
echo "cutting: $NEXT$KIND ($COUNT commits since $LATEST)"
NEXT="<< .TagPrefix >>${major}.${minor}.$((patch + 1))"
echo "cutting: $NEXT ($COUNT commits since $LATEST)"
git config user.name "loop release bot"
git config user.email "noreply@users.noreply.github.com"
git tag -a "$NEXT" -m "Release $NEXT — automated $KIND ($COUNT commits since $LATEST)"
git tag -a "$NEXT" -m "Release $NEXT — automated patch ($COUNT commits since $LATEST)"
git push "https://x-access-token:${RELEASE_TOKEN}@github.com/${REPO}.git" "$NEXT"
echo "Pushed $NEXT."
-31
View File
@@ -1,31 +0,0 @@
# Kubernetes deployment foundation (alpha)
This package is the first opt-in Kubernetes foundation for the Go Micro lifecycle:
`Service`, `Agent`, and `Flow` resources. It is intentionally experimental and
additive. Nothing in the Go Micro runtime installs these resources or changes
production defaults.
## What is included
- Alpha CRD manifests in `config/crd/` for `agents.micro.dev`,
`services.micro.dev`, and `flows.micro.dev`.
- A small dependency-free mapper that turns a desired Go Micro resource into the
Kubernetes `Deployment` shape an operator reconciliation loop will own.
- Unit tests that validate the structural CRD fragments and dry-run the
Agent-to-Deployment mapping.
## Local validation
```sh
go test ./deploy/kubernetes
```
If you have a Kubernetes cluster and `kubectl` available, you can also perform a
server-side dry run of the CRDs:
```sh
kubectl apply --dry-run=server -f deploy/kubernetes/config/crd/
```
The manifests are `v1alpha1`; expect the API shape to evolve before this becomes
a production operator.
-37
View File
@@ -1,37 +0,0 @@
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: agents.micro.dev
spec:
group: micro.dev
scope: Namespaced
names:
plural: agents
singular: agent
kind: Agent
shortNames: [magent]
versions:
- name: v1alpha1
served: true
storage: true
schema:
openAPIV3Schema:
type: object
required: [spec]
properties:
spec:
type: object
required: [image]
properties:
image: {type: string, minLength: 1}
command:
type: array
items: {type: string}
args:
type: array
items: {type: string}
replicas: {type: integer, minimum: 0}
registry: {type: string}
env:
type: object
additionalProperties: {type: string}
-37
View File
@@ -1,37 +0,0 @@
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: flows.micro.dev
spec:
group: micro.dev
scope: Namespaced
names:
plural: flows
singular: flow
kind: Flow
shortNames: [mflow]
versions:
- name: v1alpha1
served: true
storage: true
schema:
openAPIV3Schema:
type: object
required: [spec]
properties:
spec:
type: object
required: [image]
properties:
image: {type: string, minLength: 1}
command:
type: array
items: {type: string}
args:
type: array
items: {type: string}
replicas: {type: integer, minimum: 0}
registry: {type: string}
env:
type: object
additionalProperties: {type: string}
-37
View File
@@ -1,37 +0,0 @@
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: services.micro.dev
spec:
group: micro.dev
scope: Namespaced
names:
plural: services
singular: service
kind: Service
shortNames: [mservice]
versions:
- name: v1alpha1
served: true
storage: true
schema:
openAPIV3Schema:
type: object
required: [spec]
properties:
spec:
type: object
required: [image]
properties:
image: {type: string, minLength: 1}
command:
type: array
items: {type: string}
args:
type: array
items: {type: string}
replicas: {type: integer, minimum: 0}
registry: {type: string}
env:
type: object
additionalProperties: {type: string}
-8
View File
@@ -1,8 +0,0 @@
// Package kubernetes contains the experimental Kubernetes deployment foundation
// for Go Micro services, agents, and flows.
//
// The package is intentionally small and additive: it exposes alpha custom
// resource manifests and a dry-run mapper that turns a resource spec into the
// Deployment shape an operator would reconcile. It does not install an operator
// or change any runtime defaults.
package kubernetes
-87
View File
@@ -1,87 +0,0 @@
package kubernetes
import (
"strings"
"testing"
)
func TestCRDManifestsAreStructural(t *testing.T) {
for _, kind := range []Kind{KindAgent, KindService, KindFlow} {
manifest := CRDManifests[kind]
if manifest == "" {
t.Fatalf("missing manifest for %s", kind)
}
checks := []string{
"apiVersion: apiextensions.k8s.io/v1",
"kind: CustomResourceDefinition",
"group: micro.dev",
"kind: " + string(kind),
"name: v1alpha1",
"served: true",
"storage: true",
"openAPIV3Schema:",
"type: object",
"required: [image]",
}
for _, check := range checks {
if !strings.Contains(manifest, check) {
t.Fatalf("%s manifest missing %q:\n%s", kind, check, manifest)
}
}
}
}
func TestMapDeploymentForAgent(t *testing.T) {
deployment, err := MapDeployment(Resource{
Kind: KindAgent,
Name: "support-agent",
Namespace: "agents",
Spec: WorkloadSpec{
Image: "ghcr.io/acme/support-agent:v1",
Replicas: 2,
Registry: "kubernetes",
Environment: map[string]string{
"MODEL": "gpt-5.5",
},
},
})
if err != nil {
t.Fatalf("MapDeployment returned error: %v", err)
}
if deployment.Name != "support-agent" || deployment.Namespace != "agents" {
t.Fatalf("unexpected identity: %+v", deployment)
}
if deployment.Replicas != 2 {
t.Fatalf("replicas = %d, want 2", deployment.Replicas)
}
if got := deployment.Labels["micro.dev/kind"]; got != "agent" {
t.Fatalf("micro.dev/kind label = %q, want agent", got)
}
container := deployment.Pod.Container
if container.Image != "ghcr.io/acme/support-agent:v1" {
t.Fatalf("image = %q", container.Image)
}
if got := container.Environment["MICRO_REGISTRY"]; got != "kubernetes" {
t.Fatalf("MICRO_REGISTRY = %q, want kubernetes", got)
}
if got := container.Environment["MODEL"]; got != "gpt-5.5" {
t.Fatalf("MODEL = %q, want gpt-5.5", got)
}
}
func TestMapDeploymentDefaultsAndValidation(t *testing.T) {
deployment, err := MapDeployment(Resource{Kind: KindService, Name: "api", Spec: WorkloadSpec{Image: "api:latest"}})
if err != nil {
t.Fatalf("MapDeployment returned error: %v", err)
}
if deployment.Namespace != "default" || deployment.Replicas != 1 {
t.Fatalf("defaults = namespace %q replicas %d", deployment.Namespace, deployment.Replicas)
}
if _, err := MapDeployment(Resource{Kind: KindFlow, Name: "ingest"}); err == nil {
t.Fatal("MapDeployment without image succeeded")
}
if _, err := MapDeployment(Resource{Kind: "Job", Name: "job", Spec: WorkloadSpec{Image: "job:latest"}}); err == nil {
t.Fatal("MapDeployment with unsupported kind succeeded")
}
}
-32
View File
@@ -1,32 +0,0 @@
package kubernetes
import (
"embed"
"fmt"
)
// crdFS holds the canonical CRD manifests. They live as real YAML under
// config/crd/ so they can be applied directly (`kubectl apply -f
// deploy/kubernetes/config/crd/`) and are embedded here so the Go API serves
// the exact same bytes — one source of truth, no drift.
//
//go:embed config/crd/agent.yaml config/crd/service.yaml config/crd/flow.yaml
var crdFS embed.FS
// CRDManifests contains the alpha CRDs for Go Micro lifecycle resources, loaded
// from the embedded config/crd/ YAML.
var CRDManifests = map[Kind]string{
KindAgent: mustCRD("agent"),
KindService: mustCRD("service"),
KindFlow: mustCRD("flow"),
}
// mustCRD reads an embedded CRD manifest. The files are embedded at compile
// time, so a read error means a build/packaging bug, not a runtime condition.
func mustCRD(name string) string {
b, err := crdFS.ReadFile("config/crd/" + name + ".yaml")
if err != nil {
panic(fmt.Sprintf("kubernetes: embedded CRD %q missing: %v", name, err))
}
return string(b)
}
-138
View File
@@ -1,138 +0,0 @@
package kubernetes
import (
"fmt"
"sort"
"strings"
)
const (
// Group is the API group for the alpha Go Micro Kubernetes resources.
Group = "micro.dev"
// Version is the current alpha API version for the CRDs in this package.
Version = "v1alpha1"
)
// Kind identifies a Go Micro lifecycle resource that can be reconciled toward a
// Kubernetes Deployment.
type Kind string
const (
KindAgent Kind = "Agent"
KindService Kind = "Service"
KindFlow Kind = "Flow"
)
// WorkloadSpec is the common alpha spec shared by Agent, Service, and Flow CRDs.
type WorkloadSpec struct {
Image string `json:"image"`
Command []string `json:"command,omitempty"`
Args []string `json:"args,omitempty"`
Replicas int32 `json:"replicas,omitempty"`
Registry string `json:"registry,omitempty"`
Environment map[string]string `json:"env,omitempty"`
}
// Resource is the minimal desired state for a Go Micro lifecycle resource.
type Resource struct {
Kind Kind
Name string
Namespace string
Spec WorkloadSpec
}
// Deployment is a small, dependency-free representation of the Kubernetes
// Deployment fields the alpha reconciler skeleton owns.
type Deployment struct {
Name string
Namespace string
Labels map[string]string
Replicas int32
Pod PodTemplate
}
// PodTemplate describes the pod fields emitted by MapDeployment.
type PodTemplate struct {
Labels map[string]string
Container Container
}
// Container describes the single Go Micro workload container.
type Container struct {
Name string
Image string
Command []string
Args []string
Environment map[string]string
}
// MapDeployment maps a Go Micro alpha resource to the Deployment shape an
// operator reconciliation loop would apply.
func MapDeployment(resource Resource) (Deployment, error) {
if resource.Kind != KindAgent && resource.Kind != KindService && resource.Kind != KindFlow {
return Deployment{}, fmt.Errorf("unsupported kind %q", resource.Kind)
}
name := strings.TrimSpace(resource.Name)
if name == "" {
return Deployment{}, fmt.Errorf("name is required")
}
image := strings.TrimSpace(resource.Spec.Image)
if image == "" {
return Deployment{}, fmt.Errorf("spec.image is required")
}
namespace := strings.TrimSpace(resource.Namespace)
if namespace == "" {
namespace = "default"
}
replicas := resource.Spec.Replicas
if replicas == 0 {
replicas = 1
}
labels := map[string]string{
"app.kubernetes.io/name": name,
"app.kubernetes.io/managed-by": "go-micro",
"micro.dev/kind": strings.ToLower(string(resource.Kind)),
}
env := copyMap(resource.Spec.Environment)
if resource.Spec.Registry != "" {
env["MICRO_REGISTRY"] = resource.Spec.Registry
}
return Deployment{
Name: name,
Namespace: namespace,
Labels: copyMap(labels),
Replicas: replicas,
Pod: PodTemplate{
Labels: copyMap(labels),
Container: Container{
Name: name,
Image: image,
Command: append([]string(nil), resource.Spec.Command...),
Args: append([]string(nil), resource.Spec.Args...),
Environment: env,
},
},
}, nil
}
// EnvironmentKeys returns stable environment variable keys from a mapped
// container. It is useful for deterministic validation and rendering.
func (c Container) EnvironmentKeys() []string {
keys := make([]string, 0, len(c.Environment))
for key := range c.Environment {
keys = append(keys, key)
}
sort.Strings(keys)
return keys
}
func copyMap(in map[string]string) map[string]string {
out := make(map[string]string, len(in))
for k, v := range in {
out[k] = v
}
return out
}
+37 -84
View File
@@ -36,9 +36,6 @@ type subscriber struct {
retryLimit int
autoAck bool
ackWait time.Duration
pending []Event
notify chan struct{}
}
type mem struct {
@@ -127,7 +124,6 @@ func (m *mem) Consume(topic string, opts ...ConsumeOption) (<-chan Event, error)
retryMap: map[string]int{},
autoAck: true,
retryLimit: options.GetRetryLimit(),
notify: make(chan struct{}, 1),
}
if !options.AutoAck {
@@ -136,7 +132,6 @@ func (m *mem) Consume(topic string, opts ...ConsumeOption) (<-chan Event, error)
}
sub.autoAck = options.AutoAck
sub.ackWait = options.AckWait
go sub.dispatchManualAck()
}
// register the subscriber
@@ -202,98 +197,56 @@ func (m *mem) handleEvent(ev *Event) {
}
func sendEvent(ev *Event, sub *subscriber) {
evCopy := *ev
if !sub.autoAck {
sub.Lock()
sub.pending = append(sub.pending, evCopy)
sub.Unlock()
sub.wake()
return
}
go func(s *subscriber) {
s.Channel <- evCopy
}(sub)
}
func (s *subscriber) wake() {
select {
case s.notify <- struct{}{}:
default:
}
}
func (s *subscriber) dispatchManualAck() {
for {
s.Lock()
for len(s.pending) == 0 {
s.Unlock()
<-s.notify
s.Lock()
}
ev := s.pending[0]
s.pending = s.pending[1:]
s.retryMap[ev.ID] = 0
s.Unlock()
s.deliverManualAck(ev)
}
}
func (s *subscriber) deliverManualAck(ev Event) {
retries := 0
for {
if s.retryLimit > -1 && retries > s.retryLimit {
if logger.V(logger.ErrorLevel, logger.DefaultLogger) {
logger.Errorf("Message retry limit reached, discarding: %v %d %d", ev.ID, retries, s.retryLimit)
}
s.Lock()
delete(s.retryMap, ev.ID)
s.Unlock()
evCopy := *ev
if s.autoAck {
s.Channel <- evCopy
return
}
result := make(chan bool, 1)
evCopy := ev
evCopy.SetAckFunc(func() error {
select {
case result <- true:
default:
evCopy.SetAckFunc(ackFunc(s, evCopy))
evCopy.SetNackFunc(nackFunc(s, evCopy))
s.Lock()
s.retryMap[evCopy.ID] = 0
s.Unlock()
tick := time.NewTicker(s.ackWait)
defer tick.Stop()
for range tick.C {
s.Lock()
count, ok := s.retryMap[evCopy.ID]
s.Unlock()
if !ok {
// success
break
}
return nil
})
evCopy.SetNackFunc(func() error {
select {
case result <- false:
default:
}
return nil
})
s.Channel <- evCopy
timer := time.NewTimer(s.ackWait)
select {
case acked := <-result:
if !timer.Stop() {
select {
case <-timer.C:
default:
if s.retryLimit > -1 && count > s.retryLimit {
if logger.V(logger.ErrorLevel, logger.DefaultLogger) {
logger.Errorf("Message retry limit reached, discarding: %v %d %d", evCopy.ID, count, s.retryLimit)
}
}
if acked {
s.Lock()
delete(s.retryMap, ev.ID)
delete(s.retryMap, evCopy.ID)
s.Unlock()
return
}
retries++
case <-timer.C:
retries++
s.Channel <- evCopy
s.Lock()
s.retryMap[evCopy.ID] = count + 1
s.Unlock()
}
}(sub)
}
func ackFunc(s *subscriber, evCopy Event) func() error {
return func() error {
s.Lock()
s.retryMap[ev.ID] = retries
delete(s.retryMap, evCopy.ID)
s.Unlock()
return nil
}
}
func nackFunc(_ *subscriber, _ Event) func() error {
return func() error {
return nil
}
}
-8
View File
@@ -157,7 +157,6 @@ func runTestStream(t *testing.T, stream Stream) {
assert.NoError(t, err, "Unexpected error subscribing")
assert.NoError(t, stream.Publish("foobarAck", map[string]string{"foo": "message 1"}))
assert.NoError(t, stream.Publish("foobarAck", map[string]string{"foo": "message 2"}))
assert.NoError(t, stream.Publish("foobarAck", map[string]string{"foo": "message 3"}))
ev := <-ch
ev.Ack()
@@ -171,13 +170,6 @@ func runTestStream(t *testing.T, stream Stream) {
case <-time.After(7 * time.Second):
t.Fatalf("Timed out waiting for message to be put back on queue")
}
select {
case ev = <-ch:
assert.NotEqual(t, ev.ID, nacked, "Queued message should only be received after the nacked message is redelivered")
assert.NoError(t, ev.Ack())
case <-time.After(7 * time.Second):
t.Fatalf("Timed out waiting for queued message")
}
})
+1 -4
View File
@@ -12,7 +12,6 @@ provider-free unless the example README says otherwise.
| Prove the maintained 0→hero path | [`support`](./support/) | `go run ./examples/support` and `go test ./examples/support` | [`zero-to-hero` guide](../internal/website/docs/guides/zero-to-hero.md) |
| See planning and delegation | [`agent-plan-delegate`](./agent-plan-delegate/) | `go run ./examples/agent-plan-delegate` | [`plan-delegate` guide](../internal/website/docs/guides/plan-delegate.md) |
| Expose services through MCP | [`mcp/hello`](./mcp/hello/) | follow [`mcp`](./mcp/) setup | [`mcp/crud`](./mcp/crud/) and [`mcp/workflow`](./mcp/workflow/) |
| Try a paid tool with x402 | [`agent-x402-buyer`](./agent-x402-buyer/) | `go run ./examples/agent-x402-buyer` | [`Payments (x402)` guide](../internal/website/docs/guides/x402-payments.md) |
| Try A2A or gRPC interop next | [`agent-demo`](./agent-demo/) plus gateway docs | run the example, then use the gateway docs | [`grpc-interop`](./grpc-interop/) |
| Add workflow durability | [`flow-durable`](./flow-durable/) | `go run ./examples/flow-durable` | [`flow-loop`](./flow-loop/) |
@@ -29,9 +28,7 @@ provider-free unless the example README says otherwise.
4. **Interop next:** use [`mcp/hello`](./mcp/hello/), [`mcp/crud`](./mcp/crud/),
and [`mcp/workflow`](./mcp/workflow/) when you are ready to expose tools to
external AI clients.
5. **Paid tools:** run [`agent-x402-buyer`](./agent-x402-buyer/) to see an
agent pay a local x402-protected tool with a mock facilitator and budget.
6. **Workflow depth:** use [`flow-durable`](./flow-durable/) once the agent path
5. **Workflow depth:** use [`flow-durable`](./flow-durable/) once the agent path
needs checkpointed, resumable deterministic work.
## CLI wayfinding
-24
View File
@@ -1,24 +0,0 @@
# Agent x402 buyer
This example shows an agent paying for a paid HTTP tool with x402 without using
live funds or a live chain.
It starts a local paid endpoint guarded by `wrapper/x402` seller middleware and a
mock facilitator. A deterministic mock-model agent calls that endpoint as a tool,
receives the HTTP 402 challenge, pays with `AgentPayer`, stays inside
`AgentBudget`, retries the request, and prints the spend recorded for the run.
```bash
go run ./examples/agent-x402-buyer
```
Expected output includes:
- the paid tool response,
- one facilitator verify and settle call, and
- `run spend: 7 smallest units (budget 10)`.
The payment token and facilitator are intentionally local development fakes. To
settle real x402 payments, keep the same `AgentPayer` / `AgentBudget` shape but
replace the payer with a wallet-backed implementation and configure the seller
middleware with a hosted or self-run x402 facilitator.
-168
View File
@@ -1,168 +0,0 @@
// Agent x402 buyer — a provider-free example of an agent paying for a paid tool.
//
// Run:
//
// go run ./examples/agent-x402-buyer
//
// It starts a local HTTP tool protected by x402 middleware, then asks a
// deterministic mock-model agent to call that tool. The agent receives the 402
// challenge, uses AgentPayer and AgentBudget to pay within a local mock
// facilitator, retries the request, and prints the run spend.
package main
import (
"context"
"encoding/json"
"fmt"
"io"
"net/http"
"net/http/httptest"
"os"
"strings"
go_micro "go-micro.dev/v6"
"go-micro.dev/v6/agent"
"go-micro.dev/v6/ai"
"go-micro.dev/v6/store"
"go-micro.dev/v6/wrapper/x402"
)
const (
paidToolName = "paid.market_brief"
price = int64(7)
paymentToken = "dev-payment-token"
)
type devFacilitator struct {
verifyCount int
settleCount int
}
func (f *devFacilitator) Verify(ctx context.Context, payment string, req x402.Requirements) (x402.Result, error) {
f.verifyCount++
if payment != paymentToken {
return x402.Result{Valid: false, Reason: "unknown dev payment token"}, nil
}
return x402.Result{Valid: true, Payer: "dev-agent-wallet"}, nil
}
func (f *devFacilitator) Settle(ctx context.Context, payment string, req x402.Requirements) (x402.Result, error) {
f.settleCount++
return x402.Result{Valid: true, Settlement: "dev-settlement-001"}, nil
}
type devPayer struct{}
func (devPayer) Pay(ctx context.Context, req x402.Requirements) (string, error) {
return paymentToken, nil
}
type mockModel struct{ opts ai.Options }
func newMock(opts ...ai.Option) ai.Model {
m := &mockModel{}
_ = m.Init(opts...)
return m
}
func (m *mockModel) Init(opts ...ai.Option) error {
for _, o := range opts {
o(&m.opts)
}
return nil
}
func (m *mockModel) Options() ai.Options { return m.opts }
func (m *mockModel) String() string { return "agent-x402-buyer-mock" }
func (m *mockModel) Stream(context.Context, *ai.Request, ...ai.GenerateOption) (ai.Stream, error) {
return nil, fmt.Errorf("stream not supported by agent-x402-buyer mock")
}
func (m *mockModel) Generate(ctx context.Context, req *ai.Request, _ ...ai.GenerateOption) (*ai.Response, error) {
for _, tool := range req.Tools {
if tool.Name == paidToolName && m.opts.ToolHandler != nil {
out := m.opts.ToolHandler(ctx, ai.ToolCall{ID: "paid-brief", Name: tool.Name, Input: map[string]any{"url": req.Prompt}})
return &ai.Response{Answer: fmt.Sprintf("Paid tool returned: %s", out.Content)}, nil
}
}
return &ai.Response{Answer: "No paid tool was available."}, nil
}
func paidToolServer(fac *devFacilitator) *httptest.Server {
mux := http.NewServeMux()
paid := x402.Middleware(x402.Config{
PayTo: "0xMerchantDevWallet",
Network: "base-sepolia",
Amount: fmt.Sprint(price),
Description: "Local market brief for the x402 buyer example",
Facilitator: fac,
})
mux.Handle("/brief", paid(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "application/json")
_ = json.NewEncoder(w).Encode(map[string]any{
"brief": "Mock demand is up 12% after the agent paid the local tool.",
"settlement": w.Header().Get(x402.PaymentResponseHeader),
})
})))
return httptest.NewServer(mux)
}
func run(w io.Writer) error {
ai.Register("agent-x402-buyer-mock", newMock)
fac := &devFacilitator{}
srv := paidToolServer(fac)
defer srv.Close()
st := store.NewMemoryStore()
buyer := agent.New(
agent.Name("x402-buyer"),
agent.Provider("agent-x402-buyer-mock"),
agent.Prompt("Call the paid market brief tool when given its URL."),
agent.WithStore(st),
go_micro.AgentPayer(devPayer{}),
go_micro.AgentBudget(10),
agent.WithTool(paidToolName, "Fetch a paid market brief over HTTP", map[string]any{
"url": map[string]any{"type": "string", "description": "Paid HTTP endpoint to call"},
}, func(ctx context.Context, input map[string]any) (string, error) {
url, _ := input["url"].(string)
resp, err := http.Get(url)
if err != nil {
return "", err
}
defer resp.Body.Close()
body, err := io.ReadAll(resp.Body)
if err != nil {
return "", err
}
return string(body), nil
}),
)
resp, err := buyer.Ask(context.Background(), srv.URL+"/brief")
if err != nil {
return err
}
events, err := agent.LoadRunEvents(st, "x402-buyer", resp.RunID)
if err != nil {
return err
}
var spent int64
for _, event := range events {
if event.Spent > spent {
spent = event.Spent
}
}
fmt.Fprintln(w, "Agent x402 buyer (provider: mock, funds: local dev token)")
fmt.Fprintln(w, strings.TrimSpace(resp.Reply))
fmt.Fprintf(w, "facilitator verify=%d settle=%d\n", fac.verifyCount, fac.settleCount)
fmt.Fprintf(w, "run spend: %d smallest units (budget 10)\n", spent)
return nil
}
func main() {
if err := run(os.Stdout); err != nil {
fmt.Println(err)
os.Exit(1)
}
}
+2 -19
View File
@@ -34,22 +34,5 @@ CI keeps this path runnable with:
go test ./examples/first-agent
```
## Next chat, inspect, and debug breadcrumbs
This example exits after one in-process `assistant.Ask` call so it stays tiny and
provider-free. When you move from this transcript to a long-running agent, keep
these commands nearby:
```bash
micro run
micro chat assistant --prompt "Summarize my next steps"
micro inspect agent assistant
micro agent doctor assistant
```
Use the [no-secret first-agent guide](../../internal/website/docs/guides/no-secret-first-agent.md)
to compare this transcript with the CLI demo, then keep the
[debugging guide](../../internal/website/docs/guides/debugging-agents.md) open for
preflight, doctor, inspect, and history checks. After that, continue to
[`examples/support`](../support/) for the full services → agents → workflows
lifecycle with a flow trigger and an approval gate.
After this, continue to [`examples/support`](../support/) for the full services →
agents → workflows lifecycle with a flow trigger and an approval gate.
+7 -12
View File
@@ -13,7 +13,6 @@ package main
import (
"context"
"fmt"
"io"
"os"
"strings"
"time"
@@ -34,13 +33,13 @@ type ListNotesResponse struct {
Notes []string `json:"notes" description:"Notes the assistant can summarize"`
}
type NotesService struct{ w io.Writer }
type NotesService struct{}
// List returns the starter notes the first agent can read.
// @example {}
func (s *NotesService) List(ctx context.Context, req *ListNotesRequest, rsp *ListNotesResponse) error {
rsp.Notes = []string{"Install the micro CLI", "Run a service", "Chat with an agent"}
fmt.Fprintln(s.w, " [notes] listed starter notes")
fmt.Println(" [notes] listed starter notes")
return nil
}
@@ -91,10 +90,6 @@ func waitFor(reg registry.Registry, names ...string) error {
}
func runFirstAgent() error {
return runFirstAgentWithWriter(os.Stdout)
}
func runFirstAgentWithWriter(w io.Writer) error {
ai.Register("first-agent-mock", newMock)
reg := registry.NewMemoryRegistry()
@@ -109,7 +104,7 @@ func runFirstAgentWithWriter(w io.Writer) error {
cl := client.NewClient(client.Registry(reg), client.Selector(selector.NewSelector(selector.Registry(reg))), client.Broker(br))
notes := service.New(service.Name("notes"), service.Address("127.0.0.1:0"), service.Registry(reg), service.Client(cl), service.Broker(br), service.HandleSignal(false))
if err := notes.Handle(&NotesService{w: w}); err != nil {
if err := notes.Handle(new(NotesService)); err != nil {
return fmt.Errorf("handle notes: %w", err)
}
svcErr := make(chan error, 1)
@@ -142,14 +137,14 @@ func runFirstAgentWithWriter(w io.Writer) error {
return err
}
fmt.Fprintln(w, "First agent (provider: mock, no API key)")
fmt.Fprintln(w, "> Summarize my next steps")
fmt.Println("First agent (provider: mock, no API key)")
fmt.Println("> Summarize my next steps")
resp, err := assistant.Ask(context.Background(), "Summarize my next steps")
if err != nil {
return fmt.Errorf("ask assistant: %w", err)
}
fmt.Fprintln(w, "assistant:", resp.Reply)
fmt.Fprintln(w, "✓ service-backed agent completed without provider secrets")
fmt.Println("assistant:", resp.Reply)
fmt.Println("✓ service-backed agent completed without provider secrets")
return nil
}
+2 -64
View File
@@ -1,71 +1,9 @@
package main
import (
"bytes"
"os"
"strings"
"testing"
)
import "testing"
func TestRunFirstAgent(t *testing.T) {
var out bytes.Buffer
if err := runFirstAgentWithWriter(&out); err != nil {
if err := runFirstAgent(); err != nil {
t.Fatalf("first-agent example failed: %v", err)
}
want := strings.TrimSpace(readExpectedTranscript(t))
got := strings.TrimSpace(out.String())
if got != want {
t.Fatalf("first-agent transcript drifted from README.md\n--- got ---\n%s\n--- want ---\n%s", got, want)
}
}
func TestReadmeDocumentsNextBreadcrumbs(t *testing.T) {
b, err := os.ReadFile("README.md")
if err != nil {
t.Fatalf("read README.md: %v", err)
}
readme := string(b)
start := strings.Index(readme, "## Next chat, inspect, and debug breadcrumbs")
if start < 0 {
t.Fatal("README.md missing next chat, inspect, and debug breadcrumbs section")
}
section := readme[start:]
for _, want := range []string{
"micro run",
"micro chat assistant --prompt \"Summarize my next steps\"",
"micro inspect agent assistant",
"micro agent doctor assistant",
"no-secret-first-agent.md",
"debugging-agents.md",
"examples/support",
} {
if !strings.Contains(section, want) {
t.Fatalf("README.md next breadcrumbs missing %q", want)
}
}
}
func readExpectedTranscript(t *testing.T) string {
t.Helper()
b, err := os.ReadFile("README.md")
if err != nil {
t.Fatalf("read README.md: %v", err)
}
readme := string(b)
const fence = "```text"
start := strings.Index(readme, "Expected transcript:")
if start < 0 {
t.Fatal("README.md missing Expected transcript section")
}
fenceStart := strings.Index(readme[start:], fence)
if fenceStart < 0 {
t.Fatal("README.md missing transcript text fence")
}
start += fenceStart + len(fence)
end := strings.Index(readme[start:], "```")
if end < 0 {
t.Fatal("README.md missing closing transcript fence")
}
return readme[start : start+end]
}
-26
View File
@@ -54,32 +54,6 @@ agent, which:
emailing a customer (`notify.Send`) passes through the gate first. Return
`false` to hold it for a person or a policy; the example approves and logs.
## Expected inspect transcript
The provider-free run prints the same visible checkpoints a new developer should
compare against after chat and flow execution. The transcript includes service
tool calls, the approval gate, and the inspect/run-history commands that prove
the workflow run was recorded.
```text
> event: events.ticket.created {"customer":"alice@acme.com","id":"ticket-1","subject":"Can't log in"}
[customers] looked up Alice (pro plan)
[tickets] ticket-1 → priority=high status=in_progress
▣ approval gate notify_NotifyService_Send(alice@acme.com) — approved
[notify] 📨 to=alice@acme.com: "Hi Alice — thanks for reaching out. We've bumped this to high priority and are on it."
support agent: Triaged ticket-1 for Alice and sent a reply.
inspect transcript:
micro inspect flow intake
flow: intake runs=1 latest.reply="Triaged ticket-1 for Alice and sent a reply."
micro agent history support
agent: support runs=1 latest.status=completed
✓ ticket triaged and the customer was replied to — triggered by an event
```
## Run
```bash
+1 -7
View File
@@ -302,13 +302,7 @@ func runSupport(provider string) error {
}
if rs := intake.Results(); len(rs) > 0 {
latest := rs[len(rs)-1]
fmt.Printf("\n\033[1msupport agent:\033[0m %s\n", latest.Reply)
fmt.Println("\n\033[1minspect transcript:\033[0m")
fmt.Println(" micro inspect flow intake")
fmt.Printf(" flow: intake runs=%d latest.reply=%q\n", len(rs), latest.Reply)
fmt.Println(" micro agent history support")
fmt.Printf(" agent: support runs=%d latest.status=completed\n", len(rs))
fmt.Printf("\n\033[1msupport agent:\033[0m %s\n", rs[len(rs)-1].Reply)
}
if notify.sent >= 1 {
fmt.Println("\n\033[32m✓ ticket triaged and the customer was replied to — triggered by an event\033[0m")
-78
View File
@@ -1,10 +1,7 @@
package main
import (
"bytes"
"io"
"os"
"regexp"
"strings"
"testing"
)
@@ -33,78 +30,3 @@ func TestZeroToHeroReadmeDocumentsLifecycle(t *testing.T) {
}
}
}
func TestZeroToHeroInspectTranscript(t *testing.T) {
out := captureStdout(t, func() {
if err := runSupport("mock"); err != nil {
t.Fatalf("support example failed: %v", err)
}
})
got := stripANSI(out)
for _, want := range []string{
`> event: events.ticket.created {"customer":"alice@acme.com","id":"ticket-1","subject":"Can't log in"}`,
`[customers] looked up Alice (pro plan)`,
`[tickets] ticket-1 → priority=high status=in_progress`,
`approval gate notify_NotifyService_Send(alice@acme.com) — approved`,
`[notify] 📨 to=alice@acme.com: "Hi Alice — thanks for reaching out. We've bumped this to high priority and are on it."`,
`support agent: Triaged ticket-1 for Alice and sent a reply.`,
`inspect transcript:`,
`micro inspect flow intake`,
`flow: intake runs=1 latest.reply="Triaged ticket-1 for Alice and sent a reply."`,
`micro agent history support`,
`agent: support runs=1 latest.status=completed`,
`✓ ticket triaged and the customer was replied to — triggered by an event`,
} {
if !strings.Contains(got, want) {
t.Fatalf("support transcript missing %q\n--- got ---\n%s", want, got)
}
}
readme, err := os.ReadFile("README.md")
if err != nil {
t.Fatalf("read README.md: %v", err)
}
for _, want := range []string{
"Expected inspect transcript",
"micro inspect flow intake",
"micro agent history support",
"agent: support runs=1 latest.status=completed",
} {
if !strings.Contains(string(readme), want) {
t.Fatalf("README.md missing transcript contract %q", want)
}
}
}
func captureStdout(t *testing.T, fn func()) (out string) {
t.Helper()
old := os.Stdout
r, w, err := os.Pipe()
if err != nil {
t.Fatalf("capture stdout: %v", err)
}
os.Stdout = w
var buf bytes.Buffer
done := make(chan struct{})
go func() {
_, _ = io.Copy(&buf, r)
close(done)
}()
defer func() {
_ = w.Close()
os.Stdout = old
<-done
out = buf.String()
}()
fn()
return out
}
var ansiRE = regexp.MustCompile(`\x1b\[[0-9;]*m`)
func stripANSI(s string) string {
return ansiRE.ReplaceAllString(s, "")
}
+44 -136
View File
@@ -108,9 +108,6 @@ func NewAgentHandler(card AgentCard, invoke Invoke) http.Handler {
card.URL = strings.TrimRight(card.URL, "/")
serveCard := func(w http.ResponseWriter, _ *http.Request) { writeJSON(w, http.StatusOK, card) }
mux.HandleFunc("GET /{$}", serveCard)
// A2A 0.3.0 discovery is /.well-known/agent-card.json; agent.json is the
// pre-0.3 alias, kept so existing clients don't break.
mux.HandleFunc("GET /.well-known/agent-card.json", serveCard)
mux.HandleFunc("GET /.well-known/agent.json", serveCard)
mux.HandleFunc("POST /{$}", func(w http.ResponseWriter, r *http.Request) { d.serve(w, r, invoke) })
return mux
@@ -124,7 +121,6 @@ func NewAgentStreamHandler(card AgentCard, invoke Invoke, stream StreamInvoke) h
card.URL = strings.TrimRight(card.URL, "/")
serveCard := func(w http.ResponseWriter, _ *http.Request) { writeJSON(w, http.StatusOK, card) }
mux.HandleFunc("GET /{$}", serveCard)
mux.HandleFunc("GET /.well-known/agent-card.json", serveCard)
mux.HandleFunc("GET /.well-known/agent.json", serveCard)
mux.HandleFunc("POST /{$}", func(w http.ResponseWriter, r *http.Request) { d.serveWithStream(w, r, invoke, stream) })
return mux
@@ -143,19 +139,15 @@ func (g *Gateway) Handler() http.Handler {
// Discovery: a directory of all agent cards.
mux.HandleFunc("GET /agents", g.handleList)
// Per-agent card (served at the agent's url and at its well-known path).
// A2A 0.3.0 uses agent-card.json; agent.json is the pre-0.3 alias.
mux.HandleFunc("GET /agents/{name}", g.handleCard)
mux.HandleFunc("GET /agents/{name}/.well-known/agent-card.json", g.handleCard)
mux.HandleFunc("GET /agents/{name}/.well-known/agent.json", g.handleCard)
mux.HandleFunc("GET /agents/{name}/skills/{skill}", g.handleSkillCard)
mux.HandleFunc("GET /agents/{name}/skills/{skill}/.well-known/agent-card.json", g.handleSkillCard)
mux.HandleFunc("GET /agents/{name}/skills/{skill}/.well-known/agent.json", g.handleSkillCard)
// Per-agent JSON-RPC endpoint.
mux.HandleFunc("POST /agents/{name}", g.handleRPC)
mux.HandleFunc("POST /agents/{name}/skills/{skill}", g.handleSkillRPC)
// Top-level well-known: serve the single agent's card if there's
// exactly one, otherwise point to the directory.
mux.HandleFunc("GET /.well-known/agent-card.json", g.handleWellKnown)
mux.HandleFunc("GET /.well-known/agent.json", g.handleWellKnown)
return mux
}
@@ -230,39 +222,6 @@ type Artifact struct {
Parts []Part `json:"parts"`
}
// TaskStatusUpdateEvent is an A2A streaming event reporting a change in a
// task's status. External SSE clients parse stream events by `kind` and stop
// on the event whose `final` is true — a full Task snapshot (which older
// versions emitted) carries neither, so strict clients never terminate.
type TaskStatusUpdateEvent struct {
TaskID string `json:"taskId"`
ContextID string `json:"contextId"`
Kind string `json:"kind"` // "status-update"
Status TaskStatus `json:"status"`
Final bool `json:"final"`
}
// TaskArtifactUpdateEvent is an A2A streaming event carrying an artifact (or,
// with Append, one incremental chunk of one).
type TaskArtifactUpdateEvent struct {
TaskID string `json:"taskId"`
ContextID string `json:"contextId"`
Kind string `json:"kind"` // "artifact-update"
Artifact Artifact `json:"artifact"`
Append bool `json:"append,omitempty"`
LastChunk bool `json:"lastChunk,omitempty"`
}
func statusUpdateEvent(t *Task, final bool) TaskStatusUpdateEvent {
return TaskStatusUpdateEvent{
TaskID: t.ID,
ContextID: t.ContextID,
Kind: "status-update",
Status: t.Status,
Final: final,
}
}
// Task is the unit of work returned by message/send and tasks/get.
type Task struct {
ID string `json:"id"`
@@ -575,11 +534,14 @@ func (d *dispatcher) stream(ctx context.Context, w http.ResponseWriter, req rpcR
writeRPC(w, req.ID, nil, e)
return
}
enc, flush := sseResponse(w)
// The Task snapshot first (carries ids and the final artifact), then a
// terminal status-update so external SSE clients see `final:true` and stop.
writeSSE(enc, flush, req.ID, task)
writeSSE(enc, flush, req.ID, statusUpdateEvent(task, true))
w.Header().Set("Content-Type", "text/event-stream")
w.Header().Set("Cache-Control", "no-cache")
w.Header().Set("Connection", "keep-alive")
w.WriteHeader(http.StatusOK)
_ = json.NewEncoder(sseWriter{w: w}).Encode(rpcResponse{JSONRPC: "2.0", ID: req.ID, Result: task})
if f, ok := w.(http.Flusher); ok {
f.Flush()
}
}
func (d *dispatcher) streamChunks(ctx context.Context, w http.ResponseWriter, req rpcRequest, invoke StreamInvoke, fallback Invoke) {
@@ -603,53 +565,46 @@ func (d *dispatcher) streamChunks(ctx context.Context, w http.ResponseWriter, re
return
}
defer stream.Close()
enc, flush := sseResponse(w)
w.Header().Set("Content-Type", "text/event-stream")
w.Header().Set("Cache-Control", "no-cache")
w.Header().Set("Connection", "keep-alive")
w.WriteHeader(http.StatusOK)
enc := json.NewEncoder(sseWriter{w: w})
flush := func() {
if f, ok := w.(http.Flusher); ok {
f.Flush()
}
}
taskID := uuid.New().String()
contextID := p.Message.ContextID
if contextID == "" {
contextID = uuid.New().String()
}
// One artifact id for the whole stream so append:true chunks target it.
artifactID := uuid.New().String()
// Open with the Task snapshot (working) so the client learns the ids.
initial := taskFromReplyWithIDs(p.Message, "", stateWorking, taskID, contextID)
d.store(initial)
writeSSE(enc, flush, req.ID, initial)
var reply strings.Builder
for {
chunk, err := stream.Recv()
if err == io.EOF {
task := taskFromReplyWithIDs(p.Message, reply.String(), stateCompleted, taskID, contextID)
d.store(task)
// Spec-shaped terminal: a status-update with final:true — not a
// full Task snapshot, which carries no terminal marker.
writeSSE(enc, flush, req.ID, statusUpdateEvent(task, true))
_ = enc.Encode(rpcResponse{JSONRPC: "2.0", ID: req.ID, Result: task})
flush()
return
}
if err != nil {
task := taskFromReplyWithIDs(p.Message, "error: "+err.Error(), stateFailed, taskID, contextID)
d.store(task)
// A failed status-update (final) — never `result` and `error`
// together in one response, which strict clients reject.
writeSSE(enc, flush, req.ID, statusUpdateEvent(task, true))
_ = enc.Encode(rpcResponse{JSONRPC: "2.0", ID: req.ID, Result: task, Error: &rpcError{Code: errInternal, Message: err.Error()}})
flush()
return
}
if chunk == nil || chunk.Reply == "" {
continue
}
reply.WriteString(chunk.Reply)
// Emit the delta as an append artifact-update; keep the stored task
// current for tasks/get and resubscribe watchers.
d.store(taskFromReplyWithIDs(p.Message, reply.String(), stateWorking, taskID, contextID))
writeSSE(enc, flush, req.ID, TaskArtifactUpdateEvent{
TaskID: taskID,
ContextID: contextID,
Kind: "artifact-update",
Artifact: Artifact{ArtifactID: artifactID, Parts: []Part{{Kind: "text", Text: chunk.Reply}}},
Append: true,
})
task := taskFromReplyWithIDs(p.Message, reply.String(), stateWorking, taskID, contextID)
d.store(task)
_ = enc.Encode(rpcResponse{JSONRPC: "2.0", ID: req.ID, Result: task})
flush()
}
}
@@ -672,9 +627,6 @@ func (d *dispatcher) run(ctx context.Context, params json.RawMessage, invoke Inv
reply = err.Error()
state = stateInputRequired
}
} else if strings.TrimSpace(reply) == "" {
reply = "error: agent returned an empty response"
state = stateFailed
}
task := d.taskFromReply(p.Message, reply, state)
d.store(task)
@@ -698,16 +650,20 @@ func (d *dispatcher) resubscribe(ctx context.Context, w http.ResponseWriter, req
}
defer unsubscribe()
enc, flush := sseResponse(w)
writeEvent := func(t *Task) bool {
writeSSE(enc, flush, req.ID, t)
if isTerminal(t.Status.State) {
// Close the stream with a spec-shaped terminal marker so external
// clients see `final:true`.
writeSSE(enc, flush, req.ID, statusUpdateEvent(t, true))
return true
w.Header().Set("Content-Type", "text/event-stream")
w.Header().Set("Cache-Control", "no-cache")
w.Header().Set("Connection", "keep-alive")
w.WriteHeader(http.StatusOK)
enc := json.NewEncoder(sseWriter{w: w})
flush := func() {
if f, ok := w.(http.Flusher); ok {
f.Flush()
}
return false
}
writeEvent := func(t *Task) bool {
_ = enc.Encode(rpcResponse{JSONRPC: "2.0", ID: req.ID, Result: t})
flush()
return isTerminal(t.Status.State)
}
if writeEvent(task) {
return
@@ -794,11 +750,13 @@ func (g *Gateway) callAgent(ctx context.Context, name, message string) (string,
if err := g.opts.Client.Call(ctx, req, &rsp); err != nil {
return "", err
}
reply, err := decodeAgentChatReply(rsp.Data)
if err != nil {
var out struct {
Reply string `json:"reply"`
}
if err := json.Unmarshal(rsp.Data, &out); err != nil {
return "", err
}
return reply, nil
return out.Reply, nil
}
// ---------------------------------------------------------------------------
@@ -1018,35 +976,6 @@ func textArtifact(text string) Artifact {
}
}
func decodeAgentChatReply(data []byte) (string, error) {
var out struct {
Reply string `json:"reply"`
Answer string `json:"answer"`
Content string `json:"content"`
Text string `json:"text"`
Message struct {
Content string `json:"content"`
Text string `json:"text"`
} `json:"message"`
}
if err := json.Unmarshal(data, &out); err != nil {
return "", err
}
for _, candidate := range []string{
out.Reply,
out.Answer,
out.Content,
out.Text,
out.Message.Content,
out.Message.Text,
} {
if strings.TrimSpace(candidate) != "" {
return candidate, nil
}
}
return "", nil
}
// requestContext carries request cancellation and deadlines into the downstream
// agent call without leaking HTTP transport context values into the go-micro
// client stack.
@@ -1070,27 +999,6 @@ func requestContext(parent context.Context) context.Context {
return ctx
}
// sseResponse writes the SSE response headers and returns an encoder and a
// flush func for emitting `data:`-framed JSON-RPC events.
func sseResponse(w http.ResponseWriter) (*json.Encoder, func()) {
w.Header().Set("Content-Type", "text/event-stream")
w.Header().Set("Cache-Control", "no-cache")
w.Header().Set("Connection", "keep-alive")
w.WriteHeader(http.StatusOK)
enc := json.NewEncoder(sseWriter{w: w})
return enc, func() {
if f, ok := w.(http.Flusher); ok {
f.Flush()
}
}
}
// writeSSE emits one JSON-RPC event (result only — never with an error) and flushes.
func writeSSE(enc *json.Encoder, flush func(), id json.RawMessage, result any) {
_ = enc.Encode(rpcResponse{JSONRPC: "2.0", ID: id, Result: result})
flush()
}
type sseWriter struct {
w http.ResponseWriter
}
+79 -234
View File
@@ -99,38 +99,6 @@ func TestAgentCardFromRegistry(t *testing.T) {
}
}
// A2A 0.3.0 discovery is /.well-known/agent-card.json. The card must be
// reachable there (canonical) as well as at the legacy agent.json alias, both
// per-agent and at the single-agent top level.
func TestAgentCardCanonicalWellKnownPath(t *testing.T) {
ts, cleanup := newGatewayWithAgent(t)
defer cleanup()
for _, path := range []string{
"/agents/echo/.well-known/agent-card.json",
"/agents/echo/.well-known/agent.json",
"/agents/echo/skills/task/.well-known/agent-card.json",
} {
resp, err := http.Get(ts.URL + path)
if err != nil {
t.Fatalf("get %s: %v", path, err)
}
if resp.StatusCode != http.StatusOK {
resp.Body.Close()
t.Fatalf("%s status = %d, want 200", path, resp.StatusCode)
}
var card AgentCard
if err := json.NewDecoder(resp.Body).Decode(&card); err != nil {
resp.Body.Close()
t.Fatalf("%s decode card: %v", path, err)
}
resp.Body.Close()
if card.Name != "echo" {
t.Errorf("%s card name = %q, want echo", path, card.Name)
}
}
}
func TestSkillEndpointServesFocusedCardAndRoutesRPC(t *testing.T) {
ts, cleanup := newGatewayWithAgent(t)
defer cleanup()
@@ -367,67 +335,6 @@ func (s *sliceStream) Recv() (*ai.Response, error) {
func (s *sliceStream) Close() error { return nil }
// streamEvent is one decoded SSE JSON-RPC event from a message/stream response.
// A2A streams carry heterogeneous results (Task, status-update, artifact-update)
// discriminated by `kind`, so we keep the raw result and decode on demand.
type streamEvent struct {
Result json.RawMessage `json:"result"`
Error *rpcError `json:"error"`
}
func (e streamEvent) kind() string {
var k struct {
Kind string `json:"kind"`
}
_ = json.Unmarshal(e.Result, &k)
return k.Kind
}
func (e streamEvent) task(t *testing.T) Task {
t.Helper()
var task Task
if err := json.Unmarshal(e.Result, &task); err != nil {
t.Fatalf("decode task event: %v", err)
}
return task
}
func (e streamEvent) status(t *testing.T) TaskStatusUpdateEvent {
t.Helper()
var s TaskStatusUpdateEvent
if err := json.Unmarshal(e.Result, &s); err != nil {
t.Fatalf("decode status-update event: %v", err)
}
return s
}
func (e streamEvent) artifactUpdate(t *testing.T) TaskArtifactUpdateEvent {
t.Helper()
var a TaskArtifactUpdateEvent
if err := json.Unmarshal(e.Result, &a); err != nil {
t.Fatalf("decode artifact-update event: %v", err)
}
return a
}
// collectSSE parses the `data:`-framed JSON-RPC events from an SSE body.
func collectSSE(t *testing.T, body string) []streamEvent {
t.Helper()
var events []streamEvent
for _, line := range strings.Split(strings.TrimSpace(body), "\n") {
line = strings.TrimSpace(strings.TrimPrefix(strings.TrimSpace(line), "data:"))
if line == "" {
continue
}
var e streamEvent
if err := json.Unmarshal([]byte(line), &e); err != nil {
t.Fatalf("decode event %q: %v", line, err)
}
events = append(events, e)
}
return events
}
func TestMessageStreamChunksStoreFinalTask(t *testing.T) {
d := newDispatcher()
body := `{"jsonrpc":"2.0","id":1,"method":"message/stream","params":{"message":{"role":"user","parts":[{"kind":"text","text":"ping"}],"kind":"message"}}}`
@@ -444,61 +351,47 @@ func TestMessageStreamChunksStoreFinalTask(t *testing.T) {
if ct := rr.Result().Header.Get("Content-Type"); !strings.HasPrefix(ct, "text/event-stream") {
t.Fatalf("content-type = %q, want text/event-stream", ct)
}
events := collectSSE(t, rr.Body.String())
// Opening Task snapshot + one append artifact-update per chunk + terminal
// status-update.
if len(events) != 4 {
t.Fatalf("events = %d, want 4; body %s", len(events), rr.Body.String())
var events []struct {
Result Task `json:"result"`
Error *rpcError `json:"error"`
}
for i, e := range events {
if e.Error != nil {
t.Fatalf("event %d carried an error field: %+v", i, e.Error)
for _, line := range strings.Split(strings.TrimSpace(rr.Body.String()), "\n") {
line = strings.TrimSpace(line)
if line == "" {
continue
}
line = strings.TrimPrefix(line, "data: ")
var event struct {
Result Task `json:"result"`
Error *rpcError `json:"error"`
}
if err := json.Unmarshal([]byte(line), &event); err != nil {
t.Fatalf("decode event %q: %v", line, err)
}
events = append(events, event)
}
if len(events) != 3 {
t.Fatalf("events = %d, want 3; body %s", len(events), rr.Body.String())
}
for i, event := range events {
if event.Error != nil {
t.Fatalf("event %d error: %+v", i, event.Error)
}
if event.Result.ID != events[0].Result.ID || event.Result.ContextID != events[0].Result.ContextID {
t.Fatalf("event %d changed task identity: %+v vs %+v", i, event.Result, events[0].Result)
}
}
if events[0].kind() != "task" {
t.Fatalf("first event kind = %q, want task", events[0].kind())
if events[0].Result.Status.State != stateWorking || textOf(events[0].Result.Artifacts[0].Parts) != "po" {
t.Fatalf("first event = %+v, want working po", events[0].Result)
}
opening := events[0].task(t)
if opening.Status.State != stateWorking {
t.Fatalf("opening task state = %q, want working", opening.Status.State)
}
taskID := opening.ID
// The middle events are append artifact-updates carrying the chunk deltas.
var text strings.Builder
for _, e := range events[1:3] {
if e.kind() != "artifact-update" {
t.Fatalf("event kind = %q, want artifact-update", e.kind())
}
au := e.artifactUpdate(t)
if !au.Append {
t.Fatalf("artifact-update should be append: %+v", au)
}
if au.TaskID != taskID {
t.Fatalf("artifact-update taskId = %q, want %q", au.TaskID, taskID)
}
text.WriteString(textOf(au.Artifact.Parts))
}
if text.String() != "pong" {
t.Fatalf("accumulated artifact text = %q, want pong", text.String())
final := events[len(events)-1].Result
if final.Status.State != stateCompleted || textOf(final.Artifacts[0].Parts) != "pong" {
t.Fatalf("final event = %+v, want completed pong", final)
}
// The stream closes with a terminal status-update (final:true).
last := events[len(events)-1]
if last.kind() != "status-update" {
t.Fatalf("last event kind = %q, want status-update", last.kind())
}
su := last.status(t)
if !su.Final || su.Status.State != stateCompleted {
t.Fatalf("terminal event = %+v, want final completed", su)
}
if su.TaskID != taskID {
t.Fatalf("terminal taskId = %q, want %q", su.TaskID, taskID)
}
got := rpcTaskFromDispatcher(t, d, taskID)
if got.ID != taskID || got.Status.State != stateCompleted || textOf(got.Artifacts[0].Parts) != "pong" {
t.Fatalf("stored task = %+v, want final completed pong", got)
got := rpcTaskFromDispatcher(t, d, final.ID)
if got.ID != final.ID || got.Status.State != stateCompleted || textOf(got.Artifacts[0].Parts) != "pong" {
t.Fatalf("stored task = %+v, want final", got)
}
}
@@ -539,31 +432,37 @@ func TestMessageStreamChunksPropagatesCancellationAndClosesStream(t *testing.T)
t.Fatal("stream was not closed")
}
events := collectSSE(t, rr.Body.String())
// Opening Task snapshot, then a terminal failed status-update.
if len(events) != 2 {
t.Fatalf("events = %d, want 2; body %s", len(events), rr.Body.String())
var events []struct {
Result Task `json:"result"`
Error *rpcError `json:"error"`
}
// A streaming failure must be a failed status-update, never `result` and
// `error` set together in one response.
for i, e := range events {
if e.Error != nil {
t.Fatalf("event %d carried an error field (result+error not allowed): %+v", i, e.Error)
for _, line := range strings.Split(strings.TrimSpace(rr.Body.String()), "\n") {
line = strings.TrimSpace(line)
if line == "" {
continue
}
line = strings.TrimPrefix(line, "data: ")
var event struct {
Result Task `json:"result"`
Error *rpcError `json:"error"`
}
if err := json.Unmarshal([]byte(line), &event); err != nil {
t.Fatalf("decode event %q: %v", line, err)
}
events = append(events, event)
}
if events[0].kind() != "task" || events[0].task(t).Status.State != stateWorking {
t.Fatalf("first event = %s, want working task", string(events[0].Result))
if len(events) != 1 {
t.Fatalf("events = %d, want 1; body %s", len(events), rr.Body.String())
}
last := events[1]
if last.kind() != "status-update" {
t.Fatalf("last event kind = %q, want status-update", last.kind())
event := events[0]
if event.Error == nil || event.Error.Code != errInternal || event.Error.Message != context.Canceled.Error() {
t.Fatalf("error = %+v, want context cancellation", event.Error)
}
su := last.status(t)
if !su.Final || su.Status.State != stateFailed {
t.Fatalf("terminal event = %+v, want final failed", su)
if event.Result.Status.State != stateFailed || textOf(event.Result.Artifacts[0].Parts) != "error: context canceled" {
t.Fatalf("failed task = %+v, want context cancellation artifact", event.Result)
}
got := rpcTaskFromDispatcher(t, d, su.TaskID)
got := rpcTaskFromDispatcher(t, d, event.Result.ID)
if got.Status.State != stateFailed || textOf(got.Artifacts[0].Parts) != "error: context canceled" {
t.Fatalf("stored task = %+v, want failed cancellation", got)
}
@@ -594,87 +493,33 @@ func TestMessageStreamChunksFallsBackWhenUnsupported(t *testing.T) {
if ct := rr.Result().Header.Get("Content-Type"); !strings.HasPrefix(ct, "text/event-stream") {
t.Fatalf("content-type = %q, want text/event-stream", ct)
}
events := collectSSE(t, rr.Body.String())
// The non-streaming fallback emits a completed Task snapshot then a terminal
// status-update.
if len(events) != 2 {
t.Fatalf("events = %d, want 2; body %s", len(events), rr.Body.String())
var events []struct {
Result Task `json:"result"`
Error *rpcError `json:"error"`
}
for i, e := range events {
if e.Error != nil {
t.Fatalf("fallback event %d error: %+v", i, e.Error)
for _, line := range strings.Split(strings.TrimSpace(rr.Body.String()), "\n") {
line = strings.TrimSpace(line)
if line == "" {
continue
}
}
task := events[0].task(t)
if task.Status.State != stateCompleted || textOf(task.Artifacts[0].Parts) != "pong" {
t.Fatalf("fallback task = %+v, want completed pong", task)
}
su := events[1].status(t)
if !su.Final || su.Status.State != stateCompleted {
t.Fatalf("terminal event = %+v, want final completed", su)
}
}
func TestMessageStreamFallbackDoesNotCompleteWithEmptyText(t *testing.T) {
d := newDispatcher()
body := `{"jsonrpc":"2.0","id":1,"method":"message/stream","params":{"message":{"role":"user","parts":[{"kind":"text","text":"ping"}],"kind":"message"}}}`
req := httptest.NewRequest(http.MethodPost, "/", bytes.NewBufferString(body))
rr := httptest.NewRecorder()
d.serveWithStream(rr, req, func(context.Context, string) (string, error) {
return "", nil
}, func(context.Context, string) (ai.Stream, error) {
return nil, fmt.Errorf("%w: test provider", ai.ErrStreamingUnsupported)
})
events := collectSSE(t, rr.Body.String())
var task Task
var foundTask bool
for _, e := range events {
if e.Error != nil {
t.Fatalf("fallback event error: %+v", e.Error)
line = strings.TrimPrefix(line, "data: ")
var event struct {
Result Task `json:"result"`
Error *rpcError `json:"error"`
}
if e.kind() == "task" {
task = e.task(t)
foundTask = true
if err := json.Unmarshal([]byte(line), &event); err != nil {
t.Fatalf("decode event %q: %v", line, err)
}
events = append(events, event)
}
if !foundTask {
t.Fatalf("no task event in stream; body %s", rr.Body.String())
if len(events) != 1 {
t.Fatalf("events = %d, want 1; body %s", len(events), rr.Body.String())
}
if task.Status.State != stateFailed {
t.Fatalf("fallback state = %q, want failed", task.Status.State)
if events[0].Error != nil {
t.Fatalf("fallback event error: %+v", events[0].Error)
}
if got := textOf(task.Artifacts[0].Parts); got == "" {
t.Fatalf("fallback artifact text is empty: %+v", task.Artifacts)
}
if got := textOf(task.History[len(task.History)-1].Parts); got == "" {
t.Fatalf("fallback history text is empty: %+v", task.History)
}
// The stream still ends with a terminal marker.
last := events[len(events)-1]
if last.kind() != "status-update" || !last.status(t).Final {
t.Fatalf("stream must end with a final status-update; got %s", string(last.Result))
}
}
func TestDecodeAgentChatReplyFallsBackToProviderTextFields(t *testing.T) {
for name, body := range map[string]string{
"answer": `{"answer":"answer text"}`,
"content": `{"content":"content text"}`,
"text": `{"text":"text field"}`,
"message_content": `{"message":{"content":"message content"}}`,
"message_text": `{"message":{"text":"message text"}}`,
} {
t.Run(name, func(t *testing.T) {
got, err := decodeAgentChatReply([]byte(body))
if err != nil {
t.Fatalf("decodeAgentChatReply error: %v", err)
}
if strings.TrimSpace(got) == "" {
t.Fatalf("decodeAgentChatReply(%s) returned empty text", body)
}
})
if events[0].Result.Status.State != stateCompleted || textOf(events[0].Result.Artifacts[0].Parts) != "pong" {
t.Fatalf("fallback task = %+v, want completed pong", events[0].Result)
}
}
-282
View File
@@ -1,282 +0,0 @@
package mcp
import (
"context"
"encoding/json"
"fmt"
"strings"
"time"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"
reflectionpb "google.golang.org/grpc/reflection/grpc_reflection_v1alpha"
"google.golang.org/protobuf/encoding/protojson"
"google.golang.org/protobuf/proto"
"google.golang.org/protobuf/reflect/protodesc"
"google.golang.org/protobuf/reflect/protoreflect"
"google.golang.org/protobuf/reflect/protoregistry"
"google.golang.org/protobuf/types/descriptorpb"
"google.golang.org/protobuf/types/dynamicpb"
)
// ReflectedGRPCTarget describes an external gRPC server whose reflection
// catalog should be exposed as MCP tools. It is intentionally opt-in: teams can
// bridge existing reflected gRPC services without changing their servers or
// registering them in go-micro.
type ReflectedGRPCTarget struct {
// Name prefixes generated tools. When empty, Address is sanitized and used.
Name string
// Address is the host:port of the reflected gRPC server.
Address string
// DialOptions customize the connection. If none are supplied, an insecure
// transport is used for local/dev interoperability.
DialOptions []grpc.DialOption
// Timeout bounds reflection discovery and individual tool calls.
Timeout time.Duration
}
func (s *Server) discoverReflectedGRPC() error {
for _, target := range s.opts.ReflectedGRPCTargets {
if strings.TrimSpace(target.Address) == "" {
continue
}
tools, err := s.reflectedGRPCTools(target)
if err != nil {
return err
}
for _, tool := range tools {
s.tools[tool.Name] = tool
}
}
return nil
}
func (s *Server) reflectedGRPCTools(target ReflectedGRPCTarget) ([]*Tool, error) {
timeout := target.Timeout
if timeout == 0 {
timeout = 10 * time.Second
}
ctx, cancel := context.WithTimeout(s.opts.Context, timeout)
defer cancel()
dialOpts := target.DialOptions
if len(dialOpts) == 0 {
dialOpts = []grpc.DialOption{grpc.WithTransportCredentials(insecure.NewCredentials())}
}
conn, err := grpc.NewClient(target.Address, dialOpts...)
if err != nil {
return nil, fmt.Errorf("connect reflected grpc target %s: %w", target.Address, err)
}
defer conn.Close()
files, services, err := loadReflectedFiles(ctx, conn)
if err != nil {
return nil, fmt.Errorf("reflect grpc target %s: %w", target.Address, err)
}
prefix := target.Name
if prefix == "" {
prefix = sanitizeToolPart(target.Address)
}
var out []*Tool
for _, serviceName := range services {
desc, err := files.FindDescriptorByName(protoreflect.FullName(serviceName))
if err != nil {
continue
}
svc, ok := desc.(protoreflect.ServiceDescriptor)
if !ok {
continue
}
for i := 0; i < svc.Methods().Len(); i++ {
method := svc.Methods().Get(i)
if method.IsStreamingClient() || method.IsStreamingServer() {
continue
}
fullMethod := "/" + string(svc.FullName()) + "/" + string(method.Name())
toolName := prefix + "." + strings.ReplaceAll(string(svc.FullName()), ".", "_") + "." + string(method.Name())
input := method.Input()
out = append(out, &Tool{
Name: toolName,
Description: fmt.Sprintf("Call reflected gRPC method %s on %s", fullMethod, target.Address),
InputSchema: protoMessageSchema(input),
Handler: reflectedGRPCHandler(target, fullMethod, input, method.Output()),
})
}
}
return out, nil
}
func loadReflectedFiles(ctx context.Context, conn *grpc.ClientConn) (*protoregistryFiles, []string, error) {
client := reflectionpb.NewServerReflectionClient(conn)
stream, err := client.ServerReflectionInfo(ctx)
if err != nil {
return nil, nil, err
}
if err := stream.Send(&reflectionpb.ServerReflectionRequest{MessageRequest: &reflectionpb.ServerReflectionRequest_ListServices{ListServices: ""}}); err != nil {
return nil, nil, err
}
resp, err := stream.Recv()
if err != nil {
return nil, nil, err
}
list := resp.GetListServicesResponse()
if list == nil {
return nil, nil, fmt.Errorf("reflection list services returned %T", resp.MessageResponse)
}
set := &descriptorpb.FileDescriptorSet{}
seen := map[string]bool{}
var services []string
for _, svc := range list.Service {
name := svc.Name
if strings.HasPrefix(name, "grpc.reflection.") {
continue
}
services = append(services, name)
if err := requestFileContainingSymbol(ctx, client, name, set, seen); err != nil {
return nil, nil, err
}
}
files, err := newProtoregistryFiles(set)
if err != nil {
return nil, nil, err
}
return files, services, nil
}
func requestFileContainingSymbol(ctx context.Context, client reflectionpb.ServerReflectionClient, symbol string, set *descriptorpb.FileDescriptorSet, seen map[string]bool) error {
stream, err := client.ServerReflectionInfo(ctx)
if err != nil {
return err
}
if err := stream.Send(&reflectionpb.ServerReflectionRequest{MessageRequest: &reflectionpb.ServerReflectionRequest_FileContainingSymbol{FileContainingSymbol: symbol}}); err != nil {
return err
}
resp, err := stream.Recv()
if err != nil {
return err
}
fd := resp.GetFileDescriptorResponse()
if fd == nil {
return fmt.Errorf("reflection lookup for %s returned %T", symbol, resp.MessageResponse)
}
for _, raw := range fd.FileDescriptorProto {
var file descriptorpb.FileDescriptorProto
if err := proto.Unmarshal(raw, &file); err != nil {
return err
}
name := file.GetName()
if !seen[name] {
seen[name] = true
set.File = append(set.File, &file)
}
}
return nil
}
// protoregistryFiles is a narrow wrapper that keeps imports local to this file.
type protoregistryFiles struct{ files *protoregistry.Files }
func newProtoregistryFiles(set *descriptorpb.FileDescriptorSet) (*protoregistryFiles, error) {
files, err := protodesc.NewFiles(set)
if err != nil {
return nil, err
}
return &protoregistryFiles{files: files}, nil
}
func (p *protoregistryFiles) FindDescriptorByName(name protoreflect.FullName) (protoreflect.Descriptor, error) {
return p.files.FindDescriptorByName(name)
}
func reflectedGRPCHandler(target ReflectedGRPCTarget, fullMethod string, input, output protoreflect.MessageDescriptor) func(map[string]interface{}) (interface{}, error) {
return func(args map[string]interface{}) (interface{}, error) {
timeout := target.Timeout
if timeout == 0 {
timeout = 10 * time.Second
}
ctx, cancel := context.WithTimeout(context.Background(), timeout)
defer cancel()
dialOpts := target.DialOptions
if len(dialOpts) == 0 {
dialOpts = []grpc.DialOption{grpc.WithTransportCredentials(insecure.NewCredentials())}
}
conn, err := grpc.NewClient(target.Address, dialOpts...)
if err != nil {
return nil, err
}
defer conn.Close()
req := dynamicpb.NewMessage(input)
raw, err := json.Marshal(args)
if err != nil {
return nil, err
}
if err := protojson.Unmarshal(raw, req); err != nil {
return nil, err
}
rsp := dynamicpb.NewMessage(output)
if err := conn.Invoke(ctx, fullMethod, req, rsp); err != nil {
return nil, err
}
b, err := protojson.MarshalOptions{UseProtoNames: true, EmitUnpopulated: true}.Marshal(rsp)
if err != nil {
return nil, err
}
var out interface{}
if err := json.Unmarshal(b, &out); err != nil {
return nil, err
}
return out, nil
}
}
func protoMessageSchema(msg protoreflect.MessageDescriptor) map[string]interface{} {
schema := map[string]interface{}{"type": "object", "properties": map[string]interface{}{}}
props := schema["properties"].(map[string]interface{})
fields := msg.Fields()
for i := 0; i < fields.Len(); i++ {
field := fields.Get(i)
props[field.JSONName()] = protoFieldSchema(field)
}
return schema
}
func protoFieldSchema(field protoreflect.FieldDescriptor) map[string]interface{} {
schema := map[string]interface{}{"type": protoJSONType(field)}
if field.IsList() {
schema["items"] = map[string]interface{}{"type": protoJSONType(field)}
}
if field.Kind() == protoreflect.MessageKind || field.Kind() == protoreflect.GroupKind {
schema = protoMessageSchema(field.Message())
}
return schema
}
func protoJSONType(field protoreflect.FieldDescriptor) string {
if field.IsList() {
return "array"
}
switch field.Kind() {
case protoreflect.BoolKind:
return "boolean"
case protoreflect.Int32Kind, protoreflect.Sint32Kind, protoreflect.Sfixed32Kind,
protoreflect.Uint32Kind, protoreflect.Fixed32Kind, protoreflect.Int64Kind,
protoreflect.Sint64Kind, protoreflect.Sfixed64Kind, protoreflect.Uint64Kind,
protoreflect.Fixed64Kind:
return "integer"
case protoreflect.FloatKind, protoreflect.DoubleKind:
return "number"
case protoreflect.MessageKind, protoreflect.GroupKind:
return "object"
default:
return "string"
}
}
func sanitizeToolPart(s string) string {
r := strings.NewReplacer(":", "_", "/", "_", ".", "_", "-", "_")
return r.Replace(s)
}
-62
View File
@@ -1,62 +0,0 @@
package mcp
import (
"context"
"net"
"testing"
"time"
"google.golang.org/grpc"
helloworld "google.golang.org/grpc/examples/helloworld/helloworld"
"google.golang.org/grpc/reflection"
)
type reflectedGreeter struct {
helloworld.UnimplementedGreeterServer
}
func (reflectedGreeter) SayHello(_ context.Context, req *helloworld.HelloRequest) (*helloworld.HelloReply, error) {
return &helloworld.HelloReply{Message: "hello " + req.Name}, nil
}
func TestReflectedGRPCTargetDiscoversAndCallsUnaryTool(t *testing.T) {
lis, err := net.Listen("tcp", "127.0.0.1:0")
if err != nil {
t.Fatal(err)
}
grpcServer := grpc.NewServer()
helloworld.RegisterGreeterServer(grpcServer, reflectedGreeter{})
reflection.Register(grpcServer)
go grpcServer.Serve(lis)
defer grpcServer.Stop()
s := newTestServer(Options{Context: context.Background()})
tools, err := s.reflectedGRPCTools(ReflectedGRPCTarget{
Name: "demo",
Address: lis.Addr().String(),
Timeout: 3 * time.Second,
})
if err != nil {
t.Fatalf("discover reflected tools: %v", err)
}
if len(tools) != 1 {
t.Fatalf("tools len = %d, want 1", len(tools))
}
tool := tools[0]
if tool.Name != "demo.helloworld_Greeter.SayHello" {
t.Fatalf("tool name = %q", tool.Name)
}
props := tool.InputSchema["properties"].(map[string]interface{})
if _, ok := props["name"]; !ok {
t.Fatalf("input schema missing name: %#v", tool.InputSchema)
}
out, err := tool.Handler(map[string]interface{}{"name": "Ada"})
if err != nil {
t.Fatalf("call reflected tool: %v", err)
}
got := out.(map[string]interface{})["message"]
if got != "hello Ada" {
t.Fatalf("message = %v, want hello Ada", got)
}
}
-9
View File
@@ -157,11 +157,6 @@ type Options struct {
// (the /mcp/call endpoint). Listing tools and health stay free.
// Opt-in: leave nil to disable payments.
Payment *x402.Config
// ReflectedGRPCTargets exposes unary methods from external gRPC servers
// that support server reflection as MCP tools. This bridges existing gRPC
// services into the agent tool catalog without requiring go-micro handlers.
ReflectedGRPCTargets []ReflectedGRPCTarget
}
// Server represents a running MCP gateway
@@ -291,10 +286,6 @@ func (s *Server) discoverServices() error {
s.toolsMu.Lock()
defer s.toolsMu.Unlock()
if err := s.discoverReflectedGRPC(); err != nil {
return err
}
for _, svc := range services {
// Get full service details
fullSvcs, err := s.opts.Registry.GetService(svc.Name)
+19 -5
View File
@@ -294,9 +294,7 @@ func (t *StdioTransport) handleToolsCall(req *JSONRPCRequest) {
AccountID: accountID, ScopesRequired: tool.Scopes,
Allowed: true, Duration: time.Since(start), Error: err.Error(),
})
// A tool-execution failure is reported as an isError result, not a
// JSON-RPC protocol error (per the MCP spec), so the agent can read it.
t.sendResponse(req.ID, mcpToolError(traceID, "tool call failed: "+err.Error()))
t.sendError(req.ID, InternalError, "RPC call failed", err.Error())
return
}
@@ -313,8 +311,24 @@ func (t *StdioTransport) handleToolsCall(req *JSONRPCRequest) {
Allowed: true, Duration: time.Since(start),
})
// The downstream response is JSON — return it as JSON text, not %v.
t.sendResponse(req.ID, mcpToolResult(traceID, rsp.Data))
// Parse response
var result interface{}
if err := json.Unmarshal(rsp.Data, &result); err != nil {
// If unmarshal fails, return raw data
result = map[string]interface{}{
"data": string(rsp.Data),
}
}
t.sendResponse(req.ID, map[string]interface{}{
"content": []interface{}{
map[string]interface{}{
"type": "text",
"text": fmt.Sprintf("%v", result),
},
},
"trace_id": traceID,
})
}
// sendResponse sends a JSON-RPC response
-120
View File
@@ -1,120 +0,0 @@
package mcp
import (
"bufio"
"bytes"
"context"
"encoding/json"
"errors"
"testing"
"go-micro.dev/v6/client"
)
// fakeCallClient overrides Call to return canned data or an error; NewRequest
// and the rest are promoted from the embedded real client.
type fakeCallClient struct {
client.Client
data []byte
err error
}
func (f *fakeCallClient) Call(ctx context.Context, req client.Request, rsp interface{}, opts ...client.CallOption) error {
if f.err != nil {
return f.err
}
if r, ok := rsp.(*struct{ Data []byte }); ok {
r.Data = f.data
}
return nil
}
// isToolError reports whether an MCP tools/call result carries isError:true.
func isToolError(result interface{}) bool {
m, ok := result.(map[string]interface{})
if !ok {
return false
}
b, _ := m["isError"].(bool)
return b
}
// toolResultText extracts the first text content of an MCP tools/call result.
func toolResultText(t *testing.T, result interface{}) string {
t.Helper()
m, ok := result.(map[string]interface{})
if !ok {
t.Fatalf("result is not a map: %#v", result)
}
content, ok := m["content"].([]interface{})
if !ok || len(content) == 0 {
t.Fatalf("result has no content: %#v", result)
}
first, _ := content[0].(map[string]interface{})
text, _ := first["text"].(string)
return text
}
// driveStdio sends one JSON-RPC request through a StdioTransport and returns the
// decoded response, capturing the transport's stdout into a buffer.
func driveStdio(t *testing.T, s *Server, method string, id interface{}, params interface{}) JSONRPCResponse {
t.Helper()
tr := NewStdioTransport(s)
var out bytes.Buffer
tr.writer = bufio.NewWriter(&out)
raw, _ := json.Marshal(params)
tr.handleRequest(&JSONRPCRequest{JSONRPC: "2.0", ID: id, Method: method, Params: raw})
var resp JSONRPCResponse
if err := json.Unmarshal(bytes.TrimSpace(out.Bytes()), &resp); err != nil {
t.Fatalf("decode stdio response: %v (raw=%q)", err, out.String())
}
return resp
}
// The stdio transport is the path an external MCP host (Claude Desktop) uses.
// It must return tool output as JSON text, not fmt.Sprintf("%v", ...) which
// yields Go map-syntax and is unparseable by a real client.
func TestStdio_ToolsCall_ReturnsJSONNotGoSyntax(t *testing.T) {
s := newTestServer(Options{})
s.opts.Client = &fakeCallClient{Client: client.DefaultClient, data: []byte(`{"id":1,"name":"bob"}`)}
s.tools["svc.Echo"] = &Tool{Name: "svc.Echo", Service: "svc", Endpoint: "Echo"}
resp := driveStdio(t, s, "tools/call", 1, map[string]interface{}{
"name": "svc.Echo",
"arguments": map[string]interface{}{"msg": "hi"},
})
if resp.Error != nil {
t.Fatalf("unexpected protocol error: %+v", resp.Error)
}
text := toolResultText(t, resp.Result)
// The bug returned Go map-syntax ("map[id:1 name:bob]"), which fails to parse.
var got map[string]interface{}
if err := json.Unmarshal([]byte(text), &got); err != nil {
t.Fatalf("tool result text is not JSON (the %%v bug): %q", text)
}
if got["name"] != "bob" {
t.Errorf("result = %v, want name=bob", got)
}
}
// A tool-execution failure must be an MCP isError result, not a JSON-RPC
// protocol error, so the agent can read the failure.
func TestStdio_ToolsCall_FailureIsIsErrorResult(t *testing.T) {
s := newTestServer(Options{})
s.opts.Client = &fakeCallClient{Client: client.DefaultClient, err: errors.New("backend down")}
s.tools["svc.Echo"] = &Tool{Name: "svc.Echo", Service: "svc", Endpoint: "Echo"}
resp := driveStdio(t, s, "tools/call", 1, map[string]interface{}{
"name": "svc.Echo",
"arguments": map[string]interface{}{},
})
if resp.Error != nil {
t.Fatalf("tool failure returned a protocol error, want isError result: %+v", resp.Error)
}
if !isToolError(resp.Result) {
t.Fatalf("expected isError result, got %+v", resp.Result)
}
if text := toolResultText(t, resp.Result); text == "" {
t.Error("isError result should carry the error text")
}
}

Some files were not shown because too many files have changed in this diff Show More