@axiom-lattice/gateway 3.0.2 → 3.0.3

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 (155) hide show
  1. package/dist/index.js +31 -9
  2. package/dist/index.js.map +1 -1
  3. package/dist/index.mjs +31 -9
  4. package/dist/index.mjs.map +1 -1
  5. package/package.json +9 -6
  6. package/.eslintrc.json +0 -22
  7. package/.turbo/turbo-build.log +0 -46
  8. package/AGENTS.md +0 -112
  9. package/CHANGELOG.md +0 -1190
  10. package/LOGGER_CONFIG.md +0 -135
  11. package/RESUME_STREAM_CONTENT_BASED.md +0 -326
  12. package/RESUME_STREAM_README.md +0 -388
  13. package/jest.config.js +0 -72
  14. package/public/sdk/README.md +0 -695
  15. package/public/sdk/dashboard-engine-skill.md +0 -1122
  16. package/public/sdk/dashboard-single-file-spec.md +0 -357
  17. package/public/sdk/data-query-sdk-skill.md +0 -307
  18. package/public/sdk/data-query-sdk.d.ts +0 -252
  19. package/public/sdk/data-query-sdk.js +0 -970
  20. package/public/sdk/occupancy-dashboard.html +0 -363
  21. package/public/sdk/test-dashboard.html +0 -690
  22. package/scripts/seed-lark-installation.ts +0 -54
  23. package/src/__tests__/__mocks__/e2b.ts +0 -1
  24. package/src/__tests__/a2a.test.ts +0 -428
  25. package/src/__tests__/channel-installations.test.ts +0 -199
  26. package/src/__tests__/data-query.test.ts +0 -77
  27. package/src/__tests__/sandbox-provider-registration.test.ts +0 -74
  28. package/src/__tests__/setup.ts +0 -5
  29. package/src/__tests__/workspace.test.ts +0 -400
  30. package/src/channels/__tests__/routes.test.ts +0 -50
  31. package/src/channels/lark/LarkChannelAdapter.ts +0 -217
  32. package/src/channels/lark/README.md +0 -187
  33. package/src/channels/lark/__tests__/controller.test.ts +0 -136
  34. package/src/channels/lark/__tests__/mapping-service.test.ts +0 -118
  35. package/src/channels/lark/__tests__/parser.test.ts +0 -72
  36. package/src/channels/lark/__tests__/sender.test.ts +0 -37
  37. package/src/channels/lark/__tests__/verification.test.ts +0 -157
  38. package/src/channels/lark/controller.ts +0 -48
  39. package/src/channels/lark/mapping-service.ts +0 -138
  40. package/src/channels/lark/parser.ts +0 -68
  41. package/src/channels/lark/routes.ts +0 -22
  42. package/src/channels/lark/sender.ts +0 -58
  43. package/src/channels/lark/types.ts +0 -20
  44. package/src/channels/lark/verification.ts +0 -32
  45. package/src/channels/registry.ts +0 -20
  46. package/src/channels/routes.ts +0 -30
  47. package/src/channels/wechat/WechatChannelAdapter.ts +0 -294
  48. package/src/channels/wechat/__tests__/context-store.test.ts +0 -148
  49. package/src/channels/wechat/context-store.ts +0 -54
  50. package/src/channels/wechat/controller.ts +0 -59
  51. package/src/channels/wechat/routes.ts +0 -7
  52. package/src/channels/wechat/types.ts +0 -62
  53. package/src/channels/wechat/wechat-client.ts +0 -162
  54. package/src/config/local-a2a-templates.ts +0 -59
  55. package/src/config.ts +0 -124
  56. package/src/controllers/__tests__/assistant-local-a2a.test.ts +0 -147
  57. package/src/controllers/__tests__/local-a2a-templates.test.ts +0 -112
  58. package/src/controllers/__tests__/mime.test.ts +0 -74
  59. package/src/controllers/__tests__/resources.test.ts +0 -122
  60. package/src/controllers/__tests__/run.test.ts +0 -115
  61. package/src/controllers/__tests__/tasks.test.ts +0 -215
  62. package/src/controllers/__tests__/workflow-tracking.test.ts +0 -113
  63. package/src/controllers/agent_task.ts +0 -72
  64. package/src/controllers/assistant.ts +0 -490
  65. package/src/controllers/auth.ts +0 -524
  66. package/src/controllers/channel-bindings.ts +0 -135
  67. package/src/controllers/channel-installations.ts +0 -409
  68. package/src/controllers/collections.ts +0 -176
  69. package/src/controllers/config.ts +0 -126
  70. package/src/controllers/connections.ts +0 -181
  71. package/src/controllers/data-query.ts +0 -236
  72. package/src/controllers/database-configs.ts +0 -440
  73. package/src/controllers/embeddings.ts +0 -22
  74. package/src/controllers/entries.ts +0 -167
  75. package/src/controllers/eval.ts +0 -513
  76. package/src/controllers/export-import.ts +0 -166
  77. package/src/controllers/health.ts +0 -36
  78. package/src/controllers/local-a2a-templates.ts +0 -18
  79. package/src/controllers/local-a2a.ts +0 -149
  80. package/src/controllers/mcp-configs.ts +0 -673
  81. package/src/controllers/memory.ts +0 -257
  82. package/src/controllers/menu-items.ts +0 -114
  83. package/src/controllers/metrics-configs.ts +0 -1061
  84. package/src/controllers/middleware-types.ts +0 -15
  85. package/src/controllers/models.ts +0 -199
  86. package/src/controllers/personal-assistant.ts +0 -191
  87. package/src/controllers/resources.ts +0 -477
  88. package/src/controllers/run.ts +0 -338
  89. package/src/controllers/sandbox.ts +0 -255
  90. package/src/controllers/schedules.ts +0 -336
  91. package/src/controllers/skills.ts +0 -256
  92. package/src/controllers/tasks.ts +0 -213
  93. package/src/controllers/tenants.ts +0 -121
  94. package/src/controllers/thread_status.ts +0 -66
  95. package/src/controllers/threads.ts +0 -260
  96. package/src/controllers/tools.ts +0 -139
  97. package/src/controllers/users.ts +0 -135
  98. package/src/controllers/workflow-tracking.ts +0 -693
  99. package/src/controllers/workspace.ts +0 -879
  100. package/src/export_registrations/a2a-api-key.registration.ts +0 -89
  101. package/src/export_registrations/agent.registration.ts +0 -80
  102. package/src/export_registrations/binding.registration.ts +0 -106
  103. package/src/export_registrations/channel-installation.registration.ts +0 -88
  104. package/src/export_registrations/collection.registration.ts +0 -85
  105. package/src/export_registrations/connection.registration.ts +0 -97
  106. package/src/export_registrations/database-config.registration.ts +0 -94
  107. package/src/export_registrations/eval.registration.ts +0 -334
  108. package/src/export_registrations/index.ts +0 -31
  109. package/src/export_registrations/mcp-config.registration.ts +0 -97
  110. package/src/export_registrations/menu.registration.ts +0 -91
  111. package/src/export_registrations/metrics-config.registration.ts +0 -94
  112. package/src/export_registrations/skill.registration.ts +0 -88
  113. package/src/export_registrations/task.registration.ts +0 -99
  114. package/src/index.ts +0 -497
  115. package/src/logger/Logger.ts +0 -186
  116. package/src/router/MessageContext.ts +0 -14
  117. package/src/router/MessageRouter.ts +0 -490
  118. package/src/router/middlewares/auditLogger.ts +0 -34
  119. package/src/router/middlewares/deduplication.ts +0 -38
  120. package/src/router/middlewares/index.ts +0 -3
  121. package/src/router/middlewares/rateLimit.ts +0 -46
  122. package/src/routes/__tests__/a2a-test-connection.test.ts +0 -177
  123. package/src/routes/a2a-bridge.ts +0 -266
  124. package/src/routes/a2a-test-connection.ts +0 -126
  125. package/src/routes/a2a.ts +0 -851
  126. package/src/routes/channel-bindings.ts +0 -11
  127. package/src/routes/channel-installations.ts +0 -33
  128. package/src/routes/index.ts +0 -640
  129. package/src/routes/menu-items.ts +0 -10
  130. package/src/routes/resource-routes.ts +0 -35
  131. package/src/routes/stt.ts +0 -102
  132. package/src/schemas/data-query.ts +0 -69
  133. package/src/schemas/index.ts +0 -852
  134. package/src/services/ExportImportService.ts +0 -296
  135. package/src/services/__tests__/ExportImportService.test.ts +0 -130
  136. package/src/services/__tests__/eval-runner.test.ts +0 -131
  137. package/src/services/__tests__/local-a2a.test.ts +0 -124
  138. package/src/services/agent_task_consumer.ts +0 -348
  139. package/src/services/collection_service.ts +0 -258
  140. package/src/services/eval-runner.ts +0 -283
  141. package/src/services/local-a2a.ts +0 -354
  142. package/src/services/queue_service.ts +0 -104
  143. package/src/services/sandbox_service.ts +0 -223
  144. package/src/services/skill_service.ts +0 -97
  145. package/src/services/supabase.ts +0 -60
  146. package/src/swagger.ts +0 -77
  147. package/src/types/index.ts +0 -118
  148. package/src/types/koa.d.ts +0 -7
  149. package/src/utils/__tests__/local-a2a-runtime.test.ts +0 -77
  150. package/src/utils/__tests__/path-containment.test.ts +0 -35
  151. package/src/utils/a2a-url.ts +0 -20
  152. package/src/utils/local-a2a-runtime.ts +0 -107
  153. package/src/utils/mime.ts +0 -44
  154. package/src/utils/path-containment.ts +0 -38
  155. package/tsconfig.json +0 -26
