@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
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { resolveModelSelection } from "../../model/model-selection.js";
|
|
2
|
+
export function requireAvailableScheduleModel(config, modelProfileId) {
|
|
3
|
+
if (typeof modelProfileId !== "string") {
|
|
4
|
+
throw new Error("scheduler_model_required");
|
|
5
|
+
}
|
|
6
|
+
const selection = resolveModelSelection({
|
|
7
|
+
agentMode: "reasoning",
|
|
8
|
+
modelPreference: { profileId: modelProfileId },
|
|
9
|
+
modelPolicy: config.models,
|
|
10
|
+
});
|
|
11
|
+
const isSelectedScheduleModel = selection.execution.primaryProfileId === modelProfileId;
|
|
12
|
+
if (!isSelectedScheduleModel) {
|
|
13
|
+
throw new Error("scheduler_model_unavailable");
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { scheduleCreateOperations } from "./create-operations.js";
|
|
2
|
+
import { scheduleUpdateOperations } from "./update-operations.js";
|
|
3
|
+
import { scheduleTextField as text } from "./tool-input-properties.js";
|
|
4
|
+
const identity = { jobId: text(200) };
|
|
5
|
+
function operation(operationId, summary, properties, required, effect) {
|
|
6
|
+
return {
|
|
7
|
+
operationId,
|
|
8
|
+
summary,
|
|
9
|
+
effect,
|
|
10
|
+
approval: "request_policy",
|
|
11
|
+
fixedParams: { action: operationId },
|
|
12
|
+
input: {
|
|
13
|
+
type: "object",
|
|
14
|
+
additionalProperties: false,
|
|
15
|
+
properties,
|
|
16
|
+
required,
|
|
17
|
+
},
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
export const schedulingToolContract = {
|
|
21
|
+
version: 1,
|
|
22
|
+
operations: [
|
|
23
|
+
...scheduleCreateOperations,
|
|
24
|
+
operation("list", "List this conversation's schedules newest first, without executing them or exposing their task prompts. Each page has up to 100 Jobs; pass its nextCursor to retrieve the next page until null. A stale cursor requires a fresh list without cursor.", {
|
|
25
|
+
cursor: text(200),
|
|
26
|
+
limit: { type: "integer", minimum: 1, maximum: 100 },
|
|
27
|
+
}, [], "read_only"),
|
|
28
|
+
operation("get", "Read this conversation's Job and recent run history by exact Job ID.", identity, ["jobId"], "read_only"),
|
|
29
|
+
...scheduleUpdateOperations,
|
|
30
|
+
operation("pause", "Pause future starts of this Job, including its pending occurrence. An already-started run continues.", identity, ["jobId"], "mutating"),
|
|
31
|
+
operation("resume", "Resume this paused Job from its next future occurrence, without backfill.", identity, ["jobId"], "mutating"),
|
|
32
|
+
operation("cancel", "Cancel this Job and its pending occurrence. An already-started run continues.", identity, ["jobId"], "mutating"),
|
|
33
|
+
operation("run_now", "Request one immediate run of this Job; wait if this conversation is busy. Does not change its ordinary recurrence.", identity, ["jobId"], "mutating"),
|
|
34
|
+
],
|
|
35
|
+
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { ToolNormalInvocationPropertyInput } from "../../../capabilities/tool-types.js";
|
|
2
|
+
export declare const scheduleTextField: (maxLength: number) => ToolNormalInvocationPropertyInput;
|
|
3
|
+
export declare const scheduleTimingProperties: {
|
|
4
|
+
scheduleKind: {
|
|
5
|
+
type: "string";
|
|
6
|
+
enum: string[];
|
|
7
|
+
};
|
|
8
|
+
at: ToolNormalInvocationPropertyInput;
|
|
9
|
+
delayMs: {
|
|
10
|
+
type: "integer";
|
|
11
|
+
minimum: number;
|
|
12
|
+
maximum: number;
|
|
13
|
+
};
|
|
14
|
+
everyMs: {
|
|
15
|
+
type: "integer";
|
|
16
|
+
minimum: number;
|
|
17
|
+
maximum: number;
|
|
18
|
+
};
|
|
19
|
+
anchorAt: ToolNormalInvocationPropertyInput;
|
|
20
|
+
weekdays: {
|
|
21
|
+
type: "array";
|
|
22
|
+
items: {
|
|
23
|
+
type: "integer";
|
|
24
|
+
minimum: number;
|
|
25
|
+
maximum: number;
|
|
26
|
+
};
|
|
27
|
+
minItems: number;
|
|
28
|
+
maxItems: number;
|
|
29
|
+
};
|
|
30
|
+
dayOfMonth: {
|
|
31
|
+
type: "integer";
|
|
32
|
+
minimum: number;
|
|
33
|
+
maximum: number;
|
|
34
|
+
};
|
|
35
|
+
timeZone: ToolNormalInvocationPropertyInput;
|
|
36
|
+
};
|
|
37
|
+
export declare const scheduleDetailProperties: {
|
|
38
|
+
title: ToolNormalInvocationPropertyInput;
|
|
39
|
+
prompt: {
|
|
40
|
+
type: "string";
|
|
41
|
+
minLength: number;
|
|
42
|
+
};
|
|
43
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export const scheduleTextField = (maxLength) => ({
|
|
2
|
+
type: "string",
|
|
3
|
+
minLength: 1,
|
|
4
|
+
maxLength,
|
|
5
|
+
});
|
|
6
|
+
export const scheduleTimingProperties = {
|
|
7
|
+
scheduleKind: {
|
|
8
|
+
type: "string",
|
|
9
|
+
enum: ["timer", "once", "interval", "daily", "weekly", "monthly"],
|
|
10
|
+
},
|
|
11
|
+
at: scheduleTextField(64),
|
|
12
|
+
delayMs: { type: "integer", minimum: 1_000, maximum: 31_536_000_000 },
|
|
13
|
+
everyMs: { type: "integer", minimum: 1_000, maximum: 31_536_000_000 },
|
|
14
|
+
anchorAt: scheduleTextField(64),
|
|
15
|
+
weekdays: {
|
|
16
|
+
type: "array",
|
|
17
|
+
items: { type: "integer", minimum: 0, maximum: 6 },
|
|
18
|
+
minItems: 1,
|
|
19
|
+
maxItems: 7,
|
|
20
|
+
},
|
|
21
|
+
dayOfMonth: { type: "integer", minimum: 1, maximum: 31 },
|
|
22
|
+
timeZone: scheduleTextField(100),
|
|
23
|
+
};
|
|
24
|
+
export const scheduleDetailProperties = {
|
|
25
|
+
title: scheduleTextField(200),
|
|
26
|
+
prompt: { type: "string", minLength: 1 },
|
|
27
|
+
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { ToolModuleDeclaration } from "../../../capabilities/tool-types.js";
|
|
2
|
+
import type { RuntimeConfig } from "../../ports.js";
|
|
3
|
+
import type { SchedulerService } from "../../scheduler/contracts.js";
|
|
4
|
+
export declare function createSchedulingToolModule(service: SchedulerService, config: RuntimeConfig, ready: () => Promise<void>): ToolModuleDeclaration;
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import { resolveModelSelection } from "../../model/model-selection.js";
|
|
2
|
+
import { requireCreateCalendarTimeZone } from "./create-time-zone.js";
|
|
3
|
+
import { requireAvailableScheduleModel } from "./model-validation.js";
|
|
4
|
+
import { schedulingToolContract } from "./tool-contract.js";
|
|
5
|
+
import { createSchedulerJobPage } from "./job-list-page.js";
|
|
6
|
+
function requireText(value, field) {
|
|
7
|
+
if (typeof value !== "string")
|
|
8
|
+
throw new Error(`schedule_${field}_required`);
|
|
9
|
+
if (!value.trim())
|
|
10
|
+
throw new Error(`schedule_${field}_required`);
|
|
11
|
+
return value.trim();
|
|
12
|
+
}
|
|
13
|
+
function scheduleInput(params) {
|
|
14
|
+
const kind = params.scheduleKind;
|
|
15
|
+
if (kind === "timer")
|
|
16
|
+
return { kind, delayMs: Number(params.delayMs) };
|
|
17
|
+
if (kind === "once")
|
|
18
|
+
return { kind, at: requireText(params.at, "exact_time") };
|
|
19
|
+
if (kind === "interval")
|
|
20
|
+
return {
|
|
21
|
+
kind,
|
|
22
|
+
everyMs: Number(params.everyMs),
|
|
23
|
+
...(params.anchorAt
|
|
24
|
+
? { anchorAt: requireText(params.anchorAt, "anchor_time") }
|
|
25
|
+
: {}),
|
|
26
|
+
};
|
|
27
|
+
if (kind === "daily")
|
|
28
|
+
return { kind, at: requireText(params.at, "exact_time") };
|
|
29
|
+
if (kind === "weekly")
|
|
30
|
+
return {
|
|
31
|
+
kind,
|
|
32
|
+
at: requireText(params.at, "exact_time"),
|
|
33
|
+
weekdays: Array.isArray(params.weekdays)
|
|
34
|
+
? params.weekdays.map(Number)
|
|
35
|
+
: [],
|
|
36
|
+
};
|
|
37
|
+
if (kind === "monthly")
|
|
38
|
+
return {
|
|
39
|
+
kind,
|
|
40
|
+
at: requireText(params.at, "exact_time"),
|
|
41
|
+
dayOfMonth: Number(params.dayOfMonth),
|
|
42
|
+
};
|
|
43
|
+
throw new Error("schedule_kind_required");
|
|
44
|
+
}
|
|
45
|
+
function updateInput(params, config) {
|
|
46
|
+
if (params.modelProfileId !== undefined) {
|
|
47
|
+
requireAvailableScheduleModel(config, params.modelProfileId);
|
|
48
|
+
}
|
|
49
|
+
return {
|
|
50
|
+
...(params.title !== undefined
|
|
51
|
+
? { title: requireText(params.title, "title") }
|
|
52
|
+
: {}),
|
|
53
|
+
...(params.prompt !== undefined
|
|
54
|
+
? { prompt: requireText(params.prompt, "prompt") }
|
|
55
|
+
: {}),
|
|
56
|
+
...(params.modelProfileId !== undefined
|
|
57
|
+
? { modelProfileId: requireText(params.modelProfileId, "model") }
|
|
58
|
+
: {}),
|
|
59
|
+
...(params.agentMode !== undefined
|
|
60
|
+
? { agentMode: params.agentMode }
|
|
61
|
+
: {}),
|
|
62
|
+
...(params.timeZone !== undefined
|
|
63
|
+
? { timeZone: requireText(params.timeZone, "time_zone") }
|
|
64
|
+
: {}),
|
|
65
|
+
...(params.scheduleKind !== undefined
|
|
66
|
+
? { schedule: scheduleInput(params) }
|
|
67
|
+
: {}),
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
export function createSchedulingToolModule(service, config, ready) {
|
|
71
|
+
async function execute(params, context) {
|
|
72
|
+
await ready();
|
|
73
|
+
context?.abortSignal?.throwIfAborted();
|
|
74
|
+
const sessionId = requireText(context?.sharedState?.currentSessionId, "session");
|
|
75
|
+
const action = requireText(params.action, "action");
|
|
76
|
+
if (action === "list") {
|
|
77
|
+
const jobs = await service.list({ sessionId });
|
|
78
|
+
return createSchedulerJobPage(jobs, params);
|
|
79
|
+
}
|
|
80
|
+
if (action === "create") {
|
|
81
|
+
requireCreateCalendarTimeZone(params);
|
|
82
|
+
const request = context?.sharedState?.requestContext;
|
|
83
|
+
const selection = resolveModelSelection({
|
|
84
|
+
agentMode: request?.agentMode,
|
|
85
|
+
modelPreference: request?.modelPreference,
|
|
86
|
+
modelPolicy: config.models,
|
|
87
|
+
});
|
|
88
|
+
return service.create({
|
|
89
|
+
sessionId,
|
|
90
|
+
title: requireText(params.title, "title"),
|
|
91
|
+
prompt: requireText(params.prompt, "prompt"),
|
|
92
|
+
modelProfileId: requireText(selection.execution.primaryProfileId, "model"),
|
|
93
|
+
agentMode: selection.agentMode,
|
|
94
|
+
timeZone: params.timeZone
|
|
95
|
+
? requireText(params.timeZone, "time_zone")
|
|
96
|
+
: Intl.DateTimeFormat().resolvedOptions().timeZone,
|
|
97
|
+
schedule: scheduleInput(params),
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
const id = requireText(params.jobId, "job_id");
|
|
101
|
+
const job = await service.get(id);
|
|
102
|
+
if (!job)
|
|
103
|
+
throw new Error("schedule_job_not_found");
|
|
104
|
+
if (job.sessionId !== sessionId)
|
|
105
|
+
throw new Error("schedule_job_not_found");
|
|
106
|
+
if (action === "get")
|
|
107
|
+
return {
|
|
108
|
+
job,
|
|
109
|
+
runs: [...(await service.listRuns(id, { limit: 20 }))].reverse(),
|
|
110
|
+
};
|
|
111
|
+
if (action === "update")
|
|
112
|
+
return service.update(id, updateInput(params, config));
|
|
113
|
+
if (action === "pause")
|
|
114
|
+
return service.pause(id);
|
|
115
|
+
if (action === "resume")
|
|
116
|
+
return service.resume(id);
|
|
117
|
+
if (action === "cancel")
|
|
118
|
+
return service.cancel(id);
|
|
119
|
+
if (action === "run_now")
|
|
120
|
+
return service.runNow(id);
|
|
121
|
+
throw new Error("schedule_action_unknown");
|
|
122
|
+
}
|
|
123
|
+
return {
|
|
124
|
+
definition: {
|
|
125
|
+
name: "schedules",
|
|
126
|
+
description: "Core local schedules for the current conversation: create, inspect, edit, pause, resume, cancel and run now. Scheduled requests run with FULL permissions using their saved model.",
|
|
127
|
+
routingCapability: "semantic_mutation",
|
|
128
|
+
catalogGroups: ["scheduling"],
|
|
129
|
+
developmentRoles: ["auxiliary"],
|
|
130
|
+
controlsRefinement: "mechanical_when_complete",
|
|
131
|
+
},
|
|
132
|
+
normalInvocation: schedulingToolContract,
|
|
133
|
+
async implementation(params, context) {
|
|
134
|
+
try {
|
|
135
|
+
const result = await execute(params, context);
|
|
136
|
+
const isScheduleMutation = params.action !== "list" && params.action !== "get";
|
|
137
|
+
return {
|
|
138
|
+
ok: true,
|
|
139
|
+
output: JSON.stringify(result),
|
|
140
|
+
producedNewInformation: true,
|
|
141
|
+
data: {
|
|
142
|
+
mutationEvidence: isScheduleMutation,
|
|
143
|
+
currentStateEvidence: true,
|
|
144
|
+
},
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
catch (error) {
|
|
148
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
149
|
+
return {
|
|
150
|
+
ok: false,
|
|
151
|
+
output: message,
|
|
152
|
+
error: message,
|
|
153
|
+
producedNewInformation: false,
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
},
|
|
157
|
+
};
|
|
158
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { scheduleDetailProperties, scheduleTextField, scheduleTimingProperties, } from "./tool-input-properties.js";
|
|
2
|
+
const editableJobProperties = {
|
|
3
|
+
jobId: scheduleTextField(200),
|
|
4
|
+
...scheduleDetailProperties,
|
|
5
|
+
modelProfileId: scheduleTextField(200),
|
|
6
|
+
agentMode: { type: "string", enum: ["fast", "reasoning", "deep"] },
|
|
7
|
+
timeZone: scheduleTimingProperties.timeZone,
|
|
8
|
+
};
|
|
9
|
+
function updateScheduleOperation(kind, timingSummary, timingFields, requiredTiming = timingFields) {
|
|
10
|
+
return {
|
|
11
|
+
operationId: `update_${kind}`,
|
|
12
|
+
summary: `Replace this conversation's Job recurrence. Ask for missing timing details before updating. Omit timeZone, modelProfileId and agentMode to retain saved settings. ${timingSummary}`,
|
|
13
|
+
effect: "mutating",
|
|
14
|
+
approval: "request_policy",
|
|
15
|
+
fixedParams: { action: "update", scheduleKind: kind },
|
|
16
|
+
input: {
|
|
17
|
+
type: "object",
|
|
18
|
+
additionalProperties: false,
|
|
19
|
+
properties: {
|
|
20
|
+
...editableJobProperties,
|
|
21
|
+
...Object.fromEntries(timingFields.map((field) => [field, scheduleTimingProperties[field]])),
|
|
22
|
+
},
|
|
23
|
+
required: ["jobId", ...requiredTiming],
|
|
24
|
+
},
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
export const scheduleUpdateOperations = [
|
|
28
|
+
{
|
|
29
|
+
operationId: "update",
|
|
30
|
+
summary: "Edit a Job's title, prompt, model, mode or time zone in this conversation while retaining its recurrence. Choose a kind-specific update operation to replace timing. modelProfileId must identify an available configured model; omitted settings keep their saved values.",
|
|
31
|
+
effect: "mutating",
|
|
32
|
+
approval: "request_policy",
|
|
33
|
+
fixedParams: { action: "update" },
|
|
34
|
+
input: {
|
|
35
|
+
type: "object",
|
|
36
|
+
additionalProperties: false,
|
|
37
|
+
properties: editableJobProperties,
|
|
38
|
+
required: ["jobId"],
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
updateScheduleOperation("timer", "Run once after delayMs milliseconds.", [
|
|
42
|
+
"delayMs",
|
|
43
|
+
]),
|
|
44
|
+
updateScheduleOperation("once", "Run once at an exact ISO instant in at, including its UTC offset.", ["at"]),
|
|
45
|
+
updateScheduleOperation("interval", "Repeat everyMs milliseconds with optional exact first-run anchorAt ISO instant.", ["everyMs", "anchorAt"], ["everyMs"]),
|
|
46
|
+
updateScheduleOperation("daily", "Run daily at exact HH:mm in at.", ["at"]),
|
|
47
|
+
updateScheduleOperation("weekly", "Run on weekdays (Sunday=0) at exact HH:mm in at.", ["at", "weekdays"]),
|
|
48
|
+
updateScheduleOperation("monthly", "Run on dayOfMonth at exact HH:mm in at.", ["at", "dayOfMonth"]),
|
|
49
|
+
];
|
|
@@ -2,8 +2,11 @@ import type WebSocket from "ws";
|
|
|
2
2
|
import type { EventSinkFactory, ModelGatewayClient, RuntimeConfig, RuntimeHost, SessionStore, ToolRegistry } from "./ports.js";
|
|
3
3
|
import type { RuntimeAttachmentStore } from "./attachments/store.js";
|
|
4
4
|
import type { RequestHandlerOptions, RunRequestMessage } from "./request/contracts.js";
|
|
5
|
-
import {
|
|
5
|
+
import type { SessionMemoryCompactor } from "./context/session-memory/index.js";
|
|
6
6
|
import type { LongTermMemoryService } from "./long-term-memory/contracts.js";
|
|
7
|
+
import type { SchedulerRun, SchedulerService } from "./scheduler/contracts.js";
|
|
8
|
+
import { SessionRequestAdmission } from "./request/session-admission.js";
|
|
9
|
+
import type { RequestSteeringAppendResult } from "./request/request-steering.js";
|
|
7
10
|
export type RuntimeEnvironmentServices = Readonly<{
|
|
8
11
|
config: RuntimeConfig;
|
|
9
12
|
sessions: SessionStore;
|
|
@@ -13,15 +16,26 @@ export type RuntimeEnvironmentServices = Readonly<{
|
|
|
13
16
|
events: EventSinkFactory;
|
|
14
17
|
sessionMemoryCompactor: SessionMemoryCompactor;
|
|
15
18
|
longTermMemory: LongTermMemoryService;
|
|
19
|
+
scheduler?: SchedulerService;
|
|
20
|
+
startScheduler?: () => Promise<void>;
|
|
21
|
+
stopScheduler?: () => Promise<void>;
|
|
22
|
+
requestAdmission?: SessionRequestAdmission;
|
|
16
23
|
}>;
|
|
17
24
|
export type RuntimeRequestOptions = Pick<RequestHandlerOptions, "toolApprovalController" | "requestSteering">;
|
|
18
25
|
export type RuntimeRequestHandler = Readonly<{
|
|
26
|
+
steer?: (requestId: string, input: Readonly<{
|
|
27
|
+
steerId: string;
|
|
28
|
+
text: string;
|
|
29
|
+
}>) => Promise<RequestSteeringAppendResult>;
|
|
19
30
|
handle: (ws: WebSocket, message: RunRequestMessage, options?: RuntimeRequestOptions) => Promise<void>;
|
|
20
31
|
}>;
|
|
21
32
|
export type RuntimeApplication = Readonly<{
|
|
22
33
|
services: RuntimeEnvironmentServices;
|
|
23
34
|
host: RuntimeHost;
|
|
24
35
|
requests: RuntimeRequestHandler;
|
|
36
|
+
start: () => Promise<void>;
|
|
37
|
+
stop: () => Promise<void>;
|
|
38
|
+
subscribeScheduledEvents: (listener: (event: Record<string, unknown>) => void) => () => void;
|
|
25
39
|
}>;
|
|
26
40
|
export type RuntimeDependencies = {
|
|
27
41
|
config: RuntimeConfig;
|
|
@@ -33,9 +47,15 @@ export type RuntimeDependencies = {
|
|
|
33
47
|
events: EventSinkFactory;
|
|
34
48
|
sessionMemoryCompactor: SessionMemoryCompactor;
|
|
35
49
|
longTermMemory: LongTermMemoryService;
|
|
50
|
+
scheduler?: SchedulerService;
|
|
51
|
+
startScheduler?: () => Promise<void>;
|
|
52
|
+
stopScheduler?: () => Promise<void>;
|
|
53
|
+
requestAdmission?: SessionRequestAdmission;
|
|
54
|
+
};
|
|
55
|
+
export type RuntimeDependencyOverrides = Partial<Omit<RuntimeDependencies, "config" | "scheduler" | "startScheduler" | "stopScheduler" | "requestAdmission">>;
|
|
56
|
+
export type RuntimeApplicationOverrides = RuntimeDependencyOverrides & {
|
|
57
|
+
scheduledRequestOptions?: (run: SchedulerRun) => RuntimeRequestOptions;
|
|
36
58
|
};
|
|
37
|
-
export type RuntimeDependencyOverrides = Partial<Omit<RuntimeDependencies, "config">>;
|
|
38
|
-
export type RuntimeApplicationOverrides = RuntimeDependencyOverrides;
|
|
39
59
|
export declare function createRuntimeApplication(config?: RuntimeConfig, overrides?: RuntimeApplicationOverrides): RuntimeApplication;
|
|
40
60
|
export declare function createRuntimeRequestHandler(services: RuntimeEnvironmentServices): RuntimeRequestHandler;
|
|
41
61
|
export declare function createDefaultRuntimeDependencies(config?: RuntimeConfig, overrides?: RuntimeDependencyOverrides): RuntimeDependencies;
|
|
@@ -1,21 +1,9 @@
|
|
|
1
|
-
import { createBoundRuntimeRequestHandler,
|
|
1
|
+
import { createBoundRuntimeRequestHandler, createDefaultRuntimeHost, } from "./default-adapters.js";
|
|
2
|
+
import { createRuntimeEnvironment } from "./runtime-environment.js";
|
|
2
3
|
import { loadRuntimeConfig } from "./config.js";
|
|
3
|
-
import { createModelSessionMemoryCompactor, } from "./context/session-memory/index.js";
|
|
4
4
|
export function createRuntimeApplication(config = loadRuntimeConfig(), overrides = {}) {
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const services = Object.freeze({
|
|
8
|
-
config,
|
|
9
|
-
sessions: overrides.sessions ?? createDefaultSessionStore(config),
|
|
10
|
-
attachments: overrides.attachments ?? createDefaultAttachmentStore(config),
|
|
11
|
-
tools,
|
|
12
|
-
models,
|
|
13
|
-
events: overrides.events ?? createDefaultEventSinkFactory(config),
|
|
14
|
-
sessionMemoryCompactor: overrides.sessionMemoryCompactor ?? createModelSessionMemoryCompactor(),
|
|
15
|
-
longTermMemory: overrides.longTermMemory ??
|
|
16
|
-
createDefaultLongTermMemoryService(config, models),
|
|
17
|
-
});
|
|
18
|
-
const requests = createRuntimeRequestHandler(services);
|
|
5
|
+
const environment = createRuntimeEnvironment(config, overrides);
|
|
6
|
+
const { services, requests } = environment;
|
|
19
7
|
const host = overrides.host ??
|
|
20
8
|
createDefaultRuntimeHost(config, {
|
|
21
9
|
runtimeId: config.runtimeId,
|
|
@@ -25,7 +13,14 @@ export function createRuntimeApplication(config = loadRuntimeConfig(), overrides
|
|
|
25
13
|
requestHandler: requests,
|
|
26
14
|
requestHandlerFactory: createRuntimeRequestHandler,
|
|
27
15
|
});
|
|
28
|
-
return Object.freeze({
|
|
16
|
+
return Object.freeze({
|
|
17
|
+
services,
|
|
18
|
+
host,
|
|
19
|
+
requests,
|
|
20
|
+
start: environment.start,
|
|
21
|
+
stop: environment.stop,
|
|
22
|
+
subscribeScheduledEvents: environment.subscribeScheduledEvents,
|
|
23
|
+
});
|
|
29
24
|
}
|
|
30
25
|
export function createRuntimeRequestHandler(services) {
|
|
31
26
|
return createBoundRuntimeRequestHandler(services);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { RuntimeEnvironmentProfileSelection } from "./environment.js";
|
|
2
|
+
import type { RuntimeConfigFile, RuntimeConfigOptions } from "./types.js";
|
|
3
|
+
/** Resolves inherited bases once so every environment-owned adapter shares the namespace. */
|
|
4
|
+
export declare function resolveEnvironmentRuntimeDirectory(params: {
|
|
5
|
+
rootDir: string;
|
|
6
|
+
env: RuntimeConfigOptions["env"];
|
|
7
|
+
config: RuntimeConfigFile;
|
|
8
|
+
configPath: string;
|
|
9
|
+
selection: RuntimeEnvironmentProfileSelection;
|
|
10
|
+
}): string;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
import { requireLegacyRuntimeStorageAssignment } from "./environment-storage.js";
|
|
4
|
+
import { DEFAULT_RUNTIME_STATE_DIR } from "./layout.js";
|
|
5
|
+
import { readFirstString, readNestedConfigString, resolveRuntimePath, } from "./utils.js";
|
|
6
|
+
/** Resolves inherited bases once so every environment-owned adapter shares the namespace. */
|
|
7
|
+
export function resolveEnvironmentRuntimeDirectory(params) {
|
|
8
|
+
const override = readFirstString(params.env ?? {}, ["LLM_RUNTIME_DIR"]);
|
|
9
|
+
const profileDirectory = readNestedConfigString(params.selection.profilePaths, "runtimeDir");
|
|
10
|
+
const baseDirectory = readNestedConfigString(params.selection.basePaths, "runtimeDir");
|
|
11
|
+
const directory = resolveRuntimePath(params.rootDir, override ?? profileDirectory ?? baseDirectory ?? DEFAULT_RUNTIME_STATE_DIR);
|
|
12
|
+
if (!params.selection.profileId)
|
|
13
|
+
return directory;
|
|
14
|
+
if (usesExplicitEnvironmentDirectory(override, profileDirectory))
|
|
15
|
+
return directory;
|
|
16
|
+
requireLegacyRuntimeStorageAssignment({
|
|
17
|
+
rootDir: params.rootDir,
|
|
18
|
+
baseDir: directory,
|
|
19
|
+
config: params.config,
|
|
20
|
+
configPath: params.configPath,
|
|
21
|
+
environmentOverride: override !== undefined,
|
|
22
|
+
});
|
|
23
|
+
// Hash only the stable ID: safe for arbitrary IDs and case-insensitive filesystems.
|
|
24
|
+
const namespace = createHash("sha256")
|
|
25
|
+
.update(params.selection.profileId)
|
|
26
|
+
.digest("hex");
|
|
27
|
+
return join(directory, "environments", namespace);
|
|
28
|
+
}
|
|
29
|
+
function usesExplicitEnvironmentDirectory(override, profileDirectory) {
|
|
30
|
+
return override === undefined && profileDirectory !== undefined;
|
|
31
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { RuntimeConfigFile } from "./types.js";
|
|
2
|
+
/** Old shared state has no complete environment attribution; never move or hide it. */
|
|
3
|
+
export declare function requireLegacyRuntimeStorageAssignment(params: {
|
|
4
|
+
rootDir: string;
|
|
5
|
+
baseDir: string;
|
|
6
|
+
config: RuntimeConfigFile;
|
|
7
|
+
configPath: string;
|
|
8
|
+
environmentOverride: boolean;
|
|
9
|
+
}): void;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { lstatSync, readdirSync } from "node:fs";
|
|
2
|
+
import { join, resolve } from "node:path";
|
|
3
|
+
import { isRecord, readNestedConfigString } from "./utils.js";
|
|
4
|
+
import { RuntimeConfigValidationError } from "./validation/runtime-config-validation-contract.js";
|
|
5
|
+
const LEGACY_RUNTIME_DIRECTORIES = [
|
|
6
|
+
"scheduler",
|
|
7
|
+
"sessions",
|
|
8
|
+
"attachments",
|
|
9
|
+
"long-term-memory",
|
|
10
|
+
"plugins",
|
|
11
|
+
"memory",
|
|
12
|
+
"logs",
|
|
13
|
+
"local-host",
|
|
14
|
+
];
|
|
15
|
+
/** Old shared state has no complete environment attribution; never move or hide it. */
|
|
16
|
+
export function requireLegacyRuntimeStorageAssignment(params) {
|
|
17
|
+
const populated = LEGACY_RUNTIME_DIRECTORIES.filter((directory) => hasStoredEntries(join(params.baseDir, directory)));
|
|
18
|
+
if (populated.length === 0)
|
|
19
|
+
return;
|
|
20
|
+
if (hasExplicitLegacyOwner(params))
|
|
21
|
+
return;
|
|
22
|
+
throw new RuntimeConfigValidationError(params.configPath, [
|
|
23
|
+
`runtime_environment_storage_assignment_required: Existing runtime state at ${params.baseDir} (${populated.join(", ")}) needs an explicit environment owner. Set exactly one environment.profiles.<id>.paths.runtimeDir to this directory, preserving any explicit session, attachment and trace paths. Remove a shared LLM_RUNTIME_DIR override before assigning ownership. No data was moved and no new environment directory was created.`,
|
|
24
|
+
]);
|
|
25
|
+
}
|
|
26
|
+
function hasStoredEntries(path) {
|
|
27
|
+
try {
|
|
28
|
+
const entry = lstatSync(path);
|
|
29
|
+
if (!entry.isDirectory())
|
|
30
|
+
return true;
|
|
31
|
+
return readdirSync(path).length > 0;
|
|
32
|
+
}
|
|
33
|
+
catch (error) {
|
|
34
|
+
if (isMissingPath(error))
|
|
35
|
+
return false;
|
|
36
|
+
throw error;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
function isMissingPath(error) {
|
|
40
|
+
return isRecord(error) && error.code === "ENOENT";
|
|
41
|
+
}
|
|
42
|
+
function hasExplicitLegacyOwner(params) {
|
|
43
|
+
if (params.environmentOverride)
|
|
44
|
+
return false;
|
|
45
|
+
if (!isRecord(params.config.environment))
|
|
46
|
+
return false;
|
|
47
|
+
const profiles = params.config.environment.profiles;
|
|
48
|
+
if (!isRecord(profiles))
|
|
49
|
+
return false;
|
|
50
|
+
const owners = Object.values(profiles).filter((profile) => {
|
|
51
|
+
if (!isRecord(profile))
|
|
52
|
+
return false;
|
|
53
|
+
const path = readNestedConfigString(profile.paths, "runtimeDir");
|
|
54
|
+
if (!path)
|
|
55
|
+
return false;
|
|
56
|
+
return sameRuntimeDirectory(resolve(params.rootDir, path), params.baseDir);
|
|
57
|
+
});
|
|
58
|
+
return owners.length === 1;
|
|
59
|
+
}
|
|
60
|
+
function sameRuntimeDirectory(left, right) {
|
|
61
|
+
if (process.platform === "win32") {
|
|
62
|
+
return resolve(left).toLowerCase() === resolve(right).toLowerCase();
|
|
63
|
+
}
|
|
64
|
+
return resolve(left) === resolve(right);
|
|
65
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { DEFAULT_MEMORY_RECALL_CALL_LIMIT } from "../long-term-memory/recall-policy.js";
|
|
1
2
|
import { DEFAULT_MODEL_GATEWAY_URL } from "../../shared/constants.js";
|
|
2
3
|
import { DEFAULT_RUNTIME_AGENT_BRIDGE_URL, DEFAULT_RUNTIME_LOGGING_ENABLED, DEFAULT_RUNTIME_LOG_ROTATION_CONFIG, } from "./constants.js";
|
|
3
4
|
import { DEFAULT_AGENT_WORK_DIR, DEFAULT_RUNTIME_COMPILED_DIR, DEFAULT_RUNTIME_ATTACHMENTS_DIR, DEFAULT_RUNTIME_SESSIONS_DIR, DEFAULT_RUNTIME_SHARED_DIR, DEFAULT_RUNTIME_STATE_DIR, DEFAULT_RUNTIME_TRACE_FILE, DEFAULT_WORKSPACE_SOURCE_DIR, } from "./layout.js";
|
|
@@ -263,6 +264,12 @@ export const RUNTIME_CONFIG_SCHEMA_FIELDS = [
|
|
|
263
264
|
defaultValue: "false",
|
|
264
265
|
description: "Whether bounded memory lifecycle events are visible to clients.",
|
|
265
266
|
},
|
|
267
|
+
{
|
|
268
|
+
path: "longTermMemory.maxRecallCallsPerRequest",
|
|
269
|
+
type: "positive-number",
|
|
270
|
+
defaultValue: String(DEFAULT_MEMORY_RECALL_CALL_LIMIT),
|
|
271
|
+
description: "Maximum explicit memory recall calls offered per request; must be a positive safe integer.",
|
|
272
|
+
},
|
|
266
273
|
{
|
|
267
274
|
path: "longTermMemory.embeddingProfileId",
|
|
268
275
|
type: "non-empty-string",
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import { DEFAULT_MEMORY_RECALL_CALL_LIMIT, isMemoryRecallCallLimit, } from "../long-term-memory/recall-policy.js";
|
|
1
2
|
import { isRecord } from "./utils.js";
|
|
2
3
|
export const DEFAULT_LONG_TERM_MEMORY_CONFIG = Object.freeze({
|
|
3
4
|
enabled: false,
|
|
4
5
|
emitClientEvents: false,
|
|
6
|
+
maxRecallCallsPerRequest: DEFAULT_MEMORY_RECALL_CALL_LIMIT,
|
|
5
7
|
});
|
|
6
8
|
export function buildLongTermMemoryConfig(config) {
|
|
7
9
|
if (!isRecord(config.longTermMemory)) {
|
|
@@ -11,6 +13,9 @@ export function buildLongTermMemoryConfig(config) {
|
|
|
11
13
|
return Object.freeze({
|
|
12
14
|
enabled: config.longTermMemory.enabled === true,
|
|
13
15
|
emitClientEvents: config.longTermMemory.emitClientEvents === true,
|
|
16
|
+
maxRecallCallsPerRequest: isMemoryRecallCallLimit(config.longTermMemory.maxRecallCallsPerRequest)
|
|
17
|
+
? config.longTermMemory.maxRecallCallsPerRequest
|
|
18
|
+
: DEFAULT_MEMORY_RECALL_CALL_LIMIT,
|
|
14
19
|
...(embeddingProfileId ? { embeddingProfileId } : {}),
|
|
15
20
|
});
|
|
16
21
|
}
|
|
@@ -26,6 +31,7 @@ export function validateLongTermMemoryConfig(params) {
|
|
|
26
31
|
validateOptionalBoolean(params.issues, params.value, "enabled");
|
|
27
32
|
validateOptionalBoolean(params.issues, params.value, "emitClientEvents");
|
|
28
33
|
validateOptionalProfileId(params.issues, params.value);
|
|
34
|
+
validateOptionalMemoryRecallLimit(params.issues, params.value);
|
|
29
35
|
validateEnabledProfileBinding(params);
|
|
30
36
|
}
|
|
31
37
|
function rejectUnsupportedKeys(issues, config) {
|
|
@@ -33,6 +39,7 @@ function rejectUnsupportedKeys(issues, config) {
|
|
|
33
39
|
"enabled",
|
|
34
40
|
"emitClientEvents",
|
|
35
41
|
"embeddingProfileId",
|
|
42
|
+
"maxRecallCallsPerRequest",
|
|
36
43
|
]);
|
|
37
44
|
for (const key of Object.keys(config)) {
|
|
38
45
|
if (!supported.has(key)) {
|
|
@@ -40,6 +47,14 @@ function rejectUnsupportedKeys(issues, config) {
|
|
|
40
47
|
}
|
|
41
48
|
}
|
|
42
49
|
}
|
|
50
|
+
function validateOptionalMemoryRecallLimit(issues, config) {
|
|
51
|
+
const value = config.maxRecallCallsPerRequest;
|
|
52
|
+
if (value === undefined)
|
|
53
|
+
return;
|
|
54
|
+
if (isMemoryRecallCallLimit(value))
|
|
55
|
+
return;
|
|
56
|
+
issues.push("longTermMemory.maxRecallCallsPerRequest must be a positive safe integer");
|
|
57
|
+
}
|
|
43
58
|
function validateOptionalBoolean(issues, config, key) {
|
|
44
59
|
if (config[key] !== undefined && typeof config[key] !== "boolean") {
|
|
45
60
|
issues.push(`longTermMemory.${key} must be a boolean`);
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { DEFAULT_MEMORY_RECALL_CALL_LIMIT } from "../long-term-memory/recall-policy.js";
|
|
1
2
|
import { PATH_CONFIG_FIELDS, STRING_CONFIG_FIELDS, TIMEOUT_CONFIG_FIELDS, } from "./fields.js";
|
|
2
3
|
import { DEFAULT_RUNTIME_LOGGING_ENABLED, DEFAULT_RUNTIME_LOG_ROTATION_CONFIG, } from "./constants.js";
|
|
3
4
|
import { DEFAULT_REQUEST_EXECUTION_POLICY_ID, REQUEST_EXECUTION_POLICY_IDS, } from "./model-execution-policy.js";
|
|
@@ -167,6 +168,13 @@ function longTermMemorySchema() {
|
|
|
167
168
|
properties: {
|
|
168
169
|
enabled: { type: "boolean", default: false },
|
|
169
170
|
emitClientEvents: { type: "boolean", default: false },
|
|
171
|
+
maxRecallCallsPerRequest: {
|
|
172
|
+
type: "integer",
|
|
173
|
+
minimum: 1,
|
|
174
|
+
maximum: Number.MAX_SAFE_INTEGER,
|
|
175
|
+
default: DEFAULT_MEMORY_RECALL_CALL_LIMIT,
|
|
176
|
+
description: "Maximum explicit memory recall calls offered per request.",
|
|
177
|
+
},
|
|
170
178
|
embeddingProfileId: {
|
|
171
179
|
type: "string",
|
|
172
180
|
minLength: 1,
|