@abot-ai/runtime 1.3.1 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/plugins/system/source/application-catalog.d.ts +14 -0
- package/dist/plugins/system/source/application-catalog.js +185 -0
- package/dist/plugins/system/source/application-launch.d.ts +10 -0
- package/dist/plugins/system/source/application-launch.js +80 -0
- package/dist/plugins/system/source/application-observation.d.ts +25 -0
- package/dist/plugins/system/source/application-observation.js +53 -0
- package/dist/plugins/system/source/commands.d.ts +7 -0
- package/dist/plugins/system/source/commands.js +71 -0
- package/dist/plugins/system/source/companion/autostart.d.ts +16 -0
- package/dist/plugins/system/source/companion/autostart.js +146 -0
- package/dist/plugins/system/source/companion/broker-location.d.ts +11 -0
- package/dist/plugins/system/source/companion/broker-location.js +76 -0
- package/dist/plugins/system/source/companion/broker-server.d.ts +4 -0
- package/dist/plugins/system/source/companion/broker-server.js +147 -0
- package/dist/plugins/system/source/companion/connection.d.ts +25 -0
- package/dist/plugins/system/source/companion/connection.js +182 -0
- package/dist/plugins/system/source/companion/liveness.d.ts +3 -0
- package/dist/plugins/system/source/companion/liveness.js +20 -0
- package/dist/plugins/system/source/companion/native-address.d.ts +12 -0
- package/dist/plugins/system/source/companion/native-address.js +41 -0
- package/dist/plugins/system/source/companion/native-identity.d.ts +2 -0
- package/dist/plugins/system/source/companion/native-identity.js +23 -0
- package/dist/plugins/system/source/companion/native-messages.d.ts +9 -0
- package/dist/plugins/system/source/companion/native-messages.js +77 -0
- package/dist/plugins/system/source/companion/native-session.d.ts +19 -0
- package/dist/plugins/system/source/companion/native-session.js +205 -0
- package/dist/plugins/system/source/companion/native-state.d.ts +22 -0
- package/dist/plugins/system/source/companion/native-state.js +126 -0
- package/dist/plugins/system/source/companion/native-supervisor.d.ts +10 -0
- package/dist/plugins/system/source/companion/native-supervisor.js +93 -0
- package/dist/plugins/system/source/companion/pairing-store.d.ts +22 -0
- package/dist/plugins/system/source/companion/pairing-store.js +102 -0
- package/dist/plugins/system/source/companion/private-store.d.ts +4 -0
- package/dist/plugins/system/source/companion/private-store.js +59 -0
- package/dist/plugins/system/source/companion/process-owner-identity.d.ts +22 -0
- package/dist/plugins/system/source/companion/process-owner-identity.js +144 -0
- package/dist/plugins/system/source/companion/protocol.d.ts +57 -0
- package/dist/plugins/system/source/companion/protocol.js +66 -0
- package/dist/plugins/system/source/contracts.d.ts +38 -0
- package/dist/plugins/system/source/contracts.js +7 -0
- package/dist/plugins/system/source/elevation.d.ts +8 -0
- package/dist/plugins/system/source/elevation.js +57 -0
- package/dist/plugins/system/source/handlers.d.ts +3 -0
- package/dist/plugins/system/source/handlers.js +90 -0
- package/dist/plugins/system/source/host-evidence.d.ts +4 -0
- package/dist/plugins/system/source/host-evidence.js +52 -0
- package/dist/plugins/system/source/host-observation.d.ts +25 -0
- package/dist/plugins/system/source/host-observation.js +59 -0
- package/dist/plugins/system/source/process-result.d.ts +4 -0
- package/dist/plugins/system/source/process-result.js +86 -0
- package/dist/plugins/system/source/process-runner.d.ts +3 -0
- package/dist/plugins/system/source/process-runner.js +103 -0
- package/dist/plugins/system/source/target-observation.d.ts +18 -0
- package/dist/plugins/system/source/target-observation.js +29 -0
- package/dist/plugins/system/source/targets.d.ts +8 -0
- package/dist/plugins/system/source/targets.js +101 -0
- package/dist/scripts/add-runtime-model.js +10 -53
- package/dist/scripts/runtime-model-addition.d.ts +13 -0
- package/dist/scripts/runtime-model-addition.js +53 -0
- package/dist/scripts/runtime-setup-files.d.ts +3 -1
- package/dist/scripts/runtime-setup-files.js +18 -1
- package/dist/src/capabilities/file-output-presentation.d.ts +43 -0
- package/dist/src/capabilities/file-output-presentation.js +133 -0
- package/dist/src/capabilities/tool-definition-validator/definition-parser.js +2 -0
- package/dist/src/capabilities/tool-definition-validator/event-input-text-options.d.ts +5 -0
- package/dist/src/capabilities/tool-definition-validator/event-input-text-options.js +37 -0
- package/dist/src/capabilities/tool-definition-validator/event-presentation.js +3 -0
- package/dist/src/capabilities/tool-definition-validator/module-registry.js +12 -0
- package/dist/src/capabilities/tool-event-input-text.d.ts +9 -0
- package/dist/src/capabilities/tool-event-input-text.js +64 -0
- package/dist/src/capabilities/tool-event-metadata.js +10 -0
- package/dist/src/capabilities/tool-executor.d.ts +1 -0
- package/dist/src/capabilities/tool-executor.js +1 -0
- package/dist/src/capabilities/tool-permission-mode.d.ts +7 -0
- package/dist/src/capabilities/tool-permission-mode.js +27 -0
- package/dist/src/capabilities/tool-types.d.ts +18 -2
- package/dist/src/cli/abot.js +18 -15
- package/dist/src/cli/host-companion-bundle.mjs +5201 -0
- package/dist/src/cli/host-companion-entry.d.ts +8 -0
- package/dist/src/cli/host-companion-entry.js +70 -0
- package/dist/src/cli/host-companion-startup.d.ts +4 -0
- package/dist/src/cli/host-companion-startup.js +35 -0
- package/dist/src/cli/host-companion.d.ts +5 -0
- package/dist/src/cli/host-companion.js +203 -0
- package/dist/src/model-gateway/server/configuration.js +4 -1
- package/dist/src/model-gateway/server/contracts.d.ts +2 -0
- package/dist/src/plugin-contract/entrypoint.d.ts +4 -2
- package/dist/src/plugin-contract/manifest.d.ts +1 -0
- package/dist/src/runtime/adapters/config-file-transaction.d.ts +46 -0
- package/dist/src/runtime/adapters/config-file-transaction.js +158 -0
- package/dist/src/runtime/adapters/configured-skill-provider.js +3 -3
- package/dist/src/runtime/adapters/in-memory-session-store.js +11 -1
- package/dist/src/runtime/adapters/long-term-memory/file-lock/acquisition.js +7 -3
- package/dist/src/runtime/adapters/long-term-memory/file-lock/contracts.d.ts +4 -1
- package/dist/src/runtime/adapters/long-term-memory/file-lock/install.d.ts +1 -1
- package/dist/src/runtime/adapters/long-term-memory/file-lock/install.js +5 -1
- package/dist/src/runtime/adapters/long-term-memory/file-lock/owner-identity.d.ts +3 -0
- package/dist/src/runtime/adapters/long-term-memory/file-lock/owner-identity.js +15 -0
- package/dist/src/runtime/adapters/long-term-memory/file-lock/owner-record.js +2 -0
- package/dist/src/runtime/adapters/long-term-memory/onboarding-config-repository.js +17 -43
- package/dist/src/runtime/adapters/registered-tool-normal-invocations/catalog/registrations.js +6 -2
- package/dist/src/runtime/adapters/registered-tool-normal-invocations/execution/approval.js +10 -1
- package/dist/src/runtime/adapters/registered-tool-normal-invocations/execution/execution-binding.d.ts +11 -0
- package/dist/src/runtime/adapters/registered-tool-normal-invocations/execution/execution-binding.js +37 -0
- package/dist/src/runtime/adapters/registered-tool-normal-invocations/execution/file-output-presentation.d.ts +7 -0
- package/dist/src/runtime/adapters/registered-tool-normal-invocations/execution/file-output-presentation.js +105 -0
- package/dist/src/runtime/adapters/registered-tool-normal-invocations/execution/run.js +29 -3
- package/dist/src/runtime/adapters/registered-tool-normal-invocations/shared/action-fingerprint.d.ts +1 -0
- package/dist/src/runtime/adapters/registered-tool-normal-invocations/shared/action-fingerprint.js +1 -0
- package/dist/src/runtime/capabilities/configured-tool-registry.js +9 -1
- package/dist/src/runtime/capabilities/file-output-root-identity.d.ts +5 -0
- package/dist/src/runtime/capabilities/file-output-root-identity.js +146 -0
- package/dist/src/runtime/capabilities/file-output-root-marker-creation.d.ts +5 -0
- package/dist/src/runtime/capabilities/file-output-root-marker-creation.js +63 -0
- package/dist/src/runtime/capabilities/request-bound-tool-registry.d.ts +1 -0
- package/dist/src/runtime/capabilities/request-bound-tool-registry.js +6 -1
- package/dist/src/runtime/capabilities/request-module-preparation.d.ts +3 -0
- package/dist/src/runtime/capabilities/request-module-preparation.js +102 -0
- package/dist/src/runtime/capabilities/request-permission-catalog.d.ts +10 -0
- package/dist/src/runtime/capabilities/request-permission-catalog.js +50 -0
- package/dist/src/runtime/capabilities/request-permission-tool-registry.d.ts +4 -0
- package/dist/src/runtime/capabilities/request-permission-tool-registry.js +61 -0
- package/dist/src/runtime/capabilities/request-runtime-tool-registry.d.ts +3 -0
- package/dist/src/runtime/capabilities/request-runtime-tool-registry.js +5 -2
- package/dist/src/runtime/capabilities/request-working-directory.d.ts +3 -0
- package/dist/src/runtime/capabilities/request-working-directory.js +12 -0
- package/dist/src/runtime/composition.d.ts +2 -0
- package/dist/src/runtime/config/runner/loader.d.ts +4 -0
- package/dist/src/runtime/config/runner/loader.js +23 -3
- package/dist/src/runtime/context/capability-brief-budget.d.ts +18 -0
- package/dist/src/runtime/context/capability-brief-budget.js +38 -0
- package/dist/src/runtime/context/capability-brief-readmission.d.ts +21 -0
- package/dist/src/runtime/context/capability-brief-readmission.js +47 -0
- package/dist/src/runtime/context/capability-brief.d.ts +9 -2
- package/dist/src/runtime/context/capability-brief.js +21 -39
- package/dist/src/runtime/context/capability-descriptions.d.ts +3 -0
- package/dist/src/runtime/context/capability-descriptions.js +23 -0
- package/dist/src/runtime/default-environment-adapters.js +3 -4
- package/dist/src/runtime/local-application.d.ts +18 -0
- package/dist/src/runtime/local-application.js +12 -0
- package/dist/src/runtime/local-host/app-service-dispatch.d.ts +1 -0
- package/dist/src/runtime/local-host/app-service-dispatch.js +9 -0
- package/dist/src/runtime/local-host/client-services.d.ts +16 -0
- package/dist/src/runtime/local-host/client-services.js +3 -2
- package/dist/src/runtime/local-host/contracts.d.ts +4 -0
- package/dist/src/runtime/local-host/startup-connection.js +22 -7
- package/dist/src/runtime/local-host/transport.js +14 -2
- package/dist/src/runtime/orchestration/role-calls/candidate-validation.js +5 -2
- package/dist/src/runtime/orchestration/role-calls/command-decoder.js +3 -0
- package/dist/src/runtime/orchestration/role-calls/command-dispatch/work-plan-transition.d.ts +3 -0
- package/dist/src/runtime/orchestration/role-calls/command-dispatch/work-plan-transition.js +46 -0
- package/dist/src/runtime/orchestration/role-calls/command-dispatch.js +3 -0
- package/dist/src/runtime/orchestration/role-calls/contracts.d.ts +8 -4
- package/dist/src/runtime/orchestration/role-calls/transactions.js +2 -0
- package/dist/src/runtime/orchestration/role-calls/work-plan-contracts.d.ts +48 -0
- package/dist/src/runtime/orchestration/role-calls/work-plan-contracts.js +9 -0
- package/dist/src/runtime/orchestration/role-calls/work-plan-source.d.ts +7 -0
- package/dist/src/runtime/orchestration/role-calls/work-plan-source.js +85 -0
- package/dist/src/runtime/orchestration/role-calls/work-plan-transactions.d.ts +3 -0
- package/dist/src/runtime/orchestration/role-calls/work-plan-transactions.js +17 -0
- package/dist/src/runtime/orchestration/role-calls/work-plan-validation.d.ts +10 -0
- package/dist/src/runtime/orchestration/role-calls/work-plan-validation.js +149 -0
- package/dist/src/runtime/orchestration/worker-capabilities/contracts.d.ts +1 -1
- package/dist/src/runtime/orchestration/worker-capabilities/contracts.js +1 -1
- package/dist/src/runtime/plugins/compiled-catalog.d.ts +2 -1
- package/dist/src/runtime/plugins/configured-manifests.d.ts +3 -0
- package/dist/src/runtime/plugins/configured-manifests.js +37 -0
- package/dist/src/runtime/plugins/entrypoint-validation.d.ts +6 -0
- package/dist/src/runtime/plugins/entrypoint-validation.js +74 -0
- package/dist/src/runtime/plugins/loader.js +11 -123
- package/dist/src/runtime/plugins/manifest-discovery.d.ts +4 -1
- package/dist/src/runtime/plugins/manifest-discovery.js +8 -1
- package/dist/src/runtime/plugins/manifest-projection.js +3 -0
- package/dist/src/runtime/plugins/manifest-validator.js +7 -1
- package/dist/src/runtime/plugins/runtime-capability-plugins.d.ts +4 -0
- package/dist/src/runtime/plugins/runtime-capability-plugins.js +7 -0
- package/dist/src/runtime/plugins/selection.d.ts +14 -0
- package/dist/src/runtime/plugins/selection.js +38 -0
- package/dist/src/runtime/ports.d.ts +8 -2
- package/dist/src/runtime/projects/contracts.d.ts +40 -0
- package/dist/src/runtime/projects/contracts.js +10 -0
- package/dist/src/runtime/projects/folders.d.ts +7 -0
- package/dist/src/runtime/projects/folders.js +110 -0
- package/dist/src/runtime/projects/repository.d.ts +10 -0
- package/dist/src/runtime/projects/repository.js +54 -0
- package/dist/src/runtime/projects/service.d.ts +3 -0
- package/dist/src/runtime/projects/service.js +34 -0
- package/dist/src/runtime/projects/session-paths.d.ts +5 -0
- package/dist/src/runtime/projects/session-paths.js +13 -0
- package/dist/src/runtime/request/execution-agent-plan-update.d.ts +4 -0
- package/dist/src/runtime/request/execution-agent-plan-update.js +13 -0
- package/dist/src/runtime/request/execution-agent-root-execution.js +9 -1
- package/dist/src/runtime/request/handler.js +9 -2
- package/dist/src/runtime/request/input.d.ts +2 -1
- package/dist/src/runtime/request/input.js +1 -6
- package/dist/src/runtime/request/role-call-planner-events.js +4 -0
- package/dist/src/runtime/request/role-executor-composition.js +9 -1
- package/dist/src/runtime/request/root-contract.d.ts +6 -1
- package/dist/src/runtime/request/root-execution-kernel.js +17 -0
- package/dist/src/runtime/request/root-plan-event-projection.d.ts +3 -0
- package/dist/src/runtime/request/root-plan-event-projection.js +32 -0
- package/dist/src/runtime/request/root-plan-update.d.ts +15 -0
- package/dist/src/runtime/request/root-plan-update.js +20 -0
- package/dist/src/runtime/request/worker-capability-composition.d.ts +1 -0
- package/dist/src/runtime/request/worker-capability-composition.js +2 -0
- package/dist/src/runtime/runtime-environment.d.ts +1 -0
- package/dist/src/runtime/runtime-environment.js +2 -0
- package/dist/src/runtime/steps/auditor-decision/advisory-receipt.d.ts +32 -0
- package/dist/src/runtime/steps/auditor-decision/advisory-receipt.js +106 -0
- package/dist/src/runtime/steps/auditor-decision/advisory-result-budget.d.ts +5 -0
- package/dist/src/runtime/steps/auditor-decision/advisory-result-budget.js +40 -0
- package/dist/src/runtime/steps/auditor-decision/audit-input-state.d.ts +12 -0
- package/dist/src/runtime/steps/auditor-decision/audit-input-state.js +101 -0
- package/dist/src/runtime/steps/auditor-decision/contracts.d.ts +31 -16
- package/dist/src/runtime/steps/auditor-decision/contracts.js +3 -3
- package/dist/src/runtime/steps/auditor-decision/evidence-binding.d.ts +5 -0
- package/dist/src/runtime/steps/auditor-decision/evidence-binding.js +43 -0
- package/dist/src/runtime/steps/auditor-decision/evidence-coverage.d.ts +2 -0
- package/dist/src/runtime/steps/auditor-decision/evidence-coverage.js +71 -0
- package/dist/src/runtime/steps/auditor-decision/evidence-inventory.d.ts +13 -0
- package/dist/src/runtime/steps/auditor-decision/evidence-inventory.js +89 -0
- package/dist/src/runtime/steps/auditor-decision/evidence-representation.d.ts +10 -0
- package/dist/src/runtime/steps/auditor-decision/evidence-representation.js +56 -0
- package/dist/src/runtime/steps/auditor-decision/evidence-selection.d.ts +9 -0
- package/dist/src/runtime/steps/auditor-decision/evidence-selection.js +71 -0
- package/dist/src/runtime/steps/auditor-decision/format.js +44 -2
- package/dist/src/runtime/steps/auditor-decision/index.d.ts +3 -0
- package/dist/src/runtime/steps/auditor-decision/index.js +3 -0
- package/dist/src/runtime/steps/auditor-decision/input.d.ts +2 -2
- package/dist/src/runtime/steps/auditor-decision/input.js +64 -20
- package/dist/src/runtime/steps/auditor-decision/parser.js +38 -23
- package/dist/src/runtime/steps/auditor-decision/projection.js +49 -99
- package/dist/src/runtime/steps/auditor-decision/prompt.d.ts +1 -1
- package/dist/src/runtime/steps/auditor-decision/prompt.js +9 -4
- package/dist/src/runtime/steps/auditor-decision/run.js +79 -47
- package/dist/src/runtime/steps/execution-agent/contracts.d.ts +8 -1
- package/dist/src/runtime/steps/execution-agent/contracts.js +2 -0
- package/dist/src/runtime/steps/execution-agent/decision-parsing.js +4 -0
- package/dist/src/runtime/steps/execution-agent/format.js +4 -3
- package/dist/src/runtime/steps/execution-agent/input.js +10 -11
- package/dist/src/runtime/steps/execution-agent/prompt.d.ts +1 -0
- package/dist/src/runtime/steps/execution-agent/prompt.js +11 -4
- package/dist/src/runtime/steps/execution-agent/state-context.js +10 -0
- package/dist/src/runtime/steps/execution-agent/work-plan-contract.d.ts +18 -0
- package/dist/src/runtime/steps/execution-agent/work-plan-contract.js +86 -0
- package/dist/src/runtime/steps/execution-agent/work-plan-decision-parsing.d.ts +2 -0
- package/dist/src/runtime/steps/execution-agent/work-plan-decision-parsing.js +38 -0
- package/dist/src/runtime/steps/execution-agent/work-plan-sources.d.ts +6 -0
- package/dist/src/runtime/steps/execution-agent/work-plan-sources.js +54 -0
- package/dist/src/runtime/steps/planner-decision/capability-brief.d.ts +40 -0
- package/dist/src/runtime/steps/planner-decision/capability-brief.js +47 -0
- package/dist/src/runtime/steps/planner-decision/input.d.ts +4 -2
- package/dist/src/runtime/steps/planner-decision/input.js +23 -13
- package/dist/src/runtime/steps/planner-decision/prompt.js +2 -2
- package/dist/src/runtime/steps/planner-decision/run.js +11 -7
- package/dist/src/runtime/steps/planner-graph/parser.js +0 -11
- package/dist/src/runtime/steps/planner-graph/prompt.js +2 -1
- package/dist/src/runtime/steps/supervisor-decision/capability-brief-readmission.d.ts +10 -0
- package/dist/src/runtime/steps/supervisor-decision/capability-brief-readmission.js +39 -0
- package/dist/src/runtime/steps/supervisor-decision/run.js +2 -1
- package/dist/src/runtime/steps/worker-decision/parser/accepted-decision.d.ts +3 -1
- package/dist/src/runtime/steps/worker-decision/parser/accepted-decision.js +20 -1
- package/dist/src/runtime/steps/worker-decision/parser/capability-batch-validation.d.ts +1 -1
- package/dist/src/runtime/steps/worker-decision/parser/capability-batch-validation.js +6 -6
- package/dist/src/runtime/steps/worker-decision/parser/capability-invocation-validation.js +2 -1
- package/dist/src/sessions/project-binding.d.ts +12 -0
- package/dist/src/sessions/project-binding.js +49 -0
- package/dist/src/sessions/record/projection.d.ts +6 -1
- package/dist/src/sessions/record/projection.js +1 -0
- package/dist/src/sessions/session-service.d.ts +2 -1
- package/dist/src/sessions/session-service.js +11 -1
- package/dist/src/sessions/types.d.ts +7 -0
- package/dist/src/web-ui/app/ARCHITECTURE.md +121 -1
- package/dist/src/web-ui/app/app-bootstrap.js +3 -0
- package/dist/src/web-ui/app/app-dom.js +3 -0
- package/dist/src/web-ui/app/app-state.js +38 -0
- package/dist/src/web-ui/app/app.js +76 -67
- package/dist/src/web-ui/app/components/config-workspace/config-model.js +23 -3
- package/dist/src/web-ui/app/components/config-workspace/dashboard-rendering.js +2 -0
- package/dist/src/web-ui/app/components/config-workspace/field-rendering.js +2 -0
- package/dist/src/web-ui/app/components/config-workspace/model-rendering.js +6 -0
- package/dist/src/web-ui/app/components/config-workspace/model-setup-entry.js +27 -0
- package/dist/src/web-ui/app/components/config-workspace/raw-config-repair.js +28 -0
- package/dist/src/web-ui/app/components/config-workspace/workspace-events.js +5 -0
- package/dist/src/web-ui/app/components/config-workspace/workspace-mutations.js +23 -3
- package/dist/src/web-ui/app/components/config-workspace/workspace-persistence.js +26 -8
- package/dist/src/web-ui/app/components/config-workspace/workspace-view.js +56 -0
- package/dist/src/web-ui/app/components/config-workspace.js +11 -0
- package/dist/src/web-ui/app/components/conversation-activity.d.ts +6 -0
- package/dist/src/web-ui/app/components/conversation-activity.js +10 -2
- package/dist/src/web-ui/app/components/conversation-file-action.js +33 -0
- package/dist/src/web-ui/app/components/conversation-file-focus.d.ts +12 -0
- package/dist/src/web-ui/app/components/conversation-file-focus.js +149 -0
- package/dist/src/web-ui/app/components/conversation-file-preview.d.ts +23 -0
- package/dist/src/web-ui/app/components/conversation-file-preview.js +247 -0
- package/dist/src/web-ui/app/components/conversation-role-cards.d.ts +6 -0
- package/dist/src/web-ui/app/components/conversation-role-cards.js +10 -2
- package/dist/src/web-ui/app/components/conversation-tool-evidence.d.ts +9 -0
- package/dist/src/web-ui/app/components/conversation-tool-evidence.js +129 -0
- package/dist/src/web-ui/app/components/conversation-tools.d.ts +6 -0
- package/dist/src/web-ui/app/components/conversation-tools.js +25 -105
- package/dist/src/web-ui/app/components/conversation-view.js +10 -1
- package/dist/src/web-ui/app/components/dashboard/workspace.js +19 -7
- package/dist/src/web-ui/app/components/model-setup/rendering.js +99 -0
- package/dist/src/web-ui/app/components/model-setup/save-flow.js +111 -0
- package/dist/src/web-ui/app/components/model-setup/save-outcome.js +16 -0
- package/dist/src/web-ui/app/components/model-setup/validation.js +125 -0
- package/dist/src/web-ui/app/components/model-setup/wizard.d.ts +44 -0
- package/dist/src/web-ui/app/components/model-setup/wizard.js +370 -0
- package/dist/src/web-ui/app/components/plugins/manager.js +200 -0
- package/dist/src/web-ui/app/components/plugins/rendering.js +124 -0
- package/dist/src/web-ui/app/components/plugins/view-state.js +123 -0
- package/dist/src/web-ui/app/components/project-creation.js +119 -0
- package/dist/src/web-ui/app/components/project-session-groups.js +95 -0
- package/dist/src/web-ui/app/components/runtime-config-activation.js +83 -0
- package/dist/src/web-ui/app/components/runtime-setup/bridge-guide.d.ts +9 -0
- package/dist/src/web-ui/app/components/runtime-setup/bridge-guide.js +198 -0
- package/dist/src/web-ui/app/components/runtime-setup/bridge-rendering.js +107 -0
- package/dist/src/web-ui/app/components/runtime-setup/commands.js +54 -0
- package/dist/src/web-ui/app/components/runtime-setup/configuration-recovery.js +25 -0
- package/dist/src/web-ui/app/components/runtime-setup/connection-form.js +154 -0
- package/dist/src/web-ui/app/components/runtime-setup/connection-state.js +71 -0
- package/dist/src/web-ui/app/components/runtime-setup/context-window.js +18 -0
- package/dist/src/web-ui/app/components/runtime-setup/embedding-credential-status.d.ts +15 -0
- package/dist/src/web-ui/app/components/runtime-setup/embedding-credential-status.js +87 -0
- package/dist/src/web-ui/app/components/runtime-setup/embedding-provider-receipt.js +30 -0
- package/dist/src/web-ui/app/components/runtime-setup/embedding-rendering.js +57 -0
- package/dist/src/web-ui/app/components/runtime-setup/embedding.js +284 -0
- package/dist/src/web-ui/app/components/runtime-setup/optional-steps.js +117 -0
- package/dist/src/web-ui/app/components/runtime-setup/plugins.js +173 -0
- package/dist/src/web-ui/app/components/runtime-setup/rendering.js +141 -0
- package/dist/src/web-ui/app/components/runtime-setup/validation.js +69 -0
- package/dist/src/web-ui/app/components/runtime-setup/view-state.js +58 -0
- package/dist/src/web-ui/app/components/runtime-setup/wizard-shell.js +27 -0
- package/dist/src/web-ui/app/components/runtime-setup-guide.d.ts +66 -5
- package/dist/src/web-ui/app/components/runtime-setup-guide.js +415 -461
- package/dist/src/web-ui/app/components/system-host/download.js +38 -0
- package/dist/src/web-ui/app/components/system-host/manager.js +249 -0
- package/dist/src/web-ui/app/components/system-host/rendering.js +88 -0
- package/dist/src/web-ui/app/components/system-host/setup-notice.js +87 -0
- package/dist/src/web-ui/app/components/system-host/visibility.js +35 -0
- package/dist/src/web-ui/app/components/tool-approval-card.d.ts +4 -0
- package/dist/src/web-ui/app/components/tool-approval-card.js +15 -0
- package/dist/src/web-ui/app/configuration-environment-refresh.js +118 -0
- package/dist/src/web-ui/app/configuration-feature.js +125 -4
- package/dist/src/web-ui/app/controllers/app-event-bindings.js +2 -0
- package/dist/src/web-ui/app/controllers/composer-workspace-controller.d.ts +1 -0
- package/dist/src/web-ui/app/controllers/composer-workspace-controller.js +4 -3
- package/dist/src/web-ui/app/controllers/conversation-file-preview-controller.d.ts +24 -0
- package/dist/src/web-ui/app/controllers/conversation-file-preview-controller.js +158 -0
- package/dist/src/web-ui/app/controllers/conversation-file-preview-feature.d.ts +19 -0
- package/dist/src/web-ui/app/controllers/conversation-file-preview-feature.js +63 -0
- package/dist/src/web-ui/app/controllers/conversation-session-controller.d.ts +1 -0
- package/dist/src/web-ui/app/controllers/conversation-session-controller.js +2 -0
- package/dist/src/web-ui/app/controllers/conversation-view-feature.js +28 -0
- package/dist/src/web-ui/app/controllers/dashboard-controller.js +17 -0
- package/dist/src/web-ui/app/controllers/projects-controller.d.ts +45 -0
- package/dist/src/web-ui/app/controllers/projects-controller.js +278 -0
- package/dist/src/web-ui/app/controllers/realtime-event-controller.js +3 -0
- package/dist/src/web-ui/app/controllers/runtime-onboarding-controller.js +13 -6
- package/dist/src/web-ui/app/controllers/runtime-selection-controller.d.ts +7 -1
- package/dist/src/web-ui/app/controllers/runtime-selection-controller.js +11 -95
- package/dist/src/web-ui/app/controllers/session-controller.js +64 -57
- package/dist/src/web-ui/app/controllers/tool-permission-mode-controller.d.ts +20 -0
- package/dist/src/web-ui/app/controllers/tool-permission-mode-controller.js +116 -0
- package/dist/src/web-ui/app/dashboard-feature.js +32 -10
- package/dist/src/web-ui/app/index.html +44 -7
- package/dist/src/web-ui/app/lib/conversation-file-preview.d.ts +12 -0
- package/dist/src/web-ui/app/lib/conversation-file-reference.d.ts +30 -0
- package/dist/src/web-ui/app/lib/conversation-file-reference.js +66 -0
- package/dist/src/web-ui/app/lib/tool-activity-event.d.ts +2 -0
- package/dist/src/web-ui/app/lib/tool-activity-event.js +18 -6
- package/dist/src/web-ui/app/lib/tool-activity-model.d.ts +2 -0
- package/dist/src/web-ui/app/lib/tool-activity-model.js +4 -2
- package/dist/src/web-ui/app/lib/tool-permission-mode.d.ts +16 -0
- package/dist/src/web-ui/app/lib/tool-permission-mode.js +60 -0
- package/dist/src/web-ui/app/lib/tool-process-activity-fields.js +102 -0
- package/dist/src/web-ui/app/projects-feature.js +134 -0
- package/dist/src/web-ui/app/runtime-onboarding-feature.d.ts +34 -0
- package/dist/src/web-ui/app/runtime-onboarding-feature.js +92 -0
- package/dist/src/web-ui/app/runtime-setup-page-lifecycle.d.ts +5 -0
- package/dist/src/web-ui/app/runtime-setup-page-lifecycle.js +13 -0
- package/dist/src/web-ui/app/services/client-preferences.d.ts +24 -0
- package/dist/src/web-ui/app/services/client-preferences.js +32 -19
- package/dist/src/web-ui/app/services/runtime-web-client/configuration.js +46 -0
- package/dist/src/web-ui/app/services/runtime-web-client/conversation-files.d.ts +28 -0
- package/dist/src/web-ui/app/services/runtime-web-client/conversation-files.js +75 -0
- package/dist/src/web-ui/app/services/runtime-web-client/projects.d.ts +19 -0
- package/dist/src/web-ui/app/services/runtime-web-client/projects.js +34 -0
- package/dist/src/web-ui/app/services/runtime-web-client/system-host.js +27 -0
- package/dist/src/web-ui/app/services/runtime-web-client.d.ts +52 -0
- package/dist/src/web-ui/app/services/runtime-web-client.js +35 -4
- package/dist/src/web-ui/app/styles/13-projects.css +272 -0
- package/dist/src/web-ui/app/styles/18-dashboard.css +0 -5
- package/dist/src/web-ui/app/styles/19-runtime-setup.css +411 -0
- package/dist/src/web-ui/app/styles/20-chat-composer.css +0 -384
- package/dist/src/web-ui/app/styles/29-conversation-file-preview.css +254 -0
- package/dist/src/web-ui/app/styles/37-runtime-activation.css +26 -0
- package/dist/src/web-ui/app/styles/38-schedule-workspace.css +1 -10
- package/dist/src/web-ui/app/styles/41-plugin-management.css +351 -0
- package/dist/src/web-ui/app/styles/42-runtime-setup-plugins.css +179 -0
- package/dist/src/web-ui/app/styles/43-model-setup.css +73 -0
- package/dist/src/web-ui/app/styles/44-model-provider-cards.css +63 -0
- package/dist/src/web-ui/app/styles/45-bridge-setup.css +44 -0
- package/dist/src/web-ui/app/styles/46-system-host.css +132 -0
- package/dist/src/web-ui/app/styles.css +10 -0
- package/dist/src/web-ui/config-dashboard-backend.d.ts +5 -0
- package/dist/src/web-ui/config-dashboard-backend.js +94 -114
- package/dist/src/web-ui/config-dashboard-model-identity.d.ts +7 -0
- package/dist/src/web-ui/config-dashboard-model-identity.js +45 -0
- package/dist/src/web-ui/config-dashboard-save-transaction.d.ts +5 -0
- package/dist/src/web-ui/config-dashboard-save-transaction.js +21 -0
- package/dist/src/web-ui/environment-config.d.ts +17 -0
- package/dist/src/web-ui/environment-config.js +60 -0
- package/dist/src/web-ui/forwarded-loopback-policy.d.ts +2 -0
- package/dist/src/web-ui/forwarded-loopback-policy.js +14 -0
- package/dist/src/web-ui/local-runtime/api-router.d.ts +7 -0
- package/dist/src/web-ui/local-runtime/api-router.js +136 -12
- package/dist/src/web-ui/local-runtime/config-mutation-request.d.ts +8 -0
- package/dist/src/web-ui/local-runtime/config-mutation-request.js +55 -0
- package/dist/src/web-ui/local-runtime/configuration-activation-environments.d.ts +22 -0
- package/dist/src/web-ui/local-runtime/configuration-activation-environments.js +106 -0
- package/dist/src/web-ui/local-runtime/configuration-activation-source.d.ts +7 -0
- package/dist/src/web-ui/local-runtime/configuration-activation-source.js +36 -0
- package/dist/src/web-ui/local-runtime/configuration-activation.d.ts +20 -0
- package/dist/src/web-ui/local-runtime/configuration-activation.js +107 -0
- package/dist/src/web-ui/local-runtime/contracts.d.ts +8 -0
- package/dist/src/web-ui/local-runtime/conversation-file-access.d.ts +30 -0
- package/dist/src/web-ui/local-runtime/conversation-file-access.js +131 -0
- package/dist/src/web-ui/local-runtime/conversation-file-content.d.ts +21 -0
- package/dist/src/web-ui/local-runtime/conversation-file-content.js +75 -0
- package/dist/src/web-ui/local-runtime/conversation-file-format.d.ts +12 -0
- package/dist/src/web-ui/local-runtime/conversation-file-format.js +87 -0
- package/dist/src/web-ui/local-runtime/conversation-file-native-open.d.ts +10 -0
- package/dist/src/web-ui/local-runtime/conversation-file-native-open.js +94 -0
- package/dist/src/web-ui/local-runtime/conversation-file-native-request.d.ts +4 -0
- package/dist/src/web-ui/local-runtime/conversation-file-native-request.js +72 -0
- package/dist/src/web-ui/local-runtime/conversation-file-routes.d.ts +11 -0
- package/dist/src/web-ui/local-runtime/conversation-file-routes.js +105 -0
- package/dist/src/web-ui/local-runtime/conversation-file-target.d.ts +14 -0
- package/dist/src/web-ui/local-runtime/conversation-file-target.js +158 -0
- package/dist/src/web-ui/local-runtime/environment-registry.d.ts +14 -0
- package/dist/src/web-ui/local-runtime/environment-registry.js +121 -6
- package/dist/src/web-ui/local-runtime/memory-onboarding-routes.d.ts +2 -1
- package/dist/src/web-ui/local-runtime/memory-onboarding-routes.js +15 -10
- package/dist/src/web-ui/local-runtime/model-setup-catalog.d.ts +17 -0
- package/dist/src/web-ui/local-runtime/model-setup-catalog.js +45 -0
- package/dist/src/web-ui/local-runtime/model-setup-identity.d.ts +16 -0
- package/dist/src/web-ui/local-runtime/model-setup-identity.js +20 -0
- package/dist/src/web-ui/local-runtime/model-setup-input.d.ts +24 -0
- package/dist/src/web-ui/local-runtime/model-setup-input.js +107 -0
- package/dist/src/web-ui/local-runtime/model-setup-provider.d.ts +17 -0
- package/dist/src/web-ui/local-runtime/model-setup-provider.js +68 -0
- package/dist/src/web-ui/local-runtime/model-setup-retry.d.ts +14 -0
- package/dist/src/web-ui/local-runtime/model-setup-retry.js +47 -0
- package/dist/src/web-ui/local-runtime/model-setup-routes.d.ts +12 -0
- package/dist/src/web-ui/local-runtime/model-setup-routes.js +50 -0
- package/dist/src/web-ui/local-runtime/model-setup-service.d.ts +30 -0
- package/dist/src/web-ui/local-runtime/model-setup-service.js +93 -0
- package/dist/src/web-ui/local-runtime/model-setup-validation.d.ts +5 -0
- package/dist/src/web-ui/local-runtime/model-setup-validation.js +33 -0
- package/dist/src/web-ui/local-runtime/plugin-management-routes.d.ts +14 -0
- package/dist/src/web-ui/local-runtime/plugin-management-routes.js +50 -0
- package/dist/src/web-ui/local-runtime/project-routes.d.ts +17 -0
- package/dist/src/web-ui/local-runtime/project-routes.js +93 -0
- package/dist/src/web-ui/local-runtime/provider-credential-identity.d.ts +3 -0
- package/dist/src/web-ui/local-runtime/provider-credential-identity.js +18 -0
- package/dist/src/web-ui/local-runtime/request-execution.d.ts +1 -0
- package/dist/src/web-ui/local-runtime/request-execution.js +8 -0
- package/dist/src/web-ui/local-runtime/runtime-availability.js +36 -7
- package/dist/src/web-ui/local-runtime/runtime-setup-completion.d.ts +13 -0
- package/dist/src/web-ui/local-runtime/runtime-setup-completion.js +28 -0
- package/dist/src/web-ui/local-runtime/runtime-setup-connection-edit.d.ts +13 -0
- package/dist/src/web-ui/local-runtime/runtime-setup-connection-edit.js +110 -0
- package/dist/src/web-ui/local-runtime/runtime-setup-credential-completion.d.ts +4 -0
- package/dist/src/web-ui/local-runtime/runtime-setup-credential-completion.js +21 -0
- package/dist/src/web-ui/local-runtime/runtime-setup-credentials.d.ts +14 -0
- package/dist/src/web-ui/local-runtime/runtime-setup-credentials.js +148 -0
- package/dist/src/web-ui/local-runtime/runtime-setup-draft-recovery.d.ts +7 -0
- package/dist/src/web-ui/local-runtime/runtime-setup-draft-recovery.js +18 -0
- package/dist/src/web-ui/local-runtime/runtime-setup-draft.d.ts +21 -0
- package/dist/src/web-ui/local-runtime/runtime-setup-draft.js +105 -0
- package/dist/src/web-ui/local-runtime/runtime-setup-embedding-invalidation.d.ts +8 -0
- package/dist/src/web-ui/local-runtime/runtime-setup-embedding-invalidation.js +40 -0
- package/dist/src/web-ui/local-runtime/runtime-setup-environment-assignment.d.ts +1 -0
- package/dist/src/web-ui/local-runtime/runtime-setup-environment-assignment.js +27 -0
- package/dist/src/web-ui/local-runtime/runtime-setup-input.d.ts +19 -0
- package/dist/src/web-ui/local-runtime/runtime-setup-input.js +82 -0
- package/dist/src/web-ui/local-runtime/runtime-setup-model-file.d.ts +7 -0
- package/dist/src/web-ui/local-runtime/runtime-setup-model-file.js +35 -0
- package/dist/src/web-ui/local-runtime/runtime-setup-provider-ownership-recovery.d.ts +4 -0
- package/dist/src/web-ui/local-runtime/runtime-setup-provider-ownership-recovery.js +23 -0
- package/dist/src/web-ui/local-runtime/runtime-setup-provider-retention.d.ts +11 -0
- package/dist/src/web-ui/local-runtime/runtime-setup-provider-retention.js +31 -0
- package/dist/src/web-ui/local-runtime/runtime-setup-provider.d.ts +11 -0
- package/dist/src/web-ui/local-runtime/runtime-setup-provider.js +60 -0
- package/dist/src/web-ui/local-runtime/runtime-setup-receipt-file.d.ts +8 -0
- package/dist/src/web-ui/local-runtime/runtime-setup-receipt-file.js +77 -0
- package/dist/src/web-ui/local-runtime/runtime-setup-routes.d.ts +35 -0
- package/dist/src/web-ui/local-runtime/runtime-setup-routes.js +56 -0
- package/dist/src/web-ui/local-runtime/runtime-setup-scaffold.d.ts +17 -0
- package/dist/src/web-ui/local-runtime/runtime-setup-scaffold.js +229 -0
- package/dist/src/web-ui/local-runtime/runtime-setup-service.d.ts +65 -0
- package/dist/src/web-ui/local-runtime/runtime-setup-service.js +195 -0
- package/dist/src/web-ui/local-runtime/runtime-setup-validation.d.ts +8 -0
- package/dist/src/web-ui/local-runtime/runtime-setup-validation.js +35 -0
- package/dist/src/web-ui/local-runtime/saved-model-catalog.d.ts +3 -0
- package/dist/src/web-ui/local-runtime/saved-model-catalog.js +20 -0
- package/dist/src/web-ui/local-runtime/setup-embedding-input.d.ts +8 -0
- package/dist/src/web-ui/local-runtime/setup-embedding-input.js +71 -0
- package/dist/src/web-ui/local-runtime/setup-embedding-provider.d.ts +13 -0
- package/dist/src/web-ui/local-runtime/setup-embedding-provider.js +114 -0
- package/dist/src/web-ui/local-runtime/setup-embedding-routes.d.ts +12 -0
- package/dist/src/web-ui/local-runtime/setup-embedding-routes.js +53 -0
- package/dist/src/web-ui/local-runtime/setup-embedding-service.d.ts +32 -0
- package/dist/src/web-ui/local-runtime/setup-embedding-service.js +59 -0
- package/dist/src/web-ui/local-runtime-backend.d.ts +1 -0
- package/dist/src/web-ui/local-runtime-backend.js +3 -0
- package/dist/src/web-ui/plugin-capability-selection.d.ts +14 -0
- package/dist/src/web-ui/plugin-capability-selection.js +48 -0
- package/dist/src/web-ui/plugin-management-catalog.d.ts +26 -0
- package/dist/src/web-ui/plugin-management-catalog.js +56 -0
- package/dist/src/web-ui/plugin-management-selection.d.ts +16 -0
- package/dist/src/web-ui/plugin-management-selection.js +71 -0
- package/dist/src/web-ui/plugin-management-service.d.ts +29 -0
- package/dist/src/web-ui/plugin-management-service.js +150 -0
- package/dist/src/web-ui/request-authority.d.ts +8 -0
- package/dist/src/web-ui/request-authority.js +129 -0
- package/dist/src/web-ui/runtime-setup-gateway-address.d.ts +3 -0
- package/dist/src/web-ui/runtime-setup-gateway-address.js +26 -0
- package/dist/src/web-ui/runtime-setup-gateway.d.ts +29 -0
- package/dist/src/web-ui/runtime-setup-gateway.js +177 -0
- package/dist/src/web-ui/runtime-setup-shutdown.d.ts +2 -0
- package/dist/src/web-ui/runtime-setup-shutdown.js +20 -0
- package/dist/src/web-ui/server.d.ts +7 -14
- package/dist/src/web-ui/server.js +53 -63
- package/dist/src/web-ui/session-read-state/service.d.ts +12 -2
- package/dist/src/web-ui/system-host-service.d.ts +19 -0
- package/dist/src/web-ui/system-host-service.js +159 -0
- package/dist/src/web-ui/system-host-setup/companion-bundle.d.ts +2 -0
- package/dist/src/web-ui/system-host-setup/companion-bundle.js +12 -0
- package/dist/src/web-ui/system-host-setup/companion-macos.d.ts +2 -0
- package/dist/src/web-ui/system-host-setup/companion-macos.js +74 -0
- package/dist/src/web-ui/system-host-setup/companion-windows.d.ts +2 -0
- package/dist/src/web-ui/system-host-setup/companion-windows.js +105 -0
- package/dist/src/web-ui/system-host-setup/installer-contract.d.ts +18 -0
- package/dist/src/web-ui/system-host-setup/installer-contract.js +51 -0
- package/dist/src/web-ui/system-host-setup/installers.d.ts +6 -0
- package/dist/src/web-ui/system-host-setup/installers.js +30 -0
- package/dist/src/web-ui/system-host-setup/native-authorization.d.ts +3 -0
- package/dist/src/web-ui/system-host-setup/native-authorization.js +11 -0
- package/dist/src/web-ui/system-host-setup/node-distribution.d.ts +19 -0
- package/dist/src/web-ui/system-host-setup/node-distribution.js +9 -0
- package/dist/src/web-ui/system-host-setup/readiness.d.ts +18 -0
- package/dist/src/web-ui/system-host-setup/readiness.js +70 -0
- package/dist/src/web-ui/system-host-setup/routes.d.ts +20 -0
- package/dist/src/web-ui/system-host-setup/routes.js +121 -0
- package/dist/src/web-ui/system-host-setup/windows-script-wrapper.d.ts +2 -0
- package/dist/src/web-ui/system-host-setup/windows-script-wrapper.js +17 -0
- package/dist/src/web-ui/system-host-setup/wsl-interop-config.d.ts +3 -0
- package/dist/src/web-ui/system-host-setup/wsl-interop-config.js +67 -0
- package/dist/src/web-ui/system-host-setup/wsl-interop-windows.d.ts +1 -0
- package/dist/src/web-ui/system-host-setup/wsl-interop-windows.js +49 -0
- package/dist/src/web-ui/system-host-upgrade-authority.d.ts +5 -0
- package/dist/src/web-ui/system-host-upgrade-authority.js +13 -0
- package/docs/architecture.md +6 -1
- package/docs/installation.md +53 -17
- package/docs/known-limitations.md +14 -0
- package/docs/plugins.md +124 -19
- package/docs/projects-and-full-plus.md +218 -0
- package/docs/runtime-invariant-coverage.md +6 -3
- package/docs/runtime-prompt-policy-contracts.md +37 -5
- package/docs/runtime-public-contracts.md +17 -0
- package/package.json +5 -2
- package/plugins/exec/plugin.json +30 -9
- package/plugins/exec/skills/exec_process_skill/SKILL.md +1 -0
- package/plugins/exec/skills/exec_skill/SKILL.md +9 -10
- package/plugins/exec/source/handlers.ts +4 -38
- package/plugins/exec/source/paths.ts +53 -49
- package/plugins/exec/source/types.ts +6 -4
- package/plugins/exec/source/validation.ts +33 -198
- package/plugins/exec/src/index.cjs +62 -204
- package/plugins/filesystem/plugin.json +1 -1
- package/plugins/filesystem/skills/dev_view_skill/SKILL.md +7 -0
- package/plugins/filesystem/source/atomic-write.ts +6 -3
- package/plugins/filesystem/source/dev-view.ts +2 -1
- package/plugins/filesystem/source/directory-authority-write.ts +4 -0
- package/plugins/filesystem/source/edit-file.ts +3 -0
- package/plugins/filesystem/source/file-output-presentation.ts +42 -0
- package/plugins/filesystem/source/mutation-parent.ts +18 -9
- package/plugins/filesystem/source/view-locator.ts +141 -0
- package/plugins/filesystem/source/view-window.ts +12 -25
- package/plugins/filesystem/source/write-file.ts +8 -0
- package/plugins/filesystem/src/index.cjs +162 -35
- package/plugins/system/plugin.json +374 -0
- package/plugins/system/skills/system_actions/SKILL.md +31 -0
- package/plugins/system/source/application-catalog.ts +237 -0
- package/plugins/system/source/application-launch.ts +113 -0
- package/plugins/system/source/application-observation.ts +78 -0
- package/plugins/system/source/commands.ts +106 -0
- package/plugins/system/source/companion/autostart.ts +185 -0
- package/plugins/system/source/companion/broker-client.ts +183 -0
- package/plugins/system/source/companion/broker-location.ts +89 -0
- package/plugins/system/source/companion/broker-server.ts +169 -0
- package/plugins/system/source/companion/connection.ts +211 -0
- package/plugins/system/source/companion/liveness.ts +23 -0
- package/plugins/system/source/companion/native-address.ts +55 -0
- package/plugins/system/source/companion/native-identity.ts +26 -0
- package/plugins/system/source/companion/native-messages.ts +100 -0
- package/plugins/system/source/companion/native-session.ts +268 -0
- package/plugins/system/source/companion/native-state.ts +135 -0
- package/plugins/system/source/companion/native-supervisor.ts +98 -0
- package/plugins/system/source/companion/pairing-store.ts +110 -0
- package/plugins/system/source/companion/private-store.ts +58 -0
- package/plugins/system/source/companion/process-owner-identity.ts +190 -0
- package/plugins/system/source/companion/protocol.ts +108 -0
- package/plugins/system/source/contracts.ts +44 -0
- package/plugins/system/source/elevation.ts +88 -0
- package/plugins/system/source/handlers.ts +120 -0
- package/plugins/system/source/host-dispatch.ts +106 -0
- package/plugins/system/source/host-evidence.ts +72 -0
- package/plugins/system/source/host-observation.ts +66 -0
- package/plugins/system/source/index.ts +8 -0
- package/plugins/system/source/process-result.ts +111 -0
- package/plugins/system/source/process-runner.ts +104 -0
- package/plugins/system/source/request-system-modules.ts +117 -0
- package/plugins/system/source/request-target-snapshot.ts +163 -0
- package/plugins/system/source/target-observation.ts +43 -0
- package/plugins/system/source/targets.ts +147 -0
- package/plugins/system/src/index.cjs +1730 -0
- package/src/runtime/README.md +36 -8
- package/src/runtime/local-host/README.md +7 -0
- package/dist/src/runtime/steps/planner-decision/capability-catalog-context.d.ts +0 -14
- package/dist/src/runtime/steps/planner-decision/capability-catalog-context.js +0 -87
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
import { createRuntimeSetupDraft, } from "./runtime-setup-draft.js";
|
|
2
|
+
import { withConfigFileTransaction, readConfigFileSnapshot, } from "../../runtime/adapters/config-file-transaction.js";
|
|
3
|
+
import { validateRuntimeSetupPlan } from "./runtime-setup-validation.js";
|
|
4
|
+
import { planRuntimeSetupModelFile } from "./runtime-setup-model-file.js";
|
|
5
|
+
import { recoverSetupProviderOwnership } from "./runtime-setup-provider-ownership-recovery.js";
|
|
6
|
+
import { retainSetupConnectionProviders } from "./runtime-setup-provider-retention.js";
|
|
7
|
+
import { shouldInvalidateSetupEmbedding } from "./runtime-setup-embedding-invalidation.js";
|
|
8
|
+
import { constants } from "node:fs";
|
|
9
|
+
import { access, copyFile, lstat, mkdir, readFile, rm } from "node:fs/promises";
|
|
10
|
+
import { dirname, join, relative, resolve } from "node:path";
|
|
11
|
+
import { isDeepStrictEqual } from "node:util";
|
|
12
|
+
import { buildModelConfig, buildProviderConfig, DEFAULT_ROOT_RESPONSE_METHODOLOGY_FILES, isRecord, readJsonObject, resolveRuntimePackageRoot, writeJsonObject, } from "../../../scripts/runtime-setup-files.js";
|
|
13
|
+
import { inspectRuntimeConfigFileWithMeta, } from "../../runtime/config/loader.js";
|
|
14
|
+
import { parseRequestRunnerConfig } from "../../runtime/config/runner/versioned-config.js";
|
|
15
|
+
import { RuntimeSetupError, } from "./runtime-setup-input.js";
|
|
16
|
+
async function removeUnchangedSetupFile(file) {
|
|
17
|
+
try {
|
|
18
|
+
const info = await lstat(file.path);
|
|
19
|
+
if (!info.isFile() || info.isSymbolicLink())
|
|
20
|
+
return;
|
|
21
|
+
if ((await readFile(file.path, "utf8")) !== file.expectedContent)
|
|
22
|
+
return;
|
|
23
|
+
await rm(file.path, { force: true });
|
|
24
|
+
}
|
|
25
|
+
catch {
|
|
26
|
+
// A changed or inaccessible file belongs to its current owner and is retained.
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
async function pathExists(path) {
|
|
30
|
+
try {
|
|
31
|
+
await access(path, constants.F_OK);
|
|
32
|
+
return true;
|
|
33
|
+
}
|
|
34
|
+
catch (error) {
|
|
35
|
+
if (error instanceof Error && "code" in error && error.code === "ENOENT")
|
|
36
|
+
return false;
|
|
37
|
+
throw error;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
function configMap(value) {
|
|
41
|
+
return isRecord(value) ? value : {};
|
|
42
|
+
}
|
|
43
|
+
function requireEmptyModelProfiles(source) {
|
|
44
|
+
const models = configMap(source.config.models);
|
|
45
|
+
const profiles = configMap(models.profiles);
|
|
46
|
+
if (Object.keys(profiles).length > 0) {
|
|
47
|
+
throw new RuntimeSetupError("setup_configuration_exists", "Model profiles already exist. Use configuration settings to change them.", 409);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
function requireCompatibleProvider(existing, requested, owned) {
|
|
51
|
+
if (existing === undefined)
|
|
52
|
+
return;
|
|
53
|
+
if (owned)
|
|
54
|
+
return;
|
|
55
|
+
if (!isDeepStrictEqual(existing, requested)) {
|
|
56
|
+
throw new RuntimeSetupError("setup_provider_conflict", "This provider already has settings. Preserve or edit them in configuration settings.", 409);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
async function planRunnerFile(path, template) {
|
|
60
|
+
if (!(await pathExists(path)))
|
|
61
|
+
return [{ path, value: template }];
|
|
62
|
+
const runner = parseRequestRunnerConfig(await readJsonObject(path), path);
|
|
63
|
+
if (runner.models.defaults.profileId !== "default") {
|
|
64
|
+
throw new RuntimeSetupError("setup_runner_conflict", "The existing request runner selects another model. Preserve or edit it in configuration settings.", 409);
|
|
65
|
+
}
|
|
66
|
+
return [];
|
|
67
|
+
}
|
|
68
|
+
function rebaseRunnerInstructions(runner, target) {
|
|
69
|
+
const steps = configMap(runner.steps);
|
|
70
|
+
return {
|
|
71
|
+
...runner,
|
|
72
|
+
steps: Object.fromEntries(Object.entries(steps).map(([id, value]) => {
|
|
73
|
+
const step = configMap(value);
|
|
74
|
+
if (!Array.isArray(step.instructionRefs))
|
|
75
|
+
return [id, value];
|
|
76
|
+
const refs = step.instructionRefs.map((ref) => target(ref.replace(/^\.\.\//u, "")));
|
|
77
|
+
return [id, { ...step, instructionRefs: refs }];
|
|
78
|
+
})),
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
async function restoreSetupScaffoldConfig(transaction, source, candidate) {
|
|
82
|
+
if (source.exists) {
|
|
83
|
+
await transaction.write(source.config, { expectedConfig: candidate });
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
const current = await readConfigFileSnapshot(transaction.path);
|
|
87
|
+
if (current.revision !== transaction.snapshot.revision)
|
|
88
|
+
throw new RuntimeSetupError("setup_configuration_changed", "Configuration changed while setup was being saved.", 409);
|
|
89
|
+
await rm(transaction.path, { force: true });
|
|
90
|
+
}
|
|
91
|
+
/** Uses the same package templates and provider/model builders as the CLI. */
|
|
92
|
+
export async function writeRuntimeSetupScaffold(params) {
|
|
93
|
+
return withConfigFileTransaction(params.configPath, (transaction) => saveRuntimeSetupScaffold(params, transaction));
|
|
94
|
+
}
|
|
95
|
+
async function saveRuntimeSetupScaffold(params, transaction) {
|
|
96
|
+
requireEmptyModelProfiles(params.source);
|
|
97
|
+
const templateRoot = resolveRuntimePackageRoot(import.meta.dirname);
|
|
98
|
+
const [runtimeTemplate, modelTemplate, runnerTemplate] = await Promise.all([
|
|
99
|
+
readJsonObject(join(templateRoot, "examples/runtime.config.example.json")),
|
|
100
|
+
readJsonObject(join(templateRoot, "examples/models/default.config.json")),
|
|
101
|
+
readJsonObject(join(templateRoot, "examples/request-runner.config.example.json")),
|
|
102
|
+
]);
|
|
103
|
+
const configDirectory = dirname(params.configPath);
|
|
104
|
+
const models = configMap(params.source.config.models);
|
|
105
|
+
const providers = configMap(models.providers);
|
|
106
|
+
const provider = buildProviderConfig(params.input.provider, params.input.baseUrl);
|
|
107
|
+
const ownedProviders = await recoverSetupProviderOwnership(params.source, params.recoveringDraft ? params.recoveryDraft : undefined, transaction.path);
|
|
108
|
+
const existingProvider = providers[params.input.provider];
|
|
109
|
+
requireCompatibleProvider(existingProvider, provider, Object.hasOwn(ownedProviders, params.input.provider));
|
|
110
|
+
const retained = retainSetupConnectionProviders({
|
|
111
|
+
providers,
|
|
112
|
+
ownedProviders,
|
|
113
|
+
embeddingProfiles: models.embeddingProfiles,
|
|
114
|
+
providerId: params.input.provider,
|
|
115
|
+
provider,
|
|
116
|
+
});
|
|
117
|
+
const embeddingInvalidated = shouldInvalidateSetupEmbedding({
|
|
118
|
+
config: params.source.config,
|
|
119
|
+
providerId: params.input.provider,
|
|
120
|
+
provider,
|
|
121
|
+
providerChanged: !isDeepStrictEqual(existingProvider, provider),
|
|
122
|
+
credentialChanged: params.credentialChanged === true,
|
|
123
|
+
});
|
|
124
|
+
const memory = configMap(params.source.config.longTermMemory);
|
|
125
|
+
const runnerSettings = configMap(params.source.config.requestRunner);
|
|
126
|
+
const runnerRef = typeof runnerSettings.configRef === "string" &&
|
|
127
|
+
runnerSettings.configRef.trim()
|
|
128
|
+
? runnerSettings.configRef
|
|
129
|
+
: "./request-runner.config.json";
|
|
130
|
+
const runnerPath = resolve(configDirectory, runnerRef);
|
|
131
|
+
const modelFile = await planRuntimeSetupModelFile(params.configPath, params.recoveringDraft === true);
|
|
132
|
+
const runnerModels = configMap(runnerTemplate.models);
|
|
133
|
+
runnerTemplate.models = {
|
|
134
|
+
...runnerModels,
|
|
135
|
+
defaults: { ...configMap(runnerModels.defaults), profileId: "default" },
|
|
136
|
+
};
|
|
137
|
+
const modelConfig = buildModelConfig(modelTemplate, params.input.provider, params.input.model, params.input.contextWindowTokens);
|
|
138
|
+
const rebasedRunner = rebaseRunnerInstructions(runnerTemplate, (file) => relative(dirname(runnerPath), join(params.rootDir, file)));
|
|
139
|
+
const runnerFiles = await planRunnerFile(runnerPath, rebasedRunner);
|
|
140
|
+
const plannedFiles = [
|
|
141
|
+
{ path: modelFile.path, value: modelConfig },
|
|
142
|
+
...runnerFiles,
|
|
143
|
+
];
|
|
144
|
+
const runtimeConfig = {
|
|
145
|
+
...runtimeTemplate,
|
|
146
|
+
...params.source.config,
|
|
147
|
+
models: {
|
|
148
|
+
...models,
|
|
149
|
+
providers: retained.providers,
|
|
150
|
+
profiles: { default: { configRef: modelFile.configRef } },
|
|
151
|
+
},
|
|
152
|
+
requestRunner: { ...runnerSettings, configRef: runnerRef },
|
|
153
|
+
...(embeddingInvalidated
|
|
154
|
+
? { longTermMemory: { ...memory, enabled: false } }
|
|
155
|
+
: {}),
|
|
156
|
+
};
|
|
157
|
+
const instructionSources = new Map();
|
|
158
|
+
for (const file of DEFAULT_ROOT_RESPONSE_METHODOLOGY_FILES) {
|
|
159
|
+
const existing = join(params.rootDir, file);
|
|
160
|
+
instructionSources.set(file, (await pathExists(existing)) ? existing : join(templateRoot, file));
|
|
161
|
+
}
|
|
162
|
+
await validateRuntimeSetupPlan({
|
|
163
|
+
rootDir: params.rootDir,
|
|
164
|
+
config: runtimeConfig,
|
|
165
|
+
modelConfig,
|
|
166
|
+
runnerPath,
|
|
167
|
+
...(runnerFiles.length
|
|
168
|
+
? {
|
|
169
|
+
runnerConfig: rebaseRunnerInstructions(runnerTemplate, (file) => join(templateRoot, file)),
|
|
170
|
+
}
|
|
171
|
+
: {}),
|
|
172
|
+
});
|
|
173
|
+
const current = inspectRuntimeConfigFileWithMeta(params.rootDir, params.source.path);
|
|
174
|
+
if (!isDeepStrictEqual(current, params.source)) {
|
|
175
|
+
throw new RuntimeSetupError("setup_configuration_changed", "Configuration changed while setup was being saved. Refresh and try again.", 409);
|
|
176
|
+
}
|
|
177
|
+
const created = [];
|
|
178
|
+
let configWritten = false;
|
|
179
|
+
try {
|
|
180
|
+
for (const file of plannedFiles) {
|
|
181
|
+
await mkdir(dirname(file.path), { recursive: true });
|
|
182
|
+
await writeJsonObject(file.path, file.value, { exclusive: true });
|
|
183
|
+
created.push({
|
|
184
|
+
path: file.path,
|
|
185
|
+
expectedContent: JSON.stringify(file.value, null, 2) + "\n",
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
for (const file of DEFAULT_ROOT_RESPONSE_METHODOLOGY_FILES) {
|
|
189
|
+
const destination = join(params.rootDir, file);
|
|
190
|
+
if (await pathExists(destination))
|
|
191
|
+
continue;
|
|
192
|
+
await mkdir(dirname(destination), { recursive: true });
|
|
193
|
+
const expectedContent = await readFile(join(templateRoot, file), "utf8");
|
|
194
|
+
await copyFile(join(templateRoot, file), destination, constants.COPYFILE_EXCL);
|
|
195
|
+
created.push({ path: destination, expectedContent });
|
|
196
|
+
}
|
|
197
|
+
await mkdir(configDirectory, { recursive: true });
|
|
198
|
+
const beforeCommit = inspectRuntimeConfigFileWithMeta(params.rootDir, params.source.path);
|
|
199
|
+
if (!isDeepStrictEqual(beforeCommit, params.source)) {
|
|
200
|
+
throw new RuntimeSetupError("setup_configuration_changed", "Configuration changed while setup was being saved. Refresh and try again.", 409);
|
|
201
|
+
}
|
|
202
|
+
const commit = async () => {
|
|
203
|
+
await transaction.write(runtimeConfig, {
|
|
204
|
+
expectedConfig: params.source.config,
|
|
205
|
+
});
|
|
206
|
+
configWritten = true;
|
|
207
|
+
return createRuntimeSetupDraft({ config: runtimeConfig, path: params.configPath, exists: true }, providers, params.input.provider, modelConfig, retained.ownedProviders);
|
|
208
|
+
};
|
|
209
|
+
const commitWithCredentials = params.commitWithCredentials ??
|
|
210
|
+
((operation) => operation());
|
|
211
|
+
const draft = await commitWithCredentials(commit);
|
|
212
|
+
return { draft, embeddingInvalidated };
|
|
213
|
+
}
|
|
214
|
+
catch (error) {
|
|
215
|
+
await rollbackScaffoldAfterFailure(error, configWritten, transaction, params.source, runtimeConfig);
|
|
216
|
+
await Promise.all(created.map(removeUnchangedSetupFile));
|
|
217
|
+
throw error;
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
async function rollbackScaffoldAfterFailure(error, configWritten, transaction, source, runtimeConfig) {
|
|
221
|
+
if (!configWritten)
|
|
222
|
+
return;
|
|
223
|
+
try {
|
|
224
|
+
await restoreSetupScaffoldConfig(transaction, source, runtimeConfig);
|
|
225
|
+
}
|
|
226
|
+
catch (rollbackError) {
|
|
227
|
+
throw new AggregateError([error, rollbackError], "Setup failed and its configuration could not be restored.");
|
|
228
|
+
}
|
|
229
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { type RuntimeSetupActivation } from "./runtime-setup-input.js";
|
|
2
|
+
export type RuntimeSetupServiceOptions = {
|
|
3
|
+
rootDir: string;
|
|
4
|
+
getConfigPath: () => string | undefined;
|
|
5
|
+
activate: (configPath: string) => Promise<RuntimeSetupActivation>;
|
|
6
|
+
configure?: (configPath: string) => void;
|
|
7
|
+
};
|
|
8
|
+
export declare class RuntimeSetupService {
|
|
9
|
+
private readonly options;
|
|
10
|
+
private savedConfigPath;
|
|
11
|
+
constructor(options: RuntimeSetupServiceOptions);
|
|
12
|
+
private source;
|
|
13
|
+
status(): Promise<{
|
|
14
|
+
providers: {
|
|
15
|
+
id: string;
|
|
16
|
+
label: string;
|
|
17
|
+
requiresApiKey: boolean;
|
|
18
|
+
credentialConfigured: boolean;
|
|
19
|
+
}[];
|
|
20
|
+
existingModel?: {
|
|
21
|
+
baseUrl?: string | undefined;
|
|
22
|
+
provider: string;
|
|
23
|
+
model: string;
|
|
24
|
+
contextWindowTokens: number | undefined;
|
|
25
|
+
} | undefined;
|
|
26
|
+
defaultContextWindowTokens: number;
|
|
27
|
+
editableConnection?: {
|
|
28
|
+
revision: string;
|
|
29
|
+
} | undefined;
|
|
30
|
+
recovery?: "configuration" | undefined;
|
|
31
|
+
message?: string | undefined;
|
|
32
|
+
status: "required" | "ready";
|
|
33
|
+
configExists: boolean;
|
|
34
|
+
}>;
|
|
35
|
+
finalize(connectionRevision?: string): Promise<boolean>;
|
|
36
|
+
save(body: Record<string, unknown> | null): Promise<{
|
|
37
|
+
setup: {
|
|
38
|
+
providers: {
|
|
39
|
+
id: string;
|
|
40
|
+
label: string;
|
|
41
|
+
requiresApiKey: boolean;
|
|
42
|
+
credentialConfigured: boolean;
|
|
43
|
+
}[];
|
|
44
|
+
existingModel?: {
|
|
45
|
+
baseUrl?: string | undefined;
|
|
46
|
+
provider: string;
|
|
47
|
+
model: string;
|
|
48
|
+
contextWindowTokens: number | undefined;
|
|
49
|
+
} | undefined;
|
|
50
|
+
defaultContextWindowTokens: number;
|
|
51
|
+
editableConnection?: {
|
|
52
|
+
revision: string;
|
|
53
|
+
} | undefined;
|
|
54
|
+
recovery?: "configuration" | undefined;
|
|
55
|
+
message?: string | undefined;
|
|
56
|
+
status: "required" | "ready";
|
|
57
|
+
configExists: boolean;
|
|
58
|
+
};
|
|
59
|
+
activation: Readonly<{
|
|
60
|
+
status: "ready" | "restart_required";
|
|
61
|
+
message?: string;
|
|
62
|
+
}>;
|
|
63
|
+
embeddingInvalidated: boolean;
|
|
64
|
+
}>;
|
|
65
|
+
}
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
import { readDefaultContextWindowTokens } from "../../../scripts/runtime-setup-files.js";
|
|
2
|
+
import { initializeConfiguredRuntimeDirectories } from "../../../scripts/runtime-setup-directories.js";
|
|
3
|
+
import { configuredSetupModel, requiresConfiguredCredential, } from "./runtime-setup-provider.js";
|
|
4
|
+
import { editRuntimeSetupConnection } from "./runtime-setup-connection-edit.js";
|
|
5
|
+
import { inspectEditableRuntimeSetupDraft, isCurrentRuntimeSetupDraft, readRuntimeSetupDraft, removeRuntimeSetupDraft, setupConfigurationChanged, setupConfigMap, } from "./runtime-setup-draft.js";
|
|
6
|
+
import { mkdir } from "node:fs/promises";
|
|
7
|
+
import { join, resolve } from "node:path";
|
|
8
|
+
import { inspectRuntimeConfigFileWithMeta } from "../../runtime/config/loader.js";
|
|
9
|
+
import { withFileLock } from "../../runtime/adapters/long-term-memory/file-lock.js";
|
|
10
|
+
import { inspectRuntimeSetupRequirement } from "./runtime-availability.js";
|
|
11
|
+
import { assertRuntimeSetupCredentialFile, hasRuntimeSetupCredential, readRuntimeSetupCredential, persistRuntimeSetupCredentials, commitRuntimeSetupCredentials, } from "./runtime-setup-credentials.js";
|
|
12
|
+
import { RuntimeSetupError, parseRuntimeSetupInput, } from "./runtime-setup-input.js";
|
|
13
|
+
import { writeRuntimeSetupScaffold } from "./runtime-setup-scaffold.js";
|
|
14
|
+
import { inspectRuntimeSetupDraftForSave } from "./runtime-setup-draft-recovery.js";
|
|
15
|
+
import { canCompleteMissingRuntimeSetupCredential } from "./runtime-setup-credential-completion.js";
|
|
16
|
+
export class RuntimeSetupService {
|
|
17
|
+
options;
|
|
18
|
+
savedConfigPath;
|
|
19
|
+
constructor(options) {
|
|
20
|
+
this.options = options;
|
|
21
|
+
}
|
|
22
|
+
source() {
|
|
23
|
+
return inspectRuntimeConfigFileWithMeta(this.options.rootDir, this.savedConfigPath ?? this.options.getConfigPath());
|
|
24
|
+
}
|
|
25
|
+
async status() {
|
|
26
|
+
const source = this.source();
|
|
27
|
+
const configRequirement = inspectRuntimeSetupRequirement(source);
|
|
28
|
+
const existingModel = configRequirement
|
|
29
|
+
? undefined
|
|
30
|
+
: configuredSetupModel(source);
|
|
31
|
+
const draft = await inspectEditableRuntimeSetupDraft(source);
|
|
32
|
+
const editable = draft !== undefined;
|
|
33
|
+
const required = configRequirement ||
|
|
34
|
+
requiresConfiguredCredential(source, this.options.rootDir);
|
|
35
|
+
return {
|
|
36
|
+
status: required ? "required" : "ready",
|
|
37
|
+
configExists: source.exists,
|
|
38
|
+
...(configRequirement?.recovery
|
|
39
|
+
? {
|
|
40
|
+
recovery: configRequirement.recovery,
|
|
41
|
+
message: configRequirement.message,
|
|
42
|
+
}
|
|
43
|
+
: {}),
|
|
44
|
+
...(editable ? { editableConnection: { revision: draft.revision } } : {}),
|
|
45
|
+
defaultContextWindowTokens: await readDefaultContextWindowTokens(),
|
|
46
|
+
...(existingModel
|
|
47
|
+
? {
|
|
48
|
+
existingModel: {
|
|
49
|
+
provider: existingModel.provider,
|
|
50
|
+
model: existingModel.model,
|
|
51
|
+
contextWindowTokens: existingModel.contextWindowTokens,
|
|
52
|
+
...(existingModel.baseUrl
|
|
53
|
+
? { baseUrl: existingModel.baseUrl }
|
|
54
|
+
: {}),
|
|
55
|
+
},
|
|
56
|
+
}
|
|
57
|
+
: {}),
|
|
58
|
+
providers: [
|
|
59
|
+
{
|
|
60
|
+
id: "ollama",
|
|
61
|
+
label: "Ollama",
|
|
62
|
+
requiresApiKey: false,
|
|
63
|
+
credentialConfigured: false,
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
id: "openai",
|
|
67
|
+
label: "OpenAI",
|
|
68
|
+
requiresApiKey: true,
|
|
69
|
+
credentialConfigured: await hasRuntimeSetupCredential(this.options.rootDir, existingModel?.apiKeyEnv),
|
|
70
|
+
},
|
|
71
|
+
],
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
async finalize(connectionRevision) {
|
|
75
|
+
return withFileLock(join(this.options.rootDir, ".runtime-setup.lock"), async () => {
|
|
76
|
+
const source = this.source();
|
|
77
|
+
const draft = await readRuntimeSetupDraft(source.path);
|
|
78
|
+
if (!draft)
|
|
79
|
+
return connectionRevision === undefined;
|
|
80
|
+
if (draft.revision !== connectionRevision)
|
|
81
|
+
return false;
|
|
82
|
+
if (!(await isCurrentRuntimeSetupDraft(source, draft)))
|
|
83
|
+
return false;
|
|
84
|
+
await removeRuntimeSetupDraft(source.path);
|
|
85
|
+
return true;
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
async save(body) {
|
|
89
|
+
const input = parseRuntimeSetupInput(body);
|
|
90
|
+
await mkdir(this.options.rootDir, { recursive: true });
|
|
91
|
+
return withFileLock(join(this.options.rootDir, ".runtime-setup.lock"), async () => {
|
|
92
|
+
await assertRuntimeSetupCredentialFile(this.options.rootDir);
|
|
93
|
+
const source = this.source();
|
|
94
|
+
const requirement = inspectRuntimeSetupRequirement(source);
|
|
95
|
+
if (requirement?.recovery === "configuration")
|
|
96
|
+
throw new RuntimeSetupError("setup_configuration_exists", "Existing model profiles need repair in Configuration before setup can continue.", 409);
|
|
97
|
+
const existingModel = requirement
|
|
98
|
+
? undefined
|
|
99
|
+
: configuredSetupModel(source);
|
|
100
|
+
const recovery = await inspectRuntimeSetupDraftForSave(source);
|
|
101
|
+
let draft = recovery.draft;
|
|
102
|
+
const editingDraft = input.connectionRevision !== undefined;
|
|
103
|
+
if (editingDraft) {
|
|
104
|
+
if (!draft || draft.revision !== input.connectionRevision)
|
|
105
|
+
throw setupConfigurationChanged();
|
|
106
|
+
if (!(await isCurrentRuntimeSetupDraft(source, draft)))
|
|
107
|
+
throw setupConfigurationChanged();
|
|
108
|
+
}
|
|
109
|
+
const canCompleteCredential = !editingDraft &&
|
|
110
|
+
canCompleteMissingRuntimeSetupCredential(existingModel, input, this.options.rootDir);
|
|
111
|
+
if (draft && !editingDraft && !canCompleteCredential)
|
|
112
|
+
throw setupConfigurationChanged();
|
|
113
|
+
if (existingModel && !editingDraft && !canCompleteCredential) {
|
|
114
|
+
throw new RuntimeSetupError("setup_configuration_exists", "Model settings already exist. Complete the configured model or use configuration settings.", 409);
|
|
115
|
+
}
|
|
116
|
+
const requestedProviders = setupConfigMap(setupConfigMap(source.config.models).providers);
|
|
117
|
+
const requestedProvider = setupConfigMap(requestedProviders[input.provider]);
|
|
118
|
+
let apiKeyEnv = existingModel?.apiKeyEnv;
|
|
119
|
+
if (editingDraft)
|
|
120
|
+
apiKeyEnv =
|
|
121
|
+
typeof requestedProvider.apiKeyEnv === "string"
|
|
122
|
+
? requestedProvider.apiKeyEnv
|
|
123
|
+
: undefined;
|
|
124
|
+
const hasCredential = input.apiKey ||
|
|
125
|
+
(await hasRuntimeSetupCredential(this.options.rootDir, apiKeyEnv));
|
|
126
|
+
if (input.provider === "openai" && !hasCredential) {
|
|
127
|
+
throw new RuntimeSetupError("setup_credential_required", "Enter your OpenAI API key to finish setup.");
|
|
128
|
+
}
|
|
129
|
+
const configuredPath = this.options.getConfigPath();
|
|
130
|
+
const shouldUseLocalConfig = !source.exists && !configuredPath;
|
|
131
|
+
const configPath = shouldUseLocalConfig
|
|
132
|
+
? join(this.options.rootDir, "local/runtime.config.json")
|
|
133
|
+
: source.path;
|
|
134
|
+
this.options.configure?.(configPath);
|
|
135
|
+
let embeddingInvalidated = false;
|
|
136
|
+
const credentialChanged = Boolean(input.apiKey &&
|
|
137
|
+
input.apiKey !==
|
|
138
|
+
readRuntimeSetupCredential(this.options.rootDir, apiKeyEnv));
|
|
139
|
+
const credentialWrite = {
|
|
140
|
+
rootDir: this.options.rootDir,
|
|
141
|
+
configPath: resolve(configPath),
|
|
142
|
+
apiKey: input.apiKey,
|
|
143
|
+
apiKeyEnv,
|
|
144
|
+
preserveExistingCredential: canCompleteCredential,
|
|
145
|
+
};
|
|
146
|
+
let credentialsPersisted = false;
|
|
147
|
+
const commitScaffoldCredentials = async (commit) => {
|
|
148
|
+
const saved = await commitRuntimeSetupCredentials(credentialWrite, commit);
|
|
149
|
+
credentialsPersisted = true;
|
|
150
|
+
return saved;
|
|
151
|
+
};
|
|
152
|
+
if (draft && editingDraft) {
|
|
153
|
+
const edited = await editRuntimeSetupConnection({
|
|
154
|
+
rootDir: this.options.rootDir,
|
|
155
|
+
configPath,
|
|
156
|
+
draft,
|
|
157
|
+
input,
|
|
158
|
+
credentialChanged,
|
|
159
|
+
});
|
|
160
|
+
draft = edited.draft;
|
|
161
|
+
embeddingInvalidated = edited.embeddingInvalidated;
|
|
162
|
+
}
|
|
163
|
+
if (!draft && !canCompleteCredential) {
|
|
164
|
+
const needsAtomicRecoveryCredentialCommit = recovery.recoveringDraft && credentialChanged;
|
|
165
|
+
const saved = await writeRuntimeSetupScaffold({
|
|
166
|
+
rootDir: this.options.rootDir,
|
|
167
|
+
configPath,
|
|
168
|
+
source,
|
|
169
|
+
input,
|
|
170
|
+
recoveringDraft: recovery.recoveringDraft,
|
|
171
|
+
recoveryDraft: recovery.recoveryDraft,
|
|
172
|
+
credentialChanged,
|
|
173
|
+
...(needsAtomicRecoveryCredentialCommit
|
|
174
|
+
? { commitWithCredentials: commitScaffoldCredentials }
|
|
175
|
+
: {}),
|
|
176
|
+
});
|
|
177
|
+
draft = saved.draft;
|
|
178
|
+
embeddingInvalidated = saved.embeddingInvalidated;
|
|
179
|
+
}
|
|
180
|
+
this.savedConfigPath = configPath;
|
|
181
|
+
if (!credentialsPersisted)
|
|
182
|
+
await persistRuntimeSetupCredentials(credentialWrite);
|
|
183
|
+
await initializeConfiguredRuntimeDirectories(this.options.rootDir, configPath);
|
|
184
|
+
const activation = input.deferActivation
|
|
185
|
+
? {
|
|
186
|
+
status: "restart_required",
|
|
187
|
+
message: "Connection saved. Continue setup before applying the configuration.",
|
|
188
|
+
}
|
|
189
|
+
: await this.options.activate(configPath);
|
|
190
|
+
if (activation.status === "ready" && draft)
|
|
191
|
+
await removeRuntimeSetupDraft(configPath);
|
|
192
|
+
return { setup: await this.status(), activation, embeddingInvalidated };
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** Validate complete effective configuration in isolation before replacing local files. */
|
|
2
|
+
export declare function validateRuntimeSetupPlan(params: {
|
|
3
|
+
rootDir: string;
|
|
4
|
+
config: Record<string, unknown>;
|
|
5
|
+
modelConfig: Record<string, unknown>;
|
|
6
|
+
runnerPath: string;
|
|
7
|
+
runnerConfig?: Record<string, unknown>;
|
|
8
|
+
}): Promise<void>;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { mkdtemp, rm, writeFile } from "node:fs/promises";
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
import { loadRuntimeConfig } from "../../runtime/config.js";
|
|
4
|
+
import { isRecord } from "../../runtime/config/utils.js";
|
|
5
|
+
/** Validate complete effective configuration in isolation before replacing local files. */
|
|
6
|
+
export async function validateRuntimeSetupPlan(params) {
|
|
7
|
+
const staging = await mkdtemp(join(params.rootDir, ".runtime-setup-validation-"));
|
|
8
|
+
try {
|
|
9
|
+
const runnerPath = params.runnerConfig
|
|
10
|
+
? join(staging, "runner.json")
|
|
11
|
+
: params.runnerPath;
|
|
12
|
+
if (params.runnerConfig)
|
|
13
|
+
await writeFile(runnerPath, JSON.stringify(params.runnerConfig));
|
|
14
|
+
const models = isRecord(params.config.models) ? params.config.models : {};
|
|
15
|
+
const stagedConfig = {
|
|
16
|
+
...params.config,
|
|
17
|
+
models: { ...models, profiles: { default: params.modelConfig } },
|
|
18
|
+
requestRunner: { configRef: runnerPath },
|
|
19
|
+
};
|
|
20
|
+
const configPath = join(staging, "runtime.config.json");
|
|
21
|
+
await writeFile(configPath, JSON.stringify(stagedConfig));
|
|
22
|
+
const environment = isRecord(params.config.environment)
|
|
23
|
+
? params.config.environment
|
|
24
|
+
: {};
|
|
25
|
+
const profileIds = isRecord(environment.profiles)
|
|
26
|
+
? Object.keys(environment.profiles)
|
|
27
|
+
: [];
|
|
28
|
+
const environments = profileIds.length ? profileIds : [undefined];
|
|
29
|
+
for (const profileId of environments)
|
|
30
|
+
loadRuntimeConfig({ rootDir: params.rootDir, configPath, profileId });
|
|
31
|
+
}
|
|
32
|
+
finally {
|
|
33
|
+
await rm(staging, { recursive: true, force: true });
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { InspectedRuntimeConfigFile } from "../../runtime/config/loader.js";
|
|
2
|
+
/** An environment without an active owner previews saved files without changing owner caches. */
|
|
3
|
+
export declare function readSavedModelCatalog(source: InspectedRuntimeConfigFile, environmentId: string): import("../../runtime/model/model-catalog.js").RuntimeModelCatalog;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { buildRuntimeModelConfiguration } from "../../runtime/config/builders.js";
|
|
2
|
+
import { resolveRuntimeEnvironmentProfileSelection } from "../../runtime/config/environment.js";
|
|
3
|
+
import { createRequestModelPolicy } from "../../runtime/config/runner/model-policy.js";
|
|
4
|
+
import { projectRuntimeModelCatalog } from "../../runtime/model/model-catalog.js";
|
|
5
|
+
import { readConfiguredSetupRunner } from "./runtime-setup-provider.js";
|
|
6
|
+
/** An environment without an active owner previews saved files without changing owner caches. */
|
|
7
|
+
export function readSavedModelCatalog(source, environmentId) {
|
|
8
|
+
resolveRuntimeEnvironmentProfileSelection({
|
|
9
|
+
config: source.config,
|
|
10
|
+
profileId: environmentId,
|
|
11
|
+
env: process.env,
|
|
12
|
+
});
|
|
13
|
+
const platformPolicy = buildRuntimeModelConfiguration(source.config, {
|
|
14
|
+
mainConfigPath: source.path,
|
|
15
|
+
}).modelPolicy;
|
|
16
|
+
const runnerConfig = readConfiguredSetupRunner(source);
|
|
17
|
+
if (!runnerConfig)
|
|
18
|
+
throw new Error("requestRunner.configRef is required");
|
|
19
|
+
return projectRuntimeModelCatalog(createRequestModelPolicy({ platformPolicy, runnerConfig }));
|
|
20
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export type SetupEmbeddingInput = Readonly<{
|
|
2
|
+
providerId?: string;
|
|
3
|
+
provider?: "openai" | "ollama";
|
|
4
|
+
model: string;
|
|
5
|
+
baseUrl?: string;
|
|
6
|
+
apiKey?: string;
|
|
7
|
+
}>;
|
|
8
|
+
export declare function parseSetupEmbeddingInput(body: Record<string, unknown>): SetupEmbeddingInput;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { parseBaseUrl } from "../../../scripts/runtime-setup-files.js";
|
|
2
|
+
import { RuntimeSetupError } from "./runtime-setup-input.js";
|
|
3
|
+
function optionalInputString(body, name) {
|
|
4
|
+
const value = body[name];
|
|
5
|
+
if (value === undefined)
|
|
6
|
+
return undefined;
|
|
7
|
+
if (typeof value !== "string" || !value.trim()) {
|
|
8
|
+
throw new RuntimeSetupError("invalid_embedding_input", `The ${name} field must be a non-empty string.`);
|
|
9
|
+
}
|
|
10
|
+
return value.trim();
|
|
11
|
+
}
|
|
12
|
+
function hasOneProviderSelection(providerId, provider) {
|
|
13
|
+
if (providerId)
|
|
14
|
+
return provider === undefined;
|
|
15
|
+
return provider !== undefined;
|
|
16
|
+
}
|
|
17
|
+
function isSupportedProvider(provider) {
|
|
18
|
+
return provider === "openai" || provider === "ollama";
|
|
19
|
+
}
|
|
20
|
+
function isUsableModelIdentifier(model) {
|
|
21
|
+
if (!model || model.length > 256)
|
|
22
|
+
return false;
|
|
23
|
+
return !/[\u0000-\u0020\u007f]/u.test(model);
|
|
24
|
+
}
|
|
25
|
+
function isSafeCredential(apiKey) {
|
|
26
|
+
if (!apiKey)
|
|
27
|
+
return true;
|
|
28
|
+
if (apiKey.length > 4096)
|
|
29
|
+
return false;
|
|
30
|
+
return !/[\u0000-\u0020\u007f'"`]/u.test(apiKey);
|
|
31
|
+
}
|
|
32
|
+
export function parseSetupEmbeddingInput(body) {
|
|
33
|
+
const allowed = ["providerId", "provider", "model", "baseUrl", "apiKey"];
|
|
34
|
+
if (Object.keys(body).some((key) => !allowed.includes(key))) {
|
|
35
|
+
throw new RuntimeSetupError("invalid_embedding_input", "The embedding update contains unsupported fields.");
|
|
36
|
+
}
|
|
37
|
+
const providerId = optionalInputString(body, "providerId");
|
|
38
|
+
const provider = optionalInputString(body, "provider");
|
|
39
|
+
if (!hasOneProviderSelection(providerId, provider)) {
|
|
40
|
+
throw new RuntimeSetupError("invalid_embedding_provider", "Choose one configured provider or one provider type.");
|
|
41
|
+
}
|
|
42
|
+
if (provider && !isSupportedProvider(provider)) {
|
|
43
|
+
throw new RuntimeSetupError("invalid_embedding_provider", "Choose OpenAI or Ollama when adding a provider.");
|
|
44
|
+
}
|
|
45
|
+
const model = optionalInputString(body, "model");
|
|
46
|
+
if (!isUsableModelIdentifier(model)) {
|
|
47
|
+
throw new RuntimeSetupError("invalid_embedding_model", "Enter a model ID without spaces or control characters.");
|
|
48
|
+
}
|
|
49
|
+
const apiKey = optionalInputString(body, "apiKey");
|
|
50
|
+
if (!isSafeCredential(apiKey)) {
|
|
51
|
+
throw new RuntimeSetupError("invalid_embedding_credential", "The API key contains unsupported characters.");
|
|
52
|
+
}
|
|
53
|
+
const address = optionalInputString(body, "baseUrl");
|
|
54
|
+
if (address && provider !== "ollama") {
|
|
55
|
+
throw new RuntimeSetupError("invalid_embedding_address", "An address can be supplied when adding an Ollama provider.");
|
|
56
|
+
}
|
|
57
|
+
let baseUrl;
|
|
58
|
+
try {
|
|
59
|
+
baseUrl = address ? parseBaseUrl(address) : undefined;
|
|
60
|
+
}
|
|
61
|
+
catch {
|
|
62
|
+
throw new RuntimeSetupError("invalid_embedding_address", "Enter an HTTP or HTTPS origin without a path or credentials.");
|
|
63
|
+
}
|
|
64
|
+
return {
|
|
65
|
+
...(providerId ? { providerId } : {}),
|
|
66
|
+
...(provider ? { provider: provider } : {}),
|
|
67
|
+
model,
|
|
68
|
+
...(baseUrl ? { baseUrl } : {}),
|
|
69
|
+
...(apiKey ? { apiKey } : {}),
|
|
70
|
+
};
|
|
71
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { SetupEmbeddingInput } from "./setup-embedding-input.js";
|
|
2
|
+
export type SavedEmbeddingProvider = Readonly<{
|
|
3
|
+
id: string;
|
|
4
|
+
type: string;
|
|
5
|
+
}>;
|
|
6
|
+
/** Adds only the requested provider; chat profiles and existing provider settings stay intact. */
|
|
7
|
+
export declare function prepareSetupEmbeddingProvider(options: {
|
|
8
|
+
rootDir: string;
|
|
9
|
+
configPath?: string;
|
|
10
|
+
}, input: SetupEmbeddingInput): Promise<{
|
|
11
|
+
providerId: string;
|
|
12
|
+
savedProvider: SavedEmbeddingProvider;
|
|
13
|
+
}>;
|