@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
|
@@ -6,11 +6,12 @@ import { buildLongTermMemoryConfig } from "./config/long-term-memory.js";
|
|
|
6
6
|
import { DEFAULT_RUNTIME_AGENT_BRIDGE_URL, DEFAULT_RUNTIME_CONFIG_FILE, } from "./config/constants.js";
|
|
7
7
|
import { validateEffectiveRuntimeModelConfig } from "./config/effective-model-config-validation.js";
|
|
8
8
|
import { resolveRuntimeEnvironmentProfileSelection } from "./config/environment.js";
|
|
9
|
+
import { resolveEnvironmentRuntimeDirectory } from "./config/environment-paths.js";
|
|
9
10
|
import { RUNTIME_CONFIG_SCHEMA_FIELDS } from "./config/fields.js";
|
|
10
11
|
import { loadRuntimeConfigFileWithMeta } from "./config/loader.js";
|
|
11
12
|
import { resolveRequestRunnerConfigReference } from "./config/request-runner-config.js";
|
|
12
13
|
import { loadRequestRunnerConfig } from "./config/runner/loader.js";
|
|
13
|
-
import { DEFAULT_RUNTIME_COMPILED_DIR, DEFAULT_RUNTIME_SHARED_DIR, DEFAULT_AGENT_WORK_DIR,
|
|
14
|
+
import { DEFAULT_RUNTIME_COMPILED_DIR, DEFAULT_RUNTIME_SHARED_DIR, DEFAULT_AGENT_WORK_DIR, DEFAULT_WORKSPACE_SOURCE_DIR, RUNTIME_ATTACHMENTS_DIR_NAME, RUNTIME_LOGS_DIR_NAME, RUNTIME_SESSIONS_DIR_NAME, } from "./config/layout.js";
|
|
14
15
|
import { createRuntimeConfigJsonSchema, RUNTIME_CONFIG_JSON_SCHEMA, } from "./config/schema.js";
|
|
15
16
|
import { readConfigPositiveInt, readConfigString, readFirstString, readNestedConfigString, readPositiveInt, resolveRuntimePath, } from "./config/utils.js";
|
|
16
17
|
import { RuntimeConfigValidationError } from "./config/validation.js";
|
|
@@ -54,10 +55,13 @@ export function loadRuntimeConfig(options = {}) {
|
|
|
54
55
|
profileId: options.profileId,
|
|
55
56
|
});
|
|
56
57
|
const basePaths = profileSelection.basePaths ?? fileConfig.paths;
|
|
57
|
-
const runtimeDir =
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
58
|
+
const runtimeDir = resolveEnvironmentRuntimeDirectory({
|
|
59
|
+
rootDir,
|
|
60
|
+
env,
|
|
61
|
+
config: fileConfig,
|
|
62
|
+
configPath: loadedConfig.path,
|
|
63
|
+
selection: profileSelection,
|
|
64
|
+
});
|
|
61
65
|
const agentWorkDir = resolveRuntimePath(rootDir, readFirstString(env, ["LLM_RUNTIME_AGENT_WORK_DIR"]) ??
|
|
62
66
|
readNestedConfigString(profileSelection.profilePaths, "agentWorkDir") ??
|
|
63
67
|
readNestedConfigString(basePaths, "agentWorkDir") ??
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ChatMessage } from "../../model-gateway/types.js";
|
|
2
|
+
import type { RequestExecutionSeed } from "../request/contracts.js";
|
|
3
|
+
export declare const SCHEDULED_EXECUTION_CONTEXT_KIND: "runtime_scheduled_execution_v1";
|
|
4
|
+
type ScheduledExecutionPhase = "decision" | "response";
|
|
5
|
+
export declare function projectScheduledExecutionContext(request: Pick<RequestExecutionSeed, "requestId" | "scheduledExecution">, instructions: string, phase: ScheduledExecutionPhase): Readonly<{
|
|
6
|
+
instructions: string;
|
|
7
|
+
referenceMessages: readonly ChatMessage[];
|
|
8
|
+
}>;
|
|
9
|
+
export declare function isScheduledExecutionContextMessage(message: ChatMessage): boolean;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
export const SCHEDULED_EXECUTION_CONTEXT_KIND = "runtime_scheduled_execution_v1";
|
|
2
|
+
const SCHEDULED_EXECUTION_CONTEXT_POLICY = [
|
|
3
|
+
"runtime_scheduled_execution_v1 is trusted request-local state from the runtime scheduler, bound to this request and Job run. The current user message contains the saved task to execute now.",
|
|
4
|
+
"This Job run has already been triggered; do not reinterpret its saved task as a new request to create or configure this schedule.",
|
|
5
|
+
"Preserve who performs the requested action: a reminder asks you to notify the user; a task delegated to you asks you to perform the assigned work. Execution origin does not change the saved task or its actor.",
|
|
6
|
+
"This state does not add user intent, grant additional authorization, or establish completion. It is not a user fact or a memory candidate.",
|
|
7
|
+
].join("\n");
|
|
8
|
+
const SCHEDULED_EXECUTION_PHASE_POLICY = Object.freeze({
|
|
9
|
+
decision: "Choose the action needed for this current run under the saved task and existing authority; the origin does not select a capability or require an external action for a reminder notification.",
|
|
10
|
+
response: "Present the requested outcome of this current run, preserving the task's actor. Do not claim you were asked to perform an action that the saved task asks the user to perform.",
|
|
11
|
+
});
|
|
12
|
+
export function projectScheduledExecutionContext(request, instructions, phase) {
|
|
13
|
+
const reference = request.scheduledExecution;
|
|
14
|
+
if (!hasScheduledExecutionOrigin(reference)) {
|
|
15
|
+
return Object.freeze({
|
|
16
|
+
instructions,
|
|
17
|
+
referenceMessages: Object.freeze([]),
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
const capsule = Object.freeze({
|
|
21
|
+
kind: SCHEDULED_EXECUTION_CONTEXT_KIND,
|
|
22
|
+
authority: "runtime_scheduler",
|
|
23
|
+
purpose: "execute_saved_task_for_current_run",
|
|
24
|
+
requestId: request.requestId,
|
|
25
|
+
jobId: reference.jobId,
|
|
26
|
+
runId: reference.runId,
|
|
27
|
+
scheduledAt: reference.scheduledAt,
|
|
28
|
+
triggerType: reference.triggerType,
|
|
29
|
+
presenceEffect: "execution_origin_only_not_new_intent_authorization_or_completion",
|
|
30
|
+
});
|
|
31
|
+
return Object.freeze({
|
|
32
|
+
instructions: [
|
|
33
|
+
instructions,
|
|
34
|
+
SCHEDULED_EXECUTION_CONTEXT_POLICY,
|
|
35
|
+
SCHEDULED_EXECUTION_PHASE_POLICY[phase],
|
|
36
|
+
].join("\n\n"),
|
|
37
|
+
referenceMessages: Object.freeze([
|
|
38
|
+
Object.freeze({
|
|
39
|
+
role: "system",
|
|
40
|
+
content: JSON.stringify(capsule),
|
|
41
|
+
}),
|
|
42
|
+
]),
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
function hasScheduledExecutionOrigin(reference) {
|
|
46
|
+
return reference !== undefined;
|
|
47
|
+
}
|
|
48
|
+
export function isScheduledExecutionContextMessage(message) {
|
|
49
|
+
if (message.role !== "system")
|
|
50
|
+
return false;
|
|
51
|
+
return message.content.startsWith(`{"kind":${JSON.stringify(SCHEDULED_EXECUTION_CONTEXT_KIND)},`);
|
|
52
|
+
}
|
|
@@ -1,32 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import { type LongTermMemoryService } from "./long-term-memory/index.js";
|
|
5
|
-
export declare function createDefaultRuntimeHost(config?: RuntimeConfig, defaults?: DefaultRuntimeHostBindings): RuntimeHost;
|
|
6
|
-
export type DefaultRuntimeHostBindings = Readonly<{
|
|
7
|
-
runtimeId?: string;
|
|
8
|
-
agentBridgeUrl?: string;
|
|
9
|
-
agentBridgeToken?: string;
|
|
10
|
-
eventSinkFactory?: EventSinkFactory;
|
|
11
|
-
modelGatewayClient?: ModelGatewayClient;
|
|
12
|
-
sessionStore?: SessionStore;
|
|
13
|
-
attachmentStore?: RuntimeAttachmentStore;
|
|
14
|
-
toolRegistry?: ToolRegistry;
|
|
15
|
-
longTermMemoryService?: LongTermMemoryService;
|
|
16
|
-
services?: RuntimeEnvironmentServices;
|
|
17
|
-
requestHandler?: RuntimeRequestHandler;
|
|
18
|
-
requestHandlerFactory?: (services: RuntimeEnvironmentServices) => RuntimeRequestHandler;
|
|
19
|
-
}>;
|
|
20
|
-
export declare function createBoundRuntimeRequestHandler(services: RuntimeEnvironmentServices): RuntimeRequestHandler;
|
|
21
|
-
export declare function createDefaultAttachmentStore(config: RuntimeConfig): RuntimeAttachmentStore;
|
|
22
|
-
export declare function createDefaultSessionStore(config?: RuntimeConfig): SessionStore;
|
|
23
|
-
export declare function createDefaultConversationContextProvider(): ConversationContextProvider;
|
|
24
|
-
export declare function createDefaultToolRegistry(config?: RuntimeConfig): ToolRegistry;
|
|
25
|
-
export declare function createDefaultSkillProvider(config?: RuntimeConfig, options?: {
|
|
26
|
-
toolRegistry?: Pick<ToolRegistry, "listDefinitions">;
|
|
27
|
-
}): SkillProvider;
|
|
28
|
-
export declare function createDefaultWorkspaceProvider(config?: RuntimeConfig): WorkspaceProvider;
|
|
29
|
-
export declare function createDefaultModelGatewayClient(config?: RuntimeConfig): ModelGatewayClient;
|
|
30
|
-
export declare function createDefaultLongTermMemoryService(config: RuntimeConfig | undefined, models: ModelGatewayClient): LongTermMemoryService;
|
|
31
|
-
export declare function createDefaultEventSinkFactory(config?: RuntimeConfig): EventSinkFactory;
|
|
32
|
-
export declare function createNoopEventSink(): EventSink;
|
|
1
|
+
export { createDefaultAttachmentStore, createDefaultConversationContextProvider, createDefaultEventSinkFactory, createDefaultLongTermMemoryService, createDefaultModelGatewayClient, createDefaultSessionStore, createDefaultSkillProvider, createDefaultToolRegistry, createDefaultWorkspaceProvider, createNoopEventSink, } from "./default-environment-adapters.js";
|
|
2
|
+
export { createDefaultRuntimeHost, type DefaultRuntimeHostBindings, } from "./runtime-host.js";
|
|
3
|
+
export { createBoundRuntimeRequestHandler } from "./request/bound-runtime-handler.js";
|
|
@@ -1,270 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import { createModelGatewayClient, embedModelGateway, invokeModelGateway, invokeRawModelGateway, } from "../model-gateway/client.js";
|
|
5
|
-
import { MAX_MODEL_GATEWAY_EMBEDDING_BATCH_SIZE } from "../model-gateway/embeddings/constants.js";
|
|
6
|
-
import { createBundledPluginSkillProvider, createConfiguredSkillProvider, } from "./adapters/configured-skill-provider.js";
|
|
7
|
-
import { createFileSessionStore } from "./adapters/file-session-store.js";
|
|
8
|
-
import { createFileAttachmentStore, } from "./attachments/store.js";
|
|
9
|
-
import { createSourceWorkspaceProvider } from "./adapters/source-workspace-provider.js";
|
|
10
|
-
import { createRuntimeEventBus } from "./events/runtime-emitter.js";
|
|
11
|
-
import { configureDebugLogger } from "./observability/debug-logger.js";
|
|
12
|
-
import { createConfiguredToolRegistry } from "./capabilities/configured-tool-registry.js";
|
|
13
|
-
import { loadBundledRuntimePlugins, loadConfiguredRuntimePlugins, runtimePluginsToToolModules, } from "./plugins/loader.js";
|
|
14
|
-
import { handleRunRequest } from "./request/handler.js";
|
|
15
|
-
import { createModelSessionMemoryCompactor } from "./context/session-memory/index.js";
|
|
16
|
-
import { createFileLongTermMemoryRepository } from "./adapters/long-term-memory/file-repository.js";
|
|
17
|
-
import { createInMemoryLongTermMemoryRepository } from "./adapters/long-term-memory/in-memory-repository.js";
|
|
18
|
-
import { createLongTermMemoryService, } from "./long-term-memory/index.js";
|
|
19
|
-
export function createDefaultRuntimeHost(config, defaults = {}) {
|
|
20
|
-
return {
|
|
21
|
-
start(options = {}) {
|
|
22
|
-
const services = resolveRuntimeHostEnvironmentServices({
|
|
23
|
-
config,
|
|
24
|
-
defaults,
|
|
25
|
-
options,
|
|
26
|
-
});
|
|
27
|
-
const runtimeConfig = services?.config ?? options.runtimeConfig ?? config;
|
|
28
|
-
const defaultRuntimeConfig = defaults.services?.config ?? config;
|
|
29
|
-
const runtimeConfigIdentityChanged = runtimeConfig !== undefined && runtimeConfig !== defaultRuntimeConfig;
|
|
30
|
-
const requestHandler = services
|
|
31
|
-
? resolveRuntimeHostRequestHandler(services, defaults)
|
|
32
|
-
: defaults.requestHandler;
|
|
33
|
-
return startAgentBridge({
|
|
34
|
-
runtimeConfig,
|
|
35
|
-
runtimeId: options.runtimeId ??
|
|
36
|
-
(runtimeConfigIdentityChanged
|
|
37
|
-
? runtimeConfig.runtimeId
|
|
38
|
-
: defaults.runtimeId),
|
|
39
|
-
token: options.agentBridgeToken ??
|
|
40
|
-
(runtimeConfigIdentityChanged
|
|
41
|
-
? runtimeConfig.agentBridgeToken
|
|
42
|
-
: defaults.agentBridgeToken),
|
|
43
|
-
url: options.agentBridgeUrl ??
|
|
44
|
-
(runtimeConfigIdentityChanged
|
|
45
|
-
? runtimeConfig.agentBridgeUrl
|
|
46
|
-
: defaults.agentBridgeUrl),
|
|
47
|
-
eventSinkFactory: services?.events ??
|
|
48
|
-
options.eventSinkFactory ??
|
|
49
|
-
defaults.eventSinkFactory,
|
|
50
|
-
modelGatewayClient: services?.models ??
|
|
51
|
-
options.modelGatewayClient ??
|
|
52
|
-
defaults.modelGatewayClient,
|
|
53
|
-
sessionStore: services?.sessions ?? options.sessionStore ?? defaults.sessionStore,
|
|
54
|
-
attachmentStore: services?.attachments ??
|
|
55
|
-
options.attachmentStore ??
|
|
56
|
-
defaults.attachmentStore ??
|
|
57
|
-
(runtimeConfig
|
|
58
|
-
? createDefaultAttachmentStore(runtimeConfig)
|
|
59
|
-
: undefined),
|
|
60
|
-
toolRegistry: services?.tools ??
|
|
61
|
-
options.toolRegistry ??
|
|
62
|
-
defaults.toolRegistry ??
|
|
63
|
-
createDefaultToolRegistry(runtimeConfig),
|
|
64
|
-
requestHandler,
|
|
65
|
-
});
|
|
66
|
-
},
|
|
67
|
-
};
|
|
68
|
-
}
|
|
69
|
-
function resolveRuntimeHostEnvironmentServices(params) {
|
|
70
|
-
const bound = params.defaults.services;
|
|
71
|
-
const runtimeConfig = params.options.runtimeConfig ?? bound?.config ?? params.config;
|
|
72
|
-
if (!runtimeConfig) {
|
|
73
|
-
return undefined;
|
|
74
|
-
}
|
|
75
|
-
const mayReuseBound = bound?.config === runtimeConfig;
|
|
76
|
-
const mayUseLegacyDefaults = !bound && params.config === runtimeConfig;
|
|
77
|
-
const sessions = params.options.sessionStore ??
|
|
78
|
-
(mayReuseBound ? bound.sessions : undefined) ??
|
|
79
|
-
(mayUseLegacyDefaults ? params.defaults.sessionStore : undefined) ??
|
|
80
|
-
createDefaultSessionStore(runtimeConfig);
|
|
81
|
-
const attachments = params.options.attachmentStore ??
|
|
82
|
-
(mayReuseBound ? bound.attachments : undefined) ??
|
|
83
|
-
(mayUseLegacyDefaults ? params.defaults.attachmentStore : undefined) ??
|
|
84
|
-
createDefaultAttachmentStore(runtimeConfig);
|
|
85
|
-
const tools = params.options.toolRegistry ??
|
|
86
|
-
(mayReuseBound ? bound.tools : undefined) ??
|
|
87
|
-
(mayUseLegacyDefaults ? params.defaults.toolRegistry : undefined) ??
|
|
88
|
-
createDefaultToolRegistry(runtimeConfig);
|
|
89
|
-
const models = params.options.modelGatewayClient ??
|
|
90
|
-
(mayReuseBound ? bound.models : undefined) ??
|
|
91
|
-
(mayUseLegacyDefaults ? params.defaults.modelGatewayClient : undefined) ??
|
|
92
|
-
createDefaultModelGatewayClient(runtimeConfig);
|
|
93
|
-
const events = params.options.eventSinkFactory ??
|
|
94
|
-
(mayReuseBound ? bound.events : undefined) ??
|
|
95
|
-
(mayUseLegacyDefaults ? params.defaults.eventSinkFactory : undefined) ??
|
|
96
|
-
createDefaultEventSinkFactory(runtimeConfig);
|
|
97
|
-
const sessionMemoryCompactor = bound?.sessionMemoryCompactor ?? createModelSessionMemoryCompactor();
|
|
98
|
-
const mayReuseBoundLongTermMemory = mayReuseBound && models === bound?.models;
|
|
99
|
-
const longTermMemory = params.options.longTermMemoryService ??
|
|
100
|
-
(mayReuseBoundLongTermMemory ? bound?.longTermMemory : undefined) ??
|
|
101
|
-
createDefaultLongTermMemoryService(runtimeConfig, models);
|
|
102
|
-
const reusesAllBoundServices = mayReuseBound &&
|
|
103
|
-
sessions === bound.sessions &&
|
|
104
|
-
attachments === bound.attachments &&
|
|
105
|
-
tools === bound.tools &&
|
|
106
|
-
models === bound.models &&
|
|
107
|
-
events === bound.events &&
|
|
108
|
-
sessionMemoryCompactor === bound.sessionMemoryCompactor &&
|
|
109
|
-
longTermMemory === bound.longTermMemory;
|
|
110
|
-
if (reusesAllBoundServices) {
|
|
111
|
-
return bound;
|
|
112
|
-
}
|
|
113
|
-
return Object.freeze({
|
|
114
|
-
config: runtimeConfig,
|
|
115
|
-
sessions,
|
|
116
|
-
attachments,
|
|
117
|
-
tools,
|
|
118
|
-
models,
|
|
119
|
-
events,
|
|
120
|
-
sessionMemoryCompactor,
|
|
121
|
-
longTermMemory,
|
|
122
|
-
});
|
|
123
|
-
}
|
|
124
|
-
function resolveRuntimeHostRequestHandler(services, defaults) {
|
|
125
|
-
if (services === defaults.services && defaults.requestHandler) {
|
|
126
|
-
return defaults.requestHandler;
|
|
127
|
-
}
|
|
128
|
-
return (defaults.requestHandlerFactory ?? createBoundRuntimeRequestHandler)(services);
|
|
129
|
-
}
|
|
130
|
-
export function createBoundRuntimeRequestHandler(services) {
|
|
131
|
-
const environmentOptions = {
|
|
132
|
-
runtimeConfig: services.config,
|
|
133
|
-
eventSinkFactory: services.events,
|
|
134
|
-
modelGatewayClient: services.models,
|
|
135
|
-
sessionStore: services.sessions,
|
|
136
|
-
attachmentStore: services.attachments,
|
|
137
|
-
toolRegistry: services.tools,
|
|
138
|
-
sessionMemoryCompactor: services.sessionMemoryCompactor,
|
|
139
|
-
longTermMemory: services.longTermMemory,
|
|
140
|
-
};
|
|
141
|
-
return Object.freeze({
|
|
142
|
-
handle(ws, message, requestOptions = {}) {
|
|
143
|
-
return handleRunRequest(ws, message, {
|
|
144
|
-
...environmentOptions,
|
|
145
|
-
...requestOptions,
|
|
146
|
-
});
|
|
147
|
-
},
|
|
148
|
-
});
|
|
149
|
-
}
|
|
150
|
-
export function createDefaultAttachmentStore(config) {
|
|
151
|
-
return createFileAttachmentStore({
|
|
152
|
-
attachmentsDir: config.paths.attachmentsDir,
|
|
153
|
-
});
|
|
154
|
-
}
|
|
155
|
-
export function createDefaultSessionStore(config) {
|
|
156
|
-
return createFileSessionStore(config ? { sessionsDir: config.paths.sessionsDir } : {});
|
|
157
|
-
}
|
|
158
|
-
export function createDefaultConversationContextProvider() {
|
|
159
|
-
return {
|
|
160
|
-
buildContextBuckets,
|
|
161
|
-
buildContextWindow,
|
|
162
|
-
};
|
|
163
|
-
}
|
|
164
|
-
export function createDefaultToolRegistry(config) {
|
|
165
|
-
const plugins = config
|
|
166
|
-
? loadConfiguredRuntimePlugins(config)
|
|
167
|
-
: loadBundledRuntimePlugins();
|
|
168
|
-
return createConfiguredToolRegistry(config, runtimePluginsToToolModules(plugins));
|
|
169
|
-
}
|
|
170
|
-
export function createDefaultSkillProvider(config, options = {}) {
|
|
171
|
-
const toolRegistry = options.toolRegistry ??
|
|
172
|
-
(config ? createDefaultToolRegistry(config) : undefined);
|
|
173
|
-
const listToolDefinitions = toolRegistry?.listDefinitions;
|
|
174
|
-
if (config) {
|
|
175
|
-
return createConfiguredSkillProvider({ config, listToolDefinitions });
|
|
176
|
-
}
|
|
177
|
-
return createBundledPluginSkillProvider({ listToolDefinitions });
|
|
178
|
-
}
|
|
179
|
-
export function createDefaultWorkspaceProvider(config) {
|
|
180
|
-
return createSourceWorkspaceProvider(config ? { workspaceDir: config.paths.workspaceDir } : {});
|
|
181
|
-
}
|
|
182
|
-
export function createDefaultModelGatewayClient(config) {
|
|
183
|
-
if (!config) {
|
|
184
|
-
return {
|
|
185
|
-
invoke: invokeModelGateway,
|
|
186
|
-
invokeRaw: invokeRawModelGateway,
|
|
187
|
-
embed: embedModelGateway,
|
|
188
|
-
};
|
|
189
|
-
}
|
|
190
|
-
return createModelGatewayClient({
|
|
191
|
-
baseUrl: config.modelGatewayUrl,
|
|
192
|
-
streamInactivityTimeoutMs: config.timeouts?.streamInactivityTimeoutMs,
|
|
193
|
-
...(config.models ? { modelPolicy: config.models } : {}),
|
|
194
|
-
});
|
|
195
|
-
}
|
|
196
|
-
export function createDefaultLongTermMemoryService(config, models) {
|
|
197
|
-
const memoryConfig = config?.longTermMemory ?? {
|
|
198
|
-
enabled: false,
|
|
199
|
-
emitClientEvents: false,
|
|
200
|
-
};
|
|
201
|
-
const repository = config
|
|
202
|
-
? createFileLongTermMemoryRepository(join(config.paths.runtimeDir, "long-term-memory"))
|
|
203
|
-
: createInMemoryLongTermMemoryRepository();
|
|
204
|
-
const embeddings = memoryConfig.enabled && config
|
|
205
|
-
? createLongTermMemoryEmbeddingClient({ config, models })
|
|
206
|
-
: undefined;
|
|
207
|
-
return createLongTermMemoryService({
|
|
208
|
-
repository,
|
|
209
|
-
enabled: memoryConfig.enabled,
|
|
210
|
-
emitClientEvents: memoryConfig.emitClientEvents,
|
|
211
|
-
...(embeddings ? { embeddings } : {}),
|
|
212
|
-
});
|
|
213
|
-
}
|
|
214
|
-
function createLongTermMemoryEmbeddingClient(params) {
|
|
215
|
-
const profileId = params.config.longTermMemory?.embeddingProfileId;
|
|
216
|
-
if (!profileId) {
|
|
217
|
-
throw new Error("long_term_memory_embedding_profile_required");
|
|
218
|
-
}
|
|
219
|
-
if (!params.models.embed) {
|
|
220
|
-
throw new Error("long_term_memory_embedding_gateway_unavailable");
|
|
221
|
-
}
|
|
222
|
-
const embed = params.models.embed;
|
|
223
|
-
return Object.freeze({
|
|
224
|
-
maxBatchSize: MAX_MODEL_GATEWAY_EMBEDDING_BATCH_SIZE,
|
|
225
|
-
async embed(input) {
|
|
226
|
-
const result = await embed({
|
|
227
|
-
profileId,
|
|
228
|
-
texts: input.texts,
|
|
229
|
-
modelPolicy: params.config.models,
|
|
230
|
-
abortSignal: input.abortSignal,
|
|
231
|
-
...(input.debugRequestId
|
|
232
|
-
? { debugRequestId: input.debugRequestId }
|
|
233
|
-
: {}),
|
|
234
|
-
});
|
|
235
|
-
return Object.freeze({
|
|
236
|
-
modelFingerprint: result.modelFingerprint,
|
|
237
|
-
dimensions: result.dimensions,
|
|
238
|
-
vectors: result.vectors,
|
|
239
|
-
});
|
|
240
|
-
},
|
|
241
|
-
});
|
|
242
|
-
}
|
|
243
|
-
export function createDefaultEventSinkFactory(config) {
|
|
244
|
-
if (config) {
|
|
245
|
-
configureDebugLogger({
|
|
246
|
-
traceFile: config.paths.traceFile,
|
|
247
|
-
enabled: config.logging?.enabled,
|
|
248
|
-
rotation: config.logging?.rotation,
|
|
249
|
-
});
|
|
250
|
-
}
|
|
251
|
-
return {
|
|
252
|
-
create(options) {
|
|
253
|
-
return createRuntimeEventBus(options);
|
|
254
|
-
},
|
|
255
|
-
};
|
|
256
|
-
}
|
|
257
|
-
export function createNoopEventSink() {
|
|
258
|
-
return {
|
|
259
|
-
publish: () => { },
|
|
260
|
-
event: () => { },
|
|
261
|
-
runtimeState: () => { },
|
|
262
|
-
token: () => { },
|
|
263
|
-
legacyToken: () => { },
|
|
264
|
-
thinkingDelta: () => { },
|
|
265
|
-
completed: () => { },
|
|
266
|
-
failed: () => { },
|
|
267
|
-
drain: async () => { },
|
|
268
|
-
dispose: () => { },
|
|
269
|
-
};
|
|
270
|
-
}
|
|
1
|
+
export { createDefaultAttachmentStore, createDefaultConversationContextProvider, createDefaultEventSinkFactory, createDefaultLongTermMemoryService, createDefaultModelGatewayClient, createDefaultSessionStore, createDefaultSkillProvider, createDefaultToolRegistry, createDefaultWorkspaceProvider, createNoopEventSink, } from "./default-environment-adapters.js";
|
|
2
|
+
export { createDefaultRuntimeHost, } from "./runtime-host.js";
|
|
3
|
+
export { createBoundRuntimeRequestHandler } from "./request/bound-runtime-handler.js";
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type RuntimeAttachmentStore } from "./attachments/store.js";
|
|
2
|
+
import type { ConversationContextProvider, EventSink, EventSinkFactory, ModelGatewayClient, RuntimeConfig, SessionStore, SkillProvider, ToolRegistry, WorkspaceProvider } from "./ports.js";
|
|
3
|
+
import type { SchedulerService } from "./scheduler/contracts.js";
|
|
4
|
+
import { type LongTermMemoryService } from "./long-term-memory/index.js";
|
|
5
|
+
export declare function createDefaultAttachmentStore(config: RuntimeConfig): RuntimeAttachmentStore;
|
|
6
|
+
export declare function createDefaultSessionStore(config?: RuntimeConfig): SessionStore;
|
|
7
|
+
export declare function createDefaultConversationContextProvider(): ConversationContextProvider;
|
|
8
|
+
export declare function createDefaultToolRegistry(config?: RuntimeConfig, scheduling?: {
|
|
9
|
+
service: SchedulerService;
|
|
10
|
+
ready: () => Promise<void>;
|
|
11
|
+
}): ToolRegistry;
|
|
12
|
+
export declare function createDefaultSkillProvider(config?: RuntimeConfig, options?: {
|
|
13
|
+
toolRegistry?: Pick<ToolRegistry, "listDefinitions">;
|
|
14
|
+
}): SkillProvider;
|
|
15
|
+
export declare function createDefaultWorkspaceProvider(config?: RuntimeConfig): WorkspaceProvider;
|
|
16
|
+
export declare function createDefaultModelGatewayClient(config?: RuntimeConfig): ModelGatewayClient;
|
|
17
|
+
export declare function createDefaultLongTermMemoryService(config: RuntimeConfig | undefined, models: ModelGatewayClient): LongTermMemoryService;
|
|
18
|
+
export declare function createDefaultEventSinkFactory(config?: RuntimeConfig): EventSinkFactory;
|
|
19
|
+
export declare function createNoopEventSink(): EventSink;
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import { join } from "node:path";
|
|
2
|
+
import { buildContextBuckets, buildContextWindow } from "../sessions/index.js";
|
|
3
|
+
import { createModelGatewayClient, embedModelGateway, invokeModelGateway, invokeRawModelGateway, } from "../model-gateway/client.js";
|
|
4
|
+
import { MAX_MODEL_GATEWAY_EMBEDDING_BATCH_SIZE } from "../model-gateway/embeddings/constants.js";
|
|
5
|
+
import { createBundledPluginSkillProvider, createConfiguredSkillProvider, } from "./adapters/configured-skill-provider.js";
|
|
6
|
+
import { createFileSessionStore } from "./adapters/file-session-store.js";
|
|
7
|
+
import { createFileAttachmentStore, } from "./attachments/store.js";
|
|
8
|
+
import { createSourceWorkspaceProvider } from "./adapters/source-workspace-provider.js";
|
|
9
|
+
import { createRuntimeEventBus } from "./events/runtime-emitter.js";
|
|
10
|
+
import { configureDebugLogger } from "./observability/debug-logger.js";
|
|
11
|
+
import { createConfiguredToolRegistry } from "./capabilities/configured-tool-registry.js";
|
|
12
|
+
import { loadBundledRuntimePlugins, loadConfiguredRuntimePlugins, runtimePluginsToToolModules, } from "./plugins/loader.js";
|
|
13
|
+
import { createSchedulingToolModule } from "./capabilities/scheduling/tool-module.js";
|
|
14
|
+
import { createFileLongTermMemoryRepository } from "./adapters/long-term-memory/file-repository.js";
|
|
15
|
+
import { createInMemoryLongTermMemoryRepository } from "./adapters/long-term-memory/in-memory-repository.js";
|
|
16
|
+
import { createLongTermMemoryService, } from "./long-term-memory/index.js";
|
|
17
|
+
export function createDefaultAttachmentStore(config) {
|
|
18
|
+
return createFileAttachmentStore({
|
|
19
|
+
attachmentsDir: config.paths.attachmentsDir,
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
export function createDefaultSessionStore(config) {
|
|
23
|
+
return createFileSessionStore(config ? { sessionsDir: config.paths.sessionsDir } : {});
|
|
24
|
+
}
|
|
25
|
+
export function createDefaultConversationContextProvider() {
|
|
26
|
+
return {
|
|
27
|
+
buildContextBuckets,
|
|
28
|
+
buildContextWindow,
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
export function createDefaultToolRegistry(config, scheduling) {
|
|
32
|
+
const plugins = config
|
|
33
|
+
? loadConfiguredRuntimePlugins(config)
|
|
34
|
+
: loadBundledRuntimePlugins();
|
|
35
|
+
return createConfiguredToolRegistry(config, [
|
|
36
|
+
...runtimePluginsToToolModules(plugins),
|
|
37
|
+
...(config && scheduling
|
|
38
|
+
? [
|
|
39
|
+
createSchedulingToolModule(scheduling.service, config, scheduling.ready),
|
|
40
|
+
]
|
|
41
|
+
: []),
|
|
42
|
+
]);
|
|
43
|
+
}
|
|
44
|
+
export function createDefaultSkillProvider(config, options = {}) {
|
|
45
|
+
const toolRegistry = options.toolRegistry ??
|
|
46
|
+
(config ? createDefaultToolRegistry(config) : undefined);
|
|
47
|
+
const listToolDefinitions = toolRegistry?.listDefinitions;
|
|
48
|
+
if (config) {
|
|
49
|
+
return createConfiguredSkillProvider({ config, listToolDefinitions });
|
|
50
|
+
}
|
|
51
|
+
return createBundledPluginSkillProvider({ listToolDefinitions });
|
|
52
|
+
}
|
|
53
|
+
export function createDefaultWorkspaceProvider(config) {
|
|
54
|
+
return createSourceWorkspaceProvider(config ? { workspaceDir: config.paths.workspaceDir } : {});
|
|
55
|
+
}
|
|
56
|
+
export function createDefaultModelGatewayClient(config) {
|
|
57
|
+
if (!config) {
|
|
58
|
+
return {
|
|
59
|
+
invoke: invokeModelGateway,
|
|
60
|
+
invokeRaw: invokeRawModelGateway,
|
|
61
|
+
embed: embedModelGateway,
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
return createModelGatewayClient({
|
|
65
|
+
baseUrl: config.modelGatewayUrl,
|
|
66
|
+
streamInactivityTimeoutMs: config.timeouts?.streamInactivityTimeoutMs,
|
|
67
|
+
...(config.models ? { modelPolicy: config.models } : {}),
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
export function createDefaultLongTermMemoryService(config, models) {
|
|
71
|
+
const memoryConfig = config?.longTermMemory ?? {
|
|
72
|
+
enabled: false,
|
|
73
|
+
emitClientEvents: false,
|
|
74
|
+
};
|
|
75
|
+
const repository = config
|
|
76
|
+
? createFileLongTermMemoryRepository(join(config.paths.runtimeDir, "long-term-memory"))
|
|
77
|
+
: createInMemoryLongTermMemoryRepository();
|
|
78
|
+
const embeddings = memoryConfig.enabled && config
|
|
79
|
+
? createLongTermMemoryEmbeddingClient({ config, models })
|
|
80
|
+
: undefined;
|
|
81
|
+
return createLongTermMemoryService({
|
|
82
|
+
repository,
|
|
83
|
+
enabled: memoryConfig.enabled,
|
|
84
|
+
emitClientEvents: memoryConfig.emitClientEvents,
|
|
85
|
+
...(embeddings ? { embeddings } : {}),
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
function createLongTermMemoryEmbeddingClient(params) {
|
|
89
|
+
const profileId = params.config.longTermMemory?.embeddingProfileId;
|
|
90
|
+
if (!profileId) {
|
|
91
|
+
throw new Error("long_term_memory_embedding_profile_required");
|
|
92
|
+
}
|
|
93
|
+
if (!params.models.embed) {
|
|
94
|
+
throw new Error("long_term_memory_embedding_gateway_unavailable");
|
|
95
|
+
}
|
|
96
|
+
const embed = params.models.embed;
|
|
97
|
+
return Object.freeze({
|
|
98
|
+
maxBatchSize: MAX_MODEL_GATEWAY_EMBEDDING_BATCH_SIZE,
|
|
99
|
+
async embed(input) {
|
|
100
|
+
const result = await embed({
|
|
101
|
+
profileId,
|
|
102
|
+
texts: input.texts,
|
|
103
|
+
modelPolicy: params.config.models,
|
|
104
|
+
abortSignal: input.abortSignal,
|
|
105
|
+
...(input.debugRequestId
|
|
106
|
+
? { debugRequestId: input.debugRequestId }
|
|
107
|
+
: {}),
|
|
108
|
+
});
|
|
109
|
+
return Object.freeze({
|
|
110
|
+
modelFingerprint: result.modelFingerprint,
|
|
111
|
+
dimensions: result.dimensions,
|
|
112
|
+
vectors: result.vectors,
|
|
113
|
+
});
|
|
114
|
+
},
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
export function createDefaultEventSinkFactory(config) {
|
|
118
|
+
if (config) {
|
|
119
|
+
configureDebugLogger({
|
|
120
|
+
traceFile: config.paths.traceFile,
|
|
121
|
+
enabled: config.logging?.enabled,
|
|
122
|
+
rotation: config.logging?.rotation,
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
return {
|
|
126
|
+
create(options) {
|
|
127
|
+
return createRuntimeEventBus(options);
|
|
128
|
+
},
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
export function createNoopEventSink() {
|
|
132
|
+
return {
|
|
133
|
+
publish: () => { },
|
|
134
|
+
event: () => { },
|
|
135
|
+
runtimeState: () => { },
|
|
136
|
+
token: () => { },
|
|
137
|
+
legacyToken: () => { },
|
|
138
|
+
thinkingDelta: () => { },
|
|
139
|
+
completed: () => { },
|
|
140
|
+
failed: () => { },
|
|
141
|
+
drain: async () => { },
|
|
142
|
+
dispose: () => { },
|
|
143
|
+
};
|
|
144
|
+
}
|
|
@@ -10,4 +10,9 @@ export * from "./adapters/multi-workspace-provider.js";
|
|
|
10
10
|
export * from "./adapters/source-workspace-provider.js";
|
|
11
11
|
export * from "./attachments/store.js";
|
|
12
12
|
export * from "./long-term-memory/index.js";
|
|
13
|
+
export * from "./scheduler/contracts.js";
|
|
14
|
+
export * from "./scheduler/scheduler-service.js";
|
|
15
|
+
export * from "./scheduler/file-store.js";
|
|
13
16
|
export * from "./observability/debug-logger.js";
|
|
17
|
+
export { createLocalRuntimeApplication } from "./local-application.js";
|
|
18
|
+
export type { LocalRuntimeApplication, LocalRuntimeApplicationOptions, } from "./local-application.js";
|
|
@@ -10,4 +10,8 @@ export * from "./adapters/multi-workspace-provider.js";
|
|
|
10
10
|
export * from "./adapters/source-workspace-provider.js";
|
|
11
11
|
export * from "./attachments/store.js";
|
|
12
12
|
export * from "./long-term-memory/index.js";
|
|
13
|
+
export * from "./scheduler/contracts.js";
|
|
14
|
+
export * from "./scheduler/scheduler-service.js";
|
|
15
|
+
export * from "./scheduler/file-store.js";
|
|
13
16
|
export * from "./observability/debug-logger.js";
|
|
17
|
+
export { createLocalRuntimeApplication } from "./local-application.js";
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { RuntimeConfig } from "./ports.js";
|
|
2
|
+
import type { RuntimeRequestHandler, RuntimeRequestOptions } from "./composition.js";
|
|
3
|
+
import type { SchedulerRun } from "./scheduler/contracts.js";
|
|
4
|
+
export type LocalRuntimeApplicationOptions = Readonly<{
|
|
5
|
+
scheduledRequestOptions?: (run: SchedulerRun) => RuntimeRequestOptions;
|
|
6
|
+
}>;
|
|
7
|
+
/** Managed library entry: attach to the environment owner or create it once. */
|
|
8
|
+
export declare function createLocalRuntimeApplication(config?: RuntimeConfig, options?: LocalRuntimeApplicationOptions): Readonly<{
|
|
9
|
+
services: Readonly<{
|
|
10
|
+
longTermMemory: import("./index.js").LongTermMemoryService;
|
|
11
|
+
sessions: import("./ports.js").SessionStore;
|
|
12
|
+
attachments: import("./index.js").RuntimeAttachmentStore;
|
|
13
|
+
scheduler: Omit<import("./scheduler/contracts.js").SchedulerService, "stop" | "start">;
|
|
14
|
+
config: RuntimeConfig;
|
|
15
|
+
}>;
|
|
16
|
+
requests: RuntimeRequestHandler;
|
|
17
|
+
start: () => Promise<void>;
|
|
18
|
+
stop(): Promise<void>;
|
|
19
|
+
getOwnership: () => "owner" | "client" | undefined;
|
|
20
|
+
subscribeScheduledEvents: (listener: (event: Record<string, unknown>) => void) => () => void;
|
|
21
|
+
}>;
|
|
22
|
+
export type LocalRuntimeApplication = ReturnType<typeof createLocalRuntimeApplication>;
|