@noodleseed/one 0.36.0 → 0.37.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commands/mcp-apps.d.ts.map +1 -1
- package/dist/commands/mcp-apps.js +15 -8
- package/dist/commands/mcp-apps.js.map +1 -1
- package/dist/widget-scaffold-template.js +1 -1
- package/node_modules/@noodle-borg/agent-kit/dist/curated/error-fixes.d.ts.map +1 -1
- package/node_modules/@noodle-borg/agent-kit/dist/curated/error-fixes.js +6 -1
- package/node_modules/@noodle-borg/agent-kit/dist/curated/error-fixes.js.map +1 -1
- package/node_modules/@noodle-borg/agent-kit/dist/curated/hook-notes.d.ts.map +1 -1
- package/node_modules/@noodle-borg/agent-kit/dist/curated/hook-notes.js +2 -0
- package/node_modules/@noodle-borg/agent-kit/dist/curated/hook-notes.js.map +1 -1
- package/node_modules/@noodle-borg/agent-kit/dist/generated/example-files.js +9 -9
- package/node_modules/@noodle-borg/agent-kit/dist/generated/example-files.js.map +1 -1
- package/node_modules/@noodle-borg/agent-kit/dist/generated/surface.d.ts.map +1 -1
- package/node_modules/@noodle-borg/agent-kit/dist/generated/surface.js +7 -0
- package/node_modules/@noodle-borg/agent-kit/dist/generated/surface.js.map +1 -1
- package/node_modules/@noodle-borg/agent-kit/dist/skill-authoring-refs.d.ts.map +1 -1
- package/node_modules/@noodle-borg/agent-kit/dist/skill-authoring-refs.js +76 -8
- package/node_modules/@noodle-borg/agent-kit/dist/skill-authoring-refs.js.map +1 -1
- package/node_modules/@noodle-borg/agent-kit/dist/skill-content.js +2 -2
- package/node_modules/@noodle-borg/agent-kit/dist/skill-content.js.map +1 -1
- package/node_modules/@noodle-borg/agent-kit/dist/skill-embedded-assistant-ref.d.ts.map +1 -1
- package/node_modules/@noodle-borg/agent-kit/dist/skill-embedded-assistant-ref.js +90 -9
- package/node_modules/@noodle-borg/agent-kit/dist/skill-embedded-assistant-ref.js.map +1 -1
- package/node_modules/@noodle-borg/auth/dist/jwt-issuer.d.ts +4 -0
- package/node_modules/@noodle-borg/auth/dist/jwt-issuer.d.ts.map +1 -1
- package/node_modules/@noodle-borg/auth/dist/jwt-issuer.js +2 -0
- package/node_modules/@noodle-borg/auth/dist/jwt-issuer.js.map +1 -1
- package/node_modules/@noodle-borg/auth/dist/verify.d.ts +4 -0
- package/node_modules/@noodle-borg/auth/dist/verify.d.ts.map +1 -1
- package/node_modules/@noodle-borg/auth/dist/verify.js +26 -0
- package/node_modules/@noodle-borg/auth/dist/verify.js.map +1 -1
- package/node_modules/@noodle-borg/authoring/dist/context.d.ts +25 -0
- package/node_modules/@noodle-borg/authoring/dist/context.d.ts.map +1 -0
- package/node_modules/@noodle-borg/authoring/dist/context.js +34 -0
- package/node_modules/@noodle-borg/authoring/dist/context.js.map +1 -0
- package/node_modules/@noodle-borg/authoring/dist/index.d.ts +2 -1
- package/node_modules/@noodle-borg/authoring/dist/index.d.ts.map +1 -1
- package/node_modules/@noodle-borg/authoring/dist/index.js.map +1 -1
- package/node_modules/@noodle-borg/authoring/dist/react/bridge.d.ts +9 -0
- package/node_modules/@noodle-borg/authoring/dist/react/bridge.d.ts.map +1 -1
- package/node_modules/@noodle-borg/authoring/dist/react/bridge.js.map +1 -1
- package/node_modules/@noodle-borg/authoring/dist/react/hooks.d.ts +8 -2
- package/node_modules/@noodle-borg/authoring/dist/react/hooks.d.ts.map +1 -1
- package/node_modules/@noodle-borg/authoring/dist/react/hooks.js +46 -1
- package/node_modules/@noodle-borg/authoring/dist/react/hooks.js.map +1 -1
- package/node_modules/@noodle-borg/authoring/dist/react/index.d.ts +2 -2
- package/node_modules/@noodle-borg/authoring/dist/react/index.d.ts.map +1 -1
- package/node_modules/@noodle-borg/authoring/dist/react/index.js +1 -1
- package/node_modules/@noodle-borg/authoring/dist/react/index.js.map +1 -1
- package/node_modules/@noodle-borg/authoring/dist/react/model-context-validation.d.ts +4 -0
- package/node_modules/@noodle-borg/authoring/dist/react/model-context-validation.d.ts.map +1 -0
- package/node_modules/@noodle-borg/authoring/dist/react/model-context-validation.js +94 -0
- package/node_modules/@noodle-borg/authoring/dist/react/model-context-validation.js.map +1 -0
- package/node_modules/@noodle-borg/authoring/dist/recording.d.ts +19 -2
- package/node_modules/@noodle-borg/authoring/dist/recording.d.ts.map +1 -1
- package/node_modules/@noodle-borg/authoring/dist/recording.js +71 -8
- package/node_modules/@noodle-borg/authoring/dist/recording.js.map +1 -1
- package/node_modules/@noodle-borg/authoring/dist/server.d.ts +23 -0
- package/node_modules/@noodle-borg/authoring/dist/server.d.ts.map +1 -1
- package/node_modules/@noodle-borg/authoring/dist/server.js +6 -0
- package/node_modules/@noodle-borg/authoring/dist/server.js.map +1 -1
- package/node_modules/@noodle-borg/compiler/dist/artifact/config.d.ts +2 -2
- package/node_modules/@noodle-borg/compiler/dist/artifact/config.d.ts.map +1 -1
- package/node_modules/@noodle-borg/compiler/dist/artifact/config.js +4 -1
- package/node_modules/@noodle-borg/compiler/dist/artifact/config.js.map +1 -1
- package/node_modules/@noodle-borg/compiler/dist/artifact/consent.d.ts +4 -6
- package/node_modules/@noodle-borg/compiler/dist/artifact/consent.d.ts.map +1 -1
- package/node_modules/@noodle-borg/compiler/dist/artifact/consent.js +6 -6
- package/node_modules/@noodle-borg/compiler/dist/artifact/consent.js.map +1 -1
- package/node_modules/@noodle-borg/compiler/dist/artifact/types.d.ts +23 -6
- package/node_modules/@noodle-borg/compiler/dist/artifact/types.d.ts.map +1 -1
- package/node_modules/@noodle-borg/compiler/dist/artifact/types.js +7 -1
- package/node_modules/@noodle-borg/compiler/dist/artifact/types.js.map +1 -1
- package/node_modules/@noodle-borg/compiler/dist/compile.d.ts.map +1 -1
- package/node_modules/@noodle-borg/compiler/dist/compile.js +26 -6
- package/node_modules/@noodle-borg/compiler/dist/compile.js.map +1 -1
- package/node_modules/@noodle-borg/compiler/dist/confirmation-flow.d.ts +9 -0
- package/node_modules/@noodle-borg/compiler/dist/confirmation-flow.d.ts.map +1 -0
- package/node_modules/@noodle-borg/compiler/dist/confirmation-flow.js +36 -0
- package/node_modules/@noodle-borg/compiler/dist/confirmation-flow.js.map +1 -0
- package/node_modules/@noodle-borg/compiler/dist/context-compile.d.ts +18 -0
- package/node_modules/@noodle-borg/compiler/dist/context-compile.d.ts.map +1 -0
- package/node_modules/@noodle-borg/compiler/dist/context-compile.js +28 -0
- package/node_modules/@noodle-borg/compiler/dist/context-compile.js.map +1 -0
- package/node_modules/@noodle-borg/compiler/dist/elicitation-schema.d.ts +5 -0
- package/node_modules/@noodle-borg/compiler/dist/elicitation-schema.d.ts.map +1 -0
- package/node_modules/@noodle-borg/compiler/dist/elicitation-schema.js +108 -0
- package/node_modules/@noodle-borg/compiler/dist/elicitation-schema.js.map +1 -0
- package/node_modules/@noodle-borg/compiler/dist/errors.d.ts +1 -1
- package/node_modules/@noodle-borg/compiler/dist/errors.d.ts.map +1 -1
- package/node_modules/@noodle-borg/compiler/dist/fulfilment-emit.d.ts +3 -1
- package/node_modules/@noodle-borg/compiler/dist/fulfilment-emit.d.ts.map +1 -1
- package/node_modules/@noodle-borg/compiler/dist/fulfilment-emit.js +22 -4
- package/node_modules/@noodle-borg/compiler/dist/fulfilment-emit.js.map +1 -1
- package/node_modules/@noodle-borg/compiler/dist/fulfilment-structural.d.ts +8 -3
- package/node_modules/@noodle-borg/compiler/dist/fulfilment-structural.d.ts.map +1 -1
- package/node_modules/@noodle-borg/compiler/dist/fulfilment-structural.js +16 -3
- package/node_modules/@noodle-borg/compiler/dist/fulfilment-structural.js.map +1 -1
- package/node_modules/@noodle-borg/compiler/dist/index.d.ts +2 -2
- package/node_modules/@noodle-borg/compiler/dist/index.d.ts.map +1 -1
- package/node_modules/@noodle-borg/compiler/dist/index.js +1 -1
- package/node_modules/@noodle-borg/compiler/dist/index.js.map +1 -1
- package/node_modules/@noodle-borg/compiler/dist/manifest/expression.d.ts +1 -1
- package/node_modules/@noodle-borg/compiler/dist/manifest/expression.js +1 -1
- package/node_modules/@noodle-borg/compiler/dist/manifest/expression.js.map +1 -1
- package/node_modules/@noodle-borg/compiler/dist/manifest/schema.d.ts +37 -0
- package/node_modules/@noodle-borg/compiler/dist/manifest/schema.d.ts.map +1 -1
- package/node_modules/@noodle-borg/compiler/dist/manifest/schema.js +27 -4
- package/node_modules/@noodle-borg/compiler/dist/manifest/schema.js.map +1 -1
- package/node_modules/@noodle-borg/module/dist/contract.d.ts +2 -0
- package/node_modules/@noodle-borg/module/dist/contract.d.ts.map +1 -1
- package/node_modules/@noodle-borg/module/dist/contract.js.map +1 -1
- package/node_modules/@noodle-borg/protocol/dist/confirmation-elicitation.d.ts +20 -0
- package/node_modules/@noodle-borg/protocol/dist/confirmation-elicitation.d.ts.map +1 -0
- package/node_modules/@noodle-borg/protocol/dist/confirmation-elicitation.js +159 -0
- package/node_modules/@noodle-borg/protocol/dist/confirmation-elicitation.js.map +1 -0
- package/node_modules/@noodle-borg/protocol/dist/context-tool.d.ts +9 -0
- package/node_modules/@noodle-borg/protocol/dist/context-tool.d.ts.map +1 -0
- package/node_modules/@noodle-borg/protocol/dist/context-tool.js +76 -0
- package/node_modules/@noodle-borg/protocol/dist/context-tool.js.map +1 -0
- package/node_modules/@noodle-borg/protocol/dist/mapping.d.ts +1 -1
- package/node_modules/@noodle-borg/protocol/dist/mapping.d.ts.map +1 -1
- package/node_modules/@noodle-borg/protocol/dist/mapping.js +10 -22
- package/node_modules/@noodle-borg/protocol/dist/mapping.js.map +1 -1
- package/node_modules/@noodle-borg/protocol/dist/sdk-server.d.ts +9 -1
- package/node_modules/@noodle-borg/protocol/dist/sdk-server.d.ts.map +1 -1
- package/node_modules/@noodle-borg/protocol/dist/sdk-server.js +54 -6
- package/node_modules/@noodle-borg/protocol/dist/sdk-server.js.map +1 -1
- package/node_modules/@noodle-borg/protocol/dist/stateless.d.ts.map +1 -1
- package/node_modules/@noodle-borg/protocol/dist/stateless.js +8 -1
- package/node_modules/@noodle-borg/protocol/dist/stateless.js.map +1 -1
- package/node_modules/@noodle-borg/protocol/dist/tool-interaction.d.ts +29 -0
- package/node_modules/@noodle-borg/protocol/dist/tool-interaction.d.ts.map +1 -0
- package/node_modules/@noodle-borg/protocol/dist/tool-interaction.js +74 -0
- package/node_modules/@noodle-borg/protocol/dist/tool-interaction.js.map +1 -0
- package/node_modules/@noodle-borg/protocol/dist/widget/bootstrap.d.ts.map +1 -1
- package/node_modules/@noodle-borg/protocol/dist/widget/bootstrap.js +9 -4
- package/node_modules/@noodle-borg/protocol/dist/widget/bootstrap.js.map +1 -1
- package/node_modules/@noodle-borg/protocol/dist/widget/model-context-bootstrap.d.ts +3 -0
- package/node_modules/@noodle-borg/protocol/dist/widget/model-context-bootstrap.d.ts.map +1 -0
- package/node_modules/@noodle-borg/protocol/dist/widget/model-context-bootstrap.js +80 -0
- package/node_modules/@noodle-borg/protocol/dist/widget/model-context-bootstrap.js.map +1 -0
- package/node_modules/@noodle-borg/protocol/dist/widget/openai-bridge.d.ts.map +1 -1
- package/node_modules/@noodle-borg/protocol/dist/widget/openai-bridge.js +16 -4
- package/node_modules/@noodle-borg/protocol/dist/widget/openai-bridge.js.map +1 -1
- package/node_modules/@noodle-borg/protocol/dist/widget/react-bridge-bootstrap.d.ts +1 -1
- package/node_modules/@noodle-borg/protocol/dist/widget/react-bridge-bootstrap.d.ts.map +1 -1
- package/node_modules/@noodle-borg/protocol/dist/widget/react-bridge-bootstrap.js +2 -0
- package/node_modules/@noodle-borg/protocol/dist/widget/react-bridge-bootstrap.js.map +1 -1
- package/node_modules/@noodle-borg/runtime/dist/ambient-context.d.ts +10 -0
- package/node_modules/@noodle-borg/runtime/dist/ambient-context.d.ts.map +1 -0
- package/node_modules/@noodle-borg/runtime/dist/ambient-context.js +51 -0
- package/node_modules/@noodle-borg/runtime/dist/ambient-context.js.map +1 -0
- package/node_modules/@noodle-borg/runtime/dist/confirmation.d.ts +18 -0
- package/node_modules/@noodle-borg/runtime/dist/confirmation.d.ts.map +1 -0
- package/node_modules/@noodle-borg/runtime/dist/confirmation.js +263 -0
- package/node_modules/@noodle-borg/runtime/dist/confirmation.js.map +1 -0
- package/node_modules/@noodle-borg/runtime/dist/connector/types.d.ts +4 -0
- package/node_modules/@noodle-borg/runtime/dist/connector/types.d.ts.map +1 -1
- package/node_modules/@noodle-borg/runtime/dist/connector/types.js.map +1 -1
- package/node_modules/@noodle-borg/runtime/dist/context-bounds.d.ts +15 -0
- package/node_modules/@noodle-borg/runtime/dist/context-bounds.d.ts.map +1 -0
- package/node_modules/@noodle-borg/runtime/dist/context-bounds.js +123 -0
- package/node_modules/@noodle-borg/runtime/dist/context-bounds.js.map +1 -0
- package/node_modules/@noodle-borg/runtime/dist/elicitation-response.d.ts +13 -0
- package/node_modules/@noodle-borg/runtime/dist/elicitation-response.d.ts.map +1 -0
- package/node_modules/@noodle-borg/runtime/dist/elicitation-response.js +26 -0
- package/node_modules/@noodle-borg/runtime/dist/elicitation-response.js.map +1 -0
- package/node_modules/@noodle-borg/runtime/dist/execute.d.ts +69 -7
- package/node_modules/@noodle-borg/runtime/dist/execute.d.ts.map +1 -1
- package/node_modules/@noodle-borg/runtime/dist/execute.js +136 -33
- package/node_modules/@noodle-borg/runtime/dist/execute.js.map +1 -1
- package/node_modules/@noodle-borg/runtime/dist/index.d.ts +6 -2
- package/node_modules/@noodle-borg/runtime/dist/index.d.ts.map +1 -1
- package/node_modules/@noodle-borg/runtime/dist/index.js +5 -1
- package/node_modules/@noodle-borg/runtime/dist/index.js.map +1 -1
- package/node_modules/@noodle-borg/runtime/dist/interactive.d.ts +8 -0
- package/node_modules/@noodle-borg/runtime/dist/interactive.d.ts.map +1 -0
- package/node_modules/@noodle-borg/runtime/dist/interactive.js +138 -0
- package/node_modules/@noodle-borg/runtime/dist/interactive.js.map +1 -0
- package/node_modules/@noodle-borg/runtime/dist/invocation-context.d.ts +22 -0
- package/node_modules/@noodle-borg/runtime/dist/invocation-context.d.ts.map +1 -0
- package/node_modules/@noodle-borg/runtime/dist/invocation-context.js +2 -0
- package/node_modules/@noodle-borg/runtime/dist/invocation-context.js.map +1 -0
- package/node_modules/@noodle-borg/runtime/dist/result.d.ts +135 -3
- package/node_modules/@noodle-borg/runtime/dist/result.d.ts.map +1 -1
- package/node_modules/@noodle-borg/runtime/dist/result.js +9 -1
- package/node_modules/@noodle-borg/runtime/dist/result.js.map +1 -1
- package/node_modules/@noodle-borg/service/dist/assistant-context.d.ts +25 -0
- package/node_modules/@noodle-borg/service/dist/assistant-context.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/assistant-context.js +130 -0
- package/node_modules/@noodle-borg/service/dist/assistant-context.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/assistant-interaction-state.d.ts +181 -0
- package/node_modules/@noodle-borg/service/dist/assistant-interaction-state.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/assistant-interaction-state.js +293 -0
- package/node_modules/@noodle-borg/service/dist/assistant-interaction-state.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/assistant-interactive.d.ts +92 -0
- package/node_modules/@noodle-borg/service/dist/assistant-interactive.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/assistant-interactive.js +219 -0
- package/node_modules/@noodle-borg/service/dist/assistant-interactive.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/assistant-presentation.d.ts +24 -0
- package/node_modules/@noodle-borg/service/dist/assistant-presentation.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/assistant-presentation.js +151 -0
- package/node_modules/@noodle-borg/service/dist/assistant-presentation.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/assistant-sensitive-values.d.ts +3 -0
- package/node_modules/@noodle-borg/service/dist/assistant-sensitive-values.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/assistant-sensitive-values.js +6 -0
- package/node_modules/@noodle-borg/service/dist/assistant-sensitive-values.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/assistant-store.d.ts +38 -11
- package/node_modules/@noodle-borg/service/dist/assistant-store.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/assistant-store.js +111 -13
- package/node_modules/@noodle-borg/service/dist/assistant-store.js.map +1 -1
- package/node_modules/@noodle-borg/service/dist/assistant-view-availability.d.ts +23 -0
- package/node_modules/@noodle-borg/service/dist/assistant-view-availability.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/assistant-view-availability.js +24 -0
- package/node_modules/@noodle-borg/service/dist/assistant-view-availability.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/customer-verifier.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/customer-verifier.js +6 -0
- package/node_modules/@noodle-borg/service/dist/customer-verifier.js.map +1 -1
- package/node_modules/@noodle-borg/service/dist/index.d.ts +1 -1
- package/node_modules/@noodle-borg/service/dist/index.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/index.js +1 -1
- package/node_modules/@noodle-borg/service/dist/index.js.map +1 -1
- package/node_modules/@noodle-borg/service/dist/invocation-context.d.ts +20 -0
- package/node_modules/@noodle-borg/service/dist/invocation-context.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/invocation-context.js +51 -0
- package/node_modules/@noodle-borg/service/dist/invocation-context.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/mcp-public-routing.d.ts +10 -0
- package/node_modules/@noodle-borg/service/dist/mcp-public-routing.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/mcp-public-routing.js +16 -0
- package/node_modules/@noodle-borg/service/dist/mcp-public-routing.js.map +1 -1
- package/node_modules/@noodle-borg/service/dist/oauth/consent-claims.d.ts +17 -0
- package/node_modules/@noodle-borg/service/dist/oauth/consent-claims.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/oauth/consent-claims.js +14 -0
- package/node_modules/@noodle-borg/service/dist/oauth/consent-claims.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/oauth/google.d.ts +2 -0
- package/node_modules/@noodle-borg/service/dist/oauth/google.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/oauth/google.js +11 -1
- package/node_modules/@noodle-borg/service/dist/oauth/google.js.map +1 -1
- package/node_modules/@noodle-borg/service/dist/oauth/identity-preferences.d.ts +27 -0
- package/node_modules/@noodle-borg/service/dist/oauth/identity-preferences.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/oauth/identity-preferences.js +34 -0
- package/node_modules/@noodle-borg/service/dist/oauth/identity-preferences.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/oauth/microsoft.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/oauth/microsoft.js +6 -0
- package/node_modules/@noodle-borg/service/dist/oauth/microsoft.js.map +1 -1
- package/node_modules/@noodle-borg/service/dist/oauth/provider.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/oauth/provider.js +48 -92
- package/node_modules/@noodle-borg/service/dist/oauth/provider.js.map +1 -1
- package/node_modules/@noodle-borg/service/dist/oauth/store-postgres.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/oauth/store-postgres.js +29 -9
- package/node_modules/@noodle-borg/service/dist/oauth/store-postgres.js.map +1 -1
- package/node_modules/@noodle-borg/service/dist/oauth/store.d.ts +6 -0
- package/node_modules/@noodle-borg/service/dist/oauth/store.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/oauth/store.js +4 -0
- package/node_modules/@noodle-borg/service/dist/oauth/store.js.map +1 -1
- package/node_modules/@noodle-borg/service/dist/oauth/token-issuer.d.ts +45 -0
- package/node_modules/@noodle-borg/service/dist/oauth/token-issuer.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/oauth/token-issuer.js +110 -0
- package/node_modules/@noodle-borg/service/dist/oauth/token-issuer.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/routes/assistant-agent.d.ts +19 -0
- package/node_modules/@noodle-borg/service/dist/routes/assistant-agent.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/routes/assistant-agent.js +228 -0
- package/node_modules/@noodle-borg/service/dist/routes/assistant-agent.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/routes/assistant-dispatch.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/routes/assistant-dispatch.js +7 -2
- package/node_modules/@noodle-borg/service/dist/routes/assistant-dispatch.js.map +1 -1
- package/node_modules/@noodle-borg/service/dist/routes/assistant-interaction-replay.d.ts +8 -0
- package/node_modules/@noodle-borg/service/dist/routes/assistant-interaction-replay.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/routes/assistant-interaction-replay.js +126 -0
- package/node_modules/@noodle-borg/service/dist/routes/assistant-interaction-replay.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/routes/assistant-interaction-request.d.ts +23 -0
- package/node_modules/@noodle-borg/service/dist/routes/assistant-interaction-request.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/routes/assistant-interaction-request.js +29 -0
- package/node_modules/@noodle-borg/service/dist/routes/assistant-interaction-request.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/routes/assistant-interaction-resolution.d.ts +17 -0
- package/node_modules/@noodle-borg/service/dist/routes/assistant-interaction-resolution.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/routes/assistant-interaction-resolution.js +47 -0
- package/node_modules/@noodle-borg/service/dist/routes/assistant-interaction-resolution.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/routes/assistant-interaction-stream.d.ts +20 -0
- package/node_modules/@noodle-borg/service/dist/routes/assistant-interaction-stream.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/routes/assistant-interaction-stream.js +55 -0
- package/node_modules/@noodle-borg/service/dist/routes/assistant-interaction-stream.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/routes/assistant-interactions.d.ts +7 -0
- package/node_modules/@noodle-borg/service/dist/routes/assistant-interactions.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/routes/assistant-interactions.js +427 -0
- package/node_modules/@noodle-borg/service/dist/routes/assistant-interactions.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/routes/assistant-route-http.d.ts +8 -0
- package/node_modules/@noodle-borg/service/dist/routes/assistant-route-http.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/routes/assistant-route-http.js +50 -0
- package/node_modules/@noodle-borg/service/dist/routes/assistant-route-http.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/routes/assistant.d.ts +3 -3
- package/node_modules/@noodle-borg/service/dist/routes/assistant.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/routes/assistant.js +49 -295
- package/node_modules/@noodle-borg/service/dist/routes/assistant.js.map +1 -1
- package/node_modules/@noodle-borg/service/dist/service.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/service.js +4 -10
- package/node_modules/@noodle-borg/service/dist/service.js.map +1 -1
- package/node_modules/@noodle-borg/service/dist/store/postgres-assistant-interaction-writes.d.ts +6 -0
- package/node_modules/@noodle-borg/service/dist/store/postgres-assistant-interaction-writes.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/store/postgres-assistant-interaction-writes.js +36 -0
- package/node_modules/@noodle-borg/service/dist/store/postgres-assistant-interaction-writes.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/store/postgres-assistant-interactions.d.ts +25 -0
- package/node_modules/@noodle-borg/service/dist/store/postgres-assistant-interactions.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/store/postgres-assistant-interactions.js +330 -0
- package/node_modules/@noodle-borg/service/dist/store/postgres-assistant-interactions.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/store/postgres-assistant.d.ts +17 -3
- package/node_modules/@noodle-borg/service/dist/store/postgres-assistant.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/store/postgres-assistant.js +30 -37
- package/node_modules/@noodle-borg/service/dist/store/postgres-assistant.js.map +1 -1
- package/node_modules/@noodle-borg/transport-http/dist/handler.d.ts +8 -1
- package/node_modules/@noodle-borg/transport-http/dist/handler.d.ts.map +1 -1
- package/node_modules/@noodle-borg/transport-http/dist/handler.js +20 -2
- package/node_modules/@noodle-borg/transport-http/dist/handler.js.map +1 -1
- package/node_modules/@noodle-borg/transport-http/dist/index.d.ts +1 -1
- package/node_modules/@noodle-borg/transport-http/dist/index.d.ts.map +1 -1
- package/node_modules/@noodle-borg/transport-http/dist/index.js.map +1 -1
- package/node_modules/@noodle-borg/transport-http/package.json +1 -0
- package/node_modules/@noodle-borg/wire-contracts/dist/assistant.d.ts +117 -0
- package/node_modules/@noodle-borg/wire-contracts/dist/assistant.d.ts.map +1 -1
- package/node_modules/@noodle-borg/wire-contracts/dist/assistant.js +135 -0
- package/node_modules/@noodle-borg/wire-contracts/dist/assistant.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stateless.js","sourceRoot":"","sources":["../src/stateless.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,6BAA6B,EAAE,MAAM,oDAAoD,CAAC;AAEnG,OAAO,EAAE,cAAc,EAAoD,MAAM,iBAAiB,CAAC;AAEnG;;;;;;;;;GASG;AACH,MAAM,CAAC,KAAK,UAAU,mBAAmB,CACvC,MAAsB,EACtB,GAAoB,EACpB,GAAmB,EACnB,UAAmB,EACnB,UAAkC,EAAE;IAEpC,MAAM,MAAM,GAAG,cAAc,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"stateless.js","sourceRoot":"","sources":["../src/stateless.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,6BAA6B,EAAE,MAAM,oDAAoD,CAAC;AAEnG,OAAO,EAAE,cAAc,EAAoD,MAAM,iBAAiB,CAAC;AAEnG;;;;;;;;;GASG;AACH,MAAM,CAAC,KAAK,UAAU,mBAAmB,CACvC,MAAsB,EACtB,GAAoB,EACpB,GAAmB,EACnB,UAAmB,EACnB,UAAkC,EAAE;IAEpC,mGAAmG;IACnG,oGAAoG;IACpG,sGAAsG;IACtG,qGAAqG;IACrG,MAAM,MAAM,GAAG,cAAc,CAAC,MAAM,EAAE;QACpC,GAAG,OAAO;QACV,wBAAwB,EAAE,aAAa;KACxC,CAAC,CAAC;IACH,kGAAkG;IAClG,oGAAoG;IACpG,iCAAiC;IACjC,MAAM,SAAS,GAAG,IAAI,6BAA6B,CAAC,EAAE,kBAAkB,EAAE,IAAI,EAAE,CAAC,CAAC;IAClF,GAAG,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE;QACnB,KAAK,SAAS,CAAC,KAAK,EAAE,CAAC;QACvB,KAAK,MAAM,CAAC,KAAK,EAAE,CAAC;IACtB,CAAC,CAAC,CAAC;IACH,gGAAgG;IAChG,sGAAsG;IACtG,MAAM,MAAM,CAAC,OAAO,CAAC,SAAsB,CAAC,CAAC;IAC7C,MAAM,SAAS,CAAC,aAAa,CAAC,GAAG,EAAE,GAAG,EAAE,UAAU,CAAC,CAAC;AACtD,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { Server } from '@modelcontextprotocol/sdk/server/index.js';
|
|
2
|
+
import { type RuntimeArtifact } from '@noodle-borg/compiler';
|
|
3
|
+
import { type ExecuteDeps, type ExecutionError } from '@noodle-borg/runtime';
|
|
4
|
+
type ArtifactTool = RuntimeArtifact['tools'][number];
|
|
5
|
+
export type McpToolInteractionOutcome = {
|
|
6
|
+
readonly status: 'completed';
|
|
7
|
+
readonly output: unknown;
|
|
8
|
+
} | {
|
|
9
|
+
readonly status: 'failed';
|
|
10
|
+
readonly error: ExecutionError;
|
|
11
|
+
} | {
|
|
12
|
+
readonly status: 'stopped';
|
|
13
|
+
readonly action: 'decline' | 'cancel';
|
|
14
|
+
readonly source: 'input' | 'confirmation';
|
|
15
|
+
};
|
|
16
|
+
export interface McpToolInteractionInput {
|
|
17
|
+
readonly server: Server;
|
|
18
|
+
readonly artifact: RuntimeArtifact;
|
|
19
|
+
readonly tool: ArtifactTool | undefined;
|
|
20
|
+
readonly toolName: string;
|
|
21
|
+
readonly toolArguments: unknown;
|
|
22
|
+
readonly deps: ExecuteDeps;
|
|
23
|
+
readonly formElicitationTransport?: 'bidirectional' | 'unavailable';
|
|
24
|
+
readonly onProtocolError: (errorKind: 'elicitation_unavailable' | 'invalid_confirmation_flow') => void;
|
|
25
|
+
}
|
|
26
|
+
/** Execute one MCP tool through only standard negotiated form interactions. */
|
|
27
|
+
export declare function runMcpToolInteraction({ server, artifact, tool, toolName, toolArguments, deps, formElicitationTransport, onProtocolError, }: McpToolInteractionInput): Promise<McpToolInteractionOutcome>;
|
|
28
|
+
export {};
|
|
29
|
+
//# sourceMappingURL=tool-interaction.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-interaction.d.ts","sourceRoot":"","sources":["../src/tool-interaction.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AAOxE,OAAO,EAAE,KAAK,eAAe,EAA4B,MAAM,uBAAuB,CAAC;AACvF,OAAO,EACL,KAAK,WAAW,EAChB,KAAK,cAAc,EAOpB,MAAM,sBAAsB,CAAC;AAM9B,KAAK,YAAY,GAAG,eAAe,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC;AAErD,MAAM,MAAM,yBAAyB,GACjC;IAAE,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAA;CAAE,GAC1D;IAAE,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,cAAc,CAAA;CAAE,GAC7D;IACE,QAAQ,CAAC,MAAM,EAAE,SAAS,CAAC;IAC3B,QAAQ,CAAC,MAAM,EAAE,SAAS,GAAG,QAAQ,CAAC;IACtC,QAAQ,CAAC,MAAM,EAAE,OAAO,GAAG,cAAc,CAAC;CAC3C,CAAC;AAEN,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,QAAQ,EAAE,eAAe,CAAC;IACnC,QAAQ,CAAC,IAAI,EAAE,YAAY,GAAG,SAAS,CAAC;IACxC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,aAAa,EAAE,OAAO,CAAC;IAChC,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;IAC3B,QAAQ,CAAC,wBAAwB,CAAC,EAAE,eAAe,GAAG,aAAa,CAAC;IACpE,QAAQ,CAAC,eAAe,EAAE,CACxB,SAAS,EAAE,yBAAyB,GAAG,2BAA2B,KAC/D,IAAI,CAAC;CACX;AAED,+EAA+E;AAC/E,wBAAsB,qBAAqB,CAAC,EAC1C,MAAM,EACN,QAAQ,EACR,IAAI,EACJ,QAAQ,EACR,aAAa,EACb,IAAI,EACJ,wBAAwB,EACxB,eAAe,GAChB,EAAE,uBAAuB,GAAG,OAAO,CAAC,yBAAyB,CAAC,CA2E9D"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { ErrorCode, McpError, } from '@modelcontextprotocol/sdk/types.js';
|
|
2
|
+
import { requiresToolConfirmation } from '@noodle-borg/compiler';
|
|
3
|
+
import { executePreparedTool, executeToolInteractive, isInputRequired, prepareToolForConfirmation, resumeTool, resumeToolPreparation, } from '@noodle-borg/runtime';
|
|
4
|
+
import { confirmationElicitationRequest, isAffirmativeConfirmation, } from './confirmation-elicitation.js';
|
|
5
|
+
/** Execute one MCP tool through only standard negotiated form interactions. */
|
|
6
|
+
export async function runMcpToolInteraction({ server, artifact, tool, toolName, toolArguments, deps, formElicitationTransport, onProtocolError, }) {
|
|
7
|
+
const confirmationRequired = tool !== undefined && requiresToolConfirmation(tool.annotations);
|
|
8
|
+
if ((confirmationRequired || toolRequiresFormElicitation(tool)) &&
|
|
9
|
+
!supportsFormElicitation(server, formElicitationTransport)) {
|
|
10
|
+
onProtocolError('elicitation_unavailable');
|
|
11
|
+
throw new McpError(ErrorCode.InternalError, 'this client and transport cannot complete the required user interaction');
|
|
12
|
+
}
|
|
13
|
+
if (confirmationRequired && tool !== undefined) {
|
|
14
|
+
let preparation = await prepareToolForConfirmation(artifact, toolName, toolArguments, deps);
|
|
15
|
+
while (preparation.status === 'input_required') {
|
|
16
|
+
const response = await requestFormElicitation(server, {
|
|
17
|
+
mode: 'form',
|
|
18
|
+
message: preparation.request.message,
|
|
19
|
+
requestedSchema: preparation.request
|
|
20
|
+
.requestedSchema,
|
|
21
|
+
}, () => onProtocolError('elicitation_unavailable'));
|
|
22
|
+
preparation = await resumeToolPreparation(artifact, preparation.continuation, response, deps);
|
|
23
|
+
}
|
|
24
|
+
if (preparation.status === 'stopped') {
|
|
25
|
+
return { ...preparation, source: 'input' };
|
|
26
|
+
}
|
|
27
|
+
if (preparation.status === 'failed')
|
|
28
|
+
return preparation;
|
|
29
|
+
const confirmation = confirmationElicitationRequest(tool, preparation.review);
|
|
30
|
+
if (!confirmation.ok) {
|
|
31
|
+
throw new McpError(ErrorCode.InternalError, 'the prepared action cannot be shown completely and was not executed');
|
|
32
|
+
}
|
|
33
|
+
const response = await requestFormElicitation(server, confirmation.request, () => onProtocolError('elicitation_unavailable'));
|
|
34
|
+
if (response.action !== 'accept') {
|
|
35
|
+
return { status: 'stopped', action: response.action, source: 'confirmation' };
|
|
36
|
+
}
|
|
37
|
+
if (!isAffirmativeConfirmation(response)) {
|
|
38
|
+
return { status: 'stopped', action: 'decline', source: 'confirmation' };
|
|
39
|
+
}
|
|
40
|
+
const result = await executePreparedTool(artifact, preparation.continuation, deps);
|
|
41
|
+
if (result.status === 'input_required') {
|
|
42
|
+
onProtocolError('invalid_confirmation_flow');
|
|
43
|
+
throw new McpError(ErrorCode.InternalError, 'the prepared action reached an unexpected input boundary');
|
|
44
|
+
}
|
|
45
|
+
return result.status === 'stopped' ? { ...result, source: 'input' } : result;
|
|
46
|
+
}
|
|
47
|
+
let result = await executeToolInteractive(artifact, toolName, toolArguments, deps);
|
|
48
|
+
while (isInputRequired(result)) {
|
|
49
|
+
const response = await requestFormElicitation(server, {
|
|
50
|
+
mode: 'form',
|
|
51
|
+
message: result.request.message,
|
|
52
|
+
requestedSchema: result.request
|
|
53
|
+
.requestedSchema,
|
|
54
|
+
}, () => onProtocolError('elicitation_unavailable'));
|
|
55
|
+
result = await resumeTool(artifact, result.continuation, response, deps);
|
|
56
|
+
}
|
|
57
|
+
return result.status === 'stopped' ? { ...result, source: 'input' } : result;
|
|
58
|
+
}
|
|
59
|
+
function toolRequiresFormElicitation(tool) {
|
|
60
|
+
return (tool?.fulfilment.kind === 'flow' && tool.fulfilment.steps.some((step) => step.kind === 'elicit'));
|
|
61
|
+
}
|
|
62
|
+
function supportsFormElicitation(server, transport) {
|
|
63
|
+
return (transport !== 'unavailable' && server.getClientCapabilities()?.elicitation?.form !== undefined);
|
|
64
|
+
}
|
|
65
|
+
async function requestFormElicitation(server, params, onUnavailable) {
|
|
66
|
+
try {
|
|
67
|
+
return await server.elicitInput(params);
|
|
68
|
+
}
|
|
69
|
+
catch {
|
|
70
|
+
onUnavailable();
|
|
71
|
+
throw new McpError(ErrorCode.InternalError, 'this client cannot complete the required user interaction');
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
//# sourceMappingURL=tool-interaction.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-interaction.js","sourceRoot":"","sources":["../src/tool-interaction.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,SAAS,EACT,QAAQ,GACT,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAwB,wBAAwB,EAAE,MAAM,uBAAuB,CAAC;AACvF,OAAO,EAGL,mBAAmB,EACnB,sBAAsB,EACtB,eAAe,EACf,0BAA0B,EAC1B,UAAU,EACV,qBAAqB,GACtB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,8BAA8B,EAC9B,yBAAyB,GAC1B,MAAM,+BAA+B,CAAC;AA0BvC,+EAA+E;AAC/E,MAAM,CAAC,KAAK,UAAU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AAS,CAAC,aAAa,EACvB,2DAA2D,CAC5D,CAAC;IACJ,CAAC;AACH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bootstrap.d.ts","sourceRoot":"","sources":["../../src/widget/bootstrap.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"bootstrap.d.ts","sourceRoot":"","sources":["../../src/widget/bootstrap.ts"],"names":[],"mappings":"AAOA,uEAAuE;AACvE,eAAO,MAAM,uBAAuB,EAAE,MAsxBrC,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { WIDGET_FLOW_SOURCE } from './flow-bootstrap.js';
|
|
2
2
|
import { WIDGET_FORMAT_SOURCE } from './format-bootstrap.js';
|
|
3
3
|
import { WIDGET_HANDOFF_SOURCE } from './handoff-bootstrap.js';
|
|
4
|
+
import { WIDGET_MODEL_CONTEXT_SOURCE } from './model-context-bootstrap.js';
|
|
4
5
|
import { OPENAI_WIDGET_BRIDGE_SOURCE } from './openai-bridge.js';
|
|
5
6
|
import { WIDGET_REACT_BRIDGE_SOURCE } from './react-bridge-bootstrap.js';
|
|
6
7
|
/** Widget runtime bootstrap, eval-tested in widget-runtime.test.ts. */
|
|
@@ -18,7 +19,7 @@ ${OPENAI_WIDGET_BRIDGE_SOURCE}
|
|
|
18
19
|
} else {
|
|
19
20
|
return;
|
|
20
21
|
}
|
|
21
|
-
|
|
22
|
+
${WIDGET_MODEL_CONTEXT_SOURCE} guardModelContextUpdates(app);
|
|
22
23
|
${WIDGET_REACT_BRIDGE_SOURCE}
|
|
23
24
|
const get = (o, p) => String(p).split('.').reduce((x, k) => (x == null ? undefined : x[k]), o);
|
|
24
25
|
|
|
@@ -378,10 +379,14 @@ ${WIDGET_FORMAT_SOURCE}
|
|
|
378
379
|
function persistWidgetState() {
|
|
379
380
|
try {
|
|
380
381
|
if (typeof app.setWidgetState !== 'function') return;
|
|
382
|
+
const saved = readWidgetState();
|
|
383
|
+
const modelContent = saved && Object.prototype.hasOwnProperty.call(saved, 'modelContent')
|
|
384
|
+
? saved.modelContent
|
|
385
|
+
: null;
|
|
381
386
|
const viewParams = nonEmptyViewParams(globalThis.__noodleViewParams || {});
|
|
382
387
|
const overlayStack = globalThis.__noodleOverlayStack || [];
|
|
383
388
|
app.setWidgetState({
|
|
384
|
-
modelContent
|
|
389
|
+
modelContent,
|
|
385
390
|
privateContent: {
|
|
386
391
|
activeView: globalThis.__noodleActiveView || null,
|
|
387
392
|
state: stateData(),
|
|
@@ -779,9 +784,9 @@ ${WIDGET_HANDOFF_SOURCE}
|
|
|
779
784
|
// Register handlers BEFORE connect() so no one-shot host notification is missed.
|
|
780
785
|
app.ontoolresult = (p) => bind(fromResult(p));
|
|
781
786
|
app.ontoolinput = (p) => bindInput(p && p.arguments);
|
|
782
|
-
app.ontoolcancelled = () => clearBusy();
|
|
787
|
+
app.ontoolcancelled = () => { clearBusy(); notifyReact('noodle:toolcancelled'); };
|
|
783
788
|
app.onhostcontextchanged = (p) => { theme(p); applyCapabilities(); };
|
|
784
|
-
app.onteardown = () => { try { clearBusy(); } catch (e) {} return {}; };
|
|
789
|
+
app.onteardown = () => { try { clearBusy(); notifyReact('noodle:teardown'); } catch (e) {} return {}; };
|
|
785
790
|
installReactBridge();
|
|
786
791
|
wireActions();
|
|
787
792
|
restoreWidgetState();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bootstrap.js","sourceRoot":"","sources":["../../src/widget/bootstrap.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,EAAE,2BAA2B,EAAE,MAAM,oBAAoB,CAAC;AACjE,OAAO,EAAE,0BAA0B,EAAE,MAAM,6BAA6B,CAAC;AAEzE,uEAAuE;AACvE,MAAM,CAA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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgRtB,CAAC"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
/** Shared runtime guard for every widget-to-host model-context path, including raw HTML actions. */
|
|
2
|
+
export declare const WIDGET_MODEL_CONTEXT_SOURCE = "\n const MAX_MODEL_CONTEXT_BYTES = 16 * 1024;\n const MAX_MODEL_CONTEXT_DEPTH = 8;\n const MAX_MODEL_CONTEXT_ENTRIES = 128;\n const MODEL_CONTEXT_SENSITIVE_KEY = /(?:secret|token|api[-_]?key|password|credential|authorization|cookie)/i;\n const MODEL_CONTEXT_CREDENTIAL_TEXT = /(?:-----BEGIN [A-Z ]*PRIVATE KEY-----|\\bsk-[A-Za-z0-9_-]{20,}\\b|\\b(?:bearer|basic)\\s+[A-Za-z0-9._~+/=-]{20,}\\b|\\b[A-Za-z0-9_-]{16,}\\.[A-Za-z0-9_-]{16,}\\.[A-Za-z0-9_-]{16,}\\b)/i;\n function hasModelContextToJSON(value) {\n let current = value;\n const visited = new Set();\n while (current !== null && !visited.has(current)) {\n visited.add(current);\n if (Object.getOwnPropertyDescriptor(current, 'toJSON') !== undefined) return true;\n current = Object.getPrototypeOf(current);\n }\n return false;\n }\n function copyModelContextValue(value, path, depth, ancestors) {\n if (depth > MAX_MODEL_CONTEXT_DEPTH) throw new Error('Model context exceeds the maximum nesting depth at ' + path);\n if (typeof value === 'string') {\n if (MODEL_CONTEXT_CREDENTIAL_TEXT.test(value)) throw new Error('Model context contains credential-shaped text at ' + path);\n return value;\n }\n if (value === null || typeof value === 'boolean' ||\n (typeof value === 'number' && Number.isFinite(value))) return value;\n if (!value || typeof value !== 'object') throw new Error('Model context contains a non-JSON value at ' + path);\n if (hasModelContextToJSON(value)) throw new Error('Model context must not define or inherit toJSON at ' + path);\n const prototype = Object.getPrototypeOf(value);\n if (Array.isArray(value)) {\n if (prototype !== Array.prototype) throw new Error('Model context arrays must use the standard JSON prototype at ' + path);\n } else if (prototype !== Object.prototype && prototype !== null) {\n throw new Error('Model context objects must be plain records at ' + path);\n }\n if (ancestors.has(value)) throw new Error('Model context contains a cycle at ' + path);\n\n if (Array.isArray(value)) {\n if (value.length > MAX_MODEL_CONTEXT_ENTRIES) throw new Error('Model context has more than 128 entries at ' + path);\n const copy = [];\n ancestors.add(value);\n for (let index = 0; index < value.length; index += 1) {\n const entry = Object.prototype.hasOwnProperty.call(value, index) ? value[index] : null;\n copy.push(copyModelContextValue(entry, path + '.' + index, depth + 1, ancestors));\n }\n ancestors.delete(value);\n return copy;\n }\n\n const entries = Object.entries(value);\n if (entries.length > MAX_MODEL_CONTEXT_ENTRIES) throw new Error('Model context has more than 128 entries at ' + path);\n const copy = Object.create(null);\n ancestors.add(value);\n for (const [key, entry] of entries) {\n if (MODEL_CONTEXT_SENSITIVE_KEY.test(key)) {\n throw new Error('Model context contains sensitive key ' + path + '.' + key);\n }\n copy[key] = copyModelContextValue(entry, path + '.' + key, depth + 1, ancestors);\n }\n ancestors.delete(value);\n return copy;\n }\n function copyModelContextUpdate(update) {\n const copy = copyModelContextValue(update, '$', 0, new Set());\n if (!copy || typeof copy !== 'object' || Array.isArray(copy)) {\n throw new Error('Model context must be a JSON object');\n }\n const encoded = JSON.stringify(copy);\n if (new TextEncoder().encode(encoded).byteLength > MAX_MODEL_CONTEXT_BYTES) {\n throw new Error('Model context must not exceed 16 KiB');\n }\n return copy;\n }\n function guardModelContextUpdates(target) {\n if (!target || typeof target.updateModelContext !== 'function') return;\n const publish = target.updateModelContext.bind(target);\n target.updateModelContext = (update) => {\n return publish(copyModelContextUpdate(update));\n };\n }\n";
|
|
3
|
+
//# sourceMappingURL=model-context-bootstrap.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model-context-bootstrap.d.ts","sourceRoot":"","sources":["../../src/widget/model-context-bootstrap.ts"],"names":[],"mappings":"AAAA,oGAAoG;AACpG,eAAO,MAAM,2BAA2B,i2HA6EvC,CAAC"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/** Shared runtime guard for every widget-to-host model-context path, including raw HTML actions. */
|
|
2
|
+
export const WIDGET_MODEL_CONTEXT_SOURCE = `
|
|
3
|
+
const MAX_MODEL_CONTEXT_BYTES = 16 * 1024;
|
|
4
|
+
const MAX_MODEL_CONTEXT_DEPTH = 8;
|
|
5
|
+
const MAX_MODEL_CONTEXT_ENTRIES = 128;
|
|
6
|
+
const MODEL_CONTEXT_SENSITIVE_KEY = /(?:secret|token|api[-_]?key|password|credential|authorization|cookie)/i;
|
|
7
|
+
const MODEL_CONTEXT_CREDENTIAL_TEXT = /(?:-----BEGIN [A-Z ]*PRIVATE KEY-----|\\bsk-[A-Za-z0-9_-]{20,}\\b|\\b(?:bearer|basic)\\s+[A-Za-z0-9._~+/=-]{20,}\\b|\\b[A-Za-z0-9_-]{16,}\\.[A-Za-z0-9_-]{16,}\\.[A-Za-z0-9_-]{16,}\\b)/i;
|
|
8
|
+
function hasModelContextToJSON(value) {
|
|
9
|
+
let current = value;
|
|
10
|
+
const visited = new Set();
|
|
11
|
+
while (current !== null && !visited.has(current)) {
|
|
12
|
+
visited.add(current);
|
|
13
|
+
if (Object.getOwnPropertyDescriptor(current, 'toJSON') !== undefined) return true;
|
|
14
|
+
current = Object.getPrototypeOf(current);
|
|
15
|
+
}
|
|
16
|
+
return false;
|
|
17
|
+
}
|
|
18
|
+
function copyModelContextValue(value, path, depth, ancestors) {
|
|
19
|
+
if (depth > MAX_MODEL_CONTEXT_DEPTH) throw new Error('Model context exceeds the maximum nesting depth at ' + path);
|
|
20
|
+
if (typeof value === 'string') {
|
|
21
|
+
if (MODEL_CONTEXT_CREDENTIAL_TEXT.test(value)) throw new Error('Model context contains credential-shaped text at ' + path);
|
|
22
|
+
return value;
|
|
23
|
+
}
|
|
24
|
+
if (value === null || typeof value === 'boolean' ||
|
|
25
|
+
(typeof value === 'number' && Number.isFinite(value))) return value;
|
|
26
|
+
if (!value || typeof value !== 'object') throw new Error('Model context contains a non-JSON value at ' + path);
|
|
27
|
+
if (hasModelContextToJSON(value)) throw new Error('Model context must not define or inherit toJSON at ' + path);
|
|
28
|
+
const prototype = Object.getPrototypeOf(value);
|
|
29
|
+
if (Array.isArray(value)) {
|
|
30
|
+
if (prototype !== Array.prototype) throw new Error('Model context arrays must use the standard JSON prototype at ' + path);
|
|
31
|
+
} else if (prototype !== Object.prototype && prototype !== null) {
|
|
32
|
+
throw new Error('Model context objects must be plain records at ' + path);
|
|
33
|
+
}
|
|
34
|
+
if (ancestors.has(value)) throw new Error('Model context contains a cycle at ' + path);
|
|
35
|
+
|
|
36
|
+
if (Array.isArray(value)) {
|
|
37
|
+
if (value.length > MAX_MODEL_CONTEXT_ENTRIES) throw new Error('Model context has more than 128 entries at ' + path);
|
|
38
|
+
const copy = [];
|
|
39
|
+
ancestors.add(value);
|
|
40
|
+
for (let index = 0; index < value.length; index += 1) {
|
|
41
|
+
const entry = Object.prototype.hasOwnProperty.call(value, index) ? value[index] : null;
|
|
42
|
+
copy.push(copyModelContextValue(entry, path + '.' + index, depth + 1, ancestors));
|
|
43
|
+
}
|
|
44
|
+
ancestors.delete(value);
|
|
45
|
+
return copy;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const entries = Object.entries(value);
|
|
49
|
+
if (entries.length > MAX_MODEL_CONTEXT_ENTRIES) throw new Error('Model context has more than 128 entries at ' + path);
|
|
50
|
+
const copy = Object.create(null);
|
|
51
|
+
ancestors.add(value);
|
|
52
|
+
for (const [key, entry] of entries) {
|
|
53
|
+
if (MODEL_CONTEXT_SENSITIVE_KEY.test(key)) {
|
|
54
|
+
throw new Error('Model context contains sensitive key ' + path + '.' + key);
|
|
55
|
+
}
|
|
56
|
+
copy[key] = copyModelContextValue(entry, path + '.' + key, depth + 1, ancestors);
|
|
57
|
+
}
|
|
58
|
+
ancestors.delete(value);
|
|
59
|
+
return copy;
|
|
60
|
+
}
|
|
61
|
+
function copyModelContextUpdate(update) {
|
|
62
|
+
const copy = copyModelContextValue(update, '$', 0, new Set());
|
|
63
|
+
if (!copy || typeof copy !== 'object' || Array.isArray(copy)) {
|
|
64
|
+
throw new Error('Model context must be a JSON object');
|
|
65
|
+
}
|
|
66
|
+
const encoded = JSON.stringify(copy);
|
|
67
|
+
if (new TextEncoder().encode(encoded).byteLength > MAX_MODEL_CONTEXT_BYTES) {
|
|
68
|
+
throw new Error('Model context must not exceed 16 KiB');
|
|
69
|
+
}
|
|
70
|
+
return copy;
|
|
71
|
+
}
|
|
72
|
+
function guardModelContextUpdates(target) {
|
|
73
|
+
if (!target || typeof target.updateModelContext !== 'function') return;
|
|
74
|
+
const publish = target.updateModelContext.bind(target);
|
|
75
|
+
target.updateModelContext = (update) => {
|
|
76
|
+
return publish(copyModelContextUpdate(update));
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
`;
|
|
80
|
+
//# sourceMappingURL=model-context-bootstrap.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model-context-bootstrap.js","sourceRoot":"","sources":["../../src/widget/model-context-bootstrap.ts"],"names":[],"mappings":"AAAA,oGAAoG;AACpG,MAAM,CAAC,MAAM,2BAA2B,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6E1C,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"openai-bridge.d.ts","sourceRoot":"","sources":["../../src/widget/openai-bridge.ts"],"names":[],"mappings":"AAAA,mFAAmF;AACnF,eAAO,MAAM,2BAA2B,EAAE,
|
|
1
|
+
{"version":3,"file":"openai-bridge.d.ts","sourceRoot":"","sources":["../../src/widget/openai-bridge.ts"],"names":[],"mappings":"AAAA,mFAAmF;AACnF,eAAO,MAAM,2BAA2B,EAAE,MAkFzC,CAAC"}
|
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
export const OPENAI_WIDGET_BRIDGE_SOURCE = `
|
|
3
3
|
function makeOpenAiApp(o) {
|
|
4
4
|
const msgText = (m) => (m && m.content && m.content[0] && m.content[0].text) || '';
|
|
5
|
+
let latestModelContent = o.widgetState && typeof o.widgetState === 'object' &&
|
|
6
|
+
Object.prototype.hasOwnProperty.call(o.widgetState, 'modelContent')
|
|
7
|
+
? o.widgetState.modelContent
|
|
8
|
+
: null;
|
|
5
9
|
const widgetPrivateContent = () => {
|
|
6
10
|
const s = o.widgetState;
|
|
7
11
|
return s && typeof s === 'object' && s.privateContent && typeof s.privateContent === 'object'
|
|
@@ -24,14 +28,22 @@ export const OPENAI_WIDGET_BRIDGE_SOURCE = `
|
|
|
24
28
|
openLink: (p) => (typeof o.openExternal === 'function' ? o.openExternal({ href: p && p.url }) : undefined),
|
|
25
29
|
requestDisplayMode: (p) =>
|
|
26
30
|
typeof o.requestDisplayMode === 'function' ? o.requestDisplayMode({ mode: p && p.mode }) : undefined,
|
|
27
|
-
getWidgetState: () =>
|
|
28
|
-
|
|
29
|
-
|
|
31
|
+
getWidgetState: () => {
|
|
32
|
+
const current = o.widgetState && typeof o.widgetState === 'object' ? o.widgetState : {};
|
|
33
|
+
return { ...current, modelContent: latestModelContent };
|
|
34
|
+
},
|
|
35
|
+
setWidgetState: (p) => {
|
|
36
|
+
if (p && typeof p === 'object' && Object.prototype.hasOwnProperty.call(p, 'modelContent')) {
|
|
37
|
+
latestModelContent = p.modelContent;
|
|
38
|
+
}
|
|
39
|
+
return typeof o.setWidgetState === 'function' ? o.setWidgetState(p) : undefined;
|
|
40
|
+
},
|
|
30
41
|
updateModelContext: (p) => {
|
|
42
|
+
latestModelContent = modelContent(p);
|
|
31
43
|
if (typeof o.updateModelContext === 'function') return o.updateModelContext(p);
|
|
32
44
|
if (typeof o.setWidgetState !== 'function') return undefined;
|
|
33
45
|
return o.setWidgetState({
|
|
34
|
-
modelContent:
|
|
46
|
+
modelContent: latestModelContent,
|
|
35
47
|
privateContent: widgetPrivateContent(),
|
|
36
48
|
imageIds: o.widgetState && Array.isArray(o.widgetState.imageIds) ? o.widgetState.imageIds : [],
|
|
37
49
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"openai-bridge.js","sourceRoot":"","sources":["../../src/widget/openai-bridge.ts"],"names":[],"mappings":"AAAA,mFAAmF;AACnF,MAAM,CAAC,MAAM,2BAA2B,GAAW
|
|
1
|
+
{"version":3,"file":"openai-bridge.js","sourceRoot":"","sources":["../../src/widget/openai-bridge.ts"],"names":[],"mappings":"AAAA,mFAAmF;AACnF,MAAM,CAAC,MAAM,2BAA2B,GAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkFlD,CAAC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/** React helper bridge source injected into the shared widget bootstrap. */
|
|
2
|
-
export declare const WIDGET_REACT_BRIDGE_SOURCE = "\n function notifyReact(eventName) {\n globalThis.__noodleReactVersion = (globalThis.__noodleReactVersion || 0) + 1;\n try { globalThis.dispatchEvent(new CustomEvent(eventName)); } catch (e) {}\n }\n function installReactBridge() {\n globalThis.__noodleReactBridge = {\n getToolResult: () => ({ structuredContent: globalThis.__noodleData || {} }),\n getViewState: () => stateData(),\n setWidgetState: (patch) => setState(patch || {}),\n getLayout: () => {\n const context = (app.getHostContext && app.getHostContext()) || globalThis.__noodleLayout || {};\n const capabilities = (app.getHostCapabilities && app.getHostCapabilities()) || {};\n const hostInfo = (app.getHostVersion && app.getHostVersion()) || {};\n const modes = Array.isArray(context.availableDisplayModes)\n ? context.availableDisplayModes.filter((mode) => mode === 'inline' || mode === 'fullscreen' || mode === 'pip')\n : [];\n return {\n theme: context.theme === 'dark' ? 'dark' : 'light',\n displayMode: context.displayMode === 'fullscreen' || context.displayMode === 'pip'\n ? context.displayMode\n : 'inline',\n ...(modes.length ? { availableDisplayModes: modes } : {}),\n ...(context.containerDimensions ? { containerDimensions: { ...context.containerDimensions } } : {}),\n ...(context.locale ? { locale: context.locale } : {}),\n ...(context.timeZone ? { timeZone: context.timeZone } : {}),\n ...(hostInfo.name ? { host: String(hostInfo.name) } : {}),\n ...(context.platform ? { platform: context.platform } : {}),\n ...(context.deviceCapabilities ? { deviceCapabilities: { ...context.deviceCapabilities } } : {}),\n ...(context.safeAreaInsets ? { safeAreaInsets: { ...context.safeAreaInsets } } : {}),\n supports: {\n fullscreen: modes.includes('fullscreen'),\n pip: modes.includes('pip'),\n openExternal: Boolean(capabilities.openLinks || capabilities.openLink),\n followUpMessage: Boolean(capabilities.message),\n },\n };\n },\n getBranding: () => globalThis.__noodleBranding || {},\n callServerTool: (request) => app.callServerTool({\n name: request && request.name,\n arguments: request ? request.arguments : undefined,\n }),\n openExternal: (url) => app.openLink({ url: String(url || '') }),\n sendFollowUpMessage: (message) => app.sendMessage({\n role: 'user',\n content: [{ type: 'text', text: String((message && message.prompt) || '') }],\n }),\n requestDisplayMode: (mode) => app.requestDisplayMode({ mode }),\n };\n notifyReact('noodle:bridge');\n }\n";
|
|
2
|
+
export declare const WIDGET_REACT_BRIDGE_SOURCE = "\n function notifyReact(eventName) {\n globalThis.__noodleReactVersion = (globalThis.__noodleReactVersion || 0) + 1;\n try { globalThis.dispatchEvent(new CustomEvent(eventName)); } catch (e) {}\n }\n function installReactBridge() {\n globalThis.__noodleReactBridge = {\n getToolResult: () => ({ structuredContent: globalThis.__noodleData || {} }),\n getViewState: () => stateData(),\n setWidgetState: (patch) => setState(patch || {}),\n getLayout: () => {\n const context = (app.getHostContext && app.getHostContext()) || globalThis.__noodleLayout || {};\n const capabilities = (app.getHostCapabilities && app.getHostCapabilities()) || {};\n const hostInfo = (app.getHostVersion && app.getHostVersion()) || {};\n const modes = Array.isArray(context.availableDisplayModes)\n ? context.availableDisplayModes.filter((mode) => mode === 'inline' || mode === 'fullscreen' || mode === 'pip')\n : [];\n return {\n theme: context.theme === 'dark' ? 'dark' : 'light',\n displayMode: context.displayMode === 'fullscreen' || context.displayMode === 'pip'\n ? context.displayMode\n : 'inline',\n ...(modes.length ? { availableDisplayModes: modes } : {}),\n ...(context.containerDimensions ? { containerDimensions: { ...context.containerDimensions } } : {}),\n ...(context.locale ? { locale: context.locale } : {}),\n ...(context.timeZone ? { timeZone: context.timeZone } : {}),\n ...(hostInfo.name ? { host: String(hostInfo.name) } : {}),\n ...(context.platform ? { platform: context.platform } : {}),\n ...(context.deviceCapabilities ? { deviceCapabilities: { ...context.deviceCapabilities } } : {}),\n ...(context.safeAreaInsets ? { safeAreaInsets: { ...context.safeAreaInsets } } : {}),\n supports: {\n fullscreen: modes.includes('fullscreen'),\n pip: modes.includes('pip'),\n openExternal: Boolean(capabilities.openLinks || capabilities.openLink),\n followUpMessage: Boolean(capabilities.message),\n modelContext: Boolean(capabilities.updateModelContext || capabilities.modelContext),\n },\n };\n },\n getBranding: () => globalThis.__noodleBranding || {},\n callServerTool: (request) => app.callServerTool({\n name: request && request.name,\n arguments: request ? request.arguments : undefined,\n }),\n openExternal: (url) => app.openLink({ url: String(url || '') }),\n sendFollowUpMessage: (message) => app.sendMessage({\n role: 'user',\n content: [{ type: 'text', text: String((message && message.prompt) || '') }],\n }),\n updateModelContext: (update) => app.updateModelContext(update || {}),\n requestDisplayMode: (mode) => app.requestDisplayMode({ mode }),\n };\n notifyReact('noodle:bridge');\n }\n";
|
|
3
3
|
//# sourceMappingURL=react-bridge-bootstrap.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react-bridge-bootstrap.d.ts","sourceRoot":"","sources":["../../src/widget/react-bridge-bootstrap.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,eAAO,MAAM,0BAA0B,
|
|
1
|
+
{"version":3,"file":"react-bridge-bootstrap.d.ts","sourceRoot":"","sources":["../../src/widget/react-bridge-bootstrap.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,eAAO,MAAM,0BAA0B,64FAsDtC,CAAC"}
|
|
@@ -34,6 +34,7 @@ export const WIDGET_REACT_BRIDGE_SOURCE = `
|
|
|
34
34
|
pip: modes.includes('pip'),
|
|
35
35
|
openExternal: Boolean(capabilities.openLinks || capabilities.openLink),
|
|
36
36
|
followUpMessage: Boolean(capabilities.message),
|
|
37
|
+
modelContext: Boolean(capabilities.updateModelContext || capabilities.modelContext),
|
|
37
38
|
},
|
|
38
39
|
};
|
|
39
40
|
},
|
|
@@ -47,6 +48,7 @@ export const WIDGET_REACT_BRIDGE_SOURCE = `
|
|
|
47
48
|
role: 'user',
|
|
48
49
|
content: [{ type: 'text', text: String((message && message.prompt) || '') }],
|
|
49
50
|
}),
|
|
51
|
+
updateModelContext: (update) => app.updateModelContext(update || {}),
|
|
50
52
|
requestDisplayMode: (mode) => app.requestDisplayMode({ mode }),
|
|
51
53
|
};
|
|
52
54
|
notifyReact('noodle:bridge');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react-bridge-bootstrap.js","sourceRoot":"","sources":["../../src/widget/react-bridge-bootstrap.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,MAAM,CAAC,MAAM,0BAA0B,GAAG
|
|
1
|
+
{"version":3,"file":"react-bridge-bootstrap.js","sourceRoot":"","sources":["../../src/widget/react-bridge-bootstrap.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,MAAM,CAAC,MAAM,0BAA0B,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsDzC,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { RuntimeArtifact } from '@noodle-borg/compiler';
|
|
2
|
+
import { type ExecuteDeps } from './execute.js';
|
|
3
|
+
import type { ExecutionResult } from './result.js';
|
|
4
|
+
/**
|
|
5
|
+
* Resolve the server's declared ambient context against the invocation's temporal/caller snapshot.
|
|
6
|
+
* The provider is compiled fulfilment data, not tenant code, and its result is validated before it can
|
|
7
|
+
* become `${context.ambient}` for later executions.
|
|
8
|
+
*/
|
|
9
|
+
export declare function executeAmbientContext(artifact: RuntimeArtifact, deps: ExecuteDeps): Promise<ExecutionResult>;
|
|
10
|
+
//# sourceMappingURL=ambient-context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ambient-context.d.ts","sourceRoot":"","sources":["../src/ambient-context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAE7D,OAAO,EACL,KAAK,WAAW,EAIjB,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEnD;;;;GAIG;AACH,wBAAsB,qBAAqB,CACzC,QAAQ,EAAE,eAAe,EACzB,IAAI,EAAE,WAAW,GAChB,OAAO,CAAC,eAAe,CAAC,CAoD1B"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { canonicalizeContext } from './context-bounds.js';
|
|
2
|
+
import { runFulfilment, splitResultMeta, validateAgainstSchema, } from './execute.js';
|
|
3
|
+
/**
|
|
4
|
+
* Resolve the server's declared ambient context against the invocation's temporal/caller snapshot.
|
|
5
|
+
* The provider is compiled fulfilment data, not tenant code, and its result is validated before it can
|
|
6
|
+
* become `${context.ambient}` for later executions.
|
|
7
|
+
*/
|
|
8
|
+
export async function executeAmbientContext(artifact, deps) {
|
|
9
|
+
if (artifact.resolution !== 'resolved') {
|
|
10
|
+
return {
|
|
11
|
+
ok: false,
|
|
12
|
+
error: {
|
|
13
|
+
code: 'shape_only_artifact',
|
|
14
|
+
message: 'runtime refuses to serve a shape-only artifact',
|
|
15
|
+
},
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
const ambient = artifact.server.context?.ambient;
|
|
19
|
+
if (ambient === undefined)
|
|
20
|
+
return { ok: true, output: undefined };
|
|
21
|
+
const providerContext = deps.context === undefined
|
|
22
|
+
? undefined
|
|
23
|
+
: {
|
|
24
|
+
temporal: deps.context.temporal,
|
|
25
|
+
ambientStatus: 'not_configured',
|
|
26
|
+
};
|
|
27
|
+
const providerDeps = {
|
|
28
|
+
...deps,
|
|
29
|
+
...(providerContext !== undefined ? { context: providerContext } : {}),
|
|
30
|
+
};
|
|
31
|
+
const result = await runFulfilment(ambient.fulfilment, {}, 'server.context.ambient', providerDeps);
|
|
32
|
+
if (!result.ok)
|
|
33
|
+
return result;
|
|
34
|
+
const { visible } = splitResultMeta(result.output);
|
|
35
|
+
const canonical = canonicalizeContext(visible);
|
|
36
|
+
if (!canonical.ok) {
|
|
37
|
+
return {
|
|
38
|
+
ok: false,
|
|
39
|
+
error: {
|
|
40
|
+
code: 'output_invalid',
|
|
41
|
+
message: canonical.issue.message,
|
|
42
|
+
path: canonical.issue.path,
|
|
43
|
+
},
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
const outputError = validateAgainstSchema(canonical.value, ambient.outputSchema, 'context.ambient', 'output_invalid', 'ambient context');
|
|
47
|
+
if (outputError !== null)
|
|
48
|
+
return { ok: false, error: outputError };
|
|
49
|
+
return { ok: true, output: canonical.value };
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=ambient-context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ambient-context.js","sourceRoot":"","sources":["../src/ambient-context.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EAEL,aAAa,EACb,eAAe,EACf,qBAAqB,GACtB,MAAM,cAAc,CAAC;AAGtB;;;;GAIG;AACH,M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CAAC,KAAK,CAAC,OAAO;gBAChC,IAAI,EAAE,SAAS,CAAC,KAAK,CAAC,IAAI;aAC3B;SACF,CAAC;IACJ,CAAC;IACD,MAAM,WAAW,GAAG,qBAAqB,CACvC,SAAS,CAAC,KAAK,EACf,OAAO,CAAC,YAAY,EACpB,iBAAiB,EACjB,gBAAgB,EAChB,iBAAiB,CAClB,CAAC;IACF,IAAI,WAAW,KAAK,IAAI;QAAE,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,WAAW,EAAE,CAAC;IACnE,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,CAAC,KAAK,EAAE,CAAC;AAC/C,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { RuntimeArtifact } from '@noodle-borg/compiler';
|
|
2
|
+
import { type ExecuteDeps } from './execute.js';
|
|
3
|
+
import type { ConfirmationPreparationResult, ElicitationResponse, InteractiveExecutionResult, PreparedToolContinuation, ToolPreparationContinuation } from './result.js';
|
|
4
|
+
/**
|
|
5
|
+
* Evaluate the pure prefix of a confirmable tool. Connector operations are an absolute suspension
|
|
6
|
+
* boundary: this function either requests input, returns a prepared confirmation, or fails before
|
|
7
|
+
* invoking one.
|
|
8
|
+
*/
|
|
9
|
+
export declare function prepareToolForConfirmation(artifact: RuntimeArtifact, toolName: string, input: unknown, deps: ExecuteDeps): Promise<ConfirmationPreparationResult>;
|
|
10
|
+
/** Resume the pure preparation prefix with one accepted, declined, or cancelled input response. */
|
|
11
|
+
export declare function resumeToolPreparation(artifact: RuntimeArtifact, continuation: ToolPreparationContinuation, response: ElicitationResponse, deps: ExecuteDeps): Promise<ConfirmationPreparationResult>;
|
|
12
|
+
/**
|
|
13
|
+
* Execute a previously prepared tool after approval. The whole flow is checked again before the
|
|
14
|
+
* first operation; a forged or drifted continuation can therefore never reach a late elicitation
|
|
15
|
+
* after performing a side effect.
|
|
16
|
+
*/
|
|
17
|
+
export declare function executePreparedTool(artifact: RuntimeArtifact, continuation: PreparedToolContinuation, deps: ExecuteDeps): Promise<InteractiveExecutionResult>;
|
|
18
|
+
//# sourceMappingURL=confirmation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"confirmation.d.ts","sourceRoot":"","sources":["../src/confirmation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAsB,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAGjF,OAAO,EAGL,KAAK,WAAW,EAOjB,MAAM,cAAc,CAAC;AAEtB,OAAO,KAAK,EAEV,6BAA6B,EAC7B,mBAAmB,EAEnB,0BAA0B,EAE1B,wBAAwB,EACxB,2BAA2B,EAC5B,MAAM,aAAa,CAAC;AAIrB;;;;GAIG;AACH,wBAAsB,0BAA0B,CAC9C,QAAQ,EAAE,eAAe,EACzB,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,OAAO,EACd,IAAI,EAAE,WAAW,GAChB,OAAO,CAAC,6BAA6B,CAAC,CAuBxC;AAED,mGAAmG;AACnG,wBAAsB,qBAAqB,CACzC,QAAQ,EAAE,eAAe,EACzB,YAAY,EAAE,2BAA2B,EACzC,QAAQ,EAAE,mBAAmB,EAC7B,IAAI,EAAE,WAAW,GAChB,OAAO,CAAC,6BAA6B,CAAC,CAoCxC;AAED;;;;GAIG;AACH,wBAAsB,mBAAmB,CACvC,QAAQ,EAAE,eAAe,EACzB,YAAY,EAAE,wBAAwB,EACtC,IAAI,EAAE,WAAW,GAChB,OAAO,CAAC,0BAA0B,CAAC,CAsErC"}
|