@axiom-lattice/cli-a2a 0.1.5 → 0.1.6

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.
Files changed (65) hide show
  1. package/.turbo/turbo-build.log +34 -32
  2. package/CHANGELOG.md +20 -0
  3. package/README.md +85 -2
  4. package/__tests__/opencode-executor.test.ts +631 -31
  5. package/__tests__/session-store-path.test.ts +40 -0
  6. package/dist/{chunk-NQIDRU47.mjs → chunk-54SKDK3D.mjs} +78 -32
  7. package/dist/chunk-54SKDK3D.mjs.map +1 -0
  8. package/dist/chunk-BSNQOP2W.mjs +350 -0
  9. package/dist/chunk-BSNQOP2W.mjs.map +1 -0
  10. package/dist/chunk-DRFFQJII.mjs +195 -0
  11. package/dist/chunk-DRFFQJII.mjs.map +1 -0
  12. package/dist/chunk-URJDRXJW.mjs +378 -0
  13. package/dist/chunk-URJDRXJW.mjs.map +1 -0
  14. package/dist/{chunk-G7AGL2QA.mjs → chunk-WZB7FBSX.mjs} +23 -5
  15. package/dist/chunk-WZB7FBSX.mjs.map +1 -0
  16. package/dist/{chunk-LXL47XMZ.mjs → chunk-YGUPSPZO.mjs} +9 -1
  17. package/dist/chunk-YGUPSPZO.mjs.map +1 -0
  18. package/dist/{chunk-35NFMGMS.mjs → chunk-ZP3JNJQJ.mjs} +3 -3
  19. package/dist/chunk-ZP3JNJQJ.mjs.map +1 -0
  20. package/dist/cli.js +769 -156
  21. package/dist/cli.js.map +1 -1
  22. package/dist/cli.mjs +7 -6
  23. package/dist/cli.mjs.map +1 -1
  24. package/dist/executor-LLE5VEFJ.mjs +12 -0
  25. package/dist/executor-LO7P3KUW.mjs +12 -0
  26. package/dist/{executor-RVBGAWUF.mjs → executor-OOLGGXHS.mjs} +4 -3
  27. package/dist/{executors-QIIKBUMJ.mjs → executors-AQHOPGSR.mjs} +2 -2
  28. package/dist/index.d.mts +92 -21
  29. package/dist/index.d.ts +92 -21
  30. package/dist/index.js +731 -123
  31. package/dist/index.js.map +1 -1
  32. package/dist/index.mjs +15 -7
  33. package/package.json +10 -3
  34. package/runtime/cli-path.cjs +3 -0
  35. package/runtime/cli-path.d.ts +1 -0
  36. package/runtime/cli-path.mjs +5 -0
  37. package/src/config/defaults.ts +3 -1
  38. package/src/config/types.ts +8 -3
  39. package/src/executors/claude/client.ts +44 -14
  40. package/src/executors/claude/executor.ts +65 -30
  41. package/src/executors/codex/client.ts +239 -16
  42. package/src/executors/codex/executor.ts +70 -37
  43. package/src/executors/events.ts +15 -1
  44. package/src/executors/index.ts +13 -6
  45. package/src/executors/opencode/client.ts +192 -18
  46. package/src/executors/opencode/executor.ts +65 -30
  47. package/src/index.ts +8 -0
  48. package/src/local-state.ts +53 -0
  49. package/src/server/agent-card.ts +1 -0
  50. package/src/server/index.ts +22 -7
  51. package/src/session-store.ts +262 -0
  52. package/dist/chunk-35NFMGMS.mjs.map +0 -1
  53. package/dist/chunk-G7AGL2QA.mjs.map +0 -1
  54. package/dist/chunk-LXL47XMZ.mjs.map +0 -1
  55. package/dist/chunk-NQIDRU47.mjs.map +0 -1
  56. package/dist/chunk-VSZ3DACI.mjs +0 -179
  57. package/dist/chunk-VSZ3DACI.mjs.map +0 -1
  58. package/dist/chunk-WNCDOYZS.mjs +0 -187
  59. package/dist/chunk-WNCDOYZS.mjs.map +0 -1
  60. package/dist/executor-OWPVDUXH.mjs +0 -11
  61. package/dist/executor-XWHWUVQ3.mjs +0 -11
  62. /package/dist/{executor-OWPVDUXH.mjs.map → executor-LLE5VEFJ.mjs.map} +0 -0
  63. /package/dist/{executor-RVBGAWUF.mjs.map → executor-LO7P3KUW.mjs.map} +0 -0
  64. /package/dist/{executor-XWHWUVQ3.mjs.map → executor-OOLGGXHS.mjs.map} +0 -0
  65. /package/dist/{executors-QIIKBUMJ.mjs.map → executors-AQHOPGSR.mjs.map} +0 -0
