@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
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { projectStoredCompletedRoleChild } from "../orchestration/role-calls/child-return.js";
|
|
2
|
+
import { performRootMemoryRecall } from "./root-memory-recall.js";
|
|
3
|
+
import { performRootSkillRead } from "./root-skill-read.js";
|
|
4
|
+
export function isRootReferenceDecision(decision) {
|
|
5
|
+
return ["recall_memory", "list_skills", "read_skills"].includes(decision.action);
|
|
6
|
+
}
|
|
7
|
+
/** Core reference actions use the same root loop without opening a child. */
|
|
8
|
+
export async function performRootReferenceAction(request, ledger, activation, resume) {
|
|
9
|
+
const params = {
|
|
10
|
+
request,
|
|
11
|
+
ledger,
|
|
12
|
+
...activation,
|
|
13
|
+
steeringVersion: activation.decisionSteeringVersion,
|
|
14
|
+
resume,
|
|
15
|
+
};
|
|
16
|
+
if (params.decision.action === "recall_memory") {
|
|
17
|
+
await performRootMemoryRecall({ ...params, query: params.decision.query });
|
|
18
|
+
return params.resume;
|
|
19
|
+
}
|
|
20
|
+
await performRootSkillRead({ ...params, decision: params.decision });
|
|
21
|
+
return projectResumeAfterSkillRead(params.ledger.current(), params.resume);
|
|
22
|
+
}
|
|
23
|
+
/** A reference read advances the root activation without changing its completed children. */
|
|
24
|
+
function projectResumeAfterSkillRead(head, resume) {
|
|
25
|
+
if (!resume)
|
|
26
|
+
return undefined;
|
|
27
|
+
const call = head.state.calls.find(({ callId }) => callId === resume.callerCallId);
|
|
28
|
+
if (!call ||
|
|
29
|
+
call.callId !== head.state.rootCallId ||
|
|
30
|
+
call.status !== "active")
|
|
31
|
+
throw new Error("skill_read_resume_caller_invalid");
|
|
32
|
+
const completedChildren = call.childCallIds.flatMap((childCallId) => {
|
|
33
|
+
const child = head.state.calls.find(({ callId }) => callId === childCallId);
|
|
34
|
+
if (child?.status !== "completed")
|
|
35
|
+
return [];
|
|
36
|
+
return [
|
|
37
|
+
projectStoredCompletedRoleChild(head.state, { callerCallId: call.callId, childCallId }, head.policy),
|
|
38
|
+
];
|
|
39
|
+
});
|
|
40
|
+
if (!completedChildren.some((child) => child.childCallId === resume.returnedChildCallId &&
|
|
41
|
+
child.resultRef === resume.returnedResultRef))
|
|
42
|
+
throw new Error("skill_read_resume_result_invalid");
|
|
43
|
+
return Object.freeze({
|
|
44
|
+
...resume,
|
|
45
|
+
invocationAttempt: call.activationCount,
|
|
46
|
+
completedChildren: Object.freeze(completedChildren),
|
|
47
|
+
});
|
|
48
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { RoleCallFrame, RoleCallLedger, RoleCallLedgerHead } from "../orchestration/role-calls/index.js";
|
|
2
|
+
import type { SkillReadDecision } from "../steps/skill-read-decision.js";
|
|
3
|
+
import type { RequestExecutionScope } from "./execution-scope.js";
|
|
4
|
+
/** Read synchronously, then commit the exact snapshot and the next root activation together. */
|
|
5
|
+
export declare function performRootSkillRead(params: {
|
|
6
|
+
request: RequestExecutionScope;
|
|
7
|
+
ledger: RoleCallLedger;
|
|
8
|
+
head: RoleCallLedgerHead;
|
|
9
|
+
call: RoleCallFrame;
|
|
10
|
+
steeringVersion: number;
|
|
11
|
+
decision: SkillReadDecision;
|
|
12
|
+
}): Promise<void>;
|
|
13
|
+
export declare function canRootReadSkills(request: RequestExecutionScope, head: RoleCallLedgerHead, call: RoleCallFrame): boolean;
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { findRoleActivationReservationIssue, resolveRoleActivationBudget, } from "../orchestration/role-calls/activation-budget.js";
|
|
2
|
+
import { hasSuperContextContract } from "../context/super-context-policy.js";
|
|
3
|
+
import { KnowledgeSkillError } from "../knowledge-skills/personal-contracts.js";
|
|
4
|
+
import { resolveKnowledgeSkillReadTargets } from "../capabilities/knowledge-skills/read-targets.js";
|
|
5
|
+
import { emitRuntimeStatus } from "../events/runtime-status.js";
|
|
6
|
+
import { resolveRequestSteeringInbox } from "./request-steering.js";
|
|
7
|
+
/** Read synchronously, then commit the exact snapshot and the next root activation together. */
|
|
8
|
+
export async function performRootSkillRead(params) {
|
|
9
|
+
const { request, head, call } = params;
|
|
10
|
+
request.abortSignal.throwIfAborted();
|
|
11
|
+
const steering = resolveRequestSteeringInbox(request.requestSteering);
|
|
12
|
+
if (!steering.isCurrent(params.steeringVersion))
|
|
13
|
+
return;
|
|
14
|
+
if (!hasSuperContextContract(head.policy.authority, "supervisor"))
|
|
15
|
+
throw new Error("skill_read_policy_invalid");
|
|
16
|
+
if (!request.knowledgeSkillStore)
|
|
17
|
+
throw new Error("skill_read_unavailable");
|
|
18
|
+
const identity = {
|
|
19
|
+
authority: "runtime",
|
|
20
|
+
type: "record_skill_read",
|
|
21
|
+
callId: call.callId,
|
|
22
|
+
invocationAttempt: call.activationCount,
|
|
23
|
+
steeringVersion: params.steeringVersion,
|
|
24
|
+
};
|
|
25
|
+
const reservation = {
|
|
26
|
+
...identity,
|
|
27
|
+
...failedRead(params.decision, "knowledge_skill_unavailable"),
|
|
28
|
+
};
|
|
29
|
+
const exhausted = findRoleActivationReservationIssue(head.state, head.policy, reservation);
|
|
30
|
+
if (exhausted)
|
|
31
|
+
throw new Error(`role_call_ledger_rejected:${exhausted.code}`);
|
|
32
|
+
const payload = readStore(request.knowledgeSkillStore, params.decision);
|
|
33
|
+
request.abortSignal.throwIfAborted();
|
|
34
|
+
if (!steering.isCurrent(params.steeringVersion))
|
|
35
|
+
return;
|
|
36
|
+
const committed = await params.ledger.apply({
|
|
37
|
+
expectedHead: head,
|
|
38
|
+
command: { ...identity, ...payload },
|
|
39
|
+
});
|
|
40
|
+
if (!committed.ok)
|
|
41
|
+
throw new Error(`role_call_ledger_rejected:${committed.code}`);
|
|
42
|
+
emitRuntimeStatus(request, {
|
|
43
|
+
stage: "supervisor",
|
|
44
|
+
phase: "skills",
|
|
45
|
+
message: readStatus(payload),
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
function readStore(store, decision) {
|
|
49
|
+
try {
|
|
50
|
+
if (decision.action === "list_skills")
|
|
51
|
+
return {
|
|
52
|
+
operation: "list_skills",
|
|
53
|
+
selectors: [],
|
|
54
|
+
result: {
|
|
55
|
+
outcome: "completed",
|
|
56
|
+
skills: store.list().map((skill) => ({ ...skill })),
|
|
57
|
+
},
|
|
58
|
+
};
|
|
59
|
+
const resolved = resolveKnowledgeSkillReadTargets(store, decision.skillIds);
|
|
60
|
+
if (!resolved.ok)
|
|
61
|
+
return failedRead(decision, resolved.errorCode);
|
|
62
|
+
return {
|
|
63
|
+
operation: "read_skills",
|
|
64
|
+
selectors: [...decision.skillIds],
|
|
65
|
+
result: {
|
|
66
|
+
outcome: "completed",
|
|
67
|
+
skills: resolved.skills.map((skill) => ({ ...skill })),
|
|
68
|
+
},
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
catch (error) {
|
|
72
|
+
if (error instanceof KnowledgeSkillError)
|
|
73
|
+
return failedRead(decision, error.code);
|
|
74
|
+
throw error;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
function failedRead(decision, errorCode) {
|
|
78
|
+
const result = { outcome: "failed", errorCode, skills: [] };
|
|
79
|
+
if (decision.action === "list_skills")
|
|
80
|
+
return { operation: "list_skills", selectors: [], result };
|
|
81
|
+
return {
|
|
82
|
+
operation: "read_skills",
|
|
83
|
+
selectors: [...decision.skillIds],
|
|
84
|
+
result,
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
function readStatus(payload) {
|
|
88
|
+
if (payload.result.outcome === "failed")
|
|
89
|
+
return `Skill lookup failed: ${payload.result.errorCode}`;
|
|
90
|
+
if (payload.operation === "list_skills")
|
|
91
|
+
return `Listed ${payload.result.skills.length} Skills`;
|
|
92
|
+
return `Read Skills: ${payload.result.skills.map(({ name }) => name).join(", ")}`;
|
|
93
|
+
}
|
|
94
|
+
export function canRootReadSkills(request, head, call) {
|
|
95
|
+
if (!request.knowledgeSkillStore)
|
|
96
|
+
return false;
|
|
97
|
+
if (!hasSuperContextContract(head.policy.authority, "supervisor"))
|
|
98
|
+
return false;
|
|
99
|
+
return (call.activationCount <
|
|
100
|
+
resolveRoleActivationBudget(head.state, head.policy)
|
|
101
|
+
.maximumAcceptedActivationsPerCall);
|
|
102
|
+
}
|
|
@@ -1,12 +1,15 @@
|
|
|
1
|
+
import { prepareInitialMemory } from "../long-term-memory/initial-context.js";
|
|
1
2
|
import { createRequestRoleCallPolicy } from "./role-call-policy.js";
|
|
2
3
|
import { restoreApprovalExecutionFreshness } from "./capability-execution-freshness.js";
|
|
3
4
|
import { captureRoleCallLedgerCheckpoint } from "../orchestration/role-calls/checkpoint.js";
|
|
4
5
|
import { isRoleApprovalWait } from "../orchestration/role-executors/approval-continuation.js";
|
|
5
|
-
import {
|
|
6
|
+
import { restoreCapabilityApprovalGroup } from "../orchestration/worker-capabilities/execution/approval-group.js";
|
|
6
7
|
import { createRoleApprovalContinuation, validateRequestApprovalContinuation, } from "./approval-continuation.js";
|
|
7
8
|
import { createRoleCallLedger, resolveRoleCallTransactions, } from "../orchestration/role-calls/index.js";
|
|
8
9
|
import { traceDebug } from "../observability/debug-logger.js";
|
|
9
10
|
import { attachRequestPlannerRoleCallEvents } from "./role-call-planner-events.js";
|
|
11
|
+
import { attachRequestRoleDelegationEvents } from "./role-call-delegation-events.js";
|
|
12
|
+
import { attachRequestRoleReturnEvents } from "./role-call-return-events.js";
|
|
10
13
|
import { runRootExecutionKernel } from "./root-execution-kernel.js";
|
|
11
14
|
import { persistSettledSessionArtifactPaths, } from "./session-artifact-path-persistence.js";
|
|
12
15
|
export async function runRequestRunner(request, options = {}) {
|
|
@@ -26,8 +29,10 @@ export async function runRequestRunner(request, options = {}) {
|
|
|
26
29
|
}
|
|
27
30
|
: {}),
|
|
28
31
|
});
|
|
32
|
+
const initialMemory = await prepareInitialMemory(request, options.continuation?.ledger.state.initialMemory);
|
|
29
33
|
const ledger = createRoleCallLedger({
|
|
30
34
|
requestId: request.requestId,
|
|
35
|
+
...(initialMemory !== undefined ? { initialMemory } : {}),
|
|
31
36
|
...(options.continuation
|
|
32
37
|
? { checkpoint: options.continuation.ledger }
|
|
33
38
|
: {}),
|
|
@@ -37,20 +42,31 @@ export async function runRequestRunner(request, options = {}) {
|
|
|
37
42
|
ledger,
|
|
38
43
|
onEvent: request.onEvent,
|
|
39
44
|
});
|
|
45
|
+
attachRequestRoleDelegationEvents({
|
|
46
|
+
ledger,
|
|
47
|
+
onEvent: request.onEvent,
|
|
48
|
+
});
|
|
49
|
+
attachRequestRoleReturnEvents({
|
|
50
|
+
ledger,
|
|
51
|
+
onEvent: request.onEvent,
|
|
52
|
+
});
|
|
40
53
|
let result;
|
|
41
54
|
try {
|
|
42
55
|
let continuation;
|
|
43
56
|
if (options.continuation) {
|
|
44
57
|
validateRequestApprovalContinuation(options.continuation, ledger, request.workerCapabilities.provider.getDescriptors());
|
|
58
|
+
request.abortSignal.throwIfAborted();
|
|
45
59
|
const executionFreshness = restoreApprovalExecutionFreshness(options.continuation.preparedGroup.executionFreshnessToken, request.requestSteering);
|
|
46
|
-
const
|
|
60
|
+
const prepared = await restoreCapabilityApprovalGroup({
|
|
47
61
|
...(executionFreshness ? { executionFreshness } : {}),
|
|
48
62
|
ledger,
|
|
49
63
|
context: request.workerCapabilities.executionContext,
|
|
50
64
|
adapters: request.workerCapabilities.provider.getAdapters(),
|
|
51
65
|
group: options.continuation.preparedGroup,
|
|
52
|
-
decisions: options.decisions ?? [],
|
|
53
66
|
});
|
|
67
|
+
request.abortSignal.throwIfAborted();
|
|
68
|
+
restoreApprovalExecutionFreshness(options.continuation.preparedGroup.executionFreshnessToken, request.requestSteering);
|
|
69
|
+
const settled = await prepared.execute(options.decisions ?? []);
|
|
54
70
|
continuation = createRoleApprovalContinuation(options.continuation, settled.executionIds);
|
|
55
71
|
}
|
|
56
72
|
else {
|
|
@@ -3,6 +3,9 @@ import { hasSuperContextContract } from "../context/super-context-policy.js";
|
|
|
3
3
|
import { validateRoleCallCandidate } from "../orchestration/role-calls/reducer.js";
|
|
4
4
|
import { quarantineProvenOwnedSuperCheckpoint } from "./super-checkpoint-quarantine.js";
|
|
5
5
|
import { traceDebug } from "../observability/debug-logger.js";
|
|
6
|
+
import { isCanonicalSuperCapabilitySourceCall } from "../context/capability-result-compaction-source.js";
|
|
7
|
+
import { superPayloadCompactionContractId } from "../context/super-worker-compaction-sidecar.js";
|
|
8
|
+
import { rootPayloadCompactionScopeId } from "../orchestration/worker-capabilities/payload-compaction-transport.js";
|
|
6
9
|
/** Preserve normal failed-capability settlement; never create a role commit here. */
|
|
7
10
|
export function quarantineOwnedSuperPayloadCheckpoint(request, input, error) {
|
|
8
11
|
if (request.abortSignal.aborted || !(error instanceof SuperContextFailure))
|
|
@@ -11,10 +14,13 @@ export function quarantineOwnedSuperPayloadCheckpoint(request, input, error) {
|
|
|
11
14
|
if (!sidecar || !request.contextCompactionStore)
|
|
12
15
|
return;
|
|
13
16
|
const head = sidecar.head;
|
|
14
|
-
|
|
17
|
+
const contractId = superPayloadCompactionContractId(sidecar);
|
|
18
|
+
if (!hasSuperContextContract(head.policy.authority, contractId))
|
|
15
19
|
return;
|
|
16
20
|
const call = head.state.calls.find((candidate) => candidate.callId === sidecar.callId);
|
|
17
|
-
if (!
|
|
21
|
+
if (!isCanonicalSuperCapabilitySourceCall(head, call))
|
|
22
|
+
return;
|
|
23
|
+
if (call.status !== "active")
|
|
18
24
|
return;
|
|
19
25
|
if (head.state.phase !== "running" || head.state.activeCallId !== call.callId)
|
|
20
26
|
return;
|
|
@@ -28,12 +34,15 @@ export function quarantineOwnedSuperPayloadCheckpoint(request, input, error) {
|
|
|
28
34
|
if (binding.requestId !== request.requestId || binding.callId !== call.callId)
|
|
29
35
|
return;
|
|
30
36
|
if (binding.parentCallId !== call.parentCallId ||
|
|
31
|
-
binding.contractId !==
|
|
37
|
+
binding.contractId !== contractId)
|
|
32
38
|
return;
|
|
33
39
|
if (binding.sourceRevision !== head.revision ||
|
|
34
40
|
binding.invocationAttempt !== call.activationCount)
|
|
35
41
|
return;
|
|
36
|
-
|
|
42
|
+
const scopeId = "worker" in input.context
|
|
43
|
+
? `worker:${call.callId}:request-tool-results`
|
|
44
|
+
: rootPayloadCompactionScopeId(input);
|
|
45
|
+
if (binding.scopeId !== scopeId ||
|
|
37
46
|
binding.modelStep !== input.modelStep)
|
|
38
47
|
return;
|
|
39
48
|
if (validateRoleCallCandidate({ state: head.state, policy: head.policy }).length)
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
import { canRootReadSkills } from "./root-skill-read.js";
|
|
2
|
+
import { isSupervisorSkillWriteCapabilityId } from "../orchestration/worker-capabilities/supervisor-skill-authority.js";
|
|
3
|
+
import { isSupervisorSkillWriteSelection } from "../steps/supervisor-skill-authoring/contract.js";
|
|
4
|
+
import { resolveRequestSteeringInbox } from "./request-steering.js";
|
|
1
5
|
import { projectSupervisorCallIdentity, projectSupervisorResumeContext, runSupervisorDecision, SUPERVISOR_DECISION_MODEL_STEP, } from "../steps/supervisor-decision/index.js";
|
|
2
6
|
import { runSupervisorAuthoredResponse, SUPERVISOR_RESPONSE_MODEL_STEP, } from "../steps/supervisor-response/index.js";
|
|
3
7
|
import { runRootExecutionKernel, } from "./root-execution-kernel.js";
|
|
@@ -9,25 +13,64 @@ export const SUPERVISOR_ROOT_CONTRACT = Object.freeze({
|
|
|
9
13
|
projectCallIdentity: projectSupervisorCallIdentity,
|
|
10
14
|
projectResume: projectSupervisorResumeContext,
|
|
11
15
|
async decide(request, options) {
|
|
12
|
-
|
|
16
|
+
if (hasSettledSupervisorSkillWrite(options.head))
|
|
17
|
+
return {
|
|
18
|
+
decision: { action: "respond" },
|
|
19
|
+
steeringVersion: resolveRequestSteeringInbox(request.requestSteering).snapshot().version,
|
|
20
|
+
};
|
|
21
|
+
const outcome = await runSupervisorDecision(request, {
|
|
13
22
|
call: options.call,
|
|
23
|
+
skillReadHead: options.head,
|
|
14
24
|
memoryRecallCount: options.head.state.memoryRecalls.length,
|
|
25
|
+
allowSkillReads: canRootReadSkills(request, options.head, options.callFrame),
|
|
26
|
+
remainingRoleCalls: options.head.policy.limits.maxCalls -
|
|
27
|
+
options.head.state.calls.length,
|
|
28
|
+
remainingCapabilityExecutions: options.head.policy.limits.maxCapabilityExecutions -
|
|
29
|
+
options.head.state.capabilityExecutions.length,
|
|
15
30
|
toolResults: options.toolResults,
|
|
16
31
|
includeAcknowledgement: options.includeAcknowledgement,
|
|
17
32
|
includeTitle: options.includeTitle,
|
|
18
33
|
allowedRoleIds: options.allowedRoleIds,
|
|
19
34
|
availableWorkerCapabilityCatalog: options.availableWorkerCapabilityCatalog,
|
|
35
|
+
availableSkillWriteOperationIds: options.availableSkillWriteOperationIds,
|
|
36
|
+
...(options.head.state.initialMemory?.message
|
|
37
|
+
? { initialMemoryMessage: options.head.state.initialMemory.message }
|
|
38
|
+
: {}),
|
|
20
39
|
...(options.memoryRecallMessage
|
|
21
40
|
? { memoryRecallMessage: options.memoryRecallMessage }
|
|
22
41
|
: {}),
|
|
23
42
|
...(options.resume ? { resume: options.resume } : {}),
|
|
24
43
|
});
|
|
44
|
+
const { decision, steeringVersion } = outcome;
|
|
45
|
+
if (decision.action === "no_save")
|
|
46
|
+
return {
|
|
47
|
+
steeringVersion, decision: {
|
|
48
|
+
action: "respond", responseRecommendation: decision.reason,
|
|
49
|
+
responseRecommendationOrigin: "skill_authoring_no_save",
|
|
50
|
+
...(decision.acknowledgement ? { acknowledgement: decision.acknowledgement } : {}),
|
|
51
|
+
...(decision.title ? { title: decision.title } : {}),
|
|
52
|
+
},
|
|
53
|
+
};
|
|
54
|
+
if (!isSupervisorSkillWriteSelection(decision))
|
|
55
|
+
return { decision, steeringVersion };
|
|
56
|
+
return {
|
|
57
|
+
steeringVersion, decision: {
|
|
58
|
+
action: "prepare_skill_write", selection: decision,
|
|
59
|
+
...(decision.acknowledgement ? { acknowledgement: decision.acknowledgement } : {}),
|
|
60
|
+
...(decision.title ? { title: decision.title } : {}),
|
|
61
|
+
},
|
|
62
|
+
};
|
|
25
63
|
},
|
|
26
64
|
async authorResponse(request, options) {
|
|
27
65
|
return runSupervisorAuthoredResponse(request, {
|
|
28
66
|
responseRecommendation: options.responseRecommendation,
|
|
67
|
+
responseRecommendationOrigin: options.responseRecommendationOrigin,
|
|
29
68
|
call: options.call,
|
|
69
|
+
skillReadHead: options.head,
|
|
30
70
|
toolResults: options.toolResults,
|
|
71
|
+
...(options.head.state.initialMemory?.message
|
|
72
|
+
? { initialMemoryMessage: options.head.state.initialMemory.message }
|
|
73
|
+
: {}),
|
|
31
74
|
...(options.memoryRecallMessage
|
|
32
75
|
? { memoryRecallMessage: options.memoryRecallMessage }
|
|
33
76
|
: {}),
|
|
@@ -36,6 +79,16 @@ export const SUPERVISOR_ROOT_CONTRACT = Object.freeze({
|
|
|
36
79
|
});
|
|
37
80
|
},
|
|
38
81
|
});
|
|
82
|
+
/** A settled write is terminal even after approval restoration; pending writes stay pending. */
|
|
83
|
+
function hasSettledSupervisorSkillWrite(head) {
|
|
84
|
+
return head.state.capabilityExecutions.some((execution) => {
|
|
85
|
+
if (execution.callId !== head.state.rootCallId)
|
|
86
|
+
return false;
|
|
87
|
+
if (execution.status !== "settled")
|
|
88
|
+
return false;
|
|
89
|
+
return isSupervisorSkillWriteCapabilityId(execution.capabilityId);
|
|
90
|
+
});
|
|
91
|
+
}
|
|
39
92
|
/** Executes the Supervisor root contract for an already composed request. */
|
|
40
93
|
export async function runSupervisorRootExecution(params) {
|
|
41
94
|
return runRootExecutionKernel({
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { KnowledgeSkillDocument } from "../knowledge-skills/store.js";
|
|
2
|
+
import type { RoleCallLedgerHead } from "../orchestration/role-calls/index.js";
|
|
3
|
+
type PersonalEditTarget = KnowledgeSkillDocument & Readonly<{
|
|
4
|
+
source: "personal";
|
|
5
|
+
revision: number;
|
|
6
|
+
}>;
|
|
7
|
+
/** Resolve the captured document, never a newer Store value, for one accepted edit. */
|
|
8
|
+
export declare function findCapturedPersonalSkillEditTarget(head: RoleCallLedgerHead, skillId: string, expectedRevision?: number): PersonalEditTarget | undefined;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/** Resolve the captured document, never a newer Store value, for one accepted edit. */
|
|
2
|
+
export function findCapturedPersonalSkillEditTarget(head, skillId, expectedRevision) {
|
|
3
|
+
for (const read of [...(head.state.skillReads ?? [])].reverse()) {
|
|
4
|
+
if (read.callId !== head.state.rootCallId)
|
|
5
|
+
continue;
|
|
6
|
+
if (read.operation !== "read_skills" || read.result.outcome !== "completed")
|
|
7
|
+
continue;
|
|
8
|
+
const document = read.result.skills.find((candidate) => candidate.skillId === skillId);
|
|
9
|
+
if (!document)
|
|
10
|
+
continue;
|
|
11
|
+
if (!isPersonalEditTarget(document))
|
|
12
|
+
return undefined;
|
|
13
|
+
if (expectedRevision !== undefined && document.revision !== expectedRevision)
|
|
14
|
+
return undefined;
|
|
15
|
+
return document;
|
|
16
|
+
}
|
|
17
|
+
return undefined;
|
|
18
|
+
}
|
|
19
|
+
function isPersonalEditTarget(document) {
|
|
20
|
+
if (document.source !== "personal")
|
|
21
|
+
return false;
|
|
22
|
+
if (!Number.isSafeInteger(document.revision))
|
|
23
|
+
return false;
|
|
24
|
+
return (document.revision ?? 0) >= 1;
|
|
25
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { ChatMessage, ModelGatewayAttachment } from "../../model-gateway/types.js";
|
|
2
|
+
import type { RequestContextPinnedPart } from "../context/request-context-contracts.js";
|
|
3
|
+
import type { WorkerCapabilityPayloadAuthor, WorkerCapabilityPayloadModelRequest } from "../orchestration/worker-capabilities/payload-contracts.js";
|
|
4
|
+
import type { RequestExecutionSeed } from "./contracts.js";
|
|
5
|
+
import { type RootSessionMemoryProjection } from "../context/session-memory/root-projection.js";
|
|
6
|
+
import { createSessionMemoryAwareCompactionController } from "../context/session-memory/model-step-controller.js";
|
|
7
|
+
import type { ModelStepContextCompactionController } from "../model/model-step-port.js";
|
|
8
|
+
type PayloadAuthorInput = Parameters<WorkerCapabilityPayloadAuthor["author"]>[0];
|
|
9
|
+
/** The accepted edit uses the exact captured revision, never a fresh Store read. */
|
|
10
|
+
export declare function prepareSupervisorSkillPayloadInput(input: PayloadAuthorInput): PayloadAuthorInput;
|
|
11
|
+
export declare function projectPayloadSkillGuidance(input: WorkerCapabilityPayloadModelRequest): readonly ChatMessage[];
|
|
12
|
+
/** Keep child evidence compactable while the full replacement target stays exact. */
|
|
13
|
+
export declare function projectSupervisorSkillPayloadContinuation(input: WorkerCapabilityPayloadModelRequest, targetContentMessage: ChatMessage | undefined): Readonly<{
|
|
14
|
+
continuationParts?: readonly RequestContextPinnedPart[];
|
|
15
|
+
continuationMessages?: readonly ChatMessage[];
|
|
16
|
+
}>;
|
|
17
|
+
export declare function projectSupervisorSkillPayloadRequestSource(input: WorkerCapabilityPayloadModelRequest, message: ChatMessage, attachments: ModelGatewayAttachment[] | undefined): ChatMessage;
|
|
18
|
+
/** Conversation remains in its existing history lane, before budgeting. */
|
|
19
|
+
export declare function projectSupervisorSkillPayloadHistory(input: WorkerCapabilityPayloadModelRequest, request: Pick<RequestExecutionSeed, "historyMessages" | "sessionMemory">): RootSessionMemoryProjection | undefined;
|
|
20
|
+
export declare function createSupervisorSkillPayloadCompactionController(input: WorkerCapabilityPayloadModelRequest, request: Parameters<typeof createSessionMemoryAwareCompactionController>[0], activeRequestController: ModelStepContextCompactionController): ModelStepContextCompactionController;
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { buildCoreSkillReadContextMessages } from "../context/core-skill-read-context.js";
|
|
2
|
+
import { hasSuperContextContract } from "../context/super-context-policy.js";
|
|
3
|
+
import { readSuperWorkerCompactionSidecar, } from "../context/super-worker-compaction-sidecar.js";
|
|
4
|
+
import { isSupervisorSkillWriteCapabilityId } from "../orchestration/worker-capabilities/supervisor-skill-authority.js";
|
|
5
|
+
import { buildCompletedSupervisorChildContinuationParts } from "../steps/supervisor-decision/resume.js";
|
|
6
|
+
import { findCapturedPersonalSkillEditTarget } from "./supervisor-skill-edit-target.js";
|
|
7
|
+
import { projectRootSessionMemory } from "../context/session-memory/root-projection.js";
|
|
8
|
+
import { createSessionMemoryAwareCompactionController } from "../context/session-memory/model-step-controller.js";
|
|
9
|
+
/** The accepted edit uses the exact captured revision, never a fresh Store read. */
|
|
10
|
+
export function prepareSupervisorSkillPayloadInput(input) {
|
|
11
|
+
const sidecar = readSuperWorkerCompactionSidecar(input.settledCapabilityResults);
|
|
12
|
+
if (!isSupervisorSkillOwner(sidecar, input.call.callId, input.descriptor.capabilityId))
|
|
13
|
+
return input;
|
|
14
|
+
if (input.descriptor.capabilityId !== "update_skill")
|
|
15
|
+
return input;
|
|
16
|
+
const document = typeof input.controls.skillId === "string" && typeof input.controls.expectedRevision === "number"
|
|
17
|
+
? findCapturedPersonalSkillEditTarget(sidecar.head, input.controls.skillId, input.controls.expectedRevision)
|
|
18
|
+
: undefined;
|
|
19
|
+
if (!document)
|
|
20
|
+
throw new Error("supervisor_skill_edit_target_revision_mismatch");
|
|
21
|
+
return Object.freeze({
|
|
22
|
+
...input,
|
|
23
|
+
stage: Object.freeze({ index: 1, count: 1, outputParam: "content" }),
|
|
24
|
+
targetContext: Object.freeze({
|
|
25
|
+
targetParam: "skillId", targetPath: document.skillId,
|
|
26
|
+
presentation: "full", content: document.content,
|
|
27
|
+
}),
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
export function projectPayloadSkillGuidance(input) {
|
|
31
|
+
if (input.context.contextScope !== "standard")
|
|
32
|
+
return [];
|
|
33
|
+
const messages = buildCoreSkillReadContextMessages(input.superWorkerCompaction?.head, "delegate");
|
|
34
|
+
if (!isSupervisorSkillPayload(input) || input.context.acceptedCapability.capabilityId !== "update_skill")
|
|
35
|
+
return messages;
|
|
36
|
+
const targetId = input.context.targetContext?.targetPath;
|
|
37
|
+
return messages.filter(({ content }) => JSON.parse(content).document?.skillId !== targetId);
|
|
38
|
+
}
|
|
39
|
+
/** Keep child evidence compactable while the full replacement target stays exact. */
|
|
40
|
+
export function projectSupervisorSkillPayloadContinuation(input, targetContentMessage) {
|
|
41
|
+
if (!isSupervisorSkillPayload(input))
|
|
42
|
+
return targetContentMessage
|
|
43
|
+
? { continuationMessages: [targetContentMessage] } : {};
|
|
44
|
+
const parts = [
|
|
45
|
+
...buildCompletedSupervisorChildContinuationParts(input.superWorkerCompaction?.head),
|
|
46
|
+
];
|
|
47
|
+
if (targetContentMessage)
|
|
48
|
+
parts.push(Object.freeze({
|
|
49
|
+
sourceRef: `supervisor-skill-edit-target:${input.executionId}`,
|
|
50
|
+
category: "role_continuation", retention: "exact",
|
|
51
|
+
messages: Object.freeze([targetContentMessage]),
|
|
52
|
+
}));
|
|
53
|
+
return parts.length ? { continuationParts: Object.freeze(parts) } : {};
|
|
54
|
+
}
|
|
55
|
+
export function projectSupervisorSkillPayloadRequestSource(input, message, attachments) {
|
|
56
|
+
if (!isSupervisorSkillPayload(input) || !attachments?.length)
|
|
57
|
+
return message;
|
|
58
|
+
return { role: "user", content: message.content, attachments };
|
|
59
|
+
}
|
|
60
|
+
/** Conversation remains in its existing history lane, before budgeting. */
|
|
61
|
+
export function projectSupervisorSkillPayloadHistory(input, request) {
|
|
62
|
+
if (!usesSupervisorSkillRequestHistory(input))
|
|
63
|
+
return undefined;
|
|
64
|
+
return projectRootSessionMemory(request);
|
|
65
|
+
}
|
|
66
|
+
export function createSupervisorSkillPayloadCompactionController(input, request, activeRequestController) {
|
|
67
|
+
if (!usesSupervisorSkillRequestHistory(input))
|
|
68
|
+
return activeRequestController;
|
|
69
|
+
return createSessionMemoryAwareCompactionController(request, activeRequestController);
|
|
70
|
+
}
|
|
71
|
+
function usesSupervisorSkillRequestHistory(input) {
|
|
72
|
+
if (input.requestSourceProjection !== "full_request")
|
|
73
|
+
return false;
|
|
74
|
+
return isSupervisorSkillPayload(input);
|
|
75
|
+
}
|
|
76
|
+
function isSupervisorSkillPayload(input) {
|
|
77
|
+
if (!("root" in input.context) || input.context.contextScope !== "standard")
|
|
78
|
+
return false;
|
|
79
|
+
return isSupervisorSkillOwner(input.superWorkerCompaction, input.context.root.callId, input.context.acceptedCapability.capabilityId);
|
|
80
|
+
}
|
|
81
|
+
function isSupervisorSkillOwner(sidecar, callId, capabilityId) {
|
|
82
|
+
if (!sidecar || !isSupervisorSkillWriteCapabilityId(capabilityId))
|
|
83
|
+
return false;
|
|
84
|
+
const { head } = sidecar;
|
|
85
|
+
if (!hasSuperContextContract(head.policy.authority, "supervisor"))
|
|
86
|
+
return false;
|
|
87
|
+
if (sidecar.callId !== callId || sidecar.parentCallId !== null || head.state.rootCallId !== callId)
|
|
88
|
+
return false;
|
|
89
|
+
const call = head.state.calls.find((candidate) => candidate.callId === callId);
|
|
90
|
+
return call?.roleId === "supervisor" && call.parentCallId === null && call.depth === 0;
|
|
91
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { RoleCallLedger, RoleChildReturnContext } from "../orchestration/role-calls/index.js";
|
|
2
|
+
import type { RootContractDecision } from "./root-contract.js";
|
|
3
|
+
import type { RootDecisionActivation } from "./root-execution-contracts.js";
|
|
4
|
+
import type { RequestExecutionScope } from "./execution-scope.js";
|
|
5
|
+
type WritePreparationDecision = Extract<RootContractDecision, {
|
|
6
|
+
action: "prepare_skill_write";
|
|
7
|
+
}>;
|
|
8
|
+
type PreparedActivation = RootDecisionActivation & Readonly<{
|
|
9
|
+
decision: Extract<RootContractDecision, {
|
|
10
|
+
action: "invoke_capability" | "respond";
|
|
11
|
+
}>;
|
|
12
|
+
}>;
|
|
13
|
+
/** Prepare the already selected write without returning to routing or discovery. */
|
|
14
|
+
export declare function prepareSupervisorSkillWrite(params: {
|
|
15
|
+
request: RequestExecutionScope;
|
|
16
|
+
ledger: RoleCallLedger;
|
|
17
|
+
activation: RootDecisionActivation & Readonly<{
|
|
18
|
+
decision: WritePreparationDecision;
|
|
19
|
+
}>;
|
|
20
|
+
resume: RoleChildReturnContext | undefined;
|
|
21
|
+
}): Promise<Readonly<{
|
|
22
|
+
activation: PreparedActivation;
|
|
23
|
+
resume: RoleChildReturnContext | undefined;
|
|
24
|
+
}> | undefined>;
|
|
25
|
+
export {};
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { hasSuperContextContract } from "../context/super-context-policy.js";
|
|
2
|
+
import { resolveRequestSteeringInbox } from "./request-steering.js";
|
|
3
|
+
import { performRootReferenceAction } from "./root-reference-action.js";
|
|
4
|
+
import { canRootReadSkills } from "./root-skill-read.js";
|
|
5
|
+
import { findCapturedPersonalSkillEditTarget } from "./supervisor-skill-edit-target.js";
|
|
6
|
+
const SKILL_DOCUMENT_ASSIGNMENT = "Produce only the complete reusable Markdown Skill document requested by the user. Transform the supplied sources into guidance; do not copy the request, runtime instructions, or context envelopes. For an edit, preserve content outside the requested changes.";
|
|
7
|
+
/** Prepare the already selected write without returning to routing or discovery. */
|
|
8
|
+
export async function prepareSupervisorSkillWrite(params) {
|
|
9
|
+
const { request, ledger } = params;
|
|
10
|
+
let { activation, resume } = params;
|
|
11
|
+
const steering = resolveRequestSteeringInbox(request.requestSteering);
|
|
12
|
+
request.abortSignal.throwIfAborted();
|
|
13
|
+
if (!steering.isCurrent(activation.decisionSteeringVersion))
|
|
14
|
+
return undefined;
|
|
15
|
+
if (!isSupervisorWritePreparation(activation))
|
|
16
|
+
throw new Error("supervisor_skill_authority_invalid");
|
|
17
|
+
const selection = activation.decision.selection;
|
|
18
|
+
if (selection.action === "create_skill") {
|
|
19
|
+
return { activation: prepareInvocation(activation, { name: selection.name, description: selection.description }), resume };
|
|
20
|
+
}
|
|
21
|
+
let target = findCapturedPersonalSkillEditTarget(activation.head, selection.skillId);
|
|
22
|
+
if (!target) {
|
|
23
|
+
if (!canRootReadSkills(request, activation.head, activation.call)) {
|
|
24
|
+
return { activation: prepareNoSave(activation, "The requested Skill edit could not load its exact target within the request budget."), resume };
|
|
25
|
+
}
|
|
26
|
+
resume = await performRootReferenceAction(request, ledger, {
|
|
27
|
+
...activation,
|
|
28
|
+
decision: { action: "read_skills", skillIds: [selection.skillId] },
|
|
29
|
+
}, resume);
|
|
30
|
+
request.abortSignal.throwIfAborted();
|
|
31
|
+
if (!steering.isCurrent(activation.decisionSteeringVersion))
|
|
32
|
+
return undefined;
|
|
33
|
+
const head = ledger.current();
|
|
34
|
+
const callIdentity = request.executionPolicy.rootContract.projectCallIdentity(head);
|
|
35
|
+
const call = head.state.calls.find(({ callId }) => callId === callIdentity.callId);
|
|
36
|
+
if (!call)
|
|
37
|
+
throw new Error("supervisor_call_frame_missing");
|
|
38
|
+
activation = { ...activation, head, call, callIdentity };
|
|
39
|
+
target = findCapturedPersonalSkillEditTarget(head, selection.skillId);
|
|
40
|
+
}
|
|
41
|
+
if (!target) {
|
|
42
|
+
return { activation: prepareNoSave(activation, "No Skill was saved: the selected exact personal Skill is unavailable or read-only."), resume };
|
|
43
|
+
}
|
|
44
|
+
return {
|
|
45
|
+
activation: prepareInvocation(activation, {
|
|
46
|
+
skillId: target.skillId, expectedRevision: target.revision,
|
|
47
|
+
...(selection.name !== undefined ? { name: selection.name } : {}),
|
|
48
|
+
...(selection.description !== undefined ? { description: selection.description } : {}),
|
|
49
|
+
}), resume,
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
function isSupervisorWritePreparation(activation) {
|
|
53
|
+
if (!hasSuperContextContract(activation.head.policy.authority, "supervisor"))
|
|
54
|
+
return false;
|
|
55
|
+
if (activation.call.callId !== activation.head.state.rootCallId)
|
|
56
|
+
return false;
|
|
57
|
+
return activation.call.parentCallId === null;
|
|
58
|
+
}
|
|
59
|
+
function prepareInvocation(activation, controls) {
|
|
60
|
+
const selection = activation.decision.selection;
|
|
61
|
+
const title = selection.action === "create_skill" ? selection.name : selection.skillId;
|
|
62
|
+
return { ...activation, decision: {
|
|
63
|
+
action: "invoke_capability", capabilityId: selection.action,
|
|
64
|
+
intent: `${selection.action === "create_skill" ? "Create" : "Update"} Skill: ${title}`,
|
|
65
|
+
authoringObjective: SKILL_DOCUMENT_ASSIGNMENT, controls,
|
|
66
|
+
} };
|
|
67
|
+
}
|
|
68
|
+
function prepareNoSave(activation, reason) {
|
|
69
|
+
return { ...activation, decision: { action: "respond",
|
|
70
|
+
responseRecommendation: reason, responseRecommendationOrigin: "skill_authoring_no_save" } };
|
|
71
|
+
}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { KnowledgeSkillStore } from "../knowledge-skills/store.js";
|
|
2
|
+
import { type AvailableSkillsSource } from "../knowledge-skills/available-skills.js";
|
|
1
3
|
import type { RuntimeModelPluginConfig } from "../config/model-plugin-config.js";
|
|
2
4
|
import type { RuntimeFilesystemScope } from "../context/runtime-filesystem-scope.js";
|
|
3
5
|
import type { RuntimeConfig, ToolRegistry } from "../ports.js";
|
|
@@ -15,10 +17,11 @@ type RequestWorkerCapabilityProviderParams<TRequest> = Readonly<{
|
|
|
15
17
|
requestAttachments?: readonly ToolRequestAttachment[];
|
|
16
18
|
runtimeConfig?: RuntimeConfig;
|
|
17
19
|
toolRegistryOverride?: ToolRegistry;
|
|
20
|
+
knowledgeSkillStore?: KnowledgeSkillStore;
|
|
18
21
|
}>;
|
|
19
22
|
/**
|
|
20
23
|
* Creates one lazy, request-scoped Worker capability source from declarative
|
|
21
24
|
* role config and the neutral runtime Tool Registry.
|
|
22
25
|
*/
|
|
23
|
-
export declare function createRequestWorkerCapabilityProvider(params: RequestWorkerCapabilityProviderParams<RequestCapabilityCompositionView>): WorkerCapabilityAdapterProvider<RequestCapabilityExecutionView> & ToolAvailabilitySource;
|
|
26
|
+
export declare function createRequestWorkerCapabilityProvider(params: RequestWorkerCapabilityProviderParams<RequestCapabilityCompositionView>): WorkerCapabilityAdapterProvider<RequestCapabilityExecutionView> & ToolAvailabilitySource & AvailableSkillsSource;
|
|
24
27
|
export {};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { projectAvailableSkills, } from "../knowledge-skills/available-skills.js";
|
|
1
2
|
import { randomUUID } from "node:crypto";
|
|
2
3
|
import { createBundledPluginSkillProvider, createConfiguredSkillProvider, } from "../adapters/configured-skill-provider.js";
|
|
3
4
|
import { createRegisteredToolWorkerCapabilityProvider } from "../adapters/registered-tool-worker-capabilities.js";
|
|
@@ -68,8 +69,10 @@ export function createRequestWorkerCapabilityProvider(params) {
|
|
|
68
69
|
? { effectPersistence: params.request.effectPersistence }
|
|
69
70
|
: {}),
|
|
70
71
|
});
|
|
72
|
+
const getAvailableTools = () => projectAvailableTools(getRequestToolRegistry().listNormalInvocations?.());
|
|
71
73
|
return Object.freeze({
|
|
72
74
|
...provider,
|
|
73
|
-
getAvailableTools
|
|
75
|
+
getAvailableTools,
|
|
76
|
+
getAvailableSkills: () => projectAvailableSkills(params.knowledgeSkillStore, getAvailableTools()),
|
|
74
77
|
});
|
|
75
78
|
}
|