noodleseed-cli 0.1.4
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 +176 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +625 -0
- package/dist/cli.js.map +1 -0
- package/dist/config.d.ts +52 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +77 -0
- package/dist/config.js.map +1 -0
- package/dist/control-plane.d.ts +33 -0
- package/dist/control-plane.d.ts.map +1 -0
- package/dist/control-plane.js +223 -0
- package/dist/control-plane.js.map +1 -0
- package/dist/deploy.d.ts +62 -0
- package/dist/deploy.d.ts.map +1 -0
- package/dist/deploy.js +182 -0
- package/dist/deploy.js.map +1 -0
- package/dist/dev.d.ts +50 -0
- package/dist/dev.d.ts.map +1 -0
- package/dist/dev.js +223 -0
- package/dist/dev.js.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -0
- package/dist/validate.d.ts +37 -0
- package/dist/validate.d.ts.map +1 -0
- package/dist/validate.js +46 -0
- package/dist/validate.js.map +1 -0
- package/node_modules/@noodle-borg/auth/dist/index.d.ts +14 -0
- package/node_modules/@noodle-borg/auth/dist/index.d.ts.map +1 -0
- package/node_modules/@noodle-borg/auth/dist/index.js +14 -0
- package/node_modules/@noodle-borg/auth/dist/index.js.map +1 -0
- package/node_modules/@noodle-borg/auth/dist/jwt-issuer.d.ts +21 -0
- package/node_modules/@noodle-borg/auth/dist/jwt-issuer.d.ts.map +1 -0
- package/node_modules/@noodle-borg/auth/dist/jwt-issuer.js +24 -0
- package/node_modules/@noodle-borg/auth/dist/jwt-issuer.js.map +1 -0
- package/node_modules/@noodle-borg/auth/dist/metadata.d.ts +27 -0
- package/node_modules/@noodle-borg/auth/dist/metadata.d.ts.map +1 -0
- package/node_modules/@noodle-borg/auth/dist/metadata.js +21 -0
- package/node_modules/@noodle-borg/auth/dist/metadata.js.map +1 -0
- package/node_modules/@noodle-borg/auth/dist/signer.d.ts +45 -0
- package/node_modules/@noodle-borg/auth/dist/signer.d.ts.map +1 -0
- package/node_modules/@noodle-borg/auth/dist/signer.js +47 -0
- package/node_modules/@noodle-borg/auth/dist/signer.js.map +1 -0
- package/node_modules/@noodle-borg/auth/dist/verify.d.ts +42 -0
- package/node_modules/@noodle-borg/auth/dist/verify.d.ts.map +1 -0
- package/node_modules/@noodle-borg/auth/dist/verify.js +48 -0
- package/node_modules/@noodle-borg/auth/dist/verify.js.map +1 -0
- package/node_modules/@noodle-borg/auth/package.json +27 -0
- package/node_modules/@noodle-borg/authoring/dist/index.d.ts +200 -0
- package/node_modules/@noodle-borg/authoring/dist/index.d.ts.map +1 -0
- package/node_modules/@noodle-borg/authoring/dist/index.js +504 -0
- package/node_modules/@noodle-borg/authoring/dist/index.js.map +1 -0
- package/node_modules/@noodle-borg/authoring/package.json +29 -0
- package/node_modules/@noodle-borg/compiler/dist/artifact/types.d.ts +203 -0
- package/node_modules/@noodle-borg/compiler/dist/artifact/types.d.ts.map +1 -0
- package/node_modules/@noodle-borg/compiler/dist/artifact/types.js +20 -0
- package/node_modules/@noodle-borg/compiler/dist/artifact/types.js.map +1 -0
- package/node_modules/@noodle-borg/compiler/dist/catalog/in-memory.d.ts +13 -0
- package/node_modules/@noodle-borg/compiler/dist/catalog/in-memory.d.ts.map +1 -0
- package/node_modules/@noodle-borg/compiler/dist/catalog/in-memory.js +19 -0
- package/node_modules/@noodle-borg/compiler/dist/catalog/in-memory.js.map +1 -0
- package/node_modules/@noodle-borg/compiler/dist/catalog/signature.d.ts +11 -0
- package/node_modules/@noodle-borg/compiler/dist/catalog/signature.d.ts.map +1 -0
- package/node_modules/@noodle-borg/compiler/dist/catalog/signature.js +31 -0
- package/node_modules/@noodle-borg/compiler/dist/catalog/signature.js.map +1 -0
- package/node_modules/@noodle-borg/compiler/dist/catalog/types.d.ts +43 -0
- package/node_modules/@noodle-borg/compiler/dist/catalog/types.d.ts.map +1 -0
- package/node_modules/@noodle-borg/compiler/dist/catalog/types.js +11 -0
- package/node_modules/@noodle-borg/compiler/dist/catalog/types.js.map +1 -0
- package/node_modules/@noodle-borg/compiler/dist/cli.d.ts +3 -0
- package/node_modules/@noodle-borg/compiler/dist/cli.d.ts.map +1 -0
- package/node_modules/@noodle-borg/compiler/dist/cli.js +19 -0
- package/node_modules/@noodle-borg/compiler/dist/cli.js.map +1 -0
- package/node_modules/@noodle-borg/compiler/dist/compile.d.ts +50 -0
- package/node_modules/@noodle-borg/compiler/dist/compile.d.ts.map +1 -0
- package/node_modules/@noodle-borg/compiler/dist/compile.js +719 -0
- package/node_modules/@noodle-borg/compiler/dist/compile.js.map +1 -0
- package/node_modules/@noodle-borg/compiler/dist/errors.d.ts +27 -0
- package/node_modules/@noodle-borg/compiler/dist/errors.d.ts.map +1 -0
- package/node_modules/@noodle-borg/compiler/dist/errors.js +2 -0
- package/node_modules/@noodle-borg/compiler/dist/errors.js.map +1 -0
- package/node_modules/@noodle-borg/compiler/dist/index.d.ts +13 -0
- package/node_modules/@noodle-borg/compiler/dist/index.d.ts.map +1 -0
- package/node_modules/@noodle-borg/compiler/dist/index.js +11 -0
- package/node_modules/@noodle-borg/compiler/dist/index.js.map +1 -0
- package/node_modules/@noodle-borg/compiler/dist/manifest/expression.d.ts +136 -0
- package/node_modules/@noodle-borg/compiler/dist/manifest/expression.d.ts.map +1 -0
- package/node_modules/@noodle-borg/compiler/dist/manifest/expression.js +552 -0
- package/node_modules/@noodle-borg/compiler/dist/manifest/expression.js.map +1 -0
- package/node_modules/@noodle-borg/compiler/dist/manifest/naming.d.ts +14 -0
- package/node_modules/@noodle-borg/compiler/dist/manifest/naming.d.ts.map +1 -0
- package/node_modules/@noodle-borg/compiler/dist/manifest/naming.js +18 -0
- package/node_modules/@noodle-borg/compiler/dist/manifest/naming.js.map +1 -0
- package/node_modules/@noodle-borg/compiler/dist/manifest/schema-refs.d.ts +24 -0
- package/node_modules/@noodle-borg/compiler/dist/manifest/schema-refs.d.ts.map +1 -0
- package/node_modules/@noodle-borg/compiler/dist/manifest/schema-refs.js +149 -0
- package/node_modules/@noodle-borg/compiler/dist/manifest/schema-refs.js.map +1 -0
- package/node_modules/@noodle-borg/compiler/dist/manifest/schema.d.ts +97 -0
- package/node_modules/@noodle-borg/compiler/dist/manifest/schema.d.ts.map +1 -0
- package/node_modules/@noodle-borg/compiler/dist/manifest/schema.js +157 -0
- package/node_modules/@noodle-borg/compiler/dist/manifest/schema.js.map +1 -0
- package/node_modules/@noodle-borg/compiler/dist/schema-export.d.ts +6 -0
- package/node_modules/@noodle-borg/compiler/dist/schema-export.d.ts.map +1 -0
- package/node_modules/@noodle-borg/compiler/dist/schema-export.js +28 -0
- package/node_modules/@noodle-borg/compiler/dist/schema-export.js.map +1 -0
- package/node_modules/@noodle-borg/compiler/dist/suggest.d.ts +41 -0
- package/node_modules/@noodle-borg/compiler/dist/suggest.d.ts.map +1 -0
- package/node_modules/@noodle-borg/compiler/dist/suggest.js +105 -0
- package/node_modules/@noodle-borg/compiler/dist/suggest.js.map +1 -0
- package/node_modules/@noodle-borg/compiler/dist/uri-template.d.ts +33 -0
- package/node_modules/@noodle-borg/compiler/dist/uri-template.d.ts.map +1 -0
- package/node_modules/@noodle-borg/compiler/dist/uri-template.js +83 -0
- package/node_modules/@noodle-borg/compiler/dist/uri-template.js.map +1 -0
- package/node_modules/@noodle-borg/compiler/package.json +32 -0
- package/node_modules/@noodle-borg/compute/dist/code-connector.d.ts +45 -0
- package/node_modules/@noodle-borg/compute/dist/code-connector.d.ts.map +1 -0
- package/node_modules/@noodle-borg/compute/dist/code-connector.js +53 -0
- package/node_modules/@noodle-borg/compute/dist/code-connector.js.map +1 -0
- package/node_modules/@noodle-borg/compute/dist/engine.d.ts +73 -0
- package/node_modules/@noodle-borg/compute/dist/engine.d.ts.map +1 -0
- package/node_modules/@noodle-borg/compute/dist/engine.js +31 -0
- package/node_modules/@noodle-borg/compute/dist/engine.js.map +1 -0
- package/node_modules/@noodle-borg/compute/dist/index.d.ts +4 -0
- package/node_modules/@noodle-borg/compute/dist/index.d.ts.map +1 -0
- package/node_modules/@noodle-borg/compute/dist/index.js +4 -0
- package/node_modules/@noodle-borg/compute/dist/index.js.map +1 -0
- package/node_modules/@noodle-borg/compute/dist/quickjs-engine.d.ts +31 -0
- package/node_modules/@noodle-borg/compute/dist/quickjs-engine.d.ts.map +1 -0
- package/node_modules/@noodle-borg/compute/dist/quickjs-engine.js +271 -0
- package/node_modules/@noodle-borg/compute/dist/quickjs-engine.js.map +1 -0
- package/node_modules/@noodle-borg/compute/package.json +29 -0
- package/node_modules/@noodle-borg/connector-defs/dist/compile.d.ts +46 -0
- package/node_modules/@noodle-borg/connector-defs/dist/compile.d.ts.map +1 -0
- package/node_modules/@noodle-borg/connector-defs/dist/compile.js +289 -0
- package/node_modules/@noodle-borg/connector-defs/dist/compile.js.map +1 -0
- package/node_modules/@noodle-borg/connector-defs/dist/index.d.ts +3 -0
- package/node_modules/@noodle-borg/connector-defs/dist/index.d.ts.map +1 -0
- package/node_modules/@noodle-borg/connector-defs/dist/index.js +3 -0
- package/node_modules/@noodle-borg/connector-defs/dist/index.js.map +1 -0
- package/node_modules/@noodle-borg/connector-defs/dist/schema.d.ts +332 -0
- package/node_modules/@noodle-borg/connector-defs/dist/schema.d.ts.map +1 -0
- package/node_modules/@noodle-borg/connector-defs/dist/schema.js +105 -0
- package/node_modules/@noodle-borg/connector-defs/dist/schema.js.map +1 -0
- package/node_modules/@noodle-borg/connector-defs/package.json +32 -0
- package/node_modules/@noodle-borg/connector-http/dist/http-connector.d.ts +86 -0
- package/node_modules/@noodle-borg/connector-http/dist/http-connector.d.ts.map +1 -0
- package/node_modules/@noodle-borg/connector-http/dist/http-connector.js +138 -0
- package/node_modules/@noodle-borg/connector-http/dist/http-connector.js.map +1 -0
- package/node_modules/@noodle-borg/connector-http/dist/index.d.ts +3 -0
- package/node_modules/@noodle-borg/connector-http/dist/index.d.ts.map +1 -0
- package/node_modules/@noodle-borg/connector-http/dist/index.js +3 -0
- package/node_modules/@noodle-borg/connector-http/dist/index.js.map +1 -0
- package/node_modules/@noodle-borg/connector-http/dist/ssrf.d.ts +45 -0
- package/node_modules/@noodle-borg/connector-http/dist/ssrf.d.ts.map +1 -0
- package/node_modules/@noodle-borg/connector-http/dist/ssrf.js +57 -0
- package/node_modules/@noodle-borg/connector-http/dist/ssrf.js.map +1 -0
- package/node_modules/@noodle-borg/connector-http/package.json +30 -0
- package/node_modules/@noodle-borg/protocol/dist/adapter.d.ts +73 -0
- package/node_modules/@noodle-borg/protocol/dist/adapter.d.ts.map +1 -0
- package/node_modules/@noodle-borg/protocol/dist/adapter.js +2 -0
- package/node_modules/@noodle-borg/protocol/dist/adapter.js.map +1 -0
- package/node_modules/@noodle-borg/protocol/dist/adapters/mcp-2025-11-25.d.ts +19 -0
- package/node_modules/@noodle-borg/protocol/dist/adapters/mcp-2025-11-25.d.ts.map +1 -0
- package/node_modules/@noodle-borg/protocol/dist/adapters/mcp-2025-11-25.js +34 -0
- package/node_modules/@noodle-borg/protocol/dist/adapters/mcp-2025-11-25.js.map +1 -0
- package/node_modules/@noodle-borg/protocol/dist/index.d.ts +5 -0
- package/node_modules/@noodle-borg/protocol/dist/index.d.ts.map +1 -0
- package/node_modules/@noodle-borg/protocol/dist/index.js +5 -0
- package/node_modules/@noodle-borg/protocol/dist/index.js.map +1 -0
- package/node_modules/@noodle-borg/protocol/dist/jsonrpc.d.ts +19 -0
- package/node_modules/@noodle-borg/protocol/dist/jsonrpc.d.ts.map +1 -0
- package/node_modules/@noodle-borg/protocol/dist/jsonrpc.js +14 -0
- package/node_modules/@noodle-borg/protocol/dist/jsonrpc.js.map +1 -0
- package/node_modules/@noodle-borg/protocol/dist/mapping.d.ts +133 -0
- package/node_modules/@noodle-borg/protocol/dist/mapping.d.ts.map +1 -0
- package/node_modules/@noodle-borg/protocol/dist/mapping.js +181 -0
- package/node_modules/@noodle-borg/protocol/dist/mapping.js.map +1 -0
- package/node_modules/@noodle-borg/protocol/dist/negotiate.d.ts +13 -0
- package/node_modules/@noodle-borg/protocol/dist/negotiate.d.ts.map +1 -0
- package/node_modules/@noodle-borg/protocol/dist/negotiate.js +18 -0
- package/node_modules/@noodle-borg/protocol/dist/negotiate.js.map +1 -0
- package/node_modules/@noodle-borg/protocol/dist/registry.d.ts +17 -0
- package/node_modules/@noodle-borg/protocol/dist/registry.d.ts.map +1 -0
- package/node_modules/@noodle-borg/protocol/dist/registry.js +33 -0
- package/node_modules/@noodle-borg/protocol/dist/registry.js.map +1 -0
- package/node_modules/@noodle-borg/protocol/dist/sdk-server.d.ts +22 -0
- package/node_modules/@noodle-borg/protocol/dist/sdk-server.d.ts.map +1 -0
- package/node_modules/@noodle-borg/protocol/dist/sdk-server.js +91 -0
- package/node_modules/@noodle-borg/protocol/dist/sdk-server.js.map +1 -0
- package/node_modules/@noodle-borg/protocol/dist/server.d.ts +38 -0
- package/node_modules/@noodle-borg/protocol/dist/server.d.ts.map +1 -0
- package/node_modules/@noodle-borg/protocol/dist/server.js +89 -0
- package/node_modules/@noodle-borg/protocol/dist/server.js.map +1 -0
- package/node_modules/@noodle-borg/protocol/dist/stateless.d.ts +14 -0
- package/node_modules/@noodle-borg/protocol/dist/stateless.d.ts.map +1 -0
- package/node_modules/@noodle-borg/protocol/dist/stateless.js +28 -0
- package/node_modules/@noodle-borg/protocol/dist/stateless.js.map +1 -0
- package/node_modules/@noodle-borg/protocol/dist/widget/bootstrap.d.ts +24 -0
- package/node_modules/@noodle-borg/protocol/dist/widget/bootstrap.d.ts.map +1 -0
- package/node_modules/@noodle-borg/protocol/dist/widget/bootstrap.js +165 -0
- package/node_modules/@noodle-borg/protocol/dist/widget/bootstrap.js.map +1 -0
- package/node_modules/@noodle-borg/protocol/dist/widget/ext-apps-bundle.d.ts +4 -0
- package/node_modules/@noodle-borg/protocol/dist/widget/ext-apps-bundle.d.ts.map +1 -0
- package/node_modules/@noodle-borg/protocol/dist/widget/ext-apps-bundle.js +10 -0
- package/node_modules/@noodle-borg/protocol/dist/widget/ext-apps-bundle.js.map +1 -0
- package/node_modules/@noodle-borg/protocol/dist/widget/inject.d.ts +8 -0
- package/node_modules/@noodle-borg/protocol/dist/widget/inject.d.ts.map +1 -0
- package/node_modules/@noodle-borg/protocol/dist/widget/inject.js +36 -0
- package/node_modules/@noodle-borg/protocol/dist/widget/inject.js.map +1 -0
- package/node_modules/@noodle-borg/protocol/package.json +29 -0
- package/node_modules/@noodle-borg/runtime/dist/broker/map.d.ts +29 -0
- package/node_modules/@noodle-borg/runtime/dist/broker/map.d.ts.map +1 -0
- package/node_modules/@noodle-borg/runtime/dist/broker/map.js +38 -0
- package/node_modules/@noodle-borg/runtime/dist/broker/map.js.map +1 -0
- package/node_modules/@noodle-borg/runtime/dist/broker/secret-box.d.ts +103 -0
- package/node_modules/@noodle-borg/runtime/dist/broker/secret-box.d.ts.map +1 -0
- package/node_modules/@noodle-borg/runtime/dist/broker/secret-box.js +118 -0
- package/node_modules/@noodle-borg/runtime/dist/broker/secret-box.js.map +1 -0
- package/node_modules/@noodle-borg/runtime/dist/broker/static.d.ts +12 -0
- package/node_modules/@noodle-borg/runtime/dist/broker/static.d.ts.map +1 -0
- package/node_modules/@noodle-borg/runtime/dist/broker/static.js +15 -0
- package/node_modules/@noodle-borg/runtime/dist/broker/static.js.map +1 -0
- package/node_modules/@noodle-borg/runtime/dist/broker/types.d.ts +28 -0
- package/node_modules/@noodle-borg/runtime/dist/broker/types.d.ts.map +1 -0
- package/node_modules/@noodle-borg/runtime/dist/broker/types.js +2 -0
- package/node_modules/@noodle-borg/runtime/dist/broker/types.js.map +1 -0
- package/node_modules/@noodle-borg/runtime/dist/connector/in-memory.d.ts +29 -0
- package/node_modules/@noodle-borg/runtime/dist/connector/in-memory.d.ts.map +1 -0
- package/node_modules/@noodle-borg/runtime/dist/connector/in-memory.js +37 -0
- package/node_modules/@noodle-borg/runtime/dist/connector/in-memory.js.map +1 -0
- package/node_modules/@noodle-borg/runtime/dist/connector/types.d.ts +41 -0
- package/node_modules/@noodle-borg/runtime/dist/connector/types.d.ts.map +1 -0
- package/node_modules/@noodle-borg/runtime/dist/connector/types.js +2 -0
- package/node_modules/@noodle-borg/runtime/dist/connector/types.js.map +1 -0
- package/node_modules/@noodle-borg/runtime/dist/eval/evaluate.d.ts +39 -0
- package/node_modules/@noodle-borg/runtime/dist/eval/evaluate.d.ts.map +1 -0
- package/node_modules/@noodle-borg/runtime/dist/eval/evaluate.js +117 -0
- package/node_modules/@noodle-borg/runtime/dist/eval/evaluate.js.map +1 -0
- package/node_modules/@noodle-borg/runtime/dist/execute.d.ts +47 -0
- package/node_modules/@noodle-borg/runtime/dist/execute.d.ts.map +1 -0
- package/node_modules/@noodle-borg/runtime/dist/execute.js +297 -0
- package/node_modules/@noodle-borg/runtime/dist/execute.js.map +1 -0
- package/node_modules/@noodle-borg/runtime/dist/index.d.ts +12 -0
- package/node_modules/@noodle-borg/runtime/dist/index.d.ts.map +1 -0
- package/node_modules/@noodle-borg/runtime/dist/index.js +8 -0
- package/node_modules/@noodle-borg/runtime/dist/index.js.map +1 -0
- package/node_modules/@noodle-borg/runtime/dist/policy/allow-all.d.ts +10 -0
- package/node_modules/@noodle-borg/runtime/dist/policy/allow-all.d.ts.map +1 -0
- package/node_modules/@noodle-borg/runtime/dist/policy/allow-all.js +13 -0
- package/node_modules/@noodle-borg/runtime/dist/policy/allow-all.js.map +1 -0
- package/node_modules/@noodle-borg/runtime/dist/policy/types.d.ts +25 -0
- package/node_modules/@noodle-borg/runtime/dist/policy/types.d.ts.map +1 -0
- package/node_modules/@noodle-borg/runtime/dist/policy/types.js +2 -0
- package/node_modules/@noodle-borg/runtime/dist/policy/types.js.map +1 -0
- package/node_modules/@noodle-borg/runtime/dist/result.d.ts +19 -0
- package/node_modules/@noodle-borg/runtime/dist/result.d.ts.map +1 -0
- package/node_modules/@noodle-borg/runtime/dist/result.js +2 -0
- package/node_modules/@noodle-borg/runtime/dist/result.js.map +1 -0
- package/node_modules/@noodle-borg/runtime/package.json +27 -0
- package/node_modules/@noodle-borg/service/dist/auth/deploy-gate.d.ts +48 -0
- package/node_modules/@noodle-borg/service/dist/auth/deploy-gate.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/auth/deploy-gate.js +79 -0
- package/node_modules/@noodle-borg/service/dist/auth/deploy-gate.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/index.d.ts +7 -0
- package/node_modules/@noodle-borg/service/dist/index.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/index.js +7 -0
- package/node_modules/@noodle-borg/service/dist/index.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/main.d.ts +3 -0
- package/node_modules/@noodle-borg/service/dist/main.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/main.js +171 -0
- package/node_modules/@noodle-borg/service/dist/main.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/oauth/app.d.ts +14 -0
- package/node_modules/@noodle-borg/service/dist/oauth/app.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/oauth/app.js +48 -0
- package/node_modules/@noodle-borg/service/dist/oauth/app.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/oauth/consent.d.ts +18 -0
- package/node_modules/@noodle-borg/service/dist/oauth/consent.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/oauth/consent.js +55 -0
- package/node_modules/@noodle-borg/service/dist/oauth/consent.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/oauth/google.d.ts +31 -0
- package/node_modules/@noodle-borg/service/dist/oauth/google.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/oauth/google.js +39 -0
- package/node_modules/@noodle-borg/service/dist/oauth/google.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/oauth/paths.d.ts +3 -0
- package/node_modules/@noodle-borg/service/dist/oauth/paths.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/oauth/paths.js +19 -0
- package/node_modules/@noodle-borg/service/dist/oauth/paths.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/oauth/provider.d.ts +61 -0
- package/node_modules/@noodle-borg/service/dist/oauth/provider.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/oauth/provider.js +313 -0
- package/node_modules/@noodle-borg/service/dist/oauth/provider.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/oauth/store-postgres.d.ts +29 -0
- package/node_modules/@noodle-borg/service/dist/oauth/store-postgres.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/oauth/store-postgres.js +176 -0
- package/node_modules/@noodle-borg/service/dist/oauth/store-postgres.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/oauth/store.d.ts +85 -0
- package/node_modules/@noodle-borg/service/dist/oauth/store.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/oauth/store.js +57 -0
- package/node_modules/@noodle-borg/service/dist/oauth/store.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/oauth/tokens.d.ts +8 -0
- package/node_modules/@noodle-borg/service/dist/oauth/tokens.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/oauth/tokens.js +13 -0
- package/node_modules/@noodle-borg/service/dist/oauth/tokens.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/secret/kms-master-key.d.ts +36 -0
- package/node_modules/@noodle-borg/service/dist/secret/kms-master-key.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/secret/kms-master-key.js +51 -0
- package/node_modules/@noodle-borg/service/dist/secret/kms-master-key.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/service.d.ts +221 -0
- package/node_modules/@noodle-borg/service/dist/service.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/service.js +1163 -0
- package/node_modules/@noodle-borg/service/dist/service.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/store/cloudsql-pool.d.ts +34 -0
- package/node_modules/@noodle-borg/service/dist/store/cloudsql-pool.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/store/cloudsql-pool.js +38 -0
- package/node_modules/@noodle-borg/service/dist/store/cloudsql-pool.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/store/postgres.d.ts +56 -0
- package/node_modules/@noodle-borg/service/dist/store/postgres.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/store/postgres.js +372 -0
- package/node_modules/@noodle-borg/service/dist/store/postgres.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/store.d.ts +192 -0
- package/node_modules/@noodle-borg/service/dist/store.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/store.js +230 -0
- package/node_modules/@noodle-borg/service/dist/store.js.map +1 -0
- package/node_modules/@noodle-borg/service/package.json +44 -0
- package/node_modules/@noodle-borg/transport-http/dist/caller-auth.d.ts +15 -0
- package/node_modules/@noodle-borg/transport-http/dist/caller-auth.d.ts.map +1 -0
- package/node_modules/@noodle-borg/transport-http/dist/caller-auth.js +38 -0
- package/node_modules/@noodle-borg/transport-http/dist/caller-auth.js.map +1 -0
- package/node_modules/@noodle-borg/transport-http/dist/examples/serve-demo.d.ts +2 -0
- package/node_modules/@noodle-borg/transport-http/dist/examples/serve-demo.d.ts.map +1 -0
- package/node_modules/@noodle-borg/transport-http/dist/examples/serve-demo.js +129 -0
- package/node_modules/@noodle-borg/transport-http/dist/examples/serve-demo.js.map +1 -0
- package/node_modules/@noodle-borg/transport-http/dist/front-door.d.ts +46 -0
- package/node_modules/@noodle-borg/transport-http/dist/front-door.d.ts.map +1 -0
- package/node_modules/@noodle-borg/transport-http/dist/front-door.js +75 -0
- package/node_modules/@noodle-borg/transport-http/dist/front-door.js.map +1 -0
- package/node_modules/@noodle-borg/transport-http/dist/handler.d.ts +142 -0
- package/node_modules/@noodle-borg/transport-http/dist/handler.d.ts.map +1 -0
- package/node_modules/@noodle-borg/transport-http/dist/handler.js +387 -0
- package/node_modules/@noodle-borg/transport-http/dist/handler.js.map +1 -0
- package/node_modules/@noodle-borg/transport-http/dist/index.d.ts +6 -0
- package/node_modules/@noodle-borg/transport-http/dist/index.d.ts.map +1 -0
- package/node_modules/@noodle-borg/transport-http/dist/index.js +6 -0
- package/node_modules/@noodle-borg/transport-http/dist/index.js.map +1 -0
- package/node_modules/@noodle-borg/transport-http/dist/logging.d.ts +41 -0
- package/node_modules/@noodle-borg/transport-http/dist/logging.d.ts.map +1 -0
- package/node_modules/@noodle-borg/transport-http/dist/logging.js +71 -0
- package/node_modules/@noodle-borg/transport-http/dist/logging.js.map +1 -0
- package/node_modules/@noodle-borg/transport-http/dist/serve.d.ts +22 -0
- package/node_modules/@noodle-borg/transport-http/dist/serve.d.ts.map +1 -0
- package/node_modules/@noodle-borg/transport-http/dist/serve.js +25 -0
- package/node_modules/@noodle-borg/transport-http/dist/serve.js.map +1 -0
- package/node_modules/@noodle-borg/transport-http/package.json +30 -0
- package/package.json +78 -0
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import type { ArtifactTool, RuntimeArtifact } from '@noodle-borg/compiler';
|
|
2
|
+
import type { ExecutionError } from '@noodle-borg/runtime';
|
|
3
|
+
import { type JsonRpcErrorObject } from './jsonrpc.js';
|
|
4
|
+
/**
|
|
5
|
+
* Artifact → MCP wire mapping. The official `@modelcontextprotocol/sdk` owns JSON-RPC framing and
|
|
6
|
+
* version negotiation; these helpers translate a resolved artifact's tools and a tool-execution outcome
|
|
7
|
+
* into the SDK's result shapes (`tools/list`, `tools/call`). They are version-agnostic — the same
|
|
8
|
+
* mapping serves any protocol version the SDK negotiates.
|
|
9
|
+
*/
|
|
10
|
+
/** An MCP tool descriptor (the `tools/list` item shape). */
|
|
11
|
+
export interface ToolDescriptor {
|
|
12
|
+
readonly name: string;
|
|
13
|
+
readonly title?: string;
|
|
14
|
+
readonly description: string;
|
|
15
|
+
readonly inputSchema: Record<string, unknown>;
|
|
16
|
+
readonly outputSchema?: Record<string, unknown>;
|
|
17
|
+
/** MCP `_meta` extension bag (e.g. MCP Apps `{ ui: { resourceUri } }` linking the tool to its widget). */
|
|
18
|
+
readonly _meta?: Record<string, unknown>;
|
|
19
|
+
}
|
|
20
|
+
export interface ToolsListResult {
|
|
21
|
+
readonly tools: readonly ToolDescriptor[];
|
|
22
|
+
readonly nextCursor?: string;
|
|
23
|
+
}
|
|
24
|
+
/** An MCP text content block. Phase 1 emits only text blocks. */
|
|
25
|
+
export interface TextContent {
|
|
26
|
+
readonly type: 'text';
|
|
27
|
+
readonly text: string;
|
|
28
|
+
}
|
|
29
|
+
export interface ToolsCallResult {
|
|
30
|
+
readonly content: readonly TextContent[];
|
|
31
|
+
readonly structuredContent?: unknown;
|
|
32
|
+
readonly isError: boolean;
|
|
33
|
+
}
|
|
34
|
+
/** A `tools/call` either yields a tool result (possibly `isError`) or a JSON-RPC protocol error. */
|
|
35
|
+
export type CallToolOutcome = {
|
|
36
|
+
readonly result: ToolsCallResult;
|
|
37
|
+
} | {
|
|
38
|
+
readonly error: JsonRpcErrorObject;
|
|
39
|
+
};
|
|
40
|
+
/** Map a resolved artifact tool to an MCP tool descriptor (carrying its `_meta` extension bag, if any). */
|
|
41
|
+
export declare function mapTool(tool: ArtifactTool): ToolDescriptor;
|
|
42
|
+
/** Map the artifact's tools to a `tools/list` result (app-only tools filtered out; no pagination this phase). */
|
|
43
|
+
export declare function mapToolsList(artifact: RuntimeArtifact): ToolsListResult;
|
|
44
|
+
/**
|
|
45
|
+
* Map a successful tool output to a `tools/call` result. Structured (object) output is returned as
|
|
46
|
+
* `structuredContent` and also serialized into a text block (the spec asks for both, for clients
|
|
47
|
+
* that do not read structured content).
|
|
48
|
+
*/
|
|
49
|
+
export declare function mapToolOutput(output: unknown): ToolsCallResult;
|
|
50
|
+
/**
|
|
51
|
+
* Map an execution error to its MCP channel. Call-time, model-correctable failures become an
|
|
52
|
+
* `isError: true` tool result; an unknown tool is an invalid-params protocol error; everything else
|
|
53
|
+
* (server-side faults: shape-only artifact, connector unavailable, signature drift, unsupported
|
|
54
|
+
* fulfilment, policy denial) is an internal protocol error. The split is intentional and auditable.
|
|
55
|
+
*/
|
|
56
|
+
export declare function mapExecutionError(error: ExecutionError): CallToolOutcome;
|
|
57
|
+
export interface ResourceDescriptor {
|
|
58
|
+
readonly uri: string;
|
|
59
|
+
readonly name: string;
|
|
60
|
+
readonly title?: string;
|
|
61
|
+
readonly description?: string;
|
|
62
|
+
readonly mimeType?: string;
|
|
63
|
+
/** MCP `_meta` extension bag (e.g. a widget UI resource's `{ ui: { csp, permissions } }`). */
|
|
64
|
+
readonly _meta?: Record<string, unknown>;
|
|
65
|
+
}
|
|
66
|
+
export interface ResourcesListResult {
|
|
67
|
+
readonly resources: readonly ResourceDescriptor[];
|
|
68
|
+
}
|
|
69
|
+
export interface ResourceTemplateDescriptor {
|
|
70
|
+
readonly uriTemplate: string;
|
|
71
|
+
readonly name: string;
|
|
72
|
+
readonly title?: string;
|
|
73
|
+
readonly description?: string;
|
|
74
|
+
readonly mimeType?: string;
|
|
75
|
+
readonly _meta?: Record<string, unknown>;
|
|
76
|
+
}
|
|
77
|
+
export interface ResourceTemplatesListResult {
|
|
78
|
+
readonly resourceTemplates: readonly ResourceTemplateDescriptor[];
|
|
79
|
+
}
|
|
80
|
+
export interface ResourceContent {
|
|
81
|
+
readonly uri: string;
|
|
82
|
+
readonly mimeType?: string;
|
|
83
|
+
readonly text?: string;
|
|
84
|
+
readonly blob?: string;
|
|
85
|
+
}
|
|
86
|
+
export interface ReadResourceResult {
|
|
87
|
+
readonly contents: readonly ResourceContent[];
|
|
88
|
+
}
|
|
89
|
+
/** Map the artifact's fixed (non-templated) resources to a `resources/list` result. */
|
|
90
|
+
export declare function mapResourcesList(artifact: RuntimeArtifact): ResourcesListResult;
|
|
91
|
+
/** Map the artifact's templated resources to a `resources/templates/list` result. */
|
|
92
|
+
export declare function mapResourceTemplatesList(artifact: RuntimeArtifact): ResourceTemplatesListResult;
|
|
93
|
+
/**
|
|
94
|
+
* Map an executed resource's output to `resources/read` contents. The fulfilment output is the
|
|
95
|
+
* single-key `{ value }` wrapper (the authoring convention); `value` is interpreted as: a string → a
|
|
96
|
+
* text content with the resource's mime type; an object with `text` or `blob` → that content verbatim;
|
|
97
|
+
* anything else → a JSON-serialized text content.
|
|
98
|
+
*/
|
|
99
|
+
export declare function mapResourceContents(uri: string, mimeType: string | undefined, output: unknown): ReadResourceResult;
|
|
100
|
+
export interface PromptArgumentDescriptor {
|
|
101
|
+
readonly name: string;
|
|
102
|
+
readonly description?: string;
|
|
103
|
+
readonly required?: boolean;
|
|
104
|
+
}
|
|
105
|
+
export interface PromptDescriptor {
|
|
106
|
+
readonly name: string;
|
|
107
|
+
readonly title?: string;
|
|
108
|
+
readonly description?: string;
|
|
109
|
+
readonly arguments?: readonly PromptArgumentDescriptor[];
|
|
110
|
+
}
|
|
111
|
+
export interface PromptsListResult {
|
|
112
|
+
readonly prompts: readonly PromptDescriptor[];
|
|
113
|
+
}
|
|
114
|
+
export interface PromptMessage {
|
|
115
|
+
readonly role: 'user' | 'assistant';
|
|
116
|
+
readonly content: {
|
|
117
|
+
readonly type: 'text';
|
|
118
|
+
readonly text: string;
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
export interface GetPromptResult {
|
|
122
|
+
readonly description?: string;
|
|
123
|
+
readonly messages: readonly PromptMessage[];
|
|
124
|
+
}
|
|
125
|
+
/** Map the artifact's prompts to a `prompts/list` result. */
|
|
126
|
+
export declare function mapPromptsList(artifact: RuntimeArtifact): PromptsListResult;
|
|
127
|
+
/**
|
|
128
|
+
* Map an executed prompt's output to `prompts/get` messages. `value` (unwrapped from `{ value }`) is
|
|
129
|
+
* interpreted as: a string → one `user` text message; an array of `{ role, text }` (or wire-shaped
|
|
130
|
+
* messages) → those messages; an object with `messages` → those; otherwise → one `user` JSON message.
|
|
131
|
+
*/
|
|
132
|
+
export declare function mapPromptMessages(output: unknown, description?: string): GetPromptResult;
|
|
133
|
+
//# sourceMappingURL=mapping.d.ts.map
|
|
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AAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,WAAW,CAAC;IACpC,QAAQ,CAAC,OAAO,EAAE;QAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;CACpE;AAED,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,QAAQ,EAAE,SAAS,aAAa,EAAE,CAAC;CAC7C;AAED,6DAA6D;AAC7D,wBAAgB,cAAc,CAAC,QAAQ,EAAE,eAAe,GAAG,iBAAiB,CAgB3E;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,OAAO,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,eAAe,CAGxF"}
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
import { JSON_RPC } from './jsonrpc.js';
|
|
2
|
+
import { injectWidgetBridge } from './widget/inject.js';
|
|
3
|
+
/** Map a resolved artifact tool to an MCP tool descriptor (carrying its `_meta` extension bag, if any). */
|
|
4
|
+
export function mapTool(tool) {
|
|
5
|
+
return {
|
|
6
|
+
name: tool.name,
|
|
7
|
+
description: tool.description,
|
|
8
|
+
inputSchema: tool.inputSchema,
|
|
9
|
+
...(tool.outputSchema !== undefined ? { outputSchema: tool.outputSchema } : {}),
|
|
10
|
+
...(tool._meta !== undefined ? { _meta: tool._meta } : {}),
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* A tool is **hidden** from `tools/list` when its `_meta.ui.visibility` is set and does not include
|
|
15
|
+
* `'model'` (an app-only UI helper, SEP-1865). Default (unset) = visible. Hiding affects only the model's
|
|
16
|
+
* tool surface — the tool stays callable via `tools/call` (a widget reaches it through `callServerTool`),
|
|
17
|
+
* and it is **not** an authorization boundary (the policy layer remains the gate).
|
|
18
|
+
*/
|
|
19
|
+
function isModelVisible(tool) {
|
|
20
|
+
const visibility = tool._meta?.ui?.visibility;
|
|
21
|
+
// Default (unset) and the degenerate empty array both fail OPEN to visible; only an explicit list that
|
|
22
|
+
// omits 'model' hides the tool.
|
|
23
|
+
return visibility === undefined || visibility.length === 0 || visibility.includes('model');
|
|
24
|
+
}
|
|
25
|
+
/** Map the artifact's tools to a `tools/list` result (app-only tools filtered out; no pagination this phase). */
|
|
26
|
+
export function mapToolsList(artifact) {
|
|
27
|
+
return { tools: artifact.tools.filter(isModelVisible).map(mapTool) };
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Map a successful tool output to a `tools/call` result. Structured (object) output is returned as
|
|
31
|
+
* `structuredContent` and also serialized into a text block (the spec asks for both, for clients
|
|
32
|
+
* that do not read structured content).
|
|
33
|
+
*/
|
|
34
|
+
export function mapToolOutput(output) {
|
|
35
|
+
const text = typeof output === 'string' ? output : JSON.stringify(output);
|
|
36
|
+
const structured = output !== null && typeof output === 'object' && !Array.isArray(output);
|
|
37
|
+
return structured
|
|
38
|
+
? { content: [{ type: 'text', text }], structuredContent: output, isError: false }
|
|
39
|
+
: { content: [{ type: 'text', text }], isError: false };
|
|
40
|
+
}
|
|
41
|
+
/** Execution-error codes surfaced to the caller as `isError: true` tool results (model-actionable). */
|
|
42
|
+
const TOOL_EXECUTION_ERRORS = new Set([
|
|
43
|
+
'arg_invalid',
|
|
44
|
+
'expression_error',
|
|
45
|
+
'connector_error',
|
|
46
|
+
'output_invalid',
|
|
47
|
+
]);
|
|
48
|
+
/** Execution-error codes surfaced as JSON-RPC `-32602` (a malformed/unknown request). */
|
|
49
|
+
const INVALID_PARAMS_ERRORS = new Set(['unknown_tool']);
|
|
50
|
+
/**
|
|
51
|
+
* Map an execution error to its MCP channel. Call-time, model-correctable failures become an
|
|
52
|
+
* `isError: true` tool result; an unknown tool is an invalid-params protocol error; everything else
|
|
53
|
+
* (server-side faults: shape-only artifact, connector unavailable, signature drift, unsupported
|
|
54
|
+
* fulfilment, policy denial) is an internal protocol error. The split is intentional and auditable.
|
|
55
|
+
*/
|
|
56
|
+
export function mapExecutionError(error) {
|
|
57
|
+
if (TOOL_EXECUTION_ERRORS.has(error.code)) {
|
|
58
|
+
return { result: { content: [{ type: 'text', text: error.message }], isError: true } };
|
|
59
|
+
}
|
|
60
|
+
if (INVALID_PARAMS_ERRORS.has(error.code)) {
|
|
61
|
+
return { error: { code: JSON_RPC.INVALID_PARAMS, message: error.message } };
|
|
62
|
+
}
|
|
63
|
+
return { error: { code: JSON_RPC.INTERNAL_ERROR, message: error.message } };
|
|
64
|
+
}
|
|
65
|
+
function descriptorFields(r) {
|
|
66
|
+
return {
|
|
67
|
+
...(r.title !== undefined ? { title: r.title } : {}),
|
|
68
|
+
...(r.description !== undefined ? { description: r.description } : {}),
|
|
69
|
+
...(r.mimeType !== undefined ? { mimeType: r.mimeType } : {}),
|
|
70
|
+
...(r._meta !== undefined ? { _meta: r._meta } : {}),
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
/** Map the artifact's fixed (non-templated) resources to a `resources/list` result. */
|
|
74
|
+
export function mapResourcesList(artifact) {
|
|
75
|
+
const resources = (artifact.resources ?? [])
|
|
76
|
+
.filter((r) => !r.isTemplate)
|
|
77
|
+
.map((r) => ({ uri: r.uri, name: r.name, ...descriptorFields(r) }));
|
|
78
|
+
return { resources };
|
|
79
|
+
}
|
|
80
|
+
/** Map the artifact's templated resources to a `resources/templates/list` result. */
|
|
81
|
+
export function mapResourceTemplatesList(artifact) {
|
|
82
|
+
const resourceTemplates = (artifact.resources ?? [])
|
|
83
|
+
.filter((r) => r.isTemplate)
|
|
84
|
+
.map((r) => ({ uriTemplate: r.uri, name: r.name, ...descriptorFields(r) }));
|
|
85
|
+
return { resourceTemplates };
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Map an executed resource's output to `resources/read` contents. The fulfilment output is the
|
|
89
|
+
* single-key `{ value }` wrapper (the authoring convention); `value` is interpreted as: a string → a
|
|
90
|
+
* text content with the resource's mime type; an object with `text` or `blob` → that content verbatim;
|
|
91
|
+
* anything else → a JSON-serialized text content.
|
|
92
|
+
*/
|
|
93
|
+
export function mapResourceContents(uri, mimeType, output) {
|
|
94
|
+
const value = unwrap(output);
|
|
95
|
+
// For an MCP Apps widget (`text/html;profile=mcp-app`), inject the ext-apps client bridge into the body
|
|
96
|
+
// so the host renders it (a no-op for every other mime type). See ./widget/inject.ts.
|
|
97
|
+
const withMime = (text) => {
|
|
98
|
+
const body = injectWidgetBridge(mimeType, text);
|
|
99
|
+
return mimeType !== undefined ? { uri, mimeType, text: body } : { uri, text: body };
|
|
100
|
+
};
|
|
101
|
+
if (typeof value === 'string')
|
|
102
|
+
return { contents: [withMime(value)] };
|
|
103
|
+
if (value !== null && typeof value === 'object') {
|
|
104
|
+
const o = value;
|
|
105
|
+
if (typeof o.text === 'string')
|
|
106
|
+
return { contents: [withMime(o.text)] };
|
|
107
|
+
if (typeof o.blob === 'string') {
|
|
108
|
+
const mt = typeof o.mimeType === 'string' ? o.mimeType : mimeType;
|
|
109
|
+
return {
|
|
110
|
+
contents: [mt !== undefined ? { uri, mimeType: mt, blob: o.blob } : { uri, blob: o.blob }],
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
return { contents: [withMime(JSON.stringify(value))] };
|
|
115
|
+
}
|
|
116
|
+
/** Map the artifact's prompts to a `prompts/list` result. */
|
|
117
|
+
export function mapPromptsList(artifact) {
|
|
118
|
+
const prompts = (artifact.prompts ?? []).map((p) => ({
|
|
119
|
+
name: p.name,
|
|
120
|
+
...(p.title !== undefined ? { title: p.title } : {}),
|
|
121
|
+
...(p.description !== undefined ? { description: p.description } : {}),
|
|
122
|
+
...(p.arguments
|
|
123
|
+
? {
|
|
124
|
+
arguments: p.arguments.map((a) => ({
|
|
125
|
+
name: a.name,
|
|
126
|
+
...(a.description !== undefined ? { description: a.description } : {}),
|
|
127
|
+
...(a.required !== undefined ? { required: a.required } : {}),
|
|
128
|
+
})),
|
|
129
|
+
}
|
|
130
|
+
: {}),
|
|
131
|
+
}));
|
|
132
|
+
return { prompts };
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Map an executed prompt's output to `prompts/get` messages. `value` (unwrapped from `{ value }`) is
|
|
136
|
+
* interpreted as: a string → one `user` text message; an array of `{ role, text }` (or wire-shaped
|
|
137
|
+
* messages) → those messages; an object with `messages` → those; otherwise → one `user` JSON message.
|
|
138
|
+
*/
|
|
139
|
+
export function mapPromptMessages(output, description) {
|
|
140
|
+
const messages = toMessages(unwrap(output));
|
|
141
|
+
return description !== undefined ? { description, messages } : { messages };
|
|
142
|
+
}
|
|
143
|
+
function toMessages(value) {
|
|
144
|
+
if (typeof value === 'string')
|
|
145
|
+
return [userText(value)];
|
|
146
|
+
if (Array.isArray(value))
|
|
147
|
+
return value.map(normalizeMessage);
|
|
148
|
+
if (value !== null && typeof value === 'object') {
|
|
149
|
+
const o = value;
|
|
150
|
+
if (Array.isArray(o.messages))
|
|
151
|
+
return o.messages.map(normalizeMessage);
|
|
152
|
+
if (typeof o.text === 'string')
|
|
153
|
+
return [userText(o.text)];
|
|
154
|
+
}
|
|
155
|
+
return [userText(JSON.stringify(value))];
|
|
156
|
+
}
|
|
157
|
+
function normalizeMessage(raw) {
|
|
158
|
+
const m = (raw !== null && typeof raw === 'object' ? raw : {});
|
|
159
|
+
const role = m.role === 'assistant' ? 'assistant' : 'user';
|
|
160
|
+
const content = m.content;
|
|
161
|
+
const text = typeof m.text === 'string'
|
|
162
|
+
? m.text
|
|
163
|
+
: typeof content?.text === 'string'
|
|
164
|
+
? content.text
|
|
165
|
+
: JSON.stringify(raw);
|
|
166
|
+
return { role, content: { type: 'text', text } };
|
|
167
|
+
}
|
|
168
|
+
function userText(text) {
|
|
169
|
+
return { role: 'user', content: { type: 'text', text } };
|
|
170
|
+
}
|
|
171
|
+
/** Unwrap the `{ value }` fulfilment-output wrapper used by resources/prompts; pass through otherwise. */
|
|
172
|
+
function unwrap(output) {
|
|
173
|
+
if (output !== null &&
|
|
174
|
+
typeof output === 'object' &&
|
|
175
|
+
!Array.isArray(output) &&
|
|
176
|
+
'value' in output) {
|
|
177
|
+
return output.value;
|
|
178
|
+
}
|
|
179
|
+
return output;
|
|
180
|
+
}
|
|
181
|
+
//# sourceMappingURL=mapping.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mapping.js","sourceRoot":"","sources":["../src/mapping.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,QAAQ,EAA2B,MAAM,cAAc,CAAC;AACjE,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AA0CxD,2GAA2G;AAC3G,MAAM,UAAU,OAAO,CAAC,IAAkB;IACxC,OAAO;QACL,IAAI,EAAE,IAAI,CAAC,IAAI;QACf,WAAW,EAAE,IAAI,CAAC,WAAW;QAC7B,WAAW,EAAE,IAAI,CAAC,WAAW;QAC7B,GAAG,CAAC,IAAI,CAAC,YAAY,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,YAAY,EAAE,IAAI,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC/E,GAAG,CAAC,IAAI,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KAC3D,CAAC;AACJ,CAAC;AAED;;;;;GAKG;AACH,SAAS,cAAc,CAAC,IAAkB;IACxC,MAAM,UAAU,GAAG,IAAI,CAAC,KAAK,EAAE,EAAE,EAAE,UAAU,CAAC;IAC9C,uGAAuG;IACvG,gCAAgC;IAChC,OAAO,UAAU,KAAK,SAAS,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC,IAAI,UAAU,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;AAC7F,CAAC;AAED,iHAAiH;AACjH,MAAM,UAAU,YAAY,CAAC,QAAyB;I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AAE,MAAM,EAAE,IAAI,EAAE,EAAE,CAAC;AAC3D,CAAC;AAED,0GAA0G;AAC1G,SAAS,MAAM,CAAC,MAAe;IAC7B,IACE,MAAM,KAAK,IAAI;QACf,OAAO,MAAM,KAAK,QAAQ;QAC1B,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC;QACtB,OAAO,IAAI,MAAM,EACjB,CAAC;QACD,OAAQ,MAA6B,CAAC,KAAK,CAAC;IAC9C,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ProtocolAdapter } from './adapter.js';
|
|
2
|
+
import type { ProtocolRegistry } from './registry.js';
|
|
3
|
+
/**
|
|
4
|
+
* Choose the protocol adapter for a session given the version the client requested at `initialize`.
|
|
5
|
+
*
|
|
6
|
+
* Per the MCP lifecycle spec: if the server supports the requested version it MUST respond with the
|
|
7
|
+
* same version; otherwise it MUST respond with another version it supports (its latest). The client
|
|
8
|
+
* then decides whether to proceed or disconnect. So an unknown/RC-only/garbage request negotiates
|
|
9
|
+
* **down** to the advertised stable `latest()` — the chosen adapter's `version` is what the server
|
|
10
|
+
* echoes back in the initialize result.
|
|
11
|
+
*/
|
|
12
|
+
export declare function negotiate(registry: ProtocolRegistry, requestedVersion: unknown): ProtocolAdapter;
|
|
13
|
+
//# sourceMappingURL=negotiate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"negotiate.d.ts","sourceRoot":"","sources":["../src/negotiate.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAEtD;;;;;;;;GAQG;AACH,wBAAgB,SAAS,CAAC,QAAQ,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,OAAO,GAAG,eAAe,CAMhG"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Choose the protocol adapter for a session given the version the client requested at `initialize`.
|
|
3
|
+
*
|
|
4
|
+
* Per the MCP lifecycle spec: if the server supports the requested version it MUST respond with the
|
|
5
|
+
* same version; otherwise it MUST respond with another version it supports (its latest). The client
|
|
6
|
+
* then decides whether to proceed or disconnect. So an unknown/RC-only/garbage request negotiates
|
|
7
|
+
* **down** to the advertised stable `latest()` — the chosen adapter's `version` is what the server
|
|
8
|
+
* echoes back in the initialize result.
|
|
9
|
+
*/
|
|
10
|
+
export function negotiate(registry, requestedVersion) {
|
|
11
|
+
if (typeof requestedVersion === 'string') {
|
|
12
|
+
const exact = registry.get(requestedVersion);
|
|
13
|
+
if (exact)
|
|
14
|
+
return exact;
|
|
15
|
+
}
|
|
16
|
+
return registry.latest();
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=negotiate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"negotiate.js","sourceRoot":"","sources":["../src/negotiate.ts"],"names":[],"mappings":"AAGA;;;;;;;;GAQG;AACH,MAAM,UAAU,SAAS,CAAC,QAA0B,EAAE,gBAAyB;IAC7E,IAAI,OAAO,gBAAgB,KAAK,QAAQ,EAAE,CAAC;QACzC,MAAM,KAAK,GAAG,QAAQ,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC;QAC7C,IAAI,KAAK;YAAE,OAAO,KAAK,CAAC;IAC1B,CAAC;IACD,OAAO,QAAQ,CAAC,MAAM,EAAE,CAAC;AAC3B,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ProtocolAdapter } from './adapter.js';
|
|
2
|
+
/**
|
|
3
|
+
* The set of protocol versions a server supports, keyed by version string. The first stable adapter
|
|
4
|
+
* registered is the advertised `latest()` — the version the server falls back to when a client asks
|
|
5
|
+
* for one it does not support. A release-candidate adapter is added with `register()` but is **not**
|
|
6
|
+
* advertised as latest until its spec is final (docs/SPEC.md "do not advertise a final `2026-07-28`
|
|
7
|
+
* until final"); it is honored only when a client requests it explicitly.
|
|
8
|
+
*/
|
|
9
|
+
export declare class ProtocolRegistry {
|
|
10
|
+
#private;
|
|
11
|
+
constructor(adapters?: readonly ProtocolAdapter[]);
|
|
12
|
+
register(adapter: ProtocolAdapter): void;
|
|
13
|
+
get(version: string): ProtocolAdapter | undefined;
|
|
14
|
+
/** The stable version advertised when negotiation cannot honor the requested version. */
|
|
15
|
+
latest(): ProtocolAdapter;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../src/registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAEpD;;;;;;GAMG;AACH,qBAAa,gBAAgB;;gBAIf,QAAQ,GAAE,SAAS,eAAe,EAAO;IAIrD,QAAQ,CAAC,OAAO,EAAE,eAAe,GAAG,IAAI;IAQxC,GAAG,CAAC,OAAO,EAAE,MAAM,GAAG,eAAe,GAAG,SAAS;IAIjD,yFAAyF;IACzF,MAAM,IAAI,eAAe;CAI1B"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The set of protocol versions a server supports, keyed by version string. The first stable adapter
|
|
3
|
+
* registered is the advertised `latest()` — the version the server falls back to when a client asks
|
|
4
|
+
* for one it does not support. A release-candidate adapter is added with `register()` but is **not**
|
|
5
|
+
* advertised as latest until its spec is final (docs/SPEC.md "do not advertise a final `2026-07-28`
|
|
6
|
+
* until final"); it is honored only when a client requests it explicitly.
|
|
7
|
+
*/
|
|
8
|
+
export class ProtocolRegistry {
|
|
9
|
+
#byVersion = new Map();
|
|
10
|
+
#latest;
|
|
11
|
+
constructor(adapters = []) {
|
|
12
|
+
for (const adapter of adapters)
|
|
13
|
+
this.register(adapter);
|
|
14
|
+
}
|
|
15
|
+
register(adapter) {
|
|
16
|
+
this.#byVersion.set(adapter.version, adapter);
|
|
17
|
+
// The advertised "latest" is the newest *stable* adapter, never a release candidate.
|
|
18
|
+
if (adapter.status === 'stable') {
|
|
19
|
+
if (!this.#latest || adapter.version > this.#latest.version)
|
|
20
|
+
this.#latest = adapter;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
get(version) {
|
|
24
|
+
return this.#byVersion.get(version);
|
|
25
|
+
}
|
|
26
|
+
/** The stable version advertised when negotiation cannot honor the requested version. */
|
|
27
|
+
latest() {
|
|
28
|
+
if (!this.#latest)
|
|
29
|
+
throw new Error('no stable protocol adapter registered');
|
|
30
|
+
return this.#latest;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=registry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.js","sourceRoot":"","sources":["../src/registry.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,MAAM,OAAO,gBAAgB;IAClB,UAAU,GAAG,IAAI,GAAG,EAA2B,CAAC;IACzD,OAAO,CAA8B;IAErC,YAAY,WAAuC,EAAE;QACnD,KAAK,MAAM,OAAO,IAAI,QAAQ;YAAE,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;IACzD,CAAC;IAED,QAAQ,CAAC,OAAwB;QAC/B,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QAC9C,qFAAqF;QACrF,IAAI,OAAO,CAAC,MAAM,KAAK,QAAQ,EAAE,CAAC;YAChC,IAAI,CAAC,IAAI,CAAC,OAAO,IAAI,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO;gBAAE,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACtF,CAAC;IACH,CAAC;IAED,GAAG,CAAC,OAAe;QACjB,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IACtC,CAAC;IAED,yFAAyF;IACzF,MAAM;QACJ,IAAI,CAAC,IAAI,CAAC,OAAO;YAAE,MAAM,IAAI,KAAK,CAAC,uCAAuC,CAAC,CAAC;QAC5E,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;CACF"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
|
|
2
|
+
import { type RuntimeArtifact } from '@noodle-borg/compiler';
|
|
3
|
+
import { type ExecuteDeps } from '@noodle-borg/runtime';
|
|
4
|
+
/**
|
|
5
|
+
* A resolved artifact plus the execution dependencies (connector registry + credential broker) needed
|
|
6
|
+
* to serve it. This is the unit the transport routes to — the wire layer holds no state of its own; a
|
|
7
|
+
* fresh {@link Server} is built per request (see {@link handleStatelessHttp}).
|
|
8
|
+
*/
|
|
9
|
+
export interface ServedArtifact {
|
|
10
|
+
readonly artifact: RuntimeArtifact;
|
|
11
|
+
readonly deps: ExecuteDeps;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Build an official `@modelcontextprotocol/sdk` {@link Server} bound to a resolved artifact. The SDK
|
|
15
|
+
* owns the wire (JSON-RPC framing, capability negotiation, protocol-version handling); this function is
|
|
16
|
+
* the thin gateway that registers handlers translating each MCP method to the version-agnostic
|
|
17
|
+
* execution plane via our {@link mapping} helpers ([ADR 0006] amended, [ADR 0021]). The execution core
|
|
18
|
+
* never sees a JSON-RPC frame. Resource and prompt surfaces are registered (and advertised) only when
|
|
19
|
+
* the artifact provides them.
|
|
20
|
+
*/
|
|
21
|
+
export declare function buildMcpServer({ artifact, deps }: ServedArtifact): Server;
|
|
22
|
+
//# sourceMappingURL=sdk-server.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sdk-server.d.ts","sourceRoot":"","sources":["../src/sdk-server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AAmBnE,OAAO,EAAoB,KAAK,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC/E,OAAO,EACL,KAAK,WAAW,EAIjB,MAAM,sBAAsB,CAAC;AAe9B;;;;GAIG;AACH,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,QAAQ,EAAE,eAAe,CAAC;IACnC,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;CAC5B;AAED;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,EAAE,cAAc,GAAG,MAAM,CAoBzE"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
|
|
2
|
+
import { CallToolRequestSchema, ErrorCode, GetPromptRequestSchema, ListPromptsRequestSchema, ListResourcesRequestSchema, ListResourceTemplatesRequestSchema, ListToolsRequestSchema, McpError, ReadResourceRequestSchema, } from '@modelcontextprotocol/sdk/types.js';
|
|
3
|
+
import { parseUriTemplate } from '@noodle-borg/compiler';
|
|
4
|
+
import { executePrompt, executeResource, executeTool, } from '@noodle-borg/runtime';
|
|
5
|
+
import { mapExecutionError, mapPromptMessages, mapPromptsList, mapResourceContents, mapResourcesList, mapResourceTemplatesList, mapToolOutput, mapToolsList, } from './mapping.js';
|
|
6
|
+
/** MCP "resource not found" JSON-RPC error code (not in the SDK's `ErrorCode` enum). */
|
|
7
|
+
const RESOURCE_NOT_FOUND = -32002;
|
|
8
|
+
/**
|
|
9
|
+
* Build an official `@modelcontextprotocol/sdk` {@link Server} bound to a resolved artifact. The SDK
|
|
10
|
+
* owns the wire (JSON-RPC framing, capability negotiation, protocol-version handling); this function is
|
|
11
|
+
* the thin gateway that registers handlers translating each MCP method to the version-agnostic
|
|
12
|
+
* execution plane via our {@link mapping} helpers ([ADR 0006] amended, [ADR 0021]). The execution core
|
|
13
|
+
* never sees a JSON-RPC frame. Resource and prompt surfaces are registered (and advertised) only when
|
|
14
|
+
* the artifact provides them.
|
|
15
|
+
*/
|
|
16
|
+
export function buildMcpServer({ artifact, deps }) {
|
|
17
|
+
const hasResources = (artifact.resources?.length ?? 0) > 0;
|
|
18
|
+
const hasPrompts = (artifact.prompts?.length ?? 0) > 0;
|
|
19
|
+
const server = new Server({ name: artifact.server.name, title: artifact.server.title, version: artifact.server.version }, {
|
|
20
|
+
capabilities: {
|
|
21
|
+
tools: {},
|
|
22
|
+
...(hasResources ? { resources: {} } : {}),
|
|
23
|
+
...(hasPrompts ? { prompts: {} } : {}),
|
|
24
|
+
},
|
|
25
|
+
});
|
|
26
|
+
registerTools(server, artifact, deps);
|
|
27
|
+
if (hasResources)
|
|
28
|
+
registerResources(server, artifact, deps);
|
|
29
|
+
if (hasPrompts)
|
|
30
|
+
registerPrompts(server, artifact, deps);
|
|
31
|
+
return server;
|
|
32
|
+
}
|
|
33
|
+
function registerTools(server, artifact, deps) {
|
|
34
|
+
// Our mapping helpers return structural subsets of the SDK's result unions; the `as` casts pick the
|
|
35
|
+
// intended union arm (the SDK union also has a Tasks arm that requires a `task` field we never emit).
|
|
36
|
+
server.setRequestHandler(ListToolsRequestSchema, () => mapToolsList(artifact));
|
|
37
|
+
server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
38
|
+
const result = await executeTool(artifact, request.params.name, request.params.arguments ?? {}, deps);
|
|
39
|
+
if (result.ok)
|
|
40
|
+
return mapToolOutput(result.output);
|
|
41
|
+
// Two channels (docs/SPEC.md "Error Translation Matrix"): model-actionable failures become an
|
|
42
|
+
// `isError` tool result; protocol faults are thrown as a JSON-RPC error the SDK serializes.
|
|
43
|
+
const outcome = mapExecutionError(result.error);
|
|
44
|
+
if ('result' in outcome)
|
|
45
|
+
return outcome.result;
|
|
46
|
+
throw new McpError(outcome.error.code, outcome.error.message);
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
function registerResources(server, artifact, deps) {
|
|
50
|
+
server.setRequestHandler(ListResourcesRequestSchema, () => mapResourcesList(artifact));
|
|
51
|
+
server.setRequestHandler(ListResourceTemplatesRequestSchema, () => mapResourceTemplatesList(artifact));
|
|
52
|
+
server.setRequestHandler(ReadResourceRequestSchema, async (request) => {
|
|
53
|
+
const { uri } = request.params;
|
|
54
|
+
for (const resource of artifact.resources ?? []) {
|
|
55
|
+
const variables = matchResourceUri(resource.uri, resource.isTemplate, uri);
|
|
56
|
+
if (variables === null)
|
|
57
|
+
continue;
|
|
58
|
+
const result = await executeResource(artifact, resource.name, variables, deps);
|
|
59
|
+
if (!result.ok)
|
|
60
|
+
throw new McpError(ErrorCode.InternalError, result.error.message);
|
|
61
|
+
return mapResourceContents(uri, resource.mimeType, result.output);
|
|
62
|
+
}
|
|
63
|
+
throw new McpError(RESOURCE_NOT_FOUND, `resource not found: ${uri}`);
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
/** Return the URI variables a resource matches, or `null` if it does not match the requested URI. */
|
|
67
|
+
function matchResourceUri(pattern, isTemplate, uri) {
|
|
68
|
+
if (!isTemplate)
|
|
69
|
+
return pattern === uri ? {} : null;
|
|
70
|
+
const parsed = parseUriTemplate(pattern);
|
|
71
|
+
return parsed.ok && parsed.value.kind === 'template' ? parsed.value.match(uri) : null;
|
|
72
|
+
}
|
|
73
|
+
function registerPrompts(server, artifact, deps) {
|
|
74
|
+
server.setRequestHandler(ListPromptsRequestSchema, () => mapPromptsList(artifact));
|
|
75
|
+
server.setRequestHandler(GetPromptRequestSchema, async (request) => {
|
|
76
|
+
const { name, arguments: args } = request.params;
|
|
77
|
+
const prompt = (artifact.prompts ?? []).find((p) => p.name === name);
|
|
78
|
+
if (!prompt)
|
|
79
|
+
throw new McpError(ErrorCode.InvalidParams, `unknown prompt "${name}"`);
|
|
80
|
+
for (const argument of prompt.arguments ?? []) {
|
|
81
|
+
if (argument.required && args?.[argument.name] === undefined) {
|
|
82
|
+
throw new McpError(ErrorCode.InvalidParams, `missing required argument "${argument.name}"`);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
const result = await executePrompt(artifact, name, args ?? {}, deps);
|
|
86
|
+
if (!result.ok)
|
|
87
|
+
throw new McpError(ErrorCode.InternalError, result.error.message);
|
|
88
|
+
return mapPromptMessages(result.output, prompt.description);
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
//# sourceMappingURL=sdk-server.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sdk-server.js","sourceRoot":"","sources":["../src/sdk-server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AACnE,OAAO,EACL,qBAAqB,EAErB,SAAS,EACT,sBAAsB,EACtB,wBAAwB,EACxB,0BAA0B,EAC1B,kCAAkC,EAClC,sBAAsB,EAEtB,QAAQ,EACR,yBAAyB,GAM1B,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAwB,MAAM,uBAAuB,CAAC;AAC/E,OAAO,EAEL,aAAa,EACb,eAAe,EACf,WAAW,GACZ,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,iBAAiB,EACjB,iBAAiB,EACjB,cAAc,EACd,mBAAmB,EACnB,gBAAgB,EAChB,wBAAwB,EACxB,aAAa,EACb,YAAY,GACb,MAAM,cAAc,CAAC;AAEtB,wFAAwF;AACxF,MAAM,kBAAkB,GAAG,CAAC,KAAK,CAAC;AAYlC;;;;;;;GAOG;AACH,MAAM,UAAU,cAAc,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAkB;IAC/D,MAAM,YAAY,GAAG,CAAC,QAAQ,CAAC,SAAS,EAAE,MAAM,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;IAC3D,MAAM,UAAU,GAAG,CAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;IAEvD,MAAM,MAAM,GAAG,IAAI,MAAM,CACvB,EAAE,IAAI,EAAE,QAAQ,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC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AS,EAAE,CAAC;gBAC7D,MAAM,IAAI,QAAQ,CAAC,SAAS,CAAC,aAAa,EAAE,8BAA8B,QAAQ,CAAC,IAAI,GAAG,CAAC,CAAC;YAC9F,CAAC;QACH,CAAC;QAED,MAAM,MAAM,GAAG,MAAM,aAAa,CAAC,QAAQ,EAAE,IAAI,EAAE,IAAI,IAAI,EAAE,EAAE,IAAI,CAAC,CAAC;QACrE,IAAI,CAAC,MAAM,CAAC,EAAE;YAAE,MAAM,IAAI,QAAQ,CAAC,SAAS,CAAC,aAAa,EAAE,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QAClF,OAAO,iBAAiB,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,WAAW,CAAuB,CAAC;IACpF,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { RuntimeArtifact } from '@noodle-borg/compiler';
|
|
2
|
+
import type { ExecuteDeps } from '@noodle-borg/runtime';
|
|
3
|
+
import type { ProtocolAdapter } from './adapter.js';
|
|
4
|
+
import { type JsonRpcMessage, type JsonRpcResponse } from './jsonrpc.js';
|
|
5
|
+
import { ProtocolRegistry } from './registry.js';
|
|
6
|
+
/** Per-connection state: the protocol version negotiated at `initialize`. */
|
|
7
|
+
export declare class McpSession {
|
|
8
|
+
adapter: ProtocolAdapter | undefined;
|
|
9
|
+
}
|
|
10
|
+
export interface McpServerOptions {
|
|
11
|
+
readonly artifact: RuntimeArtifact;
|
|
12
|
+
readonly deps: ExecuteDeps;
|
|
13
|
+
/** Defaults to a registry holding the stable `2025-11-25` adapter. */
|
|
14
|
+
readonly registry?: ProtocolRegistry;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* A transport-agnostic MCP server for one resolved artifact. `handleMessage` maps a parsed JSON-RPC
|
|
18
|
+
* message to a response (or `null` for notifications), dispatching to the session's negotiated
|
|
19
|
+
* protocol adapter. A stdio/HTTP transport that frames bytes and carries the `MCP-Protocol-Version`
|
|
20
|
+
* header is a separate, later layer.
|
|
21
|
+
*/
|
|
22
|
+
export declare class McpServer {
|
|
23
|
+
#private;
|
|
24
|
+
constructor(options: McpServerOptions);
|
|
25
|
+
/** Open a new session (one per client connection). */
|
|
26
|
+
createSession(): McpSession;
|
|
27
|
+
handleMessage(session: McpSession, message: JsonRpcMessage): Promise<JsonRpcResponse | null>;
|
|
28
|
+
/**
|
|
29
|
+
* Handle a single message without a caller-held session — for stateless transports (e.g. remote
|
|
30
|
+
* HTTP). `initialize` negotiates from the message body; every other request negotiates from
|
|
31
|
+
* `requestedVersion` (the transport's `MCP-Protocol-Version` header), defaulting to the stable
|
|
32
|
+
* latest when absent. No session state is retained between calls.
|
|
33
|
+
*/
|
|
34
|
+
handleStateless(message: JsonRpcMessage, requestedVersion?: string): Promise<JsonRpcResponse | null>;
|
|
35
|
+
/** Whether the server supports a given protocol version (an exact registered adapter). */
|
|
36
|
+
supports(version: string): boolean;
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=server.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,KAAK,EAAoB,eAAe,EAAmB,MAAM,cAAc,CAAC;AAEvF,OAAO,EAIL,KAAK,cAAc,EACnB,KAAK,eAAe,EAErB,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAEjD,6EAA6E;AAC7E,qBAAa,UAAU;IACrB,OAAO,EAAE,eAAe,GAAG,SAAS,CAAa;CAClD;AAED,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,QAAQ,EAAE,eAAe,CAAC;IACnC,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;IAC3B,sEAAsE;IACtE,QAAQ,CAAC,QAAQ,CAAC,EAAE,gBAAgB,CAAC;CACtC;AAED;;;;;GAKG;AACH,qBAAa,SAAS;;gBAKR,OAAO,EAAE,gBAAgB;IAMrC,sDAAsD;IACtD,aAAa,IAAI,UAAU;IAIrB,aAAa,CACjB,OAAO,EAAE,UAAU,EACnB,OAAO,EAAE,cAAc,GACtB,OAAO,CAAC,eAAe,GAAG,IAAI,CAAC;IA6ClC;;;;;OAKG;IACG,eAAe,CACnB,OAAO,EAAE,cAAc,EACvB,gBAAgB,CAAC,EAAE,MAAM,GACxB,OAAO,CAAC,eAAe,GAAG,IAAI,CAAC;IAQlC,0FAA0F;IAC1F,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO;CAGnC"}
|