@@ -1,5 +1,5 @@
1
1
 
2
- > @axiom-lattice/cli-a2a@0.1.5 build /home/runner/work/agentic/agentic/packages/cli-a2a
2
+ > @axiom-lattice/cli-a2a@0.1.6 build /home/runner/work/agentic/agentic/packages/cli-a2a
3
3
  > tsup src/index.ts src/cli.ts --format cjs,esm --dts --clean --sourcemap
4
4
 
5
5
  CLI Building entry: src/cli.ts, src/index.ts
@@ -9,43 +9,45 @@
9
9
  CLI Cleaning output folder
10
10
  CJS Build start
11
11
  ESM Build start
12
- ESM dist/cli.mjs 11.29 KB
13
- ESM dist/index.mjs 824.00 B
14
- ESM dist/chunk-G7AGL2QA.mjs 10.48 KB
15
- ESM dist/executors-QIIKBUMJ.mjs 251.00 B
16
- ESM dist/chunk-35NFMGMS.mjs 696.00 B
17
- ESM dist/executor-RVBGAWUF.mjs 250.00 B
18
- ESM dist/chunk-WNCDOYZS.mjs 6.24 KB
19
- ESM dist/executor-XWHWUVQ3.mjs 238.00 B
20
- ESM dist/chunk-VSZ3DACI.mjs 5.76 KB
21
- ESM dist/executor-OWPVDUXH.mjs 242.00 B
22
- ESM dist/chunk-NQIDRU47.mjs 5.75 KB
23
- ESM dist/chunk-LXL47XMZ.mjs 934.00 B
12
+ CJS dist/cli.js 80.46 KB
13
+ CJS dist/index.js 54.18 KB
14
+ CJS dist/cli.js.map 144.21 KB
15
+ CJS dist/index.js.map 107.36 KB
16
+ CJS ⚡️ Build success in 649ms
17
+ ESM dist/cli.mjs 11.33 KB
18
+ ESM dist/index.mjs 1005.00 B
19
+ ESM dist/chunk-WZB7FBSX.mjs 10.98 KB
20
+ ESM dist/executors-AQHOPGSR.mjs 251.00 B
21
+ ESM dist/chunk-ZP3JNJQJ.mjs 724.00 B
22
+ ESM dist/executor-OOLGGXHS.mjs 281.00 B
23
+ ESM dist/chunk-BSNQOP2W.mjs 12.17 KB
24
+ ESM dist/executor-LLE5VEFJ.mjs 269.00 B
25
+ ESM dist/chunk-URJDRXJW.mjs 12.67 KB
26
+ ESM dist/executor-LO7P3KUW.mjs 273.00 B
27
+ ESM dist/chunk-54SKDK3D.mjs 7.81 KB
28
+ ESM dist/chunk-YGUPSPZO.mjs 1.12 KB
29
+ ESM dist/chunk-DRFFQJII.mjs 5.62 KB
24
30
  ESM dist/bridge-7ZUDKCZT.mjs 8.09 KB
25
31
  ESM dist/chunk-VZEH3EPJ.mjs 1.49 KB
26
32
  ESM dist/cli.mjs.map 20.54 KB
27
33
  ESM dist/index.mjs.map 71.00 B
28
- ESM dist/chunk-G7AGL2QA.mjs.map 19.20 KB
29
- ESM dist/executors-QIIKBUMJ.mjs.map 71.00 B
30
- ESM dist/chunk-35NFMGMS.mjs.map 2.26 KB
31
- ESM dist/executor-RVBGAWUF.mjs.map 71.00 B
32
- ESM dist/chunk-WNCDOYZS.mjs.map 13.07 KB
33
- ESM dist/executor-XWHWUVQ3.mjs.map 71.00 B
34
- ESM dist/chunk-VSZ3DACI.mjs.map 12.29 KB
35
- ESM dist/executor-OWPVDUXH.mjs.map 71.00 B
36
- ESM dist/chunk-NQIDRU47.mjs.map 12.18 KB
37
- ESM dist/chunk-LXL47XMZ.mjs.map 3.54 KB
34
+ ESM dist/chunk-WZB7FBSX.mjs.map 20.01 KB
35
+ ESM dist/executors-AQHOPGSR.mjs.map 71.00 B
36
+ ESM dist/chunk-ZP3JNJQJ.mjs.map 2.46 KB
37
+ ESM dist/executor-OOLGGXHS.mjs.map 71.00 B
38
+ ESM dist/chunk-BSNQOP2W.mjs.map 23.76 KB
39
+ ESM dist/executor-LLE5VEFJ.mjs.map 71.00 B
40
+ ESM dist/chunk-URJDRXJW.mjs.map 25.03 KB
41
+ ESM dist/executor-LO7P3KUW.mjs.map 71.00 B
42
+ ESM dist/chunk-54SKDK3D.mjs.map 15.69 KB
43
+ ESM dist/chunk-YGUPSPZO.mjs.map 4.16 KB
44
+ ESM dist/chunk-DRFFQJII.mjs.map 11.36 KB
38
45
  ESM dist/bridge-7ZUDKCZT.mjs.map 16.70 KB
