@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,54 @@
|
|
|
1
|
+
import { execFile } from "node:child_process";
|
|
2
|
+
import { promisify } from "node:util";
|
|
3
|
+
import { parsePluginInstallLink } from "../../plugin-contract/install-source.js";
|
|
4
|
+
import { notificationRuntimeOrigin } from "./notification-protocol.js";
|
|
5
|
+
export function pluginInstallReviewUrl(link, runtimeUrl) {
|
|
6
|
+
const source = parsePluginInstallLink(link);
|
|
7
|
+
const url = new URL("/plugins", notificationRuntimeOrigin(runtimeUrl));
|
|
8
|
+
url.searchParams.set("tab", "discover");
|
|
9
|
+
url.searchParams.set("pluginSource", source.repository);
|
|
10
|
+
if (source.ref)
|
|
11
|
+
url.searchParams.set("pluginRef", source.ref);
|
|
12
|
+
if (source.path)
|
|
13
|
+
url.searchParams.set("pluginPath", source.path);
|
|
14
|
+
return url.toString();
|
|
15
|
+
}
|
|
16
|
+
/** The saved pairing owns the destination. Incoming links cannot select a host. */
|
|
17
|
+
export async function openPluginInstallLink(state, link, open = openReviewBrowser) {
|
|
18
|
+
parsePluginInstallLink(link);
|
|
19
|
+
const connection = await state.read();
|
|
20
|
+
if (!connection)
|
|
21
|
+
throw new Error("Connect Computer Access before opening an ABot installation link.");
|
|
22
|
+
await open(pluginInstallReviewUrl(link, connection.url));
|
|
23
|
+
}
|
|
24
|
+
async function openReviewBrowser(url) {
|
|
25
|
+
const execute = promisify(execFile);
|
|
26
|
+
const options = { windowsHide: true, timeout: 10_000, maxBuffer: 16_384 };
|
|
27
|
+
if (process.platform === "win32") {
|
|
28
|
+
await execute("rundll32.exe", ["url.dll,FileProtocolHandler", url], options);
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
if (process.platform === "darwin") {
|
|
32
|
+
await execute("/usr/bin/open", [url], options);
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
if (process.platform === "linux") {
|
|
36
|
+
await execute("xdg-open", [url], options);
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
throw new Error("ABot installation links are not supported on this platform.");
|
|
40
|
+
}
|
|
41
|
+
/** Windows Script Host expands percent-delimited environment variables in Run().
|
|
42
|
+
* The launcher sends base64 so a website URL can never interpolate local values. */
|
|
43
|
+
export function parsePluginInstallArguments(args) {
|
|
44
|
+
if (args.length === 1)
|
|
45
|
+
return args[0];
|
|
46
|
+
if (args.length !== 2 || args[0] !== "--encoded")
|
|
47
|
+
throw new Error("Usage: abot host open-link <abot://install link>");
|
|
48
|
+
const encoded = args[1];
|
|
49
|
+
if (encoded.length > 12_000 || !/^[A-Za-z0-9+/]+={0,2}$/u.test(encoded))
|
|
50
|
+
throw new Error("Invalid encoded installation link.");
|
|
51
|
+
const decoded = Buffer.from(encoded, "base64").toString("utf8");
|
|
52
|
+
parsePluginInstallLink(decoded);
|
|
53
|
+
return decoded;
|
|
54
|
+
}
|
|
@@ -62,6 +62,9 @@ const NATIVE_OPERATION_FIELDS = {
|
|
|
62
62
|
desktop_notification: ["target", "notificationId", "title", "body", "url"],
|
|
63
63
|
system_targets: [],
|
|
64
64
|
system_command: ["target", "command", "cwd", "elevated", "timeout_ms"],
|
|
65
|
+
system_command_capture: ["target", "command", "cwd", "elevated", "timeout_ms", "outputRetentionMs"],
|
|
66
|
+
system_command_output: ["target", "captureId", "stream", "offset"],
|
|
67
|
+
system_command_output_close: ["target", "captureId"],
|
|
65
68
|
system_applications: ["target", "query", "limit"],
|
|
66
69
|
system_launch: ["target", "application_id", "arguments"],
|
|
67
70
|
computer_execute: ["target", "sessionId", "request"],
|
|
@@ -14,6 +14,7 @@ export type NativeSessionOptions = Readonly<{
|
|
|
14
14
|
onReady(hostId: string): void | Promise<void>;
|
|
15
15
|
resolveHost?: NativeHostResolver;
|
|
16
16
|
handlers?: Record<string, ToolImplementation>;
|
|
17
|
+
commandOutputStateDir?: string;
|
|
17
18
|
heartbeatMs?: number;
|
|
18
19
|
operationLimit?: number;
|
|
19
20
|
observationCollector?: ObservationCollectorFactory;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import WebSocket from "ws";
|
|
2
|
+
import { CompanionCommandOutput } from "./command-output.js";
|
|
3
|
+
import { SYSTEM_OUTPUT_CAPABILITY } from "./command-output-protocol.js";
|
|
2
4
|
import { createNativePermissionHandlers } from "./native-permissions.js";
|
|
3
5
|
import { MACOS_PERMISSION_CAPABILITY } from "./permission-protocol.js";
|
|
4
6
|
import { nativeLoopbackSocketOptions } from "./native-loopback-lookup.js";
|
|
@@ -41,7 +43,10 @@ export async function connectNativeHost(options) {
|
|
|
41
43
|
await ownedNotifications?.close();
|
|
42
44
|
options.signal.throwIfAborted();
|
|
43
45
|
}
|
|
46
|
+
const commandOutput = options.commandOutputStateDir && !options.handlers
|
|
47
|
+
? new CompanionCommandOutput(options.commandOutputStateDir) : undefined;
|
|
44
48
|
const handlers = options.handlers ?? {
|
|
49
|
+
...commandOutput?.handlers(),
|
|
45
50
|
...createSystemHandlers(),
|
|
46
51
|
...computers.handlers(),
|
|
47
52
|
...notifications.handlers(),
|
|
@@ -101,6 +106,7 @@ export async function connectNativeHost(options) {
|
|
|
101
106
|
clearTimeout(retirement);
|
|
102
107
|
observations.close();
|
|
103
108
|
void computers.close();
|
|
109
|
+
commandOutput?.close();
|
|
104
110
|
if (!options.notifications)
|
|
105
111
|
void notifications.close();
|
|
106
112
|
for (const controller of active.values())
|
|
@@ -148,6 +154,8 @@ export async function connectNativeHost(options) {
|
|
|
148
154
|
return false;
|
|
149
155
|
if (computers.hasActiveSessions())
|
|
150
156
|
return false;
|
|
157
|
+
if (commandOutput?.hasTransfers())
|
|
158
|
+
return false;
|
|
151
159
|
if (advertisedNotificationReady)
|
|
152
160
|
return false;
|
|
153
161
|
return notifications.ready;
|
|
@@ -165,11 +173,14 @@ export async function connectNativeHost(options) {
|
|
|
165
173
|
throw new Error("Unbound native operation.");
|
|
166
174
|
if (seen.has(message.id))
|
|
167
175
|
throw new Error("Repeated native operation identity.");
|
|
168
|
-
|
|
176
|
+
const readsCommandOutput = message.operation === "system_command_output" || message.operation === "system_command_output_close";
|
|
177
|
+
if (!readsCommandOutput && seen.size >= (options.operationLimit ?? 4_096)) {
|
|
169
178
|
retireConnection(message.id);
|
|
170
179
|
return;
|
|
171
180
|
}
|
|
172
|
-
|
|
181
|
+
// Reading stored bytes is idempotent and must not retire a large transfer.
|
|
182
|
+
if (!readsCommandOutput)
|
|
183
|
+
seen.add(message.id);
|
|
173
184
|
if (active.size >= 4) {
|
|
174
185
|
sendResult(message.id, operationFailure("The host companion is busy.", "system_host_busy"));
|
|
175
186
|
return;
|
|
@@ -246,6 +257,7 @@ export async function connectNativeHost(options) {
|
|
|
246
257
|
capabilities: [
|
|
247
258
|
OBSERVATION_CAPABILITY,
|
|
248
259
|
COMPUTER_CAPABILITY,
|
|
260
|
+
...(commandOutput ? [SYSTEM_OUTPUT_CAPABILITY] : []),
|
|
249
261
|
...(options.identity.os === "macos" ? [MACOS_PERMISSION_CAPABILITY] : []),
|
|
250
262
|
...(advertisedNotificationReady
|
|
251
263
|
? [DESKTOP_NOTIFICATION_CAPABILITY]
|
|
@@ -102,6 +102,7 @@ export async function runNativeHostSupervisor(options) {
|
|
|
102
102
|
url: initial.url,
|
|
103
103
|
authorization: initial.credential,
|
|
104
104
|
hostId: initial.hostId,
|
|
105
|
+
commandOutputStateDir: options.state.directory,
|
|
105
106
|
identity: options.identity,
|
|
106
107
|
signal: controller.signal,
|
|
107
108
|
notifications: notificationSession,
|
|
@@ -2,4 +2,4 @@ import type { DesktopNotification } from "./notification-protocol.js";
|
|
|
2
2
|
import { type NotificationProcessRunner } from "./notification-process.js";
|
|
3
3
|
export declare const WINDOWS_NOTIFICATION_IDENTITY_SCRIPT: string;
|
|
4
4
|
export declare function powershellNotificationArguments(script: string): string[];
|
|
5
|
-
export declare function sendWindowsNotification(notification: DesktopNotification, signal?: AbortSignal, run?: NotificationProcessRunner): Promise<void>;
|
|
5
|
+
export declare function sendWindowsNotification(notification: DesktopNotification, signal?: AbortSignal, run?: NotificationProcessRunner, appUserModelId?: string): Promise<void>;
|
|
@@ -11,7 +11,9 @@ $Payload = [Console]::In.ReadToEnd() | ConvertFrom-Json
|
|
|
11
11
|
[void][Windows.UI.Notifications.ToastNotificationManager, Windows.UI.Notifications, ContentType = WindowsRuntime]
|
|
12
12
|
[void][Windows.UI.Notifications.ToastNotification, Windows.UI.Notifications, ContentType = WindowsRuntime]
|
|
13
13
|
[void][Windows.Data.Xml.Dom.XmlDocument, Windows.Data.Xml.Dom.XmlDocument, ContentType = WindowsRuntime]
|
|
14
|
-
$
|
|
14
|
+
$ApplicationId = '${NOTIFICATION_APP_ID}'
|
|
15
|
+
if ($Payload.appUserModelId) { $ApplicationId = [string]$Payload.appUserModelId }
|
|
16
|
+
$Notifier = [Windows.UI.Notifications.ToastNotificationManager]::CreateToastNotifier($ApplicationId)
|
|
15
17
|
# Win32 Setting is unavailable until the first toast; Show honors Windows notification settings.
|
|
16
18
|
$Xml = New-Object Windows.Data.Xml.Dom.XmlDocument
|
|
17
19
|
$Xml.LoadXml('<toast activationType="protocol"><visual><binding template="ToastGeneric"><text/><text/></binding></visual><audio silent="true"/></toast>')
|
|
@@ -127,11 +129,14 @@ export function powershellNotificationArguments(script) {
|
|
|
127
129
|
Buffer.from(script, "utf16le").toString("base64"),
|
|
128
130
|
];
|
|
129
131
|
}
|
|
130
|
-
export async function sendWindowsNotification(notification, signal, run = runNotificationProcess) {
|
|
132
|
+
export async function sendWindowsNotification(notification, signal, run = runNotificationProcess, appUserModelId) {
|
|
131
133
|
await run({
|
|
132
134
|
file: "powershell.exe",
|
|
133
135
|
args: powershellNotificationArguments(WINDOWS_NOTIFICATION_SCRIPT),
|
|
134
|
-
input: JSON.stringify(
|
|
136
|
+
input: JSON.stringify({
|
|
137
|
+
...notification,
|
|
138
|
+
...(appUserModelId ? { appUserModelId } : {}),
|
|
139
|
+
}),
|
|
135
140
|
signal,
|
|
136
141
|
});
|
|
137
142
|
}
|
|
@@ -9,7 +9,7 @@ export declare const HOST_SOCKET_PATH = "/system-host/connect";
|
|
|
9
9
|
export declare const HOST_WIRE_MAX_BYTES: number;
|
|
10
10
|
export declare const HOST_OPERATIONS: readonly ["system_targets", "system_command", "system_applications", "system_launch"];
|
|
11
11
|
export declare const COMPUTER_HOST_OPERATIONS: readonly ["computer_execute", "computer_frame", "computer_close"];
|
|
12
|
-
export type HostOperation = (typeof HOST_OPERATIONS)[number] | (typeof COMPUTER_HOST_OPERATIONS)[number] | typeof MACOS_PERMISSION_OPERATION | typeof DESKTOP_NOTIFICATION_OPERATION;
|
|
12
|
+
export type HostOperation = (typeof HOST_OPERATIONS)[number] | (typeof COMPUTER_HOST_OPERATIONS)[number] | "system_command_capture" | "system_command_output" | "system_command_output_close" | typeof MACOS_PERMISSION_OPERATION | typeof DESKTOP_NOTIFICATION_OPERATION;
|
|
13
13
|
export type HostIdentity = Readonly<{
|
|
14
14
|
name: string;
|
|
15
15
|
os: "windows" | "macos" | "linux";
|
|
@@ -20,6 +20,12 @@ export function isHostOperation(value) {
|
|
|
20
20
|
export function isHostWireOperation(value) {
|
|
21
21
|
if (isHostOperation(value))
|
|
22
22
|
return true;
|
|
23
|
+
if (value === "system_command_capture")
|
|
24
|
+
return true;
|
|
25
|
+
if (value === "system_command_output")
|
|
26
|
+
return true;
|
|
27
|
+
if (value === "system_command_output_close")
|
|
28
|
+
return true;
|
|
23
29
|
if (value === DESKTOP_NOTIFICATION_OPERATION)
|
|
24
30
|
return true;
|
|
25
31
|
if (value === MACOS_PERMISSION_OPERATION)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** Increment when installed companions should be offered an update. Independent of the wire protocol. */
|
|
2
|
-
export declare const COMPANION_RELEASE_VERSION =
|
|
2
|
+
export declare const COMPANION_RELEASE_VERSION = 12;
|
|
3
3
|
export declare function companionReleaseStatus(version: unknown): {
|
|
4
4
|
installedVersion: number | null;
|
|
5
5
|
availableVersion: number;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** Increment when installed companions should be offered an update. Independent of the wire protocol. */
|
|
2
|
-
export const COMPANION_RELEASE_VERSION =
|
|
2
|
+
export const COMPANION_RELEASE_VERSION = 12;
|
|
3
3
|
export function companionReleaseStatus(version) {
|
|
4
4
|
const installedVersion = typeof version === "number" && Number.isSafeInteger(version) && version > 0
|
|
5
5
|
? version
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { NativeHostConnection } from "../native-state.js";
|
|
2
|
+
export declare function hasMissingStoreUpgradeConnection(upgradeHostId: string | undefined, saved: NativeHostConnection | undefined): boolean;
|
|
3
|
+
/** Fixed Store helper failure codes. Never serialize underlying errors or invitations. */
|
|
4
|
+
export declare class MissingStoreConnectionError extends Error {
|
|
5
|
+
constructor();
|
|
6
|
+
}
|
|
7
|
+
export declare function serializeStoreConnectionError(error: unknown): string;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export function hasMissingStoreUpgradeConnection(upgradeHostId, saved) {
|
|
2
|
+
if (upgradeHostId === undefined)
|
|
3
|
+
return false;
|
|
4
|
+
return saved === undefined;
|
|
5
|
+
}
|
|
6
|
+
/** Fixed Store helper failure codes. Never serialize underlying errors or invitations. */
|
|
7
|
+
export class MissingStoreConnectionError extends Error {
|
|
8
|
+
constructor() {
|
|
9
|
+
super("companion_local_pairing_missing");
|
|
10
|
+
this.name = "MissingStoreConnectionError";
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
export function serializeStoreConnectionError(error) {
|
|
14
|
+
return JSON.stringify({
|
|
15
|
+
error: error instanceof MissingStoreConnectionError
|
|
16
|
+
? "companion_local_pairing_missing"
|
|
17
|
+
: "companion_request_failed",
|
|
18
|
+
});
|
|
19
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare const STORE_CONNECTION_LINK_MAX_BYTES = 8192;
|
|
2
|
+
export type StoreConnectionInvitation = Readonly<{
|
|
3
|
+
version: 1;
|
|
4
|
+
url: string;
|
|
5
|
+
code: string;
|
|
6
|
+
expiresAt: string;
|
|
7
|
+
companionRelease: number;
|
|
8
|
+
upgradeHostId?: string;
|
|
9
|
+
}>;
|
|
10
|
+
export declare function readStoreConnectionInvitation(value: unknown, now?: number): StoreConnectionInvitation;
|
|
11
|
+
export declare function normalizeStoreConnectionOrigin(value: unknown): string;
|
|
12
|
+
export declare function createStoreConnectionLink(invitation: StoreConnectionInvitation): string;
|
|
13
|
+
export declare function parseStoreConnectionLink(link: string, now?: number): StoreConnectionInvitation;
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { isNativeLoopbackAddress, normalizeNativeRuntimeUrl } from "../native-address.js";
|
|
2
|
+
import { isHostIdentifier, isHostRecord } from "../protocol.js";
|
|
3
|
+
import { COMPANION_RELEASE_VERSION } from "../release-version.js";
|
|
4
|
+
import { WINDOWS_COMPANION_STORE } from "./identity.js";
|
|
5
|
+
export const STORE_CONNECTION_LINK_MAX_BYTES = 8_192;
|
|
6
|
+
function invalidInvitation() {
|
|
7
|
+
// Incoming links contain a secret. Never include their text in an error.
|
|
8
|
+
return new Error("Invalid Companion connection invitation. Open Computer access in ABot and request a new connection.");
|
|
9
|
+
}
|
|
10
|
+
function isLoopbackInvitationOrigin(url) {
|
|
11
|
+
if (url.protocol !== "http:")
|
|
12
|
+
return false;
|
|
13
|
+
if (url.hostname === "localhost")
|
|
14
|
+
return true;
|
|
15
|
+
if (url.hostname.endsWith(".localhost"))
|
|
16
|
+
return true;
|
|
17
|
+
return isNativeLoopbackAddress(url.hostname);
|
|
18
|
+
}
|
|
19
|
+
export function readStoreConnectionInvitation(value, now = Date.now()) {
|
|
20
|
+
if (!isHostRecord(value))
|
|
21
|
+
throw invalidInvitation();
|
|
22
|
+
const fields = ["version", "url", "code", "expiresAt", "companionRelease", "upgradeHostId"];
|
|
23
|
+
if (Object.keys(value).some((key) => !fields.includes(key)))
|
|
24
|
+
throw invalidInvitation();
|
|
25
|
+
if (value.version !== 1)
|
|
26
|
+
throw invalidInvitation();
|
|
27
|
+
const origin = normalizeStoreConnectionOrigin(value.url);
|
|
28
|
+
if (typeof value.code !== "string" || !/^[A-Za-z0-9_-]{43}$/u.test(value.code))
|
|
29
|
+
throw invalidInvitation();
|
|
30
|
+
if (typeof value.expiresAt !== "string")
|
|
31
|
+
throw invalidInvitation();
|
|
32
|
+
const expiresAt = Date.parse(value.expiresAt);
|
|
33
|
+
if (!Number.isFinite(expiresAt))
|
|
34
|
+
throw invalidInvitation();
|
|
35
|
+
if (expiresAt <= now)
|
|
36
|
+
throw new Error("This connection invitation has expired. Click Connect in ABot again.");
|
|
37
|
+
if (!Number.isSafeInteger(value.companionRelease))
|
|
38
|
+
throw invalidInvitation();
|
|
39
|
+
if (Number(value.companionRelease) < 1)
|
|
40
|
+
throw invalidInvitation();
|
|
41
|
+
if (Number(value.companionRelease) > COMPANION_RELEASE_VERSION)
|
|
42
|
+
throw new Error("Update ABot AI Companion in Microsoft Store, then connect again.");
|
|
43
|
+
if (value.upgradeHostId !== undefined && !isHostIdentifier(value.upgradeHostId))
|
|
44
|
+
throw invalidInvitation();
|
|
45
|
+
return {
|
|
46
|
+
version: 1,
|
|
47
|
+
url: origin,
|
|
48
|
+
code: value.code,
|
|
49
|
+
expiresAt: new Date(expiresAt).toISOString(),
|
|
50
|
+
companionRelease: Number(value.companionRelease),
|
|
51
|
+
...(value.upgradeHostId === undefined ? {} : { upgradeHostId: value.upgradeHostId }),
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
export function normalizeStoreConnectionOrigin(value) {
|
|
55
|
+
if (typeof value !== "string" || value.length > 4_096)
|
|
56
|
+
throw invalidInvitation();
|
|
57
|
+
let url;
|
|
58
|
+
try {
|
|
59
|
+
url = new URL(value);
|
|
60
|
+
normalizeNativeRuntimeUrl(value);
|
|
61
|
+
}
|
|
62
|
+
catch {
|
|
63
|
+
throw invalidInvitation();
|
|
64
|
+
}
|
|
65
|
+
if (!isLoopbackInvitationOrigin(url))
|
|
66
|
+
throw invalidInvitation();
|
|
67
|
+
if (/[\x00-\x20\x7f]/u.test(value))
|
|
68
|
+
throw invalidInvitation();
|
|
69
|
+
return url.origin;
|
|
70
|
+
}
|
|
71
|
+
export function createStoreConnectionLink(invitation) {
|
|
72
|
+
const data = readStoreConnectionInvitation(invitation);
|
|
73
|
+
const link = new URL(`${WINDOWS_COMPANION_STORE.protocol}//connect`);
|
|
74
|
+
link.searchParams.set("invitation", Buffer.from(JSON.stringify(data)).toString("base64url"));
|
|
75
|
+
if (Buffer.byteLength(link.href) > STORE_CONNECTION_LINK_MAX_BYTES)
|
|
76
|
+
throw invalidInvitation();
|
|
77
|
+
return link.href;
|
|
78
|
+
}
|
|
79
|
+
export function parseStoreConnectionLink(link, now = Date.now()) {
|
|
80
|
+
if (Buffer.byteLength(link) > STORE_CONNECTION_LINK_MAX_BYTES)
|
|
81
|
+
throw invalidInvitation();
|
|
82
|
+
let url;
|
|
83
|
+
try {
|
|
84
|
+
url = new URL(link);
|
|
85
|
+
}
|
|
86
|
+
catch {
|
|
87
|
+
throw invalidInvitation();
|
|
88
|
+
}
|
|
89
|
+
if (url.protocol !== WINDOWS_COMPANION_STORE.protocol)
|
|
90
|
+
throw invalidInvitation();
|
|
91
|
+
if (url.hostname !== "connect" || url.port || url.username || url.password || url.hash)
|
|
92
|
+
throw invalidInvitation();
|
|
93
|
+
if (url.pathname !== "" && url.pathname !== "/")
|
|
94
|
+
throw invalidInvitation();
|
|
95
|
+
const entries = [...url.searchParams];
|
|
96
|
+
if (entries.length !== 1 || entries[0][0] !== "invitation")
|
|
97
|
+
throw invalidInvitation();
|
|
98
|
+
const encoded = entries[0][1];
|
|
99
|
+
if (!/^[A-Za-z0-9_-]+$/u.test(encoded))
|
|
100
|
+
throw invalidInvitation();
|
|
101
|
+
let data;
|
|
102
|
+
try {
|
|
103
|
+
data = JSON.parse(Buffer.from(encoded, "base64url").toString("utf8"));
|
|
104
|
+
}
|
|
105
|
+
catch {
|
|
106
|
+
throw invalidInvitation();
|
|
107
|
+
}
|
|
108
|
+
return readStoreConnectionInvitation(data, now);
|
|
109
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/** Store-assigned identity. Build tooling and the packaged Companion share it. */
|
|
2
|
+
export declare const WINDOWS_COMPANION_STORE: Readonly<{
|
|
3
|
+
name: "ABot-AI.ABotAICompanion";
|
|
4
|
+
publisher: "CN=5497306F-2434-4801-8B3F-4B721B2A2606";
|
|
5
|
+
publisherDisplayName: "ABot-AI";
|
|
6
|
+
displayName: "ABot AI Companion";
|
|
7
|
+
familyName: "ABot-AI.ABotAICompanion_9b4v4r6by2e32";
|
|
8
|
+
applicationId: "Companion";
|
|
9
|
+
productId: "9PK2FDQQLQS9";
|
|
10
|
+
protocol: "abot-companion:";
|
|
11
|
+
}>;
|
|
12
|
+
export declare const WINDOWS_COMPANION_AUMID: string;
|
|
13
|
+
export declare const WINDOWS_COMPANION_STORE_URL: string;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/** Store-assigned identity. Build tooling and the packaged Companion share it. */
|
|
2
|
+
export const WINDOWS_COMPANION_STORE = Object.freeze({
|
|
3
|
+
name: "ABot-AI.ABotAICompanion",
|
|
4
|
+
publisher: "CN=5497306F-2434-4801-8B3F-4B721B2A2606",
|
|
5
|
+
publisherDisplayName: "ABot-AI",
|
|
6
|
+
displayName: "ABot AI Companion",
|
|
7
|
+
familyName: "ABot-AI.ABotAICompanion_9b4v4r6by2e32",
|
|
8
|
+
applicationId: "Companion",
|
|
9
|
+
productId: "9PK2FDQQLQS9",
|
|
10
|
+
protocol: "abot-companion:",
|
|
11
|
+
});
|
|
12
|
+
export const WINDOWS_COMPANION_AUMID = `${WINDOWS_COMPANION_STORE.familyName}!${WINDOWS_COMPANION_STORE.applicationId}`;
|
|
13
|
+
export const WINDOWS_COMPANION_STORE_URL = `https://apps.microsoft.com/detail/${WINDOWS_COMPANION_STORE.productId}`;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { HostCompanionLifecycle } from "../../../cli/host-companion-lifecycle.js";
|
|
2
|
+
/** MSIX owns startup/protocol registration and updates; the shared CLI owns pairing. */
|
|
3
|
+
export declare function createWindowsStoreLifecycle(options: Readonly<{
|
|
4
|
+
appUserModelId: string;
|
|
5
|
+
}>): HostCompanionLifecycle;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { startDetachedCompanion, waitForNativeConnection, } from "../../../cli/host-companion-startup.js";
|
|
2
|
+
import { existingOwnedRegistration, nativeAutostartFile, uninstallNativeAutostart, } from "../autostart.js";
|
|
3
|
+
import { uninstallCompanionInstallLinks } from "../install-link-registration.js";
|
|
4
|
+
import { readNativeCompanionBuildId } from "../native-build-identity.js";
|
|
5
|
+
import { createNotificationSession } from "../native-notifications.js";
|
|
6
|
+
import { stopOwnedNativeCompanion } from "../native-replacement.js";
|
|
7
|
+
import { uninstallDesktopNotificationIdentity } from "../notification-installation.js";
|
|
8
|
+
import { runNotificationProcess } from "../notification-process.js";
|
|
9
|
+
import { powershellNotificationArguments, sendWindowsNotification, } from "../notification-windows.js";
|
|
10
|
+
const STORE_NOTIFICATION_READINESS_SCRIPT = String.raw `
|
|
11
|
+
$ErrorActionPreference = 'Stop'
|
|
12
|
+
$ProgressPreference = 'SilentlyContinue'
|
|
13
|
+
[Console]::InputEncoding = New-Object System.Text.UTF8Encoding($false)
|
|
14
|
+
[Console]::OutputEncoding = New-Object System.Text.UTF8Encoding($false)
|
|
15
|
+
try {
|
|
16
|
+
$Payload = [Console]::In.ReadToEnd() | ConvertFrom-Json
|
|
17
|
+
[void][Windows.UI.Notifications.ToastNotificationManager, Windows.UI.Notifications, ContentType = WindowsRuntime]
|
|
18
|
+
$Notifier = [Windows.UI.Notifications.ToastNotificationManager]::CreateToastNotifier([string]$Payload.appUserModelId)
|
|
19
|
+
[Console]::Out.Write([string]$Notifier.Setting)
|
|
20
|
+
} catch {
|
|
21
|
+
[Console]::Error.WriteLine($_.Exception.GetBaseException().Message)
|
|
22
|
+
exit 1
|
|
23
|
+
}
|
|
24
|
+
`;
|
|
25
|
+
function assertWindowsStoreStartup(startup) {
|
|
26
|
+
if (startup.platform !== "win32")
|
|
27
|
+
throw new Error("The Store companion requires Windows.");
|
|
28
|
+
}
|
|
29
|
+
function requireStoreApplicationIdentity(appUserModelId) {
|
|
30
|
+
if (!/^[A-Za-z0-9.-]+_[A-Za-z0-9]+![A-Za-z0-9.-]+$/u.test(appUserModelId))
|
|
31
|
+
throw new Error("Invalid Store companion application identity.");
|
|
32
|
+
}
|
|
33
|
+
async function hasWindowsStoreNotificationSupport(appUserModelId, signal) {
|
|
34
|
+
signal?.throwIfAborted();
|
|
35
|
+
try {
|
|
36
|
+
const setting = await runNotificationProcess({
|
|
37
|
+
file: "powershell.exe",
|
|
38
|
+
args: powershellNotificationArguments(STORE_NOTIFICATION_READINESS_SCRIPT),
|
|
39
|
+
input: JSON.stringify({ appUserModelId }),
|
|
40
|
+
signal,
|
|
41
|
+
});
|
|
42
|
+
signal?.throwIfAborted();
|
|
43
|
+
return setting.trim() === "Enabled";
|
|
44
|
+
}
|
|
45
|
+
catch {
|
|
46
|
+
signal?.throwIfAborted();
|
|
47
|
+
return false;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
/** Called only after the Store connection dialog has obtained the user's consent. */
|
|
51
|
+
async function retireOwnedLegacyRegistration(startup) {
|
|
52
|
+
await existingOwnedRegistration(nativeAutostartFile(startup));
|
|
53
|
+
await stopOwnedNativeCompanion(startup.stateDir);
|
|
54
|
+
await uninstallNativeAutostart(startup);
|
|
55
|
+
await uninstallCompanionInstallLinks(startup);
|
|
56
|
+
await uninstallDesktopNotificationIdentity(startup);
|
|
57
|
+
}
|
|
58
|
+
/** MSIX owns startup/protocol registration and updates; the shared CLI owns pairing. */
|
|
59
|
+
export function createWindowsStoreLifecycle(options) {
|
|
60
|
+
requireStoreApplicationIdentity(options.appUserModelId);
|
|
61
|
+
return {
|
|
62
|
+
assertStartupSupported: assertWindowsStoreStartup,
|
|
63
|
+
async completeStartup(state, startup, hostId) {
|
|
64
|
+
assertWindowsStoreStartup(startup);
|
|
65
|
+
const buildId = await readNativeCompanionBuildId(startup.cliPath);
|
|
66
|
+
await retireOwnedLegacyRegistration(startup);
|
|
67
|
+
const connectedAfter = Date.now();
|
|
68
|
+
await startDetachedCompanion(startup);
|
|
69
|
+
if (!(await waitForNativeConnection(state, hostId, buildId, connectedAfter)))
|
|
70
|
+
throw new Error("The Store companion did not connect. The saved pairing is preserved; use Connect computer again to retry.");
|
|
71
|
+
console.log("ABot AI Companion connected.");
|
|
72
|
+
},
|
|
73
|
+
async uninstall(state, startup) {
|
|
74
|
+
assertWindowsStoreStartup(startup);
|
|
75
|
+
await state.remove();
|
|
76
|
+
await stopOwnedNativeCompanion(state.directory);
|
|
77
|
+
console.log("Host companion disconnected and its saved credential was removed. Remove ABot AI Companion in Windows Settings to uninstall the app.");
|
|
78
|
+
},
|
|
79
|
+
async createNotifications(runtimeUrl, signal) {
|
|
80
|
+
signal?.throwIfAborted();
|
|
81
|
+
const { appUserModelId } = options;
|
|
82
|
+
// The supervisor already refreshes readiness and renegotiates capabilities.
|
|
83
|
+
// A slow Windows notification probe must not consume the pairing startup deadline.
|
|
84
|
+
return createNotificationSession("windows", runtimeUrl, false, {
|
|
85
|
+
send: (notification, sendSignal) => sendWindowsNotification(notification, sendSignal, runNotificationProcess, appUserModelId),
|
|
86
|
+
close() { },
|
|
87
|
+
}, (refreshSignal) => hasWindowsStoreNotificationSupport(appUserModelId, refreshSignal));
|
|
88
|
+
},
|
|
89
|
+
};
|
|
90
|
+
}
|
|
@@ -22,7 +22,7 @@ export type SystemProcessResult = Readonly<{
|
|
|
22
22
|
exitCode: number | null;
|
|
23
23
|
stdout: string;
|
|
24
24
|
stderr: string;
|
|
25
|
-
status: "completed" | "timeout" | "aborted" | "spawn_failed";
|
|
25
|
+
status: "completed" | "timeout" | "aborted" | "spawn_failed" | "output_failed";
|
|
26
26
|
outputTruncated: boolean;
|
|
27
27
|
spawnedProcess?: SystemSpawnObservation;
|
|
28
28
|
}>;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import { type ToolImplementation } from "../plugin-sdk/index.js";
|
|
2
2
|
import { type SystemProcessRunner, type SystemTarget, type SystemTargetId } from "./contracts.js";
|
|
3
|
-
|
|
3
|
+
import type { SystemCommandOutputFactory } from "./command-output.js";
|
|
4
|
+
export declare function createSystemHandlers(run?: SystemProcessRunner, resolveTarget?: (id: SystemTargetId) => Promise<SystemTarget>, commandOutput?: SystemCommandOutputFactory): Record<string, ToolImplementation>;
|
|
@@ -30,7 +30,7 @@ function withSystemOperationErrors(operation) {
|
|
|
30
30
|
}
|
|
31
31
|
};
|
|
32
32
|
}
|
|
33
|
-
export function createSystemHandlers(run = runSystemProcess, resolveTarget = (id) => resolveSystemTarget(id, run)) {
|
|
33
|
+
export function createSystemHandlers(run = runSystemProcess, resolveTarget = (id) => resolveSystemTarget(id, run), commandOutput) {
|
|
34
34
|
const targets = async () => {
|
|
35
35
|
const observation = await observeSystemTargets(run);
|
|
36
36
|
return successResult({
|
|
@@ -43,12 +43,16 @@ export function createSystemHandlers(run = runSystemProcess, resolveTarget = (id
|
|
|
43
43
|
};
|
|
44
44
|
const command = async (params, context) => {
|
|
45
45
|
const target = await resolveTarget(readSystemTargetId(params.target));
|
|
46
|
+
const output = commandOutput?.(context);
|
|
46
47
|
const result = await executeSystemCommand({
|
|
47
48
|
target,
|
|
48
49
|
params,
|
|
49
50
|
run,
|
|
51
|
+
...(output ? { runCommand: output.run } : {}),
|
|
50
52
|
...(context?.abortSignal ? { abortSignal: context.abortSignal } : {}),
|
|
51
53
|
});
|
|
54
|
+
if (output)
|
|
55
|
+
return output.present(target, result);
|
|
52
56
|
return systemProcessResult(target, result, "command_process_completion");
|
|
53
57
|
};
|
|
54
58
|
const applications = async (params) => {
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { Readable } from "node:stream";
|
|
2
|
+
/** Optional local output sink. Its owner handles storage, retention and delivery. */
|
|
3
|
+
export type SystemProcessCapture = Readonly<{
|
|
4
|
+
attach(stdout: Readable, stderr: Readable, onFailure: () => void): void;
|
|
5
|
+
end(): void;
|
|
6
|
+
}>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -2,3 +2,5 @@ import { type ToolImplementationOutput } from "../plugin-sdk/index.js";
|
|
|
2
2
|
import type { SystemApplication, SystemProcessResult, SystemTarget } from "./contracts.js";
|
|
3
3
|
export type SystemEvidenceScope = "command_process_completion" | "launch_request_dispatch";
|
|
4
4
|
export declare function systemProcessResult(target: SystemTarget, result: SystemProcessResult, evidenceScope: SystemEvidenceScope, application?: SystemApplication): ToolImplementationOutput;
|
|
5
|
+
/** Unmeasured receipt for invocation-aware local delivery through the SDK. */
|
|
6
|
+
export declare function buildSystemProcessResult(target: SystemTarget, result: SystemProcessResult, evidenceScope: SystemEvidenceScope, application?: SystemApplication): ToolImplementationOutput;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { enforcePluginResultByteBudget, } from "../plugin-sdk/index.js";
|
|
2
2
|
const STREAM_EXCERPT_CHARS = 2_000;
|
|
3
3
|
const IDENTITY_EXCERPT_CHARS = 512;
|
|
4
4
|
const LEGACY_EVIDENCE_LABELS = {
|
|
@@ -6,6 +6,10 @@ const LEGACY_EVIDENCE_LABELS = {
|
|
|
6
6
|
launch_request_dispatch: "application launch request dispatch",
|
|
7
7
|
};
|
|
8
8
|
export function systemProcessResult(target, result, evidenceScope, application) {
|
|
9
|
+
return enforcePluginResultByteBudget(buildSystemProcessResult(target, result, evidenceScope, application));
|
|
10
|
+
}
|
|
11
|
+
/** Unmeasured receipt for invocation-aware local delivery through the SDK. */
|
|
12
|
+
export function buildSystemProcessResult(target, result, evidenceScope, application) {
|
|
9
13
|
const stdoutOmittedChars = Math.max(0, result.stdout.length - STREAM_EXCERPT_CHARS);
|
|
10
14
|
const stderrOmittedChars = Math.max(0, result.stderr.length - STREAM_EXCERPT_CHARS);
|
|
11
15
|
const data = {
|
|
@@ -46,20 +50,24 @@ export function systemProcessResult(target, result, evidenceScope, application)
|
|
|
46
50
|
`Summary omitted characters: stdout=${stdoutOmittedChars}, stderr=${stderrOmittedChars}. Raw stream capture truncated: ${result.outputTruncated}.`,
|
|
47
51
|
].join("\n");
|
|
48
52
|
if (hasSuccessfulSystemObservation(result)) {
|
|
49
|
-
return
|
|
53
|
+
return {
|
|
54
|
+
ok: true,
|
|
55
|
+
producedNewInformation: true,
|
|
50
56
|
output,
|
|
51
57
|
stdout: result.stdout,
|
|
52
58
|
stderr: result.stderr,
|
|
53
59
|
exitCode: 0,
|
|
54
60
|
data,
|
|
55
|
-
}
|
|
61
|
+
};
|
|
56
62
|
}
|
|
57
63
|
const errorCode = result.status === "completed"
|
|
58
64
|
? "system_command_failed"
|
|
59
65
|
: `system_${result.status}`;
|
|
60
|
-
return
|
|
66
|
+
return {
|
|
67
|
+
ok: false,
|
|
68
|
+
producedNewInformation: false,
|
|
61
69
|
errorCode,
|
|
62
|
-
|
|
70
|
+
error: hasUncertainDescendantState(result)
|
|
63
71
|
? "System command observation stopped. External or detached descendants may remain; inspect the target before retrying."
|
|
64
72
|
: "The target did not report successful command completion.",
|
|
65
73
|
output,
|
|
@@ -67,7 +75,7 @@ export function systemProcessResult(target, result, evidenceScope, application)
|
|
|
67
75
|
stderr: result.stderr,
|
|
68
76
|
...(result.exitCode !== null ? { exitCode: result.exitCode } : {}),
|
|
69
77
|
data,
|
|
70
|
-
}
|
|
78
|
+
};
|
|
71
79
|
}
|
|
72
80
|
function hasSuccessfulSystemObservation(result) {
|
|
73
81
|
if (result.status !== "completed")
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { SystemProcessCapture } from "./process-capture.js";
|
|
1
2
|
import type { SystemProcessInput, SystemProcessResult } from "./contracts.js";
|
|
2
3
|
/** Bounded process observation; exit zero proves command completion, not effects. */
|
|
3
|
-
export declare function runSystemProcess(input: SystemProcessInput): Promise<SystemProcessResult>;
|
|
4
|
+
export declare function runSystemProcess(input: SystemProcessInput, capture?: SystemProcessCapture): Promise<SystemProcessResult>;
|