@axiom-lattice/gateway 2.1.116 → 2.1.117
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 +13 -13
- package/CHANGELOG.md +11 -0
- package/dist/index.js +152 -73
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +80 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -5
- package/src/index.ts +1 -1
- package/src/routes/index.ts +4 -0
- package/src/routes/stt.ts +102 -0
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> @axiom-lattice/gateway@2.1.
|
|
2
|
+
> @axiom-lattice/gateway@2.1.117 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
|
|
@@ -18,29 +18,29 @@
|
|
|
18
18
|
You need to set the output format to "esm" for "import.meta" to work correctly.
|
|
19
19
|
|
|
20
20
|
|
|
21
|
-
[32mCJS[39m [1mdist/index.js [22m[
|
|
22
|
-
[32mCJS[39m [1mdist/index.js.map [22m[
|
|
23
|
-
[32mCJS[39m ⚡️ Build success in
|
|
21
|
+
[32mCJS[39m [1mdist/index.js [22m[32m412.49 KB[39m
|
|
22
|
+
[32mCJS[39m [1mdist/index.js.map [22m[32m838.48 KB[39m
|
|
23
|
+
[32mCJS[39m ⚡️ Build success in 644ms
|
|
24
|
+
[32mESM[39m [1mdist/index.mjs [22m[32m341.76 KB[39m
|
|
25
|
+
[32mESM[39m [1mdist/mcp-configs-SHRMQHIL.mjs [22m[32m685.00 B[39m
|
|
24
26
|
[32mESM[39m [1mdist/chunk-K4XELOSO.mjs [22m[32m12.52 KB[39m
|
|
25
27
|
[32mESM[39m [1mdist/sender-PX32VSHB.mjs [22m[32m873.00 B[39m
|
|
26
28
|
[32mESM[39m [1mdist/WechatChannelAdapter-WSDKR4OA.mjs [22m[32m8.27 KB[39m
|
|
27
|
-
[32mESM[39m [1mdist/index.mjs [22m[32m339.48 KB[39m
|
|
28
|
-
[32mESM[39m [1mdist/mcp-configs-SHRMQHIL.mjs [22m[32m685.00 B[39m
|
|
29
29
|
[32mESM[39m [1mdist/chunk-6CUQGDJI.mjs [22m[32m6.42 KB[39m
|
|
30
|
-
[32mESM[39m [1mdist/resources-VA7LSDKN.mjs [22m[32m15.81 KB[39m
|
|
31
30
|
[32mESM[39m [1mdist/a2a-ERG5RMUW.mjs [22m[32m15.95 KB[39m
|
|
31
|
+
[32mESM[39m [1mdist/resources-VA7LSDKN.mjs [22m[32m15.81 KB[39m
|
|
32
32
|
[32mESM[39m [1mdist/chunk-LHQY46YB.mjs [22m[32m1.46 KB[39m
|
|
33
|
-
[32mESM[39m [1mdist/
|
|
33
|
+
[32mESM[39m [1mdist/mcp-configs-SHRMQHIL.mjs.map [22m[32m71.00 B[39m
|
|
34
34
|
[32mESM[39m [1mdist/chunk-K4XELOSO.mjs.map [22m[32m25.53 KB[39m
|
|
35
|
+
[32mESM[39m [1mdist/sender-PX32VSHB.mjs.map [22m[32m2.07 KB[39m
|
|
35
36
|
[32mESM[39m [1mdist/WechatChannelAdapter-WSDKR4OA.mjs.map [22m[32m16.28 KB[39m
|
|
36
|
-
[32mESM[39m [1mdist/mcp-configs-SHRMQHIL.mjs.map [22m[32m71.00 B[39m
|
|
37
37
|
[32mESM[39m [1mdist/chunk-6CUQGDJI.mjs.map [22m[32m14.04 KB[39m
|
|
38
|
-
[32mESM[39m [1mdist/resources-VA7LSDKN.mjs.map [22m[32m29.34 KB[39m
|
|
39
38
|
[32mESM[39m [1mdist/a2a-ERG5RMUW.mjs.map [22m[32m32.14 KB[39m
|
|
39
|
+
[32mESM[39m [1mdist/resources-VA7LSDKN.mjs.map [22m[32m29.34 KB[39m
|
|
40
40
|
[32mESM[39m [1mdist/chunk-LHQY46YB.mjs.map [22m[32m2.39 KB[39m
|
|
41
|
-
[32mESM[39m [1mdist/index.mjs.map [22m[
|
|
42
|
-
[32mESM[39m ⚡️ Build success in
|
|
41
|
+
[32mESM[39m [1mdist/index.mjs.map [22m[32m716.26 KB[39m
|
|
42
|
+
[32mESM[39m ⚡️ Build success in 648ms
|
|
43
43
|
[34mDTS[39m Build start
|
|
44
|
-
[32mDTS[39m ⚡️ Build success in
|
|
44
|
+
[32mDTS[39m ⚡️ Build success in 20771ms
|
|
45
45
|
[32mDTS[39m [1mdist/index.d.ts [22m[32m7.57 KB[39m
|
|
46
46
|
[32mDTS[39m [1mdist/index.d.mts [22m[32m7.57 KB[39m
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# @axiom-lattice/gateway
|
|
2
2
|
|
|
3
|
+
## 2.1.117
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 5e1486e: add voice input
|
|
8
|
+
- Updated dependencies [5e1486e]
|
|
9
|
+
- @axiom-lattice/core@2.1.103
|
|
10
|
+
- @axiom-lattice/pg-stores@1.0.94
|
|
11
|
+
- @axiom-lattice/protocols@2.1.54
|
|
12
|
+
- @axiom-lattice/queue-redis@1.0.53
|
|
13
|
+
|
|
3
14
|
## 2.1.116
|
|
4
15
|
|
|
5
16
|
### Patch Changes
|
package/dist/index.js
CHANGED
|
@@ -1290,7 +1290,7 @@ async function handleTasksSend(request, reply) {
|
|
|
1290
1290
|
taskStore.set(taskId, record);
|
|
1291
1291
|
let agent;
|
|
1292
1292
|
try {
|
|
1293
|
-
agent =
|
|
1293
|
+
agent = import_core55.agentInstanceManager.getAgent({
|
|
1294
1294
|
assistant_id: assistantId,
|
|
1295
1295
|
thread_id: threadId,
|
|
1296
1296
|
tenant_id: tenantId,
|
|
@@ -1382,7 +1382,7 @@ async function handleTasksCancel(request, reply) {
|
|
|
1382
1382
|
return;
|
|
1383
1383
|
}
|
|
1384
1384
|
try {
|
|
1385
|
-
const agent =
|
|
1385
|
+
const agent = import_core55.agentInstanceManager.getAgent({
|
|
1386
1386
|
assistant_id: record.assistantId,
|
|
1387
1387
|
thread_id: record.threadId,
|
|
1388
1388
|
tenant_id: record.tenantId,
|
|
@@ -1419,7 +1419,7 @@ async function handleTasksStream(request, reply) {
|
|
|
1419
1419
|
}
|
|
1420
1420
|
let agent;
|
|
1421
1421
|
try {
|
|
1422
|
-
agent =
|
|
1422
|
+
agent = import_core55.agentInstanceManager.getAgent({
|
|
1423
1423
|
assistant_id: record.assistantId,
|
|
1424
1424
|
thread_id: record.threadId,
|
|
1425
1425
|
tenant_id: record.tenantId,
|
|
@@ -1614,12 +1614,12 @@ function registerA2ARoutes(app2) {
|
|
|
1614
1614
|
handleApiKeyRotate
|
|
1615
1615
|
);
|
|
1616
1616
|
}
|
|
1617
|
-
var import_uuid10,
|
|
1617
|
+
var import_uuid10, import_core55, import_protocols4, taskStore, _a2aKeyStore, _storeKeyMap;
|
|
1618
1618
|
var init_a2a = __esm({
|
|
1619
1619
|
"src/routes/a2a.ts"() {
|
|
1620
1620
|
"use strict";
|
|
1621
1621
|
import_uuid10 = require("uuid");
|
|
1622
|
-
|
|
1622
|
+
import_core55 = require("@axiom-lattice/core");
|
|
1623
1623
|
import_protocols4 = require("@axiom-lattice/protocols");
|
|
1624
1624
|
taskStore = /* @__PURE__ */ new Map();
|
|
1625
1625
|
_a2aKeyStore = null;
|
|
@@ -1632,12 +1632,12 @@ var resources_exports = {};
|
|
|
1632
1632
|
__export(resources_exports, {
|
|
1633
1633
|
ResourceController: () => ResourceController
|
|
1634
1634
|
});
|
|
1635
|
-
var import_bcryptjs,
|
|
1635
|
+
var import_bcryptjs, import_core56, ResourceController;
|
|
1636
1636
|
var init_resources = __esm({
|
|
1637
1637
|
"src/controllers/resources.ts"() {
|
|
1638
1638
|
"use strict";
|
|
1639
1639
|
import_bcryptjs = __toESM(require("bcryptjs"));
|
|
1640
|
-
|
|
1640
|
+
import_core56 = require("@axiom-lattice/core");
|
|
1641
1641
|
init_mime();
|
|
1642
1642
|
ResourceController = class {
|
|
1643
1643
|
constructor(deps) {
|
|
@@ -1652,14 +1652,14 @@ var init_resources = __esm({
|
|
|
1652
1652
|
if (!workspaceId || !projectId) {
|
|
1653
1653
|
return reply.status(400).send({ error: "x-workspace-id and x-project-id headers required" });
|
|
1654
1654
|
}
|
|
1655
|
-
const payload = (0,
|
|
1655
|
+
const payload = (0, import_core56.createSharePayload)(
|
|
1656
1656
|
tenantId,
|
|
1657
1657
|
workspaceId,
|
|
1658
1658
|
projectId,
|
|
1659
1659
|
userId,
|
|
1660
1660
|
body
|
|
1661
1661
|
);
|
|
1662
|
-
const token = (0,
|
|
1662
|
+
const token = (0, import_core56.generateToken)();
|
|
1663
1663
|
try {
|
|
1664
1664
|
await this.deps.store.create({ ...payload, token });
|
|
1665
1665
|
this.deps.logger.info(
|
|
@@ -1811,7 +1811,7 @@ var init_resources = __esm({
|
|
|
1811
1811
|
resourcePath: subPath
|
|
1812
1812
|
}, subPath, ext, request, reply);
|
|
1813
1813
|
}
|
|
1814
|
-
const volume = (0,
|
|
1814
|
+
const volume = (0, import_core56.buildNamedVolumeName)("p", "project", tenantId, workspaceId, projectId);
|
|
1815
1815
|
return this._resolveAndServe(
|
|
1816
1816
|
volume,
|
|
1817
1817
|
subPath,
|
|
@@ -9713,9 +9713,88 @@ function registerA2ABridgeRoutes(app2) {
|
|
|
9713
9713
|
});
|
|
9714
9714
|
}
|
|
9715
9715
|
|
|
9716
|
+
// src/routes/stt.ts
|
|
9717
|
+
var import_core38 = require("@axiom-lattice/core");
|
|
9718
|
+
var ALLOWED_AUDIO_FORMATS = /* @__PURE__ */ new Set([
|
|
9719
|
+
"webm",
|
|
9720
|
+
"wav",
|
|
9721
|
+
"mp3",
|
|
9722
|
+
"m4a",
|
|
9723
|
+
"ogg",
|
|
9724
|
+
"flac",
|
|
9725
|
+
"aac"
|
|
9726
|
+
]);
|
|
9727
|
+
var MAX_AUDIO_FILE_SIZE = 25 * 1024 * 1024;
|
|
9728
|
+
var registerSTTRoutes = (app2) => {
|
|
9729
|
+
app2.get("/api/stt/models", async (_request, reply) => {
|
|
9730
|
+
const models = import_core38.sttModelLatticeManager.getAllSTTModelInfo();
|
|
9731
|
+
return reply.send({ models });
|
|
9732
|
+
});
|
|
9733
|
+
app2.post(
|
|
9734
|
+
"/api/stt/transcribe",
|
|
9735
|
+
{
|
|
9736
|
+
schema: {
|
|
9737
|
+
querystring: {
|
|
9738
|
+
type: "object",
|
|
9739
|
+
properties: {
|
|
9740
|
+
model: { type: "string" }
|
|
9741
|
+
}
|
|
9742
|
+
},
|
|
9743
|
+
response: {
|
|
9744
|
+
200: {
|
|
9745
|
+
type: "object",
|
|
9746
|
+
properties: {
|
|
9747
|
+
text: { type: "string" },
|
|
9748
|
+
confidence: { type: "number" }
|
|
9749
|
+
}
|
|
9750
|
+
}
|
|
9751
|
+
}
|
|
9752
|
+
}
|
|
9753
|
+
},
|
|
9754
|
+
async (request, reply) => {
|
|
9755
|
+
const modelKey = request.query.model || "default";
|
|
9756
|
+
const data = await request.file({
|
|
9757
|
+
limits: { fileSize: MAX_AUDIO_FILE_SIZE }
|
|
9758
|
+
});
|
|
9759
|
+
if (!data) {
|
|
9760
|
+
return reply.status(400).send({ error: "No audio file provided" });
|
|
9761
|
+
}
|
|
9762
|
+
const buffer = await data.toBuffer();
|
|
9763
|
+
if (buffer.length === 0) {
|
|
9764
|
+
return reply.status(400).send({ error: "Empty audio file" });
|
|
9765
|
+
}
|
|
9766
|
+
const format = (data.filename.split(".").pop() || "webm").toLowerCase();
|
|
9767
|
+
if (!ALLOWED_AUDIO_FORMATS.has(format)) {
|
|
9768
|
+
return reply.status(400).send({ error: `Unsupported audio format: ${format}` });
|
|
9769
|
+
}
|
|
9770
|
+
try {
|
|
9771
|
+
let client;
|
|
9772
|
+
try {
|
|
9773
|
+
client = (0, import_core38.getSTTClient)(modelKey);
|
|
9774
|
+
} catch {
|
|
9775
|
+
return reply.status(404).send({ error: `STT model "${modelKey}" not found` });
|
|
9776
|
+
}
|
|
9777
|
+
const result = await client.transcribe(buffer, format);
|
|
9778
|
+
return reply.send({
|
|
9779
|
+
text: result.text,
|
|
9780
|
+
confidence: result.confidence
|
|
9781
|
+
});
|
|
9782
|
+
} catch (error) {
|
|
9783
|
+
const sanitizedMessage = error instanceof Error ? error.message : "Transcription failed";
|
|
9784
|
+
request.log.error(
|
|
9785
|
+
{ error: sanitizedMessage },
|
|
9786
|
+
"STT transcription failed"
|
|
9787
|
+
);
|
|
9788
|
+
return reply.status(500).send({ error: "Transcription service error. Please try again." });
|
|
9789
|
+
}
|
|
9790
|
+
}
|
|
9791
|
+
);
|
|
9792
|
+
};
|
|
9793
|
+
|
|
9716
9794
|
// src/routes/index.ts
|
|
9717
9795
|
var registerLatticeRoutes = (app2, channelDeps) => {
|
|
9718
9796
|
registerA2ABridgeRoutes(app2);
|
|
9797
|
+
registerSTTRoutes(app2);
|
|
9719
9798
|
app2.post("/api/runs", createRun);
|
|
9720
9799
|
app2.post("/api/resume_stream", resumeStream);
|
|
9721
9800
|
app2.post("/api/assistants/:assistantId/threads/:threadId/abort", abortRun);
|
|
@@ -10007,12 +10086,12 @@ function registerResourceRoutes(app2, controller) {
|
|
|
10007
10086
|
}
|
|
10008
10087
|
|
|
10009
10088
|
// src/export_registrations/index.ts
|
|
10010
|
-
var
|
|
10089
|
+
var import_core52 = require("@axiom-lattice/core");
|
|
10011
10090
|
|
|
10012
10091
|
// src/export_registrations/skill.registration.ts
|
|
10013
|
-
var
|
|
10092
|
+
var import_core39 = require("@axiom-lattice/core");
|
|
10014
10093
|
function getStore2() {
|
|
10015
|
-
return (0,
|
|
10094
|
+
return (0, import_core39.getStoreLattice)("default", "skill").store;
|
|
10016
10095
|
}
|
|
10017
10096
|
var skillRegistration = {
|
|
10018
10097
|
entityType: "skill",
|
|
@@ -10087,9 +10166,9 @@ var skillRegistration = {
|
|
|
10087
10166
|
};
|
|
10088
10167
|
|
|
10089
10168
|
// src/export_registrations/agent.registration.ts
|
|
10090
|
-
var
|
|
10169
|
+
var import_core40 = require("@axiom-lattice/core");
|
|
10091
10170
|
function getStore3() {
|
|
10092
|
-
return (0,
|
|
10171
|
+
return (0, import_core40.getStoreLattice)("default", "assistant").store;
|
|
10093
10172
|
}
|
|
10094
10173
|
var agentRegistration = {
|
|
10095
10174
|
entityType: "agent",
|
|
@@ -10156,9 +10235,9 @@ var agentRegistration = {
|
|
|
10156
10235
|
};
|
|
10157
10236
|
|
|
10158
10237
|
// src/export_registrations/binding.registration.ts
|
|
10159
|
-
var
|
|
10238
|
+
var import_core41 = require("@axiom-lattice/core");
|
|
10160
10239
|
function getStore4() {
|
|
10161
|
-
return (0,
|
|
10240
|
+
return (0, import_core41.getStoreLattice)("default", "channelBinding").store;
|
|
10162
10241
|
}
|
|
10163
10242
|
var bindingRegistration = {
|
|
10164
10243
|
entityType: "binding",
|
|
@@ -10246,9 +10325,9 @@ var bindingRegistration = {
|
|
|
10246
10325
|
};
|
|
10247
10326
|
|
|
10248
10327
|
// src/export_registrations/database-config.registration.ts
|
|
10249
|
-
var
|
|
10328
|
+
var import_core42 = require("@axiom-lattice/core");
|
|
10250
10329
|
function getStore5() {
|
|
10251
|
-
return (0,
|
|
10330
|
+
return (0, import_core42.getStoreLattice)("default", "database").store;
|
|
10252
10331
|
}
|
|
10253
10332
|
var databaseConfigRegistration = {
|
|
10254
10333
|
entityType: "database_config",
|
|
@@ -10328,9 +10407,9 @@ var databaseConfigRegistration = {
|
|
|
10328
10407
|
};
|
|
10329
10408
|
|
|
10330
10409
|
// src/export_registrations/metrics-config.registration.ts
|
|
10331
|
-
var
|
|
10410
|
+
var import_core43 = require("@axiom-lattice/core");
|
|
10332
10411
|
function getStore6() {
|
|
10333
|
-
return (0,
|
|
10412
|
+
return (0, import_core43.getStoreLattice)("default", "metrics").store;
|
|
10334
10413
|
}
|
|
10335
10414
|
var metricsConfigRegistration = {
|
|
10336
10415
|
entityType: "metrics_config",
|
|
@@ -10410,9 +10489,9 @@ var metricsConfigRegistration = {
|
|
|
10410
10489
|
};
|
|
10411
10490
|
|
|
10412
10491
|
// src/export_registrations/mcp-config.registration.ts
|
|
10413
|
-
var
|
|
10492
|
+
var import_core44 = require("@axiom-lattice/core");
|
|
10414
10493
|
function getStore7() {
|
|
10415
|
-
return (0,
|
|
10494
|
+
return (0, import_core44.getStoreLattice)("default", "mcp").store;
|
|
10416
10495
|
}
|
|
10417
10496
|
var mcpConfigRegistration = {
|
|
10418
10497
|
entityType: "mcp_config",
|
|
@@ -10495,9 +10574,9 @@ var mcpConfigRegistration = {
|
|
|
10495
10574
|
};
|
|
10496
10575
|
|
|
10497
10576
|
// src/export_registrations/connection.registration.ts
|
|
10498
|
-
var
|
|
10577
|
+
var import_core45 = require("@axiom-lattice/core");
|
|
10499
10578
|
function getStore8() {
|
|
10500
|
-
return (0,
|
|
10579
|
+
return (0, import_core45.getStoreLattice)("default", "connection").store;
|
|
10501
10580
|
}
|
|
10502
10581
|
async function listAllConnections(tenantId) {
|
|
10503
10582
|
const store2 = getStore8();
|
|
@@ -10579,9 +10658,9 @@ var connectionRegistration = {
|
|
|
10579
10658
|
};
|
|
10580
10659
|
|
|
10581
10660
|
// src/export_registrations/collection.registration.ts
|
|
10582
|
-
var
|
|
10661
|
+
var import_core46 = require("@axiom-lattice/core");
|
|
10583
10662
|
function getStore9() {
|
|
10584
|
-
return (0,
|
|
10663
|
+
return (0, import_core46.getStoreLattice)("default", "collection").store;
|
|
10585
10664
|
}
|
|
10586
10665
|
var collectionRegistration = {
|
|
10587
10666
|
entityType: "collection",
|
|
@@ -10652,9 +10731,9 @@ var collectionRegistration = {
|
|
|
10652
10731
|
};
|
|
10653
10732
|
|
|
10654
10733
|
// src/export_registrations/channel-installation.registration.ts
|
|
10655
|
-
var
|
|
10734
|
+
var import_core47 = require("@axiom-lattice/core");
|
|
10656
10735
|
function getStore10() {
|
|
10657
|
-
return (0,
|
|
10736
|
+
return (0, import_core47.getStoreLattice)("default", "channelInstallation").store;
|
|
10658
10737
|
}
|
|
10659
10738
|
var channelInstallationRegistration = {
|
|
10660
10739
|
entityType: "channel_installation",
|
|
@@ -10729,9 +10808,9 @@ var channelInstallationRegistration = {
|
|
|
10729
10808
|
};
|
|
10730
10809
|
|
|
10731
10810
|
// src/export_registrations/menu.registration.ts
|
|
10732
|
-
var
|
|
10811
|
+
var import_core48 = require("@axiom-lattice/core");
|
|
10733
10812
|
function getStore11() {
|
|
10734
|
-
return (0,
|
|
10813
|
+
return (0, import_core48.getStoreLattice)("default", "menu").store;
|
|
10735
10814
|
}
|
|
10736
10815
|
var menuRegistration = {
|
|
10737
10816
|
entityType: "menu",
|
|
@@ -10809,9 +10888,9 @@ var menuRegistration = {
|
|
|
10809
10888
|
};
|
|
10810
10889
|
|
|
10811
10890
|
// src/export_registrations/task.registration.ts
|
|
10812
|
-
var
|
|
10891
|
+
var import_core49 = require("@axiom-lattice/core");
|
|
10813
10892
|
function getStore12() {
|
|
10814
|
-
return (0,
|
|
10893
|
+
return (0, import_core49.getStoreLattice)("default", "task").store;
|
|
10815
10894
|
}
|
|
10816
10895
|
var taskRegistration = {
|
|
10817
10896
|
entityType: "task",
|
|
@@ -10897,9 +10976,9 @@ var taskRegistration = {
|
|
|
10897
10976
|
};
|
|
10898
10977
|
|
|
10899
10978
|
// src/export_registrations/a2a-api-key.registration.ts
|
|
10900
|
-
var
|
|
10979
|
+
var import_core50 = require("@axiom-lattice/core");
|
|
10901
10980
|
function getStore13() {
|
|
10902
|
-
return (0,
|
|
10981
|
+
return (0, import_core50.getStoreLattice)("default", "a2aApiKey").store;
|
|
10903
10982
|
}
|
|
10904
10983
|
var a2aApiKeyRegistration = {
|
|
10905
10984
|
entityType: "a2a_api_key",
|
|
@@ -10970,9 +11049,9 @@ var a2aApiKeyRegistration = {
|
|
|
10970
11049
|
};
|
|
10971
11050
|
|
|
10972
11051
|
// src/export_registrations/eval.registration.ts
|
|
10973
|
-
var
|
|
11052
|
+
var import_core51 = require("@axiom-lattice/core");
|
|
10974
11053
|
function getStore14() {
|
|
10975
|
-
return (0,
|
|
11054
|
+
return (0, import_core51.getStoreLattice)("default", "eval").store;
|
|
10976
11055
|
}
|
|
10977
11056
|
var evalRegistration = {
|
|
10978
11057
|
entityType: "eval",
|
|
@@ -11298,7 +11377,7 @@ var evalRegistration = {
|
|
|
11298
11377
|
|
|
11299
11378
|
// src/export_registrations/index.ts
|
|
11300
11379
|
function registerAllBuiltinEntities() {
|
|
11301
|
-
const registry =
|
|
11380
|
+
const registry = import_core52.ExportableEntityRegistry.getInstance();
|
|
11302
11381
|
registry.register(skillRegistration);
|
|
11303
11382
|
registry.register(agentRegistration);
|
|
11304
11383
|
registry.register(bindingRegistration);
|
|
@@ -11315,7 +11394,7 @@ function registerAllBuiltinEntities() {
|
|
|
11315
11394
|
}
|
|
11316
11395
|
|
|
11317
11396
|
// src/router/MessageRouter.ts
|
|
11318
|
-
var
|
|
11397
|
+
var import_core53 = require("@axiom-lattice/core");
|
|
11319
11398
|
var import_crypto10 = require("crypto");
|
|
11320
11399
|
var BindingNotFoundError = class extends Error {
|
|
11321
11400
|
constructor(message) {
|
|
@@ -11476,7 +11555,7 @@ var MessageRouter = class {
|
|
|
11476
11555
|
channel: message.channel,
|
|
11477
11556
|
adapterChannel: adapter.channel
|
|
11478
11557
|
}, "Thread resolved by adapter strategy");
|
|
11479
|
-
const threadStore = (0,
|
|
11558
|
+
const threadStore = (0, import_core53.getStoreLattice)("default", "thread").store;
|
|
11480
11559
|
try {
|
|
11481
11560
|
await threadStore.createThread(
|
|
11482
11561
|
tenantId,
|
|
@@ -11513,7 +11592,7 @@ var MessageRouter = class {
|
|
|
11513
11592
|
}
|
|
11514
11593
|
}
|
|
11515
11594
|
if (!threadId) {
|
|
11516
|
-
const threadStore = (0,
|
|
11595
|
+
const threadStore = (0, import_core53.getStoreLattice)("default", "thread").store;
|
|
11517
11596
|
const newThreadId = (0, import_crypto10.randomUUID)();
|
|
11518
11597
|
console.log({
|
|
11519
11598
|
event: "dispatch:thread:create",
|
|
@@ -11553,7 +11632,7 @@ var MessageRouter = class {
|
|
|
11553
11632
|
senderId: message.sender.id,
|
|
11554
11633
|
contentLength: message.content.text.length
|
|
11555
11634
|
}, "Dispatching to agent");
|
|
11556
|
-
const agent =
|
|
11635
|
+
const agent = import_core53.agentInstanceManager.getAgent({
|
|
11557
11636
|
tenant_id: tenantId,
|
|
11558
11637
|
assistant_id: agentId,
|
|
11559
11638
|
thread_id: threadId,
|
|
@@ -11798,7 +11877,7 @@ function createAuditLoggerMiddleware() {
|
|
|
11798
11877
|
}
|
|
11799
11878
|
|
|
11800
11879
|
// src/index.ts
|
|
11801
|
-
var
|
|
11880
|
+
var import_core57 = require("@axiom-lattice/core");
|
|
11802
11881
|
|
|
11803
11882
|
// src/swagger.ts
|
|
11804
11883
|
var import_swagger = __toESM(require("@fastify/swagger"));
|
|
@@ -11863,7 +11942,7 @@ var configureSwagger = async (app2, customSwaggerConfig, customSwaggerUiConfig)
|
|
|
11863
11942
|
};
|
|
11864
11943
|
|
|
11865
11944
|
// src/services/agent_task_consumer.ts
|
|
11866
|
-
var
|
|
11945
|
+
var import_core54 = require("@axiom-lattice/core");
|
|
11867
11946
|
var handleAgentTask = async (taskRequest, retryCount = 0) => {
|
|
11868
11947
|
const {
|
|
11869
11948
|
assistant_id,
|
|
@@ -11881,17 +11960,17 @@ var handleAgentTask = async (taskRequest, retryCount = 0) => {
|
|
|
11881
11960
|
console.log(
|
|
11882
11961
|
`\u5F00\u59CB\u5904\u7406\u4EFB\u52A1 [assistant_id: ${assistant_id}, thread_id: ${thread_id}]`
|
|
11883
11962
|
);
|
|
11884
|
-
const agent =
|
|
11885
|
-
await agent.addMessage({ input, command, custom_run_config: runConfig },
|
|
11963
|
+
const agent = import_core54.agentInstanceManager.getAgent({ assistant_id, thread_id, tenant_id, workspace_id: runConfig?.workspaceId, project_id: runConfig?.projectId, custom_run_config: runConfig });
|
|
11964
|
+
await agent.addMessage({ input, command, custom_run_config: runConfig }, import_core54.QueueMode.STEER);
|
|
11886
11965
|
if (callback_event) {
|
|
11887
11966
|
agent.subscribeOnce("message:completed", (evt) => {
|
|
11888
|
-
|
|
11967
|
+
import_core54.eventBus.publish(callback_event, {
|
|
11889
11968
|
success: true,
|
|
11890
11969
|
state: evt.state
|
|
11891
11970
|
});
|
|
11892
11971
|
if (main_thread_id && main_tenant_id) {
|
|
11893
11972
|
try {
|
|
11894
|
-
const mainAgent =
|
|
11973
|
+
const mainAgent = import_core54.agentInstanceManager.getAgent({
|
|
11895
11974
|
assistant_id: main_assistant_id ?? assistant_id,
|
|
11896
11975
|
thread_id: main_thread_id,
|
|
11897
11976
|
tenant_id: main_tenant_id,
|
|
@@ -11921,7 +12000,7 @@ ${summary}`
|
|
|
11921
12000
|
}
|
|
11922
12001
|
});
|
|
11923
12002
|
agent.subscribeOnce("message:interrupted", (evt) => {
|
|
11924
|
-
|
|
12003
|
+
import_core54.eventBus.publish(callback_event, {
|
|
11925
12004
|
success: true,
|
|
11926
12005
|
state: evt.state
|
|
11927
12006
|
});
|
|
@@ -11944,7 +12023,7 @@ ${summary}`
|
|
|
11944
12023
|
return handleAgentTask(taskRequest, nextRetryCount);
|
|
11945
12024
|
}
|
|
11946
12025
|
if (callback_event) {
|
|
11947
|
-
|
|
12026
|
+
import_core54.eventBus.publish(callback_event, {
|
|
11948
12027
|
success: false,
|
|
11949
12028
|
error: error instanceof Error ? error.message : String(error)
|
|
11950
12029
|
});
|
|
@@ -11981,7 +12060,7 @@ var _AgentTaskConsumer = class _AgentTaskConsumer {
|
|
|
11981
12060
|
* 初始化事件监听和队列轮询
|
|
11982
12061
|
*/
|
|
11983
12062
|
initialize() {
|
|
11984
|
-
|
|
12063
|
+
import_core54.eventBus.subscribe(import_core54.AGENT_TASK_EVENT, this.trigger_agent_task.bind(this));
|
|
11985
12064
|
this.startPollingQueue();
|
|
11986
12065
|
console.log("Agent\u4EFB\u52A1\u6D88\u8D39\u8005\u5DF2\u542F\u52A8\u5E76\u76D1\u542C\u4EFB\u52A1\u4E8B\u4EF6\u548C\u961F\u5217");
|
|
11987
12066
|
}
|
|
@@ -12100,7 +12179,7 @@ var _AgentTaskConsumer = class _AgentTaskConsumer {
|
|
|
12100
12179
|
handleAgentTask(taskRequest).catch((error) => {
|
|
12101
12180
|
console.error("\u5904\u7406Agent\u4EFB\u52A1\u65F6\u53D1\u751F\u672A\u6355\u83B7\u7684\u9519\u8BEF:", error);
|
|
12102
12181
|
if (taskRequest.callback_event) {
|
|
12103
|
-
|
|
12182
|
+
import_core54.eventBus.publish(taskRequest.callback_event, {
|
|
12104
12183
|
success: false,
|
|
12105
12184
|
error: error instanceof Error ? error.message : String(error)
|
|
12106
12185
|
});
|
|
@@ -12115,7 +12194,7 @@ _AgentTaskConsumer.agent_run_endpoint = "http://localhost:4001/api/runs";
|
|
|
12115
12194
|
var AgentTaskConsumer = _AgentTaskConsumer;
|
|
12116
12195
|
|
|
12117
12196
|
// src/index.ts
|
|
12118
|
-
var
|
|
12197
|
+
var import_core58 = require("@axiom-lattice/core");
|
|
12119
12198
|
var import_protocols5 = require("@axiom-lattice/protocols");
|
|
12120
12199
|
var import_meta = {};
|
|
12121
12200
|
process.on("unhandledRejection", (reason, promise) => {
|
|
@@ -12131,11 +12210,11 @@ var DEFAULT_LOGGER_CONFIG = {
|
|
|
12131
12210
|
var loggerLattice = initializeLogger(DEFAULT_LOGGER_CONFIG);
|
|
12132
12211
|
var logger5 = loggerLattice.client;
|
|
12133
12212
|
function initializeLogger(config) {
|
|
12134
|
-
if (
|
|
12135
|
-
|
|
12213
|
+
if (import_core58.loggerLatticeManager.hasLattice("default")) {
|
|
12214
|
+
import_core58.loggerLatticeManager.removeLattice("default");
|
|
12136
12215
|
}
|
|
12137
|
-
(0,
|
|
12138
|
-
return (0,
|
|
12216
|
+
(0, import_core58.registerLoggerLattice)("default", config);
|
|
12217
|
+
return (0, import_core58.getLoggerLattice)("default");
|
|
12139
12218
|
}
|
|
12140
12219
|
var app = (0, import_fastify.default)({
|
|
12141
12220
|
logger: false,
|
|
@@ -12159,7 +12238,7 @@ var getHeaderValue = (header) => {
|
|
|
12159
12238
|
}
|
|
12160
12239
|
return header;
|
|
12161
12240
|
};
|
|
12162
|
-
var PUBLIC_ROUTES = ["/api/auth/login", "/api/auth/register", "/health"];
|
|
12241
|
+
var PUBLIC_ROUTES = ["/api/auth/login", "/api/auth/register", "/health", "/api/stt/models"];
|
|
12163
12242
|
app.addHook("preHandler", async (request, reply) => {
|
|
12164
12243
|
const user = extractUserFromAuthHeader(request.headers.authorization);
|
|
12165
12244
|
if (user) {
|
|
@@ -12246,7 +12325,7 @@ app.setErrorHandler((error, request, reply) => {
|
|
|
12246
12325
|
});
|
|
12247
12326
|
function getConfiguredSandboxProvider() {
|
|
12248
12327
|
const sandboxProviderType = process.env.SANDBOX_PROVIDER_TYPE || "microsandbox-remote";
|
|
12249
|
-
return (0,
|
|
12328
|
+
return (0, import_core58.createSandboxProvider)({
|
|
12250
12329
|
type: sandboxProviderType,
|
|
12251
12330
|
remoteBaseURL: process.env.SANDBOX_BASE_URL,
|
|
12252
12331
|
microsandboxServiceBaseURL: process.env.MICROSANDBOX_SERVICE_BASE_URL,
|
|
@@ -12262,7 +12341,7 @@ function getConfiguredSandboxProvider() {
|
|
|
12262
12341
|
}
|
|
12263
12342
|
async function restoreMcpConnections() {
|
|
12264
12343
|
try {
|
|
12265
|
-
const storeLattice = (0,
|
|
12344
|
+
const storeLattice = (0, import_core58.getStoreLattice)("default", "mcp");
|
|
12266
12345
|
const store2 = storeLattice.store;
|
|
12267
12346
|
if (!store2) {
|
|
12268
12347
|
logger5.info("MCP store not configured, skipping connection restoration");
|
|
@@ -12276,15 +12355,15 @@ async function restoreMcpConnections() {
|
|
|
12276
12355
|
for (const config of connectedConfigs) {
|
|
12277
12356
|
try {
|
|
12278
12357
|
const connection = convertToConnection2(config.config);
|
|
12279
|
-
|
|
12358
|
+
import_core58.mcpManager.addServer(config.key, connection);
|
|
12280
12359
|
} catch (err) {
|
|
12281
12360
|
logger5.warn(`Failed to prepare MCP server "${config.key}" for restoration`, { error: err });
|
|
12282
12361
|
}
|
|
12283
12362
|
}
|
|
12284
|
-
await
|
|
12363
|
+
await import_core58.mcpManager.connect();
|
|
12285
12364
|
for (const config of connectedConfigs) {
|
|
12286
12365
|
try {
|
|
12287
|
-
await
|
|
12366
|
+
await import_core58.mcpManager.registerToolsToToolLattice(config.key, config.selectedTools);
|
|
12288
12367
|
logger5.info(`MCP server "${config.key}" restored with ${config.selectedTools.length} tools`);
|
|
12289
12368
|
} catch (err) {
|
|
12290
12369
|
logger5.warn(`Failed to register tools for MCP server "${config.key}"`, { error: err });
|
|
@@ -12317,7 +12396,7 @@ var start = async (config) => {
|
|
|
12317
12396
|
const { getStoreLattice: getStore15 } = await import("@axiom-lattice/core");
|
|
12318
12397
|
const bindingStore = getStore15("default", "channelBinding").store;
|
|
12319
12398
|
const installationStore = getStore15("default", "channelInstallation").store;
|
|
12320
|
-
(0,
|
|
12399
|
+
(0, import_core57.setBindingRegistry)(bindingStore);
|
|
12321
12400
|
const router = new MessageRouter({
|
|
12322
12401
|
middlewares: [
|
|
12323
12402
|
createDeduplicationMiddleware(),
|
|
@@ -12342,10 +12421,10 @@ var start = async (config) => {
|
|
|
12342
12421
|
error: err instanceof Error ? err.message : String(err)
|
|
12343
12422
|
});
|
|
12344
12423
|
}
|
|
12345
|
-
(0,
|
|
12424
|
+
(0, import_core57.setEvalRunService)(evalRunner);
|
|
12346
12425
|
try {
|
|
12347
|
-
const menuStore = (0,
|
|
12348
|
-
(0,
|
|
12426
|
+
const menuStore = (0, import_core58.getStoreLattice)("default", "menu").store;
|
|
12427
|
+
(0, import_core57.setMenuRegistry)(menuStore);
|
|
12349
12428
|
logger5.info("Menu registry initialized");
|
|
12350
12429
|
} catch {
|
|
12351
12430
|
}
|
|
@@ -12354,17 +12433,17 @@ var start = async (config) => {
|
|
|
12354
12433
|
setChannelControllerDeps({ adapterRegistry, router: channelDeps.router });
|
|
12355
12434
|
}
|
|
12356
12435
|
registerLatticeRoutes(app, channelDeps);
|
|
12357
|
-
if (!
|
|
12358
|
-
|
|
12436
|
+
if (!import_core58.sandboxLatticeManager.hasLattice("default")) {
|
|
12437
|
+
import_core58.sandboxLatticeManager.registerLattice("default", getConfiguredSandboxProvider());
|
|
12359
12438
|
logger5.info("Registered sandbox manager from env configuration");
|
|
12360
12439
|
}
|
|
12361
12440
|
try {
|
|
12362
12441
|
const { ResourceController: ResourceController2 } = await Promise.resolve().then(() => (init_resources(), resources_exports));
|
|
12363
|
-
const sharedResourceStore = (0,
|
|
12364
|
-
const cache = new
|
|
12442
|
+
const sharedResourceStore = (0, import_core58.getStoreLattice)("default", "sharedResource").store;
|
|
12443
|
+
const cache = new import_core58.TokenCache();
|
|
12365
12444
|
const resourceController = new ResourceController2({
|
|
12366
12445
|
store: sharedResourceStore,
|
|
12367
|
-
sandboxManager:
|
|
12446
|
+
sandboxManager: import_core58.sandboxLatticeManager,
|
|
12368
12447
|
cache,
|
|
12369
12448
|
logger: logger5
|
|
12370
12449
|
});
|
|
@@ -12405,7 +12484,7 @@ var start = async (config) => {
|
|
|
12405
12484
|
}
|
|
12406
12485
|
}
|
|
12407
12486
|
if (process.env.AXIOM_RESTORE_PENDING_ON_STARTUP === "true") {
|
|
12408
|
-
|
|
12487
|
+
import_core58.agentInstanceManager.restore().then((stats) => {
|
|
12409
12488
|
logger5.info(`Agent recovery complete: ${stats.restored} threads restored, ${stats.errors} errors`);
|
|
12410
12489
|
}).catch((error) => {
|
|
12411
12490
|
logger5.error("Agent recovery failed", { error });
|