@usecontextlayer/sdk 0.16.0 → 0.16.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.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 803 Inc.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/dist/local.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { i as DatabaseMigrations, o as SqlValue } from "./tools-BLXbCgQU-D3L2WEEd.js";
2
2
  import { z } from "zod";
3
3
  import { DurableObject, WorkerEntrypoint } from "cloudflare:workers";
4
- //#region ../shared/dist/slate-resources-zjMlTUWg.d.mts
4
+ //#region ../shared/dist/slate-resources-BxaOCJ_v.d.mts
5
5
  declare const localResourceConfigurationSchema: z.ZodObject<{
6
6
  connections: z.ZodRecord<z.ZodString, z.ZodObject<{
7
7
  mode: z.ZodEnum<{
@@ -1 +1 @@
1
- {"version":3,"file":"local.d.ts","names":[],"sources":["../../shared/dist/slate-resources-zjMlTUWg.d.mts","../../shared/dist/database-worker.d.mts","../../shared/dist/tools-worker.d.mts"],"mappings":";;;;cAiIc,kCAAkC,EAAE;EAChD,aAAa,EAAE,UAAU,EAAE,WAAW,EAAE;IACtC,MAAM,EAAE;MACN;MACA;;IAEF,SAAS,EAAE;IACX,WAAW,EAAE,SAAS,EAAE,uBAAuB,EAAE;MAC/C,MAAM,EAAE;OACP,EAAE,KAAK,UAAU,EAAE;MACpB,MAAM,EAAE;MACR,MAAM,EAAE;OACP,EAAE,KAAK;IACV,eAAe,EAAE,YAAY,EAAE;KAC9B,EAAE,KAAK;EACV,WAAW,EAAE,UAAU,EAAE,WAAW,EAAE;IACpC,MAAM,EAAE;MACN;MACA;;IAEF,WAAW,EAAE,SAAS,EAAE,uBAAuB,EAAE;MAC/C,MAAM,EAAE;OACP,EAAE,KAAK,UAAU,EAAE;MACpB,MAAM,EAAE;MACR,MAAM,EAAE;OACP,EAAE,KAAK;IACV,eAAe,EAAE;IACjB,YAAY,EAAE;MACZ,SAAS,EAAE;QACT,SAAS,EAAE,SAAS,EAAE;UACpB,aAAa,EAAE;UACf,KAAK,EAAE;UACP,KAAK,EAAE;UACP,MAAM,EAAE;WACP,EAAE,KAAK;SACT,EAAE,KAAK;MACV,YAAY,EAAE,UAAU,EAAE,WAAW,EAAE;OACtC,EAAE,KAAK;KACT,EAAE,KAAK;EACV,SAAS,EAAE,UAAU,EAAE,WAAW,EAAE;IAClC,MAAM,EAAE;MACN;MACA;;IAEF,WAAW,EAAE,SAAS,EAAE,uBAAuB,EAAE;MAC/C,MAAM,EAAE;OACP,EAAE,KAAK,UAAU,EAAE;MACpB,MAAM,EAAE;MACR,MAAM,EAAE;OACP,EAAE,KAAK;IACV,OAAO,EAAE,YAAY,EAAE;KACtB,EAAE,KAAK;GACT,EAAE,KAAK;KACL,6BAA6B,EAAE,aAAa;;;;qBClL5B,sBAAsB;EACzC,QAAQ,YAAY,qBAAqB;EACzC,MAAM,aAAa,SAAS,aAAa;IACvC;IACA;IACA;IACA;;;cAGiB,uBAAuB;EAC1C,kBAAkB,uBAAuB;;EAEzC,WAAW;;EAEX,MAAM,SAAS,UAAU,QAAQ;EACjC,MAAM,cAAc,aAAa,SAAS,aAAa;IACrD;IACA;IACA;IACA;MACE;;cAEe,kCAAkC;EACrD,kBAAkB,uBAAuB;;EAEzC,WAAW;;EAEX,SAAS,QAAQ;;;;;UCIF;EACf;EACA,aAAa;EACb;IACE;IACA;;;cAWiB,mBAAmB;EACtC;GACC;EACD,KAAK,cAAc,kBAAkB,MAAM,0BAA0B,QAAQ;IAC3E,MAAM;IACN"}
1
+ {"version":3,"file":"local.d.ts","names":[],"sources":["../../shared/dist/slate-resources-BxaOCJ_v.d.mts","../../shared/dist/database-worker.d.mts","../../shared/dist/tools-worker.d.mts"],"mappings":";;;;cAoIc,kCAAkC,EAAE;EAChD,aAAa,EAAE,UAAU,EAAE,WAAW,EAAE;IACtC,MAAM,EAAE;MACN;MACA;;IAEF,SAAS,EAAE;IACX,WAAW,EAAE,SAAS,EAAE,uBAAuB,EAAE;MAC/C,MAAM,EAAE;OACP,EAAE,KAAK,UAAU,EAAE;MACpB,MAAM,EAAE;MACR,MAAM,EAAE;OACP,EAAE,KAAK;IACV,eAAe,EAAE,YAAY,EAAE;KAC9B,EAAE,KAAK;EACV,WAAW,EAAE,UAAU,EAAE,WAAW,EAAE;IACpC,MAAM,EAAE;MACN;MACA;;IAEF,WAAW,EAAE,SAAS,EAAE,uBAAuB,EAAE;MAC/C,MAAM,EAAE;OACP,EAAE,KAAK,UAAU,EAAE;MACpB,MAAM,EAAE;MACR,MAAM,EAAE;OACP,EAAE,KAAK;IACV,eAAe,EAAE;IACjB,YAAY,EAAE;MACZ,SAAS,EAAE;QACT,SAAS,EAAE,SAAS,EAAE;UACpB,aAAa,EAAE;UACf,KAAK,EAAE;UACP,KAAK,EAAE;UACP,MAAM,EAAE;WACP,EAAE,KAAK;SACT,EAAE,KAAK;MACV,YAAY,EAAE,UAAU,EAAE,WAAW,EAAE;OACtC,EAAE,KAAK;KACT,EAAE,KAAK;EACV,SAAS,EAAE,UAAU,EAAE,WAAW,EAAE;IAClC,MAAM,EAAE;MACN;MACA;;IAEF,WAAW,EAAE,SAAS,EAAE,uBAAuB,EAAE;MAC/C,MAAM,EAAE;OACP,EAAE,KAAK,UAAU,EAAE;MACpB,MAAM,EAAE;MACR,MAAM,EAAE;OACP,EAAE,KAAK;IACV,OAAO,EAAE,YAAY,EAAE;KACtB,EAAE,KAAK;GACT,EAAE,KAAK;KACL,6BAA6B,EAAE,aAAa;;;;qBCrL5B,sBAAsB;EACzC,QAAQ,YAAY,qBAAqB;EACzC,MAAM,aAAa,SAAS,aAAa;IACvC;IACA;IACA;IACA;;;cAGiB,uBAAuB;EAC1C,kBAAkB,uBAAuB;;EAEzC,WAAW;;EAEX,MAAM,SAAS,UAAU,QAAQ;EACjC,MAAM,cAAc,aAAa,SAAS,aAAa;IACrD;IACA;IACA;IACA;MACE;;cAEe,kCAAkC;EACrD,kBAAkB,uBAAuB;;EAEzC,WAAW;;EAEX,SAAS,QAAQ;;;;;UCIF;EACf;EACA,aAAa;EACb;IACE;IACA;;;cAWiB,mBAAmB;EACtC;GACC;EACD,KAAK,cAAc,kBAAkB,MAAM,0BAA0B,QAAQ;IAC3E,MAAM;IACN"}
package/dist/vite.js CHANGED
@@ -142,24 +142,17 @@ async function contextlayer({ command }) {
142
142
  configPath: "workers/local-resources/wrangler.jsonc",
143
143
  devOnly: true
144
144
  }],
145
- config: {
146
- assets: { run_worker_first: [
147
- "/*",
148
- "!/mcp.json",
149
- "!/mcp-ui/*"
150
- ] },
151
- ...bindings ? { services: [...bindings.props ? [{
152
- binding: "TOOLS",
153
- entrypoint: "Tools",
154
- props: bindings.props,
155
- service: bindings.workerName
156
- }] : [], {
157
- binding: "DATABASES",
158
- entrypoint: "Databases",
159
- props: bindings.databaseProps,
160
- service: bindings.workerName
161
- }] } : {}
162
- },
145
+ config: { ...bindings ? { services: [...bindings.props ? [{
146
+ binding: "TOOLS",
147
+ entrypoint: "Tools",
148
+ props: bindings.props,
149
+ service: bindings.workerName
150
+ }] : [], {
151
+ binding: "DATABASES",
152
+ entrypoint: "Databases",
153
+ props: bindings.databaseProps,
154
+ service: bindings.workerName
155
+ }] } : {} },
163
156
  persistState: { path: ".contextlayer/databases" },
164
157
  viteEnvironment: { name: "ssr" }
165
158
  }),
