@axiom-lattice/gateway 8.0.0 → 8.0.2
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/dist/embed/{embed-page-AgentDetailSideApp-NK6VQBXS.js → embed-page-AgentDetailSideApp-23TCREK6.js} +1 -1
- package/dist/embed/embed-page-AgentGovernanceWorkbench-N3F65F3W.js +1 -0
- package/dist/embed/{embed-page-LangfuseDashboard-EYK2T2VK.js → embed-page-LangfuseDashboard-WBE7GJPU.js} +1 -1
- package/dist/embed/{embed-page-MessageGraph-P73B52OR.js → embed-page-MessageGraph-T3EFAXTX.js} +1 -1
- package/dist/embed/{embed-page-ReactChart-LK6DUA4R.js → embed-page-ReactChart-FJFQU4IV.js} +1 -1
- package/dist/embed/{embed-page-SkillFlow-54RIT6M2.js → embed-page-SkillFlow-2BUXCLAL.js} +1 -1
- package/dist/embed/{embed-page-TasksSideApp-RK64OPAA.js → embed-page-TasksSideApp-VFKEYFGR.js} +1 -1
- package/dist/embed/{embed-page-ThreadMaintenancePanel-PI3U76W3.js → embed-page-ThreadMaintenancePanel-EPBJ4J3L.js} +1 -1
- package/dist/embed/{embed-page-TopologyRuntimeView-X6QPRQE2.js → embed-page-TopologyRuntimeView-OWESU7IK.js} +1 -1
- package/dist/embed/{embed-page-WorkflowAutomationView-3PE6YCRK.js → embed-page-WorkflowAutomationView-5J2RQTZ7.js} +1 -1
- package/dist/embed/{embed-page-chunk-BD7DUF2M.js → embed-page-chunk-2ZBEWYJQ.js} +1 -1
- package/dist/embed/{embed-page-chunk-AICFKU43.js → embed-page-chunk-34RWKVD7.js} +1 -1
- package/dist/embed/{embed-page-chunk-GYO2ELMI.js → embed-page-chunk-6QLLZJVH.js} +1 -1
- package/dist/embed/embed-page-chunk-B2KNZ3EW.js +59 -0
- package/dist/embed/{embed-page-chunk-UV6IYDW5.js → embed-page-chunk-BFVNPGSW.js} +1 -1
- package/dist/embed/embed-page-chunk-CKUSXUKW.js +6746 -0
- package/dist/embed/{embed-page-chunk-YWJQVBZV.js → embed-page-chunk-CQLDPGEG.js} +1 -1
- package/dist/embed/{embed-page-chunk-TSZQWEXD.js → embed-page-chunk-DJKD2PHO.js} +1 -1
- package/dist/embed/{embed-page-chunk-KF3HZ4TX.js → embed-page-chunk-EU32IF7M.js} +1 -1
- package/dist/embed/{embed-page-chunk-T2HKN7ZS.js → embed-page-chunk-F7TA3LRH.js} +1 -1
- package/dist/embed/embed-page-chunk-F7ZUYG42.js +121 -0
- package/dist/embed/{embed-page-chunk-3VNL5M2Q.js → embed-page-chunk-GSUSX54K.js} +1 -1
- package/dist/embed/embed-page-chunk-JMTQCORF.js +211 -0
- package/dist/embed/{embed-page-chunk-US46Q3B7.js → embed-page-chunk-L7TDL27M.js} +2 -2
- package/dist/embed/{embed-page-chunk-OIML5DX4.js → embed-page-chunk-PTKGTA4B.js} +1 -1
- package/dist/embed/{embed-page-chunk-767LVAGR.js → embed-page-chunk-R7TLHZR3.js} +1 -1
- package/dist/embed/{embed-page-chunk-OKZPPZMF.js → embed-page-chunk-WKQHSEZ4.js} +1 -1
- package/dist/embed/{embed-page-code-highlighter-DD23LJY3.js → embed-page-code-highlighter-72YW5HXH.js} +1 -1
- package/dist/embed/embed-page-en-G5J7KW6V.js +1 -0
- package/dist/embed/embed-page-en-HDSVQ4O6.js +1 -0
- package/dist/embed/embed-page-en-TSCGSJAI.js +1 -0
- package/dist/embed/{embed-page-mermaid-IN3A3YH2.js → embed-page-mermaid-4PZJJXQU.js} +1 -1
- package/dist/embed/embed-page-zh-72QSTYRF.js +1 -0
- package/dist/embed/embed-page-zh-IR652A6J.js +1 -0
- package/dist/embed/embed-page-zh-Q22DIOB3.js +1 -0
- package/dist/embed/embed-page.js +1 -1
- package/dist/index.d.mts +19 -11
- package/dist/index.d.ts +19 -11
- package/dist/index.js +316 -190
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +167 -37
- package/dist/index.mjs.map +1 -1
- package/package.json +7 -7
- package/dist/embed/embed-page-AgentGovernanceWorkbench-TKVV2GA6.js +0 -1
- package/dist/embed/embed-page-chunk-A5GIM22E.js +0 -117
- package/dist/embed/embed-page-chunk-EB43T3BJ.js +0 -6746
- package/dist/embed/embed-page-chunk-MEY3NEJZ.js +0 -211
- package/dist/embed/embed-page-chunk-WXMPVIXV.js +0 -59
- package/dist/embed/embed-page-en-27OIE2UA.js +0 -1
- package/dist/embed/embed-page-en-PQOH5CU4.js +0 -1
- package/dist/embed/embed-page-en-X6B6RVNL.js +0 -1
- package/dist/embed/embed-page-zh-EQ5X2M32.js +0 -1
- package/dist/embed/embed-page-zh-FXQGY5HD.js +0 -1
- package/dist/embed/embed-page-zh-XO36BV2R.js +0 -1
package/dist/index.js
CHANGED
|
@@ -1024,11 +1024,11 @@ function devModeDefaults() {
|
|
|
1024
1024
|
const projectId = process.env[DEFAULT_PROJECT_ENV] || void 0;
|
|
1025
1025
|
return { tenantId, projectId };
|
|
1026
1026
|
}
|
|
1027
|
-
var
|
|
1027
|
+
var import_protocols34, A2AAuthError, DEFAULT_TENANT_ENV, DEFAULT_TENANT_ID, DEFAULT_PROJECT_ENV, BEARER_SCHEME_RE, A2AAuthService;
|
|
1028
1028
|
var init_A2AAuthService = __esm({
|
|
1029
1029
|
"src/services/a2a/A2AAuthService.ts"() {
|
|
1030
1030
|
"use strict";
|
|
1031
|
-
|
|
1031
|
+
import_protocols34 = require("@axiom-lattice/protocols");
|
|
1032
1032
|
A2AAuthError = class extends Error {
|
|
1033
1033
|
constructor(message, statusCode) {
|
|
1034
1034
|
super(message);
|
|
@@ -1083,7 +1083,7 @@ var init_A2AAuthService = __esm({
|
|
|
1083
1083
|
const entry = merged.get(token);
|
|
1084
1084
|
if (!entry) return { authenticated: false };
|
|
1085
1085
|
const hasExplicitGrants = Array.isArray(entry.grants) && entry.grants.length > 0;
|
|
1086
|
-
const agentGrant = (0,
|
|
1086
|
+
const agentGrant = (0, import_protocols34.effectiveGrants)(entry).find((g) => g.domain === "agent");
|
|
1087
1087
|
const assistantIds = hasExplicitGrants ? agentGrant?.items ?? [] : entry.assistantIds;
|
|
1088
1088
|
return {
|
|
1089
1089
|
authenticated: true,
|
|
@@ -3886,19 +3886,19 @@ function messageIdFromRun(run2) {
|
|
|
3886
3886
|
if (run2.inputMessageIds.length > 0) return run2.inputMessageIds[0];
|
|
3887
3887
|
return run2.runId;
|
|
3888
3888
|
}
|
|
3889
|
-
var import_node_crypto40, import_core108,
|
|
3889
|
+
var import_node_crypto40, import_core108, import_protocols40, TERMINAL_STREAM_CHUNK_TYPES, A2ARunNotFoundError, TERMINAL_STATUSES, A2ARunService;
|
|
3890
3890
|
var init_A2ARunService = __esm({
|
|
3891
3891
|
"src/services/a2a/A2ARunService.ts"() {
|
|
3892
3892
|
"use strict";
|
|
3893
3893
|
import_node_crypto40 = require("crypto");
|
|
3894
3894
|
import_core108 = require("@axiom-lattice/core");
|
|
3895
|
-
|
|
3895
|
+
import_protocols40 = require("@axiom-lattice/protocols");
|
|
3896
3896
|
init_runCancelRuntime();
|
|
3897
3897
|
init_runTaskRuntimeRegistry();
|
|
3898
3898
|
TERMINAL_STREAM_CHUNK_TYPES = /* @__PURE__ */ new Set([
|
|
3899
|
-
|
|
3900
|
-
|
|
3901
|
-
|
|
3899
|
+
import_protocols40.MessageChunkTypes.MESSAGE_COMPLETED,
|
|
3900
|
+
import_protocols40.MessageChunkTypes.MESSAGE_FAILED,
|
|
3901
|
+
import_protocols40.MessageChunkTypes.INTERRUPT
|
|
3902
3902
|
]);
|
|
3903
3903
|
A2ARunNotFoundError = class extends Error {
|
|
3904
3904
|
constructor(runId) {
|
|
@@ -4196,13 +4196,13 @@ function assistantHasGovernedTask(assistant) {
|
|
|
4196
4196
|
const allowedTools = taskMiddleware?.allowedTools;
|
|
4197
4197
|
return !!taskMiddleware && (allowedTools === void 0 || Array.isArray(allowedTools) && (allowedTools.length === 0 || allowedTools.includes("manage_task")));
|
|
4198
4198
|
}
|
|
4199
|
-
var import_uuid12, import_core109,
|
|
4199
|
+
var import_uuid12, import_core109, import_protocols41, import_server2, A2ABlockingDeadlineError, TERMINAL_A2A_STATES, AxiomAgentExecutor;
|
|
4200
4200
|
var init_AxiomAgentExecutor = __esm({
|
|
4201
4201
|
"src/services/a2a/AxiomAgentExecutor.ts"() {
|
|
4202
4202
|
"use strict";
|
|
4203
4203
|
import_uuid12 = require("uuid");
|
|
4204
4204
|
import_core109 = require("@axiom-lattice/core");
|
|
4205
|
-
|
|
4205
|
+
import_protocols41 = require("@axiom-lattice/protocols");
|
|
4206
4206
|
import_server2 = require("@a2a-js/sdk/server");
|
|
4207
4207
|
init_a2aFileRefs();
|
|
4208
4208
|
init_A2ARunService();
|
|
@@ -4370,10 +4370,10 @@ var init_AxiomAgentExecutor = __esm({
|
|
|
4370
4370
|
if (dropChunks) return;
|
|
4371
4371
|
const chunk = next.value;
|
|
4372
4372
|
const chunkText = chunk.data?.content ?? "";
|
|
4373
|
-
if (chunk.type ===
|
|
4373
|
+
if (chunk.type === import_protocols41.MessageChunkTypes.AI && chunkText) {
|
|
4374
4374
|
outputText += chunkText;
|
|
4375
4375
|
}
|
|
4376
|
-
if ((chunk.type ===
|
|
4376
|
+
if ((chunk.type === import_protocols41.MessageChunkTypes.AI || chunk.type === import_protocols41.MessageChunkTypes.TOOL) && chunkText) {
|
|
4377
4377
|
bus.publish({
|
|
4378
4378
|
kind: "status-update",
|
|
4379
4379
|
taskId: ctx.taskId,
|
|
@@ -5111,7 +5111,7 @@ function chunksFromThreadStream(buffer, key, cursor) {
|
|
|
5111
5111
|
if (record.kind === "end") return;
|
|
5112
5112
|
if (record.kind !== "chunk") continue;
|
|
5113
5113
|
yield record.chunk;
|
|
5114
|
-
if (record.chunk.type ===
|
|
5114
|
+
if (record.chunk.type === import_protocols42.MessageChunkTypes.MESSAGE_COMPLETED || record.chunk.type === import_protocols42.MessageChunkTypes.MESSAGE_FAILED || record.chunk.type === import_protocols42.MessageChunkTypes.INTERRUPT) {
|
|
5115
5115
|
return;
|
|
5116
5116
|
}
|
|
5117
5117
|
}
|
|
@@ -5132,7 +5132,7 @@ function runServiceChunkSource(scope) {
|
|
|
5132
5132
|
return stopAtTerminalChunks(
|
|
5133
5133
|
import_core110.agentInstanceManager.getAgent(agentParamsFor(scope, threadId, assistantId)).chunkStream(
|
|
5134
5134
|
messageId,
|
|
5135
|
-
[
|
|
5135
|
+
[import_protocols42.MessageChunkTypes.MESSAGE_COMPLETED, import_protocols42.MessageChunkTypes.MESSAGE_FAILED]
|
|
5136
5136
|
)
|
|
5137
5137
|
);
|
|
5138
5138
|
},
|
|
@@ -5837,7 +5837,7 @@ function registerA2AStandardRoutes(app2, deps) {
|
|
|
5837
5837
|
if (next.done) break;
|
|
5838
5838
|
const chunk = next.value;
|
|
5839
5839
|
const text = chunk.data?.content ?? "";
|
|
5840
|
-
if (chunk.type ===
|
|
5840
|
+
if (chunk.type === import_protocols42.MessageChunkTypes.AI && text) {
|
|
5841
5841
|
await writeFrame(resultFrame({
|
|
5842
5842
|
kind: "status-update",
|
|
5843
5843
|
taskId: task.id,
|
|
@@ -5850,7 +5850,7 @@ function registerA2AStandardRoutes(app2, deps) {
|
|
|
5850
5850
|
final: false
|
|
5851
5851
|
}));
|
|
5852
5852
|
}
|
|
5853
|
-
if (chunk.type ===
|
|
5853
|
+
if (chunk.type === import_protocols42.MessageChunkTypes.MESSAGE_COMPLETED || chunk.type === import_protocols42.MessageChunkTypes.MESSAGE_FAILED || chunk.type === import_protocols42.MessageChunkTypes.INTERRUPT) {
|
|
5854
5854
|
break;
|
|
5855
5855
|
}
|
|
5856
5856
|
}
|
|
@@ -6514,7 +6514,7 @@ data: ${JSON.stringify(errorResponse)}
|
|
|
6514
6514
|
}
|
|
6515
6515
|
);
|
|
6516
6516
|
}
|
|
6517
|
-
var import_uuid13, import_server4, import_sdk_v1, import_core110,
|
|
6517
|
+
var import_uuid13, import_server4, import_sdk_v1, import_core110, import_protocols42, TERMINAL_A2A_STATES2, TERMINAL_RUN_STATUSES, RESUBSCRIBE_SETTLE_TIMEOUT_MS, DEFAULT_A2A_TASKS_PAGE_SIZE, MAX_A2A_TASKS_PAGE_SIZE, TASKS_LIST_STATUSES, SSE_HEADERS;
|
|
6518
6518
|
var init_a2a_standard = __esm({
|
|
6519
6519
|
"src/routes/a2a-standard.ts"() {
|
|
6520
6520
|
"use strict";
|
|
@@ -6522,7 +6522,7 @@ var init_a2a_standard = __esm({
|
|
|
6522
6522
|
import_server4 = require("@a2a-js/sdk/server");
|
|
6523
6523
|
import_sdk_v1 = require("@a2a-js/sdk-v1");
|
|
6524
6524
|
import_core110 = require("@axiom-lattice/core");
|
|
6525
|
-
|
|
6525
|
+
import_protocols42 = require("@axiom-lattice/protocols");
|
|
6526
6526
|
init_A2AAuthService();
|
|
6527
6527
|
init_A2AAgentCardBuilder();
|
|
6528
6528
|
init_A2AAgentCardBuilderV1();
|
|
@@ -6577,11 +6577,11 @@ var init_a2a_standard = __esm({
|
|
|
6577
6577
|
});
|
|
6578
6578
|
|
|
6579
6579
|
// src/services/open/openAuthService.ts
|
|
6580
|
-
var
|
|
6580
|
+
var import_protocols43, OpenAuthService;
|
|
6581
6581
|
var init_openAuthService = __esm({
|
|
6582
6582
|
"src/services/open/openAuthService.ts"() {
|
|
6583
6583
|
"use strict";
|
|
6584
|
-
|
|
6584
|
+
import_protocols43 = require("@axiom-lattice/protocols");
|
|
6585
6585
|
OpenAuthService = class {
|
|
6586
6586
|
constructor(keyStore) {
|
|
6587
6587
|
this.keyStore = keyStore;
|
|
@@ -6595,7 +6595,7 @@ var init_openAuthService = __esm({
|
|
|
6595
6595
|
kind: "api_key",
|
|
6596
6596
|
tenantId: record.tenantId,
|
|
6597
6597
|
projectId: record.projectId,
|
|
6598
|
-
grants: (0,
|
|
6598
|
+
grants: (0, import_protocols43.effectiveGrants)(record)
|
|
6599
6599
|
};
|
|
6600
6600
|
}
|
|
6601
6601
|
};
|
|
@@ -6603,11 +6603,11 @@ var init_openAuthService = __esm({
|
|
|
6603
6603
|
});
|
|
6604
6604
|
|
|
6605
6605
|
// src/services/open/openCredentialService.ts
|
|
6606
|
-
var
|
|
6606
|
+
var import_protocols44, OpenCredentialService;
|
|
6607
6607
|
var init_openCredentialService = __esm({
|
|
6608
6608
|
"src/services/open/openCredentialService.ts"() {
|
|
6609
6609
|
"use strict";
|
|
6610
|
-
|
|
6610
|
+
import_protocols44 = require("@axiom-lattice/protocols");
|
|
6611
6611
|
init_openToken();
|
|
6612
6612
|
init_openAuthService();
|
|
6613
6613
|
OpenCredentialService = class {
|
|
@@ -7336,8 +7336,8 @@ function registerOpenRoutes(app2, deps = {}) {
|
|
|
7336
7336
|
const rateLimiter = deps.rateLimiter ?? new OpenRateLimiter();
|
|
7337
7337
|
const markReplica = (reply) => {
|
|
7338
7338
|
const replica = (0, import_core113.getReplicaId)();
|
|
7339
|
-
reply.header(
|
|
7340
|
-
reply.raw.setHeader(
|
|
7339
|
+
reply.header(import_protocols45.REPLICA_HEADER, replica);
|
|
7340
|
+
reply.raw.setHeader(import_protocols45.REPLICA_HEADER, replica);
|
|
7341
7341
|
};
|
|
7342
7342
|
const buildServerFor = async (context, log2) => {
|
|
7343
7343
|
const grants = grantsSource(context);
|
|
@@ -7486,12 +7486,12 @@ function registerOpenRoutes(app2, deps = {}) {
|
|
|
7486
7486
|
app2.delete("/mcp", methodNotAllowed);
|
|
7487
7487
|
app2.delete("/mcp/", methodNotAllowed);
|
|
7488
7488
|
}
|
|
7489
|
-
var import_core113,
|
|
7489
|
+
var import_core113, import_protocols45, RPC_ERROR;
|
|
7490
7490
|
var init_open = __esm({
|
|
7491
7491
|
"src/routes/open.ts"() {
|
|
7492
7492
|
"use strict";
|
|
7493
7493
|
import_core113 = require("@axiom-lattice/core");
|
|
7494
|
-
|
|
7494
|
+
import_protocols45 = require("@axiom-lattice/protocols");
|
|
7495
7495
|
init_openCredentialService();
|
|
7496
7496
|
init_openAuditService();
|
|
7497
7497
|
init_openRateLimiter();
|
|
@@ -7978,7 +7978,7 @@ function registerOpenExposureRoutes(app2, deps = {}) {
|
|
|
7978
7978
|
if (!record || record.tenantId !== tenantId) {
|
|
7979
7979
|
return reply.status(404).send({ success: false, error: "Key not found" });
|
|
7980
7980
|
}
|
|
7981
|
-
const grants = (0,
|
|
7981
|
+
const grants = (0, import_protocols46.effectiveGrants)(record);
|
|
7982
7982
|
const forwardedHost = request.headers["x-forwarded-host"];
|
|
7983
7983
|
const host = (Array.isArray(forwardedHost) ? forwardedHost[0] : forwardedHost) ?? (Array.isArray(request.headers.host) ? request.headers.host[0] : request.headers.host) ?? request.hostname;
|
|
7984
7984
|
const baseUrl = `${request.protocol}://${host}`;
|
|
@@ -8054,12 +8054,12 @@ function registerOpenExposureRoutes(app2, deps = {}) {
|
|
|
8054
8054
|
}
|
|
8055
8055
|
);
|
|
8056
8056
|
}
|
|
8057
|
-
var import_core120,
|
|
8057
|
+
var import_core120, import_protocols46;
|
|
8058
8058
|
var init_open_exposure = __esm({
|
|
8059
8059
|
"src/routes/open-exposure.ts"() {
|
|
8060
8060
|
"use strict";
|
|
8061
8061
|
import_core120 = require("@axiom-lattice/core");
|
|
8062
|
-
|
|
8062
|
+
import_protocols46 = require("@axiom-lattice/protocols");
|
|
8063
8063
|
init_openLattice();
|
|
8064
8064
|
init_tenantOpenPlugins();
|
|
8065
8065
|
init_A2AAgentCardBuilder();
|
|
@@ -8192,8 +8192,8 @@ function createAgentProvider(deps = {}) {
|
|
|
8192
8192
|
const stream = agent.chunkStream(messageId, [...STOP_TYPES]);
|
|
8193
8193
|
for await (const chunk of stream) {
|
|
8194
8194
|
const text = chunk.data?.content;
|
|
8195
|
-
if (chunk.type ===
|
|
8196
|
-
if (chunk.type ===
|
|
8195
|
+
if (chunk.type === import_protocols47.MessageChunkTypes.INTERRUPT) break;
|
|
8196
|
+
if (chunk.type === import_protocols47.MessageChunkTypes.AI && text) {
|
|
8197
8197
|
parts.push(text);
|
|
8198
8198
|
}
|
|
8199
8199
|
}
|
|
@@ -8203,14 +8203,14 @@ function createAgentProvider(deps = {}) {
|
|
|
8203
8203
|
}
|
|
8204
8204
|
};
|
|
8205
8205
|
}
|
|
8206
|
-
var import_zod25, import_core121,
|
|
8206
|
+
var import_zod25, import_core121, import_protocols47, STOP_TYPES;
|
|
8207
8207
|
var init_agentProvider = __esm({
|
|
8208
8208
|
"src/services/open/providers/agentProvider.ts"() {
|
|
8209
8209
|
"use strict";
|
|
8210
8210
|
import_zod25 = require("zod");
|
|
8211
8211
|
import_core121 = require("@axiom-lattice/core");
|
|
8212
|
-
|
|
8213
|
-
STOP_TYPES = [
|
|
8212
|
+
import_protocols47 = require("@axiom-lattice/protocols");
|
|
8213
|
+
STOP_TYPES = [import_protocols47.MessageChunkTypes.MESSAGE_COMPLETED];
|
|
8214
8214
|
}
|
|
8215
8215
|
});
|
|
8216
8216
|
|
|
@@ -8743,7 +8743,7 @@ var import_path = __toESM(require("path"));
|
|
|
8743
8743
|
|
|
8744
8744
|
// src/routes/index.ts
|
|
8745
8745
|
var import_node_crypto35 = require("crypto");
|
|
8746
|
-
var
|
|
8746
|
+
var import_protocols33 = require("@axiom-lattice/protocols");
|
|
8747
8747
|
|
|
8748
8748
|
// src/controllers/assistant.ts
|
|
8749
8749
|
var import_core = require("@axiom-lattice/core");
|
|
@@ -25555,6 +25555,7 @@ function registerA2ABridgeRoutes(app2) {
|
|
|
25555
25555
|
|
|
25556
25556
|
// src/routes/stt.ts
|
|
25557
25557
|
var import_core59 = require("@axiom-lattice/core");
|
|
25558
|
+
var import_protocols11 = require("@axiom-lattice/protocols");
|
|
25558
25559
|
function tenantIdOf(request) {
|
|
25559
25560
|
try {
|
|
25560
25561
|
return resolveTenantScope(request, false).tenantId;
|
|
@@ -25615,12 +25616,19 @@ var registerSTTRoutes = (app2) => {
|
|
|
25615
25616
|
return reply.status(400).send({ error: `Unsupported audio format: ${format}` });
|
|
25616
25617
|
}
|
|
25617
25618
|
try {
|
|
25619
|
+
const requestedKey = modelKey2 || import_protocols11.ASR_DEFAULT_KEY;
|
|
25618
25620
|
const client = await import_core59.sttModelLatticeManager.getSTTClientWithTenantAsync(
|
|
25619
25621
|
tenantIdOf(request),
|
|
25620
|
-
|
|
25622
|
+
requestedKey
|
|
25623
|
+
) ?? (requestedKey === import_protocols11.ASR_DEFAULT_KEY ? void 0 : await import_core59.sttModelLatticeManager.getSTTClientWithTenantAsync(
|
|
25624
|
+
tenantIdOf(request),
|
|
25625
|
+
import_protocols11.ASR_DEFAULT_KEY
|
|
25626
|
+
)) ?? await import_core59.sttModelLatticeManager.getSTTClientWithTenantAsync(
|
|
25627
|
+
tenantIdOf(request),
|
|
25628
|
+
"default"
|
|
25621
25629
|
);
|
|
25622
25630
|
if (!client) {
|
|
25623
|
-
return reply.status(404).send({ error: `STT model "${
|
|
25631
|
+
return reply.status(404).send({ error: `STT model "${requestedKey}" not found` });
|
|
25624
25632
|
}
|
|
25625
25633
|
const result = await client.transcribe(buffer, format);
|
|
25626
25634
|
return reply.send({
|
|
@@ -25641,7 +25649,7 @@ var registerSTTRoutes = (app2) => {
|
|
|
25641
25649
|
|
|
25642
25650
|
// src/controllers/local-a2a.ts
|
|
25643
25651
|
var import_core60 = require("@axiom-lattice/core");
|
|
25644
|
-
var
|
|
25652
|
+
var import_protocols12 = require("@axiom-lattice/protocols");
|
|
25645
25653
|
function getTenantId24(request) {
|
|
25646
25654
|
const userTenantId = request.user?.tenantId;
|
|
25647
25655
|
if (userTenantId) return userTenantId;
|
|
@@ -25650,7 +25658,7 @@ function getTenantId24(request) {
|
|
|
25650
25658
|
function getLocalRuntime(assistant) {
|
|
25651
25659
|
const graphDefinition = assistant.graphDefinition;
|
|
25652
25660
|
if (!graphDefinition || typeof graphDefinition !== "object") return void 0;
|
|
25653
|
-
if (graphDefinition.type !==
|
|
25661
|
+
if (graphDefinition.type !== import_protocols12.AgentType.A2A_REMOTE) return void 0;
|
|
25654
25662
|
return graphDefinition.localRuntime;
|
|
25655
25663
|
}
|
|
25656
25664
|
async function getLocalA2AAssistants(tenantId) {
|
|
@@ -25911,14 +25919,14 @@ function registerTaskRoutes(app2, controller) {
|
|
|
25911
25919
|
var import_core72 = require("@axiom-lattice/core");
|
|
25912
25920
|
|
|
25913
25921
|
// src/controllers/tasks.ts
|
|
25914
|
-
var
|
|
25922
|
+
var import_protocols16 = require("@axiom-lattice/protocols");
|
|
25915
25923
|
var import_core62 = require("@axiom-lattice/core");
|
|
25916
25924
|
|
|
25917
25925
|
// src/services/collaboration/ProjectTaskThreadService.ts
|
|
25918
|
-
var
|
|
25926
|
+
var import_protocols14 = require("@axiom-lattice/protocols");
|
|
25919
25927
|
|
|
25920
25928
|
// src/services/collaboration/ProjectTaskSnapshots.ts
|
|
25921
|
-
var
|
|
25929
|
+
var import_protocols13 = require("@axiom-lattice/protocols");
|
|
25922
25930
|
function snapshotJsonValue(value, stack = /* @__PURE__ */ new WeakSet()) {
|
|
25923
25931
|
if (value === null || typeof value === "string" || typeof value === "boolean") return value;
|
|
25924
25932
|
if (typeof value === "number" && Number.isFinite(value)) return value;
|
|
@@ -25964,7 +25972,7 @@ function cloneExactDate(value) {
|
|
|
25964
25972
|
}
|
|
25965
25973
|
}
|
|
25966
25974
|
function snapshotTaskItem(value) {
|
|
25967
|
-
const row = (0,
|
|
25975
|
+
const row = (0, import_protocols13.snapshotExactRecord)(value, [
|
|
25968
25976
|
"id",
|
|
25969
25977
|
"tenantId",
|
|
25970
25978
|
"ownerType",
|
|
@@ -26032,7 +26040,7 @@ function snapshotTaskItem(value) {
|
|
|
26032
26040
|
}
|
|
26033
26041
|
}
|
|
26034
26042
|
function snapshotProjectRoom(value) {
|
|
26035
|
-
const row = (0,
|
|
26043
|
+
const row = (0, import_protocols13.snapshotExactRecord)(value, ["id", "tenantId", "workspaceId", "projectId", "type", "name", "createdAt", "updatedAt"]);
|
|
26036
26044
|
const createdAt = cloneExactDate(row?.createdAt);
|
|
26037
26045
|
const updatedAt = cloneExactDate(row?.updatedAt);
|
|
26038
26046
|
if (!row || !createdAt || !updatedAt || row.type !== "main") return void 0;
|
|
@@ -26051,7 +26059,7 @@ function snapshotProjectRoom(value) {
|
|
|
26051
26059
|
};
|
|
26052
26060
|
}
|
|
26053
26061
|
function snapshotBotMembership(value) {
|
|
26054
|
-
const row = (0,
|
|
26062
|
+
const row = (0, import_protocols13.snapshotExactRecord)(value, [
|
|
26055
26063
|
"id",
|
|
26056
26064
|
"tenantId",
|
|
26057
26065
|
"workspaceId",
|
|
@@ -26090,7 +26098,7 @@ function snapshotBotMembership(value) {
|
|
|
26090
26098
|
};
|
|
26091
26099
|
}
|
|
26092
26100
|
function snapshotThread(value) {
|
|
26093
|
-
const row = (0,
|
|
26101
|
+
const row = (0, import_protocols13.snapshotExactRecord)(value, ["id", "tenantId", "assistantId", "createdAt", "updatedAt"], ["metadata", "expiresAt"]);
|
|
26094
26102
|
const createdAt = cloneExactDate(row?.createdAt);
|
|
26095
26103
|
const updatedAt = cloneExactDate(row?.updatedAt);
|
|
26096
26104
|
const expiresAt = cloneExactDate(row?.expiresAt);
|
|
@@ -26115,7 +26123,7 @@ function isRecord8(value) {
|
|
|
26115
26123
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
26116
26124
|
}
|
|
26117
26125
|
function isTaskFileRef(value) {
|
|
26118
|
-
const row = (0,
|
|
26126
|
+
const row = (0, import_protocols13.snapshotExactRecord)(value, ["uri"], ["name", "mimeType", "addedBy"]);
|
|
26119
26127
|
return !!row && typeof row.uri === "string" && !!row.uri && (row.name === void 0 || typeof row.name === "string") && (row.mimeType === void 0 || typeof row.mimeType === "string") && (row.addedBy === void 0 || row.addedBy === "user" || row.addedBy === "agent");
|
|
26120
26128
|
}
|
|
26121
26129
|
|
|
@@ -26215,7 +26223,7 @@ function taskMetadata(task, room, membership) {
|
|
|
26215
26223
|
};
|
|
26216
26224
|
}
|
|
26217
26225
|
function exactTaskMetadata(value, expected) {
|
|
26218
|
-
const row = (0,
|
|
26226
|
+
const row = (0, import_protocols14.snapshotExactRecord)(value, [
|
|
26219
26227
|
"source",
|
|
26220
26228
|
"kind",
|
|
26221
26229
|
"workspaceId",
|
|
@@ -26228,7 +26236,7 @@ function exactTaskMetadata(value, expected) {
|
|
|
26228
26236
|
return !!row && row.source === expected.source && row.kind === expected.kind && row.workspaceId === expected.workspaceId && row.projectId === expected.projectId && row.roomId === expected.roomId && row.membershipId === expected.membershipId && row.assistantId === expected.assistantId && row.taskId === expected.taskId && row.parentTaskId === expected.parentTaskId && Object.prototype.hasOwnProperty.call(row, "parentTaskId") === Object.prototype.hasOwnProperty.call(expected, "parentTaskId");
|
|
26229
26237
|
}
|
|
26230
26238
|
function snapshotEnsureInput(input) {
|
|
26231
|
-
const row = (0,
|
|
26239
|
+
const row = (0, import_protocols14.snapshotExactRecord)(input, ["task", "room", "membership", "mode"]);
|
|
26232
26240
|
if (!row || row.mode !== "current_owner" && row.mode !== "reassignment") {
|
|
26233
26241
|
throw new ProjectTaskThreadError("PROJECT_TASK_THREAD_SCOPE_INVALID", "Invalid ensure input");
|
|
26234
26242
|
}
|
|
@@ -26252,7 +26260,7 @@ var import_core61 = require("@axiom-lattice/core");
|
|
|
26252
26260
|
var import_node_crypto16 = require("crypto");
|
|
26253
26261
|
|
|
26254
26262
|
// src/services/collaboration/ProjectTaskRunProtocol.ts
|
|
26255
|
-
var
|
|
26263
|
+
var import_protocols15 = require("@axiom-lattice/protocols");
|
|
26256
26264
|
var ProjectTaskProtocolError = class extends Error {
|
|
26257
26265
|
/**
|
|
26258
26266
|
* @param code Stable machine-readable failure code.
|
|
@@ -26297,7 +26305,7 @@ function buildTrustedTaskContext(task, thread, inputMessageId, rosterExempt) {
|
|
|
26297
26305
|
};
|
|
26298
26306
|
}
|
|
26299
26307
|
function taskThreadMetadata(thread) {
|
|
26300
|
-
const row = (0,
|
|
26308
|
+
const row = (0, import_protocols15.snapshotExactRecord)(thread.metadata, [
|
|
26301
26309
|
"source",
|
|
26302
26310
|
"kind",
|
|
26303
26311
|
"workspaceId",
|
|
@@ -27578,7 +27586,7 @@ function offsetInteger(value) {
|
|
|
27578
27586
|
return parsed;
|
|
27579
27587
|
}
|
|
27580
27588
|
function exactObject(value, allowed, required = []) {
|
|
27581
|
-
const row = (0,
|
|
27589
|
+
const row = (0, import_protocols16.snapshotExactRecord)(value, required, allowed.filter((key) => !required.includes(key)));
|
|
27582
27590
|
if (!row) throw new HttpTaskError(400, "INVALID_TASK_INPUT");
|
|
27583
27591
|
return row;
|
|
27584
27592
|
}
|
|
@@ -27629,7 +27637,7 @@ function validateUpdateTaskInput(row) {
|
|
|
27629
27637
|
}
|
|
27630
27638
|
}
|
|
27631
27639
|
function taskFile(value) {
|
|
27632
|
-
const row = (0,
|
|
27640
|
+
const row = (0, import_protocols16.snapshotExactRecord)(value, ["uri"], ["name", "mimeType", "addedBy"]);
|
|
27633
27641
|
return !!row && typeof row.uri === "string" && !!row.uri && (row.name === void 0 || typeof row.name === "string") && (row.mimeType === void 0 || typeof row.mimeType === "string") && (row.addedBy === void 0 || row.addedBy === "user" || row.addedBy === "agent");
|
|
27634
27642
|
}
|
|
27635
27643
|
function snapshotCreate(value) {
|
|
@@ -27657,7 +27665,7 @@ function snapshotComplete(value) {
|
|
|
27657
27665
|
return row;
|
|
27658
27666
|
}
|
|
27659
27667
|
function snapshotCommand(value) {
|
|
27660
|
-
const row = (0,
|
|
27668
|
+
const row = (0, import_protocols16.snapshotExactRecord)(value, ["type"], ["commandId", "expectedUpdatedAt", "payload"]);
|
|
27661
27669
|
if (!row || typeof row.type !== "string" || !taskCommandTypes.includes(row.type)) {
|
|
27662
27670
|
throw new HttpTaskError(400, "INVALID_TASK_COMMAND");
|
|
27663
27671
|
}
|
|
@@ -28350,7 +28358,7 @@ var import_zod6 = require("zod");
|
|
|
28350
28358
|
|
|
28351
28359
|
// src/services/agent-web-app/AgentWebAppRuntimeService.ts
|
|
28352
28360
|
var import_node_crypto19 = require("crypto");
|
|
28353
|
-
var
|
|
28361
|
+
var import_protocols17 = require("@axiom-lattice/protocols");
|
|
28354
28362
|
var import_core63 = require("@axiom-lattice/core");
|
|
28355
28363
|
init_task_file_refs();
|
|
28356
28364
|
init_runCancelRuntime();
|
|
@@ -28501,7 +28509,7 @@ var AgentWebAppRuntimeService = class {
|
|
|
28501
28509
|
});
|
|
28502
28510
|
return messages.flatMap((message) => {
|
|
28503
28511
|
if (!isRecord9(message) || typeof message.id !== "string" || message.role !== "human" && message.role !== "ai") return [];
|
|
28504
|
-
const content = typeof message.content === "string" ? message.content : runtime.webApp.features.genUI && Array.isArray(message.content) ? message.content.map(
|
|
28512
|
+
const content = typeof message.content === "string" ? message.content : runtime.webApp.features.genUI && Array.isArray(message.content) ? message.content.map(import_protocols17.parseAgentWebAppGenUIBlock).filter((block) => block !== void 0) : void 0;
|
|
28505
28513
|
return [{ id: message.id, role: message.role, ...content && (typeof content === "string" || content.length > 0) ? { content } : {} }];
|
|
28506
28514
|
});
|
|
28507
28515
|
}
|
|
@@ -28555,7 +28563,7 @@ var AgentWebAppRuntimeService = class {
|
|
|
28555
28563
|
if (owner && owner !== (0, import_core63.getReplicaId)()) {
|
|
28556
28564
|
return {
|
|
28557
28565
|
stream: (async function* () {
|
|
28558
|
-
yield (0,
|
|
28566
|
+
yield (0, import_protocols17.buildAffinityMissChunk)(owner, threadId);
|
|
28559
28567
|
})()
|
|
28560
28568
|
};
|
|
28561
28569
|
}
|
|
@@ -28697,7 +28705,7 @@ ${formatFileRefsSection(refs)}` : input.content;
|
|
|
28697
28705
|
return executeScopedAgentMessage(agent, {
|
|
28698
28706
|
...request,
|
|
28699
28707
|
...Object.keys(customRunConfig).length > 0 ? { custom_run_config: customRunConfig } : {}
|
|
28700
|
-
}, [
|
|
28708
|
+
}, [import_protocols17.MessageChunkTypes.MESSAGE_COMPLETED, import_protocols17.MessageChunkTypes.INTERRUPT, import_protocols17.MessageChunkTypes.MESSAGE_FAILED]);
|
|
28701
28709
|
}
|
|
28702
28710
|
async resolveRuntime(webAppId, selection) {
|
|
28703
28711
|
const webApp = await this.deps.webAppStore.findById(webAppId);
|
|
@@ -28961,7 +28969,7 @@ async function verifyWebAppToken(token, issuer, options = {}) {
|
|
|
28961
28969
|
}
|
|
28962
28970
|
|
|
28963
28971
|
// src/routes/agent-web-app-runtime.ts
|
|
28964
|
-
var
|
|
28972
|
+
var import_protocols18 = require("@axiom-lattice/protocols");
|
|
28965
28973
|
var import_core64 = require("@axiom-lattice/core");
|
|
28966
28974
|
var idSchema = import_zod6.z.string().min(1).max(128);
|
|
28967
28975
|
var paramsSchema = import_zod6.z.object({ webAppId: idSchema }).strict();
|
|
@@ -29539,8 +29547,8 @@ function registerAgentWebAppRuntimeRoutes(app2, deps) {
|
|
|
29539
29547
|
if (!threadId) throw new AgentWebAppRuntimeError("INVALID_REQUEST", 400, "thread_id is required");
|
|
29540
29548
|
const content = body.messages.map((message) => message.content).join("\n");
|
|
29541
29549
|
const { messageId } = await deps.service.enqueueMessage(webAppId, identity.userId, threadId, content, { projectId: body.projectId, modelKey: body.modelKey });
|
|
29542
|
-
reply.header(
|
|
29543
|
-
for (const [name, value] of Object.entries((0,
|
|
29550
|
+
reply.header(import_protocols18.REPLICA_HEADER, (0, import_core64.getReplicaId)());
|
|
29551
|
+
for (const [name, value] of Object.entries((0, import_protocols18.affinityEchoHeaders)(request.headers[import_protocols18.AGENT_AFFINITY_HEADER]))) {
|
|
29544
29552
|
reply.header(name, value);
|
|
29545
29553
|
}
|
|
29546
29554
|
return reply.code(202).send({ success: true, messageId, queued: true });
|
|
@@ -29584,9 +29592,9 @@ function withPreview(selection, preview) {
|
|
|
29584
29592
|
return { ...selection, ...preview ? { preview } : {} };
|
|
29585
29593
|
}
|
|
29586
29594
|
async function pipeAgentWebAppStream(raw, stream, options = {}) {
|
|
29587
|
-
const projection = (0,
|
|
29595
|
+
const projection = (0, import_protocols18.createAgentWebAppStreamProjectionContext)(options);
|
|
29588
29596
|
await pipeAsyncIterableToSse(raw, stream, {
|
|
29589
|
-
project: (chunk) => (0,
|
|
29597
|
+
project: (chunk) => (0, import_protocols18.projectAgentWebAppChunk)(chunk, projection),
|
|
29590
29598
|
onError: (error) => {
|
|
29591
29599
|
const code = error?.code;
|
|
29592
29600
|
if (code === "aborted" || code === "superseded") return [{ type: "stream.completed" }];
|
|
@@ -29624,9 +29632,9 @@ function beginSse(reply, request) {
|
|
|
29624
29632
|
Connection: "keep-alive",
|
|
29625
29633
|
"X-Accel-Buffering": "no",
|
|
29626
29634
|
"Access-Control-Allow-Origin": "*",
|
|
29627
|
-
"Access-Control-Expose-Headers": `${
|
|
29628
|
-
[
|
|
29629
|
-
...(0,
|
|
29635
|
+
"Access-Control-Expose-Headers": `${import_protocols18.REPLICA_HEADER}, ${import_protocols18.AFFINITY_ECHO_HEADER}`,
|
|
29636
|
+
[import_protocols18.REPLICA_HEADER]: (0, import_core64.getReplicaId)(),
|
|
29637
|
+
...(0, import_protocols18.affinityEchoHeaders)(request.headers[import_protocols18.AGENT_AFFINITY_HEADER])
|
|
29630
29638
|
});
|
|
29631
29639
|
}
|
|
29632
29640
|
async function handle2(reply, operation) {
|
|
@@ -30214,7 +30222,7 @@ var import_zod11 = require("zod");
|
|
|
30214
30222
|
|
|
30215
30223
|
// src/services/model-provider/ModelProviderService.ts
|
|
30216
30224
|
var import_node_crypto23 = require("crypto");
|
|
30217
|
-
var
|
|
30225
|
+
var import_protocols19 = require("@axiom-lattice/protocols");
|
|
30218
30226
|
var import_core66 = require("@axiom-lattice/core");
|
|
30219
30227
|
|
|
30220
30228
|
// src/services/model-provider/errors.ts
|
|
@@ -30384,7 +30392,6 @@ var openAiCompatibleAdapter = {
|
|
|
30384
30392
|
};
|
|
30385
30393
|
async function probeEmbeddingInference(input, signal) {
|
|
30386
30394
|
const startedAt = Date.now();
|
|
30387
|
-
const endpoint = buildOpenAiEndpoint(input.baseURL, "embeddings");
|
|
30388
30395
|
const headers = {
|
|
30389
30396
|
Accept: "application/json",
|
|
30390
30397
|
"Content-Type": "application/json"
|
|
@@ -30392,17 +30399,25 @@ async function probeEmbeddingInference(input, signal) {
|
|
|
30392
30399
|
if (input.apiKey) {
|
|
30393
30400
|
headers.Authorization = `Bearer ${input.apiKey}`;
|
|
30394
30401
|
}
|
|
30402
|
+
const body = input.shape === "contents" ? JSON.stringify({
|
|
30403
|
+
model: input.modelId,
|
|
30404
|
+
input: { contents: [{ text: "ping" }] }
|
|
30405
|
+
}) : input.shape === "texts" ? JSON.stringify({
|
|
30406
|
+
model: input.modelId,
|
|
30407
|
+
input: { texts: ["ping"] }
|
|
30408
|
+
}) : JSON.stringify({ model: input.modelId, input: "ping" });
|
|
30409
|
+
let status;
|
|
30395
30410
|
try {
|
|
30396
30411
|
let response;
|
|
30397
30412
|
try {
|
|
30398
|
-
response = await fetch(endpoint, {
|
|
30413
|
+
response = await fetch(input.endpoint, {
|
|
30399
30414
|
method: "POST",
|
|
30400
30415
|
headers,
|
|
30401
30416
|
// Never follow redirects: a redirected request could reach an address
|
|
30402
30417
|
// that bypassed the SSRF checks.
|
|
30403
30418
|
redirect: "manual",
|
|
30404
30419
|
signal,
|
|
30405
|
-
body
|
|
30420
|
+
body
|
|
30406
30421
|
});
|
|
30407
30422
|
} catch (error) {
|
|
30408
30423
|
if (error instanceof Error && error.name === "AbortError") {
|
|
@@ -30420,11 +30435,12 @@ async function probeEmbeddingInference(input, signal) {
|
|
|
30420
30435
|
true
|
|
30421
30436
|
);
|
|
30422
30437
|
}
|
|
30438
|
+
status = response.status;
|
|
30423
30439
|
assertUpstreamOk(response);
|
|
30424
|
-
const
|
|
30440
|
+
const text = await readBodyWithLimit(response, MAX_RESPONSE_BYTES);
|
|
30425
30441
|
let payload;
|
|
30426
30442
|
try {
|
|
30427
|
-
payload = JSON.parse(
|
|
30443
|
+
payload = JSON.parse(text);
|
|
30428
30444
|
} catch {
|
|
30429
30445
|
throw new ModelProviderServiceError(
|
|
30430
30446
|
"UPSTREAM_INVALID_RESPONSE",
|
|
@@ -30435,14 +30451,16 @@ async function probeEmbeddingInference(input, signal) {
|
|
|
30435
30451
|
return {
|
|
30436
30452
|
reachable: true,
|
|
30437
30453
|
latencyMs: Date.now() - startedAt,
|
|
30438
|
-
dimensions: readEmbeddingDimensions(payload)
|
|
30454
|
+
dimensions: input.shape === "openai" ? readEmbeddingDimensions(payload) : readServiceDimensions(payload),
|
|
30455
|
+
status
|
|
30439
30456
|
};
|
|
30440
30457
|
} catch (error) {
|
|
30441
30458
|
if (error instanceof ModelProviderServiceError && isUpstreamErrorCode(error.code)) {
|
|
30442
30459
|
return {
|
|
30443
30460
|
reachable: false,
|
|
30444
30461
|
latencyMs: Date.now() - startedAt,
|
|
30445
|
-
error: error.code
|
|
30462
|
+
error: error.code,
|
|
30463
|
+
...status === void 0 ? {} : { status }
|
|
30446
30464
|
};
|
|
30447
30465
|
}
|
|
30448
30466
|
throw error;
|
|
@@ -30463,6 +30481,25 @@ function readEmbeddingDimensions(payload) {
|
|
|
30463
30481
|
const embedding = first.embedding;
|
|
30464
30482
|
return Array.isArray(embedding) ? embedding.length : void 0;
|
|
30465
30483
|
}
|
|
30484
|
+
function readServiceDimensions(payload) {
|
|
30485
|
+
if (typeof payload !== "object" || payload === null) {
|
|
30486
|
+
return void 0;
|
|
30487
|
+
}
|
|
30488
|
+
const output = payload.output;
|
|
30489
|
+
if (typeof output !== "object" || output === null) {
|
|
30490
|
+
return void 0;
|
|
30491
|
+
}
|
|
30492
|
+
const embeddings = output.embeddings;
|
|
30493
|
+
if (!Array.isArray(embeddings) || embeddings.length === 0) {
|
|
30494
|
+
return void 0;
|
|
30495
|
+
}
|
|
30496
|
+
const first = embeddings[0];
|
|
30497
|
+
if (typeof first !== "object" || first === null) {
|
|
30498
|
+
return void 0;
|
|
30499
|
+
}
|
|
30500
|
+
const embedding = first.embedding;
|
|
30501
|
+
return Array.isArray(embedding) ? embedding.length : void 0;
|
|
30502
|
+
}
|
|
30466
30503
|
async function readBodyWithLimit(response, maxBytes) {
|
|
30467
30504
|
if (!response.body) {
|
|
30468
30505
|
return response.text();
|
|
@@ -30563,7 +30600,7 @@ var ModelProviderService = class {
|
|
|
30563
30600
|
);
|
|
30564
30601
|
}
|
|
30565
30602
|
const models = snapshot.map((model) => ({
|
|
30566
|
-
modelKey: (0,
|
|
30603
|
+
modelKey: (0, import_protocols19.toModelKey)(model.providerId, model.modelId),
|
|
30567
30604
|
// What this row can do. Pickers filter on it, so it travels with every
|
|
30568
30605
|
// entry rather than being re-derived by each consumer.
|
|
30569
30606
|
kind: model.kind,
|
|
@@ -30580,7 +30617,7 @@ var ModelProviderService = class {
|
|
|
30580
30617
|
// catalog but are no longer reported as runnable.
|
|
30581
30618
|
!disabledProviderIds.has(model.providerId) && this.deps.registry.has(
|
|
30582
30619
|
tenantId,
|
|
30583
|
-
(0,
|
|
30620
|
+
(0, import_protocols19.toModelKey)(model.providerId, model.modelId)
|
|
30584
30621
|
)
|
|
30585
30622
|
}));
|
|
30586
30623
|
if (models.length === 0) {
|
|
@@ -30841,10 +30878,10 @@ var ModelProviderService = class {
|
|
|
30841
30878
|
if (this.shouldRegister(tenantId)) {
|
|
30842
30879
|
const snapshot = await this.deps.providerStore.listModels(tenantId, id3);
|
|
30843
30880
|
const currentKeys = new Set(
|
|
30844
|
-
snapshot.map((model) => (0,
|
|
30881
|
+
snapshot.map((model) => (0, import_protocols19.toModelKey)(id3, model.modelId))
|
|
30845
30882
|
);
|
|
30846
30883
|
for (const model of previous) {
|
|
30847
|
-
const modelKey2 = (0,
|
|
30884
|
+
const modelKey2 = (0, import_protocols19.toModelKey)(id3, model.modelId);
|
|
30848
30885
|
if (!currentKeys.has(modelKey2)) {
|
|
30849
30886
|
this.deps.registry.remove(tenantId, modelKey2);
|
|
30850
30887
|
}
|
|
@@ -30909,14 +30946,57 @@ var ModelProviderService = class {
|
|
|
30909
30946
|
);
|
|
30910
30947
|
}
|
|
30911
30948
|
try {
|
|
30912
|
-
const
|
|
30913
|
-
|
|
30949
|
+
const provider = input.providerId ? await this.deps.providerStore.getProviderById(
|
|
30950
|
+
tenantId,
|
|
30951
|
+
input.providerId
|
|
30952
|
+
) : null;
|
|
30953
|
+
const modelRow = provider && input.providerId ? await this.deps.providerStore.getModel(
|
|
30954
|
+
tenantId,
|
|
30955
|
+
input.providerId,
|
|
30956
|
+
input.modelId
|
|
30957
|
+
) : null;
|
|
30958
|
+
const extra = modelRow?.extra ?? {};
|
|
30959
|
+
const explicitShape = extra.embeddingShape === "openai" || extra.embeddingShape === "contents" || extra.embeddingShape === "texts";
|
|
30960
|
+
const baseURL = provider?.baseURL ?? input.baseURL;
|
|
30961
|
+
const initialShape = provider && modelRow ? (0, import_core66.buildModelEmbeddingsConfig)(provider, modelRow).shape : (0, import_core66.resolveEmbeddingShape)(input.modelId, {});
|
|
30962
|
+
const attempt = (shape) => probeEmbeddingInference(
|
|
30963
|
+
{
|
|
30964
|
+
endpoint: (0, import_core66.resolveEmbeddingEndpoint)(baseURL, shape, extra),
|
|
30965
|
+
apiKey,
|
|
30966
|
+
modelId: input.modelId,
|
|
30967
|
+
shape
|
|
30968
|
+
},
|
|
30914
30969
|
controller.signal
|
|
30915
30970
|
);
|
|
30971
|
+
const candidates = explicitShape ? [initialShape] : (0, import_core66.embeddingProbeCandidates)(initialShape, input.modelId);
|
|
30972
|
+
let outcome2 = await attempt(candidates[0]);
|
|
30973
|
+
let usedShape = candidates[0];
|
|
30974
|
+
for (const candidate of candidates.slice(1)) {
|
|
30975
|
+
if (outcome2.reachable || outcome2.status !== 400 && outcome2.status !== 404) {
|
|
30976
|
+
break;
|
|
30977
|
+
}
|
|
30978
|
+
const next = await attempt(candidate);
|
|
30979
|
+
if (!next.reachable) {
|
|
30980
|
+
continue;
|
|
30981
|
+
}
|
|
30982
|
+
outcome2 = next;
|
|
30983
|
+
usedShape = candidate;
|
|
30984
|
+
if (provider && modelRow) {
|
|
30985
|
+
await this.persistEmbeddingShape(
|
|
30986
|
+
tenantId,
|
|
30987
|
+
provider,
|
|
30988
|
+
modelRow,
|
|
30989
|
+
candidate,
|
|
30990
|
+
extra
|
|
30991
|
+
);
|
|
30992
|
+
}
|
|
30993
|
+
break;
|
|
30994
|
+
}
|
|
30916
30995
|
return {
|
|
30917
30996
|
reachable: outcome2.reachable,
|
|
30918
30997
|
latencyMs: outcome2.latencyMs,
|
|
30919
30998
|
models: [],
|
|
30999
|
+
shape: usedShape,
|
|
30920
31000
|
...outcome2.dimensions === void 0 ? {} : { dimensions: outcome2.dimensions },
|
|
30921
31001
|
...outcome2.error ? { error: outcome2.error } : {}
|
|
30922
31002
|
};
|
|
@@ -31008,7 +31088,7 @@ var ModelProviderService = class {
|
|
|
31008
31088
|
if (!kept.has(model.modelId)) {
|
|
31009
31089
|
this.deps.registry.remove(
|
|
31010
31090
|
tenantId,
|
|
31011
|
-
(0,
|
|
31091
|
+
(0, import_protocols19.toModelKey)(provider.id, model.modelId)
|
|
31012
31092
|
);
|
|
31013
31093
|
}
|
|
31014
31094
|
}
|
|
@@ -31017,48 +31097,94 @@ var ModelProviderService = class {
|
|
|
31017
31097
|
return this.toPublicEntry(provider, models.length);
|
|
31018
31098
|
}
|
|
31019
31099
|
/**
|
|
31020
|
-
* Give
|
|
31100
|
+
* Give each kind's sole model its default flag.
|
|
31021
31101
|
*
|
|
31022
|
-
* A tenant with exactly one runnable
|
|
31023
|
-
* saying so
|
|
31024
|
-
*
|
|
31025
|
-
* default — or has a default, which cannot be deleted.
|
|
31026
|
-
* could sit with one model and no default, and deleting that model would
|
|
31027
|
-
* leave nothing behind.
|
|
31102
|
+
* A tenant with exactly one runnable model **of a kind** has an obvious
|
|
31103
|
+
* default for that kind, and saying so keeps the invariant the rest of the
|
|
31104
|
+
* feature leans on: a kind either has no model at all — and falls back to the
|
|
31105
|
+
* deployment's default — or has a default, which cannot be deleted.
|
|
31028
31106
|
*
|
|
31029
|
-
*
|
|
31030
|
-
* embedding
|
|
31107
|
+
* Per kind because each kind publishes its own alias key (`default`,
|
|
31108
|
+
* `default:embedding`, `default:asr`).
|
|
31031
31109
|
*
|
|
31032
|
-
* Deliberately narrow: more than one model is the tenant's choice to
|
|
31033
|
-
* and a disabled model is not a candidate
|
|
31110
|
+
* Deliberately narrow: more than one model of a kind is the tenant's choice to
|
|
31111
|
+
* make, and a disabled model is not a candidate.
|
|
31034
31112
|
*
|
|
31035
31113
|
* @param tenantId - The tenant whose model set just changed
|
|
31036
31114
|
*/
|
|
31037
31115
|
async ensureDefaultModel(tenantId) {
|
|
31038
31116
|
const models = await this.deps.providerStore.listModels(tenantId);
|
|
31039
|
-
const
|
|
31040
|
-
|
|
31117
|
+
const toMark = ["chat", "embedding", "asr"].flatMap((kind) => {
|
|
31118
|
+
const ofKind = models.filter((model) => model.kind === kind);
|
|
31119
|
+
if (ofKind.length !== 1) {
|
|
31120
|
+
return [];
|
|
31121
|
+
}
|
|
31122
|
+
const [only] = ofKind;
|
|
31123
|
+
return only.enabled && !only.isDefault ? [only] : [];
|
|
31124
|
+
});
|
|
31125
|
+
if (toMark.length === 0) {
|
|
31041
31126
|
return;
|
|
31042
31127
|
}
|
|
31043
|
-
const
|
|
31044
|
-
|
|
31045
|
-
|
|
31128
|
+
const byProvider = /* @__PURE__ */ new Map();
|
|
31129
|
+
for (const model of models) {
|
|
31130
|
+
const list = byProvider.get(model.providerId) ?? [];
|
|
31131
|
+
list.push(model);
|
|
31132
|
+
byProvider.set(model.providerId, list);
|
|
31133
|
+
}
|
|
31134
|
+
for (const [providerId2, providerModels] of byProvider) {
|
|
31135
|
+
if (!providerModels.some((model) => toMark.includes(model))) {
|
|
31136
|
+
continue;
|
|
31137
|
+
}
|
|
31138
|
+
await this.deps.providerStore.replaceProviderModels(
|
|
31139
|
+
tenantId,
|
|
31140
|
+
providerId2,
|
|
31141
|
+
providerModels.map((model) => ({
|
|
31142
|
+
id: model.modelId,
|
|
31143
|
+
enabled: model.enabled,
|
|
31144
|
+
stale: model.stale,
|
|
31145
|
+
extra: model.extra,
|
|
31146
|
+
kind: model.kind,
|
|
31147
|
+
isDefault: toMark.includes(model) ? true : model.isDefault
|
|
31148
|
+
}))
|
|
31149
|
+
);
|
|
31046
31150
|
}
|
|
31047
|
-
|
|
31048
|
-
|
|
31151
|
+
}
|
|
31152
|
+
/**
|
|
31153
|
+
* Persist the embedding shape a probe detected.
|
|
31154
|
+
*
|
|
31155
|
+
* A probe is read-only except for this: when the initial shape fails with
|
|
31156
|
+
* 400/404 and another shape works, writing it down is what makes the
|
|
31157
|
+
* runtime use it. The whole provider set is written because
|
|
31158
|
+
* `replaceProviderModels` replaces it — passing one row would delete its
|
|
31159
|
+
* siblings.
|
|
31160
|
+
*/
|
|
31161
|
+
async persistEmbeddingShape(tenantId, provider, model, shape, extra) {
|
|
31162
|
+
const rows = await this.deps.providerStore.listModels(
|
|
31163
|
+
tenantId,
|
|
31164
|
+
provider.id
|
|
31049
31165
|
);
|
|
31166
|
+
const nextExtra = { ...extra, embeddingShape: shape };
|
|
31167
|
+
if (shape === "openai" && typeof extra.embeddingPath !== "string") {
|
|
31168
|
+
delete nextExtra.embeddingPath;
|
|
31169
|
+
}
|
|
31050
31170
|
await this.deps.providerStore.replaceProviderModels(
|
|
31051
31171
|
tenantId,
|
|
31052
|
-
|
|
31053
|
-
|
|
31054
|
-
id:
|
|
31055
|
-
enabled:
|
|
31056
|
-
stale:
|
|
31057
|
-
|
|
31058
|
-
|
|
31059
|
-
|
|
31172
|
+
provider.id,
|
|
31173
|
+
rows.map((row) => ({
|
|
31174
|
+
id: row.modelId,
|
|
31175
|
+
enabled: row.enabled,
|
|
31176
|
+
stale: row.stale,
|
|
31177
|
+
kind: row.kind,
|
|
31178
|
+
isDefault: row.isDefault,
|
|
31179
|
+
extra: row.modelId === model.modelId ? nextExtra : row.extra
|
|
31060
31180
|
}))
|
|
31061
31181
|
);
|
|
31182
|
+
const updated = await this.deps.providerStore.listModels(
|
|
31183
|
+
tenantId,
|
|
31184
|
+
provider.id
|
|
31185
|
+
);
|
|
31186
|
+
this.syncRegistry(tenantId, provider, updated);
|
|
31187
|
+
this.notifyChanged(tenantId, provider.id);
|
|
31062
31188
|
}
|
|
31063
31189
|
syncRegistry(tenantId, provider, models) {
|
|
31064
31190
|
this.deps.registry.evictProviderCache?.(tenantId, provider.id);
|
|
@@ -31068,7 +31194,7 @@ var ModelProviderService = class {
|
|
|
31068
31194
|
}
|
|
31069
31195
|
const registered = [];
|
|
31070
31196
|
for (const model of models) {
|
|
31071
|
-
const modelKey2 = (0,
|
|
31197
|
+
const modelKey2 = (0, import_protocols19.toModelKey)(provider.id, model.modelId);
|
|
31072
31198
|
if (!provider.enabled || !model.enabled) {
|
|
31073
31199
|
this.deps.registry.remove(tenantId, modelKey2);
|
|
31074
31200
|
continue;
|
|
@@ -32282,12 +32408,12 @@ function virtualPublicProjectBot(project, room, agent, mentionName, now) {
|
|
|
32282
32408
|
var import_node_crypto27 = require("crypto");
|
|
32283
32409
|
|
|
32284
32410
|
// src/services/collaboration/ProjectBotMembershipSnapshot.ts
|
|
32285
|
-
var
|
|
32411
|
+
var import_protocols20 = require("@axiom-lattice/protocols");
|
|
32286
32412
|
var requiredKeys = ["assistantId", "id", "joinedAt", "mentionName", "projectId", "role", "roomId", "roomThreadId", "status", "tenantId", "title", "updatedAt", "workspaceId"];
|
|
32287
32413
|
function snapshotProjectBotMembership(value) {
|
|
32288
32414
|
try {
|
|
32289
32415
|
if (typeof value !== "object" || value === null || Array.isArray(value)) return void 0;
|
|
32290
|
-
const values = (0,
|
|
32416
|
+
const values = (0, import_protocols20.snapshotExactRecord)(value, requiredKeys, ["responsibility"]);
|
|
32291
32417
|
if (!values) return void 0;
|
|
32292
32418
|
const read = (key) => values[key];
|
|
32293
32419
|
const id3 = read("id");
|
|
@@ -32651,7 +32777,7 @@ function matchesNormalizedPayload(message, input) {
|
|
|
32651
32777
|
|
|
32652
32778
|
// src/routes/project-rooms.ts
|
|
32653
32779
|
var import_zod13 = require("zod");
|
|
32654
|
-
var
|
|
32780
|
+
var import_protocols21 = require("@axiom-lattice/protocols");
|
|
32655
32781
|
|
|
32656
32782
|
// src/services/collaboration/RoomInterruptService.ts
|
|
32657
32783
|
var import_node_crypto28 = require("crypto");
|
|
@@ -32986,7 +33112,7 @@ function actor(request, projectId) {
|
|
|
32986
33112
|
return { tenantId: user.tenantId, userId: user.id, projectId };
|
|
32987
33113
|
}
|
|
32988
33114
|
function toProjectRoomMessage(message) {
|
|
32989
|
-
const publicMessage = (0,
|
|
33115
|
+
const publicMessage = (0, import_protocols21.toProjectRoomPublicMessage)(message);
|
|
32990
33116
|
if (publicMessage === void 0) throw new Error("Room message could not be mapped to its public DTO");
|
|
32991
33117
|
return publicMessage;
|
|
32992
33118
|
}
|
|
@@ -33059,7 +33185,7 @@ async function execute(reply, operation) {
|
|
|
33059
33185
|
var import_node_crypto29 = require("crypto");
|
|
33060
33186
|
var import_zod15 = require("zod");
|
|
33061
33187
|
var import_core67 = require("@axiom-lattice/core");
|
|
33062
|
-
var
|
|
33188
|
+
var import_protocols22 = require("@axiom-lattice/protocols");
|
|
33063
33189
|
var CoSpaceAuthError = class extends Error {
|
|
33064
33190
|
constructor() {
|
|
33065
33191
|
super(...arguments);
|
|
@@ -33136,7 +33262,7 @@ function registerCoSpaceRoutes(app2, deps) {
|
|
|
33136
33262
|
limit: 1
|
|
33137
33263
|
});
|
|
33138
33264
|
const lastMessage = messages[0];
|
|
33139
|
-
const publicLastMessage = lastMessage === void 0 ? void 0 : (0,
|
|
33265
|
+
const publicLastMessage = lastMessage === void 0 ? void 0 : (0, import_protocols22.toProjectRoomPublicMessage)(lastMessage);
|
|
33140
33266
|
const memberships = await deps.membershipStore.list(
|
|
33141
33267
|
actor3.tenantId,
|
|
33142
33268
|
project.id
|
|
@@ -33203,7 +33329,7 @@ function registerCoSpaceRoutes(app2, deps) {
|
|
|
33203
33329
|
rooms.unshift({
|
|
33204
33330
|
project: publicRoom.project,
|
|
33205
33331
|
room: publicRoom.room,
|
|
33206
|
-
lastMessage: publicLastMessage === void 0 ? void 0 : (0,
|
|
33332
|
+
lastMessage: publicLastMessage === void 0 ? void 0 : (0, import_protocols22.toProjectRoomPublicMessage)(publicLastMessage),
|
|
33207
33333
|
participantCount: publicMemberships.filter((m) => m.status === "active").length,
|
|
33208
33334
|
participantNames: publicParticipantNames,
|
|
33209
33335
|
isPublic: true,
|
|
@@ -33920,7 +34046,7 @@ var RoomTargetResolver = class {
|
|
|
33920
34046
|
};
|
|
33921
34047
|
|
|
33922
34048
|
// src/services/collaboration/RoomDispatchService.ts
|
|
33923
|
-
var
|
|
34049
|
+
var import_protocols23 = require("@axiom-lattice/protocols");
|
|
33924
34050
|
|
|
33925
34051
|
// src/router/InternalRoomDispatch.ts
|
|
33926
34052
|
var INTERNAL_ROOM_DISPATCH = Symbol("internal-room-dispatch");
|
|
@@ -34030,7 +34156,7 @@ function snapshotDispatchSource(value) {
|
|
|
34030
34156
|
};
|
|
34031
34157
|
}
|
|
34032
34158
|
function snapshotMentions(value) {
|
|
34033
|
-
const rows = (0,
|
|
34159
|
+
const rows = (0, import_protocols23.snapshotExactArray)(value);
|
|
34034
34160
|
if (!rows) return void 0;
|
|
34035
34161
|
const result = [];
|
|
34036
34162
|
for (const row of rows) {
|
|
@@ -34048,7 +34174,7 @@ function snapshotMentions(value) {
|
|
|
34048
34174
|
function exactValues(value, required, optional = []) {
|
|
34049
34175
|
try {
|
|
34050
34176
|
if (typeof value !== "object" || value === null || Array.isArray(value)) return void 0;
|
|
34051
|
-
return (0,
|
|
34177
|
+
return (0, import_protocols23.snapshotExactRecord)(value, required, optional);
|
|
34052
34178
|
} catch {
|
|
34053
34179
|
return void 0;
|
|
34054
34180
|
}
|
|
@@ -34056,7 +34182,7 @@ function exactValues(value, required, optional = []) {
|
|
|
34056
34182
|
|
|
34057
34183
|
// src/services/collaboration/CoordinatorWakeNotifier.ts
|
|
34058
34184
|
var import_node_crypto30 = require("crypto");
|
|
34059
|
-
var
|
|
34185
|
+
var import_protocols24 = require("@axiom-lattice/protocols");
|
|
34060
34186
|
init_projectTaskScope();
|
|
34061
34187
|
var SYNTHETIC_WAKE_AUTHOR = "coordinator-wake";
|
|
34062
34188
|
var CoordinatorWakeNotifier = class {
|
|
@@ -34213,7 +34339,7 @@ var CoordinatorWakeNotifier = class {
|
|
|
34213
34339
|
}
|
|
34214
34340
|
}
|
|
34215
34341
|
parse(value) {
|
|
34216
|
-
const row = (0,
|
|
34342
|
+
const row = (0, import_protocols24.snapshotExactRecord)(value, ["tenantId", "workspaceId", "projectId", "taskId", "status", "action", "eventKey", "updatedAt"], ["threadId"]);
|
|
34217
34343
|
const actions = ["in_progress", "interrupted", "failed", "completed", "cancelled", "reassigned"];
|
|
34218
34344
|
const statuses = ["pending", "in_progress", "review", "failed", "interrupted", "completed", "cancelled"];
|
|
34219
34345
|
if (!row || !actions.includes(String(row.action)) || !statuses.includes(String(row.status)) || !["tenantId", "workspaceId", "projectId", "taskId", "eventKey", "updatedAt"].every((key) => typeof row[key] === "string" && row[key].length > 0) || !Number.isFinite(Date.parse(row.updatedAt)) || row.threadId !== void 0 && typeof row.threadId !== "string") return void 0;
|
|
@@ -34347,11 +34473,11 @@ function createRoomMessageRetentionJob(input) {
|
|
|
34347
34473
|
}
|
|
34348
34474
|
|
|
34349
34475
|
// src/services/collaboration/ProjectTaskExecutionMutex.ts
|
|
34350
|
-
var
|
|
34476
|
+
var import_protocols25 = require("@axiom-lattice/protocols");
|
|
34351
34477
|
var import_core68 = require("@axiom-lattice/core");
|
|
34352
34478
|
var MACHINE_LEASE_OPTIONS = { ttlMs: 6e4, acquireTimeoutMs: 9e4, retryDelayMs: 100 };
|
|
34353
34479
|
function machineKey(scope) {
|
|
34354
|
-
const snapshot = (0,
|
|
34480
|
+
const snapshot = (0, import_protocols25.snapshotExactRecord)(scope, ["tenantId", "assistantId", "projectId"]);
|
|
34355
34481
|
if (!snapshot) throw new Error("Invalid Project task machine scope");
|
|
34356
34482
|
const values = [snapshot.tenantId, snapshot.assistantId, snapshot.projectId];
|
|
34357
34483
|
for (const value of values) {
|
|
@@ -34702,7 +34828,7 @@ var TaskInterruptCardProjector = class {
|
|
|
34702
34828
|
// src/services/collaboration/ProjectTaskObserver.ts
|
|
34703
34829
|
var import_node_crypto31 = require("crypto");
|
|
34704
34830
|
var import_core70 = require("@axiom-lattice/core");
|
|
34705
|
-
var
|
|
34831
|
+
var import_protocols26 = require("@axiom-lattice/protocols");
|
|
34706
34832
|
|
|
34707
34833
|
// src/services/collaboration/projectTaskDispatchMarker.ts
|
|
34708
34834
|
var EXECUTION_REQUESTED_AT_KEY = "execution_requested_at";
|
|
@@ -35601,7 +35727,7 @@ function errorMessage4(error) {
|
|
|
35601
35727
|
}
|
|
35602
35728
|
function readCreatedBy(value) {
|
|
35603
35729
|
try {
|
|
35604
|
-
const row = (0,
|
|
35730
|
+
const row = (0, import_protocols26.snapshotExactRecord)(value, ["assistantId", "membershipId"]);
|
|
35605
35731
|
return row && typeof row.assistantId === "string" && row.assistantId.length > 0 && typeof row.membershipId === "string" && row.membershipId.length > 0 ? { assistantId: row.assistantId, membershipId: row.membershipId } : void 0;
|
|
35606
35732
|
} catch {
|
|
35607
35733
|
return void 0;
|
|
@@ -35616,7 +35742,7 @@ function combineSignals(left, right) {
|
|
|
35616
35742
|
|
|
35617
35743
|
// src/services/collaboration/RoomProjectionService.ts
|
|
35618
35744
|
var import_node_crypto32 = require("crypto");
|
|
35619
|
-
var
|
|
35745
|
+
var import_protocols27 = require("@axiom-lattice/protocols");
|
|
35620
35746
|
init_projectTaskScope();
|
|
35621
35747
|
var ROOM_PROJECTABLE_ACTIONS = [
|
|
35622
35748
|
"interrupted",
|
|
@@ -35696,7 +35822,7 @@ var RoomProjectionService = class {
|
|
|
35696
35822
|
projectId: task.projectId,
|
|
35697
35823
|
roomId: room.id,
|
|
35698
35824
|
author: { type: "system" },
|
|
35699
|
-
content: { type: "text", text: `${
|
|
35825
|
+
content: { type: "text", text: `${import_protocols27.PROJECT_ROOM_TASK_DELEGATED_LABEL}${import_protocols27.PROJECT_ROOM_TASK_DELEGATED_SEPARATOR}${input.fromLabel} \u2192 ${input.toLabel}` },
|
|
35700
35826
|
mentions: [],
|
|
35701
35827
|
source: "task",
|
|
35702
35828
|
sourceId: task.id,
|
|
@@ -35847,7 +35973,7 @@ function parseProjectionInput(taskValue, itemValue) {
|
|
|
35847
35973
|
}
|
|
35848
35974
|
}
|
|
35849
35975
|
function snapshotProjectableWorkItem(value) {
|
|
35850
|
-
const row = (0,
|
|
35976
|
+
const row = (0, import_protocols27.snapshotExactRecord)(value, ["id", "taskId", "tenantId", "action", "actor", "createdAt"], [
|
|
35851
35977
|
"workspaceId",
|
|
35852
35978
|
"projectId",
|
|
35853
35979
|
"threadId",
|
|
@@ -35857,7 +35983,7 @@ function snapshotProjectableWorkItem(value) {
|
|
|
35857
35983
|
"eventKey"
|
|
35858
35984
|
]);
|
|
35859
35985
|
const createdAt = cloneExactDate(row?.createdAt);
|
|
35860
|
-
if (!row || !createdAt || typeof row.id !== "string" || !row.id || typeof row.taskId !== "string" || !row.taskId || typeof row.tenantId !== "string" || !row.tenantId || typeof row.workspaceId !== "string" || !row.workspaceId || typeof row.projectId !== "string" || !row.projectId || typeof row.actor !== "string" || !row.actor || typeof row.eventKey !== "string" || !row.eventKey || !
|
|
35986
|
+
if (!row || !createdAt || typeof row.id !== "string" || !row.id || typeof row.taskId !== "string" || !row.taskId || typeof row.tenantId !== "string" || !row.tenantId || typeof row.workspaceId !== "string" || !row.workspaceId || typeof row.projectId !== "string" || !row.projectId || typeof row.actor !== "string" || !row.actor || typeof row.eventKey !== "string" || !row.eventKey || !import_protocols27.PROJECT_TASK_LIFECYCLE_ACTIONS.includes(row.action) || row.threadId !== void 0 && typeof row.threadId !== "string" || row.summary !== void 0 && typeof row.summary !== "string" || row.attempt !== void 0 && (typeof row.attempt !== "number" || !Number.isFinite(row.attempt))) return void 0;
|
|
35861
35987
|
try {
|
|
35862
35988
|
const detail = row.detail === void 0 ? void 0 : snapshotJsonValue(row.detail);
|
|
35863
35989
|
if (detail !== void 0 && !isRecord10(detail)) return void 0;
|
|
@@ -35884,26 +36010,26 @@ function parseIso(value) {
|
|
|
35884
36010
|
return typeof value === "string" && value.length > 0 && Number.isFinite(Date.parse(value));
|
|
35885
36011
|
}
|
|
35886
36012
|
function parseInterruption(value) {
|
|
35887
|
-
const common = (0,
|
|
36013
|
+
const common = (0, import_protocols27.snapshotExactRecord)(value, ["type", "summary", "requestedAt"]);
|
|
35888
36014
|
if (common && (common.type === "missing_input" || common.type === "user_decision") && typeof common.summary === "string" && common.summary.length > 0 && parseIso(common.requestedAt)) {
|
|
35889
36015
|
return { type: common.type, summary: common.summary, requestedAt: common.requestedAt };
|
|
35890
36016
|
}
|
|
35891
|
-
const review = (0,
|
|
36017
|
+
const review = (0, import_protocols27.snapshotExactRecord)(value, ["type", "evidenceId"]);
|
|
35892
36018
|
return review?.type === "review_required" && typeof review.evidenceId === "string" && review.evidenceId.length > 0 ? { type: "review_required", evidenceId: review.evidenceId } : void 0;
|
|
35893
36019
|
}
|
|
35894
36020
|
function parseBeliefImpact(value) {
|
|
35895
|
-
const rows = (0,
|
|
36021
|
+
const rows = (0, import_protocols27.snapshotExactArray)(value);
|
|
35896
36022
|
if (!rows) return void 0;
|
|
35897
36023
|
const impacts = [];
|
|
35898
36024
|
for (const row of rows) {
|
|
35899
|
-
const entry = (0,
|
|
36025
|
+
const entry = (0, import_protocols27.snapshotExactRecord)(row, ["key", "after", "basis"]);
|
|
35900
36026
|
if (!entry || typeof entry.key !== "string" || !entry.key || typeof entry.after !== "number" || !Number.isFinite(entry.after) || typeof entry.basis !== "string" || !entry.basis) return void 0;
|
|
35901
36027
|
impacts.push({ key: entry.key, after: entry.after, basis: entry.basis });
|
|
35902
36028
|
}
|
|
35903
36029
|
return impacts;
|
|
35904
36030
|
}
|
|
35905
36031
|
function parseCompletion(item) {
|
|
35906
|
-
const row = (0,
|
|
36032
|
+
const row = (0, import_protocols27.snapshotExactRecord)(item.detail, ["evidenceId", "eventKey", "result", "beliefImpact"]);
|
|
35907
36033
|
const beliefImpact = parseBeliefImpact(row?.beliefImpact);
|
|
35908
36034
|
if (!row || typeof row.evidenceId !== "string" || !row.evidenceId || typeof row.eventKey !== "string" || !row.eventKey || item.eventKey !== `${row.eventKey}:completed` || typeof row.result !== "string" || !beliefImpact) return void 0;
|
|
35909
36035
|
return { evidenceId: row.evidenceId, eventKey: row.eventKey, result: row.result, beliefImpact };
|
|
@@ -35913,19 +36039,19 @@ function parseProjection(item) {
|
|
|
35913
36039
|
return parseInterruption(item.detail) ? { kind: "interrupted", text: "Task interrupted" } : void 0;
|
|
35914
36040
|
}
|
|
35915
36041
|
if (item.action === "failed") {
|
|
35916
|
-
const row = (0,
|
|
36042
|
+
const row = (0, import_protocols27.snapshotExactRecord)(item.detail, ["failureReason"]);
|
|
35917
36043
|
return typeof row?.failureReason === "string" && row.failureReason ? { kind: "failed", text: "Task failed" } : void 0;
|
|
35918
36044
|
}
|
|
35919
36045
|
if (item.action === "completed") {
|
|
35920
36046
|
return parseCompletion(item) ? { kind: "completed", text: "Task completed" } : void 0;
|
|
35921
36047
|
}
|
|
35922
36048
|
if (item.action === "cancelled") {
|
|
35923
|
-
const empty = (0,
|
|
35924
|
-
const summarized = (0,
|
|
36049
|
+
const empty = (0, import_protocols27.snapshotExactRecord)(item.detail, []);
|
|
36050
|
+
const summarized = (0, import_protocols27.snapshotExactRecord)(item.detail, ["summary"]);
|
|
35925
36051
|
return empty || typeof summarized?.summary === "string" && summarized.summary ? { kind: "cancelled", text: "Task cancelled" } : void 0;
|
|
35926
36052
|
}
|
|
35927
36053
|
if (item.action === "reassigned") {
|
|
35928
|
-
const row = (0,
|
|
36054
|
+
const row = (0, import_protocols27.snapshotExactRecord)(
|
|
35929
36055
|
item.detail,
|
|
35930
36056
|
["previousOwnerId", "previousThreadId", "ownerId", "membershipId", "threadId"]
|
|
35931
36057
|
);
|
|
@@ -35934,7 +36060,7 @@ function parseProjection(item) {
|
|
|
35934
36060
|
return void 0;
|
|
35935
36061
|
}
|
|
35936
36062
|
function assertCanonicalProjection(value, expected) {
|
|
35937
|
-
const row = (0,
|
|
36063
|
+
const row = (0, import_protocols27.snapshotExactRecord)(value, [
|
|
35938
36064
|
"id",
|
|
35939
36065
|
"tenantId",
|
|
35940
36066
|
"workspaceId",
|
|
@@ -35948,9 +36074,9 @@ function assertCanonicalProjection(value, expected) {
|
|
|
35948
36074
|
"idempotencyKey",
|
|
35949
36075
|
"createdAt"
|
|
35950
36076
|
]);
|
|
35951
|
-
const author = (0,
|
|
35952
|
-
const content = (0,
|
|
35953
|
-
const mentions = (0,
|
|
36077
|
+
const author = (0, import_protocols27.snapshotExactRecord)(row?.author, ["type"]);
|
|
36078
|
+
const content = (0, import_protocols27.snapshotExactRecord)(row?.content, ["type", "text"]);
|
|
36079
|
+
const mentions = (0, import_protocols27.snapshotExactArray)(row?.mentions);
|
|
35954
36080
|
const createdAt = cloneExactDate(row?.createdAt);
|
|
35955
36081
|
if (!row || !createdAt || author?.type !== "system" || content?.type !== "text" || content.text !== expected.content.text || !mentions || mentions.length !== 0 || typeof row.id !== "string" || !row.id || row.tenantId !== expected.tenantId || row.workspaceId !== expected.workspaceId || row.projectId !== expected.projectId || row.roomId !== expected.roomId || row.source !== "task" || row.sourceId !== expected.sourceId || row.idempotencyKey !== expected.idempotencyKey) {
|
|
35956
36082
|
throw new Error("Invalid canonical task projection");
|
|
@@ -35971,7 +36097,7 @@ function assertCanonicalProjection(value, expected) {
|
|
|
35971
36097
|
};
|
|
35972
36098
|
}
|
|
35973
36099
|
function snapshotLifecycleCursor(value) {
|
|
35974
|
-
const row = (0,
|
|
36100
|
+
const row = (0, import_protocols27.snapshotExactRecord)(value, ["id", "taskId", "tenantId", "action", "actor", "createdAt"], [
|
|
35975
36101
|
"workspaceId",
|
|
35976
36102
|
"projectId",
|
|
35977
36103
|
"threadId",
|
|
@@ -35996,7 +36122,7 @@ var import_core71 = require("@axiom-lattice/core");
|
|
|
35996
36122
|
|
|
35997
36123
|
// src/services/collaboration/ProjectRoomEventBroker.ts
|
|
35998
36124
|
var import_node_crypto33 = require("crypto");
|
|
35999
|
-
var
|
|
36125
|
+
var import_protocols28 = require("@axiom-lattice/protocols");
|
|
36000
36126
|
var DEFAULT_MAX_EVENTS_PER_ROOM = 1e3;
|
|
36001
36127
|
var DEFAULT_MAX_EVENT_AGE_MS = 10 * 60 * 1e3;
|
|
36002
36128
|
var DEFAULT_MAX_ROOMS = 1e3;
|
|
@@ -36079,7 +36205,7 @@ var ProjectRoomEventBroker = class {
|
|
|
36079
36205
|
const canonicalScope = snapshotScope(scope);
|
|
36080
36206
|
const key = scopeKey2(canonicalScope);
|
|
36081
36207
|
const now = this.currentTime();
|
|
36082
|
-
if (this.sequence >= Number.MAX_SAFE_INTEGER) throw new
|
|
36208
|
+
if (this.sequence >= Number.MAX_SAFE_INTEGER) throw new import_protocols28.ProjectRoomBrokerCapacityError();
|
|
36083
36209
|
const nextSequence = this.sequence + 1;
|
|
36084
36210
|
const event = snapshotJson({
|
|
36085
36211
|
...snapshotDraft(draft),
|
|
@@ -36306,11 +36432,11 @@ var ProjectRoomEventBroker = class {
|
|
|
36306
36432
|
}
|
|
36307
36433
|
resolveCursor(key, afterEventId, plan) {
|
|
36308
36434
|
if (afterEventId === void 0) return void 0;
|
|
36309
|
-
const cursor = (0,
|
|
36310
|
-
if (!cursor) throw new
|
|
36311
|
-
if (cursor.epoch !== this.epoch) throw new
|
|
36435
|
+
const cursor = (0, import_protocols28.parseProjectRoomEventId)(afterEventId);
|
|
36436
|
+
if (!cursor) throw new import_protocols28.ProjectRoomCursorError("CURSOR_EXPIRED");
|
|
36437
|
+
if (cursor.epoch !== this.epoch) throw new import_protocols28.ProjectRoomCursorError("SERVER_RESTART");
|
|
36312
36438
|
if (plan.sequences.has(cursor.sequence) || this.sequenceScopes.get(cursor.sequence) !== key) {
|
|
36313
|
-
throw new
|
|
36439
|
+
throw new import_protocols28.ProjectRoomCursorError("CURSOR_EXPIRED");
|
|
36314
36440
|
}
|
|
36315
36441
|
return cursor.sequence;
|
|
36316
36442
|
}
|
|
@@ -36411,7 +36537,7 @@ function snapshotJson(value, ancestors = /* @__PURE__ */ new Set()) {
|
|
|
36411
36537
|
|
|
36412
36538
|
// src/services/collaboration/ProjectRoomRealtimePublisher.ts
|
|
36413
36539
|
var import_node_crypto34 = require("crypto");
|
|
36414
|
-
var
|
|
36540
|
+
var import_protocols29 = require("@axiom-lattice/protocols");
|
|
36415
36541
|
var BrokerProjectRoomRealtimePublisher = class {
|
|
36416
36542
|
/** Creates a publisher around a broker and structured warning logger. */
|
|
36417
36543
|
constructor(deps) {
|
|
@@ -36425,7 +36551,7 @@ var BrokerProjectRoomRealtimePublisher = class {
|
|
|
36425
36551
|
/** Publishes a canonical message after projecting it to its public shape. */
|
|
36426
36552
|
messageCreated(message) {
|
|
36427
36553
|
this.publish("message.created", () => {
|
|
36428
|
-
const projection = (0,
|
|
36554
|
+
const projection = (0, import_protocols29.snapshotProjectRoomMessageRealtime)(message);
|
|
36429
36555
|
if (!projection) return void 0;
|
|
36430
36556
|
return {
|
|
36431
36557
|
sourceKey: `message:${projection.publicMessage.id}`,
|
|
@@ -36440,7 +36566,7 @@ var BrokerProjectRoomRealtimePublisher = class {
|
|
|
36440
36566
|
this.publish("roster.changed", () => {
|
|
36441
36567
|
const membership = snapshotInput(input, "roster");
|
|
36442
36568
|
if (membership.membership.tenantId !== membership.tenantId || membership.membership.roomId !== membership.roomId || !safeId2(membership.membership.projectId)) throw new TypeError("Invalid roster scope");
|
|
36443
|
-
const projection = (0,
|
|
36569
|
+
const projection = (0, import_protocols29.snapshotProjectRoomBotMembershipRealtime)(membership.membership);
|
|
36444
36570
|
if (!projection) return void 0;
|
|
36445
36571
|
return {
|
|
36446
36572
|
sourceKey: membership.sourceKey,
|
|
@@ -36455,7 +36581,7 @@ var BrokerProjectRoomRealtimePublisher = class {
|
|
|
36455
36581
|
this.publish("membership.changed", () => {
|
|
36456
36582
|
const membership = snapshotInput(input, "membership");
|
|
36457
36583
|
if (membership.membership.tenantId !== membership.tenantId || !safeId2(membership.membership.projectId)) throw new TypeError("Invalid membership scope");
|
|
36458
|
-
const projection = (0,
|
|
36584
|
+
const projection = (0, import_protocols29.snapshotProjectRoomMembershipRealtime)(membership.membership);
|
|
36459
36585
|
if (!projection) return void 0;
|
|
36460
36586
|
return {
|
|
36461
36587
|
sourceKey: membership.sourceKey,
|
|
@@ -36484,11 +36610,11 @@ var BrokerProjectRoomRealtimePublisher = class {
|
|
|
36484
36610
|
/** Publishes a membership notice onto the affected user's channel scope. */
|
|
36485
36611
|
membershipAffected(input) {
|
|
36486
36612
|
this.publish("membership.affected", () => {
|
|
36487
|
-
const value = (0,
|
|
36613
|
+
const value = (0, import_protocols29.snapshotExactRecord)(input, ["tenantId", "userId", "change", "projectId", "roomId", "sourceKey"]);
|
|
36488
36614
|
if (!value || !safeId2(value.tenantId) || !safeId2(value.userId) || !safeId2(value.projectId) || !safeId2(value.roomId) || !safeSourceKey(value.sourceKey) || !["added", "removed", "role_changed"].includes(value.change)) {
|
|
36489
36615
|
throw new TypeError("Invalid membership input");
|
|
36490
36616
|
}
|
|
36491
|
-
const scope = (0,
|
|
36617
|
+
const scope = (0, import_protocols29.projectRoomUserEventScope)(value.tenantId, value.userId);
|
|
36492
36618
|
return {
|
|
36493
36619
|
sourceKey: value.sourceKey,
|
|
36494
36620
|
id: value.sourceKey,
|
|
@@ -36504,11 +36630,11 @@ var BrokerProjectRoomRealtimePublisher = class {
|
|
|
36504
36630
|
/** Publishes a read-marker update onto the acting user's channel scope. */
|
|
36505
36631
|
readChanged(input) {
|
|
36506
36632
|
this.publish("read.changed", () => {
|
|
36507
|
-
const value = (0,
|
|
36633
|
+
const value = (0, import_protocols29.snapshotExactRecord)(input, ["tenantId", "userId", "projectId", "roomId", "lastReadAt", "sourceKey"]);
|
|
36508
36634
|
if (!value || !safeId2(value.tenantId) || !safeId2(value.userId) || !safeId2(value.projectId) || !safeId2(value.roomId) || !safeSourceKey(value.sourceKey) || typeof value.lastReadAt !== "string" || !Number.isFinite(Date.parse(value.lastReadAt))) {
|
|
36509
36635
|
throw new TypeError("Invalid read input");
|
|
36510
36636
|
}
|
|
36511
|
-
const scope = (0,
|
|
36637
|
+
const scope = (0, import_protocols29.projectRoomUserEventScope)(value.tenantId, value.userId);
|
|
36512
36638
|
return {
|
|
36513
36639
|
sourceKey: value.sourceKey,
|
|
36514
36640
|
id: value.sourceKey,
|
|
@@ -36549,13 +36675,13 @@ var BrokerProjectRoomRealtimePublisher = class {
|
|
|
36549
36675
|
};
|
|
36550
36676
|
function snapshotInput(input, kind) {
|
|
36551
36677
|
const keys2 = kind === "message" ? ["tenantId", "roomId", "message", "sourceKey"] : kind === "roster" ? ["tenantId", "roomId", "membership", "sourceKey"] : ["tenantId", "roomId", "membership", "sourceKey"];
|
|
36552
|
-
const value = (0,
|
|
36678
|
+
const value = (0, import_protocols29.snapshotExactRecord)(input, [...keys2, "change"]);
|
|
36553
36679
|
const validChange = kind === "roster" ? ["added", "updated", "paused", "resumed", "removed"].includes(value?.change) : ["added", "role_changed", "removed"].includes(value?.change);
|
|
36554
36680
|
if (!value || !safeId2(value.tenantId) || !safeId2(value.roomId) || !safeSourceKey(value.sourceKey) || !validChange) throw new TypeError(`Invalid ${kind} input`);
|
|
36555
36681
|
return value;
|
|
36556
36682
|
}
|
|
36557
36683
|
function snapshotTaskInput(input) {
|
|
36558
|
-
const value = (0,
|
|
36684
|
+
const value = (0, import_protocols29.snapshotExactRecord)(input, ["tenantId", "roomId", "projectId", "taskId", "status", "ownerMembershipId", "updatedAt", "sourceKey"]);
|
|
36559
36685
|
if (!value || !safeId2(value.tenantId) || !safeId2(value.roomId) || !safeSourceKey(value.sourceKey)) throw new TypeError("Invalid task input");
|
|
36560
36686
|
if (!safeId2(value.projectId) || !safeId2(value.taskId) || !safeId2(value.ownerMembershipId) || !["pending", "in_progress", "review", "failed", "interrupted", "completed", "cancelled"].includes(value.status)) throw new TypeError("Invalid task input");
|
|
36561
36687
|
if (typeof value.updatedAt !== "string") throw new TypeError("Invalid task timestamp");
|
|
@@ -36580,7 +36706,7 @@ function safeErrorCode(error) {
|
|
|
36580
36706
|
}
|
|
36581
36707
|
|
|
36582
36708
|
// src/services/collaboration/ProjectRoomTaskEventSubscriber.ts
|
|
36583
|
-
var
|
|
36709
|
+
var import_protocols30 = require("@axiom-lattice/protocols");
|
|
36584
36710
|
init_projectTaskScope();
|
|
36585
36711
|
var ProjectRoomTaskEventSubscriber = class {
|
|
36586
36712
|
/** Creates a bounded Project task lifecycle observer. */
|
|
@@ -36691,7 +36817,7 @@ var ProjectRoomTaskEventSubscriber = class {
|
|
|
36691
36817
|
}
|
|
36692
36818
|
}
|
|
36693
36819
|
parse(value) {
|
|
36694
|
-
const row = (0,
|
|
36820
|
+
const row = (0, import_protocols30.snapshotExactRecord)(value, ["tenantId", "workspaceId", "projectId", "taskId", "status", "action", "eventKey", "updatedAt"], ["threadId"]);
|
|
36695
36821
|
const actions = ["in_progress", "interrupted", "failed", "completed", "cancelled", "reassigned"];
|
|
36696
36822
|
const statuses = ["pending", "in_progress", "review", "failed", "interrupted", "completed", "cancelled"];
|
|
36697
36823
|
if (!row || !actions.includes(String(row.action)) || !statuses.includes(String(row.status)) || !["tenantId", "workspaceId", "projectId", "taskId", "eventKey", "updatedAt"].every((key) => typeof row[key] === "string" && row[key].length > 0) || !Number.isFinite(Date.parse(row.updatedAt)) || row.threadId !== void 0 && typeof row.threadId !== "string") return void 0;
|
|
@@ -36886,7 +37012,7 @@ function createRoomPushNotifier(input) {
|
|
|
36886
37012
|
}
|
|
36887
37013
|
|
|
36888
37014
|
// src/services/collaboration/WorkspaceRoomEventsService.ts
|
|
36889
|
-
var
|
|
37015
|
+
var import_protocols31 = require("@axiom-lattice/protocols");
|
|
36890
37016
|
|
|
36891
37017
|
// src/services/collaboration/ProjectRoomSseWriter.ts
|
|
36892
37018
|
var DEFAULT_MAX_FRAMES = 256;
|
|
@@ -37134,7 +37260,7 @@ var WorkspaceRoomEventsService = class {
|
|
|
37134
37260
|
const clear = (timer) => {
|
|
37135
37261
|
if (timer !== void 0) clearTimeout(timer);
|
|
37136
37262
|
};
|
|
37137
|
-
const userScope = (0,
|
|
37263
|
+
const userScope = (0, import_protocols31.projectRoomUserEventScope)(actor3.tenantId, actor3.userId);
|
|
37138
37264
|
const userScopeKey = JSON.stringify([userScope.tenantId, userScope.roomId, userScope.projectId]);
|
|
37139
37265
|
const roomScopeKey = (scope) => JSON.stringify([scope.tenantId, scope.roomId, scope.projectId]);
|
|
37140
37266
|
const serializeScoped = (scope, event) => scope === null ? `id: ${event.id}
|
|
@@ -37244,7 +37370,7 @@ data: ${JSON.stringify({ ...event, scope })}
|
|
|
37244
37370
|
accessTimer = setTimeout(() => {
|
|
37245
37371
|
accessTimer = void 0;
|
|
37246
37372
|
if (closed) return;
|
|
37247
|
-
const projectIds = [...subscriptions.values()].map((entry) => entry.scope.projectId).filter((projectId) => projectId !==
|
|
37373
|
+
const projectIds = [...subscriptions.values()].map((entry) => entry.scope.projectId).filter((projectId) => projectId !== import_protocols31.PROJECT_ROOM_USER_CHANNEL_PROJECT);
|
|
37248
37374
|
Promise.all(projectIds.map((projectId) => Promise.resolve().then(() => this.deps.requireReadAccess({ tenantId: actor3.tenantId, userId: actor3.userId, projectId })))).then(() => {
|
|
37249
37375
|
if (!closed) scheduleAccessCheck();
|
|
37250
37376
|
}, () => {
|
|
@@ -37287,7 +37413,7 @@ function createWorkspaceMemberRoomLister(deps) {
|
|
|
37287
37413
|
}
|
|
37288
37414
|
|
|
37289
37415
|
// src/routes/workspace-room-events.ts
|
|
37290
|
-
var
|
|
37416
|
+
var import_protocols32 = require("@axiom-lattice/protocols");
|
|
37291
37417
|
function registerWorkspaceRoomEventRoutes(app2, deps) {
|
|
37292
37418
|
app2.get("/api/workspaces/:workspaceId/room-events", async (request, reply) => {
|
|
37293
37419
|
try {
|
|
@@ -37315,7 +37441,7 @@ function registerWorkspaceRoomEventRoutes(app2, deps) {
|
|
|
37315
37441
|
});
|
|
37316
37442
|
}
|
|
37317
37443
|
function exactParams(params) {
|
|
37318
|
-
const value = (0,
|
|
37444
|
+
const value = (0, import_protocols32.snapshotExactRecord)(params, ["workspaceId"]);
|
|
37319
37445
|
if (!value || typeof value.workspaceId !== "string" || !value.workspaceId.trim()) throw new InvalidRealtimeRequestError();
|
|
37320
37446
|
return { workspaceId: value.workspaceId };
|
|
37321
37447
|
}
|
|
@@ -37441,7 +37567,7 @@ function snapshotDataRecord(value) {
|
|
|
37441
37567
|
for (const key of Reflect.ownKeys(descriptors)) {
|
|
37442
37568
|
if (typeof key !== "string") return void 0;
|
|
37443
37569
|
const descriptor = descriptors[key];
|
|
37444
|
-
const data = (0,
|
|
37570
|
+
const data = (0, import_protocols33.descriptorDataValue)(descriptor);
|
|
37445
37571
|
if (!data) return void 0;
|
|
37446
37572
|
result[key] = data.value;
|
|
37447
37573
|
}
|
|
@@ -37456,7 +37582,7 @@ function isPublicRoomAddress(message) {
|
|
|
37456
37582
|
}
|
|
37457
37583
|
async function validateReassignmentThread(threads, input) {
|
|
37458
37584
|
const thread = snapshotThread(await threads.getThreadById(input.tenantId, input.newThreadId));
|
|
37459
|
-
const metadata = (0,
|
|
37585
|
+
const metadata = (0, import_protocols33.snapshotExactRecord)(thread?.metadata, [
|
|
37460
37586
|
"source",
|
|
37461
37587
|
"kind",
|
|
37462
37588
|
"workspaceId",
|
|
@@ -38473,9 +38599,9 @@ var registerLatticeRoutes = (app2, channelDeps, options = {}) => {
|
|
|
38473
38599
|
function tryCreateProjectTaskRuntime(input) {
|
|
38474
38600
|
let projectWorkItems;
|
|
38475
38601
|
try {
|
|
38476
|
-
projectWorkItems = (0,
|
|
38602
|
+
projectWorkItems = (0, import_protocols33.requireProjectTaskWorkItemStore)(input.taskWorkItemStore);
|
|
38477
38603
|
} catch (error) {
|
|
38478
|
-
if (error instanceof
|
|
38604
|
+
if (error instanceof import_protocols33.ProjectTaskStoreUnsupportedError) {
|
|
38479
38605
|
input.log?.warn("project-task:runtime-unavailable", {
|
|
38480
38606
|
code: error.code,
|
|
38481
38607
|
missingMethods: error.missingMethods
|
|
@@ -41283,7 +41409,7 @@ function readField(fields, name) {
|
|
|
41283
41409
|
|
|
41284
41410
|
// src/services/run-cancel/RedisRunCancelNotifier.ts
|
|
41285
41411
|
var import_redis4 = require("redis");
|
|
41286
|
-
var
|
|
41412
|
+
var import_protocols35 = require("@axiom-lattice/protocols");
|
|
41287
41413
|
var DEFAULT_DEDUPE_TTL_MS = 6e4;
|
|
41288
41414
|
var DEFAULT_DEDUPE_MAX_ENTRIES = 1e3;
|
|
41289
41415
|
function runCancelChannel(owner) {
|
|
@@ -41499,7 +41625,7 @@ var RedisRunCancelNotifier = class {
|
|
|
41499
41625
|
let signal;
|
|
41500
41626
|
try {
|
|
41501
41627
|
const decoded = JSON.parse(message);
|
|
41502
|
-
const parsed =
|
|
41628
|
+
const parsed = import_protocols35.runCancelSignalSchema.safeParse(decoded);
|
|
41503
41629
|
if (!parsed.success) {
|
|
41504
41630
|
this.warn("Run cancel signal rejected", {
|
|
41505
41631
|
owner: this.owner,
|
|
@@ -41740,7 +41866,7 @@ var import_core87 = require("@axiom-lattice/core");
|
|
|
41740
41866
|
|
|
41741
41867
|
// src/router/MessageRouter.ts
|
|
41742
41868
|
var import_core86 = require("@axiom-lattice/core");
|
|
41743
|
-
var
|
|
41869
|
+
var import_protocols36 = require("@axiom-lattice/protocols");
|
|
41744
41870
|
var import_crypto11 = require("crypto");
|
|
41745
41871
|
init_runTaskRuntimeRegistry();
|
|
41746
41872
|
|
|
@@ -41808,10 +41934,10 @@ function clarifyText(clarify) {
|
|
|
41808
41934
|
return ["```clarify", JSON.stringify({ questions: clarify.questions }), "```"].join("\n");
|
|
41809
41935
|
}
|
|
41810
41936
|
function exactDataValues(value, required, optional = []) {
|
|
41811
|
-
return (0,
|
|
41937
|
+
return (0, import_protocols36.snapshotExactRecord)(value, required, optional);
|
|
41812
41938
|
}
|
|
41813
41939
|
function uniqueNonemptyStrings(value) {
|
|
41814
|
-
const snapshot = (0,
|
|
41940
|
+
const snapshot = (0, import_protocols36.snapshotExactArray)(value);
|
|
41815
41941
|
if (!snapshot || snapshot.length === 0 || snapshot.some((entry) => typeof entry !== "string" || entry.length === 0)) return void 0;
|
|
41816
41942
|
const values = snapshot;
|
|
41817
41943
|
return new Set(values).size === values.length ? values : void 0;
|
|
@@ -42430,13 +42556,13 @@ var _MessageRouter = class _MessageRouter {
|
|
|
42430
42556
|
for await (const chunk of stream) {
|
|
42431
42557
|
if (state.finished) break;
|
|
42432
42558
|
if (!started) {
|
|
42433
|
-
if (chunk?.type ===
|
|
42559
|
+
if (chunk?.type === import_protocols36.MessageChunkTypes.HUMAN && chunk?.data?.id === inputMessageId) {
|
|
42434
42560
|
started = true;
|
|
42435
42561
|
}
|
|
42436
42562
|
continue;
|
|
42437
42563
|
}
|
|
42438
|
-
if (chunk?.type ===
|
|
42439
|
-
if (chunk.type ===
|
|
42564
|
+
if (chunk?.type === import_protocols36.MessageChunkTypes.MESSAGE_COMPLETED || chunk?.type === import_protocols36.MessageChunkTypes.MESSAGE_FAILED || chunk?.type === import_protocols36.MessageChunkTypes.INTERRUPT) {
|
|
42565
|
+
if (chunk.type === import_protocols36.MessageChunkTypes.MESSAGE_COMPLETED) {
|
|
42440
42566
|
normalEnd = true;
|
|
42441
42567
|
const grace = setTimeout(
|
|
42442
42568
|
() => {
|
|
@@ -42445,14 +42571,14 @@ var _MessageRouter = class _MessageRouter {
|
|
|
42445
42571
|
_MessageRouter.COMPLETION_GRACE_MS
|
|
42446
42572
|
);
|
|
42447
42573
|
grace.unref?.();
|
|
42448
|
-
} else if (chunk.type ===
|
|
42574
|
+
} else if (chunk.type === import_protocols36.MessageChunkTypes.MESSAGE_FAILED) {
|
|
42449
42575
|
await closeWith("failed");
|
|
42450
42576
|
} else {
|
|
42451
42577
|
await closeWith("interrupted");
|
|
42452
42578
|
}
|
|
42453
42579
|
break;
|
|
42454
42580
|
}
|
|
42455
|
-
if (chunk?.type !==
|
|
42581
|
+
if (chunk?.type !== import_protocols36.MessageChunkTypes.AI) continue;
|
|
42456
42582
|
const text = typeof chunk.data?.content === "string" ? chunk.data.content : void 0;
|
|
42457
42583
|
if (!text) continue;
|
|
42458
42584
|
accumulated += text;
|
|
@@ -42519,7 +42645,7 @@ var MessageRouter = _MessageRouter;
|
|
|
42519
42645
|
|
|
42520
42646
|
// src/channels/room/RoomChannelAdapter.ts
|
|
42521
42647
|
var import_zod19 = require("zod");
|
|
42522
|
-
var
|
|
42648
|
+
var import_protocols37 = require("@axiom-lattice/protocols");
|
|
42523
42649
|
var roomConfigSchema = import_zod19.z.object({}).strict();
|
|
42524
42650
|
function createRoomChannelAdapter(writer) {
|
|
42525
42651
|
return {
|
|
@@ -42593,7 +42719,7 @@ function exactStrings(value, keys2) {
|
|
|
42593
42719
|
function exactValues2(value, required, optional = []) {
|
|
42594
42720
|
try {
|
|
42595
42721
|
if (typeof value !== "object" || value === null || Array.isArray(value)) return void 0;
|
|
42596
|
-
return (0,
|
|
42722
|
+
return (0, import_protocols37.snapshotExactRecord)(value, required, optional);
|
|
42597
42723
|
} catch {
|
|
42598
42724
|
return void 0;
|
|
42599
42725
|
}
|
|
@@ -42626,7 +42752,7 @@ function createChannelInfrastructure(deps) {
|
|
|
42626
42752
|
}
|
|
42627
42753
|
|
|
42628
42754
|
// src/services/channel-reply/ChannelReplyDispatcher.ts
|
|
42629
|
-
var
|
|
42755
|
+
var import_protocols38 = require("@axiom-lattice/protocols");
|
|
42630
42756
|
var CHANNEL_REPLY_NO_OUTPUT = "CHANNEL_REPLY_NO_OUTPUT";
|
|
42631
42757
|
var CHANNEL_REPLY_INSTALLATION_UNAVAILABLE = "CHANNEL_REPLY_INSTALLATION_UNAVAILABLE";
|
|
42632
42758
|
var CHANNEL_REPLY_NO_ADAPTER = "CHANNEL_REPLY_NO_ADAPTER";
|
|
@@ -42651,7 +42777,7 @@ var ChannelReplyDispatcher = class {
|
|
|
42651
42777
|
this.installationStore = deps.installationStore;
|
|
42652
42778
|
this.owner = deps.owner;
|
|
42653
42779
|
this.pollIntervalMs = positive2(deps.pollIntervalMs, 1e3);
|
|
42654
|
-
this.listLimit = positive2(deps.listLimit,
|
|
42780
|
+
this.listLimit = positive2(deps.listLimit, import_protocols38.CHANNEL_REPLY_JOB_LIST_LIMIT_DEFAULT);
|
|
42655
42781
|
this.leaseMs = positive2(deps.leaseMs, 6e4);
|
|
42656
42782
|
this.maxSendAttempts = positive2(deps.maxSendAttempts, 5);
|
|
42657
42783
|
this.backoffBaseMs = positive2(deps.backoffBaseMs, 1e3);
|
|
@@ -46162,7 +46288,7 @@ function handleAgentLifecycle(payload, deps = {}) {
|
|
|
46162
46288
|
}
|
|
46163
46289
|
|
|
46164
46290
|
// src/index.ts
|
|
46165
|
-
var
|
|
46291
|
+
var import_protocols48 = require("@axiom-lattice/protocols");
|
|
46166
46292
|
|
|
46167
46293
|
// src/services/observability/LangfuseObservabilityProvider.ts
|
|
46168
46294
|
var import_node_buffer = require("buffer");
|
|
@@ -46170,7 +46296,7 @@ var import_sdk_trace_node = require("@opentelemetry/sdk-trace-node");
|
|
|
46170
46296
|
var import_otel = require("@langfuse/otel");
|
|
46171
46297
|
var import_langchain = require("@langfuse/langchain");
|
|
46172
46298
|
var import_core98 = require("@axiom-lattice/core");
|
|
46173
|
-
var
|
|
46299
|
+
var import_protocols39 = require("@axiom-lattice/protocols");
|
|
46174
46300
|
|
|
46175
46301
|
// src/services/observability/LangfuseDashboardQueries.ts
|
|
46176
46302
|
var DASHBOARD_SECTIONS = [
|
|
@@ -46821,7 +46947,7 @@ var LangfuseObservabilityProvider = class {
|
|
|
46821
46947
|
samplingRate: this.config.sampleRate
|
|
46822
46948
|
});
|
|
46823
46949
|
return {
|
|
46824
|
-
version:
|
|
46950
|
+
version: import_protocols39.LANGFUSE_OBSERVABILITY_DASHBOARD_VERSION,
|
|
46825
46951
|
...assembled.warnings.length > 0 ? { warnings: assembled.warnings } : {},
|
|
46826
46952
|
payload: {
|
|
46827
46953
|
...assembled.payload,
|
|
@@ -46908,7 +47034,7 @@ process.on("unhandledRejection", (reason, promise) => {
|
|
|
46908
47034
|
var DEFAULT_LOGGER_CONFIG = {
|
|
46909
47035
|
name: "default",
|
|
46910
47036
|
description: "Default logger for lattice-gateway service",
|
|
46911
|
-
type:
|
|
47037
|
+
type: import_protocols48.LoggerType.PINO,
|
|
46912
47038
|
serviceName: "lattice/gateway",
|
|
46913
47039
|
loggerName: "lattice/gateway"
|
|
46914
47040
|
};
|
|
@@ -46984,8 +47110,8 @@ app.register(import_cors.default, {
|
|
|
46984
47110
|
"Content-Type",
|
|
46985
47111
|
"Content-Disposition",
|
|
46986
47112
|
"A2A-Version",
|
|
46987
|
-
|
|
46988
|
-
|
|
47113
|
+
import_protocols48.REPLICA_HEADER,
|
|
47114
|
+
import_protocols48.AFFINITY_ECHO_HEADER
|
|
46989
47115
|
],
|
|
46990
47116
|
credentials: true
|
|
46991
47117
|
});
|