@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
|
@@ -124,7 +124,7 @@ export function buildExecutionCapabilityCatalogMessage(capabilities) {
|
|
|
124
124
|
* interpretation. Each batch becomes one assistant call group followed by its
|
|
125
125
|
* linked tool results in ledger order.
|
|
126
126
|
*/
|
|
127
|
-
export function buildExecutionContinuationMessages(head, call = requireActiveRootCall(head)) {
|
|
127
|
+
export function buildExecutionContinuationMessages(head, call = requireActiveRootCall(head), memoryRecalls = []) {
|
|
128
128
|
assertExecutionRoot(head, call);
|
|
129
129
|
const executions = head.state.capabilityExecutions.filter((execution) => execution.callId === call.callId);
|
|
130
130
|
if (executions.some((execution) => execution.status !== "settled")) {
|
|
@@ -140,10 +140,18 @@ export function buildExecutionContinuationMessages(head, call = requireActiveRoo
|
|
|
140
140
|
groups.push([execution]);
|
|
141
141
|
}
|
|
142
142
|
}
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
143
|
+
const continuations = [
|
|
144
|
+
...groups.map((group) => ({
|
|
145
|
+
invocationAttempt: group[0].invocationAttempt,
|
|
146
|
+
messages: [
|
|
147
|
+
buildAcceptedActionMessage(group),
|
|
148
|
+
...group.map((execution) => buildCapabilityResultMessage(execution)),
|
|
149
|
+
],
|
|
150
|
+
})),
|
|
151
|
+
...memoryRecalls,
|
|
152
|
+
];
|
|
153
|
+
continuations.sort((left, right) => left.invocationAttempt - right.invocationAttempt);
|
|
154
|
+
return Object.freeze(continuations.flatMap(({ messages }) => messages));
|
|
147
155
|
}
|
|
148
156
|
function buildAcceptedActionMessage(executions) {
|
|
149
157
|
const invocationAttempt = executions[0].invocationAttempt;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export type MemoryRecallDecision = Readonly<{
|
|
2
|
+
action: "recall_memory";
|
|
3
|
+
query: string;
|
|
4
|
+
acknowledgement?: string;
|
|
5
|
+
title?: string;
|
|
6
|
+
}>;
|
|
7
|
+
type MemoryRecallPresentationContract = Readonly<{
|
|
8
|
+
includeAcknowledgement?: boolean;
|
|
9
|
+
includeTitle?: boolean;
|
|
10
|
+
acknowledgementMaxLength: number;
|
|
11
|
+
titleMaxLength: number;
|
|
12
|
+
}>;
|
|
13
|
+
type MemoryRecallValidationIssue = Readonly<{
|
|
14
|
+
code: string;
|
|
15
|
+
path: string;
|
|
16
|
+
message: string;
|
|
17
|
+
}>;
|
|
18
|
+
export declare function createMemoryRecallDecisionSchema(presentation: MemoryRecallPresentationContract): Record<string, unknown>;
|
|
19
|
+
export declare function isMemoryRecallDecisionRecord(record: Readonly<Record<string, unknown>>): boolean;
|
|
20
|
+
export declare function parseMemoryRecallDecision(record: Readonly<Record<string, unknown>>, options: MemoryRecallPresentationContract & Readonly<{
|
|
21
|
+
allowMemoryRecall?: boolean;
|
|
22
|
+
}>): Readonly<{
|
|
23
|
+
ok: true;
|
|
24
|
+
decision: MemoryRecallDecision;
|
|
25
|
+
}> | Readonly<{
|
|
26
|
+
ok: false;
|
|
27
|
+
stage: "domain_parser";
|
|
28
|
+
issues: readonly MemoryRecallValidationIssue[];
|
|
29
|
+
}>;
|
|
30
|
+
export { buildMemoryRecallDecisionInstructions } from "./memory-recall-prompt.js";
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { ROLE_MEMORY_RECALL_QUERY_MAX_LENGTH } from "../orchestration/role-calls/memory-recall-contract.js";
|
|
2
|
+
export function createMemoryRecallDecisionSchema(presentation) {
|
|
3
|
+
const properties = {
|
|
4
|
+
action: { type: "string", enum: ["recall_memory"] },
|
|
5
|
+
query: {
|
|
6
|
+
type: "string",
|
|
7
|
+
minLength: 1,
|
|
8
|
+
maxLength: ROLE_MEMORY_RECALL_QUERY_MAX_LENGTH,
|
|
9
|
+
},
|
|
10
|
+
...(presentation.includeAcknowledgement
|
|
11
|
+
? {
|
|
12
|
+
acknowledgement: presentationTextSchema(presentation.acknowledgementMaxLength),
|
|
13
|
+
}
|
|
14
|
+
: {}),
|
|
15
|
+
...(presentation.includeTitle
|
|
16
|
+
? { title: presentationTextSchema(presentation.titleMaxLength) }
|
|
17
|
+
: {}),
|
|
18
|
+
};
|
|
19
|
+
return {
|
|
20
|
+
type: "object",
|
|
21
|
+
properties,
|
|
22
|
+
required: Object.keys(properties),
|
|
23
|
+
additionalProperties: false,
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
export function isMemoryRecallDecisionRecord(record) {
|
|
27
|
+
return record.action === "recall_memory";
|
|
28
|
+
}
|
|
29
|
+
export function parseMemoryRecallDecision(record, options) {
|
|
30
|
+
const issues = [];
|
|
31
|
+
if (!options.allowMemoryRecall) {
|
|
32
|
+
issues.push({
|
|
33
|
+
code: "memory_recall_unavailable",
|
|
34
|
+
path: "decision.action",
|
|
35
|
+
message: "recall_memory is not available for this decision.",
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
const expectedKeys = [
|
|
39
|
+
"action",
|
|
40
|
+
"query",
|
|
41
|
+
...(options.includeAcknowledgement ? ["acknowledgement"] : []),
|
|
42
|
+
...(options.includeTitle ? ["title"] : []),
|
|
43
|
+
];
|
|
44
|
+
if (!hasExactRecallDecisionKeys(record, expectedKeys)) {
|
|
45
|
+
issues.push({
|
|
46
|
+
code: "memory_recall_shape_invalid",
|
|
47
|
+
path: "decision",
|
|
48
|
+
message: "Decision fields must exactly match the offered recall_memory action.",
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
const query = readRecallText(record.query, "query", 1, ROLE_MEMORY_RECALL_QUERY_MAX_LENGTH, issues);
|
|
52
|
+
const acknowledgement = options.includeAcknowledgement
|
|
53
|
+
? readRecallText(record.acknowledgement, "acknowledgement", 2, options.acknowledgementMaxLength, issues)
|
|
54
|
+
: undefined;
|
|
55
|
+
const title = options.includeTitle
|
|
56
|
+
? readRecallText(record.title, "title", 2, options.titleMaxLength, issues)
|
|
57
|
+
: undefined;
|
|
58
|
+
if (issues.length > 0 || query === undefined) {
|
|
59
|
+
return Object.freeze({
|
|
60
|
+
ok: false,
|
|
61
|
+
stage: "domain_parser",
|
|
62
|
+
issues: Object.freeze(issues),
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
return Object.freeze({
|
|
66
|
+
ok: true,
|
|
67
|
+
decision: Object.freeze({
|
|
68
|
+
action: "recall_memory",
|
|
69
|
+
query,
|
|
70
|
+
...(acknowledgement !== undefined ? { acknowledgement } : {}),
|
|
71
|
+
...(title !== undefined ? { title } : {}),
|
|
72
|
+
}),
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
export { buildMemoryRecallDecisionInstructions } from "./memory-recall-prompt.js";
|
|
76
|
+
function presentationTextSchema(maxLength) {
|
|
77
|
+
return { type: "string", minLength: 2, maxLength };
|
|
78
|
+
}
|
|
79
|
+
function hasExactRecallDecisionKeys(record, expectedKeys) {
|
|
80
|
+
const actualKeys = Object.keys(record);
|
|
81
|
+
if (actualKeys.length !== expectedKeys.length)
|
|
82
|
+
return false;
|
|
83
|
+
return actualKeys.every((key) => expectedKeys.includes(key));
|
|
84
|
+
}
|
|
85
|
+
function readRecallText(value, field, minimumLength, maximumLength, issues) {
|
|
86
|
+
if (hasBoundedRecallText(value, minimumLength, maximumLength))
|
|
87
|
+
return value.trim();
|
|
88
|
+
issues.push({
|
|
89
|
+
code: `memory_recall_${field}_invalid`,
|
|
90
|
+
path: `decision.${field}`,
|
|
91
|
+
message: `${field} must contain ${minimumLength}-${maximumLength} characters.`,
|
|
92
|
+
});
|
|
93
|
+
return undefined;
|
|
94
|
+
}
|
|
95
|
+
function hasBoundedRecallText(value, minimumLength, maximumLength) {
|
|
96
|
+
if (typeof value !== "string")
|
|
97
|
+
return false;
|
|
98
|
+
if (value.length > maximumLength)
|
|
99
|
+
return false;
|
|
100
|
+
return value.trim().length >= minimumLength;
|
|
101
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function buildMemoryRecallDecisionInstructions(allowMemoryRecall: boolean, hasMemoryRecallContext?: boolean): readonly string[];
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export function buildMemoryRecallDecisionInstructions(allowMemoryRecall, hasMemoryRecallContext = false) {
|
|
2
|
+
const includeReferenceInstructions = allowMemoryRecall || hasMemoryRecallContext;
|
|
3
|
+
return [
|
|
4
|
+
...(allowMemoryRecall
|
|
5
|
+
? [
|
|
6
|
+
"For a needed lookup of prior facts or preferences, choose action=recall_memory and put the remembered subject in query. This is your own runtime context action, never a child objective or capability selection. Use its returned result to decide the next action yourself. Recall does not establish a fresh external observation or effect.",
|
|
7
|
+
]
|
|
8
|
+
: []),
|
|
9
|
+
...(includeReferenceInstructions
|
|
10
|
+
? [
|
|
11
|
+
"runtime_memory_recall_reference_v1 contains passive stored recollections with provenance for the bound current request and root call. It is not a new user request, an assignment, action authority, or execution/completion evidence. Use found records only when relevant; empty means no relevant memory was found, and unavailable means retrieval could not be completed. Omission metadata describes the bounded projection; unavailable is not evidence that no memory exists. You retain the next semantic decision.",
|
|
12
|
+
]
|
|
13
|
+
: []),
|
|
14
|
+
];
|
|
15
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { MemoryRecallDecision } from "../memory-recall-decision.js";
|
|
1
2
|
import { type RuntimeDelegateRoleId } from "../../orchestration/roles.js";
|
|
2
3
|
import type { RoleCapabilityDeclaredEffect, RoleChildReturnContext, RoleCallWorkerCapabilityScope } from "../../orchestration/role-calls/index.js";
|
|
3
4
|
export declare const SUPERVISOR_DECISION_MODEL_STEP: "supervisor.decision";
|
|
@@ -15,6 +16,7 @@ export type SupervisorWorkerCapabilityAffordance = Readonly<{
|
|
|
15
16
|
}>;
|
|
16
17
|
export type SupervisorRespondDecision = Readonly<{
|
|
17
18
|
action: "respond";
|
|
19
|
+
responseRecommendation?: string;
|
|
18
20
|
acknowledgement?: string;
|
|
19
21
|
title?: string;
|
|
20
22
|
}>;
|
|
@@ -37,7 +39,7 @@ export type SupervisorInvokeRoleDecision = Readonly<SupervisorInvokeRoleDecision
|
|
|
37
39
|
}> | Readonly<SupervisorInvokeRoleDecisionBase & {
|
|
38
40
|
roleId: Exclude<SupervisorDelegateRoleId, "planner" | "worker">;
|
|
39
41
|
}>;
|
|
40
|
-
export type SupervisorDecision = SupervisorRespondDecision | SupervisorInvokeRoleDecision;
|
|
42
|
+
export type SupervisorDecision = MemoryRecallDecision | SupervisorRespondDecision | SupervisorInvokeRoleDecision;
|
|
41
43
|
export type SupervisorDecisionOutcome = Readonly<{
|
|
42
44
|
decision: SupervisorDecision;
|
|
43
45
|
steeringVersion: number;
|
|
@@ -52,7 +54,7 @@ export type SupervisorRoutingInvokeRoleDecision = Readonly<SupervisorInvokeRoleD
|
|
|
52
54
|
}> | Readonly<SupervisorInvokeRoleDecisionMetadata & {
|
|
53
55
|
roleId: "reviewer";
|
|
54
56
|
}>;
|
|
55
|
-
export type SupervisorRoutingDecision = SupervisorRespondDecision | SupervisorRoutingInvokeRoleDecision;
|
|
57
|
+
export type SupervisorRoutingDecision = MemoryRecallDecision | SupervisorRespondDecision | SupervisorRoutingInvokeRoleDecision;
|
|
56
58
|
export type SupervisorWorkingDirectoryRoutingDecision = Extract<SupervisorRoutingInvokeRoleDecision, Readonly<{
|
|
57
59
|
roleId: "planner" | "worker";
|
|
58
60
|
}>>;
|
|
@@ -15,6 +15,7 @@ export declare function traceSupervisorContextProjected(params: {
|
|
|
15
15
|
completedChildResultCount: number;
|
|
16
16
|
completedChildSummaryLength: number;
|
|
17
17
|
allowedRoleIds: readonly SupervisorDelegateRoleId[];
|
|
18
|
+
allowMemoryRecall: boolean;
|
|
18
19
|
workerCapabilityAffordances: readonly SupervisorWorkerCapabilityAffordance[];
|
|
19
20
|
availableWorkerCapabilityCatalog: readonly WorkerCapabilityCatalogGroup[];
|
|
20
21
|
capabilityBrief: CapabilityBriefProjection;
|
|
@@ -60,6 +61,7 @@ export declare function traceSupervisorModelStarted(params: {
|
|
|
60
61
|
includeAcknowledgement: boolean;
|
|
61
62
|
includeTitle: boolean;
|
|
62
63
|
allowedRoleIds: readonly SupervisorDelegateRoleId[];
|
|
64
|
+
allowMemoryRecall: boolean;
|
|
63
65
|
availableWorkerCapabilityCatalog: readonly WorkerCapabilityCatalogGroup[];
|
|
64
66
|
}): void;
|
|
65
67
|
export declare function traceSupervisorModelCompleted(params: {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { traceDebug } from "../../observability/debug-logger.js";
|
|
2
|
+
import { supervisorResponseRecommendationLength } from "./response-recommendation.js";
|
|
2
3
|
import { SUPERVISOR_DECISION_ACTIONS, SUPERVISOR_ROLE_ID, } from "./contracts.js";
|
|
3
4
|
const SUPERVISOR_LOG_SCOPE = "runtime.supervisor";
|
|
4
5
|
export function traceSupervisorContextProjected(params) {
|
|
@@ -41,9 +42,7 @@ export function traceSupervisorContextProjected(params) {
|
|
|
41
42
|
configuredInstructionContentHashes: params.configuredInstructionContentHashes,
|
|
42
43
|
estimatedInputTokens: params.context.budget.estimatedInputTokens,
|
|
43
44
|
availableInputTokens: params.context.budget.availableInputTokens,
|
|
44
|
-
allowedActions: params
|
|
45
|
-
? [...SUPERVISOR_DECISION_ACTIONS]
|
|
46
|
-
: ["respond"],
|
|
45
|
+
allowedActions: projectSupervisorAllowedActions(params),
|
|
47
46
|
allowedRoleIds: [...params.allowedRoleIds],
|
|
48
47
|
});
|
|
49
48
|
}
|
|
@@ -99,6 +98,7 @@ export function traceSupervisorDecisionAccepted(params) {
|
|
|
99
98
|
...baseFields(params.diagnostic),
|
|
100
99
|
validationStage: "domain_parser",
|
|
101
100
|
selectedAction: params.decision.action,
|
|
101
|
+
responseRecommendationLength: supervisorResponseRecommendationLength(params.decision),
|
|
102
102
|
...workingDirectoryDiagnosticFields(params.decision),
|
|
103
103
|
...(params.decision.title
|
|
104
104
|
? { titleLength: params.decision.title.length }
|
|
@@ -148,9 +148,7 @@ export function traceSupervisorModelStarted(params) {
|
|
|
148
148
|
messageCharacterCount: params.messageCharacterCount,
|
|
149
149
|
includeAcknowledgement: params.includeAcknowledgement,
|
|
150
150
|
includeTitle: params.includeTitle,
|
|
151
|
-
allowedActions: params
|
|
152
|
-
? [...SUPERVISOR_DECISION_ACTIONS]
|
|
153
|
-
: ["respond"],
|
|
151
|
+
allowedActions: projectSupervisorAllowedActions(params),
|
|
154
152
|
allowedRoleIds: [...params.allowedRoleIds],
|
|
155
153
|
availableWorkerCapabilityCatalogGroupCount: params.availableWorkerCapabilityCatalog.length,
|
|
156
154
|
availableWorkerCapabilityCatalogGroupIds: params.availableWorkerCapabilityCatalog.map((group) => group.groupId),
|
|
@@ -281,3 +279,12 @@ function workingDirectoryDiagnosticFields(decision) {
|
|
|
281
279
|
workingDirectoryLength: workingDirectory?.length ?? 0,
|
|
282
280
|
};
|
|
283
281
|
}
|
|
282
|
+
function projectSupervisorAllowedActions(params) {
|
|
283
|
+
const canInvokeRole = params.allowedRoleIds.length > 0;
|
|
284
|
+
const actions = canInvokeRole
|
|
285
|
+
? [...SUPERVISOR_DECISION_ACTIONS]
|
|
286
|
+
: ["respond"];
|
|
287
|
+
if (params.allowMemoryRecall)
|
|
288
|
+
actions.push("recall_memory");
|
|
289
|
+
return actions;
|
|
290
|
+
}
|
|
@@ -4,6 +4,8 @@ import { type SupervisorDelegateRoleId } from "./contracts.js";
|
|
|
4
4
|
export declare function createSupervisorDecisionFormat(params?: Readonly<{
|
|
5
5
|
includeAcknowledgement?: boolean;
|
|
6
6
|
includeTitle?: boolean;
|
|
7
|
+
includeResponseRecommendation?: boolean;
|
|
8
|
+
allowMemoryRecall?: boolean;
|
|
7
9
|
allowedRoleIds?: readonly SupervisorDelegateRoleId[];
|
|
8
10
|
availableWorkerCapabilityCatalog?: readonly WorkerCapabilityCatalogGroup[];
|
|
9
11
|
}>): ModelGatewayJsonSchemaFormat;
|
|
@@ -1,10 +1,13 @@
|
|
|
1
|
+
import { createMemoryRecallDecisionSchema } from "../memory-recall-decision.js";
|
|
1
2
|
import { createStructuredDecisionEnvelopeSchema, structuredDecisionVariantSchemaPath, } from "../../model/structured-decision-envelope.js";
|
|
3
|
+
import { SUPERVISOR_RESPONSE_RECOMMENDATION_MAX_LENGTH } from "./response-recommendation.js";
|
|
2
4
|
import { createWorkerCapabilityScopeDecisionContract } from "../worker-capability-scope-decision.js";
|
|
3
5
|
import { SUPERVISOR_ACKNOWLEDGEMENT_MAX_LENGTH, SUPERVISOR_DELEGATE_ROLE_IDS, SUPERVISOR_OBJECTIVE_MAX_LENGTH, SUPERVISOR_TITLE_MAX_LENGTH, } from "./contracts.js";
|
|
4
6
|
export function createSupervisorDecisionFormat(params = {}) {
|
|
5
7
|
const allowedRoleIds = uniqueRoleIds(params.allowedRoleIds ?? SUPERVISOR_DELEGATE_ROLE_IDS);
|
|
6
8
|
const includeAcknowledgement = params.includeAcknowledgement === true;
|
|
7
9
|
const includeTitle = params.includeTitle === true;
|
|
10
|
+
const includeResponseRecommendation = params.includeResponseRecommendation === true;
|
|
8
11
|
const availableWorkerCapabilityCatalog = params.availableWorkerCapabilityCatalog ?? [];
|
|
9
12
|
const workerCapabilityScopeContract = createWorkerCapabilityScopeDecisionContract(availableWorkerCapabilityCatalog);
|
|
10
13
|
const workerAvailable = allowedRoleIds.includes("worker");
|
|
@@ -33,8 +36,18 @@ export function createSupervisorDecisionFormat(params = {}) {
|
|
|
33
36
|
: []),
|
|
34
37
|
];
|
|
35
38
|
const variants = [
|
|
36
|
-
respondSchema(includeAcknowledgement, includeTitle),
|
|
39
|
+
respondSchema(includeAcknowledgement, includeTitle, includeResponseRecommendation),
|
|
37
40
|
...invokeVariants,
|
|
41
|
+
...(params.allowMemoryRecall
|
|
42
|
+
? [
|
|
43
|
+
createMemoryRecallDecisionSchema({
|
|
44
|
+
includeAcknowledgement,
|
|
45
|
+
includeTitle,
|
|
46
|
+
acknowledgementMaxLength: SUPERVISOR_ACKNOWLEDGEMENT_MAX_LENGTH,
|
|
47
|
+
titleMaxLength: SUPERVISOR_TITLE_MAX_LENGTH,
|
|
48
|
+
}),
|
|
49
|
+
]
|
|
50
|
+
: []),
|
|
38
51
|
];
|
|
39
52
|
return {
|
|
40
53
|
type: "json_schema",
|
|
@@ -43,16 +56,23 @@ export function createSupervisorDecisionFormat(params = {}) {
|
|
|
43
56
|
postValidatedSchemaConstraints: createPostValidatedConstraints({
|
|
44
57
|
includeAcknowledgement,
|
|
45
58
|
includeTitle,
|
|
59
|
+
includeResponseRecommendation,
|
|
46
60
|
variantCount: variants.length,
|
|
47
61
|
invokeVariantCount: invokeVariants.length,
|
|
48
62
|
objectiveInvokeVariantCount: objectiveInvokeVariants.length,
|
|
63
|
+
allowMemoryRecall: params.allowMemoryRecall === true,
|
|
49
64
|
}),
|
|
50
65
|
schema: createStructuredDecisionEnvelopeSchema(variants),
|
|
51
66
|
};
|
|
52
67
|
}
|
|
53
|
-
function respondSchema(includeAcknowledgement, includeTitle) {
|
|
68
|
+
function respondSchema(includeAcknowledgement, includeTitle, includeResponseRecommendation) {
|
|
54
69
|
return exactObject({
|
|
55
70
|
action: literal("respond"),
|
|
71
|
+
...(includeResponseRecommendation
|
|
72
|
+
? {
|
|
73
|
+
responseRecommendation: boundedText(SUPERVISOR_RESPONSE_RECOMMENDATION_MAX_LENGTH),
|
|
74
|
+
}
|
|
75
|
+
: {}),
|
|
56
76
|
...(includeAcknowledgement
|
|
57
77
|
? {
|
|
58
78
|
acknowledgement: boundedText(SUPERVISOR_ACKNOWLEDGEMENT_MAX_LENGTH, 2),
|
|
@@ -63,6 +83,7 @@ function respondSchema(includeAcknowledgement, includeTitle) {
|
|
|
63
83
|
: {}),
|
|
64
84
|
}, [
|
|
65
85
|
"action",
|
|
86
|
+
...(includeResponseRecommendation ? ["responseRecommendation"] : []),
|
|
66
87
|
...(includeAcknowledgement ? ["acknowledgement"] : []),
|
|
67
88
|
...(includeTitle ? ["title"] : []),
|
|
68
89
|
]);
|
|
@@ -100,6 +121,24 @@ function invokeRoleSchema(includeAcknowledgement, includeTitle, allowedRoleIds,
|
|
|
100
121
|
function createPostValidatedConstraints(params) {
|
|
101
122
|
const base = (index) => structuredDecisionVariantSchemaPath(index, params.variantCount);
|
|
102
123
|
return [
|
|
124
|
+
...(params.allowMemoryRecall
|
|
125
|
+
? [
|
|
126
|
+
"query",
|
|
127
|
+
...(params.includeAcknowledgement ? ["acknowledgement"] : []),
|
|
128
|
+
...(params.includeTitle ? ["title"] : []),
|
|
129
|
+
].map((field) => ({
|
|
130
|
+
keyword: "maxLength",
|
|
131
|
+
path: `${base(params.variantCount - 1)}/properties/${field}/maxLength`,
|
|
132
|
+
}))
|
|
133
|
+
: []),
|
|
134
|
+
...(params.includeResponseRecommendation
|
|
135
|
+
? [
|
|
136
|
+
{
|
|
137
|
+
keyword: "maxLength",
|
|
138
|
+
path: `${base(0)}/properties/responseRecommendation/maxLength`,
|
|
139
|
+
},
|
|
140
|
+
]
|
|
141
|
+
: []),
|
|
103
142
|
...(params.includeAcknowledgement
|
|
104
143
|
? [
|
|
105
144
|
{
|
|
@@ -5,11 +5,13 @@ import { type RequestToolResultsView } from "../../context/request-tool-results.
|
|
|
5
5
|
import { type WorkerCapabilityCatalogGroup } from "../../orchestration/worker-capabilities/index.js";
|
|
6
6
|
import type { RequestExecutionSeed } from "../../request/contracts.js";
|
|
7
7
|
import { SUPERVISOR_DECISION_MODEL_STEP, type SupervisorDecisionDiagnosticContext, type SupervisorDelegateRoleId, type SupervisorResumeContext, type SupervisorWorkerCapabilityAffordance } from "./contracts.js";
|
|
8
|
-
export type SupervisorDecisionInputRequest = Pick<RequestExecutionSeed, "requestId" | "prompt" | "historyMessages" | "runnerConfig" | "attachments" | "agentMode" | "modelPreference" | "modelPolicy"> & Partial<Pick<RequestExecutionSeed, "shouldGenerateSessionTitle" | "onEvent" | "temporalContext" | "sessionMemory">>;
|
|
8
|
+
export type SupervisorDecisionInputRequest = Pick<RequestExecutionSeed, "requestId" | "prompt" | "historyMessages" | "runnerConfig" | "attachments" | "agentMode" | "modelPreference" | "modelPolicy"> & Partial<Pick<RequestExecutionSeed, "shouldGenerateSessionTitle" | "onEvent" | "temporalContext" | "scheduledExecution" | "sessionMemory">>;
|
|
9
9
|
export declare function buildSupervisorDecisionInput(request: SupervisorDecisionInputRequest, options: Readonly<{
|
|
10
10
|
toolResults: RequestToolResultsView;
|
|
11
11
|
includeAcknowledgement?: boolean;
|
|
12
12
|
includeTitle?: boolean;
|
|
13
|
+
allowMemoryRecall?: boolean;
|
|
14
|
+
memoryRecallMessage?: ChatMessage;
|
|
13
15
|
allowedRoleIds?: readonly SupervisorDelegateRoleId[];
|
|
14
16
|
diagnostic?: SupervisorDecisionDiagnosticContext;
|
|
15
17
|
resume?: SupervisorResumeContext;
|
|
@@ -23,6 +25,8 @@ export declare function buildSupervisorDecisionInput(request: SupervisorDecision
|
|
|
23
25
|
modelStep: typeof SUPERVISOR_DECISION_MODEL_STEP;
|
|
24
26
|
includeAcknowledgement: boolean;
|
|
25
27
|
includeTitle: boolean;
|
|
28
|
+
includeResponseRecommendation: boolean;
|
|
29
|
+
allowMemoryRecall: boolean;
|
|
26
30
|
allowedRoleIds: readonly SupervisorDelegateRoleId[];
|
|
27
31
|
workerCapabilityAffordances: readonly SupervisorWorkerCapabilityAffordance[];
|
|
28
32
|
availableWorkerCapabilityCatalog: readonly WorkerCapabilityCatalogGroup[];
|
|
@@ -3,6 +3,7 @@ import { resolveConfiguredStepInstructionMetadata } from "../../config/runner/st
|
|
|
3
3
|
import { projectRequestContext } from "../../context/request-context.js";
|
|
4
4
|
import { projectRootSessionMemory } from "../../context/session-memory/root-projection.js";
|
|
5
5
|
import { buildRequestTemporalContextMessage } from "../../context/request-temporal-context.js";
|
|
6
|
+
import { projectScheduledExecutionContext } from "../../context/scheduled-execution-context.js";
|
|
6
7
|
import { buildRequestToolResultsMessage, } from "../../context/request-tool-results.js";
|
|
7
8
|
import { resolveModelContextBudget } from "../../model/model-context-budget.js";
|
|
8
9
|
import { WORKER_CAPABILITY_COUNT_MAX, WORKER_CAPABILITY_SUMMARY_MAX_LENGTH, } from "../../orchestration/worker-capabilities/index.js";
|
|
@@ -11,6 +12,8 @@ import { traceSupervisorChildResultProjected, traceSupervisorContextProjected, }
|
|
|
11
12
|
import { createSupervisorDecisionFormat } from "./format.js";
|
|
12
13
|
import { buildSupervisorDecisionInstructions } from "./prompt.js";
|
|
13
14
|
import { buildSupervisorContinuationPart } from "./resume.js";
|
|
15
|
+
import { buildSupervisorMemoryRecallContinuationParts } from "./memory-recall-continuation.js";
|
|
16
|
+
import { canRecommendDirectSupervisorResponse } from "./response-recommendation.js";
|
|
14
17
|
export function buildSupervisorDecisionInput(request, options) {
|
|
15
18
|
if (options.resume && options.includeTitle === true) {
|
|
16
19
|
throw new Error("supervisor_resume_title_not_allowed");
|
|
@@ -24,6 +27,7 @@ export function buildSupervisorDecisionInput(request, options) {
|
|
|
24
27
|
const includeTitle = options.resume
|
|
25
28
|
? false
|
|
26
29
|
: (options.includeTitle ?? request.shouldGenerateSessionTitle ?? false);
|
|
30
|
+
const includeResponseRecommendation = canRecommendDirectSupervisorResponse(options);
|
|
27
31
|
const allowedRoleIds = [
|
|
28
32
|
...new Set(options.allowedRoleIds ?? SUPERVISOR_DELEGATE_ROLE_IDS),
|
|
29
33
|
];
|
|
@@ -36,8 +40,10 @@ export function buildSupervisorDecisionInput(request, options) {
|
|
|
36
40
|
? normalizeWorkerCapabilityAffordances(options.workerCapabilityAffordances)
|
|
37
41
|
: EMPTY_WORKER_CAPABILITY_AFFORDANCES;
|
|
38
42
|
const format = createSupervisorDecisionFormat({
|
|
43
|
+
allowMemoryRecall: options.allowMemoryRecall === true,
|
|
39
44
|
includeAcknowledgement,
|
|
40
45
|
includeTitle,
|
|
46
|
+
includeResponseRecommendation,
|
|
41
47
|
allowedRoleIds,
|
|
42
48
|
availableWorkerCapabilityCatalog,
|
|
43
49
|
});
|
|
@@ -53,6 +59,7 @@ export function buildSupervisorDecisionInput(request, options) {
|
|
|
53
59
|
currentInvocationAttempt: requireSupervisorInvocationAttempt(diagnostic),
|
|
54
60
|
})
|
|
55
61
|
: undefined;
|
|
62
|
+
const roleContinuationParts = roleContinuationPart ? [roleContinuationPart] : [];
|
|
56
63
|
const referenceMessages = [
|
|
57
64
|
...(request.temporalContext
|
|
58
65
|
? [buildRequestTemporalContextMessage(request.temporalContext)]
|
|
@@ -75,25 +82,35 @@ export function buildSupervisorDecisionInput(request, options) {
|
|
|
75
82
|
modelStep: SUPERVISOR_DECISION_MODEL_STEP,
|
|
76
83
|
});
|
|
77
84
|
const instructions = buildSupervisorDecisionInstructions({
|
|
85
|
+
allowMemoryRecall: options.allowMemoryRecall === true,
|
|
86
|
+
hasMemoryRecallContext: options.memoryRecallMessage !== undefined,
|
|
78
87
|
includeAcknowledgement,
|
|
79
88
|
includeTitle,
|
|
89
|
+
includeResponseRecommendation,
|
|
80
90
|
allowedRoleIds,
|
|
81
91
|
hasCompletedChildResult: options.resume !== undefined,
|
|
82
92
|
hasRequestToolResults: options.toolResults.results.length > 0,
|
|
83
93
|
workerCapabilityAffordances,
|
|
84
94
|
availableWorkerCapabilityCatalog,
|
|
85
95
|
});
|
|
96
|
+
const scheduledExecution = projectScheduledExecutionContext(request, instructions, "decision");
|
|
97
|
+
referenceMessages.unshift(...scheduledExecution.referenceMessages);
|
|
86
98
|
const sessionMemory = projectRootSessionMemory(request);
|
|
87
99
|
const contextInput = {
|
|
88
|
-
instructions,
|
|
100
|
+
instructions: scheduledExecution.instructions,
|
|
89
101
|
format,
|
|
90
102
|
...sessionMemory,
|
|
91
103
|
prompt: request.prompt,
|
|
92
104
|
...(request.attachments ? { attachments: request.attachments } : {}),
|
|
93
105
|
...(referenceMessages.length > 0 ? { referenceMessages } : {}),
|
|
94
|
-
|
|
95
|
-
? {
|
|
96
|
-
|
|
106
|
+
continuationParts: options.memoryRecallMessage
|
|
107
|
+
? buildSupervisorMemoryRecallContinuationParts({
|
|
108
|
+
memoryRecallMessage: options.memoryRecallMessage,
|
|
109
|
+
...(options.resume ? { resume: options.resume } : {}),
|
|
110
|
+
currentCallId: requireSupervisorCallId(diagnostic),
|
|
111
|
+
currentInvocationAttempt: requireSupervisorInvocationAttempt(diagnostic),
|
|
112
|
+
})
|
|
113
|
+
: roleContinuationParts,
|
|
97
114
|
budget,
|
|
98
115
|
diagnostic,
|
|
99
116
|
...(request.onEvent ? { onEvent: request.onEvent } : {}),
|
|
@@ -117,12 +134,13 @@ export function buildSupervisorDecisionInput(request, options) {
|
|
|
117
134
|
});
|
|
118
135
|
traceSupervisorContextProjected({
|
|
119
136
|
diagnostic,
|
|
137
|
+
allowMemoryRecall: options.allowMemoryRecall === true,
|
|
120
138
|
context,
|
|
121
139
|
format,
|
|
122
140
|
historyMessageCount: sessionMemory.historyMessages.length,
|
|
123
141
|
attachmentCount: request.attachments?.length ?? 0,
|
|
124
142
|
referenceMessageCount: referenceMessages.length,
|
|
125
|
-
continuationMessageCount:
|
|
143
|
+
continuationMessageCount: contextInput.continuationParts?.reduce((count, part) => count + part.messages.length, 0) ?? 0,
|
|
126
144
|
completedChildResultCount: options.resume?.completedChildren.length ?? 0,
|
|
127
145
|
completedChildSummaryLength: options.resume?.completedChildren.reduce((total, child) => total + child.summary.length, 0) ?? 0,
|
|
128
146
|
allowedRoleIds,
|
|
@@ -147,6 +165,8 @@ export function buildSupervisorDecisionInput(request, options) {
|
|
|
147
165
|
modelStep: SUPERVISOR_DECISION_MODEL_STEP,
|
|
148
166
|
includeAcknowledgement,
|
|
149
167
|
includeTitle,
|
|
168
|
+
includeResponseRecommendation,
|
|
169
|
+
allowMemoryRecall: options.allowMemoryRecall === true,
|
|
150
170
|
allowedRoleIds,
|
|
151
171
|
workerCapabilityAffordances,
|
|
152
172
|
availableWorkerCapabilityCatalog,
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ChatMessage } from "../../../model-gateway/types.js";
|
|
2
|
+
import type { RequestContextPinnedPart } from "../../context/request-context-contracts.js";
|
|
3
|
+
import type { SupervisorResumeContext } from "./contracts.js";
|
|
4
|
+
/** Place recalls using the child-return position captured when each was accepted. */
|
|
5
|
+
export declare function buildSupervisorMemoryRecallContinuationParts(params: {
|
|
6
|
+
memoryRecallMessage: ChatMessage;
|
|
7
|
+
resume?: SupervisorResumeContext;
|
|
8
|
+
currentCallId: string;
|
|
9
|
+
currentInvocationAttempt: number;
|
|
10
|
+
}): readonly RequestContextPinnedPart[];
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { projectMemoryRecallContinuations, } from "../../long-term-memory/recall-continuation.js";
|
|
2
|
+
import { buildSupervisorChildContinuationParts } from "./resume.js";
|
|
3
|
+
/** Place recalls using the child-return position captured when each was accepted. */
|
|
4
|
+
export function buildSupervisorMemoryRecallContinuationParts(params) {
|
|
5
|
+
const recalls = projectMemoryRecallContinuations(params.memoryRecallMessage);
|
|
6
|
+
const children = params.resume
|
|
7
|
+
? buildSupervisorChildContinuationParts({ ...params, resume: params.resume })
|
|
8
|
+
: [];
|
|
9
|
+
if (!hasBoundRecallChildPositions(recalls, children.length)) {
|
|
10
|
+
throw new Error("memory_recall_child_position_invalid");
|
|
11
|
+
}
|
|
12
|
+
const parts = [];
|
|
13
|
+
for (let childIndex = 0; childIndex <= children.length; childIndex++) {
|
|
14
|
+
for (const recall of recalls) {
|
|
15
|
+
if (recall.completedChildCount !== childIndex)
|
|
16
|
+
continue;
|
|
17
|
+
parts.push(Object.freeze({
|
|
18
|
+
sourceRef: `memory-recall:${params.currentCallId}:${recall.invocationAttempt}`,
|
|
19
|
+
category: "role_continuation",
|
|
20
|
+
retention: "exact",
|
|
21
|
+
messages: recall.messages,
|
|
22
|
+
}));
|
|
23
|
+
}
|
|
24
|
+
const child = children[childIndex];
|
|
25
|
+
if (child)
|
|
26
|
+
parts.push(child);
|
|
27
|
+
}
|
|
28
|
+
return Object.freeze(parts);
|
|
29
|
+
}
|
|
30
|
+
function hasBoundRecallChildPositions(recalls, completedChildCount) {
|
|
31
|
+
return recalls.every((recall) => recall.completedChildCount <= completedChildCount);
|
|
32
|
+
}
|
|
@@ -3,6 +3,8 @@ import type { WorkerCapabilityCatalogGroup } from "../../orchestration/worker-ca
|
|
|
3
3
|
export declare function parseSupervisorDecisionOutput(text: string, options?: Readonly<{
|
|
4
4
|
includeAcknowledgement?: boolean;
|
|
5
5
|
includeTitle?: boolean;
|
|
6
|
+
includeResponseRecommendation?: boolean;
|
|
7
|
+
allowMemoryRecall?: boolean;
|
|
6
8
|
allowedRoleIds?: readonly SupervisorDelegateRoleId[];
|
|
7
9
|
availableWorkerCapabilityCatalog?: readonly WorkerCapabilityCatalogGroup[];
|
|
8
10
|
diagnostic?: SupervisorDecisionDiagnosticContext;
|
|
@@ -2,9 +2,12 @@ import { isSupervisorDelegateRoleId, SUPERVISOR_ACKNOWLEDGEMENT_MAX_LENGTH, SUPE
|
|
|
2
2
|
import { createWorkerCapabilityScopeDecisionContract, parseWorkerCapabilityScopeDecision, } from "../worker-capability-scope-decision.js";
|
|
3
3
|
import { traceSupervisorAcknowledgementNormalized, traceSupervisorDecisionAccepted, traceSupervisorDecisionRejected, traceSupervisorEnvelopeAccepted, traceSupervisorEnvelopeRejected, } from "./diagnostics.js";
|
|
4
4
|
import { readStructuredDecisionEnvelope } from "../../model/structured-decision-envelope.js";
|
|
5
|
+
import { isMemoryRecallDecisionRecord, parseMemoryRecallDecision, } from "../memory-recall-decision.js";
|
|
6
|
+
import { projectSupervisorResponseRecommendation, supervisorResponseRecommendationKeys, } from "./response-recommendation.js";
|
|
5
7
|
export function parseSupervisorDecisionOutput(text, options = {}) {
|
|
6
8
|
const includeAcknowledgement = options.includeAcknowledgement === true;
|
|
7
9
|
const includeTitle = options.includeTitle === true;
|
|
10
|
+
const includeResponseRecommendation = options.includeResponseRecommendation === true;
|
|
8
11
|
const allowedRoleIds = [
|
|
9
12
|
...new Set(options.allowedRoleIds ?? SUPERVISOR_DELEGATE_ROLE_IDS),
|
|
10
13
|
];
|
|
@@ -38,6 +41,30 @@ export function parseSupervisorDecisionOutput(text, options = {}) {
|
|
|
38
41
|
});
|
|
39
42
|
}
|
|
40
43
|
const issues = [];
|
|
44
|
+
if (isMemoryRecallDecisionRecord(record)) {
|
|
45
|
+
const recalled = parseMemoryRecallDecision(record, {
|
|
46
|
+
allowMemoryRecall: options.allowMemoryRecall,
|
|
47
|
+
includeAcknowledgement,
|
|
48
|
+
includeTitle,
|
|
49
|
+
acknowledgementMaxLength: SUPERVISOR_ACKNOWLEDGEMENT_MAX_LENGTH,
|
|
50
|
+
titleMaxLength: SUPERVISOR_TITLE_MAX_LENGTH,
|
|
51
|
+
});
|
|
52
|
+
if (!diagnostic)
|
|
53
|
+
return recalled;
|
|
54
|
+
if (!recalled.ok) {
|
|
55
|
+
traceSupervisorDecisionRejected({
|
|
56
|
+
diagnostic,
|
|
57
|
+
selectedAction: "recall_memory",
|
|
58
|
+
issues: recalled.issues,
|
|
59
|
+
});
|
|
60
|
+
return recalled;
|
|
61
|
+
}
|
|
62
|
+
traceSupervisorDecisionAccepted({
|
|
63
|
+
diagnostic,
|
|
64
|
+
decision: recalled.decision,
|
|
65
|
+
});
|
|
66
|
+
return recalled;
|
|
67
|
+
}
|
|
41
68
|
let normalizedAcknowledgement;
|
|
42
69
|
let acknowledgementOriginalLength;
|
|
43
70
|
let workerCapabilityScope;
|
|
@@ -50,6 +77,7 @@ export function parseSupervisorDecisionOutput(text, options = {}) {
|
|
|
50
77
|
else if (selectedAction === "respond") {
|
|
51
78
|
exactKeys(record, [
|
|
52
79
|
"action",
|
|
80
|
+
...supervisorResponseRecommendationKeys(record, includeResponseRecommendation),
|
|
53
81
|
...(includeAcknowledgement ? ["acknowledgement"] : []),
|
|
54
82
|
...(includeTitle ? ["title"] : []),
|
|
55
83
|
], issues);
|
|
@@ -119,6 +147,7 @@ export function parseSupervisorDecisionOutput(text, options = {}) {
|
|
|
119
147
|
selectedAction,
|
|
120
148
|
includeAcknowledgement,
|
|
121
149
|
includeTitle,
|
|
150
|
+
includeResponseRecommendation,
|
|
122
151
|
normalizedAcknowledgement,
|
|
123
152
|
workerCapabilityScope,
|
|
124
153
|
});
|
|
@@ -146,7 +175,13 @@ function buildAcceptedSupervisorRoutingDecision(params) {
|
|
|
146
175
|
: {}),
|
|
147
176
|
};
|
|
148
177
|
if (params.selectedAction === "respond") {
|
|
149
|
-
return {
|
|
178
|
+
return {
|
|
179
|
+
action: "respond",
|
|
180
|
+
...presentation,
|
|
181
|
+
...(params.includeResponseRecommendation
|
|
182
|
+
? projectSupervisorResponseRecommendation(params.record.responseRecommendation)
|
|
183
|
+
: {}),
|
|
184
|
+
};
|
|
150
185
|
}
|
|
151
186
|
const objective = params.record.objective?.trim();
|
|
152
187
|
if (params.record.roleId === "worker") {
|
|
@@ -3,6 +3,9 @@ import type { WorkerCapabilityCatalogGroup } from "../../orchestration/worker-ca
|
|
|
3
3
|
export declare function buildSupervisorDecisionInstructions(params?: Readonly<{
|
|
4
4
|
includeAcknowledgement?: boolean;
|
|
5
5
|
includeTitle?: boolean;
|
|
6
|
+
includeResponseRecommendation?: boolean;
|
|
7
|
+
allowMemoryRecall?: boolean;
|
|
8
|
+
hasMemoryRecallContext?: boolean;
|
|
6
9
|
allowedRoleIds?: readonly SupervisorDelegateRoleId[];
|
|
7
10
|
hasCompletedChildResult?: boolean;
|
|
8
11
|
hasRequestToolResults?: boolean;
|