package/package.json CHANGED
@@ -1,7 +1,10 @@
1
1
  {
2
2
  "name": "@axiom-lattice/gateway",
3
- "version": "3.0.2",
3
+ "version": "3.0.3",
4
4
  "main": "dist/index.js",
5
+ "files": [
6
+ "dist"
7
+ ],
5
8
  "module": "dist/index.mjs",
6
9
  "types": "dist/index.d.ts",
7
10
  "exports": {
@@ -41,11 +44,11 @@
41
44
  "redis": "^5.0.1",
42
45
  "uuid": "^9.0.1",
43
46
  "zod": "3.25.76",
44
- "@axiom-lattice/cli-a2a": "0.1.7",
45
- "@axiom-lattice/core": "3.0.2",
46
- "@axiom-lattice/pg-stores": "2.0.2",
47
- "@axiom-lattice/protocols": "3.0.1",
48
- "@axiom-lattice/queue-redis": "1.0.55"
47
+ "@axiom-lattice/cli-a2a": "0.1.8",
48
+ "@axiom-lattice/core": "3.0.3",
49
+ "@axiom-lattice/pg-stores": "2.0.3",
50
+ "@axiom-lattice/protocols": "3.0.2",
51
+ "@axiom-lattice/queue-redis": "1.0.56"
49
52
  },
50
53
  "devDependencies": {
51
54
  "@types/bcrypt": "^6.0.0",
package/.eslintrc.json DELETED
@@ -1,22 +0,0 @@
1
- {
2
- "root": true,
3
- "env": {
4
- "node": true,
5
- "es2021": true
6
- },
7
- "extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended"],
8
- "parser": "@typescript-eslint/parser",
9
- "parserOptions": {
10
- "ecmaVersion": 12,
11
- "sourceType": "module"
12
- },
13
- "plugins": ["@typescript-eslint"],
14
- "rules": {
15
- "indent": "off", // 禁用缩进规则
16
- "linebreak-style": ["warn", "unix"],
17
- "semi": ["warn", "always"],
18
- "no-unused-vars": "off",
19
- "@typescript-eslint/no-unused-vars": ["warn"],
20
- "@typescript-eslint/no-explicit-any": "off" // 禁用对 any 类型的检查
21
- }
22
- }
@@ -1,46 +0,0 @@
1
-
2
- > @axiom-lattice/gateway@3.0.2 build /home/runner/work/agentic/agentic/packages/gateway
3
- > tsup src/index.ts --format cjs,esm --dts --clean --sourcemap
4
-
5
- CLI Building entry: src/index.ts
6
- CLI Using tsconfig: tsconfig.json
7
- CLI tsup v8.5.0
8
- CLI Target: es2020
9
- CLI Cleaning output folder
10
- CJS Build start
11
- ESM Build start
12
- [warn] ▲ [WARNING] "import.meta" is not available with the "cjs" output format and will be empty [empty-import-meta]
13
-
14
- src/index.ts:200:33:
15
-  200 │ const __filename = fileURLToPath(import.meta.url);
16
- ╵ ~~~~~~~~~~~
17
-
18
- You need to set the output format to "esm" for "import.meta" to work correctly.
19
-
20
-
21
- ESM dist/index.mjs 371.32 KB
22
- ESM dist/mcp-configs-SHRMQHIL.mjs 685.00 B
23
- ESM dist/chunk-K4XELOSO.mjs 12.52 KB
24
- ESM dist/sender-PX32VSHB.mjs 873.00 B
25
- ESM dist/WechatChannelAdapter-WSDKR4OA.mjs 8.27 KB
26
- ESM dist/chunk-6CUQGDJI.mjs 6.42 KB
27
- ESM dist/a2a-QMHEH3ZT.mjs 17.78 KB
28
- ESM dist/resources-VA7LSDKN.mjs 15.81 KB
29
- ESM dist/chunk-LHQY46YB.mjs 1.46 KB
30
- ESM dist/index.mjs.map 773.05 KB
31
- ESM dist/mcp-configs-SHRMQHIL.mjs.map 71.00 B
32
- ESM dist/chunk-K4XELOSO.mjs.map 25.53 KB
33
- ESM dist/sender-PX32VSHB.mjs.map 2.07 KB
34
- ESM dist/WechatChannelAdapter-WSDKR4OA.mjs.map 16.28 KB
35
- ESM dist/chunk-6CUQGDJI.mjs.map 14.04 KB
36
- ESM dist/a2a-QMHEH3ZT.mjs.map 35.64 KB
37
- ESM dist/resources-VA7LSDKN.mjs.map 29.34 KB
38
- ESM dist/chunk-LHQY46YB.mjs.map 2.39 KB
39
- ESM ⚡️ Build success in 660ms
40
- CJS dist/index.js 444.31 KB
41
- CJS dist/index.js.map 898.76 KB
42
- CJS ⚡️ Build success in 663ms
43
- DTS Build start
44
- DTS ⚡️ Build success in 21089ms
45
- DTS dist/index.d.ts 7.57 KB
46
- DTS dist/index.d.mts 7.57 KB
package/AGENTS.md DELETED
@@ -1,112 +0,0 @@
1
- ## OVERVIEW
2
- Fastify-based HTTP API gateway exposing REST endpoints for agent execution, thread management, and config CRUD.
3
-
4
- ## STRUCTURE
5
- ```
6
- src/
7
- index.ts # Gateway startup, Fastify config
8
- routes/index.ts # Route definitions (registerLatticeRoutes)
9
- controllers/ # Route handlers
10
- run.ts # Agent execution endpoints
11
- assistant.ts # Agent CRUD
12
- threads.ts # Thread lifecycle
13
- memory.ts # Agent state/memory access
14
- skills.ts # Skill registry
15
- tools.ts # Tool configs
16
- models.ts # Model registry
17
- schedules.ts # Task scheduling
18
- database-configs.ts # DB connection configs
19
- workspace.ts # Workspace CRUD
20
- config.ts # Gateway config
21
- health.ts # Health checks
22
- services/ # Business logic
23
- agent_service.ts # Agent invocation/streaming
24
- queue_service.ts # Task queue (memory/redis)
25
- agent_task_consumer.ts # Queue consumer
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
33
- schemas/index.ts # Zod/Fastify schemas
34
- logger/Logger.ts # Logger lattice integration
35
- ```
36
-
37
- ## WHERE TO LOOK
38
- - **Run agent**: `routes/index.ts` (/api/runs), `controllers/run.ts`, `services/agent_service.ts`
39
- - **Stream responses**: `controllers/run.ts` (SSE via reply.hijack), `services/agent_service.ts#agent_stream`
40
- - **Thread CRUD**: `routes/index.ts`, `controllers/threads.ts`
41
- - **Assistant CRUD**: `routes/index.ts`, `controllers/assistant.ts`
42
- - **Memory/State**: `routes/index.ts` (/api/assistants/:id/:thread_id/state), `controllers/memory.ts`
43
- - **Skills registry**: `routes/index.ts`, `controllers/skills.ts`
44
- - **Scheduling**: `routes/index.ts`, `controllers/schedules.ts`
45
- - **Config endpoints**: `routes/index.ts`, `controllers/config.ts`
46
- - **DB configs**: `routes/index.ts`, `controllers/database-configs.ts`
47
- - **Queue setup**: `services/queue_service.ts`, `services/agent_task_consumer.ts`
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 |
105
-
106
- ## CONVENTIONS
107
- - Controllers export named handlers, consume from `services/`
108
- - Services contain business logic, talk to `@axiom-lattice/core`
109
- - Routes registered via `registerLatticeRoutes(app)`
110
- - Streaming: use `reply.hijack()` + SSE headers, iterate async generators
111
- - Tenant/workspace headers: `x-tenant-id`, `x-workspace-id`, `x-project-id`
112
- - Schemas in `schemas/index.ts` for validation/Swagger