@abot-ai/runtime 1.8.0 → 1.9.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/README.md +216 -222
- package/dist/scripts/runtime-setup-files.js +46 -2
- package/dist/src/capabilities/tool-definition-validator/definition-parser.js +8 -0
- package/dist/src/capabilities/tool-types.d.ts +4 -0
- package/dist/src/model-gateway/client/chat.js +9 -5
- package/dist/src/model-gateway/client/invocation-error.d.ts +9 -0
- package/dist/src/model-gateway/client/invocation-error.js +30 -0
- package/dist/src/model-gateway/client/stream-consumer.js +9 -2
- package/dist/src/model-gateway/client/stream-parser.js +2 -1
- package/dist/src/model-gateway/protocol/message-contract.d.ts +1 -0
- package/dist/src/model-gateway/protocol/message-contract.js +1 -1
- package/dist/src/model-gateway/server/chat-handler.js +5 -7
- package/dist/src/model-gateway/server/chat-stream-response.d.ts +7 -0
- package/dist/src/model-gateway/server/chat-stream-response.js +25 -0
- package/dist/src/runtime/adapters/registered-tool-normal-invocations/execution/approval.d.ts +5 -1
- package/dist/src/runtime/adapters/registered-tool-normal-invocations/execution/approval.js +15 -1
- package/dist/src/runtime/adapters/registered-tool-normal-invocations/execution/prepared-execution.js +7 -5
- package/dist/src/runtime/adapters/registered-tool-normal-invocations/execution/prepared-snapshot.js +9 -2
- package/dist/src/runtime/adapters/registered-tool-worker-capabilities/payload-rejection.d.ts +2 -2
- package/dist/src/runtime/adapters/registered-tool-worker-capabilities/payload-rejection.js +2 -2
- package/dist/src/runtime/adapters/registered-tool-worker-capabilities/prepared-execution.js +17 -11
- package/dist/src/runtime/automations/service.d.ts +1 -1
- package/dist/src/runtime/capabilities/automation-builder/tool-module.js +4 -4
- package/dist/src/runtime/capabilities/automations/draft-index.d.ts +1 -1
- package/dist/src/runtime/capabilities/automations/tool-module.js +4 -4
- package/dist/src/runtime/capabilities/core-tool-contracts.d.ts +29 -0
- package/dist/src/runtime/capabilities/core-tool-contracts.js +38 -0
- package/dist/src/runtime/capabilities/knowledge-skills/read-many.d.ts +4 -0
- package/dist/src/runtime/capabilities/knowledge-skills/read-many.js +21 -0
- package/dist/src/runtime/capabilities/knowledge-skills/read-targets.d.ts +13 -0
- package/dist/src/runtime/capabilities/knowledge-skills/read-targets.js +44 -0
- package/dist/src/runtime/capabilities/knowledge-skills/tool-contract.d.ts +141 -0
- package/dist/src/runtime/capabilities/knowledge-skills/tool-contract.js +58 -0
- package/dist/src/runtime/capabilities/knowledge-skills/tool-module.d.ts +4 -0
- package/dist/src/runtime/capabilities/knowledge-skills/tool-module.js +78 -0
- package/dist/src/runtime/capabilities/knowledge-skills/tool-output.d.ts +12 -0
- package/dist/src/runtime/capabilities/knowledge-skills/tool-output.js +21 -0
- package/dist/src/runtime/capabilities/knowledge-skills/write-contract.d.ts +77 -0
- package/dist/src/runtime/capabilities/knowledge-skills/write-contract.js +28 -0
- package/dist/src/runtime/capabilities/knowledge-skills/write-operations.d.ts +3 -0
- package/dist/src/runtime/capabilities/knowledge-skills/write-operations.js +34 -0
- package/dist/src/runtime/capabilities/scheduling/tool-module.js +3 -3
- package/dist/src/runtime/capabilities/tool-availability.js +6 -0
- package/dist/src/runtime/composition.d.ts +5 -0
- package/dist/src/runtime/context/capability-brief.d.ts +2 -2
- package/dist/src/runtime/context/capability-brief.js +3 -3
- package/dist/src/runtime/context/capability-descriptions.d.ts +3 -2
- package/dist/src/runtime/context/capability-descriptions.js +57 -20
- package/dist/src/runtime/context/capability-result-compaction-source.d.ts +3 -1
- package/dist/src/runtime/context/capability-result-compaction-source.js +13 -1
- package/dist/src/runtime/context/core-skill-read-context.d.ts +16 -0
- package/dist/src/runtime/context/core-skill-read-context.js +76 -0
- package/dist/src/runtime/context/exact-evidence-match.d.ts +3 -0
- package/dist/src/runtime/context/exact-evidence-match.js +34 -0
- package/dist/src/runtime/context/model-step-compaction.js +20 -6
- package/dist/src/runtime/context/semantic-compaction/core-skill-read-source.d.ts +9 -0
- package/dist/src/runtime/context/semantic-compaction/core-skill-read-source.js +38 -0
- package/dist/src/runtime/context/semantic-compaction/generation-contracts.d.ts +2 -0
- package/dist/src/runtime/context/semantic-compaction/prompt.js +7 -7
- package/dist/src/runtime/context/semantic-compaction/run.js +10 -3
- package/dist/src/runtime/context/semantic-compaction/super-source-integrity.js +33 -3
- package/dist/src/runtime/context/session-artifact-paths.d.ts +2 -1
- package/dist/src/runtime/context/session-artifact-paths.js +2 -1
- package/dist/src/runtime/context/session-memory/model-step-controller.d.ts +2 -2
- package/dist/src/runtime/context/super-worker-compaction-failure.d.ts +1 -1
- package/dist/src/runtime/context/super-worker-compaction-failure.js +2 -1
- package/dist/src/runtime/context/super-worker-compaction-sidecar.d.ts +2 -1
- package/dist/src/runtime/context/super-worker-compaction-sidecar.js +9 -3
- package/dist/src/runtime/default-environment-adapters.d.ts +2 -1
- package/dist/src/runtime/default-environment-adapters.js +5 -1
- package/dist/src/runtime/knowledge-skills/available-skills-projection.d.ts +17 -0
- package/dist/src/runtime/knowledge-skills/available-skills-projection.js +66 -0
- package/dist/src/runtime/knowledge-skills/available-skills.d.ts +7 -0
- package/dist/src/runtime/knowledge-skills/available-skills.js +17 -0
- package/dist/src/runtime/knowledge-skills/builtins/abot-studio.d.ts +2 -0
- package/dist/src/runtime/knowledge-skills/builtins/abot-studio.js +27 -0
- package/dist/src/runtime/knowledge-skills/builtins/computer-use.d.ts +2 -0
- package/dist/src/runtime/knowledge-skills/builtins/computer-use.js +34 -0
- package/dist/src/runtime/knowledge-skills/builtins/skill-creator.d.ts +2 -0
- package/dist/src/runtime/knowledge-skills/builtins/skill-creator.js +29 -0
- package/dist/src/runtime/knowledge-skills/builtins/technical-work.d.ts +2 -0
- package/dist/src/runtime/knowledge-skills/builtins/technical-work.js +27 -0
- package/dist/src/runtime/knowledge-skills/catalog.d.ts +2 -0
- package/dist/src/runtime/knowledge-skills/catalog.js +12 -0
- package/dist/src/runtime/knowledge-skills/personal-contracts.d.ts +48 -0
- package/dist/src/runtime/knowledge-skills/personal-contracts.js +29 -0
- package/dist/src/runtime/knowledge-skills/personal-documents.d.ts +6 -0
- package/dist/src/runtime/knowledge-skills/personal-documents.js +56 -0
- package/dist/src/runtime/knowledge-skills/personal-management.d.ts +9 -0
- package/dist/src/runtime/knowledge-skills/personal-management.js +64 -0
- package/dist/src/runtime/knowledge-skills/personal-repository.d.ts +6 -0
- package/dist/src/runtime/knowledge-skills/personal-repository.js +76 -0
- package/dist/src/runtime/knowledge-skills/personal-store.d.ts +4 -0
- package/dist/src/runtime/knowledge-skills/personal-store.js +33 -0
- package/dist/src/runtime/knowledge-skills/read-evidence.d.ts +3 -0
- package/dist/src/runtime/knowledge-skills/read-evidence.js +13 -0
- package/dist/src/runtime/knowledge-skills/store.d.ts +19 -0
- package/dist/src/runtime/knowledge-skills/store.js +41 -0
- package/dist/src/runtime/local-application.d.ts +2 -1
- package/dist/src/runtime/local-host/app-service-dispatch.d.ts +1 -0
- package/dist/src/runtime/local-host/app-service-dispatch.js +5 -0
- package/dist/src/runtime/local-host/client-services.d.ts +3 -1
- package/dist/src/runtime/local-host/client-services.js +3 -2
- package/dist/src/runtime/long-term-memory/conversation-authoring/context.d.ts +7 -1
- package/dist/src/runtime/long-term-memory/conversation-authoring/context.js +51 -25
- package/dist/src/runtime/long-term-memory/conversation-authoring/plain-text-context.d.ts +5 -0
- package/dist/src/runtime/long-term-memory/conversation-authoring/plain-text-context.js +28 -0
- package/dist/src/runtime/long-term-memory/initial-context.d.ts +18 -0
- package/dist/src/runtime/long-term-memory/initial-context.js +57 -0
- package/dist/src/runtime/long-term-memory/projection.js +1 -1
- package/dist/src/runtime/model/context-compaction-admission.d.ts +1 -0
- package/dist/src/runtime/model/context-compaction-admission.js +35 -1
- package/dist/src/runtime/model/context-compaction-contracts.d.ts +9 -1
- package/dist/src/runtime/model/invoke-step.js +6 -2
- package/dist/src/runtime/model/provider-failure.d.ts +13 -0
- package/dist/src/runtime/model/provider-failure.js +37 -0
- package/dist/src/runtime/orchestration/role-calls/activation-budget.js +1 -0
- package/dist/src/runtime/orchestration/role-calls/candidate-validation.js +4 -1
- package/dist/src/runtime/orchestration/role-calls/checkpoint-state.d.ts +1 -1
- package/dist/src/runtime/orchestration/role-calls/checkpoint-state.js +7 -3
- package/dist/src/runtime/orchestration/role-calls/command-decoder.js +3 -0
- package/dist/src/runtime/orchestration/role-calls/command-dispatch/skill-read-transition.d.ts +4 -0
- package/dist/src/runtime/orchestration/role-calls/command-dispatch/skill-read-transition.js +48 -0
- package/dist/src/runtime/orchestration/role-calls/command-dispatch.js +3 -0
- package/dist/src/runtime/orchestration/role-calls/contracts.d.ts +8 -4
- package/dist/src/runtime/orchestration/role-calls/contracts.js +3 -3
- package/dist/src/runtime/orchestration/role-calls/ledger.d.ts +2 -1
- package/dist/src/runtime/orchestration/role-calls/ledger.js +2 -2
- package/dist/src/runtime/orchestration/role-calls/memory-recall-contract.d.ts +7 -0
- package/dist/src/runtime/orchestration/role-calls/memory-recall-state-validation.d.ts +2 -0
- package/dist/src/runtime/orchestration/role-calls/memory-recall-state-validation.js +88 -0
- package/dist/src/runtime/orchestration/role-calls/reducer.d.ts +1 -1
- package/dist/src/runtime/orchestration/role-calls/reducer.js +2 -1
- package/dist/src/runtime/orchestration/role-calls/skill-read.d.ts +47 -0
- package/dist/src/runtime/orchestration/role-calls/skill-read.js +196 -0
- package/dist/src/runtime/orchestration/role-executors/activation/model-output-failure.d.ts +1 -1
- package/dist/src/runtime/orchestration/role-executors/activation/model-output-failure.js +4 -2
- package/dist/src/runtime/orchestration/worker-capabilities/binding/create-binding.js +4 -1
- package/dist/src/runtime/orchestration/worker-capabilities/contracts.d.ts +4 -2
- package/dist/src/runtime/orchestration/worker-capabilities/contracts.js +2 -2
- package/dist/src/runtime/orchestration/worker-capabilities/execution/approval-group.js +10 -4
- package/dist/src/runtime/orchestration/worker-capabilities/execution/execution-freshness.d.ts +5 -0
- package/dist/src/runtime/orchestration/worker-capabilities/execution/execution-freshness.js +31 -0
- package/dist/src/runtime/orchestration/worker-capabilities/payload-compaction-transport.d.ts +2 -0
- package/dist/src/runtime/orchestration/worker-capabilities/payload-compaction-transport.js +7 -2
- package/dist/src/runtime/orchestration/worker-capabilities/supervisor-skill-authority.d.ts +19 -0
- package/dist/src/runtime/orchestration/worker-capabilities/supervisor-skill-authority.js +43 -0
- package/dist/src/runtime/plugins/loader.js +7 -6
- package/dist/src/runtime/plugins/manifest-projection.js +3 -0
- package/dist/src/runtime/request/approval-wait/preflight.js +1 -0
- package/dist/src/runtime/request/bound-runtime-handler.js +1 -0
- package/dist/src/runtime/request/capability-execution-freshness.js +6 -1
- package/dist/src/runtime/request/contracts.d.ts +2 -0
- package/dist/src/runtime/request/execution-agent-root-execution.js +11 -1
- package/dist/src/runtime/request/execution-payload-compacted-evidence.d.ts +2 -2
- package/dist/src/runtime/request/execution-scope-surfaces.d.ts +2 -0
- package/dist/src/runtime/request/execution-scope-surfaces.js +7 -0
- package/dist/src/runtime/request/execution-scope.d.ts +6 -2
- package/dist/src/runtime/request/execution-scope.js +11 -0
- package/dist/src/runtime/request/payload-settled-evidence.d.ts +11 -0
- package/dist/src/runtime/request/payload-settled-evidence.js +29 -0
- package/dist/src/runtime/request/prepared-execution.js +2 -0
- package/dist/src/runtime/request/role-call-delegation-events.d.ts +19 -0
- package/dist/src/runtime/request/role-call-delegation-events.js +52 -0
- package/dist/src/runtime/request/role-call-return-events.d.ts +19 -0
- package/dist/src/runtime/request/role-call-return-events.js +63 -0
- package/dist/src/runtime/request/role-executor-composition.js +2 -2
- package/dist/src/runtime/request/root-capability-binding.d.ts +24 -0
- package/dist/src/runtime/request/root-capability-binding.js +57 -0
- package/dist/src/runtime/request/root-capability-catalog.d.ts +16 -0
- package/dist/src/runtime/request/root-capability-catalog.js +20 -0
- package/dist/src/runtime/request/root-contract.d.ts +13 -1
- package/dist/src/runtime/request/root-execution-kernel.js +36 -68
- package/dist/src/runtime/request/root-reference-action.d.ts +15 -0
- package/dist/src/runtime/request/root-reference-action.js +48 -0
- package/dist/src/runtime/request/root-skill-read.d.ts +13 -0
- package/dist/src/runtime/request/root-skill-read.js +102 -0
- package/dist/src/runtime/request/runner.js +19 -3
- package/dist/src/runtime/request/super-payload-context-failure.js +13 -4
- package/dist/src/runtime/request/supervisor-root-execution.js +54 -1
- package/dist/src/runtime/request/supervisor-skill-edit-target.d.ts +9 -0
- package/dist/src/runtime/request/supervisor-skill-edit-target.js +25 -0
- package/dist/src/runtime/request/supervisor-skill-payload-context.d.ts +21 -0
- package/dist/src/runtime/request/supervisor-skill-payload-context.js +91 -0
- package/dist/src/runtime/request/supervisor-skill-write-preparation.d.ts +25 -0
- package/dist/src/runtime/request/supervisor-skill-write-preparation.js +71 -0
- package/dist/src/runtime/request/worker-capability-composition.d.ts +4 -1
- package/dist/src/runtime/request/worker-capability-composition.js +4 -1
- package/dist/src/runtime/request/worker-capability-payload.d.ts +1 -1
- package/dist/src/runtime/request/worker-capability-payload.js +44 -37
- package/dist/src/runtime/runtime-environment.d.ts +2 -0
- package/dist/src/runtime/runtime-environment.js +12 -1
- package/dist/src/runtime/scheduler/contracts.d.ts +4 -0
- package/dist/src/runtime/scheduler/run-list-filter.d.ts +11 -0
- package/dist/src/runtime/scheduler/run-list-filter.js +56 -0
- package/dist/src/runtime/scheduler/run-list-query.d.ts +2 -2
- package/dist/src/runtime/scheduler/run-list-query.js +4 -1
- package/dist/src/runtime/steps/auditor-decision/contracts.d.ts +2 -0
- package/dist/src/runtime/steps/auditor-decision/evidence-representation.d.ts +2 -2
- package/dist/src/runtime/steps/auditor-decision/evidence-representation.js +2 -34
- package/dist/src/runtime/steps/auditor-decision/input.js +21 -3
- package/dist/src/runtime/steps/auditor-decision/projection.js +5 -0
- package/dist/src/runtime/steps/auditor-decision/prompt.d.ts +1 -1
- package/dist/src/runtime/steps/auditor-decision/prompt.js +14 -3
- package/dist/src/runtime/steps/capability-execution-guidance.d.ts +7 -0
- package/dist/src/runtime/steps/capability-execution-guidance.js +28 -0
- package/dist/src/runtime/steps/capability-execution-instructions.d.ts +0 -2
- package/dist/src/runtime/steps/capability-execution-instructions.js +0 -2
- package/dist/src/runtime/steps/execution-agent/capability-result-context.d.ts +5 -2
- package/dist/src/runtime/steps/execution-agent/capability-result-context.js +22 -3
- package/dist/src/runtime/steps/execution-agent/compaction.d.ts +3 -2
- package/dist/src/runtime/steps/execution-agent/compaction.js +9 -1
- package/dist/src/runtime/steps/execution-agent/contracts.d.ts +10 -0
- package/dist/src/runtime/steps/execution-agent/decision-parsing.js +13 -1
- package/dist/src/runtime/steps/execution-agent/direct-response-configuration.d.ts +3 -0
- package/dist/src/runtime/steps/execution-agent/direct-response-configuration.js +64 -0
- package/dist/src/runtime/steps/execution-agent/direct-response-contract.d.ts +7 -0
- package/dist/src/runtime/steps/execution-agent/direct-response-contract.js +56 -0
- package/dist/src/runtime/steps/execution-agent/direct-response-policy.d.ts +9 -0
- package/dist/src/runtime/steps/execution-agent/direct-response-policy.js +30 -0
- package/dist/src/runtime/steps/execution-agent/direct-response-prompt.d.ts +7 -0
- package/dist/src/runtime/steps/execution-agent/direct-response-prompt.js +43 -0
- package/dist/src/runtime/steps/execution-agent/format.js +2 -0
- package/dist/src/runtime/steps/execution-agent/input.d.ts +2 -0
- package/dist/src/runtime/steps/execution-agent/input.js +35 -2
- package/dist/src/runtime/steps/execution-agent/plugin-catalog.d.ts +4 -0
- package/dist/src/runtime/steps/execution-agent/plugin-catalog.js +8 -0
- package/dist/src/runtime/steps/execution-agent/prompt.d.ts +1 -0
- package/dist/src/runtime/steps/execution-agent/prompt.js +42 -41
- package/dist/src/runtime/steps/execution-agent/refinement-input.d.ts +1 -0
- package/dist/src/runtime/steps/execution-agent/refinement-prompt.js +4 -1
- package/dist/src/runtime/steps/execution-agent/response-prompt.js +1 -0
- package/dist/src/runtime/steps/execution-agent/response-run.js +6 -12
- package/dist/src/runtime/steps/execution-agent/run.js +5 -2
- package/dist/src/runtime/steps/execution-agent/state-context.d.ts +2 -3
- package/dist/src/runtime/steps/execution-agent/state-context.js +3 -40
- package/dist/src/runtime/steps/knowledge-skill-instructions.d.ts +3 -0
- package/dist/src/runtime/steps/knowledge-skill-instructions.js +3 -0
- package/dist/src/runtime/steps/planner-decision/capability-brief.d.ts +4 -2
- package/dist/src/runtime/steps/planner-decision/capability-brief.js +5 -1
- package/dist/src/runtime/steps/planner-decision/input.d.ts +2 -2
- package/dist/src/runtime/steps/planner-decision/input.js +7 -1
- package/dist/src/runtime/steps/planner-decision/prompt.js +29 -49
- package/dist/src/runtime/steps/planner-graph/input.d.ts +2 -2
- package/dist/src/runtime/steps/planner-graph/input.js +9 -8
- package/dist/src/runtime/steps/planner-graph/prompt.js +2 -2
- package/dist/src/runtime/steps/planner-graph/run.d.ts +2 -2
- package/dist/src/runtime/steps/planner-graph/run.js +5 -5
- package/dist/src/runtime/steps/planner-graph/skill-guidance.d.ts +5 -0
- package/dist/src/runtime/steps/planner-graph/skill-guidance.js +62 -0
- package/dist/src/runtime/steps/reviewer-decision/final-evidence.d.ts +1 -0
- package/dist/src/runtime/steps/reviewer-decision/final-evidence.js +3 -1
- package/dist/src/runtime/steps/reviewer-decision/input.d.ts +3 -1
- package/dist/src/runtime/steps/reviewer-decision/input.js +2 -22
- package/dist/src/runtime/steps/reviewer-decision/model-context.d.ts +21 -0
- package/dist/src/runtime/steps/reviewer-decision/model-context.js +32 -1
- package/dist/src/runtime/steps/reviewer-decision/projection.js +4 -0
- package/dist/src/runtime/steps/reviewer-decision/prompt.d.ts +1 -1
- package/dist/src/runtime/steps/reviewer-decision/prompt.js +15 -4
- package/dist/src/runtime/steps/reviewer-decision/run.d.ts +2 -0
- package/dist/src/runtime/steps/reviewer-decision/run.js +6 -0
- package/dist/src/runtime/steps/skill-read-decision.d.ts +34 -0
- package/dist/src/runtime/steps/skill-read-decision.js +91 -0
- package/dist/src/runtime/steps/supervisor-decision/artifact-paths.d.ts +22 -0
- package/dist/src/runtime/steps/supervisor-decision/artifact-paths.js +132 -0
- package/dist/src/runtime/steps/supervisor-decision/capability-brief.d.ts +2 -0
- package/dist/src/runtime/steps/supervisor-decision/capability-brief.js +9 -2
- package/dist/src/runtime/steps/supervisor-decision/contracts.d.ts +12 -3
- package/dist/src/runtime/steps/supervisor-decision/contracts.js +3 -0
- package/dist/src/runtime/steps/supervisor-decision/decision-phases.d.ts +37 -0
- package/dist/src/runtime/steps/supervisor-decision/decision-phases.js +124 -0
- package/dist/src/runtime/steps/supervisor-decision/diagnostics.d.ts +5 -1
- package/dist/src/runtime/steps/supervisor-decision/diagnostics.js +4 -0
- package/dist/src/runtime/steps/supervisor-decision/format.d.ts +1 -0
- package/dist/src/runtime/steps/supervisor-decision/format.js +2 -0
- package/dist/src/runtime/steps/supervisor-decision/input.d.ts +8 -1
- package/dist/src/runtime/steps/supervisor-decision/input.js +35 -11
- package/dist/src/runtime/steps/supervisor-decision/parser.d.ts +1 -0
- package/dist/src/runtime/steps/supervisor-decision/parser.js +11 -0
- package/dist/src/runtime/steps/supervisor-decision/preparation-input.d.ts +26 -0
- package/dist/src/runtime/steps/supervisor-decision/preparation-input.js +39 -0
- package/dist/src/runtime/steps/supervisor-decision/preparation.d.ts +17 -0
- package/dist/src/runtime/steps/supervisor-decision/preparation.js +65 -0
- package/dist/src/runtime/steps/supervisor-decision/presentation.d.ts +13 -0
- package/dist/src/runtime/steps/supervisor-decision/presentation.js +47 -0
- package/dist/src/runtime/steps/supervisor-decision/prompt.d.ts +5 -0
- package/dist/src/runtime/steps/supervisor-decision/prompt.js +97 -106
- package/dist/src/runtime/steps/supervisor-decision/response-recommendation.d.ts +2 -0
- package/dist/src/runtime/steps/supervisor-decision/response-recommendation.js +2 -0
- package/dist/src/runtime/steps/supervisor-decision/resume.d.ts +3 -0
- package/dist/src/runtime/steps/supervisor-decision/resume.js +20 -0
- package/dist/src/runtime/steps/supervisor-decision/run.d.ts +7 -0
- package/dist/src/runtime/steps/supervisor-decision/run.js +76 -158
- package/dist/src/runtime/steps/supervisor-decision/skill-selection-input.d.ts +21 -0
- package/dist/src/runtime/steps/supervisor-decision/skill-selection-input.js +29 -0
- package/dist/src/runtime/steps/supervisor-decision/skill-selection.d.ts +16 -0
- package/dist/src/runtime/steps/supervisor-decision/skill-selection.js +44 -0
- package/dist/src/runtime/steps/supervisor-response/input.d.ts +3 -0
- package/dist/src/runtime/steps/supervisor-response/input.js +5 -0
- package/dist/src/runtime/steps/supervisor-response/prompt.js +2 -0
- package/dist/src/runtime/steps/supervisor-response/response-recommendation.d.ts +3 -0
- package/dist/src/runtime/steps/supervisor-response/response-recommendation.js +24 -4
- package/dist/src/runtime/steps/supervisor-response/run.d.ts +7 -0
- package/dist/src/runtime/steps/supervisor-response/run.js +3 -6
- package/dist/src/runtime/steps/supervisor-skill-authoring/contract.d.ts +43 -0
- package/dist/src/runtime/steps/supervisor-skill-authoring/contract.js +85 -0
- package/dist/src/runtime/steps/supervisor-skill-authoring/input.d.ts +35 -0
- package/dist/src/runtime/steps/supervisor-skill-authoring/input.js +87 -0
- package/dist/src/runtime/steps/supervisor-skill-authoring/run.d.ts +10 -0
- package/dist/src/runtime/steps/supervisor-skill-authoring/run.js +35 -0
- package/dist/src/runtime/steps/supervisor-skill-instructions.d.ts +4 -0
- package/dist/src/runtime/steps/supervisor-skill-instructions.js +4 -0
- package/dist/src/runtime/steps/worker-capability-scope-decision.js +14 -1
- package/dist/src/runtime/steps/worker-decision/contracts.d.ts +1 -0
- package/dist/src/runtime/steps/worker-decision/input/execution-guidance.d.ts +5 -0
- package/dist/src/runtime/steps/worker-decision/input/execution-guidance.js +31 -0
- package/dist/src/runtime/steps/worker-decision/input/prompt-context.js +2 -25
- package/dist/src/runtime/steps/worker-decision/input/reference-context.js +4 -0
- package/dist/src/runtime/steps/worker-decision/prompt.js +6 -2
- package/dist/src/runtime/steps/worker-decision/result-author.js +6 -0
- package/dist/src/web-ui/app/ARCHITECTURE.md +1 -1
- package/dist/src/web-ui/app/app-bootstrap.js +3 -0
- package/dist/src/web-ui/app/app.js +7 -1
- package/dist/src/web-ui/app/components/automations/run-history-controls.js +77 -0
- package/dist/src/web-ui/app/components/automations/run-history.js +55 -0
- package/dist/src/web-ui/app/components/automations/run.js +3 -8
- package/dist/src/web-ui/app/components/automations/timeline.js +3 -2
- package/dist/src/web-ui/app/components/automations/workspace.js +11 -2
- package/dist/src/web-ui/app/components/conversation-role-cards.js +27 -0
- package/dist/src/web-ui/app/components/conversation-role-delegations.d.ts +12 -0
- package/dist/src/web-ui/app/components/conversation-role-delegations.js +24 -0
- package/dist/src/web-ui/app/components/conversation-role-history.d.ts +13 -0
- package/dist/src/web-ui/app/components/conversation-role-history.js +81 -0
- package/dist/src/web-ui/app/components/conversation-role-returns.d.ts +12 -0
- package/dist/src/web-ui/app/components/conversation-role-returns.js +23 -0
- package/dist/src/web-ui/app/components/dashboard/compact-layout.js +137 -0
- package/dist/src/web-ui/app/components/dashboard/icons.js +5 -0
- package/dist/src/web-ui/app/components/dashboard/widget-card.js +85 -0
- package/dist/src/web-ui/app/components/dashboard/widget-dialog.js +83 -0
- package/dist/src/web-ui/app/components/dashboard/widget-summaries.js +155 -0
- package/dist/src/web-ui/app/components/dashboard/workspace.js +28 -4
- package/dist/src/web-ui/app/components/onboarding-workspace-access.js +1 -1
- package/dist/src/web-ui/app/components/operations-summary.js +2 -1
- package/dist/src/web-ui/app/components/passive-learning/home-widget-preview.js +32 -0
- package/dist/src/web-ui/app/components/passive-learning/home.js +4 -1
- package/dist/src/web-ui/app/components/schedules/details.js +3 -2
- package/dist/src/web-ui/app/components/skills/workspace.js +119 -0
- package/dist/src/web-ui/app/components/spark-chat/panel.js +1 -1
- package/dist/src/web-ui/app/components/spark-chat/settings.js +1 -1
- package/dist/src/web-ui/app/components/system-host/home-widget-permission-preview.js +75 -0
- package/dist/src/web-ui/app/components/system-host/home-widget-summary.js +93 -0
- package/dist/src/web-ui/app/components/system-host/macos-permission-rendering.js +2 -2
- package/dist/src/web-ui/app/components/system-host/native-windows-access.js +1 -1
- package/dist/src/web-ui/app/components/system-host/rendering.js +3 -3
- package/dist/src/web-ui/app/components/system-host/windows-store-setup.js +2 -2
- package/dist/src/web-ui/app/components/workspace-shell.js +11 -1
- package/dist/src/web-ui/app/computer-access-feature.js +13 -1
- package/dist/src/web-ui/app/configuration-feature.js +2 -0
- package/dist/src/web-ui/app/controllers/automation-read-projection.js +8 -4
- package/dist/src/web-ui/app/controllers/automation-run-actions.js +3 -1
- package/dist/src/web-ui/app/controllers/automation-run-history.js +159 -0
- package/dist/src/web-ui/app/controllers/automations-controller.js +27 -11
- package/dist/src/web-ui/app/controllers/environment-workspace-preparation.js +6 -2
- package/dist/src/web-ui/app/controllers/operations-controller.js +2 -1
- package/dist/src/web-ui/app/controllers/realtime-event-controller.js +22 -1
- package/dist/src/web-ui/app/controllers/reasoning-mode-controller.js +1 -1
- package/dist/src/web-ui/app/controllers/runtime-selection-controller.js +7 -1
- package/dist/src/web-ui/app/controllers/skills-controller.js +237 -0
- package/dist/src/web-ui/app/dashboard-feature.js +9 -0
- package/dist/src/web-ui/app/lib/conversation-role-model.d.ts +5 -0
- package/dist/src/web-ui/app/lib/conversation-role-model.js +63 -5
- package/dist/src/web-ui/app/lib/event-presentation.js +34 -0
- package/dist/src/web-ui/app/lib/reasoning-controls.js +6 -1
- package/dist/src/web-ui/app/lib/role-delegation-event.d.ts +18 -0
- package/dist/src/web-ui/app/lib/role-delegation-event.js +47 -0
- package/dist/src/web-ui/app/lib/role-return-event.d.ts +19 -0
- package/dist/src/web-ui/app/lib/role-return-event.js +36 -0
- package/dist/src/web-ui/app/lib/tool-activity-event.js +8 -6
- package/dist/src/web-ui/app/lib/tool-skill-activity-fields.js +50 -0
- package/dist/src/web-ui/app/lib/workspace-route.js +1 -0
- package/dist/src/web-ui/app/passive-learning-feature.js +2 -2
- package/dist/src/web-ui/app/services/runtime-web-client/automations.d.ts +9 -1
- package/dist/src/web-ui/app/services/runtime-web-client/automations.js +10 -2
- package/dist/src/web-ui/app/services/runtime-web-client/skills.js +23 -0
- package/dist/src/web-ui/app/services/runtime-web-client.js +2 -0
- package/dist/src/web-ui/app/skills-feature.js +36 -0
- package/dist/src/web-ui/app/styles/24-conversation-role-cards.css +58 -0
- package/dist/src/web-ui/app/styles/40-skills.css +34 -0
- package/dist/src/web-ui/app/styles/50-automations.css +24 -3
- package/dist/src/web-ui/app/styles/95-home-widgets.css +110 -0
- package/dist/src/web-ui/app/styles.css +2 -0
- package/dist/src/web-ui/app/ui-behavior.d.ts +1 -1
- package/dist/src/web-ui/app/ui-behavior.js +1 -0
- package/dist/src/web-ui/client-state/store.js +3 -2
- package/dist/src/web-ui/client-state/transaction-order.d.ts +2 -0
- package/dist/src/web-ui/client-state/transaction-order.js +18 -0
- package/dist/src/web-ui/local-runtime/api-router.d.ts +1 -0
- package/dist/src/web-ui/local-runtime/api-router.js +7 -0
- package/dist/src/web-ui/local-runtime/automation-routes.js +2 -1
- package/dist/src/web-ui/local-runtime/automation-run-page.d.ts +5 -0
- package/dist/src/web-ui/local-runtime/automation-run-page.js +26 -0
- package/dist/src/web-ui/local-runtime/skill-management-routes.d.ts +18 -0
- package/dist/src/web-ui/local-runtime/skill-management-routes.js +118 -0
- package/docs/configuration.md +8 -0
- package/docs/plugins.md +37 -32
- package/docs/runtime-public-contracts.md +37 -0
- package/examples/request-runner.config.example.json +3 -0
- package/package.json +1 -1
- package/plugins/capability-brief/plugin.json +1 -1
- package/plugins/code-outline/plugin.json +1 -1
- package/plugins/document-reader/plugin.json +1 -1
- package/plugins/exec/plugin.json +1 -1
- package/plugins/filesystem/plugin.json +1 -1
- package/plugins/json-inspector/plugin.json +1 -1
- package/plugins/local-search/plugin.json +1 -1
- package/plugins/memory/plugin.json +1 -1
- package/plugins/project-orientation/plugin.json +1 -1
- package/plugins/system/plugin.json +1 -1
- package/plugins/system-probe/plugin.json +1 -1
- package/plugins/web/plugin.json +1 -1
- package/plugins/web/skills/web_fetch_skill/SKILL.md +1 -2
- package/plugins/web/skills/web_search_skill/SKILL.md +3 -7
- package/src/runtime/README.md +96 -1
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { RoleCallLedgerHead } from "../../orchestration/role-calls/index.js";
|
|
1
2
|
import type { ChatMessage, ModelGatewayJsonSchemaFormat } from "../../../model-gateway/types.js";
|
|
2
3
|
import type { ToolAvailabilityEntry } from "../../../capabilities/tool-types.js";
|
|
3
4
|
import type { RequestContextProjection } from "../../context/request-context-contracts.js";
|
|
@@ -5,13 +6,17 @@ import { type RequestToolResultsView } from "../../context/request-tool-results.
|
|
|
5
6
|
import { type WorkerCapabilityCatalogGroup } from "../../orchestration/worker-capabilities/index.js";
|
|
6
7
|
import type { RequestExecutionSeed } from "../../request/contracts.js";
|
|
7
8
|
import { SUPERVISOR_DECISION_MODEL_STEP, type SupervisorDecisionDiagnosticContext, type SupervisorDelegateRoleId, type SupervisorResumeContext, type SupervisorWorkerCapabilityAffordance } from "./contracts.js";
|
|
8
|
-
|
|
9
|
+
import { type SupervisorArtifactPathsProjection } from "./artifact-paths.js";
|
|
10
|
+
export type SupervisorDecisionInputRequest = Pick<RequestExecutionSeed, "requestId" | "prompt" | "historyMessages" | "sessionKind" | "runnerConfig" | "attachments" | "agentMode" | "modelPreference" | "modelPolicy"> & Partial<Pick<RequestExecutionSeed, "shouldGenerateSessionTitle" | "onEvent" | "temporalContext" | "scheduledExecution" | "sessionMemory" | "sessionArtifactPaths" | "longTermMemory">>;
|
|
9
11
|
export declare function buildSupervisorDecisionInput(request: SupervisorDecisionInputRequest, options: Readonly<{
|
|
10
12
|
toolResults: RequestToolResultsView;
|
|
13
|
+
skillReadHead?: RoleCallLedgerHead;
|
|
11
14
|
includeAcknowledgement?: boolean;
|
|
12
15
|
includeTitle?: boolean;
|
|
13
16
|
allowMemoryRecall?: boolean;
|
|
17
|
+
allowSkillAuthoring?: boolean;
|
|
14
18
|
memoryRecallMessage?: ChatMessage;
|
|
19
|
+
initialMemoryMessage?: ChatMessage;
|
|
15
20
|
allowedRoleIds?: readonly SupervisorDelegateRoleId[];
|
|
16
21
|
diagnostic?: SupervisorDecisionDiagnosticContext;
|
|
17
22
|
resume?: SupervisorResumeContext;
|
|
@@ -27,7 +32,9 @@ export declare function buildSupervisorDecisionInput(request: SupervisorDecision
|
|
|
27
32
|
includeTitle: boolean;
|
|
28
33
|
includeResponseRecommendation: boolean;
|
|
29
34
|
allowMemoryRecall: boolean;
|
|
35
|
+
allowSkillAuthoring: boolean;
|
|
30
36
|
allowedRoleIds: readonly SupervisorDelegateRoleId[];
|
|
31
37
|
workerCapabilityAffordances: readonly SupervisorWorkerCapabilityAffordance[];
|
|
32
38
|
availableWorkerCapabilityCatalog: readonly WorkerCapabilityCatalogGroup[];
|
|
39
|
+
artifactPathsProjection?: SupervisorArtifactPathsProjection;
|
|
33
40
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import { projectSupervisorSkillReadContext } from "../../context/core-skill-read-context.js";
|
|
1
2
|
import { buildSparkConversationInstructions } from "../../context/spark-conversation-policy.js";
|
|
2
3
|
import { projectCapabilityBrief } from "../../context/capability-brief.js";
|
|
3
4
|
import { resolveConfiguredStepInstructionMetadata } from "../../config/runner/step-instructions.js";
|
|
4
5
|
import { projectRequestContext } from "../../context/request-context.js";
|
|
5
6
|
import { projectRootSessionMemory } from "../../context/session-memory/root-projection.js";
|
|
6
|
-
import { buildConversationMemoryAvailabilityInstructions } from "../../long-term-memory/conversation-authoring/prompt.js";
|
|
7
7
|
import { buildRequestTemporalContextMessage } from "../../context/request-temporal-context.js";
|
|
8
8
|
import { projectScheduledExecutionContext } from "../../context/scheduled-execution-context.js";
|
|
9
9
|
import { buildRequestToolResultsMessage, } from "../../context/request-tool-results.js";
|
|
@@ -12,7 +12,8 @@ import { WORKER_CAPABILITY_COUNT_MAX, WORKER_CAPABILITY_SUMMARY_MAX_LENGTH, } fr
|
|
|
12
12
|
import { SUPERVISOR_DECISION_MODEL_STEP, SUPERVISOR_DELEGATE_ROLE_IDS, } from "./contracts.js";
|
|
13
13
|
import { traceSupervisorChildResultProjected, traceSupervisorContextProjected, } from "./diagnostics.js";
|
|
14
14
|
import { createSupervisorDecisionFormat } from "./format.js";
|
|
15
|
-
import {
|
|
15
|
+
import { projectSupervisorArtifactPaths, } from "./artifact-paths.js";
|
|
16
|
+
import { buildSupervisorDecisionInstructions, buildSupervisorMemoryAvailabilityInstructions, } from "./prompt.js";
|
|
16
17
|
import { buildSupervisorContinuationPart } from "./resume.js";
|
|
17
18
|
import { buildSupervisorMemoryRecallContinuationParts } from "./memory-recall-continuation.js";
|
|
18
19
|
import { canRecommendDirectSupervisorResponse } from "./response-recommendation.js";
|
|
@@ -43,6 +44,7 @@ export function buildSupervisorDecisionInput(request, options) {
|
|
|
43
44
|
: EMPTY_WORKER_CAPABILITY_AFFORDANCES;
|
|
44
45
|
const format = createSupervisorDecisionFormat({
|
|
45
46
|
allowMemoryRecall: options.allowMemoryRecall === true,
|
|
47
|
+
allowSkillAuthoring: options.allowSkillAuthoring === true,
|
|
46
48
|
includeAcknowledgement,
|
|
47
49
|
includeTitle,
|
|
48
50
|
includeResponseRecommendation,
|
|
@@ -62,7 +64,13 @@ export function buildSupervisorDecisionInput(request, options) {
|
|
|
62
64
|
})
|
|
63
65
|
: undefined;
|
|
64
66
|
const roleContinuationParts = roleContinuationPart ? [roleContinuationPart] : [];
|
|
67
|
+
const initialMemoryMessage = options.memoryRecallMessage
|
|
68
|
+
? undefined
|
|
69
|
+
: options.initialMemoryMessage;
|
|
70
|
+
const skillReadContext = projectSupervisorSkillReadContext(options.skillReadHead);
|
|
65
71
|
const referenceMessages = [
|
|
72
|
+
...skillReadContext.referenceMessages,
|
|
73
|
+
...(initialMemoryMessage ? [initialMemoryMessage] : []),
|
|
66
74
|
...(request.temporalContext
|
|
67
75
|
? [buildRequestTemporalContextMessage(request.temporalContext)]
|
|
68
76
|
: []),
|
|
@@ -86,7 +94,9 @@ export function buildSupervisorDecisionInput(request, options) {
|
|
|
86
94
|
const instructions = [
|
|
87
95
|
buildSupervisorDecisionInstructions({
|
|
88
96
|
allowMemoryRecall: options.allowMemoryRecall === true,
|
|
97
|
+
allowSkillAuthoring: options.allowSkillAuthoring === true,
|
|
89
98
|
hasMemoryRecallContext: options.memoryRecallMessage !== undefined,
|
|
99
|
+
hasInitialMemoryContext: initialMemoryMessage !== undefined,
|
|
90
100
|
includeAcknowledgement,
|
|
91
101
|
includeTitle,
|
|
92
102
|
includeResponseRecommendation,
|
|
@@ -96,7 +106,7 @@ export function buildSupervisorDecisionInput(request, options) {
|
|
|
96
106
|
workerCapabilityAffordances,
|
|
97
107
|
availableWorkerCapabilityCatalog,
|
|
98
108
|
}),
|
|
99
|
-
...
|
|
109
|
+
...buildSupervisorMemoryAvailabilityInstructions(request.longTermMemory?.enabled === true),
|
|
100
110
|
...buildSparkConversationInstructions(request.sessionKind),
|
|
101
111
|
].join("\n");
|
|
102
112
|
const scheduledExecution = projectScheduledExecutionContext(request, instructions, "decision");
|
|
@@ -109,14 +119,17 @@ export function buildSupervisorDecisionInput(request, options) {
|
|
|
109
119
|
prompt: request.prompt,
|
|
110
120
|
...(request.attachments ? { attachments: request.attachments } : {}),
|
|
111
121
|
...(referenceMessages.length > 0 ? { referenceMessages } : {}),
|
|
112
|
-
continuationParts:
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
122
|
+
continuationParts: [
|
|
123
|
+
...(options.memoryRecallMessage
|
|
124
|
+
? buildSupervisorMemoryRecallContinuationParts({
|
|
125
|
+
memoryRecallMessage: options.memoryRecallMessage,
|
|
126
|
+
...(options.resume ? { resume: options.resume } : {}),
|
|
127
|
+
currentCallId: requireSupervisorCallId(diagnostic),
|
|
128
|
+
currentInvocationAttempt: requireSupervisorInvocationAttempt(diagnostic),
|
|
129
|
+
})
|
|
130
|
+
: roleContinuationParts),
|
|
131
|
+
...skillReadContext.continuationParts,
|
|
132
|
+
],
|
|
120
133
|
budget,
|
|
121
134
|
diagnostic,
|
|
122
135
|
...(request.onEvent ? { onEvent: request.onEvent } : {}),
|
|
@@ -134,13 +147,22 @@ export function buildSupervisorDecisionInput(request, options) {
|
|
|
134
147
|
});
|
|
135
148
|
if (capabilityBrief.message)
|
|
136
149
|
referenceMessages.push(capabilityBrief.message);
|
|
150
|
+
const artifactPaths = projectSupervisorArtifactPaths({
|
|
151
|
+
targets: request.sessionArtifactPaths,
|
|
152
|
+
context: { ...contextInput, referenceMessages },
|
|
153
|
+
additionalBudgetMessages: options.capabilityBriefBudgetMessages,
|
|
154
|
+
});
|
|
155
|
+
if (artifactPaths)
|
|
156
|
+
referenceMessages.push(artifactPaths.message);
|
|
137
157
|
const context = projectRequestContext({
|
|
138
158
|
...contextInput,
|
|
159
|
+
instructions: artifactPaths?.instructions ?? contextInput.instructions,
|
|
139
160
|
...(referenceMessages.length > 0 ? { referenceMessages } : {}),
|
|
140
161
|
});
|
|
141
162
|
traceSupervisorContextProjected({
|
|
142
163
|
diagnostic,
|
|
143
164
|
allowMemoryRecall: options.allowMemoryRecall === true,
|
|
165
|
+
allowSkillAuthoring: options.allowSkillAuthoring === true,
|
|
144
166
|
context,
|
|
145
167
|
format,
|
|
146
168
|
historyMessageCount: sessionMemory.historyMessages.length,
|
|
@@ -173,9 +195,11 @@ export function buildSupervisorDecisionInput(request, options) {
|
|
|
173
195
|
includeTitle,
|
|
174
196
|
includeResponseRecommendation,
|
|
175
197
|
allowMemoryRecall: options.allowMemoryRecall === true,
|
|
198
|
+
allowSkillAuthoring: options.allowSkillAuthoring === true,
|
|
176
199
|
allowedRoleIds,
|
|
177
200
|
workerCapabilityAffordances,
|
|
178
201
|
availableWorkerCapabilityCatalog,
|
|
202
|
+
...(artifactPaths ? { artifactPathsProjection: artifactPaths } : {}),
|
|
179
203
|
};
|
|
180
204
|
}
|
|
181
205
|
const EMPTY_WORKER_CAPABILITY_AFFORDANCES = Object.freeze([]);
|
|
@@ -5,6 +5,7 @@ export declare function parseSupervisorDecisionOutput(text: string, options?: Re
|
|
|
5
5
|
includeTitle?: boolean;
|
|
6
6
|
includeResponseRecommendation?: boolean;
|
|
7
7
|
allowMemoryRecall?: boolean;
|
|
8
|
+
allowSkillAuthoring?: boolean;
|
|
8
9
|
allowedRoleIds?: readonly SupervisorDelegateRoleId[];
|
|
9
10
|
availableWorkerCapabilityCatalog?: readonly WorkerCapabilityCatalogGroup[];
|
|
10
11
|
diagnostic?: SupervisorDecisionDiagnosticContext;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { isSupervisorDelegateRoleId, SUPERVISOR_ACKNOWLEDGEMENT_MAX_LENGTH, SUPERVISOR_DECISION_ACTIONS, SUPERVISOR_DELEGATE_ROLE_IDS, SUPERVISOR_OBJECTIVE_MAX_LENGTH, SUPERVISOR_TITLE_MAX_LENGTH, } from "./contracts.js";
|
|
2
|
+
import { parseSupervisorSkillAuthoringRoute } from "../supervisor-skill-authoring/contract.js";
|
|
2
3
|
import { createWorkerCapabilityScopeDecisionContract, parseWorkerCapabilityScopeDecision, } from "../worker-capability-scope-decision.js";
|
|
3
4
|
import { traceSupervisorAcknowledgementNormalized, traceSupervisorDecisionAccepted, traceSupervisorDecisionRejected, traceSupervisorEnvelopeAccepted, traceSupervisorEnvelopeRejected, } from "./diagnostics.js";
|
|
4
5
|
import { readStructuredDecisionEnvelope } from "../../model/structured-decision-envelope.js";
|
|
@@ -41,6 +42,16 @@ export function parseSupervisorDecisionOutput(text, options = {}) {
|
|
|
41
42
|
});
|
|
42
43
|
}
|
|
43
44
|
const issues = [];
|
|
45
|
+
if (record.action === "author_skill") {
|
|
46
|
+
const parsed = parseSupervisorSkillAuthoringRoute(record, options.allowSkillAuthoring === true);
|
|
47
|
+
if (diagnostic) {
|
|
48
|
+
if (parsed.ok)
|
|
49
|
+
traceSupervisorDecisionAccepted({ diagnostic, decision: parsed.decision });
|
|
50
|
+
else
|
|
51
|
+
traceSupervisorDecisionRejected({ diagnostic, selectedAction: "author_skill", issues: parsed.issues });
|
|
52
|
+
}
|
|
53
|
+
return parsed.ok ? parsed : { ...parsed, stage: "domain_parser" };
|
|
54
|
+
}
|
|
44
55
|
if (isMemoryRecallDecisionRecord(record)) {
|
|
45
56
|
const recalled = parseMemoryRecallDecision(record, {
|
|
46
57
|
allowMemoryRecall: options.allowMemoryRecall,
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { ModelGatewayJsonSchemaFormat } from "../../../model-gateway/types.js";
|
|
2
|
+
import type { RequestExecutionScope } from "../../request/execution-scope.js";
|
|
3
|
+
import type { KnowledgeSkillMetadata } from "../../knowledge-skills/store.js";
|
|
4
|
+
import { type SupervisorDecisionDiagnosticContext } from "./contracts.js";
|
|
5
|
+
/** Preparation sees the current request, not routing state or prior tool/document bodies. */
|
|
6
|
+
export declare function buildSupervisorPreparationInput(request: RequestExecutionScope, options: {
|
|
7
|
+
instructions: string;
|
|
8
|
+
format: ModelGatewayJsonSchemaFormat;
|
|
9
|
+
diagnostic: SupervisorDecisionDiagnosticContext;
|
|
10
|
+
availableSkills?: readonly KnowledgeSkillMetadata[];
|
|
11
|
+
expandedCatalog?: boolean;
|
|
12
|
+
}): {
|
|
13
|
+
format: ModelGatewayJsonSchemaFormat;
|
|
14
|
+
context: Readonly<{
|
|
15
|
+
messages: import("../../../model-gateway/types.js").ChatMessage[];
|
|
16
|
+
selectedHistoryMessageIds: string[];
|
|
17
|
+
omittedHistoryMessageIds: string[];
|
|
18
|
+
budget: import("../../context/request-context-contracts.js").RequestContextBudgetEstimate & {
|
|
19
|
+
parts: import("../../context/request-context-contracts.js").RequestContextBudgetParts;
|
|
20
|
+
};
|
|
21
|
+
compaction: Readonly<{
|
|
22
|
+
applied: boolean;
|
|
23
|
+
compactedSourceRefs: readonly string[];
|
|
24
|
+
}>;
|
|
25
|
+
}>;
|
|
26
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { projectRequestContext } from "../../context/request-context.js";
|
|
2
|
+
import { resolveModelContextAdmission, resolveModelContextBudget } from "../../model/model-context-budget.js";
|
|
3
|
+
import { estimateMessagesTokens } from "../../context/token-estimator.js";
|
|
4
|
+
import { appendRequestSteeringContext } from "../../request/request-steering-context.js";
|
|
5
|
+
import { resolveRequestSteeringInbox } from "../../request/request-steering.js";
|
|
6
|
+
import { buildAvailableSkillsText, AVAILABLE_SKILLS_MAX_TOKENS } from "../../knowledge-skills/available-skills-projection.js";
|
|
7
|
+
import { SUPERVISOR_DECISION_MODEL_STEP } from "./contracts.js";
|
|
8
|
+
/** Preparation sees the current request, not routing state or prior tool/document bodies. */
|
|
9
|
+
export function buildSupervisorPreparationInput(request, options) {
|
|
10
|
+
const admissionOptions = {
|
|
11
|
+
runnerConfig: request.runnerConfig, agentMode: request.agentMode,
|
|
12
|
+
modelStep: SUPERVISOR_DECISION_MODEL_STEP,
|
|
13
|
+
...(request.modelPreference ? { modelPreference: request.modelPreference } : {}),
|
|
14
|
+
...(request.modelPolicy ? { modelPolicy: request.modelPolicy } : {}),
|
|
15
|
+
};
|
|
16
|
+
const budget = resolveModelContextBudget(admissionOptions);
|
|
17
|
+
const calibration = resolveModelContextAdmission(admissionOptions).invocation.instructions ?? [];
|
|
18
|
+
const additionalMessages = appendRequestSteeringContext(calibration.length ? [{ role: "system", content: calibration.join("\n") }] : [], resolveRequestSteeringInbox(request.requestSteering).snapshot());
|
|
19
|
+
const additionalTokens = estimateMessagesTokens(additionalMessages, budget.tokenEstimation);
|
|
20
|
+
const base = {
|
|
21
|
+
instructions: options.instructions, format: options.format,
|
|
22
|
+
prompt: request.prompt, historyMessages: [], budget,
|
|
23
|
+
...(request.attachments ? { attachments: request.attachments } : {}),
|
|
24
|
+
diagnostic: options.diagnostic, onEvent: request.onEvent, deferCompactionFailure: true,
|
|
25
|
+
};
|
|
26
|
+
const baseContext = projectRequestContext(base);
|
|
27
|
+
const catalog = options.availableSkills === undefined ? undefined : buildAvailableSkillsText({
|
|
28
|
+
skills: options.availableSkills,
|
|
29
|
+
budgetTokens: options.expandedCatalog
|
|
30
|
+
? Math.max(0, baseContext.budget.availableInputTokens - baseContext.budget.estimatedInputTokens - additionalTokens)
|
|
31
|
+
: AVAILABLE_SKILLS_MAX_TOKENS,
|
|
32
|
+
tokenEstimation: budget.tokenEstimation,
|
|
33
|
+
includeListHint: false,
|
|
34
|
+
});
|
|
35
|
+
const instructions = options.availableSkills === undefined ? options.instructions : [
|
|
36
|
+
catalog ?? "Available Skills: no remaining candidate metadata is available.", options.instructions,
|
|
37
|
+
].join("\n");
|
|
38
|
+
return { format: options.format, context: projectRequestContext({ ...base, instructions }) };
|
|
39
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { RequestExecutionScope } from "../../request/execution-scope.js";
|
|
2
|
+
import type { RoleCallLedgerHead } from "../../orchestration/role-calls/index.js";
|
|
3
|
+
import { type SupervisorDecisionDiagnosticContext } from "./contracts.js";
|
|
4
|
+
import { type SupervisorPresentation } from "./presentation.js";
|
|
5
|
+
import { type SupervisorSkillSelection } from "./skill-selection.js";
|
|
6
|
+
export declare function prepareSupervisorDecision(request: RequestExecutionScope, options: {
|
|
7
|
+
diagnostic: SupervisorDecisionDiagnosticContext;
|
|
8
|
+
includeAcknowledgement: boolean;
|
|
9
|
+
includeTitle: boolean;
|
|
10
|
+
allowSkillReads: boolean;
|
|
11
|
+
skillReadHead?: RoleCallLedgerHead;
|
|
12
|
+
boundSteeringVersion?: number;
|
|
13
|
+
}): Promise<{
|
|
14
|
+
presentation: SupervisorPresentation;
|
|
15
|
+
selection: SupervisorSkillSelection;
|
|
16
|
+
steeringVersion: number;
|
|
17
|
+
}>;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { invokeStructuredModelStep } from "../../model/invoke-structured-step.js";
|
|
2
|
+
import { assertBoundModelStepSteeringCurrent } from "../../model/model-step-steering.js";
|
|
3
|
+
import { traceDebug } from "../../observability/debug-logger.js";
|
|
4
|
+
import { resolveRequestSteeringInbox } from "../../request/request-steering.js";
|
|
5
|
+
import { SUPERVISOR_DECISION_MODEL_STEP } from "./contracts.js";
|
|
6
|
+
import { buildSupervisorPreparationInput } from "./preparation-input.js";
|
|
7
|
+
import { buildSupervisorSkillSelectionInput } from "./skill-selection-input.js";
|
|
8
|
+
import { buildSupervisorPresentationInstructions, createSupervisorPresentationFormat, parseSupervisorPresentationOutput } from "./presentation.js";
|
|
9
|
+
import { parseSupervisorSkillSelectionOutput } from "./skill-selection.js";
|
|
10
|
+
export async function prepareSupervisorDecision(request, options) {
|
|
11
|
+
const steering = resolveRequestSteeringInbox(request.requestSteering);
|
|
12
|
+
let steeringVersion = options.boundSteeringVersion;
|
|
13
|
+
let presentation = {};
|
|
14
|
+
if (needsSupervisorPresentation(options)) {
|
|
15
|
+
const diagnostic = { ...options.diagnostic, decisionPhase: "presentation" };
|
|
16
|
+
const input = buildSupervisorPreparationInput(request, {
|
|
17
|
+
instructions: buildSupervisorPresentationInstructions(options),
|
|
18
|
+
format: createSupervisorPresentationFormat(options), diagnostic,
|
|
19
|
+
});
|
|
20
|
+
const accepted = await invokePreparationPhase(request, {
|
|
21
|
+
input, diagnostic, boundSteeringVersion: steeringVersion,
|
|
22
|
+
parse: (text) => parseSupervisorPresentationOutput(text, options),
|
|
23
|
+
});
|
|
24
|
+
presentation = accepted.decision;
|
|
25
|
+
steeringVersion = accepted.steeringVersion;
|
|
26
|
+
}
|
|
27
|
+
if (!canSelectSupervisorSkills(options))
|
|
28
|
+
return { presentation, selection: { action: "continue" }, steeringVersion: steeringVersion ?? steering.snapshot().version };
|
|
29
|
+
const diagnostic = { ...options.diagnostic, decisionPhase: "skill_selection" };
|
|
30
|
+
const input = buildSupervisorSkillSelectionInput(request, { skillReadHead: options.skillReadHead, diagnostic });
|
|
31
|
+
const accepted = await invokePreparationPhase(request, {
|
|
32
|
+
input, diagnostic, boundSteeringVersion: steeringVersion,
|
|
33
|
+
parse: parseSupervisorSkillSelectionOutput,
|
|
34
|
+
});
|
|
35
|
+
return { presentation, selection: accepted.decision, steeringVersion: accepted.steeringVersion };
|
|
36
|
+
}
|
|
37
|
+
function needsSupervisorPresentation(options) {
|
|
38
|
+
return options.includeAcknowledgement || options.includeTitle;
|
|
39
|
+
}
|
|
40
|
+
function canSelectSupervisorSkills(options) {
|
|
41
|
+
if (!options.allowSkillReads)
|
|
42
|
+
return false;
|
|
43
|
+
return !options.skillReadHead?.state.skillReads?.some((read) => read.result.outcome === "failed");
|
|
44
|
+
}
|
|
45
|
+
async function invokePreparationPhase(request, options) {
|
|
46
|
+
const steering = resolveRequestSteeringInbox(request.requestSteering);
|
|
47
|
+
const startedAt = Date.now();
|
|
48
|
+
assertBoundModelStepSteeringCurrent(steering, options.boundSteeringVersion);
|
|
49
|
+
traceDebug("runtime.supervisor", "model.started", { ...options.diagnostic, outputContract: options.input.format.name, messageCount: options.input.context.messages.length });
|
|
50
|
+
const accepted = await invokeStructuredModelStep({
|
|
51
|
+
request, modelStep: SUPERVISOR_DECISION_MODEL_STEP,
|
|
52
|
+
format: options.input.format, messages: options.input.context.messages,
|
|
53
|
+
boundSteeringVersion: options.boundSteeringVersion,
|
|
54
|
+
contextRetention: "exact",
|
|
55
|
+
timeoutReason: "supervisor_decision_timeout", invalidOutputReason: "invalid_supervisor_decision",
|
|
56
|
+
parse(text) {
|
|
57
|
+
const parsed = options.parse(text);
|
|
58
|
+
if (!parsed.ok)
|
|
59
|
+
return parsed;
|
|
60
|
+
return { ok: true, decision: { decision: parsed.decision, steeringVersion: steering.snapshot().version } };
|
|
61
|
+
},
|
|
62
|
+
});
|
|
63
|
+
traceDebug("runtime.supervisor", "model.completed", { ...options.diagnostic, outputContract: options.input.format.name, durationMs: Date.now() - startedAt });
|
|
64
|
+
return accepted;
|
|
65
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ModelGatewayJsonSchemaFormat } from "../../../model-gateway/types.js";
|
|
2
|
+
import type { StructuredModelParseResult } from "../../model/invoke-structured-step.js";
|
|
3
|
+
export type SupervisorPresentation = Readonly<{
|
|
4
|
+
acknowledgement?: string;
|
|
5
|
+
title?: string;
|
|
6
|
+
}>;
|
|
7
|
+
export type SupervisorPresentationOptions = Readonly<{
|
|
8
|
+
includeAcknowledgement: boolean;
|
|
9
|
+
includeTitle: boolean;
|
|
10
|
+
}>;
|
|
11
|
+
export declare function createSupervisorPresentationFormat(options: SupervisorPresentationOptions): ModelGatewayJsonSchemaFormat;
|
|
12
|
+
export declare function buildSupervisorPresentationInstructions(options: SupervisorPresentationOptions): string;
|
|
13
|
+
export declare function parseSupervisorPresentationOutput(text: string, options: SupervisorPresentationOptions): StructuredModelParseResult<SupervisorPresentation>;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { createStructuredDecisionEnvelopeSchema, readStructuredDecisionEnvelope } from "../../model/structured-decision-envelope.js";
|
|
2
|
+
import { SUPERVISOR_ACKNOWLEDGEMENT_MAX_LENGTH, SUPERVISOR_TITLE_MAX_LENGTH } from "./contracts.js";
|
|
3
|
+
export function createSupervisorPresentationFormat(options) {
|
|
4
|
+
const fields = presentationFields(options);
|
|
5
|
+
return {
|
|
6
|
+
type: "json_schema", name: "supervisor_presentation", strict: true,
|
|
7
|
+
schema: createStructuredDecisionEnvelopeSchema([{
|
|
8
|
+
type: "object",
|
|
9
|
+
properties: Object.fromEntries(fields.map(([name, maxLength]) => [name, { type: "string", minLength: 2, maxLength }])),
|
|
10
|
+
required: fields.map(([name]) => name), additionalProperties: false,
|
|
11
|
+
}]),
|
|
12
|
+
postValidatedSchemaConstraints: fields.map(([name]) => ({
|
|
13
|
+
keyword: "maxLength", path: `/properties/decision/properties/${name}/maxLength`,
|
|
14
|
+
})),
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
export function buildSupervisorPresentationInstructions(options) {
|
|
18
|
+
return [
|
|
19
|
+
"Write only the requested opening acknowledgement and conversation title, in the user's language. Return exactly the supplied JSON shape.",
|
|
20
|
+
"Do not plan, choose actions, answer the request, or claim completed work.",
|
|
21
|
+
...(options.includeAcknowledgement ? [`acknowledgement: at most ${SUPERVISOR_ACKNOWLEDGEMENT_MAX_LENGTH} characters; one short sentence acknowledging the requested outcome. No implementation details or promises about a particular method.`] : []),
|
|
22
|
+
...(options.includeTitle ? [`title: at most ${SUPERVISOR_TITLE_MAX_LENGTH} characters; a short description of the user's request.`] : []),
|
|
23
|
+
].join("\n");
|
|
24
|
+
}
|
|
25
|
+
export function parseSupervisorPresentationOutput(text, options) {
|
|
26
|
+
let record;
|
|
27
|
+
try {
|
|
28
|
+
record = readStructuredDecisionEnvelope(JSON.parse(text));
|
|
29
|
+
}
|
|
30
|
+
catch { /* Rejected below. */ }
|
|
31
|
+
const fields = presentationFields(options);
|
|
32
|
+
if (!record || Object.keys(record).length !== fields.length || fields.some(([name, max]) => !isBoundedPresentation(record[name], max))) {
|
|
33
|
+
return { ok: false, stage: "domain_parser", issues: [{ code: "supervisor_presentation_invalid", path: "decision", message: "Return only the requested bounded acknowledgement/title fields." }] };
|
|
34
|
+
}
|
|
35
|
+
return { ok: true, decision: Object.freeze(Object.fromEntries(fields.map(([name]) => [name, record[name].trim()]))) };
|
|
36
|
+
}
|
|
37
|
+
function presentationFields(options) {
|
|
38
|
+
return [
|
|
39
|
+
...(options.includeAcknowledgement ? [["acknowledgement", SUPERVISOR_ACKNOWLEDGEMENT_MAX_LENGTH]] : []),
|
|
40
|
+
...(options.includeTitle ? [["title", SUPERVISOR_TITLE_MAX_LENGTH]] : []),
|
|
41
|
+
];
|
|
42
|
+
}
|
|
43
|
+
function isBoundedPresentation(value, maximum) {
|
|
44
|
+
if (typeof value !== "string")
|
|
45
|
+
return false;
|
|
46
|
+
return value.trim().length >= 2 && value.length <= maximum;
|
|
47
|
+
}
|
|
@@ -5,11 +5,16 @@ export declare function buildSupervisorDecisionInstructions(params?: Readonly<{
|
|
|
5
5
|
includeTitle?: boolean;
|
|
6
6
|
includeResponseRecommendation?: boolean;
|
|
7
7
|
allowMemoryRecall?: boolean;
|
|
8
|
+
allowSkillAuthoring?: boolean;
|
|
8
9
|
hasMemoryRecallContext?: boolean;
|
|
10
|
+
hasInitialMemoryContext?: boolean;
|
|
9
11
|
allowedRoleIds?: readonly SupervisorDelegateRoleId[];
|
|
10
12
|
hasCompletedChildResult?: boolean;
|
|
11
13
|
hasRequestToolResults?: boolean;
|
|
12
14
|
workerCapabilityAffordances?: readonly SupervisorWorkerCapabilityAffordance[];
|
|
13
15
|
availableWorkerCapabilityCatalog?: readonly WorkerCapabilityCatalogGroup[];
|
|
14
16
|
}>): string;
|
|
17
|
+
/** SUPER decision-time wording; uses the existing core-memory availability. */
|
|
18
|
+
export declare function buildSupervisorMemoryAvailabilityInstructions(memoryEnabled: boolean): readonly string[];
|
|
19
|
+
export declare function buildSupervisorArtifactPathInstructions(): string;
|
|
15
20
|
export declare function buildSupervisorWorkingDirectoryInstructions(): string;
|