@axiom-lattice/gateway 2.1.88 → 2.1.90
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +14 -12
- package/AGENTS.md +62 -0
- package/CHANGELOG.md +22 -0
- package/dist/a2a-ERG5RMUW.mjs +567 -0
- package/dist/a2a-ERG5RMUW.mjs.map +1 -0
- package/dist/index.d.mts +62 -0
- package/dist/index.d.ts +62 -0
- package/dist/index.js +879 -29
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +294 -16
- package/dist/index.mjs.map +1 -1
- package/jest.config.js +1 -1
- package/package.json +6 -6
- package/src/__tests__/a2a.test.ts +346 -0
- package/src/index.ts +19 -0
- package/src/router/MessageRouter.ts +169 -17
- package/src/routes/a2a-bridge.ts +266 -0
- package/src/routes/a2a.ts +779 -0
- package/src/routes/index.ts +5 -0
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> @axiom-lattice/gateway@2.1.
|
|
2
|
+
> @axiom-lattice/gateway@2.1.90 build /home/runner/work/agentic/agentic/packages/gateway
|
|
3
3
|
> tsup src/index.ts --format cjs,esm --dts --clean --sourcemap
|
|
4
4
|
|
|
5
5
|
[34mCLI[39m Building entry: src/index.ts
|
|
@@ -11,22 +11,24 @@
|
|
|
11
11
|
[34mESM[39m Build start
|
|
12
12
|
[warn] [33m▲ [43;33m[[43;30mWARNING[43;33m][0m [1m"import.meta" is not available with the "cjs" output format and will be empty[0m [empty-import-meta]
|
|
13
13
|
|
|
14
|
-
src/index.ts:
|
|
15
|
-
[37m
|
|
14
|
+
src/index.ts:183:33:
|
|
15
|
+
[37m 183 │ const __filename = fileURLToPath([32mimport.meta[37m.url);
|
|
16
16
|
╵ [32m~~~~~~~~~~~[0m
|
|
17
17
|
|
|
18
18
|
You need to set the output format to "esm" for "import.meta" to work correctly.
|
|
19
19
|
|
|
20
20
|
|
|
21
|
-
[32mESM[39m [1mdist/index.mjs [22m[32m237.01 KB[39m
|
|
22
21
|
[32mESM[39m [1mdist/sender-PX32VSHB.mjs [22m[32m873.00 B[39m
|
|
23
|
-
[32mESM[39m [1mdist/
|
|
22
|
+
[32mESM[39m [1mdist/a2a-ERG5RMUW.mjs [22m[32m15.95 KB[39m
|
|
23
|
+
[32mESM[39m [1mdist/index.mjs [22m[32m246.84 KB[39m
|
|
24
24
|
[32mESM[39m [1mdist/sender-PX32VSHB.mjs.map [22m[32m2.07 KB[39m
|
|
25
|
-
[32mESM[39m
|
|
26
|
-
[
|
|
27
|
-
[
|
|
28
|
-
[32mCJS[39m
|
|
25
|
+
[32mESM[39m [1mdist/a2a-ERG5RMUW.mjs.map [22m[32m32.14 KB[39m
|
|
26
|
+
[32mESM[39m [1mdist/index.mjs.map [22m[32m526.83 KB[39m
|
|
27
|
+
[32mESM[39m ⚡️ Build success in 420ms
|
|
28
|
+
[32mCJS[39m [1mdist/index.js [22m[32m268.14 KB[39m
|
|
29
|
+
[32mCJS[39m [1mdist/index.js.map [22m[32m560.68 KB[39m
|
|
30
|
+
[32mCJS[39m ⚡️ Build success in 426ms
|
|
29
31
|
[34mDTS[39m Build start
|
|
30
|
-
[32mDTS[39m ⚡️ Build success in
|
|
31
|
-
[32mDTS[39m [1mdist/index.d.ts [22m[
|
|
32
|
-
[32mDTS[39m [1mdist/index.d.mts [22m[
|
|
32
|
+
[32mDTS[39m ⚡️ Build success in 13594ms
|
|
33
|
+
[32mDTS[39m [1mdist/index.d.ts [22m[32m7.57 KB[39m
|
|
34
|
+
[32mDTS[39m [1mdist/index.d.mts [22m[32m7.57 KB[39m
|
package/AGENTS.md
CHANGED
|
@@ -24,6 +24,12 @@ src/
|
|
|
24
24
|
queue_service.ts # Task queue (memory/redis)
|
|
25
25
|
agent_task_consumer.ts # Queue consumer
|
|
26
26
|
sandbox_service.ts # Sandbox proxy
|
|
27
|
+
channels/ # External channel adapters (Lark, Slack, etc.)
|
|
28
|
+
lark/ # Lark (Feishu) adapter
|
|
29
|
+
registry.ts # ChannelAdapterRegistry
|
|
30
|
+
router/ # Message routing
|
|
31
|
+
MessageRouter.ts # Inbound message dispatch + channel reply
|
|
32
|
+
MessageContext.ts # Request-scoped context
|
|
27
33
|
schemas/index.ts # Zod/Fastify schemas
|
|
28
34
|
logger/Logger.ts # Logger lattice integration
|
|
29
35
|
```
|
|
@@ -40,6 +46,62 @@ src/
|
|
|
40
46
|
- **DB configs**: `routes/index.ts`, `controllers/database-configs.ts`
|
|
41
47
|
- **Queue setup**: `services/queue_service.ts`, `services/agent_task_consumer.ts`
|
|
42
48
|
- **Logger lattice**: `logger/Logger.ts`, integration in `index.ts`
|
|
49
|
+
- **Channel message routing**: `router/MessageRouter.ts`, `channels/lark/`
|
|
50
|
+
- **Channel reply mechanism**: `router/MessageRouter.ts#dispatch` (see below)
|
|
51
|
+
|
|
52
|
+
## CHANNEL MESSAGE REPLY FLOW
|
|
53
|
+
|
|
54
|
+
When an external channel (e.g. Lark) sends a message to a bound agent, the gateway
|
|
55
|
+
routes the message and sends the AI response back to the channel. The flow:
|
|
56
|
+
|
|
57
|
+
```
|
|
58
|
+
1. Channel webhook → ChannelAdapter.receive(rawPayload)
|
|
59
|
+
→ InboundMessage with replyTarget set
|
|
60
|
+
|
|
61
|
+
2. MessageRouter.dispatch(inboundMessage)
|
|
62
|
+
→ resolve binding → create/reuse thread
|
|
63
|
+
→ subscribe to Agent 'reply:ready' event (before addMessage)
|
|
64
|
+
→ agent.addMessage({ custom_run_config: { _replyTarget: replyTarget } })
|
|
65
|
+
|
|
66
|
+
3. Agent queue processes the message
|
|
67
|
+
→ agentStreamExecutor() runs the agent
|
|
68
|
+
→ emits 'reply:ready' { state, customRunConfig }
|
|
69
|
+
|
|
70
|
+
4. reply:ready callback fires
|
|
71
|
+
→ extracts last AI message from state.values.messages
|
|
72
|
+
→ calls ChannelAdapter.sendReply(replyTarget, { text }, installation)
|
|
73
|
+
→ reply appears in the external channel
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### Reply deduplication per thread
|
|
77
|
+
|
|
78
|
+
`MessageRouter` uses a counter-based subscription (`_replySubs: Map<string, { count, timer }>`) to handle
|
|
79
|
+
multiple concurrent dispatches on the same thread:
|
|
80
|
+
|
|
81
|
+
- Each dispatch increments the counter, only the first registers the `subscribeOnce` listener.
|
|
82
|
+
- When `reply:ready` fires, the callback decrements the counter. The subscription is removed
|
|
83
|
+
only when the counter reaches 0.
|
|
84
|
+
- A 1-hour timeout cleans up stale subscriptions (e.g. agent aborted, sequence error).
|
|
85
|
+
|
|
86
|
+
### Reply timing across QueueModes
|
|
87
|
+
|
|
88
|
+
| Mode | `reply:ready` emitted | Reply behavior |
|
|
89
|
+
|------|----------------------|----------------|
|
|
90
|
+
| STEER | After each execution | 1 reply per message |
|
|
91
|
+
| FOLLOWUP | After each execution | 1 reply per message |
|
|
92
|
+
| COLLECT | After the batch (all per-message events first) | 1 reply for the entire batch |
|
|
93
|
+
|
|
94
|
+
### Key logs for debugging
|
|
95
|
+
|
|
96
|
+
| Event | Meaning |
|
|
97
|
+
|-------|---------|
|
|
98
|
+
| `dispatch:reply:subscribed` | First reply subscription for this thread |
|
|
99
|
+
| `dispatch:reply:incremented` | Additional dispatch joined existing subscription |
|
|
100
|
+
| `dispatch:reply:sending` | AI text extracted, about to call sendReply |
|
|
101
|
+
| `dispatch:reply:sent` | Channel API responded OK |
|
|
102
|
+
| `dispatch:reply:failed` | Channel API returned an error |
|
|
103
|
+
| `dispatch:reply:empty` | Agent produced no output, skipping reply |
|
|
104
|
+
| `dispatch:reply:timeout` | No reply:ready fired within 1h, subscription cleaned up |
|
|
43
105
|
|
|
44
106
|
## CONVENTIONS
|
|
45
107
|
- Controllers export named handlers, consume from `services/`
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
# @axiom-lattice/gateway
|
|
2
2
|
|
|
3
|
+
## 2.1.90
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- b7cd409: enhance more features a2a, cli
|
|
8
|
+
- Updated dependencies [b7cd409]
|
|
9
|
+
- @axiom-lattice/pg-stores@1.0.69
|
|
10
|
+
- @axiom-lattice/protocols@2.1.40
|
|
11
|
+
- @axiom-lattice/core@2.1.78
|
|
12
|
+
- @axiom-lattice/agent-eval@2.1.72
|
|
13
|
+
- @axiom-lattice/queue-redis@1.0.39
|
|
14
|
+
|
|
15
|
+
## 2.1.89
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- 176bfe8: custom middleware, enhance messagerouter
|
|
20
|
+
- Updated dependencies [176bfe8]
|
|
21
|
+
- @axiom-lattice/core@2.1.77
|
|
22
|
+
- @axiom-lattice/agent-eval@2.1.71
|
|
23
|
+
- @axiom-lattice/pg-stores@1.0.68
|
|
24
|
+
|
|
3
25
|
## 2.1.88
|
|
4
26
|
|
|
5
27
|
### Patch Changes
|