@axiom-lattice/gateway 9.0.0 → 10.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/dist/{a2a-standard-MD7WNDTP.mjs → a2a-standard-NOAVPYXJ.mjs} +2 -2
  2. package/dist/{chunk-2SR4F3ZD.mjs → chunk-PHWGCRW2.mjs} +2 -1
  3. package/dist/{chunk-2SR4F3ZD.mjs.map → chunk-PHWGCRW2.mjs.map} +1 -1
  4. package/dist/embed/{embed-page-AgentDetailSideApp-6RYNHS5F.js → embed-page-AgentDetailSideApp-X5HKDN3N.js} +1 -1
  5. package/dist/embed/{embed-page-AgentGovernanceWorkbench-UAPXF3SZ.js → embed-page-AgentGovernanceWorkbench-MFXL7BOW.js} +1 -1
  6. package/dist/embed/{embed-page-LangfuseDashboard-ZYGZNW7P.js → embed-page-LangfuseDashboard-NPYFMKK3.js} +1 -1
  7. package/dist/embed/{embed-page-MessageGraph-S2P3WACC.js → embed-page-MessageGraph-JUCEXYLU.js} +1 -1
  8. package/dist/embed/{embed-page-ReactChart-I3UZVE4Z.js → embed-page-ReactChart-2QJ3QRBH.js} +1 -1
  9. package/dist/embed/{embed-page-SkillFlow-JMIJ46FX.js → embed-page-SkillFlow-PFEXQ75Z.js} +1 -1
  10. package/dist/embed/{embed-page-TasksSideApp-IVFEFLSH.js → embed-page-TasksSideApp-SBHVHNVT.js} +1 -1
  11. package/dist/embed/{embed-page-ThreadMaintenancePanel-KQPPAEWJ.js → embed-page-ThreadMaintenancePanel-LCCRUA75.js} +1 -1
  12. package/dist/embed/{embed-page-TopologyRuntimeView-XCFQ23HF.js → embed-page-TopologyRuntimeView-ATA23XXF.js} +1 -1
  13. package/dist/embed/{embed-page-WorkflowAutomationView-UTKCKP75.js → embed-page-WorkflowAutomationView-OVGOUVXH.js} +1 -1
  14. package/dist/embed/{embed-page-chunk-WHGU76CU.js → embed-page-chunk-7F5BSMP3.js} +1 -1
  15. package/dist/embed/{embed-page-chunk-SEOTZ4Q7.js → embed-page-chunk-HLBQ5JKL.js} +324 -185
  16. package/dist/embed/{embed-page-chunk-7VDAOX3D.js → embed-page-chunk-HUH33Z2E.js} +1 -1
  17. package/dist/embed/{embed-page-chunk-5X4MNQAW.js → embed-page-chunk-LZ4ITV3M.js} +1 -1
  18. package/dist/embed/{embed-page-chunk-ZZFTCBM6.js → embed-page-chunk-ODTY6SE7.js} +1 -1
  19. package/dist/embed/embed-page-chunk-Q7Z7MHOM.js +76 -0
  20. package/dist/embed/{embed-page-chunk-RANB2CUO.js → embed-page-chunk-QOPHOXA7.js} +1 -1
  21. package/dist/embed/{embed-page-chunk-MD4U4DHC.js → embed-page-chunk-RFF7S4H5.js} +5 -5
  22. package/dist/embed/{embed-page-chunk-RVIS6CKE.js → embed-page-chunk-VNRFN74K.js} +1 -1
  23. package/dist/embed/{embed-page-chunk-77CQOFKU.js → embed-page-chunk-WE6PZS2N.js} +1 -1
  24. package/dist/embed/{embed-page-en-DNDGCPMA.js → embed-page-en-4HTY4XK4.js} +1 -1
  25. package/dist/embed/embed-page-en-KZQZS4JN.js +1 -0
  26. package/dist/embed/embed-page-en-VHD2WUUG.js +1 -0
  27. package/dist/embed/embed-page-zh-A7DSGF6P.js +1 -0
  28. package/dist/embed/embed-page-zh-KSZOJPOV.js +1 -0
  29. package/dist/embed/{embed-page-zh-2H4EB3F3.js → embed-page-zh-UHTZEW5G.js} +1 -1
  30. package/dist/embed/embed-page.js +1 -1
  31. package/dist/embed/mcp-app-page.js +76 -15
  32. package/dist/index.js +96 -45
  33. package/dist/index.js.map +1 -1
  34. package/dist/index.mjs +18 -11
  35. package/dist/index.mjs.map +1 -1
  36. package/dist/{open-27ZPLBIW.mjs → open-PCOORPQ5.mjs} +63 -16
  37. package/dist/open-PCOORPQ5.mjs.map +1 -0
  38. package/package.json +18 -13
  39. package/dist/embed/embed-page-chunk-TCVPYXPL.js +0 -15
  40. package/dist/embed/embed-page-en-4HSTKY4Q.js +0 -1
  41. package/dist/embed/embed-page-en-MIVBTEEL.js +0 -1
  42. package/dist/embed/embed-page-zh-7PJNJJZY.js +0 -1
  43. package/dist/embed/embed-page-zh-UZ4GPIU7.js +0 -1
  44. package/dist/open-27ZPLBIW.mjs.map +0 -1
  45. /package/dist/{a2a-standard-MD7WNDTP.mjs.map → a2a-standard-NOAVPYXJ.mjs.map} +0 -0
