@axiom-lattice/gateway 4.2.0 → 4.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (103) hide show
  1. package/dist/{A2AAuthService-DK5X6VIL.mjs → A2AAuthService-7UGQ7GMW.mjs} +3 -2
  2. package/dist/{WechatChannelAdapter-WSDKR4OA.mjs → WechatChannelAdapter-7WHE5UGY.mjs} +2 -1
  3. package/dist/{WechatChannelAdapter-WSDKR4OA.mjs.map → WechatChannelAdapter-7WHE5UGY.mjs.map} +1 -1
  4. package/dist/{a2a-7N3WDAOP.mjs → a2a-FGYX2HH3.mjs} +71 -32
  5. package/dist/a2a-FGYX2HH3.mjs.map +1 -0
  6. package/dist/{a2a-standard-WC2BSOFV.mjs → a2a-standard-VEQBXBMM.mjs} +93 -115
  7. package/dist/a2a-standard-VEQBXBMM.mjs.map +1 -0
  8. package/dist/agentProvider-X4FVQPKW.mjs +88 -0
  9. package/dist/agentProvider-X4FVQPKW.mjs.map +1 -0
  10. package/dist/chunk-2POW27EI.mjs +27 -0
  11. package/dist/chunk-2POW27EI.mjs.map +1 -0
  12. package/dist/chunk-52SUWMOX.mjs +121 -0
  13. package/dist/chunk-52SUWMOX.mjs.map +1 -0
  14. package/dist/chunk-GF4GGTWJ.mjs +164 -0
  15. package/dist/chunk-GF4GGTWJ.mjs.map +1 -0
  16. package/dist/{chunk-2HOCF46L.mjs → chunk-GPHOYR3X.mjs} +33 -11
  17. package/dist/chunk-GPHOYR3X.mjs.map +1 -0
  18. package/dist/chunk-NFEGQTCC.mjs +27 -0
  19. package/dist/chunk-PWHUWFXL.mjs +173 -0
  20. package/dist/chunk-PWHUWFXL.mjs.map +1 -0
  21. package/dist/chunk-QUT2DS4R.mjs +50 -0
  22. package/dist/chunk-QUT2DS4R.mjs.map +1 -0
  23. package/dist/chunk-TJAUXMYJ.mjs +109 -0
  24. package/dist/chunk-TJAUXMYJ.mjs.map +1 -0
  25. package/dist/chunk-WKNZ7GBC.mjs +56 -0
  26. package/dist/chunk-WKNZ7GBC.mjs.map +1 -0
  27. package/dist/collection_service-RTRJEQFL.mjs +8 -0
  28. package/dist/embed/agent-chat-loader.js +1 -1
  29. package/dist/embed/{embed-page-AgentDetailSideApp-6CVXM3P3.js → embed-page-AgentDetailSideApp-DTDBMB2U.js} +1 -1
  30. package/dist/embed/{embed-page-AgentDetailSideApp-DRGKJ6C5.css → embed-page-AgentDetailSideApp-O6G4NJ7I.css} +1 -1
  31. package/dist/embed/{embed-page-AgentGovernanceWorkbench-4B3NJPCY.js → embed-page-AgentGovernanceWorkbench-JUP6SNBX.js} +1 -1
  32. package/dist/embed/embed-page-AgentGovernanceWorkbench-SFZNVMUH.css +1 -0
  33. package/dist/embed/embed-page-MessageGraph-H5S7SARE.js +6 -0
  34. package/dist/embed/{embed-page-ReactChart-OG5Z43H7.js → embed-page-ReactChart-FWXMXO7F.js} +1 -1
  35. package/dist/embed/{embed-page-SkillFlow-GS4OUCJJ.js → embed-page-SkillFlow-SFZ5HLMK.js} +1 -1
  36. package/dist/embed/{embed-page-TasksSideApp-I6Z7BOT2.js → embed-page-TasksSideApp-Q6HTW6S6.js} +1 -1
  37. package/dist/embed/{embed-page-TeamWorkspace-LSCUIJDA.js → embed-page-TeamWorkspace-6KFWCIKW.js} +4 -4
  38. package/dist/embed/{embed-page-TopologyRuntimeView-RY7NOUB7.js → embed-page-TopologyRuntimeView-MASWKWXA.js} +1 -1
  39. package/dist/embed/{embed-page-WorkflowAutomationView-RNKIKDUX.js → embed-page-WorkflowAutomationView-6UOT36GW.js} +1 -1
  40. package/dist/embed/{embed-page-chunk-4BIOW547.js → embed-page-chunk-2WCPJYBC.js} +1 -1
  41. package/dist/embed/{embed-page-chunk-7CFGO35V.js → embed-page-chunk-3EUETTEM.js} +1 -1
  42. package/dist/embed/{embed-page-chunk-4X5XHAMX.js → embed-page-chunk-74BPRLSV.js} +4 -4
  43. package/dist/embed/embed-page-chunk-7SO4HHS4.js +4084 -0
  44. package/dist/embed/{embed-page-chunk-DVHOG6AY.js → embed-page-chunk-AC6X2XRH.js} +1 -1
  45. package/dist/embed/{embed-page-chunk-SU5GXLKX.js → embed-page-chunk-AVZ7FKIO.js} +4 -4
  46. package/dist/embed/{embed-page-chunk-EPEKIAZP.js → embed-page-chunk-FJ3SFKJY.js} +1 -1
  47. package/dist/embed/{embed-page-chunk-Q32Y7CP2.js → embed-page-chunk-IV5C4DYL.js} +1 -1
  48. package/dist/embed/{embed-page-chunk-KGX7G7XQ.js → embed-page-chunk-KEL6XU6R.js} +1 -1
  49. package/dist/embed/{embed-page-chunk-BZI3YCE7.js → embed-page-chunk-N46WJ2FS.js} +1 -1
  50. package/dist/embed/embed-page-chunk-NFLB3VUZ.js +245 -0
  51. package/dist/embed/{embed-page-chunk-AYOVLRHX.js → embed-page-chunk-NHOWQIND.js} +182 -70
  52. package/dist/embed/{embed-page-chunk-KG5A66WX.js → embed-page-chunk-O4QK5LWZ.js} +83 -83
  53. package/dist/embed/{embed-page-chunk-JLWIJ4BP.js → embed-page-chunk-X4DK4JRG.js} +1 -1
  54. package/dist/embed/{embed-page-chunk-ESLOGPBN.js → embed-page-chunk-Z7USDLHI.js} +1 -1
  55. package/dist/embed/{embed-page-code-highlighter-TBT4ICNZ.js → embed-page-code-highlighter-Y6CQA4CN.js} +1 -1
  56. package/dist/embed/{embed-page-mermaid-TBO3M7GX.js → embed-page-mermaid-CW4QCAH3.js} +1 -1
  57. package/dist/embed/embed-page.css +1 -1
  58. package/dist/embed/embed-page.js +1 -1
  59. package/dist/index.js +2067 -585
  60. package/dist/index.js.map +1 -1
  61. package/dist/index.mjs +374 -348
  62. package/dist/index.mjs.map +1 -1
  63. package/dist/kbProvider-2D6DZ34N.mjs +50 -0
  64. package/dist/kbProvider-2D6DZ34N.mjs.map +1 -0
  65. package/dist/{mcp-configs-IIKQM5GM.mjs → mcp-configs-WCY5EXCW.mjs} +2 -1
  66. package/dist/mcp-configs-WCY5EXCW.mjs.map +1 -0
  67. package/dist/{mcpTransportRegistry-XMJ5Y2RG.mjs → mcpTransportRegistry-VXUVJKBC.mjs} +2 -1
  68. package/dist/mcpTransportRegistry-VXUVJKBC.mjs.map +1 -0
  69. package/dist/open-HH7RKGML.mjs +260 -0
  70. package/dist/open-HH7RKGML.mjs.map +1 -0
  71. package/dist/open-audit-UJ3NXCGW.mjs +32 -0
  72. package/dist/open-audit-UJ3NXCGW.mjs.map +1 -0
  73. package/dist/open-catalog-WYS2AENM.mjs +59 -0
  74. package/dist/open-catalog-WYS2AENM.mjs.map +1 -0
  75. package/dist/open-exposure-FK4G6O6L.mjs +67 -0
  76. package/dist/open-exposure-FK4G6O6L.mjs.map +1 -0
  77. package/dist/open-files-GVRMK5PL.mjs +146 -0
  78. package/dist/open-files-GVRMK5PL.mjs.map +1 -0
  79. package/dist/open-session-3VN65PRR.mjs +53 -0
  80. package/dist/open-session-3VN65PRR.mjs.map +1 -0
  81. package/dist/openLattice-GAAGQJST.mjs +16 -0
  82. package/dist/openLattice-GAAGQJST.mjs.map +1 -0
  83. package/dist/registerExposedPlugins-63EUF4VS.mjs +99 -0
  84. package/dist/registerExposedPlugins-63EUF4VS.mjs.map +1 -0
  85. package/dist/{resources-VA7LSDKN.mjs → resources-SRQRKW5G.mjs} +47 -4
  86. package/dist/resources-SRQRKW5G.mjs.map +1 -0
  87. package/dist/sandboxProvider-I3P66VXT.mjs +10 -0
  88. package/dist/sandboxProvider-I3P66VXT.mjs.map +1 -0
  89. package/dist/{sender-PX32VSHB.mjs → sender-PLDU5EZ3.mjs} +3 -1
  90. package/dist/{sender-PX32VSHB.mjs.map → sender-PLDU5EZ3.mjs.map} +1 -1
  91. package/package.json +7 -7
  92. package/dist/a2a-7N3WDAOP.mjs.map +0 -1
  93. package/dist/a2a-standard-WC2BSOFV.mjs.map +0 -1
  94. package/dist/chunk-2HOCF46L.mjs.map +0 -1
  95. package/dist/embed/embed-page-chunk-A2LQIHX4.js +0 -261
  96. package/dist/embed/embed-page-chunk-OWGBADV6.js +0 -3880
  97. package/dist/open-DCAOL5CG.mjs +0 -176
  98. package/dist/open-DCAOL5CG.mjs.map +0 -1
  99. package/dist/resources-VA7LSDKN.mjs.map +0 -1
  100. /package/dist/{A2AAuthService-DK5X6VIL.mjs.map → A2AAuthService-7UGQ7GMW.mjs.map} +0 -0
  101. /package/dist/{mcp-configs-IIKQM5GM.mjs.map → chunk-NFEGQTCC.mjs.map} +0 -0
  102. /package/dist/{mcpTransportRegistry-XMJ5Y2RG.mjs.map → collection_service-RTRJEQFL.mjs.map} +0 -0
  103. /package/dist/embed/{embed-page-AgentGovernanceWorkbench-SDS3GBCC.css → embed-page-MessageGraph-TYOOATYV.css} +0 -0
package/dist/index.mjs CHANGED
@@ -2,6 +2,13 @@ import {
2
2
  getContentTypeFromFilename,
3
3
  getFilenameFromPath
4
4
  } from "./chunk-LHQY46YB.mjs";
5
+ import {
6
+ buildPreviewTokenScript
7
+ } from "./chunk-2POW27EI.mjs";
8
+ import "./chunk-WKNZ7GBC.mjs";
9
+ import {
10
+ CollectionService
11
+ } from "./chunk-PWHUWFXL.mjs";
5
12
  import {
6
13
  registerMcpServerConfigRoutes
7
14
  } from "./chunk-QKPZWWHH.mjs";
@@ -20,6 +27,7 @@ import {
20
27
  resolvePathWithinRoot,
21
28
  saveProjectFile
22
29
  } from "./chunk-J4BK77PA.mjs";
30
+ import "./chunk-NFEGQTCC.mjs";
23
31
 
24
32
  // src/index.ts
25
33
  import "dotenv/config";
@@ -2022,7 +2030,12 @@ async function getHealth(request, reply) {
2022
2030
  }
2023
2031
 
2024
2032
  // src/services/skill_service.ts
2025
- import { SandboxSkillStore, PluginRegistry } from "@axiom-lattice/core";
2033
+ import {
2034
+ SandboxSkillStore,
2035
+ PluginRegistry,
2036
+ getSandboxPluginCatalog,
2037
+ parseSkillFrontmatter
2038
+ } from "@axiom-lattice/core";
2026
2039
  var PLUGIN_SKILL_SOURCE = "builtin-plugin";
