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,66 @@
|
|
|
1
|
+
import { spawnSync } from 'node:child_process';
|
|
2
|
+
import { createHash } from 'node:crypto';
|
|
3
|
+
import { lstatSync, readdirSync, readFileSync, realpathSync } from 'node:fs';
|
|
4
|
+
import { join } from 'node:path';
|
|
5
|
+
export const isComponentRelease = (value) => typeof value === 'string' && /^[a-f0-9]{64}$/.test(value);
|
|
6
|
+
const sha256 = (value) => createHash('sha256').update(value).digest('hex');
|
|
7
|
+
export function approvedArchive(path, sha) {
|
|
8
|
+
const info = lstatSync(path);
|
|
9
|
+
if (!info.isFile() || info.size > 32 * 1024 * 1024)
|
|
10
|
+
throw new Error('BOT_COMPONENT_RELEASE_INVALID');
|
|
11
|
+
const bytes = readFileSync(path);
|
|
12
|
+
if (bytes.byteLength > 32 * 1024 * 1024 || sha256(bytes) !== sha)
|
|
13
|
+
throw new Error('BOT_COMPONENT_RELEASE_DIGEST_MISMATCH');
|
|
14
|
+
return bytes;
|
|
15
|
+
}
|
|
16
|
+
/** 从已固定摘要的归档取全量文件清单,核对每个实际启动文件和捆绑依赖。 */
|
|
17
|
+
export function verifyHostRelease(root, sha) {
|
|
18
|
+
if (!isComponentRelease(sha) || realpathSync(root) !== root)
|
|
19
|
+
throw new Error('BOT_COMPONENT_RELEASE_INVALID');
|
|
20
|
+
const archive = join(root, 'host.tgz');
|
|
21
|
+
approvedArchive(archive, sha);
|
|
22
|
+
const extracted = spawnSync('/usr/bin/tar', ['-xOzf', archive, 'package/release.json'], {
|
|
23
|
+
timeout: 10000,
|
|
24
|
+
maxBuffer: 4 * 1024 * 1024,
|
|
25
|
+
killSignal: 'SIGKILL',
|
|
26
|
+
});
|
|
27
|
+
if (extracted.status !== 0)
|
|
28
|
+
throw new Error('BOT_COMPONENT_RELEASE_INVALID');
|
|
29
|
+
const manifest = JSON.parse(extracted.stdout.toString());
|
|
30
|
+
if (manifest.schemaVersion !== 1 ||
|
|
31
|
+
!/^[a-f0-9]{40,64}$/.test(manifest.revision) ||
|
|
32
|
+
!manifest.hashes ||
|
|
33
|
+
!isComponentRelease(manifest.hashes['dist/main.js']))
|
|
34
|
+
throw new Error('BOT_COMPONENT_RELEASE_INVALID');
|
|
35
|
+
// 以固定归档的回证确定包身份,继续校验旧安装和回滚包。
|
|
36
|
+
const packageNames = ['agentxgo', '@agent-stack/bot-host'].filter((name) => typeof manifest.versions?.[name] === 'string');
|
|
37
|
+
if (packageNames.length !== 1)
|
|
38
|
+
throw new Error('BOT_COMPONENT_RELEASE_INVALID');
|
|
39
|
+
const pkg = join(root, 'node_modules', packageNames[0]);
|
|
40
|
+
if (realpathSync(pkg) !== pkg)
|
|
41
|
+
throw new Error('BOT_COMPONENT_RELEASE_INVALID');
|
|
42
|
+
const remaining = new Map(Object.entries(manifest.hashes));
|
|
43
|
+
remaining.set('release.json', sha256(extracted.stdout));
|
|
44
|
+
const visit = (relative, depth) => {
|
|
45
|
+
if (depth > 32)
|
|
46
|
+
throw new Error('BOT_COMPONENT_RELEASE_INVALID');
|
|
47
|
+
for (const info of readdirSync(join(pkg, relative), { withFileTypes: true })) {
|
|
48
|
+
const file = relative ? relative + '/' + info.name : info.name;
|
|
49
|
+
if (info.isDirectory())
|
|
50
|
+
visit(file, depth + 1);
|
|
51
|
+
else {
|
|
52
|
+
const expected = remaining.get(file), path = join(pkg, file);
|
|
53
|
+
if (!info.isFile() ||
|
|
54
|
+
!isComponentRelease(expected) ||
|
|
55
|
+
lstatSync(path).size > 4 * 1024 * 1024 ||
|
|
56
|
+
sha256(readFileSync(path)) !== expected)
|
|
57
|
+
throw new Error('BOT_COMPONENT_RELEASE_INVALID');
|
|
58
|
+
remaining.delete(file);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
visit('', 0);
|
|
63
|
+
if (remaining.size !== 0)
|
|
64
|
+
throw new Error('BOT_COMPONENT_RELEASE_INVALID');
|
|
65
|
+
return join(pkg, 'dist/main.js');
|
|
66
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { assertBotCapabilityVersion, BOT_HOST_COMPONENT_CAPABILITY, BOT_HOST_COMPONENT_VERSION, botChoice, botObject, } from '@agent-stack/contracts';
|
|
2
|
+
import { windowsHostComponent } from '../windows-state.js';
|
|
3
|
+
/** Windows 复用 MSI 的 SCM 实况,版本和公共回执与其他平台共用。 */
|
|
4
|
+
export function manageWindowsHostComponent(input, native = windowsHostComponent) {
|
|
5
|
+
const { action, config } = input;
|
|
6
|
+
if (action === 'install' || action === 'rollback')
|
|
7
|
+
throw new Error('BOT_COMPONENT_WINDOWS_MSI_REQUIRED');
|
|
8
|
+
const read = (operation) => {
|
|
9
|
+
try {
|
|
10
|
+
const value = botObject(JSON.parse(native(operation, config)), [
|
|
11
|
+
'state',
|
|
12
|
+
'ready',
|
|
13
|
+
'reasonCode',
|
|
14
|
+
]);
|
|
15
|
+
const state = botChoice(value.state, [
|
|
16
|
+
'RUNNING',
|
|
17
|
+
'STARTING',
|
|
18
|
+
'STOPPING',
|
|
19
|
+
'STOPPED',
|
|
20
|
+
'FAILED',
|
|
21
|
+
'UNAVAILABLE',
|
|
22
|
+
]);
|
|
23
|
+
if (typeof value.ready !== 'boolean' ||
|
|
24
|
+
(value.ready && state !== 'RUNNING') ||
|
|
25
|
+
typeof value.reasonCode !== 'string' ||
|
|
26
|
+
(value.reasonCode && !/^[A-Z_]{1,80}$/.test(value.reasonCode)))
|
|
27
|
+
throw new Error('invalid native observation');
|
|
28
|
+
return { state, ready: value.ready, reason: value.reasonCode || null };
|
|
29
|
+
}
|
|
30
|
+
catch {
|
|
31
|
+
throw new Error('BOT_COMPONENT_WINDOWS_SUPERVISOR_UNAVAILABLE');
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
let observed = read('status');
|
|
35
|
+
if (observed.state !== 'UNAVAILABLE') {
|
|
36
|
+
assertBotCapabilityVersion(BOT_HOST_COMPONENT_CAPABILITY, BOT_HOST_COMPONENT_VERSION, input.expected);
|
|
37
|
+
if (action !== 'status')
|
|
38
|
+
observed = read(action);
|
|
39
|
+
}
|
|
40
|
+
const { state, ready, reason } = observed;
|
|
41
|
+
// 已运行的原服务不能替代本次失败或未确认的动作回执。
|
|
42
|
+
const failed = reason === 'BOT_COMPONENT_SUPERVISOR_ACTION_FAILED' ||
|
|
43
|
+
reason === 'BOT_COMPONENT_STATE_UNCONFIRMED';
|
|
44
|
+
const applied = !failed && (action === 'stop' ? state === 'STOPPED' || state === 'FAILED' : ready);
|
|
45
|
+
const out = action === 'status' ? 'OBSERVED' : applied ? 'APPLIED' : 'DEGRADED';
|
|
46
|
+
const reasonCode = out === 'APPLIED' || (out === 'OBSERVED' && ready)
|
|
47
|
+
? null
|
|
48
|
+
: (reason ?? (out === 'DEGRADED' ? 'BOT_COMPONENT_STATE_UNCONFIRMED' : null));
|
|
49
|
+
const atMs = Date.now();
|
|
50
|
+
return {
|
|
51
|
+
schemaVersion: 1,
|
|
52
|
+
action,
|
|
53
|
+
outcome: out,
|
|
54
|
+
reasonCode,
|
|
55
|
+
selectedRelease: null,
|
|
56
|
+
previousRelease: null,
|
|
57
|
+
status: {
|
|
58
|
+
component: 'host.owned',
|
|
59
|
+
state,
|
|
60
|
+
alive: state === 'RUNNING' ? true : ['STOPPED', 'FAILED'].includes(state) ? false : null,
|
|
61
|
+
observedAtMs: atMs,
|
|
62
|
+
lastSuccess: out === 'APPLIED'
|
|
63
|
+
? { atMs, reasonCode: 'BOT_COMPONENT_' + action.toUpperCase() + '_APPLIED' }
|
|
64
|
+
: null,
|
|
65
|
+
lastFailure: out === 'DEGRADED' && reasonCode ? { atMs, reasonCode } : null,
|
|
66
|
+
queue: null,
|
|
67
|
+
nextRetryAtMs: null,
|
|
68
|
+
},
|
|
69
|
+
};
|
|
70
|
+
}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
// 部署清单核对实际外接 Runtime 和同机进程。
|
|
2
|
+
import { isAbsolute, relative, resolve } from 'node:path';
|
|
3
|
+
import { botChoice, botId, botInteger, botObject, botText, botRuntimeProvider, } from '@agent-stack/contracts';
|
|
4
|
+
export const beneath = (parent, child) => {
|
|
5
|
+
const p = relative(parent, child);
|
|
6
|
+
return p === '' || (!isAbsolute(p) && p !== '..' && !p.startsWith('../'));
|
|
7
|
+
};
|
|
8
|
+
export const projectMode = (config) => 'mode' in config && config.mode === 'project';
|
|
9
|
+
export function deploymentEndpoint(value) {
|
|
10
|
+
const url = new URL(botText(value));
|
|
11
|
+
if (!['http:', 'https:'].includes(url.protocol) ||
|
|
12
|
+
!['127.0.0.1', '[::1]'].includes(url.hostname) ||
|
|
13
|
+
url.username ||
|
|
14
|
+
url.password ||
|
|
15
|
+
url.search ||
|
|
16
|
+
url.hash ||
|
|
17
|
+
url.pathname !== '/')
|
|
18
|
+
throw new Error('BOT_DEPLOYMENT_LOOPBACK_REQUIRED');
|
|
19
|
+
return url.toString();
|
|
20
|
+
}
|
|
21
|
+
export function deploymentConfig(raw, config) {
|
|
22
|
+
const v = botObject(raw, ['schemaVersion', 'hostId', 'project', 'provider', 'profiles']), p = botObject(v.project, ['tenantKey', 'workspaceKey', 'projectKey']);
|
|
23
|
+
if (v.schemaVersion !== 1 ||
|
|
24
|
+
v.hostId !== config.hostId ||
|
|
25
|
+
['tenantKey', 'workspaceKey', 'projectKey'].some((k) => p[k] !== config.project[k]))
|
|
26
|
+
throw new Error('BOT_DEPLOYMENT_SCOPE_MISMATCH');
|
|
27
|
+
const provider = botRuntimeProvider(v.provider);
|
|
28
|
+
if (provider !== (projectMode(config) ? config.provider : (config.runtimeProvider ?? 'codex')))
|
|
29
|
+
throw new Error('BOT_DEPLOYMENT_PROVIDER_MISMATCH');
|
|
30
|
+
if (!Array.isArray(v.profiles) || v.profiles.length < 2 || v.profiles.length > 4)
|
|
31
|
+
throw new Error('BOT_DEPLOYMENT_PROFILES_REQUIRED');
|
|
32
|
+
const profiles = v.profiles.map((raw) => {
|
|
33
|
+
const r = botObject(raw, ['role', 'uid', 'root', 'cgroup', 'url']), role = botChoice(r.role, ['host', 'background', 'interaction', 'reception']), root = botText(r.root), cgroup = botText(r.cgroup);
|
|
34
|
+
if (!isAbsolute(root) ||
|
|
35
|
+
resolve(root) !== root ||
|
|
36
|
+
root === '/' ||
|
|
37
|
+
cgroup.split('/').length > 32 ||
|
|
38
|
+
!/^\/(?:[A-Za-z0-9_.@:-]+\/)*[A-Za-z0-9_.@:-]+$/.test(cgroup) ||
|
|
39
|
+
cgroup.split('/').some((x) => x === '.' || x === '..'))
|
|
40
|
+
throw new Error('BOT_DEPLOYMENT_PATH_INVALID');
|
|
41
|
+
if (role === 'host' && r.url !== undefined)
|
|
42
|
+
throw new Error('BOT_DEPLOYMENT_HOST_URL_FORBIDDEN');
|
|
43
|
+
return {
|
|
44
|
+
role,
|
|
45
|
+
uid: botInteger(r.uid, 1),
|
|
46
|
+
root,
|
|
47
|
+
cgroup,
|
|
48
|
+
...(role === 'host' ? {} : { url: deploymentEndpoint(r.url) }),
|
|
49
|
+
};
|
|
50
|
+
});
|
|
51
|
+
const expected = {
|
|
52
|
+
host: true,
|
|
53
|
+
background: deploymentEndpoint(projectMode(config) ? config.backend.runtimeUrl : config.runtimeUrl),
|
|
54
|
+
};
|
|
55
|
+
if (projectMode(config))
|
|
56
|
+
expected.reception = deploymentEndpoint(config.reception.runtimeUrl);
|
|
57
|
+
else if (config.interaction)
|
|
58
|
+
expected.interaction = deploymentEndpoint(config.interaction.runtimeUrl);
|
|
59
|
+
if (new Set(profiles.map((p) => p.role)).size !== profiles.length ||
|
|
60
|
+
new Set(profiles.map((p) => p.uid)).size !== profiles.length ||
|
|
61
|
+
profiles.length !== Object.keys(expected).length ||
|
|
62
|
+
profiles.some((p) => !expected[p.role] || (p.role !== 'host' && p.url !== expected[p.role])))
|
|
63
|
+
throw new Error('BOT_DEPLOYMENT_PROFILE_MISMATCH');
|
|
64
|
+
for (let i = 0; i < profiles.length; i++)
|
|
65
|
+
for (const other of profiles.slice(i + 1)) {
|
|
66
|
+
const current = profiles[i];
|
|
67
|
+
if (beneath(current.root, other.root) ||
|
|
68
|
+
beneath(other.root, current.root) ||
|
|
69
|
+
beneath(current.cgroup, other.cgroup) ||
|
|
70
|
+
beneath(other.cgroup, current.cgroup) ||
|
|
71
|
+
(current.url && other.url && new URL(current.url).origin === new URL(other.url).origin))
|
|
72
|
+
throw new Error('BOT_DEPLOYMENT_PROFILES_OVERLAP');
|
|
73
|
+
}
|
|
74
|
+
const reserved = new Set([config.port]);
|
|
75
|
+
// 每个 Bot 的本机控制端口均独立于 Native 服务端口。
|
|
76
|
+
if (projectMode(config))
|
|
77
|
+
for (let slot = 0; slot < (config.parallelBots ?? 1); slot++)
|
|
78
|
+
reserved.add(config.childPort + slot);
|
|
79
|
+
if (profiles.some((p) => p.url &&
|
|
80
|
+
(reserved.has(Number(new URL(p.url).port || (new URL(p.url).protocol === 'https:' ? 443 : 80))) ||
|
|
81
|
+
new URL(p.url).origin === new URL(config.bridgeUrl).origin)))
|
|
82
|
+
throw new Error('BOT_DEPLOYMENT_ENDPOINT_COLLISION');
|
|
83
|
+
const host = profiles.find((p) => p.role === 'host');
|
|
84
|
+
const target = projectMode(config) ? config.root : config.journalPath;
|
|
85
|
+
if (!beneath(host.root, resolve(target)) ||
|
|
86
|
+
(!projectMode(config) && resolve(target) === host.root))
|
|
87
|
+
throw new Error('BOT_DEPLOYMENT_HOST_ROOT_MISMATCH');
|
|
88
|
+
return { schemaVersion: 1, hostId: botId(v.hostId), project: config.project, provider, profiles };
|
|
89
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
const startupCodes = new Set([
|
|
2
|
+
'BOT_SERVICE_NETWORK_UNAVAILABLE',
|
|
3
|
+
'BOT_SERVICE_PUBLIC_TUNNEL_UNAVAILABLE',
|
|
4
|
+
// 已认证 Native 的准入拒绝可供本机诊断判断资源压力。
|
|
5
|
+
'CONVERSATION_RSS_LIMIT',
|
|
6
|
+
'CONVERSATION_CAPACITY',
|
|
7
|
+
// 托管边缘返回 530 时仍属连接暂态,与正常恢复路径使用相同分类。
|
|
8
|
+
...[401, 403, 429, 502, 503, 504, 530].map((status) => `BOT_SERVICE_HTTP_${status}`),
|
|
9
|
+
'BOT_DEPLOYMENT_RUNTIME_IDENTITY_MISMATCH',
|
|
10
|
+
'BOT_DEPLOYMENT_RUNTIME_EXECUTION_MISMATCH',
|
|
11
|
+
'BOT_DEPLOYMENT_RUNTIME_ORIGIN_MISMATCH',
|
|
12
|
+
'BOT_DEPLOYMENT_RUNTIME_PROCESS_CHANGED',
|
|
13
|
+
'BOT_DEPLOYMENT_RUNTIME_RESPONSE_LIMIT',
|
|
14
|
+
'BOT_DEPLOYMENT_RUNTIME_RESPONSE_INVALID',
|
|
15
|
+
'BOT_DEPLOYMENT_PRIVATE_MANIFEST_REQUIRED',
|
|
16
|
+
'BOT_DEPLOYMENT_ABSOLUTE_MANIFEST_REQUIRED',
|
|
17
|
+
'BOT_PROJECT_ROOT_PRIVATE_REQUIRED',
|
|
18
|
+
]);
|
|
19
|
+
/** 启动日志和本机健康页只投影固定类别;远端正文、路径、凭据和异常栈不能进入输出。 */
|
|
20
|
+
export function hostStartupFailureCode(error) {
|
|
21
|
+
return error instanceof Error && startupCodes.has(error.message)
|
|
22
|
+
? error.message
|
|
23
|
+
: 'BOT_HOST_STARTUP_REJECTED';
|
|
24
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { beneath } from './config.js';
|
|
2
|
+
import { dirname } from 'node:path';
|
|
3
|
+
import { checkProfileMembers } from './members.js';
|
|
4
|
+
const denied = (reason) => {
|
|
5
|
+
throw new Error('BOT_DEPLOYMENT_' + reason);
|
|
6
|
+
};
|
|
7
|
+
const number = (s) => {
|
|
8
|
+
if (!/^[0-9]+$/.test(s.trim()) || !Number.isSafeInteger(Number(s)) || Number(s) <= 0)
|
|
9
|
+
return denied('FINITE_LIMIT_REQUIRED');
|
|
10
|
+
return Number(s);
|
|
11
|
+
};
|
|
12
|
+
export function processGroup(text) {
|
|
13
|
+
const lines = text.trim().split('\n');
|
|
14
|
+
if (lines.length !== 1 || !lines[0].startsWith('0::/'))
|
|
15
|
+
return denied('CGROUP_V2_REQUIRED');
|
|
16
|
+
return lines[0].slice(3);
|
|
17
|
+
}
|
|
18
|
+
export function processUid(text, expected) {
|
|
19
|
+
const match = /^Uid:\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s*$/m.exec(text);
|
|
20
|
+
if (!match || match.slice(1).some((s) => Number(s) !== expected))
|
|
21
|
+
denied('PROCESS_UID_MISMATCH');
|
|
22
|
+
}
|
|
23
|
+
const vanished = (e) => e instanceof Error && 'code' in e && e.code === 'ENOENT';
|
|
24
|
+
function immutableLimit(path, system) {
|
|
25
|
+
const meta = system.metadata(path);
|
|
26
|
+
if (meta.uid !== 0 || (meta.mode & 0o022) !== 0 || meta.symlink || !meta.file)
|
|
27
|
+
return denied('IMMUTABLE_KERNEL_LIMITS_REQUIRED');
|
|
28
|
+
}
|
|
29
|
+
export function kernelProfiles(profiles, system) {
|
|
30
|
+
if (system.platform !== 'linux' || system.uid <= 0 || !system.cgroupV2())
|
|
31
|
+
return denied('DEDICATED_LINUX_ACCOUNT_REQUIRED');
|
|
32
|
+
const self = processGroup(system.read('/proc/self/cgroup')), host = profiles.find((p) => p.role === 'host');
|
|
33
|
+
if (self !== host.cgroup || host.uid !== system.uid)
|
|
34
|
+
return denied('HOST_CGROUP_MISMATCH');
|
|
35
|
+
const limits = profiles.map((p) => {
|
|
36
|
+
const path = '/sys/fs/cgroup' + p.cgroup;
|
|
37
|
+
if (system.realpath(path) !== path || !system.metadata(path).directory)
|
|
38
|
+
return denied('CGROUP_PATH_INVALID');
|
|
39
|
+
for (const file of ['memory.max', 'memory.swap.max', 'pids.max', 'cpu.max']) {
|
|
40
|
+
immutableLimit(path + '/' + file, system);
|
|
41
|
+
}
|
|
42
|
+
// Moving a writer out of the envelope must not be delegated through an ancestor.
|
|
43
|
+
for (let ancestor = path; beneath('/sys/fs/cgroup', ancestor); ancestor = dirname(ancestor))
|
|
44
|
+
immutableLimit(ancestor + '/cgroup.procs', system);
|
|
45
|
+
if (system.read(path + '/memory.swap.max').trim() !== '0')
|
|
46
|
+
return denied('SWAP_LIMIT_REQUIRED');
|
|
47
|
+
const memoryBytes = number(system.read(path + '/memory.max')), pids = number(system.read(path + '/pids.max'));
|
|
48
|
+
const cpu = system
|
|
49
|
+
.read(path + '/cpu.max')
|
|
50
|
+
.trim()
|
|
51
|
+
.split(/\s+/);
|
|
52
|
+
if (cpu.length !== 2)
|
|
53
|
+
return denied('CPU_LIMIT_INVALID');
|
|
54
|
+
const cpuCores = number(cpu[0]) / number(cpu[1]);
|
|
55
|
+
if (memoryBytes < 64 * 1024 * 1024 ||
|
|
56
|
+
memoryBytes > (p.role === 'host' ? 512 : 2048) * 1024 * 1024 ||
|
|
57
|
+
pids > 128 ||
|
|
58
|
+
cpuCores > 2)
|
|
59
|
+
return denied('RESOURCE_ENVELOPE_EXCEEDED');
|
|
60
|
+
checkProfileMembers(p, system);
|
|
61
|
+
return { role: p.role, memoryBytes, pids, cpuCores };
|
|
62
|
+
});
|
|
63
|
+
// A shared Desktop or another deployment under any profile UID defeats private directory modes.
|
|
64
|
+
const processes = system.entries('/proc').filter((x) => /^\d+$/.test(x));
|
|
65
|
+
if (processes.length > 8192)
|
|
66
|
+
return denied('PROCESS_SCAN_LIMIT');
|
|
67
|
+
for (const pid of processes) {
|
|
68
|
+
try {
|
|
69
|
+
const ownerUid = system.metadata('/proc/' + pid).uid;
|
|
70
|
+
const profile = profiles.find((p) => p.uid === ownerUid);
|
|
71
|
+
if (!profile)
|
|
72
|
+
continue;
|
|
73
|
+
processUid(system.read('/proc/' + pid + '/status'), profile.uid);
|
|
74
|
+
if (!beneath(profile.cgroup, processGroup(system.read('/proc/' + pid + '/cgroup'))))
|
|
75
|
+
return denied('ACCOUNT_SHARED_WITH_OTHER_PROCESS');
|
|
76
|
+
}
|
|
77
|
+
catch (e) {
|
|
78
|
+
if (!vanished(e))
|
|
79
|
+
throw e;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
if (processGroup(system.read('/proc/self/cgroup')) !== self)
|
|
83
|
+
return denied('HOST_CGROUP_CHANGED');
|
|
84
|
+
return limits;
|
|
85
|
+
}
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import { execFileSync } from 'node:child_process';
|
|
2
|
+
import { lstatSync } from 'node:fs';
|
|
3
|
+
import { join } from 'node:path';
|
|
4
|
+
import { BotBridgeClient, BotServiceTransport } from '@agent-stack/bridge-client';
|
|
5
|
+
import { botObject } from '@agent-stack/contracts';
|
|
6
|
+
import { botRuntimeBootstrap } from '@agent-stack/runtime-contracts';
|
|
7
|
+
import { hostEnrollmentOrigin, parseHostDeviceEnrollment } from '../../enrollment/device.js';
|
|
8
|
+
import { deploymentSystem, trustedAncestors } from '../system.js';
|
|
9
|
+
import { macRolePath, sameMacEnrollment, validateMacAttachment } from './attachment.js';
|
|
10
|
+
import { installMacPlan, loadMacServicePlan, macRoleCommand, verifyMacRole, verifyManagedFile, withMacPlanLock, } from './install.js';
|
|
11
|
+
import { macosConfigRoot } from './plan.js';
|
|
12
|
+
const app = '/Applications/AgentXGo Host.app/Contents';
|
|
13
|
+
const resources = join(app, 'Resources');
|
|
14
|
+
const node = join(resources, 'bin/node');
|
|
15
|
+
const handoff = join(resources, 'host/dist/deployment/macos/handoff.js');
|
|
16
|
+
function asUser(uid, args, input) {
|
|
17
|
+
return macRoleCommand(resources, uid, args, input);
|
|
18
|
+
}
|
|
19
|
+
function readProfile(profile, path = profile.config) {
|
|
20
|
+
return botObject(asUser(profile.uid, ['read', macRolePath(profile, path)]));
|
|
21
|
+
}
|
|
22
|
+
function instances() {
|
|
23
|
+
try {
|
|
24
|
+
trustedAncestors(join(macosConfigRoot, 'plan.json'), deploymentSystem, 0);
|
|
25
|
+
}
|
|
26
|
+
catch (error) {
|
|
27
|
+
if (error instanceof Error && 'code' in error && error.code === 'ENOENT')
|
|
28
|
+
return [];
|
|
29
|
+
throw error;
|
|
30
|
+
}
|
|
31
|
+
return deploymentSystem
|
|
32
|
+
.entries(macosConfigRoot)
|
|
33
|
+
.map((name) => /^([a-z][a-z0-9-]{0,39})\.json$/.exec(name)?.[1])
|
|
34
|
+
.filter((name) => name !== undefined);
|
|
35
|
+
}
|
|
36
|
+
/** 从管理员持有的计划中寻找设备的原启动配置,检查阶段不交付新凭据。 */
|
|
37
|
+
function inspect(plan, enrollment, consoleUid) {
|
|
38
|
+
const { host, background, reception } = plan.profiles;
|
|
39
|
+
if (!host || !background || !reception || plan.profiles.interaction)
|
|
40
|
+
throw new Error('BOT_MACOS_PROJECT_RUNTIME_REQUIRED');
|
|
41
|
+
for (const profile of [host, background, reception]) {
|
|
42
|
+
if (profile.uid === consoleUid)
|
|
43
|
+
throw new Error('BOT_MACOS_ROLE_UID_MISMATCH');
|
|
44
|
+
verifyMacRole(profile);
|
|
45
|
+
}
|
|
46
|
+
const config = readProfile(host);
|
|
47
|
+
const deviceFile = macRolePath(host, config.deviceEnrollment);
|
|
48
|
+
const current = asUser(host.uid, ['binding', deviceFile]);
|
|
49
|
+
if (current !== null && !sameMacEnrollment(enrollment, botObject(current)))
|
|
50
|
+
throw new Error('BOT_MACOS_DEVICE_IDENTITY_CONFLICT');
|
|
51
|
+
const bg = readProfile(background);
|
|
52
|
+
if (bg.role !== 'background')
|
|
53
|
+
throw new Error('BOT_MACOS_PROJECT_RUNTIME_REQUIRED');
|
|
54
|
+
const native = readProfile(background, macRolePath(background, bg.configFile));
|
|
55
|
+
const bootstrap = native.bootstrapFile === undefined
|
|
56
|
+
? undefined
|
|
57
|
+
: botRuntimeBootstrap(readProfile(background, macRolePath(background, native.bootstrapFile)));
|
|
58
|
+
if ((bootstrap && bootstrap.provider !== 'dsh') || (current === null && !bootstrap))
|
|
59
|
+
throw new Error('BOT_MACOS_PROJECT_RUNTIME_REQUIRED');
|
|
60
|
+
validateMacAttachment(enrollment, config, { profile: background, config: native, identity: bootstrap ?? native }, { profile: reception, config: readProfile(reception) });
|
|
61
|
+
if (!asUser(background.uid, ['model', background.config + '.env']) ||
|
|
62
|
+
!asUser(reception.uid, ['model', reception.config + '.env']))
|
|
63
|
+
throw new Error('BOT_MACOS_PROJECT_RUNTIME_REQUIRED');
|
|
64
|
+
return { host, deviceFile, needsImport: current === null, bootstrap };
|
|
65
|
+
}
|
|
66
|
+
/** 首次交付只读取 Bridge 中由原设备授权签发的原准备回执。 */
|
|
67
|
+
async function verifyPreparation(enrollment, bootstrap) {
|
|
68
|
+
const bridge = new BotBridgeClient(new BotServiceTransport(enrollment.bridgeUrl, 5000), 5000);
|
|
69
|
+
const result = botObject(await bridge.projectHost(enrollment.project, enrollment.projectCredential, 'preparations', {
|
|
70
|
+
action: 'get',
|
|
71
|
+
args: { preparationId: bootstrap.preparationId },
|
|
72
|
+
}));
|
|
73
|
+
if (result.preparationId !== bootstrap.preparationId ||
|
|
74
|
+
result.executionId !== bootstrap.executionId)
|
|
75
|
+
throw new Error('BOT_MACOS_PREPARATION_IDENTITY_MISMATCH');
|
|
76
|
+
}
|
|
77
|
+
async function activate(args) {
|
|
78
|
+
const uid = Number(args[0]);
|
|
79
|
+
if (process.platform !== 'darwin' ||
|
|
80
|
+
process.getuid?.() !== 0 ||
|
|
81
|
+
process.geteuid?.() !== 0 ||
|
|
82
|
+
args.length !== 1 ||
|
|
83
|
+
!/^[1-9][0-9]{0,9}$/.test(args[0] ?? '') ||
|
|
84
|
+
uid < 500 ||
|
|
85
|
+
lstatSync('/dev/console').uid !== uid)
|
|
86
|
+
throw new Error('BOT_MACOS_SERVICE_ADMIN_REQUIRED');
|
|
87
|
+
const installed = join(app, 'Info.plist');
|
|
88
|
+
for (const file of [installed, node, handoff])
|
|
89
|
+
verifyManagedFile(file);
|
|
90
|
+
const api = hostEnrollmentOrigin(execFileSync('/usr/bin/plutil', ['-extract', 'AgentXGoAPI', 'raw', '-o', '-', installed], {
|
|
91
|
+
encoding: 'utf8',
|
|
92
|
+
cwd: '/',
|
|
93
|
+
timeout: 5000,
|
|
94
|
+
stdio: ['ignore', 'pipe', 'ignore'],
|
|
95
|
+
}).trim());
|
|
96
|
+
const entries = instances();
|
|
97
|
+
if (!entries.length)
|
|
98
|
+
return 'RUNTIME_REQUIRED';
|
|
99
|
+
const pair = botObject(asUser(uid, ['export']), ['device', 'receipt']);
|
|
100
|
+
const enrollment = parseHostDeviceEnrollment(pair.device, pair.receipt);
|
|
101
|
+
if (!api.startsWith('https://') || enrollment.bridgeUrl !== api + '/host/v1')
|
|
102
|
+
throw new Error('BOT_MACOS_DEVICE_API_MISMATCH');
|
|
103
|
+
let selected;
|
|
104
|
+
for (const instance of entries) {
|
|
105
|
+
try {
|
|
106
|
+
inspect(loadMacServicePlan(instance), enrollment, uid);
|
|
107
|
+
}
|
|
108
|
+
catch {
|
|
109
|
+
continue;
|
|
110
|
+
}
|
|
111
|
+
if (selected)
|
|
112
|
+
return 'RUNTIME_AMBIGUOUS';
|
|
113
|
+
selected = instance;
|
|
114
|
+
}
|
|
115
|
+
if (!selected)
|
|
116
|
+
return 'RUNTIME_REQUIRED';
|
|
117
|
+
return withMacPlanLock(selected, async () => {
|
|
118
|
+
// 持锁后二次核对原计划和设备,安装重试继续使用已有的回执及私有状态。
|
|
119
|
+
const plan = loadMacServicePlan(selected);
|
|
120
|
+
const { host, deviceFile, needsImport, bootstrap } = inspect(plan, enrollment, uid);
|
|
121
|
+
if (needsImport) {
|
|
122
|
+
await verifyPreparation(enrollment, bootstrap);
|
|
123
|
+
if (lstatSync('/dev/console').uid !== uid)
|
|
124
|
+
throw new Error('BOT_MACOS_CONSOLE_CHANGED');
|
|
125
|
+
asUser(host.uid, ['import', deviceFile], pair);
|
|
126
|
+
}
|
|
127
|
+
const configured = botObject(asUser(host.uid, ['project', host.config]));
|
|
128
|
+
if (!sameMacEnrollment(enrollment, configured))
|
|
129
|
+
throw new Error('BOT_MACOS_DEVICE_IDENTITY_CONFLICT');
|
|
130
|
+
installMacPlan(plan);
|
|
131
|
+
return 'SERVICES_ENABLED';
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
try {
|
|
135
|
+
process.stdout.write((await activate(process.argv.slice(2))) + '\n');
|
|
136
|
+
}
|
|
137
|
+
catch {
|
|
138
|
+
// 图形入口仅接收固定状态,诊断不包含任一角色的配置、路径或凭据。
|
|
139
|
+
process.stdout.write('ACTIVATION_FAILED\n');
|
|
140
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { isAbsolute, resolve } from 'node:path';
|
|
2
|
+
import { botId, botObject, botText, canonicalBotJson } from '@agent-stack/contracts';
|
|
3
|
+
import { beneath, deploymentEndpoint } from '../config.js';
|
|
4
|
+
/** 原角色只读取自己私有根中的配置和原生身份文件。 */
|
|
5
|
+
export function macRolePath(profile, value) {
|
|
6
|
+
const path = botText(value);
|
|
7
|
+
if (!isAbsolute(path) ||
|
|
8
|
+
resolve(path) !== path ||
|
|
9
|
+
path === profile.root ||
|
|
10
|
+
!beneath(profile.root, path) ||
|
|
11
|
+
/[\r\n\0]/.test(path))
|
|
12
|
+
throw new Error('BOT_MACOS_ROLE_PATH_INVALID');
|
|
13
|
+
return path;
|
|
14
|
+
}
|
|
15
|
+
const same = (a, b) => canonicalBotJson(a) === canonicalBotJson(b);
|
|
16
|
+
/** 登记、原请求和正式限域必须同时匹配,不能仅凭设备名替换凭据。 */
|
|
17
|
+
export function sameMacEnrollment(expected, current) {
|
|
18
|
+
return Object.entries(expected).every(([key, value]) => current[key] !== undefined && same(value, current[key]));
|
|
19
|
+
}
|
|
20
|
+
/** 只装配已登记设备对应的 DSH 后台和接待,不更换原任务授权或原生配置。 */
|
|
21
|
+
export function validateMacAttachment(enrollment, host, background, reception) {
|
|
22
|
+
const back = botObject(host.backend);
|
|
23
|
+
const front = botObject(host.reception);
|
|
24
|
+
const native = botObject(background.identity);
|
|
25
|
+
botId(native.executionId);
|
|
26
|
+
if (host.mode !== 'project' ||
|
|
27
|
+
enrollment.provider !== 'dsh' ||
|
|
28
|
+
deploymentEndpoint(back.runtimeUrl) !== background.profile.url ||
|
|
29
|
+
deploymentEndpoint(front.runtimeUrl) !== reception.profile.url ||
|
|
30
|
+
Number(new URL(background.profile.url).port) !== background.config.port ||
|
|
31
|
+
native.hostId !== enrollment.hostId ||
|
|
32
|
+
native.bridgeUrl !== enrollment.bridgeUrl ||
|
|
33
|
+
native.hostToken !== back.runtimeToken ||
|
|
34
|
+
!same(native.project, enrollment.project) ||
|
|
35
|
+
reception.config.role !== 'conversation' ||
|
|
36
|
+
reception.config.purpose !== 'RECEPTION_ONLY' ||
|
|
37
|
+
Number(new URL(reception.profile.url).port) !== reception.config.port ||
|
|
38
|
+
reception.config.token !== front.runtimeToken ||
|
|
39
|
+
reception.config.origin !== front.runtimeOrigin ||
|
|
40
|
+
!same(reception.config.binding, enrollment.binding))
|
|
41
|
+
throw new Error('BOT_MACOS_RUNTIME_BINDING_MISMATCH');
|
|
42
|
+
}
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import { chmodSync, closeSync, fsyncSync, lstatSync, mkdtempSync, openSync, readSync, realpathSync, renameSync, rmSync, writeFileSync, } from 'node:fs';
|
|
2
|
+
import { userInfo } from 'node:os';
|
|
3
|
+
import { basename, dirname, isAbsolute, join } from 'node:path';
|
|
4
|
+
import { parseEnv } from 'node:util';
|
|
5
|
+
import { botObject, canonicalBotJson } from '@agent-stack/contracts';
|
|
6
|
+
import { parseHostDeviceEnrollment } from '../../enrollment/device.js';
|
|
7
|
+
import { loadProjectHostConfig } from '../../preparation/config.js';
|
|
8
|
+
import { deploymentSystem, privateDeploymentFile, privateDirectory } from '../system.js';
|
|
9
|
+
const deviceName = 'device.json';
|
|
10
|
+
const receiptSuffix = '.receipt.json';
|
|
11
|
+
const inputLimit = 8192;
|
|
12
|
+
function exists(path) {
|
|
13
|
+
try {
|
|
14
|
+
lstatSync(path);
|
|
15
|
+
return true;
|
|
16
|
+
}
|
|
17
|
+
catch (error) {
|
|
18
|
+
if (error instanceof Error && 'code' in error && error.code === 'ENOENT')
|
|
19
|
+
return false;
|
|
20
|
+
throw error;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
/** 读取当前非管理员角色的私有登记,残缺的文件对不得被当作新设备。 */
|
|
24
|
+
function readPair(file) {
|
|
25
|
+
if (!exists(file) && !exists(file + receiptSuffix))
|
|
26
|
+
return null;
|
|
27
|
+
const device = privateDeploymentFile(file);
|
|
28
|
+
const receipt = privateDeploymentFile(file + receiptSuffix);
|
|
29
|
+
parseHostDeviceEnrollment(device, receipt);
|
|
30
|
+
return { device, receipt };
|
|
31
|
+
}
|
|
32
|
+
function readPipe() {
|
|
33
|
+
const buffer = Buffer.alloc(inputLimit + 1);
|
|
34
|
+
let size = 0;
|
|
35
|
+
while (size < buffer.length) {
|
|
36
|
+
const count = readSync(0, buffer, size, buffer.length - size, null);
|
|
37
|
+
if (!count)
|
|
38
|
+
break;
|
|
39
|
+
size += count;
|
|
40
|
+
}
|
|
41
|
+
if (size > inputLimit)
|
|
42
|
+
throw new Error('BOT_MACOS_ENROLLMENT_LIMIT');
|
|
43
|
+
return botObject(JSON.parse(buffer.subarray(0, size).toString('utf8')), ['device', 'receipt']);
|
|
44
|
+
}
|
|
45
|
+
function sync(path) {
|
|
46
|
+
const file = openSync(path, 'r');
|
|
47
|
+
try {
|
|
48
|
+
fsyncSync(file);
|
|
49
|
+
}
|
|
50
|
+
finally {
|
|
51
|
+
closeSync(file);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
/** 在原 Host 角色下原子发布完整设备文件对,重试只接受同一身份和授权。 */
|
|
55
|
+
function importPair(file) {
|
|
56
|
+
if (basename(file) !== deviceName)
|
|
57
|
+
throw new Error('BOT_MACOS_DEVICE_PATH_INVALID');
|
|
58
|
+
const pair = readPipe();
|
|
59
|
+
const next = parseHostDeviceEnrollment(pair.device, pair.receipt);
|
|
60
|
+
const directory = dirname(file);
|
|
61
|
+
const parent = dirname(directory);
|
|
62
|
+
privateDirectory(parent, deploymentSystem);
|
|
63
|
+
const previous = readPair(file);
|
|
64
|
+
if (previous) {
|
|
65
|
+
if (canonicalBotJson(parseHostDeviceEnrollment(previous.device, previous.receipt)) !==
|
|
66
|
+
canonicalBotJson(next))
|
|
67
|
+
throw new Error('BOT_MACOS_DEVICE_IDENTITY_CONFLICT');
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
if (exists(directory))
|
|
71
|
+
privateDirectory(directory, deploymentSystem);
|
|
72
|
+
const stage = mkdtempSync(join(parent, '.device-'));
|
|
73
|
+
try {
|
|
74
|
+
for (const [name, value] of [
|
|
75
|
+
[deviceName, pair.device],
|
|
76
|
+
[deviceName + receiptSuffix, pair.receipt],
|
|
77
|
+
]) {
|
|
78
|
+
const path = join(stage, name);
|
|
79
|
+
writeFileSync(path, JSON.stringify(value) + '\n', { flag: 'wx', mode: 0o600 });
|
|
80
|
+
sync(path);
|
|
81
|
+
}
|
|
82
|
+
chmodSync(stage, 0o700);
|
|
83
|
+
sync(stage);
|
|
84
|
+
renameSync(stage, directory);
|
|
85
|
+
sync(parent);
|
|
86
|
+
}
|
|
87
|
+
finally {
|
|
88
|
+
rmSync(stage, { recursive: true, force: true });
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
/** 模型配置仍由现有 DSH 角色持有;跨进程只交付该变量是否已配置。 */
|
|
92
|
+
function hasModelCredential(path) {
|
|
93
|
+
const stat = lstatSync(path);
|
|
94
|
+
if (!stat.isFile() ||
|
|
95
|
+
stat.uid !== deploymentSystem.uid ||
|
|
96
|
+
stat.mode & 0o077 ||
|
|
97
|
+
stat.size > 65536 ||
|
|
98
|
+
realpathSync(path) !== path)
|
|
99
|
+
return false;
|
|
100
|
+
const key = parseEnv(deploymentSystem.read(path)).DEEPSEEK_API_KEY;
|
|
101
|
+
return Boolean(key?.trim() && !/[\r\n]/.test(key));
|
|
102
|
+
}
|
|
103
|
+
/** 每个文件都由实际拥有该文件的非 root 进程打开,结果只写父进程的私有管道。 */
|
|
104
|
+
function run(args) {
|
|
105
|
+
const uid = process.getuid?.();
|
|
106
|
+
if (process.platform !== 'darwin' || !uid || uid !== process.geteuid?.())
|
|
107
|
+
throw new Error('BOT_MACOS_UNPRIVILEGED_HANDOFF_REQUIRED');
|
|
108
|
+
if (args.length === 1 && args[0] === 'export') {
|
|
109
|
+
const dir = join(userInfo().homedir, 'Library', 'Application Support', 'AgentXGo Host');
|
|
110
|
+
privateDirectory(dir, deploymentSystem);
|
|
111
|
+
return readPair(join(dir, deviceName));
|
|
112
|
+
}
|
|
113
|
+
const [action, path] = args;
|
|
114
|
+
if (args.length !== 2 || !path || !isAbsolute(path))
|
|
115
|
+
throw new Error('BOT_MACOS_HANDOFF_REQUEST_INVALID');
|
|
116
|
+
switch (action) {
|
|
117
|
+
case 'read':
|
|
118
|
+
return privateDeploymentFile(path);
|
|
119
|
+
case 'binding': {
|
|
120
|
+
const pair = readPair(path);
|
|
121
|
+
return pair && parseHostDeviceEnrollment(pair.device, pair.receipt);
|
|
122
|
+
}
|
|
123
|
+
case 'model':
|
|
124
|
+
return hasModelCredential(path);
|
|
125
|
+
case 'project':
|
|
126
|
+
return loadProjectHostConfig(path) ?? null;
|
|
127
|
+
case 'import':
|
|
128
|
+
importPair(path);
|
|
129
|
+
return true;
|
|
130
|
+
default:
|
|
131
|
+
throw new Error('BOT_MACOS_HANDOFF_REQUEST_INVALID');
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
try {
|
|
135
|
+
process.stdout.write(JSON.stringify(run(process.argv.slice(2))) + '\n');
|
|
136
|
+
}
|
|
137
|
+
catch {
|
|
138
|
+
// 文件体、路径和运行角色的凭据仅在私有交接中使用。
|
|
139
|
+
process.exitCode = 1;
|
|
140
|
+
}
|