package/dist/index.js CHANGED
@@ -651,6 +651,7 @@ async function saveProjectFile(params) {
651
651
  }
652
652
  workspaceId = project.workspaceId;
653
653
  }
654
+ if (!workspaceId) throw new Error("Workspace not found");
654
655
  const workspace = await workspaceStore.getWorkspaceById(
655
656
  params.tenantId,
656
657
  workspaceId
@@ -8308,9 +8309,19 @@ var init_openRateLimiter = __esm({
8308
8309
  });
8309
8310
 
8310
8311
  // src/services/open/openMcpServer.ts
8311
- async function buildSessionServer(options) {
8312
+ function isStandardSchemaWithJson(value) {
8313
+ if (typeof value !== "object" || value === null) return false;
8314
+ const standard = value["~standard"];
8315
+ return typeof standard === "object" && standard !== null && "jsonSchema" in standard;
8316
+ }
8317
+ function toStandardSchema(schema2) {
8318
+ if (isStandardSchemaWithJson(schema2)) return schema2;
8319
+ const zodSchema = schema2 instanceof import_zod22.z.ZodType ? schema2 : import_zod22.z.object(schema2);
8320
+ return zodSchema;
8321
+ }
8322
+ async function createSessionServer(options) {
8312
8323
  const { catalog, invoke, uiResources } = options;
8313
- const server = new import_mcp.McpServer(OPEN_MCP_SERVER_INFO, {
8324
+ const server = new import_server5.McpServer(OPEN_MCP_SERVER_INFO, {
8314
8325
  capabilities: {
8315
8326
  // The SDK has no `extensions` field; MCP App hosts discover the UI
8316
8327
  // extension through `experimental`.
@@ -8322,7 +8333,7 @@ async function buildSessionServer(options) {
8322
8333
  tool.toolName,
8323
8334
  {
8324
8335
  description: tool.description,
8325
- inputSchema: tool.schema,
8336
+ inputSchema: toStandardSchema(tool.schema),
8326
8337
  annotations: {
8327
8338
  readOnlyHint: tool.annotations.readOnlyHint,
8328
8339
  destructiveHint: tool.annotations.destructiveHint
@@ -8359,18 +8370,23 @@ async function buildSessionServer(options) {
8359
8370
  }
8360
8371
  );
8361
8372
  }
8362
- const transport = new import_streamableHttp.StreamableHTTPServerTransport({
8373
+ return { server, tools: catalog };
8374
+ }
8375
+ async function buildSessionServer(options) {
8376
+ const { server, tools } = await createSessionServer(options);
8377
+ const transport = new import_node.NodeStreamableHTTPServerTransport({
8363
8378
  sessionIdGenerator: void 0,
8364
8379
  enableJsonResponse: true
8365
8380
  });
8366
- return { server, transport, tools: catalog };
8381
+ return { server, transport, tools };
8367
8382
  }
8368
- var import_mcp, import_streamableHttp, OPEN_MCP_SERVER_INFO;
8383
+ var import_node, import_server5, import_zod22, OPEN_MCP_SERVER_INFO;
8369
8384
  var init_openMcpServer = __esm({
8370
8385
  "src/services/open/openMcpServer.ts"() {
8371
8386
  "use strict";
8372
- import_mcp = require("@modelcontextprotocol/sdk/server/mcp.js");
8373
- import_streamableHttp = require("@modelcontextprotocol/sdk/server/streamableHttp.js");
8387
+ import_node = require("@modelcontextprotocol/node");
8388
+ import_server5 = require("@modelcontextprotocol/server");
8389
+ import_zod22 = require("zod");
8374
8390
  OPEN_MCP_SERVER_INFO = {
8375
8391
  name: "axiom-open",
8376
8392
  version: "0.1.0"
@@ -8380,7 +8396,7 @@ var init_openMcpServer = __esm({
8380
8396
 
8381
8397
  // src/services/open/pluginExposeAdapter.ts
8382
8398
  function schemaOf(tool) {
8383
- return tool.lc_kwargs?.schema ?? tool.schema ?? import_zod22.z.object({}).passthrough();
8399
+ return tool.lc_kwargs?.schema ?? tool.schema ?? import_zod23.z.object({}).passthrough();
8384
8400
  }
8385
8401
  function isRecord16(value) {
8386
8402
  return typeof value === "object" && value !== null && !Array.isArray(value);
@@ -8482,11 +8498,11 @@ function createPluginProvider(domain, tools, options = {}) {
8482
8498
  }
8483
8499
  };
8484
8500
  }
8485
- var import_zod22;
8501
+ var import_zod23;
8486
8502
  var init_pluginExposeAdapter = __esm({
8487
8503
  "src/services/open/pluginExposeAdapter.ts"() {
8488
8504
  "use strict";
8489
- import_zod22 = require("zod");
8505
+ import_zod23 = require("zod");
8490
8506
  init_openLattice();
8491
8507
  }
8492
8508
  });
@@ -8830,7 +8846,7 @@ function registerOpenRoutes(app2, deps = {}) {
8830
8846
  reply.header(import_protocols45.REPLICA_HEADER, replica);
8831
8847
  reply.raw.setHeader(import_protocols45.REPLICA_HEADER, replica);
8832
8848
  };
8833
- const buildServerFor = async (context, log2) => {
8849
+ const buildSessionOptions = async (context, log2) => {
8834
8850
  const grants = grantsSource(context);
8835
8851
  const catalog = await openLattice.catalogFor(grants, { tenantId: context.tenantId });
8836
8852
  const globalToolNames = new Set(catalog.map((t2) => t2.toolName));
@@ -8856,7 +8872,7 @@ function registerOpenRoutes(app2, deps = {}) {
8856
8872
  ...collectExposedPluginUiResources(grants),
8857
8873
  ...tenant2.uiResources
8858
8874
  ]);
8859
- const built = await buildSessionServer({
8875
+ return {
8860
8876
  credential: { credentialId: context.credentialId, kind: context.kind },
8861
8877
  grants,
8862
8878
  catalog: mergedCatalog,
@@ -8963,8 +8979,7 @@ function registerOpenRoutes(app2, deps = {}) {
8963
8979
  );
8964
8980
  }
8965
8981
  }
8966
- });
8967
- return built;
8982
+ };
8968
8983
  };
8969
8984
  const handleOpenMcpPost = async (request, reply) => {
8970
8985
  markReplica(reply);
@@ -8972,15 +8987,42 @@ function registerOpenRoutes(app2, deps = {}) {
8972
8987
  if (!context) {
8973
8988
  return reply.status(401).send({ error: "AUTH_FAILED" });
8974
8989
  }
8975
- const built = await buildServerFor(context, request.log);
8976
- await built.server.connect(built.transport);
8990
+ const modern = (0, import_server6.createMcpHandler)(
8991
+ async () => (await createSessionServer(
8992
+ await buildSessionOptions(context, request.log)
8993
+ )).server,
8994
+ {
8995
+ legacy: "reject",
8996
+ onerror: (error) => {
8997
+ request.log.warn({ err: error }, "open mcp: handler error");
8998
+ }
8999
+ }
9000
+ );
9001
+ const nodeHandler = (0, import_node2.toNodeHandler)(modern, {
9002
+ onerror: (error) => {
9003
+ request.log.warn({ err: error }, "open mcp: transport error");
9004
+ }
9005
+ });
8977
9006
  reply.hijack();
9007
+ const webRequest = await (0, import_node2.toWebRequest)(request.raw, request.body);
9008
+ if (await (0, import_server6.isLegacyRequest)(webRequest, request.body)) {
9009
+ const built = await buildSessionServer(
9010
+ await buildSessionOptions(context, request.log)
9011
+ );
9012
+ await built.server.connect(built.transport);
9013
+ const close2 = () => {
9014
+ void built.transport.close().catch(() => void 0);
9015
+ void built.server.close().catch(() => void 0);
9016
+ };
9017
+ reply.raw.once("close", close2);
9018
+ await built.transport.handleRequest(request.raw, reply.raw, request.body);
9019
+ return;
9020
+ }
8978
9021
  const close = () => {
8979
- void built.transport.close().catch(() => void 0);
8980
- void built.server.close().catch(() => void 0);
9022
+ void modern.close().catch(() => void 0);
8981
9023
  };
8982
9024
  reply.raw.once("close", close);
8983
- await built.transport.handleRequest(request.raw, reply.raw, request.body);
9025
+ await nodeHandler(request.raw, reply.raw, request.body);
8984
9026
  };
8985
9027
  const methodNotAllowed = async (_request, reply) => {
8986
9028
  reply.header("Allow", "POST");
@@ -8997,7 +9039,7 @@ function registerOpenRoutes(app2, deps = {}) {
8997
9039
  app2.delete("/mcp", methodNotAllowed);
8998
9040
  app2.delete("/mcp/", methodNotAllowed);
8999
9041
  }
9000
- var import_core113, import_protocols45, RPC_ERROR;
9042
+ var import_core113, import_protocols45, import_server6, import_node2, RPC_ERROR;
9001
9043
  var init_open = __esm({
9002
9044
  "src/routes/open.ts"() {
9003
9045
  "use strict";
@@ -9007,6 +9049,8 @@ var init_open = __esm({
9007
9049
  init_openAuditService();
9008
9050
  init_openRateLimiter();
9009
9051
  init_openLattice();
9052
+ import_server6 = require("@modelcontextprotocol/server");
9053
+ import_node2 = require("@modelcontextprotocol/node");
9010
9054
  init_openMcpServer();
9011
9055
  init_registerExposedPlugins();
9012
9056
  init_tenantOpenPlugins();
@@ -9231,21 +9275,21 @@ function createOpenSandboxProvider() {
9231
9275
  name: "files_read",
9232
9276
  label: "Read files",
9233
9277
  description: "Read a file from the project sandbox.",
9234
- schema: { path: import_zod23.z.string().min(1) },
9278
+ schema: { path: import_zod24.z.string().min(1) },
9235
9279
  annotations: { readOnlyHint: true, destructiveHint: false }
9236
9280
  },
9237
9281
  {
9238
9282
  name: "files_list",
9239
9283
  label: "List files",
9240
9284
  description: "List files under a directory in the project sandbox.",
9241
- schema: { path: import_zod23.z.string(), recursive: import_zod23.z.boolean().optional() },
9285
+ schema: { path: import_zod24.z.string(), recursive: import_zod24.z.boolean().optional() },
9242
9286
  annotations: { readOnlyHint: true, destructiveHint: false }
9243
9287
  },
9244
9288
  {
9245
9289
  name: "files_write",
9246
9290
  label: "Write files",
9247
9291
  description: "Write content to a file in the project sandbox.",
9248
- schema: { path: import_zod23.z.string().min(1), content: import_zod23.z.string() },
9292
+ schema: { path: import_zod24.z.string().min(1), content: import_zod24.z.string() },
9249
9293
  annotations: { readOnlyHint: false, destructiveHint: true }
9250
9294
  },
9251
9295
  {
@@ -9253,9 +9297,9 @@ function createOpenSandboxProvider() {
9253
9297
  label: "Run shell commands",
9254
9298
  description: "Execute a shell command in the project sandbox. Returns stdout (up to 64KB) and exit code.",
9255
9299
  schema: {
9256
- command: import_zod23.z.string().min(1),
9257
- exec_dir: import_zod23.z.string().optional(),
9258
- timeout: import_zod23.z.number().int().min(1e3).optional()
9300
+ command: import_zod24.z.string().min(1),
9301
+ exec_dir: import_zod24.z.string().optional(),
9302
+ timeout: import_zod24.z.number().int().min(1e3).optional()
9259
9303
  },
9260
9304
  annotations: { readOnlyHint: false, destructiveHint: true }
9261
9305
  }
@@ -9310,11 +9354,11 @@ ${truncated}`
9310
9354
  }
9311
9355
  };
9312
9356
  }
9313
- var import_zod23, import_core117, MAX_OUTPUT_BYTES;
9357
+ var import_zod24, import_core117, MAX_OUTPUT_BYTES;
9314
9358
  var init_sandboxProvider = __esm({
9315
9359
  "src/services/open/providers/sandboxProvider.ts"() {
9316
9360
  "use strict";
9317
- import_zod23 = require("zod");
9361
+ import_zod24 = require("zod");
9318
9362
  import_core117 = require("@axiom-lattice/core");
9319
9363
  MAX_OUTPUT_BYTES = 64e3;
9320
9364
  }
@@ -9623,9 +9667,9 @@ function createKbProvider(collectionService3) {
9623
9667
  label: "Search collections",
9624
9668
  description: "Search a knowledge base collection. Returns matched entries with content, metadata and similarity score.",
9625
9669
  schema: {
9626
- collection: import_zod24.z.string().min(1),
9627
- query: import_zod24.z.string().min(1),
9628
- limit: import_zod24.z.number().int().min(1).max(50).optional()
9670
+ collection: import_zod25.z.string().min(1),
9671
+ query: import_zod25.z.string().min(1),
9672
+ limit: import_zod25.z.number().int().min(1).max(50).optional()
9629
9673
  },
9630
9674
  annotations: { readOnlyHint: true, destructiveHint: false }
9631
9675
  }
@@ -9653,11 +9697,11 @@ function createKbProvider(collectionService3) {
9653
9697
  }
9654
9698
  };
9655
9699
  }
9656
- var import_zod24;
9700
+ var import_zod25;
9657
9701
  var init_kbProvider = __esm({
9658
9702
  "src/services/open/providers/kbProvider.ts"() {
9659
9703
  "use strict";
9660
- import_zod24 = require("zod");
9704
+ import_zod25 = require("zod");
9661
9705
  }
9662
9706
  });
9663
9707
 
@@ -9695,7 +9739,7 @@ function createAgentProvider(deps = {}) {
9695
9739
  toolName: `invoke_${assistantId}`,
9696
9740
  label: name,
9697
9741
  description: `Invoke the "${name}" agent${description ? ` \u2014 ${description}` : ""}. Returns its final reply.`,
9698
- schema: { message: import_zod25.z.string().min(1) },
9742
+ schema: { message: import_zod26.z.string().min(1) },
9699
9743
  annotations: { readOnlyHint: false, destructiveHint: false }
9700
9744
  };
9701
9745
  })
@@ -9743,11 +9787,11 @@ function createAgentProvider(deps = {}) {
9743
9787
  }
9744
9788
  };
9745
9789
  }
9746
- var import_zod25, import_core121, import_protocols47, STOP_TYPES;
9790
+ var import_zod26, import_core121, import_protocols47, STOP_TYPES;
9747
9791
  var init_agentProvider = __esm({
9748
9792
  "src/services/open/providers/agentProvider.ts"() {
9749
9793
  "use strict";
9750
- import_zod25 = require("zod");
9794
+ import_zod26 = require("zod");
9751
9795
  import_core121 = require("@axiom-lattice/core");
9752
9796
  import_protocols47 = require("@axiom-lattice/protocols");
9753
9797
  STOP_TYPES = [import_protocols47.MessageChunkTypes.MESSAGE_COMPLETED];
@@ -14407,7 +14451,10 @@ function createRunLifecycleHandlers(deps = {}) {
14407
14451
  const tenantId = getTenantId4(request);
14408
14452
  const { assistantId, threadId } = request.params;
14409
14453
  if (!await ownsThread(tenantId, assistantId, threadId)) {
14410
- return notFound2(reply, THREAD_NOT_FOUND2, "Thread not found");
14454
+ if (!await isNewThread(tenantId, threadId)) {
14455
+ return notFound2(reply, THREAD_NOT_FOUND2, "Thread not found");
14456
+ }
14457
+ return reply.status(200).send({ success: true, data: { runs: [] } });
14411
14458
  }
14412
14459
  const activeOnly = request.query.active === "true" || request.query.active === "1";
14413
14460
  const source = request.query.source;
@@ -23447,11 +23494,11 @@ var createBody = import_zod2.z.object({
23447
23494
  key: import_zod2.z.string().min(1),
23448
23495
  name: import_zod2.z.string().min(1),
23449
23496
  description: import_zod2.z.string().optional(),
23450
- config: import_zod2.z.record(import_zod2.z.unknown())
23497
+ config: import_zod2.z.record(import_zod2.z.string(), import_zod2.z.unknown())
23451
23498
  });
23452
23499
  var testOrDiscoverBody = import_zod2.z.object({
23453
23500
  key: import_zod2.z.string().optional(),
23454
- config: import_zod2.z.record(import_zod2.z.unknown()).optional()
23501
+ config: import_zod2.z.record(import_zod2.z.string(), import_zod2.z.unknown()).optional()
23455
23502
  });
23456
23503
  function getTenant(request) {
23457
23504
  const userTenantId = request.user?.tenantId;
@@ -23548,7 +23595,7 @@ function connectionRoutes(fastify2) {
23548
23595
  return reply.status(400).send(err);
23549
23596
  }
23550
23597
  if (err instanceof import_zod2.z.ZodError) {
23551
- return reply.status(400).send({ error: err.errors });
23598
+ return reply.status(400).send({ error: err.issues });
23552
23599
  }
23553
23600
  return reply.status(500).send({
23554
23601
  ok: false,
@@ -23576,7 +23623,7 @@ function connectionRoutes(fastify2) {
23576
23623
  return reply.status(400).send(err);
23577
23624
  }
23578
23625
  if (err instanceof import_zod2.z.ZodError) {
23579
- return reply.status(400).send({ error: err.errors });
23626
+ return reply.status(400).send({ error: err.issues });
23580
23627
  }
23581
23628
  return reply.status(500).send({
23582
23629
  error: err instanceof Error ? err.message : String(err)
@@ -23868,13 +23915,17 @@ async function testMcpServerConnection(request, reply) {
23868
23915
  try {
23869
23916
  const testKey = `__test_${key}_${Date.now()}`;
23870
23917
  const connection = (0, import_core49.convertToConnection)(config.config);
23871
- const { latency } = await import_core49.McpLatticeManager.testConnection(testKey, connection);
23918
+ const { latency, protocolVersion } = await import_core49.McpLatticeManager.testConnection(
23919
+ testKey,
23920
+ connection
23921
+ );
23872
23922
  return {
23873
23923
  success: true,
23874
23924
  message: "Connection test successful",
23875
23925
  data: {
23876
23926
  connected: true,
23877
- latency
23927
+ latency,
23928
+ ...protocolVersion ? { protocolVersion } : {}
23878
23929
  }
23879
23930
  };
23880
23931
  } catch (error) {
@@ -31535,7 +31586,7 @@ var createSchema = import_zod9.z.object({ name: import_zod9.z.string(), descript
31535
31586
  var updateSchema = createSchema.partial().extend({ expectedUpdatedAt: import_zod9.z.string().optional() });
31536
31587
  var bundleIdSchema = import_zod9.z.string().uuid();
31537
31588
  var bundleParamsSchema = import_zod9.z.object({ bundleId: bundleIdSchema });
31538
- var projectSchema = import_zod9.z.object({ bundleIds: import_zod9.z.array(bundleIdSchema), expectedRevisions: import_zod9.z.record(import_zod9.z.string()).optional() }).strict();
31589
+ var projectSchema = import_zod9.z.object({ bundleIds: import_zod9.z.array(bundleIdSchema), expectedRevisions: import_zod9.z.record(import_zod9.z.string(), import_zod9.z.string()).optional() }).strict();
31539
31590
  function tenant(request, authRequired2) {
31540
31591
  const authenticated = request.user?.tenantId;
31541
31592
  const header2 = request.headers["x-tenant-id"];