@axiom-lattice/gateway 5.0.0 → 6.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/README.md +0 -2
- package/dist/{sandboxOpenCredentialProvider-USIU7Z7H.mjs → chunk-GL7RV5L3.mjs} +29 -59
- package/dist/chunk-GL7RV5L3.mjs.map +1 -0
- package/dist/embed/{embed-page-AgentDetailSideApp-XCP4LY7Y.js → embed-page-AgentDetailSideApp-JYVZKSUU.js} +1 -1
- package/dist/embed/embed-page-AgentGovernanceWorkbench-SD2EHW2B.js +1 -0
- package/dist/embed/{embed-page-MessageGraph-D77CYFAG.js → embed-page-MessageGraph-GLQXKAVC.js} +1 -1
- package/dist/embed/{embed-page-ReactChart-TBDJOTZ5.js → embed-page-ReactChart-74MHCE2K.js} +1 -1
- package/dist/embed/{embed-page-TasksSideApp-BVCIAE24.js → embed-page-TasksSideApp-DA4LUTMD.js} +1 -1
- package/dist/embed/{embed-page-TeamWorkspace-JFEKNVFP.js → embed-page-TeamWorkspace-DUB3L6V6.js} +1 -1
- package/dist/embed/{embed-page-TopologyRuntimeView-42TN76MK.js → embed-page-TopologyRuntimeView-NFBHAICN.js} +1 -1
- package/dist/embed/{embed-page-WorkflowAutomationView-JLP4UHPP.js → embed-page-WorkflowAutomationView-43YGTXGF.js} +1 -1
- package/dist/embed/{embed-page-chunk-K2U3JD67.js → embed-page-chunk-BVSC3MSO.js} +1 -1
- package/dist/embed/{embed-page-chunk-5NJ3O2GK.js → embed-page-chunk-C4ZV4IXK.js} +2 -2
- package/dist/embed/{embed-page-chunk-I3OONX3N.js → embed-page-chunk-DWIBLGBW.js} +1 -1
- package/dist/embed/{embed-page-chunk-H64UEFHS.js → embed-page-chunk-GKHIPXZ2.js} +1 -1
- package/dist/embed/{embed-page-chunk-YYDZ6ZBV.js → embed-page-chunk-P477ZTUO.js} +5 -5
- package/dist/embed/{embed-page-chunk-GUSAII2D.js → embed-page-chunk-UHH575CK.js} +1 -1
- package/dist/embed/embed-page.js +1 -1
- package/dist/index.js +426 -621
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +68 -285
- package/dist/index.mjs.map +1 -1
- package/dist/{open-GNBMCHYA.mjs → open-MDC4VCR7.mjs} +18 -1
- package/dist/open-MDC4VCR7.mjs.map +1 -0
- package/dist/{resources-2L3KSUUU.mjs → resources-DAU5ZIPB.mjs} +2 -17
- package/dist/resources-DAU5ZIPB.mjs.map +1 -0
- package/dist/sandboxOpenCredentialProvider-AT227D4N.mjs +66 -0
- package/dist/sandboxOpenCredentialProvider-AT227D4N.mjs.map +1 -0
- package/package.json +4 -4
- package/dist/embed/embed-page-AgentGovernanceWorkbench-BBDKEIBI.js +0 -5
- package/dist/open-GNBMCHYA.mjs.map +0 -1
- package/dist/resources-2L3KSUUU.mjs.map +0 -1
- package/dist/sandboxOpenCredentialProvider-USIU7Z7H.mjs.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1334,6 +1334,241 @@ var init_a2a = __esm({
|
|
|
1334
1334
|
}
|
|
1335
1335
|
});
|
|
1336
1336
|
|
|
1337
|
+
// src/services/open/sandboxOpenReflection.ts
|
|
1338
|
+
function invalidateAgentReflectionCache(tenantId, assistantId) {
|
|
1339
|
+
if (!tenantId) {
|
|
1340
|
+
cache.clear();
|
|
1341
|
+
return;
|
|
1342
|
+
}
|
|
1343
|
+
if (assistantId) {
|
|
1344
|
+
cache.delete(`${tenantId}:${assistantId}`);
|
|
1345
|
+
return;
|
|
1346
|
+
}
|
|
1347
|
+
const prefix = `${tenantId}:`;
|
|
1348
|
+
for (const key of cache.keys()) {
|
|
1349
|
+
if (key.startsWith(prefix)) cache.delete(key);
|
|
1350
|
+
}
|
|
1351
|
+
}
|
|
1352
|
+
function cloneGrants(grants) {
|
|
1353
|
+
return grants.map((grant) => ({
|
|
1354
|
+
...grant,
|
|
1355
|
+
items: grant.items ? [...grant.items] : void 0
|
|
1356
|
+
}));
|
|
1357
|
+
}
|
|
1358
|
+
function normalizeOpenExpose(value) {
|
|
1359
|
+
if (!Array.isArray(value)) return [];
|
|
1360
|
+
const out = [];
|
|
1361
|
+
for (const entry of value) {
|
|
1362
|
+
if (typeof entry === "string") {
|
|
1363
|
+
if (entry) out.push(entry);
|
|
1364
|
+
} else if (entry && typeof entry === "object") {
|
|
1365
|
+
const name = entry.name;
|
|
1366
|
+
if (typeof name === "string" && name) out.push(name);
|
|
1367
|
+
}
|
|
1368
|
+
}
|
|
1369
|
+
return out;
|
|
1370
|
+
}
|
|
1371
|
+
function extractMiddleware(container) {
|
|
1372
|
+
if (!container || typeof container !== "object") return void 0;
|
|
1373
|
+
const raw = container.middleware;
|
|
1374
|
+
if (!Array.isArray(raw)) return void 0;
|
|
1375
|
+
const out = [];
|
|
1376
|
+
for (const entry of raw) {
|
|
1377
|
+
if (!entry || typeof entry !== "object") continue;
|
|
1378
|
+
const type = entry.type;
|
|
1379
|
+
if (typeof type !== "string" || type.length === 0) continue;
|
|
1380
|
+
const enabled = entry.enabled;
|
|
1381
|
+
const rawAllowed = entry.allowedTools;
|
|
1382
|
+
const allowedTools = Array.isArray(rawAllowed) ? rawAllowed.filter((t2) => typeof t2 === "string" && t2.length > 0) : void 0;
|
|
1383
|
+
out.push({ type, enabled: typeof enabled === "boolean" ? enabled : void 0, allowedTools });
|
|
1384
|
+
}
|
|
1385
|
+
return out;
|
|
1386
|
+
}
|
|
1387
|
+
function extractSubAgents(config) {
|
|
1388
|
+
if (!config || typeof config !== "object") return void 0;
|
|
1389
|
+
const raw = config.subAgents;
|
|
1390
|
+
if (!Array.isArray(raw)) return void 0;
|
|
1391
|
+
const out = raw.filter((id3) => typeof id3 === "string" && id3.length > 0);
|
|
1392
|
+
return out.length > 0 ? out : void 0;
|
|
1393
|
+
}
|
|
1394
|
+
async function computeGrants(tenantId, assistantId, deps) {
|
|
1395
|
+
await deps.ensure?.(tenantId);
|
|
1396
|
+
let context = await deps.getAgentConfig?.(tenantId, assistantId);
|
|
1397
|
+
if (context === void 0) {
|
|
1398
|
+
const middleware = await deps.getAssistantMiddleware?.(tenantId, assistantId);
|
|
1399
|
+
if (middleware === void 0) return [];
|
|
1400
|
+
context = { middleware };
|
|
1401
|
+
}
|
|
1402
|
+
const byDomain = /* @__PURE__ */ new Map();
|
|
1403
|
+
const add = (domain, items) => {
|
|
1404
|
+
let bucket = byDomain.get(domain);
|
|
1405
|
+
if (!bucket) {
|
|
1406
|
+
bucket = /* @__PURE__ */ new Set();
|
|
1407
|
+
byDomain.set(domain, bucket);
|
|
1408
|
+
}
|
|
1409
|
+
for (const item of items) bucket.add(item);
|
|
1410
|
+
};
|
|
1411
|
+
for (const entry of context.middleware ?? []) {
|
|
1412
|
+
if (!entry || entry.enabled === false) continue;
|
|
1413
|
+
if (typeof entry.type !== "string" || entry.type.length === 0) continue;
|
|
1414
|
+
let actions = deps.exposedActionsByType(entry.type);
|
|
1415
|
+
if (actions.length === 0) continue;
|
|
1416
|
+
const allowedTools = entry.allowedTools;
|
|
1417
|
+
if (Array.isArray(allowedTools) && allowedTools.length > 0) {
|
|
1418
|
+
const allowed = new Set(allowedTools);
|
|
1419
|
+
actions = actions.filter((action) => allowed.has(action));
|
|
1420
|
+
if (actions.length === 0) continue;
|
|
1421
|
+
}
|
|
1422
|
+
add(entry.type, actions);
|
|
1423
|
+
}
|
|
1424
|
+
const subAgents = context.subAgents ?? [];
|
|
1425
|
+
if (subAgents.length > 0 && deps.resolvableAssistants) {
|
|
1426
|
+
const resolvable = await deps.resolvableAssistants(tenantId);
|
|
1427
|
+
const kept = subAgents.filter(
|
|
1428
|
+
(id3) => typeof id3 === "string" && id3.length > 0 && resolvable.has(id3)
|
|
1429
|
+
);
|
|
1430
|
+
if (kept.length > 0) add("agent", kept);
|
|
1431
|
+
}
|
|
1432
|
+
return [...byDomain].map(([domain, items]) => ({ domain, items: [...items] }));
|
|
1433
|
+
}
|
|
1434
|
+
async function resolveAgentOpenGrants(tenantId, assistantId, deps) {
|
|
1435
|
+
try {
|
|
1436
|
+
const key = `${tenantId}:${assistantId}`;
|
|
1437
|
+
const now = deps.now ? deps.now() : Date.now();
|
|
1438
|
+
const hit = cache.get(key);
|
|
1439
|
+
if (hit && hit.expiresAt > now) return cloneGrants(hit.grants);
|
|
1440
|
+
const grants = await computeGrants(tenantId, assistantId, deps);
|
|
1441
|
+
cache.set(key, { grants, expiresAt: now + AGENT_REFLECTION_CACHE_TTL_MS });
|
|
1442
|
+
return cloneGrants(grants);
|
|
1443
|
+
} catch {
|
|
1444
|
+
return [];
|
|
1445
|
+
}
|
|
1446
|
+
}
|
|
1447
|
+
function createDefaultAgentReflectionDeps(tenantId) {
|
|
1448
|
+
(0, import_core74.ensureBuiltinAgentsForTenant)(tenantId);
|
|
1449
|
+
return {
|
|
1450
|
+
ensure: (t2) => import_core74.agentLatticeManager.initializeStoredAssistantsForTenant(t2),
|
|
1451
|
+
getAgentConfig: (t2, assistantId) => {
|
|
1452
|
+
const config = import_core74.agentLatticeManager.getAgentConfigWithTenant(t2, assistantId);
|
|
1453
|
+
if (!config) return void 0;
|
|
1454
|
+
return {
|
|
1455
|
+
middleware: extractMiddleware(config),
|
|
1456
|
+
subAgents: extractSubAgents(config)
|
|
1457
|
+
};
|
|
1458
|
+
},
|
|
1459
|
+
getAssistantMiddleware: async (t2, assistantId) => {
|
|
1460
|
+
const store2 = (0, import_core74.getStoreLattice)("default", "assistant").store;
|
|
1461
|
+
const assistant = await store2.getAssistantById(t2, assistantId);
|
|
1462
|
+
return extractMiddleware(assistant?.graphDefinition);
|
|
1463
|
+
},
|
|
1464
|
+
exposedActionsByType: (type) => {
|
|
1465
|
+
const plugin = import_core74.PluginRegistry.get(type);
|
|
1466
|
+
return plugin ? normalizeOpenExpose(plugin.meta.openExpose) : [];
|
|
1467
|
+
},
|
|
1468
|
+
resolvableAssistants: async (t2) => new Set(
|
|
1469
|
+
import_core74.agentLatticeManager.getAllAgentLatticesByTenant(t2).map((lattice) => lattice.config.key)
|
|
1470
|
+
)
|
|
1471
|
+
};
|
|
1472
|
+
}
|
|
1473
|
+
function invalidatePluginReflectionCache(tenantId) {
|
|
1474
|
+
if (!tenantId) {
|
|
1475
|
+
pluginCache.clear();
|
|
1476
|
+
return;
|
|
1477
|
+
}
|
|
1478
|
+
pluginCache.delete(tenantId);
|
|
1479
|
+
}
|
|
1480
|
+
function mergeGrantsByDomain(grants) {
|
|
1481
|
+
const order = [];
|
|
1482
|
+
const items = /* @__PURE__ */ new Map();
|
|
1483
|
+
const unrestricted = /* @__PURE__ */ new Set();
|
|
1484
|
+
for (const grant of grants) {
|
|
1485
|
+
if (!grant || typeof grant.domain !== "string" || grant.domain.length === 0) continue;
|
|
1486
|
+
if (!items.has(grant.domain)) {
|
|
1487
|
+
items.set(grant.domain, /* @__PURE__ */ new Set());
|
|
1488
|
+
order.push(grant.domain);
|
|
1489
|
+
}
|
|
1490
|
+
if (!grant.items || grant.items.length === 0) {
|
|
1491
|
+
unrestricted.add(grant.domain);
|
|
1492
|
+
continue;
|
|
1493
|
+
}
|
|
1494
|
+
const bucket = items.get(grant.domain);
|
|
1495
|
+
if (!bucket) continue;
|
|
1496
|
+
for (const item of grant.items) {
|
|
1497
|
+
if (typeof item === "string" && item.length > 0) bucket.add(item);
|
|
1498
|
+
}
|
|
1499
|
+
}
|
|
1500
|
+
return order.map((domain) => {
|
|
1501
|
+
if (unrestricted.has(domain)) return { domain };
|
|
1502
|
+
return { domain, items: [...items.get(domain) ?? []] };
|
|
1503
|
+
});
|
|
1504
|
+
}
|
|
1505
|
+
async function computePluginGrants(tenantId, deps) {
|
|
1506
|
+
const grants = [...deps.globalExposedDomains?.() ?? []];
|
|
1507
|
+
if (deps.tenantExposedDomains) {
|
|
1508
|
+
grants.push(...await deps.tenantExposedDomains(tenantId));
|
|
1509
|
+
}
|
|
1510
|
+
if (deps.resolvableAssistants) {
|
|
1511
|
+
const resolvable = await deps.resolvableAssistants(tenantId);
|
|
1512
|
+
if (resolvable.size > 0) {
|
|
1513
|
+
grants.push({ domain: "agent", items: [...resolvable] });
|
|
1514
|
+
}
|
|
1515
|
+
}
|
|
1516
|
+
return mergeGrantsByDomain(grants);
|
|
1517
|
+
}
|
|
1518
|
+
async function resolvePluginOpenGrants(tenantId, deps) {
|
|
1519
|
+
try {
|
|
1520
|
+
const now = deps.now ? deps.now() : Date.now();
|
|
1521
|
+
const hit = pluginCache.get(tenantId);
|
|
1522
|
+
if (hit && hit.expiresAt > now) return cloneGrants(hit.grants);
|
|
1523
|
+
await deps.ensure?.(tenantId);
|
|
1524
|
+
const grants = await computePluginGrants(tenantId, deps);
|
|
1525
|
+
pluginCache.set(tenantId, { grants, expiresAt: now + PLUGIN_REFLECTION_CACHE_TTL_MS });
|
|
1526
|
+
return cloneGrants(grants);
|
|
1527
|
+
} catch {
|
|
1528
|
+
return [];
|
|
1529
|
+
}
|
|
1530
|
+
}
|
|
1531
|
+
function buildTenantExposedGrants(manifests) {
|
|
1532
|
+
const grants = [];
|
|
1533
|
+
for (const manifest of manifests) {
|
|
1534
|
+
const items = (manifest.tools ?? []).filter((tool) => tool.expose === true).map((tool) => tool.name);
|
|
1535
|
+
if (items.length > 0) grants.push({ domain: manifest.type, items });
|
|
1536
|
+
}
|
|
1537
|
+
return grants;
|
|
1538
|
+
}
|
|
1539
|
+
function createDefaultPluginReflectionDeps() {
|
|
1540
|
+
return {
|
|
1541
|
+
ensure: (tenantId) => import_core74.agentLatticeManager.initializeStoredAssistantsForTenant(tenantId),
|
|
1542
|
+
globalExposedDomains: () => {
|
|
1543
|
+
const grants = [];
|
|
1544
|
+
for (const type of import_core74.PluginRegistry.list()) {
|
|
1545
|
+
const plugin = import_core74.PluginRegistry.get(type);
|
|
1546
|
+
const items = normalizeOpenExpose(plugin?.meta.openExpose);
|
|
1547
|
+
if (items.length > 0) grants.push({ domain: type, items });
|
|
1548
|
+
}
|
|
1549
|
+
return grants;
|
|
1550
|
+
},
|
|
1551
|
+
tenantExposedDomains: async (tenantId) => {
|
|
1552
|
+
const { manifests } = await (0, import_core74.getSandboxPluginCatalog)().ensureLoaded(tenantId);
|
|
1553
|
+
return buildTenantExposedGrants(Object.values(manifests));
|
|
1554
|
+
},
|
|
1555
|
+
resolvableAssistants: async (tenantId) => new Set(
|
|
1556
|
+
import_core74.agentLatticeManager.getAllAgentLatticesByTenant(tenantId).map((lattice) => lattice.config.key)
|
|
1557
|
+
)
|
|
1558
|
+
};
|
|
1559
|
+
}
|
|
1560
|
+
var import_core74, AGENT_REFLECTION_CACHE_TTL_MS, cache, PLUGIN_REFLECTION_CACHE_TTL_MS, pluginCache;
|
|
1561
|
+
var init_sandboxOpenReflection = __esm({
|
|
1562
|
+
"src/services/open/sandboxOpenReflection.ts"() {
|
|
1563
|
+
"use strict";
|
|
1564
|
+
import_core74 = require("@axiom-lattice/core");
|
|
1565
|
+
AGENT_REFLECTION_CACHE_TTL_MS = 6e4;
|
|
1566
|
+
cache = /* @__PURE__ */ new Map();
|
|
1567
|
+
PLUGIN_REFLECTION_CACHE_TTL_MS = 6e4;
|
|
1568
|
+
pluginCache = /* @__PURE__ */ new Map();
|
|
1569
|
+
}
|
|
1570
|
+
});
|
|
1571
|
+
|
|
1337
1572
|
// src/services/collaboration/TopCallerRecovery.ts
|
|
1338
1573
|
function hasPendingInterrupts(state) {
|
|
1339
1574
|
return (state.tasks ?? []).some((t2) => (t2.interrupts?.length ?? 0) > 0);
|
|
@@ -1373,7 +1608,7 @@ function outcome(task) {
|
|
|
1373
1608
|
});
|
|
1374
1609
|
}
|
|
1375
1610
|
async function backfillTopCallerGroup(tasks, top, deps) {
|
|
1376
|
-
const registry = deps.registry ??
|
|
1611
|
+
const registry = deps.registry ?? import_core77.taskRunRegistry;
|
|
1377
1612
|
const results = [];
|
|
1378
1613
|
const eligible = [];
|
|
1379
1614
|
for (const task of tasks) {
|
|
@@ -1427,11 +1662,11 @@ async function recoverTask(task, deps) {
|
|
|
1427
1662
|
if (task.status !== "in_progress") {
|
|
1428
1663
|
return { kind: "skipped", reason: "not_in_progress" };
|
|
1429
1664
|
}
|
|
1430
|
-
const registry = deps.registry ??
|
|
1665
|
+
const registry = deps.registry ?? import_core77.taskRunRegistry;
|
|
1431
1666
|
if (registry.isLive(task.id) || deps.isTaskLive && await deps.isTaskLive(task)) {
|
|
1432
1667
|
return { kind: "skipped", reason: "live" };
|
|
1433
1668
|
}
|
|
1434
|
-
const { convergedTasks } = await (0,
|
|
1669
|
+
const { convergedTasks } = await (0, import_core77.reconcileStaleTaskRuns)({
|
|
1435
1670
|
tasks: [task],
|
|
1436
1671
|
actor: "system:on-demand-recovery",
|
|
1437
1672
|
lifecycle: deps.lifecycle,
|
|
@@ -1527,30 +1762,30 @@ async function runOrphanRecovery(deps) {
|
|
|
1527
1762
|
deps.log.info("Task orphan recovery complete", { recovered, skipped });
|
|
1528
1763
|
return { recovered, skipped };
|
|
1529
1764
|
}
|
|
1530
|
-
var import_messages,
|
|
1765
|
+
var import_messages, import_core77;
|
|
1531
1766
|
var init_TopCallerRecovery = __esm({
|
|
1532
1767
|
"src/services/collaboration/TopCallerRecovery.ts"() {
|
|
1533
1768
|
"use strict";
|
|
1534
1769
|
import_messages = require("@langchain/core/messages");
|
|
1535
|
-
|
|
1770
|
+
import_core77 = require("@axiom-lattice/core");
|
|
1536
1771
|
}
|
|
1537
1772
|
});
|
|
1538
1773
|
|
|
1539
1774
|
// src/services/collaboration/taskRunLiveness.ts
|
|
1540
1775
|
function createTaskRunLiveness() {
|
|
1541
1776
|
try {
|
|
1542
|
-
|
|
1777
|
+
import_core78.storeLatticeManager.getStoreLattice("default", "lease");
|
|
1543
1778
|
} catch {
|
|
1544
1779
|
return void 0;
|
|
1545
1780
|
}
|
|
1546
|
-
return (task) => (0,
|
|
1781
|
+
return (task) => (0, import_core79.isTaskRunLeaseHeld)(task);
|
|
1547
1782
|
}
|
|
1548
|
-
var
|
|
1783
|
+
var import_core78, import_core79;
|
|
1549
1784
|
var init_taskRunLiveness = __esm({
|
|
1550
1785
|
"src/services/collaboration/taskRunLiveness.ts"() {
|
|
1551
1786
|
"use strict";
|
|
1552
|
-
import_core77 = require("@axiom-lattice/core");
|
|
1553
1787
|
import_core78 = require("@axiom-lattice/core");
|
|
1788
|
+
import_core79 = require("@axiom-lattice/core");
|
|
1554
1789
|
}
|
|
1555
1790
|
});
|
|
1556
1791
|
|
|
@@ -1560,7 +1795,7 @@ __export(OrphanRecoveryRuntime_exports, {
|
|
|
1560
1795
|
createOrphanRecoveryRuntime: () => createOrphanRecoveryRuntime
|
|
1561
1796
|
});
|
|
1562
1797
|
function createOrphanRecoveryRuntime(deps) {
|
|
1563
|
-
const lifecycle = deps.lifecycle ?? (0,
|
|
1798
|
+
const lifecycle = deps.lifecycle ?? (0, import_core80.createTaskLifecycleService)({
|
|
1564
1799
|
taskStore: deps.taskStore,
|
|
1565
1800
|
workItemStore: deps.workItemStore
|
|
1566
1801
|
});
|
|
@@ -1568,7 +1803,7 @@ function createOrphanRecoveryRuntime(deps) {
|
|
|
1568
1803
|
async recoverAll() {
|
|
1569
1804
|
const isTaskLive = deps.isTaskLive ?? createTaskRunLiveness();
|
|
1570
1805
|
return runOrphanRecovery({
|
|
1571
|
-
reconcile: () => (0,
|
|
1806
|
+
reconcile: () => (0, import_core80.reconcileAllTenantTaskRuns)({
|
|
1572
1807
|
actor: "system:orphan-recovery",
|
|
1573
1808
|
tenantStore: {
|
|
1574
1809
|
listTenants: async () => (await deps.tenantStore.getAllTenants()).map((tenant2) => ({ id: tenant2.id }))
|
|
@@ -1594,7 +1829,7 @@ function createOrphanRecoveryRuntime(deps) {
|
|
|
1594
1829
|
const isTaskLive = deps.isTaskLive ?? createTaskRunLiveness();
|
|
1595
1830
|
return recoverTask(task, {
|
|
1596
1831
|
lifecycle,
|
|
1597
|
-
registry:
|
|
1832
|
+
registry: import_core80.taskRunRegistry,
|
|
1598
1833
|
orphans,
|
|
1599
1834
|
callerFor: deps.callerFor,
|
|
1600
1835
|
resume: deps.resume,
|
|
@@ -1603,11 +1838,11 @@ function createOrphanRecoveryRuntime(deps) {
|
|
|
1603
1838
|
}
|
|
1604
1839
|
};
|
|
1605
1840
|
}
|
|
1606
|
-
var
|
|
1841
|
+
var import_core80;
|
|
1607
1842
|
var init_OrphanRecoveryRuntime = __esm({
|
|
1608
1843
|
"src/services/collaboration/OrphanRecoveryRuntime.ts"() {
|
|
1609
1844
|
"use strict";
|
|
1610
|
-
|
|
1845
|
+
import_core80 = require("@axiom-lattice/core");
|
|
1611
1846
|
init_TopCallerRecovery();
|
|
1612
1847
|
init_projectTaskScope();
|
|
1613
1848
|
init_taskRunLiveness();
|
|
@@ -1623,12 +1858,12 @@ function createRecoveryCallerDeps() {
|
|
|
1623
1858
|
return {
|
|
1624
1859
|
callerFor: async (top, tenantId) => {
|
|
1625
1860
|
if (!top.assistantId) return void 0;
|
|
1626
|
-
const load =
|
|
1861
|
+
const load = import_core81.getAgentClientAsync ?? import_core81.getAgentClient;
|
|
1627
1862
|
const client = await load(tenantId, top.assistantId);
|
|
1628
1863
|
const config = { configurable: { thread_id: top.threadId, runConfig: { tenantId, assistant_id: top.assistantId } } };
|
|
1629
1864
|
let agent;
|
|
1630
1865
|
try {
|
|
1631
|
-
agent =
|
|
1866
|
+
agent = import_core81.agentInstanceManager.getAgent({ assistant_id: top.assistantId, thread_id: top.threadId, tenant_id: tenantId });
|
|
1632
1867
|
} catch {
|
|
1633
1868
|
}
|
|
1634
1869
|
return agent ? { client, config, agent } : { client, config };
|
|
@@ -1645,11 +1880,11 @@ function createRecoveryCallerDeps() {
|
|
|
1645
1880
|
}
|
|
1646
1881
|
};
|
|
1647
1882
|
}
|
|
1648
|
-
var
|
|
1883
|
+
var import_core81;
|
|
1649
1884
|
var init_RecoveryCallerDeps = __esm({
|
|
1650
1885
|
"src/services/collaboration/RecoveryCallerDeps.ts"() {
|
|
1651
1886
|
"use strict";
|
|
1652
|
-
|
|
1887
|
+
import_core81 = require("@axiom-lattice/core");
|
|
1653
1888
|
}
|
|
1654
1889
|
});
|
|
1655
1890
|
|
|
@@ -2068,13 +2303,13 @@ function isA2ATaskSnapshot(value) {
|
|
|
2068
2303
|
function snapshotSequence(value) {
|
|
2069
2304
|
return typeof value === "number" && Number.isSafeInteger(value) && value >= 0 ? value : void 0;
|
|
2070
2305
|
}
|
|
2071
|
-
var import_node_crypto31, import_node_util,
|
|
2306
|
+
var import_node_crypto31, import_node_util, import_core82, TASK_STATUS_TO_A2A_STATE, TITLE_MAX_LENGTH, A2ATaskScopeConflictError, A2ATaskStoreAdapter;
|
|
2072
2307
|
var init_A2ATaskStoreAdapter = __esm({
|
|
2073
2308
|
"src/services/a2a/A2ATaskStoreAdapter.ts"() {
|
|
2074
2309
|
"use strict";
|
|
2075
2310
|
import_node_crypto31 = require("crypto");
|
|
2076
2311
|
import_node_util = require("util");
|
|
2077
|
-
|
|
2312
|
+
import_core82 = require("@axiom-lattice/core");
|
|
2078
2313
|
TASK_STATUS_TO_A2A_STATE = {
|
|
2079
2314
|
pending: "submitted",
|
|
2080
2315
|
in_progress: "working",
|
|
@@ -2100,7 +2335,7 @@ var init_A2ATaskStoreAdapter = __esm({
|
|
|
2100
2335
|
this.workItemStore = options.workItemStore;
|
|
2101
2336
|
this.lifecycle = options.lifecycle;
|
|
2102
2337
|
this.scope = options.scope;
|
|
2103
|
-
this.runBridge = (0,
|
|
2338
|
+
this.runBridge = (0, import_core82.createTaskRunBridge)({
|
|
2104
2339
|
lifecycle: this.lifecycle,
|
|
2105
2340
|
taskStore: this.taskStore,
|
|
2106
2341
|
workItemStore: this.workItemStore
|
|
@@ -2451,12 +2686,12 @@ function assistantHasGovernedTask(assistant) {
|
|
|
2451
2686
|
const allowedTools = taskMiddleware?.allowedTools;
|
|
2452
2687
|
return !!taskMiddleware && (allowedTools === void 0 || Array.isArray(allowedTools) && (allowedTools.length === 0 || allowedTools.includes("manage_task")));
|
|
2453
2688
|
}
|
|
2454
|
-
var import_uuid11,
|
|
2689
|
+
var import_uuid11, import_core83, import_protocols35, _AxiomAgentExecutor, AxiomAgentExecutor;
|
|
2455
2690
|
var init_AxiomAgentExecutor = __esm({
|
|
2456
2691
|
"src/services/a2a/AxiomAgentExecutor.ts"() {
|
|
2457
2692
|
"use strict";
|
|
2458
2693
|
import_uuid11 = require("uuid");
|
|
2459
|
-
|
|
2694
|
+
import_core83 = require("@axiom-lattice/core");
|
|
2460
2695
|
import_protocols35 = require("@axiom-lattice/protocols");
|
|
2461
2696
|
init_a2aFileRefs();
|
|
2462
2697
|
init_task_file_refs();
|
|
@@ -2553,7 +2788,7 @@ var init_AxiomAgentExecutor = __esm({
|
|
|
2553
2788
|
await this.taskStore.save(initialTask);
|
|
2554
2789
|
bus.publish(initialTask);
|
|
2555
2790
|
try {
|
|
2556
|
-
const agent =
|
|
2791
|
+
const agent = import_core83.agentInstanceManager.getAgent(this.agentParams(threadId));
|
|
2557
2792
|
const requestText = inputFiles.length > 0 ? `${text}
|
|
2558
2793
|
|
|
2559
2794
|
${formatFileRefsSection(inputFiles)}` : text;
|
|
@@ -2741,7 +2976,7 @@ ${formatFileRefsSection(inputFiles)}` : text;
|
|
|
2741
2976
|
const threadId = task ? asString2(task.metadata?.threadId) : void 0;
|
|
2742
2977
|
if (threadId) {
|
|
2743
2978
|
try {
|
|
2744
|
-
const agent =
|
|
2979
|
+
const agent = import_core83.agentInstanceManager.getAgent(this.agentParams(threadId));
|
|
2745
2980
|
await agent.abort();
|
|
2746
2981
|
} catch (err) {
|
|
2747
2982
|
console.warn({
|
|
@@ -3115,10 +3350,10 @@ function isAsyncGenerator(value) {
|
|
|
3115
3350
|
}
|
|
3116
3351
|
function registerA2AStandardRoutes(app2, deps) {
|
|
3117
3352
|
const authService = deps.authService;
|
|
3118
|
-
const resolveTasks = deps.getTaskStoreLattice ?? (() => (0,
|
|
3119
|
-
const resolveTaskWorkItems = deps.getTaskWorkItemStore ?? (() => (0,
|
|
3120
|
-
const getAssistantStore2 = deps.getAssistantStore ?? (() => (0,
|
|
3121
|
-
const getProjectStore2 = deps.getProjectStore ?? (() => (0,
|
|
3353
|
+
const resolveTasks = deps.getTaskStoreLattice ?? (() => (0, import_core84.getStoreLattice)("default", "task").store);
|
|
3354
|
+
const resolveTaskWorkItems = deps.getTaskWorkItemStore ?? (() => (0, import_core84.getStoreLattice)("default", "taskWorkItem").store);
|
|
3355
|
+
const getAssistantStore2 = deps.getAssistantStore ?? (() => (0, import_core84.getStoreLattice)("default", "assistant").store);
|
|
3356
|
+
const getProjectStore2 = deps.getProjectStore ?? (() => (0, import_core84.getStoreLattice)("default", "project").store);
|
|
3122
3357
|
const runtimeRegistry = deps.runtimeRegistry ?? new A2ARuntimeRegistry();
|
|
3123
3358
|
app2.addHook("onClose", async () => {
|
|
3124
3359
|
runtimeRegistry.close();
|
|
@@ -3201,7 +3436,7 @@ function registerA2AStandardRoutes(app2, deps) {
|
|
|
3201
3436
|
const taskStore = assistantHasGovernedTask(assistant) ? new A2ATaskStoreAdapter({
|
|
3202
3437
|
taskStore: internalTasks,
|
|
3203
3438
|
workItemStore: workItems,
|
|
3204
|
-
lifecycle: (0,
|
|
3439
|
+
lifecycle: (0, import_core84.createTaskLifecycleService)({
|
|
3205
3440
|
taskStore: internalTasks,
|
|
3206
3441
|
workItemStore: workItems
|
|
3207
3442
|
}),
|
|
@@ -3320,7 +3555,7 @@ data: ${JSON.stringify(errorResponse)}
|
|
|
3320
3555
|
const taskStore = assistantHasGovernedTask(assistant) ? new A2ATaskStoreAdapter({
|
|
3321
3556
|
taskStore: internalTasks,
|
|
3322
3557
|
workItemStore: workItems,
|
|
3323
|
-
lifecycle: (0,
|
|
3558
|
+
lifecycle: (0, import_core84.createTaskLifecycleService)({
|
|
3324
3559
|
taskStore: internalTasks,
|
|
3325
3560
|
workItemStore: workItems
|
|
3326
3561
|
}),
|
|
@@ -3375,13 +3610,13 @@ data: ${JSON.stringify(data)}
|
|
|
3375
3610
|
}
|
|
3376
3611
|
);
|
|
3377
3612
|
}
|
|
3378
|
-
var import_uuid12, import_server2,
|
|
3613
|
+
var import_uuid12, import_server2, import_core84, SSE_HEADERS;
|
|
3379
3614
|
var init_a2a_standard = __esm({
|
|
3380
3615
|
"src/routes/a2a-standard.ts"() {
|
|
3381
3616
|
"use strict";
|
|
3382
3617
|
import_uuid12 = require("uuid");
|
|
3383
3618
|
import_server2 = require("@a2a-js/sdk/server");
|
|
3384
|
-
|
|
3619
|
+
import_core84 = require("@axiom-lattice/core");
|
|
3385
3620
|
init_A2AAuthService();
|
|
3386
3621
|
init_A2AAgentCardBuilder();
|
|
3387
3622
|
init_A2ATaskStoreAdapter();
|
|
@@ -3948,8 +4183,8 @@ function exposedDeclarations(plugin) {
|
|
|
3948
4183
|
return (plugin.meta.tools ?? []).filter((t2) => t2.expose);
|
|
3949
4184
|
}
|
|
3950
4185
|
async function registerExposedPluginTools() {
|
|
3951
|
-
for (const key of
|
|
3952
|
-
const plugin =
|
|
4186
|
+
for (const key of import_core85.PluginRegistry.list()) {
|
|
4187
|
+
const plugin = import_core85.PluginRegistry.get(key);
|
|
3953
4188
|
if (!plugin?.middleware) continue;
|
|
3954
4189
|
const exposed = exposedDeclarations(plugin);
|
|
3955
4190
|
if (exposed.length === 0) continue;
|
|
@@ -3984,8 +4219,8 @@ async function registerExposedPluginTools() {
|
|
|
3984
4219
|
}
|
|
3985
4220
|
function collectExposedPluginUiResources(grants) {
|
|
3986
4221
|
const resources = /* @__PURE__ */ new Map();
|
|
3987
|
-
for (const type of
|
|
3988
|
-
const plugin =
|
|
4222
|
+
for (const type of import_core85.PluginRegistry.list()) {
|
|
4223
|
+
const plugin = import_core85.PluginRegistry.get(type);
|
|
3989
4224
|
if (!plugin?.middleware) continue;
|
|
3990
4225
|
const exposedNames = new Set(exposedDeclarations(plugin).map((d) => d.name));
|
|
3991
4226
|
if (exposedNames.size === 0) continue;
|
|
@@ -4009,11 +4244,11 @@ function collectExposedPluginUiResources(grants) {
|
|
|
4009
4244
|
}
|
|
4010
4245
|
return resources;
|
|
4011
4246
|
}
|
|
4012
|
-
var
|
|
4247
|
+
var import_core85;
|
|
4013
4248
|
var init_registerExposedPlugins = __esm({
|
|
4014
4249
|
"src/services/open/registerExposedPlugins.ts"() {
|
|
4015
4250
|
"use strict";
|
|
4016
|
-
|
|
4251
|
+
import_core85 = require("@axiom-lattice/core");
|
|
4017
4252
|
init_openLattice();
|
|
4018
4253
|
init_pluginExposeAdapter();
|
|
4019
4254
|
}
|
|
@@ -4028,14 +4263,14 @@ function toText(result) {
|
|
|
4028
4263
|
}
|
|
4029
4264
|
function defaultCatalog() {
|
|
4030
4265
|
return {
|
|
4031
|
-
getValidatedManifest: (tenantId, type) => (0,
|
|
4032
|
-
getExecutor: () => (0,
|
|
4033
|
-
readPluginFile: (tenantId, type, relPath) => (0,
|
|
4266
|
+
getValidatedManifest: (tenantId, type) => (0, import_core86.getSandboxPluginCatalog)().getValidatedManifest(tenantId, type),
|
|
4267
|
+
getExecutor: () => (0, import_core86.getSandboxPluginCatalog)().getExecutor(),
|
|
4268
|
+
readPluginFile: (tenantId, type, relPath) => (0, import_core86.getSandboxPluginCatalog)().readPluginFile(tenantId, type, relPath)
|
|
4034
4269
|
};
|
|
4035
4270
|
}
|
|
4036
4271
|
async function defaultResolveConnections(pluginType, ctx) {
|
|
4037
4272
|
try {
|
|
4038
|
-
return await (0,
|
|
4273
|
+
return await (0, import_core86.resolveSandboxPluginConnections)(
|
|
4039
4274
|
pluginType,
|
|
4040
4275
|
{ connectAll: true },
|
|
4041
4276
|
{
|
|
@@ -4064,7 +4299,7 @@ function mergeOpenCatalog(globalCatalog, tenantTools) {
|
|
|
4064
4299
|
async function buildTenantOpenPlugins(tenantId, grants, deps = {}) {
|
|
4065
4300
|
const catalog = deps.catalog ?? defaultCatalog();
|
|
4066
4301
|
const listPlugins = deps.listPlugins ?? (async (tenant2) => {
|
|
4067
|
-
const snapshot = await (0,
|
|
4302
|
+
const snapshot = await (0, import_core86.getSandboxPluginCatalog)().ensureLoaded(tenant2);
|
|
4068
4303
|
return { plugins: snapshot.plugins, diagnostics: snapshot.diagnostics };
|
|
4069
4304
|
});
|
|
4070
4305
|
const resolveConnections = deps.resolveConnections ?? defaultResolveConnections;
|
|
@@ -4106,7 +4341,7 @@ async function buildTenantOpenPlugins(tenantId, grants, deps = {}) {
|
|
|
4106
4341
|
domain,
|
|
4107
4342
|
action: tool.name,
|
|
4108
4343
|
description: tool.description,
|
|
4109
|
-
schema: (0,
|
|
4344
|
+
schema: (0, import_core86.jsonSchemaToZod)(tool.schema),
|
|
4110
4345
|
annotations: {
|
|
4111
4346
|
readOnlyHint: tool.readOnly ?? false,
|
|
4112
4347
|
destructiveHint: tool.destructive ?? false
|
|
@@ -4157,11 +4392,11 @@ async function buildTenantOpenPlugins(tenantId, grants, deps = {}) {
|
|
|
4157
4392
|
}
|
|
4158
4393
|
};
|
|
4159
4394
|
}
|
|
4160
|
-
var
|
|
4395
|
+
var import_core86;
|
|
4161
4396
|
var init_tenantOpenPlugins = __esm({
|
|
4162
4397
|
"src/services/open/tenantOpenPlugins.ts"() {
|
|
4163
4398
|
"use strict";
|
|
4164
|
-
|
|
4399
|
+
import_core86 = require("@axiom-lattice/core");
|
|
4165
4400
|
init_openLattice();
|
|
4166
4401
|
init_pluginToolExecution();
|
|
4167
4402
|
}
|
|
@@ -4198,13 +4433,13 @@ function emptyTenantPlugins() {
|
|
|
4198
4433
|
}
|
|
4199
4434
|
function registerOpenRoutes(app2, deps = {}) {
|
|
4200
4435
|
const openAuth = deps.openAuth ?? new OpenCredentialService(
|
|
4201
|
-
(0,
|
|
4202
|
-
(0,
|
|
4436
|
+
(0, import_core87.getStoreLattice)("default", "a2aApiKey").store,
|
|
4437
|
+
(0, import_core87.getStoreLattice)("default", "project").store
|
|
4203
4438
|
);
|
|
4204
4439
|
const grantsSource = deps.grantsSource ?? ((ctx) => ctx.grants);
|
|
4205
4440
|
const audit = deps.audit ?? (() => {
|
|
4206
4441
|
try {
|
|
4207
|
-
const store2 = (0,
|
|
4442
|
+
const store2 = (0, import_core87.getStoreLattice)("default", "openAudit").store;
|
|
4208
4443
|
return new OpenAuditService(store2);
|
|
4209
4444
|
} catch {
|
|
4210
4445
|
return void 0;
|
|
@@ -4347,6 +4582,23 @@ function registerOpenRoutes(app2, deps = {}) {
|
|
|
4347
4582
|
reply.hijack();
|
|
4348
4583
|
await built.transport.handleRequest(request.raw, reply.raw, body);
|
|
4349
4584
|
});
|
|
4585
|
+
app2.get("/open/mcp", async (request, reply) => {
|
|
4586
|
+
const sessionId = readSessionId(request);
|
|
4587
|
+
if (!sessionId) {
|
|
4588
|
+
reply.header("Allow", "GET, POST, DELETE");
|
|
4589
|
+
return reply.status(405).send();
|
|
4590
|
+
}
|
|
4591
|
+
const context = await openAuth.resolve(extractBearer(request));
|
|
4592
|
+
if (!context) {
|
|
4593
|
+
return reply.status(401).send({ error: "AUTH_FAILED" });
|
|
4594
|
+
}
|
|
4595
|
+
const session = await getSession(sessionId);
|
|
4596
|
+
if (!session || session.credential.credentialId !== context.credentialId) {
|
|
4597
|
+
return reply.status(404).send({ error: "SESSION_NOT_FOUND" });
|
|
4598
|
+
}
|
|
4599
|
+
reply.hijack();
|
|
4600
|
+
await session.transport.handleRequest(request.raw, reply.raw);
|
|
4601
|
+
});
|
|
4350
4602
|
app2.delete(
|
|
4351
4603
|
"/open/mcp",
|
|
4352
4604
|
async (request, reply) => {
|
|
@@ -4359,12 +4611,12 @@ function registerOpenRoutes(app2, deps = {}) {
|
|
|
4359
4611
|
}
|
|
4360
4612
|
);
|
|
4361
4613
|
}
|
|
4362
|
-
var import_types,
|
|
4614
|
+
var import_types, import_core87, RPC_ERROR;
|
|
4363
4615
|
var init_open = __esm({
|
|
4364
4616
|
"src/routes/open.ts"() {
|
|
4365
4617
|
"use strict";
|
|
4366
4618
|
import_types = require("@modelcontextprotocol/sdk/types.js");
|
|
4367
|
-
|
|
4619
|
+
import_core87 = require("@axiom-lattice/core");
|
|
4368
4620
|
init_openCredentialService();
|
|
4369
4621
|
init_openAuditService();
|
|
4370
4622
|
init_openRateLimiter();
|
|
@@ -4397,7 +4649,7 @@ function registerOpenSessionRoutes(app2) {
|
|
|
4397
4649
|
if (typeof shareToken !== "string" || shareToken.length === 0) {
|
|
4398
4650
|
return reply.status(400).send({ error: "SHARE_TOKEN_REQUIRED" });
|
|
4399
4651
|
}
|
|
4400
|
-
const store2 = (0,
|
|
4652
|
+
const store2 = (0, import_core88.getStoreLattice)("default", "sharedResource").store;
|
|
4401
4653
|
const record = await store2.findByToken(shareToken);
|
|
4402
4654
|
if (!record || record.revoked) {
|
|
4403
4655
|
return reply.status(404).send({ error: "SHARE_NOT_FOUND" });
|
|
@@ -4422,11 +4674,11 @@ function registerOpenSessionRoutes(app2) {
|
|
|
4422
4674
|
}
|
|
4423
4675
|
);
|
|
4424
4676
|
}
|
|
4425
|
-
var
|
|
4677
|
+
var import_core88;
|
|
4426
4678
|
var init_open_session = __esm({
|
|
4427
4679
|
"src/routes/open-session.ts"() {
|
|
4428
4680
|
"use strict";
|
|
4429
|
-
|
|
4681
|
+
import_core88 = require("@axiom-lattice/core");
|
|
4430
4682
|
init_openToken();
|
|
4431
4683
|
init_previewToken();
|
|
4432
4684
|
init_openLattice();
|
|
@@ -4435,13 +4687,13 @@ var init_open_session = __esm({
|
|
|
4435
4687
|
|
|
4436
4688
|
// src/services/open/openCatalogService.ts
|
|
4437
4689
|
async function defaultListTenantPlugins(tenantId) {
|
|
4438
|
-
return (await (0,
|
|
4690
|
+
return (await (0, import_core89.getSandboxPluginCatalog)().ensureLoaded(tenantId)).plugins;
|
|
4439
4691
|
}
|
|
4440
|
-
var
|
|
4692
|
+
var import_core89, OpenCatalogService;
|
|
4441
4693
|
var init_openCatalogService = __esm({
|
|
4442
4694
|
"src/services/open/openCatalogService.ts"() {
|
|
4443
4695
|
"use strict";
|
|
4444
|
-
|
|
4696
|
+
import_core89 = require("@axiom-lattice/core");
|
|
4445
4697
|
init_openLattice();
|
|
4446
4698
|
OpenCatalogService = class {
|
|
4447
4699
|
constructor(assistantStore, lattice = openLattice, listTenantPlugins2 = defaultListTenantPlugins) {
|
|
@@ -4516,17 +4768,17 @@ function registerOpenCatalogRoutes(app2) {
|
|
|
4516
4768
|
if (!tenantId) {
|
|
4517
4769
|
return reply.status(401).send({ success: false, error: "Unauthorized" });
|
|
4518
4770
|
}
|
|
4519
|
-
const assistantStore = (0,
|
|
4771
|
+
const assistantStore = (0, import_core90.getStoreLattice)("default", "assistant").store;
|
|
4520
4772
|
const service2 = new OpenCatalogService(assistantStore);
|
|
4521
4773
|
const catalog = await service2.buildForTenant(tenantId);
|
|
4522
4774
|
return reply.status(200).send({ success: true, data: catalog });
|
|
4523
4775
|
});
|
|
4524
4776
|
}
|
|
4525
|
-
var
|
|
4777
|
+
var import_core90;
|
|
4526
4778
|
var init_open_catalog = __esm({
|
|
4527
4779
|
"src/routes/open-catalog.ts"() {
|
|
4528
4780
|
"use strict";
|
|
4529
|
-
|
|
4781
|
+
import_core90 = require("@axiom-lattice/core");
|
|
4530
4782
|
init_openCatalogService();
|
|
4531
4783
|
}
|
|
4532
4784
|
});
|
|
@@ -4541,11 +4793,11 @@ async function resolveContextSandbox(ctx) {
|
|
|
4541
4793
|
const sandboxName = ctx.runConfig?.sandboxName;
|
|
4542
4794
|
if (typeof sandboxName === "string" && sandboxName.length > 0) {
|
|
4543
4795
|
try {
|
|
4544
|
-
return await
|
|
4796
|
+
return await import_core91.sandboxLatticeManager.getSandbox(sandboxName);
|
|
4545
4797
|
} catch {
|
|
4546
4798
|
}
|
|
4547
4799
|
}
|
|
4548
|
-
return
|
|
4800
|
+
return import_core91.sandboxLatticeManager.getSandboxFromConfig({
|
|
4549
4801
|
assistant_id: "",
|
|
4550
4802
|
thread_id: "",
|
|
4551
4803
|
tenantId: ctx.tenantId,
|
|
@@ -4643,12 +4895,12 @@ ${truncated}`
|
|
|
4643
4895
|
}
|
|
4644
4896
|
};
|
|
4645
4897
|
}
|
|
4646
|
-
var import_zod22,
|
|
4898
|
+
var import_zod22, import_core91, MAX_OUTPUT_BYTES;
|
|
4647
4899
|
var init_sandboxProvider = __esm({
|
|
4648
4900
|
"src/services/open/providers/sandboxProvider.ts"() {
|
|
4649
4901
|
"use strict";
|
|
4650
4902
|
import_zod22 = require("zod");
|
|
4651
|
-
|
|
4903
|
+
import_core91 = require("@axiom-lattice/core");
|
|
4652
4904
|
MAX_OUTPUT_BYTES = 64e3;
|
|
4653
4905
|
}
|
|
4654
4906
|
});
|
|
@@ -4670,12 +4922,12 @@ function safePath(raw) {
|
|
|
4670
4922
|
}
|
|
4671
4923
|
function registerOpenFilesRoutes(app2, deps = {}) {
|
|
4672
4924
|
const openAuth = deps.openAuth ?? new OpenCredentialService(
|
|
4673
|
-
(0,
|
|
4674
|
-
(0,
|
|
4925
|
+
(0, import_core92.getStoreLattice)("default", "a2aApiKey").store,
|
|
4926
|
+
(0, import_core92.getStoreLattice)("default", "project").store
|
|
4675
4927
|
);
|
|
4676
4928
|
const audit = deps.audit ?? (() => {
|
|
4677
4929
|
try {
|
|
4678
|
-
const store2 = (0,
|
|
4930
|
+
const store2 = (0, import_core92.getStoreLattice)("default", "openAudit").store;
|
|
4679
4931
|
return new OpenAuditService(store2);
|
|
4680
4932
|
} catch {
|
|
4681
4933
|
return void 0;
|
|
@@ -4785,11 +5037,11 @@ function registerOpenFilesRoutes(app2, deps = {}) {
|
|
|
4785
5037
|
}
|
|
4786
5038
|
});
|
|
4787
5039
|
}
|
|
4788
|
-
var
|
|
5040
|
+
var import_core92;
|
|
4789
5041
|
var init_open_files = __esm({
|
|
4790
5042
|
"src/routes/open-files.ts"() {
|
|
4791
5043
|
"use strict";
|
|
4792
|
-
|
|
5044
|
+
import_core92 = require("@axiom-lattice/core");
|
|
4793
5045
|
init_openCredentialService();
|
|
4794
5046
|
init_openLattice();
|
|
4795
5047
|
init_sandboxProvider();
|
|
@@ -4811,7 +5063,7 @@ function registerOpenAuditRoutes(app2) {
|
|
|
4811
5063
|
return reply.status(401).send({ success: false, error: "Unauthorized" });
|
|
4812
5064
|
}
|
|
4813
5065
|
const status = request.query.status === "ok" || request.query.status === "error" ? request.query.status : void 0;
|
|
4814
|
-
const store2 = (0,
|
|
5066
|
+
const store2 = (0, import_core93.getStoreLattice)("default", "openAudit").store;
|
|
4815
5067
|
const records = await store2.query({
|
|
4816
5068
|
tenantId,
|
|
4817
5069
|
credentialId: request.query.credentialId,
|
|
@@ -4826,11 +5078,11 @@ function registerOpenAuditRoutes(app2) {
|
|
|
4826
5078
|
}
|
|
4827
5079
|
);
|
|
4828
5080
|
}
|
|
4829
|
-
var
|
|
5081
|
+
var import_core93;
|
|
4830
5082
|
var init_open_audit = __esm({
|
|
4831
5083
|
"src/routes/open-audit.ts"() {
|
|
4832
5084
|
"use strict";
|
|
4833
|
-
|
|
5085
|
+
import_core93 = require("@axiom-lattice/core");
|
|
4834
5086
|
}
|
|
4835
5087
|
});
|
|
4836
5088
|
|
|
@@ -4847,7 +5099,7 @@ function registerOpenExposureRoutes(app2, deps = {}) {
|
|
|
4847
5099
|
if (!tenantId) {
|
|
4848
5100
|
return reply.status(401).send({ success: false, error: "Unauthorized" });
|
|
4849
5101
|
}
|
|
4850
|
-
const keyStore = (0,
|
|
5102
|
+
const keyStore = (0, import_core94.getStoreLattice)("default", "a2aApiKey").store;
|
|
4851
5103
|
const record = await keyStore.findById(request.params.id);
|
|
4852
5104
|
if (!record || record.tenantId !== tenantId) {
|
|
4853
5105
|
return reply.status(404).send({ success: false, error: "Key not found" });
|
|
@@ -4881,7 +5133,7 @@ function registerOpenExposureRoutes(app2, deps = {}) {
|
|
|
4881
5133
|
hasUi: Boolean(t2.ui)
|
|
4882
5134
|
}));
|
|
4883
5135
|
const agentGrant = grants.find((g) => g.domain === "agent");
|
|
4884
|
-
const assistantStore = (0,
|
|
5136
|
+
const assistantStore = (0, import_core94.getStoreLattice)("default", "assistant").store;
|
|
4885
5137
|
const agents = [];
|
|
4886
5138
|
for (const assistantId of agentGrant?.items ?? []) {
|
|
4887
5139
|
const assistant = await assistantStore.getAssistantById(
|
|
@@ -4916,11 +5168,11 @@ function registerOpenExposureRoutes(app2, deps = {}) {
|
|
|
4916
5168
|
}
|
|
4917
5169
|
);
|
|
4918
5170
|
}
|
|
4919
|
-
var
|
|
5171
|
+
var import_core94, import_protocols38;
|
|
4920
5172
|
var init_open_exposure = __esm({
|
|
4921
5173
|
"src/routes/open-exposure.ts"() {
|
|
4922
5174
|
"use strict";
|
|
4923
|
-
|
|
5175
|
+
import_core94 = require("@axiom-lattice/core");
|
|
4924
5176
|
import_protocols38 = require("@axiom-lattice/protocols");
|
|
4925
5177
|
init_openLattice();
|
|
4926
5178
|
init_tenantOpenPlugins();
|
|
@@ -5040,253 +5292,39 @@ function createAgentProvider(deps = {}) {
|
|
|
5040
5292
|
} catch {
|
|
5041
5293
|
}
|
|
5042
5294
|
}
|
|
5043
|
-
const agent =
|
|
5295
|
+
const agent = import_core95.agentInstanceManager.getAgent({
|
|
5044
5296
|
tenant_id: ctx.tenantId,
|
|
5045
5297
|
assistant_id: assistantId,
|
|
5046
5298
|
thread_id: threadId,
|
|
5047
5299
|
workspace_id: ctx.workspaceId ?? "",
|
|
5048
|
-
project_id: ctx.projectId
|
|
5049
|
-
});
|
|
5050
|
-
const { messageId } = await agent.addMessage({
|
|
5051
|
-
input: { message }
|
|
5052
|
-
});
|
|
5053
|
-
const parts = [];
|
|
5054
|
-
const stream = agent.chunkStream(messageId, [...STOP_TYPES]);
|
|
5055
|
-
for await (const chunk of stream) {
|
|
5056
|
-
const text = chunk.data?.content;
|
|
5057
|
-
if (chunk.type === import_protocols39.MessageChunkTypes.INTERRUPT) break;
|
|
5058
|
-
if (chunk.type === import_protocols39.MessageChunkTypes.AI && text) {
|
|
5059
|
-
parts.push(text);
|
|
5060
|
-
}
|
|
5061
|
-
}
|
|
5062
|
-
return {
|
|
5063
|
-
content: [{ type: "text", text: parts.join("") || "(no output)" }]
|
|
5064
|
-
};
|
|
5065
|
-
}
|
|
5066
|
-
};
|
|
5067
|
-
}
|
|
5068
|
-
var import_zod24, import_core94, import_protocols39, STOP_TYPES;
|
|
5069
|
-
var init_agentProvider = __esm({
|
|
5070
|
-
"src/services/open/providers/agentProvider.ts"() {
|
|
5071
|
-
"use strict";
|
|
5072
|
-
import_zod24 = require("zod");
|
|
5073
|
-
import_core94 = require("@axiom-lattice/core");
|
|
5074
|
-
import_protocols39 = require("@axiom-lattice/protocols");
|
|
5075
|
-
STOP_TYPES = [import_protocols39.MessageChunkTypes.MESSAGE_COMPLETED];
|
|
5076
|
-
}
|
|
5077
|
-
});
|
|
5078
|
-
|
|
5079
|
-
// src/services/open/sandboxOpenReflection.ts
|
|
5080
|
-
function cloneGrants(grants) {
|
|
5081
|
-
return grants.map((grant) => ({
|
|
5082
|
-
...grant,
|
|
5083
|
-
items: grant.items ? [...grant.items] : void 0
|
|
5084
|
-
}));
|
|
5085
|
-
}
|
|
5086
|
-
function normalizeOpenExpose(value) {
|
|
5087
|
-
if (!Array.isArray(value)) return [];
|
|
5088
|
-
const out = [];
|
|
5089
|
-
for (const entry of value) {
|
|
5090
|
-
if (typeof entry === "string") {
|
|
5091
|
-
if (entry) out.push(entry);
|
|
5092
|
-
} else if (entry && typeof entry === "object") {
|
|
5093
|
-
const name = entry.name;
|
|
5094
|
-
if (typeof name === "string" && name) out.push(name);
|
|
5095
|
-
}
|
|
5096
|
-
}
|
|
5097
|
-
return out;
|
|
5098
|
-
}
|
|
5099
|
-
function extractMiddleware(container) {
|
|
5100
|
-
if (!container || typeof container !== "object") return void 0;
|
|
5101
|
-
const raw = container.middleware;
|
|
5102
|
-
if (!Array.isArray(raw)) return void 0;
|
|
5103
|
-
const out = [];
|
|
5104
|
-
for (const entry of raw) {
|
|
5105
|
-
if (!entry || typeof entry !== "object") continue;
|
|
5106
|
-
const type = entry.type;
|
|
5107
|
-
if (typeof type !== "string" || type.length === 0) continue;
|
|
5108
|
-
const enabled = entry.enabled;
|
|
5109
|
-
const rawAllowed = entry.allowedTools;
|
|
5110
|
-
const allowedTools = Array.isArray(rawAllowed) ? rawAllowed.filter((t2) => typeof t2 === "string" && t2.length > 0) : void 0;
|
|
5111
|
-
out.push({ type, enabled: typeof enabled === "boolean" ? enabled : void 0, allowedTools });
|
|
5112
|
-
}
|
|
5113
|
-
return out;
|
|
5114
|
-
}
|
|
5115
|
-
function extractSubAgents(config) {
|
|
5116
|
-
if (!config || typeof config !== "object") return void 0;
|
|
5117
|
-
const raw = config.subAgents;
|
|
5118
|
-
if (!Array.isArray(raw)) return void 0;
|
|
5119
|
-
const out = raw.filter((id3) => typeof id3 === "string" && id3.length > 0);
|
|
5120
|
-
return out.length > 0 ? out : void 0;
|
|
5121
|
-
}
|
|
5122
|
-
async function computeGrants(tenantId, assistantId, deps) {
|
|
5123
|
-
await deps.ensure?.(tenantId);
|
|
5124
|
-
let context = await deps.getAgentConfig?.(tenantId, assistantId);
|
|
5125
|
-
if (context === void 0) {
|
|
5126
|
-
const middleware = await deps.getAssistantMiddleware?.(tenantId, assistantId);
|
|
5127
|
-
if (middleware === void 0) return [];
|
|
5128
|
-
context = { middleware };
|
|
5129
|
-
}
|
|
5130
|
-
const byDomain = /* @__PURE__ */ new Map();
|
|
5131
|
-
const add = (domain, items) => {
|
|
5132
|
-
let bucket = byDomain.get(domain);
|
|
5133
|
-
if (!bucket) {
|
|
5134
|
-
bucket = /* @__PURE__ */ new Set();
|
|
5135
|
-
byDomain.set(domain, bucket);
|
|
5136
|
-
}
|
|
5137
|
-
for (const item of items) bucket.add(item);
|
|
5138
|
-
};
|
|
5139
|
-
for (const entry of context.middleware ?? []) {
|
|
5140
|
-
if (!entry || entry.enabled === false) continue;
|
|
5141
|
-
if (typeof entry.type !== "string" || entry.type.length === 0) continue;
|
|
5142
|
-
let actions = deps.exposedActionsByType(entry.type);
|
|
5143
|
-
if (actions.length === 0) continue;
|
|
5144
|
-
const allowedTools = entry.allowedTools;
|
|
5145
|
-
if (Array.isArray(allowedTools) && allowedTools.length > 0) {
|
|
5146
|
-
const allowed = new Set(allowedTools);
|
|
5147
|
-
actions = actions.filter((action) => allowed.has(action));
|
|
5148
|
-
if (actions.length === 0) continue;
|
|
5149
|
-
}
|
|
5150
|
-
add(entry.type, actions);
|
|
5151
|
-
}
|
|
5152
|
-
const subAgents = context.subAgents ?? [];
|
|
5153
|
-
if (subAgents.length > 0 && deps.resolvableAssistants) {
|
|
5154
|
-
const resolvable = await deps.resolvableAssistants(tenantId);
|
|
5155
|
-
const kept = subAgents.filter(
|
|
5156
|
-
(id3) => typeof id3 === "string" && id3.length > 0 && resolvable.has(id3)
|
|
5157
|
-
);
|
|
5158
|
-
if (kept.length > 0) add("agent", kept);
|
|
5159
|
-
}
|
|
5160
|
-
return [...byDomain].map(([domain, items]) => ({ domain, items: [...items] }));
|
|
5161
|
-
}
|
|
5162
|
-
async function resolveAgentOpenGrants(tenantId, assistantId, deps) {
|
|
5163
|
-
try {
|
|
5164
|
-
const key = `${tenantId}:${assistantId}`;
|
|
5165
|
-
const now = deps.now ? deps.now() : Date.now();
|
|
5166
|
-
const hit = cache.get(key);
|
|
5167
|
-
if (hit && hit.expiresAt > now) return cloneGrants(hit.grants);
|
|
5168
|
-
const grants = await computeGrants(tenantId, assistantId, deps);
|
|
5169
|
-
cache.set(key, { grants, expiresAt: now + AGENT_REFLECTION_CACHE_TTL_MS });
|
|
5170
|
-
return cloneGrants(grants);
|
|
5171
|
-
} catch {
|
|
5172
|
-
return [];
|
|
5173
|
-
}
|
|
5174
|
-
}
|
|
5175
|
-
function createDefaultAgentReflectionDeps(tenantId) {
|
|
5176
|
-
(0, import_core95.ensureBuiltinAgentsForTenant)(tenantId);
|
|
5177
|
-
return {
|
|
5178
|
-
ensure: (t2) => import_core95.agentLatticeManager.initializeStoredAssistantsForTenant(t2),
|
|
5179
|
-
getAgentConfig: (t2, assistantId) => {
|
|
5180
|
-
const config = import_core95.agentLatticeManager.getAgentConfigWithTenant(t2, assistantId);
|
|
5181
|
-
if (!config) return void 0;
|
|
5182
|
-
return {
|
|
5183
|
-
middleware: extractMiddleware(config),
|
|
5184
|
-
subAgents: extractSubAgents(config)
|
|
5185
|
-
};
|
|
5186
|
-
},
|
|
5187
|
-
getAssistantMiddleware: async (t2, assistantId) => {
|
|
5188
|
-
const store2 = (0, import_core95.getStoreLattice)("default", "assistant").store;
|
|
5189
|
-
const assistant = await store2.getAssistantById(t2, assistantId);
|
|
5190
|
-
return extractMiddleware(assistant?.graphDefinition);
|
|
5191
|
-
},
|
|
5192
|
-
exposedActionsByType: (type) => {
|
|
5193
|
-
const plugin = import_core95.PluginRegistry.get(type);
|
|
5194
|
-
return plugin ? normalizeOpenExpose(plugin.meta.openExpose) : [];
|
|
5195
|
-
},
|
|
5196
|
-
resolvableAssistants: async (t2) => new Set(
|
|
5197
|
-
import_core95.agentLatticeManager.getAllAgentLatticesByTenant(t2).map((lattice) => lattice.config.key)
|
|
5198
|
-
)
|
|
5199
|
-
};
|
|
5200
|
-
}
|
|
5201
|
-
function mergeGrantsByDomain(grants) {
|
|
5202
|
-
const order = [];
|
|
5203
|
-
const items = /* @__PURE__ */ new Map();
|
|
5204
|
-
const unrestricted = /* @__PURE__ */ new Set();
|
|
5205
|
-
for (const grant of grants) {
|
|
5206
|
-
if (!grant || typeof grant.domain !== "string" || grant.domain.length === 0) continue;
|
|
5207
|
-
if (!items.has(grant.domain)) {
|
|
5208
|
-
items.set(grant.domain, /* @__PURE__ */ new Set());
|
|
5209
|
-
order.push(grant.domain);
|
|
5210
|
-
}
|
|
5211
|
-
if (!grant.items || grant.items.length === 0) {
|
|
5212
|
-
unrestricted.add(grant.domain);
|
|
5213
|
-
continue;
|
|
5214
|
-
}
|
|
5215
|
-
const bucket = items.get(grant.domain);
|
|
5216
|
-
if (!bucket) continue;
|
|
5217
|
-
for (const item of grant.items) {
|
|
5218
|
-
if (typeof item === "string" && item.length > 0) bucket.add(item);
|
|
5219
|
-
}
|
|
5220
|
-
}
|
|
5221
|
-
return order.map((domain) => {
|
|
5222
|
-
if (unrestricted.has(domain)) return { domain };
|
|
5223
|
-
return { domain, items: [...items.get(domain) ?? []] };
|
|
5224
|
-
});
|
|
5225
|
-
}
|
|
5226
|
-
async function computePluginGrants(tenantId, deps) {
|
|
5227
|
-
const grants = [...deps.globalExposedDomains?.() ?? []];
|
|
5228
|
-
if (deps.tenantExposedDomains) {
|
|
5229
|
-
grants.push(...await deps.tenantExposedDomains(tenantId));
|
|
5230
|
-
}
|
|
5231
|
-
if (deps.resolvableAssistants) {
|
|
5232
|
-
const resolvable = await deps.resolvableAssistants(tenantId);
|
|
5233
|
-
if (resolvable.size > 0) {
|
|
5234
|
-
grants.push({ domain: "agent", items: [...resolvable] });
|
|
5235
|
-
}
|
|
5236
|
-
}
|
|
5237
|
-
return mergeGrantsByDomain(grants);
|
|
5238
|
-
}
|
|
5239
|
-
async function resolvePluginOpenGrants(tenantId, deps) {
|
|
5240
|
-
try {
|
|
5241
|
-
const now = deps.now ? deps.now() : Date.now();
|
|
5242
|
-
const hit = pluginCache.get(tenantId);
|
|
5243
|
-
if (hit && hit.expiresAt > now) return cloneGrants(hit.grants);
|
|
5244
|
-
await deps.ensure?.(tenantId);
|
|
5245
|
-
const grants = await computePluginGrants(tenantId, deps);
|
|
5246
|
-
pluginCache.set(tenantId, { grants, expiresAt: now + PLUGIN_REFLECTION_CACHE_TTL_MS });
|
|
5247
|
-
return cloneGrants(grants);
|
|
5248
|
-
} catch {
|
|
5249
|
-
return [];
|
|
5250
|
-
}
|
|
5251
|
-
}
|
|
5252
|
-
function buildTenantExposedGrants(manifests) {
|
|
5253
|
-
const grants = [];
|
|
5254
|
-
for (const manifest of manifests) {
|
|
5255
|
-
const items = (manifest.tools ?? []).filter((tool) => tool.expose === true).map((tool) => tool.name);
|
|
5256
|
-
if (items.length > 0) grants.push({ domain: manifest.type, items });
|
|
5257
|
-
}
|
|
5258
|
-
return grants;
|
|
5259
|
-
}
|
|
5260
|
-
function createDefaultPluginReflectionDeps() {
|
|
5261
|
-
return {
|
|
5262
|
-
ensure: (tenantId) => import_core95.agentLatticeManager.initializeStoredAssistantsForTenant(tenantId),
|
|
5263
|
-
globalExposedDomains: () => {
|
|
5264
|
-
const grants = [];
|
|
5265
|
-
for (const type of import_core95.PluginRegistry.list()) {
|
|
5266
|
-
const plugin = import_core95.PluginRegistry.get(type);
|
|
5267
|
-
const items = normalizeOpenExpose(plugin?.meta.openExpose);
|
|
5268
|
-
if (items.length > 0) grants.push({ domain: type, items });
|
|
5300
|
+
project_id: ctx.projectId
|
|
5301
|
+
});
|
|
5302
|
+
const { messageId } = await agent.addMessage({
|
|
5303
|
+
input: { message }
|
|
5304
|
+
});
|
|
5305
|
+
const parts = [];
|
|
5306
|
+
const stream = agent.chunkStream(messageId, [...STOP_TYPES]);
|
|
5307
|
+
for await (const chunk of stream) {
|
|
5308
|
+
const text = chunk.data?.content;
|
|
5309
|
+
if (chunk.type === import_protocols39.MessageChunkTypes.INTERRUPT) break;
|
|
5310
|
+
if (chunk.type === import_protocols39.MessageChunkTypes.AI && text) {
|
|
5311
|
+
parts.push(text);
|
|
5312
|
+
}
|
|
5269
5313
|
}
|
|
5270
|
-
return
|
|
5271
|
-
|
|
5272
|
-
|
|
5273
|
-
|
|
5274
|
-
return buildTenantExposedGrants(Object.values(manifests));
|
|
5275
|
-
},
|
|
5276
|
-
resolvableAssistants: async (tenantId) => new Set(
|
|
5277
|
-
import_core95.agentLatticeManager.getAllAgentLatticesByTenant(tenantId).map((lattice) => lattice.config.key)
|
|
5278
|
-
)
|
|
5314
|
+
return {
|
|
5315
|
+
content: [{ type: "text", text: parts.join("") || "(no output)" }]
|
|
5316
|
+
};
|
|
5317
|
+
}
|
|
5279
5318
|
};
|
|
5280
5319
|
}
|
|
5281
|
-
var
|
|
5282
|
-
var
|
|
5283
|
-
"src/services/open/
|
|
5320
|
+
var import_zod24, import_core95, import_protocols39, STOP_TYPES;
|
|
5321
|
+
var init_agentProvider = __esm({
|
|
5322
|
+
"src/services/open/providers/agentProvider.ts"() {
|
|
5284
5323
|
"use strict";
|
|
5324
|
+
import_zod24 = require("zod");
|
|
5285
5325
|
import_core95 = require("@axiom-lattice/core");
|
|
5286
|
-
|
|
5287
|
-
|
|
5288
|
-
PLUGIN_REFLECTION_CACHE_TTL_MS = 6e4;
|
|
5289
|
-
pluginCache = /* @__PURE__ */ new Map();
|
|
5326
|
+
import_protocols39 = require("@axiom-lattice/protocols");
|
|
5327
|
+
STOP_TYPES = [import_protocols39.MessageChunkTypes.MESSAGE_COMPLETED];
|
|
5290
5328
|
}
|
|
5291
5329
|
});
|
|
5292
5330
|
|
|
@@ -5477,12 +5515,7 @@ var init_resources = __esm({
|
|
|
5477
5515
|
const ext = subPath.endsWith(".py") ? "py" : "js";
|
|
5478
5516
|
return this._execApi(record2, subPath, ext, request, reply);
|
|
5479
5517
|
}
|
|
5480
|
-
|
|
5481
|
-
if (cached && !cached.requiresUnlock) {
|
|
5482
|
-
this.deps.logger.info("[share] cache hit", { token, volume: cached.address.volume, resourcePath: cached.address.resourcePath });
|
|
5483
|
-
return this._serveFile(cached.address, token, subPath, cached.sandboxConfig ?? { tenantId: "default", workspaceId: "", projectId: "", assistantId: null }, reply, request.headers.range);
|
|
5484
|
-
}
|
|
5485
|
-
this.deps.logger.info("[share] cache miss, querying DB", { token });
|
|
5518
|
+
this.deps.logger.info("[share] querying DB", { token });
|
|
5486
5519
|
const record = await this.deps.store.findByToken(token);
|
|
5487
5520
|
if (!record || record.revoked) {
|
|
5488
5521
|
this.deps.logger.warn("[share] token not found or revoked", { token, found: !!record, revoked: record?.revoked });
|
|
@@ -5509,11 +5542,6 @@ var init_resources = __esm({
|
|
|
5509
5542
|
const unlocked = this._isUnlocked(request, token);
|
|
5510
5543
|
if (!unlocked) {
|
|
5511
5544
|
this.deps.logger.info("[share] password protected, returning password page", { token });
|
|
5512
|
-
this.deps.cache.set(token, {
|
|
5513
|
-
address: record.address,
|
|
5514
|
-
requiresUnlock: true,
|
|
5515
|
-
sandboxConfig: { tenantId: record.tenantId, workspaceId: record.workspaceId, projectId: record.projectId, assistantId: record.assistantId }
|
|
5516
|
-
});
|
|
5517
5545
|
return reply.type("text/html").send(this._passwordPage(token));
|
|
5518
5546
|
}
|
|
5519
5547
|
this.deps.logger.info("[share] password unlocked", { token });
|
|
@@ -5527,11 +5555,6 @@ var init_resources = __esm({
|
|
|
5527
5555
|
});
|
|
5528
5556
|
}
|
|
5529
5557
|
const sandboxConfig = { tenantId: record.tenantId, workspaceId: record.workspaceId, projectId: record.projectId, assistantId: record.assistantId };
|
|
5530
|
-
this.deps.cache.set(token, {
|
|
5531
|
-
address: record.address,
|
|
5532
|
-
requiresUnlock: record.visibility === "password" && !isInternal,
|
|
5533
|
-
sandboxConfig
|
|
5534
|
-
});
|
|
5535
5558
|
return this._serveFile(record.address, token, subPath, sandboxConfig, reply, request.headers.range);
|
|
5536
5559
|
}
|
|
5537
5560
|
/**
|
|
@@ -5792,7 +5815,7 @@ __export(index_exports, {
|
|
|
5792
5815
|
runOrphanRecovery: () => runOrphanRecovery
|
|
5793
5816
|
});
|
|
5794
5817
|
module.exports = __toCommonJS(index_exports);
|
|
5795
|
-
var
|
|
5818
|
+
var import_config = require("dotenv/config");
|
|
5796
5819
|
var import_fastify = __toESM(require("fastify"));
|
|
5797
5820
|
var import_cors = __toESM(require("@fastify/cors"));
|
|
5798
5821
|
var import_multipart = __toESM(require("@fastify/multipart"));
|
|
@@ -6503,11 +6526,7 @@ async function getAssistantStats(request, reply) {
|
|
|
6503
6526
|
const assistantMap = /* @__PURE__ */ new Map();
|
|
6504
6527
|
codeConfiguredAssistants.forEach((a) => assistantMap.set(a.id, a));
|
|
6505
6528
|
storedAssistants.forEach((a) => assistantMap.set(a.id, a));
|
|
6506
|
-
const
|
|
6507
|
-
const assistants = Array.from(assistantMap.values()).filter((a) => {
|
|
6508
|
-
if (!a.ownerUserId) return true;
|
|
6509
|
-
return a.ownerUserId === userId;
|
|
6510
|
-
});
|
|
6529
|
+
const assistants = Array.from(assistantMap.values());
|
|
6511
6530
|
const threadStore = (0, import_core.getStoreLattice)("default", "thread").store;
|
|
6512
6531
|
const evalStore = (0, import_core.getStoreLattice)("default", "eval").store;
|
|
6513
6532
|
const now = Date.now();
|
|
@@ -7539,202 +7558,11 @@ async function resumeScheduledTask(request, reply) {
|
|
|
7539
7558
|
}
|
|
7540
7559
|
}
|
|
7541
7560
|
|
|
7542
|
-
// src/config.ts
|
|
7543
|
-
var ConfigService = class {
|
|
7544
|
-
constructor() {
|
|
7545
|
-
this.config = this.loadFromEnv();
|
|
7546
|
-
}
|
|
7547
|
-
/**
|
|
7548
|
-
* Load configuration from environment variables
|
|
7549
|
-
*/
|
|
7550
|
-
loadFromEnv() {
|
|
7551
|
-
return {
|
|
7552
|
-
port: process.env.PORT ? Number(process.env.PORT) : void 0,
|
|
7553
|
-
queueServiceType: process.env.QUEUE_SERVICE_TYPE,
|
|
7554
|
-
redisUrl: process.env.REDIS_URL,
|
|
7555
|
-
redisPassword: process.env.REDIS_PASSWORD,
|
|
7556
|
-
queueName: process.env.QUEUE_NAME
|
|
7557
|
-
};
|
|
7558
|
-
}
|
|
7559
|
-
/**
|
|
7560
|
-
* Update configuration from JSON object
|
|
7561
|
-
* This will update both the internal config and process.env
|
|
7562
|
-
*/
|
|
7563
|
-
updateConfig(jsonConfig) {
|
|
7564
|
-
for (const [key, value] of Object.entries(jsonConfig)) {
|
|
7565
|
-
if (value !== null && value !== void 0) {
|
|
7566
|
-
if (typeof value === "object" && !Array.isArray(value)) {
|
|
7567
|
-
for (const [nestedKey, nestedValue] of Object.entries(value)) {
|
|
7568
|
-
const envKey = `${key.toUpperCase()}_${nestedKey.toUpperCase()}`;
|
|
7569
|
-
process.env[envKey] = String(nestedValue);
|
|
7570
|
-
}
|
|
7571
|
-
} else {
|
|
7572
|
-
process.env[key.toUpperCase()] = String(value);
|
|
7573
|
-
}
|
|
7574
|
-
}
|
|
7575
|
-
}
|
|
7576
|
-
this.config = this.loadFromEnv();
|
|
7577
|
-
this.config = this.deepMerge(this.config, jsonConfig);
|
|
7578
|
-
}
|
|
7579
|
-
/**
|
|
7580
|
-
* Deep merge two objects
|
|
7581
|
-
*/
|
|
7582
|
-
deepMerge(target, source) {
|
|
7583
|
-
const output = { ...target };
|
|
7584
|
-
if (this.isObject(target) && this.isObject(source)) {
|
|
7585
|
-
Object.keys(source).forEach((key) => {
|
|
7586
|
-
if (this.isObject(source[key])) {
|
|
7587
|
-
if (!(key in target)) {
|
|
7588
|
-
Object.assign(output, { [key]: source[key] });
|
|
7589
|
-
} else {
|
|
7590
|
-
output[key] = this.deepMerge(target[key], source[key]);
|
|
7591
|
-
}
|
|
7592
|
-
} else {
|
|
7593
|
-
Object.assign(output, { [key]: source[key] });
|
|
7594
|
-
}
|
|
7595
|
-
});
|
|
7596
|
-
}
|
|
7597
|
-
return output;
|
|
7598
|
-
}
|
|
7599
|
-
/**
|
|
7600
|
-
* Check if value is a plain object
|
|
7601
|
-
*/
|
|
7602
|
-
isObject(item) {
|
|
7603
|
-
return item && typeof item === "object" && !Array.isArray(item);
|
|
7604
|
-
}
|
|
7605
|
-
/**
|
|
7606
|
-
* Get current configuration
|
|
7607
|
-
*/
|
|
7608
|
-
getConfig() {
|
|
7609
|
-
return { ...this.config };
|
|
7610
|
-
}
|
|
7611
|
-
};
|
|
7612
|
-
var configService = new ConfigService();
|
|
7613
|
-
|
|
7614
|
-
// src/services/queue_service.ts
|
|
7615
|
-
var import_core8 = require("@axiom-lattice/core");
|
|
7616
|
-
var import_protocols3 = require("@axiom-lattice/protocols");
|
|
7617
|
-
var import_queue_redis = require("@axiom-lattice/queue-redis");
|
|
7618
|
-
var DEFAULT_QUEUE_KEY = "default";
|
|
7619
|
-
var queueServiceType = process.env.QUEUE_SERVICE_TYPE || "memory";
|
|
7620
|
-
var setQueueServiceType = (type) => {
|
|
7621
|
-
queueServiceType = type;
|
|
7622
|
-
console.log(`Queue service type set to: ${type}`);
|
|
7623
|
-
const queueName = process.env.QUEUE_NAME || "tasks";
|
|
7624
|
-
const config = {
|
|
7625
|
-
name: "Default Queue Service",
|
|
7626
|
-
description: `Default ${type} queue service`,
|
|
7627
|
-
type: type === "redis" ? import_protocols3.QueueType.REDIS : import_protocols3.QueueType.MEMORY,
|
|
7628
|
-
queueName,
|
|
7629
|
-
options: type === "redis" ? {
|
|
7630
|
-
redisUrl: process.env.REDIS_URL,
|
|
7631
|
-
redisPassword: process.env.REDIS_PASSWORD
|
|
7632
|
-
} : void 0
|
|
7633
|
-
};
|
|
7634
|
-
if (import_core8.queueLatticeManager.hasLattice(DEFAULT_QUEUE_KEY)) {
|
|
7635
|
-
import_core8.queueLatticeManager.removeLattice(DEFAULT_QUEUE_KEY);
|
|
7636
|
-
}
|
|
7637
|
-
let client;
|
|
7638
|
-
if (type === "redis") {
|
|
7639
|
-
client = new import_queue_redis.RedisQueueClient(queueName, {
|
|
7640
|
-
redisUrl: process.env.REDIS_URL,
|
|
7641
|
-
redisPassword: process.env.REDIS_PASSWORD
|
|
7642
|
-
});
|
|
7643
|
-
}
|
|
7644
|
-
(0, import_core8.registerQueueLattice)(DEFAULT_QUEUE_KEY, config, client);
|
|
7645
|
-
};
|
|
7646
|
-
var getQueueServiceType = () => {
|
|
7647
|
-
return queueServiceType;
|
|
7648
|
-
};
|
|
7649
|
-
var getQueueService = () => {
|
|
7650
|
-
if (!import_core8.queueLatticeManager.hasLattice(DEFAULT_QUEUE_KEY)) {
|
|
7651
|
-
setQueueServiceType(queueServiceType);
|
|
7652
|
-
}
|
|
7653
|
-
return (0, import_core8.getQueueLattice)(DEFAULT_QUEUE_KEY);
|
|
7654
|
-
};
|
|
7655
|
-
var popAgentTaskFromQueue = async () => {
|
|
7656
|
-
const queue = getQueueService();
|
|
7657
|
-
const result = await queue.pop();
|
|
7658
|
-
return result;
|
|
7659
|
-
};
|
|
7660
|
-
|
|
7661
|
-
// src/controllers/config.ts
|
|
7662
|
-
async function updateConfig(request, reply) {
|
|
7663
|
-
try {
|
|
7664
|
-
const { config: jsonConfig } = request.body;
|
|
7665
|
-
if (!jsonConfig || typeof jsonConfig !== "object") {
|
|
7666
|
-
return reply.status(400).send({
|
|
7667
|
-
success: false,
|
|
7668
|
-
error: "Invalid configuration: config must be an object"
|
|
7669
|
-
});
|
|
7670
|
-
}
|
|
7671
|
-
configService.updateConfig(jsonConfig);
|
|
7672
|
-
const warnings = [];
|
|
7673
|
-
const requiresRestart = [];
|
|
7674
|
-
if (jsonConfig.port !== void 0) {
|
|
7675
|
-
requiresRestart.push("PORT");
|
|
7676
|
-
warnings.push("Port change requires server restart to take effect");
|
|
7677
|
-
}
|
|
7678
|
-
if (jsonConfig.queueServiceType) {
|
|
7679
|
-
setQueueServiceType(jsonConfig.queueServiceType);
|
|
7680
|
-
}
|
|
7681
|
-
if ((jsonConfig.redisUrl || jsonConfig.redisPassword) && (process.env.QUEUE_SERVICE_TYPE === "redis" || jsonConfig.queueServiceType === "redis")) {
|
|
7682
|
-
const currentType = jsonConfig.queueServiceType || process.env.QUEUE_SERVICE_TYPE || "memory";
|
|
7683
|
-
if (currentType === "redis") {
|
|
7684
|
-
setQueueServiceType("redis");
|
|
7685
|
-
}
|
|
7686
|
-
}
|
|
7687
|
-
const updatedConfig = configService.getConfig();
|
|
7688
|
-
const safeConfig = {
|
|
7689
|
-
...updatedConfig,
|
|
7690
|
-
redisPassword: updatedConfig.redisPassword ? "***" : updatedConfig.redisPassword
|
|
7691
|
-
};
|
|
7692
|
-
return reply.send({
|
|
7693
|
-
success: true,
|
|
7694
|
-
message: "Configuration updated successfully",
|
|
7695
|
-
data: safeConfig,
|
|
7696
|
-
warnings: warnings.length > 0 ? warnings : void 0,
|
|
7697
|
-
requiresRestart: requiresRestart.length > 0 ? requiresRestart : void 0
|
|
7698
|
-
});
|
|
7699
|
-
} catch (error) {
|
|
7700
|
-
console.error("Failed to update configuration", {
|
|
7701
|
-
error: error.message,
|
|
7702
|
-
stack: error.stack
|
|
7703
|
-
});
|
|
7704
|
-
return reply.status(500).send({
|
|
7705
|
-
success: false,
|
|
7706
|
-
error: error.message || "Failed to update configuration"
|
|
7707
|
-
});
|
|
7708
|
-
}
|
|
7709
|
-
}
|
|
7710
|
-
async function getConfig(request, reply) {
|
|
7711
|
-
try {
|
|
7712
|
-
const currentConfig = configService.getConfig();
|
|
7713
|
-
const safeConfig = {
|
|
7714
|
-
...currentConfig,
|
|
7715
|
-
redisPassword: currentConfig.redisPassword ? "***" : currentConfig.redisPassword
|
|
7716
|
-
};
|
|
7717
|
-
return reply.send({
|
|
7718
|
-
success: true,
|
|
7719
|
-
data: safeConfig
|
|
7720
|
-
});
|
|
7721
|
-
} catch (error) {
|
|
7722
|
-
console.error("Failed to get configuration", {
|
|
7723
|
-
error: error.message,
|
|
7724
|
-
stack: error.stack
|
|
7725
|
-
});
|
|
7726
|
-
return reply.status(500).send({
|
|
7727
|
-
success: false,
|
|
7728
|
-
error: error.message || "Failed to get configuration"
|
|
7729
|
-
});
|
|
7730
|
-
}
|
|
7731
|
-
}
|
|
7732
|
-
|
|
7733
7561
|
// src/controllers/models.ts
|
|
7734
|
-
var
|
|
7562
|
+
var import_core8 = require("@axiom-lattice/core");
|
|
7735
7563
|
async function getModels(request, reply) {
|
|
7736
7564
|
try {
|
|
7737
|
-
const allLattices =
|
|
7565
|
+
const allLattices = import_core8.modelLatticeManager.getAllLatticesByTenant("default");
|
|
7738
7566
|
const models = allLattices.map((lattice) => {
|
|
7739
7567
|
const config = lattice.client.getConfig();
|
|
7740
7568
|
const displayName = config.displayName || lattice.key.split("-").map((word) => word.charAt(0).toUpperCase() + word.slice(1)).join(" ");
|
|
@@ -7792,10 +7620,10 @@ async function updateModels(request, reply) {
|
|
|
7792
7620
|
continue;
|
|
7793
7621
|
}
|
|
7794
7622
|
try {
|
|
7795
|
-
const existingConfig =
|
|
7623
|
+
const existingConfig = import_core8.modelLatticeManager.hasLattice(modelConfig.key) ? import_core8.modelLatticeManager.getModelLattice(modelConfig.key).client.getConfig() : void 0;
|
|
7796
7624
|
const effectiveApiKey = modelConfig.clearApiKey ? void 0 : modelConfig.apiKey || existingConfig?.apiKey;
|
|
7797
|
-
if (
|
|
7798
|
-
|
|
7625
|
+
if (import_core8.modelLatticeManager.hasLattice(modelConfig.key)) {
|
|
7626
|
+
import_core8.modelLatticeManager.removeLattice(modelConfig.key);
|
|
7799
7627
|
}
|
|
7800
7628
|
const llmConfig = {
|
|
7801
7629
|
provider: modelConfig.provider,
|
|
@@ -7809,7 +7637,7 @@ async function updateModels(request, reply) {
|
|
|
7809
7637
|
timeout: modelConfig.timeout,
|
|
7810
7638
|
maxRetries: modelConfig.maxRetries
|
|
7811
7639
|
};
|
|
7812
|
-
(0,
|
|
7640
|
+
(0, import_core8.registerModelLattice)(modelConfig.key, llmConfig);
|
|
7813
7641
|
registeredModels.push(modelConfig.key);
|
|
7814
7642
|
} catch (error) {
|
|
7815
7643
|
errors.push(
|
|
@@ -7845,6 +7673,55 @@ async function updateModels(request, reply) {
|
|
|
7845
7673
|
|
|
7846
7674
|
// src/services/multiReplicaReadiness.ts
|
|
7847
7675
|
var import_core10 = require("@axiom-lattice/core");
|
|
7676
|
+
|
|
7677
|
+
// src/services/queue_service.ts
|
|
7678
|
+
var import_core9 = require("@axiom-lattice/core");
|
|
7679
|
+
var import_protocols3 = require("@axiom-lattice/protocols");
|
|
7680
|
+
var import_queue_redis = require("@axiom-lattice/queue-redis");
|
|
7681
|
+
var DEFAULT_QUEUE_KEY = "default";
|
|
7682
|
+
var queueServiceType = process.env.QUEUE_SERVICE_TYPE || "memory";
|
|
7683
|
+
var setQueueServiceType = (type) => {
|
|
7684
|
+
queueServiceType = type;
|
|
7685
|
+
console.log(`Queue service type set to: ${type}`);
|
|
7686
|
+
const queueName = process.env.QUEUE_NAME || "tasks";
|
|
7687
|
+
const config = {
|
|
7688
|
+
name: "Default Queue Service",
|
|
7689
|
+
description: `Default ${type} queue service`,
|
|
7690
|
+
type: type === "redis" ? import_protocols3.QueueType.REDIS : import_protocols3.QueueType.MEMORY,
|
|
7691
|
+
queueName,
|
|
7692
|
+
options: type === "redis" ? {
|
|
7693
|
+
redisUrl: process.env.REDIS_URL,
|
|
7694
|
+
redisPassword: process.env.REDIS_PASSWORD
|
|
7695
|
+
} : void 0
|
|
7696
|
+
};
|
|
7697
|
+
if (import_core9.queueLatticeManager.hasLattice(DEFAULT_QUEUE_KEY)) {
|
|
7698
|
+
import_core9.queueLatticeManager.removeLattice(DEFAULT_QUEUE_KEY);
|
|
7699
|
+
}
|
|
7700
|
+
let client;
|
|
7701
|
+
if (type === "redis") {
|
|
7702
|
+
client = new import_queue_redis.RedisQueueClient(queueName, {
|
|
7703
|
+
redisUrl: process.env.REDIS_URL,
|
|
7704
|
+
redisPassword: process.env.REDIS_PASSWORD
|
|
7705
|
+
});
|
|
7706
|
+
}
|
|
7707
|
+
(0, import_core9.registerQueueLattice)(DEFAULT_QUEUE_KEY, config, client);
|
|
7708
|
+
};
|
|
7709
|
+
var getQueueServiceType = () => {
|
|
7710
|
+
return queueServiceType;
|
|
7711
|
+
};
|
|
7712
|
+
var getQueueService = () => {
|
|
7713
|
+
if (!import_core9.queueLatticeManager.hasLattice(DEFAULT_QUEUE_KEY)) {
|
|
7714
|
+
setQueueServiceType(queueServiceType);
|
|
7715
|
+
}
|
|
7716
|
+
return (0, import_core9.getQueueLattice)(DEFAULT_QUEUE_KEY);
|
|
7717
|
+
};
|
|
7718
|
+
var popAgentTaskFromQueue = async () => {
|
|
7719
|
+
const queue = getQueueService();
|
|
7720
|
+
const result = await queue.pop();
|
|
7721
|
+
return result;
|
|
7722
|
+
};
|
|
7723
|
+
|
|
7724
|
+
// src/services/multiReplicaReadiness.ts
|
|
7848
7725
|
var SHARED_STORE_KINDS = [
|
|
7849
7726
|
"lease",
|
|
7850
7727
|
"outbox",
|
|
@@ -10543,77 +10420,6 @@ var triggerAgentTaskSchema = {
|
|
|
10543
10420
|
}
|
|
10544
10421
|
}
|
|
10545
10422
|
};
|
|
10546
|
-
var updateConfigSchema = {
|
|
10547
|
-
description: "Update gateway configuration",
|
|
10548
|
-
tags: ["Configuration"],
|
|
10549
|
-
summary: "Update Configuration",
|
|
10550
|
-
body: {
|
|
10551
|
-
type: "object",
|
|
10552
|
-
properties: {
|
|
10553
|
-
config: {
|
|
10554
|
-
type: "object",
|
|
10555
|
-
description: "Configuration object to update",
|
|
10556
|
-
properties: {
|
|
10557
|
-
port: { type: "number", description: "Server port" },
|
|
10558
|
-
queueServiceType: {
|
|
10559
|
-
type: "string",
|
|
10560
|
-
enum: ["memory", "redis"],
|
|
10561
|
-
description: "Queue service type"
|
|
10562
|
-
},
|
|
10563
|
-
redisUrl: { type: "string", description: "Redis URL" },
|
|
10564
|
-
redisPassword: { type: "string", description: "Redis password" },
|
|
10565
|
-
queueName: { type: "string", description: "Queue name" }
|
|
10566
|
-
}
|
|
10567
|
-
}
|
|
10568
|
-
},
|
|
10569
|
-
required: ["config"]
|
|
10570
|
-
},
|
|
10571
|
-
response: {
|
|
10572
|
-
200: {
|
|
10573
|
-
type: "object",
|
|
10574
|
-
properties: {
|
|
10575
|
-
success: { type: "boolean" },
|
|
10576
|
-
message: { type: "string" },
|
|
10577
|
-
data: { type: "object" }
|
|
10578
|
-
}
|
|
10579
|
-
},
|
|
10580
|
-
400: {
|
|
10581
|
-
type: "object",
|
|
10582
|
-
properties: {
|
|
10583
|
-
success: { type: "boolean" },
|
|
10584
|
-
error: { type: "string" }
|
|
10585
|
-
}
|
|
10586
|
-
},
|
|
10587
|
-
500: {
|
|
10588
|
-
type: "object",
|
|
10589
|
-
properties: {
|
|
10590
|
-
success: { type: "boolean" },
|
|
10591
|
-
error: { type: "string" }
|
|
10592
|
-
}
|
|
10593
|
-
}
|
|
10594
|
-
}
|
|
10595
|
-
};
|
|
10596
|
-
var getConfigSchema = {
|
|
10597
|
-
description: "Get current gateway configuration",
|
|
10598
|
-
tags: ["Configuration"],
|
|
10599
|
-
summary: "Get Configuration",
|
|
10600
|
-
response: {
|
|
10601
|
-
200: {
|
|
10602
|
-
type: "object",
|
|
10603
|
-
properties: {
|
|
10604
|
-
success: { type: "boolean" },
|
|
10605
|
-
data: { type: "object" }
|
|
10606
|
-
}
|
|
10607
|
-
},
|
|
10608
|
-
500: {
|
|
10609
|
-
type: "object",
|
|
10610
|
-
properties: {
|
|
10611
|
-
success: { type: "boolean" },
|
|
10612
|
-
error: { type: "string" }
|
|
10613
|
-
}
|
|
10614
|
-
}
|
|
10615
|
-
}
|
|
10616
|
-
};
|
|
10617
10423
|
var getHealthSchema = {
|
|
10618
10424
|
description: "Health check endpoint for monitoring and load balancer checks",
|
|
10619
10425
|
tags: ["Health"],
|
|
@@ -29201,16 +29007,6 @@ var registerLatticeRoutes = (app2, channelDeps, options = {}) => {
|
|
|
29201
29007
|
"/api/assistants/:assistantId/threads/:threadId",
|
|
29202
29008
|
deleteThread
|
|
29203
29009
|
);
|
|
29204
|
-
app2.get(
|
|
29205
|
-
"/api/config",
|
|
29206
|
-
{ schema: getConfigSchema },
|
|
29207
|
-
getConfig
|
|
29208
|
-
);
|
|
29209
|
-
app2.put(
|
|
29210
|
-
"/api/config",
|
|
29211
|
-
{ schema: updateConfigSchema },
|
|
29212
|
-
updateConfig
|
|
29213
|
-
);
|
|
29214
29010
|
app2.get("/api/models", getModels);
|
|
29215
29011
|
app2.put("/api/models", updateModels);
|
|
29216
29012
|
app2.get("/api/tools", getToolConfigs);
|
|
@@ -32413,6 +32209,9 @@ function createChannelInfrastructure(deps) {
|
|
|
32413
32209
|
return { router, installationStore, bindingRegistry };
|
|
32414
32210
|
}
|
|
32415
32211
|
|
|
32212
|
+
// src/index.ts
|
|
32213
|
+
init_sandboxOpenReflection();
|
|
32214
|
+
|
|
32416
32215
|
// src/services/collaboration/ProjectTaskRuntimeStartup.ts
|
|
32417
32216
|
async function prepareProjectTaskRuntime(runtime, log2) {
|
|
32418
32217
|
try {
|
|
@@ -32427,11 +32226,11 @@ async function prepareProjectTaskRuntime(runtime, log2) {
|
|
|
32427
32226
|
}
|
|
32428
32227
|
|
|
32429
32228
|
// src/services/plugins/PluginDeploymentRuntimeStartup.ts
|
|
32430
|
-
var
|
|
32229
|
+
var import_core76 = require("@axiom-lattice/core");
|
|
32431
32230
|
|
|
32432
32231
|
// src/services/plugins/PluginDeploymentService.ts
|
|
32433
32232
|
var import_node_crypto30 = require("crypto");
|
|
32434
|
-
var
|
|
32233
|
+
var import_core75 = require("@axiom-lattice/core");
|
|
32435
32234
|
|
|
32436
32235
|
// src/services/plugins/pluginDeploymentNaming.ts
|
|
32437
32236
|
var import_node_crypto29 = require("crypto");
|
|
@@ -32449,7 +32248,7 @@ function pluginSandboxName(tenantId, pluginType) {
|
|
|
32449
32248
|
}
|
|
32450
32249
|
|
|
32451
32250
|
// src/services/plugins/PluginDeploymentService.ts
|
|
32452
|
-
var PLUGIN_HOST_SERVER_PATH = `${
|
|
32251
|
+
var PLUGIN_HOST_SERVER_PATH = `${import_core75.PLUGIN_HOST_DIR}/server.js`;
|
|
32453
32252
|
var DEFAULT_PLUGIN_IDLE_TIMEOUT_MS = 15 * 60 * 1e3;
|
|
32454
32253
|
var DEFAULT_PLUGIN_HEALTH_TIMEOUT_MS = 3e4;
|
|
32455
32254
|
var DEFAULT_PLUGIN_HEALTH_POLL_INTERVAL_MS = 500;
|
|
@@ -32488,7 +32287,7 @@ var PluginDeploymentService = class {
|
|
|
32488
32287
|
this.catalog = deps.catalog;
|
|
32489
32288
|
this.installPluginHost = deps.installPluginHost;
|
|
32490
32289
|
this.lease = deps.lease;
|
|
32491
|
-
this.registry = deps.registry ?? new
|
|
32290
|
+
this.registry = deps.registry ?? new import_core75.PluginDeploymentRuntimeRegistry({ now: deps.clock ?? Date.now });
|
|
32492
32291
|
this.now = deps.clock ?? Date.now;
|
|
32493
32292
|
this.logger = deps.logger ?? { info: () => void 0 };
|
|
32494
32293
|
this.limits = deps.limits ?? {};
|
|
@@ -33205,7 +33004,7 @@ function startPluginDeploymentRuntime(options) {
|
|
|
33205
33004
|
);
|
|
33206
33005
|
return { reconcile: Promise.resolve(), dispose: async () => void 0 };
|
|
33207
33006
|
}
|
|
33208
|
-
const register = options.register ?? ((service3) => (0,
|
|
33007
|
+
const register = options.register ?? ((service3) => (0, import_core76.setPluginDeploymentService)(service3));
|
|
33209
33008
|
const setIntervalFn = options.setIntervalFn ?? setInterval;
|
|
33210
33009
|
const clearIntervalFn = options.clearIntervalFn ?? clearInterval;
|
|
33211
33010
|
const watchdogIntervalMs = options.watchdogIntervalMs ?? DEFAULT_PLUGIN_WATCHDOG_INTERVAL_MS;
|
|
@@ -33924,7 +33723,11 @@ var start = async (config) => {
|
|
|
33924
33723
|
[ROOM_EVENT_TOPIC]: async (payload) => {
|
|
33925
33724
|
if (projectRoomRealtimeRuntime) ingestRoomEvent(payload, projectRoomRealtimeRuntime.broker);
|
|
33926
33725
|
},
|
|
33927
|
-
"assistant-changed": (payload) => handleAssistantChanged(payload, (tenantId) =>
|
|
33726
|
+
"assistant-changed": (payload) => handleAssistantChanged(payload, async (tenantId) => {
|
|
33727
|
+
await import_core99.agentLatticeManager.initializeStoredAssistantsForTenant(tenantId);
|
|
33728
|
+
invalidateAgentReflectionCache(tenantId);
|
|
33729
|
+
invalidatePluginReflectionCache(tenantId);
|
|
33730
|
+
}),
|
|
33928
33731
|
[A2A_KEY_CHANGED_TOPIC]: (payload) => handleA2AKeyChanged(payload, () => refreshStoreKeyMap()),
|
|
33929
33732
|
[MCP_CONFIG_CHANGED_TOPIC]: (payload) => reconcileMcpConfigChange(payload, {
|
|
33930
33733
|
store: (0, import_core99.getStoreLattice)("default", "mcp").store,
|
|
@@ -33935,6 +33738,8 @@ var start = async (config) => {
|
|
|
33935
33738
|
const tenantId = payload?.tenantId;
|
|
33936
33739
|
if (typeof tenantId === "string" && tenantId.length > 0) {
|
|
33937
33740
|
(0, import_core99.getSandboxPluginCatalog)().invalidate(tenantId);
|
|
33741
|
+
invalidatePluginReflectionCache(tenantId);
|
|
33742
|
+
invalidateAgentReflectionCache(tenantId);
|
|
33938
33743
|
await getMcpUiResourceResolver()?.invalidateTenantPlugins(tenantId);
|
|
33939
33744
|
}
|
|
33940
33745
|
},
|