@axiom-lattice/gateway 2.1.47 → 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 +7 -7
- package/CHANGELOG.md +20 -0
- package/dist/index.js +26 -10
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +24 -7
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -5
- package/src/controllers/memory.ts +9 -1
- package/src/controllers/run.ts +4 -4
- package/src/index.ts +11 -0
- package/src/services/agent_task_consumer.ts +9 -2
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> @axiom-lattice/gateway@2.1.
|
|
2
|
+
> @axiom-lattice/gateway@2.1.49 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
|
|
@@ -9,13 +9,13 @@
|
|
|
9
9
|
[34mCLI[39m Cleaning output folder
|
|
10
10
|
[34mCJS[39m Build start
|
|
11
11
|
[34mESM[39m Build start
|
|
12
|
-
[
|
|
13
|
-
[
|
|
14
|
-
[32mESM[39m ⚡️ Build success in 306ms
|
|
15
|
-
[32mCJS[39m [1mdist/index.js [22m[32m168.05 KB[39m
|
|
16
|
-
[32mCJS[39m [1mdist/index.js.map [22m[32m358.68 KB[39m
|
|
12
|
+
[32mCJS[39m [1mdist/index.js [22m[32m168.91 KB[39m
|
|
13
|
+
[32mCJS[39m [1mdist/index.js.map [22m[32m360.31 KB[39m
|
|
17
14
|
[32mCJS[39m ⚡️ Build success in 308ms
|
|
15
|
+
[32mESM[39m [1mdist/index.mjs [22m[32m165.46 KB[39m
|
|
16
|
+
[32mESM[39m [1mdist/index.mjs.map [22m[32m360.78 KB[39m
|
|
17
|
+
[32mESM[39m ⚡️ Build success in 308ms
|
|
18
18
|
[34mDTS[39m Build start
|
|
19
|
-
[32mDTS[39m ⚡️ Build success in
|
|
19
|
+
[32mDTS[39m ⚡️ Build success in 9402ms
|
|
20
20
|
[32mDTS[39m [1mdist/index.d.ts [22m[32m3.76 KB[39m
|
|
21
21
|
[32mDTS[39m [1mdist/index.d.mts [22m[32m3.76 KB[39m
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# @axiom-lattice/gateway
|
|
2
2
|
|
|
3
|
+
## 2.1.49
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 21052a9: update issues
|
|
8
|
+
- Updated dependencies [21052a9]
|
|
9
|
+
- @axiom-lattice/pg-stores@1.0.33
|
|
10
|
+
- @axiom-lattice/core@2.1.43
|
|
11
|
+
|
|
12
|
+
## 2.1.48
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- 9a4f338: update sse
|
|
17
|
+
- Updated dependencies [9a4f338]
|
|
18
|
+
- @axiom-lattice/protocols@2.1.23
|
|
19
|
+
- @axiom-lattice/core@2.1.42
|
|
20
|
+
- @axiom-lattice/pg-stores@1.0.32
|
|
21
|
+
- @axiom-lattice/queue-redis@1.0.22
|
|
22
|
+
|
|
3
23
|
## 2.1.47
|
|
4
24
|
|
|
5
25
|
### Patch Changes
|
package/dist/index.js
CHANGED
|
@@ -234,6 +234,7 @@ var getAgentGraph = async (request, reply) => {
|
|
|
234
234
|
// src/controllers/run.ts
|
|
235
235
|
var import_uuid = require("uuid");
|
|
236
236
|
var import_core3 = require("@axiom-lattice/core");
|
|
237
|
+
var import_protocols = require("@axiom-lattice/protocols");
|
|
237
238
|
var createRun = async (request, reply) => {
|
|
238
239
|
try {
|
|
239
240
|
const {
|
|
@@ -278,9 +279,8 @@ var createRun = async (request, reply) => {
|
|
|
278
279
|
command,
|
|
279
280
|
custom_run_config
|
|
280
281
|
});
|
|
281
|
-
const stream = agent.chunkStream(result.messageId);
|
|
282
|
+
const stream = agent.chunkStream(result.messageId, [import_protocols.MessageChunkTypes.MESSAGE_COMPLETED]);
|
|
282
283
|
for await (const chunk of stream) {
|
|
283
|
-
console.log(input.message, chunk.data.content);
|
|
284
284
|
const success = reply.raw.write(`data: ${JSON.stringify(chunk)}
|
|
285
285
|
|
|
286
286
|
`);
|
|
@@ -349,7 +349,7 @@ var resumeStream = async (request, reply) => {
|
|
|
349
349
|
workspace_id,
|
|
350
350
|
project_id
|
|
351
351
|
});
|
|
352
|
-
const stream = agent.chunkStream(message_id,
|
|
352
|
+
const stream = agent.chunkStream(message_id, [import_protocols.MessageChunkTypes.THREAD_IDLE]);
|
|
353
353
|
for await (const chunk of stream) {
|
|
354
354
|
reply.raw.write(`data: ${JSON.stringify(chunk)}
|
|
355
355
|
|
|
@@ -482,9 +482,13 @@ var getAgentState = async (request, reply) => {
|
|
|
482
482
|
reply.status(500).send(result);
|
|
483
483
|
return;
|
|
484
484
|
}
|
|
485
|
+
const normalizedPendingMessages = pendingMessages.map((msg) => ({
|
|
486
|
+
...msg,
|
|
487
|
+
content: typeof msg.content === "object" && msg.content !== null ? msg.content.message || JSON.stringify(msg.content) : String(msg.content || "")
|
|
488
|
+
}));
|
|
485
489
|
const mergedResult = {
|
|
486
490
|
...result,
|
|
487
|
-
pendingMessages
|
|
491
|
+
pendingMessages: normalizedPendingMessages
|
|
488
492
|
};
|
|
489
493
|
reply.send(mergedResult);
|
|
490
494
|
} catch (error) {
|
|
@@ -968,7 +972,7 @@ var configService = new ConfigService();
|
|
|
968
972
|
|
|
969
973
|
// src/services/queue_service.ts
|
|
970
974
|
var import_core8 = require("@axiom-lattice/core");
|
|
971
|
-
var
|
|
975
|
+
var import_protocols2 = require("@axiom-lattice/protocols");
|
|
972
976
|
var import_queue_redis = require("@axiom-lattice/queue-redis");
|
|
973
977
|
var DEFAULT_QUEUE_KEY = "default";
|
|
974
978
|
var queueServiceType = process.env.QUEUE_SERVICE_TYPE || "memory";
|
|
@@ -979,7 +983,7 @@ var setQueueServiceType = (type) => {
|
|
|
979
983
|
const config = {
|
|
980
984
|
name: "Default Queue Service",
|
|
981
985
|
description: `Default ${type} queue service`,
|
|
982
|
-
type: type === "redis" ?
|
|
986
|
+
type: type === "redis" ? import_protocols2.QueueType.REDIS : import_protocols2.QueueType.MEMORY,
|
|
983
987
|
queueName,
|
|
984
988
|
options: type === "redis" ? {
|
|
985
989
|
redisUrl: process.env.REDIS_URL,
|
|
@@ -4946,8 +4950,6 @@ var handleAgentTask = async (taskRequest, retryCount = 0) => {
|
|
|
4946
4950
|
console.log(
|
|
4947
4951
|
`\u5F00\u59CB\u5904\u7406\u4EFB\u52A1 [assistant_id: ${assistant_id}, thread_id: ${thread_id}]`
|
|
4948
4952
|
);
|
|
4949
|
-
const apiUrl = AgentTaskConsumer.agent_run_endpoint;
|
|
4950
|
-
console.log(`apiUrl: ${apiUrl}`);
|
|
4951
4953
|
const agent = import_core25.agentInstanceManager.getAgent({ assistant_id, thread_id, tenant_id, workspace_id: runConfig?.workspaceId, project_id: runConfig?.projectId, custom_run_config: runConfig });
|
|
4952
4954
|
await agent.addMessage({ input, command }, import_core25.QueueMode.STEER);
|
|
4953
4955
|
if (callback_event) {
|
|
@@ -4958,6 +4960,13 @@ var handleAgentTask = async (taskRequest, retryCount = 0) => {
|
|
|
4958
4960
|
config: { assistant_id, thread_id, tenant_id }
|
|
4959
4961
|
});
|
|
4960
4962
|
});
|
|
4963
|
+
agent.subscribeOnce("message:interrupted", (evt) => {
|
|
4964
|
+
import_core25.eventBus.publish(callback_event, {
|
|
4965
|
+
success: true,
|
|
4966
|
+
state: evt.state,
|
|
4967
|
+
config: { assistant_id, thread_id, tenant_id }
|
|
4968
|
+
});
|
|
4969
|
+
});
|
|
4961
4970
|
}
|
|
4962
4971
|
return true;
|
|
4963
4972
|
} catch (error) {
|
|
@@ -5154,14 +5163,14 @@ var AgentTaskConsumer = _AgentTaskConsumer;
|
|
|
5154
5163
|
|
|
5155
5164
|
// src/index.ts
|
|
5156
5165
|
var import_core26 = require("@axiom-lattice/core");
|
|
5157
|
-
var
|
|
5166
|
+
var import_protocols3 = require("@axiom-lattice/protocols");
|
|
5158
5167
|
process.on("unhandledRejection", (reason, promise) => {
|
|
5159
5168
|
console.error("\u672A\u5904\u7406\u7684Promise\u62D2\u7EDD:", reason);
|
|
5160
5169
|
});
|
|
5161
5170
|
var DEFAULT_LOGGER_CONFIG = {
|
|
5162
5171
|
name: "default",
|
|
5163
5172
|
description: "Default logger for lattice-gateway service",
|
|
5164
|
-
type:
|
|
5173
|
+
type: import_protocols3.LoggerType.PINO,
|
|
5165
5174
|
serviceName: "lattice/gateway",
|
|
5166
5175
|
loggerName: "lattice/gateway"
|
|
5167
5176
|
};
|
|
@@ -5302,6 +5311,13 @@ var start = async (config) => {
|
|
|
5302
5311
|
agentTaskConsumer.startPollingQueue();
|
|
5303
5312
|
}
|
|
5304
5313
|
}
|
|
5314
|
+
try {
|
|
5315
|
+
logger.info("Starting agent instance recovery...");
|
|
5316
|
+
const restoreStats = await import_core26.agentInstanceManager.restore();
|
|
5317
|
+
logger.info(`Agent recovery complete: ${restoreStats.restored} threads restored, ${restoreStats.errors} errors`);
|
|
5318
|
+
} catch (error) {
|
|
5319
|
+
logger.error("Agent recovery failed", { error });
|
|
5320
|
+
}
|
|
5305
5321
|
} catch (err) {
|
|
5306
5322
|
logger.error("Server start failed", { error: err });
|
|
5307
5323
|
process.exit(1);
|