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,90 @@
|
|
|
1
|
+
import { botChoice, botId, botInteger, botObject } from '@agent-stack/contracts';
|
|
2
|
+
const prefix = 'automatic-preparation:';
|
|
3
|
+
const hash = (raw) => {
|
|
4
|
+
if (typeof raw !== 'string' || !/^[a-f0-9]{64}$/.test(raw))
|
|
5
|
+
throw new Error('JOURNAL_AUTO_PREPARATION_INVALID');
|
|
6
|
+
return raw;
|
|
7
|
+
};
|
|
8
|
+
function parse(raw) {
|
|
9
|
+
const v = botObject(raw, [
|
|
10
|
+
'requestId',
|
|
11
|
+
'executionId',
|
|
12
|
+
'policyDigest',
|
|
13
|
+
'sourceDigest',
|
|
14
|
+
'runtimeInstanceId',
|
|
15
|
+
'createdAtMs',
|
|
16
|
+
'phase',
|
|
17
|
+
'receiptDigest',
|
|
18
|
+
]);
|
|
19
|
+
const phase = botChoice(v.phase, ['RUNNING', 'UNCERTAIN', 'VERIFIED_HELD']);
|
|
20
|
+
if ((phase === 'VERIFIED_HELD') !== (v.receiptDigest !== null))
|
|
21
|
+
throw new Error('JOURNAL_AUTO_PREPARATION_INVALID');
|
|
22
|
+
return {
|
|
23
|
+
requestId: botId(v.requestId),
|
|
24
|
+
executionId: botId(v.executionId),
|
|
25
|
+
policyDigest: hash(v.policyDigest),
|
|
26
|
+
sourceDigest: hash(v.sourceDigest),
|
|
27
|
+
runtimeInstanceId: botId(v.runtimeInstanceId),
|
|
28
|
+
createdAtMs: botInteger(v.createdAtMs, 1),
|
|
29
|
+
phase,
|
|
30
|
+
receiptDigest: v.receiptDigest === null ? null : hash(v.receiptDigest),
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
/** 有界本机I/O尝试;终态可封存,原请求指纹仍覆盖检查点。 */
|
|
34
|
+
export class BotAutomaticPreparationJournal {
|
|
35
|
+
storage;
|
|
36
|
+
capacity;
|
|
37
|
+
constructor(storage, capacity) {
|
|
38
|
+
this.storage = storage;
|
|
39
|
+
this.capacity = capacity;
|
|
40
|
+
}
|
|
41
|
+
read(requestId) {
|
|
42
|
+
const row = this.storage.db
|
|
43
|
+
.prepare(`SELECT value FROM ${this.storage.terminal.table('meta')} WHERE key=?`)
|
|
44
|
+
.get(prefix + botId(requestId));
|
|
45
|
+
return row ? parse(JSON.parse(String(row.value))) : null;
|
|
46
|
+
}
|
|
47
|
+
claim(input) {
|
|
48
|
+
const next = parse({ ...input, phase: 'RUNNING', receiptDigest: null });
|
|
49
|
+
return this.storage.transaction(() => {
|
|
50
|
+
const old = this.read(next.requestId);
|
|
51
|
+
if (old) {
|
|
52
|
+
if (old.executionId !== next.executionId ||
|
|
53
|
+
old.policyDigest !== next.policyDigest ||
|
|
54
|
+
old.sourceDigest !== next.sourceDigest ||
|
|
55
|
+
old.runtimeInstanceId !== next.runtimeInstanceId)
|
|
56
|
+
throw new Error('JOURNAL_AUTO_PREPARATION_CHANGED');
|
|
57
|
+
return { fresh: false, record: old };
|
|
58
|
+
}
|
|
59
|
+
const n = this.storage.db
|
|
60
|
+
.prepare('SELECT count(*) AS n FROM meta WHERE key LIKE ?')
|
|
61
|
+
.get(prefix + '%');
|
|
62
|
+
if (Number(n?.n) >= Math.min(32, this.capacity))
|
|
63
|
+
throw new Error('JOURNAL_AUTO_PREPARATION_CAPACITY');
|
|
64
|
+
this.storage.db
|
|
65
|
+
.prepare('INSERT INTO meta(key,value) VALUES(?,?)')
|
|
66
|
+
.run(prefix + next.requestId, JSON.stringify(next));
|
|
67
|
+
return { fresh: true, record: next };
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
finish(requestId, receiptDigest) {
|
|
71
|
+
return this.storage.transaction(() => {
|
|
72
|
+
const old = this.read(requestId);
|
|
73
|
+
if (!old)
|
|
74
|
+
throw new Error('JOURNAL_AUTO_PREPARATION_MISSING');
|
|
75
|
+
if (old.phase === 'VERIFIED_HELD') {
|
|
76
|
+
if (receiptDigest !== old.receiptDigest)
|
|
77
|
+
throw new Error('JOURNAL_AUTO_PREPARATION_CHANGED');
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
const next = parse({
|
|
81
|
+
...old,
|
|
82
|
+
phase: receiptDigest === null ? 'UNCERTAIN' : 'VERIFIED_HELD',
|
|
83
|
+
receiptDigest,
|
|
84
|
+
});
|
|
85
|
+
this.storage.db
|
|
86
|
+
.prepare('UPDATE meta SET value=? WHERE key=?')
|
|
87
|
+
.run(JSON.stringify(next), prefix + requestId);
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { createHash } from 'node:crypto';
|
|
2
|
+
import { canonicalBotJson } from '@agent-stack/contracts';
|
|
3
|
+
const mask = (1n << 256n) - 1n;
|
|
4
|
+
const corrupt = () => new Error('JOURNAL_CHECKPOINT_CORRUPT');
|
|
5
|
+
const rowDigest = (row) => BigInt('0x' + createHash('sha256').update(canonicalBotJson(row)).digest('hex'));
|
|
6
|
+
const encode = (count, sum) => `${count}:${(sum & mask).toString(16).padStart(64, '0')}`;
|
|
7
|
+
/** 本机完整性封存。每行摘要包含原键,增减在同一 SQLite 事务完成。 */
|
|
8
|
+
export class CheckpointSeal {
|
|
9
|
+
db;
|
|
10
|
+
key;
|
|
11
|
+
rows;
|
|
12
|
+
verifiedVersion;
|
|
13
|
+
constructor(db, key, rows) {
|
|
14
|
+
this.db = db;
|
|
15
|
+
this.key = key;
|
|
16
|
+
this.rows = rows;
|
|
17
|
+
}
|
|
18
|
+
saved() {
|
|
19
|
+
return this.db.prepare('SELECT value FROM meta WHERE key=?').get(this.key)?.value;
|
|
20
|
+
}
|
|
21
|
+
/** 旧版顺序摘要必须原样核完,再换成本地增量清单。 */
|
|
22
|
+
verifyLegacy() {
|
|
23
|
+
const hash = createHash('sha256');
|
|
24
|
+
for (const row of this.db.prepare(this.rows).iterate())
|
|
25
|
+
hash.update(canonicalBotJson(row)).update('\n');
|
|
26
|
+
if (this.saved() !== hash.digest('hex'))
|
|
27
|
+
throw corrupt();
|
|
28
|
+
}
|
|
29
|
+
scan() {
|
|
30
|
+
let count = 0;
|
|
31
|
+
let sum = 0n;
|
|
32
|
+
for (const row of this.db.prepare(this.rows).iterate()) {
|
|
33
|
+
count++;
|
|
34
|
+
sum += rowDigest(row);
|
|
35
|
+
}
|
|
36
|
+
return encode(count, sum);
|
|
37
|
+
}
|
|
38
|
+
store(value) {
|
|
39
|
+
this.db
|
|
40
|
+
.prepare('INSERT INTO meta(key,value) VALUES(?,?) ON CONFLICT(key) DO UPDATE SET value=excluded.value')
|
|
41
|
+
.run(this.key, value);
|
|
42
|
+
}
|
|
43
|
+
initialize() {
|
|
44
|
+
this.store(this.scan());
|
|
45
|
+
}
|
|
46
|
+
/** 清单及其引用都通过后才缓存当前外部写入版本。 */
|
|
47
|
+
verify(validateReferences) {
|
|
48
|
+
const version = Number(this.db.prepare('PRAGMA data_version').get().data_version);
|
|
49
|
+
if (this.verifiedVersion === version)
|
|
50
|
+
return;
|
|
51
|
+
if (this.saved() !== this.scan())
|
|
52
|
+
throw corrupt();
|
|
53
|
+
validateReferences?.();
|
|
54
|
+
this.verifiedVersion = version;
|
|
55
|
+
}
|
|
56
|
+
/** 调用方已在写事务中验证旧清单,只纳入本批行的变化。 */
|
|
57
|
+
update(added, removed = []) {
|
|
58
|
+
if (!added.length && !removed.length)
|
|
59
|
+
return;
|
|
60
|
+
let delta = 0n;
|
|
61
|
+
for (const row of added)
|
|
62
|
+
delta += rowDigest(row);
|
|
63
|
+
for (const row of removed)
|
|
64
|
+
delta -= rowDigest(row);
|
|
65
|
+
this.apply(added.length - removed.length, delta);
|
|
66
|
+
}
|
|
67
|
+
/** 同批新增只暂存摘要和行数,正文仍直接写入原 SQLite 事务。 */
|
|
68
|
+
append(work) {
|
|
69
|
+
let count = 0;
|
|
70
|
+
let delta = 0n;
|
|
71
|
+
const result = work((row) => {
|
|
72
|
+
count++;
|
|
73
|
+
delta += rowDigest(row);
|
|
74
|
+
});
|
|
75
|
+
if (count)
|
|
76
|
+
this.apply(count, delta);
|
|
77
|
+
return result;
|
|
78
|
+
}
|
|
79
|
+
apply(change, delta) {
|
|
80
|
+
const stored = this.saved();
|
|
81
|
+
const format = typeof stored === 'string' && /^(\d+):([0-9a-f]{64})$/.exec(stored);
|
|
82
|
+
if (!format)
|
|
83
|
+
throw corrupt();
|
|
84
|
+
const count = Number(format[1]) + change;
|
|
85
|
+
if (!Number.isSafeInteger(count) || count < 0)
|
|
86
|
+
throw corrupt();
|
|
87
|
+
this.store(encode(count, BigInt('0x' + format[2]) + delta));
|
|
88
|
+
}
|
|
89
|
+
}
|
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
import { createHash } from 'node:crypto';
|
|
2
|
+
import { canonicalBotJson } from '@agent-stack/contracts';
|
|
3
|
+
/** 只保存通信接续所需原身份、批次及输入;SDK 私有租约不进入模型或中央执行许可。 */
|
|
4
|
+
export class BotCommunicationJournal {
|
|
5
|
+
storage;
|
|
6
|
+
constructor(storage) {
|
|
7
|
+
this.storage = storage;
|
|
8
|
+
storage.db
|
|
9
|
+
.exec(`CREATE TABLE IF NOT EXISTS im_sdk_calls(scope_key TEXT NOT NULL,request_id TEXT NOT NULL,digest TEXT NOT NULL,result TEXT,PRIMARY KEY(scope_key,request_id));
|
|
10
|
+
CREATE TABLE IF NOT EXISTS im_positions(scope_key TEXT PRIMARY KEY,checkpoint TEXT NOT NULL);
|
|
11
|
+
CREATE TABLE IF NOT EXISTS im_batches(scope_key TEXT NOT NULL,batch_id TEXT NOT NULL,payload TEXT NOT NULL,PRIMARY KEY(scope_key,batch_id));
|
|
12
|
+
CREATE TABLE IF NOT EXISTS im_events(scope_key TEXT NOT NULL,event_id TEXT NOT NULL,payload TEXT NOT NULL,handled INTEGER NOT NULL DEFAULT 0,PRIMARY KEY(scope_key,event_id));
|
|
13
|
+
CREATE TABLE IF NOT EXISTS im_operations(scope_key TEXT NOT NULL,operation_key TEXT NOT NULL,revision INTEGER NOT NULL,payload TEXT NOT NULL,PRIMARY KEY(scope_key,operation_key));
|
|
14
|
+
CREATE TABLE IF NOT EXISTS im_decisions(scope_key TEXT NOT NULL,result_ref TEXT NOT NULL,payload TEXT NOT NULL,PRIMARY KEY(scope_key,result_ref));
|
|
15
|
+
CREATE TABLE IF NOT EXISTS im_actors(scope_key TEXT NOT NULL,request_id TEXT NOT NULL,payload TEXT NOT NULL,PRIMARY KEY(scope_key,request_id));
|
|
16
|
+
CREATE TABLE IF NOT EXISTS im_inputs(scope_key TEXT NOT NULL,request_id TEXT NOT NULL,payload TEXT NOT NULL,native_ref TEXT,PRIMARY KEY(scope_key,request_id));`);
|
|
17
|
+
}
|
|
18
|
+
checkpoint(scope) {
|
|
19
|
+
const row = this.storage.db
|
|
20
|
+
.prepare('SELECT checkpoint FROM im_positions WHERE scope_key=?')
|
|
21
|
+
.get(scope);
|
|
22
|
+
return row ? String(row.checkpoint) : null;
|
|
23
|
+
}
|
|
24
|
+
lookup(scope, batchId) {
|
|
25
|
+
const row = this.storage.db
|
|
26
|
+
.prepare('SELECT payload FROM im_batches WHERE scope_key=? AND batch_id=?')
|
|
27
|
+
.get(scope, batchId);
|
|
28
|
+
return row ? JSON.parse(String(row.payload)) : null;
|
|
29
|
+
}
|
|
30
|
+
/** 批次回执、位置和待处理事件同事务保存,返回后官方流才推进自己的 checkpoint。 */
|
|
31
|
+
batch(scope, batch) {
|
|
32
|
+
return this.storage.transaction(() => {
|
|
33
|
+
const old = this.lookup(scope, batch.batchId);
|
|
34
|
+
if (old)
|
|
35
|
+
return old;
|
|
36
|
+
const previous = this.checkpoint(scope);
|
|
37
|
+
if (previous !== null && previous !== batch.from)
|
|
38
|
+
throw new Error('BOT_AGENTIM_LOCAL_CHECKPOINT_CONFLICT');
|
|
39
|
+
for (const event of batch.events)
|
|
40
|
+
this.storage.db
|
|
41
|
+
.prepare('INSERT OR IGNORE INTO im_events(scope_key,event_id,payload) VALUES(?,?,?)')
|
|
42
|
+
.run(scope, event.eventId, canonicalBotJson(event));
|
|
43
|
+
this.storage.db
|
|
44
|
+
.prepare('INSERT INTO im_batches(scope_key,batch_id,payload) VALUES(?,?,?)')
|
|
45
|
+
.run(scope, batch.batchId, canonicalBotJson(batch.receipt));
|
|
46
|
+
this.storage.db
|
|
47
|
+
.prepare('INSERT INTO im_positions(scope_key,checkpoint) VALUES(?,?) ON CONFLICT(scope_key) DO UPDATE SET checkpoint=excluded.checkpoint')
|
|
48
|
+
.run(scope, batch.next);
|
|
49
|
+
return batch.receipt;
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
pending(scope, after) {
|
|
53
|
+
const query = (event) => this.storage.db
|
|
54
|
+
.prepare('SELECT payload FROM im_events WHERE scope_key=? AND handled=0 AND rowid>COALESCE((SELECT rowid FROM im_events WHERE scope_key=? AND event_id=?),0) ORDER BY rowid LIMIT 32')
|
|
55
|
+
.all(scope, scope, event ?? '');
|
|
56
|
+
// 只轮转读取窗口,未知事件仍保留;旧坏事件不能永久挤掉后续批次。
|
|
57
|
+
const page = query(after);
|
|
58
|
+
return (page.length || !after ? page : query(undefined)).map((row) => JSON.parse(String(row.payload)));
|
|
59
|
+
}
|
|
60
|
+
handled(scope, eventId) {
|
|
61
|
+
this.storage.db
|
|
62
|
+
.prepare('UPDATE im_events SET handled=1 WHERE scope_key=? AND event_id=?')
|
|
63
|
+
.run(scope, eventId);
|
|
64
|
+
}
|
|
65
|
+
operation(scope, key) {
|
|
66
|
+
const row = this.storage.db
|
|
67
|
+
.prepare('SELECT payload FROM im_operations WHERE scope_key=? AND operation_key=?')
|
|
68
|
+
.get(scope, key);
|
|
69
|
+
return row ? JSON.parse(String(row.payload)) : null;
|
|
70
|
+
}
|
|
71
|
+
/** 官方协调器独占租约和 CAS 修订,AS 不新增另一套交付状态机。 */
|
|
72
|
+
compareOperation(scope, key, expected, record) {
|
|
73
|
+
return this.storage.transaction(() => {
|
|
74
|
+
const old = this.storage.db
|
|
75
|
+
.prepare('SELECT revision FROM im_operations WHERE scope_key=? AND operation_key=?')
|
|
76
|
+
.get(scope, key);
|
|
77
|
+
if ((old ? Number(old.revision) : null) !== expected)
|
|
78
|
+
return false;
|
|
79
|
+
this.storage.db
|
|
80
|
+
.prepare('INSERT INTO im_operations(scope_key,operation_key,revision,payload) VALUES(?,?,?,?) ON CONFLICT(scope_key,operation_key) DO UPDATE SET revision=excluded.revision,payload=excluded.payload')
|
|
81
|
+
.run(scope, key, record.revision, canonicalBotJson(record));
|
|
82
|
+
return true;
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
freeze(scope, ref, decision) {
|
|
86
|
+
const old = this.decision(scope, ref), payload = canonicalBotJson(decision);
|
|
87
|
+
if (old !== null && canonicalBotJson(old) !== payload)
|
|
88
|
+
throw new Error('BOT_AGENTIM_LOCAL_RESULT_CONFLICT');
|
|
89
|
+
this.storage.db
|
|
90
|
+
.prepare('INSERT OR IGNORE INTO im_decisions(scope_key,result_ref,payload) VALUES(?,?,?)')
|
|
91
|
+
.run(scope, ref, payload);
|
|
92
|
+
}
|
|
93
|
+
decision(scope, ref) {
|
|
94
|
+
const row = this.storage.db
|
|
95
|
+
.prepare('SELECT payload FROM im_decisions WHERE scope_key=? AND result_ref=?')
|
|
96
|
+
.get(scope, ref);
|
|
97
|
+
return row ? JSON.parse(String(row.payload)) : null;
|
|
98
|
+
}
|
|
99
|
+
actor(scope, requestId, actor) {
|
|
100
|
+
this.storage.db
|
|
101
|
+
.prepare('INSERT OR IGNORE INTO im_actors(scope_key,request_id,payload) VALUES(?,?,?)')
|
|
102
|
+
.run(scope, requestId, canonicalBotJson(actor));
|
|
103
|
+
}
|
|
104
|
+
/** 已保存或已退休正文的原输入均保持同一结果,恢复时不重新解释被编辑的源消息。 */
|
|
105
|
+
hasInput(scope, requestId) {
|
|
106
|
+
return !!this.storage.db
|
|
107
|
+
.prepare('SELECT 1 FROM im_inputs WHERE scope_key=? AND request_id=?')
|
|
108
|
+
.get(scope, requestId);
|
|
109
|
+
}
|
|
110
|
+
input(scope, input) {
|
|
111
|
+
const payload = canonicalBotJson(input);
|
|
112
|
+
const old = this.storage.db
|
|
113
|
+
.prepare('SELECT payload FROM im_inputs WHERE scope_key=? AND request_id=?')
|
|
114
|
+
.get(scope, input.requestId);
|
|
115
|
+
if (old && old.payload !== payload) {
|
|
116
|
+
const retired = JSON.parse(String(old.payload));
|
|
117
|
+
const { text, ...identity } = input;
|
|
118
|
+
// Native 已保存后只留摘要;相同原投递仍可回读,不能因退休正文而误报冲突。
|
|
119
|
+
if (canonicalBotJson(retired) !==
|
|
120
|
+
canonicalBotJson({
|
|
121
|
+
...identity,
|
|
122
|
+
textDigest: createHash('sha256').update(text).digest('hex'),
|
|
123
|
+
}))
|
|
124
|
+
throw new Error('BOT_AGENTIM_LOCAL_INPUT_CONFLICT');
|
|
125
|
+
}
|
|
126
|
+
this.storage.db
|
|
127
|
+
.prepare('INSERT OR IGNORE INTO im_inputs(scope_key,request_id,payload) VALUES(?,?,?)')
|
|
128
|
+
.run(scope, input.requestId, payload);
|
|
129
|
+
return `agentim-input:${input.requestId}`;
|
|
130
|
+
}
|
|
131
|
+
inputs(scope, after) {
|
|
132
|
+
const query = (requestId) => this.storage.db
|
|
133
|
+
.prepare('SELECT payload FROM im_inputs WHERE scope_key=? AND native_ref IS NULL AND rowid>COALESCE((SELECT rowid FROM im_inputs WHERE scope_key=? AND request_id=?),0) ORDER BY rowid LIMIT 32')
|
|
134
|
+
.all(scope, scope, requestId ?? '');
|
|
135
|
+
// Native 某些原输入待核对时仍保留原件,同时轮转读取后续输入,不能被旧窗口饿死。
|
|
136
|
+
const page = query(after);
|
|
137
|
+
return (page.length || !after ? page : query(undefined)).map((row) => JSON.parse(String(row.payload)));
|
|
138
|
+
}
|
|
139
|
+
/** 无正文的原输入回证,Native 已持久化时才返回保存引用。 */
|
|
140
|
+
inputReceipt(scope, requestId) {
|
|
141
|
+
const row = this.storage.db
|
|
142
|
+
.prepare('SELECT payload,native_ref FROM im_inputs WHERE scope_key=? AND request_id=?')
|
|
143
|
+
.get(scope, requestId);
|
|
144
|
+
if (!row)
|
|
145
|
+
return null;
|
|
146
|
+
const { eventId, roomId } = JSON.parse(String(row.payload));
|
|
147
|
+
return {
|
|
148
|
+
requestId,
|
|
149
|
+
eventId,
|
|
150
|
+
roomId,
|
|
151
|
+
state: row.native_ref ? 'SAVED' : 'HOST_SAVED',
|
|
152
|
+
nativeRef: row.native_ref ? String(row.native_ref) : null,
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
/** 读取本 Bot 已真实收到的原件,不把修改后的上游正文冒充第一次接收内容。 */
|
|
156
|
+
readInput(scope, id, offset = 0) {
|
|
157
|
+
const row = this.storage.db
|
|
158
|
+
.prepare('SELECT payload,native_ref FROM im_inputs WHERE scope_key=? AND request_id=?')
|
|
159
|
+
.get(scope, id);
|
|
160
|
+
if (!row)
|
|
161
|
+
return null;
|
|
162
|
+
const input = JSON.parse(String(row.payload));
|
|
163
|
+
const text = typeof input.text === 'string' ? input.text : undefined;
|
|
164
|
+
let end = text === undefined ? offset : Math.min(text.length, offset + 128 * 1024);
|
|
165
|
+
// 沿现有 JSON 物理帧按需补读,不能把截断内容伪装成全文;也不能拆断 UTF-16 字符。
|
|
166
|
+
if (text && end < text.length && /[\uD800-\uDBFF]/.test(text[end - 1]))
|
|
167
|
+
end--;
|
|
168
|
+
return {
|
|
169
|
+
contentState: text === undefined ? 'NATIVE_SAVED' : 'CAPTURED',
|
|
170
|
+
input: text === undefined ? input : { ...input, text: text.slice(offset, end) },
|
|
171
|
+
nativeRef: row.native_ref,
|
|
172
|
+
...(text === undefined
|
|
173
|
+
? {}
|
|
174
|
+
: {
|
|
175
|
+
page: {
|
|
176
|
+
offset,
|
|
177
|
+
nextOffset: end < text.length ? end : null,
|
|
178
|
+
textLength: text.length,
|
|
179
|
+
complete: offset === 0 && end === text.length,
|
|
180
|
+
},
|
|
181
|
+
}),
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
/** Native 已保存后退休重复原文,保留原身份、摘要与真实来源定位。 */
|
|
185
|
+
delivered(scope, requestId, nativeRef, retainBody = false) {
|
|
186
|
+
this.storage.transaction(() => {
|
|
187
|
+
const row = this.storage.db
|
|
188
|
+
.prepare('SELECT payload FROM im_inputs WHERE scope_key=? AND request_id=? AND native_ref IS NULL')
|
|
189
|
+
.get(scope, requestId);
|
|
190
|
+
if (!row)
|
|
191
|
+
return;
|
|
192
|
+
if (retainBody) {
|
|
193
|
+
this.storage.db
|
|
194
|
+
.prepare('UPDATE im_inputs SET native_ref=? WHERE scope_key=? AND request_id=?')
|
|
195
|
+
.run(nativeRef, scope, requestId);
|
|
196
|
+
return;
|
|
197
|
+
}
|
|
198
|
+
const original = JSON.parse(String(row.payload));
|
|
199
|
+
const { text, ...identity } = original;
|
|
200
|
+
const digest = createHash('sha256').update(text).digest('hex');
|
|
201
|
+
this.storage.db
|
|
202
|
+
.prepare('UPDATE im_inputs SET native_ref=?,payload=? WHERE scope_key=? AND request_id=? AND native_ref IS NULL')
|
|
203
|
+
.run(nativeRef, canonicalBotJson({ ...identity, textDigest: digest }), scope, requestId);
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
/** 原调用只读回查不依赖 SDK 在线;digest 始终约束同一请求身份。 */
|
|
207
|
+
lookupCall(scope, id, digest) {
|
|
208
|
+
const old = this.storage.db
|
|
209
|
+
.prepare('SELECT digest,result FROM im_sdk_calls WHERE scope_key=? AND request_id=?')
|
|
210
|
+
.get(scope, id);
|
|
211
|
+
if (!old)
|
|
212
|
+
return null;
|
|
213
|
+
if (old.digest !== digest)
|
|
214
|
+
throw new Error('AGENTIM_CALL_CONFLICT');
|
|
215
|
+
return {
|
|
216
|
+
value: old.result === null
|
|
217
|
+
? { state: 'UNKNOWN', requestId: id, code: 'NATIVE_SDK_RESULT_UNCONFIRMED' }
|
|
218
|
+
: JSON.parse(String(old.result)),
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
/** 副作用之前提交最小 intent;未确认写只回原 UNKNOWN,不封停读或其它连接。 */
|
|
222
|
+
reserveCall(scope, id, digest) {
|
|
223
|
+
return this.storage.transaction(() => {
|
|
224
|
+
const old = this.lookupCall(scope, id, digest);
|
|
225
|
+
if (old)
|
|
226
|
+
return old;
|
|
227
|
+
this.storage.db
|
|
228
|
+
.prepare('INSERT INTO im_sdk_calls(scope_key,request_id,digest) VALUES(?,?,?)')
|
|
229
|
+
.run(scope, id, digest);
|
|
230
|
+
return null;
|
|
231
|
+
});
|
|
232
|
+
}
|
|
233
|
+
callResult(scope, id, result) {
|
|
234
|
+
this.storage.db
|
|
235
|
+
.prepare('UPDATE im_sdk_calls SET result=? WHERE scope_key=? AND request_id=?')
|
|
236
|
+
.run(JSON.stringify(result), scope, id);
|
|
237
|
+
}
|
|
238
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { botId, canonicalBotJson } from '@agent-stack/contracts';
|
|
2
|
+
import { botTargetScratchIdentity } from './target-scratch.js';
|
|
3
|
+
/** 人工会话与探针共用原目录 inode 核对原语,不伪造普通 Native 动作身份。 */
|
|
4
|
+
export class ComputerScratchJournal {
|
|
5
|
+
db;
|
|
6
|
+
transact;
|
|
7
|
+
constructor(db, transact) {
|
|
8
|
+
this.db = db;
|
|
9
|
+
this.transact = transact;
|
|
10
|
+
}
|
|
11
|
+
initialize() {
|
|
12
|
+
this.db.exec("CREATE TABLE IF NOT EXISTS target_computer_scratch(scope_id TEXT PRIMARY KEY,identity_json TEXT NOT NULL,phase TEXT NOT NULL CHECK(phase IN('ACTIVE','STAGED','REVIEW')))");
|
|
13
|
+
}
|
|
14
|
+
register(scopeId, identity) {
|
|
15
|
+
const id = botId(scopeId), frozen = canonicalBotJson(botTargetScratchIdentity(identity));
|
|
16
|
+
this.transact(() => {
|
|
17
|
+
const old = this.db
|
|
18
|
+
.prepare('SELECT identity_json FROM target_computer_scratch WHERE scope_id=?')
|
|
19
|
+
.get(id);
|
|
20
|
+
if (old && old.identity_json !== frozen)
|
|
21
|
+
throw new Error('BOT_COMPUTER_SCRATCH_CONFLICT');
|
|
22
|
+
if (Number(this.db.prepare('SELECT count(*) n FROM target_computer_scratch').get()?.n) >= 4096)
|
|
23
|
+
throw new Error('BOT_COMPUTER_SCRATCH_CAPACITY');
|
|
24
|
+
this.db
|
|
25
|
+
.prepare("INSERT OR IGNORE INTO target_computer_scratch(scope_id,identity_json,phase) VALUES(?,?,'ACTIVE')")
|
|
26
|
+
.run(id, frozen);
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
pending() {
|
|
30
|
+
return this.db
|
|
31
|
+
.prepare('SELECT * FROM target_computer_scratch ORDER BY scope_id')
|
|
32
|
+
.all()
|
|
33
|
+
.map((row) => ({
|
|
34
|
+
scopeId: botId(row.scope_id),
|
|
35
|
+
identity: botTargetScratchIdentity(JSON.parse(String(row.identity_json))),
|
|
36
|
+
phase: row.phase,
|
|
37
|
+
}));
|
|
38
|
+
}
|
|
39
|
+
phase(scopeId, phase) {
|
|
40
|
+
this.transact(() => {
|
|
41
|
+
this.db
|
|
42
|
+
.prepare("UPDATE target_computer_scratch SET phase=? WHERE scope_id=? AND phase<>'REVIEW'")
|
|
43
|
+
.run(phase, botId(scopeId));
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
removed(scopeId) {
|
|
47
|
+
this.transact(() => {
|
|
48
|
+
const old = this.db
|
|
49
|
+
.prepare('SELECT phase FROM target_computer_scratch WHERE scope_id=?')
|
|
50
|
+
.get(botId(scopeId));
|
|
51
|
+
if (old?.phase !== 'STAGED')
|
|
52
|
+
throw new Error('BOT_COMPUTER_SCRATCH_NOT_STAGED');
|
|
53
|
+
this.db.prepare('DELETE FROM target_computer_scratch WHERE scope_id=?').run(scopeId);
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
}
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
import { ComputerScratchJournal } from './computer-scratch.js';
|
|
2
|
+
import { canonicalBotJson, botComputerPhysicalReceipt, botComputerProcessProof, } from '@agent-stack/contracts';
|
|
3
|
+
/** 只持久化原机器身份和回证,输入正文及画面字节始终不进入目标账本。 */
|
|
4
|
+
export class TargetComputerJournal {
|
|
5
|
+
db;
|
|
6
|
+
transact;
|
|
7
|
+
targetId;
|
|
8
|
+
capacity;
|
|
9
|
+
scratch;
|
|
10
|
+
constructor(db, transact, targetId, capacity) {
|
|
11
|
+
this.db = db;
|
|
12
|
+
this.transact = transact;
|
|
13
|
+
this.targetId = targetId;
|
|
14
|
+
this.capacity = capacity;
|
|
15
|
+
this.scratch = new ComputerScratchJournal(db, transact);
|
|
16
|
+
}
|
|
17
|
+
initialize() {
|
|
18
|
+
this.scratch.initialize();
|
|
19
|
+
this.db.exec(`CREATE TABLE IF NOT EXISTS target_computer_commands(
|
|
20
|
+
command_id TEXT PRIMARY KEY, parameters_digest TEXT NOT NULL, metadata_json TEXT NOT NULL,
|
|
21
|
+
process_json TEXT, crossed INTEGER NOT NULL DEFAULT 0 CHECK(crossed IN(0,1)), effect_sequence INTEGER NOT NULL DEFAULT 0,
|
|
22
|
+
receipt_json TEXT, receipt_source TEXT NOT NULL DEFAULT 'LOCAL' CHECK(receipt_source IN('LOCAL','BRIDGE')),
|
|
23
|
+
reported INTEGER NOT NULL DEFAULT 0 CHECK(reported IN(0,1)), created_at_ms INTEGER NOT NULL
|
|
24
|
+
);
|
|
25
|
+
CREATE TABLE IF NOT EXISTS target_computer_input_state(
|
|
26
|
+
singleton INTEGER PRIMARY KEY CHECK(singleton=1), crossed_sequence INTEGER NOT NULL,
|
|
27
|
+
stopped_sequence INTEGER NOT NULL
|
|
28
|
+
);
|
|
29
|
+
INSERT OR IGNORE INTO target_computer_input_state VALUES(1,0,0);`);
|
|
30
|
+
}
|
|
31
|
+
read(id) {
|
|
32
|
+
const row = this.db
|
|
33
|
+
.prepare('SELECT * FROM target_computer_commands WHERE command_id=?')
|
|
34
|
+
.get(id);
|
|
35
|
+
if (!row)
|
|
36
|
+
return null;
|
|
37
|
+
const metadata = JSON.parse(String(row.metadata_json));
|
|
38
|
+
return {
|
|
39
|
+
...metadata,
|
|
40
|
+
process: row.process_json === null
|
|
41
|
+
? null
|
|
42
|
+
: botComputerProcessProof(JSON.parse(String(row.process_json))),
|
|
43
|
+
crossed: row.crossed === 1,
|
|
44
|
+
receipt: row.receipt_json === null
|
|
45
|
+
? null
|
|
46
|
+
: botComputerPhysicalReceipt(JSON.parse(String(row.receipt_json))),
|
|
47
|
+
reported: row.reported === 1,
|
|
48
|
+
receiptSource: row.receipt_source === 'BRIDGE' ? 'BRIDGE' : 'LOCAL',
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
prepare(command, session) {
|
|
52
|
+
if (command.targetId !== this.targetId ||
|
|
53
|
+
session.targetId !== this.targetId ||
|
|
54
|
+
command.sessionId !== session.sessionId ||
|
|
55
|
+
command.generation !== session.generation)
|
|
56
|
+
throw new Error('BOT_COMPUTER_JOURNAL_IDENTITY');
|
|
57
|
+
return this.transact(() => {
|
|
58
|
+
const old = this.read(command.commandId);
|
|
59
|
+
if (old) {
|
|
60
|
+
if (old.command.parametersDigest !== command.parametersDigest)
|
|
61
|
+
throw new Error('BOT_COMPUTER_JOURNAL_CONFLICT');
|
|
62
|
+
return old;
|
|
63
|
+
}
|
|
64
|
+
this.db
|
|
65
|
+
.prepare('DELETE FROM target_computer_commands WHERE command_id IN(SELECT command_id FROM target_computer_commands WHERE reported=1 ORDER BY created_at_ms LIMIT max(0,(SELECT count(*) FROM target_computer_commands)-?+1))')
|
|
66
|
+
.run(this.capacity);
|
|
67
|
+
if (Number(this.db.prepare('SELECT count(*) n FROM target_computer_commands').get()?.n) >=
|
|
68
|
+
this.capacity)
|
|
69
|
+
throw new Error('BOT_COMPUTER_JOURNAL_CAPACITY');
|
|
70
|
+
this.db
|
|
71
|
+
.prepare('INSERT INTO target_computer_commands(command_id,parameters_digest,metadata_json,created_at_ms) VALUES(?,?,?,?)')
|
|
72
|
+
.run(command.commandId, command.parametersDigest, canonicalBotJson({ command, session }), Date.now());
|
|
73
|
+
return this.read(command.commandId);
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
process(id, raw) {
|
|
77
|
+
const proof = botComputerProcessProof(raw);
|
|
78
|
+
return this.transact(() => {
|
|
79
|
+
const old = this.required(id);
|
|
80
|
+
if (old.receipt ||
|
|
81
|
+
old.crossed ||
|
|
82
|
+
(old.process && canonicalBotJson(old.process) !== canonicalBotJson(proof)))
|
|
83
|
+
throw new Error('BOT_COMPUTER_JOURNAL_CONFLICT');
|
|
84
|
+
this.db
|
|
85
|
+
.prepare('UPDATE target_computer_commands SET process_json=? WHERE command_id=?')
|
|
86
|
+
.run(canonicalBotJson(proof), id);
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
cross(id) {
|
|
90
|
+
return this.transact(() => {
|
|
91
|
+
const old = this.required(id);
|
|
92
|
+
if (old.receipt || old.crossed || !old.process)
|
|
93
|
+
throw new Error('BOT_COMPUTER_JOURNAL_ALREADY_CROSSED');
|
|
94
|
+
this.db.exec('UPDATE target_computer_input_state SET crossed_sequence=crossed_sequence+1');
|
|
95
|
+
this.db
|
|
96
|
+
.prepare('UPDATE target_computer_commands SET crossed=1,effect_sequence=(SELECT crossed_sequence FROM target_computer_input_state) WHERE command_id=?')
|
|
97
|
+
.run(id);
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
/** 原交回尚未准入时可替换已退出的准备进程,固定停止动作不会重放业务输入。 */
|
|
101
|
+
prepareRecoveredStop(id, proof) {
|
|
102
|
+
const current = botComputerProcessProof(proof);
|
|
103
|
+
this.transact(() => {
|
|
104
|
+
const old = this.required(id);
|
|
105
|
+
if (!['RETURN', 'EXPIRE'].includes(old.command.kind) || old.crossed || old.receipt)
|
|
106
|
+
throw new Error('BOT_COMPUTER_JOURNAL_CONFLICT');
|
|
107
|
+
this.db
|
|
108
|
+
.prepare('UPDATE target_computer_commands SET process_json=? WHERE command_id=?')
|
|
109
|
+
.run(canonicalBotJson(current), id);
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
finish(raw) {
|
|
113
|
+
const receipt = botComputerPhysicalReceipt(raw);
|
|
114
|
+
return this.transact(() => {
|
|
115
|
+
const old = this.required(receipt.commandId), command = old.command;
|
|
116
|
+
if (receipt.targetId !== this.targetId ||
|
|
117
|
+
receipt.sessionId !== command.sessionId ||
|
|
118
|
+
receipt.generation !== command.generation ||
|
|
119
|
+
receipt.parametersDigest !== command.parametersDigest ||
|
|
120
|
+
(old.process &&
|
|
121
|
+
canonicalBotJson(old.process) !== canonicalBotJson(receipt.platformExtension)) ||
|
|
122
|
+
(old.receipt && canonicalBotJson(old.receipt) !== canonicalBotJson(receipt)))
|
|
123
|
+
throw new Error('BOT_COMPUTER_JOURNAL_CONFLICT');
|
|
124
|
+
if (receipt.state === 'APPLIED' && !old.crossed)
|
|
125
|
+
throw new Error('BOT_COMPUTER_JOURNAL_BOUNDARY_REQUIRED');
|
|
126
|
+
this.db
|
|
127
|
+
.prepare('UPDATE target_computer_commands SET receipt_json=? WHERE command_id=?')
|
|
128
|
+
.run(canonicalBotJson(receipt), receipt.commandId);
|
|
129
|
+
if (receipt.inputsStopped)
|
|
130
|
+
this.db
|
|
131
|
+
.prepare('UPDATE target_computer_input_state SET stopped_sequence=max(stopped_sequence,(SELECT effect_sequence FROM target_computer_commands WHERE command_id=?))')
|
|
132
|
+
.run(receipt.commandId);
|
|
133
|
+
return receipt;
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
acknowledge(receipt) {
|
|
137
|
+
this.transact(() => {
|
|
138
|
+
if (canonicalBotJson(this.required(receipt.commandId).receipt) !== canonicalBotJson(receipt))
|
|
139
|
+
throw new Error('BOT_COMPUTER_JOURNAL_CONFLICT');
|
|
140
|
+
this.db
|
|
141
|
+
.prepare('UPDATE target_computer_commands SET reported=1 WHERE command_id=?')
|
|
142
|
+
.run(receipt.commandId);
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
/** 正式原回证可补回本地旧快照,保留 Bridge 来源且不伪造本地跨闸门事实。 */
|
|
146
|
+
reconcileRemote(raw) {
|
|
147
|
+
const receipt = botComputerPhysicalReceipt(raw);
|
|
148
|
+
this.transact(() => {
|
|
149
|
+
const old = this.required(receipt.commandId), command = old.command;
|
|
150
|
+
if (receipt.targetId !== this.targetId ||
|
|
151
|
+
receipt.sessionId !== command.sessionId ||
|
|
152
|
+
receipt.generation !== command.generation ||
|
|
153
|
+
receipt.parametersDigest !== command.parametersDigest ||
|
|
154
|
+
(old.receipt && canonicalBotJson(old.receipt) !== canonicalBotJson(receipt)))
|
|
155
|
+
throw new Error('BOT_COMPUTER_JOURNAL_CONFLICT');
|
|
156
|
+
this.db
|
|
157
|
+
.prepare('UPDATE target_computer_commands SET receipt_json=?,receipt_source=?,reported=1 WHERE command_id=?')
|
|
158
|
+
.run(canonicalBotJson(receipt), old.receipt ? old.receiptSource : 'BRIDGE', receipt.commandId);
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
pending() {
|
|
162
|
+
return this.db
|
|
163
|
+
.prepare('SELECT command_id FROM target_computer_commands WHERE reported=0 ORDER BY created_at_ms,command_id')
|
|
164
|
+
.all()
|
|
165
|
+
.map((row) => this.required(String(row.command_id)));
|
|
166
|
+
}
|
|
167
|
+
/** 清理水位独立于不可变旧回证,后续已证实的物理释放覆盖先前未知输入。 */
|
|
168
|
+
inputsStopped() {
|
|
169
|
+
this.transact(() => this.db.exec('UPDATE target_computer_input_state SET stopped_sequence=crossed_sequence'));
|
|
170
|
+
}
|
|
171
|
+
/** 冷启动断网仍核对尚未被物理清理覆盖的跨界事实。 */
|
|
172
|
+
needsInputReset() {
|
|
173
|
+
return Boolean(this.db
|
|
174
|
+
.prepare('SELECT 1 FROM target_computer_input_state WHERE crossed_sequence>stopped_sequence')
|
|
175
|
+
.get());
|
|
176
|
+
}
|
|
177
|
+
required(id) {
|
|
178
|
+
const row = this.read(id);
|
|
179
|
+
if (!row)
|
|
180
|
+
throw new Error('BOT_COMPUTER_JOURNAL_NOT_FOUND');
|
|
181
|
+
return row;
|
|
182
|
+
}
|
|
183
|
+
}
|