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,30 @@
|
|
|
1
|
+
import { AdapterError } from "../errors.js";
|
|
2
|
+
/** Aborting a local wait does not prove that a remote side effect was cancelled. */
|
|
3
|
+
export async function bounded(operation, signal, timeoutMs) {
|
|
4
|
+
if (!Number.isSafeInteger(timeoutMs) || timeoutMs < 1 || timeoutMs > 86400000)
|
|
5
|
+
throw new AdapterError("INVALID_OPERATION_BUDGET");
|
|
6
|
+
signal.throwIfAborted();
|
|
7
|
+
const controller = new AbortController();
|
|
8
|
+
const combined = AbortSignal.any([signal, controller.signal]);
|
|
9
|
+
let rejectBudget;
|
|
10
|
+
const expired = new Promise((_resolve, reject) => { rejectBudget = reject; });
|
|
11
|
+
const cancelled = () => rejectBudget?.(new AdapterError(signal.aborted ? "ADAPTER_STOPPED" : "ADAPTER_TIMEOUT", !signal.aborted));
|
|
12
|
+
combined.addEventListener("abort", cancelled, { once: true });
|
|
13
|
+
const timer = setTimeout(() => controller.abort(), timeoutMs);
|
|
14
|
+
try {
|
|
15
|
+
return await Promise.race([Promise.resolve().then(() => operation(combined)), expired]);
|
|
16
|
+
}
|
|
17
|
+
finally {
|
|
18
|
+
clearTimeout(timer);
|
|
19
|
+
combined.removeEventListener("abort", cancelled);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
export function delay(ms, signal) {
|
|
23
|
+
if (signal.aborted)
|
|
24
|
+
return Promise.resolve();
|
|
25
|
+
return new Promise(resolve => {
|
|
26
|
+
const done = () => { clearTimeout(timer); signal.removeEventListener("abort", done); resolve(); };
|
|
27
|
+
const timer = setTimeout(done, ms);
|
|
28
|
+
signal.addEventListener("abort", done, { once: true });
|
|
29
|
+
});
|
|
30
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { snapshotBinding, verifyAuthority } from "../authority/binding.js";
|
|
2
|
+
import { AdapterError } from "../errors.js";
|
|
3
|
+
import { bounded } from "../lifecycle/budget.js";
|
|
4
|
+
/** Read the original intent only. Missing/uncertain results never authorize another send. */
|
|
5
|
+
export async function readCommunicationReceipt(options) {
|
|
6
|
+
options = { ...options, binding: snapshotBinding(options.binding) };
|
|
7
|
+
const signal = options.signal ?? new AbortController().signal;
|
|
8
|
+
if (!/^[A-Za-z0-9._:-]{1,128}$/.test(options.requestId) || !options.binding.rooms.includes(options.roomId))
|
|
9
|
+
throw new AdapterError("RECEIPT_SCOPE_DENIED");
|
|
10
|
+
return bounded(async (signal) => {
|
|
11
|
+
await verifyAuthority(options.client, options.binding, options.authority, signal);
|
|
12
|
+
const item = await options.client.outbox.get(options.requestId, { signal });
|
|
13
|
+
if (item.request_id !== options.requestId || item.room_id !== options.roomId
|
|
14
|
+
|| (options.inputEventId !== undefined && item.input_event_id !== options.inputEventId))
|
|
15
|
+
throw new AdapterError("RECEIPT_REFERENCE_MISMATCH");
|
|
16
|
+
if (item.state === "sent" && !item.event_id)
|
|
17
|
+
throw new AdapterError("SENT_EVENT_ID_MISSING");
|
|
18
|
+
await verifyAuthority(options.client, options.binding, options.authority, signal);
|
|
19
|
+
return { identity: { ...options.binding.identity }, requestId: item.request_id, roomId: item.room_id,
|
|
20
|
+
txnId: item.txn_id, eventId: item.event_id, inputEventId: item.input_event_id, state: item.state,
|
|
21
|
+
errorCode: item.error_code, observedAtMs: Date.now(), homeserverAcceptance: item.state === "sent" ? "confirmed" : "unconfirmed",
|
|
22
|
+
recipientRead: "unknown", businessCompleted: "not_reported" };
|
|
23
|
+
}, signal, options.timeoutMs ?? 15000);
|
|
24
|
+
}
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
import { stringifyAgentIMJSON } from "@agentims/sdk";
|
|
3
|
+
import { sameIdentity, snapshotBinding, verifyAuthority } from "../authority/binding.js";
|
|
4
|
+
import { AdapterError, failure } from "../errors.js";
|
|
5
|
+
import { bounded, delay } from "../lifecycle/budget.js";
|
|
6
|
+
export class EventSource {
|
|
7
|
+
options;
|
|
8
|
+
controller = new AbortController();
|
|
9
|
+
signal;
|
|
10
|
+
busy = false;
|
|
11
|
+
loop;
|
|
12
|
+
retryAfterMs = 0;
|
|
13
|
+
current;
|
|
14
|
+
constructor(options) {
|
|
15
|
+
this.options = options;
|
|
16
|
+
this.options = { ...options, binding: snapshotBinding(options.binding) };
|
|
17
|
+
this.current = { bindingId: this.options.binding.bindingId, bindingRevision: this.options.binding.revision,
|
|
18
|
+
state: "starting", code: null, observedAtMs: Date.now(), checkpoint: null, highWatermark: null,
|
|
19
|
+
sinkState: "not_observed", sinkObservedAtMs: null, handler: "not_reported" };
|
|
20
|
+
if (!Number.isSafeInteger(options.pollMs ?? 1000) || (options.pollMs ?? 1000) < 100 || (options.pollMs ?? 1000) > 60000
|
|
21
|
+
|| !Number.isSafeInteger(options.timeoutMs ?? 15000) || (options.timeoutMs ?? 15000) < 100 || (options.timeoutMs ?? 15000) > 60000) {
|
|
22
|
+
throw new AdapterError("INVALID_ADAPTER_BUDGET");
|
|
23
|
+
}
|
|
24
|
+
this.signal = AbortSignal.any([this.controller.signal, ...(options.signal ? [options.signal] : [])]);
|
|
25
|
+
}
|
|
26
|
+
status() { return { ...this.current }; }
|
|
27
|
+
report(state, code) {
|
|
28
|
+
this.current = { ...this.current, state, code, observedAtMs: Date.now() };
|
|
29
|
+
try {
|
|
30
|
+
this.options.reportState?.(this.status());
|
|
31
|
+
}
|
|
32
|
+
catch {
|
|
33
|
+
this.current = { ...this.current, state: "held", code: "STATE_REPORT_FAILED" };
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
async tick() {
|
|
37
|
+
if (this.busy)
|
|
38
|
+
throw new AdapterError("ADAPTER_SOURCE_BUSY");
|
|
39
|
+
if (this.current.state === "held")
|
|
40
|
+
throw new AdapterError(this.current.code ?? "ADAPTER_HELD");
|
|
41
|
+
this.signal.throwIfAborted();
|
|
42
|
+
this.busy = true;
|
|
43
|
+
try {
|
|
44
|
+
await bounded(signal => this.readAndCommit(signal), this.signal, this.options.timeoutMs ?? 15000);
|
|
45
|
+
this.signal.throwIfAborted();
|
|
46
|
+
this.report("ready", null);
|
|
47
|
+
}
|
|
48
|
+
catch (error) {
|
|
49
|
+
const problem = failure(error);
|
|
50
|
+
this.retryAfterMs = problem.retryAfterMs;
|
|
51
|
+
this.report(this.signal.aborted ? "stopped" : problem.retryable ? "retry_wait" : "held", problem.code);
|
|
52
|
+
throw problem;
|
|
53
|
+
}
|
|
54
|
+
finally {
|
|
55
|
+
this.busy = false;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
async readAndCommit(signal) {
|
|
59
|
+
const { client, binding, authority, sink } = this.options;
|
|
60
|
+
await verifyAuthority(client, binding, authority, signal);
|
|
61
|
+
const info = await client.timeline.streamInfo({ signal });
|
|
62
|
+
if (!sameIdentity(info.identity, binding.identity))
|
|
63
|
+
throw new AdapterError("ADAPTER_STREAM_IDENTITY_MISMATCH");
|
|
64
|
+
const from = await this.options.loadCheckpoint(signal) ?? this.options.initialCheckpoint;
|
|
65
|
+
if (!from)
|
|
66
|
+
throw new AdapterError("EXPLICIT_START_CHECKPOINT_REQUIRED");
|
|
67
|
+
this.current = { ...this.current, checkpoint: from };
|
|
68
|
+
const page = await client.timeline.changesPage({ checkpoint: from, limit: 32 }, { signal });
|
|
69
|
+
if (page.changes.length > 32)
|
|
70
|
+
throw new AdapterError("SOURCE_PAGE_EXCEEDS_REQUEST");
|
|
71
|
+
let previous = 0n;
|
|
72
|
+
const identities = new Set();
|
|
73
|
+
for (const change of page.changes) {
|
|
74
|
+
const cursor = BigInt(change.cursor);
|
|
75
|
+
if (cursor <= previous || cursor > BigInt(page.high_watermark) || identities.has(change.observation_id))
|
|
76
|
+
throw new AdapterError("UNVERIFIABLE_SOURCE_ORDER");
|
|
77
|
+
previous = cursor;
|
|
78
|
+
identities.add(change.observation_id);
|
|
79
|
+
}
|
|
80
|
+
if (page.changes.length && (page.next_checkpoint === from || page.has_more !== (previous < BigInt(page.high_watermark))))
|
|
81
|
+
throw new AdapterError("UNVERIFIABLE_SOURCE_PROGRESS");
|
|
82
|
+
this.current = { ...this.current, highWatermark: page.high_watermark };
|
|
83
|
+
if (!page.changes.length) {
|
|
84
|
+
if (page.next_checkpoint !== from || page.has_more)
|
|
85
|
+
throw new AdapterError("UNVERIFIABLE_EMPTY_PAGE");
|
|
86
|
+
this.current = { ...this.current, checkpoint: from };
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
const changes = page.changes.filter(item => binding.rooms.includes(item.room_id)
|
|
90
|
+
&& !(item.sender === binding.identity.user_id && ["message", "notice"].includes(item.kind)));
|
|
91
|
+
// Include excluded observation identities, so advancing over filtered material remains auditable.
|
|
92
|
+
const batchId = createHash("sha256").update(stringifyAgentIMJSON([
|
|
93
|
+
binding.bindingId, binding.revision, [...binding.rooms].sort(), from, page.next_checkpoint,
|
|
94
|
+
page.changes.map(item => [item.cursor, item.observation_id]),
|
|
95
|
+
])).digest("hex");
|
|
96
|
+
const batch = { batch_id: batchId, binding_id: binding.bindingId, binding_revision: binding.revision,
|
|
97
|
+
from_checkpoint: from, next_checkpoint: page.next_checkpoint,
|
|
98
|
+
observed: page.changes.map(item => ({ cursor: item.cursor, observation_id: item.observation_id })), changes };
|
|
99
|
+
await verifyAuthority(client, binding, authority, signal);
|
|
100
|
+
this.current = { ...this.current, sinkState: "uncertain", sinkObservedAtMs: Date.now() };
|
|
101
|
+
const found = await sink.lookup(batchId, signal);
|
|
102
|
+
let receipt;
|
|
103
|
+
if (found)
|
|
104
|
+
receipt = found;
|
|
105
|
+
else {
|
|
106
|
+
try {
|
|
107
|
+
receipt = await sink.commit(batch, signal);
|
|
108
|
+
}
|
|
109
|
+
catch {
|
|
110
|
+
signal.throwIfAborted();
|
|
111
|
+
await verifyAuthority(client, binding, authority, signal);
|
|
112
|
+
const observed = await sink.lookup(batchId, signal);
|
|
113
|
+
if (!observed)
|
|
114
|
+
throw new AdapterError("SINK_OUTCOME_UNRESOLVED", true);
|
|
115
|
+
receipt = observed;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
if (receipt.batch_id !== batchId || receipt.binding_id !== binding.bindingId
|
|
119
|
+
|| receipt.binding_revision !== binding.revision || receipt.checkpoint !== page.next_checkpoint) {
|
|
120
|
+
throw new AdapterError("SINK_RECEIPT_MISMATCH");
|
|
121
|
+
}
|
|
122
|
+
this.current = { ...this.current, sinkState: "confirmed", sinkObservedAtMs: Date.now() };
|
|
123
|
+
await verifyAuthority(client, binding, authority, signal);
|
|
124
|
+
this.current = { ...this.current, checkpoint: receipt.checkpoint };
|
|
125
|
+
}
|
|
126
|
+
start() {
|
|
127
|
+
if (this.loop)
|
|
128
|
+
throw new AdapterError("ADAPTER_ALREADY_STARTED");
|
|
129
|
+
this.loop = this.run();
|
|
130
|
+
return this;
|
|
131
|
+
}
|
|
132
|
+
async run() {
|
|
133
|
+
let failures = 0;
|
|
134
|
+
while (!this.signal.aborted) {
|
|
135
|
+
try {
|
|
136
|
+
await this.tick();
|
|
137
|
+
failures = 0;
|
|
138
|
+
}
|
|
139
|
+
catch {
|
|
140
|
+
if (this.current.state === "held" || this.signal.aborted)
|
|
141
|
+
break;
|
|
142
|
+
failures++;
|
|
143
|
+
}
|
|
144
|
+
await delay(failures ? Math.max(this.retryAfterMs, Math.min(30000, 1000 * 2 ** Math.min(failures - 1, 5))) : this.options.pollMs ?? 1000, this.signal);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
async stop() {
|
|
148
|
+
this.controller.abort();
|
|
149
|
+
await this.loop;
|
|
150
|
+
this.report("stopped", null);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
export function startEventSource(options) { return new EventSource(options).start(); }
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { snapshotBinding, verifyAuthority } from "../authority/binding.js";
|
|
2
|
+
import { AdapterError } from "../errors.js";
|
|
3
|
+
import { bounded } from "../lifecycle/budget.js";
|
|
4
|
+
export async function readAdapterStatus(options) {
|
|
5
|
+
const binding = snapshotBinding(options.binding);
|
|
6
|
+
const source = options.source ? { ...options.source } : undefined;
|
|
7
|
+
const handler = options.handler ? { ...options.handler } : undefined;
|
|
8
|
+
const sourceAge = options.sourceMaxAgeMs ?? 60000;
|
|
9
|
+
if (!Number.isSafeInteger(sourceAge) || sourceAge < 100 || sourceAge > 300000)
|
|
10
|
+
throw new AdapterError("INVALID_SOURCE_STATUS_TTL");
|
|
11
|
+
for (const report of [source, handler]) {
|
|
12
|
+
if (report && (report.bindingId !== binding.bindingId || report.bindingRevision !== binding.revision
|
|
13
|
+
|| !Number.isSafeInteger(report.observedAtMs) || report.observedAtMs < 0))
|
|
14
|
+
throw new AdapterError("STATUS_BINDING_MISMATCH");
|
|
15
|
+
}
|
|
16
|
+
if (handler && (!["ready", "busy", "unavailable"].includes(handler.state) || !Number.isSafeInteger(handler.ttlMs)
|
|
17
|
+
|| handler.ttlMs < 100 || handler.ttlMs > 300000))
|
|
18
|
+
throw new AdapterError("INVALID_HANDLER_HEALTH");
|
|
19
|
+
if (source && (!["not_observed", "confirmed", "uncertain"].includes(source.sinkState)
|
|
20
|
+
|| (source.sinkObservedAtMs !== null && (!Number.isSafeInteger(source.sinkObservedAtMs) || source.sinkObservedAtMs < 0))
|
|
21
|
+
|| (source.sinkState !== "not_observed" && source.sinkObservedAtMs === null)))
|
|
22
|
+
throw new AdapterError("INVALID_SINK_STATUS");
|
|
23
|
+
return bounded(async (signal) => {
|
|
24
|
+
const identity = await verifyAuthority(options.client, binding, options.authority, signal);
|
|
25
|
+
const reliability = await options.client.reliability.status({ signal });
|
|
26
|
+
await verifyAuthority(options.client, binding, options.authority, signal);
|
|
27
|
+
const now = Date.now();
|
|
28
|
+
const fresh = (timestamp, ttl) => timestamp <= now && now - timestamp <= ttl;
|
|
29
|
+
const sourceState = source ? (fresh(source.observedAtMs, sourceAge) ? source.state : "unknown") : "not_attached";
|
|
30
|
+
const sinkState = source ? (source.sinkState === "not_observed" ? "not_observed"
|
|
31
|
+
: fresh(source.sinkObservedAtMs, sourceAge) ? source.sinkState : "unknown") : "not_attached";
|
|
32
|
+
const handlerState = handler ? (fresh(handler.observedAtMs, handler.ttlMs) ? handler.state : "unknown") : "not_reported";
|
|
33
|
+
const online = identity.sync_state === "syncing";
|
|
34
|
+
return { bindingId: binding.bindingId, bindingRevision: binding.revision, observedAtMs: now,
|
|
35
|
+
communicationOnline: online, syncState: identity.sync_state, cryptoReady: identity.crypto_ready,
|
|
36
|
+
storeBindingValid: reliability.binding_valid, backpressure: reliability.backpressure,
|
|
37
|
+
pendingInputs: reliability.inbox_pending, pendingDecryption: reliability.pending_decryption,
|
|
38
|
+
pendingSends: reliability.outbox_pending, uncertainSends: reliability.outbox_uncertain,
|
|
39
|
+
historyIncompleteRooms: reliability.rooms.filter(room => room.state !== "caught_up").length,
|
|
40
|
+
sourceState, sourceCode: source?.code ?? null, sourceObservedAtMs: source?.observedAtMs ?? null,
|
|
41
|
+
sinkState, sinkObservedAtMs: source?.sinkObservedAtMs ?? null,
|
|
42
|
+
handlerState, handlerObservedAtMs: handler?.observedAtMs ?? null,
|
|
43
|
+
readyToProcess: online && identity.crypto_ready && reliability.binding_valid && !reliability.backpressure
|
|
44
|
+
&& sourceState === "ready" && sinkState === "confirmed" && handlerState === "ready" };
|
|
45
|
+
}, options.signal ?? new AbortController().signal, options.timeoutMs ?? 15000);
|
|
46
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { lstat } from "node:fs/promises";
|
|
2
|
+
import { stringifyAgentIMJSON } from "@agentims/sdk";
|
|
3
|
+
import { accountCredential } from "../configuration/account-credential.js";
|
|
4
|
+
import { createOnce, replacePrivate } from "../configuration/private-state.js";
|
|
5
|
+
import { bundledExecutable } from "../configuration/executable.js";
|
|
6
|
+
import { controlLease } from "../managed/lease.js";
|
|
7
|
+
import { AccountAccessError } from "./errors.js";
|
|
8
|
+
/** Bridge retained profiles that predate the daemon's configured external backup path. */
|
|
9
|
+
export async function saveVerifiedBackup(account, key, explicit, executable) {
|
|
10
|
+
if (key.homeserver !== account.homeserver || key.user_id.slice(1).split(":", 1)[0] !== account.agentId)
|
|
11
|
+
throw new Error("Native account backup identity differs; original files were preserved");
|
|
12
|
+
// The same kernel lock is used by AccountStore: no second, incompatible file lock protocol.
|
|
13
|
+
const release = await controlLease(executable ?? bundledExecutable(), account.credentialFile, "account");
|
|
14
|
+
try {
|
|
15
|
+
let saved;
|
|
16
|
+
try {
|
|
17
|
+
await lstat(account.credentialFile);
|
|
18
|
+
saved = await accountCredential(account.credentialFile);
|
|
19
|
+
}
|
|
20
|
+
catch (error) {
|
|
21
|
+
if (error.code !== "ENOENT")
|
|
22
|
+
throw error;
|
|
23
|
+
}
|
|
24
|
+
if (saved && (saved.homeserver !== key.homeserver || saved.user_id !== key.user_id))
|
|
25
|
+
throw new Error("Saved account backup belongs to another identity; it was preserved");
|
|
26
|
+
if (saved?.credential_id === key.credential_id && saved.credential_secret === key.credential_secret)
|
|
27
|
+
return;
|
|
28
|
+
if (saved && !explicit)
|
|
29
|
+
throw new AccountAccessError("ACCOUNT_CREDENTIAL_CONFLICT", "Saved account key differs; use explicit proof-verified replacement", "select_matching_account");
|
|
30
|
+
const bytes = stringifyAgentIMJSON(key) + "\n";
|
|
31
|
+
if (saved)
|
|
32
|
+
await replacePrivate(account.credentialFile, bytes);
|
|
33
|
+
else
|
|
34
|
+
await createOnce(account.credentialFile, bytes);
|
|
35
|
+
}
|
|
36
|
+
finally {
|
|
37
|
+
await release();
|
|
38
|
+
}
|
|
39
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { attachCommunicationFromEnv, communicationStatusFromEnv, stopCommunicationFromEnv } from "../lifecycle/communication.js";
|
|
2
|
+
import { selectAccount } from "./selection.js";
|
|
3
|
+
/** Attach without login, registration or a service manager requirement for foreground owners. */
|
|
4
|
+
export async function attachAgentAccount(options) {
|
|
5
|
+
const selected = await selectAccount(options, false, "operation");
|
|
6
|
+
const connection = await attachCommunicationFromEnv(selected.env);
|
|
7
|
+
return Object.freeze({ ...connection, account: selected.account });
|
|
8
|
+
}
|
|
9
|
+
export async function agentAccountStatus(options) {
|
|
10
|
+
return communicationStatusFromEnv((await selectAccount(options, false, "operation")).env);
|
|
11
|
+
}
|
|
12
|
+
export async function stopAgentAccount(options) {
|
|
13
|
+
await stopCommunicationFromEnv((await selectAccount(options, false, "operation")).env);
|
|
14
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { lstat } from "node:fs/promises";
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
import { managedDirectory } from "../managed/directory.js";
|
|
4
|
+
import { selectAccount } from "./selection.js";
|
|
5
|
+
import { AccountAccessError } from "./errors.js";
|
|
6
|
+
async function exists(path) {
|
|
7
|
+
try {
|
|
8
|
+
await lstat(path);
|
|
9
|
+
return true;
|
|
10
|
+
}
|
|
11
|
+
catch (error) {
|
|
12
|
+
if (error.code === "ENOENT")
|
|
13
|
+
return false;
|
|
14
|
+
throw error;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
/** Resolve only a known account. Explicit legacy profile/state selection keeps its meaning. */
|
|
18
|
+
export async function accountEnvironment(env, purpose = "operation") {
|
|
19
|
+
if (env.AGENTIM_STATE_DIR !== undefined || env.AGENTIM_PROFILE !== undefined || !env.AGENTIM_AGENT_ID)
|
|
20
|
+
return env;
|
|
21
|
+
const options = {
|
|
22
|
+
agentId: env.AGENTIM_AGENT_ID,
|
|
23
|
+
...(env.AGENTIM_NATIVE_SETTINGS_FILE ? { nativeSettingsFile: env.AGENTIM_NATIVE_SETTINGS_FILE } : {}),
|
|
24
|
+
...(env.AGENTIM_HOMESERVER_URL ? { homeserverUrl: env.AGENTIM_HOMESERVER_URL } : {}),
|
|
25
|
+
...(env.AGENTIM_SITE_URL ? { siteUrl: env.AGENTIM_SITE_URL } : {}),
|
|
26
|
+
...(env.AGENTIM_ACCOUNTS_DIR ? { accountsDirectory: env.AGENTIM_ACCOUNTS_DIR } : {}),
|
|
27
|
+
...(env.AGENTIM_DEVICES_DIR ? { devicesDirectory: env.AGENTIM_DEVICES_DIR } : {}),
|
|
28
|
+
};
|
|
29
|
+
const selected = await selectAccount(options, false, "operation");
|
|
30
|
+
if (!selected.credentialExists && !await exists(join(selected.account.stateDir, "homeserver.json")))
|
|
31
|
+
return env;
|
|
32
|
+
const legacy = managedDirectory(env);
|
|
33
|
+
if (await exists(join(legacy, "homeserver.json")))
|
|
34
|
+
throw new AccountAccessError("ACCOUNT_SELECTION_AMBIGUOUS", "Both an account vault and legacy profile exist; select --account or an explicit profile/state directory", "select_account_or_profile");
|
|
35
|
+
return { ...env, ...(purpose === "admission" ? await selectAccount(options) : selected).env };
|
|
36
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { saveVerifiedBackup } from "./backup.js";
|
|
2
|
+
import { assertDeviceBinding } from "../configuration/device-binding.js";
|
|
3
|
+
import { accountCredential } from "../configuration/account-credential.js";
|
|
4
|
+
import { attachCommunicationFromEnv } from "../lifecycle/communication.js";
|
|
5
|
+
import { openAccountMaintenance } from "../lifecycle/start.js";
|
|
6
|
+
import { prepareAccount, selectAccount } from "./selection.js";
|
|
7
|
+
/** Maintenance restores existing device authority, without submitting registration or login. */
|
|
8
|
+
async function maintain(options, replacement, action) {
|
|
9
|
+
const selected = await selectAccount(options, false, replacement ? "replacement" : "operation");
|
|
10
|
+
await prepareAccount(selected);
|
|
11
|
+
let connection;
|
|
12
|
+
try {
|
|
13
|
+
connection = await attachCommunicationFromEnv(selected.env);
|
|
14
|
+
}
|
|
15
|
+
catch (error) {
|
|
16
|
+
const code = error && typeof error === "object" && "code" in error ? error.code : undefined;
|
|
17
|
+
if (code !== "COMMUNICATION_STOPPED" && code !== "ENOENT")
|
|
18
|
+
throw error;
|
|
19
|
+
const { AGENTIM_CREDENTIAL_FILE: _credential, AGENTIM_AUTHORIZATION_FILE: _authorization, ...maintenance } = selected.env;
|
|
20
|
+
connection = await openAccountMaintenance(maintenance);
|
|
21
|
+
}
|
|
22
|
+
try {
|
|
23
|
+
const status = await connection.client.identity.status();
|
|
24
|
+
assertDeviceBinding(selected.env, status.user_id, selected.account.homeserver);
|
|
25
|
+
return await action(connection.client, selected.account);
|
|
26
|
+
}
|
|
27
|
+
finally {
|
|
28
|
+
await connection.close();
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
/** Server-proof-verified import replaces the selected vault key and preserves its device. */
|
|
32
|
+
export async function replaceAgentCredential(options) {
|
|
33
|
+
const imported = await accountCredential(options.credentialFile);
|
|
34
|
+
return maintain(options, true, async (client, account) => {
|
|
35
|
+
const result = await client.identity.replaceCredential({ credential_id: imported.credential_id,
|
|
36
|
+
credential_secret: imported.credential_secret, expected_user_id: imported.user_id });
|
|
37
|
+
await saveVerifiedBackup(account, imported, true, options.daemonPath);
|
|
38
|
+
const saved = await accountCredential(account.credentialFile);
|
|
39
|
+
if (saved.credential_id !== imported.credential_id || saved.credential_secret !== imported.credential_secret || result.user_id !== imported.user_id)
|
|
40
|
+
throw new Error("Replacement backup readback failed; device state was preserved");
|
|
41
|
+
return { ...account, credentialSaved: true, userId: result.user_id };
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
/** Recover/regenerate a portable backup using a retained native session, even when its key was revoked. */
|
|
45
|
+
export async function ensureAgentCredential(options) {
|
|
46
|
+
return maintain(options, false, async (client, account) => {
|
|
47
|
+
const result = await client.identity.ensureCredential();
|
|
48
|
+
const exported = await client.identity.exportCredential();
|
|
49
|
+
if (exported.credential_id !== result.credential_id || exported.user_id !== result.user_id)
|
|
50
|
+
throw new Error("Native credential changed during backup; retry with original state");
|
|
51
|
+
await saveVerifiedBackup(account, exported, false, options.daemonPath);
|
|
52
|
+
const saved = await accountCredential(account.credentialFile);
|
|
53
|
+
if (saved.credential_id !== result.credential_id || saved.user_id !== result.user_id)
|
|
54
|
+
throw new Error("Account backup readback failed; device state was preserved");
|
|
55
|
+
return { ...account, credentialSaved: true, userId: result.user_id };
|
|
56
|
+
});
|
|
57
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/** Bounded account-selection errors contain no caller-provided credential contents. */
|
|
2
|
+
export class AccountAccessError extends Error {
|
|
3
|
+
code;
|
|
4
|
+
nextAction;
|
|
5
|
+
exitCode;
|
|
6
|
+
name = "AccountAccessError";
|
|
7
|
+
constructor(code, message, nextAction, exitCode = 2) {
|
|
8
|
+
super(message);
|
|
9
|
+
this.code = code;
|
|
10
|
+
this.nextAction = nextAction;
|
|
11
|
+
this.exitCode = exitCode;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { startEmbeddedAgentFromEnv } from "../lifecycle/embedded.js";
|
|
2
|
+
import { startAgentFromEnv } from "../lifecycle/start.js";
|
|
3
|
+
import { waitForCommunication } from "../managed/connection.js";
|
|
4
|
+
import { connectAgentFromEnv } from "../managed/control.js";
|
|
5
|
+
import { prepareAccount, selectAccount } from "./selection.js";
|
|
6
|
+
import { selectPasswordAccount } from "./password.js";
|
|
7
|
+
/** Log in to an existing account; device state is selected automatically and registration is never a fallback. */
|
|
8
|
+
export async function loginAgentAccount(options) {
|
|
9
|
+
const mode = options.mode ?? "managed";
|
|
10
|
+
if (!["managed", "owned", "embedded"].includes(mode))
|
|
11
|
+
throw new Error("Choose managed, owned or embedded communication");
|
|
12
|
+
const password = "password" in options ? await selectPasswordAccount(options) : undefined;
|
|
13
|
+
const selection = password?.selection ?? await selectAccount(options);
|
|
14
|
+
await prepareAccount(selection, options.mode === "embedded");
|
|
15
|
+
let runtime;
|
|
16
|
+
if (mode === "embedded")
|
|
17
|
+
runtime = await startEmbeddedAgentFromEnv(selection.env, password?.authentication);
|
|
18
|
+
else if (mode === "owned")
|
|
19
|
+
runtime = await startAgentFromEnv({ ...selection.env, AGENTIM_FOREGROUND_CONNECTION: "1" }, password?.authentication);
|
|
20
|
+
else
|
|
21
|
+
runtime = await connectAgentFromEnv(selection.env, password?.authentication);
|
|
22
|
+
if (mode !== "managed") {
|
|
23
|
+
try {
|
|
24
|
+
await waitForCommunication(runtime.client);
|
|
25
|
+
}
|
|
26
|
+
catch (error) {
|
|
27
|
+
await runtime.close();
|
|
28
|
+
throw error;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return Object.freeze({ mode, account: selection.account, client: runtime.client, close: runtime.close });
|
|
32
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { validateLocalRequest } from "@agentims/sdk";
|
|
2
|
+
import { selectAccount } from "./selection.js";
|
|
3
|
+
import { AccountAccessError } from "./errors.js";
|
|
4
|
+
/** Select the same device namespace; a password is never converted to a portable key. */
|
|
5
|
+
export async function selectPasswordAccount(options) {
|
|
6
|
+
if (options.credentialFile)
|
|
7
|
+
throw new AccountAccessError("AUTH_METHOD_CONFLICT", "Choose password or account credential login", "select_one_auth_method");
|
|
8
|
+
const username = options.username ?? options.agentId;
|
|
9
|
+
if (!username)
|
|
10
|
+
throw new AccountAccessError("ACCOUNT_REQUIRED", "Password login requires a username or full Matrix user ID", "select_account");
|
|
11
|
+
const authentication = { username, password: options.password };
|
|
12
|
+
validateLocalRequest("loginWithPassword", { body: authentication });
|
|
13
|
+
const agentId = username.startsWith("@") ? username.slice(1).split(":", 1)[0] : username;
|
|
14
|
+
if (options.username && options.agentId && options.agentId !== agentId && options.agentId !== username)
|
|
15
|
+
throw new AccountAccessError("ACCOUNT_IDENTITY_MISMATCH", "Username differs from the selected account", "select_matching_account");
|
|
16
|
+
const selection = await selectAccount({ ...options, agentId }, false, "password");
|
|
17
|
+
return { selection, authentication };
|
|
18
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { startEmbeddedAgentFromEnv } from "../lifecycle/embedded.js";
|
|
2
|
+
import { accountCredential } from "../configuration/account-credential.js";
|
|
3
|
+
import { waitForCommunication } from "../managed/connection.js";
|
|
4
|
+
import { startAgentFromEnv } from "../lifecycle/start.js";
|
|
5
|
+
import { prepareAccount, selectAccount } from "./selection.js";
|
|
6
|
+
/** Register/resume an account, durably save portable authority, then close this owned device. */
|
|
7
|
+
export async function registerAgentAccount(options) {
|
|
8
|
+
if (options.mode !== undefined && !["owned", "embedded"].includes(options.mode))
|
|
9
|
+
throw new Error("Choose owned or embedded registration");
|
|
10
|
+
const selection = await selectAccount(options, true);
|
|
11
|
+
await prepareAccount(selection, options.mode === "embedded");
|
|
12
|
+
const runtime = options.mode === "embedded" ? await startEmbeddedAgentFromEnv(selection.env) : await startAgentFromEnv(selection.env);
|
|
13
|
+
try {
|
|
14
|
+
// A retried registration may restore a native session before confirming its bootstrap.
|
|
15
|
+
if (selection.credentialExists)
|
|
16
|
+
await runtime.client.identity.registerPublic({ localpart: options.agentId });
|
|
17
|
+
await waitForCommunication(runtime.client);
|
|
18
|
+
const identity = await runtime.client.identity.status();
|
|
19
|
+
const saved = await accountCredential(selection.account.credentialFile);
|
|
20
|
+
const exported = await runtime.client.identity.exportCredential();
|
|
21
|
+
if (saved.user_id !== identity.user_id || saved.credential_id !== exported.credential_id || saved.credential_secret !== exported.credential_secret)
|
|
22
|
+
throw new Error("Portable account credential verification failed; preserve the private files");
|
|
23
|
+
if (!identity.user_id || !identity.device_id)
|
|
24
|
+
throw new Error("Account did not finish registration");
|
|
25
|
+
return { ...selection.account, userId: identity.user_id, deviceId: identity.device_id, credentialSaved: true, communication: "stopped" };
|
|
26
|
+
}
|
|
27
|
+
finally {
|
|
28
|
+
await runtime.close();
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
import { homedir } from "node:os";
|
|
3
|
+
import { dirname, join, resolve } from "node:path";
|
|
4
|
+
import { lstat } from "node:fs/promises";
|
|
5
|
+
import { AgentIMClient, stringifyAgentIMJSON, validateLocalRequest } from "@agentims/sdk";
|
|
6
|
+
import { accountCredential } from "../configuration/account-credential.js";
|
|
7
|
+
import { origin, serviceOrigin } from "../configuration/service-origin.js";
|
|
8
|
+
import { createOnce, directory } from "../configuration/private-state.js";
|
|
9
|
+
import { assertRuntimeNode } from "../configuration/node-version.js";
|
|
10
|
+
import { bundledExecutable } from "../configuration/executable.js";
|
|
11
|
+
import { AccountAccessError } from "./errors.js";
|
|
12
|
+
function baseDirectory(kind) {
|
|
13
|
+
const base = process.platform === "darwin" ? join(homedir(), "Library/Application Support/AgentIM")
|
|
14
|
+
: process.platform === "win32" ? join(process.env.LOCALAPPDATA ?? join(homedir(), "AppData/Local"), "AgentIM")
|
|
15
|
+
: join(kind === "accounts" ? process.env.XDG_CONFIG_HOME ?? join(homedir(), ".config") : process.env.XDG_STATE_HOME ?? join(homedir(), ".local/state"), "agentim");
|
|
16
|
+
return join(base, kind);
|
|
17
|
+
}
|
|
18
|
+
async function exists(path) {
|
|
19
|
+
try {
|
|
20
|
+
await lstat(path);
|
|
21
|
+
return true;
|
|
22
|
+
}
|
|
23
|
+
catch (error) {
|
|
24
|
+
if (error.code === "ENOENT")
|
|
25
|
+
return false;
|
|
26
|
+
throw error;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
function same(left, right) {
|
|
30
|
+
return left.homeserver === right.homeserver && left.user_id === right.user_id && left.credential_id === right.credential_id && left.credential_secret === right.credential_secret;
|
|
31
|
+
}
|
|
32
|
+
const missing = () => new AccountAccessError("ACCOUNT_CREDENTIAL_REQUIRED", "No saved account credential; register explicitly or import its private file", "import_credential_or_register");
|
|
33
|
+
const conflict = () => new AccountAccessError("ACCOUNT_CREDENTIAL_CONFLICT", "Imported credential differs from the saved account credential; the saved file was preserved", "select_matching_account");
|
|
34
|
+
/** Select/import account authority independently of any browser or named device profile. */
|
|
35
|
+
export async function selectAccount(options, registration = false, purpose = "admission") {
|
|
36
|
+
const imported = options.credentialFile ? await accountCredential(resolve(options.credentialFile)) : undefined;
|
|
37
|
+
const home = await serviceOrigin(options.homeserverUrl ?? (!options.siteUrl ? imported?.homeserver : undefined), options.siteUrl);
|
|
38
|
+
if (imported && origin(imported.homeserver) !== home)
|
|
39
|
+
throw new AccountAccessError("ACCOUNT_SERVICE_MISMATCH", "Account credential belongs to another service", "select_matching_service");
|
|
40
|
+
const expectedUser = options.agentId?.startsWith("@") ? options.agentId : undefined;
|
|
41
|
+
if (expectedUser && !/^@[^:\s]+:[^\s]+$/.test(expectedUser))
|
|
42
|
+
throw new AccountAccessError("ACCOUNT_REQUIRED", "Invalid Matrix user ID", "select_account");
|
|
43
|
+
const agentId = expectedUser ? expectedUser.slice(1).split(":", 1)[0] : options.agentId ?? imported?.user_id.slice(1).split(":", 1)[0];
|
|
44
|
+
if (!agentId)
|
|
45
|
+
throw new AccountAccessError("ACCOUNT_REQUIRED", "Provide an Agent ID or a portable account credential file", "select_account");
|
|
46
|
+
if (purpose === "password" || purpose === "operation") {
|
|
47
|
+
if (!/^[^@:\s]{1,255}$/.test(agentId))
|
|
48
|
+
throw new AccountAccessError("ACCOUNT_REQUIRED", "Use a local username or full Matrix user ID", "select_account");
|
|
49
|
+
}
|
|
50
|
+
else
|
|
51
|
+
validateLocalRequest("registerPublicAgentIdentity", { body: { localpart: agentId } });
|
|
52
|
+
const key = createHash("sha256").update(home + "\0" + agentId).digest("hex");
|
|
53
|
+
const credentialFile = join(resolve(options.accountsDirectory ?? baseDirectory("accounts")), key + ".json");
|
|
54
|
+
const credentialExists = await exists(credentialFile);
|
|
55
|
+
const saved = !["operation", "password"].includes(purpose) && credentialExists ? await accountCredential(credentialFile) : undefined;
|
|
56
|
+
const credential = imported ?? saved;
|
|
57
|
+
if (credential && (origin(credential.homeserver) !== home || credential.user_id.slice(1).split(":", 1)[0] !== agentId || expectedUser && credential.user_id !== expectedUser))
|
|
58
|
+
throw new AccountAccessError("ACCOUNT_IDENTITY_MISMATCH", "Account credential differs from the selected identity", "select_matching_account");
|
|
59
|
+
if (purpose !== "replacement" && imported && saved && !same(imported, saved))
|
|
60
|
+
throw conflict();
|
|
61
|
+
if (purpose === "admission" && !registration && !credential)
|
|
62
|
+
throw missing();
|
|
63
|
+
const stateDir = resolve(options.stateDir ?? join(options.devicesDirectory ?? baseDirectory("devices"), key));
|
|
64
|
+
return { account: { homeserver: home, agentId, credentialFile, stateDir }, credentialExists: !!credential || credentialExists,
|
|
65
|
+
...(purpose === "admission" && imported && !saved ? { importedCredential: imported } : {}),
|
|
66
|
+
env: { AGENTIM_HOMESERVER_URL: home, AGENTIM_AGENT_ID: agentId, AGENTIM_STATE_DIR: stateDir,
|
|
67
|
+
...(expectedUser ? { AGENTIM_EXPECTED_USER_ID: expectedUser } : {}),
|
|
68
|
+
...(purpose === "password" ? {} : { AGENTIM_CREDENTIAL_BACKUP: credentialFile, AGENTIM_VERIFY_ACCOUNT_CREDENTIAL: "1" }),
|
|
69
|
+
...(options.startupTimeoutMs === undefined ? {} : { AGENTIM_STARTUP_TIMEOUT_MS: String(options.startupTimeoutMs) }),
|
|
70
|
+
...(credential ? { AGENTIM_CREDENTIAL_FILE: credentialFile } : {}),
|
|
71
|
+
...(options.nativeSettingsFile ? { AGENTIM_NATIVE_SETTINGS_FILE: resolve(options.nativeSettingsFile) } : {}),
|
|
72
|
+
...(options.daemonPath ? { AGENTIM_DAEMON_BIN: options.daemonPath } : {}) } };
|
|
73
|
+
}
|
|
74
|
+
export async function prepareAccount(selection, embedded = false) {
|
|
75
|
+
assertRuntimeNode();
|
|
76
|
+
if (embedded)
|
|
77
|
+
await AgentIMClient.checkEmbeddedSupport();
|
|
78
|
+
else if (!selection.env.AGENTIM_DAEMON_BIN)
|
|
79
|
+
bundledExecutable();
|
|
80
|
+
await directory(dirname(selection.account.credentialFile));
|
|
81
|
+
await directory(selection.account.stateDir);
|
|
82
|
+
if (selection.importedCredential) {
|
|
83
|
+
try {
|
|
84
|
+
await createOnce(selection.account.credentialFile, stringifyAgentIMJSON(selection.importedCredential) + "\n");
|
|
85
|
+
}
|
|
86
|
+
catch (error) {
|
|
87
|
+
if (error.code !== "EEXIST")
|
|
88
|
+
throw error;
|
|
89
|
+
if (!same(await accountCredential(selection.account.credentialFile), selection.importedCredential))
|
|
90
|
+
throw conflict();
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { AccountAccessError } from "../accounts/errors.js";
|
|
2
|
+
/** Bind an admission to a selected account before the homeserver can create a device. */
|
|
3
|
+
export function assertAuthenticationIntent(operation, input, env) {
|
|
4
|
+
if (!["loginNativeMatrix", "registerNativeMatrix", "beginOAuthAuthorization", "beginQrAuthorization"].includes(operation)
|
|
5
|
+
|| !env.AGENTIM_AGENT_ID && !env.AGENTIM_EXPECTED_USER_ID)
|
|
6
|
+
return;
|
|
7
|
+
const body = input.body;
|
|
8
|
+
const user = body && typeof body === "object" && !Array.isArray(body) && "expected_user_id" in body ? body.expected_user_id : undefined;
|
|
9
|
+
if (typeof user !== "string")
|
|
10
|
+
throw new AccountAccessError("AUTH_EXPECTED_USER_REQUIRED", "A selected account requires an explicit expected_user_id before authorization", "bind_original_authorization_to_selected_account");
|
|
11
|
+
if (env.AGENTIM_EXPECTED_USER_ID && user !== env.AGENTIM_EXPECTED_USER_ID
|
|
12
|
+
|| env.AGENTIM_AGENT_ID && user.slice(1).split(":", 1)[0] !== env.AGENTIM_AGENT_ID) {
|
|
13
|
+
throw new AccountAccessError("ACCOUNT_IDENTITY_MISMATCH", "Authentication intent differs from the selected account; no authorization was submitted", "select_matching_account");
|
|
14
|
+
}
|
|
15
|
+
}
|