package/dist/vite.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"vite.js","names":[],"sources":["../../shared/dist/declaration.mjs","../../shared/dist/mcp.mjs","../mcp-vite.ts","../vite.ts"],"sourcesContent":["import { z } from \"zod\";\n\n//#region lib/declaration.ts\nconst credentialModeSchema = z.enum([\"viewer\", \"owner\"]);\nconst connectionRequirementSchema = z.strictObject({\n\tmode: credentialModeSchema,\n\ttoolkit: z.string().min(1)\n});\nconst secretNameSchema = z.string().regex(/^[A-Z_][A-Z0-9_]*$/);\nconst secretRequirementSchema = z.strictObject({ mode: credentialModeSchema });\nconst databaseRequirementSchema = z.strictObject({ mode: credentialModeSchema });\nconst databaseSlugSchema = z.string().min(1).regex(/^(?!\\.{1,2}$)[^/\\\\]+$/);\nconst declarationSchema = z.strictObject({\n\tconnections: z.record(z.string().min(1), connectionRequirementSchema),\n\tdatabases: z.record(databaseSlugSchema, databaseRequirementSchema).default({}),\n\tsecrets: z.record(secretNameSchema, secretRequirementSchema).default({})\n});\nconst slateDeclarationsSchema = z.strictObject({\n\tagents: z.record(z.string().min(1), declarationSchema),\n\tapp: declarationSchema\n});\nconst resourceConsumerSchema = z.discriminatedUnion(\"type\", [z.strictObject({ type: z.literal(\"app\") }), z.strictObject({\n\tname: z.string().min(1),\n\ttype: z.literal(\"agent\")\n})]);\nconst resourcesSchema = declarationSchema.extend({\n\tconnections: z.record(z.string().min(1), connectionRequirementSchema.extend({ consumers: z.array(resourceConsumerSchema) })),\n\tdatabases: z.record(databaseSlugSchema, databaseRequirementSchema.extend({ consumers: z.array(resourceConsumerSchema) })),\n\tsecrets: z.record(secretNameSchema, secretRequirementSchema.extend({ consumers: z.array(resourceConsumerSchema) }))\n});\nfunction hasViewerResources(resources) {\n\treturn Object.values(resources).some((requirements) => Object.values(requirements).some(({ mode }) => mode === \"viewer\"));\n}\nfunction collectSlateResources(slateDeclarations) {\n\tconst declarations = [{\n\t\tconsumer: { type: \"app\" },\n\t\tdeclaration: slateDeclarations.app\n\t}, ...Object.entries(slateDeclarations.agents).map(([name, declaration]) => ({\n\t\tconsumer: {\n\t\t\tname,\n\t\t\ttype: \"agent\"\n\t\t},\n\t\tdeclaration\n\t}))];\n\treturn {\n\t\tconnections: collectRequirements(\"connections\", declarations, (declaration) => declaration.connections),\n\t\tdatabases: collectRequirements(\"databases\", declarations, (declaration) => declaration.databases),\n\t\tsecrets: collectRequirements(\"secrets\", declarations, (declaration) => declaration.secrets)\n\t};\n}\nfunction resourcesForConsumer(resources, consumer) {\n\treturn {\n\t\tconnections: filterRequirements(resources.connections, consumer),\n\t\tdatabases: filterRequirements(resources.databases, consumer),\n\t\tsecrets: filterRequirements(resources.secrets, consumer)\n\t};\n}\nfunction filterRequirements(requirements, consumer) {\n\treturn Object.fromEntries(Object.entries(requirements).filter(([, requirement]) => requirement.consumers.some((declared) => declared.type === consumer.type && (consumer.type === \"app\" || declared.type === \"agent\" && declared.name === consumer.name))));\n}\nfunction collectRequirements(category, declarations, select) {\n\tconst resources = /* @__PURE__ */ new Map();\n\tfor (const { consumer, declaration } of declarations) for (const [key, requirement] of Object.entries(select(declaration))) {\n\t\tconst existing = resources.get(key);\n\t\tif (!existing) {\n\t\t\tresources.set(key, {\n\t\t\t\t...requirement,\n\t\t\t\tconsumers: [consumer]\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tif (existing.mode !== requirement.mode || existing.toolkit !== requirement.toolkit) throw new z.ZodError([{\n\t\t\tcode: \"custom\",\n\t\t\tmessage: `Conflicting ${category} requirement \"${key}\": declarations must agree on mode${category === \"connections\" ? \" and toolkit\" : \"\"}`,\n\t\t\tpath: [\n\t\t\t\t...consumer.type === \"app\" ? [\"app\"] : [\"agents\", consumer.name],\n\t\t\t\tcategory,\n\t\t\t\tkey\n\t\t\t]\n\t\t}]);\n\t\texisting.consumers.push(consumer);\n\t}\n\treturn Object.fromEntries(resources);\n}\n\n//#endregion\nexport { collectSlateResources, connectionRequirementSchema, credentialModeSchema, databaseRequirementSchema, databaseSlugSchema, declarationSchema, hasViewerResources, resourceConsumerSchema, resourcesForConsumer, resourcesSchema, secretNameSchema, secretRequirementSchema, slateDeclarationsSchema };","import { declarationSchema } from \"./declaration.mjs\";\nimport { z } from \"zod\";\nimport { ResourceSchema, ToolSchema } from \"@modelcontextprotocol/core\";\n\n//#region lib/mcp.ts\nconst MCP_MANIFEST_PATH = \"/mcp.json\";\nconst mcpManifestSchema = z.object({\n\tresources: z.array(ResourceSchema.extend({ path: z.string() })),\n\ttools: z.array(ToolSchema.extend({ declaration: declarationSchema }))\n});\n\n//#endregion\nexport { MCP_MANIFEST_PATH, mcpManifestSchema };","import { glob, readFile } from \"node:fs/promises\"\nimport { dirname, join, relative } from \"node:path\"\nimport { RESOURCE_MIME_TYPE } from \"@modelcontextprotocol/ext-apps/server\"\nimport { declarationSchema } from \"@usecontextlayer/shared/declaration\"\nimport { MCP_MANIFEST_PATH, mcpManifestSchema } from \"@usecontextlayer/shared/mcp\"\nimport { build, createServer, createServerModuleRunner, type Plugin } from \"vite\"\nimport { viteSingleFile } from \"vite-plugin-singlefile\"\nimport { z } from \"zod\"\nimport type { McpToolModule } from \"@/worker\"\n\nexport function mcpApps(): Plugin {\n\tlet root: string\n\tlet compiled: ReturnType<typeof compile>\n\n\tasync function compile() {\n\t\tconst server = await createServer({\n\t\t\tappType: \"custom\",\n\t\t\tconfigFile: false,\n\t\t\tresolve: { tsconfigPaths: true },\n\t\t\troot,\n\t\t\tserver: { middlewareMode: true },\n\t\t})\n\t\tconst runner = createServerModuleRunner(server.environments.ssr)\n\t\ttry {\n\t\t\tconst tools = []\n\t\t\tfor await (const file of glob(\"mcp/*/index.ts\", { cwd: root })) {\n\t\t\t\tconst { tool } = await runner.import<McpToolModule>(join(root, file))\n\t\t\t\tconst declaration = declarationSchema.parse(\n\t\t\t\t\tJSON.parse(await readFile(join(root, dirname(file), \"slate.json\"), \"utf8\")),\n\t\t\t\t)\n\t\t\t\tif (\n\t\t\t\t\tObject.keys(declaration.connections).length ||\n\t\t\t\t\tObject.keys(declaration.databases).length ||\n\t\t\t\t\tObject.keys(declaration.secrets).length\n\t\t\t\t) {\n\t\t\t\t\tthrow new Error(`${file}: MCP resource consumers are not implemented yet`)\n\t\t\t\t}\n\t\t\t\ttools.push({\n\t\t\t\t\t...tool,\n\t\t\t\t\tdeclaration,\n\t\t\t\t\tinputSchema: z.toJSONSchema(tool.inputSchema),\n\t\t\t\t\toutputSchema: tool.outputSchema ? z.toJSONSchema(tool.outputSchema) : undefined,\n\t\t\t\t})\n\t\t\t}\n\t\t\tconst assets = []\n\t\t\tconst resources = []\n\t\t\tfor await (const file of glob(\"mcp-ui/*/index.html\", { cwd: root })) {\n\t\t\t\tconst name = relative(\"mcp-ui\", dirname(file))\n\t\t\t\tconst result = await build({\n\t\t\t\t\tbuild: { rolldownOptions: { input: join(root, file) }, write: false },\n\t\t\t\t\tconfigFile: false,\n\t\t\t\t\tplugins: [viteSingleFile()],\n\t\t\t\t\tpublicDir: false,\n\t\t\t\t\tresolve: { tsconfigPaths: true },\n\t\t\t\t\troot,\n\t\t\t\t})\n\t\t\t\tif (Array.isArray(result) || !(\"output\" in result)) {\n\t\t\t\t\tthrow new Error(\"MCP View build must produce one bundle\")\n\t\t\t\t}\n\t\t\t\tconst html = result.output.find(\n\t\t\t\t\t(asset) => asset.type === \"asset\" && asset.fileName.endsWith(\".html\"),\n\t\t\t\t)\n\t\t\t\tif (html?.type !== \"asset\") throw new Error(`${file}: missing built HTML`)\n\t\t\t\tconst path = `/mcp-ui/${name}`\n\t\t\t\tassets.push({\n\t\t\t\t\tfileName: `${path.slice(1)}.html`,\n\t\t\t\t\tsource: html.source,\n\t\t\t\t\ttype: \"asset\" as const,\n\t\t\t\t})\n\t\t\t\tresources.push({\n\t\t\t\t\tmimeType: RESOURCE_MIME_TYPE,\n\t\t\t\t\tname,\n\t\t\t\t\tpath,\n\t\t\t\t\turi: `ui://${name}/index.html`,\n\t\t\t\t})\n\t\t\t}\n\t\t\tconst manifest = mcpManifestSchema.parse({ resources, tools })\n\t\t\tassets.push({\n\t\t\t\tfileName: MCP_MANIFEST_PATH.slice(1),\n\t\t\t\tsource: JSON.stringify(manifest),\n\t\t\t\ttype: \"asset\" as const,\n\t\t\t})\n\t\t\treturn assets\n\t\t} finally {\n\t\t\tawait runner.close()\n\t\t\tawait server.close()\n\t\t}\n\t}\n\n\treturn {\n\t\tconfigResolved(config) {\n\t\t\troot = config.root\n\t\t},\n\t\tasync generateBundle() {\n\t\t\tif (this.environment.config.consumer !== \"client\") return\n\t\t\tcompiled ??= compile()\n\t\t\tfor (const asset of await compiled) this.emitFile(asset)\n\t\t},\n\t\tname: \"contextlayer-mcp-apps\",\n\t}\n}\n","import { cloudflare } from \"@cloudflare/vite-plugin\"\nimport {\n\tgetLocalResourcesBindings,\n\tlocalDatabaseProvisioning,\n} from \"@usecontextlayer/cli/vite\"\nimport type { ConfigEnv } from \"vite\"\nimport { mcpApps } from \"@/mcp-vite\"\n\nexport async function contextlayer({ command }: ConfigEnv) {\n\tconst bindings = command === \"serve\" ? await getLocalResourcesBindings() : undefined\n\treturn [\n\t\tmcpApps(),\n\t\tcloudflare({\n\t\t\tauxiliaryWorkers: [\n\t\t\t\t{\n\t\t\t\t\tconfig: bindings ? { name: bindings.workerName, vars: bindings.vars } : {},\n\t\t\t\t\tconfigPath: \"workers/local-resources/wrangler.jsonc\",\n\t\t\t\t\tdevOnly: true,\n\t\t\t\t},\n\t\t\t],\n\t\t\tconfig: {\n\t\t\t\tassets: { run_worker_first: [\"/*\", \"!/mcp.json\", \"!/mcp-ui/*\"] },\n\t\t\t\t...(bindings\n\t\t\t\t\t? {\n\t\t\t\t\t\t\tservices: [\n\t\t\t\t\t\t\t\t...(bindings.props\n\t\t\t\t\t\t\t\t\t? [\n\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\tbinding: \"TOOLS\",\n\t\t\t\t\t\t\t\t\t\t\t\tentrypoint: \"Tools\",\n\t\t\t\t\t\t\t\t\t\t\t\tprops: bindings.props,\n\t\t\t\t\t\t\t\t\t\t\t\tservice: bindings.workerName,\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t]\n\t\t\t\t\t\t\t\t\t: []),\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tbinding: \"DATABASES\",\n\t\t\t\t\t\t\t\t\tentrypoint: \"Databases\",\n\t\t\t\t\t\t\t\t\tprops: bindings.databaseProps,\n\t\t\t\t\t\t\t\t\tservice: bindings.workerName,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t],\n\t\t\t\t\t\t}\n\t\t\t\t\t: {}),\n\t\t\t},\n\t\t\tpersistState: { path: \".contextlayer/databases\" },\n\t\t\tviteEnvironment: { name: \"ssr\" },\n\t\t}),\n\t\tbindings ? localDatabaseProvisioning(bindings) : undefined,\n\t]\n}\n"],"mappings":";;;;;;;;;;AAGA,MAAM,uBAAuB,EAAE,KAAK,CAAC,UAAU,OAAO,CAAC;AACvD,MAAM,8BAA8B,EAAE,aAAa;CAClD,MAAM;CACN,SAAS,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC;AAC1B,CAAC;AACD,MAAM,mBAAmB,EAAE,OAAO,CAAC,CAAC,MAAM,oBAAoB;AAC9D,MAAM,0BAA0B,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAC7E,MAAM,4BAA4B,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAC/E,MAAM,qB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;KAAM;KAAc;IAAY,EAAE;IAC/D,GAAI,WACD,EACA,UAAU,CACT,GAAI,SAAS,QACV,CACA;KACC,SAAS;KACT,YAAY;KACZ,OAAO,SAAS;KAChB,SAAS,SAAS;IACnB,CACD,IACC,CAAC,GACJ;KACC,SAAS;KACT,YAAY;KACZ,OAAO,SAAS;KAChB,SAAS,SAAS;IACnB,CACD,EACD,IACC,CAAC;GACL;GACA,cAAc,EAAE,MAAM,0BAA0B;GAChD,iBAAiB,EAAE,MAAM,MAAM;EAChC,CAAC;EACD,WAAW,0BAA0B,QAAQ,IAAI,KAAA;CAClD;AACD"}
1
+ {"version":3,"file":"vite.js","names":[],"sources":["../../shared/dist/declaration.mjs","../../shared/dist/mcp.mjs","../mcp-vite.ts","../vite.ts"],"sourcesContent":["import { z } from \"zod\";\n\n//#region lib/declaration.ts\nconst credentialModeSchema = z.enum([\"viewer\", \"owner\"]);\nconst connectionRequirementSchema = z.strictObject({\n\tmode: credentialModeSchema,\n\ttoolkit: z.string().min(1)\n});\nconst secretNameSchema = z.string().regex(/^[A-Z_][A-Z0-9_]*$/);\nconst secretRequirementSchema = z.strictObject({ mode: credentialModeSchema });\nconst databaseRequirementSchema = z.strictObject({ mode: credentialModeSchema });\nconst databaseSlugSchema = z.string().min(1).regex(/^(?!\\.{1,2}$)[^/\\\\]+$/);\nconst declarationSchema = z.strictObject({\n\tconnections: z.record(z.string().min(1), connectionRequirementSchema),\n\tdatabases: z.record(databaseSlugSchema, databaseRequirementSchema).default({}),\n\tsecrets: z.record(secretNameSchema, secretRequirementSchema).default({})\n});\nconst slateDeclarationsSchema = z.strictObject({\n\tagents: z.record(z.string().min(1), declarationSchema),\n\tapp: declarationSchema\n});\nconst resourceConsumerSchema = z.discriminatedUnion(\"type\", [z.strictObject({ type: z.literal(\"app\") }), z.strictObject({\n\tname: z.string().min(1),\n\ttype: z.literal(\"agent\")\n})]);\nconst resourcesSchema = declarationSchema.extend({\n\tconnections: z.record(z.string().min(1), connectionRequirementSchema.extend({ consumers: z.array(resourceConsumerSchema) })),\n\tdatabases: z.record(databaseSlugSchema, databaseRequirementSchema.extend({ consumers: z.array(resourceConsumerSchema) })),\n\tsecrets: z.record(secretNameSchema, secretRequirementSchema.extend({ consumers: z.array(resourceConsumerSchema) }))\n});\nfunction hasViewerResources(resources) {\n\treturn Object.values(resources).some((requirements) => Object.values(requirements).some(({ mode }) => mode === \"viewer\"));\n}\nfunction collectSlateResources(slateDeclarations) {\n\tconst declarations = [{\n\t\tconsumer: { type: \"app\" },\n\t\tdeclaration: slateDeclarations.app\n\t}, ...Object.entries(slateDeclarations.agents).map(([name, declaration]) => ({\n\t\tconsumer: {\n\t\t\tname,\n\t\t\ttype: \"agent\"\n\t\t},\n\t\tdeclaration\n\t}))];\n\treturn {\n\t\tconnections: collectRequirements(\"connections\", declarations, (declaration) => declaration.connections),\n\t\tdatabases: collectRequirements(\"databases\", declarations, (declaration) => declaration.databases),\n\t\tsecrets: collectRequirements(\"secrets\", declarations, (declaration) => declaration.secrets)\n\t};\n}\nfunction resourcesForConsumer(resources, consumer) {\n\treturn {\n\t\tconnections: filterRequirements(resources.connections, consumer),\n\t\tdatabases: filterRequirements(resources.databases, consumer),\n\t\tsecrets: filterRequirements(resources.secrets, consumer)\n\t};\n}\nfunction filterRequirements(requirements, consumer) {\n\treturn Object.fromEntries(Object.entries(requirements).filter(([, requirement]) => requirement.consumers.some((declared) => declared.type === consumer.type && (consumer.type === \"app\" || declared.type === \"agent\" && declared.name === consumer.name))));\n}\nfunction collectRequirements(category, declarations, select) {\n\tconst resources = /* @__PURE__ */ new Map();\n\tfor (const { consumer, declaration } of declarations) for (const [key, requirement] of Object.entries(select(declaration))) {\n\t\tconst existing = resources.get(key);\n\t\tif (!existing) {\n\t\t\tresources.set(key, {\n\t\t\t\t...requirement,\n\t\t\t\tconsumers: [consumer]\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tif (existing.mode !== requirement.mode || existing.toolkit !== requirement.toolkit) throw new z.ZodError([{\n\t\t\tcode: \"custom\",\n\t\t\tmessage: `Conflicting ${category} requirement \"${key}\": declarations must agree on mode${category === \"connections\" ? \" and toolkit\" : \"\"}`,\n\t\t\tpath: [\n\t\t\t\t...consumer.type === \"app\" ? [\"app\"] : [\"agents\", consumer.name],\n\t\t\t\tcategory,\n\t\t\t\tkey\n\t\t\t]\n\t\t}]);\n\t\texisting.consumers.push(consumer);\n\t}\n\treturn Object.fromEntries(resources);\n}\n\n//#endregion\nexport { collectSlateResources, connectionRequirementSchema, credentialModeSchema, databaseRequirementSchema, databaseSlugSchema, declarationSchema, hasViewerResources, resourceConsumerSchema, resourcesForConsumer, resourcesSchema, secretNameSchema, secretRequirementSchema, slateDeclarationsSchema };","import { declarationSchema } from \"./declaration.mjs\";\nimport { z } from \"zod\";\nimport { ResourceSchema, ToolSchema } from \"@modelcontextprotocol/core\";\n\n//#region lib/mcp.ts\nconst MCP_MANIFEST_PATH = \"/mcp.json\";\nconst mcpManifestSchema = z.object({\n\tresources: z.array(ResourceSchema.extend({ path: z.string() })),\n\ttools: z.array(ToolSchema.extend({ declaration: declarationSchema }))\n});\n\n//#endregion\nexport { MCP_MANIFEST_PATH, mcpManifestSchema };","import { glob, readFile } from \"node:fs/promises\"\nimport { dirname, join, relative } from \"node:path\"\nimport { RESOURCE_MIME_TYPE } from \"@modelcontextprotocol/ext-apps/server\"\nimport { declarationSchema } from \"@usecontextlayer/shared/declaration\"\nimport { MCP_MANIFEST_PATH, mcpManifestSchema } from \"@usecontextlayer/shared/mcp\"\nimport { build, createServer, createServerModuleRunner, type Plugin } from \"vite\"\nimport { viteSingleFile } from \"vite-plugin-singlefile\"\nimport { z } from \"zod\"\nimport type { McpToolModule } from \"@/worker\"\n\nexport function mcpApps(): Plugin {\n\tlet root: string\n\tlet compiled: ReturnType<typeof compile>\n\n\tasync function compile() {\n\t\tconst server = await createServer({\n\t\t\tappType: \"custom\",\n\t\t\tconfigFile: false,\n\t\t\tresolve: { tsconfigPaths: true },\n\t\t\troot,\n\t\t\tserver: { middlewareMode: true },\n\t\t})\n\t\tconst runner = createServerModuleRunner(server.environments.ssr)\n\t\ttry {\n\t\t\tconst tools = []\n\t\t\tfor await (const file of glob(\"mcp/*/index.ts\", { cwd: root })) {\n\t\t\t\tconst { tool } = await runner.import<McpToolModule>(join(root, file))\n\t\t\t\tconst declaration = declarationSchema.parse(\n\t\t\t\t\tJSON.parse(await readFile(join(root, dirname(file), \"slate.json\"), \"utf8\")),\n\t\t\t\t)\n\t\t\t\tif (\n\t\t\t\t\tObject.keys(declaration.connections).length ||\n\t\t\t\t\tObject.keys(declaration.databases).length ||\n\t\t\t\t\tObject.keys(declaration.secrets).length\n\t\t\t\t) {\n\t\t\t\t\tthrow new Error(`${file}: MCP resource consumers are not implemented yet`)\n\t\t\t\t}\n\t\t\t\ttools.push({\n\t\t\t\t\t...tool,\n\t\t\t\t\tdeclaration,\n\t\t\t\t\tinputSchema: z.toJSONSchema(tool.inputSchema),\n\t\t\t\t\toutputSchema: tool.outputSchema ? z.toJSONSchema(tool.outputSchema) : undefined,\n\t\t\t\t})\n\t\t\t}\n\t\t\tconst assets = []\n\t\t\tconst resources = []\n\t\t\tfor await (const file of glob(\"mcp-ui/*/index.html\", { cwd: root })) {\n\t\t\t\tconst name = relative(\"mcp-ui\", dirname(file))\n\t\t\t\tconst result = await build({\n\t\t\t\t\tbuild: { rolldownOptions: { input: join(root, file) }, write: false },\n\t\t\t\t\tconfigFile: false,\n\t\t\t\t\tplugins: [viteSingleFile()],\n\t\t\t\t\tpublicDir: false,\n\t\t\t\t\tresolve: { tsconfigPaths: true },\n\t\t\t\t\troot,\n\t\t\t\t})\n\t\t\t\tif (Array.isArray(result) || !(\"output\" in result)) {\n\t\t\t\t\tthrow new Error(\"MCP View build must produce one bundle\")\n\t\t\t\t}\n\t\t\t\tconst html = result.output.find(\n\t\t\t\t\t(asset) => asset.type === \"asset\" && asset.fileName.endsWith(\".html\"),\n\t\t\t\t)\n\t\t\t\tif (html?.type !== \"asset\") throw new Error(`${file}: missing built HTML`)\n\t\t\t\tconst path = `/mcp-ui/${name}`\n\t\t\t\tassets.push({\n\t\t\t\t\tfileName: `${path.slice(1)}.html`,\n\t\t\t\t\tsource: html.source,\n\t\t\t\t\ttype: \"asset\" as const,\n\t\t\t\t})\n\t\t\t\tresources.push({\n\t\t\t\t\tmimeType: RESOURCE_MIME_TYPE,\n\t\t\t\t\tname,\n\t\t\t\t\tpath,\n\t\t\t\t\turi: `ui://${name}/index.html`,\n\t\t\t\t})\n\t\t\t}\n\t\t\tconst manifest = mcpManifestSchema.parse({ resources, tools })\n\t\t\tassets.push({\n\t\t\t\tfileName: MCP_MANIFEST_PATH.slice(1),\n\t\t\t\tsource: JSON.stringify(manifest),\n\t\t\t\ttype: \"asset\" as const,\n\t\t\t})\n\t\t\treturn assets\n\t\t} finally {\n\t\t\tawait runner.close()\n\t\t\tawait server.close()\n\t\t}\n\t}\n\n\treturn {\n\t\tconfigResolved(config) {\n\t\t\troot = config.root\n\t\t},\n\t\tasync generateBundle() {\n\t\t\tif (this.environment.config.consumer !== \"client\") return\n\t\t\tcompiled ??= compile()\n\t\t\tfor (const asset of await compiled) this.emitFile(asset)\n\t\t},\n\t\tname: \"contextlayer-mcp-apps\",\n\t}\n}\n","import { cloudflare } from \"@cloudflare/vite-plugin\"\nimport {\n\tgetLocalResourcesBindings,\n\tlocalDatabaseProvisioning,\n} from \"@usecontextlayer/cli/vite\"\nimport type { ConfigEnv } from \"vite\"\nimport { mcpApps } from \"@/mcp-vite\"\n\nexport async function contextlayer({ command }: ConfigEnv) {\n\tconst bindings = command === \"serve\" ? await getLocalResourcesBindings() : undefined\n\treturn [\n\t\tmcpApps(),\n\t\tcloudflare({\n\t\t\tauxiliaryWorkers: [\n\t\t\t\t{\n\t\t\t\t\tconfig: bindings ? { name: bindings.workerName, vars: bindings.vars } : {},\n\t\t\t\t\tconfigPath: \"workers/local-resources/wrangler.jsonc\",\n\t\t\t\t\tdevOnly: true,\n\t\t\t\t},\n\t\t\t],\n\t\t\tconfig: {\n\t\t\t\t...(bindings\n\t\t\t\t\t? {\n\t\t\t\t\t\t\tservices: [\n\t\t\t\t\t\t\t\t...(bindings.props\n\t\t\t\t\t\t\t\t\t? [\n\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\tbinding: \"TOOLS\",\n\t\t\t\t\t\t\t\t\t\t\t\tentrypoint: \"Tools\",\n\t\t\t\t\t\t\t\t\t\t\t\tprops: bindings.props,\n\t\t\t\t\t\t\t\t\t\t\t\tservice: bindings.workerName,\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t]\n\t\t\t\t\t\t\t\t\t: []),\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tbinding: \"DATABASES\",\n\t\t\t\t\t\t\t\t\tentrypoint: \"Databases\",\n\t\t\t\t\t\t\t\t\tprops: bindings.databaseProps,\n\t\t\t\t\t\t\t\t\tservice: bindings.workerName,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t],\n\t\t\t\t\t\t}\n\t\t\t\t\t: {}),\n\t\t\t},\n\t\t\tpersistState: { path: \".contextlayer/databases\" },\n\t\t\tviteEnvironment: { name: \"ssr\" },\n\t\t}),\n\t\tbindings ? localDatabaseProvisioning(bindings) : undefined,\n\t]\n}\n"],"mappings":";;;;;;;;;;AAGA,MAAM,uBAAuB,EAAE,KAAK,CAAC,UAAU,OAAO,CAAC;AACvD,MAAM,8BAA8B,EAAE,aAAa;CAClD,MAAM;CACN,SAAS,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC;AAC1B,CAAC;AACD,MAAM,mBAAmB,EAAE,OAAO,CAAC,CAAC,MAAM,oBAAoB;AAC9D,MAAM,0BAA0B,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAC7E,MAAM,4BAA4B,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAC/E,MAAM,qBAAqB,EAA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S,QACV,CACA;IACC,SAAS;IACT,YAAY;IACZ,OAAO,SAAS;IAChB,SAAS,SAAS;GACnB,CACD,IACC,CAAC,GACJ;IACC,SAAS;IACT,YAAY;IACZ,OAAO,SAAS;IAChB,SAAS,SAAS;GACnB,CACD,EACD,IACC,CAAC,EACL;GACA,cAAc,EAAE,MAAM,0BAA0B;GAChD,iBAAiB,EAAE,MAAM,MAAM;EAChC,CAAC;EACD,WAAW,0BAA0B,QAAQ,IAAI,KAAA;CAClD;AACD"}
package/package.json CHANGED
@@ -7,7 +7,7 @@
7
7
  "drizzle-orm": "0.45.3",
