@abot-ai/runtime 1.2.0 → 1.3.1
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/scripts/init-runtime.js +4 -13
- package/dist/scripts/runtime-setup-directories.d.ts +2 -0
- package/dist/scripts/runtime-setup-directories.js +38 -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/directory-authority/bootstrap.d.ts +1 -0
- package/dist/src/shared/directory-authority/bootstrap.js +118 -0
- package/dist/src/shared/directory-authority/command.d.ts +8 -0
- package/dist/src/shared/directory-authority/command.js +27 -0
- package/dist/src/shared/directory-authority/errors.d.ts +5 -0
- package/dist/src/shared/directory-authority/errors.js +10 -0
- package/dist/src/shared/directory-authority/index.d.ts +3 -0
- package/dist/src/shared/directory-authority/index.js +3 -0
- package/dist/src/shared/directory-authority/protocol.d.ts +11 -0
- package/dist/src/shared/directory-authority/protocol.js +62 -0
- package/dist/src/shared/directory-authority/task.d.ts +7 -0
- package/dist/src/shared/directory-authority/task.js +97 -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/plugins.md +15 -9
- 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/exec/plugin.json +3 -3
- package/plugins/exec/skills/exec_skill/SKILL.md +1 -1
- package/plugins/exec/source/process-manager.ts +1 -20
- package/plugins/exec/source/shell-platform.ts +29 -0
- package/plugins/exec/src/index.cjs +25 -18
- package/plugins/filesystem/plugin.json +17 -2
- package/plugins/filesystem/source/atomic-write.ts +9 -0
- package/plugins/filesystem/source/bounded-io.ts +5 -99
- package/plugins/filesystem/source/directory-authority-write.ts +64 -0
- package/plugins/filesystem/source/directory-sample-task.ts +23 -0
- package/plugins/filesystem/source/directory-sample.ts +132 -0
- package/plugins/filesystem/source/directory-write-task.ts +160 -0
- package/plugins/filesystem/source/mutation-parent.ts +11 -0
- package/plugins/filesystem/src/index.cjs +693 -118
- package/plugins/json-inspector/plugin.json +12 -0
- package/plugins/local-search/plugin.json +12 -0
- package/plugins/local-search/source/index.ts +2 -0
- package/plugins/local-search/source/paths.ts +30 -7
- package/plugins/local-search/source/ripgrep-process.ts +69 -0
- package/plugins/local-search/source/ripgrep.ts +19 -23
- package/plugins/local-search/src/index.cjs +295 -32
- 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
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
import { beginCapabilityBatch, settleCapabilityBatch, } from "./command-dispatch/capability-batch-transitions.js";
|
|
2
2
|
import { beginCapabilityExecution, settleCapabilityExecution, } from "./command-dispatch/capability-execution-transitions.js";
|
|
3
3
|
import { reconsiderCapabilitySelection } from "./command-dispatch/capability-selection-transition.js";
|
|
4
|
+
import { beginMemoryRecall, settleMemoryRecall } from "./command-dispatch/memory-recall-transitions.js";
|
|
4
5
|
import { establishWorkingDirectory, updateCapabilityScope, } from "./command-dispatch/call-scope-transitions.js";
|
|
5
6
|
import { openChild, returnChild, } from "./command-dispatch/child-transitions.js";
|
|
6
7
|
import { completeRootResponse, createRoot, } from "./command-dispatch/root-transitions.js";
|
|
7
8
|
export function dispatchRoleCallCommand(state, command, policy, admittedHeadRevision) {
|
|
8
9
|
switch (command.type) {
|
|
10
|
+
case "begin_memory_recall":
|
|
11
|
+
return beginMemoryRecall(state, command);
|
|
12
|
+
case "settle_memory_recall":
|
|
13
|
+
return settleMemoryRecall(state, command);
|
|
9
14
|
case "create_root":
|
|
10
15
|
return createRoot(state);
|
|
11
16
|
case "complete_root_response":
|
|
@@ -5,8 +5,9 @@ import type { RoleOperationFingerprint, RoleOperationOutcomeFingerprint, RoleOpe
|
|
|
5
5
|
import type { RoleCapabilitySelectionSupervisionStage, RoleCapabilitySelectionSupervisionState, RoleCapabilitySelectionSupervisionTrigger } from "./capability-selection-supervision.js";
|
|
6
6
|
import type { RoleCapabilitySelectionReconsiderationCause } from "./reconsideration-cause.js";
|
|
7
7
|
import type { RoleCallResultReceipt } from "./result-receipt.js";
|
|
8
|
-
|
|
9
|
-
export declare const
|
|
8
|
+
import type { RoleMemoryRecall, RoleMemoryRecallCommand, RoleMemoryRecallCommitEffect, RoleMemoryRecallTransactions } from "./memory-recall-contract.js";
|
|
9
|
+
export declare const ROLE_CALL_LEDGER_CONTRACT_VERSION = 18;
|
|
10
|
+
export declare const ROLE_CALL_LEDGER_HEAD_KIND: "runtime_role_call_ledger_v18";
|
|
10
11
|
export declare const ROLE_CALL_OBJECTIVE_MAX_LENGTH = 8192;
|
|
11
12
|
export declare const ROLE_CALL_RESULT_MAX_LENGTH = 8192;
|
|
12
13
|
export declare const ROLE_CALL_RESPONSE_MAX_LENGTH = 65536;
|
|
@@ -53,7 +54,7 @@ export type RoleCallPolicyInput = Readonly<{
|
|
|
53
54
|
authority?: ExecutionPolicyAuthoritySnapshot;
|
|
54
55
|
limits: RoleCallPolicy["limits"];
|
|
55
56
|
}>;
|
|
56
|
-
export type RoleCallFrameStatus = "active" | "waiting_for_child" | "waiting_for_capability" | "completed";
|
|
57
|
+
export type RoleCallFrameStatus = "active" | "waiting_for_child" | "waiting_for_capability" | "waiting_for_memory" | "completed";
|
|
57
58
|
export type RoleCallWorkerCapabilityScope = Readonly<{
|
|
58
59
|
catalogGroupIds: readonly string[];
|
|
59
60
|
}>;
|
|
@@ -183,6 +184,7 @@ export type RoleCallState = Readonly<{
|
|
|
183
184
|
results: readonly RoleCallResult[];
|
|
184
185
|
plans: readonly RoleCallPlanState[];
|
|
185
186
|
capabilityExecutions: readonly RoleCapabilityExecution[];
|
|
187
|
+
memoryRecalls: readonly RoleMemoryRecall[];
|
|
186
188
|
operationSupervision: RoleOperationSupervisionState;
|
|
187
189
|
capabilitySelectionSupervision: RoleCapabilitySelectionSupervisionState;
|
|
188
190
|
rootResponse: string | null;
|
|
@@ -296,8 +298,8 @@ export type ReconsiderRoleCapabilitySelectionCommand = Readonly<{
|
|
|
296
298
|
selection: RoleCapabilitySelectionProjection;
|
|
297
299
|
cause: RoleCapabilitySelectionReconsiderationCause;
|
|
298
300
|
}>;
|
|
299
|
-
export type RoleCallLedgerCommand = CreateRootRoleCallCommand | CompleteRootResponseCommand | OpenChildRoleCallCommand | ReturnChildRoleCallCommand | BeginRoleCapabilityExecutionCommand | SettleRoleCapabilityExecutionCommand | BeginRoleCapabilityBatchCommand | SettleRoleCapabilityBatchCommand | UpdateRoleCapabilityScopeCommand | EstablishRoleCallWorkingDirectoryCommand | ReconsiderRoleCapabilitySelectionCommand;
|
|
300
|
-
export type RoleCallCommitEffect = Readonly<{
|
|
301
|
+
export type RoleCallLedgerCommand = RoleMemoryRecallCommand | CreateRootRoleCallCommand | CompleteRootResponseCommand | OpenChildRoleCallCommand | ReturnChildRoleCallCommand | BeginRoleCapabilityExecutionCommand | SettleRoleCapabilityExecutionCommand | BeginRoleCapabilityBatchCommand | SettleRoleCapabilityBatchCommand | UpdateRoleCapabilityScopeCommand | EstablishRoleCallWorkingDirectoryCommand | ReconsiderRoleCapabilitySelectionCommand;
|
|
302
|
+
export type RoleCallCommitEffect = RoleMemoryRecallCommitEffect | Readonly<{
|
|
301
303
|
type: "root_created";
|
|
302
304
|
callId: string;
|
|
303
305
|
}> | Readonly<{
|
|
@@ -364,7 +366,7 @@ export type RoleCallValidationIssue = Readonly<{
|
|
|
364
366
|
code: string;
|
|
365
367
|
path: string;
|
|
366
368
|
}>;
|
|
367
|
-
export type RoleCallTransitionRejectionCode = "invalid_current_state" | "invalid_policy" | "invalid_command" | "root_already_created" | "root_missing" | "caller_not_active" | "root_response_not_allowed" | "supervisor_child_forbidden" | "child_role_not_authorized" | "child_dependency_invalid" | "planner_plan_binding_invalid" | "planner_plan_already_declared" | "planner_plan_missing" | "planner_plan_item_unavailable" | "planner_plan_incomplete" | "depth_limit_exceeded" | "call_limit_exceeded" | "child_return_mismatch" | "capability_caller_invalid" | "capability_invocation_mismatch" | "capability_execution_limit_exceeded" | "capability_execution_mismatch" | "capability_scope_update_invalid" | "working_directory_establishment_invalid" | "capability_selection_reconsideration_invalid" | "capability_selection_supervision_limit_exceeded" | "operation_supervision_limit_exceeded" | "role_activation_limit_exceeded";
|
|
369
|
+
export type RoleCallTransitionRejectionCode = "invalid_current_state" | "invalid_policy" | "invalid_command" | "root_already_created" | "root_missing" | "caller_not_active" | "root_response_not_allowed" | "supervisor_child_forbidden" | "child_role_not_authorized" | "child_dependency_invalid" | "planner_plan_binding_invalid" | "planner_plan_already_declared" | "planner_plan_missing" | "planner_plan_item_unavailable" | "planner_plan_incomplete" | "depth_limit_exceeded" | "call_limit_exceeded" | "child_return_mismatch" | "capability_caller_invalid" | "capability_invocation_mismatch" | "capability_execution_limit_exceeded" | "capability_execution_mismatch" | "capability_scope_update_invalid" | "working_directory_establishment_invalid" | "capability_selection_reconsideration_invalid" | "capability_selection_supervision_limit_exceeded" | "operation_supervision_limit_exceeded" | "memory_recall_caller_invalid" | "memory_recall_invocation_mismatch" | "memory_recall_settlement_mismatch" | "role_activation_limit_exceeded";
|
|
368
370
|
export type RoleCallTransitionResult = Readonly<{
|
|
369
371
|
ok: true;
|
|
370
372
|
state: RoleCallState;
|
|
@@ -433,7 +435,7 @@ export type RoleCallTransactionFailure<TTransitionIssueCode extends string> = Re
|
|
|
433
435
|
commit: RoleCallLedgerCommitResult;
|
|
434
436
|
}>;
|
|
435
437
|
export type RoleCallTransactionResult<TEffectType extends RoleCallCommitEffect["type"], TTransitionIssueCode extends string> = RoleCallTransactionSuccess<TEffectType> | RoleCallTransactionFailure<TTransitionIssueCode>;
|
|
436
|
-
export type RoleCallTransactions = Readonly<{
|
|
438
|
+
export type RoleCallTransactions = RoleMemoryRecallTransactions & Readonly<{
|
|
437
439
|
createRoot(input: Readonly<{
|
|
438
440
|
expectedHead: unknown;
|
|
439
441
|
}>): Promise<RoleCallTransactionResult<"root_created", "root_create_transition_invalid">>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export const ROLE_CALL_LEDGER_CONTRACT_VERSION =
|
|
2
|
-
export const ROLE_CALL_LEDGER_HEAD_KIND = "
|
|
1
|
+
export const ROLE_CALL_LEDGER_CONTRACT_VERSION = 18;
|
|
2
|
+
export const ROLE_CALL_LEDGER_HEAD_KIND = "runtime_role_call_ledger_v18";
|
|
3
3
|
export const ROLE_CALL_OBJECTIVE_MAX_LENGTH = 8_192;
|
|
4
4
|
export const ROLE_CALL_RESULT_MAX_LENGTH = 8_192;
|
|
5
5
|
export const ROLE_CALL_RESPONSE_MAX_LENGTH = 65_536;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { traceDebug } from "../../observability/debug-logger.js";
|
|
2
2
|
import { resolveRoleActivationBudget } from "./activation-budget.js";
|
|
3
3
|
import { isSuccessfulObservedMutation } from "./operation-supervision.js";
|
|
4
|
+
import { traceMemoryRecallCommit } from "./memory-recall-diagnostics.js";
|
|
4
5
|
const ROLE_CALL_LOG_SCOPE = "runtime.role_calls";
|
|
5
6
|
export function traceRoleCallCommit(params) {
|
|
6
7
|
const state = params.head.state;
|
|
@@ -25,6 +26,8 @@ export function traceRoleCallCommit(params) {
|
|
|
25
26
|
effectType: params.effect.type,
|
|
26
27
|
});
|
|
27
28
|
traceCapabilitySelectionSupervisionReset(params, common);
|
|
29
|
+
if (traceMemoryRecallCommit(params, common))
|
|
30
|
+
return;
|
|
28
31
|
switch (params.effect.type) {
|
|
29
32
|
case "root_created": {
|
|
30
33
|
traceDebug(ROLE_CALL_LOG_SCOPE, "root.created", {
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { LongTermMemoryRecord } from "../../long-term-memory/contracts.js";
|
|
2
|
+
import type { RoleCallTransactionInput, RoleCallTransactionResult } from "./contracts.js";
|
|
3
|
+
export declare const ROLE_MEMORY_RECALL_QUERY_MAX_LENGTH = 1024;
|
|
4
|
+
export declare const ROLE_MEMORY_RECALL_RECORD_LIMIT_MAX = 6;
|
|
5
|
+
export declare const ROLE_MEMORY_RECALL_RESULT_MAX_LENGTH = 6000;
|
|
6
|
+
export declare const ROLE_MEMORY_RECALL_REASON_MAX_LENGTH = 256;
|
|
7
|
+
export type RoleMemoryRecallResult = Readonly<{
|
|
8
|
+
outcome: "found" | "empty" | "unavailable" | "superseded";
|
|
9
|
+
records: readonly LongTermMemoryRecord[];
|
|
10
|
+
omittedRecordCount: number;
|
|
11
|
+
reason?: string;
|
|
12
|
+
}>;
|
|
13
|
+
export type RoleMemoryRecallIdentity = Readonly<{
|
|
14
|
+
callId: string;
|
|
15
|
+
invocationAttempt: number;
|
|
16
|
+
steeringVersion: number;
|
|
17
|
+
}>;
|
|
18
|
+
export type RoleMemoryRecall = RoleMemoryRecallIdentity & Readonly<{
|
|
19
|
+
recallId: string;
|
|
20
|
+
completedChildCount: number;
|
|
21
|
+
query: string;
|
|
22
|
+
}> & (Readonly<{
|
|
23
|
+
status: "pending";
|
|
24
|
+
result?: undefined;
|
|
25
|
+
}> | Readonly<{
|
|
26
|
+
status: "settled";
|
|
27
|
+
result: RoleMemoryRecallResult;
|
|
28
|
+
}>);
|
|
29
|
+
export type BeginRoleMemoryRecallCommand = RoleMemoryRecallIdentity & Readonly<{
|
|
30
|
+
authority: "active_role";
|
|
31
|
+
type: "begin_memory_recall";
|
|
32
|
+
query: string;
|
|
33
|
+
}>;
|
|
34
|
+
export type SettleRoleMemoryRecallCommand = RoleMemoryRecallIdentity & Readonly<{
|
|
35
|
+
authority: "runtime";
|
|
36
|
+
type: "settle_memory_recall";
|
|
37
|
+
recallId: string;
|
|
38
|
+
result: RoleMemoryRecallResult;
|
|
39
|
+
}>;
|
|
40
|
+
export type RoleMemoryRecallCommand = BeginRoleMemoryRecallCommand | SettleRoleMemoryRecallCommand;
|
|
41
|
+
export type RoleMemoryRecallCommitEffect = RoleMemoryRecallIdentity & Readonly<{
|
|
42
|
+
recallId: string;
|
|
43
|
+
}> & (Readonly<{
|
|
44
|
+
type: "memory_recall_begun";
|
|
45
|
+
}> | Readonly<{
|
|
46
|
+
type: "memory_recall_settled";
|
|
47
|
+
}>);
|
|
48
|
+
export type RoleMemoryRecallTransactions = Readonly<{
|
|
49
|
+
beginMemoryRecall(input: RoleCallTransactionInput<BeginRoleMemoryRecallCommand>): Promise<RoleCallTransactionResult<"memory_recall_begun", "memory_recall_transition_invalid">>;
|
|
50
|
+
settleMemoryRecall(input: RoleCallTransactionInput<SettleRoleMemoryRecallCommand>): Promise<RoleCallTransactionResult<"memory_recall_settled", "memory_recall_transition_invalid">>;
|
|
51
|
+
}>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { DecodedRoleCallCommand } from "./command-decoder.js";
|
|
2
|
+
import { type RoleMemoryRecallIdentity, type RoleMemoryRecallResult } from "./memory-recall-contract.js";
|
|
3
|
+
export declare function decodeMemoryRecallCommand(input: Record<string, unknown>): DecodedRoleCallCommand;
|
|
4
|
+
export declare function hasMemoryRecallIdentity(input: Record<string, unknown>): input is Record<string, unknown> & RoleMemoryRecallIdentity;
|
|
5
|
+
export declare function isBoundedMemoryRecallQuery(input: unknown): input is string;
|
|
6
|
+
export declare function normalizeRoleMemoryRecallResult(input: unknown): RoleMemoryRecallResult | undefined;
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import { parseMemoryRecord } from "../../long-term-memory/repository-state.js";
|
|
2
|
+
import { exactKeys, isRecord } from "../../validation/strict-record.js";
|
|
3
|
+
import { ROLE_MEMORY_RECALL_QUERY_MAX_LENGTH, ROLE_MEMORY_RECALL_REASON_MAX_LENGTH, ROLE_MEMORY_RECALL_RECORD_LIMIT_MAX, ROLE_MEMORY_RECALL_RESULT_MAX_LENGTH, } from "./memory-recall-contract.js";
|
|
4
|
+
export function decodeMemoryRecallCommand(input) {
|
|
5
|
+
const invalid = { ok: false, code: "invalid_command" };
|
|
6
|
+
if (!hasMemoryRecallIdentity(input))
|
|
7
|
+
return invalid;
|
|
8
|
+
if (input.type === "begin_memory_recall")
|
|
9
|
+
return decodeBeginMemoryRecall(input);
|
|
10
|
+
return decodeSettleMemoryRecall(input);
|
|
11
|
+
}
|
|
12
|
+
function decodeBeginMemoryRecall(input) {
|
|
13
|
+
const invalid = { ok: false, code: "invalid_command" };
|
|
14
|
+
if (input.authority !== "active_role")
|
|
15
|
+
return invalid;
|
|
16
|
+
if (!exactKeys(input, [
|
|
17
|
+
"authority",
|
|
18
|
+
"type",
|
|
19
|
+
"callId",
|
|
20
|
+
"invocationAttempt",
|
|
21
|
+
"steeringVersion",
|
|
22
|
+
"query",
|
|
23
|
+
]))
|
|
24
|
+
return invalid;
|
|
25
|
+
if (!isBoundedMemoryRecallQuery(input.query))
|
|
26
|
+
return invalid;
|
|
27
|
+
return {
|
|
28
|
+
ok: true,
|
|
29
|
+
value: {
|
|
30
|
+
authority: "active_role",
|
|
31
|
+
type: "begin_memory_recall",
|
|
32
|
+
callId: input.callId,
|
|
33
|
+
invocationAttempt: input.invocationAttempt,
|
|
34
|
+
steeringVersion: input.steeringVersion,
|
|
35
|
+
query: input.query.trim(),
|
|
36
|
+
},
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
function decodeSettleMemoryRecall(input) {
|
|
40
|
+
const invalid = { ok: false, code: "invalid_command" };
|
|
41
|
+
if (input.type !== "settle_memory_recall")
|
|
42
|
+
return invalid;
|
|
43
|
+
if (input.authority !== "runtime")
|
|
44
|
+
return invalid;
|
|
45
|
+
if (!exactKeys(input, [
|
|
46
|
+
"authority",
|
|
47
|
+
"type",
|
|
48
|
+
"callId",
|
|
49
|
+
"invocationAttempt",
|
|
50
|
+
"steeringVersion",
|
|
51
|
+
"recallId",
|
|
52
|
+
"result",
|
|
53
|
+
]))
|
|
54
|
+
return invalid;
|
|
55
|
+
if (typeof input.recallId !== "string")
|
|
56
|
+
return invalid;
|
|
57
|
+
const result = normalizeRoleMemoryRecallResult(input.result);
|
|
58
|
+
if (!result)
|
|
59
|
+
return invalid;
|
|
60
|
+
return {
|
|
61
|
+
ok: true,
|
|
62
|
+
value: {
|
|
63
|
+
authority: "runtime",
|
|
64
|
+
type: "settle_memory_recall",
|
|
65
|
+
callId: input.callId,
|
|
66
|
+
invocationAttempt: input.invocationAttempt,
|
|
67
|
+
steeringVersion: input.steeringVersion,
|
|
68
|
+
recallId: input.recallId,
|
|
69
|
+
result,
|
|
70
|
+
},
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
export function hasMemoryRecallIdentity(input) {
|
|
74
|
+
if (typeof input.callId !== "string" || input.callId.length === 0)
|
|
75
|
+
return false;
|
|
76
|
+
if (!Number.isSafeInteger(input.invocationAttempt))
|
|
77
|
+
return false;
|
|
78
|
+
if (input.invocationAttempt < 1)
|
|
79
|
+
return false;
|
|
80
|
+
if (!Number.isSafeInteger(input.steeringVersion))
|
|
81
|
+
return false;
|
|
82
|
+
return input.steeringVersion >= 0;
|
|
83
|
+
}
|
|
84
|
+
export function isBoundedMemoryRecallQuery(input) {
|
|
85
|
+
if (typeof input !== "string")
|
|
86
|
+
return false;
|
|
87
|
+
if (input.trim().length === 0)
|
|
88
|
+
return false;
|
|
89
|
+
return input.length <= ROLE_MEMORY_RECALL_QUERY_MAX_LENGTH;
|
|
90
|
+
}
|
|
91
|
+
export function normalizeRoleMemoryRecallResult(input) {
|
|
92
|
+
if (!isRecord(input))
|
|
93
|
+
return undefined;
|
|
94
|
+
if (!exactKeys(input, ["outcome", "records", "omittedRecordCount"], ["reason"]))
|
|
95
|
+
return undefined;
|
|
96
|
+
const outcome = input.outcome;
|
|
97
|
+
if (!isMemoryRecallOutcome(outcome))
|
|
98
|
+
return undefined;
|
|
99
|
+
if (!Array.isArray(input.records))
|
|
100
|
+
return undefined;
|
|
101
|
+
if (input.records.length > ROLE_MEMORY_RECALL_RECORD_LIMIT_MAX)
|
|
102
|
+
return undefined;
|
|
103
|
+
if (!Number.isSafeInteger(input.omittedRecordCount))
|
|
104
|
+
return undefined;
|
|
105
|
+
if (input.omittedRecordCount < 0)
|
|
106
|
+
return undefined;
|
|
107
|
+
if (!isMemoryRecallReason(input.reason))
|
|
108
|
+
return undefined;
|
|
109
|
+
if (!hasRecordsForMemoryRecallOutcome(outcome, input.records.length))
|
|
110
|
+
return undefined;
|
|
111
|
+
try {
|
|
112
|
+
if (JSON.stringify(input).length > ROLE_MEMORY_RECALL_RESULT_MAX_LENGTH)
|
|
113
|
+
return undefined;
|
|
114
|
+
const records = Object.freeze(input.records.map(parseMemoryRecord));
|
|
115
|
+
if (new Set(records.map((record) => record.id)).size !== records.length)
|
|
116
|
+
return undefined;
|
|
117
|
+
return Object.freeze({
|
|
118
|
+
outcome,
|
|
119
|
+
records,
|
|
120
|
+
omittedRecordCount: input.omittedRecordCount,
|
|
121
|
+
...(input.reason !== undefined ? { reason: input.reason } : {}),
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
catch {
|
|
125
|
+
return undefined;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
function isMemoryRecallOutcome(input) {
|
|
129
|
+
return (input === "found" ||
|
|
130
|
+
input === "empty" ||
|
|
131
|
+
input === "unavailable" ||
|
|
132
|
+
input === "superseded");
|
|
133
|
+
}
|
|
134
|
+
function isMemoryRecallReason(input) {
|
|
135
|
+
if (input === undefined)
|
|
136
|
+
return true;
|
|
137
|
+
if (typeof input !== "string")
|
|
138
|
+
return false;
|
|
139
|
+
if (input.trim().length === 0)
|
|
140
|
+
return false;
|
|
141
|
+
return input.length <= ROLE_MEMORY_RECALL_REASON_MAX_LENGTH;
|
|
142
|
+
}
|
|
143
|
+
function hasRecordsForMemoryRecallOutcome(outcome, count) {
|
|
144
|
+
if (outcome === "found")
|
|
145
|
+
return count > 0;
|
|
146
|
+
return count === 0;
|
|
147
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { traceDebug } from "../../observability/debug-logger.js";
|
|
2
|
+
export function traceMemoryRecallCommit(params, common) {
|
|
3
|
+
const effect = params.effect;
|
|
4
|
+
if (!isMemoryRecallEffect(effect))
|
|
5
|
+
return false;
|
|
6
|
+
const recall = params.head.state.memoryRecalls.find((entry) => entry.recallId === effect.recallId);
|
|
7
|
+
const call = params.head.state.calls.find((entry) => entry.callId === effect.callId);
|
|
8
|
+
traceDebug("runtime.role_calls", effect.type === "memory_recall_begun"
|
|
9
|
+
? "memory.recall_begun"
|
|
10
|
+
: "memory.recall_settled", {
|
|
11
|
+
...common,
|
|
12
|
+
callId: effect.callId,
|
|
13
|
+
recallId: effect.recallId,
|
|
14
|
+
invocationAttempt: effect.invocationAttempt,
|
|
15
|
+
steeringVersion: effect.steeringVersion,
|
|
16
|
+
activationCount: call?.activationCount,
|
|
17
|
+
queryLength: recall?.query.length,
|
|
18
|
+
outcome: recall?.result?.outcome,
|
|
19
|
+
recordCount: recall?.result?.records.length,
|
|
20
|
+
omittedRecordCount: recall?.result?.omittedRecordCount,
|
|
21
|
+
});
|
|
22
|
+
return true;
|
|
23
|
+
}
|
|
24
|
+
function isMemoryRecallEffect(effect) {
|
|
25
|
+
return (effect.type === "memory_recall_begun" ||
|
|
26
|
+
effect.type === "memory_recall_settled");
|
|
27
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { RoleCallState, RoleCallValidationIssue } from "./contracts.js";
|
|
2
|
+
export declare function validateRoleMemoryRecalls(state: RoleCallState): RoleCallValidationIssue[];
|
|
3
|
+
export declare function hasSettledMemoryRecallActivationRange(state: RoleCallState, callId: string, fromActivation: number, toActivation: number): boolean;
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { RUNTIME_ROOT_ROLE_ID } from "../roles.js";
|
|
2
|
+
import { hasMemoryRecallIdentity, isBoundedMemoryRecallQuery, normalizeRoleMemoryRecallResult, } from "./memory-recall-decoder.js";
|
|
3
|
+
import { exactKeys, isRecord } from "../../validation/strict-record.js";
|
|
4
|
+
export function validateRoleMemoryRecalls(state) {
|
|
5
|
+
const invalid = [
|
|
6
|
+
{ code: "invalid_role_memory_recalls", path: "state.memoryRecalls" },
|
|
7
|
+
];
|
|
8
|
+
if (!Array.isArray(state.memoryRecalls))
|
|
9
|
+
return invalid;
|
|
10
|
+
const root = state.calls.find((call) => call.callId === state.rootCallId);
|
|
11
|
+
if (!root)
|
|
12
|
+
return state.memoryRecalls.length === 0 ? [] : invalid;
|
|
13
|
+
let previousAttempt = 0;
|
|
14
|
+
let previousSteeringVersion = 0;
|
|
15
|
+
let previousCompletedChildCount = 0;
|
|
16
|
+
let pendingCount = 0;
|
|
17
|
+
for (const [index, recall] of state.memoryRecalls.entries()) {
|
|
18
|
+
if (!isOrderedRootMemoryRecall(recall, root, index, previousAttempt, previousSteeringVersion, previousCompletedChildCount))
|
|
19
|
+
return invalid;
|
|
20
|
+
previousAttempt = recall.invocationAttempt;
|
|
21
|
+
previousSteeringVersion = recall.steeringVersion;
|
|
22
|
+
previousCompletedChildCount = recall.completedChildCount;
|
|
23
|
+
if (!isMemoryRecallSettlementBound(state, root, recall, index))
|
|
24
|
+
return invalid;
|
|
25
|
+
pendingCount += recall.status === "pending" ? 1 : 0;
|
|
26
|
+
}
|
|
27
|
+
if (hasUnboundMemoryWait(state, pendingCount))
|
|
28
|
+
return invalid;
|
|
29
|
+
return [];
|
|
30
|
+
}
|
|
31
|
+
function isOrderedRootMemoryRecall(recall, root, index, previousAttempt, previousSteeringVersion, previousCompletedChildCount) {
|
|
32
|
+
if (!isRecord(recall))
|
|
33
|
+
return false;
|
|
34
|
+
if (!hasMemoryRecallIdentity(recall))
|
|
35
|
+
return false;
|
|
36
|
+
if (!exactKeys(recall, [
|
|
37
|
+
"recallId",
|
|
38
|
+
"completedChildCount",
|
|
39
|
+
"callId",
|
|
40
|
+
"invocationAttempt",
|
|
41
|
+
"steeringVersion",
|
|
42
|
+
"query",
|
|
43
|
+
"status",
|
|
44
|
+
], ["result"]))
|
|
45
|
+
return false;
|
|
46
|
+
if (recall.recallId !== `recall-${index + 1}`)
|
|
47
|
+
return false;
|
|
48
|
+
if (recall.callId !== root.callId)
|
|
49
|
+
return false;
|
|
50
|
+
if (root.roleId !== RUNTIME_ROOT_ROLE_ID)
|
|
51
|
+
return false;
|
|
52
|
+
if (root.parentCallId !== null)
|
|
53
|
+
return false;
|
|
54
|
+
if (recall.invocationAttempt <= previousAttempt)
|
|
55
|
+
return false;
|
|
56
|
+
if (recall.steeringVersion < previousSteeringVersion)
|
|
57
|
+
return false;
|
|
58
|
+
if (!hasOrderedMemoryRecallChildAnchor(recall.completedChildCount, root, previousCompletedChildCount))
|
|
59
|
+
return false;
|
|
60
|
+
if (!isBoundedMemoryRecallQuery(recall.query))
|
|
61
|
+
return false;
|
|
62
|
+
return recall.query === recall.query.trim();
|
|
63
|
+
}
|
|
64
|
+
function hasOrderedMemoryRecallChildAnchor(value, root, previousCompletedChildCount) {
|
|
65
|
+
if (typeof value !== "number")
|
|
66
|
+
return false;
|
|
67
|
+
if (!Number.isSafeInteger(value))
|
|
68
|
+
return false;
|
|
69
|
+
if (value < 0)
|
|
70
|
+
return false;
|
|
71
|
+
if (value < previousCompletedChildCount)
|
|
72
|
+
return false;
|
|
73
|
+
return value <= root.childCallIds.length;
|
|
74
|
+
}
|
|
75
|
+
function isMemoryRecallSettlementBound(state, root, recall, index) {
|
|
76
|
+
if (recall.status === "pending")
|
|
77
|
+
return isPendingMemoryRecallBound(state, root, recall, index);
|
|
78
|
+
if (recall.status !== "settled")
|
|
79
|
+
return false;
|
|
80
|
+
if (recall.invocationAttempt >= root.activationCount)
|
|
81
|
+
return false;
|
|
82
|
+
return normalizeRoleMemoryRecallResult(recall.result) !== undefined;
|
|
83
|
+
}
|
|
84
|
+
function isPendingMemoryRecallBound(state, root, recall, index) {
|
|
85
|
+
if (index !== state.memoryRecalls.length - 1)
|
|
86
|
+
return false;
|
|
87
|
+
if (recall.result !== undefined)
|
|
88
|
+
return false;
|
|
89
|
+
if (recall.invocationAttempt !== root.activationCount)
|
|
90
|
+
return false;
|
|
91
|
+
if (recall.completedChildCount !== root.childCallIds.length)
|
|
92
|
+
return false;
|
|
93
|
+
if (state.phase !== "running")
|
|
94
|
+
return false;
|
|
95
|
+
if (state.activeCallId !== root.callId)
|
|
96
|
+
return false;
|
|
97
|
+
return root.status === "waiting_for_memory";
|
|
98
|
+
}
|
|
99
|
+
export function hasSettledMemoryRecallActivationRange(state, callId, fromActivation, toActivation) {
|
|
100
|
+
if (toActivation < fromActivation)
|
|
101
|
+
return false;
|
|
102
|
+
const recalls = state.memoryRecalls.filter((recall) => isSettledMemoryRecallWithinRange(recall, callId, fromActivation, toActivation));
|
|
103
|
+
if (recalls.length !== toActivation - fromActivation)
|
|
104
|
+
return false;
|
|
105
|
+
return recalls.every((recall, index) => recall.invocationAttempt === fromActivation + index);
|
|
106
|
+
}
|
|
107
|
+
function isSettledMemoryRecallWithinRange(recall, callId, fromActivation, toActivation) {
|
|
108
|
+
if (recall.callId !== callId)
|
|
109
|
+
return false;
|
|
110
|
+
if (recall.status !== "settled")
|
|
111
|
+
return false;
|
|
112
|
+
if (recall.invocationAttempt < fromActivation)
|
|
113
|
+
return false;
|
|
114
|
+
return recall.invocationAttempt < toActivation;
|
|
115
|
+
}
|
|
116
|
+
function hasUnboundMemoryWait(state, pendingCount) {
|
|
117
|
+
const waitingCalls = state.calls.filter((call) => call.status === "waiting_for_memory");
|
|
118
|
+
if (waitingCalls.length !== pendingCount)
|
|
119
|
+
return true;
|
|
120
|
+
return waitingCalls.some((call) => call.callId !== state.rootCallId);
|
|
121
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { requireEffect } from "./transaction-effect.js";
|
|
2
|
+
export function createMemoryRecallTransactions(apply) {
|
|
3
|
+
return Object.freeze({
|
|
4
|
+
async beginMemoryRecall(input) {
|
|
5
|
+
return requireEffect(await apply({
|
|
6
|
+
expectedHead: input.expectedHead,
|
|
7
|
+
command: {
|
|
8
|
+
authority: "active_role",
|
|
9
|
+
type: "begin_memory_recall",
|
|
10
|
+
callId: input.callId,
|
|
11
|
+
invocationAttempt: input.invocationAttempt,
|
|
12
|
+
steeringVersion: input.steeringVersion,
|
|
13
|
+
query: input.query,
|
|
14
|
+
},
|
|
15
|
+
}), "memory_recall_begun", "memory_recall_transition_invalid", (effect) => matchesMemoryRecallIdentity(effect, input));
|
|
16
|
+
},
|
|
17
|
+
async settleMemoryRecall(input) {
|
|
18
|
+
return requireEffect(await apply({
|
|
19
|
+
expectedHead: input.expectedHead,
|
|
20
|
+
command: {
|
|
21
|
+
authority: "runtime",
|
|
22
|
+
type: "settle_memory_recall",
|
|
23
|
+
callId: input.callId,
|
|
24
|
+
invocationAttempt: input.invocationAttempt,
|
|
25
|
+
steeringVersion: input.steeringVersion,
|
|
26
|
+
recallId: input.recallId,
|
|
27
|
+
result: input.result,
|
|
28
|
+
},
|
|
29
|
+
}), "memory_recall_settled", "memory_recall_transition_invalid", (effect) => matchesMemoryRecallSettlement(effect, input));
|
|
30
|
+
},
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
function matchesMemoryRecallIdentity(effect, input) {
|
|
34
|
+
if (effect.callId !== input.callId)
|
|
35
|
+
return false;
|
|
36
|
+
if (effect.invocationAttempt !== input.invocationAttempt)
|
|
37
|
+
return false;
|
|
38
|
+
return effect.steeringVersion === input.steeringVersion;
|
|
39
|
+
}
|
|
40
|
+
function matchesMemoryRecallSettlement(effect, input) {
|
|
41
|
+
if (!matchesMemoryRecallIdentity(effect, input))
|
|
42
|
+
return false;
|
|
43
|
+
return effect.recallId === input.recallId;
|
|
44
|
+
}
|
|
@@ -22,6 +22,7 @@ export function createInitialRoleCallState(requestId) {
|
|
|
22
22
|
results: [],
|
|
23
23
|
plans: [],
|
|
24
24
|
capabilityExecutions: [],
|
|
25
|
+
memoryRecalls: [],
|
|
25
26
|
operationSupervision: createInitialRoleOperationSupervisionState(),
|
|
26
27
|
capabilitySelectionSupervision: createInitialRoleCapabilitySelectionSupervisionState(),
|
|
27
28
|
rootResponse: null,
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { RoleCallCommitEffect, RoleCallLedgerCommit, RoleCallLedgerCommitResult, RoleCallTransactionResult } from "./contracts.js";
|
|
2
|
+
export declare function requireEffect<TEffectType extends RoleCallCommitEffect["type"], TTransitionIssueCode extends string>(commit: RoleCallLedgerCommitResult, effectType: TEffectType, invalidEffectIssueCode: TTransitionIssueCode, validate: (effect: Extract<RoleCallCommitEffect, {
|
|
3
|
+
type: TEffectType;
|
|
4
|
+
}>) => boolean): RoleCallTransactionResult<TEffectType, TTransitionIssueCode>;
|
|
5
|
+
export declare function invalidEffect<TTransitionIssueCode extends string>(commit: RoleCallLedgerCommit, issueCode: TTransitionIssueCode): RoleCallTransactionResult<never, TTransitionIssueCode>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export function requireEffect(commit, effectType, invalidEffectIssueCode, validate) {
|
|
2
|
+
if (!commit.ok) {
|
|
3
|
+
return Object.freeze({ ok: false, issueCode: commit.code, commit });
|
|
4
|
+
}
|
|
5
|
+
if (commit.effect.type !== effectType)
|
|
6
|
+
return invalidEffect(commit, invalidEffectIssueCode);
|
|
7
|
+
const typedCommit = commit;
|
|
8
|
+
if (!validate(typedCommit.effect))
|
|
9
|
+
return invalidEffect(commit, invalidEffectIssueCode);
|
|
10
|
+
return Object.freeze({ ok: true, commit: typedCommit });
|
|
11
|
+
}
|
|
12
|
+
export function invalidEffect(commit, issueCode) {
|
|
13
|
+
return Object.freeze({ ok: false, issueCode, commit });
|
|
14
|
+
}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
+
import { createMemoryRecallTransactions } from "./memory-recall-transactions.js";
|
|
2
|
+
import { requireEffect, invalidEffect } from "./transaction-effect.js";
|
|
1
3
|
export function createRoleCallTransactions(apply) {
|
|
2
4
|
return Object.freeze({
|
|
5
|
+
...createMemoryRecallTransactions(apply),
|
|
3
6
|
async createRoot(input) {
|
|
4
7
|
return requireEffect(await apply({
|
|
5
8
|
expectedHead: input.expectedHead,
|
|
@@ -223,30 +226,6 @@ function createSettleCapabilityExecutionCommand(input) {
|
|
|
223
226
|
...(input.references ? { references: input.references } : {}),
|
|
224
227
|
};
|
|
225
228
|
}
|
|
226
|
-
function requireEffect(commit, effectType, invalidEffectIssueCode, validate) {
|
|
227
|
-
if (!commit.ok) {
|
|
228
|
-
return Object.freeze({
|
|
229
|
-
ok: false,
|
|
230
|
-
issueCode: commit.code,
|
|
231
|
-
commit,
|
|
232
|
-
});
|
|
233
|
-
}
|
|
234
|
-
if (commit.effect.type !== effectType) {
|
|
235
|
-
return invalidEffect(commit, invalidEffectIssueCode);
|
|
236
|
-
}
|
|
237
|
-
const typedCommit = commit;
|
|
238
|
-
if (!validate(typedCommit.effect)) {
|
|
239
|
-
return invalidEffect(commit, invalidEffectIssueCode);
|
|
240
|
-
}
|
|
241
|
-
return Object.freeze({ ok: true, commit: typedCommit });
|
|
242
|
-
}
|
|
243
|
-
function invalidEffect(commit, issueCode) {
|
|
244
|
-
return Object.freeze({
|
|
245
|
-
ok: false,
|
|
246
|
-
issueCode,
|
|
247
|
-
commit,
|
|
248
|
-
});
|
|
249
|
-
}
|
|
250
229
|
function sameStrings(left, right) {
|
|
251
230
|
return (left.length === right.length &&
|
|
252
231
|
left.every((value, index) => value === right[index]));
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { isToolCatalogGroupId } from "../../capabilities/tool-types.js";
|
|
2
|
+
import { parseEventResultMetadata } from "../../capabilities/tool-definition-validator/event-result-metadata.js";
|
|
2
3
|
import { ABOT_RUNTIME_EXTENSION, ABOT_RUNTIME_EXTENSION_VERSION, AGENT_PLUGIN_MANIFEST_SCHEMA, } from "../../plugin-contract/manifest.js";
|
|
3
4
|
const PLUGIN_NAME_PATTERN = /^(?!.*(?:--|\.\.))[a-z0-9][a-z0-9.-]{0,62}[a-z0-9]$|^[a-z0-9]$/u;
|
|
4
5
|
const SECRET_ENV_PATTERN = /^[A-Z][A-Z0-9_]*$/u;
|
|
@@ -179,7 +180,8 @@ function parseEventPresentation(value, path) {
|
|
|
179
180
|
if (value === undefined)
|
|
180
181
|
return undefined;
|
|
181
182
|
const presentation = expectRecord(value, path);
|
|
182
|
-
rejectUnknownKeys(presentation, ["metadata", "lifecycle"], path);
|
|
183
|
+
rejectUnknownKeys(presentation, ["metadata", "lifecycle", "resultMetadata"], path);
|
|
184
|
+
const resultMetadata = parseEventResultMetadata(presentation.resultMetadata, `${path}.resultMetadata`);
|
|
183
185
|
const metadata = expectRecord(presentation.metadata, `${path}.metadata`);
|
|
184
186
|
const lifecycle = presentation.lifecycle;
|
|
185
187
|
if (lifecycle !== undefined && !isRecord(lifecycle)) {
|
|
@@ -232,6 +234,7 @@ function parseEventPresentation(value, path) {
|
|
|
232
234
|
},
|
|
233
235
|
];
|
|
234
236
|
})),
|
|
237
|
+
...(resultMetadata ? { resultMetadata } : {}),
|
|
235
238
|
...(parsedLifecycle && Object.keys(parsedLifecycle).length > 0
|
|
236
239
|
? { lifecycle: parsedLifecycle }
|
|
237
240
|
: {}),
|