2027
2040
  function getTenantId4(request) {
2028
2041
  return request.user?.tenantId || request.headers["x-tenant-id"] || "default";
@@ -2059,6 +2072,36 @@ var SkillService = class {
2059
2072
  constructor() {
2060
2073
  this.store = new SandboxSkillStore();
2061
2074
  }
2075
+ /**
2076
+ * Read the read-only skills contributed by the tenant's sandbox plugins.
2077
+ * Sandbox failures degrade silently so the system view still returns
2078
+ * built-in and store skills.
2079
+ */
2080
+ async tenantPluginSkills(tenantId) {
2081
+ const items = [];
2082
+ try {
2083
+ const loaded = await getSandboxPluginCatalog().ensureLoaded(tenantId);
2084
+ for (const plugin of loaded.plugins) {
2085
+ for (const [name, definition] of Object.entries(plugin.skills ?? {})) {
2086
+ const { meta } = parseSkillFrontmatter(definition.content);
2087
+ items.push({
2088
+ id: name,
2089
+ name: meta.name || name,
2090
+ description: meta.description || "",
2091
+ version: definition.version,
2092
+ pluginType: plugin.meta.type,
2093
+ resourcePaths: Object.entries(definition.resources ?? {}).map(([path5, resource]) => ({
2094
+ path: path5,
2095
+ mimeType: resource.mimeType
2096
+ })),
2097
+ content: definition.content
2098
+ });
2099
+ }
2100
+ }
2101
+ } catch {
2102
+ }
2103
+ return items;
2104
+ }
2062
2105
  async getAllSkills(request) {
2063
2106
  const tenantId = getTenantId4(request);
2064
2107
  const storeSkills = await this.store.getAllSkills(tenantId, buildContext(request));
@@ -2069,6 +2112,9 @@ var SkillService = class {
2069
2112
  for (const item of PluginRegistry.listSkills()) {
2070
2113
  merged.set(item.id, pluginSkillToSkill(item, tenantId));
2071
2114
  }
2115
+ for (const item of await this.tenantPluginSkills(tenantId)) {
2116
+ merged.set(item.id, pluginSkillToSkill(item, tenantId, item.content));
2117
+ }
2072
2118
  return Array.from(merged.values());
2073
2119
  }
2074
2120
  async getSkillById(request, id3) {
@@ -2081,21 +2127,23 @@ var SkillService = class {
2081
2127
  return pluginSkillToSkill(item, tenantId, definition.content);
2082
2128
  }
2083
2129
  }
2130
+ const tenantItem = (await this.tenantPluginSkills(tenantId)).find((entry) => entry.id === id3);
2131
+ if (tenantItem) return pluginSkillToSkill(tenantItem, tenantId, tenantItem.content);
2084
2132
  return this.store.getSkillById(tenantId, id3, buildContext(request));
2085
2133
  }
2086
2134
  async createSkill(request, id3, data) {
2087
2135
  const tenantId = getTenantId4(request);
2088
- this.assertNotPluginSkill(id3, "created");
2136
+ await this.assertMutable(tenantId, id3, "created");
2089
2137
  return this.store.createSkill(tenantId, id3, data, buildContext(request));
2090
2138
  }
2091
2139
  async updateSkill(request, id3, updates) {
2092
2140
  const tenantId = getTenantId4(request);
2093
- this.assertNotPluginSkill(id3, "modified");
2141
+ await this.assertMutable(tenantId, id3, "modified");
2094
2142
  return this.store.updateSkill(tenantId, id3, updates, buildContext(request));
2095
2143
  }
2096
2144
  async deleteSkill(request, id3) {
2097
2145
  const tenantId = getTenantId4(request);
2098
- this.assertNotPluginSkill(id3, "deleted");
2146
+ await this.assertMutable(tenantId, id3, "deleted");
2099
2147
  return this.store.deleteSkill(tenantId, id3, buildContext(request));
2100
2148
  }
2101
2149
  async searchByMetadata(request, key, value) {
@@ -2111,7 +2159,18 @@ var SkillService = class {
2111
2159
  return this.store.filterByLicense(tenantId, license, buildContext(request));
2112
2160
  }
2113
2161
  /**
2114
- * Guard against mutating a registered plugin skill.
2162
+ * Guard against mutating a built-in or tenant-plugin skill.
2163
+ * Message style mirrors SandboxSkillStore built-in errors so the controller's
2164
+ * existing "built-in skill" -> 403 mapping applies. Runs before any store write.
2165
+ */
2166
+ async assertMutable(tenantId, id3, action) {
2167
+ this.assertNotPluginSkill(id3, action);
2168
+ if ((await this.tenantPluginSkills(tenantId)).some((skill) => skill.id === id3)) {
2169
+ throw new Error(`Skill "${id3}" is a built-in skill and cannot be ${action}`);
2170
+ }
2171
+ }
2172
+ /**
2173
+ * Guard against mutating a globally registered plugin skill.
2115
2174
  * Message style mirrors SandboxSkillStore built-in errors so the controller's
2116
2175
  * existing "built-in skill" -> 403 mapping applies.
2117
2176
  */
@@ -2317,175 +2376,6 @@ async function filterSkillsByLicense(request, reply) {
2317
2376
  }
2318
2377
  }
2319
2378
 
2320
- // src/services/collection_service.ts
2321
- import { v4 as uuidv4 } from "uuid";
2322
- import { Document } from "@langchain/core/documents";
2323
- import {
2324
- collectionLatticeManager,
2325
- embeddingsLatticeManager,
2326
- getOrCreateCollectionVectorStore,
2327
- getCollectionEntryCount,
2328
- listCollectionEntries,
2329
- removeCollectionVectorStore
2330
- } from "@axiom-lattice/core";
2331
- function getTenantId5(request) {
2332
- return request.user?.tenantId || request.headers["x-tenant-id"] || "default";
2333
- }
2334
- var CollectionService = class {
2335
- // ─── Collection CRUD ──────────────────────────────────────────
2336
- async getAllCollections(request) {
2337
- const tenantId = getTenantId5(request);
2338
- const collections = await collectionLatticeManager.getAllCollections(tenantId);
2339
- for (const c2 of collections) {
2340
- try {
2341
- c2._entryCount = await getCollectionEntryCount(c2.name, c2.embeddingKey, c2.tenantId);
2342
- } catch {
2343
- c2._entryCount = 0;
2344
- }
2345
- }
2346
- return collections;
2347
- }
2348
- async getCollectionByName(request, name) {
2349
- const tenantId = getTenantId5(request);
2350
- return collectionLatticeManager.getCollection(tenantId, name);
2351
- }
2352
- async createCollection(request, data) {
2353
- const tenantId = getTenantId5(request);
2354
- const collection = await collectionLatticeManager.registerCollection(tenantId, data);
2355
- try {
2356
- await getOrCreateCollectionVectorStore(data.name, data.embeddingKey, tenantId);
2357
- } catch (err) {
2358
- console.warn(`[CollectionService] Failed to init vector store for ${data.name}:`, err);
2359
- }
2360
- return collection;
2361
- }
2362
- async updateCollection(request, name, updates) {
2363
- const tenantId = getTenantId5(request);
2364
- return collectionLatticeManager.updateCollection(tenantId, name, updates);
2365
- }
2366
- async deleteCollection(request, name) {
2367
- const tenantId = getTenantId5(request);
2368
- await removeCollectionVectorStore(name, tenantId);
2369
- return collectionLatticeManager.removeCollection(tenantId, name);
2370
- }
2371
- // ─── Entry CRUD ───────────────────────────────────────────────
2372
- async getEntries(request, collectionName) {
2373
- const collection = await this.getCollectionByName(request, collectionName);
2374
- if (!collection) throw new Error(`Collection "${collectionName}" not found`);
2375
- const docs = await listCollectionEntries(collectionName, collection.embeddingKey, collection.tenantId);
2376
- return docs.map((doc) => ({
2377
- id: doc.metadata._id || "",
2378
- content: doc.pageContent,
2379
- metadata: Object.fromEntries(
2380
- Object.entries(doc.metadata).filter(([k]) => !k.startsWith("_"))
2381
- )
2382
- }));
2383
- }
2384
- async createEntry(request, collectionName, data) {
2385
- const collection = await this.getCollectionByName(request, collectionName);
2386
- if (!collection) throw new Error(`Collection "${collectionName}" not found`);
2387
- const vectorStore = await getOrCreateCollectionVectorStore(
2388
- collectionName,
2389
- collection.embeddingKey,
2390
- collection.tenantId
2391
- );
2392
- const entryId = uuidv4();
2393
- const now = (/* @__PURE__ */ new Date()).toISOString();
2394
- const doc = new Document({
2395
- pageContent: data.content,
2396
- metadata: {
2397
- _id: entryId,
2398
- _created_at: now,
2399
- _updated_at: now,
2400
- ...data.metadata || {}
2401
- }
2402
- });
2403
- await vectorStore.addDocuments([doc]);
2404
- return { id: entryId, content: data.content, metadata: data.metadata || {} };
2405
- }
2406
- async getEntry(request, collectionName, entryId) {
2407
- const collection = await this.getCollectionByName(request, collectionName);
2408
- if (!collection) throw new Error(`Collection "${collectionName}" not found`);
2409
- const docs = await listCollectionEntries(collectionName, collection.embeddingKey, collection.tenantId);
2410
- const doc = docs.find((d) => d.metadata._id === entryId);
2411
- if (!doc) return null;
2412
- return {
2413
- id: entryId,
2414
- content: doc.pageContent,
2415
- metadata: Object.fromEntries(
2416
- Object.entries(doc.metadata).filter(([k]) => !k.startsWith("_"))
2417
- )
2418
- };
2419
- }
2420
- async updateEntry(request, collectionName, entryId, data) {
2421
- const existing = await this.getEntry(request, collectionName, entryId);
2422
- if (!existing) return null;
2423
- const collection = await this.getCollectionByName(request, collectionName);
2424
- if (!collection) throw new Error(`Collection "${collectionName}" not found`);
2425
- const vectorStore = await getOrCreateCollectionVectorStore(
2426
- collectionName,
2427
- collection.embeddingKey,
2428
- collection.tenantId
2429
- );
2430
- try {
2431
- await vectorStore.delete({ filter: { _id: entryId } });
2432
- } catch {
2433
- }
2434
- const now = (/* @__PURE__ */ new Date()).toISOString();
2435
- const mergedMetadata = { ...existing.metadata, ...data.metadata || {} };
2436
- const doc = new Document({
2437
- pageContent: data.content ?? existing.content,
2438
- metadata: { _id: entryId, _created_at: now, _updated_at: now, ...mergedMetadata }
2439
- });
2440
- await vectorStore.addDocuments([doc]);
2441
- return { id: entryId, content: data.content ?? existing.content, metadata: mergedMetadata };
2442
- }
2443
- async deleteEntry(request, collectionName, entryId) {
2444
- const collection = await this.getCollectionByName(request, collectionName);
2445
- if (!collection) throw new Error(`Collection "${collectionName}" not found`);
2446
- const vectorStore = await getOrCreateCollectionVectorStore(
2447
- collectionName,
2448
- collection.embeddingKey,
2449
- collection.tenantId
2450
- );
2451
- try {
2452
- await vectorStore.delete({ filter: { _id: entryId } });
2453
- return true;
2454
- } catch {
2455
- return false;
2456
- }
2457
- }
2458
- async searchEntries(request, collectionName, params) {
2459
- const collection = await this.getCollectionByName(request, collectionName);
2460
- if (!collection) throw new Error(`Collection "${collectionName}" not found`);
2461
- const vectorStore = await getOrCreateCollectionVectorStore(
2462
- collectionName,
2463
- collection.embeddingKey,
2464
- collection.tenantId
2465
- );
2466
- let embeddings;
2467
- try {
2468
- embeddings = embeddingsLatticeManager.getEmbeddingsClient(collection.embeddingKey);
2469
- } catch {
2470
- embeddings = embeddingsLatticeManager.getEmbeddingsClient("default");
2471
- }
2472
- const queryVector = await embeddings.embedQuery(params.query);
2473
- const results = await vectorStore.similaritySearchVectorWithScore(
2474
- queryVector,
2475
- params.top_k || 5,
2476
- params.filter
2477
- );
2478
- return results.map(([doc, score]) => ({
2479
- id: doc.metadata._id || uuidv4(),
2480
- content: doc.pageContent,
2481
- metadata: Object.fromEntries(
2482
- Object.entries(doc.metadata).filter(([k]) => !k.startsWith("_"))
2483
- ),
2484
- score
2485
- }));
2486
- }
2487
- };
2488
-
2489
2379
  // src/controllers/collections.ts
2490
2380
  var collectionService = new CollectionService();
2491
2381
  function serializeCollection(collection) {
@@ -2607,10 +2497,10 @@ async function deleteCollection(request, reply) {
2607
2497
  }
2608
2498
 
2609
2499
  // src/controllers/embeddings.ts
2610
- import { embeddingsLatticeManager as embeddingsLatticeManager2 } from "@axiom-lattice/core";
2500
+ import { embeddingsLatticeManager } from "@axiom-lattice/core";
2611
2501
  async function listEmbeddings(_request, _reply) {
2612
2502
  try {
2613
- const info = embeddingsLatticeManager2.getAllEmbeddingsInfo();
2503
+ const info = embeddingsLatticeManager.getAllEmbeddingsInfo();
2614
2504
  return {
2615
2505
  success: true,
2616
2506
  message: "Successfully retrieved embedding models",
@@ -2840,11 +2730,11 @@ import {
2840
2730
  getStoreLattice as getStoreLattice3,
2841
2731
  metricsServerManager
2842
2732
  } from "@axiom-lattice/core";
2843
- function getTenantId6(request) {
2733
+ function getTenantId5(request) {
2844
2734
  return request.headers["x-tenant-id"] || "default";
2845
2735
  }
2846
2736
  async function executeDataQuery(request, reply) {
2847
- const tenantId = getTenantId6(request);
2737
+ const tenantId = getTenantId5(request);
2848
2738
  const body = request.body;
2849
2739
  try {
2850
2740
  if (!body.serverKey && !body.datasourceId) {
@@ -2980,7 +2870,7 @@ async function executeSqlQuery(client, body, reply) {
2980
2870
  // src/controllers/workflow-tracking.ts
2981
2871
  import { getStoreLattice as getStoreLattice4, agentInstanceManager as agentInstanceManager4, ThreadStatus as ThreadStatus2, abortWorkflowRun as signalAbort } from "@axiom-lattice/core";
2982
2872
  import { MessageChunkTypes as MessageChunkTypes2 } from "@axiom-lattice/protocols";
2983
- function getTenantId7(request) {
2873
+ function getTenantId6(request) {
2984
2874
  const userTenantId = request.user?.tenantId;
2985
2875
  if (userTenantId) return userTenantId;
2986
2876
  return request.headers["x-tenant-id"] || "default";
@@ -3021,7 +2911,7 @@ async function getDefinitionsFromAssistants(tenantId) {
3021
2911
  }
3022
2912
  }
3023
2913
  async function getAllWorkflowDefinitions(request, reply) {
3024
- const tenantId = getTenantId7(request);
2914
+ const tenantId = getTenantId6(request);
3025
2915
  try {
3026
2916
  const configDefs = await getDefinitionsFromAssistants(tenantId);
3027
2917
  if (configDefs.length === 0) {
@@ -3066,7 +2956,7 @@ async function getAllWorkflowDefinitions(request, reply) {
3066
2956
  }
3067
2957
  }
3068
2958
  async function getAllWorkflowRuns(request, reply) {
3069
- const tenantId = getTenantId7(request);
2959
+ const tenantId = getTenantId6(request);
3070
2960
  const { assistantId, status } = request.query;
3071
2961
  try {
3072
2962
  const store = getTrackingStore();
@@ -3120,7 +3010,7 @@ async function getAllWorkflowRuns(request, reply) {
3120
3010
  var INBOX_DEFAULT_PAGE_SIZE = 20;
3121
3011
  var INBOX_MAX_PAGE_SIZE = 100;
3122
3012
  async function getInboxItems(request, reply) {
3123
- const tenantId = getTenantId7(request);
3013
+ const tenantId = getTenantId6(request);
3124
3014
  try {
3125
3015
  const store = getTrackingStore();
3126
3016
  if (!store) {
@@ -3228,7 +3118,7 @@ async function getInboxItems(request, reply) {
3228
3118
  }
3229
3119
  async function getWorkflowDefinitions(request, reply) {
3230
3120
  const { assistantId } = request.params;
3231
- const tenantId = getTenantId7(request);
3121
+ const tenantId = getTenantId6(request);
3232
3122
  try {
3233
3123
  const store = getTrackingStore();
3234
3124
  if (!store) {
@@ -3259,7 +3149,7 @@ async function getWorkflowDefinitions(request, reply) {
3259
3149
  }
3260
3150
  async function getWorkflowRuns(request, reply) {
3261
3151
  const { threadId } = request.params;
3262
- const tenantId = getTenantId7(request);
3152
+ const tenantId = getTenantId6(request);
3263
3153
  try {
3264
3154
  const store = getTrackingStore();
3265
3155
  if (!store) {
@@ -3295,7 +3185,7 @@ async function getWorkflowRun(request, reply) {
3295
3185
  }
3296
3186
  async function deleteWorkflowRun(request, reply) {
3297
3187
  const { runId } = request.params;
3298
- const tenantId = getTenantId7(request);
3188
+ const tenantId = getTenantId6(request);
3299
3189
  try {
3300
3190
  const store = getTrackingStore();
3301
3191
  if (!store) {
@@ -3378,7 +3268,7 @@ async function getRunTasks(request, reply) {
3378
3268
  }
3379
3269
  async function replyInboxTask(request, reply) {
3380
3270
  const { runId, answers } = request.body;
3381
- const tenantId = getTenantId7(request);
3271
+ const tenantId = getTenantId6(request);
3382
3272
  try {
3383
3273
  const store = getTrackingStore();
3384
3274
  if (!store) {
@@ -3455,7 +3345,7 @@ async function replyInboxTask(request, reply) {
3455
3345
  async function abortWorkflowRun(request, reply) {
3456
3346
  try {
3457
3347
  const { runId } = request.params;
3458
- const tenantId = getTenantId7(request);
3348
+ const tenantId = getTenantId6(request);
3459
3349
  const store = getTrackingStore();
3460
3350
  if (!store) {
3461
3351
  return reply.status(404).send({
@@ -3507,7 +3397,7 @@ import { randomUUID as randomUUID3 } from "crypto";
3507
3397
  function getWorkspaceId2(request) {
3508
3398
  return request.headers["x-workspace-id"] || "default";
3509
3399
  }
3510
- function getTenantId8(request) {
3400
+ function getTenantId7(request) {
3511
3401
  const userTenantId = request.user?.tenantId;
3512
3402
  if (userTenantId) return userTenantId;
3513
3403
  return request.headers["x-tenant-id"] || "default";
@@ -3534,7 +3424,7 @@ async function updateLinkMeta(userId, tenantId, meta) {
3534
3424
  await getLinkStore().updateLink(userId, tenantId, { metadata: meta });
3535
3425
  }
3536
3426
  async function createPersonalAssistant(request, reply) {
3537
- const tenantId = getTenantId8(request);
3427
+ const tenantId = getTenantId7(request);
3538
3428
  const userId = getUserId3(request);
3539
3429
  const { name, personality } = request.body;
3540
3430
  if (!name || !personality) {
@@ -3571,7 +3461,7 @@ async function createPersonalAssistant(request, reply) {
3571
3461
  });
3572
3462
  }
3573
3463
  async function getPersonalAssistant(request, reply) {
3574
- const tenantId = getTenantId8(request);
3464
+ const tenantId = getTenantId7(request);
3575
3465
  const userId = getUserId3(request);
3576
3466
  const store = getAssistantStore();
3577
3467
  const assistant = await store.getByOwner(tenantId, userId);
@@ -3588,7 +3478,7 @@ async function getPersonalAssistant(request, reply) {
3588
3478
  };
3589
3479
  }
3590
3480
  async function deletePersonalAssistant(request, reply) {
3591
- const tenantId = getTenantId8(request);
3481
+ const tenantId = getTenantId7(request);
3592
3482
  const userId = getUserId3(request);
3593
3483
  const store = getAssistantStore();
3594
3484
  const assistant = await store.getByOwner(tenantId, userId);
@@ -4497,11 +4387,26 @@ async function importApply(request, reply) {
4497
4387
  }
4498
4388
 
4499
4389
  // src/controllers/middleware-types.ts
4500
- import { PluginRegistry as PluginRegistry2 } from "@axiom-lattice/core";
4390
+ import {
4391
+ PluginRegistry as PluginRegistry2,
4392
+ getSandboxPluginCatalog as getSandboxPluginCatalog2,
4393
+ mergePluginSources,
4394
+ serializePluginMeta
4395
+ } from "@axiom-lattice/core";
4396
+ async function collectMiddlewareMetas(tenantId) {
4397
+ let tenantPlugins = [];
4398
+ try {
4399
+ tenantPlugins = (await getSandboxPluginCatalog2().ensureLoaded(tenantId)).plugins;
4400
+ } catch {
4401
+ tenantPlugins = [];
4402
+ }
4403
+ const globalPlugins = PluginRegistry2.list().map((type) => PluginRegistry2.get(type)).filter((p) => Boolean(p));
4404
+ return mergePluginSources(globalPlugins, tenantPlugins).map(serializePluginMeta);
4405
+ }
4501
4406
  function middlewareTypesRoutes(fastify2) {
4502
- fastify2.get("/api/middleware-types", async (_request, reply) => {
4503
- const metas = PluginRegistry2.listMeta();
4504
- return reply.send(metas);
4407
+ fastify2.get("/api/middleware-types", async (request, reply) => {
4408
+ const tenantId = request.user?.tenantId || request.headers["x-tenant-id"] || "default";
4409
+ return reply.send(await collectMiddlewareMetas(tenantId));
4505
4410
  });
4506
4411
  }
4507
4412
 
@@ -5220,7 +5125,7 @@ import * as os2 from "os";
5220
5125
  import { getStoreLattice as getStoreLattice6 } from "@axiom-lattice/core";
5221
5126
  import { SandboxFilesystem, FilesystemBackend } from "@axiom-lattice/core";
5222
5127
  import { getSandBoxManager as getSandBoxManager3 } from "@axiom-lattice/core";
5223
- import { v4 as uuidv42 } from "uuid";
5128
+ import { v4 as uuidv4 } from "uuid";
5224
5129
 
5225
5130
  // src/services/collaboration/RoomCoordinatorProvisioner.ts
5226
5131
  var ROOM_COORDINATOR_KEY = "room-coordinator";
@@ -5423,7 +5328,7 @@ var ProjectCollaborationInitializationError = class extends Error {
5423
5328
  }
5424
5329
  };
5425
5330
  function createProjectCollaborationInitializer(deps) {
5426
- const idFactory = deps.idFactory ?? uuidv42;
5331
+ const idFactory = deps.idFactory ?? uuidv4;
5427
5332
  return {
5428
5333
  authorizeCreator: async ({ tenantId, userId }) => await deps.userTenantLinkStore.getLink(userId, tenantId) !== null,
5429
5334
  initialize: async ({ tenantId, userId, project }) => {
@@ -5498,7 +5403,7 @@ var WorkspaceController = class {
5498
5403
  async createWorkspace(request, reply) {
5499
5404
  const tenantId = this.getTenantId(request);
5500
5405
  const data = request.body;
5501
- const id3 = uuidv42();
5406
+ const id3 = uuidv4();
5502
5407
  const workspace = await this.workspaceStore.createWorkspace(
5503
5408
  tenantId,
5504
5409
  id3,
@@ -5571,7 +5476,7 @@ var WorkspaceController = class {
5571
5476
  if (existing.length > 0) {
5572
5477
  return;
5573
5478
  }
5574
- await this.projectStore.createProject(tenantId, workspaceId, uuidv42(), {
5479
+ await this.projectStore.createProject(tenantId, workspaceId, uuidv4(), {
5575
5480
  name: "Training",
5576
5481
  description: "Shared workspace for agent training",
5577
5482
  kind: "training"
@@ -5624,7 +5529,7 @@ var WorkspaceController = class {
5624
5529
  });
5625
5530
  }
5626
5531
  }
5627
- const id3 = uuidv42();
5532
+ const id3 = uuidv4();
5628
5533
  const project = await this.projectStore.createProject(
5629
5534
  tenantId,
5630
5535
  workspaceId,
@@ -6171,7 +6076,7 @@ var WorkspaceController = class {
6171
6076
  workspaceId,
6172
6077
  projectId,
6173
6078
  timestamp: Date.now()
6174
- })};</script>`;
6079
+ })};</script>` + buildPreviewTokenScript({ tenantId, workspaceId, projectId });
6175
6080
  if (content2.toLowerCase().includes("</head>")) {
6176
6081
  content2 = content2.replace(/<\/head>/i, `${contextScript}</head>`);
6177
6082
  console.log(`[viewFile] Context script injected before </head>`);
@@ -6202,7 +6107,7 @@ var WorkspaceController = class {
6202
6107
  workspaceId,
6203
6108
  projectId,
6204
6109
  timestamp: Date.now()
6205
- })};</script>`;
6110
+ })};</script>` + buildPreviewTokenScript({ tenantId, workspaceId, projectId });
6206
6111
  if (content.toLowerCase().includes("</head>")) {
6207
6112
  finalContent = content.replace(/<\/head>/i, `${contextScript}</head>`);
6208
6113
  console.log(`[viewFile] Context script injected before </head>`);
@@ -6525,13 +6430,17 @@ var ProjectAccessService = class {
6525
6430
  this.requireCapability(membership, input.capability);
6526
6431
  return { project, membership };
6527
6432
  }
6528
- /** Authorizes roster visibility: read for public rooms, manage elsewhere. */
6433
+ /**
6434
+ * Authorizes roster visibility for any active participant (owner/admin/member/viewer).
6435
+ * Mutating the roster requires `manage` separately; reading it never does, because every
6436
+ * room participant needs the member list to render the room and derive their own capabilities.
6437
+ */
6529
6438
  async requireRosterAccess(input) {
6530
6439
  const project = await this.deps.projectStore.getProjectById(input.tenantId, input.projectId);
6531
6440
  if (!project) throw new ProjectCollaborationError("PROJECT_NOT_FOUND", 404, "Project not found");
6532
6441
  return this.requireProjectAccess({
6533
6442
  ...input,
6534
- capability: project.kind === "public" ? "read" : "manage"
6443
+ capability: "read"
6535
6444
  });
6536
6445
  }
6537
6446
  async requirePublicProjectAccess(project, input) {
@@ -6620,7 +6529,7 @@ import {
6620
6529
  sqlDatabaseManager
6621
6530
  } from "@axiom-lattice/core";
6622
6531
  import { randomUUID as randomUUID7 } from "crypto";
6623
- function getTenantId9(request) {
6532
+ function getTenantId8(request) {
6624
6533
  const userTenantId = request.user?.tenantId;
6625
6534
  if (userTenantId) {
6626
6535
  return userTenantId;
@@ -6628,7 +6537,7 @@ function getTenantId9(request) {
6628
6537
  return request.headers["x-tenant-id"] || "default";
6629
6538
  }
6630
6539
  async function getDatabaseConfigList(request, reply) {
6631
- const tenantId = getTenantId9(request);
6540
+ const tenantId = getTenantId8(request);
6632
6541
  try {
6633
6542
  const storeLattice = getStoreLattice7("default", "database");
6634
6543
  const store = storeLattice.store;
@@ -6658,7 +6567,7 @@ async function getDatabaseConfigList(request, reply) {
6658
6567
  }
6659
6568
  }
6660
6569
  async function getDatabaseConfig(request, reply) {
6661
- const tenantId = getTenantId9(request);
6570
+ const tenantId = getTenantId8(request);
6662
6571
  const { key } = request.params;
6663
6572
  try {
6664
6573
  const storeLattice = getStoreLattice7("default", "database");
@@ -6684,7 +6593,7 @@ async function getDatabaseConfig(request, reply) {
6684
6593
  }
6685
6594
  }
6686
6595
  async function createDatabaseConfig(request, reply) {
6687
- const tenantId = getTenantId9(request);
6596
+ const tenantId = getTenantId8(request);
6688
6597
  const body = request.body;
6689
6598
  try {
6690
6599
  const storeLattice = getStoreLattice7("default", "database");
@@ -6719,7 +6628,7 @@ async function createDatabaseConfig(request, reply) {
6719
6628
  }
6720
6629
  }
6721
6630
  async function updateDatabaseConfig(request, reply) {
6722
- const tenantId = getTenantId9(request);
6631
+ const tenantId = getTenantId8(request);
6723
6632
  const { key } = request.params;
6724
6633
  const updates = request.body;
6725
6634
  try {
@@ -6761,7 +6670,7 @@ async function updateDatabaseConfig(request, reply) {
6761
6670
  }
6762
6671
  }
6763
6672
  async function deleteDatabaseConfig(request, reply) {
6764
- const tenantId = getTenantId9(request);
6673
+ const tenantId = getTenantId8(request);
6765
6674
  const { keyOrId } = request.params;
6766
6675
  try {
6767
6676
  const storeLattice = getStoreLattice7("default", "database");
@@ -6810,7 +6719,7 @@ async function deleteDatabaseConfig(request, reply) {
6810
6719
  }
6811
6720
  }
6812
6721
  async function testDatabaseConnection(request, reply) {
6813
- const tenantId = getTenantId9(request);
6722
+ const tenantId = getTenantId8(request);
6814
6723
  const { key } = request.params;
6815
6724
  try {
6816
6725
  const storeLattice = getStoreLattice7("default", "database");
@@ -6903,7 +6812,7 @@ import {
6903
6812
  SemanticMetricsClient as SemanticMetricsClient2
6904
6813
  } from "@axiom-lattice/core";
6905
6814
  import { randomUUID as randomUUID8 } from "crypto";
6906
- function getTenantId10(request) {
6815
+ function getTenantId9(request) {
6907
6816
  const userTenantId = request.user?.tenantId;
6908
6817
  if (userTenantId) {
6909
6818
  return userTenantId;
@@ -6911,7 +6820,7 @@ function getTenantId10(request) {
6911
6820
  return request.headers["x-tenant-id"] || "default";
6912
6821
  }
6913
6822
  async function getMetricsServerConfigList(request, reply) {
6914
- const tenantId = getTenantId10(request);
6823
+ const tenantId = getTenantId9(request);
6915
6824
  try {
6916
6825
  const storeLattice = getStoreLattice8("default", "metrics");
6917
6826
  const store = storeLattice.store;
@@ -6937,7 +6846,7 @@ async function getMetricsServerConfigList(request, reply) {
6937
6846
  }
6938
6847
  }
6939
6848
  async function getMetricsServerConfig(request, reply) {
6940
- const tenantId = getTenantId10(request);
6849
+ const tenantId = getTenantId9(request);
6941
6850
  const { key } = request.params;
6942
6851
  try {
6943
6852
  const storeLattice = getStoreLattice8("default", "metrics");
@@ -6963,7 +6872,7 @@ async function getMetricsServerConfig(request, reply) {
6963
6872
  }
6964
6873
  }
6965
6874
  async function createMetricsServerConfig(request, reply) {
6966
- const tenantId = getTenantId10(request);
6875
+ const tenantId = getTenantId9(request);
6967
6876
  const body = request.body;
6968
6877
  try {
6969
6878
  const storeLattice = getStoreLattice8("default", "metrics");
@@ -7014,7 +6923,7 @@ async function createMetricsServerConfig(request, reply) {
7014
6923
  }
7015
6924
  }
7016
6925
  async function updateMetricsServerConfig(request, reply) {
7017
- const tenantId = getTenantId10(request);
6926
+ const tenantId = getTenantId9(request);
7018
6927
  const { key } = request.params;
7019
6928
  const updates = request.body;
7020
6929
  try {
@@ -7065,7 +6974,7 @@ async function updateMetricsServerConfig(request, reply) {
7065
6974
  }
7066
6975
  }
7067
6976
  async function deleteMetricsServerConfig(request, reply) {
7068
- const tenantId = getTenantId10(request);
6977
+ const tenantId = getTenantId9(request);
7069
6978
  const { keyOrId } = request.params;
7070
6979
  try {
7071
6980
  const storeLattice = getStoreLattice8("default", "metrics");
@@ -7112,7 +7021,7 @@ async function deleteMetricsServerConfig(request, reply) {
7112
7021
  }
7113
7022
  }
7114
7023
  async function testMetricsServerConnection(request, reply) {
7115
- const tenantId = getTenantId10(request);
7024
+ const tenantId = getTenantId9(request);
7116
7025
  const { key } = request.params;
7117
7026
  try {
7118
7027
  const storeLattice = getStoreLattice8("default", "metrics");
@@ -7163,7 +7072,7 @@ async function testMetricsServerConnection(request, reply) {
7163
7072
  }
7164
7073
  }
7165
7074
  async function listAvailableMetrics(request, reply) {
7166
- const tenantId = getTenantId10(request);
7075
+ const tenantId = getTenantId9(request);
7167
7076
  const { key } = request.params;
7168
7077
  try {
7169
7078
  const storeLattice = getStoreLattice8("default", "metrics");
@@ -7201,7 +7110,7 @@ async function listAvailableMetrics(request, reply) {
7201
7110
  }
7202
7111
  }
7203
7112
  async function queryMetricsData(request, reply) {
7204
- const tenantId = getTenantId10(request);
7113
+ const tenantId = getTenantId9(request);
7205
7114
  const { key } = request.params;
7206
7115
  const { metricName, startTime, endTime, step, labels } = request.body;
7207
7116
  try {
@@ -7249,7 +7158,7 @@ async function queryMetricsData(request, reply) {
7249
7158
  }
7250
7159
  }
7251
7160
  async function getDataSources(request, reply) {
7252
- const tenantId = getTenantId10(request);
7161
+ const tenantId = getTenantId9(request);
7253
7162
  const { key } = request.params;
7254
7163
  try {
7255
7164
  const storeLattice = getStoreLattice8("default", "metrics");
@@ -7290,7 +7199,7 @@ async function getDataSources(request, reply) {
7290
7199
  }
7291
7200
  }
7292
7201
  async function getDatasourceMetrics(request, reply) {
7293
- const tenantId = getTenantId10(request);
7202
+ const tenantId = getTenantId9(request);
7294
7203
  const { key, datasourceId } = request.params;
7295
7204
  try {
7296
7205
  const storeLattice = getStoreLattice8("default", "metrics");
@@ -7327,7 +7236,7 @@ async function getDatasourceMetrics(request, reply) {
7327
7236
  }
7328
7237
  }
7329
7238
  async function querySemanticMetrics(request, reply) {
7330
- const tenantId = getTenantId10(request);
7239
+ const tenantId = getTenantId9(request);
7331
7240
  const { key } = request.params;
7332
7241
  const body = request.body;
7333
7242
  try {
@@ -7484,7 +7393,7 @@ function registerMetricsServerConfigRoutes(app2) {
7484
7393
  }
7485
7394
 
7486
7395
  // src/controllers/connections.ts
7487
- import { ConnectionRegistry, PluginRegistry as PluginRegistry3 } from "@axiom-lattice/core";
7396
+ import { ConnectionRegistry, PluginRegistry as PluginRegistry3, getSandboxPluginCatalog as getSandboxPluginCatalog3, mergePluginSources as mergePluginSources2 } from "@axiom-lattice/core";
7488
7397
  import { z as z2 } from "zod";
7489
7398
  var createBody = z2.object({
7490
7399
  type: z2.string().min(1),
@@ -7504,6 +7413,17 @@ function getTenant(request) {
7504
7413
  }
7505
7414
  return request.headers["x-tenant-id"] || "default";
7506
7415
  }
7416
+ async function getTenantPlugin(request, type) {
7417
+ const tenantId = getTenant(request);
7418
+ let tenantPlugins = [];
7419
+ try {
7420
+ tenantPlugins = (await getSandboxPluginCatalog3().ensureLoaded(tenantId)).plugins;
7421
+ } catch {
7422
+ tenantPlugins = [];
7423
+ }
7424
+ const globalPlugins = PluginRegistry3.list().map((t2) => PluginRegistry3.get(t2)).filter((p) => Boolean(p));
7425
+ return mergePluginSources2(globalPlugins, tenantPlugins).find((p) => p.meta.type === type);
7426
+ }
7507
7427
  function maskSecrets(config) {
7508
7428
  const sensitive = /* @__PURE__ */ new Set([
7509
7429
  "password",
@@ -7587,7 +7507,7 @@ function connectionRoutes(fastify2) {
7587
7507
  fastify2.post("/api/connections/test", async (request, reply) => {
7588
7508
  const { type } = request.query;
7589
7509
  if (!type) return reply.status(400).send({ error: "query 'type' required" });
7590
- const plugin = PluginRegistry3.get(type);
7510
+ const plugin = await getTenantPlugin(request, type);
7591
7511
  if (!plugin?.connection?.test) {
7592
7512
  return reply.status(400).send({ error: "plugin does not support connection testing" });
7593
7513
  }
@@ -7615,7 +7535,7 @@ function connectionRoutes(fastify2) {
7615
7535
  fastify2.post("/api/connections/discover", async (request, reply) => {
7616
7536
  const { type } = request.query;
7617
7537
  if (!type) return reply.status(400).send({ error: "query 'type' required" });
7618
- const plugin = PluginRegistry3.get(type);
7538
+ const plugin = await getTenantPlugin(request, type);
7619
7539
  if (!plugin?.connection?.discover) {
7620
7540
  return reply.status(400).send({ error: "plugin does not support resource discovery" });
7621
7541
  }
@@ -7643,7 +7563,7 @@ function connectionRoutes(fastify2) {
7643
7563
 
7644
7564
  // src/controllers/eval.ts
7645
7565
  import { getStoreLattice as getStoreLattice10 } from "@axiom-lattice/core";
7646
- import { v4 as uuidv44 } from "uuid";
7566
+ import { v4 as uuidv43 } from "uuid";
7647
7567
 
7648
7568
  // src/services/eval-runner.ts
7649
7569
  import { EventEmitter } from "events";
@@ -7652,7 +7572,7 @@ import {
7652
7572
  modelLatticeManager as modelLatticeManager2,
7653
7573
  LatticeEvalProject
7654
7574
  } from "@axiom-lattice/core";
7655
- import { v4 as uuidv43 } from "uuid";
7575
+ import { v4 as uuidv42 } from "uuid";
7656
7576
  var TERMINAL_PERSIST_ATTEMPTS = 2;
7657
7577
  function mapLogs(logs) {
7658
7578
  return logs.map((l) => ({
@@ -7776,7 +7696,7 @@ var EvalRunner = class {
7776
7696
  console.warn(`[eval-runner] Project "${project.name}" has no judge modelKey and no "default" model \u2014 falling back to first registered model "${resolvedJudgeModelKey}"`);
7777
7697
  }
7778
7698
  }
7779
- const runId = uuidv43();
7699
+ const runId = uuidv42();
7780
7700
  const concurrency = Math.max(1, Math.floor(project.concurrency) || 3);
7781
7701
  const isHoldout = suites.length > 0 && suites.every((s) => s.name.endsWith("-validation"));
7782
7702
  const workspaceId = runConfig?.workspaceId || "";
@@ -7833,7 +7753,7 @@ var EvalRunner = class {
7833
7753
  if (terminalUnavailable()) return;
7834
7754
  const passed = result.result?.pass ?? false;
7835
7755
  const score = result.result?.final_score ?? 0;
7836
- await store.createRunResult(tenantId, runId, uuidv43(), {
7756
+ await store.createRunResult(tenantId, runId, uuidv42(), {
7837
7757
  suiteName,
7838
7758
  caseId: result.caseId,
7839
7759
  pass: passed,
@@ -7987,7 +7907,7 @@ var EvalRunner = class {
7987
7907
  var evalRunner = new EvalRunner();
7988
7908
 
7989
7909
  // src/controllers/eval.ts
7990
- function getTenantId11(request) {
7910
+ function getTenantId10(request) {
7991
7911
  const userTenantId = request.user?.tenantId;
7992
7912
  if (userTenantId) {
7993
7913
  return userTenantId;
@@ -8011,9 +7931,9 @@ async function getOwnedCase(store, tenantId, projectId, suiteId, caseId) {
8011
7931
  }
8012
7932
  async function createProject(request, reply) {
8013
7933
  try {
8014
- const tenantId = getTenantId11(request);
7934
+ const tenantId = getTenantId10(request);
8015
7935
  const store = getEvalStore();
8016
- const id3 = uuidv44();
7936
+ const id3 = uuidv43();
8017
7937
  const data = request.body;
8018
7938
  const existing = await store.getProjectsByTenant(tenantId);
8019
7939
  if (existing.some((p) => p.name === data.name)) {
@@ -8068,7 +7988,7 @@ async function createProject(request, reply) {
8068
7988
  }
8069
7989
  async function listProjects(request, reply) {
8070
7990
  try {
8071
- const tenantId = getTenantId11(request);
7991
+ const tenantId = getTenantId10(request);
8072
7992
  const store = getEvalStore();
8073
7993
  let projects = await store.getProjectsByTenant(tenantId);
8074
7994
  if (projects.length === 0) {
@@ -8079,7 +7999,7 @@ async function listProjects(request, reply) {
8079
7999
  const judgeModel = first ? { modelKey: first.key } : {};
8080
8000
  const host = request.hostname || "localhost";
8081
8001
  const baseUrl = `http://${host}:${process.env.PORT || 4001}`;
8082
- await store.createProject(tenantId, uuidv44(), {
8002
+ await store.createProject(tenantId, uuidv43(), {
8083
8003
  name: "Default",
8084
8004
  description: "Built-in project for testing eval against this server",
8085
8005
  judgeModelConfig: judgeModel,
@@ -8102,7 +8022,7 @@ async function listProjects(request, reply) {
8102
8022
  }
8103
8023
  async function getProject(request, reply) {
8104
8024
  try {
8105
- const tenantId = getTenantId11(request);
8025
+ const tenantId = getTenantId10(request);
8106
8026
  const store = getEvalStore();
8107
8027
  const { pid } = request.params;
8108
8028
  const project = await store.getProjectById(tenantId, pid);
@@ -8122,7 +8042,7 @@ async function getProject(request, reply) {
8122
8042
  }
8123
8043
  async function updateProject(request, reply) {
8124
8044
  try {
8125
- const tenantId = getTenantId11(request);
8045
+ const tenantId = getTenantId10(request);
8126
8046
  const store = getEvalStore();
8127
8047
  const { pid } = request.params;
8128
8048
  const existing = await store.getProjectById(tenantId, pid);
@@ -8166,7 +8086,7 @@ async function updateProject(request, reply) {
8166
8086
  async function deleteProject(request, reply) {
8167
8087
  let releaseDeletion;
8168
8088
  try {
8169
- const tenantId = getTenantId11(request);
8089
+ const tenantId = getTenantId10(request);
8170
8090
  const store = getEvalStore();
8171
8091
  const { pid } = request.params;
8172
8092
  const existing = await store.getProjectById(tenantId, pid);
@@ -8204,14 +8124,14 @@ async function deleteProject(request, reply) {
8204
8124
  }
8205
8125
  async function createSuite(request, reply) {
8206
8126
  try {
8207
- const tenantId = getTenantId11(request);
8127
+ const tenantId = getTenantId10(request);
8208
8128
  const store = getEvalStore();
8209
8129
  const { pid } = request.params;
8210
8130
  const project = await store.getProjectById(tenantId, pid);
8211
8131
  if (!project) {
8212
8132
  return reply.status(404).send({ success: false, message: "Project not found" });
8213
8133
  }
8214
- const id3 = uuidv44();
8134
+ const id3 = uuidv43();
8215
8135
  const data = request.body;
8216
8136
  const suite = await store.createSuite(tenantId, pid, id3, { name: data.name });
8217
8137
  return reply.status(201).send({
@@ -8226,7 +8146,7 @@ async function createSuite(request, reply) {
8226
8146
  }
8227
8147
  async function updateSuite(request, reply) {
8228
8148
  try {
8229
- const tenantId = getTenantId11(request);
8149
+ const tenantId = getTenantId10(request);
8230
8150
  const store = getEvalStore();
8231
8151
  const { pid, sid } = request.params;
8232
8152
  const existing = await getOwnedSuite(store, tenantId, pid, sid);
@@ -8246,7 +8166,7 @@ async function updateSuite(request, reply) {
8246
8166
  }
8247
8167
  async function deleteSuite(request, reply) {
8248
8168
  try {
8249
- const tenantId = getTenantId11(request);
8169
+ const tenantId = getTenantId10(request);
8250
8170
  const store = getEvalStore();
8251
8171
  const { pid, sid } = request.params;
8252
8172
  const existing = await getOwnedSuite(store, tenantId, pid, sid);
@@ -8265,14 +8185,14 @@ async function deleteSuite(request, reply) {
8265
8185
  }
8266
8186
  async function createCase(request, reply) {
8267
8187
  try {
8268
- const tenantId = getTenantId11(request);
8188
+ const tenantId = getTenantId10(request);
8269
8189
  const store = getEvalStore();
8270
8190
  const { pid, sid } = request.params;
8271
8191
  const suite = await getOwnedSuite(store, tenantId, pid, sid);
8272
8192
  if (!suite) {
8273
8193
  return reply.status(404).send({ success: false, message: "Suite not found" });
8274
8194
  }
8275
- const id3 = uuidv44();
8195
+ const id3 = uuidv43();
8276
8196
  const data = request.body;
8277
8197
  const created = await store.createCase(tenantId, sid, id3, {
8278
8198
  inputMessage: data.inputMessage,
@@ -8295,7 +8215,7 @@ async function createCase(request, reply) {
8295
8215
  }
8296
8216
  async function listCasesForSuite(request, reply) {
8297
8217
  try {
8298
- const tenantId = getTenantId11(request);
8218
+ const tenantId = getTenantId10(request);
8299
8219
  const store = getEvalStore();
8300
8220
  const { pid, sid } = request.params;
8301
8221
  const suite = await getOwnedSuite(store, tenantId, pid, sid);
@@ -8315,7 +8235,7 @@ async function listCasesForSuite(request, reply) {
8315
8235
  }
8316
8236
  async function updateCase(request, reply) {
8317
8237
  try {
8318
- const tenantId = getTenantId11(request);
8238
+ const tenantId = getTenantId10(request);
8319
8239
  const store = getEvalStore();
8320
8240
  const { pid, sid, cid } = request.params;
8321
8241
  const existing = await getOwnedCase(store, tenantId, pid, sid, cid);
@@ -8335,7 +8255,7 @@ async function updateCase(request, reply) {
8335
8255
  }
8336
8256
  async function deleteCase(request, reply) {
8337
8257
  try {
8338
- const tenantId = getTenantId11(request);
8258
+ const tenantId = getTenantId10(request);
8339
8259
  const store = getEvalStore();
8340
8260
  const { pid, sid, cid } = request.params;
8341
8261
  const existing = await getOwnedCase(store, tenantId, pid, sid, cid);
@@ -8367,7 +8287,7 @@ function registerEvalRoutes(app2) {
8367
8287
  app2.delete("/api/eval/projects/:pid/suites/:sid/cases/:cid", deleteCase);
8368
8288
  app2.post("/api/eval/projects/:pid/runs", async (request, reply) => {
8369
8289
  try {
8370
- const tenantId = getTenantId11(request);
8290
+ const tenantId = getTenantId10(request);
8371
8291
  const { pid } = request.params;
8372
8292
  const body = request.body ?? {};
8373
8293
  const bodyWs = request.headers["x-workspace-id"] || "";
@@ -8386,7 +8306,7 @@ function registerEvalRoutes(app2) {
8386
8306
  });
8387
8307
  app2.get("/api/eval/runs", async (request, reply) => {
8388
8308
  try {
8389
- const tenantId = getTenantId11(request);
8309
+ const tenantId = getTenantId10(request);
8390
8310
  const query = request.query;
8391
8311
  const runs = await getEvalStore().getRunsByTenant(tenantId, { projectId: query.project_id, status: query.status });
8392
8312
  reply.send({ success: true, message: "Ok", data: { records: runs, total: runs.length } });
@@ -8396,7 +8316,7 @@ function registerEvalRoutes(app2) {
8396
8316
  });
8397
8317
  app2.get("/api/eval/runs/:rid", async (request, reply) => {
8398
8318
  try {
8399
- const tenantId = getTenantId11(request);
8319
+ const tenantId = getTenantId10(request);
8400
8320
  const { rid } = request.params;
8401
8321
  const run2 = await getEvalStore().getRunById(tenantId, rid);
8402
8322
  if (!run2) return reply.status(404).send({ success: false, message: "Run not found" });
@@ -8407,7 +8327,7 @@ function registerEvalRoutes(app2) {
8407
8327
  }
8408
8328
  });
8409
8329
  app2.get("/api/eval/runs/:rid/stream", async (request, reply) => {
8410
- const tenantId = getTenantId11(request);
8330
+ const tenantId = getTenantId10(request);
8411
8331
  const { rid } = request.params;
8412
8332
  const store = getEvalStore();
8413
8333
  const ownedRun = await store.getRunById(tenantId, rid);
@@ -8483,7 +8403,7 @@ data: ${JSON.stringify(event.data)}
8483
8403
  });
8484
8404
  app2.post("/api/eval/runs/:rid/abort", async (request, reply) => {
8485
8405
  try {
8486
- const tenantId = getTenantId11(request);
8406
+ const tenantId = getTenantId10(request);
8487
8407
  const { rid } = request.params;
8488
8408
  const run2 = await getEvalStore().getRunById(tenantId, rid);
8489
8409
  if (!run2) return reply.status(404).send({ success: false, message: "Run not found" });
@@ -8496,7 +8416,7 @@ data: ${JSON.stringify(event.data)}
8496
8416
  });
8497
8417
  app2.delete("/api/eval/runs/:rid", async (request, reply) => {
8498
8418
  try {
8499
- const tenantId = getTenantId11(request);
8419
+ const tenantId = getTenantId10(request);
8500
8420
  const { rid } = request.params;
8501
8421
  const store = getEvalStore();
8502
8422
  const run2 = await store.getRunById(tenantId, rid);
@@ -8513,7 +8433,7 @@ data: ${JSON.stringify(event.data)}
8513
8433
  });
8514
8434
  app2.get("/api/eval/reports/projects/:pid", async (request, reply) => {
8515
8435
  try {
8516
- const tenantId = getTenantId11(request);
8436
+ const tenantId = getTenantId10(request);
8517
8437
  const { pid } = request.params;
8518
8438
  const report = await getEvalStore().getProjectReport(tenantId, pid);
8519
8439
  if (!report) return reply.status(404).send({ success: false, message: "Project not found" });
@@ -8526,7 +8446,7 @@ data: ${JSON.stringify(event.data)}
8526
8446
 
8527
8447
  // src/controllers/users.ts
8528
8448
  import { getStoreLattice as getStoreLattice11 } from "@axiom-lattice/core";
8529
- import { v4 as uuidv45 } from "uuid";
8449
+ import { v4 as uuidv44 } from "uuid";
8530
8450
  var UsersController = class {
8531
8451
  constructor() {
8532
8452
  this.userStore = getStoreLattice11("default", "user").store;
@@ -8542,7 +8462,7 @@ var UsersController = class {
8542
8462
  }
8543
8463
  async createUser(request, reply) {
8544
8464
  const data = request.body;
8545
- const id3 = uuidv45();
8465
+ const id3 = uuidv44();
8546
8466
  const existingUser = await this.userStore.getUserByEmail(data.email);
8547
8467
  if (existingUser) {
8548
8468
  return reply.status(409).send({
@@ -8608,7 +8528,7 @@ function registerUserRoutes(app2) {
8608
8528
 
8609
8529
  // src/controllers/tenants.ts
8610
8530
  import { getStoreLattice as getStoreLattice12 } from "@axiom-lattice/core";
8611
- import { v4 as uuidv46 } from "uuid";
8531
+ import { v4 as uuidv45 } from "uuid";
8612
8532
  var TenantsController = class {
8613
8533
  constructor() {
8614
8534
  this.tenantStore = getStoreLattice12("default", "tenant").store;
@@ -8620,7 +8540,7 @@ var TenantsController = class {
8620
8540
  }
8621
8541
  async createTenant(request, reply) {
8622
8542
  const data = request.body;
8623
- const id3 = uuidv46();
8543
+ const id3 = uuidv45();
8624
8544
  const tenant2 = await this.tenantStore.createTenant(id3, data);
8625
8545
  return reply.status(201).send({ success: true, data: tenant2 });
8626
8546
  }
@@ -8676,7 +8596,7 @@ function registerTenantRoutes(app2) {
8676
8596
 
8677
8597
  // src/controllers/auth.ts
8678
8598
  import { getStoreLattice as getStoreLattice13 } from "@axiom-lattice/core";
8679
- import { v4 as uuidv47 } from "uuid";
8599
+ import { v4 as uuidv46 } from "uuid";
8680
8600
  import { createHmac, randomBytes, timingSafeEqual } from "crypto";
8681
8601
  var defaultAuthConfig = {
8682
8602
  autoApproveUsers: true,
@@ -8700,7 +8620,7 @@ var AuthController = class {
8700
8620
  error: "User with this email already exists"
8701
8621
  });
8702
8622
  }
8703
- const userId = uuidv47();
8623
+ const userId = uuidv46();
8704
8624
  const userStatus = this.config.autoApproveUsers ? "active" : "pending";
8705
8625
  const userData = {
8706
8626
  email,
@@ -9101,7 +9021,7 @@ function isStaleConsoleSessionCredential(authHeader) {
9101
9021
  function bypassesConsoleAuth(request) {
9102
9022
  const path5 = request.url.split("?")[0];
9103
9023
  const method = request.method;
9104
- if (method === "GET" && /^\/api\/web-apps\/[^/]+\/runtime\/bootstrap$/.test(path5) || (method === "GET" || method === "POST") && /^\/api\/web-apps\/[^/]+\/runtime\/threads$/.test(path5) || (method === "PATCH" || method === "DELETE") && /^\/api\/web-apps\/[^/]+\/runtime\/threads\/[^/]+$/.test(path5) || method === "GET" && /^\/api\/web-apps\/[^/]+\/runtime\/threads\/[^/]+\/messages$/.test(path5) || method === "GET" && /^\/api\/web-apps\/[^/]+\/runtime\/files\/(viewfile|downloadfile)$/.test(path5) || method === "GET" && /^\/api\/web-apps\/[^/]+\/runtime\/api\/assistants\/[^/]+\/threads\/[^/]+\/sandbox\/(viewfile|downloadfile)$/.test(path5) || method === "POST" && /^\/api\/web-apps\/[^/]+\/runtime\/threads\/[^/]+\/(messages\/stream|abort|attachments)$/.test(path5) || method === "POST" && /^\/api\/web-apps\/[^/]+\/runtime\/threads\/[^/]+\/interrupts\/[^/]+\/resume$/.test(path5) || method === "GET" && /^\/api\/web-apps\/[^/]+\/chat$/.test(path5) || method === "GET" && /^\/embed\/[^/]+$/.test(path5) || (method === "POST" || method === "DELETE") && path5 === "/open/mcp") return true;
9024
+ if (method === "GET" && /^\/api\/web-apps\/[^/]+\/runtime\/bootstrap$/.test(path5) || (method === "GET" || method === "POST") && /^\/api\/web-apps\/[^/]+\/runtime\/threads$/.test(path5) || (method === "PATCH" || method === "DELETE") && /^\/api\/web-apps\/[^/]+\/runtime\/threads\/[^/]+$/.test(path5) || method === "GET" && /^\/api\/web-apps\/[^/]+\/runtime\/threads\/[^/]+\/messages$/.test(path5) || method === "GET" && /^\/api\/web-apps\/[^/]+\/runtime\/files\/(viewfile|downloadfile)$/.test(path5) || method === "GET" && /^\/api\/web-apps\/[^/]+\/runtime\/api\/assistants\/[^/]+\/threads\/[^/]+\/sandbox\/(viewfile|downloadfile)$/.test(path5) || method === "POST" && /^\/api\/web-apps\/[^/]+\/runtime\/threads\/[^/]+\/(messages\/stream|abort|attachments)$/.test(path5) || method === "POST" && /^\/api\/web-apps\/[^/]+\/runtime\/threads\/[^/]+\/interrupts\/[^/]+\/resume$/.test(path5) || method === "GET" && /^\/api\/web-apps\/[^/]+\/chat$/.test(path5) || method === "GET" && /^\/embed\/[^/]+$/.test(path5) || (method === "POST" || method === "DELETE") && path5 === "/open/mcp" || method === "POST" && path5 === "/open/session" || (method === "GET" || method === "POST") && path5.startsWith("/open/sandbox/files/")) return true;
9105
9025
  if (request.method === "GET" && /^\/api\/a2a\/agents\/[^/]+\/\.well-known\/agent-card\.json$/.test(path5)) {
9106
9026
  return true;
9107
9027
  }
@@ -9277,7 +9197,7 @@ var larkChannelAdapter = {
9277
9197
  };
9278
9198
  },
9279
9199
  async sendReply(replyTarget, message, installation) {
9280
- const { createLarkSender } = await import("./sender-PX32VSHB.mjs");
9200
+ const { createLarkSender } = await import("./sender-PLDU5EZ3.mjs");
9281
9201
  const sender = await createLarkSender(installation.config);
9282
9202
  await sender.sendTextReply({
9283
9203
  chatId: replyTarget.rawTarget.chatId,
@@ -9500,7 +9420,7 @@ function setChannelControllerDeps(deps) {
9500
9420
  _adapterRegistry = deps.adapterRegistry;
9501
9421
  _router = deps.router;
9502
9422
  }
9503
- function getTenantId12(request) {
9423
+ function getTenantId11(request) {
9504
9424
  const userTenantId = request.user?.tenantId;
9505
9425
  if (typeof userTenantId === "string" && userTenantId) {
9506
9426
  return userTenantId;
@@ -9630,7 +9550,7 @@ async function getInstallationStore() {
9630
9550
  });
9631
9551
  }
9632
9552
  async function getChannelInstallationList(request) {
9633
- const tenantId = getTenantId12(request);
9553
+ const tenantId = getTenantId11(request);
9634
9554
  const { channel } = request.query;
9635
9555
  try {
9636
9556
  const store = await getInstallationStore();
@@ -9656,7 +9576,7 @@ async function getChannelInstallationList(request) {
9656
9576
  }
9657
9577
  }
9658
9578
  async function getChannelInstallation(request, reply) {
9659
- const tenantId = getTenantId12(request);
9579
+ const tenantId = getTenantId11(request);
9660
9580
  const { installationId } = request.params;
9661
9581
  try {
9662
9582
  const store = await getInstallationStore();
@@ -9683,7 +9603,7 @@ async function getChannelInstallation(request, reply) {
9683
9603
  }
9684
9604
  }
9685
9605
  async function createChannelInstallation(request, reply) {
9686
- const tenantId = getTenantId12(request);
9606
+ const tenantId = getTenantId11(request);
9687
9607
  try {
9688
9608
  const body = snapshotPublicCreateRequest(request.body);
9689
9609
  if (!body) {
@@ -9742,7 +9662,7 @@ async function createChannelInstallation(request, reply) {
9742
9662
  }
9743
9663
  }
9744
9664
  async function updateChannelInstallation(request, reply) {
9745
- const tenantId = getTenantId12(request);
9665
+ const tenantId = getTenantId11(request);
9746
9666
  const { installationId } = request.params;
9747
9667
  try {
9748
9668
  const store = await getInstallationStore();
@@ -9866,7 +9786,7 @@ async function updateChannelInstallation(request, reply) {
9866
9786
  }
9867
9787
  }
9868
9788
  async function deleteChannelInstallation(request, reply) {
9869
- const tenantId = getTenantId12(request);
9789
+ const tenantId = getTenantId11(request);
9870
9790
  const { installationId } = request.params;
9871
9791
  try {
9872
9792
  const store = await getInstallationStore();
@@ -9938,7 +9858,7 @@ import {
9938
9858
  descriptorDataValue as descriptorDataValue2
9939
9859
  } from "@axiom-lattice/protocols";
9940
9860
  import { getBindingRegistry, getStoreLattice as getStoreLattice14 } from "@axiom-lattice/core";
9941
- function getTenantId13(request) {
9861
+ function getTenantId12(request) {
9942
9862
  const userTenantId = request.user?.tenantId;
9943
9863
  if (typeof userTenantId === "string" && userTenantId) return userTenantId;
9944
9864
  return request.headers["x-tenant-id"] || "default";
@@ -10011,7 +9931,7 @@ function invalidCreateRequest(reply) {
10011
9931
  }
10012
9932
  async function getBindingList(request, _reply) {
10013
9933
  void _reply;
10014
- const tenantId = getTenantId13(request);
9934
+ const tenantId = getTenantId12(request);
10015
9935
  const { channel, agentId, channelInstallationId, limit, offset } = request.query;
10016
9936
  try {
10017
9937
  const registry = getBindingRegistry();
@@ -10031,7 +9951,7 @@ async function getBindingList(request, _reply) {
10031
9951
  }
10032
9952
  }
10033
9953
  async function getBinding(request, reply) {
10034
- const tenantId = getTenantId13(request);
9954
+ const tenantId = getTenantId12(request);
10035
9955
  try {
10036
9956
  const registry = getBindingRegistry();
10037
9957
  const binding = await registry.findById(tenantId, request.params.id);
@@ -10046,7 +9966,7 @@ async function getBinding(request, reply) {
10046
9966
  }
10047
9967
  }
10048
9968
  async function createBinding(request, reply) {
10049
- const tenantId = getTenantId13(request);
9969
+ const tenantId = getTenantId12(request);
10050
9970
  try {
10051
9971
  const input = snapshotPublicCreate(request.body);
10052
9972
  if (!input) return invalidCreateRequest(reply);
@@ -10071,7 +9991,7 @@ async function createBinding(request, reply) {
10071
9991
  }
10072
9992
  async function updateBinding(request, reply) {
10073
9993
  try {
10074
- const tenantId = getTenantId13(request);
9994
+ const tenantId = getTenantId12(request);
10075
9995
  const registry = getBindingRegistry();
10076
9996
  const existing = await registry.findById(tenantId, request.params.id);
10077
9997
  if (!existing || isInternalBinding(existing)) {
@@ -10098,7 +10018,7 @@ async function updateBinding(request, reply) {
10098
10018
  }
10099
10019
  async function deleteBinding(request, reply) {
10100
10020
  try {
10101
- const tenantId = getTenantId13(request);
10021
+ const tenantId = getTenantId12(request);
10102
10022
  const registry = getBindingRegistry();
10103
10023
  const existing = await registry.findById(tenantId, request.params.id);
10104
10024
  if (!existing || isInternalBinding(existing)) {
@@ -10115,7 +10035,7 @@ async function deleteBinding(request, reply) {
10115
10035
  }
10116
10036
  async function resolveBinding(request, _reply) {
10117
10037
  void _reply;
10118
- const tenantId = getTenantId13(request);
10038
+ const tenantId = getTenantId12(request);
10119
10039
  const { channel, senderId, channelInstallationId } = request.query;
10120
10040
  if (channel === "room") {
10121
10041
  return { success: false, message: "No binding found", data: null };
@@ -10145,7 +10065,7 @@ function registerChannelBindingRoutes(app2) {
10145
10065
 
10146
10066
  // src/controllers/menu-items.ts
10147
10067
  import { getMenuRegistry } from "@axiom-lattice/core";
10148
- function getTenantId14(request) {
10068
+ function getTenantId13(request) {
10149
10069
  const userTenantId = request.user?.tenantId;
10150
10070
  if (userTenantId) return userTenantId;
10151
10071
  return request.headers["x-tenant-id"] || "default";
@@ -10154,7 +10074,7 @@ function errorMessage(err) {
10154
10074
  return err instanceof Error ? err.message : "Unexpected error";
10155
10075
  }
10156
10076
  async function getMenuItemList(request, _reply) {
10157
- const tenantId = getTenantId14(request);
10077
+ const tenantId = getTenantId13(request);
10158
10078
  try {
10159
10079
  const registry = getMenuRegistry();
10160
10080
  const items = await registry.list({ tenantId, menuTarget: request.query.menuTarget });
@@ -10166,7 +10086,7 @@ async function getMenuItemList(request, _reply) {
10166
10086
  }
10167
10087
  }
10168
10088
  async function getMenuItem(request, reply) {
10169
- const tenantId = getTenantId14(request);
10089
+ const tenantId = getTenantId13(request);
10170
10090
  try {
10171
10091
  const registry = getMenuRegistry();
10172
10092
  const item = await registry.getById(request.params.id);
@@ -10183,7 +10103,7 @@ async function getMenuItem(request, reply) {
10183
10103
  }
10184
10104
  }
10185
10105
  async function createMenuItem(request, reply) {
10186
- const tenantId = getTenantId14(request);
10106
+ const tenantId = getTenantId13(request);
10187
10107
  try {
10188
10108
  const registry = getMenuRegistry();
10189
10109
  const item = await registry.create({ ...request.body, tenantId });
@@ -10198,7 +10118,7 @@ async function createMenuItem(request, reply) {
10198
10118
  }
10199
10119
  async function updateMenuItem(request, reply) {
10200
10120
  try {
10201
- const tenantId = getTenantId14(request);
10121
+ const tenantId = getTenantId13(request);
10202
10122
  const registry = getMenuRegistry();
10203
10123
  const existing = await registry.getById(request.params.id);
10204
10124
  if (!existing || existing.tenantId !== tenantId) {
@@ -10216,7 +10136,7 @@ async function updateMenuItem(request, reply) {
10216
10136
  }
10217
10137
  async function deleteMenuItem(request, reply) {
10218
10138
  try {
10219
- const tenantId = getTenantId14(request);
10139
+ const tenantId = getTenantId13(request);
10220
10140
  const registry = getMenuRegistry();
10221
10141
  const existing = await registry.getById(request.params.id);
10222
10142
  if (!existing || existing.tenantId !== tenantId) {
@@ -10499,7 +10419,7 @@ import { getStoreLattice as getStoreLattice15 } from "@axiom-lattice/core";
10499
10419
  import {
10500
10420
  AgentType as AgentType2
10501
10421
  } from "@axiom-lattice/protocols";
10502
- function getTenantId15(request) {
10422
+ function getTenantId14(request) {
10503
10423
  const userTenantId = request.user?.tenantId;
10504
10424
  if (userTenantId) return userTenantId;
10505
10425
  return request.headers["x-tenant-id"] || "default";
@@ -10536,7 +10456,7 @@ async function requireManagedAssistant(request, reply) {
10536
10456
  reply.status(400).send({ success: false, error: "assistantId is required" });
10537
10457
  return null;
10538
10458
  }
10539
- const registered = await getLocalA2AAssistant(getTenantId15(request), assistantId);
10459
+ const registered = await getLocalA2AAssistant(getTenantId14(request), assistantId);
10540
10460
  if (!registered) {
10541
10461
  reply.status(404).send({
10542
10462
  success: false,
@@ -10547,7 +10467,7 @@ async function requireManagedAssistant(request, reply) {
10547
10467
  return { assistantId, localRuntime: registered.localRuntime };
10548
10468
  }
10549
10469
  async function getLocalA2AStatus(request, reply) {
10550
- const tenantId = getTenantId15(request);
10470
+ const tenantId = getTenantId14(request);
10551
10471
  const managed = await getLocalA2AAssistants(tenantId);
10552
10472
  const states = await Promise.all(
10553
10473
  managed.map(
@@ -11186,7 +11106,7 @@ function notifyProjectTaskAdmission(task) {
11186
11106
  } catch {
11187
11107
  }
11188
11108
  }
11189
- function getTenantId16(request) {
11109
+ function getTenantId15(request) {
11190
11110
  const user = request.user;
11191
11111
  const value = user?.tenantId ?? request.headers["x-tenant-id"] ?? "default";
11192
11112
  if (typeof value !== "string" || !value) throw new HttpTaskError(400, "INVALID_TASK_INPUT");
@@ -11427,7 +11347,7 @@ async function validateReferences(store, task, parentId, dependencies) {
11427
11347
  function createTaskController(deps) {
11428
11348
  const mutationMutex = deps.projectMutationMutex ?? projectMutationMutex;
11429
11349
  const authorize = async (request, projectId, capability2) => deps.access.requireProjectAccess({
11430
- tenantId: getTenantId16(request),
11350
+ tenantId: getTenantId15(request),
11431
11351
  userId: getUserId4(request),
11432
11352
  projectId,
11433
11353
  capability: capability2
@@ -11444,7 +11364,7 @@ function createTaskController(deps) {
11444
11364
  });
11445
11365
  };
11446
11366
  const list = withErrors(async (request) => {
11447
- const tenantId = getTenantId16(request);
11367
+ const tenantId = getTenantId15(request);
11448
11368
  const userId = getUserId4(request);
11449
11369
  const query = exactObject(request.query, ["projectId", "status", "priority", "limit", "offset", "ownerType", "ownerId", "parentId", "metadata"]);
11450
11370
  const projectId = typeof query.projectId === "string" ? query.projectId : void 0;
@@ -11516,14 +11436,14 @@ function createTaskController(deps) {
11516
11436
  });
11517
11437
  const get = withErrors(async (request, reply) => {
11518
11438
  await preauthorizeExplicitProject(request, authorize);
11519
- const current = await deps.tasks.getById(getTenantId16(request), request.params.id);
11439
+ const current = await deps.tasks.getById(getTenantId15(request), request.params.id);
11520
11440
  if (!current) return sendNotFound(reply);
11521
11441
  await authorizeRead(request, current, authorize);
11522
11442
  return { success: true, data: current };
11523
11443
  });
11524
11444
  const create = withErrors(async (request, reply) => {
11525
11445
  const body = snapshotCreate(request.body);
11526
- const tenantId = getTenantId16(request);
11446
+ const tenantId = getTenantId15(request);
11527
11447
  const userId = getUserId4(request);
11528
11448
  const governed = governedCreate(body);
11529
11449
  if (governed) return reply.code(409).send({ success: false, code: governed });
@@ -11576,7 +11496,7 @@ function createTaskController(deps) {
11576
11496
  const update = withErrors(async (request, reply) => {
11577
11497
  const body = snapshotUpdate(request.body);
11578
11498
  await preauthorizeExplicitProject(request, authorize);
11579
- const current = await deps.tasks.getById(getTenantId16(request), request.params.id);
11499
+ const current = await deps.tasks.getById(getTenantId15(request), request.params.id);
11580
11500
  if (!current) return sendNotFound(reply);
11581
11501
  await authorizeMutation(request, current, authorize);
11582
11502
  return lockedTask(request, current, async (locked) => {
@@ -11594,7 +11514,7 @@ function createTaskController(deps) {
11594
11514
  });
11595
11515
  const remove = withErrors(async (request, reply) => {
11596
11516
  await preauthorizeExplicitProject(request, authorize);
11597
- const current = await deps.tasks.getById(getTenantId16(request), request.params.id);
11517
+ const current = await deps.tasks.getById(getTenantId15(request), request.params.id);
11598
11518
  if (!current) return sendNotFound(reply);
11599
11519
  await authorizeMutation(request, current, authorize);
11600
11520
  return lockedTask(request, current, async (locked) => {
@@ -11608,7 +11528,7 @@ function createTaskController(deps) {
11608
11528
  const complete = withErrors(async (request, reply) => {
11609
11529
  const body = snapshotComplete(request.body);
11610
11530
  await preauthorizeExplicitProject(request, authorize);
11611
- const current = await deps.tasks.getById(getTenantId16(request), request.params.id);
11531
+ const current = await deps.tasks.getById(getTenantId15(request), request.params.id);
11612
11532
  if (!current) return sendNotFound(reply);
11613
11533
  await authorizeMutation(request, current, authorize);
11614
11534
  return lockedTask(request, current, async (locked) => {
@@ -11625,7 +11545,7 @@ function createTaskController(deps) {
11625
11545
  });
11626
11546
  const workItems = withErrors(async (request, reply) => {
11627
11547
  await preauthorizeExplicitProject(request, authorize);
11628
- const current = await deps.tasks.getById(getTenantId16(request), request.params.id);
11548
+ const current = await deps.tasks.getById(getTenantId15(request), request.params.id);
11629
11549
  if (!current) return sendNotFound(reply);
11630
11550
  await authorizeRead(request, current, authorize);
11631
11551
  const query = exactObject(request.query, ["action", "limit", "offset"]);
@@ -11645,7 +11565,7 @@ function createTaskController(deps) {
11645
11565
  const body = snapshotReassign(request.body);
11646
11566
  const pathProject = request.params.projectId;
11647
11567
  const access = await authorize(request, pathProject, "manage");
11648
- const snapshot = await deps.tasks.getById(getTenantId16(request), request.params.id);
11568
+ const snapshot = await deps.tasks.getById(getTenantId15(request), request.params.id);
11649
11569
  if (!snapshot || snapshot.projectId !== access.project.id || snapshot.workspaceId !== access.project.workspaceId || snapshot.ownerType !== "agent") throw notFound();
11650
11570
  const projectId = snapshot.projectId;
11651
11571
  return deps.executionMutex.runExclusive({
@@ -13045,6 +12965,7 @@ function isMultipartRequestError(error) {
13045
12965
  import { existsSync as existsSync2 } from "fs";
13046
12966
  import { readFile, readdir as readdir2 } from "fs/promises";
13047
12967
  import path3 from "path";
12968
+ import { fileURLToPath } from "url";
13048
12969
  import { z as z6 } from "zod";
13049
12970
  var idSchema2 = z6.string().min(1).max(128).regex(/^[A-Za-z0-9._:@-]+$/);
13050
12971
  var JS_CONTENT_TYPE = "application/javascript; charset=utf-8";
@@ -13074,10 +12995,36 @@ async function listChunkCssFiles(assetsDir) {
13074
12995
  }
13075
12996
  }
13076
12997
  var BUNDLED_MARKER = "agent-chat-loader.js";
12998
+ function selfModuleDir() {
12999
+ try {
13000
+ const target = {};
13001
+ const originalPrepare = Error.prepareStackTrace;
13002
+ Error.captureStackTrace(target, selfModuleDir);
13003
+ Error.prepareStackTrace = (error, frames2) => frames2;
13004
+ const frames = target.stack;
13005
+ Error.prepareStackTrace = originalPrepare;
13006
+ if (!Array.isArray(frames)) return null;
13007
+ for (const frame of frames) {
13008
+ const callSite = frame;
13009
+ if (typeof callSite.getFileName !== "function") continue;
13010
+ const fileName = callSite.getFileName();
13011
+ if (typeof fileName !== "string" || fileName.length === 0) continue;
13012
+ const filePath = fileName.startsWith("file://") ? fileURLToPath(fileName) : fileName;
13013
+ return path3.dirname(filePath);
13014
+ }
13015
+ } catch {
13016
+ }
13017
+ return null;
13018
+ }
13077
13019
  function resolveBundledEmbedDir() {
13020
+ const candidates = [];
13078
13021
  if (typeof __dirname === "string") {
13079
- const compiled = path3.resolve(__dirname, "embed");
13080
- if (existsSync2(path3.join(compiled, BUNDLED_MARKER))) return compiled;
13022
+ candidates.push(path3.resolve(__dirname, "embed"));
13023
+ }
13024
+ const selfDir = selfModuleDir();
13025
+ if (selfDir !== null) candidates.push(path3.resolve(selfDir, "embed"));
13026
+ for (const candidate of candidates) {
13027
+ if (existsSync2(path3.join(candidate, BUNDLED_MARKER))) return candidate;
13081
13028
  }
13082
13029
  let dir = path3.dirname(path3.resolve(process.argv[1] ?? process.cwd()));
13083
13030
  for (let depth = 0; depth < 8; depth += 1) {
@@ -14406,7 +14353,14 @@ function registerProjectRoomRoutes(app2, deps) {
14406
14353
  await deps.readStateService.mark(actor(request, params.projectId));
14407
14354
  return { data: { marked: true } };
14408
14355
  }));
14409
- app2.get("/api/projects/:projectId/members", async (request, reply) => run(reply, async () => ({ data: await deps.membershipService.list(actor(request, projectRoomParamsSchema.parse(request.params).projectId)) })));
14356
+ app2.get("/api/projects/:projectId/members", async (request, reply) => run(reply, async () => {
14357
+ const memberships = await deps.membershipService.list(actor(request, projectRoomParamsSchema.parse(request.params).projectId));
14358
+ const enriched = await Promise.all(memberships.map(async (membership) => {
14359
+ const user = await deps.userDirectory.getUserById(membership.userId);
14360
+ return user === null ? membership : { ...membership, name: user.name };
14361
+ }));
14362
+ return { data: enriched };
14363
+ }));
14410
14364
  app2.post("/api/projects/:projectId/members", async (request, reply) => run(reply, async () => {
14411
14365
  const p = projectRoomParamsSchema.parse(request.params);
14412
14366
  return { statusCode: 201, data: await deps.membershipService.add(actor(request, p.projectId), addProjectMemberSchema.parse(request.body)) };
@@ -14581,13 +14535,16 @@ function registerCoSpaceRoutes(app2, deps) {
14581
14535
  project.id
14582
14536
  );
14583
14537
  const participantNames = [];
14538
+ const otherHumanNames = [];
14584
14539
  for (const m of memberships) {
14585
14540
  if (m.status !== "active") continue;
14586
14541
  const user = await deps.userStore.getUserById(m.userId);
14587
14542
  if (user) {
14588
14543
  participantNames.push(user.name);
14544
+ if (m.userId !== actor2.userId) otherHumanNames.push(user.name);
14589
14545
  }
14590
14546
  }
14547
+ const displayName = project.kind === "personal" && otherHumanNames.length === 1 ? otherHumanNames[0] : void 0;
14591
14548
  rooms.push({
14592
14549
  project,
14593
14550
  room,
@@ -14596,6 +14553,7 @@ function registerCoSpaceRoutes(app2, deps) {
14596
14553
  (m) => m.status === "active"
14597
14554
  ).length,
14598
14555
  participantNames,
14556
+ ...displayName === void 0 ? {} : { displayName },
14599
14557
  unreadCount: await computeUnread(
14600
14558
  deps,
14601
14559
  actor2.tenantId,
@@ -14613,41 +14571,45 @@ function registerCoSpaceRoutes(app2, deps) {
14613
14571
  const bTime = b.lastMessage ? Date.parse(b.lastMessage.createdAt) : 0;
14614
14572
  return bTime - aTime;
14615
14573
  });
14616
- const publicRoom = await deps.publicRoom.ensure(actor2.tenantId, params.workspaceId);
14617
- if (publicRoom) {
14618
- const publicMessages = await deps.messageStore.list({
14619
- tenantId: actor2.tenantId,
14620
- roomId: publicRoom.room.id,
14621
- limit: 1
14622
- });
14623
- const publicLastMessage = publicMessages[0];
14624
- const publicMemberships = await deps.membershipStore.list(
14625
- actor2.tenantId,
14626
- publicRoom.project.id
14627
- );
14628
- const publicParticipantNames = [];
14629
- for (const m of publicMemberships) {
14630
- if (m.status !== "active") continue;
14631
- const user = await deps.userStore.getUserById(m.userId);
14632
- if (user) {
14633
- publicParticipantNames.push(user.name);
14574
+ try {
14575
+ const publicRoom = await deps.publicRoom.ensure(actor2.tenantId, params.workspaceId);
14576
+ if (publicRoom) {
14577
+ const publicMessages = await deps.messageStore.list({
14578
+ tenantId: actor2.tenantId,
14579
+ roomId: publicRoom.room.id,
14580
+ limit: 1
14581
+ });
14582
+ const publicLastMessage = publicMessages[0];
14583
+ const publicMemberships = await deps.membershipStore.list(
14584
+ actor2.tenantId,
14585
+ publicRoom.project.id
14586
+ );
14587
+ const publicParticipantNames = [];
14588
+ for (const m of publicMemberships) {
14589
+ if (m.status !== "active") continue;
14590
+ const user = await deps.userStore.getUserById(m.userId);
14591
+ if (user) {
14592
+ publicParticipantNames.push(user.name);
14593
+ }
14634
14594
  }
14595
+ rooms.unshift({
14596
+ project: publicRoom.project,
14597
+ room: publicRoom.room,
14598
+ lastMessage: publicLastMessage === void 0 ? void 0 : toProjectRoomPublicMessage2(publicLastMessage),
14599
+ participantCount: publicMemberships.filter((m) => m.status === "active").length,
14600
+ participantNames: publicParticipantNames,
14601
+ isPublic: true,
14602
+ unreadCount: await computeUnread(
14603
+ deps,
14604
+ actor2.tenantId,
14605
+ actor2.userId,
14606
+ publicRoom.room.id,
14607
+ publicLastMessage
14608
+ )
14609
+ });
14635
14610
  }
14636
- rooms.unshift({
14637
- project: publicRoom.project,
14638
- room: publicRoom.room,
14639
- lastMessage: publicLastMessage === void 0 ? void 0 : toProjectRoomPublicMessage2(publicLastMessage),
14640
- participantCount: publicMemberships.filter((m) => m.status === "active").length,
14641
- participantNames: publicParticipantNames,
14642
- isPublic: true,
14643
- unreadCount: await computeUnread(
14644
- deps,
14645
- actor2.tenantId,
14646
- actor2.userId,
14647
- publicRoom.room.id,
14648
- publicLastMessage
14649
- )
14650
- });
14611
+ } catch (e) {
14612
+ console.error("[CoSpace] Failed to assemble public room:", e);
14651
14613
  }
14652
14614
  return { data: { rooms } };
14653
14615
  });
@@ -14672,7 +14634,6 @@ function registerCoSpaceRoutes(app2, deps) {
14672
14634
  );
14673
14635
  }
14674
14636
  let projectId;
14675
- let otherPartyId;
14676
14637
  if (body.type === "human") {
14677
14638
  projectId = generateDirectHumanProjectId(
14678
14639
  actor2.tenantId,
@@ -14680,7 +14641,6 @@ function registerCoSpaceRoutes(app2, deps) {
14680
14641
  actor2.userId,
14681
14642
  body.targetUserId
14682
14643
  );
14683
- otherPartyId = body.targetUserId;
14684
14644
  } else {
14685
14645
  projectId = generateDirectBotProjectId(
14686
14646
  actor2.tenantId,
@@ -14688,14 +14648,24 @@ function registerCoSpaceRoutes(app2, deps) {
14688
14648
  actor2.userId,
14689
14649
  body.assistantId
14690
14650
  );
14691
- otherPartyId = body.assistantId;
14692
14651
  }
14693
14652
  let project = await deps.projectStore.getProjectById(
14694
14653
  actor2.tenantId,
14695
14654
  projectId
14696
14655
  );
14697
14656
  if (!project) {
14698
- const name = body.type === "human" ? `Direct with ${otherPartyId}` : `Chat with ${otherPartyId}`;
14657
+ let displayName;
14658
+ if (body.type === "human") {
14659
+ const targetUser = await deps.userStore.getUserById(body.targetUserId);
14660
+ displayName = targetUser?.name ?? body.targetUserId;
14661
+ } else {
14662
+ const targetAssistant = await deps.assistantStore.getAssistantById(
14663
+ actor2.tenantId,
14664
+ body.assistantId
14665
+ );
14666
+ displayName = targetAssistant?.name ?? body.assistantId;
14667
+ }
14668
+ const name = body.type === "human" ? `Direct with ${displayName}` : `Chat with ${displayName}`;
14699
14669
  project = await deps.projectStore.createProject(
14700
14670
  actor2.tenantId,
14701
14671
  params.workspaceId,
@@ -14888,12 +14858,28 @@ function registerCoSpaceRoutes(app2, deps) {
14888
14858
  actor2.tenantId,
14889
14859
  directProjectId
14890
14860
  );
14891
- bots.push({
14861
+ const bot = {
14892
14862
  assistantId: assistant.id,
14893
14863
  name: assistant.name,
14894
14864
  description: assistant.description,
14895
14865
  hasDirectRoom: existingProject !== null
14896
- });
14866
+ };
14867
+ if (assistant.createdAt) bot.createdAt = assistant.createdAt.toISOString();
14868
+ if (existingProject) {
14869
+ const membership = await deps.botMembershipStore.findByAssistant(
14870
+ actor2.tenantId,
14871
+ directProjectId,
14872
+ assistant.id
14873
+ );
14874
+ if (membership) {
14875
+ if (membership.role) bot.role = membership.role;
14876
+ if (membership.mentionName) bot.mentionName = membership.mentionName;
14877
+ if (membership.responsibility) bot.responsibility = membership.responsibility;
14878
+ bot.status = membership.status;
14879
+ if (membership.joinedAt) bot.joinedAt = membership.joinedAt.toISOString();
14880
+ }
14881
+ }
14882
+ bots.push(bot);
14897
14883
  }
14898
14884
  return { data: { bots } };
14899
14885
  });
@@ -14934,13 +14920,15 @@ function registerCoSpaceRoutes(app2, deps) {
14934
14920
  actor2.tenantId,
14935
14921
  directProjectId
14936
14922
  );
14937
- members.push({
14923
+ const member = {
14938
14924
  userId: link.userId,
14939
14925
  name: user.name,
14940
14926
  email: user.email,
14941
14927
  role: link.role,
14942
14928
  hasDirectRoom: existingProject !== null
14943
- });
14929
+ };
14930
+ if (link.joinedAt) member.joinedAt = link.joinedAt.toISOString();
14931
+ members.push(member);
14944
14932
  }
14945
14933
  return { data: { members } };
14946
14934
  });
@@ -18812,7 +18800,15 @@ var registerLatticeRoutes = (app2, channelDeps, options = {}) => {
18812
18800
  });
18813
18801
  }
18814
18802
  };
18815
- registerProjectRoomRoutes(app2, { roomService, membershipService, messageService, readStateService });
18803
+ registerProjectRoomRoutes(app2, {
18804
+ roomService,
18805
+ membershipService,
18806
+ messageService,
18807
+ readStateService,
18808
+ userDirectory: {
18809
+ getUserById: (id3) => getStoreLattice16("default", "user").store.getUserById(id3).then((u) => u ? { name: u.name } : null)
18810
+ }
18811
+ });
18816
18812
  registerProjectRosterRoutes(app2, { service: rosterService });
18817
18813
  registerCoSpaceRoutes(app2, {
18818
18814
  projectStore: {
@@ -21926,7 +21922,7 @@ async function restoreMcpConnections() {
21926
21922
  const connectedConfigs = configs.filter((c2) => c2.status === "connected");
21927
21923
  if (connectedConfigs.length === 0) return;
21928
21924
  logger5.info(`Restoring ${connectedConfigs.length} MCP server connections...`);
21929
- const { convertToConnection } = await import("./mcp-configs-IIKQM5GM.mjs");
21925
+ const { convertToConnection } = await import("./mcp-configs-WCY5EXCW.mjs");
21930
21926
  for (const config of connectedConfigs) {
21931
21927
  try {
21932
21928
  const connection = convertToConnection(config.config);
@@ -21975,7 +21971,7 @@ var start = async (config) => {
21975
21971
  let channelDeps;
21976
21972
  const adapterRegistry = new ChannelAdapterRegistry();
21977
21973
  adapterRegistry.register(larkChannelAdapter);
21978
- const { wechatChannelAdapter } = await import("./WechatChannelAdapter-WSDKR4OA.mjs");
21974
+ const { wechatChannelAdapter } = await import("./WechatChannelAdapter-7WHE5UGY.mjs");
21979
21975
  adapterRegistry.register(wechatChannelAdapter);
21980
21976
  try {
21981
21977
  const { getStoreLattice: getStore11 } = await import("@axiom-lattice/core");
@@ -22026,9 +22022,9 @@ var start = async (config) => {
22026
22022
  projectRoomRealtimeRuntime
22027
22023
  });
22028
22024
  try {
22029
- const { A2AAuthService, parseEnvKeys } = await import("./A2AAuthService-DK5X6VIL.mjs");
22030
- const { registerA2AStandardRoutes } = await import("./a2a-standard-WC2BSOFV.mjs");
22031
- const a2a = await import("./a2a-7N3WDAOP.mjs");
22025
+ const { A2AAuthService, parseEnvKeys } = await import("./A2AAuthService-7UGQ7GMW.mjs");
22026
+ const { registerA2AStandardRoutes } = await import("./a2a-standard-VEQBXBMM.mjs");
22027
+ const a2a = await import("./a2a-FGYX2HH3.mjs");
22032
22028
  const a2aKeyStore = getStoreLattice27("default", "a2aApiKey").store;
22033
22029
  const assistantStore = getStoreLattice27("default", "assistant").store;
22034
22030
  const projectStore = getStoreLattice27("default", "project").store;
@@ -22057,11 +22053,41 @@ var start = async (config) => {
22057
22053
  });
22058
22054
  }
22059
22055
  try {
22060
- const { registerOpenRoutes } = await import("./open-DCAOL5CG.mjs");
22056
+ const { registerOpenRoutes } = await import("./open-HH7RKGML.mjs");
22057
+ const { registerOpenSessionRoutes } = await import("./open-session-3VN65PRR.mjs");
22058
+ const { registerOpenCatalogRoutes } = await import("./open-catalog-WYS2AENM.mjs");
22059
+ const { registerOpenFilesRoutes } = await import("./open-files-GVRMK5PL.mjs");
22060
+ const { registerOpenAuditRoutes } = await import("./open-audit-UJ3NXCGW.mjs");
22061
+ const { registerOpenExposureRoutes } = await import("./open-exposure-FK4G6O6L.mjs");
22062
+ const { openLattice } = await import("./openLattice-GAAGQJST.mjs");
22063
+ const { createKbProvider } = await import("./kbProvider-2D6DZ34N.mjs");
22064
+ const { createOpenSandboxProvider } = await import("./sandboxProvider-I3P66VXT.mjs");
22065
+ const { createAgentProvider } = await import("./agentProvider-X4FVQPKW.mjs");
22066
+ const { registerExposedPluginTools } = await import("./registerExposedPlugins-63EUF4VS.mjs");
22067
+ const { CollectionService: CollectionService2 } = await import("./collection_service-RTRJEQFL.mjs");
22068
+ openLattice.register(createKbProvider(new CollectionService2()));
22069
+ openLattice.register(createOpenSandboxProvider());
22070
+ const threadStore = getStoreLattice27("default", "thread").store;
22071
+ const assistantStore = getStoreLattice27("default", "assistant").store;
22072
+ openLattice.register(
22073
+ createAgentProvider({
22074
+ threadStore,
22075
+ resolveAssistant: async (tenantId, assistantId) => {
22076
+ const assistant = await assistantStore.getAssistantById(tenantId, assistantId);
22077
+ return assistant ? { name: assistant.name, description: assistant.description } : null;
22078
+ }
22079
+ })
22080
+ );
22081
+ await registerExposedPluginTools();
22061
22082
  registerOpenRoutes(app);
22062
- logger5.info("Open MCP spike routes registered");
22083
+ registerOpenSessionRoutes(app);
22084
+ registerOpenCatalogRoutes(app);
22085
+ registerOpenFilesRoutes(app);
22086
+ registerOpenAuditRoutes(app);
22087
+ registerOpenExposureRoutes(app);
22088
+ logger5.info("Open API routes registered (kb + sandbox providers, session exchange)");
22063
22089
  } catch (err) {
22064
- logger5.warn("Open MCP spike routes unavailable", {
22090
+ logger5.warn("Open API routes unavailable", {
22065
22091
  error: err instanceof Error ? err.message : String(err)
22066
22092
  });
22067
22093
  }
@@ -22070,7 +22096,7 @@ var start = async (config) => {
22070
22096
  logger5.info("Registered sandbox manager from env configuration");
22071
22097
  }
22072
22098
  try {
22073
- const { ResourceController } = await import("./resources-VA7LSDKN.mjs");
22099
+ const { ResourceController } = await import("./resources-SRQRKW5G.mjs");
22074
22100
  const sharedResourceStore = getStoreLattice27("default", "sharedResource").store;
22075
22101
  const cache = new TokenCache();
22076
22102
  const resourceController = new ResourceController({