@axiom-lattice/gateway 4.3.2 → 4.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -22937,7 +22937,7 @@ var start = async (config) => {
22937
22937
  const { createKbProvider } = await import("./kbProvider-2D6DZ34N.mjs");
22938
22938
  const { createOpenSandboxProvider } = await import("./sandboxProvider-I3P66VXT.mjs");
22939
22939
  const { createAgentProvider } = await import("./agentProvider-X4FVQPKW.mjs");
22940
- const { registerExposedPluginTools } = await import("./registerExposedPlugins-63EUF4VS.mjs");
22940
+ const { registerExposedPluginTools } = await import("./registerExposedPlugins-ZBOEHJYH.mjs");
22941
22941
  const { CollectionService: CollectionService2 } = await import("./collection_service-RTRJEQFL.mjs");
22942
22942
  openLattice.register(createKbProvider(new CollectionService2()));
22943
22943
  openLattice.register(createOpenSandboxProvider());
@@ -42,6 +42,8 @@ function createPluginProvider(domain, tools, options = {}) {
42
42
  configurable: {
43
43
  runConfig: {
44
44
  tenantId: ctx.tenantId,
45
+ workspaceId: ctx.workspaceId,
46
+ projectId: ctx.projectId,
45
47
  _resolvedConnections: ctx.runConfig._resolvedConnections ?? []
46
48
  }
47
49
  }
@@ -96,4 +98,4 @@ async function registerExposedPluginTools() {
96
98
  export {
97
99
  registerExposedPluginTools
98
100
  };
99
- //# sourceMappingURL=registerExposedPlugins-63EUF4VS.mjs.map
101
+ //# sourceMappingURL=registerExposedPlugins-ZBOEHJYH.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/services/open/registerExposedPlugins.ts","../src/services/open/pluginExposeAdapter.ts"],"sourcesContent":["import { PluginRegistry } from \"@axiom-lattice/core\";\nimport { openLattice } from \"./openLattice\";\nimport { createPluginProvider } from \"./pluginExposeAdapter\";\n\n/** Walk PluginRegistry and register every exposed tool as an Open provider. */\nexport async function registerExposedPluginTools(): Promise<void> {\n for (const key of PluginRegistry.list()) {\n const plugin = PluginRegistry.get(key);\n if (!plugin?.middleware) continue;\n // Declaration source: meta.openExpose (preferred, standalone) or\n // meta.tools[].expose (per-tool flags).\n const openExpose = plugin.meta.openExpose;\n const exposed = openExpose\n ? openExpose.map((entry) =>\n typeof entry === \"string\"\n ? { name: entry, description: \"\", expose: true }\n : {\n name: entry.name,\n description: \"\",\n expose: true,\n readOnly: entry.readOnly,\n destructive: entry.destructive,\n },\n )\n : (plugin.meta.tools?.filter((t) => t.expose) ?? []);\n if (exposed.length === 0) continue;\n try {\n // Open-door semantics: resolve the tenant's connections at call time\n // (credential → tenant → tenant's own Connection Store entries).\n const middleware = await plugin.middleware({\n ...(plugin.meta.defaultConfig ?? {}),\n connectAll: true,\n });\n const toolObjects = (middleware as { tools?: Array<{ name: string; description: string; invoke: (input: unknown, config?: unknown) => Promise<string> }> }).tools ?? [];\n const matched = exposed\n .map((tm) => {\n const tool = toolObjects.find((t: { name: string }) => t.name === tm.name);\n if (!tool) return null;\n const annotations = tm as { readOnly?: boolean; destructive?: boolean };\n return {\n name: tm.name,\n description: tm.description,\n tool,\n readOnly: annotations.readOnly,\n destructive: annotations.destructive,\n };\n })\n .filter(Boolean) as Array<{\n name: string;\n description?: string;\n tool: { name: string; description: string; invoke: (input: unknown, config?: unknown) => Promise<string> };\n readOnly?: boolean;\n destructive?: boolean;\n }>;\n if (matched.length === 0) continue;\n const provider = createPluginProvider(key, matched, { label: plugin.meta.name });\n openLattice.register(provider);\n } catch {\n // skip plugins whose middleware fails to instantiate\n }\n }\n}","/**\n * Plugin expose adapter: converts a plugin's middleware-emitted tools into an\n * OpenProvider, so `expose: true` tools surface on the Open API catalog.\n *\n * The LangChain tool emits schema via .lc_kwargs.schema (ZodType) and runs via\n * .invoke(input, exeConfig). We synthesize the exeConfig the way the Agent\n * path would — injecting tenantId + _resolvedConnections into runConfig.\n */\n\nimport { z } from \"zod\";\nimport type { OpenExecutionContext, OpenGrant } from \"@axiom-lattice/protocols\";\nimport type { OpenProviderDeclaration, OpenActionDeclaration } from \"./openLattice\";\n\nexport interface PluginToolLike {\n name: string;\n description: string;\n invoke: (input: unknown, exeConfig?: unknown) => Promise<string>;\n lc_kwargs?: { schema?: z.ZodTypeAny };\n schema?: z.ZodTypeAny;\n}\n\nfunction schemaOf(tool: PluginToolLike): z.ZodTypeAny {\n return tool.lc_kwargs?.schema ?? tool.schema ?? z.object({}).passthrough();\n}\n\n/** Build an Open provider exposing the given plugin tools under a domain. */\nexport interface PluginExposedTool {\n name: string;\n description?: string;\n tool: PluginToolLike;\n /** MCP readOnlyHint (default false — conservative). */\n readOnly?: boolean;\n /** MCP destructiveHint (default false). */\n destructive?: boolean;\n}\n\nexport function createPluginProvider(\n domain: string,\n tools: PluginExposedTool[],\n options: { label?: string } = {},\n): OpenProviderDeclaration {\n function toAction(info: PluginExposedTool): OpenActionDeclaration {\n return {\n name: info.name,\n description:\n info.description || info.tool.description || `Plugin tool ${info.name}`,\n schema: schemaOf(info.tool),\n annotations: {\n readOnlyHint: info.readOnly ?? false,\n destructiveHint: info.destructive ?? false,\n },\n };\n }\n\n const actions = tools.map(toAction);\n return {\n domain,\n label: options.label ?? domain,\n source: \"plugin\",\n scopeKind: \"tenant\",\n actions,\n execute: async (action: string, args: unknown, ctx: OpenExecutionContext) => {\n const info = tools.find((t) => t.name === action);\n if (!info) {\n return {\n content: [{ type: \"text\", text: `Unknown action: ${action}` }],\n isError: true,\n };\n }\n const exeConfig = {\n configurable: {\n runConfig: {\n tenantId: ctx.tenantId,\n _resolvedConnections: ctx.runConfig._resolvedConnections ?? [],\n },\n },\n };\n const output = await info.tool.invoke(args, exeConfig);\n return { content: [{ type: \"text\", text: output }] };\n },\n };\n}"],"mappings":";;;;;;AAAA,SAAS,sBAAsB;;;ACS/B,SAAS,SAAS;AAYlB,SAAS,SAAS,MAAoC;AACpD,SAAO,KAAK,WAAW,UAAU,KAAK,UAAU,EAAE,OAAO,CAAC,CAAC,EAAE,YAAY;AAC3E;AAaO,SAAS,qBACd,QACA,OACA,UAA8B,CAA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AO,aAAa,IAAI,QAAQ,KAAK,IAC7C;AAAA,QACE,MAAM,MAAM;AAAA,QACZ,aAAa;AAAA,QACb,QAAQ;AAAA,QACR,UAAU,MAAM;AAAA,QAChB,aAAa,MAAM;AAAA,MACrB;AAAA,IACN,IACC,OAAO,KAAK,OAAO,OAAO,CAAC,MAAM,EAAE,MAAM,KAAK,CAAC;AACpD,QAAI,QAAQ,WAAW,EAAG;AAC1B,QAAI;AAGF,YAAM,aAAa,MAAM,OAAO,WAAW;AAAA,QACzC,GAAI,OAAO,KAAK,iBAAiB,CAAC;AAAA,QAClC,YAAY;AAAA,MACd,CAAC;AACD,YAAM,cAAe,WAAuI,SAAS,CAAC;AACtK,YAAM,UAAU,QACb,IAAI,CAAC,OAAO;AACX,cAAM,OAAO,YAAY,KAAK,CAAC,MAAwB,EAAE,SAAS,GAAG,IAAI;AACzE,YAAI,CAAC,KAAM,QAAO;AAClB,cAAM,cAAc;AACpB,eAAO;AAAA,UACL,MAAM,GAAG;AAAA,UACT,aAAa,GAAG;AAAA,UAChB;AAAA,UACA,UAAU,YAAY;AAAA,UACtB,aAAa,YAAY;AAAA,QAC3B;AAAA,MACF,CAAC,EACA,OAAO,OAAO;AAOjB,UAAI,QAAQ,WAAW,EAAG;AAC1B,YAAM,WAAW,qBAAqB,KAAK,SAAS,EAAE,OAAO,OAAO,KAAK,KAAK,CAAC;AAC/E,kBAAY,SAAS,QAAQ;AAAA,IAC/B,QAAQ;AAAA,IAER;AAAA,EACF;AACF;","names":[]}
1
+ {"version":3,"sources":["../src/services/open/registerExposedPlugins.ts","../src/services/open/pluginExposeAdapter.ts"],"sourcesContent":["import { PluginRegistry } from \"@axiom-lattice/core\";\nimport { openLattice } from \"./openLattice\";\nimport { createPluginProvider } from \"./pluginExposeAdapter\";\n\n/** Walk PluginRegistry and register every exposed tool as an Open provider. */\nexport async function registerExposedPluginTools(): Promise<void> {\n for (const key of PluginRegistry.list()) {\n const plugin = PluginRegistry.get(key);\n if (!plugin?.middleware) continue;\n // Declaration source: meta.openExpose (preferred, standalone) or\n // meta.tools[].expose (per-tool flags).\n const openExpose = plugin.meta.openExpose;\n const exposed = openExpose\n ? openExpose.map((entry) =>\n typeof entry === \"string\"\n ? { name: entry, description: \"\", expose: true }\n : {\n name: entry.name,\n description: \"\",\n expose: true,\n readOnly: entry.readOnly,\n destructive: entry.destructive,\n },\n )\n : (plugin.meta.tools?.filter((t) => t.expose) ?? []);\n if (exposed.length === 0) continue;\n try {\n // Open-door semantics: resolve the tenant's connections at call time\n // (credential → tenant → tenant's own Connection Store entries).\n const middleware = await plugin.middleware({\n ...(plugin.meta.defaultConfig ?? {}),\n connectAll: true,\n });\n const toolObjects = (middleware as { tools?: Array<{ name: string; description: string; invoke: (input: unknown, config?: unknown) => Promise<string> }> }).tools ?? [];\n const matched = exposed\n .map((tm) => {\n const tool = toolObjects.find((t: { name: string }) => t.name === tm.name);\n if (!tool) return null;\n const annotations = tm as { readOnly?: boolean; destructive?: boolean };\n return {\n name: tm.name,\n description: tm.description,\n tool,\n readOnly: annotations.readOnly,\n destructive: annotations.destructive,\n };\n })\n .filter(Boolean) as Array<{\n name: string;\n description?: string;\n tool: { name: string; description: string; invoke: (input: unknown, config?: unknown) => Promise<string> };\n readOnly?: boolean;\n destructive?: boolean;\n }>;\n if (matched.length === 0) continue;\n const provider = createPluginProvider(key, matched, { label: plugin.meta.name });\n openLattice.register(provider);\n } catch {\n // skip plugins whose middleware fails to instantiate\n }\n }\n}","/**\n * Plugin expose adapter: converts a plugin's middleware-emitted tools into an\n * OpenProvider, so `expose: true` tools surface on the Open API catalog.\n *\n * The LangChain tool emits schema via .lc_kwargs.schema (ZodType) and runs via\n * .invoke(input, exeConfig). We synthesize the exeConfig the way the Agent\n * path would — injecting tenantId + _resolvedConnections into runConfig.\n */\n\nimport { z } from \"zod\";\nimport type { OpenExecutionContext, OpenGrant } from \"@axiom-lattice/protocols\";\nimport type { OpenProviderDeclaration, OpenActionDeclaration } from \"./openLattice\";\n\nexport interface PluginToolLike {\n name: string;\n description: string;\n invoke: (input: unknown, exeConfig?: unknown) => Promise<string>;\n lc_kwargs?: { schema?: z.ZodTypeAny };\n schema?: z.ZodTypeAny;\n}\n\nfunction schemaOf(tool: PluginToolLike): z.ZodTypeAny {\n return tool.lc_kwargs?.schema ?? tool.schema ?? z.object({}).passthrough();\n}\n\n/** Build an Open provider exposing the given plugin tools under a domain. */\nexport interface PluginExposedTool {\n name: string;\n description?: string;\n tool: PluginToolLike;\n /** MCP readOnlyHint (default false — conservative). */\n readOnly?: boolean;\n /** MCP destructiveHint (default false). */\n destructive?: boolean;\n}\n\nexport function createPluginProvider(\n domain: string,\n tools: PluginExposedTool[],\n options: { label?: string } = {},\n): OpenProviderDeclaration {\n function toAction(info: PluginExposedTool): OpenActionDeclaration {\n return {\n name: info.name,\n description:\n info.description || info.tool.description || `Plugin tool ${info.name}`,\n schema: schemaOf(info.tool),\n annotations: {\n readOnlyHint: info.readOnly ?? false,\n destructiveHint: info.destructive ?? false,\n },\n };\n }\n\n const actions = tools.map(toAction);\n return {\n domain,\n label: options.label ?? domain,\n source: \"plugin\",\n scopeKind: \"tenant\",\n actions,\n execute: async (action: string, args: unknown, ctx: OpenExecutionContext) => {\n const info = tools.find((t) => t.name === action);\n if (!info) {\n return {\n content: [{ type: \"text\", text: `Unknown action: ${action}` }],\n isError: true,\n };\n }\n const exeConfig = {\n configurable: {\n runConfig: {\n tenantId: ctx.tenantId,\n workspaceId: ctx.workspaceId,\n projectId: ctx.projectId,\n _resolvedConnections: ctx.runConfig._resolvedConnections ?? [],\n },\n },\n };\n const output = await info.tool.invoke(args, exeConfig);\n return { content: [{ type: \"text\", text: output }] };\n },\n };\n}"],"mappings":";;;;;;AAAA,SAAS,sBAAsB;;;ACS/B,SAAS,SAAS;AAYlB,SAAS,SAAS,MAAoC;AACpD,SAAO,KAAK,WAAW,UAAU,KAAK,UAAU,EAAE,OAAO,CAAC,CAAC,EAAE,YAAY;AAC3E;AAaO,SAAS,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,UAAU,aACZ,WAAW;AAAA,MAAI,CAAC,UACd,OAAO,UAAU,WACb,EAAE,MAAM,OAAO,aAAa,IAAI,QAAQ,KAAK,IAC7C;AAAA,QACE,MAAM,MAAM;AAAA,QACZ,aAAa;AAAA,QACb,QAAQ;AAAA,QACR,UAAU,MAAM;AAAA,QAChB,aAAa,MAAM;AAAA,MACrB;AAAA,IACN,IACC,OAAO,KAAK,OAAO,OAAO,CAAC,MAAM,EAAE,MAAM,KAAK,CAAC;AACpD,QAAI,QAAQ,WAAW,EAAG;AAC1B,QAAI;AAGF,YAAM,aAAa,MAAM,OAAO,WAAW;AAAA,QACzC,GAAI,OAAO,KAAK,iBAAiB,CAAC;AAAA,QAClC,YAAY;AAAA,MACd,CAAC;AACD,YAAM,cAAe,WAAuI,SAAS,CAAC;AACtK,YAAM,UAAU,QACb,IAAI,CAAC,OAAO;AACX,cAAM,OAAO,YAAY,KAAK,CAAC,MAAwB,EAAE,SAAS,GAAG,IAAI;AACzE,YAAI,CAAC,KAAM,QAAO;AAClB,cAAM,cAAc;AACpB,eAAO;AAAA,UACL,MAAM,GAAG;AAAA,UACT,aAAa,GAAG;AAAA,UAChB;AAAA,UACA,UAAU,YAAY;AAAA,UACtB,aAAa,YAAY;AAAA,QAC3B;AAAA,MACF,CAAC,EACA,OAAO,OAAO;AAOjB,UAAI,QAAQ,WAAW,EAAG;AAC1B,YAAM,WAAW,qBAAqB,KAAK,SAAS,EAAE,OAAO,OAAO,KAAK,KAAK,CAAC;AAC/E,kBAAY,SAAS,QAAQ;AAAA,IAC/B,QAAQ;AAAA,IAER;AAAA,EACF;AACF;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@axiom-lattice/gateway",
3
- "version": "4.3.2",
3
+ "version": "4.3.3",
4
4
  "main": "dist/index.js",
5
5
  "files": [
6
6
  "dist"
@@ -48,11 +48,11 @@
48
48
  "uuid": "^9.0.1",
49
49
  "web-push": "^3.6.7",
50
50
  "zod": "3.25.76",
51
- "@axiom-lattice/cli-a2a": "0.2.11",
52
- "@axiom-lattice/core": "4.2.16",
53
- "@axiom-lattice/pg-stores": "3.1.16",
54
- "@axiom-lattice/protocols": "4.3.1",
55
- "@axiom-lattice/queue-redis": "1.1.11"
51
+ "@axiom-lattice/cli-a2a": "0.2.12",
52
+ "@axiom-lattice/core": "4.2.17",
53
+ "@axiom-lattice/pg-stores": "3.1.17",
54
+ "@axiom-lattice/protocols": "4.3.2",
55
+ "@axiom-lattice/queue-redis": "1.1.12"
56
56
  },
57
57
  "devDependencies": {
58
58
  "@types/bcrypt": "^6.0.0",
@@ -74,7 +74,7 @@
74
74
  "tsconfig-paths": "^4.2.0",
75
75
  "tsup": "^8.5.0",
76
76
  "typescript": "^5.8.2",
77
- "@axiom-lattice/react-sdk": "4.2.2"
77
+ "@axiom-lattice/react-sdk": "4.2.3"
78
78
  },
79
79
  "scripts": {
80
80
  "build": "tsup src/index.ts --format cjs,esm --dts --clean --sourcemap && pnpm copy:embed-assets",