@noodleseed/one 0.35.2 → 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/catalog-data-resources.d.ts.map +1 -1
- package/dist/commands/catalog-data-resources.js +2 -1
- package/dist/commands/catalog-data-resources.js.map +1 -1
- 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/commands/policy-ops.d.ts.map +1 -1
- package/dist/commands/policy-ops.js +57 -15
- package/dist/commands/policy-ops.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/commercial-plans.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/commercial-plans.js +5 -6
- package/node_modules/@noodle-borg/service/dist/commercial-plans.js.map +1 -1
- 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 -2
- package/node_modules/@noodle-borg/service/dist/index.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/index.js +1 -2
- 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/main.js +0 -9
- package/node_modules/@noodle-borg/service/dist/main.js.map +1 -1
- 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/routes/plans.d.ts +1 -1
- package/node_modules/@noodle-borg/service/dist/routes/plans.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/routes/plans.js +92 -4
- package/node_modules/@noodle-borg/service/dist/routes/plans.js.map +1 -1
- package/node_modules/@noodle-borg/service/dist/serve.d.ts +0 -6
- package/node_modules/@noodle-borg/service/dist/serve.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/serve.js +0 -6
- package/node_modules/@noodle-borg/service/dist/serve.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
- package/node_modules/@noodle-borg/service/dist/free-tier.d.ts +0 -33
- package/node_modules/@noodle-borg/service/dist/free-tier.d.ts.map +0 -1
- package/node_modules/@noodle-borg/service/dist/free-tier.js +0 -77
- package/node_modules/@noodle-borg/service/dist/free-tier.js.map +0 -1
|
@@ -0,0 +1,427 @@
|
|
|
1
|
+
import { executePreparedTool, executeToolInteractive, resumeTool, resumeToolPreparation, } from '@noodle-borg/runtime';
|
|
2
|
+
import { assistantConfirmationTransition, assistantInputTransition, assistantInteractionTool, assistantPreparedToolContinuation, assistantToolContinuation, auditAssistantInteraction, } from '../assistant-interactive.js';
|
|
3
|
+
import { assistantPreparedArgumentReview, assistantSafeOutput } from '../assistant-presentation.js';
|
|
4
|
+
import { AssistantInteractionCapacityError, } from '../assistant-store.js';
|
|
5
|
+
import { assistantViewAvailableData } from '../assistant-view-availability.js';
|
|
6
|
+
import { readJsonBody, sendJson } from '../http-util.js';
|
|
7
|
+
import { applyBrowserCors, authenticateSession, now, } from './assistant.js';
|
|
8
|
+
import { replayOrConflict, writeUnknownOutcome } from './assistant-interaction-replay.js';
|
|
9
|
+
import { parseInteractionResponse, validateInputContent } from './assistant-interaction-request.js';
|
|
10
|
+
import { assistantInteractionScope, completeAssistantInteractionExecution, resolveAssistantInteractionContext, transitionAssistantInteractionExecution, } from './assistant-interaction-resolution.js';
|
|
11
|
+
import { endInteractionSse, narrateResolvedInteraction, writeInputRequested, writeInteractionError, writeInteractionResolved, writeInteractionSseHeaders, writeToolCompleted, writeToolProposed, writeViewAvailable, } from './assistant-interaction-stream.js';
|
|
12
|
+
class ConfirmationTransitionError extends Error {
|
|
13
|
+
code;
|
|
14
|
+
constructor(code) {
|
|
15
|
+
super(code);
|
|
16
|
+
this.name = 'ConfirmationTransitionError';
|
|
17
|
+
this.code = code;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
/** Accept-only compatibility route consumed by published pre-interaction assistant widgets. */
|
|
21
|
+
export async function handleAssistantConfirmation(req, res, deps) {
|
|
22
|
+
return handleResolution(req, res, deps, true);
|
|
23
|
+
}
|
|
24
|
+
/** Resolve one durable server-held confirmation or structured-input interaction. */
|
|
25
|
+
export async function handleAssistantInteraction(req, res, deps) {
|
|
26
|
+
return handleResolution(req, res, deps, false);
|
|
27
|
+
}
|
|
28
|
+
async function handleResolution(req, res, deps, legacyAcceptOnly) {
|
|
29
|
+
const session = await authenticateSession(req, res, deps);
|
|
30
|
+
if (!session)
|
|
31
|
+
return;
|
|
32
|
+
applyBrowserCors(req, res, session.origin);
|
|
33
|
+
const body = await readJsonBody(req, deps.maxBody);
|
|
34
|
+
if (!body.ok)
|
|
35
|
+
return sendJson(res, body.status, { error: body.error });
|
|
36
|
+
const response = parseInteractionResponse(body.value, legacyAcceptOnly);
|
|
37
|
+
if (!response.ok)
|
|
38
|
+
return sendJson(res, 400, { error: response.error });
|
|
39
|
+
const scope = assistantInteractionScope(response.value.id, session, now(deps));
|
|
40
|
+
const interaction = await deps.store.getInteraction(scope);
|
|
41
|
+
if (!interaction) {
|
|
42
|
+
return sendJson(res, 409, { error: 'interaction is invalid or expired' });
|
|
43
|
+
}
|
|
44
|
+
if (response.value.action !== 'accept') {
|
|
45
|
+
return resolveStop(res, deps, session, interaction, response.value.action);
|
|
46
|
+
}
|
|
47
|
+
if (interaction.kind === 'confirmation' && response.value.content !== undefined) {
|
|
48
|
+
return sendJson(res, 400, { error: 'confirmation content cannot replace reviewed arguments' });
|
|
49
|
+
}
|
|
50
|
+
let acceptedContent = response.value.content;
|
|
51
|
+
if (interaction.kind === 'input' && interaction.status === 'pending') {
|
|
52
|
+
const validated = validateInputContent(interaction, acceptedContent);
|
|
53
|
+
if (!validated.ok) {
|
|
54
|
+
await auditAssistantInteraction({
|
|
55
|
+
audit: deps.audit,
|
|
56
|
+
session,
|
|
57
|
+
interaction,
|
|
58
|
+
eventType: 'assistant.interaction.execution',
|
|
59
|
+
decision: 'deny',
|
|
60
|
+
httpStatus: 400,
|
|
61
|
+
action: 'accept',
|
|
62
|
+
status: 'input_invalid',
|
|
63
|
+
reasonCode: 'arg_invalid',
|
|
64
|
+
});
|
|
65
|
+
return sendJson(res, 400, {
|
|
66
|
+
error: 'interaction input does not match the requested schema',
|
|
67
|
+
code: 'arg_invalid',
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
acceptedContent = validated.value;
|
|
71
|
+
}
|
|
72
|
+
return resolveAccept(res, deps, session, interaction, acceptedContent);
|
|
73
|
+
}
|
|
74
|
+
async function resolveAccept(res, deps, session, interaction, content) {
|
|
75
|
+
if (interaction.status !== 'pending') {
|
|
76
|
+
return replayOrConflict(res, deps, session, interaction, 'accept');
|
|
77
|
+
}
|
|
78
|
+
const target = await deps.registry.get(session.deploymentId);
|
|
79
|
+
if (!target) {
|
|
80
|
+
await auditAssistantInteraction({
|
|
81
|
+
audit: deps.audit,
|
|
82
|
+
session,
|
|
83
|
+
interaction,
|
|
84
|
+
eventType: 'assistant.interaction.execution',
|
|
85
|
+
decision: 'deny',
|
|
86
|
+
httpStatus: 409,
|
|
87
|
+
action: 'accept',
|
|
88
|
+
status: 'deployment_unavailable',
|
|
89
|
+
reasonCode: 'deployment_unavailable',
|
|
90
|
+
});
|
|
91
|
+
return sendJson(res, 409, { error: 'assistant deployment is unavailable' });
|
|
92
|
+
}
|
|
93
|
+
const context = await resolveAssistantInteractionContext(interaction, session, target, deps);
|
|
94
|
+
const claimed = await deps.store.claimInteraction(assistantInteractionScope(interaction.id, session, now(deps)));
|
|
95
|
+
if (claimed.disposition === 'unavailable') {
|
|
96
|
+
await auditAssistantInteraction({
|
|
97
|
+
audit: deps.audit,
|
|
98
|
+
session,
|
|
99
|
+
interaction,
|
|
100
|
+
eventType: 'assistant.interaction.execution',
|
|
101
|
+
decision: 'deny',
|
|
102
|
+
httpStatus: 409,
|
|
103
|
+
action: 'accept',
|
|
104
|
+
status: 'unavailable',
|
|
105
|
+
reasonCode: 'interaction_unavailable',
|
|
106
|
+
});
|
|
107
|
+
return sendJson(res, 409, { error: 'interaction is invalid or expired' });
|
|
108
|
+
}
|
|
109
|
+
if (claimed.disposition === 'replay') {
|
|
110
|
+
return replayOrConflict(res, deps, session, claimed.interaction, 'accept');
|
|
111
|
+
}
|
|
112
|
+
await auditAssistantInteraction({
|
|
113
|
+
audit: deps.audit,
|
|
114
|
+
session,
|
|
115
|
+
interaction: claimed.interaction,
|
|
116
|
+
eventType: 'assistant.interaction.resolved',
|
|
117
|
+
decision: 'allow',
|
|
118
|
+
httpStatus: 200,
|
|
119
|
+
action: 'accept',
|
|
120
|
+
status: 'accepted',
|
|
121
|
+
});
|
|
122
|
+
const executeDeps = {
|
|
123
|
+
...target.served.deps,
|
|
124
|
+
caller: session.caller,
|
|
125
|
+
context,
|
|
126
|
+
};
|
|
127
|
+
let result;
|
|
128
|
+
if (claimed.interaction.kind === 'confirmation') {
|
|
129
|
+
const prepared = assistantPreparedToolContinuation(claimed.interaction);
|
|
130
|
+
const tool = target.served.artifact.tools.find((candidate) => candidate.name === claimed.interaction.tool);
|
|
131
|
+
if (!prepared &&
|
|
132
|
+
tool?.fulfilment.kind === 'flow' &&
|
|
133
|
+
tool.fulfilment.steps.some((step) => step.kind === 'elicit')) {
|
|
134
|
+
result = {
|
|
135
|
+
status: 'failed',
|
|
136
|
+
error: {
|
|
137
|
+
code: 'invalid_continuation',
|
|
138
|
+
message: 'legacy confirmation did not capture elicited input',
|
|
139
|
+
},
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
else {
|
|
143
|
+
result = prepared
|
|
144
|
+
? await executePreparedTool(target.served.artifact, prepared, executeDeps)
|
|
145
|
+
: await executeToolInteractive(target.served.artifact, claimed.interaction.tool, claimed.interaction.arguments, executeDeps);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
else {
|
|
149
|
+
const continuation = assistantToolContinuation(claimed.interaction);
|
|
150
|
+
result = isToolPreparationContinuation(continuation)
|
|
151
|
+
? await resumeToolPreparation(target.served.artifact, continuation, { action: 'accept', content }, executeDeps)
|
|
152
|
+
: await resumeTool(target.served.artifact, continuation, { action: 'accept', content }, executeDeps);
|
|
153
|
+
}
|
|
154
|
+
return finishExecution(res, deps, session, claimed.interaction, context, result, target);
|
|
155
|
+
}
|
|
156
|
+
async function finishExecution(res, deps, session, interaction, context, result, target) {
|
|
157
|
+
const toolName = assistantInteractionTool(interaction) ?? 'unknown_tool';
|
|
158
|
+
if (result.status === 'confirmation_required') {
|
|
159
|
+
const tool = target.served.artifact.tools.find((candidate) => candidate.name === toolName);
|
|
160
|
+
const review = tool
|
|
161
|
+
? assistantPreparedArgumentReview(tool.inputSchema, result.review)
|
|
162
|
+
: { ok: false, code: 'arguments_not_presentable' };
|
|
163
|
+
let transition;
|
|
164
|
+
try {
|
|
165
|
+
if (!review.ok)
|
|
166
|
+
throw new ConfirmationTransitionError(review.code);
|
|
167
|
+
const transitionAt = now(deps);
|
|
168
|
+
const next = assistantConfirmationTransition({
|
|
169
|
+
context,
|
|
170
|
+
tool: toolName,
|
|
171
|
+
arguments: result.review.input,
|
|
172
|
+
review: review.value,
|
|
173
|
+
continuation: result.continuation,
|
|
174
|
+
now: transitionAt,
|
|
175
|
+
});
|
|
176
|
+
transition = await transitionAssistantInteractionExecution(deps, session, interaction, 'confirmation_required', toolName, next, transitionAt);
|
|
177
|
+
}
|
|
178
|
+
catch (error) {
|
|
179
|
+
const code = error instanceof AssistantInteractionCapacityError ||
|
|
180
|
+
error instanceof ConfirmationTransitionError
|
|
181
|
+
? error.code
|
|
182
|
+
: 'confirmation_interaction_failed';
|
|
183
|
+
const failed = await completeAssistantInteractionExecution(deps, session, interaction, 'failed', code, toolName);
|
|
184
|
+
if (!failed)
|
|
185
|
+
return writeUnknownOutcome(res, deps, session, interaction, 'accept');
|
|
186
|
+
await auditAssistantInteraction({
|
|
187
|
+
audit: deps.audit,
|
|
188
|
+
session,
|
|
189
|
+
interaction: failed,
|
|
190
|
+
eventType: 'assistant.interaction.execution',
|
|
191
|
+
decision: 'deny',
|
|
192
|
+
httpStatus: 200,
|
|
193
|
+
action: 'accept',
|
|
194
|
+
status: 'failed',
|
|
195
|
+
reasonCode: code,
|
|
196
|
+
});
|
|
197
|
+
writeInteractionSseHeaders(res, session.origin);
|
|
198
|
+
writeInteractionResolved(res, interaction.id, 'accept');
|
|
199
|
+
writeInteractionError(res, code, false);
|
|
200
|
+
return endInteractionSse(res);
|
|
201
|
+
}
|
|
202
|
+
if (transition.disposition === 'replay') {
|
|
203
|
+
return replayOrConflict(res, deps, session, transition.interaction, 'accept');
|
|
204
|
+
}
|
|
205
|
+
if (transition.disposition !== 'transitioned') {
|
|
206
|
+
return writeUnknownOutcome(res, deps, session, interaction, 'accept');
|
|
207
|
+
}
|
|
208
|
+
if (transition.next.kind !== 'confirmation') {
|
|
209
|
+
return replayOrConflict(res, deps, session, transition.interaction, 'accept');
|
|
210
|
+
}
|
|
211
|
+
const next = transition.next;
|
|
212
|
+
await auditAssistantInteraction({
|
|
213
|
+
audit: deps.audit,
|
|
214
|
+
session,
|
|
215
|
+
interaction: next,
|
|
216
|
+
eventType: 'assistant.interaction.proposed',
|
|
217
|
+
decision: 'allow',
|
|
218
|
+
httpStatus: 201,
|
|
219
|
+
status: 'pending',
|
|
220
|
+
});
|
|
221
|
+
await auditAssistantInteraction({
|
|
222
|
+
audit: deps.audit,
|
|
223
|
+
session,
|
|
224
|
+
interaction: transition.interaction,
|
|
225
|
+
eventType: 'assistant.interaction.execution',
|
|
226
|
+
decision: 'allow',
|
|
227
|
+
httpStatus: 200,
|
|
228
|
+
action: 'accept',
|
|
229
|
+
status: 'confirmation_required',
|
|
230
|
+
});
|
|
231
|
+
writeInteractionSseHeaders(res, session.origin);
|
|
232
|
+
writeInteractionResolved(res, interaction.id, 'accept');
|
|
233
|
+
writeToolProposed(res, next);
|
|
234
|
+
return endInteractionSse(res);
|
|
235
|
+
}
|
|
236
|
+
if (result.status === 'input_required') {
|
|
237
|
+
let transition;
|
|
238
|
+
try {
|
|
239
|
+
const transitionAt = now(deps);
|
|
240
|
+
const next = assistantInputTransition({
|
|
241
|
+
context,
|
|
242
|
+
required: result,
|
|
243
|
+
now: transitionAt,
|
|
244
|
+
});
|
|
245
|
+
transition = await transitionAssistantInteractionExecution(deps, session, interaction, 'input_requested', toolName, next, transitionAt);
|
|
246
|
+
}
|
|
247
|
+
catch (error) {
|
|
248
|
+
const code = error instanceof AssistantInteractionCapacityError
|
|
249
|
+
? error.code
|
|
250
|
+
: 'input_interaction_failed';
|
|
251
|
+
const failed = await completeAssistantInteractionExecution(deps, session, interaction, 'failed', code, toolName);
|
|
252
|
+
if (!failed)
|
|
253
|
+
return writeUnknownOutcome(res, deps, session, interaction, 'accept');
|
|
254
|
+
await auditAssistantInteraction({
|
|
255
|
+
audit: deps.audit,
|
|
256
|
+
session,
|
|
257
|
+
interaction: failed,
|
|
258
|
+
eventType: 'assistant.interaction.execution',
|
|
259
|
+
decision: 'deny',
|
|
260
|
+
httpStatus: 200,
|
|
261
|
+
action: 'accept',
|
|
262
|
+
status: 'failed',
|
|
263
|
+
reasonCode: code,
|
|
264
|
+
});
|
|
265
|
+
writeInteractionSseHeaders(res, session.origin);
|
|
266
|
+
writeInteractionResolved(res, interaction.id, 'accept');
|
|
267
|
+
writeInteractionError(res, code, false);
|
|
268
|
+
return endInteractionSse(res);
|
|
269
|
+
}
|
|
270
|
+
if (transition.disposition === 'replay') {
|
|
271
|
+
return replayOrConflict(res, deps, session, transition.interaction, 'accept');
|
|
272
|
+
}
|
|
273
|
+
if (transition.disposition !== 'transitioned') {
|
|
274
|
+
return writeUnknownOutcome(res, deps, session, interaction, 'accept');
|
|
275
|
+
}
|
|
276
|
+
if (transition.next.kind !== 'input') {
|
|
277
|
+
return replayOrConflict(res, deps, session, transition.interaction, 'accept');
|
|
278
|
+
}
|
|
279
|
+
const next = transition.next;
|
|
280
|
+
await auditAssistantInteraction({
|
|
281
|
+
audit: deps.audit,
|
|
282
|
+
session,
|
|
283
|
+
interaction: next,
|
|
284
|
+
eventType: 'assistant.interaction.proposed',
|
|
285
|
+
decision: 'allow',
|
|
286
|
+
httpStatus: 201,
|
|
287
|
+
status: 'input_requested',
|
|
288
|
+
});
|
|
289
|
+
await auditAssistantInteraction({
|
|
290
|
+
audit: deps.audit,
|
|
291
|
+
session,
|
|
292
|
+
interaction: transition.interaction,
|
|
293
|
+
eventType: 'assistant.interaction.execution',
|
|
294
|
+
decision: 'allow',
|
|
295
|
+
httpStatus: 200,
|
|
296
|
+
action: 'accept',
|
|
297
|
+
status: 'input_requested',
|
|
298
|
+
});
|
|
299
|
+
writeInteractionSseHeaders(res, session.origin);
|
|
300
|
+
writeInteractionResolved(res, interaction.id, 'accept');
|
|
301
|
+
writeInputRequested(res, next);
|
|
302
|
+
return endInteractionSse(res);
|
|
303
|
+
}
|
|
304
|
+
if (result.status === 'failed' || result.status === 'stopped') {
|
|
305
|
+
const code = result.status === 'failed' ? result.error.code : `interaction_${result.action}`;
|
|
306
|
+
const completed = await completeAssistantInteractionExecution(deps, session, interaction, 'failed', code, toolName);
|
|
307
|
+
if (!completed)
|
|
308
|
+
return writeUnknownOutcome(res, deps, session, interaction, 'accept');
|
|
309
|
+
await auditAssistantInteraction({
|
|
310
|
+
audit: deps.audit,
|
|
311
|
+
session,
|
|
312
|
+
interaction: completed,
|
|
313
|
+
eventType: 'assistant.interaction.execution',
|
|
314
|
+
decision: 'deny',
|
|
315
|
+
httpStatus: 200,
|
|
316
|
+
action: 'accept',
|
|
317
|
+
status: 'failed',
|
|
318
|
+
reasonCode: code,
|
|
319
|
+
});
|
|
320
|
+
writeInteractionSseHeaders(res, session.origin);
|
|
321
|
+
writeInteractionResolved(res, interaction.id, 'accept');
|
|
322
|
+
writeInteractionError(res, code, false);
|
|
323
|
+
return endInteractionSse(res);
|
|
324
|
+
}
|
|
325
|
+
const completedTool = target.served.artifact.tools.find((tool) => tool.name === toolName);
|
|
326
|
+
const safeOutput = assistantSafeOutput(completedTool?.outputSchema, result.output);
|
|
327
|
+
const completed = await completeAssistantInteractionExecution(deps, session, interaction, 'succeeded', 'tool_completed', toolName, { result: safeOutput });
|
|
328
|
+
if (!completed)
|
|
329
|
+
return writeUnknownOutcome(res, deps, session, interaction, 'accept');
|
|
330
|
+
await auditAssistantInteraction({
|
|
331
|
+
audit: deps.audit,
|
|
332
|
+
session,
|
|
333
|
+
interaction: completed,
|
|
334
|
+
eventType: 'assistant.interaction.execution',
|
|
335
|
+
decision: 'allow',
|
|
336
|
+
httpStatus: 200,
|
|
337
|
+
action: 'accept',
|
|
338
|
+
status: 'succeeded',
|
|
339
|
+
});
|
|
340
|
+
await deps.store.appendHistory(session.id, [
|
|
341
|
+
{ role: 'assistant', content: `Completed ${toolName}: ${JSON.stringify(safeOutput)}` },
|
|
342
|
+
]);
|
|
343
|
+
writeInteractionSseHeaders(res, session.origin);
|
|
344
|
+
writeInteractionResolved(res, interaction.id, 'accept');
|
|
345
|
+
writeToolCompleted(res, interaction.id, toolName, safeOutput);
|
|
346
|
+
const view = assistantViewAvailableData(target.served.artifact, {
|
|
347
|
+
id: interaction.id,
|
|
348
|
+
tool: toolName,
|
|
349
|
+
result: safeOutput,
|
|
350
|
+
});
|
|
351
|
+
if (view)
|
|
352
|
+
writeViewAvailable(res, view);
|
|
353
|
+
await narrateResolvedInteraction(res, deps, target, session, toolName, 'accept', safeOutput, context);
|
|
354
|
+
return endInteractionSse(res);
|
|
355
|
+
}
|
|
356
|
+
async function resolveStop(res, deps, session, interaction, action) {
|
|
357
|
+
if (interaction.status !== 'pending') {
|
|
358
|
+
return replayOrConflict(res, deps, session, interaction, action);
|
|
359
|
+
}
|
|
360
|
+
const target = await deps.registry.get(session.deploymentId);
|
|
361
|
+
const context = target
|
|
362
|
+
? await resolveAssistantInteractionContext(interaction, session, target, deps)
|
|
363
|
+
: undefined;
|
|
364
|
+
if (interaction.kind === 'input' && target && context) {
|
|
365
|
+
// This validates the stored continuation/artifact binding; decline/cancel has no connector side effect.
|
|
366
|
+
const continuation = assistantToolContinuation(interaction);
|
|
367
|
+
const executeDeps = {
|
|
368
|
+
...target.served.deps,
|
|
369
|
+
caller: session.caller,
|
|
370
|
+
context,
|
|
371
|
+
};
|
|
372
|
+
if (isToolPreparationContinuation(continuation)) {
|
|
373
|
+
await resumeToolPreparation(target.served.artifact, continuation, { action }, executeDeps);
|
|
374
|
+
}
|
|
375
|
+
else {
|
|
376
|
+
await resumeTool(target.served.artifact, continuation, { action }, executeDeps);
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
const completion = await deps.store.completeInteraction({
|
|
380
|
+
...assistantInteractionScope(interaction.id, session, now(deps)),
|
|
381
|
+
completion: { status: action === 'decline' ? 'declined' : 'cancelled' },
|
|
382
|
+
});
|
|
383
|
+
if (completion.disposition === 'replay') {
|
|
384
|
+
return replayOrConflict(res, deps, session, completion.interaction, action);
|
|
385
|
+
}
|
|
386
|
+
if (completion.disposition !== 'completed') {
|
|
387
|
+
await auditAssistantInteraction({
|
|
388
|
+
audit: deps.audit,
|
|
389
|
+
session,
|
|
390
|
+
interaction,
|
|
391
|
+
eventType: 'assistant.interaction.resolved',
|
|
392
|
+
decision: 'deny',
|
|
393
|
+
httpStatus: 409,
|
|
394
|
+
action,
|
|
395
|
+
status: 'unknown',
|
|
396
|
+
reasonCode: 'interaction_state_changed',
|
|
397
|
+
});
|
|
398
|
+
return sendJson(res, 409, { error: 'interaction state changed before it was resolved' });
|
|
399
|
+
}
|
|
400
|
+
await auditAssistantInteraction({
|
|
401
|
+
audit: deps.audit,
|
|
402
|
+
session,
|
|
403
|
+
interaction: completion.interaction,
|
|
404
|
+
eventType: 'assistant.interaction.resolved',
|
|
405
|
+
decision: 'deny',
|
|
406
|
+
httpStatus: 200,
|
|
407
|
+
action,
|
|
408
|
+
status: action === 'decline' ? 'declined' : 'cancelled',
|
|
409
|
+
});
|
|
410
|
+
const toolName = assistantInteractionTool(completion.interaction) ?? 'tool request';
|
|
411
|
+
await deps.store.appendHistory(session.id, [
|
|
412
|
+
{
|
|
413
|
+
role: 'assistant',
|
|
414
|
+
content: `${action === 'decline' ? 'Declined' : 'Cancelled'} ${toolName}; it was not executed.`,
|
|
415
|
+
},
|
|
416
|
+
]);
|
|
417
|
+
writeInteractionSseHeaders(res, session.origin);
|
|
418
|
+
writeInteractionResolved(res, interaction.id, action);
|
|
419
|
+
if (target && context) {
|
|
420
|
+
await narrateResolvedInteraction(res, deps, target, session, toolName, action, undefined, context);
|
|
421
|
+
}
|
|
422
|
+
return endInteractionSse(res);
|
|
423
|
+
}
|
|
424
|
+
function isToolPreparationContinuation(continuation) {
|
|
425
|
+
return continuation.kind === 'confirmation_preparation';
|
|
426
|
+
}
|
|
427
|
+
//# sourceMappingURL=assistant-interactions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assistant-interactions.js","sourceRoot":"","sources":["../../src/routes/assistant-interactions.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,mBAAmB,EACnB,sBAAsB,EAGtB,UAAU,EACV,qBAAqB,GAGtB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,+BAA+B,EAC/B,wBAAwB,EACxB,wBAAwB,EACxB,iCAAiC,EACjC,yBAAyB,EACzB,yBAAyB,GAC1B,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,+BAA+B,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AACpG,OAAO,EACL,iCAAiC,GAIlC,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,0BAA0B,EAAE,MAAM,mCAAmC,CAAC;AAC/E,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,EAEL,gBAAgB,EAChB,mBAAmB,EACnB,GAAG,GACJ,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AAC1F,OAAO,EAAE,wBAAwB,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AACpG,OAAO,EACL,yBAAyB,EACzB,qCAAqC,EACrC,kCAAkC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
+
import type { AssistantSessionRecord } from '../assistant-store.js';
|
|
3
|
+
import type { AssistantRouteDeps } from './assistant.js';
|
|
4
|
+
export declare function handleAssistantPreflight(req: IncomingMessage, res: ServerResponse): void;
|
|
5
|
+
export declare function authenticateSession(req: IncomingMessage, res: ServerResponse, deps: AssistantRouteDeps): Promise<AssistantSessionRecord | undefined>;
|
|
6
|
+
export declare function applyBrowserCors(req: IncomingMessage, res: ServerResponse, expectedOrigin?: string): void;
|
|
7
|
+
export declare function now(deps: AssistantRouteDeps): Date;
|
|
8
|
+
//# sourceMappingURL=assistant-route-http.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assistant-route-http.d.ts","sourceRoot":"","sources":["../../src/routes/assistant-route-http.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AACjE,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAEpE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAEzD,wBAAgB,wBAAwB,CAAC,GAAG,EAAE,eAAe,EAAE,GAAG,EAAE,cAAc,GAAG,IAAI,CAUxF;AAED,wBAAsB,mBAAmB,CACvC,GAAG,EAAE,eAAe,EACpB,GAAG,EAAE,cAAc,EACnB,IAAI,EAAE,kBAAkB,GACvB,OAAO,CAAC,sBAAsB,GAAG,SAAS,CAAC,CAkB7C;AAED,wBAAgB,gBAAgB,CAC9B,GAAG,EAAE,eAAe,EACpB,GAAG,EAAE,cAAc,EACnB,cAAc,CAAC,EAAE,MAAM,GACtB,IAAI,CAWN;AAED,wBAAgB,GAAG,CAAC,IAAI,EAAE,kBAAkB,GAAG,IAAI,CAElD"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { sendForbidden, sendUnauthorized } from '../http-util.js';
|
|
2
|
+
export function handleAssistantPreflight(req, res) {
|
|
3
|
+
const origin = typeof req.headers.origin === 'string' ? req.headers.origin : 'null';
|
|
4
|
+
res.writeHead(204, {
|
|
5
|
+
'access-control-allow-origin': origin,
|
|
6
|
+
'access-control-allow-methods': 'POST, OPTIONS',
|
|
7
|
+
'access-control-allow-headers': 'authorization, content-type',
|
|
8
|
+
'access-control-max-age': '600',
|
|
9
|
+
vary: 'Origin',
|
|
10
|
+
});
|
|
11
|
+
res.end();
|
|
12
|
+
}
|
|
13
|
+
export async function authenticateSession(req, res, deps) {
|
|
14
|
+
const match = /^Bearer\s+(.+)$/i.exec(req.headers.authorization ?? '');
|
|
15
|
+
if (!match?.[1]) {
|
|
16
|
+
applyBrowserCors(req, res);
|
|
17
|
+
sendUnauthorized(res, 'invalid assistant session');
|
|
18
|
+
return undefined;
|
|
19
|
+
}
|
|
20
|
+
const session = await deps.store.getSession(match[1], now(deps));
|
|
21
|
+
if (!session) {
|
|
22
|
+
applyBrowserCors(req, res);
|
|
23
|
+
sendUnauthorized(res, 'invalid assistant session');
|
|
24
|
+
return undefined;
|
|
25
|
+
}
|
|
26
|
+
if (req.headers.origin !== session.origin) {
|
|
27
|
+
sendForbidden(res, 'origin is not allowed');
|
|
28
|
+
return undefined;
|
|
29
|
+
}
|
|
30
|
+
return session;
|
|
31
|
+
}
|
|
32
|
+
export function applyBrowserCors(req, res, expectedOrigin) {
|
|
33
|
+
const origin = typeof req.headers.origin === 'string' ? req.headers.origin : undefined;
|
|
34
|
+
if (!origin || (expectedOrigin !== undefined && origin !== expectedOrigin))
|
|
35
|
+
return;
|
|
36
|
+
try {
|
|
37
|
+
const parsed = new URL(origin);
|
|
38
|
+
if (parsed.origin !== origin || !['http:', 'https:'].includes(parsed.protocol))
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
catch {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
res.setHeader('access-control-allow-origin', origin);
|
|
45
|
+
res.setHeader('vary', 'Origin');
|
|
46
|
+
}
|
|
47
|
+
export function now(deps) {
|
|
48
|
+
return deps.clock?.() ?? new Date();
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=assistant-route-http.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assistant-route-http.js","sourceRoot":"","sources":["../../src/routes/assistant-route-http.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAGlE,MAAM,UAAU,wBAAwB,CAAC,GAAoB,EAAE,GAAmB;IAChF,MAAM,MAAM,GAAG,OAAO,GAAG,CAAC,OAAO,CAAC,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC;IACpF,GAAG,CAAC,SAAS,CAAC,GAAG,EAAE;QACjB,6BAA6B,EAAE,MAAM;QACrC,8BAA8B,EAAE,eAAe;QAC/C,8BAA8B,EAAE,6BAA6B;QAC7D,wBAAwB,EAAE,KAAK;QAC/B,IAAI,EAAE,QAAQ;KACf,CAAC,CAAC;IACH,GAAG,CAAC,GAAG,EAAE,CAAC;AACZ,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,mBAAmB,CACvC,GAAoB,EACpB,GAAmB,EACnB,IAAwB;IAExB,MAAM,KAAK,GAAG,kBAAkB,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,aAAa,IAAI,EAAE,CAAC,CAAC;IACvE,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAChB,gBAAgB,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;QAC3B,gBAAgB,CAAC,GAAG,EAAE,2BAA2B,CAAC,CAAC;QACnD,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC;IACjE,IAAI,CAAC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type AssistantStore } from '../assistant-store.js';
|
|
|
3
3
|
import type { DeployAuthGate } from '../auth/deploy-gate.js';
|
|
4
4
|
import type { ServerRegistry } from '../registry.js';
|
|
5
5
|
import type { AuditSink } from '../store/audit.js';
|
|
6
|
-
import {
|
|
6
|
+
import type { ControlPlaneStore, TenantRef } from '../store.js';
|
|
7
|
+
import { applyBrowserCors, authenticateSession, handleAssistantPreflight, now } from './assistant-route-http.js';
|
|
8
|
+
export { applyBrowserCors, authenticateSession, handleAssistantPreflight, now };
|
|
7
9
|
export interface AssistantRouteDeps {
|
|
8
10
|
readonly registry: ServerRegistry;
|
|
9
11
|
readonly store: AssistantStore;
|
|
@@ -19,6 +21,4 @@ export declare function handleConsoleApprovalNonce(req: IncomingMessage, res: Se
|
|
|
19
21
|
export declare function handleAssistantClients(req: IncomingMessage, res: ServerResponse, tenant: TenantRef, id: string | undefined, action: 'collection' | 'rotate' | 'item', deps: AssistantRouteDeps): Promise<void>;
|
|
20
22
|
export declare function handleAssistantSession(req: IncomingMessage, res: ServerResponse, deps: AssistantRouteDeps): Promise<void>;
|
|
21
23
|
export declare function handleAssistantTurn(req: IncomingMessage, res: ServerResponse, deps: AssistantRouteDeps): Promise<void>;
|
|
22
|
-
export declare function handleAssistantConfirmation(req: IncomingMessage, res: ServerResponse, deps: AssistantRouteDeps): Promise<void>;
|
|
23
|
-
export declare function handleAssistantPreflight(req: IncomingMessage, res: ServerResponse): void;
|
|
24
24
|
//# sourceMappingURL=assistant.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assistant.d.ts","sourceRoot":"","sources":["../../src/routes/assistant.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"assistant.d.ts","sourceRoot":"","sources":["../../src/routes/assistant.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM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