agentxgo 0.0.0-stage → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -2
- package/dist/adapters/codex/client.js +6 -0
- package/dist/adapters/dsh/client.js +6 -0
- package/dist/adapters/runtime-http/client.js +101 -0
- package/dist/adapters/runtime-http/endpoint.js +15 -0
- package/dist/bootstrap.js +161 -0
- package/dist/cli.js +134 -0
- package/dist/communication/assembly.js +172 -0
- package/dist/communication/calls.js +107 -0
- package/dist/communication/config.js +33 -0
- package/dist/communication/pump.js +136 -0
- package/dist/computer/authority.js +67 -0
- package/dist/computer/automatic.js +163 -0
- package/dist/computer/automation-main.js +59 -0
- package/dist/computer/automation.js +229 -0
- package/dist/computer/backend.js +160 -0
- package/dist/computer/clipboard.js +72 -0
- package/dist/computer/config.js +66 -0
- package/dist/computer/controller.js +378 -0
- package/dist/computer/desktop.js +225 -0
- package/dist/computer/job-main.js +114 -0
- package/dist/computer/main.js +9 -0
- package/dist/computer/native.js +28 -0
- package/dist/computer/processes.js +165 -0
- package/dist/computer/release.js +40 -0
- package/dist/computer/scratch.js +171 -0
- package/dist/computer/service.js +46 -0
- package/dist/computer/worker.js +70 -0
- package/dist/config.js +156 -0
- package/dist/continuation/checkpoints.js +98 -0
- package/dist/continuation/commands.js +81 -0
- package/dist/continuation/coordinator.js +490 -0
- package/dist/continuation/corrections.js +154 -0
- package/dist/continuation/events.js +171 -0
- package/dist/continuation/failure.js +93 -0
- package/dist/continuation/listening.js +24 -0
- package/dist/continuation/local-wait.js +67 -0
- package/dist/continuation/observations.js +100 -0
- package/dist/continuation/parking.js +190 -0
- package/dist/continuation/reading.js +77 -0
- package/dist/conversations/pump.js +158 -0
- package/dist/conversations/runtime-http.js +88 -0
- package/dist/deployment/cold-qualification.js +119 -0
- package/dist/deployment/cold-release.js +56 -0
- package/dist/deployment/components/cli.js +45 -0
- package/dist/deployment/components/lock.js +38 -0
- package/dist/deployment/components/manager.js +281 -0
- package/dist/deployment/components/release.js +50 -0
- package/dist/deployment/components/runner.js +15 -0
- package/dist/deployment/components/supervisor.js +289 -0
- package/dist/deployment/components/verify.js +66 -0
- package/dist/deployment/components/windows.js +70 -0
- package/dist/deployment/config.js +89 -0
- package/dist/deployment/failure.js +24 -0
- package/dist/deployment/kernel.js +85 -0
- package/dist/deployment/macos/activate.js +140 -0
- package/dist/deployment/macos/attachment.js +42 -0
- package/dist/deployment/macos/handoff.js +140 -0
- package/dist/deployment/macos/install.js +223 -0
- package/dist/deployment/macos/plan.js +155 -0
- package/dist/deployment/macos/proof.js +24 -0
- package/dist/deployment/main.js +16 -0
- package/dist/deployment/members.js +58 -0
- package/dist/deployment/preflight.js +41 -0
- package/dist/deployment/recovery-route.js +18 -0
- package/dist/deployment/runtime.js +114 -0
- package/dist/deployment/system.js +112 -0
- package/dist/deployment/windows-state.js +32 -0
- package/dist/doctor/config.js +155 -0
- package/dist/doctor/probe.js +212 -0
- package/dist/doctor/process.js +31 -0
- package/dist/doctor/run.js +105 -0
- package/dist/enrollment/cli.js +57 -0
- package/dist/enrollment/defaults.js +54 -0
- package/dist/enrollment/device.js +314 -0
- package/dist/enrollment/login.js +107 -0
- package/dist/enrollment/setup.js +164 -0
- package/dist/enrollment/terminal.js +55 -0
- package/dist/execution/artifact.js +157 -0
- package/dist/execution/codex/authority.js +356 -0
- package/dist/execution/codex/catalog.js +24 -0
- package/dist/execution/codex/config.js +77 -0
- package/dist/execution/codex/directories.js +67 -0
- package/dist/execution/codex/main.js +17 -0
- package/dist/execution/codex/read.js +35 -0
- package/dist/execution/codex/record.js +121 -0
- package/dist/execution/codex/role.js +2 -0
- package/dist/execution/codex/stream.js +2 -0
- package/dist/execution/codex/window-receipts.js +73 -0
- package/dist/execution/codex/wire.js +56 -0
- package/dist/execution/codex/worker.js +143 -0
- package/dist/execution/config.js +215 -0
- package/dist/execution/environment.js +61 -0
- package/dist/execution/gateway.js +212 -0
- package/dist/execution/lease-watchdog.js +172 -0
- package/dist/execution/local.js +159 -0
- package/dist/execution/main.js +71 -0
- package/dist/execution/native/config.js +45 -0
- package/dist/execution/native/input.js +7 -0
- package/dist/execution/native/main.js +9 -0
- package/dist/execution/native/records.js +168 -0
- package/dist/execution/native/worker.js +128 -0
- package/dist/execution/native-job-gate.js +63 -0
- package/dist/execution/process-types.js +1 -0
- package/dist/execution/process.js +246 -0
- package/dist/execution/results.js +111 -0
- package/dist/execution/role.js +210 -0
- package/dist/execution/runner.js +338 -0
- package/dist/execution/scope.js +415 -0
- package/dist/execution/scratch-files.js +352 -0
- package/dist/execution/scratch-paths.js +56 -0
- package/dist/execution/scratch.js +126 -0
- package/dist/execution/stdio.js +83 -0
- package/dist/execution/stream.js +159 -0
- package/dist/execution/watchdog.js +181 -0
- package/dist/execution/work.js +76 -0
- package/dist/execution/worker.js +106 -0
- package/dist/help.js +21 -0
- package/dist/lifecycle/http.js +178 -0
- package/dist/lifecycle/runtime.js +263 -0
- package/dist/lifecycle/status-command.js +78 -0
- package/dist/lifecycle/status.js +37 -0
- package/dist/lifecycle/wake-hints.js +68 -0
- package/dist/main.js +59 -0
- package/dist/ports/reports.js +1 -0
- package/dist/ports/runtime.js +1 -0
- package/dist/preparation/backend.js +44 -0
- package/dist/preparation/binding.js +47 -0
- package/dist/preparation/bootstrap.js +165 -0
- package/dist/preparation/config.js +143 -0
- package/dist/preparation/coordinator.js +251 -0
- package/dist/preparation/main.js +58 -0
- package/dist/preparation/runtime.js +122 -0
- package/dist/receptions/pump.js +109 -0
- package/dist/receptions/runtime-http.js +115 -0
- package/dist/recovery/activation.js +178 -0
- package/dist/recovery/admission.js +95 -0
- package/dist/recovery/automatic-preparation.js +194 -0
- package/dist/recovery/automatic-recovery.js +210 -0
- package/dist/recovery/confirmed-binding.js +45 -0
- package/dist/recovery/coordinator.js +351 -0
- package/dist/recovery/execution-policy.js +26 -0
- package/dist/recovery/preparation-policy.js +30 -0
- package/dist/recovery/prestart.js +62 -0
- package/dist/recovery/quarantine.js +153 -0
- package/dist/recovery/service-restart-view.js +32 -0
- package/dist/recovery/service-restart.js +368 -0
- package/dist/reports/pump.js +98 -0
- package/dist/resources/admission.js +25 -0
- package/dist/resources/guard.js +14 -0
- package/node_modules/@agent-stack/adapter-agentim/dist/account.js +42 -0
- package/node_modules/@agent-stack/adapter-agentim/dist/connection-file.js +32 -0
- package/node_modules/@agent-stack/adapter-agentim/dist/direct.js +114 -0
- package/node_modules/@agent-stack/adapter-agentim/dist/local.js +238 -0
- package/node_modules/@agent-stack/adapter-agentim/dist/operations-arguments.js +20 -0
- package/node_modules/@agent-stack/adapter-agentim/dist/operations-communication.js +56 -0
- package/node_modules/@agent-stack/adapter-agentim/dist/operations-operator.js +40 -0
- package/node_modules/@agent-stack/adapter-agentim/package.json +15 -0
- package/node_modules/@agent-stack/bot-host-journal/dist/automatic-activation.js +94 -0
- package/node_modules/@agent-stack/bot-host-journal/dist/automatic-preparation.js +90 -0
- package/node_modules/@agent-stack/bot-host-journal/dist/checkpoint-seal.js +89 -0
- package/node_modules/@agent-stack/bot-host-journal/dist/communication.js +238 -0
- package/node_modules/@agent-stack/bot-host-journal/dist/computer-scratch.js +56 -0
- package/node_modules/@agent-stack/bot-host-journal/dist/computer.js +183 -0
- package/node_modules/@agent-stack/bot-host-journal/dist/database.js +174 -0
- package/node_modules/@agent-stack/bot-host-journal/dist/index.js +4 -0
- package/node_modules/@agent-stack/bot-host-journal/dist/input.js +55 -0
- package/node_modules/@agent-stack/bot-host-journal/dist/journal.js +396 -0
- package/node_modules/@agent-stack/bot-host-journal/dist/models.js +35 -0
- package/node_modules/@agent-stack/bot-host-journal/dist/native-calls.js +123 -0
- package/node_modules/@agent-stack/bot-host-journal/dist/native-window.js +12 -0
- package/node_modules/@agent-stack/bot-host-journal/dist/observations.js +237 -0
- package/node_modules/@agent-stack/bot-host-journal/dist/preparation.js +117 -0
- package/node_modules/@agent-stack/bot-host-journal/dist/recovery-history.js +30 -0
- package/node_modules/@agent-stack/bot-host-journal/dist/recovery-record.js +32 -0
- package/node_modules/@agent-stack/bot-host-journal/dist/recovery.js +256 -0
- package/node_modules/@agent-stack/bot-host-journal/dist/reports.js +105 -0
- package/node_modules/@agent-stack/bot-host-journal/dist/runtime-events.js +246 -0
- package/node_modules/@agent-stack/bot-host-journal/dist/runtime-settings.js +95 -0
- package/node_modules/@agent-stack/bot-host-journal/dist/target-actions.js +355 -0
- package/node_modules/@agent-stack/bot-host-journal/dist/target-local.js +210 -0
- package/node_modules/@agent-stack/bot-host-journal/dist/target-scratch.js +207 -0
- package/node_modules/@agent-stack/bot-host-journal/dist/terminal-checkpoints.js +286 -0
- package/node_modules/@agent-stack/bot-host-journal/dist/terminal-store.js +136 -0
- package/node_modules/@agent-stack/bot-host-journal/dist/trace-inputs.js +104 -0
- package/node_modules/@agent-stack/bot-host-journal/dist/upgrade.js +25 -0
- package/node_modules/@agent-stack/bot-host-journal/dist/waits.js +213 -0
- package/node_modules/@agent-stack/bot-host-journal/package.json +10 -0
- package/node_modules/@agent-stack/bridge-client/dist/bot-transport.js +339 -0
- package/node_modules/@agent-stack/bridge-client/dist/client/agents.js +22 -0
- package/node_modules/@agent-stack/bridge-client/dist/client/bots/assistant.js +26 -0
- package/node_modules/@agent-stack/bridge-client/dist/client/bots/auth.js +9 -0
- package/node_modules/@agent-stack/bridge-client/dist/client/bots/client.js +160 -0
- package/node_modules/@agent-stack/bridge-client/dist/client/bots/inventory.js +55 -0
- package/node_modules/@agent-stack/bridge-client/dist/client/bots/native-events.js +52 -0
- package/node_modules/@agent-stack/bridge-client/dist/client/bots/owner-route.js +21 -0
- package/node_modules/@agent-stack/bridge-client/dist/client/bots/reports.js +41 -0
- package/node_modules/@agent-stack/bridge-client/dist/client/bots/runtime.js +190 -0
- package/node_modules/@agent-stack/bridge-client/dist/client/bridge-client.js +37 -0
- package/node_modules/@agent-stack/bridge-client/dist/client/core.js +123 -0
- package/node_modules/@agent-stack/bridge-client/dist/client/deployments.js +57 -0
- package/node_modules/@agent-stack/bridge-client/dist/client/integrations.js +45 -0
- package/node_modules/@agent-stack/bridge-client/dist/client/knowledge.js +33 -0
- package/node_modules/@agent-stack/bridge-client/dist/client/management.js +112 -0
- package/node_modules/@agent-stack/bridge-client/dist/client/platform-events.js +59 -0
- package/node_modules/@agent-stack/bridge-client/dist/client/platform.js +82 -0
- package/node_modules/@agent-stack/bridge-client/dist/client/public-runtime.js +94 -0
- package/node_modules/@agent-stack/bridge-client/dist/client/run-work-acknowledgement.js +54 -0
- package/node_modules/@agent-stack/bridge-client/dist/client/run-work-errors.js +34 -0
- package/node_modules/@agent-stack/bridge-client/dist/client/runtime.js +46 -0
- package/node_modules/@agent-stack/bridge-client/dist/client/tenant/authorization.js +7 -0
- package/node_modules/@agent-stack/bridge-client/dist/client/tenant/management.js +59 -0
- package/node_modules/@agent-stack/bridge-client/dist/client/workspace.js +109 -0
- package/node_modules/@agent-stack/bridge-client/dist/index.js +9 -0
- package/node_modules/@agent-stack/bridge-client/package.json +11 -0
- package/node_modules/@agent-stack/contracts/dist/api-credentials.js +103 -0
- package/node_modules/@agent-stack/contracts/dist/bots/assistant-path.js +24 -0
- package/node_modules/@agent-stack/contracts/dist/bots/assistant.js +2 -0
- package/node_modules/@agent-stack/contracts/dist/bots/capabilities.js +66 -0
- package/node_modules/@agent-stack/contracts/dist/bots/capability-migration.js +1 -0
- package/node_modules/@agent-stack/contracts/dist/bots/capability-version.js +48 -0
- package/node_modules/@agent-stack/contracts/dist/bots/codex-policy.js +22 -0
- package/node_modules/@agent-stack/contracts/dist/bots/command-evidence.js +101 -0
- package/node_modules/@agent-stack/contracts/dist/bots/command-inventory.js +74 -0
- package/node_modules/@agent-stack/contracts/dist/bots/command-receipt.js +78 -0
- package/node_modules/@agent-stack/contracts/dist/bots/communication-native.js +33 -0
- package/node_modules/@agent-stack/contracts/dist/bots/communication-stream.js +13 -0
- package/node_modules/@agent-stack/contracts/dist/bots/communication.js +154 -0
- package/node_modules/@agent-stack/contracts/dist/bots/component-status.js +38 -0
- package/node_modules/@agent-stack/contracts/dist/bots/components.js +10 -0
- package/node_modules/@agent-stack/contracts/dist/bots/computer-validation.js +320 -0
- package/node_modules/@agent-stack/contracts/dist/bots/computer.js +10 -0
- package/node_modules/@agent-stack/contracts/dist/bots/conversations.js +31 -0
- package/node_modules/@agent-stack/contracts/dist/bots/corrections.js +1 -0
- package/node_modules/@agent-stack/contracts/dist/bots/delegation-renewal.js +17 -0
- package/node_modules/@agent-stack/contracts/dist/bots/delegation.js +35 -0
- package/node_modules/@agent-stack/contracts/dist/bots/delivery-history.js +115 -0
- package/node_modules/@agent-stack/contracts/dist/bots/delivery-read.js +121 -0
- package/node_modules/@agent-stack/contracts/dist/bots/elicitation.js +83 -0
- package/node_modules/@agent-stack/contracts/dist/bots/entries.js +65 -0
- package/node_modules/@agent-stack/contracts/dist/bots/event-exchanges.js +1 -0
- package/node_modules/@agent-stack/contracts/dist/bots/goal-window.js +84 -0
- package/node_modules/@agent-stack/contracts/dist/bots/host-actions.js +191 -0
- package/node_modules/@agent-stack/contracts/dist/bots/identities.js +1 -0
- package/node_modules/@agent-stack/contracts/dist/bots/index.js +72 -0
- package/node_modules/@agent-stack/contracts/dist/bots/installation.js +9 -0
- package/node_modules/@agent-stack/contracts/dist/bots/interaction-validation.js +227 -0
- package/node_modules/@agent-stack/contracts/dist/bots/interactions.js +1 -0
- package/node_modules/@agent-stack/contracts/dist/bots/lifecycle.js +13 -0
- package/node_modules/@agent-stack/contracts/dist/bots/local-execution.js +72 -0
- package/node_modules/@agent-stack/contracts/dist/bots/mcp-capabilities.js +53 -0
- package/node_modules/@agent-stack/contracts/dist/bots/mission.js +3 -0
- package/node_modules/@agent-stack/contracts/dist/bots/model-routing.js +43 -0
- package/node_modules/@agent-stack/contracts/dist/bots/native-events-validation.js +229 -0
- package/node_modules/@agent-stack/contracts/dist/bots/native-events.js +4 -0
- package/node_modules/@agent-stack/contracts/dist/bots/native-fact.js +32 -0
- package/node_modules/@agent-stack/contracts/dist/bots/native-host.js +10 -0
- package/node_modules/@agent-stack/contracts/dist/bots/observation.js +42 -0
- package/node_modules/@agent-stack/contracts/dist/bots/owner-progress.js +85 -0
- package/node_modules/@agent-stack/contracts/dist/bots/owner-transition.js +169 -0
- package/node_modules/@agent-stack/contracts/dist/bots/parking.js +75 -0
- package/node_modules/@agent-stack/contracts/dist/bots/preferences.js +39 -0
- package/node_modules/@agent-stack/contracts/dist/bots/preparations.js +2 -0
- package/node_modules/@agent-stack/contracts/dist/bots/project-oauth.js +1 -0
- package/node_modules/@agent-stack/contracts/dist/bots/quarantine-installation.js +117 -0
- package/node_modules/@agent-stack/contracts/dist/bots/quarantine.js +186 -0
- package/node_modules/@agent-stack/contracts/dist/bots/read-recovery.js +10 -0
- package/node_modules/@agent-stack/contracts/dist/bots/receptions.js +7 -0
- package/node_modules/@agent-stack/contracts/dist/bots/recovery-admission.js +163 -0
- package/node_modules/@agent-stack/contracts/dist/bots/recovery-errors.js +51 -0
- package/node_modules/@agent-stack/contracts/dist/bots/recovery-history.js +90 -0
- package/node_modules/@agent-stack/contracts/dist/bots/recovery-source.js +164 -0
- package/node_modules/@agent-stack/contracts/dist/bots/recovery-validation.js +160 -0
- package/node_modules/@agent-stack/contracts/dist/bots/recovery.js +13 -0
- package/node_modules/@agent-stack/contracts/dist/bots/relay.js +21 -0
- package/node_modules/@agent-stack/contracts/dist/bots/report-status.js +99 -0
- package/node_modules/@agent-stack/contracts/dist/bots/reports.js +8 -0
- package/node_modules/@agent-stack/contracts/dist/bots/restart-source.js +151 -0
- package/node_modules/@agent-stack/contracts/dist/bots/runtime-command.js +59 -0
- package/node_modules/@agent-stack/contracts/dist/bots/runtime-input.js +80 -0
- package/node_modules/@agent-stack/contracts/dist/bots/runtime-provider.js +12 -0
- package/node_modules/@agent-stack/contracts/dist/bots/runtime-settings.js +63 -0
- package/node_modules/@agent-stack/contracts/dist/bots/runtime-validation.js +35 -0
- package/node_modules/@agent-stack/contracts/dist/bots/runtime.js +1 -0
- package/node_modules/@agent-stack/contracts/dist/bots/same-native.js +44 -0
- package/node_modules/@agent-stack/contracts/dist/bots/service-restart.js +80 -0
- package/node_modules/@agent-stack/contracts/dist/bots/status.js +1 -0
- package/node_modules/@agent-stack/contracts/dist/bots/sync.js +1 -0
- package/node_modules/@agent-stack/contracts/dist/bots/targets.js +95 -0
- package/node_modules/@agent-stack/contracts/dist/bots/validation.js +82 -0
- package/node_modules/@agent-stack/contracts/dist/bots/versions.js +6 -0
- package/node_modules/@agent-stack/contracts/dist/bots/wake-hints.js +20 -0
- package/node_modules/@agent-stack/contracts/dist/bots/work-brief.js +120 -0
- package/node_modules/@agent-stack/contracts/dist/bots/work-control.js +47 -0
- package/node_modules/@agent-stack/contracts/dist/bots/work-events.js +38 -0
- package/node_modules/@agent-stack/contracts/dist/browser-chat-attachment.js +66 -0
- package/node_modules/@agent-stack/contracts/dist/business-outcomes.js +1 -0
- package/node_modules/@agent-stack/contracts/dist/chat-attachment.js +70 -0
- package/node_modules/@agent-stack/contracts/dist/chat-stream.js +105 -0
- package/node_modules/@agent-stack/contracts/dist/contracts/agent-ui.js +1 -0
- package/node_modules/@agent-stack/contracts/dist/contracts/base.js +6 -0
- package/node_modules/@agent-stack/contracts/dist/contracts/deployments.js +6 -0
- package/node_modules/@agent-stack/contracts/dist/contracts/index.js +8 -0
- package/node_modules/@agent-stack/contracts/dist/contracts/integrations.js +13 -0
- package/node_modules/@agent-stack/contracts/dist/contracts/knowledge.js +69 -0
- package/node_modules/@agent-stack/contracts/dist/contracts/live.js +56 -0
- package/node_modules/@agent-stack/contracts/dist/contracts/runtime.js +1 -0
- package/node_modules/@agent-stack/contracts/dist/contracts/workspace.js +9 -0
- package/node_modules/@agent-stack/contracts/dist/delivery-targets.js +139 -0
- package/node_modules/@agent-stack/contracts/dist/desktop-mcp.js +105 -0
- package/node_modules/@agent-stack/contracts/dist/employee-association.js +31 -0
- package/node_modules/@agent-stack/contracts/dist/event-links.js +1 -0
- package/node_modules/@agent-stack/contracts/dist/execution-oauth-callback.js +61 -0
- package/node_modules/@agent-stack/contracts/dist/host-page-context.js +156 -0
- package/node_modules/@agent-stack/contracts/dist/index.js +115 -0
- package/node_modules/@agent-stack/contracts/dist/installation-lifecycle.js +1 -0
- package/node_modules/@agent-stack/contracts/dist/installation-mcp.js +5 -0
- package/node_modules/@agent-stack/contracts/dist/installations.js +7 -0
- package/node_modules/@agent-stack/contracts/dist/integration-context.js +22 -0
- package/node_modules/@agent-stack/contracts/dist/integration-oauth.js +23 -0
- package/node_modules/@agent-stack/contracts/dist/integration-runtime.js +107 -0
- package/node_modules/@agent-stack/contracts/dist/interactive-run-wake.js +78 -0
- package/node_modules/@agent-stack/contracts/dist/interactive-work-acknowledgement.js +74 -0
- package/node_modules/@agent-stack/contracts/dist/interactive-work-events.js +131 -0
- package/node_modules/@agent-stack/contracts/dist/interactive-work-sources.js +142 -0
- package/node_modules/@agent-stack/contracts/dist/knowledge-attachment.js +50 -0
- package/node_modules/@agent-stack/contracts/dist/knowledge-catalog.js +94 -0
- package/node_modules/@agent-stack/contracts/dist/knowledge-organization.js +87 -0
- package/node_modules/@agent-stack/contracts/dist/live-audio.js +46 -0
- package/node_modules/@agent-stack/contracts/dist/live-business.js +1 -0
- package/node_modules/@agent-stack/contracts/dist/live-human.js +1 -0
- package/node_modules/@agent-stack/contracts/dist/live-transport.js +2 -0
- package/node_modules/@agent-stack/contracts/dist/mcp-directory.js +7 -0
- package/node_modules/@agent-stack/contracts/dist/mcp-refresh.js +1 -0
- package/node_modules/@agent-stack/contracts/dist/mcp-scopes.js +24 -0
- package/node_modules/@agent-stack/contracts/dist/native-studio-installation.js +1 -0
- package/node_modules/@agent-stack/contracts/dist/oauth-authorization.js +19 -0
- package/node_modules/@agent-stack/contracts/dist/platform-events.js +182 -0
- package/node_modules/@agent-stack/contracts/dist/reply-presentation.js +59 -0
- package/node_modules/@agent-stack/contracts/dist/reply.js +129 -0
- package/node_modules/@agent-stack/contracts/dist/request-body.js +38 -0
- package/node_modules/@agent-stack/contracts/dist/schedules.js +1 -0
- package/node_modules/@agent-stack/contracts/dist/task-work-events.js +107 -0
- package/node_modules/@agent-stack/contracts/dist/tasks.js +200 -0
- package/node_modules/@agent-stack/contracts/dist/templates.js +1 -0
- package/node_modules/@agent-stack/contracts/dist/tenant/access-schemas.js +149 -0
- package/node_modules/@agent-stack/contracts/dist/tenant/access-views.js +17 -0
- package/node_modules/@agent-stack/contracts/dist/tenant/access.js +132 -0
- package/node_modules/@agent-stack/contracts/dist/tenant/actions.js +173 -0
- package/node_modules/@agent-stack/contracts/dist/tenant/attachments.js +68 -0
- package/node_modules/@agent-stack/contracts/dist/tenant/authorization.js +160 -0
- package/node_modules/@agent-stack/contracts/dist/tenant/capabilities.js +98 -0
- package/node_modules/@agent-stack/contracts/dist/tenant/connections.js +31 -0
- package/node_modules/@agent-stack/contracts/dist/tenant/conversation-work-events.js +72 -0
- package/node_modules/@agent-stack/contracts/dist/tenant/conversation-work-schemas.js +136 -0
- package/node_modules/@agent-stack/contracts/dist/tenant/conversations.js +31 -0
- package/node_modules/@agent-stack/contracts/dist/tenant/deliveries.js +120 -0
- package/node_modules/@agent-stack/contracts/dist/tenant/delivery-views.js +38 -0
- package/node_modules/@agent-stack/contracts/dist/tenant/deployment-catalog.js +50 -0
- package/node_modules/@agent-stack/contracts/dist/tenant/descriptor.js +50 -0
- package/node_modules/@agent-stack/contracts/dist/tenant/events.js +39 -0
- package/node_modules/@agent-stack/contracts/dist/tenant/feedback.js +161 -0
- package/node_modules/@agent-stack/contracts/dist/tenant/guidance.js +284 -0
- package/node_modules/@agent-stack/contracts/dist/tenant/host-enrollment.js +51 -0
- package/node_modules/@agent-stack/contracts/dist/tenant/identity.js +31 -0
- package/node_modules/@agent-stack/contracts/dist/tenant/installation-schemas.js +350 -0
- package/node_modules/@agent-stack/contracts/dist/tenant/installation-views.js +69 -0
- package/node_modules/@agent-stack/contracts/dist/tenant/installations.js +217 -0
- package/node_modules/@agent-stack/contracts/dist/tenant/integration-configuration.js +96 -0
- package/node_modules/@agent-stack/contracts/dist/tenant/integration-oauth.js +85 -0
- package/node_modules/@agent-stack/contracts/dist/tenant/integrations.js +75 -0
- package/node_modules/@agent-stack/contracts/dist/tenant/json.js +96 -0
- package/node_modules/@agent-stack/contracts/dist/tenant/knowledge-management-input.js +211 -0
- package/node_modules/@agent-stack/contracts/dist/tenant/knowledge-management-results.js +145 -0
- package/node_modules/@agent-stack/contracts/dist/tenant/knowledge-management-schemas.js +139 -0
- package/node_modules/@agent-stack/contracts/dist/tenant/knowledge-management.js +32 -0
- package/node_modules/@agent-stack/contracts/dist/tenant/knowledge-organization.js +96 -0
- package/node_modules/@agent-stack/contracts/dist/tenant/knowledge-program-input.js +111 -0
- package/node_modules/@agent-stack/contracts/dist/tenant/knowledge-program-results.js +234 -0
- package/node_modules/@agent-stack/contracts/dist/tenant/knowledge-programs.js +15 -0
- package/node_modules/@agent-stack/contracts/dist/tenant/live.js +63 -0
- package/node_modules/@agent-stack/contracts/dist/tenant/marketplace-schemas.js +110 -0
- package/node_modules/@agent-stack/contracts/dist/tenant/marketplaces.js +51 -0
- package/node_modules/@agent-stack/contracts/dist/tenant/mcp-directory.js +98 -0
- package/node_modules/@agent-stack/contracts/dist/tenant/native-operations.js +113 -0
- package/node_modules/@agent-stack/contracts/dist/tenant/operations.js +36 -0
- package/node_modules/@agent-stack/contracts/dist/tenant/outcome-schemas.js +121 -0
- package/node_modules/@agent-stack/contracts/dist/tenant/outcomes.js +87 -0
- package/node_modules/@agent-stack/contracts/dist/tenant/queries.js +24 -0
- package/node_modules/@agent-stack/contracts/dist/tenant/resource-views.js +463 -0
- package/node_modules/@agent-stack/contracts/dist/tenant/resources.js +1 -0
- package/node_modules/@agent-stack/contracts/dist/tenant/schedule-schemas.js +122 -0
- package/node_modules/@agent-stack/contracts/dist/tenant/schedule-views.js +22 -0
- package/node_modules/@agent-stack/contracts/dist/tenant/schedules.js +109 -0
- package/node_modules/@agent-stack/contracts/dist/tenant/schemas.js +117 -0
- package/node_modules/@agent-stack/contracts/dist/tenant/settings.js +34 -0
- package/node_modules/@agent-stack/contracts/dist/tenant/sse.js +58 -0
- package/node_modules/@agent-stack/contracts/dist/tenant/task-schemas.js +89 -0
- package/node_modules/@agent-stack/contracts/dist/tenant/task-views.js +34 -0
- package/node_modules/@agent-stack/contracts/dist/tenant/tasks.js +41 -0
- package/node_modules/@agent-stack/contracts/dist/tenant/tests.js +1 -0
- package/node_modules/@agent-stack/contracts/dist/tenant/transport.js +2 -0
- package/node_modules/@agent-stack/contracts/dist/tenant/usage.js +61 -0
- package/node_modules/@agent-stack/contracts/dist/tenant/views.js +52 -0
- package/node_modules/@agent-stack/contracts/dist/tenant/widgets.js +215 -0
- package/node_modules/@agent-stack/contracts/dist/tenant/work-changes.js +71 -0
- package/node_modules/@agent-stack/contracts/dist/tenant/work-materials.js +102 -0
- package/node_modules/@agent-stack/contracts/dist/tenant/workspace-resources.js +87 -0
- package/node_modules/@agent-stack/contracts/dist/widget-authorization.js +55 -0
- package/node_modules/@agent-stack/contracts/dist/widget-avatar.js +24 -0
- package/node_modules/@agent-stack/contracts/dist/widget-context.js +57 -0
- package/node_modules/@agent-stack/contracts/dist/widget-conversation.js +13 -0
- package/node_modules/@agent-stack/contracts/dist/widget-host-auth.js +142 -0
- package/node_modules/@agent-stack/contracts/dist/widget-origin.js +16 -0
- package/node_modules/@agent-stack/contracts/dist/widget-turn.js +84 -0
- package/node_modules/@agent-stack/contracts/package.json +8 -0
- package/node_modules/@agent-stack/runtime-contracts/dist/authority.js +64 -0
- package/node_modules/@agent-stack/runtime-contracts/dist/bot/bootstrap.js +81 -0
- package/node_modules/@agent-stack/runtime-contracts/dist/bot/codex-record.js +37 -0
- package/node_modules/@agent-stack/runtime-contracts/dist/bot/codex-target.js +56 -0
- package/node_modules/@agent-stack/runtime-contracts/dist/bot/conversation.js +1 -0
- package/node_modules/@agent-stack/runtime-contracts/dist/bot/index.js +7 -0
- package/node_modules/@agent-stack/runtime-contracts/dist/bot/process-identity.js +18 -0
- package/node_modules/@agent-stack/runtime-contracts/dist/bot/quarantine-material.js +9 -0
- package/node_modules/@agent-stack/runtime-contracts/dist/bot/recovery-inspection.js +103 -0
- package/node_modules/@agent-stack/runtime-contracts/dist/bot/service.js +3 -0
- package/node_modules/@agent-stack/runtime-contracts/dist/execution/index.js +7 -0
- package/node_modules/@agent-stack/runtime-contracts/dist/execution/json.js +169 -0
- package/node_modules/@agent-stack/runtime-contracts/dist/execution/observation.js +40 -0
- package/node_modules/@agent-stack/runtime-contracts/dist/execution/runtime.js +1 -0
- package/node_modules/@agent-stack/runtime-contracts/dist/execution/trace.js +1 -0
- package/node_modules/@agent-stack/runtime-contracts/dist/execution/types.js +32 -0
- package/node_modules/@agent-stack/runtime-contracts/dist/execution/wire.js +167 -0
- package/node_modules/@agent-stack/runtime-contracts/dist/execution/wire.schema.json +1 -0
- package/node_modules/@agent-stack/runtime-contracts/dist/index.js +31 -0
- package/node_modules/@agent-stack/runtime-contracts/dist/interactive-run-wake.js +190 -0
- package/node_modules/@agent-stack/runtime-contracts/dist/legacy.js +1 -0
- package/node_modules/@agent-stack/runtime-contracts/dist/mcp.js +53 -0
- package/node_modules/@agent-stack/runtime-contracts/dist/native-studio-connection.js +46 -0
- package/node_modules/@agent-stack/runtime-contracts/dist/native-studio-execution.js +100 -0
- package/node_modules/@agent-stack/runtime-contracts/dist/native-studio-registration.js +193 -0
- package/node_modules/@agent-stack/runtime-contracts/dist/oauth-context.js +38 -0
- package/node_modules/@agent-stack/runtime-contracts/dist/personal-mcp.js +1 -0
- package/node_modules/@agent-stack/runtime-contracts/dist/signing.js +1 -0
- package/node_modules/@agent-stack/runtime-contracts/dist/source-reply.js +153 -0
- package/node_modules/@agent-stack/runtime-contracts/dist/storage.js +1 -0
- package/node_modules/@agent-stack/runtime-contracts/dist/target-environment.js +45 -0
- package/node_modules/@agent-stack/runtime-contracts/dist/tenant-management.js +57 -0
- package/node_modules/@agent-stack/runtime-contracts/dist/tool-trace.js +1 -0
- package/node_modules/@agent-stack/runtime-contracts/package.json +13 -0
- package/node_modules/@agentims/adapter/dist/authority/binding.js +40 -0
- package/node_modules/@agentims/adapter/dist/delivery/coordinator.js +202 -0
- package/node_modules/@agentims/adapter/dist/delivery/decision.js +51 -0
- package/node_modules/@agentims/adapter/dist/delivery/record.js +24 -0
- package/node_modules/@agentims/adapter/dist/delivery/types.js +1 -0
- package/node_modules/@agentims/adapter/dist/errors.js +40 -0
- package/node_modules/@agentims/adapter/dist/index.js +5 -0
- package/node_modules/@agentims/adapter/dist/lifecycle/budget.js +30 -0
- package/node_modules/@agentims/adapter/dist/receipts/send.js +24 -0
- package/node_modules/@agentims/adapter/dist/source/event-source.js +153 -0
- package/node_modules/@agentims/adapter/dist/source/types.js +1 -0
- package/node_modules/@agentims/adapter/dist/status/adapter-status.js +46 -0
- package/node_modules/@agentims/adapter/package.json +10 -0
- package/node_modules/@agentims/runtime/dist/accounts/backup.js +39 -0
- package/node_modules/@agentims/runtime/dist/accounts/communication.js +14 -0
- package/node_modules/@agentims/runtime/dist/accounts/context.js +36 -0
- package/node_modules/@agentims/runtime/dist/accounts/credential-lifecycle.js +57 -0
- package/node_modules/@agentims/runtime/dist/accounts/errors.js +13 -0
- package/node_modules/@agentims/runtime/dist/accounts/login.js +32 -0
- package/node_modules/@agentims/runtime/dist/accounts/password.js +18 -0
- package/node_modules/@agentims/runtime/dist/accounts/register.js +30 -0
- package/node_modules/@agentims/runtime/dist/accounts/selection.js +93 -0
- package/node_modules/@agentims/runtime/dist/accounts/types.js +1 -0
- package/node_modules/@agentims/runtime/dist/authentication/intent.js +15 -0
- package/node_modules/@agentims/runtime/dist/authentication/journals.js +39 -0
- package/node_modules/@agentims/runtime/dist/authentication/methods.js +42 -0
- package/node_modules/@agentims/runtime/dist/authentication/selection.js +20 -0
- package/node_modules/@agentims/runtime/dist/authentication/status.js +42 -0
- package/node_modules/@agentims/runtime/dist/cli/account-commands.js +72 -0
- package/node_modules/@agentims/runtime/dist/cli/arguments.js +120 -0
- package/node_modules/@agentims/runtime/dist/cli/authentication.js +22 -0
- package/node_modules/@agentims/runtime/dist/cli/command-names.js +9 -0
- package/node_modules/@agentims/runtime/dist/cli/commands/account-authorization.js +12 -0
- package/node_modules/@agentims/runtime/dist/cli/commands/cache-inspection.js +8 -0
- package/node_modules/@agentims/runtime/dist/cli/commands/cache.js +14 -0
- package/node_modules/@agentims/runtime/dist/cli/commands/catalog.js +40 -0
- package/node_modules/@agentims/runtime/dist/cli/commands/contacts.js +5 -0
- package/node_modules/@agentims/runtime/dist/cli/commands/conversations.js +15 -0
- package/node_modules/@agentims/runtime/dist/cli/commands/definition.js +9 -0
- package/node_modules/@agentims/runtime/dist/cli/commands/deliveries-native.js +6 -0
- package/node_modules/@agentims/runtime/dist/cli/commands/deliveries.js +10 -0
- package/node_modules/@agentims/runtime/dist/cli/commands/devices-native.js +7 -0
- package/node_modules/@agentims/runtime/dist/cli/commands/discovery.js +4 -0
- package/node_modules/@agentims/runtime/dist/cli/commands/drafts.js +6 -0
- package/node_modules/@agentims/runtime/dist/cli/commands/encryption-dehydration.js +13 -0
- package/node_modules/@agentims/runtime/dist/cli/commands/encryption-native.js +9 -0
- package/node_modules/@agentims/runtime/dist/cli/commands/encryption-recovery.js +11 -0
- package/node_modules/@agentims/runtime/dist/cli/commands/encryption-reset.js +9 -0
- package/node_modules/@agentims/runtime/dist/cli/commands/encryption-secrets.js +9 -0
- package/node_modules/@agentims/runtime/dist/cli/commands/encryption.js +12 -0
- package/node_modules/@agentims/runtime/dist/cli/commands/identity.js +10 -0
- package/node_modules/@agentims/runtime/dist/cli/commands/location.js +7 -0
- package/node_modules/@agentims/runtime/dist/cli/commands/matrix-capabilities.js +38 -0
- package/node_modules/@agentims/runtime/dist/cli/commands/matrix-identity.js +12 -0
- package/node_modules/@agentims/runtime/dist/cli/commands/matrix-rooms.js +23 -0
- package/node_modules/@agentims/runtime/dist/cli/commands/media.js +12 -0
- package/node_modules/@agentims/runtime/dist/cli/commands/messages-native.js +8 -0
- package/node_modules/@agentims/runtime/dist/cli/commands/messages.js +10 -0
- package/node_modules/@agentims/runtime/dist/cli/commands/native-inspection.js +24 -0
- package/node_modules/@agentims/runtime/dist/cli/commands/native-preferences.js +11 -0
- package/node_modules/@agentims/runtime/dist/cli/commands/native-requests.js +6 -0
- package/node_modules/@agentims/runtime/dist/cli/commands/oauth.js +15 -0
- package/node_modules/@agentims/runtime/dist/cli/commands/outbox.js +10 -0
- package/node_modules/@agentims/runtime/dist/cli/commands/pairing.js +8 -0
- package/node_modules/@agentims/runtime/dist/cli/commands/profiles.js +6 -0
- package/node_modules/@agentims/runtime/dist/cli/commands/qr-authorization.js +6 -0
- package/node_modules/@agentims/runtime/dist/cli/commands/reliability.js +8 -0
- package/node_modules/@agentims/runtime/dist/cli/commands/room-management.js +17 -0
- package/node_modules/@agentims/runtime/dist/cli/commands/rtc.js +14 -0
- package/node_modules/@agentims/runtime/dist/cli/commands/search.js +11 -0
- package/node_modules/@agentims/runtime/dist/cli/commands/sync-qr.js +9 -0
- package/node_modules/@agentims/runtime/dist/cli/commands/timeline-native.js +10 -0
- package/node_modules/@agentims/runtime/dist/cli/commands/verification-native.js +7 -0
- package/node_modules/@agentims/runtime/dist/cli/errors.js +83 -0
- package/node_modules/@agentims/runtime/dist/cli/help.js +74 -0
- package/node_modules/@agentims/runtime/dist/cli/history-commands.js +13 -0
- package/node_modules/@agentims/runtime/dist/cli/input.js +82 -0
- package/node_modules/@agentims/runtime/dist/cli/main.js +19 -0
- package/node_modules/@agentims/runtime/dist/cli/output.js +71 -0
- package/node_modules/@agentims/runtime/dist/cli/password-input.js +36 -0
- package/node_modules/@agentims/runtime/dist/cli/run.js +90 -0
- package/node_modules/@agentims/runtime/dist/cli/update-commands.js +76 -0
- package/node_modules/@agentims/runtime/dist/configuration/account-credential.js +30 -0
- package/node_modules/@agentims/runtime/dist/configuration/connection-descriptor.js +18 -0
- package/node_modules/@agentims/runtime/dist/configuration/device-binding.js +41 -0
- package/node_modules/@agentims/runtime/dist/configuration/environment.js +43 -0
- package/node_modules/@agentims/runtime/dist/configuration/executable.js +49 -0
- package/node_modules/@agentims/runtime/dist/configuration/http.js +4 -0
- package/node_modules/@agentims/runtime/dist/configuration/native-settings.js +13 -0
- package/node_modules/@agentims/runtime/dist/configuration/node-version.js +8 -0
- package/node_modules/@agentims/runtime/dist/configuration/private-state.js +115 -0
- package/node_modules/@agentims/runtime/dist/configuration/service-origin.js +48 -0
- package/node_modules/@agentims/runtime/dist/configuration/windows-command.js +14 -0
- package/node_modules/@agentims/runtime/dist/configuration/windows-security.js +13 -0
- package/node_modules/@agentims/runtime/dist/history/backup.js +45 -0
- package/node_modules/@agentims/runtime/dist/history/online.js +48 -0
- package/node_modules/@agentims/runtime/dist/history/recovery-file.js +19 -0
- package/node_modules/@agentims/runtime/dist/history/restore.js +19 -0
- package/node_modules/@agentims/runtime/dist/index.js +31 -0
- package/node_modules/@agentims/runtime/dist/lifecycle/communication.js +66 -0
- package/node_modules/@agentims/runtime/dist/lifecycle/embedded.js +24 -0
- package/node_modules/@agentims/runtime/dist/lifecycle/foreground-connection.js +61 -0
- package/node_modules/@agentims/runtime/dist/lifecycle/foreground.js +47 -0
- package/node_modules/@agentims/runtime/dist/lifecycle/identity.js +46 -0
- package/node_modules/@agentims/runtime/dist/lifecycle/process-priority.js +22 -0
- package/node_modules/@agentims/runtime/dist/lifecycle/process.js +60 -0
- package/node_modules/@agentims/runtime/dist/lifecycle/shutdown-lease.js +90 -0
- package/node_modules/@agentims/runtime/dist/lifecycle/start.js +69 -0
- package/node_modules/@agentims/runtime/dist/managed/connection.js +29 -0
- package/node_modules/@agentims/runtime/dist/managed/control.js +134 -0
- package/node_modules/@agentims/runtime/dist/managed/directory.js +19 -0
- package/node_modules/@agentims/runtime/dist/managed/errors.js +9 -0
- package/node_modules/@agentims/runtime/dist/managed/lease.js +32 -0
- package/node_modules/@agentims/runtime/dist/managed/shutdown.js +63 -0
- package/node_modules/@agentims/runtime/dist/managed/state.js +82 -0
- package/node_modules/@agentims/runtime/dist/storage/archive.js +89 -0
- package/node_modules/@agentims/runtime/dist/supervision/command.js +13 -0
- package/node_modules/@agentims/runtime/dist/supervision/launchd.js +64 -0
- package/node_modules/@agentims/runtime/dist/supervision/select.js +13 -0
- package/node_modules/@agentims/runtime/dist/supervision/service.js +4 -0
- package/node_modules/@agentims/runtime/dist/supervision/systemd.js +34 -0
- package/node_modules/@agentims/runtime/dist/supervision/windows.js +20 -0
- package/node_modules/@agentims/runtime/dist/updates/activation.js +65 -0
- package/node_modules/@agentims/runtime/dist/updates/admission.js +15 -0
- package/node_modules/@agentims/runtime/dist/updates/archive.js +45 -0
- package/node_modules/@agentims/runtime/dist/updates/binding-preflight.js +25 -0
- package/node_modules/@agentims/runtime/dist/updates/continuity.js +45 -0
- package/node_modules/@agentims/runtime/dist/updates/device-archive.js +43 -0
- package/node_modules/@agentims/runtime/dist/updates/discovery.js +91 -0
- package/node_modules/@agentims/runtime/dist/updates/download.js +66 -0
- package/node_modules/@agentims/runtime/dist/updates/embedded.js +143 -0
- package/node_modules/@agentims/runtime/dist/updates/host-continuation.js +43 -0
- package/node_modules/@agentims/runtime/dist/updates/inspection-config.js +18 -0
- package/node_modules/@agentims/runtime/dist/updates/installation-integrity.js +35 -0
- package/node_modules/@agentims/runtime/dist/updates/installation.js +134 -0
- package/node_modules/@agentims/runtime/dist/updates/ledger.js +75 -0
- package/node_modules/@agentims/runtime/dist/updates/locking.js +17 -0
- package/node_modules/@agentims/runtime/dist/updates/managed.js +271 -0
- package/node_modules/@agentims/runtime/dist/updates/manifest.js +97 -0
- package/node_modules/@agentims/runtime/dist/updates/offline.js +56 -0
- package/node_modules/@agentims/runtime/dist/updates/owner.js +14 -0
- package/node_modules/@agentims/runtime/dist/updates/pending.js +20 -0
- package/node_modules/@agentims/runtime/dist/updates/policy.js +73 -0
- package/node_modules/@agentims/runtime/dist/updates/records.js +33 -0
- package/node_modules/@agentims/runtime/dist/updates/restart.js +80 -0
- package/node_modules/@agentims/runtime/dist/updates/shutdown-owner.js +74 -0
- package/node_modules/@agentims/runtime/dist/updates/shutdown-proof.js +35 -0
- package/node_modules/@agentims/runtime/dist/updates/types.js +16 -0
- package/node_modules/@agentims/runtime/dist/updates/version.js +40 -0
- package/node_modules/@agentims/runtime/dist/updates/watch.js +87 -0
- package/node_modules/@agentims/runtime/package.json +11 -0
- package/node_modules/@agentims/sdk/dist/api/client.js +15 -0
- package/node_modules/@agentims/sdk/dist/api/embedded-options.js +1 -0
- package/node_modules/@agentims/sdk/dist/api/embedded.js +28 -0
- package/node_modules/@agentims/sdk/dist/api/errors.js +43 -0
- package/node_modules/@agentims/sdk/dist/api/facade.js +92 -0
- package/node_modules/@agentims/sdk/dist/api/json-value.js +1 -0
- package/node_modules/@agentims/sdk/dist/api/options.js +1 -0
- package/node_modules/@agentims/sdk/dist/api/request-data.js +43 -0
- package/node_modules/@agentims/sdk/dist/api/sdk-info.js +9 -0
- package/node_modules/@agentims/sdk/dist/features/account/client.js +57 -0
- package/node_modules/@agentims/sdk/dist/features/account/index.js +1 -0
- package/node_modules/@agentims/sdk/dist/features/account/types.js +1 -0
- package/node_modules/@agentims/sdk/dist/features/cache/client.js +40 -0
- package/node_modules/@agentims/sdk/dist/features/cache/index.js +1 -0
- package/node_modules/@agentims/sdk/dist/features/cache/types.js +1 -0
- package/node_modules/@agentims/sdk/dist/features/configuration/index.js +1 -0
- package/node_modules/@agentims/sdk/dist/features/configuration/schema.js +8 -0
- package/node_modules/@agentims/sdk/dist/features/configuration/types.js +3 -0
- package/node_modules/@agentims/sdk/dist/features/contacts/client.js +12 -0
- package/node_modules/@agentims/sdk/dist/features/contacts/index.js +1 -0
- package/node_modules/@agentims/sdk/dist/features/contacts/types.js +3 -0
- package/node_modules/@agentims/sdk/dist/features/conversations/client.js +54 -0
- package/node_modules/@agentims/sdk/dist/features/conversations/index.js +1 -0
- package/node_modules/@agentims/sdk/dist/features/conversations/matrix.js +61 -0
- package/node_modules/@agentims/sdk/dist/features/conversations/types.js +1 -0
- package/node_modules/@agentims/sdk/dist/features/deliveries/client.js +41 -0
- package/node_modules/@agentims/sdk/dist/features/deliveries/index.js +1 -0
- package/node_modules/@agentims/sdk/dist/features/deliveries/types.js +1 -0
- package/node_modules/@agentims/sdk/dist/features/devices/client.js +36 -0
- package/node_modules/@agentims/sdk/dist/features/devices/index.js +1 -0
- package/node_modules/@agentims/sdk/dist/features/devices/types.js +1 -0
- package/node_modules/@agentims/sdk/dist/features/directory/client.js +36 -0
- package/node_modules/@agentims/sdk/dist/features/directory/index.js +1 -0
- package/node_modules/@agentims/sdk/dist/features/directory/types.js +3 -0
- package/node_modules/@agentims/sdk/dist/features/discovery/client.js +9 -0
- package/node_modules/@agentims/sdk/dist/features/discovery/index.js +1 -0
- package/node_modules/@agentims/sdk/dist/features/discovery/types.js +3 -0
- package/node_modules/@agentims/sdk/dist/features/drafts/client.js +16 -0
- package/node_modules/@agentims/sdk/dist/features/drafts/index.js +1 -0
- package/node_modules/@agentims/sdk/dist/features/drafts/types.js +3 -0
- package/node_modules/@agentims/sdk/dist/features/encryption/client.js +105 -0
- package/node_modules/@agentims/sdk/dist/features/encryption/dehydration.js +36 -0
- package/node_modules/@agentims/sdk/dist/features/encryption/index.js +1 -0
- package/node_modules/@agentims/sdk/dist/features/encryption/types.js +1 -0
- package/node_modules/@agentims/sdk/dist/features/events/client.js +45 -0
- package/node_modules/@agentims/sdk/dist/features/events/index.js +1 -0
- package/node_modules/@agentims/sdk/dist/features/events/types.js +1 -0
- package/node_modules/@agentims/sdk/dist/features/identity/client.js +77 -0
- package/node_modules/@agentims/sdk/dist/features/identity/index.js +1 -0
- package/node_modules/@agentims/sdk/dist/features/identity/types.js +1 -0
- package/node_modules/@agentims/sdk/dist/features/location/client.js +18 -0
- package/node_modules/@agentims/sdk/dist/features/location/index.js +1 -0
- package/node_modules/@agentims/sdk/dist/features/location/types.js +3 -0
- package/node_modules/@agentims/sdk/dist/features/media/client.js +34 -0
- package/node_modules/@agentims/sdk/dist/features/media/index.js +1 -0
- package/node_modules/@agentims/sdk/dist/features/media/types.js +1 -0
- package/node_modules/@agentims/sdk/dist/features/messages/client.js +43 -0
- package/node_modules/@agentims/sdk/dist/features/messages/index.js +1 -0
- package/node_modules/@agentims/sdk/dist/features/messages/types.js +3 -0
- package/node_modules/@agentims/sdk/dist/features/notifications/client.js +42 -0
- package/node_modules/@agentims/sdk/dist/features/notifications/index.js +1 -0
- package/node_modules/@agentims/sdk/dist/features/notifications/types.js +1 -0
- package/node_modules/@agentims/sdk/dist/features/oauth/client.js +52 -0
- package/node_modules/@agentims/sdk/dist/features/oauth/index.js +1 -0
- package/node_modules/@agentims/sdk/dist/features/oauth/types.js +1 -0
- package/node_modules/@agentims/sdk/dist/features/operations/client.js +16 -0
- package/node_modules/@agentims/sdk/dist/features/operations/index.js +1 -0
- package/node_modules/@agentims/sdk/dist/features/operations/types.js +1 -0
- package/node_modules/@agentims/sdk/dist/features/outbox/client.js +25 -0
- package/node_modules/@agentims/sdk/dist/features/outbox/index.js +1 -0
- package/node_modules/@agentims/sdk/dist/features/outbox/types.js +3 -0
- package/node_modules/@agentims/sdk/dist/features/pairing/client.js +48 -0
- package/node_modules/@agentims/sdk/dist/features/pairing/index.js +1 -0
- package/node_modules/@agentims/sdk/dist/features/pairing/types.js +3 -0
- package/node_modules/@agentims/sdk/dist/features/presence/client.js +15 -0
- package/node_modules/@agentims/sdk/dist/features/presence/index.js +1 -0
- package/node_modules/@agentims/sdk/dist/features/presence/types.js +3 -0
- package/node_modules/@agentims/sdk/dist/features/profiles/client.js +15 -0
- package/node_modules/@agentims/sdk/dist/features/profiles/index.js +1 -0
- package/node_modules/@agentims/sdk/dist/features/profiles/types.js +3 -0
- package/node_modules/@agentims/sdk/dist/features/reliability/client.js +32 -0
- package/node_modules/@agentims/sdk/dist/features/reliability/index.js +1 -0
- package/node_modules/@agentims/sdk/dist/features/reliability/observe.js +48 -0
- package/node_modules/@agentims/sdk/dist/features/reliability/types.js +3 -0
- package/node_modules/@agentims/sdk/dist/features/rooms/client.js +76 -0
- package/node_modules/@agentims/sdk/dist/features/rooms/index.js +1 -0
- package/node_modules/@agentims/sdk/dist/features/rooms/types.js +1 -0
- package/node_modules/@agentims/sdk/dist/features/rtc/client.js +39 -0
- package/node_modules/@agentims/sdk/dist/features/rtc/index.js +1 -0
- package/node_modules/@agentims/sdk/dist/features/rtc/types.js +1 -0
- package/node_modules/@agentims/sdk/dist/features/search/client.js +31 -0
- package/node_modules/@agentims/sdk/dist/features/search/index.js +1 -0
- package/node_modules/@agentims/sdk/dist/features/search/types.js +3 -0
- package/node_modules/@agentims/sdk/dist/features/sync/client.js +16 -0
- package/node_modules/@agentims/sdk/dist/features/sync/index.js +1 -0
- package/node_modules/@agentims/sdk/dist/features/sync/types.js +1 -0
- package/node_modules/@agentims/sdk/dist/features/timeline/client.js +27 -0
- package/node_modules/@agentims/sdk/dist/features/timeline/index.js +1 -0
- package/node_modules/@agentims/sdk/dist/features/timeline/types.js +3 -0
- package/node_modules/@agentims/sdk/dist/features/verification/client.js +33 -0
- package/node_modules/@agentims/sdk/dist/features/verification/index.js +1 -0
- package/node_modules/@agentims/sdk/dist/features/verification/types.js +3 -0
- package/node_modules/@agentims/sdk/dist/index.js +7 -0
- package/node_modules/@agentims/sdk/dist/internal/native/binding.js +85 -0
- package/node_modules/@agentims/sdk/dist/internal/native/platform-resource.js +15 -0
- package/node_modules/@agentims/sdk/dist/internal/native/secrets-export.js +27 -0
- package/node_modules/@agentims/sdk/dist/internal/native/transport.js +92 -0
- package/node_modules/@agentims/sdk/dist/internal/protocol/codec.js +69 -0
- package/node_modules/@agentims/sdk/dist/internal/protocol/input.js +38 -0
- package/node_modules/@agentims/sdk/dist/internal/protocol/native-settings.js +48 -0
- package/node_modules/@agentims/sdk/dist/internal/protocol/operations.json +1 -0
- package/node_modules/@agentims/sdk/dist/internal/protocol/registry.js +72 -0
- package/node_modules/@agentims/sdk/dist/internal/protocol/schema.js +133 -0
- package/node_modules/@agentims/sdk/dist/internal/transport/client.js +102 -0
- package/node_modules/@agentims/sdk/dist/internal/transport/error-diagnostics.js +50 -0
- package/node_modules/@agentims/sdk/dist/internal/transport/request.js +59 -0
- package/node_modules/@agentims/sdk/dist/internal/transport/response.js +94 -0
- package/node_modules/@agentims/sdk/dist/internal/transport/retry-after.js +21 -0
- package/node_modules/@agentims/sdk/dist/internal/transport/stream-diagnostics.js +19 -0
- package/node_modules/@agentims/sdk/dist/internal/transport/types.js +1 -0
- package/node_modules/@agentims/sdk/package.json +8 -0
- package/package.json +31 -4
- package/release.json +746 -0
|
@@ -0,0 +1,271 @@
|
|
|
1
|
+
import { constants } from "node:fs";
|
|
2
|
+
import { quiesceForUpdate } from "./admission.js";
|
|
3
|
+
import { expectCleanShutdown, verifyCleanShutdown } from "./shutdown-proof.js";
|
|
4
|
+
import { chmod, copyFile, lstat, rename, unlink } from "node:fs/promises";
|
|
5
|
+
import { join } from "node:path";
|
|
6
|
+
import { randomBytes } from "node:crypto";
|
|
7
|
+
import { readBundle } from "../managed/state.js";
|
|
8
|
+
import { bundleClient, waitForApi, waitForCommunication } from "../managed/connection.js";
|
|
9
|
+
import { updateLease, updateControllerExecutable } from "./locking.js";
|
|
10
|
+
import { controlLease } from "../managed/lease.js";
|
|
11
|
+
import { supervisor } from "../supervision/select.js";
|
|
12
|
+
import { migrateAgentDeviceState } from "../storage/archive.js";
|
|
13
|
+
import { privateText } from "../configuration/private-state.js";
|
|
14
|
+
import { UpdateError } from "./types.js";
|
|
15
|
+
import { plannedRelease, readUpdateRecord, writeUpdateRecord } from "./ledger.js";
|
|
16
|
+
import { readUpdatePolicy, updateDocument } from "./policy.js";
|
|
17
|
+
import { stageInstallation, validateInstallation } from "./installation.js";
|
|
18
|
+
import { assertContinuity, assertDatabaseContinuity, captureContinuity, loadContinuity, saveContinuity } from "./continuity.js";
|
|
19
|
+
import { availableRuntimeInfo, inspectDevice, offlineBaseline, saveLegacyIdentity } from "./offline.js";
|
|
20
|
+
import { ensureDeviceArchive } from "./device-archive.js";
|
|
21
|
+
import { activeClient } from "./activation.js";
|
|
22
|
+
import { compareVersion } from "./discovery.js";
|
|
23
|
+
import { clientRestartTicket, managedAdmission } from "./restart.js";
|
|
24
|
+
import { quiesceHost, resumeHost } from "./host-continuation.js";
|
|
25
|
+
import { fileDigest, verifyDeviceArchive } from "./archive.js";
|
|
26
|
+
import { stopUpdateOwner } from "./shutdown-owner.js";
|
|
27
|
+
async function exists(path) {
|
|
28
|
+
try {
|
|
29
|
+
await lstat(path);
|
|
30
|
+
return true;
|
|
31
|
+
}
|
|
32
|
+
catch (error) {
|
|
33
|
+
if (error.code === "ENOENT")
|
|
34
|
+
return false;
|
|
35
|
+
throw error;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
async function switchCore(source, destination, expected) {
|
|
39
|
+
if ((await fileDigest(destination)).sha256 === expected)
|
|
40
|
+
return;
|
|
41
|
+
const temporary = `${destination}.${randomBytes(8).toString("hex")}.next`;
|
|
42
|
+
try {
|
|
43
|
+
await copyFile(source, temporary, constants.COPYFILE_EXCL);
|
|
44
|
+
await chmod(temporary, 0o700);
|
|
45
|
+
if ((await fileDigest(temporary)).sha256 !== expected)
|
|
46
|
+
throw new UpdateError("UPDATE_CORE_MISMATCH", "Candidate core changed during activation");
|
|
47
|
+
await rename(temporary, destination);
|
|
48
|
+
}
|
|
49
|
+
finally {
|
|
50
|
+
await unlink(temporary).catch(() => { });
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
/** Internal driver seam also permits a controlled foreground supervisor in acceptance tests. */
|
|
54
|
+
export async function applyManagedUpdate(options, manager, observe) {
|
|
55
|
+
const policy = await readUpdatePolicy(options.root);
|
|
56
|
+
if (policy.hostMode === "communication_only" && options.host)
|
|
57
|
+
throw new UpdateError("UPDATE_HOST_MODE_MISMATCH", "A business host requires coordinated customer update policy");
|
|
58
|
+
const releaseLock = await updateLease(policy.root);
|
|
59
|
+
let client;
|
|
60
|
+
try {
|
|
61
|
+
let record = await readUpdateRecord(policy.root, options.updateId);
|
|
62
|
+
if (record.owner !== "managed")
|
|
63
|
+
throw new UpdateError("UPDATE_OWNER_MODE", "Use prepareEmbeddedClientUpdate for an embedded owner");
|
|
64
|
+
if (["applied", "failed", "restart_required", "resuming"].includes(record.phase))
|
|
65
|
+
return record;
|
|
66
|
+
const release = await plannedRelease(policy, record);
|
|
67
|
+
const active = await activeClient(policy.root);
|
|
68
|
+
if (active && compareVersion(record.toVersion, active.runtimeVersion) < 0)
|
|
69
|
+
throw new UpdateError("UPDATE_VERSION_REWIND", "Original plan is older than the activated client; preserve its record and select a newer compatible release");
|
|
70
|
+
const platform = release.platforms.find(value => value.platform === `${process.platform}-${process.arch}`);
|
|
71
|
+
if (!platform?.executionValidated)
|
|
72
|
+
throw new UpdateError("UPDATE_PLATFORM_UNVALIDATED", "The release has no executed acceptance for this client platform");
|
|
73
|
+
const installed = await stageInstallation(release, record.manifestDigest, policy);
|
|
74
|
+
const bundle = await readBundle(record.stateDir);
|
|
75
|
+
const releaseDevice = await controlLease(updateControllerExecutable(), bundle.spec.directory);
|
|
76
|
+
const transition = async (phase, errorCode = null) => {
|
|
77
|
+
record = { ...record, phase, errorCode, updatedAtMs: Date.now() };
|
|
78
|
+
await writeUpdateRecord(policy, record);
|
|
79
|
+
await observe?.(record);
|
|
80
|
+
};
|
|
81
|
+
try {
|
|
82
|
+
if (["planned", "deferred"].includes(record.phase))
|
|
83
|
+
await transition("staged");
|
|
84
|
+
if (policy.hostMode === "coordinated" && (!options.host || !await quiesceHost(policy, record.updateId, options.host))) {
|
|
85
|
+
if (["staged", "quiescing"].includes(record.phase))
|
|
86
|
+
await transition("deferred", "UPDATE_HOST_QUIESCE_REQUIRED");
|
|
87
|
+
return record;
|
|
88
|
+
}
|
|
89
|
+
if (["staged", "quiescing"].includes(record.phase)) {
|
|
90
|
+
const approvedLegacy = platform.compatibleCoreSha256.includes(bundle.binaryHash) || bundle.binaryHash === platform.coreSha256;
|
|
91
|
+
if (!approvedLegacy) {
|
|
92
|
+
await transition("deferred", "UPDATE_SOURCE_CORE_NOT_APPROVED");
|
|
93
|
+
await resumeHost(policy, record.updateId, options.host);
|
|
94
|
+
return record;
|
|
95
|
+
}
|
|
96
|
+
if (!await manager.registered(bundle.spec))
|
|
97
|
+
await manager.start(bundle.spec);
|
|
98
|
+
client = bundleClient(bundle);
|
|
99
|
+
await waitForApi(client);
|
|
100
|
+
const info = await availableRuntimeInfo(client);
|
|
101
|
+
const sameStore = info && info.storage_compatibility === platform.storageCompatibility
|
|
102
|
+
&& info.matrix_revision === release.matrixRevision && info.application_schema === platform.applicationSchema && info.binding_abi === release.bindingAbi;
|
|
103
|
+
if (!sameStore && (!approvedLegacy || info && !policy.allowMigrations)) {
|
|
104
|
+
await transition("deferred", approvedLegacy ? "UPDATE_MIGRATION_NOT_ENABLED" : "UPDATE_SOURCE_CORE_NOT_APPROVED");
|
|
105
|
+
await resumeHost(policy, record.updateId, options.host);
|
|
106
|
+
return record;
|
|
107
|
+
}
|
|
108
|
+
await transition("quiescing");
|
|
109
|
+
if (client && info) {
|
|
110
|
+
const pending = await quiesceForUpdate(client, info.owner_generation);
|
|
111
|
+
if (pending) {
|
|
112
|
+
await transition("deferred", `UPDATE_${pending.toUpperCase()}`);
|
|
113
|
+
await resumeHost(policy, record.updateId, options.host);
|
|
114
|
+
return record;
|
|
115
|
+
}
|
|
116
|
+
const baseline = await captureContinuity(client);
|
|
117
|
+
if (BigInt(baseline.state.active_leases) !== 0n) {
|
|
118
|
+
await client.reliability.quiesce({ owner_generation: info.owner_generation, quiesced: false });
|
|
119
|
+
await transition("deferred", "UPDATE_ACTIVE_DELIVERY_LEASES");
|
|
120
|
+
await resumeHost(policy, record.updateId, options.host);
|
|
121
|
+
return record;
|
|
122
|
+
}
|
|
123
|
+
await saveContinuity(policy, record.updateId, baseline);
|
|
124
|
+
}
|
|
125
|
+
else if (client) {
|
|
126
|
+
await saveLegacyIdentity(policy, record.updateId, client);
|
|
127
|
+
}
|
|
128
|
+
const oldCore = join(policy.root, "backups", `${record.updateId}.core`);
|
|
129
|
+
if (!await exists(oldCore)) {
|
|
130
|
+
await copyFile(bundle.spec.executable, oldCore, constants.COPYFILE_EXCL);
|
|
131
|
+
await chmod(oldCore, 0o700);
|
|
132
|
+
}
|
|
133
|
+
if ((await fileDigest(oldCore)).sha256 !== bundle.binaryHash)
|
|
134
|
+
throw new UpdateError("UPDATE_OLD_CORE_CONFLICT", "Original communication core backup differs");
|
|
135
|
+
await updateDocument(policy.root, `${record.updateId}.owner.json`, { binaryHash: bundle.binaryHash });
|
|
136
|
+
await expectCleanShutdown(policy.root, record.updateId, info);
|
|
137
|
+
await transition("quiesced");
|
|
138
|
+
await client?.close();
|
|
139
|
+
client = undefined;
|
|
140
|
+
}
|
|
141
|
+
if (["quiesced", "stopping"].includes(record.phase)) {
|
|
142
|
+
await transition("stopping");
|
|
143
|
+
await stopUpdateOwner(policy.root, record.updateId, record.stateDir, bundle, installed.executable, manager);
|
|
144
|
+
await transition("stopped");
|
|
145
|
+
}
|
|
146
|
+
if (["stopped", "archiving"].includes(record.phase)) {
|
|
147
|
+
await verifyCleanShutdown(policy.root, record.updateId, record.stateDir);
|
|
148
|
+
const inspection = await inspectDevice(installed.executable, bundle.spec.configFile, installed.slot);
|
|
149
|
+
let baseline;
|
|
150
|
+
try {
|
|
151
|
+
baseline = await loadContinuity(policy, record.updateId);
|
|
152
|
+
}
|
|
153
|
+
catch (error) {
|
|
154
|
+
if (error.code !== "ENOENT")
|
|
155
|
+
throw error;
|
|
156
|
+
baseline = await offlineBaseline(policy, record.updateId, inspection, record.stateDir);
|
|
157
|
+
await saveContinuity(policy, record.updateId, baseline);
|
|
158
|
+
}
|
|
159
|
+
assertDatabaseContinuity(baseline.state, inspection.state);
|
|
160
|
+
if (BigInt(inspection.state.active_leases) !== 0n)
|
|
161
|
+
throw new UpdateError("UPDATE_ACTIVE_DELIVERY_LEASES", "Stopped device still has business delivery leases; preserve host records and resolve them before continuing");
|
|
162
|
+
if (inspection.state.application_schema !== platform.applicationSchema && (!policy.allowMigrations || !platform.migratesFrom.includes(Number(inspection.state.application_schema)))) {
|
|
163
|
+
await transition("deferred", "UPDATE_MIGRATION_NOT_ENABLED");
|
|
164
|
+
await manager.start(bundle.spec);
|
|
165
|
+
client = bundleClient(bundle);
|
|
166
|
+
await waitForApi(client);
|
|
167
|
+
await resumeHost(policy, record.updateId, options.host);
|
|
168
|
+
return record;
|
|
169
|
+
}
|
|
170
|
+
await transition("archiving");
|
|
171
|
+
await ensureDeviceArchive(policy, record.updateId, record.stateDir, installed.executable);
|
|
172
|
+
await transition("archived");
|
|
173
|
+
}
|
|
174
|
+
if (["archived", "migrating"].includes(record.phase)) {
|
|
175
|
+
let inspection = await inspectDevice(installed.executable, bundle.spec.configFile, installed.slot);
|
|
176
|
+
if (inspection.state.application_schema !== platform.applicationSchema) {
|
|
177
|
+
if (!policy.allowMigrations || !platform.migratesFrom.includes(Number(inspection.state.application_schema)))
|
|
178
|
+
throw new UpdateError("UPDATE_MIGRATION_NOT_ENABLED", "This customer policy does not allow the signed migration path");
|
|
179
|
+
let attempts = 0;
|
|
180
|
+
try {
|
|
181
|
+
attempts = Number(JSON.parse(await privateText(join(policy.root, `${record.updateId}.migration.json`))).attempts);
|
|
182
|
+
}
|
|
183
|
+
catch (error) {
|
|
184
|
+
if (error.code !== "ENOENT")
|
|
185
|
+
throw error;
|
|
186
|
+
}
|
|
187
|
+
if (!Number.isSafeInteger(attempts) || attempts < 0 || attempts >= 3)
|
|
188
|
+
throw new UpdateError("UPDATE_MIGRATION_REVIEW_REQUIRED", "Migration retry budget exhausted; preserve all backups and inspect the original update record");
|
|
189
|
+
await transition("migrating");
|
|
190
|
+
await updateDocument(policy.root, `${record.updateId}.migration.json`, { attempts: attempts + 1 });
|
|
191
|
+
const backup = join(policy.root, "backups", `${record.updateId}.migration.${attempts + 1}`);
|
|
192
|
+
await migrateAgentDeviceState(record.stateDir, backup, { daemonPath: installed.executable });
|
|
193
|
+
await verifyDeviceArchive(backup);
|
|
194
|
+
inspection = await inspectDevice(installed.executable, bundle.spec.configFile, installed.slot);
|
|
195
|
+
}
|
|
196
|
+
assertDatabaseContinuity((await loadContinuity(policy, record.updateId)).state, inspection.state);
|
|
197
|
+
if (inspection.state.application_schema !== platform.applicationSchema)
|
|
198
|
+
throw new UpdateError("UPDATE_MIGRATION_UNVERIFIED", "Device migration did not reach its signed target schema");
|
|
199
|
+
await transition("migrated");
|
|
200
|
+
}
|
|
201
|
+
if (["migrated", "switching"].includes(record.phase)) {
|
|
202
|
+
const original = JSON.parse(await privateText(join(policy.root, `${record.updateId}.owner.json`)));
|
|
203
|
+
const hash = (await fileDigest(bundle.spec.executable)).sha256;
|
|
204
|
+
if (hash !== original.binaryHash && hash !== platform.coreSha256)
|
|
205
|
+
throw new UpdateError("UPDATE_OWNER_CHANGED", "Managed communication changed since update planning");
|
|
206
|
+
if (await manager.registered(bundle.spec))
|
|
207
|
+
throw new UpdateError("UPDATE_OLD_OWNER_ACTIVE", "The original supervisor is still registered");
|
|
208
|
+
await transition("switching");
|
|
209
|
+
await switchCore(installed.executable, bundle.spec.executable, platform.coreSha256);
|
|
210
|
+
await transition("opening");
|
|
211
|
+
}
|
|
212
|
+
if (record.phase === "opening") {
|
|
213
|
+
await validateInstallation(release, installed.slot);
|
|
214
|
+
await managedAdmission(bundle.spec.configFile, true);
|
|
215
|
+
await manager.start(bundle.spec);
|
|
216
|
+
client = bundleClient(bundle);
|
|
217
|
+
await waitForApi(client);
|
|
218
|
+
await waitForCommunication(client);
|
|
219
|
+
const baseline = await loadContinuity(policy, record.updateId);
|
|
220
|
+
const current = await captureContinuity(client);
|
|
221
|
+
if (current.runtime.source_digest !== platform.sourceDigest)
|
|
222
|
+
throw new UpdateError("UPDATE_RUNNING_BUILD_MISMATCH", "The active communication owner is not the selected build");
|
|
223
|
+
assertContinuity(baseline, current);
|
|
224
|
+
if (baseline.stream?.head_checkpoint)
|
|
225
|
+
await client.timeline.changesPage({ checkpoint: baseline.stream.head_checkpoint, limit: 1 });
|
|
226
|
+
await transition("validated");
|
|
227
|
+
}
|
|
228
|
+
if (record.phase === "validated") {
|
|
229
|
+
await updateDocument(policy.root, "active.json", { version: 1, updateId: record.updateId, digest: record.manifestDigest, runtimeVersion: record.toVersion });
|
|
230
|
+
if (policy.hostMode === "coordinated") {
|
|
231
|
+
await transition("restart_required");
|
|
232
|
+
await options.host?.restartRequired?.(await clientRestartTicket(policy.root, record.updateId));
|
|
233
|
+
}
|
|
234
|
+
else {
|
|
235
|
+
client ??= bundleClient(bundle);
|
|
236
|
+
const info = await client.reliability.runtimeInfo();
|
|
237
|
+
await client.reliability.quiesce({ owner_generation: info.owner_generation, quiesced: false });
|
|
238
|
+
await managedAdmission(bundle.spec.configFile, false);
|
|
239
|
+
await transition("applied");
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
return record;
|
|
243
|
+
}
|
|
244
|
+
catch (error) {
|
|
245
|
+
const code = error instanceof UpdateError ? error.code : "UPDATE_INTERRUPTED";
|
|
246
|
+
await writeUpdateRecord(policy, { ...record, updatedAtMs: Date.now(), errorCode: code });
|
|
247
|
+
throw error;
|
|
248
|
+
}
|
|
249
|
+
finally {
|
|
250
|
+
await client?.close();
|
|
251
|
+
await releaseDevice();
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
catch (error) {
|
|
255
|
+
try {
|
|
256
|
+
const latest = await readUpdateRecord(policy.root, options.updateId);
|
|
257
|
+
const code = error instanceof UpdateError ? error.code : "UPDATE_INTERRUPTED";
|
|
258
|
+
const invalid = ["UPDATE_MANIFEST_INVALID", "UPDATE_SIGNATURE_INVALID", "UPDATE_PACKAGE_MISMATCH", "UPDATE_CORE_MISMATCH", "UPDATE_BUILD_MISMATCH", "UPDATE_BINDING_MISMATCH", "UPDATE_BUNDLE_MISMATCH", "UPDATE_DOWNLOAD_DIGEST", "UPDATE_DOWNLOAD_SIZE", "UPDATE_CACHE_CORRUPT", "UPDATE_INSTALLATION_CHANGED"].includes(code);
|
|
259
|
+
const phase = invalid && ["planned", "staged", "deferred"].includes(latest.phase) ? "failed" : latest.phase;
|
|
260
|
+
await writeUpdateRecord(policy, { ...latest, phase, updatedAtMs: Date.now(), errorCode: code });
|
|
261
|
+
}
|
|
262
|
+
catch { /* Preserve the original failure and any existing private record. */ }
|
|
263
|
+
throw error;
|
|
264
|
+
}
|
|
265
|
+
finally {
|
|
266
|
+
await releaseLock();
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
export async function applyClientUpdate(options) {
|
|
270
|
+
return applyManagedUpdate(options, await supervisor());
|
|
271
|
+
}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { createPublicKey, verify, createHash } from "node:crypto";
|
|
2
|
+
import { parseAgentIMJSON } from "@agentims/sdk";
|
|
3
|
+
import { isClientVersion, isStableVersion } from "./version.js";
|
|
4
|
+
import { UpdateError } from "./types.js";
|
|
5
|
+
function invalid() { throw new UpdateError("UPDATE_MANIFEST_INVALID", "Client release metadata is invalid"); }
|
|
6
|
+
const record = (value) => value !== null && typeof value === "object" && !Array.isArray(value);
|
|
7
|
+
const digest = (value) => typeof value === "string" && /^[a-f0-9]{64}$/.test(value);
|
|
8
|
+
const integer = (value) => typeof value === "number" && Number.isSafeInteger(value) && value >= 0;
|
|
9
|
+
const exact = (value, keys) => Object.keys(value).sort().join() === [...keys].sort().join();
|
|
10
|
+
const basePackages = ["@agentims/runtime", "@agentims/sdk", "@agentims/adapter", "@agentims/runtime-assets"];
|
|
11
|
+
const resourcePackages = ["sdk", "core"].flatMap(role => ["darwin-x64", "darwin-arm64", "linux-x64", "linux-arm64", "win32-x64"].map(platform => `@agentims/native-${role}-${platform}`));
|
|
12
|
+
export function validateRelease(value, now = Date.now()) {
|
|
13
|
+
if (!record(value) || !exact(value, ["version", "audience", "releaseId", "sequence", "channel", "issuedAtMs", "expiresAtMs", "node", "bindingAbi", "matrixRevision", "packages", "platforms"]))
|
|
14
|
+
invalid();
|
|
15
|
+
if (![1, 2].includes(Number(value.version)) || typeof value.version !== "number" || value.audience !== "customer" || typeof value.releaseId !== "string"
|
|
16
|
+
|| !/^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/.test(value.releaseId) || !integer(value.sequence) || value.sequence < 1
|
|
17
|
+
|| !["stable", "beta"].includes(String(value.channel)) || !isStableVersion(value.node) || !integer(value.bindingAbi) || value.bindingAbi < 1 || value.bindingAbi > 65535
|
|
18
|
+
|| typeof value.matrixRevision !== "string" || !/^[a-f0-9]{40}$/.test(value.matrixRevision)
|
|
19
|
+
|| !integer(value.issuedAtMs) || !integer(value.expiresAtMs) || value.issuedAtMs > now + 300000
|
|
20
|
+
|| value.expiresAtMs <= now || value.expiresAtMs <= value.issuedAtMs || !Array.isArray(value.packages)
|
|
21
|
+
|| value.packages.length !== (value.version === 2 ? 14 : 4) || !Array.isArray(value.platforms) || !value.platforms.length || value.platforms.length > 16)
|
|
22
|
+
invalid();
|
|
23
|
+
const allowedPackages = value.version === 2 ? [...basePackages, ...resourcePackages] : basePackages;
|
|
24
|
+
const names = new Set();
|
|
25
|
+
for (const item of value.packages) {
|
|
26
|
+
if (!record(item) || !exact(item, ["name", "version", "url", "sha256", "bytes"])
|
|
27
|
+
|| !allowedPackages.includes(String(item.name))
|
|
28
|
+
|| names.has(String(item.name)) || !isClientVersion(item.version) || value.channel === "stable" && !isStableVersion(item.version) || !digest(item.sha256)
|
|
29
|
+
|| !integer(item.bytes) || item.bytes < 1 || item.bytes > 512 * 1024 * 1024 || typeof item.url !== "string")
|
|
30
|
+
invalid();
|
|
31
|
+
safeURL(item.url);
|
|
32
|
+
names.add(String(item.name));
|
|
33
|
+
}
|
|
34
|
+
const platforms = new Set();
|
|
35
|
+
for (const item of value.platforms) {
|
|
36
|
+
if (!record(item) || !exact(item, ["platform", "coreSha256", "sourceDigest", "storageCompatibility", "applicationSchema", "migratesFrom", "executionValidated", "compatibleCoreSha256", "compatibleSourceDigest"])
|
|
37
|
+
|| !["darwin-x64", "darwin-arm64", "linux-x64", "linux-arm64", "win32-x64"].includes(String(item.platform))
|
|
38
|
+
|| platforms.has(String(item.platform)) || !digest(item.coreSha256) || !digest(item.sourceDigest)
|
|
39
|
+
|| typeof item.storageCompatibility !== "string" || !/^[A-Za-z0-9._-]{1,128}$/.test(item.storageCompatibility)
|
|
40
|
+
|| !integer(item.applicationSchema) || item.applicationSchema < 1 || item.applicationSchema > 65535 || !Array.isArray(item.migratesFrom) || item.migratesFrom.length > 32
|
|
41
|
+
|| !item.migratesFrom.every(entry => integer(entry) && entry >= 1 && entry <= 65535) || new Set(item.migratesFrom).size !== item.migratesFrom.length || typeof item.executionValidated !== "boolean"
|
|
42
|
+
|| !Array.isArray(item.compatibleCoreSha256) || item.compatibleCoreSha256.length > 64 || !item.compatibleCoreSha256.every(digest) || new Set(item.compatibleCoreSha256).size !== item.compatibleCoreSha256.length
|
|
43
|
+
|| !Array.isArray(item.compatibleSourceDigest) || item.compatibleSourceDigest.length > 64 || !item.compatibleSourceDigest.every(digest) || new Set(item.compatibleSourceDigest).size !== item.compatibleSourceDigest.length)
|
|
44
|
+
invalid();
|
|
45
|
+
platforms.add(String(item.platform));
|
|
46
|
+
}
|
|
47
|
+
const release = value;
|
|
48
|
+
if (packageVersion(release, "@agentims/runtime") !== packageVersion(release, "@agentims/runtime-assets"))
|
|
49
|
+
invalid();
|
|
50
|
+
return release;
|
|
51
|
+
}
|
|
52
|
+
export function safeURL(input) {
|
|
53
|
+
let url;
|
|
54
|
+
try {
|
|
55
|
+
url = new URL(input);
|
|
56
|
+
}
|
|
57
|
+
catch {
|
|
58
|
+
return invalid();
|
|
59
|
+
}
|
|
60
|
+
if (input.length > 8192 || url.search || url.username || url.password || url.hash || (url.protocol !== "https:"
|
|
61
|
+
&& !(url.protocol === "http:" && ["127.0.0.1", "[::1]", "localhost"].includes(url.hostname))))
|
|
62
|
+
invalid();
|
|
63
|
+
return url;
|
|
64
|
+
}
|
|
65
|
+
export function verifyRelease(envelope, policy, now = Date.now(), acceptedAt) {
|
|
66
|
+
if (!record(envelope) || !exact(envelope, ["keyId", "payload", "signature"]) || typeof envelope.keyId !== "string"
|
|
67
|
+
|| typeof envelope.payload !== "string" || envelope.payload.length > 131072 || typeof envelope.signature !== "string")
|
|
68
|
+
invalid();
|
|
69
|
+
const pem = Object.hasOwn(policy.trustedKeys, envelope.keyId) ? policy.trustedKeys[envelope.keyId] : undefined;
|
|
70
|
+
if (!pem)
|
|
71
|
+
throw new UpdateError("UPDATE_UNTRUSTED_KEY", "Client release signing key is not trusted by this user");
|
|
72
|
+
const payload = Buffer.from(envelope.payload, "base64"), signature = Buffer.from(envelope.signature, "base64");
|
|
73
|
+
let valid = false;
|
|
74
|
+
try {
|
|
75
|
+
const key = createPublicKey(pem);
|
|
76
|
+
valid = key.asymmetricKeyType === "ed25519" && signature.length === 64
|
|
77
|
+
&& payload.toString("base64") === envelope.payload && signature.toString("base64") === envelope.signature
|
|
78
|
+
&& verify(null, payload, key, signature);
|
|
79
|
+
}
|
|
80
|
+
catch { /* Reject malformed keys and signatures without reflecting their values. */ }
|
|
81
|
+
if (!valid)
|
|
82
|
+
throw new UpdateError("UPDATE_SIGNATURE_INVALID", "Client release signature verification failed");
|
|
83
|
+
const release = validateRelease(parseAgentIMJSON(new TextDecoder("utf-8", { fatal: true }).decode(payload)), acceptedAt ?? now);
|
|
84
|
+
if (release.channel !== policy.channel)
|
|
85
|
+
throw new UpdateError("UPDATE_CHANNEL_MISMATCH", "Client release channel differs from the configured channel");
|
|
86
|
+
return { release, digest: createHash("sha256").update(payload).digest("hex") };
|
|
87
|
+
}
|
|
88
|
+
export function packageVersion(release, name) {
|
|
89
|
+
const item = release.packages.find(value => value.name === name);
|
|
90
|
+
if (!item)
|
|
91
|
+
return invalid();
|
|
92
|
+
return item.version;
|
|
93
|
+
}
|
|
94
|
+
/** Authenticate the complete release; download and install only this machine's resource. */
|
|
95
|
+
export function platformPackages(release, platform = `${process.platform}-${process.arch}`) {
|
|
96
|
+
return release.packages.filter(item => basePackages.includes(item.name) || ["sdk", "core"].some(role => item.name === `@agentims/native-${role}-${platform}`));
|
|
97
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { ApiError, parseAgentIMJSON } from "@agentims/sdk";
|
|
2
|
+
import { createHash } from "node:crypto";
|
|
3
|
+
import { join } from "node:path";
|
|
4
|
+
import { privateText } from "../configuration/private-state.js";
|
|
5
|
+
import { runUpdateProcess } from "./installation.js";
|
|
6
|
+
import { UpdateError } from "./types.js";
|
|
7
|
+
import { updateDocument } from "./policy.js";
|
|
8
|
+
export async function inspectDevice(executable, configFile, cwd) {
|
|
9
|
+
const value = parseAgentIMJSON(await runUpdateProcess(executable, ["--config", configFile, "--inspect-store"], cwd, 60000));
|
|
10
|
+
const schema = Number(value?.state?.application_schema);
|
|
11
|
+
if (!value?.state?.user_id || !value.state.device_id || !Number.isSafeInteger(schema) || schema < 1 || schema > 65535
|
|
12
|
+
|| !/^[a-f0-9]{64}$/.test(value.state.processed_digest) || !/^[a-f0-9]{64}$/.test(value.state.intents_digest)) {
|
|
13
|
+
throw new UpdateError("UPDATE_OFFLINE_STATE_INVALID", "Stopped device inspection did not return verifiable original state");
|
|
14
|
+
}
|
|
15
|
+
return value;
|
|
16
|
+
}
|
|
17
|
+
export async function availableRuntimeInfo(client) {
|
|
18
|
+
try {
|
|
19
|
+
return await client.reliability.runtimeInfo();
|
|
20
|
+
}
|
|
21
|
+
catch (error) {
|
|
22
|
+
if (error instanceof ApiError && error.status === 404)
|
|
23
|
+
return null;
|
|
24
|
+
throw error;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
export async function saveLegacyIdentity(policy, id, client) {
|
|
28
|
+
const identity = await client.identity.status();
|
|
29
|
+
if (!identity.user_id || !identity.device_id || !identity.crypto_ready)
|
|
30
|
+
throw new UpdateError("UPDATE_IDENTITY_UNVERIFIABLE", "Original device is not ready for update continuity verification");
|
|
31
|
+
const device = (await client.devices.trust(identity.user_id)).devices.find(value => value.device_id === identity.device_id);
|
|
32
|
+
if (!device?.ed25519 || !device.curve25519)
|
|
33
|
+
throw new UpdateError("UPDATE_DEVICE_KEYS_UNVERIFIABLE", "Original device public keys are not observable");
|
|
34
|
+
const keys = createHash("sha256").update(JSON.stringify([device.ed25519, device.curve25519])).digest("hex");
|
|
35
|
+
await updateDocument(policy.root, `${id}.identity.json`, { userId: identity.user_id, deviceId: identity.device_id, keys });
|
|
36
|
+
}
|
|
37
|
+
export async function offlineBaseline(policy, id, inspection, stateDir) {
|
|
38
|
+
let keys = null;
|
|
39
|
+
try {
|
|
40
|
+
const identity = JSON.parse(await privateText(join(policy.root, `${id}.identity.json`)));
|
|
41
|
+
if (identity.userId !== inspection.state.user_id || identity.deviceId !== inspection.state.device_id || !/^[a-f0-9]{64}$/.test(identity.keys))
|
|
42
|
+
throw new UpdateError("UPDATE_IDENTITY_MISMATCH", "Stopped device differs from the original running identity");
|
|
43
|
+
keys = identity.keys;
|
|
44
|
+
}
|
|
45
|
+
catch (error) {
|
|
46
|
+
if (error.code !== "ENOENT")
|
|
47
|
+
throw error;
|
|
48
|
+
}
|
|
49
|
+
const pin = JSON.parse(await privateText(join(stateDir, "homeserver.json")));
|
|
50
|
+
let stream = null;
|
|
51
|
+
if (inspection.stream_id && inspection.incarnation && inspection.head !== null) {
|
|
52
|
+
stream = { stream_id: inspection.stream_id, incarnation: inspection.incarnation, high_watermark: inspection.head,
|
|
53
|
+
identity: { homeserver: pin.homeserver, user_id: inspection.state.user_id, device_id: inspection.state.device_id } };
|
|
54
|
+
}
|
|
55
|
+
return { runtime: null, stream, state: { ...inspection.state, device_keys_digest: keys } };
|
|
56
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { applyClientUpdate } from "./managed.js";
|
|
2
|
+
import { prepareEmbeddedClientUpdate } from "./embedded.js";
|
|
3
|
+
import { UpdateError } from "./types.js";
|
|
4
|
+
/** Route update control to its existing communication owner; never swaps owner modes. */
|
|
5
|
+
export async function applyOwnedClientUpdate(record, root, options) {
|
|
6
|
+
if (record.owner !== (options.owner ?? "managed"))
|
|
7
|
+
throw new UpdateError("UPDATE_OWNER_MODE", "Original update belongs to a different communication owner mode");
|
|
8
|
+
if (record.owner === "embedded") {
|
|
9
|
+
if (!options.host)
|
|
10
|
+
throw new UpdateError("UPDATE_EMBEDDED_HOST_REQUIRED", "Embedded updates require durable host quiesce and restart hooks");
|
|
11
|
+
return prepareEmbeddedClientUpdate({ root, updateId: record.updateId, host: options.host, ...(options.client ? { client: options.client } : {}) });
|
|
12
|
+
}
|
|
13
|
+
return applyClientUpdate({ root, updateId: record.updateId, ...(options.host ? { host: options.host } : {}) });
|
|
14
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { readdir, realpath } from "node:fs/promises";
|
|
2
|
+
import { readUpdateRecord } from "./records.js";
|
|
3
|
+
import { UpdateError } from "./types.js";
|
|
4
|
+
/** Recover the same in-flight update even when discovery is unavailable or its manifest has expired. */
|
|
5
|
+
export async function pendingClientUpdate(root, stateDir, inFlightOnly = false) {
|
|
6
|
+
const state = await realpath(stateDir), records = [];
|
|
7
|
+
for (const name of await readdir(root)) {
|
|
8
|
+
if (!/^[a-f0-9]{64}\.json$/.test(name))
|
|
9
|
+
continue;
|
|
10
|
+
const record = await readUpdateRecord(root, name.slice(0, -5));
|
|
11
|
+
if (record.stateDir === state && !["applied", "failed"].includes(record.phase))
|
|
12
|
+
records.push(record);
|
|
13
|
+
}
|
|
14
|
+
const active = records.filter(item => !["planned", "staged", "deferred"].includes(item.phase));
|
|
15
|
+
if (active.length > 1)
|
|
16
|
+
throw new UpdateError("UPDATE_CONFLICT", "More than one in-flight update claims this device; preserve the records and inspect before continuing");
|
|
17
|
+
if (inFlightOnly)
|
|
18
|
+
return active[0];
|
|
19
|
+
return active[0] ?? records.sort((a, b) => b.createdAtMs - a.createdAtMs)[0];
|
|
20
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { createPublicKey } from "node:crypto";
|
|
2
|
+
import { homedir } from "node:os";
|
|
3
|
+
import { dirname, isAbsolute, join, resolve } from "node:path";
|
|
4
|
+
import { directory, privateText, replacePrivate, assertPrivateDirectory } from "../configuration/private-state.js";
|
|
5
|
+
import { safeURL } from "./manifest.js";
|
|
6
|
+
import { UpdateError } from "./types.js";
|
|
7
|
+
export function clientUpdateRoot() {
|
|
8
|
+
const configured = process.env.AGENTIM_CLIENT_UPDATE_ROOT;
|
|
9
|
+
if (configured) {
|
|
10
|
+
if (!isAbsolute(configured))
|
|
11
|
+
throw new UpdateError("UPDATE_ROOT_INVALID", "Client update root must be absolute");
|
|
12
|
+
return resolve(configured);
|
|
13
|
+
}
|
|
14
|
+
const base = process.platform === "darwin" ? join(homedir(), "Library/Application Support/AgentIM")
|
|
15
|
+
: process.platform === "win32" ? join(process.env.LOCALAPPDATA ?? join(homedir(), "AppData/Local"), "AgentIM")
|
|
16
|
+
: join(process.env.XDG_STATE_HOME ?? join(homedir(), ".local/state"), "agentim");
|
|
17
|
+
return join(base, "client-updates");
|
|
18
|
+
}
|
|
19
|
+
export function validatePolicy(value, root) {
|
|
20
|
+
if (!value || typeof value !== "object")
|
|
21
|
+
throw new UpdateError("UPDATE_POLICY_INVALID", "Client update policy is invalid");
|
|
22
|
+
const item = value;
|
|
23
|
+
if (Object.keys(item).some(key => !["version", "root", "manifestUrl", "channel", "trustedKeys", "automatic", "hostMode", "intervalMs", "allowMigrations"].includes(key))
|
|
24
|
+
|| item.version !== 1 || item.root !== resolve(root) || !isAbsolute(root) || typeof item.manifestUrl !== "string"
|
|
25
|
+
|| !["stable", "beta"].includes(String(item.channel)) || !["off", "check", "compatible"].includes(String(item.automatic))
|
|
26
|
+
|| !["coordinated", "communication_only"].includes(String(item.hostMode))
|
|
27
|
+
|| !Number.isSafeInteger(item.intervalMs) || Number(item.intervalMs) < 60000 || Number(item.intervalMs) > 604800000
|
|
28
|
+
|| (item.allowMigrations !== undefined && typeof item.allowMigrations !== "boolean")
|
|
29
|
+
|| !item.trustedKeys || typeof item.trustedKeys !== "object" || Array.isArray(item.trustedKeys)
|
|
30
|
+
|| Object.keys(item.trustedKeys).length < 1 || Object.keys(item.trustedKeys).length > 16
|
|
31
|
+
|| !Object.entries(item.trustedKeys).every(([key, pem]) => /^[A-Za-z0-9._-]{1,64}$/.test(key) && typeof pem === "string" && pem.length <= 8192)) {
|
|
32
|
+
throw new UpdateError("UPDATE_POLICY_INVALID", "Client update policy is invalid");
|
|
33
|
+
}
|
|
34
|
+
try {
|
|
35
|
+
for (const pem of Object.values(item.trustedKeys)) {
|
|
36
|
+
if (createPublicKey(String(pem)).asymmetricKeyType !== "ed25519")
|
|
37
|
+
throw new Error();
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
catch {
|
|
41
|
+
throw new UpdateError("UPDATE_POLICY_INVALID", "Client update policy requires Ed25519 public signing keys");
|
|
42
|
+
}
|
|
43
|
+
safeURL(item.manifestUrl);
|
|
44
|
+
return item;
|
|
45
|
+
}
|
|
46
|
+
/** Explicit user configuration. Public signing keys are trusted only through this action. */
|
|
47
|
+
export async function configureClientUpdates(policy) {
|
|
48
|
+
validatePolicy(policy, policy.root);
|
|
49
|
+
await directory(policy.root);
|
|
50
|
+
await assertPrivateDirectory(policy.root);
|
|
51
|
+
await replacePrivate(join(policy.root, "policy.json"), JSON.stringify(policy));
|
|
52
|
+
}
|
|
53
|
+
export async function readUpdatePolicy(root = clientUpdateRoot()) {
|
|
54
|
+
try {
|
|
55
|
+
await assertPrivateDirectory(root);
|
|
56
|
+
return validatePolicy(JSON.parse(await privateText(join(root, "policy.json"), 65536)), root);
|
|
57
|
+
}
|
|
58
|
+
catch (error) {
|
|
59
|
+
if (error.code === "ENOENT")
|
|
60
|
+
throw new UpdateError("UPDATE_POLICY_REQUIRED", "Configure this user's update source and trusted public keys with update configure");
|
|
61
|
+
if (error instanceof UpdateError)
|
|
62
|
+
throw error;
|
|
63
|
+
throw new UpdateError("UPDATE_POLICY_INVALID", "Client update policy is malformed, inaccessible, or not private to this user");
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
export async function updateDocument(root, name, value) {
|
|
67
|
+
if (!/^[a-z0-9][a-z0-9.-]{0,127}\.json$/.test(name))
|
|
68
|
+
throw new UpdateError("UPDATE_PATH_INVALID", "Update document name is invalid");
|
|
69
|
+
const path = join(root, name);
|
|
70
|
+
await directory(dirname(path));
|
|
71
|
+
await assertPrivateDirectory(root);
|
|
72
|
+
await replacePrivate(path, JSON.stringify(value));
|
|
73
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
import { realpath } from "node:fs/promises";
|
|
3
|
+
import { join, isAbsolute } from "node:path";
|
|
4
|
+
import { assertPrivateDirectory, privateText } from "../configuration/private-state.js";
|
|
5
|
+
import { updateDocument } from "./policy.js";
|
|
6
|
+
import { UpdateError } from "./types.js";
|
|
7
|
+
export function assertUpdateId(id) {
|
|
8
|
+
if (!/^[a-f0-9]{64}$/.test(id))
|
|
9
|
+
throw new UpdateError("UPDATE_ID_INVALID", "An exact client update ID is required");
|
|
10
|
+
}
|
|
11
|
+
export async function readUpdateRecord(root, id) {
|
|
12
|
+
assertUpdateId(id);
|
|
13
|
+
await assertPrivateDirectory(root);
|
|
14
|
+
const value = JSON.parse(await privateText(join(root, `${id}.json`)));
|
|
15
|
+
if (!value || typeof value !== "object")
|
|
16
|
+
throw new UpdateError("UPDATE_LEDGER_INVALID", "Client update record is invalid");
|
|
17
|
+
const record = value;
|
|
18
|
+
if (record.version !== 1 || record.updateId !== id || !/^[a-f0-9]{64}$/.test(record.manifestDigest)
|
|
19
|
+
|| !["planned", "staged", "quiescing", "quiesced", "stopping", "stopped", "archiving", "archived", "migrating", "migrated", "switching", "opening", "validated", "restart_required", "resuming", "applied", "deferred", "failed"].includes(record.phase)
|
|
20
|
+
|| !["managed", "embedded"].includes(record.owner) || !Number.isSafeInteger(record.createdAtMs) || record.createdAtMs > record.updatedAtMs
|
|
21
|
+
|| typeof record.stateDir !== "string" || !isAbsolute(record.stateDir) || !Number.isSafeInteger(record.updatedAtMs)) {
|
|
22
|
+
throw new UpdateError("UPDATE_LEDGER_INVALID", "Client update record is invalid");
|
|
23
|
+
}
|
|
24
|
+
const state = await realpath(record.stateDir);
|
|
25
|
+
const expectedId = createHash("sha256").update(record.manifestDigest + "\0" + state + "\0" + record.owner).digest("hex");
|
|
26
|
+
if (state !== record.stateDir || expectedId !== id)
|
|
27
|
+
throw new UpdateError("UPDATE_DEVICE_BINDING", "Original update no longer matches its exact device directory and owner mode");
|
|
28
|
+
return record;
|
|
29
|
+
}
|
|
30
|
+
export async function writeUpdateRecord(policy, record) {
|
|
31
|
+
assertUpdateId(record.updateId);
|
|
32
|
+
await updateDocument(policy.root, `${record.updateId}.json`, record);
|
|
33
|
+
}
|