39
46
  ESM dist/chunk-VZEH3EPJ.mjs.map 3.18 KB
40
- ESM ⚡️ Build success in 221ms
41
- CJS dist/cli.js 56.81 KB
42
- CJS dist/index.js 32.87 KB
43
- CJS dist/cli.js.map 104.01 KB
44
- CJS dist/index.js.map 67.18 KB
45
- CJS ⚡️ Build success in 232ms
47
+ ESM ⚡️ Build success in 664ms
46
48
  DTS Build start
47
- DTS ⚡️ Build success in 12086ms
49
+ DTS ⚡️ Build success in 17931ms
48
50
  DTS dist/cli.d.ts 20.00 B
49
- DTS dist/index.d.ts 9.50 KB
51
+ DTS dist/index.d.ts 12.14 KB
50
52
  DTS dist/cli.d.mts 20.00 B
51
- DTS dist/index.d.mts 9.50 KB
53
+ DTS dist/index.d.mts 12.14 KB
package/CHANGELOG.md CHANGED
@@ -1,5 +1,25 @@
1
1
  # @axiom-lattice/cli-a2a
2
2
 
3
+ ## 0.1.6
4
+
5
+ ### Patch Changes
6
+
7
+ - 3a124ab: **BREAKING**: Remove `LocalA2ATemplateStore` from store lattice, replacing it with static template config.
8
+
9
+ - Deleted `LocalA2ATemplateStoreProtocol` and all implementations (InMemory, PostgreSQL, SQLite)
10
+ - Removed `localA2ATemplate` entry from `StoreTypeMap` and store lattice default registrations
11
+ - Removed obsolete PostgreSQL Local A2A template migration source; existing database tables are not dropped
12
+ - Removed `LocalA2ATemplateEntry`, `CreateLocalA2ATemplateRequest`, `UpdateLocalA2ATemplateRequest` types
13
+ - `client.assistants.localA2A.templates` now only supports `.list()` (returns `LocalA2ATemplateDefinition[]`)
14
+ - Templates are now defined in `packages/gateway/src/config/local-a2a-templates.ts`
15
+ - Gateway resolves the managed CLI through the installed `@axiom-lattice/cli-a2a/cli-path` export and declares the CLI package as a runtime dependency
16
+ - Templates no longer contain port or agentCardUrl; those are user-supplied at creation time
17
+ - `CreateAssistantModal` appends the Agent Card URL port to template commands as `--port <port>` when the template does not already declare a port
18
+ - CLI session files are isolated by provider and server port when no explicit store path is configured
19
+
20
+ - Updated dependencies [3a124ab]
21
+ - @axiom-lattice/protocols@3.0.0
22
+
3
23
  ## 0.1.5
4
24
 
5
25
  ### Patch Changes
package/README.md CHANGED
@@ -164,10 +164,15 @@ import {
164
164
  resolveConfig,
165
165
  registerExecutor,
166
166
  createOpenCodeExecutor,
167
+ createCodexExecutor,
168
+ createClaudeExecutor,
169
+ SessionBindingStore,
167
170
  } from '@axiom-lattice/cli-a2a';
168
171
 
169
172
  // Register executors
170
173
  registerExecutor('opencode', createOpenCodeExecutor);
174
+ registerExecutor('codex', createCodexExecutor);
175
+ registerExecutor('claude', createClaudeExecutor);
171
176
 
172
177
  // Load config
173
178
  const config = resolveConfig('agent-config.json');
@@ -182,6 +187,76 @@ process.on('SIGINT', async () => {
182
187
  });
