@axiom-lattice/gateway 2.1.48 → 2.1.49
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 +8 -8
- package/CHANGELOG.md +9 -0
- package/dist/index.js +14 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +16 -4
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
- package/src/controllers/run.ts +0 -2
- package/src/index.ts +11 -0
- package/src/services/agent_task_consumer.ts +9 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@axiom-lattice/gateway",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.49",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"module": "dist/index.mjs",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -38,8 +38,8 @@
|
|
|
38
38
|
"pg": "^8.11.0",
|
|
39
39
|
"redis": "^5.0.1",
|
|
40
40
|
"uuid": "^9.0.1",
|
|
41
|
-
"@axiom-lattice/core": "2.1.
|
|
42
|
-
"@axiom-lattice/pg-stores": "1.0.
|
|
41
|
+
"@axiom-lattice/core": "2.1.43",
|
|
42
|
+
"@axiom-lattice/pg-stores": "1.0.33",
|
|
43
43
|
"@axiom-lattice/protocols": "2.1.23",
|
|
44
44
|
"@axiom-lattice/queue-redis": "1.0.22"
|
|
45
45
|
},
|
package/src/controllers/run.ts
CHANGED
|
@@ -169,7 +169,6 @@ export const resumeStream = async (
|
|
|
169
169
|
|
|
170
170
|
try {
|
|
171
171
|
// Create Agent instance for accessing chunk buffer
|
|
172
|
-
// Note: assistant_id, tenant_id are not required for chunkStream
|
|
173
172
|
// Get or create Agent instance (ensures single instance per thread)
|
|
174
173
|
const agent = agentInstanceManager.getAgent({
|
|
175
174
|
assistant_id,
|
|
@@ -180,7 +179,6 @@ export const resumeStream = async (
|
|
|
180
179
|
});
|
|
181
180
|
|
|
182
181
|
// Get the stream from agent's chunk buffer
|
|
183
|
-
console.log("[UI]message_id", message_id)
|
|
184
182
|
const stream = agent.chunkStream(message_id, [MessageChunkTypes.THREAD_IDLE]);
|
|
185
183
|
|
|
186
184
|
// Stream the chunks to the client
|
package/src/index.ts
CHANGED
|
@@ -19,6 +19,7 @@ import {
|
|
|
19
19
|
sandboxLatticeManager,
|
|
20
20
|
sqlDatabaseManager,
|
|
21
21
|
getStoreLattice,
|
|
22
|
+
agentInstanceManager,
|
|
22
23
|
} from "@axiom-lattice/core";
|
|
23
24
|
import type { DatabaseConfigStore } from "@axiom-lattice/protocols";
|
|
24
25
|
import {
|
|
@@ -260,6 +261,16 @@ const start = async (config?: LatticeGatewayConfig) => {
|
|
|
260
261
|
agentTaskConsumer.startPollingQueue();
|
|
261
262
|
}
|
|
262
263
|
}
|
|
264
|
+
|
|
265
|
+
// Restore agent instances with pending messages
|
|
266
|
+
try {
|
|
267
|
+
logger.info("Starting agent instance recovery...");
|
|
268
|
+
const restoreStats = await agentInstanceManager.restore();
|
|
269
|
+
logger.info(`Agent recovery complete: ${restoreStats.restored} threads restored, ${restoreStats.errors} errors`);
|
|
270
|
+
} catch (error) {
|
|
271
|
+
logger.error("Agent recovery failed", { error });
|
|
272
|
+
// Don't exit - server can still function even if recovery fails
|
|
273
|
+
}
|
|
263
274
|
} catch (err) {
|
|
264
275
|
logger.error("Server start failed", { error: err });
|
|
265
276
|
process.exit(1);
|
|
@@ -38,9 +38,9 @@ const handleAgentTask = async (
|
|
|
38
38
|
);
|
|
39
39
|
|
|
40
40
|
// 检查API服务器是否可用
|
|
41
|
-
const apiUrl = AgentTaskConsumer.agent_run_endpoint;
|
|
41
|
+
// const apiUrl = AgentTaskConsumer.agent_run_endpoint;
|
|
42
42
|
|
|
43
|
-
console.log(`apiUrl: ${apiUrl}`);
|
|
43
|
+
// console.log(`apiUrl: ${apiUrl}`);
|
|
44
44
|
const agent = agentInstanceManager.getAgent({ assistant_id, thread_id, tenant_id, workspace_id: runConfig?.workspaceId, project_id: runConfig?.projectId, custom_run_config: runConfig })
|
|
45
45
|
await agent.addMessage({ input, command }, QueueMode.STEER);
|
|
46
46
|
if (callback_event) {
|
|
@@ -51,6 +51,13 @@ const handleAgentTask = async (
|
|
|
51
51
|
config: { assistant_id, thread_id, tenant_id },
|
|
52
52
|
});
|
|
53
53
|
})
|
|
54
|
+
agent.subscribeOnce("message:interrupted", (evt) => {
|
|
55
|
+
eventBus.publish(callback_event, {
|
|
56
|
+
success: true,
|
|
57
|
+
state: evt.state,
|
|
58
|
+
config: { assistant_id, thread_id, tenant_id },
|
|
59
|
+
});
|
|
60
|
+
})
|
|
54
61
|
}
|
|
55
62
|
|
|
56
63
|
return true;
|