@abot-ai/runtime 1.2.0 → 1.3.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 +14 -0
- package/dist/src/bridge/request-steering.d.ts +2 -1
- package/dist/src/bridge/request-steering.js +4 -2
- package/dist/src/bridge/runtime-replay.js +2 -19
- package/dist/src/bridge/start-agent-bridge.js +1 -1
- package/dist/src/capabilities/normal-invocation/validator.js +1 -1
- package/dist/src/capabilities/tool-definition-validator/event-presentation.js +3 -0
- package/dist/src/capabilities/tool-definition-validator/event-result-metadata.d.ts +2 -0
- package/dist/src/capabilities/tool-definition-validator/event-result-metadata.js +74 -0
- package/dist/src/capabilities/tool-event-metadata.js +3 -0
- package/dist/src/capabilities/tool-result-event-projection.d.ts +3 -0
- package/dist/src/capabilities/tool-result-event-projection.js +82 -0
- package/dist/src/capabilities/tool-types.d.ts +5 -0
- package/dist/src/cli/abot.js +2 -11
- package/dist/src/runtime/adapters/in-memory-session-store.js +1 -0
- package/dist/src/runtime/adapters/long-term-memory/file-lock/acquisition.js +11 -2
- package/dist/src/runtime/adapters/long-term-memory/file-lock/contracts.d.ts +2 -0
- package/dist/src/runtime/adapters/long-term-memory/file-lock/synchronous-release.d.ts +2 -0
- package/dist/src/runtime/adapters/long-term-memory/file-lock/synchronous-release.js +40 -0
- package/dist/src/runtime/adapters/registered-tool-normal-invocations/execution/approval.d.ts +3 -0
- package/dist/src/runtime/adapters/registered-tool-normal-invocations/execution/approval.js +9 -0
- package/dist/src/runtime/adapters/registered-tool-normal-invocations/execution/rejection-event.d.ts +13 -0
- package/dist/src/runtime/adapters/registered-tool-normal-invocations/execution/rejection-event.js +25 -0
- package/dist/src/runtime/adapters/registered-tool-normal-invocations/execution/run.js +18 -2
- package/dist/src/runtime/adapters/registered-tool-normal-invocations/executor.js +8 -0
- package/dist/src/runtime/adapters/registered-tool-normal-invocations/payload/lifecycle.js +7 -3
- package/dist/src/runtime/adapters/registered-tool-normal-invocations/shared/contracts.d.ts +17 -2
- package/dist/src/runtime/adapters/registered-tool-normal-invocations/shared/event-metadata.d.ts +9 -0
- package/dist/src/runtime/adapters/registered-tool-normal-invocations/shared/event-metadata.js +8 -0
- package/dist/src/runtime/adapters/registered-tool-worker-capabilities/execution.js +16 -1
- package/dist/src/runtime/adapters/registered-tool-worker-capabilities/payload-observability.js +2 -2
- package/dist/src/runtime/adapters/scheduled-request-outcome.d.ts +11 -0
- package/dist/src/runtime/adapters/scheduled-request-outcome.js +41 -0
- package/dist/src/runtime/adapters/scheduler-runtime.d.ts +19 -0
- package/dist/src/runtime/adapters/scheduler-runtime.js +138 -0
- package/dist/src/runtime/capabilities/scheduling/create-operations.d.ts +55 -0
- package/dist/src/runtime/capabilities/scheduling/create-operations.js +30 -0
- package/dist/src/runtime/capabilities/scheduling/create-time-zone.d.ts +1 -0
- package/dist/src/runtime/capabilities/scheduling/create-time-zone.js +11 -0
- package/dist/src/runtime/capabilities/scheduling/job-list-page.d.ts +25 -0
- package/dist/src/runtime/capabilities/scheduling/job-list-page.js +40 -0
- package/dist/src/runtime/capabilities/scheduling/model-validation.d.ts +2 -0
- package/dist/src/runtime/capabilities/scheduling/model-validation.js +15 -0
- package/dist/src/runtime/capabilities/scheduling/tool-contract.d.ts +2 -0
- package/dist/src/runtime/capabilities/scheduling/tool-contract.js +35 -0
- package/dist/src/runtime/capabilities/scheduling/tool-input-properties.d.ts +43 -0
- package/dist/src/runtime/capabilities/scheduling/tool-input-properties.js +27 -0
- package/dist/src/runtime/capabilities/scheduling/tool-module.d.ts +4 -0
- package/dist/src/runtime/capabilities/scheduling/tool-module.js +158 -0
- package/dist/src/runtime/capabilities/scheduling/update-operations.d.ts +2 -0
- package/dist/src/runtime/capabilities/scheduling/update-operations.js +49 -0
- package/dist/src/runtime/composition.d.ts +23 -3
- package/dist/src/runtime/composition.js +12 -17
- package/dist/src/runtime/config/environment-paths.d.ts +10 -0
- package/dist/src/runtime/config/environment-paths.js +31 -0
- package/dist/src/runtime/config/environment-storage.d.ts +9 -0
- package/dist/src/runtime/config/environment-storage.js +65 -0
- package/dist/src/runtime/config/fields.js +7 -0
- package/dist/src/runtime/config/long-term-memory.js +15 -0
- package/dist/src/runtime/config/schema.js +8 -0
- package/dist/src/runtime/config.js +9 -5
- package/dist/src/runtime/context/scheduled-execution-context.d.ts +10 -0
- package/dist/src/runtime/context/scheduled-execution-context.js +52 -0
- package/dist/src/runtime/default-adapters.d.ts +3 -32
- package/dist/src/runtime/default-adapters.js +3 -270
- package/dist/src/runtime/default-environment-adapters.d.ts +19 -0
- package/dist/src/runtime/default-environment-adapters.js +144 -0
- package/dist/src/runtime/index.d.ts +5 -0
- package/dist/src/runtime/index.js +4 -0
- package/dist/src/runtime/local-application.d.ts +22 -0
- package/dist/src/runtime/local-application.js +81 -0
- package/dist/src/runtime/local-host/app-memory-dispatch.d.ts +11 -0
- package/dist/src/runtime/local-host/app-memory-dispatch.js +103 -0
- package/dist/src/runtime/local-host/app-owner.d.ts +4 -0
- package/dist/src/runtime/local-host/app-owner.js +119 -0
- package/dist/src/runtime/local-host/app-request-control.d.ts +24 -0
- package/dist/src/runtime/local-host/app-request-control.js +135 -0
- package/dist/src/runtime/local-host/app-service-dispatch.d.ts +5 -0
- package/dist/src/runtime/local-host/app-service-dispatch.js +64 -0
- package/dist/src/runtime/local-host/client-identity.d.ts +3 -0
- package/dist/src/runtime/local-host/client-identity.js +17 -0
- package/dist/src/runtime/local-host/client-memory.d.ts +7 -0
- package/dist/src/runtime/local-host/client-memory.js +54 -0
- package/dist/src/runtime/local-host/client-requests.d.ts +19 -0
- package/dist/src/runtime/local-host/client-requests.js +145 -0
- package/dist/src/runtime/local-host/client-services.d.ts +10 -0
- package/dist/src/runtime/local-host/client-services.js +14 -0
- package/dist/src/runtime/local-host/contracts.d.ts +36 -0
- package/dist/src/runtime/local-host/contracts.js +1 -0
- package/dist/src/runtime/local-host/endpoint.d.ts +7 -0
- package/dist/src/runtime/local-host/endpoint.js +79 -0
- package/dist/src/runtime/local-host/owner-activity.d.ts +10 -0
- package/dist/src/runtime/local-host/owner-activity.js +30 -0
- package/dist/src/runtime/local-host/owner-retirement.d.ts +3 -0
- package/dist/src/runtime/local-host/owner-retirement.js +15 -0
- package/dist/src/runtime/local-host/owner-server.d.ts +6 -0
- package/dist/src/runtime/local-host/owner-server.js +88 -0
- package/dist/src/runtime/local-host/private-access.d.ts +2 -0
- package/dist/src/runtime/local-host/private-access.js +16 -0
- package/dist/src/runtime/local-host/private-directory.d.ts +1 -0
- package/dist/src/runtime/local-host/private-directory.js +57 -0
- package/dist/src/runtime/local-host/rpc-peer.d.ts +22 -0
- package/dist/src/runtime/local-host/rpc-peer.js +168 -0
- package/dist/src/runtime/local-host/rpc-protocol.d.ts +21 -0
- package/dist/src/runtime/local-host/rpc-protocol.js +46 -0
- package/dist/src/runtime/local-host/startup-connection.d.ts +5 -0
- package/dist/src/runtime/local-host/startup-connection.js +72 -0
- package/dist/src/runtime/local-host/transport.d.ts +3 -0
- package/dist/src/runtime/local-host/transport.js +88 -0
- package/dist/src/runtime/local-host/windows-private-access.d.ts +1 -0
- package/dist/src/runtime/local-host/windows-private-access.js +51 -0
- package/dist/src/runtime/long-term-memory/onboarding/configuration.js +6 -0
- package/dist/src/runtime/long-term-memory/recall-binding.d.ts +3 -0
- package/dist/src/runtime/long-term-memory/recall-binding.js +27 -0
- package/dist/src/runtime/long-term-memory/recall-context.d.ts +20 -0
- package/dist/src/runtime/long-term-memory/recall-context.js +101 -0
- package/dist/src/runtime/long-term-memory/recall-continuation.d.ts +8 -0
- package/dist/src/runtime/long-term-memory/recall-continuation.js +36 -0
- package/dist/src/runtime/long-term-memory/recall-policy.d.ts +7 -0
- package/dist/src/runtime/long-term-memory/recall-policy.js +14 -0
- package/dist/src/runtime/long-term-memory/recall-result.d.ts +5 -0
- package/dist/src/runtime/long-term-memory/recall-result.js +54 -0
- package/dist/src/runtime/long-term-memory/repository-state.d.ts +2 -1
- package/dist/src/runtime/long-term-memory/repository-state.js +2 -2
- package/dist/src/runtime/model/invoke-raw-step.d.ts +1 -0
- package/dist/src/runtime/model/invoke-raw-step.js +1 -0
- package/dist/src/runtime/model/invoke-step.js +6 -0
- package/dist/src/runtime/model/invoke-structured-step.d.ts +1 -0
- package/dist/src/runtime/model/invoke-structured-step.js +1 -0
- package/dist/src/runtime/model/model-step-port.d.ts +2 -0
- package/dist/src/runtime/model/model-step-steering.d.ts +8 -0
- package/dist/src/runtime/model/model-step-steering.js +19 -0
- package/dist/src/runtime/orchestration/final-response/authoring-contract.js +1 -1
- package/dist/src/runtime/orchestration/final-response/invoke.d.ts +1 -0
- package/dist/src/runtime/orchestration/final-response/invoke.js +1 -0
- package/dist/src/runtime/orchestration/role-calls/activation-budget.js +1 -0
- package/dist/src/runtime/orchestration/role-calls/candidate-validation.js +9 -49
- package/dist/src/runtime/orchestration/role-calls/capability-selection-reconsideration.d.ts +9 -0
- package/dist/src/runtime/orchestration/role-calls/capability-selection-reconsideration.js +17 -8
- package/dist/src/runtime/orchestration/role-calls/capability-selection-supervision-validation.d.ts +2 -0
- package/dist/src/runtime/orchestration/role-calls/capability-selection-supervision-validation.js +62 -0
- package/dist/src/runtime/orchestration/role-calls/command-decoder.js +4 -0
- package/dist/src/runtime/orchestration/role-calls/command-dispatch/memory-recall-transitions.d.ts +4 -0
- package/dist/src/runtime/orchestration/role-calls/command-dispatch/memory-recall-transitions.js +89 -0
- package/dist/src/runtime/orchestration/role-calls/command-dispatch.js +5 -0
- package/dist/src/runtime/orchestration/role-calls/contracts.d.ts +9 -7
- package/dist/src/runtime/orchestration/role-calls/contracts.js +2 -2
- package/dist/src/runtime/orchestration/role-calls/diagnostics.js +3 -0
- package/dist/src/runtime/orchestration/role-calls/index.d.ts +1 -0
- package/dist/src/runtime/orchestration/role-calls/index.js +1 -0
- package/dist/src/runtime/orchestration/role-calls/memory-recall-contract.d.ts +51 -0
- package/dist/src/runtime/orchestration/role-calls/memory-recall-contract.js +4 -0
- package/dist/src/runtime/orchestration/role-calls/memory-recall-decoder.d.ts +6 -0
- package/dist/src/runtime/orchestration/role-calls/memory-recall-decoder.js +147 -0
- package/dist/src/runtime/orchestration/role-calls/memory-recall-diagnostics.d.ts +5 -0
- package/dist/src/runtime/orchestration/role-calls/memory-recall-diagnostics.js +27 -0
- package/dist/src/runtime/orchestration/role-calls/memory-recall-state-validation.d.ts +3 -0
- package/dist/src/runtime/orchestration/role-calls/memory-recall-state-validation.js +121 -0
- package/dist/src/runtime/orchestration/role-calls/memory-recall-transactions.d.ts +3 -0
- package/dist/src/runtime/orchestration/role-calls/memory-recall-transactions.js +44 -0
- package/dist/src/runtime/orchestration/role-calls/reducer.js +1 -0
- package/dist/src/runtime/orchestration/role-calls/transaction-effect.d.ts +5 -0
- package/dist/src/runtime/orchestration/role-calls/transaction-effect.js +14 -0
- package/dist/src/runtime/orchestration/role-calls/transactions.js +3 -24
- package/dist/src/runtime/plugins/manifest-validator.js +4 -1
- package/dist/src/runtime/ports.d.ts +4 -0
- package/dist/src/runtime/request/bound-runtime-handler.d.ts +2 -0
- package/dist/src/runtime/request/bound-runtime-handler.js +25 -0
- package/dist/src/runtime/request/contracts.d.ts +6 -0
- package/dist/src/runtime/request/execution-agent-root-execution.js +12 -0
- package/dist/src/runtime/request/execution-facets.js +6 -0
- package/dist/src/runtime/request/execution-scope-surfaces.js +10 -0
- package/dist/src/runtime/request/execution-scope.d.ts +1 -1
- package/dist/src/runtime/request/handler.js +6 -0
- package/dist/src/runtime/request/root-contract.d.ts +7 -1
- package/dist/src/runtime/request/root-execution-kernel.js +33 -37
- package/dist/src/runtime/request/root-memory-recall.d.ts +11 -0
- package/dist/src/runtime/request/root-memory-recall.js +71 -0
- package/dist/src/runtime/request/root-observation-handoff.d.ts +17 -0
- package/dist/src/runtime/request/root-observation-handoff.js +44 -0
- package/dist/src/runtime/request/scheduled-execution.d.ts +9 -0
- package/dist/src/runtime/request/scheduled-execution.js +32 -0
- package/dist/src/runtime/request/session-admission.d.ts +17 -0
- package/dist/src/runtime/request/session-admission.js +88 -0
- package/dist/src/runtime/request/supervisor-root-execution-diagnostics.d.ts +1 -1
- package/dist/src/runtime/request/supervisor-root-execution.js +8 -0
- package/dist/src/runtime/runtime-environment.d.ts +31 -0
- package/dist/src/runtime/runtime-environment.js +102 -0
- package/dist/src/runtime/runtime-host-environment.d.ts +8 -0
- package/dist/src/runtime/runtime-host-environment.js +57 -0
- package/dist/src/runtime/runtime-host-lifecycle.d.ts +4 -0
- package/dist/src/runtime/runtime-host-lifecycle.js +64 -0
- package/dist/src/runtime/runtime-host-scheduler-ownership.d.ts +5 -0
- package/dist/src/runtime/runtime-host-scheduler-ownership.js +67 -0
- package/dist/src/runtime/runtime-host.d.ts +19 -0
- package/dist/src/runtime/runtime-host.js +63 -0
- package/dist/src/runtime/scheduler/calendar-time.d.ts +10 -0
- package/dist/src/runtime/scheduler/calendar-time.js +58 -0
- package/dist/src/runtime/scheduler/contracts.d.ts +143 -0
- package/dist/src/runtime/scheduler/contracts.js +1 -0
- package/dist/src/runtime/scheduler/file-store.d.ts +2 -0
- package/dist/src/runtime/scheduler/file-store.js +76 -0
- package/dist/src/runtime/scheduler/instant-validation.d.ts +4 -0
- package/dist/src/runtime/scheduler/instant-validation.js +69 -0
- package/dist/src/runtime/scheduler/interval-range.d.ts +8 -0
- package/dist/src/runtime/scheduler/interval-range.js +24 -0
- package/dist/src/runtime/scheduler/job-management.d.ts +8 -0
- package/dist/src/runtime/scheduler/job-management.js +212 -0
- package/dist/src/runtime/scheduler/journal-checkpoint.d.ts +9 -0
- package/dist/src/runtime/scheduler/journal-checkpoint.js +45 -0
- package/dist/src/runtime/scheduler/journal-durability.d.ts +8 -0
- package/dist/src/runtime/scheduler/journal-durability.js +59 -0
- package/dist/src/runtime/scheduler/journal-files.d.ts +14 -0
- package/dist/src/runtime/scheduler/journal-files.js +59 -0
- package/dist/src/runtime/scheduler/journal-head.d.ts +21 -0
- package/dist/src/runtime/scheduler/journal-head.js +81 -0
- package/dist/src/runtime/scheduler/journal-index-state.d.ts +31 -0
- package/dist/src/runtime/scheduler/journal-index-state.js +137 -0
- package/dist/src/runtime/scheduler/journal-index.d.ts +22 -0
- package/dist/src/runtime/scheduler/journal-index.js +195 -0
- package/dist/src/runtime/scheduler/journal-store.d.ts +21 -0
- package/dist/src/runtime/scheduler/journal-store.js +184 -0
- package/dist/src/runtime/scheduler/journal-transaction.d.ts +14 -0
- package/dist/src/runtime/scheduler/journal-transaction.js +104 -0
- package/dist/src/runtime/scheduler/next-occurrence.d.ts +3 -0
- package/dist/src/runtime/scheduler/next-occurrence.js +39 -0
- package/dist/src/runtime/scheduler/run-completion.d.ts +12 -0
- package/dist/src/runtime/scheduler/run-completion.js +77 -0
- package/dist/src/runtime/scheduler/run-list-query.d.ts +5 -0
- package/dist/src/runtime/scheduler/run-list-query.js +38 -0
- package/dist/src/runtime/scheduler/run-records.d.ts +6 -0
- package/dist/src/runtime/scheduler/run-records.js +41 -0
- package/dist/src/runtime/scheduler/schedule-update.d.ts +3 -0
- package/dist/src/runtime/scheduler/schedule-update.js +22 -0
- package/dist/src/runtime/scheduler/schedule-validation.d.ts +10 -0
- package/dist/src/runtime/scheduler/schedule-validation.js +132 -0
- package/dist/src/runtime/scheduler/scheduler-engine.d.ts +2 -0
- package/dist/src/runtime/scheduler/scheduler-engine.js +174 -0
- package/dist/src/runtime/scheduler/scheduler-service.d.ts +10 -0
- package/dist/src/runtime/scheduler/scheduler-service.js +115 -0
- package/dist/src/runtime/scheduler/service-context.d.ts +21 -0
- package/dist/src/runtime/scheduler/service-context.js +26 -0
- package/dist/src/runtime/scheduler/session-deletion-state.d.ts +9 -0
- package/dist/src/runtime/scheduler/session-deletion-state.js +30 -0
- package/dist/src/runtime/scheduler/snapshot-validation.d.ts +4 -0
- package/dist/src/runtime/scheduler/snapshot-validation.js +112 -0
- package/dist/src/runtime/scheduler/startup-recovery.d.ts +2 -0
- package/dist/src/runtime/scheduler/startup-recovery.js +38 -0
- package/dist/src/runtime/scheduler/validation-error.d.ts +4 -0
- package/dist/src/runtime/scheduler/validation-error.js +8 -0
- package/dist/src/runtime/scheduler/working-store.d.ts +3 -0
- package/dist/src/runtime/scheduler/working-store.js +8 -0
- package/dist/src/runtime/session/request-session.d.ts +1 -0
- package/dist/src/runtime/session/request-session.js +14 -1
- package/dist/src/runtime/session/session-attachment-deletion.d.ts +8 -0
- package/dist/src/runtime/session/session-attachment-deletion.js +87 -0
- package/dist/src/runtime/session/session-deletion-boundary.d.ts +10 -0
- package/dist/src/runtime/session/session-deletion-boundary.js +39 -0
- package/dist/src/runtime/session/session-deletion-cleanup.d.ts +7 -0
- package/dist/src/runtime/session/session-deletion-cleanup.js +62 -0
- package/dist/src/runtime/session/session-deletion-finalization.d.ts +7 -0
- package/dist/src/runtime/session/session-deletion-finalization.js +34 -0
- package/dist/src/runtime/session/session-deletion-receipts.d.ts +7 -0
- package/dist/src/runtime/session/session-deletion-receipts.js +18 -0
- package/dist/src/runtime/session/session-lifecycle-store.d.ts +21 -0
- package/dist/src/runtime/session/session-lifecycle-store.js +72 -0
- package/dist/src/runtime/session/session-mutation-queue.d.ts +3 -0
- package/dist/src/runtime/session/session-mutation-queue.js +15 -0
- package/dist/src/runtime/steps/execution-agent/capability-decision-parsing.d.ts +16 -0
- package/dist/src/runtime/steps/execution-agent/capability-decision-parsing.js +165 -0
- package/dist/src/runtime/steps/execution-agent/contracts.d.ts +3 -1
- package/dist/src/runtime/steps/execution-agent/decision-parsing.d.ts +2 -0
- package/dist/src/runtime/steps/execution-agent/decision-parsing.js +195 -0
- package/dist/src/runtime/steps/execution-agent/decision-validation.d.ts +30 -0
- package/dist/src/runtime/steps/execution-agent/decision-validation.js +127 -0
- package/dist/src/runtime/steps/execution-agent/format.d.ts +1 -0
- package/dist/src/runtime/steps/execution-agent/format.js +12 -0
- package/dist/src/runtime/steps/execution-agent/input.d.ts +2 -1
- package/dist/src/runtime/steps/execution-agent/input.js +17 -2
- package/dist/src/runtime/steps/execution-agent/parser.d.ts +1 -2
- package/dist/src/runtime/steps/execution-agent/parser.js +1 -472
- package/dist/src/runtime/steps/execution-agent/prompt.d.ts +2 -0
- package/dist/src/runtime/steps/execution-agent/prompt.js +2 -0
- package/dist/src/runtime/steps/execution-agent/reconsideration-context.js +4 -3
- package/dist/src/runtime/steps/execution-agent/response-input.js +5 -4
- package/dist/src/runtime/steps/execution-agent/response-run.d.ts +3 -0
- package/dist/src/runtime/steps/execution-agent/response-run.js +7 -3
- package/dist/src/runtime/steps/execution-agent/run.d.ts +2 -0
- package/dist/src/runtime/steps/execution-agent/run.js +2 -0
- package/dist/src/runtime/steps/execution-agent/state-context.d.ts +2 -1
- package/dist/src/runtime/steps/execution-agent/state-context.js +13 -5
- package/dist/src/runtime/steps/memory-recall-decision.d.ts +30 -0
- package/dist/src/runtime/steps/memory-recall-decision.js +101 -0
- package/dist/src/runtime/steps/memory-recall-prompt.d.ts +1 -0
- package/dist/src/runtime/steps/memory-recall-prompt.js +15 -0
- package/dist/src/runtime/steps/supervisor-decision/contracts.d.ts +4 -2
- package/dist/src/runtime/steps/supervisor-decision/diagnostics.d.ts +2 -0
- package/dist/src/runtime/steps/supervisor-decision/diagnostics.js +13 -6
- package/dist/src/runtime/steps/supervisor-decision/format.d.ts +2 -0
- package/dist/src/runtime/steps/supervisor-decision/format.js +41 -2
- package/dist/src/runtime/steps/supervisor-decision/input.d.ts +5 -1
- package/dist/src/runtime/steps/supervisor-decision/input.js +25 -5
- package/dist/src/runtime/steps/supervisor-decision/memory-recall-continuation.d.ts +10 -0
- package/dist/src/runtime/steps/supervisor-decision/memory-recall-continuation.js +32 -0
- package/dist/src/runtime/steps/supervisor-decision/parser.d.ts +2 -0
- package/dist/src/runtime/steps/supervisor-decision/parser.js +36 -1
- package/dist/src/runtime/steps/supervisor-decision/prompt.d.ts +3 -0
- package/dist/src/runtime/steps/supervisor-decision/prompt.js +16 -8
- package/dist/src/runtime/steps/supervisor-decision/response-recommendation.d.ts +13 -0
- package/dist/src/runtime/steps/supervisor-decision/response-recommendation.js +32 -0
- package/dist/src/runtime/steps/supervisor-decision/resume.d.ts +2 -0
- package/dist/src/runtime/steps/supervisor-decision/resume.js +13 -0
- package/dist/src/runtime/steps/supervisor-decision/run.d.ts +3 -0
- package/dist/src/runtime/steps/supervisor-decision/run.js +19 -0
- package/dist/src/runtime/steps/supervisor-decision/working-directory.js +7 -1
- package/dist/src/runtime/steps/supervisor-response/diagnostics.d.ts +1 -0
- package/dist/src/runtime/steps/supervisor-response/diagnostics.js +1 -0
- package/dist/src/runtime/steps/supervisor-response/input.d.ts +2 -1
- package/dist/src/runtime/steps/supervisor-response/input.js +17 -4
- package/dist/src/runtime/steps/supervisor-response/memory-authoring.d.ts +1 -0
- package/dist/src/runtime/steps/supervisor-response/memory-authoring.js +4 -0
- package/dist/src/runtime/steps/supervisor-response/prompt.d.ts +1 -0
- package/dist/src/runtime/steps/supervisor-response/prompt.js +8 -2
- package/dist/src/runtime/steps/supervisor-response/response-recommendation.d.ts +10 -0
- package/dist/src/runtime/steps/supervisor-response/response-recommendation.js +25 -0
- package/dist/src/runtime/steps/supervisor-response/run.d.ts +6 -1
- package/dist/src/runtime/steps/supervisor-response/run.js +26 -7
- package/dist/src/sessions/record/projection.js +1 -0
- package/dist/src/sessions/schedule-metadata.d.ts +8 -0
- package/dist/src/sessions/schedule-metadata.js +1 -0
- package/dist/src/sessions/session-service.d.ts +1 -0
- package/dist/src/sessions/session-service.js +1 -0
- package/dist/src/sessions/types.d.ts +2 -0
- package/dist/src/shared/http-server-shutdown.d.ts +4 -0
- package/dist/src/shared/http-server-shutdown.js +17 -0
- package/dist/src/shared/public-http/aggregate-gate.d.ts +3 -0
- package/dist/src/shared/public-http/aggregate-gate.js +87 -0
- package/dist/src/shared/public-http/deadline.d.ts +2 -0
- package/dist/src/shared/public-http/deadline.js +29 -0
- package/dist/src/shared/public-http/errors.d.ts +6 -0
- package/dist/src/shared/public-http/errors.js +11 -0
- package/dist/src/shared/public-http/limits.d.ts +8 -0
- package/dist/src/shared/public-http/limits.js +8 -0
- package/dist/src/shared/public-http/network-policy.d.ts +11 -0
- package/dist/src/shared/public-http/network-policy.js +178 -0
- package/dist/src/shared/public-http/public-http.d.ts +24 -0
- package/dist/src/shared/public-http/public-http.js +85 -0
- package/dist/src/shared/public-http/request-hop.d.ts +18 -0
- package/dist/src/shared/public-http/request-hop.js +140 -0
- package/dist/src/web-ui/app/ARCHITECTURE.md +66 -4
- package/dist/src/web-ui/app/app-bootstrap.js +53 -0
- package/dist/src/web-ui/app/app-dom.js +80 -0
- package/dist/src/web-ui/app/app.js +195 -212
- package/dist/src/web-ui/app/components/conversation-activity.d.ts +2 -0
- package/dist/src/web-ui/app/components/conversation-activity.js +34 -7
- package/dist/src/web-ui/app/components/conversation-role-cards.d.ts +1 -0
- package/dist/src/web-ui/app/components/conversation-role-cards.js +61 -5
- package/dist/src/web-ui/app/components/conversation-schedule.js +71 -0
- package/dist/src/web-ui/app/components/conversation-status.js +65 -0
- package/dist/src/web-ui/app/components/conversation-tools.d.ts +13 -0
- package/dist/src/web-ui/app/components/conversation-tools.js +284 -0
- package/dist/src/web-ui/app/components/conversation-view.js +39 -11
- package/dist/src/web-ui/app/components/dashboard/activity.js +61 -0
- package/dist/src/web-ui/app/components/dashboard/icons.js +23 -0
- package/dist/src/web-ui/app/components/dashboard/recent-conversations.js +64 -0
- package/dist/src/web-ui/app/components/dashboard/workspace.js +107 -0
- package/dist/src/web-ui/app/components/message-link-previews.d.ts +16 -0
- package/dist/src/web-ui/app/components/message-link-previews.js +179 -0
- package/dist/src/web-ui/app/components/schedules/details.js +101 -0
- package/dist/src/web-ui/app/components/schedules/form.d.ts +13 -0
- package/dist/src/web-ui/app/components/schedules/form.js +246 -0
- package/dist/src/web-ui/app/components/schedules/workspace-state.js +59 -0
- package/dist/src/web-ui/app/components/schedules/workspace.js +165 -0
- package/dist/src/web-ui/app/components/workspace-shell.js +48 -2
- package/dist/src/web-ui/app/configuration-feature.js +72 -0
- package/dist/src/web-ui/app/controllers/composer-attachments-controller.d.ts +1 -0
- package/dist/src/web-ui/app/controllers/composer-attachments-controller.js +17 -6
- package/dist/src/web-ui/app/controllers/composer-submit-controller.d.ts +2 -0
- package/dist/src/web-ui/app/controllers/composer-submit-controller.js +15 -1
- package/dist/src/web-ui/app/controllers/composer-surface-controller.js +58 -0
- package/dist/src/web-ui/app/controllers/composer-workspace-controller.d.ts +53 -0
- package/dist/src/web-ui/app/controllers/composer-workspace-controller.js +180 -0
- package/dist/src/web-ui/app/controllers/conversation-read-state-controller.d.ts +23 -0
- package/dist/src/web-ui/app/controllers/conversation-read-state-controller.js +82 -0
- package/dist/src/web-ui/app/controllers/conversation-session-controller.d.ts +8 -0
- package/dist/src/web-ui/app/controllers/conversation-session-controller.js +28 -39
- package/dist/src/web-ui/app/controllers/dashboard-controller.js +127 -0
- package/dist/src/web-ui/app/controllers/home-composer-feature.d.ts +40 -0
- package/dist/src/web-ui/app/controllers/home-composer-feature.js +119 -0
- package/dist/src/web-ui/app/controllers/home-conversation-activation.js +37 -0
- package/dist/src/web-ui/app/controllers/realtime-event-controller.d.ts +1 -0
- package/dist/src/web-ui/app/controllers/realtime-event-controller.js +74 -3
- package/dist/src/web-ui/app/controllers/runtime-selection-controller.d.ts +2 -1
- package/dist/src/web-ui/app/controllers/runtime-selection-controller.js +15 -14
- package/dist/src/web-ui/app/controllers/schedule-realtime.js +118 -0
- package/dist/src/web-ui/app/controllers/schedules-controller.js +421 -0
- package/dist/src/web-ui/app/controllers/session-controller.js +30 -3
- package/dist/src/web-ui/app/dashboard-feature.js +44 -0
- package/dist/src/web-ui/app/index.html +53 -1
- package/dist/src/web-ui/app/lib/composer-submission-scope.d.ts +21 -0
- package/dist/src/web-ui/app/lib/composer-submission-scope.js +13 -0
- package/dist/src/web-ui/app/lib/context-window-snapshot-order.d.ts +15 -0
- package/dist/src/web-ui/app/lib/context-window-snapshot-order.js +31 -0
- package/dist/src/web-ui/app/lib/conversation-role-model.d.ts +10 -1
- package/dist/src/web-ui/app/lib/conversation-role-model.js +97 -15
- package/dist/src/web-ui/app/lib/conversation-status-model.d.ts +12 -0
- package/dist/src/web-ui/app/lib/conversation-status-model.js +116 -0
- package/dist/src/web-ui/app/lib/dashboard-job-templates.js +41 -0
- package/dist/src/web-ui/app/lib/dashboard-presentation.js +126 -0
- package/dist/src/web-ui/app/lib/message-markdown.d.ts +5 -0
- package/dist/src/web-ui/app/lib/message-markdown.js +99 -0
- package/dist/src/web-ui/app/lib/message-url-policy.d.ts +1 -0
- package/dist/src/web-ui/app/lib/message-url-policy.js +13 -0
- package/dist/src/web-ui/app/lib/schedule-errors.js +29 -0
- package/dist/src/web-ui/app/lib/schedule-message.js +30 -0
- package/dist/src/web-ui/app/lib/schedule-presentation.js +81 -0
- package/dist/src/web-ui/app/lib/session-read-state.d.ts +22 -0
- package/dist/src/web-ui/app/lib/session-read-state.js +63 -0
- package/dist/src/web-ui/app/lib/text-format.js +2 -143
- package/dist/src/web-ui/app/lib/tool-activity-event.d.ts +26 -0
- package/dist/src/web-ui/app/lib/tool-activity-event.js +228 -0
- package/dist/src/web-ui/app/lib/tool-activity-model.d.ts +41 -0
- package/dist/src/web-ui/app/lib/tool-activity-model.js +255 -0
- package/dist/src/web-ui/app/lib/tool-timeline.d.ts +3 -0
- package/dist/src/web-ui/app/lib/tool-timeline.js +18 -0
- package/dist/src/web-ui/app/schedules-feature.js +87 -0
- package/dist/src/web-ui/app/services/message-link-preview-client.d.ts +14 -0
- package/dist/src/web-ui/app/services/message-link-preview-client.js +96 -0
- package/dist/src/web-ui/app/services/runtime-web-client/schedules.js +51 -0
- package/dist/src/web-ui/app/services/runtime-web-client.d.ts +37 -0
- package/dist/src/web-ui/app/services/runtime-web-client.js +13 -8
- package/dist/src/web-ui/app/styles/00-tokens-base.css +11 -11
- package/dist/src/web-ui/app/styles/18-dashboard.css +384 -0
- package/dist/src/web-ui/app/styles/20-chat-composer.css +1 -130
- package/dist/src/web-ui/app/styles/26-message-content.css +295 -0
- package/dist/src/web-ui/app/styles/27-conversation-tools.css +266 -0
- package/dist/src/web-ui/app/styles/28-conversation-status.css +52 -0
- package/dist/src/web-ui/app/styles/38-schedule-workspace.css +263 -0
- package/dist/src/web-ui/app/styles/38-schedules.css +352 -0
- package/dist/src/web-ui/app/styles/90-responsive.css +14 -0
- package/dist/src/web-ui/app/styles/91-schedules-responsive.css +72 -0
- package/dist/src/web-ui/app/styles/92-dashboard-responsive.css +88 -0
- package/dist/src/web-ui/app/styles.css +8 -0
- package/dist/src/web-ui/app/ui-behavior.d.ts +1 -1
- package/dist/src/web-ui/app/ui-behavior.js +3 -1
- package/dist/src/web-ui/app/vendor/README.md +15 -0
- package/dist/src/web-ui/app/vendor/markdown-it.LICENSE +22 -0
- package/dist/src/web-ui/app/vendor/markdown-it.js +3003 -0
- package/dist/src/web-ui/link-preview/metadata.d.ts +9 -0
- package/dist/src/web-ui/link-preview/metadata.js +97 -0
- package/dist/src/web-ui/link-preview/preview-cache.d.ts +4 -0
- package/dist/src/web-ui/link-preview/preview-cache.js +23 -0
- package/dist/src/web-ui/link-preview/raster-response.d.ts +9 -0
- package/dist/src/web-ui/link-preview/raster-response.js +49 -0
- package/dist/src/web-ui/link-preview/routes.d.ts +3 -0
- package/dist/src/web-ui/link-preview/routes.js +97 -0
- package/dist/src/web-ui/link-preview/service.d.ts +11 -0
- package/dist/src/web-ui/link-preview/service.js +117 -0
- package/dist/src/web-ui/local-runtime/api-router.d.ts +4 -1
- package/dist/src/web-ui/local-runtime/api-router.js +42 -73
- package/dist/src/web-ui/local-runtime/contracts.d.ts +2 -2
- package/dist/src/web-ui/local-runtime/environment-registry.d.ts +12 -1
- package/dist/src/web-ui/local-runtime/environment-registry.js +38 -3
- package/dist/src/web-ui/local-runtime/realtime-controller.js +3 -1
- package/dist/src/web-ui/local-runtime/request-execution.d.ts +5 -1
- package/dist/src/web-ui/local-runtime/request-execution.js +38 -2
- package/dist/src/web-ui/local-runtime/schedule-job-creation.d.ts +7 -0
- package/dist/src/web-ui/local-runtime/schedule-job-creation.js +62 -0
- package/dist/src/web-ui/local-runtime/schedule-management-routes.d.ts +30 -0
- package/dist/src/web-ui/local-runtime/schedule-management-routes.js +134 -0
- package/dist/src/web-ui/local-runtime/schedule-run-page.d.ts +5 -0
- package/dist/src/web-ui/local-runtime/schedule-run-page.js +23 -0
- package/dist/src/web-ui/local-runtime/session-routes.d.ts +17 -0
- package/dist/src/web-ui/local-runtime/session-routes.js +74 -0
- package/dist/src/web-ui/local-runtime-backend.d.ts +2 -0
- package/dist/src/web-ui/local-runtime-backend.js +11 -1
- package/dist/src/web-ui/schedule-creation-contract.d.ts +7 -0
- package/dist/src/web-ui/schedule-creation-contract.js +1 -0
- package/dist/src/web-ui/server-shutdown.d.ts +4 -0
- package/dist/src/web-ui/server-shutdown.js +32 -0
- package/dist/src/web-ui/server.js +13 -10
- package/dist/src/web-ui/session-read-state/availability.d.ts +16 -0
- package/dist/src/web-ui/session-read-state/availability.js +20 -0
- package/dist/src/web-ui/session-read-state/projection.d.ts +17 -0
- package/dist/src/web-ui/session-read-state/projection.js +71 -0
- package/dist/src/web-ui/session-read-state/service.d.ts +86 -0
- package/dist/src/web-ui/session-read-state/service.js +89 -0
- package/dist/src/web-ui/session-read-state/store.d.ts +22 -0
- package/dist/src/web-ui/session-read-state/store.js +110 -0
- package/docs/configuration.md +41 -1
- package/docs/long-term-memory.md +46 -5
- package/docs/runtime-invariant-coverage.md +1 -1
- package/docs/runtime-library.md +23 -0
- package/docs/runtime-public-contracts.md +32 -1
- package/package.json +3 -1
- package/plugins/code-outline/plugin.json +15 -0
- package/plugins/document-reader/plugin.json +17 -0
- package/plugins/filesystem/plugin.json +17 -2
- package/plugins/json-inspector/plugin.json +12 -0
- package/plugins/local-search/plugin.json +12 -0
- package/plugins/memory/plugin.json +26 -1
- package/plugins/memory/source/index.ts +10 -6
- package/plugins/memory/src/index.cjs +11 -7
- package/plugins/project-orientation/plugin.json +14 -0
- package/plugins/web/source/aggregate-gate.ts +8 -130
- package/plugins/web/source/deadline.ts +14 -50
- package/plugins/web/source/errors.ts +17 -11
- package/plugins/web/source/limits.ts +3 -6
- package/plugins/web/source/network-policy.ts +28 -226
- package/plugins/web/source/public-http.ts +17 -142
- package/plugins/web/source/request-hop.ts +11 -191
- package/plugins/web/src/index.cjs +119 -59
- package/runtime.config.schema.json +7 -0
- package/src/runtime/README.md +105 -1
- package/src/runtime/local-host/README.md +86 -0
- package/src/runtime/scheduler/README.md +166 -0
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import { CAPABILITY_INTENT_MAX_LENGTH, materializeCapabilityControlsIfComplete, validateCapabilitySelectionControls, } from "../../orchestration/capability-adapters/index.js";
|
|
2
|
+
import { normalizeExecutionWorkingDirectory } from "../../orchestration/capability-adapters/working-directory.js";
|
|
3
|
+
import { executionCapabilityControlsIssue, normalizeGeneratedExecutionCapabilityControls, parseExecutionOperationObjective, requiresExecutionOperationObjective, } from "./capability-invocation-contract.js";
|
|
4
|
+
import { EXECUTION_AGENT_CAPABILITY_SCOPE_GROUP_COUNT_MAX, } from "./contracts.js";
|
|
5
|
+
import { asRecord, exactKeys, issue, validateBoundedText, } from "./decision-validation.js";
|
|
6
|
+
export function parseCapabilityCatalogGroupIds(value, offeredCatalogGroupIds, issues) {
|
|
7
|
+
if (!Array.isArray(value) ||
|
|
8
|
+
value.length === 0 ||
|
|
9
|
+
value.length > EXECUTION_AGENT_CAPABILITY_SCOPE_GROUP_COUNT_MAX ||
|
|
10
|
+
new Set(value).size !== value.length ||
|
|
11
|
+
value.some((entry) => typeof entry !== "string")) {
|
|
12
|
+
issues.push(issue("execution_agent_capability_scope_invalid", "decision.catalogGroupIds", `catalogGroupIds must contain 1-${EXECUTION_AGENT_CAPABILITY_SCOPE_GROUP_COUNT_MAX} distinct offered group ids.`));
|
|
13
|
+
return undefined;
|
|
14
|
+
}
|
|
15
|
+
const catalogGroupIds = value;
|
|
16
|
+
if (catalogGroupIds.some((groupId) => !offeredCatalogGroupIds.includes(groupId))) {
|
|
17
|
+
issues.push(issue("execution_agent_capability_scope_group_unavailable", "decision.catalogGroupIds", "Every catalogGroupId must identify one group offered for this exact scope action."));
|
|
18
|
+
return undefined;
|
|
19
|
+
}
|
|
20
|
+
return Object.freeze([...catalogGroupIds]);
|
|
21
|
+
}
|
|
22
|
+
export function parseCapabilityBatch(value, contract, issues) {
|
|
23
|
+
if (!Array.isArray(value) ||
|
|
24
|
+
value.length < 2 ||
|
|
25
|
+
contract.maxBatchCapabilityExecutions < 2 ||
|
|
26
|
+
value.length > contract.maxBatchCapabilityExecutions) {
|
|
27
|
+
issues.push(issue("execution_agent_capability_batch_invalid", "decision.invocations", `Observation batch must contain 2-${contract.maxBatchCapabilityExecutions} invocations.`));
|
|
28
|
+
return undefined;
|
|
29
|
+
}
|
|
30
|
+
const accepted = [];
|
|
31
|
+
const issueCountBeforeInvocations = issues.length;
|
|
32
|
+
value.forEach((invocation, index) => {
|
|
33
|
+
const parsed = parseCapabilityInvocation({
|
|
34
|
+
value: invocation,
|
|
35
|
+
path: `decision.invocations.${index}`,
|
|
36
|
+
capabilities: contract.capabilities,
|
|
37
|
+
observationOnly: true,
|
|
38
|
+
includesAction: false,
|
|
39
|
+
issues,
|
|
40
|
+
});
|
|
41
|
+
if (parsed.value)
|
|
42
|
+
accepted.push(parsed.value);
|
|
43
|
+
});
|
|
44
|
+
const invocationValidationFailed = accepted.length !== value.length ||
|
|
45
|
+
issues.length !== issueCountBeforeInvocations;
|
|
46
|
+
if (invocationValidationFailed)
|
|
47
|
+
return undefined;
|
|
48
|
+
return Object.freeze(accepted);
|
|
49
|
+
}
|
|
50
|
+
export function parseCapabilityInvocation(params) {
|
|
51
|
+
const record = asRecord(params.value);
|
|
52
|
+
const baseExpectedKeys = [
|
|
53
|
+
...(params.includesAction ? ["action"] : []),
|
|
54
|
+
"capabilityId",
|
|
55
|
+
"intent",
|
|
56
|
+
];
|
|
57
|
+
if (!record) {
|
|
58
|
+
params.issues.push(issue("execution_agent_capability_invocation_invalid", params.path, "Capability invocation must be an object."));
|
|
59
|
+
return { expectedKeys: baseExpectedKeys };
|
|
60
|
+
}
|
|
61
|
+
let capability;
|
|
62
|
+
if (typeof record.capabilityId !== "string") {
|
|
63
|
+
params.issues.push(issue("execution_agent_capability_id_invalid", `${params.path}.capabilityId`, "capabilityId must identify one available capability."));
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
capability = params.capabilities.find(({ capabilityId }) => capabilityId === record.capabilityId);
|
|
67
|
+
if (!capability) {
|
|
68
|
+
params.issues.push(issue("execution_agent_capability_unavailable", `${params.path}.capabilityId`, "capabilityId must identify one available capability."));
|
|
69
|
+
}
|
|
70
|
+
else if (params.observationOnly && capability.effect !== "observation") {
|
|
71
|
+
params.issues.push(issue("execution_agent_capability_batch_effect_invalid", `${params.path}.capabilityId`, "Only observation capabilities may be invoked in a batch."));
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
const expectedKeys = [
|
|
75
|
+
...baseExpectedKeys,
|
|
76
|
+
...(capability && requiresExecutionOperationObjective(capability.partition)
|
|
77
|
+
? ["operationObjective"]
|
|
78
|
+
: []),
|
|
79
|
+
...(capability?.partition.selectionControlIds.length
|
|
80
|
+
? ["selectionControls"]
|
|
81
|
+
: []),
|
|
82
|
+
];
|
|
83
|
+
if (!params.includesAction) {
|
|
84
|
+
exactKeys(record, expectedKeys, params.issues, params.path);
|
|
85
|
+
}
|
|
86
|
+
const intent = validateBoundedText({
|
|
87
|
+
value: record.intent,
|
|
88
|
+
maximumLength: CAPABILITY_INTENT_MAX_LENGTH,
|
|
89
|
+
code: "execution_agent_capability_intent_invalid",
|
|
90
|
+
path: `${params.path}.intent`,
|
|
91
|
+
label: "Capability intent",
|
|
92
|
+
issues: params.issues,
|
|
93
|
+
});
|
|
94
|
+
const operationObjective = parseExecutionOperationObjective({
|
|
95
|
+
value: record.operationObjective,
|
|
96
|
+
required: capability !== undefined &&
|
|
97
|
+
requiresExecutionOperationObjective(capability.partition),
|
|
98
|
+
path: `${params.path}.operationObjective`,
|
|
99
|
+
issues: params.issues,
|
|
100
|
+
});
|
|
101
|
+
let selectionControls;
|
|
102
|
+
let controls;
|
|
103
|
+
if (capability) {
|
|
104
|
+
const normalizedSelectionControls = capability.partition.selectionControlIds.length > 0
|
|
105
|
+
? normalizeGeneratedExecutionCapabilityControls(record.selectionControls, capability.partition.selectionSchema)
|
|
106
|
+
: {};
|
|
107
|
+
const selection = validateCapabilitySelectionControls(capability.partition, normalizedSelectionControls);
|
|
108
|
+
if (!selection.ok) {
|
|
109
|
+
params.issues.push(executionCapabilityControlsIssue({
|
|
110
|
+
issueCode: selection.issueCode,
|
|
111
|
+
controlId: selection.controlId,
|
|
112
|
+
path: selection.controlId
|
|
113
|
+
? `${params.path}.selectionControls.${selection.controlId}`
|
|
114
|
+
: `${params.path}.selectionControls`,
|
|
115
|
+
}));
|
|
116
|
+
}
|
|
117
|
+
else {
|
|
118
|
+
if (capability.partition.selectionControlIds.length > 0) {
|
|
119
|
+
selectionControls = selection.value;
|
|
120
|
+
}
|
|
121
|
+
const materialized = materializeCapabilityControlsIfComplete(capability.partition, selection.value);
|
|
122
|
+
if (materialized && !materialized.ok) {
|
|
123
|
+
params.issues.push(executionCapabilityControlsIssue({
|
|
124
|
+
issueCode: materialized.issueCode,
|
|
125
|
+
controlId: materialized.controlId,
|
|
126
|
+
path: materialized.controlId
|
|
127
|
+
? `${params.path}.selectionControls.${materialized.controlId}`
|
|
128
|
+
: `${params.path}.selectionControls`,
|
|
129
|
+
}));
|
|
130
|
+
}
|
|
131
|
+
else if (materialized?.ok) {
|
|
132
|
+
controls = materialized.value;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
if (!capability ||
|
|
137
|
+
(params.observationOnly && capability.effect !== "observation") ||
|
|
138
|
+
intent === undefined ||
|
|
139
|
+
!operationObjective.ok) {
|
|
140
|
+
return { expectedKeys };
|
|
141
|
+
}
|
|
142
|
+
return {
|
|
143
|
+
expectedKeys,
|
|
144
|
+
value: Object.freeze({
|
|
145
|
+
capabilityId: capability.capabilityId,
|
|
146
|
+
intent,
|
|
147
|
+
...(operationObjective.value
|
|
148
|
+
? { operationObjective: operationObjective.value }
|
|
149
|
+
: {}),
|
|
150
|
+
...(selectionControls ? { selectionControls } : {}),
|
|
151
|
+
...(controls ? { controls } : {}),
|
|
152
|
+
}),
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
export function parseWorkingDirectory(record, contract, issues) {
|
|
156
|
+
if (!contract.includeWorkingDirectory)
|
|
157
|
+
return undefined;
|
|
158
|
+
if (record.workingDirectory === null)
|
|
159
|
+
return ".";
|
|
160
|
+
const normalized = normalizeExecutionWorkingDirectory(record.workingDirectory);
|
|
161
|
+
if (!normalized) {
|
|
162
|
+
issues.push(issue("execution_agent_working_directory_invalid", "decision.workingDirectory", "workingDirectory must be one safe agent-root-relative directory."));
|
|
163
|
+
}
|
|
164
|
+
return normalized;
|
|
165
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { MemoryRecallDecision } from "../memory-recall-decision.js";
|
|
1
2
|
import type { RoleCapabilitySelectionProjection, RoleCapabilitySelectionReconsiderationCause } from "../../orchestration/role-calls/index.js";
|
|
2
3
|
import { type CapabilityControls, type CapabilityDescriptor } from "../../orchestration/capability-adapters/index.js";
|
|
3
4
|
export declare const EXECUTION_AGENT_DECISION_MODEL_STEP: "execution.decision";
|
|
@@ -58,7 +59,7 @@ export type ExecutionAgentInvokeAuditorDecision = Readonly<ExecutionAgentDecisio
|
|
|
58
59
|
action: "invoke_auditor";
|
|
59
60
|
criterionIds: readonly string[];
|
|
60
61
|
}>;
|
|
61
|
-
export type ExecutionAgentDecision = ExecutionAgentOpenCapabilityScopeDecision | ExecutionAgentExtendCapabilityScopeDecision | ExecutionAgentRespondDecision | ExecutionAgentBlockedDecision | ExecutionAgentInvokeCapabilityDecision | ExecutionAgentInvokeCapabilitiesDecision | ExecutionAgentInvokePlannerDecision | ExecutionAgentInvokeAuditorDecision;
|
|
62
|
+
export type ExecutionAgentDecision = MemoryRecallDecision | ExecutionAgentOpenCapabilityScopeDecision | ExecutionAgentExtendCapabilityScopeDecision | ExecutionAgentRespondDecision | ExecutionAgentBlockedDecision | ExecutionAgentInvokeCapabilityDecision | ExecutionAgentInvokeCapabilitiesDecision | ExecutionAgentInvokePlannerDecision | ExecutionAgentInvokeAuditorDecision;
|
|
62
63
|
/** Runtime-only transition emitted when controls refinement exhausts validation. */
|
|
63
64
|
export type ExecutionAgentReconsiderCapabilitySelectionDecision = Readonly<{
|
|
64
65
|
action: "reconsider_capability_selection";
|
|
@@ -94,6 +95,7 @@ export type ExecutionAgentDecisionContractOptions = Readonly<{
|
|
|
94
95
|
includeAcknowledgement?: boolean;
|
|
95
96
|
includeTitle?: boolean;
|
|
96
97
|
allowRespond?: boolean;
|
|
98
|
+
allowMemoryRecall?: boolean;
|
|
97
99
|
allowPlanner?: boolean;
|
|
98
100
|
allowAuditor?: boolean;
|
|
99
101
|
availableAuditCriterionIds?: readonly string[];
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
import { readStructuredDecisionEnvelope } from "../../model/structured-decision-envelope.js";
|
|
2
|
+
import { isMemoryRecallDecisionRecord, parseMemoryRecallDecision, } from "../memory-recall-decision.js";
|
|
3
|
+
import { EXECUTION_AGENT_ACKNOWLEDGEMENT_MAX_LENGTH, EXECUTION_AGENT_TITLE_MAX_LENGTH, EXECUTION_AGENT_AUDIT_CRITERION_COUNT_MAX, EXECUTION_AGENT_AUDIT_CRITERION_ID_MAX_LENGTH, EXECUTION_AGENT_DECISION_ACTIONS, EXECUTION_AGENT_RESPONSE_MAX_LENGTH, } from "./contracts.js";
|
|
4
|
+
import { prepareExecutionAgentDecisionContract } from "./format.js";
|
|
5
|
+
import { parseCapabilityCatalogGroupIds, parseCapabilityBatch, parseCapabilityInvocation, parseWorkingDirectory, } from "./capability-decision-parsing.js";
|
|
6
|
+
import { parsePresentation, presentationKeys, exactPresentationKeys, validateObjective, parseBoundedTextArray, validateBoundedText, readAction, exactKeys, rejectEnvelope, issue, asRecord, deepFreeze, } from "./decision-validation.js";
|
|
7
|
+
export function parseExecutionAgentDecisionOutput(text, options = {}) {
|
|
8
|
+
const contract = prepareExecutionAgentDecisionContract(options);
|
|
9
|
+
let decoded;
|
|
10
|
+
try {
|
|
11
|
+
decoded = JSON.parse(text.trim());
|
|
12
|
+
}
|
|
13
|
+
catch {
|
|
14
|
+
return rejectEnvelope([
|
|
15
|
+
issue("execution_agent_output_not_json", "decision", "Expected one JSON object."),
|
|
16
|
+
]);
|
|
17
|
+
}
|
|
18
|
+
if (!asRecord(decoded)) {
|
|
19
|
+
return rejectEnvelope([
|
|
20
|
+
issue("execution_agent_output_not_object", "decision", "Expected one JSON object."),
|
|
21
|
+
]);
|
|
22
|
+
}
|
|
23
|
+
const record = readStructuredDecisionEnvelope(decoded);
|
|
24
|
+
if (!record) {
|
|
25
|
+
return rejectEnvelope([
|
|
26
|
+
issue("execution_agent_output_envelope_invalid", "decision", "Expected exactly one decision object inside the canonical envelope."),
|
|
27
|
+
]);
|
|
28
|
+
}
|
|
29
|
+
if (isMemoryRecallDecisionRecord(record)) {
|
|
30
|
+
return parseMemoryRecallDecision(record, {
|
|
31
|
+
allowMemoryRecall: contract.allowMemoryRecall,
|
|
32
|
+
includeAcknowledgement: contract.includeAcknowledgement,
|
|
33
|
+
includeTitle: contract.includeTitle,
|
|
34
|
+
acknowledgementMaxLength: EXECUTION_AGENT_ACKNOWLEDGEMENT_MAX_LENGTH,
|
|
35
|
+
titleMaxLength: EXECUTION_AGENT_TITLE_MAX_LENGTH,
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
const issues = [];
|
|
39
|
+
const selectedAction = readAction(record.action);
|
|
40
|
+
if (!selectedAction) {
|
|
41
|
+
issues.push(issue("execution_agent_action_invalid", "decision.action", `Action must be one of: ${EXECUTION_AGENT_DECISION_ACTIONS.join(", ")}.`));
|
|
42
|
+
}
|
|
43
|
+
const presentation = parsePresentation(record, contract, issues);
|
|
44
|
+
let decision;
|
|
45
|
+
if (selectedAction === "open_capability_scope") {
|
|
46
|
+
exactKeys(record, ["action", "catalogGroupIds", ...presentationKeys(contract)], issues, "decision");
|
|
47
|
+
const catalogGroupIds = parseCapabilityCatalogGroupIds(record.catalogGroupIds, contract.capabilityCatalogGroupIds, issues);
|
|
48
|
+
if (contract.activeCapabilityCatalogGroupIds !== null ||
|
|
49
|
+
contract.capabilityCatalogGroupIds.length === 0) {
|
|
50
|
+
issues.push(issue("execution_agent_capability_scope_open_unavailable", "decision.action", "open_capability_scope is available only while the canonical capability scope is closed."));
|
|
51
|
+
}
|
|
52
|
+
if (catalogGroupIds) {
|
|
53
|
+
decision = {
|
|
54
|
+
action: "open_capability_scope",
|
|
55
|
+
catalogGroupIds,
|
|
56
|
+
...presentation,
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
else if (selectedAction === "respond") {
|
|
61
|
+
exactKeys(record, ["action", ...presentationKeys(contract)], issues, "decision");
|
|
62
|
+
if (!contract.allowRespond) {
|
|
63
|
+
issues.push(issue("execution_agent_response_not_allowed", "decision.action", "respond is not available until the canonical completion gate is open."));
|
|
64
|
+
}
|
|
65
|
+
decision = {
|
|
66
|
+
action: "respond",
|
|
67
|
+
...presentation,
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
else if (selectedAction === "blocked") {
|
|
71
|
+
exactKeys(record, ["action", "response", ...presentationKeys(contract)], issues, "decision");
|
|
72
|
+
const response = validateBoundedText({
|
|
73
|
+
value: record.response,
|
|
74
|
+
maximumLength: EXECUTION_AGENT_RESPONSE_MAX_LENGTH,
|
|
75
|
+
code: "execution_agent_response_invalid",
|
|
76
|
+
path: "decision.response",
|
|
77
|
+
label: "Response",
|
|
78
|
+
issues,
|
|
79
|
+
});
|
|
80
|
+
if (response !== undefined) {
|
|
81
|
+
decision = {
|
|
82
|
+
action: "blocked",
|
|
83
|
+
response,
|
|
84
|
+
...presentation,
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
else if (selectedAction === "invoke_capability") {
|
|
89
|
+
const invocation = parseCapabilityInvocation({
|
|
90
|
+
value: record,
|
|
91
|
+
path: "decision",
|
|
92
|
+
capabilities: contract.capabilities,
|
|
93
|
+
observationOnly: false,
|
|
94
|
+
includesAction: true,
|
|
95
|
+
issues,
|
|
96
|
+
});
|
|
97
|
+
exactPresentationKeys(record, contract, [
|
|
98
|
+
...invocation.expectedKeys,
|
|
99
|
+
...(contract.includeWorkingDirectory ? ["workingDirectory"] : []),
|
|
100
|
+
], issues);
|
|
101
|
+
const workingDirectory = parseWorkingDirectory(record, contract, issues);
|
|
102
|
+
if (invocation.value) {
|
|
103
|
+
decision = {
|
|
104
|
+
action: "invoke_capability",
|
|
105
|
+
...invocation.value,
|
|
106
|
+
...(workingDirectory ? { workingDirectory } : {}),
|
|
107
|
+
...presentation,
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
else if (selectedAction === "invoke_capabilities") {
|
|
112
|
+
exactKeys(record, [
|
|
113
|
+
"action",
|
|
114
|
+
"invocations",
|
|
115
|
+
...(contract.includeWorkingDirectory ? ["workingDirectory"] : []),
|
|
116
|
+
...presentationKeys(contract),
|
|
117
|
+
], issues, "decision");
|
|
118
|
+
const invocations = parseCapabilityBatch(record.invocations, contract, issues);
|
|
119
|
+
const workingDirectory = parseWorkingDirectory(record, contract, issues);
|
|
120
|
+
if (invocations) {
|
|
121
|
+
decision = {
|
|
122
|
+
action: "invoke_capabilities",
|
|
123
|
+
invocations,
|
|
124
|
+
...(workingDirectory ? { workingDirectory } : {}),
|
|
125
|
+
...presentation,
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
else if (selectedAction === "extend_capability_scope") {
|
|
130
|
+
exactKeys(record, ["action", "catalogGroupIds", ...presentationKeys(contract)], issues, "decision");
|
|
131
|
+
const catalogGroupIds = parseCapabilityCatalogGroupIds(record.catalogGroupIds, contract.inactiveCapabilityCatalogGroupIds, issues);
|
|
132
|
+
if (contract.activeCapabilityCatalogGroupIds === null ||
|
|
133
|
+
contract.inactiveCapabilityCatalogGroupIds.length === 0) {
|
|
134
|
+
issues.push(issue("execution_agent_capability_scope_extend_unavailable", "decision.action", "extend_capability_scope is available only while a canonical capability scope is active and at least one inactive group is offered."));
|
|
135
|
+
}
|
|
136
|
+
if (catalogGroupIds) {
|
|
137
|
+
decision = {
|
|
138
|
+
action: "extend_capability_scope",
|
|
139
|
+
catalogGroupIds,
|
|
140
|
+
...presentation,
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
else if (selectedAction === "invoke_planner") {
|
|
145
|
+
exactKeys(record, ["action", "objective", ...presentationKeys(contract)], issues, "decision");
|
|
146
|
+
if (!contract.allowPlanner) {
|
|
147
|
+
issues.push(issue("execution_agent_planner_not_allowed", "decision.action", "Planner invocation is not available for this decision."));
|
|
148
|
+
}
|
|
149
|
+
const objective = validateObjective(record.objective, issues);
|
|
150
|
+
if (objective !== undefined) {
|
|
151
|
+
decision = {
|
|
152
|
+
action: "invoke_planner",
|
|
153
|
+
objective,
|
|
154
|
+
...presentation,
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
else if (selectedAction === "invoke_auditor") {
|
|
159
|
+
exactKeys(record, ["action", "criterionIds", ...presentationKeys(contract)], issues, "decision");
|
|
160
|
+
if (!contract.allowAuditor ||
|
|
161
|
+
contract.availableAuditCriterionIds.length === 0) {
|
|
162
|
+
issues.push(issue("execution_agent_auditor_not_allowed", "decision.action", "Auditor invocation is not available for this decision."));
|
|
163
|
+
}
|
|
164
|
+
const criterionIds = parseBoundedTextArray({
|
|
165
|
+
value: record.criterionIds,
|
|
166
|
+
path: "decision.criterionIds",
|
|
167
|
+
code: "execution_agent_audit_criteria_invalid",
|
|
168
|
+
label: "Audit criterion ids",
|
|
169
|
+
itemMaximumLength: EXECUTION_AGENT_AUDIT_CRITERION_ID_MAX_LENGTH,
|
|
170
|
+
maximumItems: EXECUTION_AGENT_AUDIT_CRITERION_COUNT_MAX,
|
|
171
|
+
issues,
|
|
172
|
+
});
|
|
173
|
+
if (criterionIds?.some((criterionId) => !contract.availableAuditCriterionIds.includes(criterionId))) {
|
|
174
|
+
issues.push(issue("execution_agent_audit_criteria_unavailable", "decision.criterionIds", "criterionIds must identify unresolved semantic criteria offered by the runtime."));
|
|
175
|
+
}
|
|
176
|
+
if (criterionIds) {
|
|
177
|
+
decision = {
|
|
178
|
+
action: "invoke_auditor",
|
|
179
|
+
criterionIds,
|
|
180
|
+
...presentation,
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
if (issues.length > 0 || !decision) {
|
|
185
|
+
return {
|
|
186
|
+
ok: false,
|
|
187
|
+
stage: "domain_parser",
|
|
188
|
+
issues: Object.freeze(issues),
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
return {
|
|
192
|
+
ok: true,
|
|
193
|
+
decision: deepFreeze(structuredClone(decision)),
|
|
194
|
+
};
|
|
195
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { type ExecutionAgentDecisionAction, type ExecutionAgentDecisionParseResult, type ExecutionAgentDecisionPresentation, type ExecutionAgentDecisionValidationIssue } from "./contracts.js";
|
|
2
|
+
import type { PreparedExecutionAgentDecisionContract } from "./format.js";
|
|
3
|
+
export declare function parsePresentation(record: Record<string, unknown>, contract: PreparedExecutionAgentDecisionContract, issues: ExecutionAgentDecisionValidationIssue[]): ExecutionAgentDecisionPresentation;
|
|
4
|
+
export declare function presentationKeys(contract: PreparedExecutionAgentDecisionContract): readonly string[];
|
|
5
|
+
export declare function exactPresentationKeys(record: Record<string, unknown>, contract: PreparedExecutionAgentDecisionContract, actionKeys: readonly string[], issues: ExecutionAgentDecisionValidationIssue[]): void;
|
|
6
|
+
export declare function validateObjective(value: unknown, issues: ExecutionAgentDecisionValidationIssue[]): string | undefined;
|
|
7
|
+
export declare function parseBoundedTextArray(params: Readonly<{
|
|
8
|
+
value: unknown;
|
|
9
|
+
path: string;
|
|
10
|
+
code: string;
|
|
11
|
+
label: string;
|
|
12
|
+
itemMaximumLength: number;
|
|
13
|
+
maximumItems: number;
|
|
14
|
+
issues: ExecutionAgentDecisionValidationIssue[];
|
|
15
|
+
}>): readonly string[] | undefined;
|
|
16
|
+
export declare function validateBoundedText(params: Readonly<{
|
|
17
|
+
value: unknown;
|
|
18
|
+
minimumLength?: number;
|
|
19
|
+
maximumLength: number;
|
|
20
|
+
code: string;
|
|
21
|
+
path: string;
|
|
22
|
+
label: string;
|
|
23
|
+
issues: ExecutionAgentDecisionValidationIssue[];
|
|
24
|
+
}>): string | undefined;
|
|
25
|
+
export declare function readAction(value: unknown): ExecutionAgentDecisionAction | undefined;
|
|
26
|
+
export declare function exactKeys(record: Record<string, unknown>, expectedKeys: readonly string[], issues: ExecutionAgentDecisionValidationIssue[], path: string): void;
|
|
27
|
+
export declare function rejectEnvelope(issues: readonly ExecutionAgentDecisionValidationIssue[]): ExecutionAgentDecisionParseResult;
|
|
28
|
+
export declare function issue(code: string, path: string, message: string): ExecutionAgentDecisionValidationIssue;
|
|
29
|
+
export declare function asRecord(value: unknown): Record<string, unknown> | undefined;
|
|
30
|
+
export declare function deepFreeze<T>(value: T, seen?: WeakSet<object>): T;
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { EXECUTION_AGENT_ACKNOWLEDGEMENT_MAX_LENGTH, EXECUTION_AGENT_TITLE_MAX_LENGTH, EXECUTION_AGENT_OBJECTIVE_MAX_LENGTH, EXECUTION_AGENT_DECISION_ACTIONS, } from "./contracts.js";
|
|
2
|
+
export function parsePresentation(record, contract, issues) {
|
|
3
|
+
const acknowledgement = contract.includeAcknowledgement
|
|
4
|
+
? validateBoundedText({
|
|
5
|
+
value: record.acknowledgement,
|
|
6
|
+
minimumLength: 2,
|
|
7
|
+
maximumLength: EXECUTION_AGENT_ACKNOWLEDGEMENT_MAX_LENGTH,
|
|
8
|
+
code: "execution_agent_acknowledgement_invalid",
|
|
9
|
+
path: "decision.acknowledgement",
|
|
10
|
+
label: "Acknowledgement",
|
|
11
|
+
issues,
|
|
12
|
+
})
|
|
13
|
+
: undefined;
|
|
14
|
+
const title = contract.includeTitle
|
|
15
|
+
? validateBoundedText({
|
|
16
|
+
value: record.title,
|
|
17
|
+
minimumLength: 2,
|
|
18
|
+
maximumLength: EXECUTION_AGENT_TITLE_MAX_LENGTH,
|
|
19
|
+
code: "execution_agent_title_invalid",
|
|
20
|
+
path: "decision.title",
|
|
21
|
+
label: "Title",
|
|
22
|
+
issues,
|
|
23
|
+
})
|
|
24
|
+
: undefined;
|
|
25
|
+
return {
|
|
26
|
+
...(contract.includeAcknowledgement && acknowledgement !== undefined
|
|
27
|
+
? { acknowledgement }
|
|
28
|
+
: {}),
|
|
29
|
+
...(contract.includeTitle && title !== undefined ? { title } : {}),
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
export function presentationKeys(contract) {
|
|
33
|
+
return [
|
|
34
|
+
...(contract.includeAcknowledgement ? ["acknowledgement"] : []),
|
|
35
|
+
...(contract.includeTitle ? ["title"] : []),
|
|
36
|
+
];
|
|
37
|
+
}
|
|
38
|
+
export function exactPresentationKeys(record, contract, actionKeys, issues) {
|
|
39
|
+
exactKeys(record, [...actionKeys, ...presentationKeys(contract)], issues, "decision");
|
|
40
|
+
}
|
|
41
|
+
export function validateObjective(value, issues) {
|
|
42
|
+
return validateBoundedText({
|
|
43
|
+
value,
|
|
44
|
+
maximumLength: EXECUTION_AGENT_OBJECTIVE_MAX_LENGTH,
|
|
45
|
+
code: "execution_agent_objective_invalid",
|
|
46
|
+
path: "decision.objective",
|
|
47
|
+
label: "Objective",
|
|
48
|
+
issues,
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
export function parseBoundedTextArray(params) {
|
|
52
|
+
if (!Array.isArray(params.value) ||
|
|
53
|
+
params.value.length < 1 ||
|
|
54
|
+
params.value.length > params.maximumItems) {
|
|
55
|
+
params.issues.push(issue(params.code, params.path, `${params.label} must contain 1-${params.maximumItems} entries.`));
|
|
56
|
+
return undefined;
|
|
57
|
+
}
|
|
58
|
+
const normalized = [];
|
|
59
|
+
params.value.forEach((value, index) => {
|
|
60
|
+
const accepted = validateBoundedText({
|
|
61
|
+
value,
|
|
62
|
+
maximumLength: params.itemMaximumLength,
|
|
63
|
+
code: params.code,
|
|
64
|
+
path: `${params.path}.${index}`,
|
|
65
|
+
label: params.label,
|
|
66
|
+
issues: params.issues,
|
|
67
|
+
});
|
|
68
|
+
if (accepted !== undefined)
|
|
69
|
+
normalized.push(accepted);
|
|
70
|
+
});
|
|
71
|
+
if (new Set(normalized).size !== normalized.length) {
|
|
72
|
+
params.issues.push(issue(params.code, params.path, `${params.label} entries must be distinct.`));
|
|
73
|
+
}
|
|
74
|
+
return normalized.length === params.value.length
|
|
75
|
+
? Object.freeze(normalized)
|
|
76
|
+
: undefined;
|
|
77
|
+
}
|
|
78
|
+
export function validateBoundedText(params) {
|
|
79
|
+
const normalized = typeof params.value === "string" ? params.value.trim() : "";
|
|
80
|
+
const minimumLength = params.minimumLength ?? 1;
|
|
81
|
+
if (typeof params.value !== "string" ||
|
|
82
|
+
normalized.length < minimumLength ||
|
|
83
|
+
params.value.length > params.maximumLength) {
|
|
84
|
+
params.issues.push(issue(params.code, params.path, `${params.label} must be text of ${minimumLength}-${params.maximumLength} characters.`));
|
|
85
|
+
return undefined;
|
|
86
|
+
}
|
|
87
|
+
return normalized;
|
|
88
|
+
}
|
|
89
|
+
export function readAction(value) {
|
|
90
|
+
return typeof value === "string" &&
|
|
91
|
+
EXECUTION_AGENT_DECISION_ACTIONS.includes(value)
|
|
92
|
+
? value
|
|
93
|
+
: undefined;
|
|
94
|
+
}
|
|
95
|
+
export function exactKeys(record, expectedKeys, issues, path) {
|
|
96
|
+
const expected = new Set(expectedKeys);
|
|
97
|
+
const actual = Object.keys(record);
|
|
98
|
+
if (actual.length !== expected.size ||
|
|
99
|
+
actual.some((key) => !expected.has(key))) {
|
|
100
|
+
issues.push(issue("execution_agent_decision_shape_invalid", path, "Decision fields must exactly match the selected action."));
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
export function rejectEnvelope(issues) {
|
|
104
|
+
return {
|
|
105
|
+
ok: false,
|
|
106
|
+
stage: "json_envelope",
|
|
107
|
+
issues: Object.freeze([...issues]),
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
export function issue(code, path, message) {
|
|
111
|
+
return { code, path, message };
|
|
112
|
+
}
|
|
113
|
+
export function asRecord(value) {
|
|
114
|
+
return value !== null && typeof value === "object" && !Array.isArray(value)
|
|
115
|
+
? value
|
|
116
|
+
: undefined;
|
|
117
|
+
}
|
|
118
|
+
export function deepFreeze(value, seen = new WeakSet()) {
|
|
119
|
+
if (typeof value !== "object" || value === null || seen.has(value)) {
|
|
120
|
+
return value;
|
|
121
|
+
}
|
|
122
|
+
seen.add(value);
|
|
123
|
+
for (const child of Object.values(value)) {
|
|
124
|
+
deepFreeze(child, seen);
|
|
125
|
+
}
|
|
126
|
+
return Object.freeze(value);
|
|
127
|
+
}
|
|
@@ -16,6 +16,7 @@ export type PreparedExecutionAgentDecisionContract = Readonly<{
|
|
|
16
16
|
includeAcknowledgement: boolean;
|
|
17
17
|
includeTitle: boolean;
|
|
18
18
|
allowRespond: boolean;
|
|
19
|
+
allowMemoryRecall: boolean;
|
|
19
20
|
allowPlanner: boolean;
|
|
20
21
|
allowAuditor: boolean;
|
|
21
22
|
availableAuditCriterionIds: readonly string[];
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { createMemoryRecallDecisionSchema } from "../memory-recall-decision.js";
|
|
1
2
|
import { isToolCatalogGroupId } from "../../../capabilities/tool-types.js";
|
|
2
3
|
import { createStructuredDecisionEnvelopeSchema } from "../../model/structured-decision-envelope.js";
|
|
3
4
|
import { CAPABILITY_COUNT_MAX, CAPABILITY_INTENT_MAX_LENGTH, EXECUTION_WORKING_DIRECTORY_MAX_LENGTH, EXECUTION_WORKING_DIRECTORY_PATTERN, canOfferCapabilityBatchSelection, normalizeCapabilityDescriptor, normalizeCapabilityControlsSchema, partitionCapabilityControlsSchema, } from "../../orchestration/capability-adapters/index.js";
|
|
@@ -14,6 +15,16 @@ export function createExecutionAgentDecisionFormat(options = {}) {
|
|
|
14
15
|
selectionSchema: capability.partition.selectionSchema,
|
|
15
16
|
})));
|
|
16
17
|
const variants = [
|
|
18
|
+
...(contract.allowMemoryRecall
|
|
19
|
+
? [
|
|
20
|
+
createMemoryRecallDecisionSchema({
|
|
21
|
+
includeAcknowledgement: contract.includeAcknowledgement,
|
|
22
|
+
includeTitle: contract.includeTitle,
|
|
23
|
+
acknowledgementMaxLength: EXECUTION_AGENT_ACKNOWLEDGEMENT_MAX_LENGTH,
|
|
24
|
+
titleMaxLength: EXECUTION_AGENT_TITLE_MAX_LENGTH,
|
|
25
|
+
}),
|
|
26
|
+
]
|
|
27
|
+
: []),
|
|
17
28
|
...(contract.activeCapabilityCatalogGroupIds === null &&
|
|
18
29
|
contract.capabilityCatalogGroupIds.length > 0
|
|
19
30
|
? [
|
|
@@ -214,6 +225,7 @@ export function prepareExecutionAgentDecisionContract(options) {
|
|
|
214
225
|
includeAcknowledgement: options.includeAcknowledgement === true,
|
|
215
226
|
includeTitle: options.includeTitle === true,
|
|
216
227
|
allowRespond: options.allowRespond !== false,
|
|
228
|
+
allowMemoryRecall: options.allowMemoryRecall === true,
|
|
217
229
|
allowPlanner: options.allowPlanner === true,
|
|
218
230
|
allowAuditor: options.allowAuditor === true,
|
|
219
231
|
availableAuditCriterionIds,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ModelGatewayJsonSchemaFormat } from "../../../model-gateway/types.js";
|
|
1
|
+
import type { ChatMessage, ModelGatewayJsonSchemaFormat } from "../../../model-gateway/types.js";
|
|
2
2
|
import type { RequestContextProjection } from "../../context/request-context-contracts.js";
|
|
3
3
|
import type { RoleCallFrame, RoleCallLedgerHead } from "../../orchestration/role-calls/index.js";
|
|
4
4
|
import { type CapabilityCatalogGroup, type CapabilityDescriptor } from "../../orchestration/capability-adapters/index.js";
|
|
@@ -24,6 +24,7 @@ type BuildExecutionAgentInputOptions = Readonly<{
|
|
|
24
24
|
includeTitle: boolean;
|
|
25
25
|
allowPlanner: boolean;
|
|
26
26
|
allowAuditor: boolean;
|
|
27
|
+
memoryRecallMessage?: ChatMessage;
|
|
27
28
|
}>;
|
|
28
29
|
export declare function buildExecutionAgentInput(request: RequestExecutionScope, options: BuildExecutionAgentInputOptions): ExecutionAgentInput;
|
|
29
30
|
export {};
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { projectRequestContext } from "../../context/request-context.js";
|
|
2
2
|
import { projectRootSessionMemory } from "../../context/session-memory/root-projection.js";
|
|
3
|
+
import { canOfferMemoryRecall } from "../../long-term-memory/recall-policy.js";
|
|
4
|
+
import { projectMemoryRecallContinuations } from "../../long-term-memory/recall-continuation.js";
|
|
3
5
|
import { buildRequestTemporalContextMessage } from "../../context/request-temporal-context.js";
|
|
6
|
+
import { projectScheduledExecutionContext } from "../../context/scheduled-execution-context.js";
|
|
4
7
|
import { buildImmediateOperationSupervisionEvidenceMessage } from "../../context/operation-supervision-evidence.js";
|
|
5
8
|
import { resolveModelContextBudget } from "../../model/model-context-budget.js";
|
|
6
9
|
import { CAPABILITY_COUNT_MAX, projectCapabilityCatalogGroups, projectCapabilityScope, } from "../../orchestration/capability-adapters/index.js";
|
|
@@ -46,7 +49,15 @@ export function buildExecutionAgentInput(request, options) {
|
|
|
46
49
|
const availableAuditCriterionIds = options.allowAuditor && hasCurrentEvidence
|
|
47
50
|
? Object.freeze([EXECUTION_AGENT_ROOT_AUDIT_CRITERION_ID])
|
|
48
51
|
: Object.freeze([]);
|
|
52
|
+
const memoryRecallMessage = request.longTermMemory?.enabled
|
|
53
|
+
? options.memoryRecallMessage
|
|
54
|
+
: undefined;
|
|
49
55
|
const contract = Object.freeze({
|
|
56
|
+
allowMemoryRecall: canOfferMemoryRecall({
|
|
57
|
+
enabled: request.longTermMemory?.enabled === true,
|
|
58
|
+
recallCount: options.head.state.memoryRecalls.length,
|
|
59
|
+
maxRecallCallsPerRequest: request.memoryRecallLimit,
|
|
60
|
+
}),
|
|
50
61
|
capabilities,
|
|
51
62
|
capabilityCatalogGroupIds: knownGroupIds,
|
|
52
63
|
activeCapabilityCatalogGroupIds,
|
|
@@ -61,6 +72,8 @@ export function buildExecutionAgentInput(request, options) {
|
|
|
61
72
|
});
|
|
62
73
|
const format = createExecutionAgentDecisionFormat(contract);
|
|
63
74
|
const instructions = buildExecutionAgentInstructions({
|
|
75
|
+
allowMemoryRecall: contract.allowMemoryRecall,
|
|
76
|
+
hasMemoryRecallContext: memoryRecallMessage !== undefined,
|
|
64
77
|
hasCapabilities: capabilities.length > 0,
|
|
65
78
|
hasCapabilityCatalogGroups: capabilityCatalogGroups.length > 0,
|
|
66
79
|
capabilityScopeAction,
|
|
@@ -71,6 +84,7 @@ export function buildExecutionAgentInput(request, options) {
|
|
|
71
84
|
includeTitle: options.includeTitle,
|
|
72
85
|
includeWorkingDirectory: options.call.workingDirectory === undefined,
|
|
73
86
|
});
|
|
87
|
+
const scheduledExecution = projectScheduledExecutionContext(request, instructions, "decision");
|
|
74
88
|
const budget = resolveModelContextBudget({
|
|
75
89
|
runnerConfig: request.runnerConfig,
|
|
76
90
|
agentMode: request.agentMode,
|
|
@@ -82,6 +96,7 @@ export function buildExecutionAgentInput(request, options) {
|
|
|
82
96
|
});
|
|
83
97
|
const operationSupervisionEvidenceMessage = buildImmediateOperationSupervisionEvidenceMessage(options.head, options.call);
|
|
84
98
|
const referenceMessages = [
|
|
99
|
+
...scheduledExecution.referenceMessages,
|
|
85
100
|
...(request.temporalContext
|
|
86
101
|
? [buildRequestTemporalContextMessage(request.temporalContext)]
|
|
87
102
|
: []),
|
|
@@ -94,10 +109,10 @@ export function buildExecutionAgentInput(request, options) {
|
|
|
94
109
|
? [buildExecutionCapabilityCatalogMessage(capabilities)]
|
|
95
110
|
: []),
|
|
96
111
|
];
|
|
97
|
-
const continuationMessages = buildExecutionContinuationMessages(options.head, options.call);
|
|
112
|
+
const continuationMessages = buildExecutionContinuationMessages(options.head, options.call, projectMemoryRecallContinuations(memoryRecallMessage));
|
|
98
113
|
const sessionMemory = projectRootSessionMemory(request);
|
|
99
114
|
const context = projectRequestContext({
|
|
100
|
-
instructions,
|
|
115
|
+
instructions: scheduledExecution.instructions,
|
|
101
116
|
format,
|
|
102
117
|
...sessionMemory,
|
|
103
118
|
prompt: request.prompt,
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export declare function parseExecutionAgentDecisionOutput(text: string, options?: ExecutionAgentDecisionContractOptions): ExecutionAgentDecisionParseResult;
|
|
1
|
+
export { parseExecutionAgentDecisionOutput } from "./decision-parsing.js";
|