183
188
  ```
184
189
 
190
+ ## Multi-Turn Conversations
191
+
192
+ The A2A protocol uses `contextId` to group messages into a single conversation.
193
+ `cli-a2a` maps each `contextId` to an underlying CLI session, enabling multi-turn
194
+ continuity across all three providers:
195
+
196
+ | Provider | New Session | Resume Session | Session ID Source |
197
+ |----------|-------------|----------------|-------------------|
198
+ | Codex | `codex exec --json <prompt>` | `codex exec resume <thread_id> <prompt>` | `thread_id` from JSONL `thread.started` event |
199
+ | Claude Code | `claude -p --session-id <uuid> <prompt>` | `claude -p --resume <uuid> <prompt>` | Generated UUID |
200
+ | OpenCode | `opencode run --format json <prompt>` | `opencode run --session <sessionID> <prompt>` | `sessionID` from JSON events |
201
+
202
+ **How it works:**
203
+ 1. The A2A client sends a message with a `contextId`
204
+ 2. `cli-a2a` looks up the `contextId` in the SessionBindingStore
205
+ 3. If found: uses the provider's resume command to continue the CLI session
206
+ 4. If not found: creates a new CLI session and saves the binding
207
+ 5. Subsequent messages with the same `contextId` reuse the same CLI session
208
+
209
+ History is maintained by the underlying CLI tool — no prompt concatenation needed.
210
+
211
+ ### Session Persistence
212
+
213
+ Bindings are persisted to disk so that `cli-a2a` restarts preserve conversations:
214
+
215
+ - **Default path**: `~/Library/Application Support/axiom-lattice/cli-a2a/sessions.json`
216
+ - **Format**: JSON array of `{ provider, contextId, sessionId, ... }`
217
+ - **TTL**: 24 hours by default (configurable via `session.ttl`)
218
+ - **Cleanup**: Expired bindings removed on load and periodically (every 1h)
219
+
220
+ To disable persistence:
221
+ ```json
222
+ {
223
+ "session": {
224
+ "persist": false
225
+ }
226
+ }
227
+ ```
228
+
229
+ To disable session reuse entirely (each request creates a new session):
230
+ ```json
231
+ {
232
+ "session": {
233
+ "reuseByContext": false
234
+ }
235
+ }
236
+ ```
237
+
238
+ ### Session Config
239
+
240
+ ```json
241
+ {
242
+ "session": {
243
+ "reuseByContext": true,
244
+ "persist": true,
245
+ "storePath": "~/custom/path/sessions.json",
246
+ "ttl": 86400000,
247
+ "cleanupInterval": 3600000
248
+ }
249
+ }
250
+ ```
251
+
252
+ | Field | Default | Description |
253
+ |-------|---------|-------------|
254
+ | `reuseByContext` | `true` | Map `contextId` to CLI session for multi-turn |
255
+ | `persist` | `true` | Save bindings to disk across restarts |
256
+ | `storePath` | `~/Library/Application Support/axiom-lattice/cli-a2a/sessions.json` | Custom binding store path |
257
+ | `ttl` | `86400000` (24h) | Session TTL in milliseconds |
258
+ | `cleanupInterval` | `3600000` (1h) | Cleanup interval in milliseconds |
259
+
185
260
  ## Architecture
186
261
 
187
262
  ```
@@ -199,6 +274,11 @@ process.on('SIGINT', async () => {
199
274
  │ │ │ Executor │ │ Executor│ │ Executor │ ││
200
275
  │ │ └─────┬──────┘ └────┬────┘ └───────┬──────────┘ ││
201
276
  │ └────────┼─────────────┼──────────────┼────────────┘│
277
+ │ │ │ │ │
278
+ │ ┌────────▼─────────────▼──────────────▼────────────┐│
279
+ │ │ SessionBindingStore ││
280
+ │ │ contextId → CLI sessionId + file persistence ││
281
+ │ └──────────────────────────────────────────────────┘│
202
282
  └───────────┼─────────────┼──────────────┼─────────────┘
203
283
  │ HTTP │ spawn │ spawn
204
284
  ┌───────▼────────┐ ┌──▼───────┐ ┌───▼────────────┐
@@ -281,8 +361,11 @@ npx @axiom-lattice/cli-a2a --provider opencode -d /proj/backend --port 3002 &
281
361
  | `resolveConfig(path?, overrides?)` | Merge config layers |
282
362
  | `loadConfigFile(path)` | Read and parse a JSON config file |
283
363
  | `registerExecutor(provider, factory)` | Register an executor factory |
284
- | `createOpenCodeExecutor(config)` | Create an OpenCode executor |
285
- | `OpenCodeExecutor` | Executor class (for extension) |
364
+ | `createOpenCodeExecutor(config, store)` | Create an OpenCode executor |
365
+ | `createCodexExecutor(config, store)` | Create a Codex executor |
366
+ | `createClaudeExecutor(config, store)` | Create a Claude executor |
367
+ | `SessionBindingStore` | `contextId → sessionId` persistence |
368
+ | `generateContextId()` | Generate a new UUID contextId |
286
369
  | `logger`, `LogLevel` | Structured logger |
287
370
 
288
371
  ## License