@axiom-lattice/gateway 4.9.0 → 4.9.1
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/{chunk-NPHK4SZ6.mjs → chunk-FGSFOXIX.mjs} +2 -2
- package/dist/{chunk-73QZQQOT.mjs → chunk-MWWLJMYN.mjs} +3 -2
- package/dist/chunk-MWWLJMYN.mjs.map +1 -0
- package/dist/embed/{embed-page-AgentDetailSideApp-BVJK7WIS.js → embed-page-AgentDetailSideApp-UMITWVYQ.js} +1 -1
- package/dist/embed/{embed-page-AgentGovernanceWorkbench-L2YHPRNE.js → embed-page-AgentGovernanceWorkbench-UD7RE7PT.js} +1 -1
- package/dist/embed/{embed-page-MessageGraph-JOQ46UE2.js → embed-page-MessageGraph-XQWKYDUB.js} +1 -1
- package/dist/embed/{embed-page-ReactChart-I5AYTSII.js → embed-page-ReactChart-LW3GWMY2.js} +1 -1
- package/dist/embed/{embed-page-SkillFlow-YLB5XPFH.js → embed-page-SkillFlow-X3D346DE.js} +1 -1
- package/dist/embed/{embed-page-TasksSideApp-QLJVB7UK.js → embed-page-TasksSideApp-SUMX2GJF.js} +1 -1
- package/dist/embed/{embed-page-TeamWorkspace-BZZEAYSB.js → embed-page-TeamWorkspace-QMIX2TP2.js} +1 -1
- package/dist/embed/{embed-page-TopologyRuntimeView-FRA3AXQQ.js → embed-page-TopologyRuntimeView-ZP6NWNS7.js} +1 -1
- package/dist/embed/{embed-page-WorkflowAutomationView-D745PK3W.js → embed-page-WorkflowAutomationView-4HD3ISK6.js} +1 -1
- package/dist/embed/{embed-page-chunk-FVMSMU4J.js → embed-page-chunk-3VIEL6KL.js} +1 -1
- package/dist/embed/{embed-page-chunk-4WBAN7QL.js → embed-page-chunk-MFFCCHGW.js} +158 -158
- package/dist/embed/{embed-page-chunk-M2PV36MX.js → embed-page-chunk-QCKYIPFY.js} +1 -1
- package/dist/embed/{embed-page-chunk-P5PFV3N7.js → embed-page-chunk-QGAGZMX2.js} +1 -1
- package/dist/embed/{embed-page-chunk-FWGNJMXD.js → embed-page-chunk-SX7YO5JA.js} +1 -1
- package/dist/embed/{embed-page-chunk-WMLR2GQK.js → embed-page-chunk-T7XXE35M.js} +1 -1
- package/dist/embed/{embed-page-chunk-K5YYUAPL.js → embed-page-chunk-YAJUWBF2.js} +1 -1
- package/dist/embed/embed-page.js +1 -1
- package/dist/index.d.mts +48 -3
- package/dist/index.d.ts +48 -3
- package/dist/index.js +621 -442
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +327 -146
- package/dist/index.mjs.map +1 -1
- package/dist/{open-UVKMONVE.mjs → open-FJ3BY3CL.mjs} +3 -3
- package/dist/{open-exposure-27ESFWTB.mjs → open-exposure-OX5NKWDG.mjs} +3 -3
- package/package.json +3 -3
- package/dist/chunk-73QZQQOT.mjs.map +0 -1
- /package/dist/{chunk-NPHK4SZ6.mjs.map → chunk-FGSFOXIX.mjs.map} +0 -0
- /package/dist/{open-UVKMONVE.mjs.map → open-FJ3BY3CL.mjs.map} +0 -0
- /package/dist/{open-exposure-27ESFWTB.mjs.map → open-exposure-OX5NKWDG.mjs.map} +0 -0
package/dist/index.mjs
CHANGED
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
import {
|
|
17
17
|
PluginToolScopeError,
|
|
18
18
|
invokePluginTool
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-MWWLJMYN.mjs";
|
|
20
20
|
import {
|
|
21
21
|
buildPreviewTokenScript
|
|
22
22
|
} from "./chunk-7CG57LEF.mjs";
|
|
@@ -8741,7 +8741,7 @@ function registerMcpAppRoutes(fastify2) {
|
|
|
8741
8741
|
}
|
|
8742
8742
|
|
|
8743
8743
|
// src/controllers/eval.ts
|
|
8744
|
-
import { getStoreLattice as getStoreLattice11 } from "@axiom-lattice/core";
|
|
8744
|
+
import { getStoreLattice as getStoreLattice11, modelLatticeManager as modelLatticeManager3 } from "@axiom-lattice/core";
|
|
8745
8745
|
import { v4 as uuidv43 } from "uuid";
|
|
8746
8746
|
|
|
8747
8747
|
// src/services/eval-runner.ts
|
|
@@ -9125,8 +9125,7 @@ async function createProject(request, reply) {
|
|
|
9125
9125
|
const judgeCfg = data.judgeModelConfig || {};
|
|
9126
9126
|
const modelKey2 = judgeCfg.modelKey || "";
|
|
9127
9127
|
if (modelKey2) {
|
|
9128
|
-
|
|
9129
|
-
if (!modelLatticeManager4.hasLattice(modelKey2)) {
|
|
9128
|
+
if (!modelLatticeManager3.hasLattice(modelKey2)) {
|
|
9130
9129
|
return reply.status(400).send({ success: false, message: `Judge model "${modelKey2}" is not registered` });
|
|
9131
9130
|
}
|
|
9132
9131
|
}
|
|
@@ -9172,8 +9171,7 @@ async function listProjects(request, reply) {
|
|
|
9172
9171
|
let projects = await store.getProjectsByTenant(tenantId);
|
|
9173
9172
|
if (projects.length === 0) {
|
|
9174
9173
|
try {
|
|
9175
|
-
const
|
|
9176
|
-
const models = modelLatticeManager4.getAllLattices();
|
|
9174
|
+
const models = modelLatticeManager3.getAllLattices();
|
|
9177
9175
|
const first = models[0];
|
|
9178
9176
|
const judgeModel = first ? { modelKey: first.key } : {};
|
|
9179
9177
|
const host = request.hostname || "localhost";
|
|
@@ -9241,8 +9239,7 @@ async function updateProject(request, reply) {
|
|
|
9241
9239
|
const judgeCfg = body.judgeModelConfig || {};
|
|
9242
9240
|
const modelKey2 = judgeCfg.modelKey || "";
|
|
9243
9241
|
if (modelKey2) {
|
|
9244
|
-
|
|
9245
|
-
if (!modelLatticeManager4.hasLattice(modelKey2)) {
|
|
9242
|
+
if (!modelLatticeManager3.hasLattice(modelKey2)) {
|
|
9246
9243
|
return reply.status(400).send({ success: false, message: `Judge model "${modelKey2}" is not registered` });
|
|
9247
9244
|
}
|
|
9248
9245
|
}
|
|
@@ -10641,6 +10638,7 @@ import { randomUUID as randomUUID11 } from "crypto";
|
|
|
10641
10638
|
import {
|
|
10642
10639
|
descriptorDataValue
|
|
10643
10640
|
} from "@axiom-lattice/protocols";
|
|
10641
|
+
import { getStoreLattice as getStoreLattice15 } from "@axiom-lattice/core";
|
|
10644
10642
|
var _adapterRegistry;
|
|
10645
10643
|
var _router;
|
|
10646
10644
|
function setChannelControllerDeps(deps) {
|
|
@@ -10764,8 +10762,7 @@ function snapshotPlainObject(value) {
|
|
|
10764
10762
|
}
|
|
10765
10763
|
}
|
|
10766
10764
|
async function getInstallationStore() {
|
|
10767
|
-
const
|
|
10768
|
-
const store = getStoreLattice30("default", "channelInstallation").store;
|
|
10765
|
+
const store = getStoreLattice15("default", "channelInstallation").store;
|
|
10769
10766
|
if (store) return store;
|
|
10770
10767
|
const { PostgreSQLChannelInstallationStore } = await import("@axiom-lattice/pg-stores");
|
|
10771
10768
|
const databaseUrl = process.env.DATABASE_URL;
|
|
@@ -11084,7 +11081,7 @@ import {
|
|
|
11084
11081
|
DuplicateChannelBindingSubjectError,
|
|
11085
11082
|
descriptorDataValue as descriptorDataValue2
|
|
11086
11083
|
} from "@axiom-lattice/protocols";
|
|
11087
|
-
import { getBindingRegistry, getStoreLattice as
|
|
11084
|
+
import { getBindingRegistry, getStoreLattice as getStoreLattice16 } from "@axiom-lattice/core";
|
|
11088
11085
|
function getTenantId13(request) {
|
|
11089
11086
|
const userTenantId = request.user?.tenantId;
|
|
11090
11087
|
if (typeof userTenantId === "string" && userTenantId) return userTenantId;
|
|
@@ -11142,7 +11139,7 @@ function snapshotPublicUpdate(value) {
|
|
|
11142
11139
|
return body;
|
|
11143
11140
|
}
|
|
11144
11141
|
function getInstallationStore2() {
|
|
11145
|
-
return
|
|
11142
|
+
return getStoreLattice16("default", "channelInstallation").store;
|
|
11146
11143
|
}
|
|
11147
11144
|
async function isValidPublicInstallation(tenantId, channelInstallationId, channel) {
|
|
11148
11145
|
const installation = await getInstallationStore2().getInstallationById(channelInstallationId);
|
|
@@ -11642,7 +11639,7 @@ var registerSTTRoutes = (app2) => {
|
|
|
11642
11639
|
};
|
|
11643
11640
|
|
|
11644
11641
|
// src/controllers/local-a2a.ts
|
|
11645
|
-
import { getStoreLattice as
|
|
11642
|
+
import { getStoreLattice as getStoreLattice17 } from "@axiom-lattice/core";
|
|
11646
11643
|
import {
|
|
11647
11644
|
AgentType as AgentType2
|
|
11648
11645
|
} from "@axiom-lattice/protocols";
|
|
@@ -11658,7 +11655,7 @@ function getLocalRuntime(assistant) {
|
|
|
11658
11655
|
return graphDefinition.localRuntime;
|
|
11659
11656
|
}
|
|
11660
11657
|
async function getLocalA2AAssistants(tenantId) {
|
|
11661
|
-
const storeLattice =
|
|
11658
|
+
const storeLattice = getStoreLattice17("default", "assistant");
|
|
11662
11659
|
const assistants = await storeLattice.store.getAllAssistants(tenantId);
|
|
11663
11660
|
const results = [];
|
|
11664
11661
|
for (const assistant of assistants) {
|
|
@@ -11670,7 +11667,7 @@ async function getLocalA2AAssistants(tenantId) {
|
|
|
11670
11667
|
return results;
|
|
11671
11668
|
}
|
|
11672
11669
|
async function getLocalA2AAssistant(tenantId, assistantId) {
|
|
11673
|
-
const storeLattice =
|
|
11670
|
+
const storeLattice = getStoreLattice17("default", "assistant");
|
|
11674
11671
|
const assistant = await storeLattice.store.getAssistantById(tenantId, assistantId);
|
|
11675
11672
|
if (!assistant) return null;
|
|
11676
11673
|
const runtime = getLocalRuntime(assistant);
|
|
@@ -11920,9 +11917,9 @@ import {
|
|
|
11920
11917
|
createTrustedAgentMessageDispatcher,
|
|
11921
11918
|
executionAuthorityRegistry,
|
|
11922
11919
|
getReplicaId as getReplicaId6,
|
|
11923
|
-
getStoreLattice as
|
|
11920
|
+
getStoreLattice as getStoreLattice18,
|
|
11924
11921
|
ManagedTaskStartError,
|
|
11925
|
-
modelLatticeManager as
|
|
11922
|
+
modelLatticeManager as modelLatticeManager4,
|
|
11926
11923
|
ProjectTaskOwnerPolicy,
|
|
11927
11924
|
ProjectTaskOwnerPolicyError as ProjectTaskOwnerPolicyError2,
|
|
11928
11925
|
projectMutationMutex as projectMutationMutex2,
|
|
@@ -12374,10 +12371,10 @@ var ProjectTaskExecutionService = class {
|
|
|
12374
12371
|
return { kind: "ready", task: current, thread: ensured.thread, rosterExempt: validated.rosterExempt };
|
|
12375
12372
|
}
|
|
12376
12373
|
/** Resumes an interrupted Project Task on its canonical existing Thread. */
|
|
12377
|
-
async resume(input, signal) {
|
|
12374
|
+
async resume(input, signal, options) {
|
|
12378
12375
|
const prepared = await this.prepareResume(input, signal);
|
|
12379
12376
|
if (prepared.kind === "aborted") return prepared.outcome;
|
|
12380
|
-
return this.dispatchRun(prepared.task, prepared.thread, "resume", prepared.rosterExempt, signal);
|
|
12377
|
+
return this.dispatchRun(prepared.task, prepared.thread, "resume", prepared.rosterExempt, signal, options);
|
|
12381
12378
|
}
|
|
12382
12379
|
/** Clears the durable interruption and loads the exact resumed task. */
|
|
12383
12380
|
async prepareResume(input, signal) {
|
|
@@ -12410,6 +12407,7 @@ var ProjectTaskExecutionService = class {
|
|
|
12410
12407
|
*
|
|
12411
12408
|
* @param input Tenant, task identity, and optional command actor.
|
|
12412
12409
|
* @param signal Optional cancellation signal for the armed settlement.
|
|
12410
|
+
* @param options Optional resume command carried into the queued run message.
|
|
12413
12411
|
* @returns The settled run outcome.
|
|
12414
12412
|
* @remarks `start` semantics: make this task run. `pending` starts,
|
|
12415
12413
|
* `interrupted` resumes, `failed` retries, and `completed`/`cancelled`
|
|
@@ -12417,14 +12415,15 @@ var ProjectTaskExecutionService = class {
|
|
|
12417
12415
|
* conflict. This is a record transition plus an application-layer side
|
|
12418
12416
|
* effect; the kernel only records the status change. `actor` attributes the
|
|
12419
12417
|
* start/resume/retry/reopen transition and defaults to the system actor.
|
|
12418
|
+
* `options.command` is only carried on an interrupted-task resume.
|
|
12420
12419
|
*/
|
|
12421
|
-
async dispatch(input, signal) {
|
|
12420
|
+
async dispatch(input, signal, options) {
|
|
12422
12421
|
const task = await this.requireTask(input);
|
|
12423
12422
|
if (task.ownerType !== "agent") {
|
|
12424
12423
|
throw new ProjectTaskExecutionError("PROJECT_TASK_NOT_READY", "Project task is not agent-owned");
|
|
12425
12424
|
}
|
|
12426
12425
|
if (task.status === "pending") return this.start(input, signal);
|
|
12427
|
-
if (task.status === "interrupted") return this.resume(input, signal);
|
|
12426
|
+
if (task.status === "interrupted") return this.resume(input, signal, options);
|
|
12428
12427
|
if (task.status === "failed" || task.status === "completed" || task.status === "cancelled") {
|
|
12429
12428
|
return this.dispatchRestartable(task, input.actor ?? SYSTEM_ACTOR, signal);
|
|
12430
12429
|
}
|
|
@@ -12435,6 +12434,7 @@ var ProjectTaskExecutionService = class {
|
|
|
12435
12434
|
*
|
|
12436
12435
|
* @param input Tenant, task identity, and optional command actor.
|
|
12437
12436
|
* @param signal Optional cancellation signal for the pre-run transition.
|
|
12437
|
+
* @param options Optional resume command carried into the queued run message.
|
|
12438
12438
|
* @returns The `in_progress` task snapshot and whether the run was queued.
|
|
12439
12439
|
* @remarks Intended for command HTTP handlers that must release the Project
|
|
12440
12440
|
* mutation mutex immediately: the armed settlement keeps running in the
|
|
@@ -12442,20 +12442,25 @@ var ProjectTaskExecutionService = class {
|
|
|
12442
12442
|
* awaits it. Enqueue failure converges the task exactly like the awaited
|
|
12443
12443
|
* path before throwing, so no phantom run is left behind.
|
|
12444
12444
|
*/
|
|
12445
|
-
async dispatchDetached(input, signal) {
|
|
12445
|
+
async dispatchDetached(input, signal, options) {
|
|
12446
12446
|
const task = await this.requireTask(input);
|
|
12447
|
+
if (options?.expectedStatus !== void 0 && task.status !== options.expectedStatus) {
|
|
12448
|
+
throw new ProjectTaskExecutionError("PROJECT_TASK_NOT_RESUMABLE", "Project task is not in the expected status");
|
|
12449
|
+
}
|
|
12447
12450
|
if (task.ownerType !== "agent") {
|
|
12448
12451
|
throw new ProjectTaskExecutionError("PROJECT_TASK_NOT_READY", "Project task is not agent-owned");
|
|
12449
12452
|
}
|
|
12450
12453
|
const actor3 = input.actor ?? SYSTEM_ACTOR;
|
|
12451
12454
|
let prepared;
|
|
12452
12455
|
let mode;
|
|
12456
|
+
let resumeOptions;
|
|
12453
12457
|
if (task.status === "pending") {
|
|
12454
12458
|
prepared = await this.prepareStart(input, signal);
|
|
12455
12459
|
mode = "start";
|
|
12456
12460
|
} else if (task.status === "interrupted") {
|
|
12457
12461
|
prepared = await this.prepareResume(input, signal);
|
|
12458
12462
|
mode = "resume";
|
|
12463
|
+
resumeOptions = options;
|
|
12459
12464
|
} else if (task.status === "failed" || task.status === "completed" || task.status === "cancelled") {
|
|
12460
12465
|
prepared = await this.prepareRestartable(task, actor3, signal);
|
|
12461
12466
|
mode = "resume";
|
|
@@ -12463,7 +12468,7 @@ var ProjectTaskExecutionService = class {
|
|
|
12463
12468
|
throw new ProjectTaskExecutionError("PROJECT_TASK_NOT_READY", `Project task is '${task.status}'`);
|
|
12464
12469
|
}
|
|
12465
12470
|
if (prepared.kind === "aborted") return { task: prepared.outcome.task, queued: false };
|
|
12466
|
-
return this.enqueueDetached(prepared.task, prepared.thread, mode, prepared.rosterExempt);
|
|
12471
|
+
return this.enqueueDetached(prepared.task, prepared.thread, mode, prepared.rosterExempt, resumeOptions);
|
|
12467
12472
|
}
|
|
12468
12473
|
/** Recovers one exact pending or processing queue row without dispatching a duplicate input. */
|
|
12469
12474
|
async recover(input, signal) {
|
|
@@ -12708,10 +12713,10 @@ var ProjectTaskExecutionService = class {
|
|
|
12708
12713
|
}
|
|
12709
12714
|
return current;
|
|
12710
12715
|
}
|
|
12711
|
-
async dispatchRun(task, thread, mode, rosterExempt, signal) {
|
|
12716
|
+
async dispatchRun(task, thread, mode, rosterExempt, signal, options) {
|
|
12712
12717
|
const messageId = (this.options.idFactory ?? randomUUID13)();
|
|
12713
12718
|
if (signal?.aborted) return this.compensateCancellation(task, thread, messageId, false);
|
|
12714
|
-
const armed = await this.armAndEnqueue(task, thread, mode, messageId, rosterExempt, signal);
|
|
12719
|
+
const armed = await this.armAndEnqueue(task, thread, mode, messageId, rosterExempt, signal, options);
|
|
12715
12720
|
if (armed.cancelled) return this.cancelSettlement(armed.settlement, task, thread, messageId, false);
|
|
12716
12721
|
if (signal?.aborted) return this.cancelSettlement(armed.settlement, task, thread, messageId, armed.queued);
|
|
12717
12722
|
if (!armed.queued) {
|
|
@@ -12726,7 +12731,7 @@ var ProjectTaskExecutionService = class {
|
|
|
12726
12731
|
* enqueue yields `queued: false` with a stable reason; the caller decides
|
|
12727
12732
|
* whether to converge only (awaited path) or converge and throw (detached).
|
|
12728
12733
|
*/
|
|
12729
|
-
async armAndEnqueue(task, thread, mode, messageId, rosterExempt, signal) {
|
|
12734
|
+
async armAndEnqueue(task, thread, mode, messageId, rosterExempt, signal, options) {
|
|
12730
12735
|
const settlement = this.armSettlement(task, thread, messageId);
|
|
12731
12736
|
if (signal?.aborted) return { settlement, queued: false, error: "", cancelled: true };
|
|
12732
12737
|
try {
|
|
@@ -12736,7 +12741,10 @@ var ProjectTaskExecutionService = class {
|
|
|
12736
12741
|
project_id: task.projectId,
|
|
12737
12742
|
assistant_id: task.ownerId,
|
|
12738
12743
|
thread_id: thread.id
|
|
12739
|
-
}, {
|
|
12744
|
+
}, {
|
|
12745
|
+
input: { id: messageId, message: buildTaskPrompt(task, mode) },
|
|
12746
|
+
...mode === "resume" && options?.command ? { command: options.command } : {}
|
|
12747
|
+
}, {
|
|
12740
12748
|
executionMode: "followup",
|
|
12741
12749
|
trustedRunContext: { projectTask: buildTrustedTaskContext(task, thread, messageId, rosterExempt) }
|
|
12742
12750
|
});
|
|
@@ -12762,9 +12770,9 @@ var ProjectTaskExecutionService = class {
|
|
|
12762
12770
|
* task is converged exactly like the awaited path before throwing, so no
|
|
12763
12771
|
* phantom in-progress run is left behind.
|
|
12764
12772
|
*/
|
|
12765
|
-
async enqueueDetached(task, thread, mode, rosterExempt) {
|
|
12773
|
+
async enqueueDetached(task, thread, mode, rosterExempt, options) {
|
|
12766
12774
|
const messageId = (this.options.idFactory ?? randomUUID13)();
|
|
12767
|
-
const armed = await this.armAndEnqueue(task, thread, mode, messageId, rosterExempt);
|
|
12775
|
+
const armed = await this.armAndEnqueue(task, thread, mode, messageId, rosterExempt, void 0, options);
|
|
12768
12776
|
void armed.settlement.promise.catch(() => void 0);
|
|
12769
12777
|
if (!armed.queued) {
|
|
12770
12778
|
await this.claimDispatchFailure(armed.settlement, task, thread, messageId, armed.error);
|
|
@@ -12895,12 +12903,14 @@ var ProjectTaskExecutionService = class {
|
|
|
12895
12903
|
async settleInterruptedEvent(task, thread, messageId, state) {
|
|
12896
12904
|
const current = await this.withLifecycleTimeout(this.reloadTask(task), void 0);
|
|
12897
12905
|
if (current?.status === "interrupted" && this.matchesExecution(current, task, thread)) {
|
|
12906
|
+
this.emitInterrupted(current, thread, messageId, state);
|
|
12898
12907
|
return { kind: "interrupted", task: current, thread, messageId };
|
|
12899
12908
|
}
|
|
12900
12909
|
const clarify = readClarifyInterrupt(state ?? await this.readInterruptedThreadState(task, thread));
|
|
12901
12910
|
if (clarify !== void 0) {
|
|
12902
12911
|
const interrupted = await this.interruptForClarify(current ?? task, thread, clarify);
|
|
12903
12912
|
if (interrupted?.status === "interrupted" && this.matchesExecution(interrupted, task, thread)) {
|
|
12913
|
+
this.emitInterrupted(interrupted, thread, messageId, state);
|
|
12904
12914
|
return { kind: "interrupted", task: interrupted, thread, messageId };
|
|
12905
12915
|
}
|
|
12906
12916
|
}
|
|
@@ -12912,6 +12922,22 @@ var ProjectTaskExecutionService = class {
|
|
|
12912
12922
|
"interruption_not_durable"
|
|
12913
12923
|
);
|
|
12914
12924
|
}
|
|
12925
|
+
/**
|
|
12926
|
+
* Fire-and-forget best-effort projection of a durable interruption.
|
|
12927
|
+
*
|
|
12928
|
+
* @remarks Never awaited and never allowed to affect settlement. The state is
|
|
12929
|
+
* resolved lazily so a missing/undefined event state only triggers a thread
|
|
12930
|
+
* read when the hook is actually wired.
|
|
12931
|
+
*/
|
|
12932
|
+
emitInterrupted(task, thread, messageId, state) {
|
|
12933
|
+
const hook = this.deps.onTaskInterrupted;
|
|
12934
|
+
if (!hook) return;
|
|
12935
|
+
void Promise.resolve().then(async () => {
|
|
12936
|
+
const resolved = state ?? await this.readInterruptedThreadState(task, thread);
|
|
12937
|
+
await hook({ task, thread, messageId, state: resolved });
|
|
12938
|
+
}).catch(() => {
|
|
12939
|
+
});
|
|
12940
|
+
}
|
|
12915
12941
|
/** Reads the paused thread snapshot when no interrupt event payload is available (recovery). */
|
|
12916
12942
|
async readInterruptedThreadState(task, thread) {
|
|
12917
12943
|
try {
|
|
@@ -17414,7 +17440,13 @@ var ProjectRosterService = class {
|
|
|
17414
17440
|
}
|
|
17415
17441
|
const agent = (await this.deps.agents.list(actor3.tenantId, actor3.userId)).find((item) => item.assistantId === assistantId);
|
|
17416
17442
|
if (!agent || agent.ownerUserId !== void 0) throw new ProjectRosterServiceError("ASSISTANT_NOT_FOUND", 404, "Agent not found");
|
|
17417
|
-
const room = await this.deps.
|
|
17443
|
+
const room = await this.deps.roomStore.ensureMainRoom({
|
|
17444
|
+
id: randomUUID18(),
|
|
17445
|
+
tenantId: actor3.tenantId,
|
|
17446
|
+
workspaceId: project.workspaceId,
|
|
17447
|
+
projectId: actor3.projectId,
|
|
17448
|
+
name: project.name
|
|
17449
|
+
});
|
|
17418
17450
|
const taken = new Set((await this.deps.membershipStore.list(actor3.tenantId, actor3.projectId)).map((item) => item.mentionName));
|
|
17419
17451
|
const mentionName = uniqueMentionName(agent.name, taken);
|
|
17420
17452
|
let ids = await this.findSafePresence(actor3, room, assistantId);
|
|
@@ -18129,6 +18161,13 @@ import { toProjectRoomPublicMessage } from "@axiom-lattice/protocols";
|
|
|
18129
18161
|
|
|
18130
18162
|
// src/services/collaboration/RoomInterruptService.ts
|
|
18131
18163
|
import { randomUUID as randomUUID20 } from "crypto";
|
|
18164
|
+
var RESUMABLE_TASK_INTERRUPT_CODES = /* @__PURE__ */ new Set([
|
|
18165
|
+
"PROJECT_TASK_NOT_RESUMABLE",
|
|
18166
|
+
"PROJECT_TASK_NOT_READY",
|
|
18167
|
+
"PROJECT_TASK_START_CONFLICT",
|
|
18168
|
+
"TASK_STATUS_CONFLICT",
|
|
18169
|
+
"REVIEW_APPROVAL_REQUIRED"
|
|
18170
|
+
]);
|
|
18132
18171
|
var RoomInterruptServiceError = class extends Error {
|
|
18133
18172
|
/** Creates a stable room interrupt error. */
|
|
18134
18173
|
constructor(code, statusCode, message) {
|
|
@@ -18151,7 +18190,16 @@ var RoomInterruptService = class {
|
|
|
18151
18190
|
/** Resolves a pending interrupt with an explicit resume command. */
|
|
18152
18191
|
async resume(input, command) {
|
|
18153
18192
|
await this.deps.requireAccess({ tenantId: input.tenantId, userId: input.userId, projectId: input.projectId });
|
|
18154
|
-
|
|
18193
|
+
if (input.ref.kind === "task") {
|
|
18194
|
+
await this.resumeTask(input, command);
|
|
18195
|
+
return;
|
|
18196
|
+
}
|
|
18197
|
+
await this.resumePresence(input, command);
|
|
18198
|
+
}
|
|
18199
|
+
/** Resolves a bot presence-thread interrupt by dispatching a follow-up resume. */
|
|
18200
|
+
async resumePresence(input, command) {
|
|
18201
|
+
const membershipId = input.ref.kind === "presence" ? input.ref.membershipId : "";
|
|
18202
|
+
const membership = await this.deps.resolveMembership({ tenantId: input.tenantId, projectId: input.projectId, membershipId });
|
|
18155
18203
|
if (!membership || membership.status !== "active" || !membership.roomThreadId || membership.projectId !== input.projectId) {
|
|
18156
18204
|
throw new RoomInterruptServiceError("ROOM_INTERRUPT_TARGET_UNAVAILABLE", 404, "Room interrupt target is unavailable");
|
|
18157
18205
|
}
|
|
@@ -18204,6 +18252,47 @@ var RoomInterruptService = class {
|
|
|
18204
18252
|
}
|
|
18205
18253
|
);
|
|
18206
18254
|
}
|
|
18255
|
+
/** Resolves a Project Task interrupt by re-reading the task thread and resuming its durable run. */
|
|
18256
|
+
async resumeTask(input, command) {
|
|
18257
|
+
if (!this.deps.tasks || !this.deps.execution) throw new RoomInterruptServiceError("ROOM_INTERRUPT_TARGET_UNAVAILABLE", 404, "Project task runtime is unavailable");
|
|
18258
|
+
const taskId = input.ref.kind === "task" ? input.ref.taskId : "";
|
|
18259
|
+
const task = await this.deps.tasks.getById(input.tenantId, taskId);
|
|
18260
|
+
if (!task || task.tenantId !== input.tenantId || task.projectId !== input.projectId || task.status !== "interrupted" || typeof task.context?.thread_id !== "string") {
|
|
18261
|
+
throw new RoomInterruptServiceError("ROOM_INTERRUPT_NOT_PENDING", 409, "Room interrupt is no longer pending");
|
|
18262
|
+
}
|
|
18263
|
+
const status = await this.deps.getThreadStatus({
|
|
18264
|
+
tenantId: task.tenantId,
|
|
18265
|
+
assistantId: task.ownerId,
|
|
18266
|
+
threadId: task.context.thread_id,
|
|
18267
|
+
workspaceId: task.workspaceId ?? "",
|
|
18268
|
+
projectId: task.projectId ?? ""
|
|
18269
|
+
});
|
|
18270
|
+
if (String(status) !== "interrupted") throw new RoomInterruptServiceError("ROOM_INTERRUPT_NOT_PENDING", 409, "Room interrupt is no longer pending");
|
|
18271
|
+
if (this.deps.getThreadState) {
|
|
18272
|
+
const state = await this.deps.getThreadState({
|
|
18273
|
+
tenantId: task.tenantId,
|
|
18274
|
+
assistantId: task.ownerId,
|
|
18275
|
+
threadId: task.context.thread_id,
|
|
18276
|
+
workspaceId: task.workspaceId ?? "",
|
|
18277
|
+
projectId: task.projectId ?? ""
|
|
18278
|
+
});
|
|
18279
|
+
if (readClarifyInterrupt(state) === void 0) {
|
|
18280
|
+
throw new RoomInterruptServiceError("ROOM_INTERRUPT_NOT_PENDING", 409, "Room interrupt is no longer pending");
|
|
18281
|
+
}
|
|
18282
|
+
}
|
|
18283
|
+
try {
|
|
18284
|
+
await this.deps.execution.dispatchDetached(
|
|
18285
|
+
{ tenantId: task.tenantId, taskId: task.id, actor: `user:${input.userId}` },
|
|
18286
|
+
void 0,
|
|
18287
|
+
{ command, expectedStatus: "interrupted" }
|
|
18288
|
+
);
|
|
18289
|
+
} catch (error) {
|
|
18290
|
+
if (error instanceof ProjectTaskExecutionError && RESUMABLE_TASK_INTERRUPT_CODES.has(error.code)) {
|
|
18291
|
+
throw new RoomInterruptServiceError("ROOM_INTERRUPT_NOT_PENDING", 409, error.message);
|
|
18292
|
+
}
|
|
18293
|
+
throw error;
|
|
18294
|
+
}
|
|
18295
|
+
}
|
|
18207
18296
|
};
|
|
18208
18297
|
|
|
18209
18298
|
// src/schemas/project-room.ts
|
|
@@ -18247,14 +18336,18 @@ var updateProjectBotSchema = z10.object({
|
|
|
18247
18336
|
expectedUpdatedAt: isoDate
|
|
18248
18337
|
}).strict().refine((value) => value.role !== void 0 || value.title !== void 0 || value.responsibility !== void 0 || value.mentionName !== void 0, { message: "At least one mutable field is required" });
|
|
18249
18338
|
var resumeInterruptSchema = z10.object({
|
|
18250
|
-
|
|
18339
|
+
ref: z10.discriminatedUnion("kind", [
|
|
18340
|
+
z10.object({ kind: z10.literal("presence"), membershipId: id2 }).strict(),
|
|
18341
|
+
z10.object({ kind: z10.literal("task"), taskId: id2 }).strict()
|
|
18342
|
+
]).optional(),
|
|
18343
|
+
membershipId: id2.optional(),
|
|
18251
18344
|
answers: z10.array(z10.object({
|
|
18252
18345
|
questionIndex: z10.number().int().nonnegative(),
|
|
18253
18346
|
otherText: z10.string().optional(),
|
|
18254
18347
|
selectedOptions: z10.array(z10.string()).optional(),
|
|
18255
18348
|
filePath: z10.string().optional()
|
|
18256
18349
|
}).strict()).optional()
|
|
18257
|
-
}).strict();
|
|
18350
|
+
}).strict().refine((v) => v.ref !== void 0 || v.membershipId !== void 0, { message: "ref or membershipId is required" });
|
|
18258
18351
|
|
|
18259
18352
|
// src/routes/project-rooms.ts
|
|
18260
18353
|
var ProjectRoomAuthError = class extends Error {
|
|
@@ -18305,8 +18398,9 @@ function registerProjectRoomRoutes(app2, deps) {
|
|
|
18305
18398
|
const params = projectRoomParamsSchema.parse(request.params);
|
|
18306
18399
|
const requestActor = actor(request, params.projectId);
|
|
18307
18400
|
const body = resumeInterruptSchema.parse(request.body ?? {});
|
|
18401
|
+
const ref = body.ref ?? { kind: "presence", membershipId: body.membershipId };
|
|
18308
18402
|
await deps.interruptService.resume(
|
|
18309
|
-
{ tenantId: requestActor.tenantId, projectId: requestActor.projectId, userId: requestActor.userId,
|
|
18403
|
+
{ tenantId: requestActor.tenantId, projectId: requestActor.projectId, userId: requestActor.userId, ref },
|
|
18310
18404
|
{ resume: { data: { answers: body.answers ?? [] } } }
|
|
18311
18405
|
);
|
|
18312
18406
|
return { data: { resolved: true } };
|
|
@@ -19787,6 +19881,54 @@ var ProjectTaskExecutionMutex = class {
|
|
|
19787
19881
|
}
|
|
19788
19882
|
};
|
|
19789
19883
|
|
|
19884
|
+
// src/services/collaboration/TaskInterruptCardProjector.ts
|
|
19885
|
+
function clarifyFence(data) {
|
|
19886
|
+
return ["```clarify", JSON.stringify(data), "```"].join("\n");
|
|
19887
|
+
}
|
|
19888
|
+
var TaskInterruptCardProjector = class {
|
|
19889
|
+
constructor(deps) {
|
|
19890
|
+
this.deps = deps;
|
|
19891
|
+
}
|
|
19892
|
+
/** Projects the interruption as a correlated room card when it is a clarify. */
|
|
19893
|
+
async project(input) {
|
|
19894
|
+
const clarify = readClarifyInterrupt(input.state);
|
|
19895
|
+
if (!clarify) return;
|
|
19896
|
+
const { task, messageId } = input;
|
|
19897
|
+
const workspaceId = task.workspaceId;
|
|
19898
|
+
const projectId = task.projectId;
|
|
19899
|
+
if (!workspaceId || !projectId) return;
|
|
19900
|
+
const adapter = this.deps.adapter;
|
|
19901
|
+
const sendInterrupt = adapter.sendInterrupt;
|
|
19902
|
+
if (!sendInterrupt) {
|
|
19903
|
+
this.safeWarn("project-room:task-interrupt-card-unsupported", { taskId: task.id });
|
|
19904
|
+
return;
|
|
19905
|
+
}
|
|
19906
|
+
try {
|
|
19907
|
+
const room = snapshotProjectRoom(await this.deps.rooms.getMainRoom(task.tenantId, projectId));
|
|
19908
|
+
if (!room || !room.id || room.tenantId !== task.tenantId || room.workspaceId !== workspaceId || room.projectId !== projectId) return;
|
|
19909
|
+
const membership = snapshotBotMembership(await this.deps.bots.findByAssistant(task.tenantId, projectId, task.ownerId));
|
|
19910
|
+
if (!membership || membership.tenantId !== task.tenantId || membership.workspaceId !== workspaceId || membership.projectId !== projectId || membership.roomId !== room.id || membership.assistantId !== task.ownerId || membership.status !== "active") return;
|
|
19911
|
+
const installation = await this.deps.installation.ensure(task.tenantId);
|
|
19912
|
+
const text = clarifyFence({ taskId: task.id, questions: clarify.questions });
|
|
19913
|
+
await sendInterrupt.call(
|
|
19914
|
+
adapter,
|
|
19915
|
+
{ adapterChannel: "room", channelInstallationId: installation.id, rawTarget: { targetMembershipId: membership.id } },
|
|
19916
|
+
{ text, metadata: { correlationKey: `task:${task.id}:${messageId}` } },
|
|
19917
|
+
installation
|
|
19918
|
+
);
|
|
19919
|
+
} catch (error) {
|
|
19920
|
+
this.safeWarn("project-room:task-interrupt-card-failed", { taskId: task.id, error: error instanceof Error ? error.message : String(error) });
|
|
19921
|
+
}
|
|
19922
|
+
}
|
|
19923
|
+
/** Logs without ever letting a failing logger reject `project()`. */
|
|
19924
|
+
safeWarn(message, context) {
|
|
19925
|
+
try {
|
|
19926
|
+
this.deps.log.warn(message, context);
|
|
19927
|
+
} catch {
|
|
19928
|
+
}
|
|
19929
|
+
}
|
|
19930
|
+
};
|
|
19931
|
+
|
|
19790
19932
|
// src/services/collaboration/ProjectTaskObserver.ts
|
|
19791
19933
|
import { createHash as createHash7 } from "crypto";
|
|
19792
19934
|
import {
|
|
@@ -22707,25 +22849,25 @@ async function transferGovernedDispatchOwner(task, options, deps) {
|
|
|
22707
22849
|
function broadcastModelProviderChanged(tenantId, providerId2) {
|
|
22708
22850
|
if (!tenantId) return;
|
|
22709
22851
|
try {
|
|
22710
|
-
const outbox =
|
|
22852
|
+
const outbox = getStoreLattice18("default", "outbox").store;
|
|
22711
22853
|
void publishModelProviderChanged(outbox, getReplicaId6(), tenantId, providerId2);
|
|
22712
22854
|
} catch {
|
|
22713
22855
|
}
|
|
22714
22856
|
}
|
|
22715
22857
|
var registerLatticeRoutes = (app2, channelDeps, options = {}) => {
|
|
22716
|
-
const webAppStore =
|
|
22717
|
-
const assistantStore =
|
|
22718
|
-
const projectStore =
|
|
22719
|
-
const projectMembershipStore =
|
|
22720
|
-
const userTenantLinkStore =
|
|
22721
|
-
const projectRoomStore =
|
|
22722
|
-
const projectBotMembershipStore =
|
|
22723
|
-
const projectRoomMessageStore =
|
|
22724
|
-
const projectRoomReadStateStore =
|
|
22725
|
-
const userPushSubscriptionStore =
|
|
22726
|
-
const threadStore =
|
|
22727
|
-
const taskStore =
|
|
22728
|
-
const taskWorkItemStore =
|
|
22858
|
+
const webAppStore = getStoreLattice18("default", "agentWebApp").store;
|
|
22859
|
+
const assistantStore = getStoreLattice18("default", "assistant").store;
|
|
22860
|
+
const projectStore = getStoreLattice18("default", "project").store;
|
|
22861
|
+
const projectMembershipStore = getStoreLattice18("default", "projectMembership").store;
|
|
22862
|
+
const userTenantLinkStore = getStoreLattice18("default", "userTenantLink").store;
|
|
22863
|
+
const projectRoomStore = getStoreLattice18("default", "projectRoom").store;
|
|
22864
|
+
const projectBotMembershipStore = getStoreLattice18("default", "projectBotMembership").store;
|
|
22865
|
+
const projectRoomMessageStore = getStoreLattice18("default", "projectRoomMessage").store;
|
|
22866
|
+
const projectRoomReadStateStore = getStoreLattice18("default", "projectRoomReadState").store;
|
|
22867
|
+
const userPushSubscriptionStore = getStoreLattice18("default", "userPushSubscription").store;
|
|
22868
|
+
const threadStore = getStoreLattice18("default", "thread").store;
|
|
22869
|
+
const taskStore = getStoreLattice18("default", "task").store;
|
|
22870
|
+
const taskWorkItemStore = getStoreLattice18("default", "taskWorkItem").store;
|
|
22729
22871
|
const projectTaskEnabled = options.projectTaskEnabled ?? process.env.AXIOM_PROJECT_TASK_EXECUTION_ENABLED !== "false";
|
|
22730
22872
|
const accessService = new ProjectAccessService({ projectStore, membershipStore: projectMembershipStore, userTenantLinkStore });
|
|
22731
22873
|
const realtimeMode = resolveProjectRoomRealtimeMode();
|
|
@@ -22791,7 +22933,7 @@ var registerLatticeRoutes = (app2, channelDeps, options = {}) => {
|
|
|
22791
22933
|
updateAssistant: assistantStore.updateAssistant.bind(assistantStore)
|
|
22792
22934
|
});
|
|
22793
22935
|
const resolveCoordinatorMentionName = async (tenantId) => {
|
|
22794
|
-
const tenant2 = await
|
|
22936
|
+
const tenant2 = await getStoreLattice18("default", "tenant").store.getTenantById(tenantId);
|
|
22795
22937
|
const value = tenant2?.metadata?.coordinatorMentionName;
|
|
22796
22938
|
return typeof value === "string" && value.length > 0 ? value : void 0;
|
|
22797
22939
|
};
|
|
@@ -22809,31 +22951,11 @@ var registerLatticeRoutes = (app2, channelDeps, options = {}) => {
|
|
|
22809
22951
|
ensureCoordinator: (scope) => coordinatorEnsurer.ensure(scope),
|
|
22810
22952
|
log: realtimeLog
|
|
22811
22953
|
});
|
|
22812
|
-
const roomInterruptService = new RoomInterruptService({
|
|
22813
|
-
requireAccess: async ({ tenantId, userId, projectId }) => {
|
|
22814
|
-
await accessService.requireProjectAccess({ tenantId, userId, projectId, capability: "send" });
|
|
22815
|
-
},
|
|
22816
|
-
resolveMembership: async ({ tenantId, projectId, membershipId }) => {
|
|
22817
|
-
const membership = await projectBotMembershipStore.findById(tenantId, membershipId);
|
|
22818
|
-
return membership !== null && membership.projectId === projectId ? membership : null;
|
|
22819
|
-
},
|
|
22820
|
-
getThreadStatus: async ({ tenantId, assistantId, threadId, workspaceId, projectId }) => {
|
|
22821
|
-
const agent = agentInstanceManager6.getAgent({
|
|
22822
|
-
tenant_id: tenantId,
|
|
22823
|
-
assistant_id: assistantId,
|
|
22824
|
-
thread_id: threadId,
|
|
22825
|
-
workspace_id: workspaceId,
|
|
22826
|
-
project_id: projectId
|
|
22827
|
-
});
|
|
22828
|
-
return String(await agent.getRunStatus());
|
|
22829
|
-
},
|
|
22830
|
-
dispatcher: createTrustedAgentMessageDispatcher((scope) => agentInstanceManager6.getAgent(scope)),
|
|
22831
|
-
projects: projectStore
|
|
22832
|
-
});
|
|
22833
22954
|
const membershipService = new ProjectMembershipService({ membershipStore: projectMembershipStore, userTenantLinkStore, accessService, projectMutationMutex: projectMutationMutex2, roomStore: projectRoomStore, realtime, onRealtimeFailure: realtime && channelDeps?.warn ? ({ code, membershipId }) => channelDeps.warn?.("project-room:membership-realtime-failed", { code, membershipId }) : void 0 });
|
|
22834
22955
|
const rosterService = new ProjectRosterService({
|
|
22835
22956
|
accessService,
|
|
22836
22957
|
roomService,
|
|
22958
|
+
roomStore: projectRoomStore,
|
|
22837
22959
|
membershipStore: projectBotMembershipStore,
|
|
22838
22960
|
projects: projectStore,
|
|
22839
22961
|
agents: { list: async (tenantId, userId) => (await collectTenantAssistants(tenantId, userId)).map((assistant) => ({ assistantId: assistant.id, name: assistant.name, ...assistant.ownerUserId === void 0 ? {} : { ownerUserId: assistant.ownerUserId } })) },
|
|
@@ -22883,6 +23005,14 @@ var registerLatticeRoutes = (app2, channelDeps, options = {}) => {
|
|
|
22883
23005
|
messageId: event.messageId
|
|
22884
23006
|
}) : void 0
|
|
22885
23007
|
});
|
|
23008
|
+
const roomAdapter = channelDeps?.adapterRegistry.get("room");
|
|
23009
|
+
const taskInterruptProjector = installation && roomAdapter ? new TaskInterruptCardProjector({
|
|
23010
|
+
rooms: projectRoomStore,
|
|
23011
|
+
bots: projectBotMembershipStore,
|
|
23012
|
+
installation,
|
|
23013
|
+
adapter: roomAdapter,
|
|
23014
|
+
log: realtimeLog
|
|
23015
|
+
}) : void 0;
|
|
22886
23016
|
const projectTaskRuntime = projectTaskEnabled ? tryCreateProjectTaskRuntime({
|
|
22887
23017
|
taskStore,
|
|
22888
23018
|
taskWorkItemStore,
|
|
@@ -22894,7 +23024,10 @@ var registerLatticeRoutes = (app2, channelDeps, options = {}) => {
|
|
|
22894
23024
|
realtime,
|
|
22895
23025
|
log: options.projectTaskLog,
|
|
22896
23026
|
ensurePublicOwner: (scope) => rosterService.ensurePublicProjectAgent(scope),
|
|
22897
|
-
...coordinatorWakeNotifier === void 0 ? {} : { coordinatorWake: coordinatorWakeNotifier }
|
|
23027
|
+
...coordinatorWakeNotifier === void 0 ? {} : { coordinatorWake: coordinatorWakeNotifier },
|
|
23028
|
+
...taskInterruptProjector === void 0 ? {} : {
|
|
23029
|
+
onTaskInterrupted: (input) => taskInterruptProjector.project(input)
|
|
23030
|
+
}
|
|
22898
23031
|
}) : { reason: void 0 };
|
|
22899
23032
|
const projectTaskComposition = "composition" in projectTaskRuntime ? projectTaskRuntime.composition : void 0;
|
|
22900
23033
|
const projectTaskUnavailableReason = "reason" in projectTaskRuntime ? projectTaskRuntime.reason : void 0;
|
|
@@ -22924,6 +23057,39 @@ var registerLatticeRoutes = (app2, channelDeps, options = {}) => {
|
|
|
22924
23057
|
}),
|
|
22925
23058
|
reassign: unsupportedHumanReassign
|
|
22926
23059
|
});
|
|
23060
|
+
const roomInterruptService = new RoomInterruptService({
|
|
23061
|
+
requireAccess: async ({ tenantId, userId, projectId }) => {
|
|
23062
|
+
await accessService.requireProjectAccess({ tenantId, userId, projectId, capability: "send" });
|
|
23063
|
+
},
|
|
23064
|
+
resolveMembership: async ({ tenantId, projectId, membershipId }) => {
|
|
23065
|
+
const membership = await projectBotMembershipStore.findById(tenantId, membershipId);
|
|
23066
|
+
return membership !== null && membership.projectId === projectId ? membership : null;
|
|
23067
|
+
},
|
|
23068
|
+
getThreadStatus: async ({ tenantId, assistantId, threadId, workspaceId, projectId }) => {
|
|
23069
|
+
const agent = agentInstanceManager6.getAgent({
|
|
23070
|
+
tenant_id: tenantId,
|
|
23071
|
+
assistant_id: assistantId,
|
|
23072
|
+
thread_id: threadId,
|
|
23073
|
+
workspace_id: workspaceId,
|
|
23074
|
+
project_id: projectId
|
|
23075
|
+
});
|
|
23076
|
+
return String(await agent.getRunStatus());
|
|
23077
|
+
},
|
|
23078
|
+
getThreadState: async ({ tenantId, assistantId, threadId, workspaceId, projectId }) => {
|
|
23079
|
+
const agent = agentInstanceManager6.getAgent({
|
|
23080
|
+
tenant_id: tenantId,
|
|
23081
|
+
assistant_id: assistantId,
|
|
23082
|
+
thread_id: threadId,
|
|
23083
|
+
workspace_id: workspaceId,
|
|
23084
|
+
project_id: projectId
|
|
23085
|
+
});
|
|
23086
|
+
return agent.getCurrentState();
|
|
23087
|
+
},
|
|
23088
|
+
dispatcher: createTrustedAgentMessageDispatcher((scope) => agentInstanceManager6.getAgent(scope)),
|
|
23089
|
+
projects: projectStore,
|
|
23090
|
+
tasks: taskStore,
|
|
23091
|
+
execution: projectTaskComposition?.lease.runtime.execution
|
|
23092
|
+
});
|
|
22927
23093
|
const publicRoomService = new WorkspacePublicRoomService({
|
|
22928
23094
|
getProjectById: projectStore.getProjectById.bind(projectStore),
|
|
22929
23095
|
createProject: projectStore.createProject.bind(projectStore),
|
|
@@ -22954,7 +23120,7 @@ var registerLatticeRoutes = (app2, channelDeps, options = {}) => {
|
|
|
22954
23120
|
readStateService,
|
|
22955
23121
|
interruptService: roomInterruptService,
|
|
22956
23122
|
userDirectory: {
|
|
22957
|
-
getUserById: (id3) =>
|
|
23123
|
+
getUserById: (id3) => getStoreLattice18("default", "user").store.getUserById(id3).then((u) => u ? { name: u.name } : null)
|
|
22958
23124
|
}
|
|
22959
23125
|
});
|
|
22960
23126
|
registerProjectRosterRoutes(app2, { service: rosterService });
|
|
@@ -22965,7 +23131,7 @@ var registerLatticeRoutes = (app2, channelDeps, options = {}) => {
|
|
|
22965
23131
|
createProject: projectStore.createProject.bind(projectStore)
|
|
22966
23132
|
},
|
|
22967
23133
|
workspaceStore: {
|
|
22968
|
-
getWorkspaceById: (tenantId, id3) =>
|
|
23134
|
+
getWorkspaceById: (tenantId, id3) => getStoreLattice18("default", "workspace").store.getWorkspaceById(tenantId, id3)
|
|
22969
23135
|
},
|
|
22970
23136
|
membershipStore: {
|
|
22971
23137
|
list: projectMembershipStore.list.bind(projectMembershipStore),
|
|
@@ -22988,7 +23154,7 @@ var registerLatticeRoutes = (app2, channelDeps, options = {}) => {
|
|
|
22988
23154
|
getUsersByTenant: userTenantLinkStore.getUsersByTenant.bind(userTenantLinkStore)
|
|
22989
23155
|
},
|
|
22990
23156
|
userStore: {
|
|
22991
|
-
getUserById: (id3) =>
|
|
23157
|
+
getUserById: (id3) => getStoreLattice18("default", "user").store.getUserById(id3).then((u) => u ? { id: u.id, name: u.name, email: u.email } : null)
|
|
22992
23158
|
},
|
|
22993
23159
|
assistantStore: {
|
|
22994
23160
|
getAssistantById: assistantStore.getAssistantById.bind(assistantStore),
|
|
@@ -23010,17 +23176,17 @@ var registerLatticeRoutes = (app2, channelDeps, options = {}) => {
|
|
|
23010
23176
|
}
|
|
23011
23177
|
});
|
|
23012
23178
|
registerCapabilityBundleRoutes(app2, new CapabilityBundleController({
|
|
23013
|
-
bundleStore:
|
|
23179
|
+
bundleStore: getStoreLattice18("default", "capabilityBundle").store,
|
|
23014
23180
|
projectStore
|
|
23015
23181
|
}, { authRequired: process.env.AUTH_REQUIRED === "true" }));
|
|
23016
23182
|
const modelProviderController = new ModelProviderController({
|
|
23017
|
-
providerStore:
|
|
23183
|
+
providerStore: getStoreLattice18("default", "modelProvider").store,
|
|
23018
23184
|
userTenantLinkStore,
|
|
23019
23185
|
registry: {
|
|
23020
|
-
register: (tenantId, modelKey2, config) =>
|
|
23021
|
-
has: (tenantId, modelKey2) =>
|
|
23022
|
-
remove: (tenantId, modelKey2) =>
|
|
23023
|
-
listRegistered: (tenantId) =>
|
|
23186
|
+
register: (tenantId, modelKey2, config) => modelLatticeManager4.registerLatticeWithTenant(tenantId, modelKey2, config),
|
|
23187
|
+
has: (tenantId, modelKey2) => modelLatticeManager4.hasLatticeWithTenant(tenantId, modelKey2),
|
|
23188
|
+
remove: (tenantId, modelKey2) => modelLatticeManager4.removeLatticeWithTenant(tenantId, modelKey2),
|
|
23189
|
+
listRegistered: (tenantId) => modelLatticeManager4.getLatticeKeysByTenant(tenantId)
|
|
23024
23190
|
},
|
|
23025
23191
|
onChanged: (tenantId, providerId2) => broadcastModelProviderChanged(tenantId, providerId2)
|
|
23026
23192
|
}, { authRequired: process.env.AUTH_REQUIRED === "true" });
|
|
@@ -23031,7 +23197,7 @@ var registerLatticeRoutes = (app2, channelDeps, options = {}) => {
|
|
|
23031
23197
|
webAppStore,
|
|
23032
23198
|
assistantStore,
|
|
23033
23199
|
projectStore,
|
|
23034
|
-
modelRegistry: { has: (key) =>
|
|
23200
|
+
modelRegistry: { has: (key) => modelLatticeManager4.hasLattice(key) },
|
|
23035
23201
|
configuredAgentResolver: createConfiguredAgentResolver({
|
|
23036
23202
|
hydrate: (tenantId) => agentLatticeManager4.initializeStoredAssistantsForTenant(tenantId),
|
|
23037
23203
|
has: (tenantId, assistantId) => agentLatticeManager4.hasAgentLatticeWithTenant(tenantId, assistantId)
|
|
@@ -23076,7 +23242,7 @@ var registerLatticeRoutes = (app2, channelDeps, options = {}) => {
|
|
|
23076
23242
|
}),
|
|
23077
23243
|
service: new AgentWebAppRuntimeService({
|
|
23078
23244
|
webAppStore,
|
|
23079
|
-
threadStore:
|
|
23245
|
+
threadStore: getStoreLattice18("default", "thread").store,
|
|
23080
23246
|
projectStore,
|
|
23081
23247
|
assistantResolver: {
|
|
23082
23248
|
resolve: async (tenantId, assistantId) => {
|
|
@@ -23088,7 +23254,7 @@ var registerLatticeRoutes = (app2, channelDeps, options = {}) => {
|
|
|
23088
23254
|
}
|
|
23089
23255
|
},
|
|
23090
23256
|
modelRegistry: {
|
|
23091
|
-
has: (key) =>
|
|
23257
|
+
has: (key) => modelLatticeManager4.hasLattice(key),
|
|
23092
23258
|
label: (key) => key
|
|
23093
23259
|
},
|
|
23094
23260
|
messageReader: {
|
|
@@ -23502,9 +23668,9 @@ function tryCreateProjectTaskRuntime(input) {
|
|
|
23502
23668
|
let stores;
|
|
23503
23669
|
try {
|
|
23504
23670
|
stores = {
|
|
23505
|
-
tenants:
|
|
23506
|
-
workspaces:
|
|
23507
|
-
queue:
|
|
23671
|
+
tenants: getStoreLattice18("default", "tenant").store,
|
|
23672
|
+
workspaces: getStoreLattice18("default", "workspace").store,
|
|
23673
|
+
queue: getStoreLattice18("default", "threadMessageQueue").store
|
|
23508
23674
|
};
|
|
23509
23675
|
const missing = missingRuntimeMethod(input, stores);
|
|
23510
23676
|
if (missing) return { reason: missing };
|
|
@@ -23564,7 +23730,8 @@ function createRuntime(input, stores, log2) {
|
|
|
23564
23730
|
dispatcher: createTrustedAgentMessageDispatcher((scope) => agentInstanceManager6.getAgent(scope)),
|
|
23565
23731
|
queue: stores.queue,
|
|
23566
23732
|
agentFor,
|
|
23567
|
-
...input.ensurePublicOwner === void 0 ? {} : { ensurePublicOwner: input.ensurePublicOwner }
|
|
23733
|
+
...input.ensurePublicOwner === void 0 ? {} : { ensurePublicOwner: input.ensurePublicOwner },
|
|
23734
|
+
...input.onTaskInterrupted === void 0 ? {} : { onTaskInterrupted: input.onTaskInterrupted }
|
|
23568
23735
|
},
|
|
23569
23736
|
{
|
|
23570
23737
|
settlementTimeoutMs: PROJECT_TASK_SETTLEMENT_TIMEOUT_MS,
|
|
@@ -23886,9 +24053,9 @@ var skillRegistration = {
|
|
|
23886
24053
|
};
|
|
23887
24054
|
|
|
23888
24055
|
// src/export_registrations/agent.registration.ts
|
|
23889
|
-
import { getStoreLattice as
|
|
24056
|
+
import { getStoreLattice as getStoreLattice19 } from "@axiom-lattice/core";
|
|
23890
24057
|
function getStore2() {
|
|
23891
|
-
return
|
|
24058
|
+
return getStoreLattice19("default", "assistant").store;
|
|
23892
24059
|
}
|
|
23893
24060
|
var agentRegistration = {
|
|
23894
24061
|
entityType: "agent",
|
|
@@ -23968,9 +24135,9 @@ var agentRegistration = {
|
|
|
23968
24135
|
};
|
|
23969
24136
|
|
|
23970
24137
|
// src/export_registrations/database-config.registration.ts
|
|
23971
|
-
import { getStoreLattice as
|
|
24138
|
+
import { getStoreLattice as getStoreLattice20 } from "@axiom-lattice/core";
|
|
23972
24139
|
function getStore3() {
|
|
23973
|
-
return
|
|
24140
|
+
return getStoreLattice20("default", "database").store;
|
|
23974
24141
|
}
|
|
23975
24142
|
var databaseConfigRegistration = {
|
|
23976
24143
|
entityType: "database_config",
|
|
@@ -24050,9 +24217,9 @@ var databaseConfigRegistration = {
|
|
|
24050
24217
|
};
|
|
24051
24218
|
|
|
24052
24219
|
// src/export_registrations/metrics-config.registration.ts
|
|
24053
|
-
import { getStoreLattice as
|
|
24220
|
+
import { getStoreLattice as getStoreLattice21 } from "@axiom-lattice/core";
|
|
24054
24221
|
function getStore4() {
|
|
24055
|
-
return
|
|
24222
|
+
return getStoreLattice21("default", "metrics").store;
|
|
24056
24223
|
}
|
|
24057
24224
|
var metricsConfigRegistration = {
|
|
24058
24225
|
entityType: "metrics_config",
|
|
@@ -24132,9 +24299,9 @@ var metricsConfigRegistration = {
|
|
|
24132
24299
|
};
|
|
24133
24300
|
|
|
24134
24301
|
// src/export_registrations/mcp-config.registration.ts
|
|
24135
|
-
import { getStoreLattice as
|
|
24302
|
+
import { getStoreLattice as getStoreLattice22 } from "@axiom-lattice/core";
|
|
24136
24303
|
function getStore5() {
|
|
24137
|
-
return
|
|
24304
|
+
return getStoreLattice22("default", "mcp").store;
|
|
24138
24305
|
}
|
|
24139
24306
|
var mcpConfigRegistration = {
|
|
24140
24307
|
entityType: "mcp_config",
|
|
@@ -24217,9 +24384,9 @@ var mcpConfigRegistration = {
|
|
|
24217
24384
|
};
|
|
24218
24385
|
|
|
24219
24386
|
// src/export_registrations/connection.registration.ts
|
|
24220
|
-
import { getStoreLattice as
|
|
24387
|
+
import { getStoreLattice as getStoreLattice23 } from "@axiom-lattice/core";
|
|
24221
24388
|
function getStore6() {
|
|
24222
|
-
return
|
|
24389
|
+
return getStoreLattice23("default", "connection").store;
|
|
24223
24390
|
}
|
|
24224
24391
|
async function listAllConnections(tenantId) {
|
|
24225
24392
|
const store = getStore6();
|
|
@@ -24304,9 +24471,9 @@ var connectionRegistration = {
|
|
|
24304
24471
|
};
|
|
24305
24472
|
|
|
24306
24473
|
// src/export_registrations/collection.registration.ts
|
|
24307
|
-
import { getStoreLattice as
|
|
24474
|
+
import { getStoreLattice as getStoreLattice24 } from "@axiom-lattice/core";
|
|
24308
24475
|
function getStore7() {
|
|
24309
|
-
return
|
|
24476
|
+
return getStoreLattice24("default", "collection").store;
|
|
24310
24477
|
}
|
|
24311
24478
|
var collectionRegistration = {
|
|
24312
24479
|
entityType: "collection",
|
|
@@ -24377,7 +24544,7 @@ var collectionRegistration = {
|
|
|
24377
24544
|
};
|
|
24378
24545
|
|
|
24379
24546
|
// src/export_registrations/channel-installation.registration.ts
|
|
24380
|
-
import { getStoreLattice as
|
|
24547
|
+
import { getStoreLattice as getStoreLattice25 } from "@axiom-lattice/core";
|
|
24381
24548
|
import { randomUUID as randomUUID25 } from "crypto";
|
|
24382
24549
|
var UUID_PATTERN2 = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
|
|
24383
24550
|
var PUBLIC_CHANNELS = /* @__PURE__ */ new Set(["lark", "email", "slack", "wechat"]);
|
|
@@ -24411,7 +24578,7 @@ function validateImportData(data) {
|
|
|
24411
24578
|
};
|
|
24412
24579
|
}
|
|
24413
24580
|
function getStore8() {
|
|
24414
|
-
return
|
|
24581
|
+
return getStoreLattice25("default", "channelInstallation").store;
|
|
24415
24582
|
}
|
|
24416
24583
|
function getOverwriteError(tenantId, incomingChannel, existing) {
|
|
24417
24584
|
if (!existing) return "Channel installation overwrite target must exist";
|
|
@@ -24545,9 +24712,9 @@ var channelInstallationRegistration = {
|
|
|
24545
24712
|
};
|
|
24546
24713
|
|
|
24547
24714
|
// src/export_registrations/menu.registration.ts
|
|
24548
|
-
import { getStoreLattice as
|
|
24715
|
+
import { getStoreLattice as getStoreLattice26 } from "@axiom-lattice/core";
|
|
24549
24716
|
function getStore9() {
|
|
24550
|
-
return
|
|
24717
|
+
return getStoreLattice26("default", "menu").store;
|
|
24551
24718
|
}
|
|
24552
24719
|
var menuRegistration = {
|
|
24553
24720
|
entityType: "menu",
|
|
@@ -24625,9 +24792,9 @@ var menuRegistration = {
|
|
|
24625
24792
|
};
|
|
24626
24793
|
|
|
24627
24794
|
// src/export_registrations/eval.registration.ts
|
|
24628
|
-
import { getStoreLattice as
|
|
24795
|
+
import { getStoreLattice as getStoreLattice27 } from "@axiom-lattice/core";
|
|
24629
24796
|
function getStore10() {
|
|
24630
|
-
return
|
|
24797
|
+
return getStoreLattice27("default", "eval").store;
|
|
24631
24798
|
}
|
|
24632
24799
|
var evalRegistration = {
|
|
24633
24800
|
entityType: "eval",
|
|
@@ -25488,13 +25655,16 @@ import {
|
|
|
25488
25655
|
getLoggerLattice,
|
|
25489
25656
|
loggerLatticeManager,
|
|
25490
25657
|
sandboxLatticeManager as sandboxLatticeManager2,
|
|
25491
|
-
getStoreLattice as
|
|
25658
|
+
getStoreLattice as getStoreLattice30,
|
|
25492
25659
|
agentInstanceManager as agentInstanceManager9,
|
|
25493
25660
|
createSandboxProvider,
|
|
25494
25661
|
TokenCache,
|
|
25495
25662
|
mcpManager as mcpManager3,
|
|
25496
25663
|
convertToConnection as convertToConnection2,
|
|
25497
25664
|
createTrustedAgentMessageDispatcher as createTrustedAgentMessageDispatcher2,
|
|
25665
|
+
connectAllChannels,
|
|
25666
|
+
disconnectAllChannels,
|
|
25667
|
+
ChannelConnectionLeader,
|
|
25498
25668
|
runAsLeader,
|
|
25499
25669
|
configureCoordinationLeaseStore,
|
|
25500
25670
|
getReplicaId as getReplicaId7,
|
|
@@ -25516,7 +25686,7 @@ import { RoomAgentMessageService } from "@axiom-lattice/core";
|
|
|
25516
25686
|
|
|
25517
25687
|
// src/router/MessageRouter.ts
|
|
25518
25688
|
import {
|
|
25519
|
-
getStoreLattice as
|
|
25689
|
+
getStoreLattice as getStoreLattice28,
|
|
25520
25690
|
agentInstanceManager as agentInstanceManager8
|
|
25521
25691
|
} from "@axiom-lattice/core";
|
|
25522
25692
|
import {
|
|
@@ -25807,7 +25977,7 @@ var MessageRouter = class {
|
|
|
25807
25977
|
channel: message.channel,
|
|
25808
25978
|
adapterChannel: adapter.channel
|
|
25809
25979
|
}, "Thread resolved by adapter strategy");
|
|
25810
|
-
const threadStore =
|
|
25980
|
+
const threadStore = getStoreLattice28("default", "thread").store;
|
|
25811
25981
|
try {
|
|
25812
25982
|
await threadStore.createThread(
|
|
25813
25983
|
tenantId,
|
|
@@ -25844,7 +26014,7 @@ var MessageRouter = class {
|
|
|
25844
26014
|
}
|
|
25845
26015
|
}
|
|
25846
26016
|
if (!threadId) {
|
|
25847
|
-
const threadStore =
|
|
26017
|
+
const threadStore = getStoreLattice28("default", "thread").store;
|
|
25848
26018
|
const newThreadId = randomUUID27();
|
|
25849
26019
|
console.log({
|
|
25850
26020
|
event: "dispatch:thread:create",
|
|
@@ -26106,10 +26276,23 @@ function createRoomChannelAdapter(writer) {
|
|
|
26106
26276
|
const installed = installationValues(installation);
|
|
26107
26277
|
if (!installed) throw new Error("Invalid room installation");
|
|
26108
26278
|
const targetEnvelope = exactValues2(replyTarget, ["adapterChannel", "channelInstallationId", "rawTarget"]);
|
|
26109
|
-
const target = exactStrings(targetEnvelope?.rawTarget, ["sourceRoomMessageId", "targetMembershipId", "inputMessageId"]);
|
|
26110
26279
|
const envelope = exactValues2(message, ["text", "metadata"]);
|
|
26111
|
-
|
|
26112
|
-
|
|
26280
|
+
if (!targetEnvelope || targetEnvelope.adapterChannel !== "room" || targetEnvelope.channelInstallationId !== installation.id || typeof envelope?.text !== "string") throw new Error("Invalid room interrupt");
|
|
26281
|
+
const correlationKey = exactStrings(envelope.metadata, ["correlationKey"])?.correlationKey;
|
|
26282
|
+
if (correlationKey) {
|
|
26283
|
+
const correlatedTarget = exactStrings(targetEnvelope.rawTarget, ["targetMembershipId"]);
|
|
26284
|
+
if (!correlatedTarget) throw new Error("Invalid room interrupt correlation");
|
|
26285
|
+
await writer.postCorrelatedInterrupt({
|
|
26286
|
+
tenantId: installed.tenantId,
|
|
26287
|
+
membershipId: correlatedTarget.targetMembershipId,
|
|
26288
|
+
correlationKey,
|
|
26289
|
+
text: envelope.text
|
|
26290
|
+
});
|
|
26291
|
+
return;
|
|
26292
|
+
}
|
|
26293
|
+
const target = exactStrings(targetEnvelope.rawTarget, ["sourceRoomMessageId", "targetMembershipId", "inputMessageId"]);
|
|
26294
|
+
const metadata = exactStrings(envelope.metadata, ["inputMessageId"]);
|
|
26295
|
+
if (!target || !metadata) throw new Error("Invalid room interrupt");
|
|
26113
26296
|
if (target.inputMessageId !== metadata.inputMessageId) throw new Error("Invalid room interrupt correlation");
|
|
26114
26297
|
await writer.postInterrupt({
|
|
26115
26298
|
tenantId: installed.tenantId,
|
|
@@ -26246,7 +26429,7 @@ var PluginDeploymentService = class {
|
|
|
26246
26429
|
this.now = deps.clock ?? Date.now;
|
|
26247
26430
|
this.logger = deps.logger ?? { info: () => void 0 };
|
|
26248
26431
|
this.limits = deps.limits ?? {};
|
|
26249
|
-
this.serviceBaseUrl = (deps.serviceBaseUrl ?? process.env.
|
|
26432
|
+
this.serviceBaseUrl = (deps.serviceBaseUrl ?? process.env.MICROSANDBOX_SERVICE_BASE_URL ?? "").replace(
|
|
26250
26433
|
/\/$/,
|
|
26251
26434
|
""
|
|
26252
26435
|
);
|
|
@@ -26934,7 +27117,7 @@ function isPluginDeploymentRuntimeEnabled(env = process.env) {
|
|
|
26934
27117
|
const flag = env[PLUGIN_DEPLOYMENT_RUNTIME_FLAG];
|
|
26935
27118
|
if (flag === "false" || flag === "0") return false;
|
|
26936
27119
|
if (flag === "true" || flag === "1") return true;
|
|
26937
|
-
return Boolean(env.
|
|
27120
|
+
return Boolean(env.MICROSANDBOX_SERVICE_BASE_URL);
|
|
26938
27121
|
}
|
|
26939
27122
|
function readPluginDeploymentLimits(env = process.env) {
|
|
26940
27123
|
return {
|
|
@@ -26951,10 +27134,10 @@ function readPluginDeploymentLimits(env = process.env) {
|
|
|
26951
27134
|
function startPluginDeploymentRuntime(options) {
|
|
26952
27135
|
const { lease, holder, logger: logger7 } = options;
|
|
26953
27136
|
const forcedOn = process.env[PLUGIN_DEPLOYMENT_RUNTIME_FLAG] === "true" || process.env[PLUGIN_DEPLOYMENT_RUNTIME_FLAG] === "1";
|
|
26954
|
-
const effectiveServiceBaseUrl = options.wiring.serviceBaseUrl ?? process.env.
|
|
27137
|
+
const effectiveServiceBaseUrl = options.wiring.serviceBaseUrl ?? process.env.MICROSANDBOX_SERVICE_BASE_URL;
|
|
26955
27138
|
if (forcedOn && !effectiveServiceBaseUrl) {
|
|
26956
27139
|
logger7.warn(
|
|
26957
|
-
`${PLUGIN_DEPLOYMENT_RUNTIME_FLAG} is enabled but
|
|
27140
|
+
`${PLUGIN_DEPLOYMENT_RUNTIME_FLAG} is enabled but MICROSANDBOX_SERVICE_BASE_URL is empty; skipping plugin deployment runtime`,
|
|
26958
27141
|
{ holder }
|
|
26959
27142
|
);
|
|
26960
27143
|
return { reconcile: Promise.resolve(), dispose: async () => void 0 };
|
|
@@ -27104,7 +27287,7 @@ function errorMessage5(error) {
|
|
|
27104
27287
|
}
|
|
27105
27288
|
|
|
27106
27289
|
// src/services/multiReplicaReadiness.ts
|
|
27107
|
-
import { getStoreLattice as
|
|
27290
|
+
import { getStoreLattice as getStoreLattice29 } from "@axiom-lattice/core";
|
|
27108
27291
|
var SHARED_STORE_KINDS = [
|
|
27109
27292
|
"lease",
|
|
27110
27293
|
"outbox",
|
|
@@ -27115,7 +27298,7 @@ var SHARED_STORE_KINDS = [
|
|
|
27115
27298
|
];
|
|
27116
27299
|
function storeClassName(kind) {
|
|
27117
27300
|
try {
|
|
27118
|
-
return
|
|
27301
|
+
return getStoreLattice29("default", kind).store.constructor?.name;
|
|
27119
27302
|
} catch {
|
|
27120
27303
|
return void 0;
|
|
27121
27304
|
}
|
|
@@ -27403,7 +27586,7 @@ function getConfiguredSandboxProvider() {
|
|
|
27403
27586
|
}
|
|
27404
27587
|
async function restoreMcpConnections() {
|
|
27405
27588
|
try {
|
|
27406
|
-
const storeLattice =
|
|
27589
|
+
const storeLattice = getStoreLattice30("default", "mcp");
|
|
27407
27590
|
const store = storeLattice.store;
|
|
27408
27591
|
if (!store) {
|
|
27409
27592
|
logger6.info("MCP store not configured, skipping connection restoration");
|
|
@@ -27458,9 +27641,9 @@ var start = async (config) => {
|
|
|
27458
27641
|
let projectRoomRealtimeRuntime;
|
|
27459
27642
|
if (projectRoomRealtimeMode === "single-gateway") {
|
|
27460
27643
|
projectRoomRealtimeRuntime = createProjectRoomRealtimeRuntime({
|
|
27461
|
-
tasks:
|
|
27462
|
-
rooms:
|
|
27463
|
-
memberships:
|
|
27644
|
+
tasks: getStoreLattice30("default", "task").store,
|
|
27645
|
+
rooms: getStoreLattice30("default", "projectRoom").store,
|
|
27646
|
+
memberships: getStoreLattice30("default", "projectBotMembership").store,
|
|
27464
27647
|
log: { warn: (message, context) => logger6.warn(message, context) }
|
|
27465
27648
|
});
|
|
27466
27649
|
}
|
|
@@ -27470,10 +27653,9 @@ var start = async (config) => {
|
|
|
27470
27653
|
const { wechatChannelAdapter } = await import("./WechatChannelAdapter-7WHE5UGY.mjs");
|
|
27471
27654
|
adapterRegistry.register(wechatChannelAdapter);
|
|
27472
27655
|
try {
|
|
27473
|
-
const { getStoreLattice: getStore11 } = await import("@axiom-lattice/core");
|
|
27474
27656
|
const infrastructure = createChannelInfrastructure({
|
|
27475
27657
|
adapterRegistry,
|
|
27476
|
-
getStore: ((kind) =>
|
|
27658
|
+
getStore: ((kind) => getStoreLattice30("default", kind).store),
|
|
27477
27659
|
trustedDispatcher: createTrustedAgentMessageDispatcher2((scope) => agentInstanceManager9.getAgent(scope)),
|
|
27478
27660
|
middlewares: [
|
|
27479
27661
|
createDeduplicationMiddleware(),
|
|
@@ -27503,7 +27685,7 @@ var start = async (config) => {
|
|
|
27503
27685
|
}
|
|
27504
27686
|
setEvalRunService(evalRunner);
|
|
27505
27687
|
try {
|
|
27506
|
-
const menuStore =
|
|
27688
|
+
const menuStore = getStoreLattice30("default", "menu").store;
|
|
27507
27689
|
setMenuRegistry(menuStore);
|
|
27508
27690
|
logger6.info("Menu registry initialized");
|
|
27509
27691
|
} catch {
|
|
@@ -27521,10 +27703,10 @@ var start = async (config) => {
|
|
|
27521
27703
|
const { A2AAuthService: A2AAuthService2, parseEnvKeys: parseEnvKeys2 } = await import("./A2AAuthService-7UGQ7GMW.mjs");
|
|
27522
27704
|
const { registerA2AStandardRoutes } = await import("./a2a-standard-PBYPNHOA.mjs");
|
|
27523
27705
|
const a2a = await import("./a2a-BHBLACJV.mjs");
|
|
27524
|
-
const a2aKeyStore =
|
|
27525
|
-
const assistantStore =
|
|
27526
|
-
const projectStore =
|
|
27527
|
-
const taskStore =
|
|
27706
|
+
const a2aKeyStore = getStoreLattice30("default", "a2aApiKey").store;
|
|
27707
|
+
const assistantStore = getStoreLattice30("default", "assistant").store;
|
|
27708
|
+
const projectStore = getStoreLattice30("default", "project").store;
|
|
27709
|
+
const taskStore = getStoreLattice30("default", "task").store;
|
|
27528
27710
|
const authService = new A2AAuthService2({
|
|
27529
27711
|
keyStore: a2aKeyStore,
|
|
27530
27712
|
assistantStore,
|
|
@@ -27549,12 +27731,12 @@ var start = async (config) => {
|
|
|
27549
27731
|
});
|
|
27550
27732
|
}
|
|
27551
27733
|
try {
|
|
27552
|
-
const { registerOpenRoutes } = await import("./open-
|
|
27734
|
+
const { registerOpenRoutes } = await import("./open-FJ3BY3CL.mjs");
|
|
27553
27735
|
const { registerOpenSessionRoutes } = await import("./open-session-2Y7XJJW2.mjs");
|
|
27554
27736
|
const { registerOpenCatalogRoutes } = await import("./open-catalog-SZQ435AY.mjs");
|
|
27555
27737
|
const { registerOpenFilesRoutes } = await import("./open-files-X3HXVEEM.mjs");
|
|
27556
27738
|
const { registerOpenAuditRoutes } = await import("./open-audit-UJ3NXCGW.mjs");
|
|
27557
|
-
const { registerOpenExposureRoutes } = await import("./open-exposure-
|
|
27739
|
+
const { registerOpenExposureRoutes } = await import("./open-exposure-OX5NKWDG.mjs");
|
|
27558
27740
|
const { openLattice } = await import("./openLattice-Q6M5S6CY.mjs");
|
|
27559
27741
|
const { createKbProvider } = await import("./kbProvider-2D6DZ34N.mjs");
|
|
27560
27742
|
const { createOpenSandboxProvider } = await import("./sandboxProvider-DUYWHYJN.mjs");
|
|
@@ -27563,8 +27745,8 @@ var start = async (config) => {
|
|
|
27563
27745
|
const { CollectionService: CollectionService2 } = await import("./collection_service-RTRJEQFL.mjs");
|
|
27564
27746
|
openLattice.register(createKbProvider(new CollectionService2()));
|
|
27565
27747
|
openLattice.register(createOpenSandboxProvider());
|
|
27566
|
-
const threadStore =
|
|
27567
|
-
const assistantStore =
|
|
27748
|
+
const threadStore = getStoreLattice30("default", "thread").store;
|
|
27749
|
+
const assistantStore = getStoreLattice30("default", "assistant").store;
|
|
27568
27750
|
openLattice.register(
|
|
27569
27751
|
createAgentProvider({
|
|
27570
27752
|
threadStore,
|
|
@@ -27604,9 +27786,9 @@ var start = async (config) => {
|
|
|
27604
27786
|
}
|
|
27605
27787
|
if (isPluginDeploymentRuntimeEnabled()) {
|
|
27606
27788
|
try {
|
|
27607
|
-
const pluginDeploymentStore =
|
|
27608
|
-
const tenantStore =
|
|
27609
|
-
const leaseStore2 =
|
|
27789
|
+
const pluginDeploymentStore = getStoreLattice30("default", "pluginDeployment").store;
|
|
27790
|
+
const tenantStore = getStoreLattice30("default", "tenant").store;
|
|
27791
|
+
const leaseStore2 = getStoreLattice30("default", "lease").store;
|
|
27610
27792
|
const listAllDeployments = async () => {
|
|
27611
27793
|
const tenants = await tenantStore.getAllTenants();
|
|
27612
27794
|
const lists = await Promise.all(
|
|
@@ -27648,7 +27830,7 @@ var start = async (config) => {
|
|
|
27648
27830
|
}
|
|
27649
27831
|
try {
|
|
27650
27832
|
const { ResourceController } = await import("./resources-2L3KSUUU.mjs");
|
|
27651
|
-
const sharedResourceStore =
|
|
27833
|
+
const sharedResourceStore = getStoreLattice30("default", "sharedResource").store;
|
|
27652
27834
|
const cache = new TokenCache();
|
|
27653
27835
|
const resourceController = new ResourceController({
|
|
27654
27836
|
store: sharedResourceStore,
|
|
@@ -27664,10 +27846,9 @@ var start = async (config) => {
|
|
|
27664
27846
|
});
|
|
27665
27847
|
}
|
|
27666
27848
|
if (channelDeps && process.env.CHANNELS_ENABLED !== "false") {
|
|
27667
|
-
const { connectAllChannels, disconnectAllChannels, ChannelConnectionLeader } = await import("@axiom-lattice/core");
|
|
27668
27849
|
try {
|
|
27669
27850
|
const channelLeader = new ChannelConnectionLeader({
|
|
27670
|
-
leaseStore:
|
|
27851
|
+
leaseStore: getStoreLattice30("default", "lease").store,
|
|
27671
27852
|
owner: getReplicaId7(),
|
|
27672
27853
|
connect: () => connectAllChannels((channel) => adapterRegistry.get(channel), {
|
|
27673
27854
|
deps: { router: channelDeps.router }
|
|
@@ -27686,8 +27867,8 @@ var start = async (config) => {
|
|
|
27686
27867
|
}
|
|
27687
27868
|
}
|
|
27688
27869
|
const target_port = config?.port || Number(process.env.PORT) || 4001;
|
|
27689
|
-
configureCoordinationLeaseStore(
|
|
27690
|
-
const outboxStore =
|
|
27870
|
+
configureCoordinationLeaseStore(getStoreLattice30("default", "lease").store);
|
|
27871
|
+
const outboxStore = getStoreLattice30("default", "outbox").store;
|
|
27691
27872
|
taskLifecycleNotifier3.setOutbox(outboxStore);
|
|
27692
27873
|
projectTaskAdmissionNotifier2.setOutbox(outboxStore);
|
|
27693
27874
|
configurePluginCatalogSync({ outbox: outboxStore, owner: getReplicaId7() });
|
|
@@ -27713,7 +27894,7 @@ var start = async (config) => {
|
|
|
27713
27894
|
"assistant-changed": (payload) => handleAssistantChanged(payload, (tenantId) => agentLatticeManager5.initializeStoredAssistantsForTenant(tenantId)),
|
|
27714
27895
|
[A2A_KEY_CHANGED_TOPIC]: (payload) => handleA2AKeyChanged(payload, () => refreshStoreKeyMap()),
|
|
27715
27896
|
[MCP_CONFIG_CHANGED_TOPIC]: (payload) => reconcileMcpConfigChange(payload, {
|
|
27716
|
-
store:
|
|
27897
|
+
store: getStoreLattice30("default", "mcp").store,
|
|
27717
27898
|
manager: mcpManager3,
|
|
27718
27899
|
convertToConnection: convertToConnection2
|
|
27719
27900
|
}),
|
|
@@ -27734,7 +27915,7 @@ var start = async (config) => {
|
|
|
27734
27915
|
} catch (err) {
|
|
27735
27916
|
logger6.warn("Outbox poller failed to start", { error: err instanceof Error ? err.message : String(err) });
|
|
27736
27917
|
}
|
|
27737
|
-
const leaseStore =
|
|
27918
|
+
const leaseStore = getStoreLattice30("default", "lease").store;
|
|
27738
27919
|
if (leaseStore.constructor?.name === "InMemoryLeaseStore") {
|
|
27739
27920
|
logger6.warn(
|
|
27740
27921
|
"Startup recovery leader gate uses a non-distributed lease store (per-process only); configure a shared 'lease' store for multi-replica deployments",
|
|
@@ -27751,9 +27932,9 @@ var start = async (config) => {
|
|
|
27751
27932
|
const { createOrphanRecoveryRuntime: createOrphanRecoveryRuntime2 } = await import("./OrphanRecoveryRuntime-BEFILJMU.mjs");
|
|
27752
27933
|
const { createRecoveryCallerDeps: createRecoveryCallerDeps2 } = await import("./RecoveryCallerDeps-6SJUYJ5S.mjs");
|
|
27753
27934
|
const runtime = createOrphanRecoveryRuntime2({
|
|
27754
|
-
taskStore:
|
|
27755
|
-
workItemStore:
|
|
27756
|
-
tenantStore:
|
|
27935
|
+
taskStore: getStoreLattice30("default", "task").store,
|
|
27936
|
+
workItemStore: getStoreLattice30("default", "taskWorkItem").store,
|
|
27937
|
+
tenantStore: getStoreLattice30("default", "tenant").store,
|
|
27757
27938
|
...createRecoveryCallerDeps2(),
|
|
27758
27939
|
log: logger6
|
|
27759
27940
|
});
|