@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.
@@ -1,5 +1,5 @@
1
1
 
2
- > @axiom-lattice/gateway@2.1.88 build /home/runner/work/agentic/agentic/packages/gateway
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
  CLI Building entry: src/index.ts
@@ -11,22 +11,24 @@
11
11
  ESM Build start
12
12
  [warn] ▲ [WARNING] "import.meta" is not available with the "cjs" output format and will be empty [empty-import-meta]
13
13
 
14
- src/index.ts:175:33:
15
-  175 │ const __filename = fileURLToPath(import.meta.url);
14
+ src/index.ts:183:33:
15
+  183 │ const __filename = fileURLToPath(import.meta.url);
16
16
  ╵ ~~~~~~~~~~~
17
17
 
18
18
  You need to set the output format to "esm" for "import.meta" to work correctly.
19
19
 
20
20
 
21
- ESM dist/index.mjs 237.01 KB
22
21
  ESM dist/sender-PX32VSHB.mjs 873.00 B
23
- ESM dist/index.mjs.map 504.85 KB
22
+ ESM dist/a2a-ERG5RMUW.mjs 15.95 KB
23
+ ESM dist/index.mjs 246.84 KB
24
24
  ESM dist/sender-PX32VSHB.mjs.map 2.07 KB
25
- ESM ⚡️ Build success in 417ms
26
- CJS dist/index.js 241.90 KB
27
- CJS dist/index.js.map 506.42 KB
28
- CJS ⚡️ Build success in 418ms
25
+ ESM dist/a2a-ERG5RMUW.mjs.map 32.14 KB
26
+ ESM dist/index.mjs.map 526.83 KB
27
+ ESM ⚡️ Build success in 420ms
28
+ CJS dist/index.js 268.14 KB
29
+ CJS dist/index.js.map 560.68 KB
30
+ CJS ⚡️ Build success in 426ms
29
31
  DTS Build start
30
- DTS ⚡️ Build success in 13918ms
31
- DTS dist/index.d.ts 5.01 KB
32
- DTS dist/index.d.mts 5.01 KB
32
+ DTS ⚡️ Build success in 13594ms
33
+ DTS dist/index.d.ts 7.57 KB
34
+ DTS dist/index.d.mts 7.57 KB
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