@abot-ai/runtime 1.6.0 → 1.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/dist/src/bridge/request-steering.js +60 -15
- package/dist/src/capabilities/normal-invocation/contracts.d.ts +3 -0
- package/dist/src/capabilities/normal-invocation/output-channels.d.ts +10 -0
- package/dist/src/capabilities/normal-invocation/output-channels.js +29 -0
- package/dist/src/capabilities/normal-invocation/validator.js +4 -2
- package/dist/src/capabilities/tool-types.d.ts +1 -1
- package/dist/src/cli/host-companion-bundle.mjs +7570 -6781
- package/dist/src/cli/host-companion-entry.js +5 -22
- package/dist/src/cli/host-companion-input.d.ts +3 -0
- package/dist/src/cli/host-companion-input.js +21 -0
- package/dist/src/cli/host-companion-lifecycle.d.ts +11 -0
- package/dist/src/cli/host-companion-lifecycle.js +32 -0
- package/dist/src/cli/host-companion-setup-target.d.ts +4 -0
- package/dist/src/cli/host-companion-setup-target.js +17 -0
- package/dist/src/cli/host-companion-startup.d.ts +2 -0
- package/dist/src/cli/host-companion-startup.js +7 -2
- package/dist/src/cli/host-companion.d.ts +6 -0
- package/dist/src/cli/host-companion.js +30 -27
- package/dist/src/cli/windows-companion-store-entry.d.ts +9 -0
- package/dist/src/cli/windows-companion-store-entry.js +67 -0
- package/dist/src/computer-access/command-output-capture.d.ts +37 -0
- package/dist/src/computer-access/command-output-capture.js +136 -0
- package/dist/src/computer-access/command-output-retention.d.ts +5 -0
- package/dist/src/computer-access/command-output-retention.js +90 -0
- package/dist/src/computer-access/command-output.d.ts +7 -0
- package/dist/src/computer-access/command-output.js +1 -0
- package/dist/src/computer-access/commands.d.ts +1 -0
- package/dist/src/computer-access/commands.js +1 -1
- package/dist/src/computer-access/companion/command-output-protocol.d.ts +12 -0
- package/dist/src/computer-access/companion/command-output-protocol.js +28 -0
- package/dist/src/computer-access/companion/command-output.d.ts +13 -0
- package/dist/src/computer-access/companion/command-output.js +110 -0
- package/dist/src/computer-access/companion/install-link-macos.d.ts +7 -0
- package/dist/src/computer-access/companion/install-link-macos.js +48 -0
- package/dist/src/computer-access/companion/install-link-registration.d.ts +4 -0
- package/dist/src/computer-access/companion/install-link-registration.js +184 -0
- package/dist/src/computer-access/companion/install-link-windows.d.ts +4 -0
- package/dist/src/computer-access/companion/install-link-windows.js +65 -0
- package/dist/src/computer-access/companion/install-link.d.ts +9 -0
- package/dist/src/computer-access/companion/install-link.js +54 -0
- package/dist/src/computer-access/companion/native-messages.js +3 -0
- package/dist/src/computer-access/companion/native-session.d.ts +1 -0
- package/dist/src/computer-access/companion/native-session.js +14 -2
- package/dist/src/computer-access/companion/native-supervisor.js +1 -0
- package/dist/src/computer-access/companion/notification-windows.d.ts +1 -1
- package/dist/src/computer-access/companion/notification-windows.js +8 -3
- package/dist/src/computer-access/companion/protocol.d.ts +1 -1
- package/dist/src/computer-access/companion/protocol.js +6 -0
- package/dist/src/computer-access/companion/release-version.d.ts +1 -1
- package/dist/src/computer-access/companion/release-version.js +1 -1
- package/dist/src/computer-access/companion/windows-store/connection-error.d.ts +7 -0
- package/dist/src/computer-access/companion/windows-store/connection-error.js +19 -0
- package/dist/src/computer-access/companion/windows-store/connection-link.d.ts +13 -0
- package/dist/src/computer-access/companion/windows-store/connection-link.js +109 -0
- package/dist/src/computer-access/companion/windows-store/identity.d.ts +13 -0
- package/dist/src/computer-access/companion/windows-store/identity.js +13 -0
- package/dist/src/computer-access/companion/windows-store/lifecycle.d.ts +5 -0
- package/dist/src/computer-access/companion/windows-store/lifecycle.js +90 -0
- package/dist/src/computer-access/contracts.d.ts +1 -1
- package/dist/src/computer-access/handlers.d.ts +2 -1
- package/dist/src/computer-access/handlers.js +5 -1
- package/dist/src/computer-access/process-capture.d.ts +6 -0
- package/dist/src/computer-access/process-capture.js +1 -0
- package/dist/src/computer-access/process-result.d.ts +2 -0
- package/dist/src/computer-access/process-result.js +14 -6
- package/dist/src/computer-access/process-runner.d.ts +2 -1
- package/dist/src/computer-access/process-runner.js +21 -13
- package/dist/src/model-gateway/server/configuration.d.ts +2 -0
- package/dist/src/model-gateway/server/configuration.js +73 -21
- package/dist/src/plugin-contract/install-source.d.ts +13 -0
- package/dist/src/plugin-contract/install-source.js +99 -0
- package/dist/src/plugin-contract/manifest.d.ts +2 -1
- package/dist/src/plugin-sdk/computer-access.d.ts +8 -0
- package/dist/src/plugin-sdk/computer-access.js +5 -0
- package/dist/src/runtime/adapters/in-memory-session-store.js +6 -16
- package/dist/src/runtime/admin/config-control.js +2 -1
- package/dist/src/runtime/automations/catalog.d.ts +3 -0
- package/dist/src/runtime/automations/catalog.js +1 -0
- package/dist/src/runtime/automations/model-dependency-projection.d.ts +2 -0
- package/dist/src/runtime/automations/service.d.ts +2 -0
- package/dist/src/runtime/capabilities/automation-builder/authoring-reference.d.ts +10 -5
- package/dist/src/runtime/capabilities/automation-builder/authoring-reference.js +8 -7
- package/dist/src/runtime/capabilities/automation-builder/payload-instructions.d.ts +2 -2
- package/dist/src/runtime/capabilities/automation-builder/payload-instructions.js +2 -2
- package/dist/src/runtime/capabilities/automation-builder/tool-contract.d.ts +2 -2
- package/dist/src/runtime/capabilities/automations/authoring-catalog.js +1 -1
- package/dist/src/runtime/capabilities/automations/authoring-preparation.d.ts +11 -5
- package/dist/src/runtime/capabilities/automations/tool-module.js +1 -1
- package/dist/src/runtime/capabilities/request-permission-catalog.d.ts +3 -1
- package/dist/src/runtime/capabilities/request-permission-catalog.js +21 -2
- package/dist/src/runtime/capabilities/request-permission-tool-registry.d.ts +2 -1
- package/dist/src/runtime/capabilities/request-permission-tool-registry.js +18 -10
- package/dist/src/runtime/capabilities/request-runtime-tool-registry.d.ts +2 -0
- package/dist/src/runtime/capabilities/request-runtime-tool-registry.js +1 -1
- package/dist/src/runtime/capabilities/scheduling/create-operations.d.ts +6 -0
- package/dist/src/runtime/config/builders.js +6 -5
- package/dist/src/runtime/config/effective-model-config-validation.js +4 -35
- package/dist/src/runtime/config/fields.js +15 -0
- package/dist/src/runtime/config/model-context-capacity.d.ts +20 -0
- package/dist/src/runtime/config/model-context-capacity.js +55 -0
- package/dist/src/runtime/config/model-execution-policy.d.ts +5 -1
- package/dist/src/runtime/config/model-execution-policy.js +16 -0
- package/dist/src/runtime/config/model-plugin-config.d.ts +8 -0
- package/dist/src/runtime/config/model-plugin-config.js +40 -0
- package/dist/src/runtime/config/schema.js +5 -1
- package/dist/src/runtime/config/validation/model-profile-validation.js +2 -0
- package/dist/src/runtime/config/validation/runtime-config-validation-contract.d.ts +3 -1
- package/dist/src/runtime/config/validation/runtime-config-validation-contract.js +3 -1
- package/dist/src/runtime/config/validation/runtime-root-section-validation.js +11 -4
- package/dist/src/runtime/config/validation/web-ui-config-validation.js +3 -2
- package/dist/src/runtime/config/web-ui.d.ts +5 -0
- package/dist/src/runtime/config/web-ui.js +5 -0
- package/dist/src/runtime/config.js +2 -0
- package/dist/src/runtime/local-application.d.ts +2 -0
- package/dist/src/runtime/local-host/app-owner.js +50 -6
- package/dist/src/runtime/local-host/app-request-control.d.ts +3 -1
- package/dist/src/runtime/local-host/app-request-control.js +91 -11
- package/dist/src/runtime/local-host/client-requests.js +32 -5
- package/dist/src/runtime/local-host/client-services.d.ts +2 -0
- package/dist/src/runtime/local-host/local-request-diagnostics.d.ts +9 -0
- package/dist/src/runtime/local-host/local-request-diagnostics.js +47 -0
- package/dist/src/runtime/local-host/saved-approvals.js +23 -2
- package/dist/src/runtime/model/model-selection.js +4 -1
- package/dist/src/runtime/observability/request-control-diagnostics.d.ts +6 -0
- package/dist/src/runtime/observability/request-control-diagnostics.js +52 -0
- package/dist/src/runtime/plugins/configuration-context.d.ts +9 -0
- package/dist/src/runtime/plugins/configuration-context.js +42 -0
- package/dist/src/runtime/plugins/configuration-settings.d.ts +2 -0
- package/dist/src/runtime/plugins/configuration-settings.js +26 -0
- package/dist/src/runtime/plugins/configuration-store.d.ts +23 -0
- package/dist/src/runtime/plugins/configuration-store.js +100 -0
- package/dist/src/runtime/plugins/configuration-write.d.ts +5 -0
- package/dist/src/runtime/plugins/configuration-write.js +58 -0
- package/dist/src/runtime/plugins/installation/archive.d.ts +2 -0
- package/dist/src/runtime/plugins/installation/archive.js +107 -0
- package/dist/src/runtime/plugins/installation/github-download.d.ts +9 -0
- package/dist/src/runtime/plugins/installation/github-download.js +72 -0
- package/dist/src/runtime/plugins/installation/installed-package.d.ts +9 -0
- package/dist/src/runtime/plugins/installation/installed-package.js +66 -0
- package/dist/src/runtime/plugins/installation/package.d.ts +45 -0
- package/dist/src/runtime/plugins/installation/package.js +79 -0
- package/dist/src/runtime/plugins/installation/portable-path.d.ts +2 -0
- package/dist/src/runtime/plugins/installation/portable-path.js +10 -0
- package/dist/src/runtime/plugins/installation/publication.d.ts +10 -0
- package/dist/src/runtime/plugins/installation/publication.js +17 -0
- package/dist/src/runtime/plugins/installation/service.d.ts +41 -0
- package/dist/src/runtime/plugins/installation/service.js +80 -0
- package/dist/src/runtime/plugins/loader.js +15 -29
- package/dist/src/runtime/plugins/manifest-projection.js +1 -0
- package/dist/src/runtime/plugins/manifest-validator.js +3 -0
- package/dist/src/runtime/plugins/module-cache.d.ts +2 -0
- package/dist/src/runtime/plugins/module-cache.js +19 -0
- package/dist/src/runtime/plugins/selection.d.ts +2 -0
- package/dist/src/runtime/plugins/selection.js +16 -11
- package/dist/src/runtime/ports.d.ts +6 -4
- package/dist/src/runtime/request/dependencies.d.ts +2 -1
- package/dist/src/runtime/request/execution-payload-compacted-evidence.d.ts +1 -1
- package/dist/src/runtime/request/handler.js +8 -0
- package/dist/src/runtime/request/prepared-execution.js +6 -1
- package/dist/src/runtime/request/request-steering.d.ts +4 -0
- package/dist/src/runtime/request/request-steering.js +37 -12
- package/dist/src/runtime/request/worker-capability-composition.d.ts +2 -0
- package/dist/src/runtime/request/worker-capability-composition.js +4 -1
- package/dist/src/runtime/scheduler/journal-index-state.d.ts +1 -1
- package/dist/src/sessions/assistant-initiative-message.d.ts +3 -0
- package/dist/src/sessions/assistant-initiative-message.js +12 -0
- package/dist/src/sessions/assistant-initiative.d.ts +2 -2
- package/dist/src/sessions/assistant-initiative.js +1 -7
- package/dist/src/sessions/durable-session-commit.d.ts +2 -1
- package/dist/src/sessions/durable-session-commit.js +6 -1
- package/dist/src/sessions/metadata/projection.d.ts +15 -0
- package/dist/src/sessions/metadata/projection.js +55 -0
- package/dist/src/sessions/metadata/publication.d.ts +12 -0
- package/dist/src/sessions/metadata/publication.js +78 -0
- package/dist/src/sessions/metadata/source-receipt.d.ts +5 -0
- package/dist/src/sessions/metadata/source-receipt.js +42 -0
- package/dist/src/sessions/metadata/store.d.ts +7 -0
- package/dist/src/sessions/metadata/store.js +119 -0
- package/dist/src/sessions/record/projection.d.ts +3 -1
- package/dist/src/sessions/record/projection.js +26 -18
- package/dist/src/sessions/request-lifecycle/service.js +3 -3
- package/dist/src/sessions/session-service.d.ts +2 -4
- package/dist/src/sessions/session-service.js +4 -16
- package/dist/src/sessions/session-store.d.ts +2 -1
- package/dist/src/sessions/session-store.js +9 -3
- package/dist/src/sessions/snapshot.d.ts +17 -0
- package/dist/src/sessions/snapshot.js +105 -0
- package/dist/src/sessions/types.d.ts +2 -0
- package/dist/src/shared/tool-selection.d.ts +2 -0
- package/dist/src/shared/tool-selection.js +7 -0
- package/dist/src/web-ui/app/ARCHITECTURE.md +14 -0
- package/dist/src/web-ui/app/app.js +6 -3
- package/dist/src/web-ui/app/components/config-workspace/config-model.js +2 -0
- package/dist/src/web-ui/app/components/config-workspace/model-plugin-permissions.js +130 -0
- package/dist/src/web-ui/app/components/config-workspace/model-plugin-selection.js +180 -0
- package/dist/src/web-ui/app/components/config-workspace/model-plugin-view-state.js +114 -0
- package/dist/src/web-ui/app/components/config-workspace/model-rendering.js +3 -0
- package/dist/src/web-ui/app/components/config-workspace/model-summary.js +39 -0
- package/dist/src/web-ui/app/components/config-workspace/summary-rendering.js +30 -0
- package/dist/src/web-ui/app/components/config-workspace/workspace-events.js +37 -0
- package/dist/src/web-ui/app/components/config-workspace/workspace-mutations.js +2 -0
- package/dist/src/web-ui/app/components/config-workspace/workspace-persistence.js +9 -1
- package/dist/src/web-ui/app/components/config-workspace/workspace-view.js +23 -67
- package/dist/src/web-ui/app/components/config-workspace.js +11 -2
- package/dist/src/web-ui/app/components/conversation-view.js +36 -5
- package/dist/src/web-ui/app/components/dashboard/recent-conversations.js +2 -1
- package/dist/src/web-ui/app/components/dashboard/workspace.js +2 -1
- package/dist/src/web-ui/app/components/operations-summary.js +105 -0
- package/dist/src/web-ui/app/components/passive-learning/home.js +1 -9
- package/dist/src/web-ui/app/components/plugins/configuration-draft.js +34 -0
- package/dist/src/web-ui/app/components/plugins/configuration-editor.js +147 -0
- package/dist/src/web-ui/app/components/plugins/configuration-fields.js +103 -0
- package/dist/src/web-ui/app/components/plugins/configuration-retained-secrets.js +20 -0
- package/dist/src/web-ui/app/components/plugins/configuration-settings.js +108 -0
- package/dist/src/web-ui/app/components/plugins/discovery-rendering.js +37 -0
- package/dist/src/web-ui/app/components/plugins/installation.js +212 -0
- package/dist/src/web-ui/app/components/plugins/manager.js +160 -6
- package/dist/src/web-ui/app/components/plugins/removal.js +130 -0
- package/dist/src/web-ui/app/components/plugins/rendering.js +14 -2
- package/dist/src/web-ui/app/components/plugins/summary.js +54 -0
- package/dist/src/web-ui/app/components/plugins/tabs.js +31 -0
- package/dist/src/web-ui/app/components/plugins/view-state.js +3 -1
- package/dist/src/web-ui/app/components/runtime-setup/connection-form.js +5 -2
- package/dist/src/web-ui/app/components/runtime-setup/connection-state.js +9 -1
- package/dist/src/web-ui/app/components/runtime-setup/context-window-feedback.js +71 -0
- package/dist/src/web-ui/app/components/runtime-setup/optional-steps.js +2 -0
- package/dist/src/web-ui/app/components/runtime-setup-guide.js +15 -3
- package/dist/src/web-ui/app/components/spark-chat/empty-state.js +1 -0
- package/dist/src/web-ui/app/components/spark-chat/panel.js +1 -0
- package/dist/src/web-ui/app/components/system-host/connection-card.js +35 -0
- package/dist/src/web-ui/app/components/system-host/macos-setup.js +1 -1
- package/dist/src/web-ui/app/components/system-host/manager.js +45 -12
- package/dist/src/web-ui/app/components/system-host/rendering.js +111 -106
- package/dist/src/web-ui/app/components/system-host/windows-store-setup.js +293 -0
- package/dist/src/web-ui/app/components/workspace-shell.js +6 -0
- package/dist/src/web-ui/app/computer-access-feature.js +22 -5
- package/dist/src/web-ui/app/configuration-feature.js +35 -2
- package/dist/src/web-ui/app/controllers/app-event-bindings.js +4 -1
- package/dist/src/web-ui/app/controllers/conversation-read-state-controller.d.ts +1 -0
- package/dist/src/web-ui/app/controllers/conversation-read-state-controller.js +7 -3
- package/dist/src/web-ui/app/controllers/conversation-request-hydration.js +88 -0
- package/dist/src/web-ui/app/controllers/conversation-session-controller.d.ts +9 -3
- package/dist/src/web-ui/app/controllers/conversation-session-controller.js +52 -144
- package/dist/src/web-ui/app/controllers/history-pagination.js +111 -0
- package/dist/src/web-ui/app/controllers/operations-controller.d.ts +12 -0
- package/dist/src/web-ui/app/controllers/operations-controller.js +28 -21
- package/dist/src/web-ui/app/controllers/runtime-onboarding-controller.d.ts +1 -0
- package/dist/src/web-ui/app/controllers/runtime-onboarding-controller.js +11 -0
- package/dist/src/web-ui/app/controllers/session-controller.js +10 -2
- package/dist/src/web-ui/app/controllers/session-list-pagination.js +71 -0
- package/dist/src/web-ui/app/controllers/session-sidebar-controller.js +6 -4
- package/dist/src/web-ui/app/controllers/spark-chat-reading.js +1 -0
- package/dist/src/web-ui/app/controllers/spark-chat-sync.js +24 -5
- package/dist/src/web-ui/app/controllers/workspace-route-controller.js +21 -19
- package/dist/src/web-ui/app/dashboard-feature.js +2 -2
- package/dist/src/web-ui/app/index.html +6 -2
- package/dist/src/web-ui/app/lib/history-page-messages.js +49 -0
- package/dist/src/web-ui/app/lib/request-lifecycle-view.js +8 -0
- package/dist/src/web-ui/app/lib/workspace-route.d.ts +3 -0
- package/dist/src/web-ui/app/lib/workspace-route.js +4 -0
- package/dist/src/web-ui/app/passive-learning-feature.js +0 -1
- package/dist/src/web-ui/app/runtime-onboarding-feature.js +3 -0
- package/dist/src/web-ui/app/schedules-feature.js +1 -1
- package/dist/src/web-ui/app/services/runtime-web-client/configuration.js +20 -0
- package/dist/src/web-ui/app/services/runtime-web-client/plugin-configuration.js +19 -0
- package/dist/src/web-ui/app/services/runtime-web-client/spark-chat.js +4 -4
- package/dist/src/web-ui/app/services/runtime-web-client/system-host.js +2 -0
- package/dist/src/web-ui/app/services/runtime-web-client.d.ts +6 -1
- package/dist/src/web-ui/app/services/runtime-web-client.js +12 -3
- package/dist/src/web-ui/app/spark-chat-feature.js +76 -19
- package/dist/src/web-ui/app/styles/11-product-links.css +30 -0
- package/dist/src/web-ui/app/styles/41-plugin-configuration.css +79 -0
- package/dist/src/web-ui/app/styles/41-plugin-discovery.css +132 -0
- package/dist/src/web-ui/app/styles/41-plugin-management.css +6 -0
- package/dist/src/web-ui/app/styles/42-model-plugin-permissions.css +173 -0
- package/dist/src/web-ui/app/styles/46-system-host.css +61 -107
- package/dist/src/web-ui/app/styles/47-config-controls.css +13 -1
- package/dist/src/web-ui/app/styles/54-spark-chat.css +33 -1
- package/dist/src/web-ui/app/styles.css +4 -0
- package/dist/src/web-ui/local-runtime/api-router.js +11 -6
- package/dist/src/web-ui/local-runtime/approval-request-attachment.js +14 -5
- package/dist/src/web-ui/local-runtime/configuration-activation-source.d.ts +1 -1
- package/dist/src/web-ui/local-runtime/configuration-activation-source.js +9 -3
- package/dist/src/web-ui/local-runtime/contracts.d.ts +4 -3
- package/dist/src/web-ui/local-runtime/environment-registry.d.ts +5 -1
- package/dist/src/web-ui/local-runtime/environment-registry.js +53 -11
- package/dist/src/web-ui/local-runtime/history-pagination.d.ts +16 -0
- package/dist/src/web-ui/local-runtime/history-pagination.js +20 -0
- package/dist/src/web-ui/local-runtime/plugin-configuration-routes.d.ts +16 -0
- package/dist/src/web-ui/local-runtime/plugin-configuration-routes.js +68 -0
- package/dist/src/web-ui/local-runtime/plugin-installation-routes.d.ts +16 -0
- package/dist/src/web-ui/local-runtime/plugin-installation-routes.js +96 -0
- package/dist/src/web-ui/local-runtime/plugin-management-routes.d.ts +8 -1
- package/dist/src/web-ui/local-runtime/plugin-management-routes.js +17 -0
- package/dist/src/web-ui/local-runtime/plugin-mutation-admission.d.ts +7 -0
- package/dist/src/web-ui/local-runtime/plugin-mutation-admission.js +17 -0
- package/dist/src/web-ui/local-runtime/plugin-removal-routes.d.ts +18 -0
- package/dist/src/web-ui/local-runtime/plugin-removal-routes.js +60 -0
- package/dist/src/web-ui/local-runtime/realtime-controller.js +41 -2
- package/dist/src/web-ui/local-runtime/request-cancellation-route.js +28 -1
- package/dist/src/web-ui/local-runtime/request-control-observation.d.ts +19 -0
- package/dist/src/web-ui/local-runtime/request-control-observation.js +80 -0
- package/dist/src/web-ui/local-runtime/request-execution.js +69 -37
- package/dist/src/web-ui/local-runtime/runtime-setup-context-window.d.ts +20 -0
- package/dist/src/web-ui/local-runtime/runtime-setup-context-window.js +44 -0
- package/dist/src/web-ui/local-runtime/runtime-setup-routes.js +2 -0
- package/dist/src/web-ui/local-runtime/runtime-setup-validation.js +9 -2
- package/dist/src/web-ui/local-runtime/session-routes.d.ts +1 -0
- package/dist/src/web-ui/local-runtime/session-routes.js +16 -4
- package/dist/src/web-ui/local-runtime/spark-chat-routes.js +4 -3
- package/dist/src/web-ui/plugin-capability-selection.js +4 -1
- package/dist/src/web-ui/plugin-configuration-input.d.ts +12 -0
- package/dist/src/web-ui/plugin-configuration-input.js +68 -0
- package/dist/src/web-ui/plugin-configuration-retained-secrets.d.ts +9 -0
- package/dist/src/web-ui/plugin-configuration-retained-secrets.js +48 -0
- package/dist/src/web-ui/plugin-configuration-service.d.ts +52 -0
- package/dist/src/web-ui/plugin-configuration-service.js +66 -0
- package/dist/src/web-ui/plugin-configuration-view.d.ts +25 -0
- package/dist/src/web-ui/plugin-configuration-view.js +45 -0
- package/dist/src/web-ui/plugin-disabled-selection.d.ts +7 -0
- package/dist/src/web-ui/plugin-disabled-selection.js +17 -0
- package/dist/src/web-ui/plugin-management-catalog.d.ts +3 -1
- package/dist/src/web-ui/plugin-management-catalog.js +11 -1
- package/dist/src/web-ui/plugin-management-selection.js +22 -9
- package/dist/src/web-ui/plugin-management-service.d.ts +5 -1
- package/dist/src/web-ui/plugin-management-service.js +11 -7
- package/dist/src/web-ui/plugin-removal-error.d.ts +7 -0
- package/dist/src/web-ui/plugin-removal-error.js +16 -0
- package/dist/src/web-ui/plugin-removal-service.d.ts +30 -0
- package/dist/src/web-ui/plugin-removal-service.js +109 -0
- package/dist/src/web-ui/runtime-setup-gateway.d.ts +6 -2
- package/dist/src/web-ui/runtime-setup-gateway.js +30 -10
- package/dist/src/web-ui/server.js +6 -2
- package/dist/src/web-ui/session-read-state/overview.d.ts +42 -0
- package/dist/src/web-ui/session-read-state/overview.js +16 -0
- package/dist/src/web-ui/session-read-state/pagination.d.ts +15 -0
- package/dist/src/web-ui/session-read-state/pagination.js +42 -0
- package/dist/src/web-ui/session-read-state/projection.d.ts +4 -3
- package/dist/src/web-ui/session-read-state/service.d.ts +213 -20
- package/dist/src/web-ui/session-read-state/service.js +25 -23
- package/dist/src/web-ui/session-read-state/visible-messages.d.ts +3 -3
- package/dist/src/web-ui/system-host-setup/companion-linux.js +1 -1
- package/dist/src/web-ui/system-host-setup/installer-contract.d.ts +1 -1
- package/dist/src/web-ui/system-host-setup/installer-contract.js +2 -2
- package/dist/src/web-ui/system-host-setup/installers.js +0 -7
- package/dist/src/web-ui/system-host-setup/local-connection.d.ts +4 -1
- package/dist/src/web-ui/system-host-setup/local-connection.js +10 -17
- package/dist/src/web-ui/system-host-setup/routes.d.ts +2 -0
- package/dist/src/web-ui/system-host-setup/routes.js +32 -9
- package/dist/src/web-ui/system-host-setup/setup-mutation.d.ts +9 -0
- package/dist/src/web-ui/system-host-setup/setup-mutation.js +27 -0
- package/dist/src/web-ui/system-host-setup/windows-store-route.d.ts +13 -0
- package/dist/src/web-ui/system-host-setup/windows-store-route.js +68 -0
- package/docs/configuration.md +46 -0
- package/docs/installation.md +45 -24
- package/docs/plugins.md +165 -2
- package/docs/projects-and-full-plus.md +2 -6
- package/docs/runtime-library.md +0 -1
- package/docs/windows-companion-store.md +127 -0
- package/package.json +3 -3
- package/plugins/document-reader/plugin.json +1 -0
- package/plugins/exec/plugin.json +3 -0
- package/plugins/filesystem/plugin.json +2 -0
- package/plugins/local-search/plugin.json +1 -0
- package/plugins/system/README.md +43 -3
- package/plugins/system/plugin.json +5 -0
- package/plugins/system/source/companion-command-output.ts +82 -0
- package/plugins/system/source/host-dispatch.ts +4 -0
- package/plugins/system/source/index.ts +11 -5
- package/plugins/system/source/local-command-output.ts +61 -0
- package/plugins/system/source/request-system-modules.ts +2 -0
- package/plugins/system/src/index.cjs +474 -39
- package/plugins/web/README.md +2 -2
- package/plugins/web/plugin.json +4 -0
- package/runtime.config.schema.json +25 -1
- package/src/runtime/README.md +12 -2
- package/dist/src/web-ui/system-host-setup/companion-windows.d.ts +0 -2
- package/dist/src/web-ui/system-host-setup/companion-windows.js +0 -108
- package/docs/publishing.md +0 -167
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { DEFAULT_WEB_UI_PAGE_SIZE } from "../../runtime/config/web-ui.js";
|
|
2
|
+
export function webPageSize(config) {
|
|
3
|
+
return config.webUi?.pageSize ?? DEFAULT_WEB_UI_PAGE_SIZE;
|
|
4
|
+
}
|
|
5
|
+
export function historyPageOptions(url, config) {
|
|
6
|
+
if (url?.searchParams.get("page") !== "1")
|
|
7
|
+
return { includeRequests: true };
|
|
8
|
+
return { includeRequests: true, page: {
|
|
9
|
+
limit: webPageSize(config), cursor: url.searchParams.get("cursor"),
|
|
10
|
+
targetMessageId: url.searchParams.get("targetMessageId") ?? undefined,
|
|
11
|
+
targetCreatedAt: url.searchParams.has("targetCreatedAt") ? Number(url.searchParams.get("targetCreatedAt")) : undefined,
|
|
12
|
+
targetRequestId: url.searchParams.get("targetRequestId") ?? undefined,
|
|
13
|
+
waitingRequestId: url.searchParams.get("waitingRequestId") ?? undefined,
|
|
14
|
+
} };
|
|
15
|
+
}
|
|
16
|
+
/** Compact identities stay between the session service and the read-state owner. */
|
|
17
|
+
export function publicHistorySnapshot(snapshot) {
|
|
18
|
+
const { messageIndex: _index, ...publicSnapshot } = snapshot;
|
|
19
|
+
return publicSnapshot;
|
|
20
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { IncomingMessage, ServerResponse } from "node:http";
|
|
2
|
+
export declare class PluginConfigurationRoutes {
|
|
3
|
+
private readonly options;
|
|
4
|
+
constructor(options: {
|
|
5
|
+
rootDir: string;
|
|
6
|
+
requireMutationIdle?: () => void;
|
|
7
|
+
getConfigPath?: () => string | undefined;
|
|
8
|
+
});
|
|
9
|
+
handle(params: {
|
|
10
|
+
method: string;
|
|
11
|
+
route: string;
|
|
12
|
+
body: Record<string, unknown> | null;
|
|
13
|
+
request?: IncomingMessage;
|
|
14
|
+
response: ServerResponse;
|
|
15
|
+
}): Promise<boolean>;
|
|
16
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { PluginConfigurationError } from "../../runtime/plugins/configuration-store.js";
|
|
2
|
+
import { getRuntimePluginConfiguration, saveRuntimePluginConfiguration, } from "../plugin-configuration-service.js";
|
|
3
|
+
import { PluginManagementError } from "../plugin-management-service.js";
|
|
4
|
+
import { acceptConfigMutationRequest } from "./config-mutation-request.js";
|
|
5
|
+
import { sendJson } from "./http.js";
|
|
6
|
+
export class PluginConfigurationRoutes {
|
|
7
|
+
options;
|
|
8
|
+
constructor(options) {
|
|
9
|
+
this.options = options;
|
|
10
|
+
}
|
|
11
|
+
async handle(params) {
|
|
12
|
+
const prefix = "runtime/plugins/configuration/";
|
|
13
|
+
if (!params.route.startsWith(prefix))
|
|
14
|
+
return false;
|
|
15
|
+
params.response.setHeader("Cache-Control", "no-store");
|
|
16
|
+
try {
|
|
17
|
+
const pluginId = decodeURIComponent(params.route.slice(prefix.length));
|
|
18
|
+
const options = {
|
|
19
|
+
...this.options,
|
|
20
|
+
configPath: this.options.getConfigPath?.(),
|
|
21
|
+
};
|
|
22
|
+
if (params.method === "GET") {
|
|
23
|
+
sendJson(params.response, 200, {
|
|
24
|
+
ok: true,
|
|
25
|
+
configuration: getRuntimePluginConfiguration(options, pluginId),
|
|
26
|
+
});
|
|
27
|
+
return true;
|
|
28
|
+
}
|
|
29
|
+
if (params.method !== "PUT") {
|
|
30
|
+
sendJson(params.response, 405, {
|
|
31
|
+
ok: false,
|
|
32
|
+
error: "method_not_allowed",
|
|
33
|
+
});
|
|
34
|
+
return true;
|
|
35
|
+
}
|
|
36
|
+
if (!params.request) {
|
|
37
|
+
sendJson(params.response, 403, {
|
|
38
|
+
ok: false,
|
|
39
|
+
error: "request_origin_required",
|
|
40
|
+
});
|
|
41
|
+
return true;
|
|
42
|
+
}
|
|
43
|
+
if (!acceptConfigMutationRequest(params.request, params.response))
|
|
44
|
+
return true;
|
|
45
|
+
const saved = await saveRuntimePluginConfiguration(options, {
|
|
46
|
+
pluginId,
|
|
47
|
+
input: params.body,
|
|
48
|
+
});
|
|
49
|
+
sendJson(params.response, 200, {
|
|
50
|
+
ok: true,
|
|
51
|
+
configuration: saved.configuration,
|
|
52
|
+
restartRequired: true,
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
catch (error) {
|
|
56
|
+
const known = error instanceof PluginConfigurationError ||
|
|
57
|
+
error instanceof PluginManagementError;
|
|
58
|
+
sendJson(params.response, known ? error.statusCode : 500, {
|
|
59
|
+
ok: false,
|
|
60
|
+
error: known ? error.code : "plugin_configuration_failed",
|
|
61
|
+
message: known
|
|
62
|
+
? error.message
|
|
63
|
+
: "Plugin configuration could not be loaded or saved.",
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
return true;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { IncomingMessage, ServerResponse } from "node:http";
|
|
2
|
+
export declare class PluginInstallationRoutes {
|
|
3
|
+
private readonly options;
|
|
4
|
+
constructor(options: {
|
|
5
|
+
rootDir: string;
|
|
6
|
+
requireMutationIdle?: () => void;
|
|
7
|
+
getConfigPath?: () => string | undefined;
|
|
8
|
+
});
|
|
9
|
+
handle(params: {
|
|
10
|
+
method: string;
|
|
11
|
+
route: string;
|
|
12
|
+
body: Record<string, unknown> | null;
|
|
13
|
+
request?: IncomingMessage;
|
|
14
|
+
response: ServerResponse;
|
|
15
|
+
}): Promise<boolean>;
|
|
16
|
+
}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { projectPluginConfiguration } from "../plugin-configuration-view.js";
|
|
2
|
+
import { saveRuntimePluginConfiguration } from "../plugin-configuration-service.js";
|
|
3
|
+
import { PluginConfigurationError, readPluginConfigurationStore, } from "../../runtime/plugins/configuration-store.js";
|
|
4
|
+
import { PluginInstallError } from "../../plugin-contract/install-source.js";
|
|
5
|
+
import { inspectPluginPackage, installPluginPackage, } from "../../runtime/plugins/installation/service.js";
|
|
6
|
+
import { inspectRuntimeConfigFileWithMeta } from "../../runtime/config/loader.js";
|
|
7
|
+
import { PluginManagementError, setRuntimePluginEnabled, } from "../plugin-management-service.js";
|
|
8
|
+
import { acceptConfigMutationRequest } from "./config-mutation-request.js";
|
|
9
|
+
import { sendJson } from "./http.js";
|
|
10
|
+
export class PluginInstallationRoutes {
|
|
11
|
+
options;
|
|
12
|
+
constructor(options) {
|
|
13
|
+
this.options = options;
|
|
14
|
+
}
|
|
15
|
+
async handle(params) {
|
|
16
|
+
if (!["runtime/plugins/inspect", "runtime/plugins/install"].includes(params.route))
|
|
17
|
+
return false;
|
|
18
|
+
if (params.method !== "POST") {
|
|
19
|
+
sendJson(params.response, 405, {
|
|
20
|
+
ok: false,
|
|
21
|
+
error: "method_not_allowed",
|
|
22
|
+
});
|
|
23
|
+
return true;
|
|
24
|
+
}
|
|
25
|
+
if (!params.request) {
|
|
26
|
+
sendJson(params.response, 403, {
|
|
27
|
+
ok: false,
|
|
28
|
+
error: "request_origin_required",
|
|
29
|
+
});
|
|
30
|
+
return true;
|
|
31
|
+
}
|
|
32
|
+
if (!acceptConfigMutationRequest(params.request, params.response))
|
|
33
|
+
return true;
|
|
34
|
+
try {
|
|
35
|
+
const configPath = this.options.getConfigPath?.();
|
|
36
|
+
const configuration = inspectRuntimeConfigFileWithMeta(this.options.rootDir, configPath);
|
|
37
|
+
if (!configuration.exists)
|
|
38
|
+
throw new PluginInstallError("runtime_setup_required", "Complete Runtime setup before installing plugins.", 409);
|
|
39
|
+
if (params.route === "runtime/plugins/inspect") {
|
|
40
|
+
const review = await inspectPluginPackage(this.options.rootDir, params.body);
|
|
41
|
+
const configuration = projectPluginConfiguration(review.id, {
|
|
42
|
+
settings: { defaults: review.settings },
|
|
43
|
+
secrets: Object.fromEntries(review.secrets.map(({ name, env, required }) => [
|
|
44
|
+
name,
|
|
45
|
+
{ env, required },
|
|
46
|
+
])),
|
|
47
|
+
}, readPluginConfigurationStore(this.options.rootDir));
|
|
48
|
+
sendJson(params.response, 200, {
|
|
49
|
+
ok: true,
|
|
50
|
+
review: { ...review, configuration },
|
|
51
|
+
});
|
|
52
|
+
return true;
|
|
53
|
+
}
|
|
54
|
+
this.options.requireMutationIdle?.();
|
|
55
|
+
const result = await installPluginPackage({
|
|
56
|
+
requireMutationIdle: this.options.requireMutationIdle,
|
|
57
|
+
rootDir: this.options.rootDir,
|
|
58
|
+
configPath: configuration.path,
|
|
59
|
+
input: params.body,
|
|
60
|
+
saveSelection: async (pluginId, transaction) => {
|
|
61
|
+
const options = {
|
|
62
|
+
rootDir: this.options.rootDir,
|
|
63
|
+
configPath,
|
|
64
|
+
requireMutationIdle: this.options.requireMutationIdle,
|
|
65
|
+
};
|
|
66
|
+
const saved = await saveRuntimePluginConfiguration(options, {
|
|
67
|
+
pluginId,
|
|
68
|
+
input: params.body?.configuration,
|
|
69
|
+
transaction,
|
|
70
|
+
installation: true,
|
|
71
|
+
commit: () => setRuntimePluginEnabled(options, { pluginId, enabled: true }, transaction),
|
|
72
|
+
});
|
|
73
|
+
return saved.result;
|
|
74
|
+
},
|
|
75
|
+
});
|
|
76
|
+
sendJson(params.response, 200, {
|
|
77
|
+
ok: true,
|
|
78
|
+
...result.snapshot,
|
|
79
|
+
installed: result.installed,
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
catch (error) {
|
|
83
|
+
const known = error instanceof PluginConfigurationError ||
|
|
84
|
+
error instanceof PluginInstallError ||
|
|
85
|
+
error instanceof PluginManagementError;
|
|
86
|
+
sendJson(params.response, known ? error.statusCode : 500, {
|
|
87
|
+
ok: false,
|
|
88
|
+
error: known ? error.code : "plugin_installation_failed",
|
|
89
|
+
message: known
|
|
90
|
+
? error.message
|
|
91
|
+
: "The plugin could not be installed. No existing plugin was replaced.",
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
return true;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
@@ -1,14 +1,21 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { PluginRemovalRuntime } from "../plugin-removal-service.js";
|
|
2
|
+
import type { IncomingMessage, ServerResponse } from "node:http";
|
|
2
3
|
export declare class PluginManagementRoutes {
|
|
3
4
|
private readonly options;
|
|
5
|
+
private readonly configuration;
|
|
6
|
+
private readonly removal;
|
|
7
|
+
private readonly installation;
|
|
4
8
|
constructor(options: {
|
|
5
9
|
rootDir: string;
|
|
10
|
+
requireMutationIdle?: () => void;
|
|
11
|
+
removalRuntime?: PluginRemovalRuntime;
|
|
6
12
|
getConfigPath?: () => string | undefined;
|
|
7
13
|
});
|
|
8
14
|
handle(params: {
|
|
9
15
|
method: string;
|
|
10
16
|
route: string;
|
|
11
17
|
body: Record<string, unknown> | null;
|
|
18
|
+
request?: IncomingMessage;
|
|
12
19
|
response: ServerResponse;
|
|
13
20
|
}): Promise<boolean>;
|
|
14
21
|
}
|
|
@@ -1,16 +1,32 @@
|
|
|
1
|
+
import { PluginConfigurationRoutes } from "./plugin-configuration-routes.js";
|
|
2
|
+
import { PluginRemovalRoutes } from "./plugin-removal-routes.js";
|
|
3
|
+
import { PluginInstallationRoutes } from "./plugin-installation-routes.js";
|
|
1
4
|
import { getRuntimePluginSnapshot, PluginManagementError, setRuntimePluginEnabled, } from "../plugin-management-service.js";
|
|
2
5
|
import { sendJson } from "./http.js";
|
|
3
6
|
export class PluginManagementRoutes {
|
|
4
7
|
options;
|
|
8
|
+
configuration;
|
|
9
|
+
removal;
|
|
10
|
+
installation;
|
|
5
11
|
constructor(options) {
|
|
6
12
|
this.options = options;
|
|
13
|
+
this.configuration = new PluginConfigurationRoutes(options);
|
|
14
|
+
this.removal = new PluginRemovalRoutes(options);
|
|
15
|
+
this.installation = new PluginInstallationRoutes(options);
|
|
7
16
|
}
|
|
8
17
|
async handle(params) {
|
|
18
|
+
if (await this.configuration.handle(params))
|
|
19
|
+
return true;
|
|
20
|
+
if (await this.installation.handle(params))
|
|
21
|
+
return true;
|
|
22
|
+
if (await this.removal.handle(params))
|
|
23
|
+
return true;
|
|
9
24
|
if (params.route !== "runtime/plugins")
|
|
10
25
|
return false;
|
|
11
26
|
const options = {
|
|
12
27
|
rootDir: this.options.rootDir,
|
|
13
28
|
configPath: this.options.getConfigPath?.(),
|
|
29
|
+
requireMutationIdle: this.options.requireMutationIdle,
|
|
14
30
|
};
|
|
15
31
|
try {
|
|
16
32
|
if (params.method === "GET") {
|
|
@@ -21,6 +37,7 @@ export class PluginManagementRoutes {
|
|
|
21
37
|
return true;
|
|
22
38
|
}
|
|
23
39
|
if (params.method === "PUT") {
|
|
40
|
+
this.options.requireMutationIdle?.();
|
|
24
41
|
const result = await setRuntimePluginEnabled(options, params.body);
|
|
25
42
|
sendJson(params.response, 200, { ok: true, ...result });
|
|
26
43
|
return true;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { RuntimeEnvironment } from "./contracts.js";
|
|
2
|
+
/** A saved plugin change must not start while any owning Runtime is working. */
|
|
3
|
+
export declare function requirePluginOwnersIdle(options: {
|
|
4
|
+
environments: Iterable<RuntimeEnvironment>;
|
|
5
|
+
busy: boolean;
|
|
6
|
+
unavailable: boolean;
|
|
7
|
+
}): void;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { PluginManagementError } from "../plugin-management-service.js";
|
|
2
|
+
/** A saved plugin change must not start while any owning Runtime is working. */
|
|
3
|
+
export function requirePluginOwnersIdle(options) {
|
|
4
|
+
if (options.unavailable)
|
|
5
|
+
throw new PluginManagementError("plugin_mutation_unavailable", "Apply Runtime configuration before changing plugins.", 409);
|
|
6
|
+
if (options.busy)
|
|
7
|
+
throw busyPluginMutation();
|
|
8
|
+
for (const environment of options.environments) {
|
|
9
|
+
if (environment.getOwnership() !== "owner")
|
|
10
|
+
throw new PluginManagementError("plugin_owner_unavailable", "This Web UI cannot verify that the owning Runtime is idle. Open Plugins in the Web UI that owns this Runtime.", 409);
|
|
11
|
+
if (!environment.isOwnerIdle())
|
|
12
|
+
throw busyPluginMutation();
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
function busyPluginMutation() {
|
|
16
|
+
return new PluginManagementError("plugin_runtime_busy", "Your agent is working. Wait for active conversations and Jobs to finish before changing plugins.", 409);
|
|
17
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { IncomingMessage, ServerResponse } from "node:http";
|
|
2
|
+
import { type PluginRemovalRuntime } from "../plugin-removal-service.js";
|
|
3
|
+
export declare class PluginRemovalRoutes {
|
|
4
|
+
private readonly options;
|
|
5
|
+
constructor(options: {
|
|
6
|
+
rootDir: string;
|
|
7
|
+
requireMutationIdle?: () => void;
|
|
8
|
+
getConfigPath?: () => string | undefined;
|
|
9
|
+
removalRuntime?: PluginRemovalRuntime;
|
|
10
|
+
});
|
|
11
|
+
handle(params: {
|
|
12
|
+
method: string;
|
|
13
|
+
route: string;
|
|
14
|
+
body: Record<string, unknown> | null;
|
|
15
|
+
request?: IncomingMessage;
|
|
16
|
+
response: ServerResponse;
|
|
17
|
+
}): Promise<boolean>;
|
|
18
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { ConfigFileConflictError } from "../../runtime/adapters/config-file-transaction.js";
|
|
2
|
+
import { PluginRemovalActivationError } from "../plugin-removal-error.js";
|
|
3
|
+
import { PluginManagementError } from "../plugin-management-service.js";
|
|
4
|
+
import { removeRuntimePlugin, } from "../plugin-removal-service.js";
|
|
5
|
+
import { acceptConfigMutationRequest } from "./config-mutation-request.js";
|
|
6
|
+
import { sendJson } from "./http.js";
|
|
7
|
+
export class PluginRemovalRoutes {
|
|
8
|
+
options;
|
|
9
|
+
constructor(options) {
|
|
10
|
+
this.options = options;
|
|
11
|
+
}
|
|
12
|
+
async handle(params) {
|
|
13
|
+
if (params.route !== "runtime/plugins/remove")
|
|
14
|
+
return false;
|
|
15
|
+
if (params.method !== "POST") {
|
|
16
|
+
sendJson(params.response, 405, {
|
|
17
|
+
ok: false,
|
|
18
|
+
error: "method_not_allowed",
|
|
19
|
+
});
|
|
20
|
+
return true;
|
|
21
|
+
}
|
|
22
|
+
if (!params.request) {
|
|
23
|
+
sendJson(params.response, 403, {
|
|
24
|
+
ok: false,
|
|
25
|
+
error: "request_origin_required",
|
|
26
|
+
});
|
|
27
|
+
return true;
|
|
28
|
+
}
|
|
29
|
+
if (!acceptConfigMutationRequest(params.request, params.response))
|
|
30
|
+
return true;
|
|
31
|
+
try {
|
|
32
|
+
if (!this.options.removalRuntime)
|
|
33
|
+
throw new PluginManagementError("plugin_removal_unavailable", "This Runtime cannot apply plugin removal.", 409);
|
|
34
|
+
this.options.requireMutationIdle?.();
|
|
35
|
+
const result = await removeRuntimePlugin({
|
|
36
|
+
rootDir: this.options.rootDir,
|
|
37
|
+
requireMutationIdle: this.options.requireMutationIdle,
|
|
38
|
+
configPath: this.options.getConfigPath?.(),
|
|
39
|
+
...this.options.removalRuntime,
|
|
40
|
+
}, params.body);
|
|
41
|
+
sendJson(params.response, 200, { ok: true, ...result });
|
|
42
|
+
}
|
|
43
|
+
catch (error) {
|
|
44
|
+
const known = error instanceof PluginManagementError ||
|
|
45
|
+
error instanceof ConfigFileConflictError;
|
|
46
|
+
const status = error instanceof PluginManagementError ? error.statusCode : 500;
|
|
47
|
+
sendJson(params.response, error instanceof ConfigFileConflictError ? 409 : status, {
|
|
48
|
+
ok: false,
|
|
49
|
+
...(error instanceof PluginRemovalActivationError
|
|
50
|
+
? { activation: error.activation }
|
|
51
|
+
: {}),
|
|
52
|
+
error: known ? error.code : "plugin_removal_failed",
|
|
53
|
+
message: known
|
|
54
|
+
? error.message
|
|
55
|
+
: "Plugin removal could not complete. Refresh plugins before trying again.",
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
return true;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { getNumber, getString, requestEnvironmentId } from "./http.js";
|
|
2
2
|
import { ManagedWebToolApprovals } from "./managed-tool-approvals.js";
|
|
3
|
+
import { diagnosticErrorType } from "../../runtime/observability/request-control-diagnostics.js";
|
|
4
|
+
import { traceWebRequestControl } from "./request-control-observation.js";
|
|
3
5
|
export class LocalRealtimeController {
|
|
4
6
|
options;
|
|
5
7
|
environments;
|
|
@@ -47,18 +49,42 @@ export class LocalRealtimeController {
|
|
|
47
49
|
return;
|
|
48
50
|
}
|
|
49
51
|
if (message.type === "steer_request") {
|
|
50
|
-
|
|
52
|
+
const acknowledgement = await this.requests.handleSteer(message, (id) => this.environments.get(id));
|
|
53
|
+
traceWebRequestControl("steer.ack_dispatch_attempted", {
|
|
54
|
+
requestId: getString(acknowledgement.requestId),
|
|
55
|
+
steerId: getString(acknowledgement.steerId),
|
|
56
|
+
accepted: acknowledgement.accepted === true,
|
|
57
|
+
reason: getString(acknowledgement.reason) || undefined,
|
|
58
|
+
socketReadyState: client.readyState,
|
|
59
|
+
});
|
|
60
|
+
this.clients.send(client, acknowledgement);
|
|
51
61
|
return;
|
|
52
62
|
}
|
|
53
63
|
if (message.type !== "resume_request")
|
|
54
64
|
return;
|
|
55
|
-
|
|
65
|
+
try {
|
|
66
|
+
await this.resume(client, message);
|
|
67
|
+
}
|
|
68
|
+
catch (error) {
|
|
69
|
+
traceWebRequestControl("resume.failed", {
|
|
70
|
+
requestId: getString(message.requestId),
|
|
71
|
+
requestedEnvironment: getString(message.environment),
|
|
72
|
+
errorType: diagnosticErrorType(error),
|
|
73
|
+
});
|
|
74
|
+
throw error;
|
|
75
|
+
}
|
|
56
76
|
}
|
|
57
77
|
async resume(client, message) {
|
|
58
78
|
const requestId = getString(message.requestId);
|
|
59
79
|
if (!requestId)
|
|
60
80
|
return;
|
|
61
81
|
const environmentId = requestEnvironmentId(new URL("/", "http://localhost"), message, this.options.defaultEnvironmentId);
|
|
82
|
+
const startedAt = Date.now();
|
|
83
|
+
traceWebRequestControl("resume.received", {
|
|
84
|
+
requestId,
|
|
85
|
+
environmentId,
|
|
86
|
+
afterSeq: getNumber(message.afterSeq),
|
|
87
|
+
});
|
|
62
88
|
const environment = this.environments.get(environmentId);
|
|
63
89
|
let replay = await environment.services.sessions.getRequestReplayById(requestId, getNumber(message.afterSeq));
|
|
64
90
|
if (!replay?.finalState) {
|
|
@@ -86,5 +112,18 @@ export class LocalRealtimeController {
|
|
|
86
112
|
error: replay.finalState.error,
|
|
87
113
|
});
|
|
88
114
|
}
|
|
115
|
+
// A returned send call is not a browser delivery acknowledgement.
|
|
116
|
+
traceWebRequestControl("resume.dispatch_returned", {
|
|
117
|
+
requestId,
|
|
118
|
+
environmentId,
|
|
119
|
+
afterSeq: getNumber(message.afterSeq),
|
|
120
|
+
replayFound: replay !== null && replay !== undefined,
|
|
121
|
+
sessionId: replay?.sessionId,
|
|
122
|
+
eventCount: replay?.events.length ?? 0,
|
|
123
|
+
lifecycleStatus: replay?.lifecycle?.status,
|
|
124
|
+
finalStateStatus: replay?.finalState?.status,
|
|
125
|
+
socketReadyState: client.readyState,
|
|
126
|
+
elapsedMs: Date.now() - startedAt,
|
|
127
|
+
});
|
|
89
128
|
}
|
|
90
129
|
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { acceptConfigMutationRequest } from "./config-mutation-request.js";
|
|
2
2
|
import { getString, sendJson } from "./http.js";
|
|
3
|
+
import { diagnosticErrorType } from "../../runtime/observability/request-control-diagnostics.js";
|
|
4
|
+
import { traceWebRequestControl } from "./request-control-observation.js";
|
|
3
5
|
export async function cancelWebRequest(input) {
|
|
4
6
|
if (!acceptConfigMutationRequest(input.request, input.response))
|
|
5
7
|
return;
|
|
@@ -29,6 +31,31 @@ export async function cancelWebRequest(input) {
|
|
|
29
31
|
commandId: getString(body.commandId),
|
|
30
32
|
}
|
|
31
33
|
: undefined;
|
|
32
|
-
const
|
|
34
|
+
const fields = {
|
|
35
|
+
requestId,
|
|
36
|
+
sessionId,
|
|
37
|
+
environmentId: input.environment.services?.config?.runtimeId,
|
|
38
|
+
hasWaitIdentity: wait !== undefined,
|
|
39
|
+
};
|
|
40
|
+
const startedAt = Date.now();
|
|
41
|
+
traceWebRequestControl("cancel.received", fields);
|
|
42
|
+
let result;
|
|
43
|
+
try {
|
|
44
|
+
result = await cancel(requestId, sessionId, wait);
|
|
45
|
+
}
|
|
46
|
+
catch (error) {
|
|
47
|
+
traceWebRequestControl("cancel.failed", {
|
|
48
|
+
...fields,
|
|
49
|
+
errorType: diagnosticErrorType(error),
|
|
50
|
+
elapsedMs: Date.now() - startedAt,
|
|
51
|
+
});
|
|
52
|
+
throw error;
|
|
53
|
+
}
|
|
54
|
+
traceWebRequestControl("cancel.result", {
|
|
55
|
+
...fields,
|
|
56
|
+
accepted: result.accepted,
|
|
57
|
+
reason: result.accepted ? undefined : result.reason,
|
|
58
|
+
elapsedMs: Date.now() - startedAt,
|
|
59
|
+
});
|
|
33
60
|
sendJson(input.response, 200, { ok: true, ...result });
|
|
34
61
|
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type RequestControlDiagnosticFields } from "../../runtime/observability/request-control-diagnostics.js";
|
|
2
|
+
import type { ActiveRequest, JsonObject } from "./contracts.js";
|
|
3
|
+
export declare function traceWebRequestControl(event: string, fields: RequestControlDiagnosticFields): void;
|
|
4
|
+
export declare function traceWebProjection(event: "projection.opened" | "projection.removed", requestId: string, active: ActiveRequest | undefined, reason: string, removed?: boolean): void;
|
|
5
|
+
export declare function webSteerRoute(active: ActiveRequest | undefined, steer: unknown): string;
|
|
6
|
+
/** Observes the existing routing decision; it never queries or changes an owner. */
|
|
7
|
+
export declare class WebSteerObservation {
|
|
8
|
+
private readonly requestId;
|
|
9
|
+
private readonly steerId;
|
|
10
|
+
private readonly active;
|
|
11
|
+
private readonly currentProjection;
|
|
12
|
+
private readonly startedAt;
|
|
13
|
+
private route;
|
|
14
|
+
constructor(requestId: string, steerId: string, requestedEnvironment: string, textLength: number, active: ActiveRequest | undefined, currentProjection: () => ActiveRequest | undefined);
|
|
15
|
+
selectRoute(route: string): void;
|
|
16
|
+
result(acknowledgement: JsonObject): void;
|
|
17
|
+
failed(error: unknown): void;
|
|
18
|
+
private trace;
|
|
19
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { diagnosticErrorType, traceRequestControl, } from "../../runtime/observability/request-control-diagnostics.js";
|
|
2
|
+
import { getString } from "./http.js";
|
|
3
|
+
export function traceWebRequestControl(event, fields) {
|
|
4
|
+
traceRequestControl("web.request_control", event, fields);
|
|
5
|
+
}
|
|
6
|
+
function projectionFields(active) {
|
|
7
|
+
return {
|
|
8
|
+
projectionPresent: active !== undefined,
|
|
9
|
+
environmentId: active?.environmentId,
|
|
10
|
+
sessionId: active?.sessionId,
|
|
11
|
+
projectionStartedAt: active?.startedAt,
|
|
12
|
+
lastEventAt: active?.lastEventAt,
|
|
13
|
+
finalStateStatus: getString(active?.finalState?.status) || undefined,
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
export function traceWebProjection(event, requestId, active, reason, removed) {
|
|
17
|
+
traceWebRequestControl(event, {
|
|
18
|
+
requestId,
|
|
19
|
+
...projectionFields(active),
|
|
20
|
+
reason,
|
|
21
|
+
removed,
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
export function webSteerRoute(active, steer) {
|
|
25
|
+
if (!active)
|
|
26
|
+
return "web_projection_missing";
|
|
27
|
+
if (steer)
|
|
28
|
+
return "runtime_owner";
|
|
29
|
+
return "local_inbox";
|
|
30
|
+
}
|
|
31
|
+
/** Observes the existing routing decision; it never queries or changes an owner. */
|
|
32
|
+
export class WebSteerObservation {
|
|
33
|
+
requestId;
|
|
34
|
+
steerId;
|
|
35
|
+
active;
|
|
36
|
+
currentProjection;
|
|
37
|
+
startedAt = Date.now();
|
|
38
|
+
route = "not_routed";
|
|
39
|
+
constructor(requestId, steerId, requestedEnvironment, textLength, active, currentProjection) {
|
|
40
|
+
this.requestId = requestId;
|
|
41
|
+
this.steerId = steerId;
|
|
42
|
+
this.active = active;
|
|
43
|
+
this.currentProjection = currentProjection;
|
|
44
|
+
traceWebRequestControl("steer.received", {
|
|
45
|
+
requestId,
|
|
46
|
+
steerId,
|
|
47
|
+
requestedEnvironment,
|
|
48
|
+
textLength,
|
|
49
|
+
...projectionFields(active),
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
selectRoute(route) {
|
|
53
|
+
this.route = route;
|
|
54
|
+
}
|
|
55
|
+
result(acknowledgement) {
|
|
56
|
+
this.trace("steer.result", {
|
|
57
|
+
accepted: acknowledgement.accepted === true,
|
|
58
|
+
reason: getString(acknowledgement.reason) || undefined,
|
|
59
|
+
acceptedSequence: typeof acknowledgement.acceptedSequence === "number"
|
|
60
|
+
? acknowledgement.acceptedSequence
|
|
61
|
+
: undefined,
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
failed(error) {
|
|
65
|
+
this.trace("steer.failed", { errorType: diagnosticErrorType(error) });
|
|
66
|
+
}
|
|
67
|
+
trace(event, fields) {
|
|
68
|
+
const current = this.currentProjection();
|
|
69
|
+
traceWebRequestControl(event, {
|
|
70
|
+
requestId: this.requestId,
|
|
71
|
+
steerId: this.steerId,
|
|
72
|
+
route: this.route,
|
|
73
|
+
...projectionFields(this.active),
|
|
74
|
+
currentProjectionPresent: current !== undefined,
|
|
75
|
+
projectionStillCurrent: this.active !== undefined && current === this.active,
|
|
76
|
+
elapsedMs: Date.now() - this.startedAt,
|
|
77
|
+
...fields,
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
}
|