8
8
  "vite-plugin-singlefile": "2.3.3",
9
9
  "zod": "^4.6.5",
10
- "@usecontextlayer/cli": "0.16.0"
10
+ "@usecontextlayer/cli": "0.16.2"
11
11
  },
12
12
  "devDependencies": {
13
13
  "@cloudflare/vite-plugin": "^1.62.4",
@@ -22,7 +22,7 @@
22
22
  "typescript": "latest",
23
23
  "vite": "^8.3.2",
24
24
  "vitest": "^4.1.11",
25
- "@usecontextlayer/shared": "0.16.0"
25
+ "@usecontextlayer/shared": "0.16.2"
26
26
  },
27
27
  "exports": {
28
28
  ".": {
@@ -50,6 +50,7 @@
50
50
  "dist",
51
51
  "examples"
52
52
  ],
53
+ "license": "MIT",
53
54
  "name": "@usecontextlayer/sdk",
54
55
  "peerDependencies": {
55
56
  "@cloudflare/vite-plugin": "^1.62.4",
@@ -59,7 +60,7 @@
59
60
  "vite": "^8.3.2"
60
61
  },
61
62
  "type": "module",
62
- "version": "0.16.0",
63
+ "version": "0.16.2",
63
64
  "scripts": {
64
65
  "build": "tsdown",
65
66
  "dev:watch": "tsdown --watch",