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,153 @@
|
|
|
1
|
+
/** 仅供 Bridge→Runtime 的可信绑定,不进入模型参数或公开 Widget 请求。 */
|
|
2
|
+
import { parseRuntimeOauthContext } from './oauth-context.js';
|
|
3
|
+
/** 非秘密 OAuth 复核描述符仍采用严格白名单,避免旁存夹带凭据或替代资源。 */
|
|
4
|
+
export function parseRuntimeSourceAuthorization(raw) {
|
|
5
|
+
if (!raw || typeof raw !== 'object' || Array.isArray(raw))
|
|
6
|
+
throw new Error('SOURCE_AUTHORIZATION_INVALID');
|
|
7
|
+
const fields = Object.getOwnPropertyDescriptors(raw);
|
|
8
|
+
const keys = Reflect.ownKeys(fields);
|
|
9
|
+
if (!keys.includes('kind') ||
|
|
10
|
+
!keys.includes('resource') ||
|
|
11
|
+
keys.some((key) => !['kind', 'resource', 'context'].includes(String(key))) ||
|
|
12
|
+
Object.values(fields).some((field) => !('value' in field) || !field.enumerable))
|
|
13
|
+
throw new Error('SOURCE_AUTHORIZATION_INVALID');
|
|
14
|
+
const value = raw;
|
|
15
|
+
if (value.kind !== 'tenant-service-oauth' ||
|
|
16
|
+
typeof value.resource !== 'string' ||
|
|
17
|
+
value.resource.length > 2048)
|
|
18
|
+
throw new Error('SOURCE_AUTHORIZATION_INVALID');
|
|
19
|
+
const url = new URL(value.resource);
|
|
20
|
+
if (url.protocol !== 'https:' ||
|
|
21
|
+
url.username ||
|
|
22
|
+
url.password ||
|
|
23
|
+
url.search ||
|
|
24
|
+
url.hash ||
|
|
25
|
+
url.href !== value.resource)
|
|
26
|
+
throw new Error('SOURCE_AUTHORIZATION_INVALID');
|
|
27
|
+
const context = parseRuntimeOauthContext(value.context);
|
|
28
|
+
return {
|
|
29
|
+
kind: 'tenant-service-oauth',
|
|
30
|
+
resource: value.resource,
|
|
31
|
+
...(context ? { context } : {}),
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
const parentKeys = [
|
|
35
|
+
'entry',
|
|
36
|
+
'tenantRef',
|
|
37
|
+
'workspaceRef',
|
|
38
|
+
'conversationRef',
|
|
39
|
+
'authorizationRef',
|
|
40
|
+
'grantRevision',
|
|
41
|
+
'purposeRef',
|
|
42
|
+
'audience',
|
|
43
|
+
'expiresAt',
|
|
44
|
+
'ephemeral',
|
|
45
|
+
];
|
|
46
|
+
/** 传输边界统一白名单;字段存在不代表调用者已经获得原入口权限。 */
|
|
47
|
+
function replyRecord(raw, keys) {
|
|
48
|
+
if (!raw ||
|
|
49
|
+
typeof raw !== 'object' ||
|
|
50
|
+
Array.isArray(raw) ||
|
|
51
|
+
Object.getPrototypeOf(raw) !== Object.prototype)
|
|
52
|
+
throw new Error('REPLY_CONTEXT_INVALID');
|
|
53
|
+
const fields = Object.getOwnPropertyDescriptors(raw);
|
|
54
|
+
if (Reflect.ownKeys(raw).length !== keys.length ||
|
|
55
|
+
keys.some((key) => !Object.hasOwn(fields, key)) ||
|
|
56
|
+
Object.values(fields).some((field) => !('value' in field) || !field.enumerable))
|
|
57
|
+
throw new Error('REPLY_CONTEXT_INVALID');
|
|
58
|
+
return raw;
|
|
59
|
+
}
|
|
60
|
+
function parentFields(row) {
|
|
61
|
+
for (const key of parentKeys.filter((key) => key !== 'expiresAt' && key !== 'ephemeral'))
|
|
62
|
+
if (typeof row[key] !== 'string' ||
|
|
63
|
+
!row[key] ||
|
|
64
|
+
new TextEncoder().encode(row[key]).length > 2048)
|
|
65
|
+
throw new Error('REPLY_CONTEXT_INVALID');
|
|
66
|
+
if (!['tenant', 'public', 'host', 'test'].includes(String(row.entry)) ||
|
|
67
|
+
!['tenant', 'public'].includes(String(row.audience)) ||
|
|
68
|
+
(row.entry === 'public' && row.audience !== 'public') ||
|
|
69
|
+
(['tenant', 'test'].includes(String(row.entry)) && row.audience !== 'tenant') ||
|
|
70
|
+
!Number.isSafeInteger(row.expiresAt) ||
|
|
71
|
+
Number(row.expiresAt) <= 0 ||
|
|
72
|
+
typeof row.ephemeral !== 'boolean')
|
|
73
|
+
throw new Error('REPLY_CONTEXT_INVALID');
|
|
74
|
+
return Object.fromEntries(parentKeys.map((key) => [key, row[key]]));
|
|
75
|
+
}
|
|
76
|
+
/** 同一解析器服务 Bridge 和 Runtime,拒绝未知合同、额外 scope、凭据和模型自称身份。 */
|
|
77
|
+
export function parseRuntimeReplyContext(raw) {
|
|
78
|
+
const row = replyRecord(raw, ['version', 'sources', ...parentKeys]);
|
|
79
|
+
if (row.version !== 1 || !Array.isArray(row.sources) || row.sources.length > 16)
|
|
80
|
+
throw new Error('REPLY_CONTEXT_INVALID');
|
|
81
|
+
const seen = new Set();
|
|
82
|
+
const sources = row.sources.map((raw) => {
|
|
83
|
+
if (!raw || typeof raw !== 'object')
|
|
84
|
+
throw new Error('REPLY_CONTEXT_INVALID');
|
|
85
|
+
const keys = Object.keys(raw);
|
|
86
|
+
if (keys.some((key) => ![
|
|
87
|
+
'contract',
|
|
88
|
+
'server',
|
|
89
|
+
'readTool',
|
|
90
|
+
'installationRef',
|
|
91
|
+
'grantRevision',
|
|
92
|
+
'audience',
|
|
93
|
+
'context',
|
|
94
|
+
'policy',
|
|
95
|
+
'authorization',
|
|
96
|
+
].includes(key)))
|
|
97
|
+
throw new Error('REPLY_CONTEXT_INVALID');
|
|
98
|
+
const value = replyRecord(raw, keys);
|
|
99
|
+
for (const key of ['server', 'readTool', 'installationRef', 'grantRevision'])
|
|
100
|
+
if (typeof value[key] !== 'string' || !value[key] || String(value[key]).length > 256)
|
|
101
|
+
throw new Error('REPLY_CONTEXT_INVALID');
|
|
102
|
+
if (!['builtin-knowledge-v1', 'resource-v2'].includes(String(value.contract)) ||
|
|
103
|
+
!['tenant', 'public'].includes(String(value.audience)))
|
|
104
|
+
throw new Error('SOURCE_CONTRACT_UNSUPPORTED');
|
|
105
|
+
const id = JSON.stringify([value.server, value.readTool]);
|
|
106
|
+
if (seen.has(id))
|
|
107
|
+
throw new Error('REPLY_CONTEXT_INVALID');
|
|
108
|
+
seen.add(id);
|
|
109
|
+
if (value.contract === 'builtin-knowledge-v1') {
|
|
110
|
+
if (value.context !== undefined ||
|
|
111
|
+
value.policy !== undefined ||
|
|
112
|
+
value.authorization !== undefined)
|
|
113
|
+
throw new Error('REPLY_CONTEXT_INVALID');
|
|
114
|
+
}
|
|
115
|
+
else {
|
|
116
|
+
if (!value.context || typeof value.context !== 'object' || Array.isArray(value.context))
|
|
117
|
+
throw new Error('REPLY_CONTEXT_INVALID');
|
|
118
|
+
const context = replyRecord(value.context, value.context.type === 'TENANT'
|
|
119
|
+
? ['type', 'tenantId', 'tenantRef']
|
|
120
|
+
: ['type', 'tenantId', 'projectKey', 'projectRef']);
|
|
121
|
+
if (Object.values(context).some((value) => typeof value !== 'string' || !value || value.length > 2048) ||
|
|
122
|
+
!['TENANT', 'PROJECT'].includes(String(context.type)) ||
|
|
123
|
+
(context.type === 'TENANT') !== (value.policy === 'TENANT_NATIVE') ||
|
|
124
|
+
!['TENANT_NATIVE', 'TENANT_PROJECT_SCOPE'].includes(String(value.policy)) ||
|
|
125
|
+
(context.type === 'TENANT'
|
|
126
|
+
? context.tenantRef !==
|
|
127
|
+
`knowledge-tenant://tenant/${encodeURIComponent(String(context.tenantId))}`
|
|
128
|
+
: context.projectRef !==
|
|
129
|
+
`knowledge-project://${String(context.projectKey)}/tenant/${encodeURIComponent(String(context.tenantId))}`))
|
|
130
|
+
throw new Error('REPLY_CONTEXT_INVALID');
|
|
131
|
+
if (value.authorization !== undefined)
|
|
132
|
+
parseRuntimeSourceAuthorization(value.authorization);
|
|
133
|
+
}
|
|
134
|
+
return structuredClone(value);
|
|
135
|
+
});
|
|
136
|
+
const context = { version: 1, ...parentFields(row), sources };
|
|
137
|
+
if (new TextEncoder().encode(JSON.stringify(context)).length > 16384)
|
|
138
|
+
throw new Error('REPLY_CONTEXT_INVALID');
|
|
139
|
+
return context;
|
|
140
|
+
}
|
|
141
|
+
/** Native 双引用只在可信服务边界使用;它们不出现在模型引用工具的参数中。 */
|
|
142
|
+
export function parseRuntimeReplyBinding(raw) {
|
|
143
|
+
const row = replyRecord(raw, [...parentKeys, 'requestRef', 'threadId', 'turnId']);
|
|
144
|
+
for (const key of ['requestRef', 'threadId', 'turnId'])
|
|
145
|
+
if (typeof row[key] !== 'string' || !row[key] || String(row[key]).length > 256)
|
|
146
|
+
throw new Error('REPLY_BINDING_INVALID');
|
|
147
|
+
return {
|
|
148
|
+
...parentFields(row),
|
|
149
|
+
requestRef: String(row.requestRef),
|
|
150
|
+
threadId: String(row.threadId),
|
|
151
|
+
turnId: String(row.turnId),
|
|
152
|
+
};
|
|
153
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/** 专用命令叶子只加载此零依赖子路径;名单与 Host 部署声明共用,不加载宽 Runtime。 */
|
|
2
|
+
export const TARGET_SESSION_ENV_NAMES = Object.freeze([
|
|
3
|
+
'DISPLAY',
|
|
4
|
+
'XAUTHORITY',
|
|
5
|
+
'XDG_RUNTIME_DIR',
|
|
6
|
+
'DBUS_SESSION_BUS_ADDRESS',
|
|
7
|
+
'AGENT_BROWSER_EXECUTABLE_PATH',
|
|
8
|
+
'AGENT_BROWSER_PROFILE',
|
|
9
|
+
'AGENT_BROWSER_SESSION',
|
|
10
|
+
'AGENT_BROWSER_SOCKET_DIR',
|
|
11
|
+
'AGENT_BROWSER_CDP',
|
|
12
|
+
'AGENT_BROWSER_AUTO_CONNECT',
|
|
13
|
+
'AGENT_BROWSER_HEADLESS',
|
|
14
|
+
'AGENTXGO_CUA_SOCKET',
|
|
15
|
+
'AGENTXGO_CHROME_PORT',
|
|
16
|
+
'AGENTXGO_COMPUTER_BROWSER',
|
|
17
|
+
'AGENTXGO_COMPUTER_DRIVER',
|
|
18
|
+
'AGENTXGO_COMPUTER_BROWSER_ARGS',
|
|
19
|
+
'CUA_DRIVER_RS_UPDATE_CHECK',
|
|
20
|
+
'CUA_DRIVER_RS_TELEMETRY_ENABLED',
|
|
21
|
+
]);
|
|
22
|
+
const names = new Set(TARGET_SESSION_ENV_NAMES);
|
|
23
|
+
/** 显式公共对象拒绝未知键与非法值,HOME/PATH/TMPDIR 等执行身份由各层单独固定。 */
|
|
24
|
+
export function targetSessionEnvironment(raw) {
|
|
25
|
+
if (raw === undefined)
|
|
26
|
+
return {};
|
|
27
|
+
if (!raw ||
|
|
28
|
+
typeof raw !== 'object' ||
|
|
29
|
+
Array.isArray(raw) ||
|
|
30
|
+
![Object.prototype, null].includes(Object.getPrototypeOf(raw)))
|
|
31
|
+
throw new Error('BOT_TARGET_SESSION_ENV_INVALID');
|
|
32
|
+
return Object.fromEntries(Object.entries(raw).map(([key, value]) => {
|
|
33
|
+
if (!names.has(key) ||
|
|
34
|
+
typeof value !== 'string' ||
|
|
35
|
+
!value.trim() ||
|
|
36
|
+
value.length > 4096 ||
|
|
37
|
+
/[\x00-\x1f\x7f]/.test(value))
|
|
38
|
+
throw new Error('BOT_TARGET_SESSION_ENV_INVALID');
|
|
39
|
+
return [key, value];
|
|
40
|
+
}));
|
|
41
|
+
}
|
|
42
|
+
/** 从已启动的任务环境仅摘取公共字段;监督/Provider 等其余变量绝不进入 Native。 */
|
|
43
|
+
export function selectTargetSessionEnvironment(environment) {
|
|
44
|
+
return targetSessionEnvironment(Object.fromEntries(TARGET_SESSION_ENV_NAMES.flatMap((key) => environment[key] === undefined ? [] : [[key, environment[key]]])));
|
|
45
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { parseTenantManagementDelegationBinding, } from '@agent-stack/contracts';
|
|
2
|
+
/** 模型选项的推理预算由平台冻结;缺省保留兼容,未知值不能回退宿主默认。 */
|
|
3
|
+
export const RUNTIME_REASONING_EFFORTS = [
|
|
4
|
+
'none',
|
|
5
|
+
'minimal',
|
|
6
|
+
'low',
|
|
7
|
+
'medium',
|
|
8
|
+
'high',
|
|
9
|
+
'xhigh',
|
|
10
|
+
'max',
|
|
11
|
+
'ultra',
|
|
12
|
+
];
|
|
13
|
+
export function parseRuntimeReasoningEffort(raw) {
|
|
14
|
+
if (raw === undefined)
|
|
15
|
+
return undefined;
|
|
16
|
+
if (typeof raw !== 'string' || !RUNTIME_REASONING_EFFORTS.some((value) => value === raw))
|
|
17
|
+
throw new TypeError('RUNTIME_REASONING_EFFORT_INVALID');
|
|
18
|
+
return raw;
|
|
19
|
+
}
|
|
20
|
+
/** 保持既有 Runtime 错误码,严格字段与引用校验由公共合同唯一维护。 */
|
|
21
|
+
export function parseRuntimeTenantManagementBinding(raw) {
|
|
22
|
+
try {
|
|
23
|
+
return parseTenantManagementDelegationBinding(raw);
|
|
24
|
+
}
|
|
25
|
+
catch {
|
|
26
|
+
throw new TypeError('RUNTIME_TENANT_MANAGEMENT_BINDING_INVALID');
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
export function parseRuntimeVersionTestBinding(raw) {
|
|
30
|
+
const invalid = () => {
|
|
31
|
+
throw new TypeError('RUNTIME_VERSION_TEST_BINDING_INVALID');
|
|
32
|
+
};
|
|
33
|
+
if (!raw ||
|
|
34
|
+
typeof raw !== 'object' ||
|
|
35
|
+
Array.isArray(raw) ||
|
|
36
|
+
(Object.getPrototypeOf(raw) !== Object.prototype && Object.getPrototypeOf(raw) !== null))
|
|
37
|
+
return invalid();
|
|
38
|
+
const fields = Object.getOwnPropertyDescriptors(raw);
|
|
39
|
+
const testRef = fields.testRef?.value;
|
|
40
|
+
if (Reflect.ownKeys(raw).length !== 2 ||
|
|
41
|
+
Object.values(fields).some((field) => !('value' in field) || !field.enumerable) ||
|
|
42
|
+
fields.schemaVersion?.value !== 1 ||
|
|
43
|
+
typeof testRef !== 'string' ||
|
|
44
|
+
!/^ttest_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/.test(testRef))
|
|
45
|
+
return invalid();
|
|
46
|
+
return Object.freeze({ schemaVersion: 1, testRef });
|
|
47
|
+
}
|
|
48
|
+
/** JSON 回执的文本预算保留显式截断标记,不从回答内容生成业务成功结论。 */
|
|
49
|
+
export function versionTestAnswer(messages) {
|
|
50
|
+
const answer = messages.join('\n');
|
|
51
|
+
let value = answer.slice(0, 32768);
|
|
52
|
+
while (new TextEncoder().encode(JSON.stringify(value)).byteLength > 98304)
|
|
53
|
+
value = value.slice(0, Math.floor(value.length / 2));
|
|
54
|
+
if (/[\uD800-\uDBFF]$/.test(value))
|
|
55
|
+
value = value.slice(0, -1);
|
|
56
|
+
return { modelAnswer: value, answerTruncated: value.length < answer.length };
|
|
57
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@agent-stack/runtime-contracts",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"private": true,
|
|
5
|
+
"type": "module",
|
|
6
|
+
"exports": {
|
|
7
|
+
".": "./dist/index.js",
|
|
8
|
+
"./target-environment": "./dist/target-environment.js"
|
|
9
|
+
},
|
|
10
|
+
"dependencies": {
|
|
11
|
+
"@agent-stack/contracts": "0.2.2"
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { AdapterError } from "../errors.js";
|
|
2
|
+
export function validateBinding(binding) {
|
|
3
|
+
if (!binding || !binding.identity || !Array.isArray(binding.rooms)
|
|
4
|
+
|| typeof binding.bindingId !== "string" || !/^[A-Za-z0-9._:-]{1,128}$/.test(binding.bindingId)
|
|
5
|
+
|| !Number.isSafeInteger(binding.revision) || binding.revision < 1
|
|
6
|
+
|| binding.rooms.length < 1 || binding.rooms.length > 128 || new Set(binding.rooms).size !== binding.rooms.length
|
|
7
|
+
|| binding.rooms.some(room => typeof room !== "string" || !room.startsWith("!") || room.length > 255)
|
|
8
|
+
|| typeof binding.identity.user_id !== "string" || !binding.identity.user_id.startsWith("@") || binding.identity.user_id.length > 255
|
|
9
|
+
|| typeof binding.identity.device_id !== "string" || !binding.identity.device_id || binding.identity.device_id.length > 255
|
|
10
|
+
|| typeof binding.identity.homeserver !== "string" || binding.identity.homeserver.length > 2048) {
|
|
11
|
+
throw new AdapterError("INVALID_ADAPTER_BINDING");
|
|
12
|
+
}
|
|
13
|
+
let home;
|
|
14
|
+
try {
|
|
15
|
+
home = new URL(binding.identity.homeserver);
|
|
16
|
+
}
|
|
17
|
+
catch {
|
|
18
|
+
throw new AdapterError("INVALID_ADAPTER_HOMESERVER");
|
|
19
|
+
}
|
|
20
|
+
if (!["https:", "http:"].includes(home.protocol) || home.username || home.password || home.hash || home.search) {
|
|
21
|
+
throw new AdapterError("INVALID_ADAPTER_HOMESERVER");
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
export function snapshotBinding(binding) {
|
|
25
|
+
validateBinding(binding);
|
|
26
|
+
return Object.freeze({ ...binding, identity: Object.freeze({ ...binding.identity }), rooms: Object.freeze([...binding.rooms]) });
|
|
27
|
+
}
|
|
28
|
+
export function sameIdentity(actual, expected) {
|
|
29
|
+
return actual.homeserver === expected.homeserver && actual.user_id === expected.user_id && actual.device_id === expected.device_id;
|
|
30
|
+
}
|
|
31
|
+
export async function verifyAuthority(client, binding, authority, signal) {
|
|
32
|
+
signal.throwIfAborted();
|
|
33
|
+
const identity = await client.identity.status({ signal });
|
|
34
|
+
if (identity.homeserver !== binding.identity.homeserver || identity.user_id !== binding.identity.user_id || identity.device_id !== binding.identity.device_id) {
|
|
35
|
+
throw new AdapterError("ADAPTER_IDENTITY_MISMATCH");
|
|
36
|
+
}
|
|
37
|
+
await authority(binding, signal);
|
|
38
|
+
signal.throwIfAborted();
|
|
39
|
+
return identity;
|
|
40
|
+
}
|
|
@@ -0,0 +1,202 @@
|
|
|
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 } from "../lifecycle/budget.js";
|
|
6
|
+
import { decisionHash, matchDecision, snapshotDecision } from "./decision.js";
|
|
7
|
+
import { validateOperation } from "./record.js";
|
|
8
|
+
/** Coordinates communication, never chooses a model, tool or new business task. */
|
|
9
|
+
export class DeliveryCoordinator {
|
|
10
|
+
options;
|
|
11
|
+
controller = new AbortController();
|
|
12
|
+
busy = false;
|
|
13
|
+
signal;
|
|
14
|
+
leaseSeconds;
|
|
15
|
+
timeoutMs;
|
|
16
|
+
constructor(options) {
|
|
17
|
+
this.options = options;
|
|
18
|
+
this.options = { ...options, binding: snapshotBinding(options.binding) };
|
|
19
|
+
this.leaseSeconds = options.leaseSeconds ?? 60;
|
|
20
|
+
this.timeoutMs = options.timeoutMs ?? 15000;
|
|
21
|
+
if (!Number.isSafeInteger(this.leaseSeconds) || this.leaseSeconds < 3 || this.leaseSeconds > 300
|
|
22
|
+
|| !Number.isSafeInteger(this.timeoutMs) || this.timeoutMs < 100 || this.timeoutMs > 60000
|
|
23
|
+
|| !Number.isSafeInteger(options.handlerTimeoutMs ?? 300000) || (options.handlerTimeoutMs ?? 300000) < 100 || (options.handlerTimeoutMs ?? 300000) > 86400000) {
|
|
24
|
+
throw new AdapterError("INVALID_DELIVERY_BUDGET");
|
|
25
|
+
}
|
|
26
|
+
this.signal = AbortSignal.any([this.controller.signal, ...(options.signal ? [options.signal] : [])]);
|
|
27
|
+
}
|
|
28
|
+
async io(operation, signal = this.signal) {
|
|
29
|
+
return bounded(operation, signal, this.timeoutMs);
|
|
30
|
+
}
|
|
31
|
+
async authorize(signal) {
|
|
32
|
+
await verifyAuthority(this.options.client, this.options.binding, this.options.authority, signal);
|
|
33
|
+
}
|
|
34
|
+
async status(input, signal) {
|
|
35
|
+
await this.authorize(signal);
|
|
36
|
+
const status = await this.options.client.deliveries.get(input.event_id, { signal });
|
|
37
|
+
if (status.event_id !== input.event_id || status.room_id !== input.room_id)
|
|
38
|
+
throw new AdapterError("DELIVERY_REFERENCE_MISMATCH");
|
|
39
|
+
await this.authorize(signal);
|
|
40
|
+
return status;
|
|
41
|
+
}
|
|
42
|
+
async process(input, handler) {
|
|
43
|
+
if (this.busy)
|
|
44
|
+
throw new AdapterError("DELIVERY_COORDINATOR_BUSY");
|
|
45
|
+
if (typeof input.room_id !== "string" || !this.options.binding.rooms.includes(input.room_id)
|
|
46
|
+
|| typeof input.event_id !== "string" || !input.event_id.startsWith("$") || input.event_id.length > 255)
|
|
47
|
+
throw new AdapterError("DELIVERY_SCOPE_DENIED");
|
|
48
|
+
const target = Object.freeze({ room_id: input.room_id, event_id: input.event_id });
|
|
49
|
+
this.signal.throwIfAborted();
|
|
50
|
+
this.busy = true;
|
|
51
|
+
try {
|
|
52
|
+
return await this.processOne(target, handler);
|
|
53
|
+
}
|
|
54
|
+
catch (error) {
|
|
55
|
+
throw failure(error);
|
|
56
|
+
}
|
|
57
|
+
finally {
|
|
58
|
+
this.busy = false;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
async processOne(input, handler) {
|
|
62
|
+
const { client, binding, operationStore } = this.options;
|
|
63
|
+
const key = createHash("sha256").update(stringifyAgentIMJSON([
|
|
64
|
+
binding.bindingId, binding.identity.homeserver, binding.identity.user_id, input.room_id, input.event_id,
|
|
65
|
+
])).digest("hex");
|
|
66
|
+
await this.io(signal => this.authorize(signal));
|
|
67
|
+
let record = await this.io(signal => operationStore.load(key, signal));
|
|
68
|
+
if (record)
|
|
69
|
+
validateOperation(record);
|
|
70
|
+
if (record && (record.version !== 1 || record.binding_id !== binding.bindingId || record.binding_revision !== binding.revision
|
|
71
|
+
|| !sameIdentity(record.identity, binding.identity) || record.room_id !== input.room_id || record.event_id !== input.event_id))
|
|
72
|
+
throw new AdapterError("STORED_DELIVERY_SCOPE_MISMATCH");
|
|
73
|
+
const current = await this.io(signal => this.status(input, signal));
|
|
74
|
+
if (current.state === "processed") {
|
|
75
|
+
if (record?.request_id && current.outbox?.request_id !== record.request_id)
|
|
76
|
+
throw new AdapterError("DELIVERY_DECISION_CONFLICT");
|
|
77
|
+
return { state: "processed", delivery: current, businessCompleted: "not_reported" };
|
|
78
|
+
}
|
|
79
|
+
if (["invalidated", "not_eligible"].includes(current.state))
|
|
80
|
+
return { state: "not_claimable", delivery: current, businessCompleted: "not_reported" };
|
|
81
|
+
if (record && ["running", "uncertain", "complete"].includes(record.phase) && !record.decision_hash && !this.options.resolveDecision) {
|
|
82
|
+
throw new AdapterError("HOST_RECONCILIATION_REQUIRED");
|
|
83
|
+
}
|
|
84
|
+
let decision;
|
|
85
|
+
if (record && record.phase !== "released") {
|
|
86
|
+
if (!this.options.resolveDecision)
|
|
87
|
+
throw new AdapterError("HOST_RESULT_RESOLVER_REQUIRED");
|
|
88
|
+
decision = await this.io(async (signal) => snapshotDecision(await this.options.resolveDecision(record, signal)));
|
|
89
|
+
if (record.decision_hash)
|
|
90
|
+
matchDecision(record, decision);
|
|
91
|
+
else
|
|
92
|
+
decisionHash(decision);
|
|
93
|
+
}
|
|
94
|
+
const claimed = await this.io(async (signal) => {
|
|
95
|
+
await this.authorize(signal);
|
|
96
|
+
return client.deliveries.claim({ worker_id: binding.bindingId, room_id: input.room_id, event_id: input.event_id, limit: 1, lease_seconds: this.leaseSeconds }, { signal });
|
|
97
|
+
});
|
|
98
|
+
const delivery = claimed.deliveries[0];
|
|
99
|
+
if (!delivery)
|
|
100
|
+
return { state: "not_claimable", delivery: await this.io(signal => this.status(input, signal)), businessCompleted: "not_reported" };
|
|
101
|
+
if (claimed.deliveries.length !== 1 || delivery.message.event_id !== input.event_id || delivery.message.room_id !== input.room_id)
|
|
102
|
+
throw new AdapterError("TARGETED_CLAIM_MISMATCH");
|
|
103
|
+
const save = async (next, signal) => {
|
|
104
|
+
const updated = { ...next, revision: (record?.revision ?? 0) + 1 };
|
|
105
|
+
if (!await operationStore.compareAndSet(key, record?.revision ?? null, updated, signal))
|
|
106
|
+
throw new AdapterError("DELIVERY_STORE_CONFLICT");
|
|
107
|
+
record = updated;
|
|
108
|
+
};
|
|
109
|
+
// SDK结果已核实后的索引只作有界旁路;失败保留原记录,不扣留结果或伪造CAS成功。
|
|
110
|
+
const indexKnownResult = (next) => {
|
|
111
|
+
void this.io(signal => save(next, signal)).catch(() => { });
|
|
112
|
+
};
|
|
113
|
+
await this.io(signal => save({ version: 1, binding_id: binding.bindingId, binding_revision: binding.revision,
|
|
114
|
+
identity: { ...binding.identity },
|
|
115
|
+
room_id: input.room_id, event_id: input.event_id, phase: decision ? "prepared" : "running",
|
|
116
|
+
lease_token: delivery.lease_token, lease_expires_at_ms: delivery.lease_expires_at_ms,
|
|
117
|
+
decision_hash: decision ? decisionHash(decision) : null, action: decision?.action ?? null,
|
|
118
|
+
request_id: decision && "requestId" in decision ? decision.requestId : null, result_ref: decision?.resultRef ?? null }, signal));
|
|
119
|
+
const leaseController = new AbortController();
|
|
120
|
+
const leaseSignal = AbortSignal.any([this.signal, leaseController.signal]);
|
|
121
|
+
let timer;
|
|
122
|
+
let renewing = Promise.resolve();
|
|
123
|
+
let renewalStopped = false;
|
|
124
|
+
const schedule = () => {
|
|
125
|
+
if (renewalStopped || leaseSignal.aborted)
|
|
126
|
+
return;
|
|
127
|
+
timer = setTimeout(() => {
|
|
128
|
+
renewing = this.io(async (signal) => {
|
|
129
|
+
await this.authorize(signal);
|
|
130
|
+
const renewed = await client.deliveries.renew(input.event_id, { lease_token: delivery.lease_token, lease_seconds: this.leaseSeconds }, { signal });
|
|
131
|
+
if (renewed.event_id !== input.event_id || renewed.state !== "leased" || renewed.lease_expires_at_ms === null)
|
|
132
|
+
throw new AdapterError("DELIVERY_LEASE_LOST");
|
|
133
|
+
await save({ ...record, lease_expires_at_ms: renewed.lease_expires_at_ms }, signal);
|
|
134
|
+
}, leaseSignal).then(schedule).catch(() => { leaseController.abort(new AdapterError("DELIVERY_LEASE_LOST")); });
|
|
135
|
+
}, Math.max(100, this.leaseSeconds * 1000 / 3));
|
|
136
|
+
};
|
|
137
|
+
const stopRenewal = async () => { renewalStopped = true; clearTimeout(timer); await renewing; };
|
|
138
|
+
schedule();
|
|
139
|
+
try {
|
|
140
|
+
if (!decision) {
|
|
141
|
+
const effective = await this.io(signal => client.timeline.event(input.room_id, input.event_id, { signal }), leaseSignal);
|
|
142
|
+
if (!effective.complete || !effective.effective.decrypted || effective.effective.redacted) {
|
|
143
|
+
await stopRenewal();
|
|
144
|
+
await this.io(async (signal) => {
|
|
145
|
+
await this.authorize(signal);
|
|
146
|
+
await client.deliveries.release(input.event_id, { lease_token: delivery.lease_token }, { signal });
|
|
147
|
+
}, leaseSignal);
|
|
148
|
+
const result = await this.io(signal => this.status(input, signal), leaseSignal);
|
|
149
|
+
indexKnownResult({ ...record, phase: "released", action: "release", result_ref: "agentim:input-not-effective" });
|
|
150
|
+
return { state: "not_claimable", delivery: result, businessCompleted: "not_reported" };
|
|
151
|
+
}
|
|
152
|
+
for (const event of [effective.original, effective.effective]) {
|
|
153
|
+
if (event.room_id !== input.room_id || event.event_id !== input.event_id || event.sender !== delivery.message.sender)
|
|
154
|
+
throw new AdapterError("EFFECTIVE_INPUT_MISMATCH");
|
|
155
|
+
}
|
|
156
|
+
await this.io(signal => this.authorize(signal), leaseSignal);
|
|
157
|
+
decision = await bounded(async (signal) => snapshotDecision(await handler({ input, effective, operationKey: key, signal })), leaseSignal, this.options.handlerTimeoutMs ?? 300000);
|
|
158
|
+
}
|
|
159
|
+
await stopRenewal();
|
|
160
|
+
leaseSignal.throwIfAborted();
|
|
161
|
+
const frozen = decision;
|
|
162
|
+
await this.io(async (signal) => {
|
|
163
|
+
await this.authorize(signal);
|
|
164
|
+
await save({ ...record, phase: "prepared", decision_hash: decisionHash(frozen), action: frozen.action,
|
|
165
|
+
request_id: "requestId" in frozen ? frozen.requestId : null, result_ref: frozen.resultRef }, signal);
|
|
166
|
+
}, leaseSignal);
|
|
167
|
+
await this.io(async (signal) => {
|
|
168
|
+
await this.authorize(signal);
|
|
169
|
+
const token = { lease_token: delivery.lease_token };
|
|
170
|
+
if (frozen.action === "reply")
|
|
171
|
+
await client.deliveries.reply(input.event_id, { ...token, request_id: frozen.requestId, body: frozen.body, ...(frozen.mentionUserIds ? { mention_user_ids: frozen.mentionUserIds } : {}) }, { signal });
|
|
172
|
+
else if (frozen.action === "reply_file")
|
|
173
|
+
await client.deliveries.replyFile(input.event_id, { ...token, request_id: frozen.requestId, filename: frozen.filename, mime_type: frozen.mimeType, data_base64: frozen.dataBase64 }, { signal });
|
|
174
|
+
else if (frozen.action === "ack")
|
|
175
|
+
await client.deliveries.ack(input.event_id, token, { signal });
|
|
176
|
+
else
|
|
177
|
+
await client.deliveries.release(input.event_id, token, { signal });
|
|
178
|
+
}, leaseSignal);
|
|
179
|
+
const result = await this.io(signal => this.status(input, signal), leaseSignal);
|
|
180
|
+
if (frozen.action !== "release" && (result.state !== "processed" || ("requestId" in frozen && result.outbox?.request_id !== frozen.requestId)))
|
|
181
|
+
throw new AdapterError("DELIVERY_RESULT_UNRESOLVED");
|
|
182
|
+
indexKnownResult({ ...record, phase: frozen.action === "release" ? "released" : "complete" });
|
|
183
|
+
return { state: frozen.action === "release" ? "released" : "processed", delivery: result, businessCompleted: "not_reported" };
|
|
184
|
+
}
|
|
185
|
+
catch (error) {
|
|
186
|
+
await stopRenewal();
|
|
187
|
+
// A frozen result stays prepared for readback, never invokes the handler a second time.
|
|
188
|
+
if (record && !record.decision_hash && !this.signal.aborted) {
|
|
189
|
+
try {
|
|
190
|
+
await this.io(signal => save({ ...record, phase: "uncertain" }, signal));
|
|
191
|
+
}
|
|
192
|
+
catch { /* Original private record is retained. */ }
|
|
193
|
+
}
|
|
194
|
+
throw error;
|
|
195
|
+
}
|
|
196
|
+
finally {
|
|
197
|
+
await stopRenewal();
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
stop() { this.controller.abort(); }
|
|
201
|
+
}
|
|
202
|
+
export function createDeliveryCoordinator(options) { return new DeliveryCoordinator(options); }
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
import { stringifyAgentIMJSON } from "@agentims/sdk";
|
|
3
|
+
import { AdapterError } from "../errors.js";
|
|
4
|
+
/** Copy before an await so a caller cannot mutate the intent after it is hashed. */
|
|
5
|
+
export function snapshotDecision(decision) {
|
|
6
|
+
decisionHash(decision);
|
|
7
|
+
if (decision.action === "reply")
|
|
8
|
+
return Object.freeze({ action: decision.action, resultRef: decision.resultRef,
|
|
9
|
+
requestId: decision.requestId, body: decision.body,
|
|
10
|
+
...(decision.mentionUserIds ? { mentionUserIds: Object.freeze([...decision.mentionUserIds]) } : {}) });
|
|
11
|
+
if (decision.action === "reply_file")
|
|
12
|
+
return Object.freeze({ action: decision.action, resultRef: decision.resultRef,
|
|
13
|
+
requestId: decision.requestId, filename: decision.filename, mimeType: decision.mimeType, dataBase64: decision.dataBase64 });
|
|
14
|
+
if (decision.action === "release")
|
|
15
|
+
return Object.freeze({ action: decision.action, resultRef: decision.resultRef, effectsClear: true });
|
|
16
|
+
return Object.freeze({ action: decision.action, resultRef: decision.resultRef });
|
|
17
|
+
}
|
|
18
|
+
export function decisionHash(decision) {
|
|
19
|
+
if (!decision || !["ack", "release", "reply", "reply_file"].includes(decision.action))
|
|
20
|
+
throw new AdapterError("INVALID_HOST_DECISION");
|
|
21
|
+
if (typeof decision.resultRef !== "string")
|
|
22
|
+
throw new AdapterError("HOST_RESULT_REFERENCE_REQUIRED");
|
|
23
|
+
if (!decision.resultRef || decision.resultRef.length > 2048)
|
|
24
|
+
throw new AdapterError("HOST_RESULT_REFERENCE_REQUIRED");
|
|
25
|
+
if (["reply", "reply_file"].includes(decision.action)
|
|
26
|
+
&& (!("requestId" in decision) || typeof decision.requestId !== "string" || !/^[A-Za-z0-9._:-]{1,128}$/.test(decision.requestId))) {
|
|
27
|
+
throw new AdapterError("STABLE_REPLY_REQUEST_ID_REQUIRED");
|
|
28
|
+
}
|
|
29
|
+
if (decision.action === "release" && decision.effectsClear !== true)
|
|
30
|
+
throw new AdapterError("HOST_EFFECTS_NOT_CLEAR");
|
|
31
|
+
if (decision.action === "reply" && (typeof decision.body !== "string" || decision.body.length > 16000
|
|
32
|
+
|| (decision.mentionUserIds !== undefined && (!Array.isArray(decision.mentionUserIds) || decision.mentionUserIds.length > 100
|
|
33
|
+
|| decision.mentionUserIds.some(id => typeof id !== "string" || !id.startsWith("@") || id.length > 255)))))
|
|
34
|
+
throw new AdapterError("INVALID_REPLY_DECISION");
|
|
35
|
+
if (decision.action === "reply_file" && (typeof decision.filename !== "string" || !decision.filename || decision.filename.length > 255
|
|
36
|
+
|| typeof decision.mimeType !== "string" || !decision.mimeType || decision.mimeType.length > 255
|
|
37
|
+
|| typeof decision.dataBase64 !== "string" || decision.dataBase64.length > 6990508))
|
|
38
|
+
throw new AdapterError("INVALID_FILE_DECISION");
|
|
39
|
+
// Canonical, fixed-order tuples keep a caller's JS property ordering out of intent identity.
|
|
40
|
+
const intent = decision.action === "reply"
|
|
41
|
+
? [decision.action, decision.resultRef, decision.requestId, decision.body, decision.mentionUserIds ?? []]
|
|
42
|
+
: decision.action === "reply_file"
|
|
43
|
+
? [decision.action, decision.resultRef, decision.requestId, decision.filename, decision.mimeType, decision.dataBase64]
|
|
44
|
+
: [decision.action, decision.resultRef];
|
|
45
|
+
return createHash("sha256").update(stringifyAgentIMJSON(intent)).digest("hex");
|
|
46
|
+
}
|
|
47
|
+
export function matchDecision(record, decision) {
|
|
48
|
+
if (record.decision_hash !== decisionHash(decision) || record.action !== decision.action || record.result_ref !== decision.resultRef) {
|
|
49
|
+
throw new AdapterError("FROZEN_HOST_DECISION_MISMATCH");
|
|
50
|
+
}
|
|
51
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { AdapterError } from "../errors.js";
|
|
2
|
+
/** Reject corrupted or foreign persistence before deciding whether a handler may run. */
|
|
3
|
+
export function validateOperation(record) {
|
|
4
|
+
const expires = record.lease_expires_at_ms;
|
|
5
|
+
const validExpiry = typeof expires === "bigint"
|
|
6
|
+
? expires >= 0n && expires <= 9223372036854775807n
|
|
7
|
+
: typeof expires === "number" && Number.isSafeInteger(expires) && expires >= 0;
|
|
8
|
+
if (record.version !== 1 || !Number.isSafeInteger(record.revision) || record.revision < 1
|
|
9
|
+
|| !record.identity || typeof record.identity.homeserver !== "string" || typeof record.identity.user_id !== "string" || typeof record.identity.device_id !== "string"
|
|
10
|
+
|| !Number.isSafeInteger(record.binding_revision) || record.binding_revision < 1
|
|
11
|
+
|| !["running", "prepared", "complete", "released", "uncertain"].includes(record.phase)
|
|
12
|
+
|| typeof record.lease_token !== "string" || !record.lease_token || record.lease_token.length > 255 || !validExpiry
|
|
13
|
+
|| (record.decision_hash !== null && (typeof record.decision_hash !== "string" || !/^[a-f0-9]{64}$/.test(record.decision_hash)))
|
|
14
|
+
|| (record.action !== null && !["ack", "release", "reply", "reply_file"].includes(record.action))
|
|
15
|
+
|| (record.request_id !== null && (typeof record.request_id !== "string" || !/^[A-Za-z0-9._:-]{1,128}$/.test(record.request_id)))
|
|
16
|
+
|| (record.result_ref !== null && (typeof record.result_ref !== "string" || !record.result_ref || record.result_ref.length > 2048))) {
|
|
17
|
+
throw new AdapterError("INVALID_STORED_OPERATION");
|
|
18
|
+
}
|
|
19
|
+
if (["prepared", "complete"].includes(record.phase) && (!record.decision_hash || !record.action || !record.result_ref))
|
|
20
|
+
throw new AdapterError("INCOMPLETE_STORED_DECISION");
|
|
21
|
+
if (record.decision_hash && ((["reply", "reply_file"].includes(record.action ?? "") && !record.request_id)
|
|
22
|
+
|| !record.result_ref))
|
|
23
|
+
throw new AdapterError("INCOMPLETE_STORED_DECISION");
|
|
24
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { TransportError } from "@agentims/sdk";
|
|
2
|
+
export class AdapterError extends Error {
|
|
3
|
+
name = "AdapterError";
|
|
4
|
+
code;
|
|
5
|
+
retryable;
|
|
6
|
+
retryAfterMs;
|
|
7
|
+
constructor(code, retryable = false, retryAfterMs = 0) {
|
|
8
|
+
const safeCode = typeof code === "string" && /^[A-Za-z0-9_]{1,128}$/.test(code) ? code : "ADAPTER_OPERATION_FAILED";
|
|
9
|
+
super(safeCode);
|
|
10
|
+
this.code = safeCode;
|
|
11
|
+
const validWait = Number.isSafeInteger(retryAfterMs) && retryAfterMs >= 0 && retryAfterMs <= 2147483647;
|
|
12
|
+
this.retryable = retryable === true && validWait;
|
|
13
|
+
this.retryAfterMs = validWait ? retryAfterMs : 0;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
export function failure(error) {
|
|
17
|
+
if (error instanceof AdapterError)
|
|
18
|
+
return error;
|
|
19
|
+
// Runtime bundles its own SDK copy; instanceof alone cannot identify its errors.
|
|
20
|
+
const remote = remoteParts(error);
|
|
21
|
+
if (remote) {
|
|
22
|
+
if (remote.status === 404)
|
|
23
|
+
return new AdapterError("CAPABILITY_OR_RESOURCE_UNAVAILABLE");
|
|
24
|
+
const code = /^[A-Za-z0-9_]{1,128}$/.test(remote.code) ? remote.code : "REMOTE_FAILURE";
|
|
25
|
+
if (typeof remote.wait !== "number" || !Number.isSafeInteger(remote.wait) || remote.wait < 0 || remote.wait > 2147483647)
|
|
26
|
+
return new AdapterError("INVALID_RETRY_AFTER");
|
|
27
|
+
return new AdapterError(code, remote.status === 429 || remote.status === 502 || remote.status === 503, remote.wait);
|
|
28
|
+
}
|
|
29
|
+
if (error instanceof TransportError || (error instanceof Error && ["TransportError", "RequestTimeoutError"].includes(error.name)))
|
|
30
|
+
return new AdapterError("COMMUNICATION_UNAVAILABLE", true);
|
|
31
|
+
return new AdapterError("ADAPTER_OPERATION_FAILED");
|
|
32
|
+
}
|
|
33
|
+
function remoteParts(error) {
|
|
34
|
+
if (!(error instanceof Error) || !("status" in error) || !("code" in error) || !("diagnostics" in error))
|
|
35
|
+
return null;
|
|
36
|
+
const status = error.status, code = error.code, diagnostics = error.diagnostics;
|
|
37
|
+
if (typeof status !== "number" || typeof code !== "string" || typeof diagnostics !== "object" || diagnostics === null)
|
|
38
|
+
return null;
|
|
39
|
+
return { status, code, wait: "retryAfterMs" in diagnostics ? diagnostics.retryAfterMs : 0 };
|
|
40
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { AdapterError } from "./errors.js";
|
|
2
|
+
export { EventSource, startEventSource } from "./source/event-source.js";
|
|
3
|
+
export { DeliveryCoordinator, createDeliveryCoordinator } from "./delivery/coordinator.js";
|
|
4
|
+
export { readCommunicationReceipt } from "./receipts/send.js";
|
|
5
|
+
export { readAdapterStatus } from "./status/adapter-status.js";
|