@axiom-lattice/gateway 4.11.0 → 5.0.0
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/{OrphanRecoveryRuntime-BEFILJMU.mjs → OrphanRecoveryRuntime-T4T5NOZU.mjs} +2 -2
- package/dist/{a2a-standard-PBYPNHOA.mjs → a2a-standard-3OZFXDCW.mjs} +1 -1
- package/dist/a2a-standard-3OZFXDCW.mjs.map +1 -0
- package/dist/{chunk-ZBTG3T7K.mjs → chunk-NZXKECNN.mjs} +4 -19
- package/dist/{chunk-ZBTG3T7K.mjs.map → chunk-NZXKECNN.mjs.map} +1 -1
- package/dist/embed/{embed-page-AgentDetailSideApp-FHC56ARN.js → embed-page-AgentDetailSideApp-XCP4LY7Y.js} +1 -1
- package/dist/embed/{embed-page-AgentGovernanceWorkbench-KAPZJBE6.js → embed-page-AgentGovernanceWorkbench-BBDKEIBI.js} +1 -1
- package/dist/embed/{embed-page-MessageGraph-DMP5EZBM.js → embed-page-MessageGraph-D77CYFAG.js} +1 -1
- package/dist/embed/{embed-page-ReactChart-PYGNSRHG.js → embed-page-ReactChart-TBDJOTZ5.js} +1 -1
- package/dist/embed/{embed-page-SkillFlow-6LPE2VG3.js → embed-page-SkillFlow-NDAK3GAD.js} +1 -1
- package/dist/embed/{embed-page-TasksSideApp-MPYOPRXW.js → embed-page-TasksSideApp-BVCIAE24.js} +5 -5
- package/dist/embed/{embed-page-TeamWorkspace-EXUAXKAH.js → embed-page-TeamWorkspace-JFEKNVFP.js} +1 -1
- package/dist/embed/{embed-page-TopologyRuntimeView-MH4YMU7D.js → embed-page-TopologyRuntimeView-42TN76MK.js} +1 -1
- package/dist/embed/{embed-page-WorkflowAutomationView-KQYFSLLH.js → embed-page-WorkflowAutomationView-JLP4UHPP.js} +1 -1
- package/dist/embed/{embed-page-chunk-O44JEYLD.js → embed-page-chunk-2PFKLMTR.js} +5 -5
- package/dist/embed/{embed-page-chunk-YQZI5LNV.js → embed-page-chunk-5NJ3O2GK.js} +1 -1
- package/dist/embed/{embed-page-chunk-JSAUTBU5.js → embed-page-chunk-GUSAII2D.js} +1 -1
- package/dist/embed/{embed-page-chunk-I7BVN6EY.js → embed-page-chunk-H64UEFHS.js} +1 -1
- package/dist/embed/{embed-page-chunk-QGXGVLAX.js → embed-page-chunk-I3OONX3N.js} +1 -1
- package/dist/embed/{embed-page-chunk-NW37OVAX.js → embed-page-chunk-K2U3JD67.js} +1 -1
- package/dist/embed/{embed-page-chunk-QHXKZNDU.js → embed-page-chunk-YYDZ6ZBV.js} +307 -191
- package/dist/embed/{embed-page-en-PQZ2ZCEH.js → embed-page-en-GLT2HEZZ.js} +1 -1
- package/dist/embed/{embed-page-zh-D3EX4GW4.js → embed-page-zh-XMEJPDMF.js} +1 -1
- package/dist/embed/embed-page.js +1 -1
- package/dist/index.d.mts +8 -7
- package/dist/index.d.ts +8 -7
- package/dist/index.js +718 -730
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +284 -285
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -4
- package/dist/a2a-standard-PBYPNHOA.mjs.map +0 -1
- /package/dist/{OrphanRecoveryRuntime-BEFILJMU.mjs.map → OrphanRecoveryRuntime-T4T5NOZU.mjs.map} +0 -0
package/dist/index.mjs
CHANGED
|
@@ -44,7 +44,7 @@ import {
|
|
|
44
44
|
resolveTaskOwnerMembership,
|
|
45
45
|
resolveTopCaller,
|
|
46
46
|
runOrphanRecovery
|
|
47
|
-
} from "./chunk-
|
|
47
|
+
} from "./chunk-NZXKECNN.mjs";
|
|
48
48
|
import {
|
|
49
49
|
createRecoveryCallerDeps
|
|
50
50
|
} from "./chunk-NOXGKYUV.mjs";
|
|
@@ -66,7 +66,7 @@ import staticPlugin from "@fastify/static";
|
|
|
66
66
|
import path4 from "path";
|
|
67
67
|
|
|
68
68
|
// src/routes/index.ts
|
|
69
|
-
import { randomUUID as
|
|
69
|
+
import { randomUUID as randomUUID23 } from "crypto";
|
|
70
70
|
import {
|
|
71
71
|
descriptorDataValue as descriptorDataValue3,
|
|
72
72
|
snapshotExactRecord as snapshotExactRecord14,
|
|
@@ -1920,6 +1920,9 @@ var setQueueServiceType = (type) => {
|
|
|
1920
1920
|
}
|
|
1921
1921
|
registerQueueLattice(DEFAULT_QUEUE_KEY, config, client);
|
|
1922
1922
|
};
|
|
1923
|
+
var getQueueServiceType = () => {
|
|
1924
|
+
return queueServiceType;
|
|
1925
|
+
};
|
|
1923
1926
|
var getQueueService = () => {
|
|
1924
1927
|
if (!queueLatticeManager.hasLattice(DEFAULT_QUEUE_KEY)) {
|
|
1925
1928
|
setQueueServiceType(queueServiceType);
|
|
@@ -2117,6 +2120,66 @@ async function updateModels(request, reply) {
|
|
|
2117
2120
|
}
|
|
2118
2121
|
}
|
|
2119
2122
|
|
|
2123
|
+
// src/services/multiReplicaReadiness.ts
|
|
2124
|
+
import { getStoreLattice as getStoreLattice3 } from "@axiom-lattice/core";
|
|
2125
|
+
var SHARED_STORE_KINDS = [
|
|
2126
|
+
"lease",
|
|
2127
|
+
"outbox",
|
|
2128
|
+
"threadMessageQueue",
|
|
2129
|
+
"task",
|
|
2130
|
+
"taskWorkItem",
|
|
2131
|
+
"channelInstallation"
|
|
2132
|
+
];
|
|
2133
|
+
function isMultiReplicaDeclared() {
|
|
2134
|
+
return typeof process.env.AXIOM_REPLICA_ID === "string" && process.env.AXIOM_REPLICA_ID.trim() !== "";
|
|
2135
|
+
}
|
|
2136
|
+
function storeClassName(kind) {
|
|
2137
|
+
try {
|
|
2138
|
+
return getStoreLattice3("default", kind).store.constructor?.name;
|
|
2139
|
+
} catch {
|
|
2140
|
+
return void 0;
|
|
2141
|
+
}
|
|
2142
|
+
}
|
|
2143
|
+
function computeMultiReplicaReadiness() {
|
|
2144
|
+
const multiReplicaDeclared = isMultiReplicaDeclared();
|
|
2145
|
+
const warnings = [];
|
|
2146
|
+
if (!multiReplicaDeclared) {
|
|
2147
|
+
return { multiReplicaDeclared, ok: true, warnings };
|
|
2148
|
+
}
|
|
2149
|
+
for (const kind of SHARED_STORE_KINDS) {
|
|
2150
|
+
const name = storeClassName(kind);
|
|
2151
|
+
if (name === void 0 || !name.startsWith("InMemory")) continue;
|
|
2152
|
+
warnings.push(`Multi-replica: store '${kind}' is ${name} (not shared); configure a shared store`);
|
|
2153
|
+
}
|
|
2154
|
+
if (!process.env.AUTH_TOKEN_SECRET?.trim() && !process.env.JWT_SECRET?.trim()) {
|
|
2155
|
+
warnings.push(
|
|
2156
|
+
"Multi-replica: AUTH_TOKEN_SECRET/JWT_SECRET unset; console sessions are signed per-process and will not verify across replicas"
|
|
2157
|
+
);
|
|
2158
|
+
}
|
|
2159
|
+
if (!process.env.LATTICE_ENCRYPTION_KEY?.trim()) {
|
|
2160
|
+
warnings.push(
|
|
2161
|
+
"Multi-replica: LATTICE_ENCRYPTION_KEY unset; stored credentials use the shared dev default and may not decrypt across differing keys"
|
|
2162
|
+
);
|
|
2163
|
+
}
|
|
2164
|
+
if (getQueueServiceType() !== "redis") {
|
|
2165
|
+
warnings.push(
|
|
2166
|
+
"Multi-replica: task queue service is 'memory' (not shared); set QUEUE_SERVICE_TYPE=redis so queued work is visible across replicas"
|
|
2167
|
+
);
|
|
2168
|
+
}
|
|
2169
|
+
return { multiReplicaDeclared, ok: warnings.length === 0, warnings };
|
|
2170
|
+
}
|
|
2171
|
+
function warnMultiReplicaReadiness(logger8) {
|
|
2172
|
+
const { multiReplicaDeclared, warnings } = computeMultiReplicaReadiness();
|
|
2173
|
+
if (!multiReplicaDeclared) return;
|
|
2174
|
+
for (const message of warnings) {
|
|
2175
|
+
logger8.warn(message, { phase: "multi_replica_readiness" });
|
|
2176
|
+
}
|
|
2177
|
+
logger8.warn(
|
|
2178
|
+
"Multi-replica: agent run SSE and resume_stream are process-local; route a thread's follow-up runs to the replica streaming it (sticky routing) or share the stream/queue state",
|
|
2179
|
+
{ phase: "multi_replica_readiness", feature: "agent-run-sse" }
|
|
2180
|
+
);
|
|
2181
|
+
}
|
|
2182
|
+
|
|
2120
2183
|
// src/controllers/health.ts
|
|
2121
2184
|
async function getHealth(request, reply) {
|
|
2122
2185
|
try {
|
|
@@ -2125,7 +2188,8 @@ async function getHealth(request, reply) {
|
|
|
2125
2188
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
2126
2189
|
uptime: process.uptime(),
|
|
2127
2190
|
service: "lattice-gateway",
|
|
2128
|
-
version: process.env.npm_package_version || "1.0.0"
|
|
2191
|
+
version: process.env.npm_package_version || "1.0.0",
|
|
2192
|
+
readiness: computeMultiReplicaReadiness()
|
|
2129
2193
|
};
|
|
2130
2194
|
return reply.send({
|
|
2131
2195
|
success: true,
|
|
@@ -2846,7 +2910,7 @@ async function getToolConfigs(request, reply) {
|
|
|
2846
2910
|
|
|
2847
2911
|
// src/controllers/data-query.ts
|
|
2848
2912
|
import {
|
|
2849
|
-
getStoreLattice as
|
|
2913
|
+
getStoreLattice as getStoreLattice4,
|
|
2850
2914
|
metricsServerManager
|
|
2851
2915
|
} from "@axiom-lattice/core";
|
|
2852
2916
|
function getTenantId5(request) {
|
|
@@ -2879,7 +2943,7 @@ async function executeDataQuery(request, reply) {
|
|
|
2879
2943
|
message: "Cannot provide both metrics and customSql. Use one query type only."
|
|
2880
2944
|
};
|
|
2881
2945
|
}
|
|
2882
|
-
const storeLattice =
|
|
2946
|
+
const storeLattice = getStoreLattice4("default", "metrics");
|
|
2883
2947
|
const store = storeLattice.store;
|
|
2884
2948
|
if (!body.serverKey) {
|
|
2885
2949
|
reply.code(400);
|
|
@@ -2987,7 +3051,7 @@ async function executeSqlQuery(client, body, reply) {
|
|
|
2987
3051
|
}
|
|
2988
3052
|
|
|
2989
3053
|
// src/controllers/workflow-tracking.ts
|
|
2990
|
-
import { getStoreLattice as
|
|
3054
|
+
import { getStoreLattice as getStoreLattice5, agentInstanceManager as agentInstanceManager4, ThreadStatus as ThreadStatus2, abortWorkflowRun as signalAbort } from "@axiom-lattice/core";
|
|
2991
3055
|
import { MessageChunkTypes as MessageChunkTypes2 } from "@axiom-lattice/protocols";
|
|
2992
3056
|
function getTenantId6(request) {
|
|
2993
3057
|
const userTenantId = request.user?.tenantId;
|
|
@@ -2996,7 +3060,7 @@ function getTenantId6(request) {
|
|
|
2996
3060
|
}
|
|
2997
3061
|
function getTrackingStore() {
|
|
2998
3062
|
try {
|
|
2999
|
-
const storeLattice =
|
|
3063
|
+
const storeLattice = getStoreLattice5("default", "workflowTracking");
|
|
3000
3064
|
return storeLattice.store;
|
|
3001
3065
|
} catch {
|
|
3002
3066
|
return null;
|
|
@@ -3004,7 +3068,7 @@ function getTrackingStore() {
|
|
|
3004
3068
|
}
|
|
3005
3069
|
async function getDefinitionsFromAssistants(tenantId) {
|
|
3006
3070
|
try {
|
|
3007
|
-
const storeLattice =
|
|
3071
|
+
const storeLattice = getStoreLattice5("default", "assistant");
|
|
3008
3072
|
const assistantStore = storeLattice.store;
|
|
3009
3073
|
const assistants = await assistantStore.getAllAssistants(tenantId);
|
|
3010
3074
|
const results = [];
|
|
@@ -3084,7 +3148,7 @@ async function getAllWorkflowRuns(request, reply) {
|
|
|
3084
3148
|
}
|
|
3085
3149
|
const nameMap = {};
|
|
3086
3150
|
try {
|
|
3087
|
-
const asStoreLattice =
|
|
3151
|
+
const asStoreLattice = getStoreLattice5("default", "assistant");
|
|
3088
3152
|
const assistantStore = asStoreLattice.store;
|
|
3089
3153
|
const assistants = await assistantStore.getAllAssistants(tenantId);
|
|
3090
3154
|
for (const a of assistants) {
|
|
@@ -3137,7 +3201,7 @@ async function getInboxItems(request, reply) {
|
|
|
3137
3201
|
}
|
|
3138
3202
|
const nameMap = {};
|
|
3139
3203
|
try {
|
|
3140
|
-
const asStoreLattice =
|
|
3204
|
+
const asStoreLattice = getStoreLattice5("default", "assistant");
|
|
3141
3205
|
const assistantStore = asStoreLattice.store;
|
|
3142
3206
|
const assistants = await assistantStore.getAllAssistants(tenantId);
|
|
3143
3207
|
for (const a of assistants) {
|
|
@@ -3511,7 +3575,7 @@ async function abortWorkflowRun(request, reply) {
|
|
|
3511
3575
|
}
|
|
3512
3576
|
|
|
3513
3577
|
// src/controllers/personal-assistant.ts
|
|
3514
|
-
import { eventBus as eventBus2, getStoreLattice as
|
|
3578
|
+
import { eventBus as eventBus2, getStoreLattice as getStoreLattice6, PersonalAssistantConfig } from "@axiom-lattice/core";
|
|
3515
3579
|
import { randomUUID as randomUUID3 } from "crypto";
|
|
3516
3580
|
function getWorkspaceId2(request) {
|
|
3517
3581
|
return request.headers["x-workspace-id"] || "default";
|
|
@@ -3527,13 +3591,13 @@ function getUserId3(request) {
|
|
|
3527
3591
|
return userId;
|
|
3528
3592
|
}
|
|
3529
3593
|
function getLinkStore() {
|
|
3530
|
-
return
|
|
3594
|
+
return getStoreLattice6("default", "userTenantLink").store;
|
|
3531
3595
|
}
|
|
3532
3596
|
function getAssistantStore() {
|
|
3533
|
-
return
|
|
3597
|
+
return getStoreLattice6("default", "assistant").store;
|
|
3534
3598
|
}
|
|
3535
3599
|
function getProjectStore() {
|
|
3536
|
-
return
|
|
3600
|
+
return getStoreLattice6("default", "project").store;
|
|
3537
3601
|
}
|
|
3538
3602
|
async function getLinkMeta(userId, tenantId) {
|
|
3539
3603
|
const link = await getLinkStore().getLink(userId, tenantId);
|
|
@@ -3609,7 +3673,7 @@ async function deletePersonalAssistant(request, reply) {
|
|
|
3609
3673
|
return reply.status(500).send({ success: false, message: "Failed to delete personal assistant" });
|
|
3610
3674
|
}
|
|
3611
3675
|
eventBus2.publish("assistant:deleted", { id: assistant.id, tenantId });
|
|
3612
|
-
const threadStore =
|
|
3676
|
+
const threadStore = getStoreLattice6("default", "thread").store;
|
|
3613
3677
|
try {
|
|
3614
3678
|
const threads = await threadStore.getThreadsByAssistantId(tenantId, assistant.id);
|
|
3615
3679
|
for (const t2 of threads) {
|
|
@@ -3635,25 +3699,14 @@ async function deletePersonalAssistant(request, reply) {
|
|
|
3635
3699
|
|
|
3636
3700
|
// src/services/ExportImportService.ts
|
|
3637
3701
|
import { ExportableEntityRegistry, DependencyResolver, IdRemapper, isBuiltInSkill } from "@axiom-lattice/core";
|
|
3638
|
-
import { randomUUID as randomUUID4 } from "crypto";
|
|
3639
3702
|
import * as fs from "fs/promises";
|
|
3640
3703
|
import * as os from "os";
|
|
3641
3704
|
import * as path from "path";
|
|
3642
3705
|
import * as tar from "tar";
|
|
3643
3706
|
import * as zlib from "zlib";
|
|
3644
|
-
var exportJobs = /* @__PURE__ */ new Map();
|
|
3645
|
-
var JOB_TTL_MS = 60 * 60 * 1e3;
|
|
3646
3707
|
var MAX_ARCHIVE_ENTRIES = 1e4;
|
|
3647
3708
|
var MAX_ARCHIVE_FILE_BYTES = 100 * 1024 * 1024;
|
|
3648
3709
|
var MAX_ARCHIVE_TOTAL_BYTES = 512 * 1024 * 1024;
|
|
3649
|
-
function cleanExpiredJobs() {
|
|
3650
|
-
const now = Date.now();
|
|
3651
|
-
for (const [id3, entry] of exportJobs) {
|
|
3652
|
-
if (now - entry.createdAt > JOB_TTL_MS) {
|
|
3653
|
-
exportJobs.delete(id3);
|
|
3654
|
-
}
|
|
3655
|
-
}
|
|
3656
|
-
}
|
|
3657
3710
|
function archiveFileKey(entityType, entityId, relPath) {
|
|
3658
3711
|
return `files/${entityType}/${entityId}/${relPath}`;
|
|
3659
3712
|
}
|
|
@@ -3676,7 +3729,8 @@ var ExportImportService = class {
|
|
|
3676
3729
|
}
|
|
3677
3730
|
/**
|
|
3678
3731
|
* Generate a full export (bundle + file content) for the given tenant and entity types.
|
|
3679
|
-
*
|
|
3732
|
+
* The result is returned directly so the caller can pack and stream it in the same
|
|
3733
|
+
* request, with no process-local job state that would break across Gateway replicas.
|
|
3680
3734
|
*/
|
|
3681
3735
|
async export(tenantId, entityTypes, entityIds, context) {
|
|
3682
3736
|
const { dependencyOrder, entities: rawEntities } = await this.resolveExportSelection(
|
|
@@ -3735,18 +3789,7 @@ var ExportImportService = class {
|
|
|
3735
3789
|
dependencyOrder,
|
|
3736
3790
|
_warning: "This file contains plaintext secrets (passwords, API keys, tokens). Store it securely and delete after import."
|
|
3737
3791
|
};
|
|
3738
|
-
|
|
3739
|
-
exportJobs.set(jobId, { data: { bundle, files }, tenantId, createdAt: Date.now() });
|
|
3740
|
-
return { jobId, data: { bundle, files } };
|
|
3741
|
-
}
|
|
3742
|
-
/**
|
|
3743
|
-
* Retrieve a previously generated export job data by jobId with tenant validation.
|
|
3744
|
-
*/
|
|
3745
|
-
getExportJob(jobId, tenantId) {
|
|
3746
|
-
cleanExpiredJobs();
|
|
3747
|
-
const entry = exportJobs.get(jobId);
|
|
3748
|
-
if (!entry || entry.tenantId !== tenantId) return void 0;
|
|
3749
|
-
return entry.data;
|
|
3792
|
+
return { bundle, files };
|
|
3750
3793
|
}
|
|
3751
3794
|
/**
|
|
3752
3795
|
* Pack an ExportJobData into a tar.gz buffer.
|
|
@@ -4331,6 +4374,12 @@ function safeArchiveFilename(sourceTenantId) {
|
|
|
4331
4374
|
const safeTenantId = sourceTenantId.replace(/[^A-Za-z0-9._-]/g, "_");
|
|
4332
4375
|
return `tenant-export-${safeTenantId}.tar.gz`;
|
|
4333
4376
|
}
|
|
4377
|
+
async function sendArchive(reply, data) {
|
|
4378
|
+
const tarGz = await service.packTarGz(data);
|
|
4379
|
+
reply.type("application/gzip");
|
|
4380
|
+
reply.header("Content-Disposition", `attachment; filename="${safeArchiveFilename(data.bundle.sourceTenantId)}"`);
|
|
4381
|
+
reply.send(tarGz);
|
|
4382
|
+
}
|
|
4334
4383
|
function assertCompleteFile(file) {
|
|
4335
4384
|
if (file.truncated) {
|
|
4336
4385
|
throw new Error("Uploaded file was truncated because it exceeds the configured file size limit");
|
|
@@ -4418,30 +4467,14 @@ async function exportConfig(request, reply) {
|
|
|
4418
4467
|
}
|
|
4419
4468
|
});
|
|
4420
4469
|
}
|
|
4421
|
-
const
|
|
4422
|
-
return reply
|
|
4423
|
-
success: true,
|
|
4424
|
-
data: {
|
|
4425
|
-
jobId,
|
|
4426
|
-
summary: Object.fromEntries(
|
|
4427
|
-
Object.entries(data.bundle.entities).map(([type, entities]) => [type, entities.length])
|
|
4428
|
-
)
|
|
4429
|
-
}
|
|
4430
|
-
});
|
|
4470
|
+
const data = await service.export(tenantId, entityTypes, entityIds, getContext(request));
|
|
4471
|
+
return sendArchive(reply, data);
|
|
4431
4472
|
}
|
|
4432
4473
|
async function exportConfigConfirm(request, reply) {
|
|
4433
4474
|
const tenantId = resolveTenantId(request, request.params.tenantId);
|
|
4434
4475
|
const { entityTypes, entityIds } = request.body;
|
|
4435
|
-
const
|
|
4436
|
-
return reply
|
|
4437
|
-
success: true,
|
|
4438
|
-
data: {
|
|
4439
|
-
jobId,
|
|
4440
|
-
summary: Object.fromEntries(
|
|
4441
|
-
Object.entries(data.bundle.entities).map(([type, entities]) => [type, entities.length])
|
|
4442
|
-
)
|
|
4443
|
-
}
|
|
4444
|
-
});
|
|
4476
|
+
const data = await service.export(tenantId, entityTypes, entityIds, getContext(request));
|
|
4477
|
+
return sendArchive(reply, data);
|
|
4445
4478
|
}
|
|
4446
4479
|
async function previewEntities(request, reply) {
|
|
4447
4480
|
const tenantId = resolveTenantId(request, request.params.tenantId);
|
|
@@ -4464,18 +4497,6 @@ async function previewEntities(request, reply) {
|
|
|
4464
4497
|
return reply.status(400).send({ success: false, message: err.message });
|
|
4465
4498
|
}
|
|
4466
4499
|
}
|
|
4467
|
-
async function downloadExport(request, reply) {
|
|
4468
|
-
const tenantId = resolveTenantId(request, request.params.tenantId);
|
|
4469
|
-
const data = service.getExportJob(request.params.jobId, tenantId);
|
|
4470
|
-
if (!data) {
|
|
4471
|
-
return reply.status(404).send({ success: false, message: "Export job not found or expired" });
|
|
4472
|
-
}
|
|
4473
|
-
const tarGz = await service.packTarGz(data);
|
|
4474
|
-
const filename = safeArchiveFilename(data.bundle.sourceTenantId);
|
|
4475
|
-
reply.type("application/gzip");
|
|
4476
|
-
reply.header("Content-Disposition", `attachment; filename="${filename}"`);
|
|
4477
|
-
return reply.send(tarGz);
|
|
4478
|
-
}
|
|
4479
4500
|
async function importPreview(request, reply) {
|
|
4480
4501
|
const tenantId = resolveTenantId(request, request.params.tenantId);
|
|
4481
4502
|
try {
|
|
@@ -4892,7 +4913,15 @@ var getHealthSchema = {
|
|
|
4892
4913
|
timestamp: { type: "string" },
|
|
4893
4914
|
uptime: { type: "number" },
|
|
4894
4915
|
service: { type: "string" },
|
|
4895
|
-
version: { type: "string" }
|
|
4916
|
+
version: { type: "string" },
|
|
4917
|
+
readiness: {
|
|
4918
|
+
type: "object",
|
|
4919
|
+
properties: {
|
|
4920
|
+
multiReplicaDeclared: { type: "boolean" },
|
|
4921
|
+
ok: { type: "boolean" },
|
|
4922
|
+
warnings: { type: "array", items: { type: "string" } }
|
|
4923
|
+
}
|
|
4924
|
+
}
|
|
4896
4925
|
}
|
|
4897
4926
|
}
|
|
4898
4927
|
}
|
|
@@ -5238,7 +5267,7 @@ import * as fs2 from "fs/promises";
|
|
|
5238
5267
|
import * as path2 from "path";
|
|
5239
5268
|
import { constants as fsConstants } from "fs";
|
|
5240
5269
|
import * as os2 from "os";
|
|
5241
|
-
import { getStoreLattice as
|
|
5270
|
+
import { getStoreLattice as getStoreLattice7 } from "@axiom-lattice/core";
|
|
5242
5271
|
import { SandboxFilesystem, FilesystemBackend } from "@axiom-lattice/core";
|
|
5243
5272
|
import { getSandBoxManager as getSandBoxManager3 } from "@axiom-lattice/core";
|
|
5244
5273
|
import { v4 as uuidv4 } from "uuid";
|
|
@@ -5291,7 +5320,7 @@ var RoomCoordinatorProvisioner = class {
|
|
|
5291
5320
|
};
|
|
5292
5321
|
|
|
5293
5322
|
// src/services/collaboration/RoomCoordinatorEnsurer.ts
|
|
5294
|
-
import { randomUUID as
|
|
5323
|
+
import { randomUUID as randomUUID4 } from "crypto";
|
|
5295
5324
|
|
|
5296
5325
|
// src/services/collaboration/ProjectMutationMutex.ts
|
|
5297
5326
|
import {
|
|
@@ -5332,7 +5361,7 @@ var RoomCoordinatorEnsurer = class {
|
|
|
5332
5361
|
constructor(deps) {
|
|
5333
5362
|
this.deps = deps;
|
|
5334
5363
|
this.mutex = deps.mutationMutex ?? projectMutationMutex;
|
|
5335
|
-
this.idFactory = deps.idFactory ??
|
|
5364
|
+
this.idFactory = deps.idFactory ?? randomUUID4;
|
|
5336
5365
|
}
|
|
5337
5366
|
/**
|
|
5338
5367
|
* Ensures the coordinator membership for one room.
|
|
@@ -5417,7 +5446,7 @@ var NoopRoomBindingLifecycle = class {
|
|
|
5417
5446
|
|
|
5418
5447
|
// src/services/collaboration/WorkspacePublicRoomService.ts
|
|
5419
5448
|
import { createHash } from "crypto";
|
|
5420
|
-
import { randomUUID as
|
|
5449
|
+
import { randomUUID as randomUUID5 } from "crypto";
|
|
5421
5450
|
import { WORKSPACE_PUBLIC_ROOM_PROJECT_PREFIX } from "@axiom-lattice/protocols";
|
|
5422
5451
|
var PUBLIC_ROOM_PROJECT_NAME = "General";
|
|
5423
5452
|
var PUBLIC_ROOM_PROJECT_DESCRIPTION = "Public room for everyone in the workspace";
|
|
@@ -5429,7 +5458,7 @@ var WorkspacePublicRoomService = class {
|
|
|
5429
5458
|
/** Creates the service from explicitly injected stores and provisioners. */
|
|
5430
5459
|
constructor(deps) {
|
|
5431
5460
|
this.deps = deps;
|
|
5432
|
-
this.idFactory = deps.idFactory ??
|
|
5461
|
+
this.idFactory = deps.idFactory ?? randomUUID5;
|
|
5433
5462
|
}
|
|
5434
5463
|
/**
|
|
5435
5464
|
* Returns the workspace's public room project and room, creating them on first call.
|
|
@@ -5618,13 +5647,13 @@ function createProjectCollaborationInitializer(deps) {
|
|
|
5618
5647
|
var WorkspaceController = class {
|
|
5619
5648
|
constructor(projectCollaboration) {
|
|
5620
5649
|
this.projectCollaboration = projectCollaboration;
|
|
5621
|
-
this.workspaceStore =
|
|
5622
|
-
this.projectStore =
|
|
5623
|
-
const roomStore =
|
|
5624
|
-
const botMembershipStore =
|
|
5625
|
-
const assistantStore =
|
|
5626
|
-
const threadStore =
|
|
5627
|
-
const tenantStore =
|
|
5650
|
+
this.workspaceStore = getStoreLattice7("default", "workspace").store;
|
|
5651
|
+
this.projectStore = getStoreLattice7("default", "project").store;
|
|
5652
|
+
const roomStore = getStoreLattice7("default", "projectRoom").store;
|
|
5653
|
+
const botMembershipStore = getStoreLattice7("default", "projectBotMembership").store;
|
|
5654
|
+
const assistantStore = getStoreLattice7("default", "assistant").store;
|
|
5655
|
+
const threadStore = getStoreLattice7("default", "thread").store;
|
|
5656
|
+
const tenantStore = getStoreLattice7("default", "tenant").store;
|
|
5628
5657
|
const coordinatorProvisioner = new RoomCoordinatorProvisioner({
|
|
5629
5658
|
getAssistantById: assistantStore.getAssistantById.bind(assistantStore),
|
|
5630
5659
|
createAssistant: assistantStore.createAssistant.bind(assistantStore),
|
|
@@ -6594,7 +6623,7 @@ function registerWorkspaceRoutes(app2, projectCollaboration) {
|
|
|
6594
6623
|
}
|
|
6595
6624
|
|
|
6596
6625
|
// src/services/collaboration/ProjectAccessService.ts
|
|
6597
|
-
import { randomUUID as
|
|
6626
|
+
import { randomUUID as randomUUID6 } from "crypto";
|
|
6598
6627
|
var ProjectCollaborationError = class extends Error {
|
|
6599
6628
|
/** Creates a project collaboration error. */
|
|
6600
6629
|
constructor(code, statusCode, message) {
|
|
@@ -6620,7 +6649,7 @@ var ProjectAccessService = class {
|
|
|
6620
6649
|
/** Creates a project access service from explicitly injected stores. */
|
|
6621
6650
|
constructor(deps) {
|
|
6622
6651
|
this.deps = deps;
|
|
6623
|
-
this.idFactory = deps.idFactory ??
|
|
6652
|
+
this.idFactory = deps.idFactory ?? randomUUID6;
|
|
6624
6653
|
}
|
|
6625
6654
|
/** Returns the project and active membership when the user has the requested capability. */
|
|
6626
6655
|
async requireProjectAccess(input) {
|
|
@@ -6786,10 +6815,10 @@ var ProjectAccessService = class {
|
|
|
6786
6815
|
|
|
6787
6816
|
// src/controllers/database-configs.ts
|
|
6788
6817
|
import {
|
|
6789
|
-
getStoreLattice as
|
|
6818
|
+
getStoreLattice as getStoreLattice8,
|
|
6790
6819
|
sqlDatabaseManager
|
|
6791
6820
|
} from "@axiom-lattice/core";
|
|
6792
|
-
import { randomUUID as
|
|
6821
|
+
import { randomUUID as randomUUID7 } from "crypto";
|
|
6793
6822
|
function getTenantId8(request) {
|
|
6794
6823
|
const userTenantId = request.user?.tenantId;
|
|
6795
6824
|
if (userTenantId) {
|
|
@@ -6800,7 +6829,7 @@ function getTenantId8(request) {
|
|
|
6800
6829
|
async function getDatabaseConfigList(request, reply) {
|
|
6801
6830
|
const tenantId = getTenantId8(request);
|
|
6802
6831
|
try {
|
|
6803
|
-
const storeLattice =
|
|
6832
|
+
const storeLattice = getStoreLattice8("default", "database");
|
|
6804
6833
|
const store = storeLattice.store;
|
|
6805
6834
|
const configs = await store.getAllConfigs(tenantId);
|
|
6806
6835
|
console.log("Backend: getAllConfigs returned:", configs);
|
|
@@ -6831,7 +6860,7 @@ async function getDatabaseConfig(request, reply) {
|
|
|
6831
6860
|
const tenantId = getTenantId8(request);
|
|
6832
6861
|
const { key } = request.params;
|
|
6833
6862
|
try {
|
|
6834
|
-
const storeLattice =
|
|
6863
|
+
const storeLattice = getStoreLattice8("default", "database");
|
|
6835
6864
|
const store = storeLattice.store;
|
|
6836
6865
|
const config = await store.getConfigByKey(tenantId, key);
|
|
6837
6866
|
if (!config) {
|
|
@@ -6857,7 +6886,7 @@ async function createDatabaseConfig(request, reply) {
|
|
|
6857
6886
|
const tenantId = getTenantId8(request);
|
|
6858
6887
|
const body = request.body;
|
|
6859
6888
|
try {
|
|
6860
|
-
const storeLattice =
|
|
6889
|
+
const storeLattice = getStoreLattice8("default", "database");
|
|
6861
6890
|
const store = storeLattice.store;
|
|
6862
6891
|
const existing = await store.getConfigByKey(tenantId, body.key);
|
|
6863
6892
|
if (existing) {
|
|
@@ -6867,7 +6896,7 @@ async function createDatabaseConfig(request, reply) {
|
|
|
6867
6896
|
message: "Database configuration with this key already exists"
|
|
6868
6897
|
};
|
|
6869
6898
|
}
|
|
6870
|
-
const id3 = body.id ||
|
|
6899
|
+
const id3 = body.id || randomUUID7();
|
|
6871
6900
|
const config = await store.createConfig(tenantId, id3, body);
|
|
6872
6901
|
try {
|
|
6873
6902
|
sqlDatabaseManager.registerDatabase(tenantId, config.key, config.config);
|
|
@@ -6893,7 +6922,7 @@ async function updateDatabaseConfig(request, reply) {
|
|
|
6893
6922
|
const { key } = request.params;
|
|
6894
6923
|
const updates = request.body;
|
|
6895
6924
|
try {
|
|
6896
|
-
const storeLattice =
|
|
6925
|
+
const storeLattice = getStoreLattice8("default", "database");
|
|
6897
6926
|
const store = storeLattice.store;
|
|
6898
6927
|
const existing = await store.getConfigByKey(tenantId, key);
|
|
6899
6928
|
if (!existing) {
|
|
@@ -6934,7 +6963,7 @@ async function deleteDatabaseConfig(request, reply) {
|
|
|
6934
6963
|
const tenantId = getTenantId8(request);
|
|
6935
6964
|
const { keyOrId } = request.params;
|
|
6936
6965
|
try {
|
|
6937
|
-
const storeLattice =
|
|
6966
|
+
const storeLattice = getStoreLattice8("default", "database");
|
|
6938
6967
|
const store = storeLattice.store;
|
|
6939
6968
|
console.log("Delete request - keyOrId:", keyOrId);
|
|
6940
6969
|
let config = await store.getConfigByKey(tenantId, keyOrId);
|
|
@@ -6983,7 +7012,7 @@ async function testDatabaseConnection(request, reply) {
|
|
|
6983
7012
|
const tenantId = getTenantId8(request);
|
|
6984
7013
|
const { key } = request.params;
|
|
6985
7014
|
try {
|
|
6986
|
-
const storeLattice =
|
|
7015
|
+
const storeLattice = getStoreLattice8("default", "database");
|
|
6987
7016
|
const store = storeLattice.store;
|
|
6988
7017
|
const config = await store.getConfigByKey(tenantId, key);
|
|
6989
7018
|
if (!config) {
|
|
@@ -7068,11 +7097,11 @@ function registerDatabaseConfigRoutes(app2) {
|
|
|
7068
7097
|
|
|
7069
7098
|
// src/controllers/metrics-configs.ts
|
|
7070
7099
|
import {
|
|
7071
|
-
getStoreLattice as
|
|
7100
|
+
getStoreLattice as getStoreLattice9,
|
|
7072
7101
|
metricsServerManager as metricsServerManager2,
|
|
7073
7102
|
SemanticMetricsClient as SemanticMetricsClient2
|
|
7074
7103
|
} from "@axiom-lattice/core";
|
|
7075
|
-
import { randomUUID as
|
|
7104
|
+
import { randomUUID as randomUUID8 } from "crypto";
|
|
7076
7105
|
function getTenantId9(request) {
|
|
7077
7106
|
const userTenantId = request.user?.tenantId;
|
|
7078
7107
|
if (userTenantId) {
|
|
@@ -7083,7 +7112,7 @@ function getTenantId9(request) {
|
|
|
7083
7112
|
async function getMetricsServerConfigList(request, reply) {
|
|
7084
7113
|
const tenantId = getTenantId9(request);
|
|
7085
7114
|
try {
|
|
7086
|
-
const storeLattice =
|
|
7115
|
+
const storeLattice = getStoreLattice9("default", "metrics");
|
|
7087
7116
|
const store = storeLattice.store;
|
|
7088
7117
|
const configs = await store.getAllConfigs(tenantId);
|
|
7089
7118
|
return {
|
|
@@ -7110,7 +7139,7 @@ async function getMetricsServerConfig(request, reply) {
|
|
|
7110
7139
|
const tenantId = getTenantId9(request);
|
|
7111
7140
|
const { key } = request.params;
|
|
7112
7141
|
try {
|
|
7113
|
-
const storeLattice =
|
|
7142
|
+
const storeLattice = getStoreLattice9("default", "metrics");
|
|
7114
7143
|
const store = storeLattice.store;
|
|
7115
7144
|
const config = await store.getConfigByKey(tenantId, key);
|
|
7116
7145
|
if (!config) {
|
|
@@ -7136,7 +7165,7 @@ async function createMetricsServerConfig(request, reply) {
|
|
|
7136
7165
|
const tenantId = getTenantId9(request);
|
|
7137
7166
|
const body = request.body;
|
|
7138
7167
|
try {
|
|
7139
|
-
const storeLattice =
|
|
7168
|
+
const storeLattice = getStoreLattice9("default", "metrics");
|
|
7140
7169
|
const store = storeLattice.store;
|
|
7141
7170
|
const existing = await store.getConfigByKey(tenantId, body.key);
|
|
7142
7171
|
if (existing) {
|
|
@@ -7153,7 +7182,7 @@ async function createMetricsServerConfig(request, reply) {
|
|
|
7153
7182
|
message: "selectedDataSources is required for semantic metrics servers"
|
|
7154
7183
|
};
|
|
7155
7184
|
}
|
|
7156
|
-
const id3 = body.id ||
|
|
7185
|
+
const id3 = body.id || randomUUID8();
|
|
7157
7186
|
const configData = {
|
|
7158
7187
|
key: body.key,
|
|
7159
7188
|
name: body.name,
|
|
@@ -7188,7 +7217,7 @@ async function updateMetricsServerConfig(request, reply) {
|
|
|
7188
7217
|
const { key } = request.params;
|
|
7189
7218
|
const updates = request.body;
|
|
7190
7219
|
try {
|
|
7191
|
-
const storeLattice =
|
|
7220
|
+
const storeLattice = getStoreLattice9("default", "metrics");
|
|
7192
7221
|
const store = storeLattice.store;
|
|
7193
7222
|
const existing = await store.getConfigByKey(tenantId, key);
|
|
7194
7223
|
if (!existing) {
|
|
@@ -7238,7 +7267,7 @@ async function deleteMetricsServerConfig(request, reply) {
|
|
|
7238
7267
|
const tenantId = getTenantId9(request);
|
|
7239
7268
|
const { keyOrId } = request.params;
|
|
7240
7269
|
try {
|
|
7241
|
-
const storeLattice =
|
|
7270
|
+
const storeLattice = getStoreLattice9("default", "metrics");
|
|
7242
7271
|
const store = storeLattice.store;
|
|
7243
7272
|
let config = await store.getConfigByKey(tenantId, keyOrId);
|
|
7244
7273
|
let configKey = keyOrId;
|
|
@@ -7285,7 +7314,7 @@ async function testMetricsServerConnection(request, reply) {
|
|
|
7285
7314
|
const tenantId = getTenantId9(request);
|
|
7286
7315
|
const { key } = request.params;
|
|
7287
7316
|
try {
|
|
7288
|
-
const storeLattice =
|
|
7317
|
+
const storeLattice = getStoreLattice9("default", "metrics");
|
|
7289
7318
|
const store = storeLattice.store;
|
|
7290
7319
|
const config = await store.getConfigByKey(tenantId, key);
|
|
7291
7320
|
if (!config) {
|
|
@@ -7336,7 +7365,7 @@ async function listAvailableMetrics(request, reply) {
|
|
|
7336
7365
|
const tenantId = getTenantId9(request);
|
|
7337
7366
|
const { key } = request.params;
|
|
7338
7367
|
try {
|
|
7339
|
-
const storeLattice =
|
|
7368
|
+
const storeLattice = getStoreLattice9("default", "metrics");
|
|
7340
7369
|
const store = storeLattice.store;
|
|
7341
7370
|
const config = await store.getConfigByKey(tenantId, key);
|
|
7342
7371
|
if (!config) {
|
|
@@ -7375,7 +7404,7 @@ async function queryMetricsData(request, reply) {
|
|
|
7375
7404
|
const { key } = request.params;
|
|
7376
7405
|
const { metricName, startTime, endTime, step, labels } = request.body;
|
|
7377
7406
|
try {
|
|
7378
|
-
const storeLattice =
|
|
7407
|
+
const storeLattice = getStoreLattice9("default", "metrics");
|
|
7379
7408
|
const store = storeLattice.store;
|
|
7380
7409
|
const config = await store.getConfigByKey(tenantId, key);
|
|
7381
7410
|
if (!config) {
|
|
@@ -7422,7 +7451,7 @@ async function getDataSources(request, reply) {
|
|
|
7422
7451
|
const tenantId = getTenantId9(request);
|
|
7423
7452
|
const { key } = request.params;
|
|
7424
7453
|
try {
|
|
7425
|
-
const storeLattice =
|
|
7454
|
+
const storeLattice = getStoreLattice9("default", "metrics");
|
|
7426
7455
|
const store = storeLattice.store;
|
|
7427
7456
|
const config = await store.getConfigByKey(tenantId, key);
|
|
7428
7457
|
if (!config) {
|
|
@@ -7463,7 +7492,7 @@ async function getDatasourceMetrics(request, reply) {
|
|
|
7463
7492
|
const tenantId = getTenantId9(request);
|
|
7464
7493
|
const { key, datasourceId } = request.params;
|
|
7465
7494
|
try {
|
|
7466
|
-
const storeLattice =
|
|
7495
|
+
const storeLattice = getStoreLattice9("default", "metrics");
|
|
7467
7496
|
const store = storeLattice.store;
|
|
7468
7497
|
const config = await store.getConfigByKey(tenantId, key);
|
|
7469
7498
|
if (!config) {
|
|
@@ -7501,7 +7530,7 @@ async function querySemanticMetrics(request, reply) {
|
|
|
7501
7530
|
const { key } = request.params;
|
|
7502
7531
|
const body = request.body;
|
|
7503
7532
|
try {
|
|
7504
|
-
const storeLattice =
|
|
7533
|
+
const storeLattice = getStoreLattice9("default", "metrics");
|
|
7505
7534
|
const store = storeLattice.store;
|
|
7506
7535
|
const config = await store.getConfigByKey(tenantId, key);
|
|
7507
7536
|
if (!config) {
|
|
@@ -7810,13 +7839,13 @@ function connectionRoutes(fastify2) {
|
|
|
7810
7839
|
|
|
7811
7840
|
// src/controllers/mcp-configs.ts
|
|
7812
7841
|
import {
|
|
7813
|
-
getStoreLattice as
|
|
7842
|
+
getStoreLattice as getStoreLattice10,
|
|
7814
7843
|
getReplicaId as getReplicaId2,
|
|
7815
7844
|
mcpManager,
|
|
7816
7845
|
McpLatticeManager,
|
|
7817
7846
|
convertToConnection
|
|
7818
7847
|
} from "@axiom-lattice/core";
|
|
7819
|
-
import { randomUUID as
|
|
7848
|
+
import { randomUUID as randomUUID9 } from "crypto";
|
|
7820
7849
|
|
|
7821
7850
|
// src/services/mcpConfigSync.ts
|
|
7822
7851
|
var MCP_CONFIG_CHANGED_TOPIC = "mcp-config-changed";
|
|
@@ -7864,7 +7893,7 @@ function getTenantId10(request) {
|
|
|
7864
7893
|
function broadcastMcpConfigChanged(tenantId, serverKey) {
|
|
7865
7894
|
if (!tenantId || !serverKey) return;
|
|
7866
7895
|
try {
|
|
7867
|
-
const outbox =
|
|
7896
|
+
const outbox = getStoreLattice10("default", "outbox").store;
|
|
7868
7897
|
void publishMcpConfigChanged(outbox, getReplicaId2(), tenantId, serverKey);
|
|
7869
7898
|
} catch {
|
|
7870
7899
|
}
|
|
@@ -7872,7 +7901,7 @@ function broadcastMcpConfigChanged(tenantId, serverKey) {
|
|
|
7872
7901
|
async function getMcpServerConfigList(request, reply) {
|
|
7873
7902
|
const tenantId = getTenantId10(request);
|
|
7874
7903
|
try {
|
|
7875
|
-
const storeLattice =
|
|
7904
|
+
const storeLattice = getStoreLattice10("default", "mcp");
|
|
7876
7905
|
const store = storeLattice.store;
|
|
7877
7906
|
const configs = await store.getAllConfigs(tenantId);
|
|
7878
7907
|
return {
|
|
@@ -7899,7 +7928,7 @@ async function getMcpServerConfig(request, reply) {
|
|
|
7899
7928
|
const tenantId = getTenantId10(request);
|
|
7900
7929
|
const { key } = request.params;
|
|
7901
7930
|
try {
|
|
7902
|
-
const storeLattice =
|
|
7931
|
+
const storeLattice = getStoreLattice10("default", "mcp");
|
|
7903
7932
|
const store = storeLattice.store;
|
|
7904
7933
|
const config = await store.getConfigByKey(tenantId, key);
|
|
7905
7934
|
if (!config) {
|
|
@@ -7925,7 +7954,7 @@ async function createMcpServerConfig(request, reply) {
|
|
|
7925
7954
|
const tenantId = getTenantId10(request);
|
|
7926
7955
|
const body = request.body;
|
|
7927
7956
|
try {
|
|
7928
|
-
const storeLattice =
|
|
7957
|
+
const storeLattice = getStoreLattice10("default", "mcp");
|
|
7929
7958
|
const store = storeLattice.store;
|
|
7930
7959
|
const existing = await store.getConfigByKey(tenantId, body.key);
|
|
7931
7960
|
if (existing) {
|
|
@@ -7935,7 +7964,7 @@ async function createMcpServerConfig(request, reply) {
|
|
|
7935
7964
|
message: "MCP server configuration with this key already exists"
|
|
7936
7965
|
};
|
|
7937
7966
|
}
|
|
7938
|
-
const id3 = body.id ||
|
|
7967
|
+
const id3 = body.id || randomUUID9();
|
|
7939
7968
|
const config = await store.createConfig(tenantId, id3, body);
|
|
7940
7969
|
try {
|
|
7941
7970
|
await connectAndRegisterTools(config);
|
|
@@ -7966,7 +7995,7 @@ async function updateMcpServerConfig(request, reply) {
|
|
|
7966
7995
|
const { key } = request.params;
|
|
7967
7996
|
const updates = request.body;
|
|
7968
7997
|
try {
|
|
7969
|
-
const storeLattice =
|
|
7998
|
+
const storeLattice = getStoreLattice10("default", "mcp");
|
|
7970
7999
|
const store = storeLattice.store;
|
|
7971
8000
|
const existing = await store.getConfigByKey(tenantId, key);
|
|
7972
8001
|
if (!existing) {
|
|
@@ -8036,7 +8065,7 @@ async function deleteMcpServerConfig(request, reply) {
|
|
|
8036
8065
|
const tenantId = getTenantId10(request);
|
|
8037
8066
|
const { keyOrId } = request.params;
|
|
8038
8067
|
try {
|
|
8039
|
-
const storeLattice =
|
|
8068
|
+
const storeLattice = getStoreLattice10("default", "mcp");
|
|
8040
8069
|
const store = storeLattice.store;
|
|
8041
8070
|
let config = await store.getConfigByKey(tenantId, keyOrId);
|
|
8042
8071
|
let configKey = keyOrId;
|
|
@@ -8084,7 +8113,7 @@ async function testMcpServerConnection(request, reply) {
|
|
|
8084
8113
|
const tenantId = getTenantId10(request);
|
|
8085
8114
|
const { key } = request.params;
|
|
8086
8115
|
try {
|
|
8087
|
-
const storeLattice =
|
|
8116
|
+
const storeLattice = getStoreLattice10("default", "mcp");
|
|
8088
8117
|
const store = storeLattice.store;
|
|
8089
8118
|
const config = await store.getConfigByKey(tenantId, key);
|
|
8090
8119
|
if (!config) {
|
|
@@ -8132,7 +8161,7 @@ async function listMcpServerTools(request, reply) {
|
|
|
8132
8161
|
const tenantId = getTenantId10(request);
|
|
8133
8162
|
const { key } = request.params;
|
|
8134
8163
|
try {
|
|
8135
|
-
const storeLattice =
|
|
8164
|
+
const storeLattice = getStoreLattice10("default", "mcp");
|
|
8136
8165
|
const store = storeLattice.store;
|
|
8137
8166
|
const config = await store.getConfigByKey(tenantId, key);
|
|
8138
8167
|
if (!config) {
|
|
@@ -8173,7 +8202,7 @@ async function connectMcpServer(request, reply) {
|
|
|
8173
8202
|
const tenantId = getTenantId10(request);
|
|
8174
8203
|
const { key } = request.params;
|
|
8175
8204
|
try {
|
|
8176
|
-
const storeLattice =
|
|
8205
|
+
const storeLattice = getStoreLattice10("default", "mcp");
|
|
8177
8206
|
const store = storeLattice.store;
|
|
8178
8207
|
const config = await store.getConfigByKey(tenantId, key);
|
|
8179
8208
|
if (!config) {
|
|
@@ -8195,7 +8224,7 @@ async function connectMcpServer(request, reply) {
|
|
|
8195
8224
|
};
|
|
8196
8225
|
} catch (error) {
|
|
8197
8226
|
console.error("Failed to connect MCP server:", error);
|
|
8198
|
-
const storeLattice =
|
|
8227
|
+
const storeLattice = getStoreLattice10("default", "mcp");
|
|
8199
8228
|
const store = storeLattice.store;
|
|
8200
8229
|
const config = await store.getConfigByKey(tenantId, key);
|
|
8201
8230
|
if (config) {
|
|
@@ -8212,7 +8241,7 @@ async function disconnectMcpServer(request, reply) {
|
|
|
8212
8241
|
const tenantId = getTenantId10(request);
|
|
8213
8242
|
const { key } = request.params;
|
|
8214
8243
|
try {
|
|
8215
|
-
const storeLattice =
|
|
8244
|
+
const storeLattice = getStoreLattice10("default", "mcp");
|
|
8216
8245
|
const store = storeLattice.store;
|
|
8217
8246
|
const config = await store.getConfigByKey(tenantId, key);
|
|
8218
8247
|
if (!config) {
|
|
@@ -8360,6 +8389,17 @@ var UiResourceResolver = class {
|
|
|
8360
8389
|
async invalidate(tenantId, ref) {
|
|
8361
8390
|
await this.deps.store.delete(this.fullKey(tenantId, ref));
|
|
8362
8391
|
}
|
|
8392
|
+
/**
|
|
8393
|
+
* Evict every cached plugin UI resource for a tenant.
|
|
8394
|
+
*
|
|
8395
|
+
* @param tenantId Tenant whose plugin UI resources to drop.
|
|
8396
|
+
* @remarks Called when a tenant's plugin catalog changes so an edited
|
|
8397
|
+
* `ui/*.html` is re-fetched instead of being served from the TTL cache
|
|
8398
|
+
* (which is keyed by ref identity, not content).
|
|
8399
|
+
*/
|
|
8400
|
+
async invalidateTenantPlugins(tenantId) {
|
|
8401
|
+
await this.deps.store.deleteByPrefix(`${tenantId}\0plugin\0`);
|
|
8402
|
+
}
|
|
8363
8403
|
async fetchAndCache(tenantId, ref, key, cached) {
|
|
8364
8404
|
try {
|
|
8365
8405
|
const fresh = ref.kind === "mcp" ? await this.deps.fetchMcp(tenantId, ref.serverKey, ref.resourceUri) : await this.deps.fetchPlugin(tenantId, ref.pluginType, ref.resource);
|
|
@@ -8684,12 +8724,17 @@ function createDefaultPluginBackend() {
|
|
|
8684
8724
|
}
|
|
8685
8725
|
};
|
|
8686
8726
|
}
|
|
8727
|
+
var uiResourceResolverSingleton;
|
|
8728
|
+
function getMcpUiResourceResolver() {
|
|
8729
|
+
return uiResourceResolverSingleton;
|
|
8730
|
+
}
|
|
8687
8731
|
function resolveMcpAppDeps(pluginBackend = createDefaultPluginBackend()) {
|
|
8688
8732
|
const uiResourceResolver = new UiResourceResolver({
|
|
8689
8733
|
store: new InMemoryMcpUiResourceCacheStore(),
|
|
8690
8734
|
fetchMcp: (tenantId, serverKey, resourceUri) => mcpManager2.readUiResource(tenantId, serverKey, resourceUri),
|
|
8691
8735
|
fetchPlugin: (tenantId, pluginType, resource) => fetchPluginUiResource(pluginBackend, tenantId, pluginType, resource)
|
|
8692
8736
|
});
|
|
8737
|
+
uiResourceResolverSingleton = uiResourceResolver;
|
|
8693
8738
|
return {
|
|
8694
8739
|
resolveUiResource: (tenantId, ref) => uiResourceResolver.resolve(tenantId, ref),
|
|
8695
8740
|
callTool: (tenantId, ref, name, args, context) => ref.kind === "mcp" ? mcpManager2.callServerTool(tenantId, ref.serverKey, name, args) : callPluginTool(pluginBackend, tenantId, ref, name, args, context),
|
|
@@ -8741,13 +8786,13 @@ function registerMcpAppRoutes(fastify2) {
|
|
|
8741
8786
|
}
|
|
8742
8787
|
|
|
8743
8788
|
// src/controllers/eval.ts
|
|
8744
|
-
import { getStoreLattice as
|
|
8789
|
+
import { getStoreLattice as getStoreLattice12, hasModelLatticeForTenant as hasModelLatticeForTenant2, modelLatticeManager as modelLatticeManager2 } from "@axiom-lattice/core";
|
|
8745
8790
|
import { v4 as uuidv43 } from "uuid";
|
|
8746
8791
|
|
|
8747
8792
|
// src/services/eval-runner.ts
|
|
8748
8793
|
import { EventEmitter } from "events";
|
|
8749
8794
|
import {
|
|
8750
|
-
getStoreLattice as
|
|
8795
|
+
getStoreLattice as getStoreLattice11,
|
|
8751
8796
|
hasModelLatticeForTenant,
|
|
8752
8797
|
listModelLatticesForTenant,
|
|
8753
8798
|
LatticeEvalProject
|
|
@@ -9078,7 +9123,7 @@ var EvalRunner = class {
|
|
|
9078
9123
|
return ctx !== void 0 && !ctx.terminal.workerSettled && (tenantId === void 0 || ctx.tenantId === tenantId);
|
|
9079
9124
|
}
|
|
9080
9125
|
getEvalStore() {
|
|
9081
|
-
return
|
|
9126
|
+
return getStoreLattice11("default", "eval").store;
|
|
9082
9127
|
}
|
|
9083
9128
|
releaseProjectLease(leaseKey, leaseToken) {
|
|
9084
9129
|
if (this.projectLeases.get(leaseKey) === leaseToken) this.projectLeases.delete(leaseKey);
|
|
@@ -9095,7 +9140,7 @@ function getTenantId11(request) {
|
|
|
9095
9140
|
return request.headers["x-tenant-id"] || "default";
|
|
9096
9141
|
}
|
|
9097
9142
|
function getEvalStore() {
|
|
9098
|
-
return
|
|
9143
|
+
return getStoreLattice12("default", "eval").store;
|
|
9099
9144
|
}
|
|
9100
9145
|
async function getOwnedSuite(store, tenantId, projectId, suiteId) {
|
|
9101
9146
|
const project = await store.getProjectById(tenantId, projectId);
|
|
@@ -9622,11 +9667,11 @@ data: ${JSON.stringify(event.data)}
|
|
|
9622
9667
|
}
|
|
9623
9668
|
|
|
9624
9669
|
// src/controllers/users.ts
|
|
9625
|
-
import { getStoreLattice as
|
|
9670
|
+
import { getStoreLattice as getStoreLattice13 } from "@axiom-lattice/core";
|
|
9626
9671
|
import { v4 as uuidv44 } from "uuid";
|
|
9627
9672
|
var UsersController = class {
|
|
9628
9673
|
constructor() {
|
|
9629
|
-
this.userStore =
|
|
9674
|
+
this.userStore = getStoreLattice13("default", "user").store;
|
|
9630
9675
|
}
|
|
9631
9676
|
async listUsers(request, reply) {
|
|
9632
9677
|
const { email } = request.query;
|
|
@@ -9704,11 +9749,11 @@ function registerUserRoutes(app2) {
|
|
|
9704
9749
|
}
|
|
9705
9750
|
|
|
9706
9751
|
// src/controllers/tenants.ts
|
|
9707
|
-
import { getStoreLattice as
|
|
9752
|
+
import { getStoreLattice as getStoreLattice14 } from "@axiom-lattice/core";
|
|
9708
9753
|
import { v4 as uuidv45 } from "uuid";
|
|
9709
9754
|
var TenantsController = class {
|
|
9710
9755
|
constructor() {
|
|
9711
|
-
this.tenantStore =
|
|
9756
|
+
this.tenantStore = getStoreLattice14("default", "tenant").store;
|
|
9712
9757
|
}
|
|
9713
9758
|
// ==================== Tenant CRUD ====================
|
|
9714
9759
|
async listTenants(request, reply) {
|
|
@@ -9772,7 +9817,7 @@ function registerTenantRoutes(app2) {
|
|
|
9772
9817
|
}
|
|
9773
9818
|
|
|
9774
9819
|
// src/controllers/auth.ts
|
|
9775
|
-
import { getStoreLattice as
|
|
9820
|
+
import { getStoreLattice as getStoreLattice15 } from "@axiom-lattice/core";
|
|
9776
9821
|
import { v4 as uuidv46 } from "uuid";
|
|
9777
9822
|
import { createHmac, randomBytes, timingSafeEqual } from "crypto";
|
|
9778
9823
|
var defaultAuthConfig = {
|
|
@@ -9782,9 +9827,9 @@ var defaultAuthConfig = {
|
|
|
9782
9827
|
};
|
|
9783
9828
|
var AuthController = class {
|
|
9784
9829
|
constructor(config = {}) {
|
|
9785
|
-
this.userStore =
|
|
9786
|
-
this.tenantStore =
|
|
9787
|
-
this.userTenantLinkStore =
|
|
9830
|
+
this.userStore = getStoreLattice15("default", "user").store;
|
|
9831
|
+
this.tenantStore = getStoreLattice15("default", "tenant").store;
|
|
9832
|
+
this.userTenantLinkStore = getStoreLattice15("default", "userTenantLink").store;
|
|
9788
9833
|
this.config = { ...defaultAuthConfig, ...config };
|
|
9789
9834
|
}
|
|
9790
9835
|
async register(request, reply) {
|
|
@@ -9943,7 +9988,7 @@ var AuthController = class {
|
|
|
9943
9988
|
const linkMeta = link?.metadata || {};
|
|
9944
9989
|
let personalAssistant = null;
|
|
9945
9990
|
if (linkMeta.personalAssistantId) {
|
|
9946
|
-
const assistantStore =
|
|
9991
|
+
const assistantStore = getStoreLattice15("default", "assistant").store;
|
|
9947
9992
|
const exists = await assistantStore.hasAssistant(tenantId, linkMeta.personalAssistantId);
|
|
9948
9993
|
if (exists) {
|
|
9949
9994
|
personalAssistant = {
|
|
@@ -10635,11 +10680,11 @@ function registerChannelRoutes(app2, dependencies) {
|
|
|
10635
10680
|
}
|
|
10636
10681
|
|
|
10637
10682
|
// src/controllers/channel-installations.ts
|
|
10638
|
-
import { randomUUID as
|
|
10683
|
+
import { randomUUID as randomUUID10 } from "crypto";
|
|
10639
10684
|
import {
|
|
10640
10685
|
descriptorDataValue
|
|
10641
10686
|
} from "@axiom-lattice/protocols";
|
|
10642
|
-
import { getStoreLattice as
|
|
10687
|
+
import { getStoreLattice as getStoreLattice16 } from "@axiom-lattice/core";
|
|
10643
10688
|
var _adapterRegistry;
|
|
10644
10689
|
var _router;
|
|
10645
10690
|
function setChannelControllerDeps(deps) {
|
|
@@ -10770,7 +10815,7 @@ function snapshotPlainObject(value) {
|
|
|
10770
10815
|
}
|
|
10771
10816
|
}
|
|
10772
10817
|
async function getInstallationStore() {
|
|
10773
|
-
const store =
|
|
10818
|
+
const store = getStoreLattice16("default", "channelInstallation").store;
|
|
10774
10819
|
if (store) return store;
|
|
10775
10820
|
const { PostgreSQLChannelInstallationStore } = await import("@axiom-lattice/pg-stores");
|
|
10776
10821
|
const databaseUrl = process.env.DATABASE_URL;
|
|
@@ -10846,7 +10891,7 @@ async function createChannelInstallation(request, reply) {
|
|
|
10846
10891
|
};
|
|
10847
10892
|
}
|
|
10848
10893
|
const store = await getInstallationStore();
|
|
10849
|
-
const installationId =
|
|
10894
|
+
const installationId = randomUUID10();
|
|
10850
10895
|
const createInput = {
|
|
10851
10896
|
channel: body.channel,
|
|
10852
10897
|
name: body.name,
|
|
@@ -11089,7 +11134,7 @@ import {
|
|
|
11089
11134
|
DuplicateChannelBindingSubjectError,
|
|
11090
11135
|
descriptorDataValue as descriptorDataValue2
|
|
11091
11136
|
} from "@axiom-lattice/protocols";
|
|
11092
|
-
import { getBindingRegistry, getStoreLattice as
|
|
11137
|
+
import { getBindingRegistry, getStoreLattice as getStoreLattice17 } from "@axiom-lattice/core";
|
|
11093
11138
|
function getTenantId13(request) {
|
|
11094
11139
|
const userTenantId = request.user?.tenantId;
|
|
11095
11140
|
if (typeof userTenantId === "string" && userTenantId) return userTenantId;
|
|
@@ -11147,7 +11192,7 @@ function snapshotPublicUpdate(value) {
|
|
|
11147
11192
|
return body;
|
|
11148
11193
|
}
|
|
11149
11194
|
function getInstallationStore2() {
|
|
11150
|
-
return
|
|
11195
|
+
return getStoreLattice17("default", "channelInstallation").store;
|
|
11151
11196
|
}
|
|
11152
11197
|
async function isValidPublicInstallation(tenantId, channelInstallationId, channel) {
|
|
11153
11198
|
const installation = await getInstallationStore2().getInstallationById(channelInstallationId);
|
|
@@ -11647,7 +11692,7 @@ var registerSTTRoutes = (app2) => {
|
|
|
11647
11692
|
};
|
|
11648
11693
|
|
|
11649
11694
|
// src/controllers/local-a2a.ts
|
|
11650
|
-
import { getStoreLattice as
|
|
11695
|
+
import { getStoreLattice as getStoreLattice18 } from "@axiom-lattice/core";
|
|
11651
11696
|
import {
|
|
11652
11697
|
AgentType as AgentType2
|
|
11653
11698
|
} from "@axiom-lattice/protocols";
|
|
@@ -11663,7 +11708,7 @@ function getLocalRuntime(assistant) {
|
|
|
11663
11708
|
return graphDefinition.localRuntime;
|
|
11664
11709
|
}
|
|
11665
11710
|
async function getLocalA2AAssistants(tenantId) {
|
|
11666
|
-
const storeLattice =
|
|
11711
|
+
const storeLattice = getStoreLattice18("default", "assistant");
|
|
11667
11712
|
const assistants = await storeLattice.store.getAllAssistants(tenantId);
|
|
11668
11713
|
const results = [];
|
|
11669
11714
|
for (const assistant of assistants) {
|
|
@@ -11675,7 +11720,7 @@ async function getLocalA2AAssistants(tenantId) {
|
|
|
11675
11720
|
return results;
|
|
11676
11721
|
}
|
|
11677
11722
|
async function getLocalA2AAssistant(tenantId, assistantId) {
|
|
11678
|
-
const storeLattice =
|
|
11723
|
+
const storeLattice = getStoreLattice18("default", "assistant");
|
|
11679
11724
|
const assistant = await storeLattice.store.getAssistantById(tenantId, assistantId);
|
|
11680
11725
|
if (!assistant) return null;
|
|
11681
11726
|
const runtime = getLocalRuntime(assistant);
|
|
@@ -11806,7 +11851,7 @@ async function getLocalA2ATemplates(_request, reply) {
|
|
|
11806
11851
|
}
|
|
11807
11852
|
|
|
11808
11853
|
// src/routes/a2a-test-connection.ts
|
|
11809
|
-
import { randomUUID as
|
|
11854
|
+
import { randomUUID as randomUUID11 } from "crypto";
|
|
11810
11855
|
function describeTestConnectionError(error, agentCardUrl) {
|
|
11811
11856
|
if (!(error instanceof Error)) {
|
|
11812
11857
|
return `Failed to fetch agent card from ${agentCardUrl}: ${String(error)}`;
|
|
@@ -11846,7 +11891,7 @@ async function ensureLocalRuntimeForConnectionTest(localRuntime, agentCardUrl) {
|
|
|
11846
11891
|
return { error: portValidation.error };
|
|
11847
11892
|
}
|
|
11848
11893
|
const state = await localA2AService.startProvider(
|
|
11849
|
-
`test-${
|
|
11894
|
+
`test-${randomUUID11()}`,
|
|
11850
11895
|
testRuntime
|
|
11851
11896
|
);
|
|
11852
11897
|
if (state.status === "running") return { runtimeId: state.runtimeId };
|
|
@@ -11925,7 +11970,7 @@ import {
|
|
|
11925
11970
|
createTrustedAgentMessageDispatcher,
|
|
11926
11971
|
executionAuthorityRegistry,
|
|
11927
11972
|
getReplicaId as getReplicaId6,
|
|
11928
|
-
getStoreLattice as
|
|
11973
|
+
getStoreLattice as getStoreLattice19,
|
|
11929
11974
|
hasModelLatticeForTenant as hasModelLatticeForTenant3,
|
|
11930
11975
|
ManagedTaskStartError,
|
|
11931
11976
|
modelLatticeManager as modelLatticeManager3,
|
|
@@ -12261,7 +12306,7 @@ function snapshotEnsureInput(input) {
|
|
|
12261
12306
|
import { createHash as createHash3 } from "crypto";
|
|
12262
12307
|
|
|
12263
12308
|
// src/services/collaboration/ProjectTaskExecutionService.ts
|
|
12264
|
-
import { randomUUID as
|
|
12309
|
+
import { randomUUID as randomUUID12 } from "crypto";
|
|
12265
12310
|
import {
|
|
12266
12311
|
createTaskRunBridge,
|
|
12267
12312
|
ThreadStatus as ThreadStatus3
|
|
@@ -12724,7 +12769,7 @@ var ProjectTaskExecutionService = class {
|
|
|
12724
12769
|
return current;
|
|
12725
12770
|
}
|
|
12726
12771
|
async dispatchRun(task, thread, mode, rosterExempt, signal, options) {
|
|
12727
|
-
const messageId = (this.options.idFactory ??
|
|
12772
|
+
const messageId = (this.options.idFactory ?? randomUUID12)();
|
|
12728
12773
|
if (signal?.aborted) return this.compensateCancellation(task, thread, messageId, false);
|
|
12729
12774
|
const armed = await this.armAndEnqueue(task, thread, mode, messageId, rosterExempt, signal, options);
|
|
12730
12775
|
if (armed.cancelled) return this.cancelSettlement(armed.settlement, task, thread, messageId, false);
|
|
@@ -12781,7 +12826,7 @@ var ProjectTaskExecutionService = class {
|
|
|
12781
12826
|
* phantom in-progress run is left behind.
|
|
12782
12827
|
*/
|
|
12783
12828
|
async enqueueDetached(task, thread, mode, rosterExempt, options) {
|
|
12784
|
-
const messageId = (this.options.idFactory ??
|
|
12829
|
+
const messageId = (this.options.idFactory ?? randomUUID12)();
|
|
12785
12830
|
const armed = await this.armAndEnqueue(task, thread, mode, messageId, rosterExempt, void 0, options);
|
|
12786
12831
|
void armed.settlement.promise.catch(() => void 0);
|
|
12787
12832
|
if (!armed.queued) {
|
|
@@ -14251,7 +14296,7 @@ import { createHmac as createHmac3 } from "crypto";
|
|
|
14251
14296
|
import { z as z5, ZodError as ZodError2 } from "zod";
|
|
14252
14297
|
|
|
14253
14298
|
// src/services/agent-web-app/AgentWebAppRuntimeService.ts
|
|
14254
|
-
import { createHash as createHash4, randomUUID as
|
|
14299
|
+
import { createHash as createHash4, randomUUID as randomUUID13 } from "crypto";
|
|
14255
14300
|
import { MessageChunkTypes as MessageChunkTypes3, parseAgentWebAppGenUIBlock, buildAffinityMissChunk as buildAffinityMissChunk2 } from "@axiom-lattice/protocols";
|
|
14256
14301
|
import { getReplicaId as getReplicaId3, getThreadRunOwner as getThreadRunOwner2 } from "@axiom-lattice/core";
|
|
14257
14302
|
function isRecord2(value) {
|
|
@@ -14470,7 +14515,7 @@ ${formatFileRefsSection(refs)}` : input.content;
|
|
|
14470
14515
|
const userDigest = createHash4("sha256").update(userId, "utf8").digest("hex");
|
|
14471
14516
|
const contentDigest = createHash4("sha256").update(file.bytes).digest("hex");
|
|
14472
14517
|
const displayName = file.name;
|
|
14473
|
-
const physicalName = `${
|
|
14518
|
+
const physicalName = `${randomUUID13()}-${sanitizePhysicalFilename(file.name)}`;
|
|
14474
14519
|
const saved = await this.deps.saveProjectFile({
|
|
14475
14520
|
tenantId: runtime.webApp.tenantId,
|
|
14476
14521
|
workspaceId: runtime.project.workspaceId,
|
|
@@ -14622,7 +14667,7 @@ ${formatFileRefsSection(refs)}` : input.content;
|
|
|
14622
14667
|
const thread = await this.deps.threadStore.createThread(
|
|
14623
14668
|
runtime.webApp.tenantId,
|
|
14624
14669
|
runtime.webApp.assistantId,
|
|
14625
|
-
|
|
14670
|
+
randomUUID13(),
|
|
14626
14671
|
{ metadata: this.metadata(runtime, userId, normalizeLabel(rawLabel)) }
|
|
14627
14672
|
);
|
|
14628
14673
|
return toRuntimeThread(thread);
|
|
@@ -15884,7 +15929,7 @@ function registerCapabilityBundleRoutes(app2, controller) {
|
|
|
15884
15929
|
import { ZodError as ZodError3 } from "zod";
|
|
15885
15930
|
|
|
15886
15931
|
// src/services/model-provider/ModelProviderService.ts
|
|
15887
|
-
import { randomUUID as
|
|
15932
|
+
import { randomUUID as randomUUID14 } from "crypto";
|
|
15888
15933
|
import { toModelKey } from "@axiom-lattice/protocols";
|
|
15889
15934
|
import {
|
|
15890
15935
|
assertSafeUpstreamUrl,
|
|
@@ -16102,7 +16147,7 @@ var unsafeReasonToErrorCode = {
|
|
|
16102
16147
|
var ModelProviderService = class {
|
|
16103
16148
|
constructor(deps) {
|
|
16104
16149
|
this.deps = deps;
|
|
16105
|
-
this.idFactory = deps.idFactory ?? (() =>
|
|
16150
|
+
this.idFactory = deps.idFactory ?? (() => randomUUID14());
|
|
16106
16151
|
}
|
|
16107
16152
|
/**
|
|
16108
16153
|
* List the tenant's provider configurations.
|
|
@@ -17167,12 +17212,12 @@ async function handleModelProviderChanged(payload, reconcile) {
|
|
|
17167
17212
|
}
|
|
17168
17213
|
|
|
17169
17214
|
// src/services/collaboration/ProjectRoomService.ts
|
|
17170
|
-
import { randomUUID as
|
|
17215
|
+
import { randomUUID as randomUUID15 } from "crypto";
|
|
17171
17216
|
var ProjectRoomService = class {
|
|
17172
17217
|
/** Creates a project room service from explicitly injected collaborators. */
|
|
17173
17218
|
constructor(deps) {
|
|
17174
17219
|
this.deps = deps;
|
|
17175
|
-
this.idFactory = deps.idFactory ??
|
|
17220
|
+
this.idFactory = deps.idFactory ?? randomUUID15;
|
|
17176
17221
|
}
|
|
17177
17222
|
/**
|
|
17178
17223
|
* Authorizes read access and ensures the project's main room.
|
|
@@ -17232,7 +17277,7 @@ var ProjectRoomService = class {
|
|
|
17232
17277
|
};
|
|
17233
17278
|
|
|
17234
17279
|
// src/services/collaboration/ProjectMembershipService.ts
|
|
17235
|
-
import { randomUUID as
|
|
17280
|
+
import { randomUUID as randomUUID16 } from "crypto";
|
|
17236
17281
|
var ProjectMembershipServiceError = class extends Error {
|
|
17237
17282
|
constructor(code, statusCode, message) {
|
|
17238
17283
|
super(message);
|
|
@@ -17248,7 +17293,7 @@ function isMembershipConflict(error) {
|
|
|
17248
17293
|
var ProjectMembershipService = class {
|
|
17249
17294
|
constructor(deps) {
|
|
17250
17295
|
this.deps = deps;
|
|
17251
|
-
this.idFactory = deps.idFactory ??
|
|
17296
|
+
this.idFactory = deps.idFactory ?? randomUUID16;
|
|
17252
17297
|
this.mutationMutex = deps.projectMutationMutex ?? projectMutationMutex;
|
|
17253
17298
|
}
|
|
17254
17299
|
async list(actor3) {
|
|
@@ -17382,7 +17427,7 @@ var ProjectMembershipService = class {
|
|
|
17382
17427
|
};
|
|
17383
17428
|
|
|
17384
17429
|
// src/services/collaboration/ProjectRosterService.ts
|
|
17385
|
-
import { randomUUID as
|
|
17430
|
+
import { randomUUID as randomUUID17 } from "crypto";
|
|
17386
17431
|
var ProjectRosterServiceError = class extends Error {
|
|
17387
17432
|
/** Creates a stable roster service error. */
|
|
17388
17433
|
constructor(code, statusCode, message) {
|
|
@@ -17401,7 +17446,7 @@ var ProjectRosterService = class {
|
|
|
17401
17446
|
/** Creates a roster service from explicitly injected collaborators. */
|
|
17402
17447
|
constructor(deps) {
|
|
17403
17448
|
this.deps = deps;
|
|
17404
|
-
this.idFactory = deps.idFactory ??
|
|
17449
|
+
this.idFactory = deps.idFactory ?? randomUUID17;
|
|
17405
17450
|
this.mutationMutex = deps.projectMutationMutex ?? projectMutationMutex;
|
|
17406
17451
|
}
|
|
17407
17452
|
/**
|
|
@@ -17508,7 +17553,7 @@ var ProjectRosterService = class {
|
|
|
17508
17553
|
const agent = (await this.deps.agents.list(actor3.tenantId, actor3.userId)).find((item) => item.assistantId === assistantId);
|
|
17509
17554
|
if (!agent || agent.ownerUserId !== void 0) throw new ProjectRosterServiceError("ASSISTANT_NOT_FOUND", 404, "Agent not found");
|
|
17510
17555
|
const room = await this.deps.roomStore.ensureMainRoom({
|
|
17511
|
-
id:
|
|
17556
|
+
id: randomUUID17(),
|
|
17512
17557
|
tenantId: actor3.tenantId,
|
|
17513
17558
|
workspaceId: project.workspaceId,
|
|
17514
17559
|
projectId: actor3.projectId,
|
|
@@ -17852,7 +17897,7 @@ function virtualPublicProjectBot(project, room, agent, mentionName, now) {
|
|
|
17852
17897
|
}
|
|
17853
17898
|
|
|
17854
17899
|
// src/services/collaboration/RoomMessageService.ts
|
|
17855
|
-
import { createHash as createHash6, randomUUID as
|
|
17900
|
+
import { createHash as createHash6, randomUUID as randomUUID18 } from "crypto";
|
|
17856
17901
|
|
|
17857
17902
|
// src/services/collaboration/ProjectBotMembershipSnapshot.ts
|
|
17858
17903
|
import { snapshotExactRecord as snapshotExactRecord5 } from "@axiom-lattice/protocols";
|
|
@@ -17941,7 +17986,7 @@ var RoomMessageService = class {
|
|
|
17941
17986
|
constructor(deps, options = {}) {
|
|
17942
17987
|
this.deps = deps;
|
|
17943
17988
|
this.idempotentOutcomes = /* @__PURE__ */ new Map();
|
|
17944
|
-
this.idFactory = deps.idFactory ??
|
|
17989
|
+
this.idFactory = deps.idFactory ?? randomUUID18;
|
|
17945
17990
|
const limit = options.idempotentOutcomeLimit ?? 1e3;
|
|
17946
17991
|
if (!Number.isSafeInteger(limit) || limit < 1) throw new RangeError("idempotentOutcomeLimit must be a positive safe integer");
|
|
17947
17992
|
this.idempotentOutcomeLimit = limit;
|
|
@@ -18227,7 +18272,7 @@ import { ZodError as ZodError4 } from "zod";
|
|
|
18227
18272
|
import { toProjectRoomPublicMessage } from "@axiom-lattice/protocols";
|
|
18228
18273
|
|
|
18229
18274
|
// src/services/collaboration/RoomInterruptService.ts
|
|
18230
|
-
import { randomUUID as
|
|
18275
|
+
import { randomUUID as randomUUID19 } from "crypto";
|
|
18231
18276
|
var RESUMABLE_TASK_INTERRUPT_CODES = /* @__PURE__ */ new Set([
|
|
18232
18277
|
"PROJECT_TASK_NOT_RESUMABLE",
|
|
18233
18278
|
"PROJECT_TASK_NOT_READY",
|
|
@@ -18248,7 +18293,7 @@ var RoomInterruptService = class {
|
|
|
18248
18293
|
/** Creates the service from explicitly injected stores and dispatcher. */
|
|
18249
18294
|
constructor(deps) {
|
|
18250
18295
|
this.deps = deps;
|
|
18251
|
-
this.idFactory = deps.idFactory ??
|
|
18296
|
+
this.idFactory = deps.idFactory ?? randomUUID19;
|
|
18252
18297
|
}
|
|
18253
18298
|
/** Resolves a pending clarify interrupt with no answers. */
|
|
18254
18299
|
async skip(input) {
|
|
@@ -18572,7 +18617,7 @@ async function execute(reply, operation) {
|
|
|
18572
18617
|
}
|
|
18573
18618
|
|
|
18574
18619
|
// src/routes/cospace.ts
|
|
18575
|
-
import { randomUUID as
|
|
18620
|
+
import { randomUUID as randomUUID20 } from "crypto";
|
|
18576
18621
|
import { ZodError as ZodError6 } from "zod";
|
|
18577
18622
|
import {
|
|
18578
18623
|
generateDirectHumanProjectId,
|
|
@@ -18606,7 +18651,7 @@ async function computeUnread(deps, tenantId, userId, roomId, lastMessage) {
|
|
|
18606
18651
|
});
|
|
18607
18652
|
}
|
|
18608
18653
|
function registerCoSpaceRoutes(app2, deps) {
|
|
18609
|
-
const idFactory = deps.idFactory ?? (() =>
|
|
18654
|
+
const idFactory = deps.idFactory ?? (() => randomUUID20());
|
|
18610
18655
|
app2.get(
|
|
18611
18656
|
"/api/workspaces/:workspaceId/rooms",
|
|
18612
18657
|
async (request, reply) => {
|
|
@@ -19573,7 +19618,7 @@ function exactValues(value, required, optional = []) {
|
|
|
19573
19618
|
}
|
|
19574
19619
|
|
|
19575
19620
|
// src/services/collaboration/CoordinatorWakeNotifier.ts
|
|
19576
|
-
import { randomUUID as
|
|
19621
|
+
import { randomUUID as randomUUID21 } from "crypto";
|
|
19577
19622
|
import {
|
|
19578
19623
|
snapshotExactRecord as snapshotExactRecord7
|
|
19579
19624
|
} from "@axiom-lattice/protocols";
|
|
@@ -19589,7 +19634,7 @@ var CoordinatorWakeNotifier = class {
|
|
|
19589
19634
|
this.accepted = /* @__PURE__ */ new Set();
|
|
19590
19635
|
this.maxPending = deps.maxPending ?? 1024;
|
|
19591
19636
|
if (!Number.isSafeInteger(this.maxPending) || this.maxPending < 1) throw new RangeError("maxPending must be a positive safe integer");
|
|
19592
|
-
this.idFactory = deps.idFactory ??
|
|
19637
|
+
this.idFactory = deps.idFactory ?? randomUUID21;
|
|
19593
19638
|
}
|
|
19594
19639
|
/** Admits one notification without awaiting any store or dispatch operation. */
|
|
19595
19640
|
handle(value, anchorMessageId) {
|
|
@@ -21259,7 +21304,7 @@ function isRecord3(value) {
|
|
|
21259
21304
|
import { taskLifecycleNotifier } from "@axiom-lattice/core";
|
|
21260
21305
|
|
|
21261
21306
|
// src/services/collaboration/ProjectRoomEventBroker.ts
|
|
21262
|
-
import { randomUUID as
|
|
21307
|
+
import { randomUUID as randomUUID22 } from "crypto";
|
|
21263
21308
|
import {
|
|
21264
21309
|
parseProjectRoomEventId,
|
|
21265
21310
|
ProjectRoomBrokerCapacityError,
|
|
@@ -21290,7 +21335,7 @@ var ProjectRoomEventBroker = class {
|
|
|
21290
21335
|
this.subscriberCount = 0;
|
|
21291
21336
|
this.usageClock = 0;
|
|
21292
21337
|
this.closed = false;
|
|
21293
|
-
this.epoch = options.epoch ??
|
|
21338
|
+
this.epoch = options.epoch ?? randomUUID22();
|
|
21294
21339
|
if (!UUID_PATTERN.test(this.epoch)) {
|
|
21295
21340
|
throw new TypeError("Project Room event epoch must be a lowercase canonical UUID");
|
|
21296
21341
|
}
|
|
@@ -22916,25 +22961,25 @@ async function transferGovernedDispatchOwner(task, options, deps) {
|
|
|
22916
22961
|
function broadcastModelProviderChanged(tenantId, providerId2) {
|
|
22917
22962
|
if (!tenantId) return;
|
|
22918
22963
|
try {
|
|
22919
|
-
const outbox =
|
|
22964
|
+
const outbox = getStoreLattice19("default", "outbox").store;
|
|
22920
22965
|
void publishModelProviderChanged(outbox, getReplicaId6(), tenantId, providerId2);
|
|
22921
22966
|
} catch {
|
|
22922
22967
|
}
|
|
22923
22968
|
}
|
|
22924
22969
|
var registerLatticeRoutes = (app2, channelDeps, options = {}) => {
|
|
22925
|
-
const webAppStore =
|
|
22926
|
-
const assistantStore =
|
|
22927
|
-
const projectStore =
|
|
22928
|
-
const projectMembershipStore =
|
|
22929
|
-
const userTenantLinkStore =
|
|
22930
|
-
const projectRoomStore =
|
|
22931
|
-
const projectBotMembershipStore =
|
|
22932
|
-
const projectRoomMessageStore =
|
|
22933
|
-
const projectRoomReadStateStore =
|
|
22934
|
-
const userPushSubscriptionStore =
|
|
22935
|
-
const threadStore =
|
|
22936
|
-
const taskStore =
|
|
22937
|
-
const taskWorkItemStore =
|
|
22970
|
+
const webAppStore = getStoreLattice19("default", "agentWebApp").store;
|
|
22971
|
+
const assistantStore = getStoreLattice19("default", "assistant").store;
|
|
22972
|
+
const projectStore = getStoreLattice19("default", "project").store;
|
|
22973
|
+
const projectMembershipStore = getStoreLattice19("default", "projectMembership").store;
|
|
22974
|
+
const userTenantLinkStore = getStoreLattice19("default", "userTenantLink").store;
|
|
22975
|
+
const projectRoomStore = getStoreLattice19("default", "projectRoom").store;
|
|
22976
|
+
const projectBotMembershipStore = getStoreLattice19("default", "projectBotMembership").store;
|
|
22977
|
+
const projectRoomMessageStore = getStoreLattice19("default", "projectRoomMessage").store;
|
|
22978
|
+
const projectRoomReadStateStore = getStoreLattice19("default", "projectRoomReadState").store;
|
|
22979
|
+
const userPushSubscriptionStore = getStoreLattice19("default", "userPushSubscription").store;
|
|
22980
|
+
const threadStore = getStoreLattice19("default", "thread").store;
|
|
22981
|
+
const taskStore = getStoreLattice19("default", "task").store;
|
|
22982
|
+
const taskWorkItemStore = getStoreLattice19("default", "taskWorkItem").store;
|
|
22938
22983
|
const projectTaskEnabled = options.projectTaskEnabled ?? process.env.AXIOM_PROJECT_TASK_EXECUTION_ENABLED !== "false";
|
|
22939
22984
|
const accessService = new ProjectAccessService({ projectStore, membershipStore: projectMembershipStore, userTenantLinkStore });
|
|
22940
22985
|
const realtimeMode = resolveProjectRoomRealtimeMode();
|
|
@@ -23000,7 +23045,7 @@ var registerLatticeRoutes = (app2, channelDeps, options = {}) => {
|
|
|
23000
23045
|
updateAssistant: assistantStore.updateAssistant.bind(assistantStore)
|
|
23001
23046
|
});
|
|
23002
23047
|
const resolveCoordinatorMentionName = async (tenantId) => {
|
|
23003
|
-
const tenant2 = await
|
|
23048
|
+
const tenant2 = await getStoreLattice19("default", "tenant").store.getTenantById(tenantId);
|
|
23004
23049
|
const value = tenant2?.metadata?.coordinatorMentionName;
|
|
23005
23050
|
return typeof value === "string" && value.length > 0 ? value : void 0;
|
|
23006
23051
|
};
|
|
@@ -23104,7 +23149,7 @@ var registerLatticeRoutes = (app2, channelDeps, options = {}) => {
|
|
|
23104
23149
|
});
|
|
23105
23150
|
}
|
|
23106
23151
|
if (projectTaskComposition) app2.addHook("onClose", async () => projectTaskComposition.lease.release());
|
|
23107
|
-
const taskThreadService = projectTaskComposition?.lease.runtime.threads ?? new ProjectTaskThreadService({ threads: threadStore, idFactory:
|
|
23152
|
+
const taskThreadService = projectTaskComposition?.lease.runtime.threads ?? new ProjectTaskThreadService({ threads: threadStore, idFactory: randomUUID23 });
|
|
23108
23153
|
const taskLifecycle = projectTaskComposition?.lease.runtime.lifecycle ?? createTaskLifecycleService({ taskStore, workItemStore: taskWorkItemStore });
|
|
23109
23154
|
const reassignmentAuthorizer = createProjectTaskReassignmentAuthorizer(
|
|
23110
23155
|
new ProjectTaskOwnerPolicy(projectBotMembershipStore),
|
|
@@ -23187,7 +23232,7 @@ var registerLatticeRoutes = (app2, channelDeps, options = {}) => {
|
|
|
23187
23232
|
readStateService,
|
|
23188
23233
|
interruptService: roomInterruptService,
|
|
23189
23234
|
userDirectory: {
|
|
23190
|
-
getUserById: (id3) =>
|
|
23235
|
+
getUserById: (id3) => getStoreLattice19("default", "user").store.getUserById(id3).then((u) => u ? { name: u.name } : null)
|
|
23191
23236
|
}
|
|
23192
23237
|
});
|
|
23193
23238
|
registerProjectRosterRoutes(app2, { service: rosterService });
|
|
@@ -23198,7 +23243,7 @@ var registerLatticeRoutes = (app2, channelDeps, options = {}) => {
|
|
|
23198
23243
|
createProject: projectStore.createProject.bind(projectStore)
|
|
23199
23244
|
},
|
|
23200
23245
|
workspaceStore: {
|
|
23201
|
-
getWorkspaceById: (tenantId, id3) =>
|
|
23246
|
+
getWorkspaceById: (tenantId, id3) => getStoreLattice19("default", "workspace").store.getWorkspaceById(tenantId, id3)
|
|
23202
23247
|
},
|
|
23203
23248
|
membershipStore: {
|
|
23204
23249
|
list: projectMembershipStore.list.bind(projectMembershipStore),
|
|
@@ -23221,7 +23266,7 @@ var registerLatticeRoutes = (app2, channelDeps, options = {}) => {
|
|
|
23221
23266
|
getUsersByTenant: userTenantLinkStore.getUsersByTenant.bind(userTenantLinkStore)
|
|
23222
23267
|
},
|
|
23223
23268
|
userStore: {
|
|
23224
|
-
getUserById: (id3) =>
|
|
23269
|
+
getUserById: (id3) => getStoreLattice19("default", "user").store.getUserById(id3).then((u) => u ? { id: u.id, name: u.name, email: u.email } : null)
|
|
23225
23270
|
},
|
|
23226
23271
|
assistantStore: {
|
|
23227
23272
|
getAssistantById: assistantStore.getAssistantById.bind(assistantStore),
|
|
@@ -23243,11 +23288,11 @@ var registerLatticeRoutes = (app2, channelDeps, options = {}) => {
|
|
|
23243
23288
|
}
|
|
23244
23289
|
});
|
|
23245
23290
|
registerCapabilityBundleRoutes(app2, new CapabilityBundleController({
|
|
23246
|
-
bundleStore:
|
|
23291
|
+
bundleStore: getStoreLattice19("default", "capabilityBundle").store,
|
|
23247
23292
|
projectStore
|
|
23248
23293
|
}, { authRequired: process.env.AUTH_REQUIRED === "true" }));
|
|
23249
23294
|
const modelProviderController = new ModelProviderController({
|
|
23250
|
-
providerStore:
|
|
23295
|
+
providerStore: getStoreLattice19("default", "modelProvider").store,
|
|
23251
23296
|
userTenantLinkStore,
|
|
23252
23297
|
registry: {
|
|
23253
23298
|
register: (tenantId, modelKey2, config) => modelLatticeManager3.registerLatticeWithTenant(tenantId, modelKey2, config),
|
|
@@ -23320,7 +23365,7 @@ var registerLatticeRoutes = (app2, channelDeps, options = {}) => {
|
|
|
23320
23365
|
}),
|
|
23321
23366
|
service: new AgentWebAppRuntimeService({
|
|
23322
23367
|
webAppStore,
|
|
23323
|
-
threadStore:
|
|
23368
|
+
threadStore: getStoreLattice19("default", "thread").store,
|
|
23324
23369
|
projectStore,
|
|
23325
23370
|
assistantResolver: {
|
|
23326
23371
|
resolve: async (tenantId, assistantId) => {
|
|
@@ -23710,10 +23755,6 @@ var registerLatticeRoutes = (app2, channelDeps, options = {}) => {
|
|
|
23710
23755
|
"/api/tenants/:tenantId/export/entities",
|
|
23711
23756
|
previewEntities
|
|
23712
23757
|
);
|
|
23713
|
-
app2.get(
|
|
23714
|
-
"/api/tenants/:tenantId/export/:jobId/download",
|
|
23715
|
-
downloadExport
|
|
23716
|
-
);
|
|
23717
23758
|
app2.post(
|
|
23718
23759
|
"/api/tenants/:tenantId/import/preview",
|
|
23719
23760
|
importPreview
|
|
@@ -23746,9 +23787,9 @@ function tryCreateProjectTaskRuntime(input) {
|
|
|
23746
23787
|
let stores;
|
|
23747
23788
|
try {
|
|
23748
23789
|
stores = {
|
|
23749
|
-
tenants:
|
|
23750
|
-
workspaces:
|
|
23751
|
-
queue:
|
|
23790
|
+
tenants: getStoreLattice19("default", "tenant").store,
|
|
23791
|
+
workspaces: getStoreLattice19("default", "workspace").store,
|
|
23792
|
+
queue: getStoreLattice19("default", "threadMessageQueue").store
|
|
23752
23793
|
};
|
|
23753
23794
|
const missing = missingRuntimeMethod(input, stores);
|
|
23754
23795
|
if (missing) return { reason: missing };
|
|
@@ -23779,7 +23820,7 @@ function tryCreateProjectTaskRuntime(input) {
|
|
|
23779
23820
|
function createRuntime(input, stores, log2) {
|
|
23780
23821
|
const controller = new AbortController();
|
|
23781
23822
|
const mutex = new ProjectTaskExecutionMutex();
|
|
23782
|
-
const threads = new ProjectTaskThreadService({ threads: input.threadStore, idFactory:
|
|
23823
|
+
const threads = new ProjectTaskThreadService({ threads: input.threadStore, idFactory: randomUUID23 });
|
|
23783
23824
|
const lifecycle = createTaskLifecycleService({ taskStore: input.taskStore, workItemStore: input.taskWorkItemStore });
|
|
23784
23825
|
const projection = new RoomProjectionService({
|
|
23785
23826
|
messages: input.projectRoomMessageStore,
|
|
@@ -23788,7 +23829,7 @@ function createRuntime(input, stores, log2) {
|
|
|
23788
23829
|
warnings: input.taskWorkItemStore,
|
|
23789
23830
|
log: log2,
|
|
23790
23831
|
realtime: input.realtime,
|
|
23791
|
-
idFactory:
|
|
23832
|
+
idFactory: randomUUID23
|
|
23792
23833
|
});
|
|
23793
23834
|
const agentFor = (task, thread) => agentInstanceManager6.getAgent({
|
|
23794
23835
|
tenant_id: task.tenantId,
|
|
@@ -24131,9 +24172,9 @@ var skillRegistration = {
|
|
|
24131
24172
|
};
|
|
24132
24173
|
|
|
24133
24174
|
// src/export_registrations/agent.registration.ts
|
|
24134
|
-
import { getStoreLattice as
|
|
24175
|
+
import { getStoreLattice as getStoreLattice20 } from "@axiom-lattice/core";
|
|
24135
24176
|
function getStore2() {
|
|
24136
|
-
return
|
|
24177
|
+
return getStoreLattice20("default", "assistant").store;
|
|
24137
24178
|
}
|
|
24138
24179
|
var agentRegistration = {
|
|
24139
24180
|
entityType: "agent",
|
|
@@ -24213,9 +24254,9 @@ var agentRegistration = {
|
|
|
24213
24254
|
};
|
|
24214
24255
|
|
|
24215
24256
|
// src/export_registrations/database-config.registration.ts
|
|
24216
|
-
import { getStoreLattice as
|
|
24257
|
+
import { getStoreLattice as getStoreLattice21 } from "@axiom-lattice/core";
|
|
24217
24258
|
function getStore3() {
|
|
24218
|
-
return
|
|
24259
|
+
return getStoreLattice21("default", "database").store;
|
|
24219
24260
|
}
|
|
24220
24261
|
var databaseConfigRegistration = {
|
|
24221
24262
|
entityType: "database_config",
|
|
@@ -24295,9 +24336,9 @@ var databaseConfigRegistration = {
|
|
|
24295
24336
|
};
|
|
24296
24337
|
|
|
24297
24338
|
// src/export_registrations/metrics-config.registration.ts
|
|
24298
|
-
import { getStoreLattice as
|
|
24339
|
+
import { getStoreLattice as getStoreLattice22 } from "@axiom-lattice/core";
|
|
24299
24340
|
function getStore4() {
|
|
24300
|
-
return
|
|
24341
|
+
return getStoreLattice22("default", "metrics").store;
|
|
24301
24342
|
}
|
|
24302
24343
|
var metricsConfigRegistration = {
|
|
24303
24344
|
entityType: "metrics_config",
|
|
@@ -24377,9 +24418,9 @@ var metricsConfigRegistration = {
|
|
|
24377
24418
|
};
|
|
24378
24419
|
|
|
24379
24420
|
// src/export_registrations/mcp-config.registration.ts
|
|
24380
|
-
import { getStoreLattice as
|
|
24421
|
+
import { getStoreLattice as getStoreLattice23 } from "@axiom-lattice/core";
|
|
24381
24422
|
function getStore5() {
|
|
24382
|
-
return
|
|
24423
|
+
return getStoreLattice23("default", "mcp").store;
|
|
24383
24424
|
}
|
|
24384
24425
|
var mcpConfigRegistration = {
|
|
24385
24426
|
entityType: "mcp_config",
|
|
@@ -24462,9 +24503,9 @@ var mcpConfigRegistration = {
|
|
|
24462
24503
|
};
|
|
24463
24504
|
|
|
24464
24505
|
// src/export_registrations/connection.registration.ts
|
|
24465
|
-
import { getStoreLattice as
|
|
24506
|
+
import { getStoreLattice as getStoreLattice24 } from "@axiom-lattice/core";
|
|
24466
24507
|
function getStore6() {
|
|
24467
|
-
return
|
|
24508
|
+
return getStoreLattice24("default", "connection").store;
|
|
24468
24509
|
}
|
|
24469
24510
|
async function listAllConnections(tenantId) {
|
|
24470
24511
|
const store = getStore6();
|
|
@@ -24549,9 +24590,9 @@ var connectionRegistration = {
|
|
|
24549
24590
|
};
|
|
24550
24591
|
|
|
24551
24592
|
// src/export_registrations/collection.registration.ts
|
|
24552
|
-
import { getStoreLattice as
|
|
24593
|
+
import { getStoreLattice as getStoreLattice25 } from "@axiom-lattice/core";
|
|
24553
24594
|
function getStore7() {
|
|
24554
|
-
return
|
|
24595
|
+
return getStoreLattice25("default", "collection").store;
|
|
24555
24596
|
}
|
|
24556
24597
|
var collectionRegistration = {
|
|
24557
24598
|
entityType: "collection",
|
|
@@ -24622,8 +24663,8 @@ var collectionRegistration = {
|
|
|
24622
24663
|
};
|
|
24623
24664
|
|
|
24624
24665
|
// src/export_registrations/channel-installation.registration.ts
|
|
24625
|
-
import { getStoreLattice as
|
|
24626
|
-
import { randomUUID as
|
|
24666
|
+
import { getStoreLattice as getStoreLattice26 } from "@axiom-lattice/core";
|
|
24667
|
+
import { randomUUID as randomUUID24 } from "crypto";
|
|
24627
24668
|
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;
|
|
24628
24669
|
var PUBLIC_CHANNELS = /* @__PURE__ */ new Set(["lark", "email", "slack", "wechat", "wecom"]);
|
|
24629
24670
|
function isPublicChannel(channel) {
|
|
@@ -24659,7 +24700,7 @@ function validateImportData(data) {
|
|
|
24659
24700
|
};
|
|
24660
24701
|
}
|
|
24661
24702
|
function getStore8() {
|
|
24662
|
-
return
|
|
24703
|
+
return getStoreLattice26("default", "channelInstallation").store;
|
|
24663
24704
|
}
|
|
24664
24705
|
function getOverwriteError(tenantId, incomingChannel, existing) {
|
|
24665
24706
|
if (!existing) return "Channel installation overwrite target must exist";
|
|
@@ -24785,7 +24826,7 @@ var channelInstallationRegistration = {
|
|
|
24785
24826
|
}
|
|
24786
24827
|
id3 = sourceId;
|
|
24787
24828
|
} else {
|
|
24788
|
-
id3 =
|
|
24829
|
+
id3 = randomUUID24();
|
|
24789
24830
|
}
|
|
24790
24831
|
await store.createInstallation(tenantId, id3, createInput);
|
|
24791
24832
|
return { newId: id3 };
|
|
@@ -24793,9 +24834,9 @@ var channelInstallationRegistration = {
|
|
|
24793
24834
|
};
|
|
24794
24835
|
|
|
24795
24836
|
// src/export_registrations/menu.registration.ts
|
|
24796
|
-
import { getStoreLattice as
|
|
24837
|
+
import { getStoreLattice as getStoreLattice27 } from "@axiom-lattice/core";
|
|
24797
24838
|
function getStore9() {
|
|
24798
|
-
return
|
|
24839
|
+
return getStoreLattice27("default", "menu").store;
|
|
24799
24840
|
}
|
|
24800
24841
|
var menuRegistration = {
|
|
24801
24842
|
entityType: "menu",
|
|
@@ -24873,9 +24914,9 @@ var menuRegistration = {
|
|
|
24873
24914
|
};
|
|
24874
24915
|
|
|
24875
24916
|
// src/export_registrations/eval.registration.ts
|
|
24876
|
-
import { getStoreLattice as
|
|
24917
|
+
import { getStoreLattice as getStoreLattice28 } from "@axiom-lattice/core";
|
|
24877
24918
|
function getStore10() {
|
|
24878
|
-
return
|
|
24919
|
+
return getStoreLattice28("default", "eval").store;
|
|
24879
24920
|
}
|
|
24880
24921
|
var evalRegistration = {
|
|
24881
24922
|
entityType: "eval",
|
|
@@ -25334,7 +25375,7 @@ function createAuditLoggerMiddleware() {
|
|
|
25334
25375
|
import { setBindingRegistry, setMenuRegistry, setEvalRunService } from "@axiom-lattice/core";
|
|
25335
25376
|
|
|
25336
25377
|
// src/channels/wecom/WecomChannelAdapter.ts
|
|
25337
|
-
import { randomUUID as
|
|
25378
|
+
import { randomUUID as randomUUID25 } from "crypto";
|
|
25338
25379
|
import { z as z12 } from "zod";
|
|
25339
25380
|
import * as WecomAiBot from "@wecom/aibot-node-sdk";
|
|
25340
25381
|
|
|
@@ -25379,7 +25420,7 @@ function streamIdFor(replyTarget) {
|
|
|
25379
25420
|
const key = streamKeyOf(replyTarget);
|
|
25380
25421
|
let streamId = streamIdsByReqId.get(key);
|
|
25381
25422
|
if (!streamId) {
|
|
25382
|
-
streamId =
|
|
25423
|
+
streamId = randomUUID25();
|
|
25383
25424
|
streamIdsByReqId.set(key, streamId);
|
|
25384
25425
|
if (streamIdsByReqId.size > MAX_TRACKED_STREAMS) {
|
|
25385
25426
|
const oldest = streamIdsByReqId.keys().next().value;
|
|
@@ -25632,7 +25673,7 @@ var configureSwagger = async (app2, customSwaggerConfig, customSwaggerUiConfig)
|
|
|
25632
25673
|
};
|
|
25633
25674
|
|
|
25634
25675
|
// src/services/agent_task_consumer.ts
|
|
25635
|
-
import { randomUUID as
|
|
25676
|
+
import { randomUUID as randomUUID26 } from "crypto";
|
|
25636
25677
|
import { eventBus as eventBus3, AGENT_TASK_EVENT, agentInstanceManager as agentInstanceManager7, QueueMode as QueueMode2 } from "@axiom-lattice/core";
|
|
25637
25678
|
import { resolveRunScope } from "@axiom-lattice/protocols";
|
|
25638
25679
|
var handleAgentTask = async (taskRequest, retryCount = 0) => {
|
|
@@ -25656,7 +25697,7 @@ var handleAgentTask = async (taskRequest, retryCount = 0) => {
|
|
|
25656
25697
|
const agent = agentInstanceManager7.getAgent({ assistant_id, thread_id, tenant_id, workspace_id: scope.workspaceId, project_id: scope.projectId, custom_run_config: runConfig });
|
|
25657
25698
|
if (callback_event) {
|
|
25658
25699
|
const callbackEvent = callback_event;
|
|
25659
|
-
const messageId = typeof input?.id === "string" && input.id !== "" ? input.id :
|
|
25700
|
+
const messageId = typeof input?.id === "string" && input.id !== "" ? input.id : randomUUID26();
|
|
25660
25701
|
let settled = false;
|
|
25661
25702
|
const subscriptions = [];
|
|
25662
25703
|
const dispose = () => {
|
|
@@ -26003,7 +26044,7 @@ import { RoomAgentMessageService } from "@axiom-lattice/core";
|
|
|
26003
26044
|
|
|
26004
26045
|
// src/router/MessageRouter.ts
|
|
26005
26046
|
import {
|
|
26006
|
-
getStoreLattice as
|
|
26047
|
+
getStoreLattice as getStoreLattice29,
|
|
26007
26048
|
agentInstanceManager as agentInstanceManager8
|
|
26008
26049
|
} from "@axiom-lattice/core";
|
|
26009
26050
|
import {
|
|
@@ -26011,7 +26052,7 @@ import {
|
|
|
26011
26052
|
snapshotExactRecord as snapshotExactRecord15,
|
|
26012
26053
|
MessageChunkTypes as MessageChunkTypes4
|
|
26013
26054
|
} from "@axiom-lattice/protocols";
|
|
26014
|
-
import { randomUUID as
|
|
26055
|
+
import { randomUUID as randomUUID27 } from "crypto";
|
|
26015
26056
|
var BindingNotFoundError = class extends Error {
|
|
26016
26057
|
constructor(message) {
|
|
26017
26058
|
super(message);
|
|
@@ -26304,7 +26345,7 @@ var _MessageRouter = class _MessageRouter {
|
|
|
26304
26345
|
channel: message.channel,
|
|
26305
26346
|
adapterChannel: adapter.channel
|
|
26306
26347
|
}, "Thread resolved by adapter strategy");
|
|
26307
|
-
const threadStore =
|
|
26348
|
+
const threadStore = getStoreLattice29("default", "thread").store;
|
|
26308
26349
|
try {
|
|
26309
26350
|
await threadStore.createThread(
|
|
26310
26351
|
tenantId,
|
|
@@ -26341,8 +26382,8 @@ var _MessageRouter = class _MessageRouter {
|
|
|
26341
26382
|
}
|
|
26342
26383
|
}
|
|
26343
26384
|
if (!threadId) {
|
|
26344
|
-
const threadStore =
|
|
26345
|
-
const newThreadId =
|
|
26385
|
+
const threadStore = getStoreLattice29("default", "thread").store;
|
|
26386
|
+
const newThreadId = randomUUID27();
|
|
26346
26387
|
console.log({
|
|
26347
26388
|
event: "dispatch:thread:create",
|
|
26348
26389
|
agentId,
|
|
@@ -26388,7 +26429,7 @@ var _MessageRouter = class _MessageRouter {
|
|
|
26388
26429
|
workspace_id: binding?.workspaceId || "",
|
|
26389
26430
|
project_id: binding?.projectId || ""
|
|
26390
26431
|
});
|
|
26391
|
-
const inputMessageId =
|
|
26432
|
+
const inputMessageId = randomUUID27();
|
|
26392
26433
|
const replyTarget = internalRoom ? correlatedRoomReplyTarget(message.replyTarget, inputMessageId) : message.replyTarget;
|
|
26393
26434
|
const replyAdapter = replyTarget ? this.adapterRegistry.get(replyTarget.adapterChannel) : void 0;
|
|
26394
26435
|
if (options.trustedMessageOptions && (!this.trustedDispatcher || !replyTarget || !replyAdapter)) {
|
|
@@ -26765,7 +26806,7 @@ async function prepareProjectTaskRuntime(runtime, log2) {
|
|
|
26765
26806
|
import { setPluginDeploymentService } from "@axiom-lattice/core";
|
|
26766
26807
|
|
|
26767
26808
|
// src/services/plugins/PluginDeploymentService.ts
|
|
26768
|
-
import { randomUUID as
|
|
26809
|
+
import { randomUUID as randomUUID28 } from "crypto";
|
|
26769
26810
|
import {
|
|
26770
26811
|
PLUGIN_HOST_DIR,
|
|
26771
26812
|
PluginDeploymentRuntimeRegistry
|
|
@@ -26909,7 +26950,7 @@ var PluginDeploymentService = class {
|
|
|
26909
26950
|
const failedAt = this.nowIso();
|
|
26910
26951
|
await this.store.upsert(
|
|
26911
26952
|
this.buildRecord({
|
|
26912
|
-
id: existing?.id ??
|
|
26953
|
+
id: existing?.id ?? randomUUID28(),
|
|
26913
26954
|
tenantId,
|
|
26914
26955
|
pluginType,
|
|
26915
26956
|
pluginVersion: manifest.version,
|
|
@@ -26931,7 +26972,7 @@ var PluginDeploymentService = class {
|
|
|
26931
26972
|
);
|
|
26932
26973
|
}
|
|
26933
26974
|
const record = this.buildRecord({
|
|
26934
|
-
id: existing?.id ??
|
|
26975
|
+
id: existing?.id ?? randomUUID28(),
|
|
26935
26976
|
tenantId,
|
|
26936
26977
|
pluginType,
|
|
26937
26978
|
pluginVersion: manifest.version,
|
|
@@ -27687,51 +27728,6 @@ function errorMessage5(error) {
|
|
|
27687
27728
|
return error instanceof Error ? error.message : String(error);
|
|
27688
27729
|
}
|
|
27689
27730
|
|
|
27690
|
-
// src/services/multiReplicaReadiness.ts
|
|
27691
|
-
import { getStoreLattice as getStoreLattice29 } from "@axiom-lattice/core";
|
|
27692
|
-
var SHARED_STORE_KINDS = [
|
|
27693
|
-
"lease",
|
|
27694
|
-
"outbox",
|
|
27695
|
-
"threadMessageQueue",
|
|
27696
|
-
"task",
|
|
27697
|
-
"taskWorkItem",
|
|
27698
|
-
"channelInstallation"
|
|
27699
|
-
];
|
|
27700
|
-
function storeClassName(kind) {
|
|
27701
|
-
try {
|
|
27702
|
-
return getStoreLattice29("default", kind).store.constructor?.name;
|
|
27703
|
-
} catch {
|
|
27704
|
-
return void 0;
|
|
27705
|
-
}
|
|
27706
|
-
}
|
|
27707
|
-
function warnMultiReplicaReadiness(logger8) {
|
|
27708
|
-
if (typeof process.env.AXIOM_REPLICA_ID !== "string" || process.env.AXIOM_REPLICA_ID.trim() === "") return;
|
|
27709
|
-
for (const kind of SHARED_STORE_KINDS) {
|
|
27710
|
-
const name = storeClassName(kind);
|
|
27711
|
-
if (name === void 0 || !name.startsWith("InMemory")) continue;
|
|
27712
|
-
logger8.warn(`Multi-replica: store '${kind}' is ${name} (not shared); configure a shared store`, {
|
|
27713
|
-
phase: "multi_replica_readiness",
|
|
27714
|
-
store: kind
|
|
27715
|
-
});
|
|
27716
|
-
}
|
|
27717
|
-
if (!process.env.AUTH_TOKEN_SECRET?.trim() && !process.env.JWT_SECRET?.trim()) {
|
|
27718
|
-
logger8.warn(
|
|
27719
|
-
"Multi-replica: AUTH_TOKEN_SECRET/JWT_SECRET unset; console sessions are signed per-process and will not verify across replicas",
|
|
27720
|
-
{ phase: "multi_replica_readiness", env: "AUTH_TOKEN_SECRET" }
|
|
27721
|
-
);
|
|
27722
|
-
}
|
|
27723
|
-
if (!process.env.LATTICE_ENCRYPTION_KEY?.trim()) {
|
|
27724
|
-
logger8.warn(
|
|
27725
|
-
"Multi-replica: LATTICE_ENCRYPTION_KEY unset; stored credentials use the shared dev default and may not decrypt across differing keys",
|
|
27726
|
-
{ phase: "multi_replica_readiness", env: "LATTICE_ENCRYPTION_KEY" }
|
|
27727
|
-
);
|
|
27728
|
-
}
|
|
27729
|
-
logger8.warn(
|
|
27730
|
-
"Multi-replica: agent run SSE and resume_stream are process-local; route a thread's follow-up runs to the replica streaming it (sticky routing) or share the stream/queue state",
|
|
27731
|
-
{ phase: "multi_replica_readiness", feature: "agent-run-sse" }
|
|
27732
|
-
);
|
|
27733
|
-
}
|
|
27734
|
-
|
|
27735
27731
|
// src/services/OutboxRetentionJob.ts
|
|
27736
27732
|
var HOUR_MS = 60 * 60 * 1e3;
|
|
27737
27733
|
var DEFAULT_INTERVAL_MS2 = 6 * HOUR_MS;
|
|
@@ -28103,7 +28099,7 @@ var start = async (config) => {
|
|
|
28103
28099
|
});
|
|
28104
28100
|
try {
|
|
28105
28101
|
const { A2AAuthService: A2AAuthService2, parseEnvKeys: parseEnvKeys2 } = await import("./A2AAuthService-7UGQ7GMW.mjs");
|
|
28106
|
-
const { registerA2AStandardRoutes } = await import("./a2a-standard-
|
|
28102
|
+
const { registerA2AStandardRoutes } = await import("./a2a-standard-3OZFXDCW.mjs");
|
|
28107
28103
|
const a2a = await import("./a2a-BHBLACJV.mjs");
|
|
28108
28104
|
const a2aKeyStore = getStoreLattice30("default", "a2aApiKey").store;
|
|
28109
28105
|
const assistantStore = getStoreLattice30("default", "assistant").store;
|
|
@@ -28314,7 +28310,10 @@ var start = async (config) => {
|
|
|
28314
28310
|
}),
|
|
28315
28311
|
[PLUGIN_CATALOG_CHANGED_TOPIC]: async (payload) => {
|
|
28316
28312
|
const tenantId = payload?.tenantId;
|
|
28317
|
-
if (typeof tenantId === "string" && tenantId.length > 0)
|
|
28313
|
+
if (typeof tenantId === "string" && tenantId.length > 0) {
|
|
28314
|
+
getSandboxPluginCatalog3().invalidate(tenantId);
|
|
28315
|
+
await getMcpUiResourceResolver()?.invalidateTenantPlugins(tenantId);
|
|
28316
|
+
}
|
|
28318
28317
|
},
|
|
28319
28318
|
[MODEL_PROVIDER_CHANGED_TOPIC]: async (payload) => {
|
|
28320
28319
|
const controller = routes.modelProviderController;
|
|
@@ -28343,7 +28342,7 @@ var start = async (config) => {
|
|
|
28343
28342
|
}
|
|
28344
28343
|
if (process.env.AXIOM_TASK_ORPHAN_RECOVERY === "true") {
|
|
28345
28344
|
try {
|
|
28346
|
-
const { createOrphanRecoveryRuntime: createOrphanRecoveryRuntime2 } = await import("./OrphanRecoveryRuntime-
|
|
28345
|
+
const { createOrphanRecoveryRuntime: createOrphanRecoveryRuntime2 } = await import("./OrphanRecoveryRuntime-T4T5NOZU.mjs");
|
|
28347
28346
|
const { createRecoveryCallerDeps: createRecoveryCallerDeps2 } = await import("./RecoveryCallerDeps-6SJUYJ5S.mjs");
|
|
28348
28347
|
const runtime = createOrphanRecoveryRuntime2({
|
|
28349
28348
|
taskStore: getStoreLattice30("default", "task").store,
|