@songsid/agend 2.4.0-beta.3 → 2.4.0-beta.30
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 +11 -1
- package/README.zh-TW.md +11 -1
- package/dist/accounts-profiles.d.ts +1 -1
- package/dist/accounts-view.d.ts +32 -0
- package/dist/accounts-view.js +2 -14
- package/dist/accounts-view.js.map +1 -1
- package/dist/agend-home.js +5 -5
- package/dist/agend-home.js.map +1 -1
- package/dist/agent-cli-instructions.md +19 -7
- package/dist/agent-cli.js +199 -51
- package/dist/agent-cli.js.map +1 -1
- package/dist/agent-endpoint.d.ts +5 -1
- package/dist/agent-endpoint.js +62 -11
- package/dist/agent-endpoint.js.map +1 -1
- package/dist/agent-export.d.ts +3 -1
- package/dist/agent-export.js +18 -1
- package/dist/agent-export.js.map +1 -1
- package/dist/agent-file-read.js +3 -3
- package/dist/agent-file-read.js.map +1 -1
- package/dist/agent-whats-new.js +35 -0
- package/dist/agent-whats-new.js.map +1 -1
- package/dist/agent-workspace.d.ts +18 -2
- package/dist/agent-workspace.js +15 -4
- package/dist/agent-workspace.js.map +1 -1
- package/dist/app-message-origin.d.ts +2 -0
- package/dist/app-message-origin.js +3 -0
- package/dist/app-message-origin.js.map +1 -0
- package/dist/apply-job.d.ts +2 -2
- package/dist/auth-api.d.ts +12 -0
- package/dist/auth-api.js +87 -5
- package/dist/auth-api.js.map +1 -1
- package/dist/authority/authority-state.d.ts +7 -0
- package/dist/authority/authority-state.js +17 -2
- package/dist/authority/authority-state.js.map +1 -1
- package/dist/authority/web-authority.d.ts +28 -4
- package/dist/authority/web-authority.js +67 -4
- package/dist/authority/web-authority.js.map +1 -1
- package/dist/backend/agy-model-switch.d.ts +22 -0
- package/dist/backend/agy-model-switch.js +62 -0
- package/dist/backend/agy-model-switch.js.map +1 -0
- package/dist/backend/antigravity.d.ts +9 -2
- package/dist/backend/antigravity.js +82 -13
- package/dist/backend/antigravity.js.map +1 -1
- package/dist/backend/claude-carry.d.ts +11 -0
- package/dist/backend/claude-carry.js +88 -6
- package/dist/backend/claude-carry.js.map +1 -1
- package/dist/backend/claude-code.d.ts +39 -7
- package/dist/backend/claude-code.js +234 -32
- package/dist/backend/claude-code.js.map +1 -1
- package/dist/backend/claude-mcp-carry.d.ts +63 -0
- package/dist/backend/claude-mcp-carry.js +242 -0
- package/dist/backend/claude-mcp-carry.js.map +1 -0
- package/dist/backend/claude-transcript-errors.d.ts +4 -0
- package/dist/backend/claude-transcript-errors.js +5 -1
- package/dist/backend/claude-transcript-errors.js.map +1 -1
- package/dist/backend/claude-usage-credits.d.ts +8 -0
- package/dist/backend/claude-usage-credits.js +121 -0
- package/dist/backend/claude-usage-credits.js.map +1 -0
- package/dist/backend/cli-env-probe.js +1 -1
- package/dist/backend/cli-env-probe.js.map +1 -1
- package/dist/backend/cli-runtime-switch.d.ts +90 -0
- package/dist/backend/cli-runtime-switch.js +273 -0
- package/dist/backend/cli-runtime-switch.js.map +1 -0
- package/dist/backend/codex-footer-hints.d.ts +1 -0
- package/dist/backend/codex-footer-hints.js +15 -0
- package/dist/backend/codex-footer-hints.js.map +1 -1
- package/dist/backend/codex-model-switch.d.ts +41 -0
- package/dist/backend/codex-model-switch.js +170 -0
- package/dist/backend/codex-model-switch.js.map +1 -0
- package/dist/backend/codex-precaution.d.ts +7 -0
- package/dist/backend/codex-precaution.js +103 -0
- package/dist/backend/codex-precaution.js.map +1 -0
- package/dist/backend/codex.d.ts +7 -4
- package/dist/backend/codex.js +56 -10
- package/dist/backend/codex.js.map +1 -1
- package/dist/backend/grok-model-switch.d.ts +16 -0
- package/dist/backend/grok-model-switch.js +45 -0
- package/dist/backend/grok-model-switch.js.map +1 -0
- package/dist/backend/grok.js +33 -7
- package/dist/backend/grok.js.map +1 -1
- package/dist/backend/kiro-auth-store.d.ts +15 -2
- package/dist/backend/kiro-auth-store.js +64 -0
- package/dist/backend/kiro-auth-store.js.map +1 -1
- package/dist/backend/kiro.js +10 -5
- package/dist/backend/kiro.js.map +1 -1
- package/dist/backend/muse.d.ts +2 -0
- package/dist/backend/muse.js +7 -3
- package/dist/backend/muse.js.map +1 -1
- package/dist/backend/native-pane.js +1 -1
- package/dist/backend/native-pane.js.map +1 -1
- package/dist/backend/types.d.ts +59 -2
- package/dist/backend/types.js.map +1 -1
- package/dist/backend-availability.d.ts +23 -16
- package/dist/backend-availability.js +73 -93
- package/dist/backend-availability.js.map +1 -1
- package/dist/backend-command.d.ts +4 -2
- package/dist/backend-command.js +3 -0
- package/dist/backend-command.js.map +1 -1
- package/dist/backend-signin-guide.js +1 -1
- package/dist/backend-signin-guide.js.map +1 -1
- package/dist/backend-version-static.d.ts +15 -0
- package/dist/backend-version-static.js +95 -0
- package/dist/backend-version-static.js.map +1 -0
- package/dist/browser-backend-signins.d.ts +1 -0
- package/dist/browser-backend-signins.js +3 -1
- package/dist/browser-backend-signins.js.map +1 -1
- package/dist/build-provenance.json +1 -1
- package/dist/cache-ledger.d.ts +23 -21
- package/dist/cache-ledger.js +70 -6
- package/dist/cache-ledger.js.map +1 -1
- package/dist/cache-prices.d.ts +8 -6
- package/dist/cache-prices.js +12 -5
- package/dist/cache-prices.js.map +1 -1
- package/dist/cache-service.d.ts +9 -5
- package/dist/cache-service.js +202 -50
- package/dist/cache-service.js.map +1 -1
- package/dist/channel/adapters/discord.d.ts +23 -1
- package/dist/channel/adapters/discord.js +97 -26
- package/dist/channel/adapters/discord.js.map +1 -1
- package/dist/channel/adapters/telegram.d.ts +2 -0
- package/dist/channel/adapters/telegram.js +9 -4
- package/dist/channel/adapters/telegram.js.map +1 -1
- package/dist/channel/ipc-bridge.d.ts +7 -0
- package/dist/channel/ipc-bridge.js +45 -11
- package/dist/channel/ipc-bridge.js.map +1 -1
- package/dist/channel/mcp-server.js +39 -5
- package/dist/channel/mcp-server.js.map +1 -1
- package/dist/channel/mcp-tools.d.ts +27 -1
- package/dist/channel/mcp-tools.js +107 -14
- package/dist/channel/mcp-tools.js.map +1 -1
- package/dist/channel/tool-router.d.ts +4 -0
- package/dist/channel/tool-router.js +51 -19
- package/dist/channel/tool-router.js.map +1 -1
- package/dist/channel/types.d.ts +10 -0
- package/dist/chat-task-refs.d.ts +61 -0
- package/dist/chat-task-refs.js +112 -0
- package/dist/chat-task-refs.js.map +1 -0
- package/dist/classic-channel-manager.d.ts +6 -2
- package/dist/classic-channel-manager.js +29 -4
- package/dist/classic-channel-manager.js.map +1 -1
- package/dist/classic-cli-guard.d.ts +66 -0
- package/dist/classic-cli-guard.js +209 -0
- package/dist/classic-cli-guard.js.map +1 -0
- package/dist/claude-credential-change.d.ts +22 -0
- package/dist/claude-credential-change.js +47 -0
- package/dist/claude-credential-change.js.map +1 -0
- package/dist/claude-credential-launch.d.ts +69 -0
- package/dist/claude-credential-launch.js +328 -0
- package/dist/claude-credential-launch.js.map +1 -0
- package/dist/claude-credential-runner.d.ts +1 -0
- package/dist/claude-credential-runner.js +58 -0
- package/dist/claude-credential-runner.js.map +1 -0
- package/dist/claude-credential-vault.d.ts +57 -0
- package/dist/claude-credential-vault.js +277 -0
- package/dist/claude-credential-vault.js.map +1 -0
- package/dist/claude-install-kind.d.ts +19 -0
- package/dist/claude-install-kind.js +54 -0
- package/dist/claude-install-kind.js.map +1 -0
- package/dist/claude-request-observation.d.ts +7 -0
- package/dist/claude-request-observation.js +26 -0
- package/dist/claude-request-observation.js.map +1 -0
- package/dist/claude-setup-token-transport.d.ts +9 -0
- package/dist/claude-setup-token-transport.js +104 -0
- package/dist/claude-setup-token-transport.js.map +1 -0
- package/dist/claude-setup-token.d.ts +51 -0
- package/dist/claude-setup-token.js +83 -0
- package/dist/claude-setup-token.js.map +1 -0
- package/dist/claude-turn-boundaries.d.ts +15 -0
- package/dist/claude-turn-boundaries.js +88 -0
- package/dist/claude-turn-boundaries.js.map +1 -0
- package/dist/cli-audited.js +30 -17
- package/dist/cli-audited.js.map +1 -1
- package/dist/cli-capability.d.ts +3 -0
- package/dist/cli-capability.js.map +1 -1
- package/dist/cli-registry-check.js +1 -1
- package/dist/cli-registry-check.js.map +1 -1
- package/dist/cli-registry.d.ts +1 -0
- package/dist/cli-spec-antigravity.d.ts +1 -0
- package/dist/cli-spec-antigravity.js +3 -1
- package/dist/cli-spec-antigravity.js.map +1 -1
- package/dist/cli.js +231 -24
- package/dist/cli.js.map +1 -1
- package/dist/command-report.d.ts +11 -0
- package/dist/command-report.js +2 -0
- package/dist/command-report.js.map +1 -0
- package/dist/composite-tools.d.ts +11 -0
- package/dist/composite-tools.js +29 -0
- package/dist/composite-tools.js.map +1 -0
- package/dist/config-validator.js +69 -3
- package/dist/config-validator.js.map +1 -1
- package/dist/config.js +17 -2
- package/dist/config.js.map +1 -1
- package/dist/connect/control.d.ts +20 -0
- package/dist/connect/control.js +236 -0
- package/dist/connect/control.js.map +1 -0
- package/dist/connect/install.d.ts +13 -0
- package/dist/connect/install.js +12 -0
- package/dist/connect/install.js.map +1 -0
- package/dist/connect/mcp.d.ts +9 -0
- package/dist/connect/mcp.js +10 -0
- package/dist/connect/mcp.js.map +1 -0
- package/dist/connect/protocol.d.ts +38 -0
- package/dist/connect/protocol.js +36 -0
- package/dist/connect/protocol.js.map +1 -0
- package/dist/connect/service.d.ts +19 -0
- package/dist/connect/service.js +79 -0
- package/dist/connect/service.js.map +1 -0
- package/dist/connect/stdio-entry.d.ts +1 -0
- package/dist/connect/stdio-entry.js +6 -0
- package/dist/connect/stdio-entry.js.map +1 -0
- package/dist/connect/stdio.d.ts +5 -0
- package/dist/connect/stdio.js +33 -0
- package/dist/connect/stdio.js.map +1 -0
- package/dist/contact-auth-api.d.ts +17 -0
- package/dist/contact-auth-api.js +90 -0
- package/dist/contact-auth-api.js.map +1 -0
- package/dist/contact-auth-files.d.ts +6 -0
- package/dist/contact-auth-files.js +29 -0
- package/dist/contact-auth-files.js.map +1 -0
- package/dist/contact-auth-policy.d.ts +81 -0
- package/dist/contact-auth-policy.js +26 -0
- package/dist/contact-auth-policy.js.map +1 -0
- package/dist/contact-auth-service.d.ts +32 -0
- package/dist/contact-auth-service.js +110 -0
- package/dist/contact-auth-service.js.map +1 -0
- package/dist/contact-auth-store.d.ts +149 -0
- package/dist/contact-auth-store.js +573 -0
- package/dist/contact-auth-store.js.map +1 -0
- package/dist/contact-auth-types.d.ts +202 -0
- package/dist/contact-auth-types.js +7 -0
- package/dist/contact-auth-types.js.map +1 -0
- package/dist/contact-change-proposals.d.ts +98 -0
- package/dist/contact-change-proposals.js +166 -0
- package/dist/contact-change-proposals.js.map +1 -0
- package/dist/contact-state-view.d.ts +103 -0
- package/dist/contact-state-view.js +80 -0
- package/dist/contact-state-view.js.map +1 -0
- package/dist/cross-instance-notice.d.ts +1 -0
- package/dist/cross-instance-notice.js +9 -8
- package/dist/cross-instance-notice.js.map +1 -1
- package/dist/daemon.d.ts +247 -3
- package/dist/daemon.js +1714 -181
- package/dist/daemon.js.map +1 -1
- package/dist/darwin-memory.js +2 -1
- package/dist/darwin-memory.js.map +1 -1
- package/dist/dashboard-permissions.d.ts +23 -8
- package/dist/dashboard-permissions.js +33 -10
- package/dist/dashboard-permissions.js.map +1 -1
- package/dist/delivery-consumed-watch.js +3 -0
- package/dist/delivery-consumed-watch.js.map +1 -1
- package/dist/delivery-outbox.d.ts +213 -10
- package/dist/delivery-outbox.js +664 -49
- package/dist/delivery-outbox.js.map +1 -1
- package/dist/delivery-outbox.test.js +132 -96
- package/dist/delivery-outbox.test.js.map +1 -1
- package/dist/detached-fleet-stop.d.ts +40 -0
- package/dist/detached-fleet-stop.js +126 -0
- package/dist/detached-fleet-stop.js.map +1 -0
- package/dist/dispatcher-liveness.d.ts +51 -1
- package/dist/dispatcher-liveness.js +94 -4
- package/dist/dispatcher-liveness.js.map +1 -1
- package/dist/event-log.d.ts +12 -0
- package/dist/event-log.js +40 -0
- package/dist/event-log.js.map +1 -1
- package/dist/fleet-context.d.ts +9 -0
- package/dist/fleet-level-config.d.ts +1 -1
- package/dist/fleet-level-config.js +1 -0
- package/dist/fleet-level-config.js.map +1 -1
- package/dist/fleet-lock.d.ts +88 -2
- package/dist/fleet-lock.js +296 -3
- package/dist/fleet-lock.js.map +1 -1
- package/dist/fleet-manager.d.ts +1397 -29
- package/dist/fleet-manager.js +8180 -623
- package/dist/fleet-manager.js.map +1 -1
- package/dist/fleet-windows-runtime.d.ts +59 -4
- package/dist/fleet-windows-runtime.js +307 -40
- package/dist/fleet-windows-runtime.js.map +1 -1
- package/dist/fleet-yaml-stringify.d.ts +3 -0
- package/dist/fleet-yaml-stringify.js +132 -0
- package/dist/fleet-yaml-stringify.js.map +1 -0
- package/dist/general-knowledge/skills/admin/SKILL.md +52 -0
- package/dist/general-knowledge/skills/concepts/SKILL.md +106 -23
- package/dist/general-knowledge/skills/credential-profiles/SKILL.md +19 -1
- package/dist/general-knowledge/skills/cross-instance-messaging/SKILL.md +68 -1
- package/dist/general-knowledge/skills/fleet-config/SKILL.md +24 -4
- package/dist/general-knowledge/skills/fleet-health/SKILL.md +9 -1
- package/dist/general-knowledge/skills/hub/SKILL.md +393 -27
- package/dist/general-knowledge/skills/instance-lifecycle/SKILL.md +6 -2
- package/dist/general-knowledge/skills/model-discovery/SKILL.md +7 -2
- package/dist/general-knowledge/skills/persona-emoji/SKILL.md +3 -0
- package/dist/general-knowledge/skills/task-board/SKILL.md +98 -0
- package/dist/general-knowledge/skills/web-appearance/SKILL.md +35 -3
- package/dist/general-knowledge/skills/web-dashboard/SKILL.md +391 -70
- package/dist/general-knowledge/skills/worker-collaboration/SKILL.md +7 -1
- package/dist/general-knowledge/steering/core-rules.md +15 -78
- package/dist/general-role-block.d.ts +19 -0
- package/dist/general-role-block.js +56 -0
- package/dist/general-role-block.js.map +1 -0
- package/dist/general-role.d.ts +1 -1
- package/dist/general-role.js +2 -0
- package/dist/general-role.js.map +1 -1
- package/dist/home-update-lock.d.ts +35 -0
- package/dist/home-update-lock.js +81 -0
- package/dist/home-update-lock.js.map +1 -0
- package/dist/host-memory.d.ts +24 -1
- package/dist/host-memory.js +30 -4
- package/dist/host-memory.js.map +1 -1
- package/dist/host-monitoring/darwin/collector.d.ts +18 -0
- package/dist/host-monitoring/darwin/collector.js +65 -0
- package/dist/host-monitoring/darwin/collector.js.map +1 -0
- package/dist/host-monitoring/darwin/defaults.d.ts +2 -0
- package/dist/host-monitoring/darwin/defaults.js +9 -0
- package/dist/host-monitoring/darwin/defaults.js.map +1 -0
- package/dist/host-monitoring/darwin/interpretation.d.ts +20 -0
- package/dist/host-monitoring/darwin/interpretation.js +73 -0
- package/dist/host-monitoring/darwin/interpretation.js.map +1 -0
- package/dist/host-monitoring/linux/collector.d.ts +17 -0
- package/dist/host-monitoring/linux/collector.js +55 -0
- package/dist/host-monitoring/linux/collector.js.map +1 -0
- package/dist/host-monitoring/linux/defaults.d.ts +2 -0
- package/dist/host-monitoring/linux/defaults.js +9 -0
- package/dist/host-monitoring/linux/defaults.js.map +1 -0
- package/dist/host-monitoring/linux/interpretation.d.ts +22 -0
- package/dist/host-monitoring/linux/interpretation.js +76 -0
- package/dist/host-monitoring/linux/interpretation.js.map +1 -0
- package/dist/host-monitoring/transport.d.ts +42 -0
- package/dist/host-monitoring/transport.js +101 -0
- package/dist/host-monitoring/transport.js.map +1 -0
- package/dist/host-monitoring/wsl/collector.d.ts +19 -0
- package/dist/host-monitoring/wsl/collector.js +72 -0
- package/dist/host-monitoring/wsl/collector.js.map +1 -0
- package/dist/host-monitoring/wsl/defaults.d.ts +2 -0
- package/dist/host-monitoring/wsl/defaults.js +9 -0
- package/dist/host-monitoring/wsl/defaults.js.map +1 -0
- package/dist/host-monitoring/wsl/interpretation.d.ts +22 -0
- package/dist/host-monitoring/wsl/interpretation.js +77 -0
- package/dist/host-monitoring/wsl/interpretation.js.map +1 -0
- package/dist/host-monitoring-alert-policy.d.ts +73 -0
- package/dist/host-monitoring-alert-policy.js +152 -0
- package/dist/host-monitoring-alert-policy.js.map +1 -0
- package/dist/host-monitoring-alert-resources.d.ts +11 -0
- package/dist/host-monitoring-alert-resources.js +16 -0
- package/dist/host-monitoring-alert-resources.js.map +1 -0
- package/dist/host-monitoring-alert-settings.d.ts +16 -0
- package/dist/host-monitoring-alert-settings.js +68 -0
- package/dist/host-monitoring-alert-settings.js.map +1 -0
- package/dist/host-monitoring-alert-store.d.ts +49 -0
- package/dist/host-monitoring-alert-store.js +228 -0
- package/dist/host-monitoring-alert-store.js.map +1 -0
- package/dist/host-monitoring-alert-text.d.ts +7 -0
- package/dist/host-monitoring-alert-text.js +10 -0
- package/dist/host-monitoring-alert-text.js.map +1 -0
- package/dist/host-monitoring-alerts.d.ts +79 -0
- package/dist/host-monitoring-alerts.js +276 -0
- package/dist/host-monitoring-alerts.js.map +1 -0
- package/dist/host-monitoring-config.d.ts +15 -0
- package/dist/host-monitoring-config.js +36 -0
- package/dist/host-monitoring-config.js.map +1 -0
- package/dist/host-monitoring-defaults.d.ts +19 -0
- package/dist/host-monitoring-defaults.js +10 -0
- package/dist/host-monitoring-defaults.js.map +1 -0
- package/dist/host-monitoring-footprint-policy.d.ts +45 -0
- package/dist/host-monitoring-footprint-policy.js +150 -0
- package/dist/host-monitoring-footprint-policy.js.map +1 -0
- package/dist/host-monitoring-footprint.d.ts +42 -0
- package/dist/host-monitoring-footprint.js +169 -0
- package/dist/host-monitoring-footprint.js.map +1 -0
- package/dist/host-monitoring-history-files.d.ts +2 -0
- package/dist/host-monitoring-history-files.js +16 -0
- package/dist/host-monitoring-history-files.js.map +1 -0
- package/dist/host-monitoring-history-policy.d.ts +57 -0
- package/dist/host-monitoring-history-policy.js +107 -0
- package/dist/host-monitoring-history-policy.js.map +1 -0
- package/dist/host-monitoring-history-store.d.ts +52 -0
- package/dist/host-monitoring-history-store.js +178 -0
- package/dist/host-monitoring-history-store.js.map +1 -0
- package/dist/host-monitoring-history-worker.d.ts +1 -0
- package/dist/host-monitoring-history-worker.js +66 -0
- package/dist/host-monitoring-history-worker.js.map +1 -0
- package/dist/host-monitoring-history.d.ts +80 -0
- package/dist/host-monitoring-history.js +301 -0
- package/dist/host-monitoring-history.js.map +1 -0
- package/dist/host-monitoring-platform.d.ts +21 -0
- package/dist/host-monitoring-platform.js +18 -0
- package/dist/host-monitoring-platform.js.map +1 -0
- package/dist/host-monitoring-process-identity.d.ts +8 -0
- package/dist/host-monitoring-process-identity.js +81 -0
- package/dist/host-monitoring-process-identity.js.map +1 -0
- package/dist/host-monitoring-runtime.d.ts +42 -0
- package/dist/host-monitoring-runtime.js +95 -0
- package/dist/host-monitoring-runtime.js.map +1 -0
- package/dist/host-monitoring-settings-store.d.ts +5 -0
- package/dist/host-monitoring-settings-store.js +49 -0
- package/dist/host-monitoring-settings-store.js.map +1 -0
- package/dist/host-monitoring.d.ts +123 -0
- package/dist/host-monitoring.js +157 -0
- package/dist/host-monitoring.js.map +1 -0
- package/dist/hub/admin-dashboard.d.ts +85 -0
- package/dist/hub/admin-dashboard.js +177 -0
- package/dist/hub/admin-dashboard.js.map +1 -0
- package/dist/hub/agent-catalog-model.d.ts +297 -0
- package/dist/hub/agent-catalog-model.js +57 -0
- package/dist/hub/agent-catalog-model.js.map +1 -0
- package/dist/hub/agent-catalog.d.ts +140 -0
- package/dist/hub/agent-catalog.js +130 -0
- package/dist/hub/agent-catalog.js.map +1 -0
- package/dist/hub/agent-intro-model.d.ts +38 -0
- package/dist/hub/agent-intro-model.js +14 -0
- package/dist/hub/agent-intro-model.js.map +1 -0
- package/dist/hub/agent-intro-tool.d.ts +35 -0
- package/dist/hub/agent-intro-tool.js +83 -0
- package/dist/hub/agent-intro-tool.js.map +1 -0
- package/dist/hub/agent-intro.d.ts +31 -0
- package/dist/hub/agent-intro.js +51 -0
- package/dist/hub/agent-intro.js.map +1 -0
- package/dist/hub/agent-pictures-model.d.ts +275 -0
- package/dist/hub/agent-pictures-model.js +103 -0
- package/dist/hub/agent-pictures-model.js.map +1 -0
- package/dist/hub/agent-pictures.d.ts +64 -0
- package/dist/hub/agent-pictures.js +256 -0
- package/dist/hub/agent-pictures.js.map +1 -0
- package/dist/hub/attachments/store.d.ts +2 -0
- package/dist/hub/attachments/store.js +6 -0
- package/dist/hub/attachments/store.js.map +1 -1
- package/dist/hub/audit/index.d.ts +5 -1
- package/dist/hub/audit/index.js +43 -3
- package/dist/hub/audit/index.js.map +1 -1
- package/dist/hub/buttons.js +3 -1
- package/dist/hub/buttons.js.map +1 -1
- package/dist/hub/catalog.d.ts +19 -6
- package/dist/hub/catalog.js +102 -27
- package/dist/hub/catalog.js.map +1 -1
- package/dist/hub/client.d.ts +20 -0
- package/dist/hub/client.js +175 -12
- package/dist/hub/client.js.map +1 -1
- package/dist/hub/compose/member.d.ts +65 -8
- package/dist/hub/compose/member.js +404 -35
- package/dist/hub/compose/member.js.map +1 -1
- package/dist/hub/compose/server.d.ts +30 -5
- package/dist/hub/compose/server.js +140 -20
- package/dist/hub/compose/server.js.map +1 -1
- package/dist/hub/direct-posts-model.d.ts +1 -0
- package/dist/hub/direct-posts-model.js +2 -0
- package/dist/hub/direct-posts-model.js.map +1 -0
- package/dist/hub/direct-posts.d.ts +36 -0
- package/dist/hub/direct-posts.js +145 -0
- package/dist/hub/direct-posts.js.map +1 -0
- package/dist/hub/directory/directory.js +27 -7
- package/dist/hub/directory/directory.js.map +1 -1
- package/dist/hub/directory/types.d.ts +10 -4
- package/dist/hub/directory/types.js.map +1 -1
- package/dist/hub/display-name.d.ts +10 -0
- package/dist/hub/display-name.js +35 -0
- package/dist/hub/display-name.js.map +1 -0
- package/dist/hub/execution/service.d.ts +2 -1
- package/dist/hub/execution/service.js +2 -1
- package/dist/hub/execution/service.js.map +1 -1
- package/dist/hub/fleet-info.d.ts +12 -0
- package/dist/hub/fleet-info.js +14 -0
- package/dist/hub/fleet-info.js.map +1 -0
- package/dist/hub/fleet-update-model.d.ts +100 -0
- package/dist/hub/fleet-update-model.js +15 -0
- package/dist/hub/fleet-update-model.js.map +1 -0
- package/dist/hub/fleet-updates.d.ts +46 -0
- package/dist/hub/fleet-updates.js +284 -0
- package/dist/hub/fleet-updates.js.map +1 -0
- package/dist/hub/fleet-versions.d.ts +28 -0
- package/dist/hub/fleet-versions.js +81 -0
- package/dist/hub/fleet-versions.js.map +1 -0
- package/dist/hub/group-policy/admin-api.d.ts +1 -0
- package/dist/hub/group-policy/admin-api.js +10 -1
- package/dist/hub/group-policy/admin-api.js.map +1 -1
- package/dist/hub/group-policy/admin-control.d.ts +1 -0
- package/dist/hub/group-policy/admin-control.js +13 -4
- package/dist/hub/group-policy/admin-control.js.map +1 -1
- package/dist/hub/group-policy/admin-dto.d.ts +39 -1
- package/dist/hub/group-policy/admin-dto.js.map +1 -1
- package/dist/hub/group-policy/admin-facts.d.ts +4 -2
- package/dist/hub/group-policy/admin-facts.js +17 -2
- package/dist/hub/group-policy/admin-facts.js.map +1 -1
- package/dist/hub/group-policy/admin-impact.d.ts +36 -6
- package/dist/hub/group-policy/admin-impact.js +21 -7
- package/dist/hub/group-policy/admin-impact.js.map +1 -1
- package/dist/hub/group-policy/admin-inventory.d.ts +2 -0
- package/dist/hub/group-policy/admin-inventory.js +13 -4
- package/dist/hub/group-policy/admin-inventory.js.map +1 -1
- package/dist/hub/group-policy/admin-search.d.ts +2 -1
- package/dist/hub/group-policy/admin-search.js +56 -7
- package/dist/hub/group-policy/admin-search.js.map +1 -1
- package/dist/hub/group-policy/authorization.d.ts +2 -0
- package/dist/hub/group-policy/authorization.js +7 -2
- package/dist/hub/group-policy/authorization.js.map +1 -1
- package/dist/hub/group-policy/impact-inventory.d.ts +4 -1
- package/dist/hub/group-policy/impact-inventory.js +23 -2
- package/dist/hub/group-policy/impact-inventory.js.map +1 -1
- package/dist/hub/group-policy/model.d.ts +52 -1
- package/dist/hub/group-policy/model.js +20 -7
- package/dist/hub/group-policy/model.js.map +1 -1
- package/dist/hub/group-policy/resources.d.ts +2 -0
- package/dist/hub/group-policy/resources.js +12 -1
- package/dist/hub/group-policy/resources.js.map +1 -1
- package/dist/hub/group-policy/store.js +22 -3
- package/dist/hub/group-policy/store.js.map +1 -1
- package/dist/hub/group-policy/team-subjects.d.ts +16 -0
- package/dist/hub/group-policy/team-subjects.js +32 -0
- package/dist/hub/group-policy/team-subjects.js.map +1 -0
- package/dist/hub/http/compose.d.ts +17 -0
- package/dist/hub/http/compose.js +903 -100
- package/dist/hub/http/compose.js.map +1 -1
- package/dist/hub/http/core.d.ts +11 -1
- package/dist/hub/http/core.js +70 -10
- package/dist/hub/http/core.js.map +1 -1
- package/dist/hub/http/deps.d.ts +21 -0
- package/dist/hub/http/schema.js +54 -1
- package/dist/hub/http/schema.js.map +1 -1
- package/dist/hub/init/text.js +1 -1
- package/dist/hub/invitations.js +15 -7
- package/dist/hub/invitations.js.map +1 -1
- package/dist/hub/join/client.js +75 -42
- package/dist/hub/join/client.js.map +1 -1
- package/dist/hub/join/service.d.ts +9 -1
- package/dist/hub/join/service.js +17 -3
- package/dist/hub/join/service.js.map +1 -1
- package/dist/hub/lapse-carry.d.ts +45 -0
- package/dist/hub/lapse-carry.js +62 -0
- package/dist/hub/lapse-carry.js.map +1 -0
- package/dist/hub/mcp/auth-schema.d.ts +7 -0
- package/dist/hub/mcp/auth-schema.js +31 -0
- package/dist/hub/mcp/auth-schema.js.map +1 -0
- package/dist/hub/mcp/auth.d.ts +89 -0
- package/dist/hub/mcp/auth.js +374 -0
- package/dist/hub/mcp/auth.js.map +1 -0
- package/dist/hub/mcp/catalog.d.ts +44 -0
- package/dist/hub/mcp/catalog.js +31 -0
- package/dist/hub/mcp/catalog.js.map +1 -0
- package/dist/hub/mcp/door-schema.d.ts +7 -0
- package/dist/hub/mcp/door-schema.js +20 -0
- package/dist/hub/mcp/door-schema.js.map +1 -0
- package/dist/hub/mcp/http.d.ts +25 -0
- package/dist/hub/mcp/http.js +259 -0
- package/dist/hub/mcp/http.js.map +1 -0
- package/dist/hub/mcp/policy.d.ts +65 -0
- package/dist/hub/mcp/policy.js +153 -0
- package/dist/hub/mcp/policy.js.map +1 -0
- package/dist/hub/mcp/server.d.ts +3 -0
- package/dist/hub/mcp/server.js +32 -0
- package/dist/hub/mcp/server.js.map +1 -0
- package/dist/hub/mcp/tools.d.ts +31 -0
- package/dist/hub/mcp/tools.js +177 -0
- package/dist/hub/mcp/tools.js.map +1 -0
- package/dist/hub/member/agent-catalog.d.ts +31 -0
- package/dist/hub/member/agent-catalog.js +91 -0
- package/dist/hub/member/agent-catalog.js.map +1 -0
- package/dist/hub/member/agent-intro.d.ts +29 -0
- package/dist/hub/member/agent-intro.js +73 -0
- package/dist/hub/member/agent-intro.js.map +1 -0
- package/dist/hub/member/agent-pictures.d.ts +76 -0
- package/dist/hub/member/agent-pictures.js +196 -0
- package/dist/hub/member/agent-pictures.js.map +1 -0
- package/dist/hub/member/direct-rooms.d.ts +9 -0
- package/dist/hub/member/direct-rooms.js +14 -0
- package/dist/hub/member/direct-rooms.js.map +1 -0
- package/dist/hub/member/display-name.d.ts +9 -0
- package/dist/hub/member/display-name.js +71 -0
- package/dist/hub/member/display-name.js.map +1 -0
- package/dist/hub/member/exposure-api.d.ts +11 -3
- package/dist/hub/member/exposure-api.js +24 -10
- package/dist/hub/member/exposure-api.js.map +1 -1
- package/dist/hub/member/exposures.d.ts +16 -4
- package/dist/hub/member/exposures.js +47 -13
- package/dist/hub/member/exposures.js.map +1 -1
- package/dist/hub/member/pairing-api.js +3 -2
- package/dist/hub/member/pairing-api.js.map +1 -1
- package/dist/hub/member/recommendations.d.ts +37 -0
- package/dist/hub/member/recommendations.js +129 -0
- package/dist/hub/member/recommendations.js.map +1 -0
- package/dist/hub/member/room-ask.d.ts +104 -6
- package/dist/hub/member/room-ask.js +505 -34
- package/dist/hub/member/room-ask.js.map +1 -1
- package/dist/hub/member/room-asker-store.d.ts +48 -0
- package/dist/hub/member/room-asker-store.js +181 -0
- package/dist/hub/member/room-asker-store.js.map +1 -0
- package/dist/hub/member/room-context-budget.d.ts +5 -0
- package/dist/hub/member/room-context-budget.js +34 -0
- package/dist/hub/member/room-context-budget.js.map +1 -0
- package/dist/hub/member/room-mention-feedback.d.ts +46 -0
- package/dist/hub/member/room-mention-feedback.js +121 -0
- package/dist/hub/member/room-mention-feedback.js.map +1 -0
- package/dist/hub/member/room-notification.d.ts +9 -0
- package/dist/hub/member/room-notification.js +2 -0
- package/dist/hub/member/room-notification.js.map +1 -0
- package/dist/hub/member/room-post-answers.d.ts +48 -0
- package/dist/hub/member/room-post-answers.js +152 -0
- package/dist/hub/member/room-post-answers.js.map +1 -0
- package/dist/hub/member/room-post-receipt.d.ts +21 -0
- package/dist/hub/member/room-post-receipt.js +49 -0
- package/dist/hub/member/room-post-receipt.js.map +1 -0
- package/dist/hub/member/room-post.d.ts +144 -0
- package/dist/hub/member/room-post.js +339 -0
- package/dist/hub/member/room-post.js.map +1 -0
- package/dist/hub/member/room-reaction-acks.d.ts +12 -0
- package/dist/hub/member/room-reaction-acks.js +44 -0
- package/dist/hub/member/room-reaction-acks.js.map +1 -0
- package/dist/hub/member/sharing-journal.d.ts +252 -0
- package/dist/hub/member/sharing-journal.js +212 -0
- package/dist/hub/member/sharing-journal.js.map +1 -0
- package/dist/hub/member/sharing-link.d.ts +25 -0
- package/dist/hub/member/sharing-link.js +68 -0
- package/dist/hub/member/sharing-link.js.map +1 -0
- package/dist/hub/member/sharing-result.d.ts +6 -0
- package/dist/hub/member/sharing-result.js +46 -0
- package/dist/hub/member/sharing-result.js.map +1 -0
- package/dist/hub/member/sharing.d.ts +39 -0
- package/dist/hub/member/sharing.js +188 -0
- package/dist/hub/member/sharing.js.map +1 -0
- package/dist/hub/member/updates.d.ts +98 -0
- package/dist/hub/member/updates.js +322 -0
- package/dist/hub/member/updates.js.map +1 -0
- package/dist/hub/pairing.d.ts +15 -1
- package/dist/hub/pairing.js +33 -2
- package/dist/hub/pairing.js.map +1 -1
- package/dist/hub/personal/owner-host.d.ts +146 -0
- package/dist/hub/personal/owner-host.js +289 -0
- package/dist/hub/personal/owner-host.js.map +1 -0
- package/dist/hub/personal/refusals.d.ts +11 -0
- package/dist/hub/personal/refusals.js +33 -0
- package/dist/hub/personal/refusals.js.map +1 -0
- package/dist/hub/personal/runtime-host.d.ts +26 -0
- package/dist/hub/personal/runtime-host.js +51 -0
- package/dist/hub/personal/runtime-host.js.map +1 -0
- package/dist/hub/personal/schema.d.ts +4 -0
- package/dist/hub/personal/schema.js +54 -0
- package/dist/hub/personal/schema.js.map +1 -0
- package/dist/hub/personal/turns.d.ts +39 -0
- package/dist/hub/personal/turns.js +221 -0
- package/dist/hub/personal/turns.js.map +1 -0
- package/dist/hub/personal/types.d.ts +42 -0
- package/dist/hub/personal/types.js +2 -0
- package/dist/hub/personal/types.js.map +1 -0
- package/dist/hub/policy.d.ts +12 -3
- package/dist/hub/policy.js +107 -23
- package/dist/hub/policy.js.map +1 -1
- package/dist/hub/protocol.d.ts +1481 -49
- package/dist/hub/protocol.js +130 -17
- package/dist/hub/protocol.js.map +1 -1
- package/dist/hub/published-version.d.ts +3 -0
- package/dist/hub/published-version.js +35 -0
- package/dist/hub/published-version.js.map +1 -0
- package/dist/hub/question-close-model.d.ts +17 -0
- package/dist/hub/question-close-model.js +7 -0
- package/dist/hub/question-close-model.js.map +1 -0
- package/dist/hub/quota.d.ts +2 -2
- package/dist/hub/quota.js +9 -5
- package/dist/hub/quota.js.map +1 -1
- package/dist/hub/read-statement.d.ts +6 -0
- package/dist/hub/read-statement.js +33 -0
- package/dist/hub/read-statement.js.map +1 -0
- package/dist/hub/recommendation-model.d.ts +36 -0
- package/dist/hub/recommendation-model.js +9 -0
- package/dist/hub/recommendation-model.js.map +1 -0
- package/dist/hub/recommendations.d.ts +58 -0
- package/dist/hub/recommendations.js +212 -0
- package/dist/hub/recommendations.js.map +1 -0
- package/dist/hub/representative.d.ts +57 -0
- package/dist/hub/representative.js +239 -19
- package/dist/hub/representative.js.map +1 -1
- package/dist/hub/roles/admin-control.d.ts +29 -0
- package/dist/hub/roles/admin-control.js +187 -0
- package/dist/hub/roles/admin-control.js.map +1 -0
- package/dist/hub/roles/admin-types.d.ts +72 -0
- package/dist/hub/roles/admin-types.js +2 -0
- package/dist/hub/roles/admin-types.js.map +1 -0
- package/dist/hub/roles/allowed-list-control.d.ts +34 -0
- package/dist/hub/roles/allowed-list-control.js +179 -0
- package/dist/hub/roles/allowed-list-control.js.map +1 -0
- package/dist/hub/roles/allowed-list.d.ts +8 -0
- package/dist/hub/roles/allowed-list.js +49 -0
- package/dist/hub/roles/allowed-list.js.map +1 -0
- package/dist/hub/roles/audit-details.d.ts +146 -0
- package/dist/hub/roles/audit-details.js +26 -0
- package/dist/hub/roles/audit-details.js.map +1 -0
- package/dist/hub/roles/authority.d.ts +20 -3
- package/dist/hub/roles/authority.js +165 -87
- package/dist/hub/roles/authority.js.map +1 -1
- package/dist/hub/roles/change.d.ts +3 -1
- package/dist/hub/roles/change.js +7 -2
- package/dist/hub/roles/change.js.map +1 -1
- package/dist/hub/roles/clock.d.ts +4 -1
- package/dist/hub/roles/clock.js +15 -12
- package/dist/hub/roles/clock.js.map +1 -1
- package/dist/hub/roles/convert.js +1 -1
- package/dist/hub/roles/convert.js.map +1 -1
- package/dist/hub/roles/cutover-clock-facts.d.ts +13 -0
- package/dist/hub/roles/cutover-clock-facts.js +25 -0
- package/dist/hub/roles/cutover-clock-facts.js.map +1 -0
- package/dist/hub/roles/cutover-inventory.d.ts +5 -0
- package/dist/hub/roles/cutover-inventory.js +27 -4
- package/dist/hub/roles/cutover-inventory.js.map +1 -1
- package/dist/hub/roles/cutover-marker.d.ts +18 -2
- package/dist/hub/roles/cutover-marker.js +6 -2
- package/dist/hub/roles/cutover-marker.js.map +1 -1
- package/dist/hub/roles/cutover.d.ts +2 -2
- package/dist/hub/roles/cutover.js +3 -4
- package/dist/hub/roles/cutover.js.map +1 -1
- package/dist/hub/roles/delegation.d.ts +4 -1
- package/dist/hub/roles/delegation.js +9 -4
- package/dist/hub/roles/delegation.js.map +1 -1
- package/dist/hub/roles/evaluate.d.ts +2 -1
- package/dist/hub/roles/evaluate.js +14 -0
- package/dist/hub/roles/evaluate.js.map +1 -1
- package/dist/hub/roles/expiry-effects.d.ts +8 -0
- package/dist/hub/roles/expiry-effects.js +50 -0
- package/dist/hub/roles/expiry-effects.js.map +1 -0
- package/dist/hub/roles/migrations.d.ts +7 -0
- package/dist/hub/roles/migrations.js +44 -0
- package/dist/hub/roles/migrations.js.map +1 -0
- package/dist/hub/roles/model.d.ts +30 -2
- package/dist/hub/roles/model.js +14 -7
- package/dist/hub/roles/model.js.map +1 -1
- package/dist/hub/roles/overview.d.ts +8 -0
- package/dist/hub/roles/overview.js +15 -0
- package/dist/hub/roles/overview.js.map +1 -0
- package/dist/hub/roles/read.d.ts +4 -0
- package/dist/hub/roles/read.js +37 -7
- package/dist/hub/roles/read.js.map +1 -1
- package/dist/hub/roles/resource-effects.d.ts +17 -0
- package/dist/hub/roles/resource-effects.js +62 -0
- package/dist/hub/roles/resource-effects.js.map +1 -0
- package/dist/hub/roles/review.d.ts +16 -0
- package/dist/hub/roles/review.js +42 -0
- package/dist/hub/roles/review.js.map +1 -0
- package/dist/hub/roles/writer.d.ts +14 -3
- package/dist/hub/roles/writer.js +64 -16
- package/dist/hub/roles/writer.js.map +1 -1
- package/dist/hub/room-agent-discovery-model.d.ts +29 -0
- package/dist/hub/room-agent-discovery-model.js +33 -0
- package/dist/hub/room-agent-discovery-model.js.map +1 -0
- package/dist/hub/room-agent-discovery.d.ts +14 -0
- package/dist/hub/room-agent-discovery.js +65 -0
- package/dist/hub/room-agent-discovery.js.map +1 -0
- package/dist/hub/room-agent-requests.d.ts +71 -0
- package/dist/hub/room-agent-requests.js +377 -0
- package/dist/hub/room-agent-requests.js.map +1 -0
- package/dist/hub/room-answer-status-model.d.ts +3 -0
- package/dist/hub/room-answer-status-model.js +4 -0
- package/dist/hub/room-answer-status-model.js.map +1 -0
- package/dist/hub/room-asker-identity-model.d.ts +53 -0
- package/dist/hub/room-asker-identity-model.js +14 -0
- package/dist/hub/room-asker-identity-model.js.map +1 -0
- package/dist/hub/room-asker-identity.d.ts +22 -0
- package/dist/hub/room-asker-identity.js +43 -0
- package/dist/hub/room-asker-identity.js.map +1 -0
- package/dist/hub/room-brief-model.d.ts +30 -0
- package/dist/hub/room-brief-model.js +38 -0
- package/dist/hub/room-brief-model.js.map +1 -0
- package/dist/hub/room-context-model.d.ts +45 -0
- package/dist/hub/room-context-model.js +12 -0
- package/dist/hub/room-context-model.js.map +1 -0
- package/dist/hub/room-history-model.d.ts +87 -0
- package/dist/hub/room-history-model.js +14 -0
- package/dist/hub/room-history-model.js.map +1 -0
- package/dist/hub/room-members-model.d.ts +63 -0
- package/dist/hub/room-members-model.js +7 -0
- package/dist/hub/room-members-model.js.map +1 -0
- package/dist/hub/room-mention-feedback-model.d.ts +12 -0
- package/dist/hub/room-mention-feedback-model.js +12 -0
- package/dist/hub/room-mention-feedback-model.js.map +1 -0
- package/dist/hub/room-react-ack-model.d.ts +2 -0
- package/dist/hub/room-react-ack-model.js +3 -0
- package/dist/hub/room-react-ack-model.js.map +1 -0
- package/dist/hub/rooms/admin.d.ts +6 -0
- package/dist/hub/rooms/admin.js +33 -0
- package/dist/hub/rooms/admin.js.map +1 -1
- package/dist/hub/rooms/agents.d.ts +52 -11
- package/dist/hub/rooms/agents.js +418 -37
- package/dist/hub/rooms/agents.js.map +1 -1
- package/dist/hub/rooms/asker-identity.d.ts +21 -0
- package/dist/hub/rooms/asker-identity.js +86 -0
- package/dist/hub/rooms/asker-identity.js.map +1 -0
- package/dist/hub/rooms/assistant.d.ts +1 -6
- package/dist/hub/rooms/assistant.js +7 -2
- package/dist/hub/rooms/assistant.js.map +1 -1
- package/dist/hub/rooms/automation.d.ts +24 -0
- package/dist/hub/rooms/automation.js +66 -0
- package/dist/hub/rooms/automation.js.map +1 -0
- package/dist/hub/rooms/brief.d.ts +18 -0
- package/dist/hub/rooms/brief.js +39 -0
- package/dist/hub/rooms/brief.js.map +1 -0
- package/dist/hub/rooms/buttons.d.ts +85 -0
- package/dist/hub/rooms/buttons.js +62 -0
- package/dist/hub/rooms/buttons.js.map +1 -0
- package/dist/hub/rooms/context-cursor.d.ts +18 -0
- package/dist/hub/rooms/context-cursor.js +61 -0
- package/dist/hub/rooms/context-cursor.js.map +1 -0
- package/dist/hub/rooms/context.d.ts +1 -1
- package/dist/hub/rooms/context.js +4 -4
- package/dist/hub/rooms/context.js.map +1 -1
- package/dist/hub/rooms/direct-view.d.ts +12 -3
- package/dist/hub/rooms/direct-view.js +26 -10
- package/dist/hub/rooms/direct-view.js.map +1 -1
- package/dist/hub/rooms/directory.d.ts +13 -0
- package/dist/hub/rooms/directory.js +12 -3
- package/dist/hub/rooms/directory.js.map +1 -1
- package/dist/hub/rooms/history.d.ts +8 -0
- package/dist/hub/rooms/history.js +31 -0
- package/dist/hub/rooms/history.js.map +1 -0
- package/dist/hub/rooms/members-page.d.ts +33 -0
- package/dist/hub/rooms/members-page.js +37 -0
- package/dist/hub/rooms/members-page.js.map +1 -0
- package/dist/hub/rooms/mentions.d.ts +15 -0
- package/dist/hub/rooms/mentions.js +43 -0
- package/dist/hub/rooms/mentions.js.map +1 -0
- package/dist/hub/rooms/office.d.ts +141 -0
- package/dist/hub/rooms/office.js +81 -0
- package/dist/hub/rooms/office.js.map +1 -0
- package/dist/hub/rooms/post-replies.d.ts +23 -0
- package/dist/hub/rooms/post-replies.js +114 -0
- package/dist/hub/rooms/post-replies.js.map +1 -0
- package/dist/hub/rooms/purpose.d.ts +7 -0
- package/dist/hub/rooms/purpose.js +14 -0
- package/dist/hub/rooms/purpose.js.map +1 -0
- package/dist/hub/rooms/schema.d.ts +16 -0
- package/dist/hub/rooms/schema.js +56 -0
- package/dist/hub/rooms/schema.js.map +1 -1
- package/dist/hub/rooms/service.d.ts +400 -8
- package/dist/hub/rooms/service.js +1231 -72
- package/dist/hub/rooms/service.js.map +1 -1
- package/dist/hub/rooms/types.d.ts +48 -4
- package/dist/hub/rooms.d.ts +33 -6
- package/dist/hub/rooms.js +236 -51
- package/dist/hub/rooms.js.map +1 -1
- package/dist/hub/runtime.d.ts +1 -1
- package/dist/hub/runtime.js +17 -4
- package/dist/hub/runtime.js.map +1 -1
- package/dist/hub/send-timing.d.ts +6 -0
- package/dist/hub/send-timing.js +39 -0
- package/dist/hub/send-timing.js.map +1 -0
- package/dist/hub/server.d.ts +8 -1
- package/dist/hub/server.js +187 -7
- package/dist/hub/server.js.map +1 -1
- package/dist/hub/session-directory-transition.d.ts +3 -1
- package/dist/hub/session-directory-transition.js +25 -12
- package/dist/hub/session-directory-transition.js.map +1 -1
- package/dist/hub/session-epoch.js +2 -1
- package/dist/hub/session-epoch.js.map +1 -1
- package/dist/hub/session-limits.d.ts +58 -0
- package/dist/hub/session-limits.js +121 -0
- package/dist/hub/session-limits.js.map +1 -0
- package/dist/hub/sessions.d.ts +5 -2
- package/dist/hub/sessions.js +84 -12
- package/dist/hub/sessions.js.map +1 -1
- package/dist/hub/settings-commit.d.ts +32 -1
- package/dist/hub/settings-commit.js +11 -4
- package/dist/hub/settings-commit.js.map +1 -1
- package/dist/hub/settings-directory-ca.js +1 -1
- package/dist/hub/settings-directory-ca.js.map +1 -1
- package/dist/hub/settings-directory-control.js +7 -7
- package/dist/hub/settings-directory-control.js.map +1 -1
- package/dist/hub/settings-directory-decision.js +15 -8
- package/dist/hub/settings-directory-decision.js.map +1 -1
- package/dist/hub/settings-directory-http.d.ts +2 -0
- package/dist/hub/settings-directory-http.js +21 -6
- package/dist/hub/settings-directory-http.js.map +1 -1
- package/dist/hub/settings-directory-proof.d.ts +5 -1
- package/dist/hub/settings-directory-proof.js +49 -10
- package/dist/hub/settings-directory-proof.js.map +1 -1
- package/dist/hub/settings-directory-recovery.js +2 -1
- package/dist/hub/settings-directory-recovery.js.map +1 -1
- package/dist/hub/settings-directory-save.d.ts +2 -0
- package/dist/hub/settings-directory-save.js +9 -6
- package/dist/hub/settings-directory-save.js.map +1 -1
- package/dist/hub/settings-member-address-decision.js +3 -2
- package/dist/hub/settings-member-address-decision.js.map +1 -1
- package/dist/hub/settings-web-address-decision.js +2 -1
- package/dist/hub/settings-web-address-decision.js.map +1 -1
- package/dist/hub/sharing-previous-access.d.ts +22 -0
- package/dist/hub/sharing-previous-access.js +93 -0
- package/dist/hub/sharing-previous-access.js.map +1 -0
- package/dist/hub/sharing-requests.d.ts +174 -0
- package/dist/hub/sharing-requests.js +326 -0
- package/dist/hub/sharing-requests.js.map +1 -0
- package/dist/hub/sharing-retention.d.ts +47 -0
- package/dist/hub/sharing-retention.js +83 -0
- package/dist/hub/sharing-retention.js.map +1 -0
- package/dist/hub/sharing-withdrawal.d.ts +14 -0
- package/dist/hub/sharing-withdrawal.js +28 -0
- package/dist/hub/sharing-withdrawal.js.map +1 -0
- package/dist/hub/sharing.js +2 -2
- package/dist/hub/sharing.js.map +1 -1
- package/dist/hub/socket.d.ts +1 -0
- package/dist/hub/socket.js +39 -2
- package/dist/hub/socket.js.map +1 -1
- package/dist/hub/store.d.ts +5 -0
- package/dist/hub/store.js +28 -5
- package/dist/hub/store.js.map +1 -1
- package/dist/hub/teams/index.d.ts +8 -3
- package/dist/hub/teams/index.js +106 -31
- package/dist/hub/teams/index.js.map +1 -1
- package/dist/hub/teams/store.d.ts +5 -1
- package/dist/hub/teams/store.js +25 -2
- package/dist/hub/teams/store.js.map +1 -1
- package/dist/hub/teams/types.d.ts +19 -2
- package/dist/hub/types.d.ts +176 -5
- package/dist/hub-agent-incarnation-record.d.ts +24 -0
- package/dist/hub-agent-incarnation-record.js +46 -0
- package/dist/hub-agent-incarnation-record.js.map +1 -0
- package/dist/hub-character-plan.d.ts +47 -0
- package/dist/hub-character-plan.js +70 -0
- package/dist/hub-character-plan.js.map +1 -0
- package/dist/hub-classic-private.d.ts +19 -0
- package/dist/hub-classic-private.js +64 -0
- package/dist/hub-classic-private.js.map +1 -0
- package/dist/hub-contact-windows.d.ts +23 -0
- package/dist/hub-contact-windows.js +89 -0
- package/dist/hub-contact-windows.js.map +1 -0
- package/dist/hub-page-sharing-settings.d.ts +6 -0
- package/dist/hub-page-sharing-settings.js +19 -0
- package/dist/hub-page-sharing-settings.js.map +1 -0
- package/dist/hub-pairing-summary.d.ts +1 -1
- package/dist/hub-picture-reduce.d.ts +34 -0
- package/dist/hub-picture-reduce.js +101 -0
- package/dist/hub-picture-reduce.js.map +1 -0
- package/dist/hub-picture-worker.d.ts +1 -0
- package/dist/hub-picture-worker.js +19 -0
- package/dist/hub-picture-worker.js.map +1 -0
- package/dist/hub-report-target.d.ts +6 -0
- package/dist/hub-report-target.js +6 -0
- package/dist/hub-report-target.js.map +1 -1
- package/dist/hub-room-conversation.d.ts +14 -0
- package/dist/hub-room-conversation.js +60 -0
- package/dist/hub-room-conversation.js.map +1 -0
- package/dist/hub-room-reply-warning.d.ts +2 -0
- package/dist/hub-room-reply-warning.js +16 -0
- package/dist/hub-room-reply-warning.js.map +1 -0
- package/dist/hub-sharing-notice.d.ts +43 -0
- package/dist/hub-sharing-notice.js +34 -0
- package/dist/hub-sharing-notice.js.map +1 -0
- package/dist/hub-update-notice.d.ts +12 -0
- package/dist/hub-update-notice.js +35 -0
- package/dist/hub-update-notice.js.map +1 -0
- package/dist/human-delivery-receipts.d.ts +27 -5
- package/dist/human-delivery-receipts.js +52 -8
- package/dist/human-delivery-receipts.js.map +1 -1
- package/dist/install-lock.d.ts +15 -1
- package/dist/install-lock.js +16 -8
- package/dist/install-lock.js.map +1 -1
- package/dist/install-ownership.d.ts +165 -0
- package/dist/install-ownership.js +404 -0
- package/dist/install-ownership.js.map +1 -0
- package/dist/instance-config-impact.js +7 -2
- package/dist/instance-config-impact.js.map +1 -1
- package/dist/instance-lifecycle.d.ts +32 -4
- package/dist/instance-lifecycle.js +111 -25
- package/dist/instance-lifecycle.js.map +1 -1
- package/dist/instruction-file-sizes.d.ts +46 -0
- package/dist/instruction-file-sizes.js +115 -0
- package/dist/instruction-file-sizes.js.map +1 -0
- package/dist/instructions.d.ts +40 -2
- package/dist/instructions.js +68 -34
- package/dist/instructions.js.map +1 -1
- package/dist/local-pane-endpoint.d.ts +18 -1
- package/dist/local-pane-endpoint.js +44 -2
- package/dist/local-pane-endpoint.js.map +1 -1
- package/dist/locale.d.ts +2 -0
- package/dist/locale.js +956 -295
- package/dist/locale.js.map +1 -1
- package/dist/log-steps.d.ts +5 -0
- package/dist/log-steps.js +6 -2
- package/dist/log-steps.js.map +1 -1
- package/dist/login-controller.d.ts +45 -2
- package/dist/login-controller.js +98 -10
- package/dist/login-controller.js.map +1 -1
- package/dist/login-flows.js +1 -1
- package/dist/login-flows.js.map +1 -1
- package/dist/ls-rows.d.ts +2 -0
- package/dist/ls-rows.js.map +1 -1
- package/dist/memory-guidance.d.ts +5 -0
- package/dist/memory-guidance.js +14 -0
- package/dist/memory-guidance.js.map +1 -0
- package/dist/memory-pressure.js +8 -1
- package/dist/memory-pressure.js.map +1 -1
- package/dist/model-defaults.d.ts +5 -0
- package/dist/model-defaults.js +6 -0
- package/dist/model-defaults.js.map +1 -0
- package/dist/native-agent-admission.d.ts +7 -0
- package/dist/native-agent-admission.js +55 -3
- package/dist/native-agent-admission.js.map +1 -1
- package/dist/native-exec-context.d.ts +11 -0
- package/dist/native-exec-context.js +18 -0
- package/dist/native-exec-context.js.map +1 -0
- package/dist/native-exec-input.d.ts +56 -0
- package/dist/native-exec-input.js +89 -0
- package/dist/native-exec-input.js.map +1 -0
- package/dist/native-mcp.d.ts +26 -1
- package/dist/native-mcp.js +85 -18
- package/dist/native-mcp.js.map +1 -1
- package/dist/native-model-catalog.d.ts +15 -0
- package/dist/native-model-catalog.js +43 -3
- package/dist/native-model-catalog.js.map +1 -1
- package/dist/native-pane-lifecycle.d.ts +12 -0
- package/dist/native-pane-lifecycle.js +28 -2
- package/dist/native-pane-lifecycle.js.map +1 -1
- package/dist/native-pane-manager.d.ts +37 -6
- package/dist/native-pane-manager.js +160 -8
- package/dist/native-pane-manager.js.map +1 -1
- package/dist/native-pane-tools.js +3 -0
- package/dist/native-pane-tools.js.map +1 -1
- package/dist/needs-you-hub.d.ts +7 -0
- package/dist/needs-you-hub.js +48 -7
- package/dist/needs-you-hub.js.map +1 -1
- package/dist/needs-you.d.ts +66 -2
- package/dist/needs-you.js +26 -1
- package/dist/needs-you.js.map +1 -1
- package/dist/office-share-page.js +5 -5
- package/dist/office-share-page.js.map +1 -1
- package/dist/office-share.js +2 -1
- package/dist/office-share.js.map +1 -1
- package/dist/outbound-handlers.d.ts +49 -4
- package/dist/outbound-handlers.js +263 -20
- package/dist/outbound-handlers.js.map +1 -1
- package/dist/outbound-schemas.d.ts +44 -0
- package/dist/outbound-schemas.js +56 -30
- package/dist/outbound-schemas.js.map +1 -1
- package/dist/package-preimage.js +4 -0
- package/dist/package-preimage.js.map +1 -1
- package/dist/pane-port.d.ts +3 -0
- package/dist/pause-marker.d.ts +1 -1
- package/dist/pause-marker.js +1 -1
- package/dist/pause-marker.js.map +1 -1
- package/dist/plist-args.d.ts +9 -0
- package/dist/plist-args.js +22 -0
- package/dist/plist-args.js.map +1 -0
- package/dist/profile-signins.d.ts +1 -0
- package/dist/profile-signins.js +3 -1
- package/dist/profile-signins.js.map +1 -1
- package/dist/public-preview.d.ts +4 -6
- package/dist/public-preview.js +5 -2
- package/dist/public-preview.js.map +1 -1
- package/dist/public-web-gateway.d.ts +20 -0
- package/dist/public-web-gateway.js +262 -9
- package/dist/public-web-gateway.js.map +1 -1
- package/dist/public-web-link.d.ts +34 -3
- package/dist/public-web-link.js +50 -3
- package/dist/public-web-link.js.map +1 -1
- package/dist/queued-handoffs.d.ts +16 -4
- package/dist/queued-handoffs.js +18 -1
- package/dist/queued-handoffs.js.map +1 -1
- package/dist/quickstart-api.d.ts +0 -1
- package/dist/quickstart-api.js +8 -1
- package/dist/quickstart-api.js.map +1 -1
- package/dist/quickstart.d.ts +1 -1
- package/dist/quickstart.js +2 -3
- package/dist/quickstart.js.map +1 -1
- package/dist/recover.cjs +2639 -0
- package/dist/remote-card-answer.d.ts +1 -1
- package/dist/remote-card-answer.js +8 -1
- package/dist/remote-card-answer.js.map +1 -1
- package/dist/remote-card-prompt.d.ts +7 -2
- package/dist/remote-card-prompt.js +13 -4
- package/dist/remote-card-prompt.js.map +1 -1
- package/dist/reply-buttons-controller.d.ts +3 -1
- package/dist/reply-buttons-controller.js +1 -1
- package/dist/reply-buttons-controller.js.map +1 -1
- package/dist/reply-dedup.js +3 -1
- package/dist/reply-dedup.js.map +1 -1
- package/dist/reply-draft.d.ts +12 -0
- package/dist/reply-draft.js +81 -0
- package/dist/reply-draft.js.map +1 -0
- package/dist/reply-preview-files.d.ts +38 -0
- package/dist/reply-preview-files.js +142 -0
- package/dist/reply-preview-files.js.map +1 -0
- package/dist/reply-preview-spec.d.ts +18 -0
- package/dist/reply-preview-spec.js +27 -0
- package/dist/reply-preview-spec.js.map +1 -0
- package/dist/request-contact-api.d.ts +15 -0
- package/dist/request-contact-api.js +120 -0
- package/dist/request-contact-api.js.map +1 -0
- package/dist/request-contact-card.d.ts +36 -0
- package/dist/request-contact-card.js +206 -0
- package/dist/request-contact-card.js.map +1 -0
- package/dist/request-contact-gate.d.ts +81 -0
- package/dist/request-contact-gate.js +267 -0
- package/dist/request-contact-gate.js.map +1 -0
- package/dist/request-contact-native.d.ts +52 -0
- package/dist/request-contact-native.js +87 -0
- package/dist/request-contact-native.js.map +1 -0
- package/dist/request-contact-types.d.ts +86 -0
- package/dist/request-contact-types.js +7 -0
- package/dist/request-contact-types.js.map +1 -0
- package/dist/request-context-activation.d.ts +29 -0
- package/dist/request-context-activation.js +85 -0
- package/dist/request-context-activation.js.map +1 -0
- package/dist/request-context-admission.d.ts +22 -0
- package/dist/request-context-admission.js +12 -0
- package/dist/request-context-admission.js.map +1 -0
- package/dist/request-context-boot.d.ts +35 -0
- package/dist/request-context-boot.js +97 -0
- package/dist/request-context-boot.js.map +1 -0
- package/dist/request-context-call-protocol.d.ts +12 -0
- package/dist/request-context-call-protocol.js +14 -0
- package/dist/request-context-call-protocol.js.map +1 -0
- package/dist/request-context-call.d.ts +25 -0
- package/dist/request-context-call.js +35 -0
- package/dist/request-context-call.js.map +1 -0
- package/dist/request-context-compatibility.d.ts +20 -0
- package/dist/request-context-compatibility.js +82 -0
- package/dist/request-context-compatibility.js.map +1 -0
- package/dist/request-context-continuation.d.ts +6 -0
- package/dist/request-context-continuation.js +24 -0
- package/dist/request-context-continuation.js.map +1 -0
- package/dist/request-context-control-api.d.ts +119 -0
- package/dist/request-context-control-api.js +179 -0
- package/dist/request-context-control-api.js.map +1 -0
- package/dist/request-context-control-copy.d.ts +3 -0
- package/dist/request-context-control-copy.js +7 -0
- package/dist/request-context-control-copy.js.map +1 -0
- package/dist/request-context-controller.d.ts +44 -0
- package/dist/request-context-controller.js +129 -0
- package/dist/request-context-controller.js.map +1 -0
- package/dist/request-context-delivery-resolver.d.ts +13 -0
- package/dist/request-context-delivery-resolver.js +30 -0
- package/dist/request-context-delivery-resolver.js.map +1 -0
- package/dist/request-context-drain-projection.d.ts +8 -0
- package/dist/request-context-drain-projection.js +40 -0
- package/dist/request-context-drain-projection.js.map +1 -0
- package/dist/request-context-drain.d.ts +61 -0
- package/dist/request-context-drain.js +291 -0
- package/dist/request-context-drain.js.map +1 -0
- package/dist/request-context-enable-offer.d.ts +13 -0
- package/dist/request-context-enable-offer.js +31 -0
- package/dist/request-context-enable-offer.js.map +1 -0
- package/dist/request-context-exec-owner.d.ts +39 -0
- package/dist/request-context-exec-owner.js +128 -0
- package/dist/request-context-exec-owner.js.map +1 -0
- package/dist/request-context-fence.d.ts +28 -0
- package/dist/request-context-fence.js +58 -0
- package/dist/request-context-fence.js.map +1 -0
- package/dist/request-context-go-back-view.d.ts +1 -0
- package/dist/request-context-go-back-view.js +17 -0
- package/dist/request-context-go-back-view.js.map +1 -0
- package/dist/request-context-helper-readiness.d.ts +14 -0
- package/dist/request-context-helper-readiness.js +23 -0
- package/dist/request-context-helper-readiness.js.map +1 -0
- package/dist/request-context-helper.d.ts +20 -0
- package/dist/request-context-helper.js +41 -0
- package/dist/request-context-helper.js.map +1 -0
- package/dist/request-context-hub-resolver.d.ts +29 -0
- package/dist/request-context-hub-resolver.js +90 -0
- package/dist/request-context-hub-resolver.js.map +1 -0
- package/dist/request-context-human-resolver.d.ts +20 -0
- package/dist/request-context-human-resolver.js +77 -0
- package/dist/request-context-human-resolver.js.map +1 -0
- package/dist/request-context-human.d.ts +112 -0
- package/dist/request-context-human.js +176 -0
- package/dist/request-context-human.js.map +1 -0
- package/dist/request-context-inputs.d.ts +21 -0
- package/dist/request-context-inputs.js +63 -0
- package/dist/request-context-inputs.js.map +1 -0
- package/dist/request-context-installation.d.ts +117 -0
- package/dist/request-context-installation.js +328 -0
- package/dist/request-context-installation.js.map +1 -0
- package/dist/request-context-knowledge.d.ts +5 -0
- package/dist/request-context-knowledge.js +32 -0
- package/dist/request-context-knowledge.js.map +1 -0
- package/dist/request-context-migration.d.ts +75 -0
- package/dist/request-context-migration.js +171 -0
- package/dist/request-context-migration.js.map +1 -0
- package/dist/request-context-native-human.d.ts +20 -0
- package/dist/request-context-native-human.js +91 -0
- package/dist/request-context-native-human.js.map +1 -0
- package/dist/request-context-native-output.d.ts +15 -0
- package/dist/request-context-native-output.js +46 -0
- package/dist/request-context-native-output.js.map +1 -0
- package/dist/request-context-native-result.d.ts +15 -0
- package/dist/request-context-native-result.js +46 -0
- package/dist/request-context-native-result.js.map +1 -0
- package/dist/request-context-off.d.ts +22 -0
- package/dist/request-context-off.js +77 -0
- package/dist/request-context-off.js.map +1 -0
- package/dist/request-context-outside-label.d.ts +5 -0
- package/dist/request-context-outside-label.js +28 -0
- package/dist/request-context-outside-label.js.map +1 -0
- package/dist/request-context-pane.d.ts +33 -0
- package/dist/request-context-pane.js +67 -0
- package/dist/request-context-pane.js.map +1 -0
- package/dist/request-context-pending-work.d.ts +11 -0
- package/dist/request-context-pending-work.js +43 -0
- package/dist/request-context-pending-work.js.map +1 -0
- package/dist/request-context-policy.d.ts +90 -0
- package/dist/request-context-policy.js +194 -0
- package/dist/request-context-policy.js.map +1 -0
- package/dist/request-context-protocol.d.ts +137 -0
- package/dist/request-context-protocol.js +38 -0
- package/dist/request-context-protocol.js.map +1 -0
- package/dist/request-context-readiness.d.ts +49 -0
- package/dist/request-context-readiness.js +64 -0
- package/dist/request-context-readiness.js.map +1 -0
- package/dist/request-context-recovery.d.ts +18 -0
- package/dist/request-context-recovery.js +81 -0
- package/dist/request-context-recovery.js.map +1 -0
- package/dist/request-context-relay.d.ts +19 -0
- package/dist/request-context-relay.js +63 -0
- package/dist/request-context-relay.js.map +1 -0
- package/dist/request-context-reply-pending.d.ts +16 -0
- package/dist/request-context-reply-pending.js +77 -0
- package/dist/request-context-reply-pending.js.map +1 -0
- package/dist/request-context-resolution.d.ts +35 -0
- package/dist/request-context-resolution.js +86 -0
- package/dist/request-context-resolution.js.map +1 -0
- package/dist/request-context-retirement.d.ts +21 -0
- package/dist/request-context-retirement.js +16 -0
- package/dist/request-context-retirement.js.map +1 -0
- package/dist/request-context-returns.d.ts +67 -0
- package/dist/request-context-returns.js +211 -0
- package/dist/request-context-returns.js.map +1 -0
- package/dist/request-context-start.d.ts +15 -0
- package/dist/request-context-start.js +2 -0
- package/dist/request-context-start.js.map +1 -0
- package/dist/request-context-store.d.ts +26 -0
- package/dist/request-context-store.js +144 -0
- package/dist/request-context-store.js.map +1 -0
- package/dist/request-context-turns.d.ts +99 -0
- package/dist/request-context-turns.js +216 -0
- package/dist/request-context-turns.js.map +1 -0
- package/dist/request-context-unproved-label.d.ts +4 -0
- package/dist/request-context-unproved-label.js +25 -0
- package/dist/request-context-unproved-label.js.map +1 -0
- package/dist/request-context-update-guard.d.ts +15 -0
- package/dist/request-context-update-guard.js +54 -0
- package/dist/request-context-update-guard.js.map +1 -0
- package/dist/request-context-view.d.ts +33 -0
- package/dist/request-context-view.js +36 -0
- package/dist/request-context-view.js.map +1 -0
- package/dist/request-context-work.d.ts +50 -0
- package/dist/request-context-work.js +178 -0
- package/dist/request-context-work.js.map +1 -0
- package/dist/request-hub-context.d.ts +131 -0
- package/dist/request-hub-context.js +89 -0
- package/dist/request-hub-context.js.map +1 -0
- package/dist/request-hub-output.d.ts +13 -0
- package/dist/request-hub-output.js +33 -0
- package/dist/request-hub-output.js.map +1 -0
- package/dist/restart-progress.d.ts +6 -0
- package/dist/restart-progress.js +5 -0
- package/dist/restart-progress.js.map +1 -1
- package/dist/retained-human-control.d.ts +11 -0
- package/dist/retained-human-control.js +11 -0
- package/dist/retained-human-control.js.map +1 -0
- package/dist/runtime-api.js +10 -2
- package/dist/runtime-api.js.map +1 -1
- package/dist/runtime-build-info.js +2 -1
- package/dist/runtime-build-info.js.map +1 -1
- package/dist/runtime-cli-install.js +20 -14
- package/dist/runtime-cli-install.js.map +1 -1
- package/dist/runtime-cli.js +31 -5
- package/dist/runtime-cli.js.map +1 -1
- package/dist/runtime-client-store.d.ts +5 -0
- package/dist/runtime-client-store.js +35 -1
- package/dist/runtime-client-store.js.map +1 -1
- package/dist/runtime-client.d.ts +6 -0
- package/dist/runtime-client.js +63 -15
- package/dist/runtime-client.js.map +1 -1
- package/dist/runtime-coordinator.d.ts +31 -3
- package/dist/runtime-coordinator.js +145 -12
- package/dist/runtime-coordinator.js.map +1 -1
- package/dist/runtime-install.d.ts +6 -1
- package/dist/runtime-install.js +12 -4
- package/dist/runtime-install.js.map +1 -1
- package/dist/runtime-pane-assets.d.ts +1 -1
- package/dist/runtime-pane-assets.js +1 -1
- package/dist/runtime-pane-assets.js.map +1 -1
- package/dist/runtime-pane-host.d.ts +3 -0
- package/dist/runtime-pane-host.js +39 -21
- package/dist/runtime-pane-host.js.map +1 -1
- package/dist/runtime-pane-link.d.ts +6 -2
- package/dist/runtime-pane-link.js +17 -4
- package/dist/runtime-pane-link.js.map +1 -1
- package/dist/runtime-pane-mcp-relay.d.ts +11 -1
- package/dist/runtime-pane-mcp-relay.js +69 -3
- package/dist/runtime-pane-mcp-relay.js.map +1 -1
- package/dist/runtime-pane-mcp.d.ts +37 -1
- package/dist/runtime-pane-mcp.js +120 -19
- package/dist/runtime-pane-mcp.js.map +1 -1
- package/dist/runtime-pane-native.js +5 -2
- package/dist/runtime-pane-native.js.map +1 -1
- package/dist/runtime-pane-port.d.ts +6 -0
- package/dist/runtime-pane-port.js +23 -4
- package/dist/runtime-pane-port.js.map +1 -1
- package/dist/runtime-pane-protocol.d.ts +4 -0
- package/dist/runtime-pane-protocol.js +11 -4
- package/dist/runtime-pane-protocol.js.map +1 -1
- package/dist/runtime-pane-service.d.ts +1 -0
- package/dist/runtime-pane-service.js +25 -9
- package/dist/runtime-pane-service.js.map +1 -1
- package/dist/runtime-pane-stdio-protocol.d.ts +4 -0
- package/dist/runtime-pane-stdio-protocol.js +12 -5
- package/dist/runtime-pane-stdio-protocol.js.map +1 -1
- package/dist/runtime-pane-stdio.js +5 -5
- package/dist/runtime-pane-stdio.js.map +1 -1
- package/dist/runtime-personal-answer-only-probe.d.ts +3 -0
- package/dist/runtime-personal-answer-only-probe.js +134 -0
- package/dist/runtime-personal-answer-only-probe.js.map +1 -0
- package/dist/runtime-personal-answer-only.d.ts +16 -0
- package/dist/runtime-personal-answer-only.js +54 -0
- package/dist/runtime-personal-answer-only.js.map +1 -0
- package/dist/runtime-personal-answer.d.ts +30 -0
- package/dist/runtime-personal-answer.js +124 -0
- package/dist/runtime-personal-answer.js.map +1 -0
- package/dist/runtime-personal-preflight.d.ts +8 -0
- package/dist/runtime-personal-preflight.js +103 -0
- package/dist/runtime-personal-preflight.js.map +1 -0
- package/dist/runtime-personal-profile.d.ts +40 -0
- package/dist/runtime-personal-profile.js +81 -0
- package/dist/runtime-personal-profile.js.map +1 -0
- package/dist/runtime-personal-protocol.d.ts +10 -0
- package/dist/runtime-personal-protocol.js +15 -0
- package/dist/runtime-personal-protocol.js.map +1 -0
- package/dist/runtime-personal-stage.d.ts +37 -0
- package/dist/runtime-personal-stage.js +167 -0
- package/dist/runtime-personal-stage.js.map +1 -0
- package/dist/runtime-protocol.d.ts +7 -0
- package/dist/runtime-protocol.js.map +1 -1
- package/dist/runtime-update-controller.js +1 -1
- package/dist/runtime-update-controller.js.map +1 -1
- package/dist/runtime-windows-bridge.d.ts +8 -0
- package/dist/runtime-windows-bridge.js +50 -3
- package/dist/runtime-windows-bridge.js.map +1 -1
- package/dist/scheduler/db.js +37 -0
- package/dist/scheduler/db.js.map +1 -1
- package/dist/scheduler/scheduler.d.ts +15 -0
- package/dist/scheduler/scheduler.js +45 -1
- package/dist/scheduler/scheduler.js.map +1 -1
- package/dist/scheduler/scheduler.test.js +17 -0
- package/dist/scheduler/scheduler.test.js.map +1 -1
- package/dist/scheduler/task-board-mentions.d.ts +32 -0
- package/dist/scheduler/task-board-mentions.js +97 -0
- package/dist/scheduler/task-board-mentions.js.map +1 -0
- package/dist/scheduler/task-board-text.d.ts +5 -6
- package/dist/scheduler/task-board-text.js +30 -10
- package/dist/scheduler/task-board-text.js.map +1 -1
- package/dist/scheduler/task-board-unread.d.ts +90 -0
- package/dist/scheduler/task-board-unread.js +192 -0
- package/dist/scheduler/task-board-unread.js.map +1 -0
- package/dist/scheduler/task-board.d.ts +628 -10
- package/dist/scheduler/task-board.js +1496 -48
- package/dist/scheduler/task-board.js.map +1 -1
- package/dist/scheduler/task-files.d.ts +80 -0
- package/dist/scheduler/task-files.js +357 -0
- package/dist/scheduler/task-files.js.map +1 -0
- package/dist/scheduler/types.d.ts +1 -1
- package/dist/service-activation.js +3 -13
- package/dist/service-activation.js.map +1 -1
- package/dist/service-install-handover.d.ts +52 -0
- package/dist/service-install-handover.js +50 -0
- package/dist/service-install-handover.js.map +1 -0
- package/dist/service-installer.d.ts +12 -0
- package/dist/service-installer.js +24 -10
- package/dist/service-installer.js.map +1 -1
- package/dist/service-lock.d.ts +28 -0
- package/dist/service-lock.js +85 -0
- package/dist/service-lock.js.map +1 -0
- package/dist/settings-api.d.ts +46 -1
- package/dist/settings-api.js +642 -97
- package/dist/settings-api.js.map +1 -1
- package/dist/settings-baseline.d.ts +6 -0
- package/dist/settings-baseline.js +11 -8
- package/dist/settings-baseline.js.map +1 -1
- package/dist/settings-change.js +60 -7
- package/dist/settings-change.js.map +1 -1
- package/dist/settings-confirmation.d.ts +2 -0
- package/dist/settings-confirmation.js +6 -0
- package/dist/settings-confirmation.js.map +1 -1
- package/dist/settings-effect.d.ts +11 -0
- package/dist/settings-effect.js +154 -7
- package/dist/settings-effect.js.map +1 -1
- package/dist/settings-http-confirmation.d.ts +3 -0
- package/dist/settings-http-confirmation.js +46 -43
- package/dist/settings-http-confirmation.js.map +1 -1
- package/dist/settings-instance-patch.js +3 -1
- package/dist/settings-instance-patch.js.map +1 -1
- package/dist/settings-route-lifetime.d.ts +3 -1
- package/dist/settings-route-lifetime.js +15 -5
- package/dist/settings-route-lifetime.js.map +1 -1
- package/dist/settings-transaction.d.ts +3 -2
- package/dist/settings-transaction.js.map +1 -1
- package/dist/setup-form.js +10 -0
- package/dist/setup-form.js.map +1 -1
- package/dist/setup-host.d.ts +2 -3
- package/dist/setup-host.js +3 -5
- package/dist/setup-host.js.map +1 -1
- package/dist/setup-i18n.js +2 -2
- package/dist/setup-i18n.js.map +1 -1
- package/dist/setup-wizard.js +0 -2
- package/dist/setup-wizard.js.map +1 -1
- package/dist/shared-default-adoption.d.ts +24 -0
- package/dist/shared-default-adoption.js +73 -0
- package/dist/shared-default-adoption.js.map +1 -0
- package/dist/state-lease.d.ts +24 -0
- package/dist/state-lease.js +103 -0
- package/dist/state-lease.js.map +1 -0
- package/dist/subagent-records.d.ts +2 -0
- package/dist/subagent-records.js +64 -12
- package/dist/subagent-records.js.map +1 -1
- package/dist/subagent-service.d.ts +3 -0
- package/dist/subagent-service.js +27 -5
- package/dist/subagent-service.js.map +1 -1
- package/dist/task-attach-client.d.ts +43 -0
- package/dist/task-attach-client.js +125 -0
- package/dist/task-attach-client.js.map +1 -0
- package/dist/task-board-tool.d.ts +60 -0
- package/dist/task-board-tool.js +216 -11
- package/dist/task-board-tool.js.map +1 -1
- package/dist/task-board-waker.d.ts +75 -31
- package/dist/task-board-waker.js +311 -101
- package/dist/task-board-waker.js.map +1 -1
- package/dist/task-file-limits.d.ts +15 -0
- package/dist/task-file-limits.js +21 -0
- package/dist/task-file-limits.js.map +1 -0
- package/dist/tips.js +4 -4
- package/dist/tips.js.map +1 -1
- package/dist/tmux-binary.js +1 -1
- package/dist/tmux-binary.js.map +1 -1
- package/dist/tmux-manager.d.ts +2 -0
- package/dist/tmux-manager.js +2 -0
- package/dist/tmux-manager.js.map +1 -1
- package/dist/tool-permissions.d.ts +32 -0
- package/dist/tool-permissions.js +68 -2
- package/dist/tool-permissions.js.map +1 -1
- package/dist/tool-progress.d.ts +9 -0
- package/dist/tool-progress.js +141 -32
- package/dist/tool-progress.js.map +1 -1
- package/dist/tool-receipt-output.d.ts +8 -6
- package/dist/topic-commands.d.ts +7 -1
- package/dist/topic-commands.js +124 -92
- package/dist/topic-commands.js.map +1 -1
- package/dist/transcript-monitor.d.ts +7 -1
- package/dist/transcript-monitor.js +79 -3
- package/dist/transcript-monitor.js.map +1 -1
- package/dist/transcript-turns.d.ts +3 -0
- package/dist/transcript-turns.js +5 -0
- package/dist/transcript-turns.js.map +1 -1
- package/dist/tunnel/lease.d.ts +14 -0
- package/dist/tunnel/lease.js +23 -0
- package/dist/tunnel/lease.js.map +1 -1
- package/dist/tunnel/named-link-test.d.ts +27 -0
- package/dist/tunnel/named-link-test.js +41 -0
- package/dist/tunnel/named-link-test.js.map +1 -1
- package/dist/turn-reply-guard.d.ts +18 -3
- package/dist/turn-reply-guard.js +23 -5
- package/dist/turn-reply-guard.js.map +1 -1
- package/dist/types.d.ts +50 -2
- package/dist/ui/accounts-keepalive.js +4 -2
- package/dist/ui/accounts-view.js +18 -9
- package/dist/ui/agent-details-settings.js +11 -7
- package/dist/ui/agent-export-dialog.js +4 -3
- package/dist/ui/agent-export-strings.js +5 -5
- package/dist/ui/agent-page-strings.js +23 -5
- package/dist/ui/agent-who-can-use-strings.js +125 -0
- package/dist/ui/agent-who-can-use.js +238 -0
- package/dist/ui/app.html +2 -2
- package/dist/ui/backend-signin.js +94 -23
- package/dist/ui/chat-activity-groups.js +42 -9
- package/dist/ui/chat-activity.js +24 -4
- package/dist/ui/chat-commands.js +2 -0
- package/dist/ui/chat-mentions.js +13 -0
- package/dist/ui/chat-msg-actions.js +3 -222
- package/dist/ui/chat-pins.js +107 -0
- package/dist/ui/chat-popout-header.js +2 -2
- package/dist/ui/chat-popout-transport.js +49 -19
- package/dist/ui/chat-popout.js +15 -1
- package/dist/ui/chat-quote.js +3 -261
- package/dist/ui/chat-store.js +182 -19
- package/dist/ui/chat-task-ref-strings.js +24 -0
- package/dist/ui/chat-task-refs.js +131 -0
- package/dist/ui/chat-tour.js +1 -1
- package/dist/ui/chat-workspace.js +3 -3
- package/dist/ui/claude-credentials.js +124 -0
- package/dist/ui/claude-setup-token.js +36 -0
- package/dist/ui/contact-auth-client.js +55 -0
- package/dist/ui/contact-auth-strings.js +272 -0
- package/dist/ui/contact-authorizations.js +159 -0
- package/dist/ui/contact-grant-editor.js +110 -0
- package/dist/ui/contact-needs.js +124 -0
- package/dist/ui/contact-permissions.js +278 -0
- package/dist/ui/contact-ticket-badge.js +54 -0
- package/dist/ui/contact-tool-groups.js +39 -0
- package/dist/ui/contact-verify-need.js +46 -0
- package/dist/ui/fleet-cache.js +7 -6
- package/dist/ui/fleet-canvas.js +21 -8
- package/dist/ui/fleet-office-card.js +505 -45
- package/dist/ui/fleet-office-carousel.d.ts +14 -0
- package/dist/ui/fleet-office-carousel.js +95 -0
- package/dist/ui/fleet-office-dialogue.d.ts +6 -3
- package/dist/ui/fleet-office-dialogue.js +16 -6
- package/dist/ui/fleet-office-editor.js +11 -6
- package/dist/ui/fleet-office-layout.js +15 -15
- package/dist/ui/fleet-office-model.js +5 -3
- package/dist/ui/fleet-office-overview.js +1 -1
- package/dist/ui/fleet-office-pack.d.ts +92 -5
- package/dist/ui/fleet-office-pack.js +596 -50
- package/dist/ui/fleet-office-play.js +498 -0
- package/dist/ui/fleet-office-skin.js +360 -52
- package/dist/ui/fleet-office-store.js +121 -5
- package/dist/ui/fleet-office-talk.js +423 -0
- package/dist/ui/fleet-office-vehicles.js +147 -0
- package/dist/ui/fleet-office-view.js +58 -17
- package/dist/ui/fleet-office-zones.js +174 -39
- package/dist/ui/fleet-office.js +1462 -188
- package/dist/ui/fleet-org.js +9 -4
- package/dist/ui/fleet-route.js +44 -6
- package/dist/ui/fleet-tab-icons.js +19 -0
- package/dist/ui/fleet-task-activity.js +430 -0
- package/dist/ui/fleet-task-archive.js +111 -0
- package/dist/ui/fleet-task-card.js +386 -317
- package/dist/ui/fleet-task-common.js +117 -13
- package/dist/ui/fleet-task-create.js +67 -0
- package/dist/ui/fleet-task-edit.js +211 -0
- package/dist/ui/fleet-task-files.js +196 -0
- package/dist/ui/fleet-task-flow.js +353 -0
- package/dist/ui/fleet-task-follow.js +123 -0
- package/dist/ui/fleet-task-md.js +98 -0
- package/dist/ui/fleet-task-menu.js +2 -2
- package/dist/ui/fleet-task-owner.js +252 -0
- package/dist/ui/fleet-task-run.js +333 -0
- package/dist/ui/fleet-task-sort.js +88 -0
- package/dist/ui/fleet-task-stats.js +2 -2
- package/dist/ui/fleet-task-thread.js +245 -0
- package/dist/ui/fleet-task-unread.js +100 -0
- package/dist/ui/fleet-task-view.js +221 -46
- package/dist/ui/fleet-task-wake.js +140 -0
- package/dist/ui/fleet-task-work.js +2 -2
- package/dist/ui/fleet-tasks.js +336 -145
- package/dist/ui/fleet-usage.js +8 -7
- package/dist/ui/host-alerts.js +23 -0
- package/dist/ui/host-footprint.js +17 -0
- package/dist/ui/host-health-model.js +42 -0
- package/dist/ui/host-health.js +82 -0
- package/dist/ui/host-install.js +87 -7
- package/dist/ui/host-monitoring-darwin.js +6 -0
- package/dist/ui/host-monitoring-help.js +7 -0
- package/dist/ui/host-monitoring-linux.js +6 -0
- package/dist/ui/host-monitoring-wsl.js +6 -0
- package/dist/ui/host-time.js +5 -0
- package/dist/ui/hub-admin-overview.js +190 -0
- package/dist/ui/hub-admin-rooms-strings.js +6 -2
- package/dist/ui/hub-admin-rooms.js +4 -2
- package/dist/ui/hub-agent-copy.js +8 -2
- package/dist/ui/hub-agent-intro.js +36 -0
- package/dist/ui/hub-ai-apps-strings.js +6 -0
- package/dist/ui/hub-ai-apps.js +84 -0
- package/dist/ui/hub-assistant-admin.js +2 -1
- package/dist/ui/hub-attachments.js +81 -3
- package/dist/ui/hub-chat-store.js +4 -3
- package/dist/ui/hub-chat-strings.js +14 -4
- package/dist/ui/hub-client.js +126 -12
- package/dist/ui/hub-directory-editor-strings.js +2 -2
- package/dist/ui/hub-directory-editor.js +1 -0
- package/dist/ui/hub-directory-notices.js +2 -1
- package/dist/ui/hub-enrolment-code.js +2 -1
- package/dist/ui/hub-fleet-versions.js +393 -0
- package/dist/ui/hub-grant-picker.js +28 -47
- package/dist/ui/hub-group-policy.js +26 -13
- package/dist/ui/hub-group-search.js +2 -2
- package/dist/ui/hub-group-strings.js +28 -18
- package/dist/ui/hub-intro-notice.js +16 -0
- package/dist/ui/hub-invitations.js +5 -1
- package/dist/ui/hub-join-steps.js +27 -15
- package/dist/ui/hub-my-agents-model.js +42 -0
- package/dist/ui/hub-my-agents-strings.js +20 -0
- package/dist/ui/hub-my-agents.js +170 -0
- package/dist/ui/hub-notify-keep.js +49 -0
- package/dist/ui/hub-owner-strings.js +9 -8
- package/dist/ui/hub-personal-agent-strings.js +246 -0
- package/dist/ui/hub-personal-agent.js +119 -0
- package/dist/ui/hub-policy-subjects.js +35 -0
- package/dist/ui/hub-quick-pairing.js +9 -3
- package/dist/ui/hub-quota.js +2 -1
- package/dist/ui/hub-role-audit.js +40 -0
- package/dist/ui/hub-role-forms.js +100 -0
- package/dist/ui/hub-role-notices.js +11 -0
- package/dist/ui/hub-role-view.js +87 -0
- package/dist/ui/hub-roles-strings.js +444 -0
- package/dist/ui/hub-roles.js +84 -0
- package/dist/ui/hub-room-agent-strings.js +29 -0
- package/dist/ui/hub-room-composer.js +174 -17
- package/dist/ui/hub-room-list.js +8 -5
- package/dist/ui/hub-room-members-strings.js +11 -4
- package/dist/ui/hub-room-members.js +134 -18
- package/dist/ui/hub-room-new-strings.js +2 -1
- package/dist/ui/hub-room-new.js +17 -7
- package/dist/ui/hub-room-notify.js +162 -0
- package/dist/ui/hub-room-office.js +271 -0
- package/dist/ui/hub-room-owner-requests-strings.js +114 -0
- package/dist/ui/hub-room-owner-requests.js +265 -0
- package/dist/ui/hub-room-pins.js +44 -0
- package/dist/ui/hub-room-presence.js +19 -2
- package/dist/ui/hub-room-purpose.js +35 -0
- package/dist/ui/hub-room-search.js +126 -0
- package/dist/ui/hub-room-settings-strings.js +8 -0
- package/dist/ui/hub-room-settings.js +110 -3
- package/dist/ui/hub-room-source-strings.js +17 -0
- package/dist/ui/hub-room-source.js +37 -0
- package/dist/ui/hub-room-strings.js +102 -7
- package/dist/ui/hub-room-thread.js +522 -69
- package/dist/ui/hub-room-unread.js +2 -1
- package/dist/ui/hub-room-working.js +37 -0
- package/dist/ui/hub-session-limits.js +79 -0
- package/dist/ui/hub-strings.js +23 -10
- package/dist/ui/hub-subject-picker.js +58 -0
- package/dist/ui/hub-switcher.js +2 -2
- package/dist/ui/hub-teams-strings.js +10 -6
- package/dist/ui/hub-teams.js +58 -29
- package/dist/ui/hub-this-hub.js +2 -2
- package/dist/ui/hub-welcome.js +122 -75
- package/dist/ui/icons/hub-apple-touch-icon.png +0 -0
- package/dist/ui/icons/hub-favicon.ico +0 -0
- package/dist/ui/icons/hub-favicon.svg +10 -0
- package/dist/ui/icons/hub-icon-192.png +0 -0
- package/dist/ui/icons/hub-icon-512.png +0 -0
- package/dist/ui/icons/hub-icon-maskable-192.png +0 -0
- package/dist/ui/icons/hub-icon-maskable-512.png +0 -0
- package/dist/ui/icons/hub-maskable.svg +12 -0
- package/dist/ui/image-annotate.js +2 -283
- package/dist/ui/image-lightbox.js +2 -176
- package/dist/ui/image-zoom.js +2 -242
- package/dist/ui/log-row.js +11 -8
- package/dist/ui/model-picker.js +7 -3
- package/dist/ui/native-instance-settings.js +4 -2
- package/dist/ui/notice-hub-sharing.js +81 -0
- package/dist/ui/notice-hub-update.js +94 -0
- package/dist/ui/office-share-dialog.js +4 -3
- package/dist/ui/office-share-page.js +7 -2
- package/dist/ui/page-share-dialog.js +3 -2
- package/dist/ui/panel-chat.js +515 -81
- package/dist/ui/panel-details.js +27 -3
- package/dist/ui/panel-fleet.js +61 -21
- package/dist/ui/panel-hub.js +478 -135
- package/dist/ui/panel-log.js +7 -7
- package/dist/ui/panel-needs.js +139 -28
- package/dist/ui/panel-notices.js +6 -2
- package/dist/ui/panel-runtimes.js +6 -4
- package/dist/ui/panel-settings.js +150 -61
- package/dist/ui/panel-windows-cli.js +4 -3
- package/dist/ui/preview-panel.js +3 -1
- package/dist/ui/preview-popout.js +134 -0
- package/dist/ui/reply-file-preview.js +65 -0
- package/dist/ui/request-contact-card.js +287 -0
- package/dist/ui/request-contact-client.js +83 -0
- package/dist/ui/request-contact-page.js +78 -0
- package/dist/ui/request-context-control.js +209 -0
- package/dist/ui/runtime-cli-install.js +3 -2
- package/dist/ui/runtime-commands.d.ts +2 -2
- package/dist/ui/runtime-commands.js +7 -4
- package/dist/ui/runtime-update-status.js +1 -1
- package/dist/ui/search-dialog.js +8 -1
- package/dist/ui/settings-access-overview.js +5 -4
- package/dist/ui/settings-access-strings.js +1 -1
- package/dist/ui/settings-appearance.js +15 -12
- package/dist/ui/settings-apply.js +8 -3
- package/dist/ui/settings-archive-files.js +109 -0
- package/dist/ui/settings-build-version.js +2 -2
- package/dist/ui/settings-capabilities.js +2 -0
- package/dist/ui/settings-catalog.js +22 -0
- package/dist/ui/settings-connector-strings.js +23 -0
- package/dist/ui/settings-connector.js +40 -0
- package/dist/ui/settings-default-model-scope.js +40 -0
- package/dist/ui/settings-default-model-strings.js +43 -0
- package/dist/ui/settings-dialogs.js +9 -5
- package/dist/ui/settings-guests-entries.js +16 -0
- package/dist/ui/settings-guests.js +61 -18
- package/dist/ui/settings-host-alerts.js +23 -0
- package/dist/ui/settings-host-monitoring.js +71 -0
- package/dist/ui/settings-hub-connection.js +6 -7
- package/dist/ui/settings-hub-member-address.js +2 -1
- package/dist/ui/settings-hub-membership.js +6 -7
- package/dist/ui/settings-hub-page-sharing.js +52 -0
- package/dist/ui/settings-hub-section.js +2 -4
- package/dist/ui/settings-hub-setup-strings.js +1 -1
- package/dist/ui/settings-hub-setup.js +4 -2
- package/dist/ui/settings-hub-updates.js +67 -0
- package/dist/ui/settings-hub-web-address.js +2 -1
- package/dist/ui/settings-hub.js +37 -8
- package/dist/ui/settings-layout.js +18 -15
- package/dist/ui/settings-model.js +9 -5
- package/dist/ui/settings-named-test.js +16 -16
- package/dist/ui/settings-preview-address.js +156 -0
- package/dist/ui/settings-public-session-strings.js +2 -2
- package/dist/ui/settings-quota-notice.js +3 -3
- package/dist/ui/settings-registry.js +32 -5
- package/dist/ui/settings-revoke-strings.js +1 -1
- package/dist/ui/settings-shared-strings.js +35 -2
- package/dist/ui/settings-shared.js +67 -14
- package/dist/ui/settings-strings.js +58 -49
- package/dist/ui/settings-update.js +28 -7
- package/dist/ui/settings-web-authority.js +9 -6
- package/dist/ui/shared/access-overview.css +2 -2
- package/dist/ui/shared/accounts-keepalive.css +1 -1
- package/dist/ui/shared/accounts.css +9 -5
- package/dist/ui/shared/agent-sheet.js +121 -0
- package/dist/ui/shared/agent-widget.js +1 -2
- package/dist/ui/shared/app-i18n.js +12 -4
- package/dist/ui/shared/app-install.js +123 -0
- package/dist/ui/shared/app-nav.js +9 -5
- package/dist/ui/shared/app-needs.js +8 -1
- package/dist/ui/shared/app-prefs.js +9 -3
- package/dist/ui/shared/app-route.js +5 -3
- package/dist/ui/shared/app-session.js +4 -3
- package/dist/ui/shared/app-shell.js +218 -46
- package/dist/ui/shared/app-store.js +7 -3
- package/dist/ui/shared/app-stream.js +11 -2
- package/dist/ui/shared/app-swipe.js +3 -1
- package/dist/ui/shared/app-themes.js +3 -5
- package/dist/ui/shared/app-update.js +107 -10
- package/dist/ui/shared/app.css +1398 -275
- package/dist/ui/shared/app.js +34 -5
- package/dist/ui/shared/asset-url.d.ts +2 -0
- package/dist/ui/shared/asset-url.js +20 -0
- package/dist/ui/shared/chat-composer.js +30 -8
- package/dist/ui/shared/chat-msg-actions.js +233 -0
- package/dist/ui/shared/chat-quote.js +285 -0
- package/dist/ui/shared/chat-render.js +63 -10
- package/dist/ui/shared/chat-strings.js +49 -24
- package/dist/ui/shared/chat-table-select.js +175 -0
- package/dist/ui/shared/chat-thread.js +181 -29
- package/dist/ui/shared/chat-time.js +7 -4
- package/dist/ui/shared/chat-work-bar.css +97 -15
- package/dist/ui/shared/clock-text.js +57 -0
- package/dist/ui/shared/composer-focus.js +21 -0
- package/dist/ui/shared/connector-prompt.d.ts +3 -0
- package/dist/ui/shared/connector-prompt.js +20 -0
- package/dist/ui/shared/device-roles.js +6 -5
- package/dist/ui/shared/hub-ai-apps.css +12 -0
- package/dist/ui/shared/hub-chat.css +114 -4
- package/dist/ui/shared/hub-groups.css +19 -15
- package/dist/ui/shared/hub-my-agents.css +41 -0
- package/dist/ui/shared/hub-owner.css +123 -3
- package/dist/ui/shared/hub-roles.css +99 -0
- package/dist/ui/shared/hub-rooms-u2.css +98 -0
- package/dist/ui/shared/hub-signin.css +2 -0
- package/dist/ui/shared/hub.css +23 -5
- package/dist/ui/shared/image-annotate.css +22 -3
- package/dist/ui/shared/image-annotate.js +416 -0
- package/dist/ui/shared/image-lightbox.js +218 -0
- package/dist/ui/shared/image-zoom.js +316 -0
- package/dist/ui/shared/info-tip.js +64 -0
- package/dist/ui/shared/instance-nav.js +197 -21
- package/dist/ui/shared/jump-idle.js +36 -0
- package/dist/ui/shared/loading.css +1 -1
- package/dist/ui/shared/model-picker.css +28 -1
- package/dist/ui/shared/module-warm.d.ts +3 -0
- package/dist/ui/shared/module-warm.js +39 -0
- package/dist/ui/shared/office-dialogue.css +122 -0
- package/dist/ui/shared/owner-css.js +1 -1
- package/dist/ui/shared/panel-view.js +7 -1
- package/dist/ui/shared/preview-panel-actions.js +1 -1
- package/dist/ui/shared/preview-panel.js +51 -21
- package/dist/ui/shared/preview-popout.css +11 -0
- package/dist/ui/shared/preview.js +11 -2
- package/dist/ui/shared/reply-previews.css +4 -0
- package/dist/ui/shared/runtime-install.css +5 -0
- package/dist/ui/shared/settings-connector.css +7 -0
- package/dist/ui/shared/signin.js +27 -12
- package/dist/ui/shared/task-board.css +733 -11
- package/dist/ui/shared/text-undo.js +17 -3
- package/dist/ui/shared/theme-picker.js +46 -0
- package/dist/ui/shared/theme.js +101 -2
- package/dist/ui/shared/tokens.css +318 -13
- package/dist/ui/shared/ui-confirm.js +10 -5
- package/dist/ui/shared/ui-icons.js +7 -0
- package/dist/ui/shared/ui-menu.js +17 -11
- package/dist/ui/shared/ui-states.js +9 -2
- package/dist/ui/shared/ui-toast.js +4 -4
- package/dist/ui/shared/update-card-ui.js +586 -0
- package/dist/ui/shared/usage-dialog.js +90 -18
- package/dist/ui/shared/view-history.js +2 -1
- package/dist/ui/shared/view-strings.js +57 -13
- package/dist/ui/shared/web-authorize.js +6 -5
- package/dist/ui/shared/workspace.css +7 -0
- package/dist/ui/signin.html +4 -2
- package/dist/ui/structured-signin.js +64 -12
- package/dist/ui/subagent-row.js +5 -3
- package/dist/ui/task-unread.js +70 -0
- package/dist/ui/trigger-complete.js +71 -0
- package/dist/ui/usage-credits-card.js +84 -0
- package/dist/ui/usage-pool.js +2 -1
- package/dist/ui/web-terminal/terminal.css +1 -1
- package/dist/ui/windows-cli-catalog.js +33 -6
- package/dist/ui/workspace-ignored-strings.js +16 -0
- package/dist/ui/workspace-panel.js +21 -10
- package/dist/update-abandon.d.ts +26 -0
- package/dist/update-abandon.js +111 -0
- package/dist/update-abandon.js.map +1 -0
- package/dist/update-card.d.ts +193 -0
- package/dist/update-card.js +620 -0
- package/dist/update-card.js.map +1 -0
- package/dist/update-dispatch.d.ts +24 -2
- package/dist/update-dispatch.js +28 -5
- package/dist/update-dispatch.js.map +1 -1
- package/dist/update-fix.d.ts +66 -0
- package/dist/update-fix.js +67 -0
- package/dist/update-fix.js.map +1 -0
- package/dist/update-forward.d.ts +59 -0
- package/dist/update-forward.js +227 -0
- package/dist/update-forward.js.map +1 -0
- package/dist/update-goback.d.ts +90 -0
- package/dist/update-goback.js +272 -0
- package/dist/update-goback.js.map +1 -0
- package/dist/update-idle.d.ts +66 -0
- package/dist/update-idle.js +199 -0
- package/dist/update-idle.js.map +1 -0
- package/dist/update-install.d.ts +2 -1
- package/dist/update-install.js +18 -10
- package/dist/update-install.js.map +1 -1
- package/dist/update-journal.d.ts +359 -0
- package/dist/update-journal.js +723 -0
- package/dist/update-journal.js.map +1 -0
- package/dist/update-launch.d.ts +1 -1
- package/dist/update-launch.js +10 -3
- package/dist/update-launch.js.map +1 -1
- package/dist/update-npm-env.d.ts +45 -12
- package/dist/update-npm-env.js +48 -0
- package/dist/update-npm-env.js.map +1 -1
- package/dist/update-package-restore.d.ts +84 -0
- package/dist/update-package-restore.js +329 -0
- package/dist/update-package-restore.js.map +1 -0
- package/dist/update-quiescence.d.ts +221 -0
- package/dist/update-quiescence.js +370 -0
- package/dist/update-quiescence.js.map +1 -0
- package/dist/update-readiness-host.d.ts +61 -0
- package/dist/update-readiness-host.js +297 -0
- package/dist/update-readiness-host.js.map +1 -0
- package/dist/update-readiness.d.ts +85 -0
- package/dist/update-readiness.js +463 -0
- package/dist/update-readiness.js.map +1 -0
- package/dist/update-recovery/kit.d.ts +35 -0
- package/dist/update-recovery/kit.js +99 -0
- package/dist/update-recovery/kit.js.map +1 -0
- package/dist/update-recovery/pre-start.d.ts +34 -0
- package/dist/update-recovery/pre-start.js +103 -0
- package/dist/update-recovery/pre-start.js.map +1 -0
- package/dist/update-recovery/recover-main.d.ts +1 -0
- package/dist/update-recovery/recover-main.js +4 -0
- package/dist/update-recovery/recover-main.js.map +1 -0
- package/dist/update-recovery/recover.d.ts +22 -0
- package/dist/update-recovery/recover.js +134 -0
- package/dist/update-recovery/recover.js.map +1 -0
- package/dist/update-recovery/route.d.ts +53 -0
- package/dist/update-recovery/route.js +262 -0
- package/dist/update-recovery/route.js.map +1 -0
- package/dist/update-recovery/runner.d.ts +62 -0
- package/dist/update-recovery/runner.js +229 -0
- package/dist/update-recovery/runner.js.map +1 -0
- package/dist/update-recovery/service-manager.d.ts +39 -0
- package/dist/update-recovery/service-manager.js +57 -0
- package/dist/update-recovery/service-manager.js.map +1 -0
- package/dist/update-restore.d.ts +50 -0
- package/dist/update-restore.js +360 -0
- package/dist/update-restore.js.map +1 -0
- package/dist/update-retained.d.ts +65 -0
- package/dist/update-retained.js +116 -0
- package/dist/update-retained.js.map +1 -0
- package/dist/update-rollback.d.ts +74 -0
- package/dist/update-rollback.js +221 -0
- package/dist/update-rollback.js.map +1 -0
- package/dist/update-settings.d.ts +63 -0
- package/dist/update-settings.js +162 -0
- package/dist/update-settings.js.map +1 -0
- package/dist/update-snapshot-manifest.d.ts +32 -0
- package/dist/update-snapshot-manifest.js +65 -0
- package/dist/update-snapshot-manifest.js.map +1 -0
- package/dist/update-snapshot-scope.d.ts +67 -0
- package/dist/update-snapshot-scope.js +174 -0
- package/dist/update-snapshot-scope.js.map +1 -0
- package/dist/update-snapshot.d.ts +34 -0
- package/dist/update-snapshot.js +246 -0
- package/dist/update-snapshot.js.map +1 -0
- package/dist/update-writers.d.ts +71 -0
- package/dist/update-writers.js +235 -0
- package/dist/update-writers.js.map +1 -0
- package/dist/usage/i18n-keys.d.ts +1 -1
- package/dist/usage/i18n-keys.js +10 -1
- package/dist/usage/i18n-keys.js.map +1 -1
- package/dist/usage/profile-timeline.d.ts +2 -0
- package/dist/usage/profile-timeline.js +4 -0
- package/dist/usage/profile-timeline.js.map +1 -1
- package/dist/usage/providers.d.ts +4 -11
- package/dist/usage/providers.js +109 -134
- package/dist/usage/providers.js.map +1 -1
- package/dist/usage/usage-api.js +5 -2
- package/dist/usage/usage-api.js.map +1 -1
- package/dist/wake-coordinator.js +3 -2
- package/dist/wake-coordinator.js.map +1 -1
- package/dist/web-api.d.ts +132 -9
- package/dist/web-api.js +1468 -242
- package/dist/web-api.js.map +1 -1
- package/dist/web-asset-version.d.ts +65 -0
- package/dist/web-asset-version.js +259 -0
- package/dist/web-asset-version.js.map +1 -0
- package/dist/web-backend-login.d.ts +5 -1
- package/dist/web-backend-login.js +8 -2
- package/dist/web-backend-login.js.map +1 -1
- package/dist/web-chat-archive.d.ts +147 -0
- package/dist/web-chat-archive.js +530 -0
- package/dist/web-chat-archive.js.map +1 -0
- package/dist/web-chat-history.d.ts +137 -2
- package/dist/web-chat-history.js +335 -12
- package/dist/web-chat-history.js.map +1 -1
- package/dist/web-claude-credentials.d.ts +31 -0
- package/dist/web-claude-credentials.js +138 -0
- package/dist/web-claude-credentials.js.map +1 -0
- package/dist/web-commands.d.ts +9 -5
- package/dist/web-commands.js +7 -4
- package/dist/web-commands.js.map +1 -1
- package/dist/web-guest-access.d.ts +3 -0
- package/dist/web-guest-access.js +8 -4
- package/dist/web-guest-access.js.map +1 -1
- package/dist/web-host-guard.js +3 -1
- package/dist/web-host-guard.js.map +1 -1
- package/dist/web-host-install.d.ts +30 -3
- package/dist/web-host-install.js +50 -4
- package/dist/web-host-install.js.map +1 -1
- package/dist/web-icons.d.ts +20 -3
- package/dist/web-icons.js +79 -10
- package/dist/web-icons.js.map +1 -1
- package/dist/web-login.d.ts +13 -1
- package/dist/web-login.js +16 -4
- package/dist/web-login.js.map +1 -1
- package/dist/web-mentions.d.ts +29 -8
- package/dist/web-mentions.js +128 -1
- package/dist/web-mentions.js.map +1 -1
- package/dist/web-notices.d.ts +20 -0
- package/dist/web-notices.js +64 -8
- package/dist/web-notices.js.map +1 -1
- package/dist/web-office-acts.d.ts +16 -0
- package/dist/web-office-acts.js +30 -9
- package/dist/web-office-acts.js.map +1 -1
- package/dist/web-office-pack-read.js +1 -1
- package/dist/web-office-pack-read.js.map +1 -1
- package/dist/web-office-skins.d.ts +19 -6
- package/dist/web-office-skins.js +85 -36
- package/dist/web-office-skins.js.map +1 -1
- package/dist/web-office-store.d.ts +2 -0
- package/dist/web-office-store.js +20 -6
- package/dist/web-office-store.js.map +1 -1
- package/dist/web-pin-store.d.ts +58 -0
- package/dist/web-pin-store.js +170 -0
- package/dist/web-pin-store.js.map +1 -0
- package/dist/web-prefs.js +5 -1
- package/dist/web-prefs.js.map +1 -1
- package/dist/web-preview.d.ts +5 -0
- package/dist/web-preview.js +1 -1
- package/dist/web-preview.js.map +1 -1
- package/dist/web-reply-files.d.ts +1 -0
- package/dist/web-reply-files.js +2 -0
- package/dist/web-reply-files.js.map +1 -1
- package/dist/web-session-authorization.d.ts +27 -0
- package/dist/web-session-authorization.js +32 -0
- package/dist/web-session-authorization.js.map +1 -1
- package/dist/web-session.d.ts +26 -5
- package/dist/web-session.js +32 -3
- package/dist/web-session.js.map +1 -1
- package/dist/web-settings-patch.d.ts +51 -3
- package/dist/web-settings-patch.js +124 -1
- package/dist/web-settings-patch.js.map +1 -1
- package/dist/web-shell-routes.d.ts +2 -2
- package/dist/web-shell-routes.js +3 -2
- package/dist/web-shell-routes.js.map +1 -1
- package/dist/web-terminal.d.ts +9 -0
- package/dist/web-terminal.js +27 -1
- package/dist/web-terminal.js.map +1 -1
- package/dist/web-theme.js +2 -2
- package/dist/web-update.d.ts +30 -1
- package/dist/web-upload.d.ts +37 -1
- package/dist/web-upload.js +105 -5
- package/dist/web-upload.js.map +1 -1
- package/dist/windows-agents.d.ts +36 -2
- package/dist/windows-agents.js +115 -4
- package/dist/windows-agents.js.map +1 -1
- package/dist/windows-cli-api.d.ts +10 -7
- package/dist/windows-cli-api.js +17 -14
- package/dist/windows-cli-api.js.map +1 -1
- package/dist/windows-cli-worker.d.ts +10 -0
- package/dist/windows-cli-worker.js +118 -15
- package/dist/windows-cli-worker.js.map +1 -1
- package/dist/windows-cli.d.ts +65 -2
- package/dist/windows-cli.js +192 -28
- package/dist/windows-cli.js.map +1 -1
- package/dist/windows-native-mcp.js +5 -2
- package/dist/windows-native-mcp.js.map +1 -1
- package/dist/windows-shortcuts.d.ts +3 -22
- package/dist/windows-shortcuts.js +5 -45
- package/dist/windows-shortcuts.js.map +1 -1
- package/dist/workflow-templates/default.md +8 -8
- package/dist/wsl-host.d.ts +52 -0
- package/dist/wsl-host.js +97 -0
- package/dist/wsl-host.js.map +1 -0
- package/launcher/agend +4 -1
- package/launcher/agend-agent +4 -1
- package/launcher/agend-install.cjs +63 -14
- package/launcher/install-admission.d.cts +8 -0
- package/launcher/npm-allow-scripts.cjs +72 -0
- package/launcher/npm-global-prefix.cjs +81 -0
- package/launcher/postinstall.cjs +9 -8
- package/launcher/runtime-select.cjs +8 -2
- package/package.json +4 -3
- package/scripts/preinstall-guard.cjs +1 -1
- package/templates/runtime-install/install.ps1 +24 -4
package/dist/daemon.js
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
|
+
import { RequestContextPendingReplies } from "./request-context-reply-pending.js";
|
|
2
|
+
import { expandCompositeCall as expandReplyWaitCall } from "./channel/mcp-tools.js";
|
|
3
|
+
import { RequestContextHelperAdmission } from "./request-context-helper.js";
|
|
4
|
+
import { requestContextDigest } from "./request-context-store.js";
|
|
5
|
+
import { RequestContextPendingWork } from "./request-context-pending-work.js";
|
|
6
|
+
import { requestContextProcessGroupGone } from "./request-context-retirement.js";
|
|
7
|
+
import { ReplyDraft } from "./reply-draft.js";
|
|
8
|
+
import { requireRequestContextPolicy, requestContextInstructionMode } from "./request-context-policy.js";
|
|
9
|
+
import { RequestContextReferenceMap } from "./request-context-fence.js";
|
|
10
|
+
import { managedClaudeBinding } from "./claude-credential-launch.js";
|
|
11
|
+
import { HUB_REPORT_TARGET } from "./hub-report-target.js";
|
|
12
|
+
import { atomicWriteFileSync } from "./atomic-write.js";
|
|
13
|
+
import { RoomConversationGeneration, roomContextInputMarker } from "./hub-room-conversation.js";
|
|
1
14
|
import { checkpointGrokDelivery } from "./grok-delivery-proof.js";
|
|
2
15
|
import { nativePaneToolRefusal } from "./native-pane-tools.js";
|
|
16
|
+
import { classicGuardInventory, classicPlanDigest, invalidateClassicGuard } from "./classic-cli-guard.js";
|
|
17
|
+
import { CLASSIC_RESTRICTED_TOOLS } from "./contact-auth-types.js";
|
|
3
18
|
import { generalByName } from "./general-instance.js";
|
|
4
19
|
import { ClaudeModelObserver, normalizeClaudeModel } from "./claude-model-observation.js";
|
|
5
20
|
import { codexMetadataHomes } from "./backend/codex-metadata.js";
|
|
@@ -15,6 +30,7 @@ import { join, dirname, basename, resolve } from "node:path";
|
|
|
15
30
|
import { checkoutTarget, readCheckouts, releaseCandidate, reposRoot, verifyWorktree, writeCheckouts } from "./repo-worktree-guard.js";
|
|
16
31
|
import { mkdirSync, writeFileSync, readFileSync, readdirSync, existsSync, unlinkSync, rmSync, appendFileSync, statSync, renameSync } from "node:fs";
|
|
17
32
|
import { COMPACT_WATCH_TIMEOUT_MS, launchIdentity } from "./compact-watch.js";
|
|
33
|
+
import { TurnWatch } from "./dispatcher-liveness.js";
|
|
18
34
|
import { KIRO_COMPACT_PANE_LINES, KiroCompactPaneFollower } from "./kiro-compact-pane.js";
|
|
19
35
|
import { clearKiroSessionProof, proveKiroSessionId, recordKiroSessionProof } from "./kiro-session-proof.js";
|
|
20
36
|
import { fileURLToPath } from "node:url";
|
|
@@ -43,6 +59,7 @@ import { legacyTmuxSocket, tmuxSocket } from "./tmux-binary.js";
|
|
|
43
59
|
import { migrateLegacyWindow, tagWindowId } from "./tmux-legacy.js";
|
|
44
60
|
import { scopedFleetConfigEnvironment } from "./web-experimental.js";
|
|
45
61
|
import { readAgentFile } from "./agent-file-read.js";
|
|
62
|
+
import { sendTaskWrite } from "./task-attach-client.js";
|
|
46
63
|
import { ASSET_UPLOAD_MAX_BYTES, receivePreview, sendAssetInParts, writePreview } from "./web-asset-parts.js";
|
|
47
64
|
import { LOGIN_FLOWS } from "./login-flows.js";
|
|
48
65
|
import { ProgressAccumulator, isSearchProgram, summarizeProgress } from "./tool-progress.js";
|
|
@@ -52,6 +69,7 @@ import { ContextGuardian } from "./context-guardian.js";
|
|
|
52
69
|
import { IpcServer } from "./channel/ipc-bridge.js";
|
|
53
70
|
import { daemonBudgetMs } from "./channel/ipc-timeouts.js";
|
|
54
71
|
import { MessageBus } from "./channel/message-bus.js";
|
|
72
|
+
import { captureRequestContextCall } from "./request-context-call.js";
|
|
55
73
|
import { shellQuote, KiroCompatibilityError, UnsupportedCliError, ResumeBlockedError } from "./backend/types.js";
|
|
56
74
|
import { getTmuxSession } from "./config.js";
|
|
57
75
|
import { routeToolCall } from "./channel/tool-router.js";
|
|
@@ -62,7 +80,7 @@ import { PaneWriteLock } from "./pane-write-lock.js";
|
|
|
62
80
|
import { answerRemoteCard } from "./remote-card-answer.js";
|
|
63
81
|
import { tmuxPaneHost } from "./tmux-pane-host.js";
|
|
64
82
|
import { buildFleetInstructions, INBOUND_HEADER_RULE } from "./instructions.js";
|
|
65
|
-
import { formatHumanInboundMessage, prepareDeliveryWire, steerInboundEnvelope,
|
|
83
|
+
import { formatHumanInboundMessage, prepareDeliveryWire, steerInboundEnvelope, btwInboundEnvelope, humanBodyHash, humanOwnerObjectId } from "./human-delivery-receipts.js";
|
|
66
84
|
import { formatCrossInstanceInboundMessage, renderCrossInstanceHandoffMetadata, } from "./cross-instance-envelope.js";
|
|
67
85
|
import { agendMessageInInput, bottomRowIsReady, inputAreaText, inputShowsPastedText, pastedTextSignature, pasteLeftInInput, strandedAgendMessageInInput } from "./pane-input-residue.js";
|
|
68
86
|
import { TurnReplyGuard, formatReplyDropDetection, turnExpectsPersonReply } from "./turn-reply-guard.js";
|
|
@@ -79,10 +97,13 @@ import { QUEUED_HANDOFF_MAX_REDELIVERIES, QueuedHandoffStore } from "./queued-ha
|
|
|
79
97
|
import { measureSyncWork, noteSyncWork } from "./sync-work-attribution.js";
|
|
80
98
|
import { TranscriptDeltaReader } from "./transcript-delta-reader.js";
|
|
81
99
|
import { checkpointCodexPane } from "./codex-pane-ownership.js";
|
|
100
|
+
import { codexAppliedFromRollout, codexRunningVersion, codexSupportsInlineModel, codexSwitchAnswerCount, codexSwitchFromPane, readFrom } from "./backend/codex-model-switch.js";
|
|
101
|
+
import { CLI_RUNTIME_SWITCH, cliRunningVersion, cliSwitchAllowed } from "./backend/cli-runtime-switch.js";
|
|
82
102
|
import { buildResumeContinuation, clearInFlightTurnMarker, consumeInFlightTurnMarker, decideTurnResume, normalizeResumeBackend, readResumeFingerprint, RESUME_BLOCKING_DELIVERY_STATES, writeInFlightTurnMarker, } from "./turn-resume.js";
|
|
83
103
|
import { codexLiveRowMatches } from "./backend/codex.js";
|
|
84
104
|
import { codexPackageProblemMessage } from "./backend/codex-package.js";
|
|
85
|
-
import { claudeConfigDirFor, claudeProfileConfigDir, claudeProjectKey, claudeSwitchDialog, claudeSwitchTargetMatches } from "./backend/claude-code.js";
|
|
105
|
+
import { claudeConfigDirFor, claudeJsonPath, claudeProfileConfigDir, claudeProjectKey, claudeSwitchDialog, claudeSwitchTargetMatches } from "./backend/claude-code.js";
|
|
106
|
+
import { checkClaudeMcpAtLaunch, dismissClaudeMcpMissing } from "./backend/claude-mcp-carry.js";
|
|
86
107
|
import { MuseBackend } from "./backend/muse.js";
|
|
87
108
|
import { BACKEND_LABELS, InteractionObservation, INTERACTION_CONFIRM_MS, sameInteractionOwner } from "./interaction-observation.js";
|
|
88
109
|
import { unrecognisedPromptShape } from "./unrecognised-prompt.js";
|
|
@@ -109,7 +130,7 @@ const WEB_THEME_IPC = Object.freeze({
|
|
|
109
130
|
});
|
|
110
131
|
/** The largest picture any slot may take (a card slot's ceiling; the fleet checks the limit in force): read no more. */
|
|
111
132
|
const WEB_THEME_ASSET_MAX_BYTES = ASSET_UPLOAD_MAX_BYTES;
|
|
112
|
-
const CROSS_INSTANCE_TOOLS = new Set(["send_to_instance", "broadcast", "list_instances", "start_instance", "restart_instance", "create_instance", "delete_instance", "replace_instance", "request_information", "delegate_task", "report_result", "delivery_status", "describe_instance"]);
|
|
133
|
+
const CROSS_INSTANCE_TOOLS = new Set(["hub_set_intro", "hub_room_status", "hub_room_list", "hub_room_post", "hub_room_history", "hub_room_members", "hub_people_search", "send_to_instance", "broadcast", "list_instances", "start_instance", "restart_instance", "create_instance", "delete_instance", "replace_instance", "request_information", "delegate_task", "report_result", "delivery_status", "describe_instance"]);
|
|
113
134
|
const SCHEDULE_TOOLS = new Set(["create_schedule", "list_schedules", "update_schedule", "delete_schedule"]);
|
|
114
135
|
const DECISION_TOOLS = new Set(["post_decision", "list_decisions", "update_decision"]);
|
|
115
136
|
const TASK_TOOL = "task";
|
|
@@ -155,6 +176,10 @@ export const DEFAULT_STATE_IDLE_DEBOUNCE_MS = 2_000;
|
|
|
155
176
|
export const DEFAULT_STATE_SAFETY_SWEEP_MS = 60_000;
|
|
156
177
|
/** Coalesce one cosmetic-redraw burst before comparing the visible pane. */
|
|
157
178
|
export const PERIODIC_REDRAW_PROBE_MS = 25;
|
|
179
|
+
/** M-3239: a turn's progress reaches the fleet at most this often while it runs. */
|
|
180
|
+
const TURN_ACTIVITY_REPORT_MS = 30_000;
|
|
181
|
+
/** M-3239: after the idle edge, the transcript's last lines (the final answer) are read within this. */
|
|
182
|
+
const TURN_END_SETTLE_MS = 5_000;
|
|
158
183
|
/** Board 907c7899: how often a kiro /compact's pane is read (TUI V2's "too short" shows for about ten seconds). */
|
|
159
184
|
const KIRO_COMPACT_PANE_POLL_MS = 1_000;
|
|
160
185
|
/** Do not turn a streaming Codex turn into one capture-pane per burst. */
|
|
@@ -563,6 +588,13 @@ const STARTUP_DIALOG_BUDGET_MS = 30_000;
|
|
|
563
588
|
export const OWN_SWITCH_WAIT_MS = 6_000;
|
|
564
589
|
/** #1690: after an answer to that dialog, how long it gets to go away. */
|
|
565
590
|
const OWN_SWITCH_SETTLE_MS = 3_000;
|
|
591
|
+
/** M-3175: how long a codex switch waits for the pane to be idle before it is not typed (the fleet then restarts instead). */
|
|
592
|
+
const CODEX_SWITCH_IDLE_MS = 60_000;
|
|
593
|
+
/** M-3175: how long codex gets to record the switch (rollout) or answer it (pane) after it is typed. */
|
|
594
|
+
const CODEX_SWITCH_VERIFY_MS = 10_000;
|
|
595
|
+
/** M-3175: the scrollback read around a codex switch (codex's answer rows are counted in it) and the most of a rollout delta read. */
|
|
596
|
+
const CODEX_SWITCH_HISTORY_LINES = 200;
|
|
597
|
+
const CODEX_SWITCH_ROLLOUT_READ = 4 * 1024 * 1024;
|
|
566
598
|
/** A blocking dialog still on screen this long after first being seen is reported for a human. */
|
|
567
599
|
const DIALOG_PARKED_NOTIFY_MS = 60_000;
|
|
568
600
|
/** #2675: a card a person can answer from the chat is posted once it has been on screen, unchanged, this long. */
|
|
@@ -660,7 +692,7 @@ const INPUT_TRANSIENT_STALL_MS = 30_000;
|
|
|
660
692
|
*/
|
|
661
693
|
const INPUT_TRANSIENT_WAIT_MS = 10 * 60_000;
|
|
662
694
|
const INPUT_TRANSIENT_POLL_MS = 250;
|
|
663
|
-
/** Max
|
|
695
|
+
/** Max actual stranded-text recovery Enters per delivery; a busy observation spends none. */
|
|
664
696
|
const STRANDED_INPUT_MAX_ROUNDS = 3;
|
|
665
697
|
/** The Claude phrasing every backend was judged by before #1217; still the default for a backend that names none. */
|
|
666
698
|
const LEGACY_NO_CONVERSATION = /no conversation found|no conversation to (continue|resume)|no previous (session|conversation)/i;
|
|
@@ -676,6 +708,8 @@ const INPUT_RESIDUE_POLL_MS = 100;
|
|
|
676
708
|
const RECENT_PASTES_KEPT = 8;
|
|
677
709
|
/** Build a status holder from channel metadata, keeping chat and thread apart. */
|
|
678
710
|
export function channelStatus(meta) {
|
|
711
|
+
if (meta.source === "app")
|
|
712
|
+
return undefined; // no platform post exists to react to
|
|
679
713
|
const chatId = meta.chat_id;
|
|
680
714
|
const messageId = meta.message_id;
|
|
681
715
|
// A web chat message has no platform chat when the fleet has no channel, and still gets its reports:
|
|
@@ -1120,6 +1154,33 @@ const FLEET_RESPONSE_TYPES = new Set([
|
|
|
1120
1154
|
"fleet_schedule_response", "fleet_outbound_response", "fleet_decision_response", "fleet_task_response",
|
|
1121
1155
|
"fleet_display_name_response", "fleet_description_response", "fleet_persona_emoji_response", "fleet_web_theme_response",
|
|
1122
1156
|
]);
|
|
1157
|
+
/** null: no record (no turn). "unknown": a record that cannot be read or makes no sense — a turn may be running. */
|
|
1158
|
+
function readHubAnswerTurn(file) {
|
|
1159
|
+
let text;
|
|
1160
|
+
try {
|
|
1161
|
+
text = readFileSync(file, "utf8");
|
|
1162
|
+
}
|
|
1163
|
+
catch (err) {
|
|
1164
|
+
return err.code === "ENOENT" ? null : "unknown";
|
|
1165
|
+
}
|
|
1166
|
+
try {
|
|
1167
|
+
const r = JSON.parse(text);
|
|
1168
|
+
if (!r || typeof r.correlationId !== "string" || !/^hub-[A-Za-z0-9-]+$/.test(r.correlationId))
|
|
1169
|
+
return "unknown";
|
|
1170
|
+
return { correlationId: r.correlationId, contactLimit: r.contactLimit !== false, sawWorking: true, restored: true };
|
|
1171
|
+
}
|
|
1172
|
+
catch {
|
|
1173
|
+
return "unknown";
|
|
1174
|
+
}
|
|
1175
|
+
}
|
|
1176
|
+
/**
|
|
1177
|
+
* M-3660: a question from the Hub (a representative or room ask) that the agent answers with report_result to agend-hub.
|
|
1178
|
+
* It trusts the meta: only the fleet writes fleet_inbound, and from_instance "agend-hub" is its reserved sender — an
|
|
1179
|
+
* agent's send_to_instance is stamped with the agent's own name.
|
|
1180
|
+
*/
|
|
1181
|
+
export function isHubQuestionMeta(meta) {
|
|
1182
|
+
return meta.from_instance === HUB_REPORT_TARGET && meta.request_kind === "query" && /^hub-[A-Za-z0-9-]+$/.test(meta.correlation_id ?? "");
|
|
1183
|
+
}
|
|
1123
1184
|
export class Daemon extends EventEmitter {
|
|
1124
1185
|
name;
|
|
1125
1186
|
config;
|
|
@@ -1186,6 +1247,14 @@ export class Daemon extends EventEmitter {
|
|
|
1186
1247
|
}
|
|
1187
1248
|
guardian = null;
|
|
1188
1249
|
adapter = null;
|
|
1250
|
+
requestContextAdmission;
|
|
1251
|
+
/** Input fencing may attach to a legacy owner; it does not bind C or reinterpret an existing turn. */
|
|
1252
|
+
setRequestContextAdmission(port) {
|
|
1253
|
+
if (this.requestContextAdmission && this.requestContextAdmission !== port)
|
|
1254
|
+
throw Error("Request-context admission owner differs");
|
|
1255
|
+
this.requestContextAdmission = port;
|
|
1256
|
+
}
|
|
1257
|
+
requestContextPendingWork = new RequestContextPendingWork();
|
|
1189
1258
|
pendingIpcRequests = new Map();
|
|
1190
1259
|
/**
|
|
1191
1260
|
* Daemon-global request sequence. MCP request ids are only process-local:
|
|
@@ -1550,6 +1619,8 @@ export class Daemon extends EventEmitter {
|
|
|
1550
1619
|
* instance is still auth-broken and must not resume raising alarms.
|
|
1551
1620
|
*/
|
|
1552
1621
|
authFailureUnresolved = false;
|
|
1622
|
+
/** A process-local login failure cannot be repaired by a valid auth file or idle chrome. */
|
|
1623
|
+
staleAuth = null;
|
|
1553
1624
|
/** One login-screen auth report per spawn — the screen persists across polls. */
|
|
1554
1625
|
loginScreenReported = false;
|
|
1555
1626
|
/** #2795: the auth pattern match the token-free check is still to judge; it arms nothing until confirmAuthFailure(). */
|
|
@@ -1843,7 +1914,7 @@ export class Daemon extends EventEmitter {
|
|
|
1843
1914
|
if (!["codex", "grok"].includes(this.backend?.binaryName ?? ""))
|
|
1844
1915
|
return [];
|
|
1845
1916
|
const patterns = this.backend?.getErrorPatterns?.() ?? [];
|
|
1846
|
-
return this.backend?.binaryName === "codex" ? patterns.filter(ep => Daemon.isCodexUsageLimitPause(ep)) : patterns.filter(ep => ep.type === "quota");
|
|
1917
|
+
return this.backend?.binaryName === "codex" ? patterns.filter(ep => Daemon.isCodexUsageLimitPause(ep) || ep.type === "stale_auth") : patterns.filter(ep => ep.type === "quota");
|
|
1847
1918
|
}
|
|
1848
1919
|
async prepareQuotaReplayHistory(reuseWindow) {
|
|
1849
1920
|
this.quotaReplay = null;
|
|
@@ -1867,7 +1938,20 @@ export class Daemon extends EventEmitter {
|
|
|
1867
1938
|
if (!current())
|
|
1868
1939
|
return;
|
|
1869
1940
|
const patterns = this.paneQuotaPatterns();
|
|
1870
|
-
|
|
1941
|
+
// A quota frame can span several wrapped rows. Keep the complete rows
|
|
1942
|
+
// each actual match covered, rather than testing the rows independently.
|
|
1943
|
+
// Exact spans dedupe overlapping rules without collapsing repeated hits.
|
|
1944
|
+
const spans = new Map();
|
|
1945
|
+
for (const ep of patterns) {
|
|
1946
|
+
const flags = ep.pattern.flags.includes("g") ? ep.pattern.flags : ep.pattern.flags + "g";
|
|
1947
|
+
for (const match of oldPane.matchAll(new RegExp(ep.pattern.source, flags))) {
|
|
1948
|
+
const start = oldPane.lastIndexOf("\n", match.index) + 1;
|
|
1949
|
+
const newline = oldPane.indexOf("\n", match.index + match[0].length);
|
|
1950
|
+
const end = newline < 0 ? oldPane.length : newline;
|
|
1951
|
+
spans.set(`${start}:${end}`, oldPane.slice(start, end));
|
|
1952
|
+
}
|
|
1953
|
+
}
|
|
1954
|
+
const messages = [...spans.values()];
|
|
1871
1955
|
this.quotaReplay = { messages, current: () => true, spawn, fence, attempt };
|
|
1872
1956
|
}
|
|
1873
1957
|
}
|
|
@@ -1883,7 +1967,13 @@ export class Daemon extends EventEmitter {
|
|
|
1883
1967
|
this.quotaReplay = null;
|
|
1884
1968
|
if (history.spawn !== this.spawnGeneration || history.fence !== this.launchFenceEpoch || history.attempt !== this.launchAttempt || !history.current())
|
|
1885
1969
|
return;
|
|
1886
|
-
|
|
1970
|
+
const patterns = this.paneQuotaPatterns();
|
|
1971
|
+
// Grok's old quota frame can also contain a 401. That same proven frame
|
|
1972
|
+
// must not arm the auth gate after its quota was absorbed as history.
|
|
1973
|
+
if (this.backend?.binaryName === "grok") {
|
|
1974
|
+
patterns.push(...(this.backend.getErrorPatterns?.() ?? []).filter(ep => ep.type === "auth_error"));
|
|
1975
|
+
}
|
|
1976
|
+
for (const ep of patterns) {
|
|
1887
1977
|
const count = Math.min(Daemon.countOccurrences(ep.pattern, pane), quotaHistoryCount(pane, ep.pattern, history.messages));
|
|
1888
1978
|
if (!count)
|
|
1889
1979
|
continue;
|
|
@@ -1905,7 +1995,7 @@ export class Daemon extends EventEmitter {
|
|
|
1905
1995
|
this.quotaInput = history.marker && history.occurrences === 0 ? { history, reported: new Map() } : null;
|
|
1906
1996
|
}
|
|
1907
1997
|
quotaOccurrencesAfterInput(pane, ep) {
|
|
1908
|
-
if (!(this.backend?.binaryName === "codex" && Daemon.isCodexUsageLimitPause(ep)
|
|
1998
|
+
if (!(this.backend?.binaryName === "codex" && (Daemon.isCodexUsageLimitPause(ep) || ep.type === "stale_auth")
|
|
1909
1999
|
|| this.backend?.binaryName === "grok" && ep.type === "quota"))
|
|
1910
2000
|
return null;
|
|
1911
2001
|
const input = this.quotaInput, history = input?.history;
|
|
@@ -1929,6 +2019,42 @@ export class Daemon extends EventEmitter {
|
|
|
1929
2019
|
transcriptEventSeq = 0;
|
|
1930
2020
|
usageLimitErrorSeq = 0;
|
|
1931
2021
|
static MODEL_USAGE_LIMIT = CLAUDE_MODEL_USAGE_LIMIT;
|
|
2022
|
+
/** M-3749: the MCP servers missing since a profile switch — Needs you lists them until they are back or dismissed. */
|
|
2023
|
+
mcpMissingState = null;
|
|
2024
|
+
mcpMissing() {
|
|
2025
|
+
return this.mcpMissingState ? { ...this.mcpMissingState, names: [...this.mcpMissingState.names] } : null;
|
|
2026
|
+
}
|
|
2027
|
+
/** M-3749: a person dismissed the missing-MCP list (Needs you → Acknowledge). false: nothing was outstanding. */
|
|
2028
|
+
dismissMcpMissing() {
|
|
2029
|
+
dismissClaudeMcpMissing(this.instanceDir);
|
|
2030
|
+
if (!this.mcpMissingState)
|
|
2031
|
+
return false;
|
|
2032
|
+
this.mcpMissingState = null;
|
|
2033
|
+
this.emit("mcp_missing", { name: this.name, missing: null });
|
|
2034
|
+
return true;
|
|
2035
|
+
}
|
|
2036
|
+
/**
|
|
2037
|
+
* M-3749: at each Claude launch, the user/local-scope MCP servers it had before a credential-profile switch and does not
|
|
2038
|
+
* have now (outstanding until back or dismissed). Never fails a launch; names only, never an entry.
|
|
2039
|
+
*/
|
|
2040
|
+
checkClaudeMcpServers(backendConfig) {
|
|
2041
|
+
const before = this.mcpMissingState;
|
|
2042
|
+
this.mcpMissingState = null;
|
|
2043
|
+
if ((this.config.backend ?? "claude-code") === "claude-code") {
|
|
2044
|
+
try {
|
|
2045
|
+
const profileDir = claudeProfileConfigDir(backendConfig.backendOptions);
|
|
2046
|
+
this.mcpMissingState = checkClaudeMcpAtLaunch({ instanceDir: this.instanceDir, configDir: claudeConfigDirFor(profileDir),
|
|
2047
|
+
jsonPath: claudeJsonPath(profileDir), workingDirectory: this.config.working_directory });
|
|
2048
|
+
}
|
|
2049
|
+
catch (err) {
|
|
2050
|
+
this.logger.debug({ err }, "MCP server check at launch skipped");
|
|
2051
|
+
}
|
|
2052
|
+
}
|
|
2053
|
+
if (this.mcpMissingState)
|
|
2054
|
+
this.logger.warn({ missing: this.mcpMissingState.names }, "MCP servers from the previous credential profile are not in this one");
|
|
2055
|
+
if (before || this.mcpMissingState)
|
|
2056
|
+
this.emit("mcp_missing", { name: this.name, missing: this.mcpMissing() });
|
|
2057
|
+
}
|
|
1932
2058
|
/** #2822: the usage-limit hold, while it lasts — Needs you lists it. */
|
|
1933
2059
|
usageHold() {
|
|
1934
2060
|
return this.usageLimitHold ? { ...this.usageLimitHold } : null;
|
|
@@ -2069,6 +2195,10 @@ export class Daemon extends EventEmitter {
|
|
|
2069
2195
|
}
|
|
2070
2196
|
return super.emit(event, ...args);
|
|
2071
2197
|
}
|
|
2198
|
+
/** Attention remains active for General/busy agents too, until a new launch takes ownership. */
|
|
2199
|
+
staleAuthIssue() {
|
|
2200
|
+
return this.staleAuth?.generation === this.spawnGeneration ? { since: this.staleAuth.since } : null;
|
|
2201
|
+
}
|
|
2072
2202
|
/**
|
|
2073
2203
|
* Undo an auth suspicion once the backend's token-free probe has said the credentials are fine. Since #2795 a pane
|
|
2074
2204
|
* pattern match arms nothing before that probe (its pending match is just dropped); what is left to undo is a
|
|
@@ -2077,6 +2207,8 @@ export class Daemon extends EventEmitter {
|
|
|
2077
2207
|
* is still live and stays.
|
|
2078
2208
|
*/
|
|
2079
2209
|
clearSuspectedAuthFailure() {
|
|
2210
|
+
if (this.staleAuthIssue())
|
|
2211
|
+
return false;
|
|
2080
2212
|
this.unverifiedAuthMatch = null;
|
|
2081
2213
|
if (!this.authFailureUnresolved && !this.loginScreenReported)
|
|
2082
2214
|
return false;
|
|
@@ -2140,6 +2272,7 @@ export class Daemon extends EventEmitter {
|
|
|
2140
2272
|
guardGeneration: turn?.generation ?? null, guardPhase: turn?.phase ?? null }, "Native pane tool operation failed");
|
|
2141
2273
|
}
|
|
2142
2274
|
nativePaneCurrent() { return this.nativePaneLifecycle?.current() ?? false; }
|
|
2275
|
+
nativePaneRequestContextTransportCurrent() { return this.nativePaneLifecycle?.requestContextTransportCurrent?.() === true; }
|
|
2143
2276
|
nativeEnterHold = null;
|
|
2144
2277
|
/** Per-launch attention for a native delivery whose bounded input attempts were refused or uncertain, including non-outbox input. */
|
|
2145
2278
|
nativeDeliveryHold() {
|
|
@@ -2194,14 +2327,435 @@ export class Daemon extends EventEmitter {
|
|
|
2194
2327
|
fleetTransportAvailable() {
|
|
2195
2328
|
return this.nativePaneLifecycle ? !!this.nativeFleetBridge?.current() && !this.runtimeMonitorsFrozen : !!this.ipcServer;
|
|
2196
2329
|
}
|
|
2330
|
+
classicRestriction;
|
|
2331
|
+
classicRestrictionFailed = false;
|
|
2332
|
+
classicRestrictionNeedsRestart = false;
|
|
2333
|
+
setClassicRestriction(input) {
|
|
2334
|
+
if (this.runtimeIdentity?.kind !== "classic") {
|
|
2335
|
+
if (input?.mode === "legacy")
|
|
2336
|
+
return; // The optional adapter also sees existing/default-kind starts.
|
|
2337
|
+
throw Error("Classic restriction requires a Classic room");
|
|
2338
|
+
}
|
|
2339
|
+
try {
|
|
2340
|
+
if (!input || !["legacy", "restricted"].includes(input.mode))
|
|
2341
|
+
throw Error("invalid-policy");
|
|
2342
|
+
const next = input.mode === "restricted" ? { roomKey: this.name, policyRevision: input.policyRevision ?? 0,
|
|
2343
|
+
publicRead: input.roomTools.publicRead, allowedMcpTools: structuredClone(input.roomTools.allowedMcpTools),
|
|
2344
|
+
allowedAgendTools: [...CLASSIC_RESTRICTED_TOOLS] } : undefined;
|
|
2345
|
+
// A1's revision also changes for contact grants and approvers. Validate it,
|
|
2346
|
+
// but preserve the frozen launch when the native tool policy is unchanged.
|
|
2347
|
+
if (next)
|
|
2348
|
+
classicPlanDigest(next);
|
|
2349
|
+
const before = this.classicRestriction ? classicPlanDigest({ ...this.classicRestriction, policyRevision: 0 }) : null;
|
|
2350
|
+
const after = next ? classicPlanDigest({ ...next, policyRevision: 0 }) : null;
|
|
2351
|
+
if (before !== after) {
|
|
2352
|
+
invalidateClassicGuard(this.instanceDir);
|
|
2353
|
+
if (this.classicRestriction && !next && this.processStatus === "running")
|
|
2354
|
+
this.classicRestrictionNeedsRestart = true;
|
|
2355
|
+
this.classicRestriction = next;
|
|
2356
|
+
}
|
|
2357
|
+
this.classicRestrictionFailed = false;
|
|
2358
|
+
}
|
|
2359
|
+
catch {
|
|
2360
|
+
this.classicRestrictionFailed = true;
|
|
2361
|
+
try {
|
|
2362
|
+
invalidateClassicGuard(this.instanceDir);
|
|
2363
|
+
}
|
|
2364
|
+
catch { /* failed remains visible and refuses the next launch */ }
|
|
2365
|
+
}
|
|
2366
|
+
}
|
|
2367
|
+
assertClassicRestrictionLaunch(expected) {
|
|
2368
|
+
const current = this.classicRestriction ? classicPlanDigest(this.classicRestriction) : null;
|
|
2369
|
+
if (this.classicRestrictionFailed || current !== expected)
|
|
2370
|
+
throw Error("Restricted room policy changed while CLI launch was being prepared");
|
|
2371
|
+
}
|
|
2372
|
+
classicNativeGuard() {
|
|
2373
|
+
const backend = this.config.backend ?? this.backend?.binaryName ?? "unknown";
|
|
2374
|
+
if (this.classicRestrictionFailed)
|
|
2375
|
+
return classicGuardInventory({ state: "failed", backend, reason: "guard-unavailable" });
|
|
2376
|
+
if (!this.classicRestriction)
|
|
2377
|
+
return classicGuardInventory(this.classicRestrictionNeedsRestart
|
|
2378
|
+
? { state: "restart-required", backend, reason: "stale-policy" }
|
|
2379
|
+
: { state: "not-covered", backend, reason: "legacy-mode" });
|
|
2380
|
+
if (this.nativePaneLifecycle)
|
|
2381
|
+
return classicGuardInventory({ state: "not-covered", backend, reason: "unsupported-platform" });
|
|
2382
|
+
const status = this.backend?.classicNativeGuard?.(this.classicRestriction)
|
|
2383
|
+
?? { state: "not-covered", backend, reason: "unsupported-backend" };
|
|
2384
|
+
return classicGuardInventory(status.state === "ready" && this.processStatus !== "running"
|
|
2385
|
+
? { state: "restart-required", backend, reason: "not-running" } : status);
|
|
2386
|
+
}
|
|
2387
|
+
/** Internal local-lifecycle port only. No config, IPC or MCP setter; production stays unbound until cutover. */
|
|
2388
|
+
requestContextLifecycle;
|
|
2389
|
+
requestContextWrite;
|
|
2390
|
+
requestContextPolicy;
|
|
2391
|
+
bindRequestContextPolicy(policy) { if (this.requestContextPolicy || !this.requestContextLifecycle)
|
|
2392
|
+
throw Error("request-context policy requires its owned turn binding"); this.requestContextPolicy = policy; }
|
|
2393
|
+
requestContextCalls = new RequestContextReferenceMap(call => call.admission.coverage === "covered" ? call.admission.lease.snapshot.context.ref.rootContextId : null, call => `local-call:${call.id}`);
|
|
2394
|
+
requestContextQueuedWork = new RequestContextReferenceMap(row => row.root, (_row, id) => `queued-recovery:${id}`);
|
|
2395
|
+
get requestContextQueuedWorkDrainRevision() { return this.requestContextQueuedWork.revision; }
|
|
2396
|
+
requestContextQueuedWorkDrainView(rootId) { return this.requestContextQueuedWork.view(rootId); }
|
|
2397
|
+
requestContextPendingReplies = new RequestContextPendingReplies();
|
|
2398
|
+
requestContextHumanReplies = new Map();
|
|
2399
|
+
requestContextInterruptedLaunch;
|
|
2400
|
+
requestContextLaunch() { return JSON.stringify([this.bootId, this.spawnGeneration, this.nativePaneLifecycle?.snapshot?.()?.launchId ?? null]); }
|
|
2401
|
+
/** First local owned hop only. No lookup at a later Fleet receipt may retag this call. */
|
|
2402
|
+
beginRequestContextCall(socket) {
|
|
2403
|
+
if (!this.requestContextLifecycle)
|
|
2404
|
+
return;
|
|
2405
|
+
if (this.requestContextCalls.size >= 128)
|
|
2406
|
+
throw Error("Request context call admission backlog");
|
|
2407
|
+
const launch = this.requestContextLaunch();
|
|
2408
|
+
const snapshot = socket && this.socketSessionNames.get(socket) === this.name ? this.requestContextTurnSnapshot() : null;
|
|
2409
|
+
const reason = this.requestContextInterruptedLaunch === launch ? "interrupted-launch" : "unbound-input";
|
|
2410
|
+
const admission = snapshot && reason !== "interrupted-launch"
|
|
2411
|
+
? { coverage: "covered", lease: captureRequestContextCall(snapshot, captured => this.requestContextTurnCurrent(captured)) }
|
|
2412
|
+
: { coverage: "not-covered", reason };
|
|
2413
|
+
const reply = this.requestContextCapturedReply(admission);
|
|
2414
|
+
const call = Object.freeze({ id: randomUUID(), admission: Object.freeze(admission),
|
|
2415
|
+
get replyRoute() { return reply.route(); }, waitForReplyRoute: reply.wait,
|
|
2416
|
+
current: () => reply.current() && !this.deliveryWritesStopping && this.requestContextLaunch() === launch
|
|
2417
|
+
&& (admission.coverage !== "covered" || admission.lease.current()) });
|
|
2418
|
+
this.requestContextCalls.set(call.id, call);
|
|
2419
|
+
return call;
|
|
2420
|
+
}
|
|
2421
|
+
/** Capture the scheduling record now; waiting never looks up a newer input. */
|
|
2422
|
+
requestContextCapturedReply(admission) {
|
|
2423
|
+
const snapshot = admission.coverage === "covered" ? admission.lease.snapshot : null;
|
|
2424
|
+
let deadline = Infinity;
|
|
2425
|
+
let route = snapshot ? this.captureRequestContextReplyRoute(snapshot) : undefined;
|
|
2426
|
+
const pending = snapshot && !route ? this.requestContextPendingReplies.capture(snapshot) : undefined;
|
|
2427
|
+
return { route: () => route, current: () => performance.now() < deadline, wait: pending ? async (budgetMs) => {
|
|
2428
|
+
deadline = Math.min(deadline, performance.now() + budgetMs);
|
|
2429
|
+
const confirmed = await pending.wait(budgetMs);
|
|
2430
|
+
if (confirmed && snapshot && performance.now() < deadline && admission.coverage === "covered" && admission.lease.current()) {
|
|
2431
|
+
const checked = this.captureRequestContextReplyRoute(snapshot);
|
|
2432
|
+
if (checked && checked.generation === confirmed.generation && requestContextDigest(checked.target) === requestContextDigest(confirmed.target))
|
|
2433
|
+
route = Object.freeze({ ...checked, current: () => performance.now() < deadline && checked.current() });
|
|
2434
|
+
}
|
|
2435
|
+
} : undefined };
|
|
2436
|
+
}
|
|
2437
|
+
/** Bind the original call to a delivered target, with the original human admission rechecked at commit. */
|
|
2438
|
+
captureRequestContextReplyRoute(snapshot) {
|
|
2439
|
+
const route = this.turnReplyGuard?.captureReplyRoute(snapshot.token);
|
|
2440
|
+
if (!route)
|
|
2441
|
+
return;
|
|
2442
|
+
const current = () => {
|
|
2443
|
+
try {
|
|
2444
|
+
return route.current() && this.requestContextTurnCurrent(snapshot)
|
|
2445
|
+
&& requestContextDigest(this.requestContextLifecycle?.replyTarget?.(snapshot)) === requestContextDigest(route.target);
|
|
2446
|
+
}
|
|
2447
|
+
catch {
|
|
2448
|
+
return false;
|
|
2449
|
+
}
|
|
2450
|
+
};
|
|
2451
|
+
return current() ? Object.freeze({ ...route, current }) : undefined;
|
|
2452
|
+
}
|
|
2453
|
+
/** Internal Fleet accessor, paired with the current daemon/IPC connection; returns original scope or nothing. */
|
|
2454
|
+
requestContextCall(callId) {
|
|
2455
|
+
const call = this.requestContextCalls.get(callId);
|
|
2456
|
+
return call?.current() ? call : null;
|
|
2457
|
+
}
|
|
2458
|
+
requestContextCallsRequired() { return this.requestContextLifecycle !== undefined; }
|
|
2459
|
+
get requestContextCallDrainRevision() { return this.requestContextCalls.revision; }
|
|
2460
|
+
requestContextCallDrainView(rootId) { return this.requestContextCalls.view(rootId); }
|
|
2461
|
+
requestContextTurnDrainView(rootId) {
|
|
2462
|
+
const view = this.requestContextLifecycle?.turns.drainView(rootId);
|
|
2463
|
+
if (!view)
|
|
2464
|
+
return null;
|
|
2465
|
+
const write = this.requestContextWrite;
|
|
2466
|
+
return { ...view, revision: this.requestContextTurnDrainRevision, references: [...view.references,
|
|
2467
|
+
...(write?.unknownEnd && write.snapshot.context.ref.rootContextId === rootId
|
|
2468
|
+
? [`unknown-end:${this.name}:${write.unknownEnd}`] : [])] };
|
|
2469
|
+
}
|
|
2470
|
+
get requestContextTurnDrainRevision() {
|
|
2471
|
+
return JSON.stringify([
|
|
2472
|
+
this.requestContextLifecycle?.turns.drainRevision ?? "unavailable",
|
|
2473
|
+
this.requestContextWrite?.unknownEnd ?? null
|
|
2474
|
+
]);
|
|
2475
|
+
}
|
|
2476
|
+
handleOwnedToolCall(message, socket) {
|
|
2477
|
+
let call;
|
|
2478
|
+
try {
|
|
2479
|
+
call = this.beginRequestContextCall(socket);
|
|
2480
|
+
this.handleToolCall(message, socket, undefined, call);
|
|
2481
|
+
}
|
|
2482
|
+
catch {
|
|
2483
|
+
if (call)
|
|
2484
|
+
this.requestContextCalls.delete(call.id);
|
|
2485
|
+
this.ipcServer?.send(socket, { requestId: message.requestId, result: null, error: "Request context call admission is unavailable" });
|
|
2486
|
+
}
|
|
2487
|
+
}
|
|
2488
|
+
/** New replacement only; an old launch never acquires C by reseeding its counters. */
|
|
2489
|
+
seedRequestContextReplacement(previous) {
|
|
2490
|
+
if (this.tmux || this.ipcServer || this.nativePaneLifecycle || this.requestContextLifecycle
|
|
2491
|
+
|| ![previous.spawnGeneration, previous.launchFenceEpoch].every(n => Number.isSafeInteger(n) && n >= 0 && n < Number.MAX_SAFE_INTEGER)) {
|
|
2492
|
+
throw Error("Request-context replacement must be prepared before startup");
|
|
2493
|
+
}
|
|
2494
|
+
this.spawnGeneration = previous.spawnGeneration + 1;
|
|
2495
|
+
this.launchFenceEpoch = previous.launchFenceEpoch + 1;
|
|
2496
|
+
}
|
|
2497
|
+
/** Read-only first-On inventory. Idle alone is never a legacy-work drain proof. */
|
|
2498
|
+
requestContextLaunchObservation() {
|
|
2499
|
+
return Object.freeze({ daemonBootId: this.bootId, spawnGeneration: this.spawnGeneration,
|
|
2500
|
+
launchFenceEpoch: this.launchFenceEpoch, observation: this.getWorkingStateObservation(),
|
|
2501
|
+
pendingCalls: this.requestContextPendingWork.count(this.name), responseWaiters: this.pendingIpcRequests.size,
|
|
2502
|
+
paneWriteBusy: this.paneWriteLock.isBusy, queuedInputs: this.pasteQueueDepth,
|
|
2503
|
+
transcriptOpen: this.transcriptTurns.openSince() !== null,
|
|
2504
|
+
starting: this.spawning, stopping: this.deliveryWritesStopping || this.startupAborted,
|
|
2505
|
+
replacementRequired: !this.requestContextLifecycle || this.requestContextInterruptedLaunch === this.requestContextLaunch() });
|
|
2506
|
+
}
|
|
2507
|
+
requestContextHelper;
|
|
2508
|
+
requestContextStartupResources;
|
|
2509
|
+
/** Candidate-only physical resource receipt, installed before startup. Used even when startup rejects.
|
|
2510
|
+
* No stop result, timeout, removed metadata or empty supervisor map proves retirement.
|
|
2511
|
+
*/
|
|
2512
|
+
prepareRequestContextStartupRetirement() {
|
|
2513
|
+
if (this.tmux || this.ipcServer || this.nativePaneLifecycle || this.requestContextStartupResources)
|
|
2514
|
+
throw Error("Request startup retirement must precede launch");
|
|
2515
|
+
const resources = { pending: 0, unknown: false, windows: [], ipc: new Set(), native: [] };
|
|
2516
|
+
this.requestContextStartupResources = resources;
|
|
2517
|
+
return Object.freeze({ retired: async () => {
|
|
2518
|
+
try {
|
|
2519
|
+
if (this.requestContextStartupResources !== resources || !this.startupAborted && !this.deliveryWritesStopping || this.spawning
|
|
2520
|
+
|| resources.pending || resources.unknown || [...resources.ipc].some(ipc => !ipc.retired()))
|
|
2521
|
+
return false;
|
|
2522
|
+
for (const row of resources.native) {
|
|
2523
|
+
const snapshot = row.owner.snapshot?.();
|
|
2524
|
+
if (!snapshot || snapshot.state !== "exited" || JSON.stringify([snapshot.hostBootId, snapshot.paneId, snapshot.launchId, snapshot.agentId, snapshot.instance]) !== row.identity)
|
|
2525
|
+
return false;
|
|
2526
|
+
}
|
|
2527
|
+
for (const row of resources.windows) {
|
|
2528
|
+
const windows = await TmuxManager.listWindowsStrict(row.session);
|
|
2529
|
+
if (resources.pending || resources.unknown || windows.some(window => window.id === row.window) || !requestContextProcessGroupGone(row.pid))
|
|
2530
|
+
return false;
|
|
2531
|
+
}
|
|
2532
|
+
return this.requestContextStartupResources === resources && !resources.pending && !resources.unknown && [...resources.ipc].every(ipc => ipc.retired());
|
|
2533
|
+
}
|
|
2534
|
+
catch {
|
|
2535
|
+
return false;
|
|
2536
|
+
}
|
|
2537
|
+
} });
|
|
2538
|
+
}
|
|
2539
|
+
requestContextHelperReadiness() {
|
|
2540
|
+
if (!this.requestContextLifecycle)
|
|
2541
|
+
return null;
|
|
2542
|
+
if (this.nativePaneLifecycle) {
|
|
2543
|
+
const snapshot = this.nativePaneLifecycle.snapshot?.();
|
|
2544
|
+
if (!snapshot)
|
|
2545
|
+
return null;
|
|
2546
|
+
// Output/sequence changes are observations, not a new admitting launch. Bind the actual owner tuple.
|
|
2547
|
+
return { version: 1, generation: JSON.stringify([this.bootId, this.spawnGeneration, this.launchFenceEpoch, snapshot.hostBootId, snapshot.paneId, snapshot.launchId, snapshot.agentId]),
|
|
2548
|
+
ready: snapshot.state === "running" && this.nativePaneLifecycle.requestContextTransportCurrent?.() === true };
|
|
2549
|
+
}
|
|
2550
|
+
return this.requestContextHelper ? { version: 1, generation: `${this.bootId}:${this.requestContextHelper.revision}`, ready: this.requestContextHelper.ready() } : null;
|
|
2551
|
+
}
|
|
2552
|
+
getRequestContextLaunchSpec() {
|
|
2553
|
+
const kind = this.runtimeIdentity?.kind;
|
|
2554
|
+
if (kind !== "classic" && kind !== "fleet-topic")
|
|
2555
|
+
throw Error("Request launch kind unavailable");
|
|
2556
|
+
return Object.freeze({ config: this.getConfigSnapshot(), topicMode: this.topicMode, kind });
|
|
2557
|
+
}
|
|
2558
|
+
/** First-On uses a real bounded pane read, not the cached idle badge; admission must already be fenced. */
|
|
2559
|
+
async captureRequestContextIdle() {
|
|
2560
|
+
const admission = this.requestContextAdmission;
|
|
2561
|
+
if (!admission || admission.available())
|
|
2562
|
+
return null;
|
|
2563
|
+
// Capture before waiting for the write lock: a replaced/respawned owner cannot inherit this request.
|
|
2564
|
+
const tmux = this.tmux, ipc = this.ipcServer, owner = JSON.stringify(this.interactionOwner());
|
|
2565
|
+
const daemonBootId = this.bootId, spawnGeneration = this.spawnGeneration, launchFenceEpoch = this.launchFenceEpoch, deliveryEpoch = this.deliveryEpoch;
|
|
2566
|
+
const pendingRevision = this.requestContextPendingWork.revision, turn = this.turnReplyGuard.snapshot();
|
|
2567
|
+
return this.paneWriteLock.run(async () => {
|
|
2568
|
+
const stable = () => {
|
|
2569
|
+
const observed = this.requestContextLaunchObservation(), now = this.turnReplyGuard.snapshot();
|
|
2570
|
+
return this.requestContextAdmission === admission && !admission.available()
|
|
2571
|
+
&& this.tmux === tmux && this.ipcServer === ipc && JSON.stringify(this.interactionOwner()) === owner
|
|
2572
|
+
&& this.deliveryEpoch === deliveryEpoch && this.requestContextPendingWork.revision === pendingRevision
|
|
2573
|
+
&& observed.pendingCalls === 0 && observed.responseWaiters === 0 && observed.queuedInputs === 0
|
|
2574
|
+
&& !observed.transcriptOpen && !observed.starting && !observed.stopping && !this.runtimeMonitorsFrozen
|
|
2575
|
+
&& observed.observation.processStatus === "running" && observed.observation.executionState === "idle"
|
|
2576
|
+
&& (!this.backend?.backgroundWorkRunning || observed.observation.backgroundWork !== true)
|
|
2577
|
+
&& now?.generation === turn?.generation
|
|
2578
|
+
&& (!now || now.cancelledByUser || now.completionDelivered);
|
|
2579
|
+
};
|
|
2580
|
+
if (!tmux || !stable())
|
|
2581
|
+
return null;
|
|
2582
|
+
let pane;
|
|
2583
|
+
try {
|
|
2584
|
+
pane = await tmux.capturePane(2000);
|
|
2585
|
+
}
|
|
2586
|
+
catch {
|
|
2587
|
+
return null;
|
|
2588
|
+
}
|
|
2589
|
+
if (!stable() || !this.paneAuthoritativelyIdle(pane) || this.inputTransientInPane(pane)
|
|
2590
|
+
|| this.backend?.backgroundWorkRunning && this.backend.backgroundWorkRunning(pane) !== false)
|
|
2591
|
+
return null;
|
|
2592
|
+
// The owning gate still checks its durable rows and producer revision. A late handler, queue, turn,
|
|
2593
|
+
// IPC replacement or owner change invalidates this proof even if it later looks idle again.
|
|
2594
|
+
return Object.freeze({ daemonBootId, spawnGeneration, launchFenceEpoch, deliveryEpoch,
|
|
2595
|
+
current: () => !this.paneWriteLock.isBusy && stable() });
|
|
2596
|
+
});
|
|
2597
|
+
}
|
|
2598
|
+
/** Capture the exact old resources BEFORE stop removes metadata; this proof never kills or signals anything. */
|
|
2599
|
+
async captureRequestContextRetirement() {
|
|
2600
|
+
const tmux = this.tmux, windowId = tmux?.getWindowId(), native = this.nativePaneLifecycle, ipc = this.ipcServer;
|
|
2601
|
+
const spawnGeneration = this.spawnGeneration, launchFenceEpoch = this.launchFenceEpoch, daemonBootId = this.bootId;
|
|
2602
|
+
if (!tmux || !windowId)
|
|
2603
|
+
throw Error("Owned launch unavailable for retirement");
|
|
2604
|
+
const owned = () => this.bootId === daemonBootId && this.spawnGeneration === spawnGeneration
|
|
2605
|
+
&& this.tmux === tmux && tmux.getWindowId() === windowId && this.nativePaneLifecycle === native
|
|
2606
|
+
&& (this.ipcServer === ipc || this.ipcServer === null && ipc?.retired() === true);
|
|
2607
|
+
const captured = native?.snapshot?.();
|
|
2608
|
+
const panePid = native ? null : await this.paneHost.getPanePid(this.tmuxSessionName, windowId);
|
|
2609
|
+
if (!owned() || !native && (!panePid || !Number.isSafeInteger(panePid) || panePid <= 1)
|
|
2610
|
+
|| native && (!captured || captured.instance !== this.name || captured.paneId !== windowId))
|
|
2611
|
+
throw Error("Owned launch changed during retirement capture");
|
|
2612
|
+
let observedRetired = false;
|
|
2613
|
+
const retiredCurrent = () => {
|
|
2614
|
+
if (!observedRetired || !owned() || ipc && !ipc.retired())
|
|
2615
|
+
return false;
|
|
2616
|
+
if (native) {
|
|
2617
|
+
const now = native.snapshot?.();
|
|
2618
|
+
return !!now && now.state === "exited" && ["hostBootId", "paneId", "launchId", "agentId", "instance"].every(k => now[k] === captured[k]);
|
|
2619
|
+
}
|
|
2620
|
+
return requestContextProcessGroupGone(panePid);
|
|
2621
|
+
};
|
|
2622
|
+
return Object.freeze({ daemonBootId, spawnGeneration, launchFenceEpoch, windowId, panePid, retiredCurrent, retired: async () => {
|
|
2623
|
+
try {
|
|
2624
|
+
if (!owned() || ipc && !ipc.retired())
|
|
2625
|
+
return false;
|
|
2626
|
+
if (native) {
|
|
2627
|
+
const now = native.snapshot?.();
|
|
2628
|
+
const gone = !!now && now.state === "exited" && ["hostBootId", "paneId", "launchId", "agentId", "instance"].every(k => now[k] === captured[k]) && owned();
|
|
2629
|
+
if (gone)
|
|
2630
|
+
observedRetired = true;
|
|
2631
|
+
return gone;
|
|
2632
|
+
}
|
|
2633
|
+
const windows = await TmuxManager.listWindowsStrict(this.tmuxSessionName);
|
|
2634
|
+
const gone = owned() && (!ipc || ipc.retired()) && !windows.some(w => w.id === windowId) && requestContextProcessGroupGone(panePid);
|
|
2635
|
+
if (gone)
|
|
2636
|
+
observedRetired = true;
|
|
2637
|
+
return gone;
|
|
2638
|
+
}
|
|
2639
|
+
catch {
|
|
2640
|
+
return false;
|
|
2641
|
+
}
|
|
2642
|
+
} });
|
|
2643
|
+
}
|
|
2644
|
+
setRequestContextLocalLifecycle(turns, identity, newWork, replyTarget, continuation) {
|
|
2645
|
+
if (this.tmux || this.ipcServer || this.requestContextLifecycle || this.nativePaneLifecycle && !this.nativePaneLifecycle.requestContextAvailable?.())
|
|
2646
|
+
throw Error("Request context must be bound before a supported daemon startup");
|
|
2647
|
+
this.requestContextCalls.installRegistration(turns.registrationGate ?? undefined);
|
|
2648
|
+
this.requestContextQueuedWork.installRegistration(turns.registrationGate ?? undefined);
|
|
2649
|
+
this.requestContextHelper = new RequestContextHelperAdmission();
|
|
2650
|
+
this.requestContextLifecycle = { turns, identity, newWork, replyTarget, continuation };
|
|
2651
|
+
}
|
|
2652
|
+
/** Authoritative fresh-launch boundary only; session discovery and a merely written clear command do not prove it. */
|
|
2653
|
+
requestContextNewWork(reason) {
|
|
2654
|
+
const lifecycle = this.requestContextLifecycle;
|
|
2655
|
+
if (!lifecycle?.newWork)
|
|
2656
|
+
return;
|
|
2657
|
+
const owner = this.requestContextOwner(), previous = owner ? lifecycle.turns.current(owner) : null;
|
|
2658
|
+
lifecycle.newWork(reason);
|
|
2659
|
+
if (owner && previous)
|
|
2660
|
+
lifecycle.turns.ended(previous, owner);
|
|
2661
|
+
this.requestContextWrite = undefined;
|
|
2662
|
+
this.requestContextPendingReplies.clear();
|
|
2663
|
+
this.requestContextHumanReplies.clear();
|
|
2664
|
+
}
|
|
2665
|
+
requestContextOwner() {
|
|
2666
|
+
const lifecycle = this.requestContextLifecycle;
|
|
2667
|
+
return lifecycle ? { ...lifecycle.identity(), instance: this.name, daemonBootId: this.bootId,
|
|
2668
|
+
spawnGeneration: this.spawnGeneration, launchFenceEpoch: this.launchFenceEpoch, deliveryEpoch: this.deliveryEpoch } : null;
|
|
2669
|
+
}
|
|
2670
|
+
/** Trusted installer/resolver observation only; no turn token or authority is granted. */
|
|
2671
|
+
captureRequestContextOwner() {
|
|
2672
|
+
const owner = this.requestContextOwner();
|
|
2673
|
+
return owner ? Object.freeze(owner) : null;
|
|
2674
|
+
}
|
|
2675
|
+
requestContextTurnSnapshot() {
|
|
2676
|
+
const owner = this.requestContextOwner();
|
|
2677
|
+
return owner ? this.requestContextLifecycle.turns.current(owner) : null;
|
|
2678
|
+
}
|
|
2679
|
+
requestContextTurnCurrent(snapshot) {
|
|
2680
|
+
const owner = this.requestContextOwner();
|
|
2681
|
+
return !!owner && this.requestContextLifecycle.turns.isCurrent(snapshot, owner);
|
|
2682
|
+
}
|
|
2683
|
+
bindRequestContextWrite(inputId, text, queued, recovery) {
|
|
2684
|
+
const owner = this.requestContextOwner();
|
|
2685
|
+
if (!owner)
|
|
2686
|
+
return;
|
|
2687
|
+
// Ordinary queues are never evidence of consumption. Only a proven steer can join the EXISTING turn.
|
|
2688
|
+
if (queued && recovery)
|
|
2689
|
+
throw Error("request-context queued input consumption is not covered yet");
|
|
2690
|
+
if (recovery && !recovery.current())
|
|
2691
|
+
throw Error("request-context recovery job is no longer current");
|
|
2692
|
+
const previous = this.requestContextTurnSnapshot();
|
|
2693
|
+
const snapshot = queued ? this.requestContextLifecycle.turns.beforeQueuedSteer(inputId, deliveryContentDigest(text), owner)
|
|
2694
|
+
: recovery ? this.requestContextLifecycle.turns.beforeRecoveryWrite(recovery.inputId, deliveryContentDigest(text), owner, recovery.parent)
|
|
2695
|
+
: this.requestContextLifecycle.turns.beforeWrite(inputId, deliveryContentDigest(text), owner);
|
|
2696
|
+
try {
|
|
2697
|
+
this.nativePaneLifecycle?.stageRequestContext?.(snapshot, deliveryContentDigest(text), () => this.requestContextTurnCurrent(snapshot), this.requestContextInterruptedLaunch === this.requestContextLaunch());
|
|
2698
|
+
}
|
|
2699
|
+
catch (error) {
|
|
2700
|
+
if (snapshot !== previous)
|
|
2701
|
+
this.requestContextLifecycle.turns.ended(snapshot, owner);
|
|
2702
|
+
throw error;
|
|
2703
|
+
}
|
|
2704
|
+
if (this.requestContextWrite?.snapshot.token !== snapshot.token) {
|
|
2705
|
+
const id = snapshot.inputId;
|
|
2706
|
+
const humanId = id.startsWith("human:") ? id.slice(6) : null;
|
|
2707
|
+
const deliveryId = /^delivery:([^:]+):[0-9]+$/.exec(id)?.[1];
|
|
2708
|
+
const endAnchor = !!humanId && /^[A-Za-z0-9_-]+$/.test(humanId) && text.split("\n").some(line => line.startsWith(`[hid:${humanId}]`) || line.startsWith(`[agend-human-id:${humanId}]`))
|
|
2709
|
+
|| !!deliveryId && text.startsWith(`[agend-delivery-id:${deliveryId}]\n`)
|
|
2710
|
+
|| /^hub-input:[a-f0-9-]{36}$/.test(id) && /^\[agend-room-input:hub-room-[a-f0-9-]{36}\]\n/.test(text)
|
|
2711
|
+
|| /^[A-Za-z0-9:_-]+$/.test(id) && text.startsWith(`[agend-request-input:${id}]\n`);
|
|
2712
|
+
this.requestContextWrite = { snapshot, text, at: Date.now(), ledger: new TranscriptTurnLedger(), endAnchor };
|
|
2713
|
+
}
|
|
2714
|
+
}
|
|
2715
|
+
/** A reset withdraws proof; it never silently retires C or admits the next root. */
|
|
2716
|
+
observeRequestContextTranscript(events) {
|
|
2717
|
+
const write = this.requestContextWrite;
|
|
2718
|
+
if (!write)
|
|
2719
|
+
return;
|
|
2720
|
+
for (const event of events) {
|
|
2721
|
+
if (event.kind !== "retract")
|
|
2722
|
+
continue;
|
|
2723
|
+
// Ask before withdrawing the row. A foreign transcript turn cannot turn
|
|
2724
|
+
// this owned input into an unknown-end blocker.
|
|
2725
|
+
if (write.ledger.matchesInputTurn(event.turnId, write.text, write.at))
|
|
2726
|
+
write.unknownEnd = event.reason ?? "reset";
|
|
2727
|
+
}
|
|
2728
|
+
write.ledger.observe(events, performance.now());
|
|
2729
|
+
this.settleRequestContextFromTranscript();
|
|
2730
|
+
}
|
|
2731
|
+
settleRequestContextFromTranscript() {
|
|
2732
|
+
const write = this.requestContextWrite, owner = this.requestContextOwner();
|
|
2733
|
+
if (!write || write.unknownEnd || !write.endAnchor || !owner || !this.requestContextLifecycle.turns.isCurrent(write.snapshot, owner))
|
|
2734
|
+
return;
|
|
2735
|
+
const verdict = write.ledger.verdict(write.text, write.at);
|
|
2736
|
+
if (verdict === "ended" || verdict === "aborted" || verdict === "error") {
|
|
2737
|
+
if (verdict !== "ended")
|
|
2738
|
+
this.requestContextInterruptedLaunch = this.requestContextLaunch();
|
|
2739
|
+
this.requestContextLifecycle.turns.ended(write.snapshot, owner);
|
|
2740
|
+
this.requestContextWrite = undefined;
|
|
2741
|
+
this.requestContextPendingReplies.clear();
|
|
2742
|
+
}
|
|
2743
|
+
}
|
|
2197
2744
|
/** Internal lifecycle injection, before start. Native paths and provider files stay on their runner. */
|
|
2198
2745
|
setNativePaneLifecycle(native) {
|
|
2199
|
-
if (this.tmux || this.ipcServer || this.nativePaneLifecycle)
|
|
2200
|
-
throw Error("Native pane adapter must be bound before daemon startup");
|
|
2746
|
+
if (this.tmux || this.ipcServer || this.nativePaneLifecycle || this.requestContextLifecycle && !native.requestContextAvailable?.())
|
|
2747
|
+
throw Error("Native pane adapter must be bound before daemon startup with a supported request-context producer");
|
|
2201
2748
|
this.nativePaneLifecycle = native;
|
|
2202
2749
|
this.backend = native.backend;
|
|
2203
2750
|
this.paneTransport = native.host;
|
|
2204
2751
|
this.controlClient = native.observation;
|
|
2752
|
+
if (this.requestContextStartupResources) {
|
|
2753
|
+
const snapshot = native.snapshot?.();
|
|
2754
|
+
if (!snapshot)
|
|
2755
|
+
this.requestContextStartupResources.unknown = true;
|
|
2756
|
+
else
|
|
2757
|
+
this.requestContextStartupResources.native.push({ owner: native, identity: JSON.stringify([snapshot.hostBootId, snapshot.paneId, snapshot.launchId, snapshot.agentId, snapshot.instance]) });
|
|
2758
|
+
}
|
|
2205
2759
|
}
|
|
2206
2760
|
constructor(name, config, instanceDir, topicMode = false, backend, controlClient, rootLogger, runtimeIdentity, spawnGate, stormWindow,
|
|
2207
2761
|
/** Fleet-level "is this CLI's backend down?" memory — see backend-outage.ts. */
|
|
@@ -2249,6 +2803,7 @@ export class Daemon extends EventEmitter {
|
|
|
2249
2803
|
// deliberately NOT hooked: stop/spawn abandon the in-memory turn while
|
|
2250
2804
|
// the on-disk interruption must survive for the resume gate.
|
|
2251
2805
|
this.turnReplyGuard.onComplete = () => {
|
|
2806
|
+
this.replyDraft.reset();
|
|
2252
2807
|
clearInFlightTurnMarker(this.instanceDir);
|
|
2253
2808
|
this.publishWorkingState("turn_closed");
|
|
2254
2809
|
};
|
|
@@ -2279,12 +2834,68 @@ export class Daemon extends EventEmitter {
|
|
|
2279
2834
|
setStatusEmojiAvoidList(list) {
|
|
2280
2835
|
this.statusEmojiAvoidList = list;
|
|
2281
2836
|
}
|
|
2837
|
+
credentialChangeIncarnation = null;
|
|
2838
|
+
/** Claim an idle local Claude pane for an account change; queued input cannot race the final capture. */
|
|
2839
|
+
async quiesceClaudeCredential() {
|
|
2840
|
+
const spawn = this.spawnGeneration, fence = this.launchFenceEpoch;
|
|
2841
|
+
return this.paneWriteLock.run(async () => {
|
|
2842
|
+
const turn = this.turnReplyGuard.snapshot(), deliveryEpoch = this.deliveryEpoch;
|
|
2843
|
+
if (turn && !turn.cancelledByUser && !turn.completionDelivered)
|
|
2844
|
+
return false;
|
|
2845
|
+
if (this.backend?.binaryName !== "claude" || this.usesNativePane() || this.spawning || this.healthCheckPaused || this.deliveryWritesStopping || this.startupAborted || this.isPaused)
|
|
2846
|
+
return false;
|
|
2847
|
+
if (!await this.isPaneAuthoritativelyIdle())
|
|
2848
|
+
return false;
|
|
2849
|
+
const windowId = this.tmux?.getWindowId();
|
|
2850
|
+
if (!windowId)
|
|
2851
|
+
return false;
|
|
2852
|
+
let pid = null;
|
|
2853
|
+
try {
|
|
2854
|
+
pid = await this.paneHost.getPanePid(this.tmuxSessionName, windowId);
|
|
2855
|
+
}
|
|
2856
|
+
catch {
|
|
2857
|
+
return false;
|
|
2858
|
+
}
|
|
2859
|
+
if (pid === null || !Number.isSafeInteger(pid) || pid <= 1 || windowId !== this.tmux?.getWindowId())
|
|
2860
|
+
return false;
|
|
2861
|
+
// A tool pause can look idle. Re-read the owned logical turn after both
|
|
2862
|
+
// pane awaits; new input or another turn must not inherit this idle proof.
|
|
2863
|
+
const currentTurn = this.turnReplyGuard.snapshot();
|
|
2864
|
+
if ((currentTurn && !currentTurn.cancelledByUser && !currentTurn.completionDelivered) || currentTurn?.generation !== turn?.generation || deliveryEpoch !== this.deliveryEpoch)
|
|
2865
|
+
return false;
|
|
2866
|
+
if (spawn !== this.spawnGeneration || fence !== this.launchFenceEpoch || this.spawning || this.healthCheckPaused || this.deliveryWritesStopping || this.startupAborted || this.isPaused)
|
|
2867
|
+
return false;
|
|
2868
|
+
this.credentialChangeIncarnation = { windowId, pid };
|
|
2869
|
+
this.fenceDeliveryWritesForStop();
|
|
2870
|
+
return true;
|
|
2871
|
+
});
|
|
2872
|
+
}
|
|
2873
|
+
/** Read-only proof for the exact pane captured above; never kill a replacement window. */
|
|
2874
|
+
async claudeCredentialRetired() {
|
|
2875
|
+
const inc = this.credentialChangeIncarnation;
|
|
2876
|
+
if (!inc)
|
|
2877
|
+
return false;
|
|
2878
|
+
try {
|
|
2879
|
+
const windows = await TmuxManager.listWindowsStrict(this.tmuxSessionName);
|
|
2880
|
+
if (!windows.some(window => window.id === inc.windowId))
|
|
2881
|
+
return true;
|
|
2882
|
+
const pid = await this.paneHost.getPanePid(this.tmuxSessionName, inc.windowId);
|
|
2883
|
+
return pid !== null && pid !== inc.pid;
|
|
2884
|
+
}
|
|
2885
|
+
catch {
|
|
2886
|
+
return false;
|
|
2887
|
+
}
|
|
2888
|
+
}
|
|
2282
2889
|
/** Fence pane writers before lifecycle captures pre-kill reconciliation evidence. */
|
|
2283
2890
|
fenceDeliveryWritesForStop() {
|
|
2284
2891
|
if (this.deliveryWritesStopping)
|
|
2285
2892
|
return;
|
|
2286
2893
|
this.deliveryWritesStopping = true;
|
|
2894
|
+
this.requestContextAdmission?.changed();
|
|
2287
2895
|
this.deliveryEpoch++;
|
|
2896
|
+
this.replyDraft.reset();
|
|
2897
|
+
this.requestContextLifecycle?.turns.fence();
|
|
2898
|
+
this.requestContextCalls.clear();
|
|
2288
2899
|
}
|
|
2289
2900
|
/** Bounded drain: timeout remains safe because Enter has a write-ahead fence. */
|
|
2290
2901
|
waitForDeliveryWritesToDrain(timeoutMs) {
|
|
@@ -2371,7 +2982,13 @@ export class Daemon extends EventEmitter {
|
|
|
2371
2982
|
// not — a pre-write failure never gets here; it is retried before begin.
|
|
2372
2983
|
if (outcome !== "failed")
|
|
2373
2984
|
this.noteWorkActivity();
|
|
2374
|
-
this.deliveryOutbox?.complete(delivery.deliveryId, this.bootId, delivery.attemptNo, outcome, evidence);
|
|
2985
|
+
const accepted = this.deliveryOutbox?.complete(delivery.deliveryId, this.bootId, delivery.attemptNo, outcome, evidence);
|
|
2986
|
+
if (verdict?.pendingReply) {
|
|
2987
|
+
if (accepted && outcome === "delivered" && !["unverified", "output-edge", "unverifiable"].includes(verdict.proof ?? ""))
|
|
2988
|
+
verdict.pendingReply.confirm();
|
|
2989
|
+
else
|
|
2990
|
+
verdict.pendingReply.refuse();
|
|
2991
|
+
}
|
|
2375
2992
|
if (verdict && outcome !== "failed")
|
|
2376
2993
|
this.startConsumedWatch(delivery, verdict, outcome);
|
|
2377
2994
|
}
|
|
@@ -2455,25 +3072,26 @@ export class Daemon extends EventEmitter {
|
|
|
2455
3072
|
if (!["claude-code", "codex"].includes(backend))
|
|
2456
3073
|
return;
|
|
2457
3074
|
const marker = durableAttempt ? `[agend-delivery-id:${durableAttempt.deliveryId}]`
|
|
2458
|
-
: humanVerificationId ? verdict.humanReceipt?.marker ?? `[agend-human-id:${humanVerificationId}]` :
|
|
3075
|
+
: humanVerificationId ? verdict.humanReceipt?.marker ?? `[agend-human-id:${humanVerificationId}]` : roomContextInputMarker(track.meta);
|
|
2459
3076
|
if (!marker || !formatted.startsWith(marker))
|
|
2460
3077
|
return;
|
|
2461
3078
|
let found = verdict.transcriptCheckpoint ?? null;
|
|
2462
3079
|
if (!found) {
|
|
2463
3080
|
try {
|
|
2464
|
-
|
|
3081
|
+
// M-2403: a native or remote pane checkpoints its runtime transcript (no local file); a local CLI, its file.
|
|
3082
|
+
const runtime = this.nativePaneLifecycle ? await this.transcriptMonitor?.reconciliationRuntimeCheckpoint() ?? null : null;
|
|
3083
|
+
found = runtime ? { runtime } : await this.transcriptMonitor?.reconciliationCheckpoint() ?? null;
|
|
2465
3084
|
}
|
|
2466
3085
|
catch (err) {
|
|
2467
3086
|
this.logger.debug({ err }, "Could not checkpoint the transcript before a queued hand-off");
|
|
2468
3087
|
}
|
|
2469
3088
|
}
|
|
2470
|
-
|
|
2471
|
-
|
|
2472
|
-
const checkpoint = found && typeof found.path === "string" && typeof found.offset === "number" ? { path: found.path, offset: found.offset } : null;
|
|
3089
|
+
const checkpoint = found?.runtime ? { runtime: found.runtime }
|
|
3090
|
+
: found && typeof found.path === "string" && typeof found.offset === "number" ? { path: found.path, offset: found.offset } : null;
|
|
2473
3091
|
if (!checkpoint)
|
|
2474
3092
|
return; // nothing could judge it later: it runs as before (✅ at the hand-off)
|
|
2475
3093
|
const entry = {
|
|
2476
|
-
id: track.id ?? randomUUID(), marker, backend,
|
|
3094
|
+
id: track.id ?? randomUUID(), marker, backend, ...checkpoint,
|
|
2477
3095
|
content: track.content, meta: track.meta, wire: formatted, holder: this.handoffHolder(), createdAt: Date.now(),
|
|
2478
3096
|
redeliveries: track.redeliveries ?? 0,
|
|
2479
3097
|
};
|
|
@@ -2504,6 +3122,8 @@ export class Daemon extends EventEmitter {
|
|
|
2504
3122
|
this.dropQueuedHandoff(verdict);
|
|
2505
3123
|
return;
|
|
2506
3124
|
}
|
|
3125
|
+
if (sent && !verdict.roomInputQueued && meta.hub_room_context_generation)
|
|
3126
|
+
this.roomInputHandedOff(meta);
|
|
2507
3127
|
const id = meta.handoff_redelivery;
|
|
2508
3128
|
if (!id)
|
|
2509
3129
|
return;
|
|
@@ -2545,12 +3165,24 @@ export class Daemon extends EventEmitter {
|
|
|
2545
3165
|
*/
|
|
2546
3166
|
watchQueuedHandoff(entry) {
|
|
2547
3167
|
const spawn = this.spawnGeneration, fence = this.launchFenceEpoch, epoch = this.deliveryEpoch;
|
|
3168
|
+
// M-2403: a native or remote pane's record is read through its runner (the runtime reader), a local one from its file.
|
|
3169
|
+
let source;
|
|
3170
|
+
if (entry.runtime) {
|
|
3171
|
+
try {
|
|
3172
|
+
source = { reader: this.nativeTranscriptReader(entry.runtime, { marker: entry.marker, ...(entry.wire !== undefined ? { wire: entry.wire } : {}) }) };
|
|
3173
|
+
}
|
|
3174
|
+
catch (err) {
|
|
3175
|
+
this.logger.debug({ err, handoff: entry.id }, "Queued hand-off: its pane's transcript is not readable now");
|
|
3176
|
+
return this.settleQueuedHandoff(entry, "unverifiable", "transcript:unavailable");
|
|
3177
|
+
}
|
|
3178
|
+
}
|
|
3179
|
+
else
|
|
3180
|
+
source = { path: entry.path, offset: entry.offset };
|
|
2548
3181
|
const started = consumedWatches.start({
|
|
2549
3182
|
deliveryId: `handoff:${entry.id}`,
|
|
2550
3183
|
attemptNo: entry.redeliveries,
|
|
2551
3184
|
backend: entry.backend,
|
|
2552
|
-
|
|
2553
|
-
offset: entry.offset,
|
|
3185
|
+
...source,
|
|
2554
3186
|
marker: entry.marker,
|
|
2555
3187
|
...(entry.wire !== undefined ? { wire: entry.wire } : {}),
|
|
2556
3188
|
// A cancel or stop moves the epoch: the watch ends quietly (a cancel cleared the record, a stop leaves it).
|
|
@@ -2581,6 +3213,8 @@ export class Daemon extends EventEmitter {
|
|
|
2581
3213
|
const meta = entry.meta;
|
|
2582
3214
|
const status = channelStatus(meta);
|
|
2583
3215
|
if (outcome === "taken") {
|
|
3216
|
+
if (meta.hub_room_context_generation)
|
|
3217
|
+
this.roomInputHandedOff(meta);
|
|
2584
3218
|
this.logger.info({ handoff: entry.id, proof, redeliveries: entry.redeliveries }, "Queued hand-off taken by the CLI");
|
|
2585
3219
|
if (status)
|
|
2586
3220
|
this.emit("message_confirmed", status);
|
|
@@ -2628,8 +3262,20 @@ export class Daemon extends EventEmitter {
|
|
|
2628
3262
|
const spawn = this.spawnGeneration, fence = this.launchFenceEpoch, epoch = this.deliveryEpoch;
|
|
2629
3263
|
const fresh = () => spawn === this.spawnGeneration && fence === this.launchFenceEpoch && epoch === this.deliveryEpoch
|
|
2630
3264
|
&& !this.deliveryWritesStopping;
|
|
2631
|
-
let redelivered = 0, taken = 0, unverifiable = 0;
|
|
3265
|
+
let redelivered = 0, taken = 0, unverifiable = 0, watching = 0;
|
|
2632
3266
|
for (const entry of entries) {
|
|
3267
|
+
if (entry.runtime) {
|
|
3268
|
+
const outcome = await this.reconcileRuntimeHandoff(entry, holder, fresh);
|
|
3269
|
+
if (outcome === "stale")
|
|
3270
|
+
return;
|
|
3271
|
+
if (outcome === "taken")
|
|
3272
|
+
taken++;
|
|
3273
|
+
else if (outcome === "unverifiable")
|
|
3274
|
+
unverifiable++;
|
|
3275
|
+
else if (outcome === "watching")
|
|
3276
|
+
watching++;
|
|
3277
|
+
continue;
|
|
3278
|
+
}
|
|
2633
3279
|
const kind = await scanTranscriptForDeliveryMarker(entry.path, entry.offset, entry.backend, { marker: entry.marker, ...(entry.wire !== undefined ? { wire: entry.wire } : {}) });
|
|
2634
3280
|
// This CLI is gone already, or a cancel came: the next CLI settles them (a cancel cleared them).
|
|
2635
3281
|
if (!fresh())
|
|
@@ -2669,7 +3315,71 @@ export class Daemon extends EventEmitter {
|
|
|
2669
3315
|
this.pushChannelMessage(entry.content, { ...meta, handoff_redelivery: entry.id,
|
|
2670
3316
|
handoff_redeliveries: String(next.redeliveries), handoff_holder: next.holder }, undefined, epoch);
|
|
2671
3317
|
}
|
|
2672
|
-
this.logger.info({ instance: this.name, redelivered, taken, unverifiable, proof: "transcript" }, "Queued hand-offs left by the previous CLI settled");
|
|
3318
|
+
this.logger.info({ instance: this.name, redelivered, taken, unverifiable, watching, proof: "transcript" }, "Queued hand-offs left by the previous CLI settled");
|
|
3319
|
+
}
|
|
3320
|
+
/**
|
|
3321
|
+
* M-2403: a native or remote pane's record, after this daemon came up. Its runner may have kept the CLI (and its queue)
|
|
3322
|
+
* across the coordinator's restart, so nothing here proves the queue is gone, and a runtime record is never
|
|
3323
|
+
* redelivered. Read through the runner from its checkpoint (bounded, as reconcileNativePaneTarget): taken → ✅; the
|
|
3324
|
+
* same launch still current with the marker not taken yet → watched again under this CLI; that launch gone, or its
|
|
3325
|
+
* transcript unreadable → unverifiable (reported, never pasted again).
|
|
3326
|
+
*/
|
|
3327
|
+
async reconcileRuntimeHandoff(entry, holder, fresh) {
|
|
3328
|
+
const still = () => {
|
|
3329
|
+
let current;
|
|
3330
|
+
try {
|
|
3331
|
+
current = this.handoffStore().get(entry.id);
|
|
3332
|
+
}
|
|
3333
|
+
catch {
|
|
3334
|
+
current = undefined;
|
|
3335
|
+
}
|
|
3336
|
+
return !!current && current.holder === entry.holder && current.redeliveries === entry.redeliveries;
|
|
3337
|
+
};
|
|
3338
|
+
const native = this.nativePaneLifecycle;
|
|
3339
|
+
let kind = null;
|
|
3340
|
+
if (native?.current(entry.runtime)) {
|
|
3341
|
+
let reader;
|
|
3342
|
+
try {
|
|
3343
|
+
reader = this.nativeTranscriptReader(entry.runtime, { marker: entry.marker, ...(entry.wire !== undefined ? { wire: entry.wire } : {}) });
|
|
3344
|
+
for (let n = 0; n < 8; n++) {
|
|
3345
|
+
const before = reader.readPosition, look = await reader.look();
|
|
3346
|
+
if (!fresh())
|
|
3347
|
+
return "stale";
|
|
3348
|
+
kind = look;
|
|
3349
|
+
if (markerConsumed(look) || look === "unavailable" || look === "pending" || reader.readPosition === before)
|
|
3350
|
+
break;
|
|
3351
|
+
}
|
|
3352
|
+
}
|
|
3353
|
+
catch {
|
|
3354
|
+
kind = "unavailable";
|
|
3355
|
+
}
|
|
3356
|
+
finally {
|
|
3357
|
+
reader?.close?.();
|
|
3358
|
+
}
|
|
3359
|
+
}
|
|
3360
|
+
if (!fresh())
|
|
3361
|
+
return "stale";
|
|
3362
|
+
if (!still())
|
|
3363
|
+
return "skipped";
|
|
3364
|
+
if (kind && markerConsumed(kind)) {
|
|
3365
|
+
this.settleQueuedHandoff(entry, "taken", `restart-transcript:${kind}`);
|
|
3366
|
+
return "taken";
|
|
3367
|
+
}
|
|
3368
|
+
if (kind === null || kind === "unavailable" || !native?.current(entry.runtime)) {
|
|
3369
|
+
this.settleQueuedHandoff(entry, "unverifiable", "restart-transcript:unavailable");
|
|
3370
|
+
return "unverifiable";
|
|
3371
|
+
}
|
|
3372
|
+
// The same launch still holds it in its queue: this CLI watches it from where the read stopped.
|
|
3373
|
+
const next = { ...entry, holder };
|
|
3374
|
+
try {
|
|
3375
|
+
this.handoffStore().put(next);
|
|
3376
|
+
}
|
|
3377
|
+
catch (err) {
|
|
3378
|
+
this.logger.warn({ err, handoff: entry.id }, "Could not update a queued hand-off record");
|
|
3379
|
+
return "skipped";
|
|
3380
|
+
}
|
|
3381
|
+
this.watchQueuedHandoff(next);
|
|
3382
|
+
return "watching";
|
|
2673
3383
|
}
|
|
2674
3384
|
finishDurableSubmission(delivery, verdict) {
|
|
2675
3385
|
// Legacy backends may accept a pane write without enough pane evidence to
|
|
@@ -2859,6 +3569,8 @@ export class Daemon extends EventEmitter {
|
|
|
2859
3569
|
const oomStop = readSessionOomStop(this.instanceDir);
|
|
2860
3570
|
if (oomStop.blocked)
|
|
2861
3571
|
return sessionOomStopHint(oomStop);
|
|
3572
|
+
if (this.staleAuthIssue())
|
|
3573
|
+
return t("inst.codex_stale_auth");
|
|
2862
3574
|
if (this.pauseWakeState !== "active")
|
|
2863
3575
|
return t("delivery.hold_state", this.pauseWakeState);
|
|
2864
3576
|
if (this.inputBlockedDialogKey !== null)
|
|
@@ -2985,6 +3697,14 @@ export class Daemon extends EventEmitter {
|
|
|
2985
3697
|
// 1. IPC server — bridge between MCP server (Claude's child) and daemon
|
|
2986
3698
|
const sockPath = join(this.instanceDir, "channel.sock");
|
|
2987
3699
|
this.ipcServer = new IpcServer(sockPath, this.logger);
|
|
3700
|
+
this.requestContextStartupResources?.ipc.add(this.ipcServer);
|
|
3701
|
+
if (this.requestContextHelper)
|
|
3702
|
+
this.ipcServer.setMessageAdmission((message, socket) => {
|
|
3703
|
+
const admitted = this.requestContextHelper.admit(message, socket);
|
|
3704
|
+
if (!admitted)
|
|
3705
|
+
this.logger.warn({ instance: this.name }, "old_launch_helper_refused");
|
|
3706
|
+
return admitted;
|
|
3707
|
+
});
|
|
2988
3708
|
// Forward IPC server errors as daemon events (prevents unhandled 'error' crash).
|
|
2989
3709
|
// Guard: only forward post-listen errors — startup errors are handled by listen() rejection.
|
|
2990
3710
|
let ipcListening = false;
|
|
@@ -3005,7 +3725,7 @@ export class Daemon extends EventEmitter {
|
|
|
3005
3725
|
this.ipcServer.on("message", (msg, socket) => {
|
|
3006
3726
|
if (msg.type === "tool_call") {
|
|
3007
3727
|
// MCP server forwarding a Claude tool call (reply, react, edit, download)
|
|
3008
|
-
this.
|
|
3728
|
+
this.handleOwnedToolCall(msg, socket);
|
|
3009
3729
|
}
|
|
3010
3730
|
else if (msg.type === "mcp_ready") {
|
|
3011
3731
|
this.handleMcpReady(msg, socket);
|
|
@@ -3026,6 +3746,7 @@ export class Daemon extends EventEmitter {
|
|
|
3026
3746
|
}
|
|
3027
3747
|
// Batch response for prune path
|
|
3028
3748
|
this.ipcServer?.send(socket, { type: "query_sessions_response", sessions });
|
|
3749
|
+
this.ipcServer?.send(socket, this.hubAnswerTurnStateMessage()); // M-3660: a fresh connection learns the current turn
|
|
3029
3750
|
}
|
|
3030
3751
|
else
|
|
3031
3752
|
this.handleFleetMessage(msg, reply => { this.ipcServer?.send(socket, reply); });
|
|
@@ -3051,6 +3772,11 @@ export class Daemon extends EventEmitter {
|
|
|
3051
3772
|
// bounded dialog/readiness scan as local startup. An already-running reattachment may be busy: do not
|
|
3052
3773
|
// wait for that work to finish or inject a startup key into it.
|
|
3053
3774
|
if (acquired.disposition === "reattached") {
|
|
3775
|
+
// A surviving process predates this daemon's first-hop binding. Its queued helper bytes
|
|
3776
|
+
// cannot prove a turn, even after a later input installs a new proof on that launch.
|
|
3777
|
+
// Keep the one-contact approval fallback until a genuinely new process is launched.
|
|
3778
|
+
if (this.requestContextLifecycle)
|
|
3779
|
+
this.requestContextInterruptedLaunch = this.requestContextLaunch();
|
|
3054
3780
|
if (this.backend?.binaryName === "codex") {
|
|
3055
3781
|
const native = this.nativePaneLifecycle, spawn = this.spawnGeneration, fence = this.launchFenceEpoch, attempt = this.launchAttempt;
|
|
3056
3782
|
try {
|
|
@@ -3133,6 +3859,10 @@ export class Daemon extends EventEmitter {
|
|
|
3133
3859
|
}
|
|
3134
3860
|
if (nativeDisposition)
|
|
3135
3861
|
this.isNewSession = nativeDisposition === "fresh";
|
|
3862
|
+
if (nativeDisposition === "fresh")
|
|
3863
|
+
this.requestContextNewWork("fresh");
|
|
3864
|
+
this.resetRoomConversation(nativeDisposition === "reattached");
|
|
3865
|
+
this.settleHubAnswerTurnAtLaunch(nativeDisposition === "reattached");
|
|
3136
3866
|
// #1209: conditional continuation for the turn interrupted by the last
|
|
3137
3867
|
// restart, if the gates allow. Detached; the gate
|
|
3138
3868
|
// consumes its one-shot marker first and never throws into boot.
|
|
@@ -3712,9 +4442,12 @@ export class Daemon extends EventEmitter {
|
|
|
3712
4442
|
return;
|
|
3713
4443
|
}
|
|
3714
4444
|
const native = this.nativePaneLifecycle, pane = this.tmux;
|
|
4445
|
+
const footprintObservedAt = this.footprintEnabled ? Date.now() : 0, footprintOwner = this.footprintEnabled ? JSON.stringify(this.interactionOwner()) : null;
|
|
3715
4446
|
const status = await pane?.getPaneStatus();
|
|
3716
4447
|
if (this.runtimeMonitorsFrozen || native !== this.nativePaneLifecycle || pane !== this.tmux)
|
|
3717
4448
|
return;
|
|
4449
|
+
if (this.footprintEnabled && status?.alive && status.pid && footprintOwner === JSON.stringify(this.interactionOwner()))
|
|
4450
|
+
this.footprintPane = { pid: status.pid, owner: footprintOwner, observedAt: footprintObservedAt, pane };
|
|
3718
4451
|
const snapshot = native.snapshot?.();
|
|
3719
4452
|
if (status?.alive === false && snapshot?.state === "exited") {
|
|
3720
4453
|
this.healthCheckPaused = true;
|
|
@@ -3755,12 +4488,15 @@ export class Daemon extends EventEmitter {
|
|
|
3755
4488
|
scheduleNext();
|
|
3756
4489
|
return true;
|
|
3757
4490
|
};
|
|
4491
|
+
const footprintObservedAt = this.footprintEnabled ? Date.now() : 0;
|
|
3758
4492
|
let paneStatus = await healthTmux.getPaneStatus();
|
|
3759
4493
|
// Auto-pause intentionally exits the pane process. A health tick that
|
|
3760
4494
|
// began just before pause must not classify that exit as a crash.
|
|
3761
4495
|
if (discardStaleHealth())
|
|
3762
4496
|
return;
|
|
3763
4497
|
if (paneStatus?.alive) {
|
|
4498
|
+
if (this.footprintEnabled && footprintObservedAt > 0 && paneStatus.pid)
|
|
4499
|
+
this.footprintPane = { pid: paneStatus.pid, owner: JSON.stringify(healthOwner), observedAt: footprintObservedAt, pane: healthTmux };
|
|
3764
4500
|
// A CLI shutdown also closes its MCP children. Revive tools only for
|
|
3765
4501
|
// a positively live pane, never while its exit is being classified.
|
|
3766
4502
|
measureSyncWork("daemon.healthCheck", () => this.checkMcpServerAlive());
|
|
@@ -4367,7 +5103,7 @@ export class Daemon extends EventEmitter {
|
|
|
4367
5103
|
const loginFlow = LOGIN_FLOWS[this.config.backend ?? "claude-code"];
|
|
4368
5104
|
if (loginFlow?.loginScreenActive && this.reportLoginScreen(pane))
|
|
4369
5105
|
return;
|
|
4370
|
-
const interactivePrompt = this.interactivePromptDetector.observe(pane, Date.now(), this.instanceStateLastOutputAt);
|
|
5106
|
+
const interactivePrompt = dialogs.some(d => d.humanOnly && Daemon.dialogMatches(d, pane)) ? null : this.interactivePromptDetector.observe(pane, Date.now(), this.instanceStateLastOutputAt);
|
|
4371
5107
|
if (interactivePrompt) {
|
|
4372
5108
|
this.logger.warn(interactivePrompt, "Interactive terminal prompt is waiting for human input");
|
|
4373
5109
|
// M-2269: the prompt as it was on screen, from this capture, for the Log.
|
|
@@ -4602,6 +5338,8 @@ export class Daemon extends EventEmitter {
|
|
|
4602
5338
|
}
|
|
4603
5339
|
/** Evaluate one pane snapshot. Kept synchronous so state-machine edges are unit-testable. */
|
|
4604
5340
|
evaluateErrorPatterns(pane, patterns, readyPattern, now = Date.now(), busyPattern = null) {
|
|
5341
|
+
if (this.staleAuthIssue())
|
|
5342
|
+
return; // Ready chrome and recovery deadlines cannot repair this process.
|
|
4605
5343
|
// Count occurrences across the WHOLE pane (not just text after the last
|
|
4606
5344
|
// ready prompt). One shared counter (the static below): arm requires
|
|
4607
5345
|
// count > baseline, so a drifted clone here would silently gate nudges.
|
|
@@ -4712,7 +5450,7 @@ export class Daemon extends EventEmitter {
|
|
|
4712
5450
|
// composer to establish its baseline; later appended occurrences remain eligible.
|
|
4713
5451
|
if ((ep.type === "rate_limit" && ep.action === "nudge_continue") || ep.historyUntilLiveComposer) {
|
|
4714
5452
|
const baseline = this.nudgeBaselines?.get(key);
|
|
4715
|
-
if (baseline === undefined || count <= baseline) {
|
|
5453
|
+
if ((baseline === undefined || count <= baseline) && !(ep.type === "stale_auth" && newQuotaAfterInput)) {
|
|
4716
5454
|
if (baseline !== undefined)
|
|
4717
5455
|
this.lastErrorCount.set(key, count);
|
|
4718
5456
|
continue;
|
|
@@ -4810,6 +5548,10 @@ export class Daemon extends EventEmitter {
|
|
|
4810
5548
|
});
|
|
4811
5549
|
return;
|
|
4812
5550
|
}
|
|
5551
|
+
if (ep.type === "stale_auth") {
|
|
5552
|
+
this.staleAuth = { generation: this.spawnGeneration, since: now };
|
|
5553
|
+
this.authFailureUnresolved = true;
|
|
5554
|
+
}
|
|
4813
5555
|
// #2795: auth text on the pane proves nothing about the credentials (22 of 22 such matches on the main host were
|
|
4814
5556
|
// conversation text). It arms nothing here; it only asks the lifecycle's token-free check, and a failing check
|
|
4815
5557
|
// arms the auth state through confirmAuthFailure().
|
|
@@ -4888,7 +5630,7 @@ export class Daemon extends EventEmitter {
|
|
|
4888
5630
|
const screen = await tmux.capturePane().catch(() => null);
|
|
4889
5631
|
if (screen === null)
|
|
4890
5632
|
return;
|
|
4891
|
-
await tmux.sendSpecialKey(cancelKey, undefined, { kind: "dialog", screen });
|
|
5633
|
+
await tmux.sendSpecialKey(cancelKey, undefined, { kind: "dialog", screen, cancelTurn: true });
|
|
4892
5634
|
return;
|
|
4893
5635
|
}
|
|
4894
5636
|
await tmux.sendSpecialKey(cancelKey);
|
|
@@ -4904,6 +5646,7 @@ export class Daemon extends EventEmitter {
|
|
|
4904
5646
|
// current human turn; leave already-forwarded tool requests to settle.
|
|
4905
5647
|
this.recoveryCancelled = true;
|
|
4906
5648
|
this.turnReplyGuard.cancelByUser();
|
|
5649
|
+
this.replyDraft.reset();
|
|
4907
5650
|
// #1241: a cancelled turn never confirms — its next edge completes it as
|
|
4908
5651
|
// intentional. Drop a pending confirmation so it cannot promote afterwards.
|
|
4909
5652
|
this.clearReplyGuardConfirm();
|
|
@@ -5037,6 +5780,8 @@ export class Daemon extends EventEmitter {
|
|
|
5037
5780
|
return;
|
|
5038
5781
|
}
|
|
5039
5782
|
const verdict = { reached: false };
|
|
5783
|
+
let codexBefore = null;
|
|
5784
|
+
let cliBefore = null;
|
|
5040
5785
|
try {
|
|
5041
5786
|
await this.wake();
|
|
5042
5787
|
if (!this.isDeliveryEpochCurrent(deliveryEpoch)) {
|
|
@@ -5046,6 +5791,27 @@ export class Daemon extends EventEmitter {
|
|
|
5046
5791
|
tellWritten(false);
|
|
5047
5792
|
return;
|
|
5048
5793
|
}
|
|
5794
|
+
// M-3175: a codex switch is typed only into an idle pane of a codex known to take it, with the rollout's end taken first.
|
|
5795
|
+
if (ownSwitch?.codex) {
|
|
5796
|
+
const gate = await this.codexSwitchGate();
|
|
5797
|
+
if ("blocked" in gate) {
|
|
5798
|
+
this.logger.info({ requested: ownSwitch.codex, reason: gate.blocked, version: gate.version }, "Codex runtime switch not typed");
|
|
5799
|
+
reportSwitch({ outcome: "not_sent", reason: gate.blocked, version: gate.version ?? null });
|
|
5800
|
+
tellWritten(false);
|
|
5801
|
+
return;
|
|
5802
|
+
}
|
|
5803
|
+
codexBefore = gate;
|
|
5804
|
+
}
|
|
5805
|
+
if (ownSwitch?.cli) {
|
|
5806
|
+
const gate = await this.cliSwitchGate(ownSwitch.cli);
|
|
5807
|
+
if ("blocked" in gate) {
|
|
5808
|
+
this.logger.info({ requested: ownSwitch.cli, reason: gate.blocked, version: gate.version }, "CLI runtime switch not typed");
|
|
5809
|
+
reportSwitch({ outcome: "not_sent", reason: gate.blocked, version: gate.version ?? null });
|
|
5810
|
+
tellWritten(false);
|
|
5811
|
+
return;
|
|
5812
|
+
}
|
|
5813
|
+
cliBefore = gate;
|
|
5814
|
+
}
|
|
5049
5815
|
// Board 907c7899: the pane just before this attempt's paste — after its readiness wait, last capture and fence,
|
|
5050
5816
|
// under the paste lock (no other input lands in between). Each attempt looks again.
|
|
5051
5817
|
const lookBefore = async () => {
|
|
@@ -5060,8 +5826,10 @@ export class Daemon extends EventEmitter {
|
|
|
5060
5826
|
preserveExactBytes: true,
|
|
5061
5827
|
// #1690: our own /model holds every other delivery from its write on — before the lock is released, so a steer
|
|
5062
5828
|
// or /btw waiting on it cannot type into the gap before claude paints "Switch model?" (default cursor: Yes).
|
|
5063
|
-
...(ownSwitch || notifyWritten || contextReset ? { onPaneWritten: () => { if (contextReset)
|
|
5064
|
-
this.resetInboundPresentation();
|
|
5829
|
+
...(ownSwitch || notifyWritten || contextReset ? { onPaneWritten: () => { if (contextReset) {
|
|
5830
|
+
this.resetInboundPresentation();
|
|
5831
|
+
this.resetRoomConversation();
|
|
5832
|
+
} if (ownSwitch) {
|
|
5065
5833
|
this.ownSwitch = ownSwitch;
|
|
5066
5834
|
if (currentModelOwner())
|
|
5067
5835
|
modelObserver?.ownIntent(ownSwitch.requested);
|
|
@@ -5115,7 +5883,7 @@ export class Daemon extends EventEmitter {
|
|
|
5115
5883
|
reportSwitch({ outcome: "not_sent" }); // its write never began
|
|
5116
5884
|
else {
|
|
5117
5885
|
try {
|
|
5118
|
-
reportSwitch(await this.answerOwnSwitchDialog(ownSwitch));
|
|
5886
|
+
reportSwitch(ownSwitch.codex ? await this.verifyCodexSwitch(ownSwitch.codex, codexBefore) : ownSwitch.cli ? await this.verifyCliSwitch(ownSwitch.cli, cliBefore) : await this.answerOwnSwitchDialog(ownSwitch));
|
|
5119
5887
|
}
|
|
5120
5888
|
catch (err) {
|
|
5121
5889
|
this.logger.warn({ err: err.message }, "Answering our own model switch failed");
|
|
@@ -5145,11 +5913,118 @@ export class Daemon extends EventEmitter {
|
|
|
5145
5913
|
return;
|
|
5146
5914
|
}
|
|
5147
5915
|
const sw = msg.runtime_switch;
|
|
5148
|
-
const
|
|
5149
|
-
|
|
5916
|
+
const codexPart = (v) => v === null ? null : typeof v === "string" && v ? v : undefined;
|
|
5917
|
+
const codex = sw?.codex && typeof sw.codex === "object" ? { model: codexPart(sw.codex.model), effort: codexPart(sw.codex.effort) } : undefined;
|
|
5918
|
+
// M-3180: one generic spec for the CLIs of CLI_RUNTIME_SWITCH — a known backend and one command (which may carry both model and effort).
|
|
5919
|
+
const rawCli = sw?.cli;
|
|
5920
|
+
const cli = rawCli && typeof rawCli === "object" && typeof rawCli.backend === "string" && Object.hasOwn(CLI_RUNTIME_SWITCH, rawCli.backend)
|
|
5921
|
+
? { backend: rawCli.backend, model: codexPart(rawCli.model), effort: codexPart(rawCli.effort) } : rawCli === undefined ? undefined : null;
|
|
5922
|
+
const cliOk = !cli || (cli.model !== undefined && cli.effort !== undefined && (cli.model !== null || cli.effort !== null)
|
|
5923
|
+
&& CLI_RUNTIME_SWITCH[cli.backend].command({ model: cli.model, effort: cli.effort }) === msg.content);
|
|
5924
|
+
// A malformed switch must not downgrade into an ungated legacy raw paste.
|
|
5925
|
+
if (rawCli !== undefined && (cli === null || !cliOk || codex || !sw || typeof sw.id !== "string" || sw.kind !== "model" || typeof sw.requested !== "string")) {
|
|
5926
|
+
if (typeof sw?.id === "string")
|
|
5927
|
+
this.broadcastFleetMessage({ type: "runtime_switch_result", id: sw.id, outcome: "not_sent", reason: "command" });
|
|
5928
|
+
return;
|
|
5929
|
+
}
|
|
5930
|
+
const ownSwitch = sw && typeof sw.id === "string" && sw.kind === "model" && typeof sw.requested === "string" && cli !== null && cliOk && !(codex && cli)
|
|
5931
|
+
&& (!codex || (codex.model !== undefined && codex.effort !== undefined && (codex.model !== null || codex.effort !== null)))
|
|
5932
|
+
? { id: sw.id, kind: "model", requested: sw.requested,
|
|
5933
|
+
...(codex ? { codex: { model: codex.model, effort: codex.effort } } : {}),
|
|
5934
|
+
...(cli ? { cli: { backend: cli.backend, model: cli.model, effort: cli.effort } } : {}) } : undefined;
|
|
5150
5935
|
const notifyWritten = typeof msg.notify_written === "string" && /^[0-9a-f]{16}$/.test(msg.notify_written) ? msg.notify_written : undefined;
|
|
5151
5936
|
this.queueRawPaste(msg.content, this.captureDeliveryEpoch(msg.delivery_epoch), msg.confirm_clear === true, durableAttempt ? { ...durableAttempt, submissionMode: "raw_paste", silentSchedule: msg.silent_schedule === true } : undefined, ownSwitch, notifyWritten, msg.context_reset === "clear" || msg.context_reset === "compact" ? msg.context_reset : undefined);
|
|
5152
5937
|
}
|
|
5938
|
+
/**
|
|
5939
|
+
* M-3175: before typing a codex `/model … --reasoning=…`: the pane authoritatively idle (bounded), the RUNNING codex at a
|
|
5940
|
+
* version that has the inline form (an older one would send the line to the model as a prompt), and what the switch is
|
|
5941
|
+
* verified against afterwards — the rollout's end when the session has one, and the count of codex's answers on the pane.
|
|
5942
|
+
*/
|
|
5943
|
+
async codexSwitchGate() {
|
|
5944
|
+
const tmux = this.tmux;
|
|
5945
|
+
if (!tmux || !await this.waitForAuthoritativePaneIdle(CODEX_SWITCH_IDLE_MS, 500) || this.tmux !== tmux)
|
|
5946
|
+
return { blocked: "busy" };
|
|
5947
|
+
const pid = await tmux.getPanePid?.() ?? null;
|
|
5948
|
+
const version = pid ? await codexRunningVersion(pid) : null;
|
|
5949
|
+
if (!codexSupportsInlineModel(version))
|
|
5950
|
+
return { blocked: "version", version };
|
|
5951
|
+
const pane = await tmux.capturePaneWithHistory(CODEX_SWITCH_HISTORY_LINES).catch(() => "");
|
|
5952
|
+
let rollout = null;
|
|
5953
|
+
const session = this.backend?.readRawPasteSession?.(pane);
|
|
5954
|
+
if (session) {
|
|
5955
|
+
const file = await checkpointCodexPane(session.sessionsDir, session.sessionId, this.config.working_directory || process.cwd()).catch(() => null);
|
|
5956
|
+
if (file)
|
|
5957
|
+
rollout = { path: file.path, offset: file.offset };
|
|
5958
|
+
}
|
|
5959
|
+
return { rollout, answers: codexSwitchAnswerCount(pane), version };
|
|
5960
|
+
}
|
|
5961
|
+
/**
|
|
5962
|
+
* M-3180: before typing a CLI_RUNTIME_SWITCH step: the pane authoritatively idle (bounded), the RUNNING binary at the entry's minimum
|
|
5963
|
+
* for this step, and what the verdict compares against — the scrollback before the command and the entry's record checkpoint.
|
|
5964
|
+
*/
|
|
5965
|
+
async cliSwitchGate(step) {
|
|
5966
|
+
const tmux = this.tmux, entry = CLI_RUNTIME_SWITCH[step.backend];
|
|
5967
|
+
if (!entry || !tmux || !await this.waitForAuthoritativePaneIdle(CODEX_SWITCH_IDLE_MS, 500) || this.tmux !== tmux)
|
|
5968
|
+
return { blocked: "busy" };
|
|
5969
|
+
const pid = await tmux.getPanePid?.() ?? null;
|
|
5970
|
+
const version = pid ? await cliRunningVersion(pid, { backend: step.backend, matchExe: entry.matchExe, versionFromExe: entry.versionFromExe }) : null;
|
|
5971
|
+
if (!cliSwitchAllowed(entry, step, version))
|
|
5972
|
+
return { blocked: "version", version };
|
|
5973
|
+
const pane = await tmux.capturePaneWithHistory(CODEX_SWITCH_HISTORY_LINES).catch(() => "");
|
|
5974
|
+
const record = entry.checkpoint ? await entry.checkpoint(pane, this.config.working_directory || process.cwd(), pid).catch(() => undefined) : undefined;
|
|
5975
|
+
return { pane, ...(record !== undefined ? { record } : {}) };
|
|
5976
|
+
}
|
|
5977
|
+
/** M-3180: the entry's verdict on the scrollback after the step, against the one before it; nothing in time is not confirmed. */
|
|
5978
|
+
async verifyCliSwitch(step, before) {
|
|
5979
|
+
const tmux = this.tmux, entry = CLI_RUNTIME_SWITCH[step.backend];
|
|
5980
|
+
if (!tmux || !before || !entry)
|
|
5981
|
+
return { outcome: "not_confirmed" };
|
|
5982
|
+
const deadline = performance.now() + CODEX_SWITCH_VERIFY_MS;
|
|
5983
|
+
while (performance.now() < deadline && this.tmux === tmux) {
|
|
5984
|
+
const pane = await tmux.capturePaneWithHistory(CODEX_SWITCH_HISTORY_LINES).catch(() => "");
|
|
5985
|
+
const verdict = await entry.verify({ model: step.model, effort: step.effort }, before, { pane });
|
|
5986
|
+
if (verdict?.outcome === "switched")
|
|
5987
|
+
return { outcome: "switched", confirmed: true, shown: verdict.shown };
|
|
5988
|
+
if (verdict?.outcome === "mismatch")
|
|
5989
|
+
return { outcome: "mismatch", shown: verdict.shown, answered: true };
|
|
5990
|
+
await new Promise(resolve => setTimeout(resolve, 200));
|
|
5991
|
+
}
|
|
5992
|
+
return { outcome: "not_confirmed" };
|
|
5993
|
+
}
|
|
5994
|
+
/**
|
|
5995
|
+
* M-3175: what our codex switch came to. The rollout's `thread_settings_applied` written after our checkpoint is the proof
|
|
5996
|
+
* (codex writes it at once once the session has a rollout); a session with none yet has codex's own answer on the pane —
|
|
5997
|
+
* a NEW `• Model changed to … for this session only` (or `■` refusal) after the ones counted before the line was typed.
|
|
5998
|
+
* Anything that does not name what was asked is a mismatch; no answer in time is not confirmed. The fleet restarts on both.
|
|
5999
|
+
*/
|
|
6000
|
+
async verifyCodexSwitch(want, before) {
|
|
6001
|
+
const tmux = this.tmux;
|
|
6002
|
+
if (!tmux || !before)
|
|
6003
|
+
return { outcome: "not_confirmed" };
|
|
6004
|
+
const fits = (model, effort) => (want.model === null || model === want.model) && (want.effort === null || effort === want.effort);
|
|
6005
|
+
const deadline = performance.now() + CODEX_SWITCH_VERIFY_MS;
|
|
6006
|
+
while (performance.now() < deadline && this.tmux === tmux) {
|
|
6007
|
+
if (before.rollout) {
|
|
6008
|
+
const applied = codexAppliedFromRollout(await readFrom(before.rollout.path, before.rollout.offset, CODEX_SWITCH_ROLLOUT_READ));
|
|
6009
|
+
if (applied) {
|
|
6010
|
+
const shown = `${applied.model} ${applied.effort ?? "default"}`;
|
|
6011
|
+
return fits(applied.model, applied.effort) ? { outcome: "switched", confirmed: true, shown } : { outcome: "mismatch", shown, answered: true };
|
|
6012
|
+
}
|
|
6013
|
+
}
|
|
6014
|
+
const pane = await tmux.capturePaneWithHistory(CODEX_SWITCH_HISTORY_LINES).catch(() => "");
|
|
6015
|
+
if (codexSwitchAnswerCount(pane) > before.answers) {
|
|
6016
|
+
const answer = codexSwitchFromPane(pane);
|
|
6017
|
+
if (answer?.kind === "refused")
|
|
6018
|
+
return { outcome: "mismatch", shown: answer.text, answered: true };
|
|
6019
|
+
if (answer?.kind === "switched" && !before.rollout) {
|
|
6020
|
+
const shown = `${answer.model} ${answer.effort}`;
|
|
6021
|
+
return fits(answer.model, answer.effort) ? { outcome: "switched", confirmed: true, shown } : { outcome: "mismatch", shown, answered: true };
|
|
6022
|
+
}
|
|
6023
|
+
}
|
|
6024
|
+
await new Promise(resolve => setTimeout(resolve, 200));
|
|
6025
|
+
}
|
|
6026
|
+
return { outcome: "not_confirmed" };
|
|
6027
|
+
}
|
|
5153
6028
|
/**
|
|
5154
6029
|
* #1690 (the user's choice A): after AgEnD's own `/model <name>`, claude may ask "Switch model?" (a warm cache for
|
|
5155
6030
|
* another model). When the model it names is the one asked for, answer Yes; otherwise No (Escape — `Kept model as …`),
|
|
@@ -5513,6 +6388,7 @@ export class Daemon extends EventEmitter {
|
|
|
5513
6388
|
this.logger.info("Stopping daemon instance");
|
|
5514
6389
|
this.clearQuitRelaunchWatch();
|
|
5515
6390
|
this.fenceDeliveryWritesForStop();
|
|
6391
|
+
this.requestContextHelper?.revoke();
|
|
5516
6392
|
this.turnReplyGuard.reset();
|
|
5517
6393
|
this.clearReplyGuardConfirm();
|
|
5518
6394
|
this.sawBlockedInput = false;
|
|
@@ -5534,6 +6410,7 @@ export class Daemon extends EventEmitter {
|
|
|
5534
6410
|
this.healthCheckPaused = true;
|
|
5535
6411
|
this.saveSessionId();
|
|
5536
6412
|
await this.nativePaneLifecycle.release(options.nativePane ?? "detach");
|
|
6413
|
+
await this.ipcServer?.close();
|
|
5537
6414
|
try {
|
|
5538
6415
|
unlinkSync(join(this.instanceDir, "daemon.pid"));
|
|
5539
6416
|
}
|
|
@@ -5607,7 +6484,7 @@ export class Daemon extends EventEmitter {
|
|
|
5607
6484
|
await this.ipcServer?.close();
|
|
5608
6485
|
// Clean up backend config files
|
|
5609
6486
|
if (this.backend?.cleanup) {
|
|
5610
|
-
this.backend.cleanup(this.buildBackendConfig());
|
|
6487
|
+
this.backend.cleanup(this.buildBackendConfig(false));
|
|
5611
6488
|
}
|
|
5612
6489
|
// Clean up checked-out repos
|
|
5613
6490
|
try {
|
|
@@ -5660,6 +6537,16 @@ export class Daemon extends EventEmitter {
|
|
|
5660
6537
|
}
|
|
5661
6538
|
return { ...snapshot, interaction: this.getInteractionSnapshot() };
|
|
5662
6539
|
}
|
|
6540
|
+
footprintEnabled = false;
|
|
6541
|
+
footprintPane = null;
|
|
6542
|
+
setHostFootprintEnabled(enabled) { this.footprintEnabled = enabled; if (!enabled)
|
|
6543
|
+
this.footprintPane = null; }
|
|
6544
|
+
hostFootprintRoot() {
|
|
6545
|
+
const cached = this.footprintPane;
|
|
6546
|
+
if (!this.footprintEnabled || !cached || cached.pane !== this.tmux || cached.owner !== JSON.stringify(this.interactionOwner()) || this.isPaused || this.spawning || this.healthCheckPaused || this.runtimeMonitorsFrozen || Date.now() - cached.observedAt > 120000)
|
|
6547
|
+
return null;
|
|
6548
|
+
return { pid: cached.pid, owner: cached.owner, observedAt: cached.observedAt };
|
|
6549
|
+
}
|
|
5663
6550
|
interactionOwner() {
|
|
5664
6551
|
return { bootId: this.bootId, spawnGeneration: this.spawnGeneration,
|
|
5665
6552
|
launchAttempt: this.launchAttempt, launchFenceEpoch: this.launchFenceEpoch };
|
|
@@ -5708,13 +6595,17 @@ export class Daemon extends EventEmitter {
|
|
|
5708
6595
|
/** Local system work: no user turn, channel reply target, wake or replay of an original request. */
|
|
5709
6596
|
async deliverWorkingRecovery(content, delivery, admitted) {
|
|
5710
6597
|
const tmux = this.tmux, owner = JSON.stringify(this.interactionOwner()), epoch = this.deliveryEpoch;
|
|
5711
|
-
|
|
6598
|
+
let begun = false;
|
|
6599
|
+
const current = () => (begun || !this.requestContextAdmission || this.requestContextAdmission.available()) && this.tmux === tmux && owner === JSON.stringify(this.interactionOwner())
|
|
5712
6600
|
&& this.deliveryEpoch === epoch && !this.deliveryWritesStopping && !this.runtimeMonitorsFrozen
|
|
5713
6601
|
&& !this.spawning && !this.startupAborted && !this.isPaused && !this.healthCheckPaused
|
|
5714
6602
|
&& this.processStatus === "running" && this.pasteQueueDepth === 0
|
|
5715
6603
|
&& (this.workingRecoveryInputOwner === owner || this.instanceState === "idle" && !this.recoveryNativeWork)
|
|
5716
6604
|
&& this.recoveryBootSettled && !this.recoveryCancelled && !this.isSessionOomStopped() && admitted();
|
|
5717
|
-
|
|
6605
|
+
const heldCurrent = () => this.tmux === tmux && owner === JSON.stringify(this.interactionOwner())
|
|
6606
|
+
&& this.deliveryEpoch === epoch && !this.deliveryWritesStopping && !this.startupAborted && admitted();
|
|
6607
|
+
if (this.requestContextAdmission && !await this.requestContextAdmission.wait(heldCurrent))
|
|
6608
|
+
return;
|
|
5718
6609
|
try {
|
|
5719
6610
|
await this.paneWriteLock.run(async () => {
|
|
5720
6611
|
if (!tmux || !current())
|
|
@@ -5773,6 +6664,7 @@ export class Daemon extends EventEmitter {
|
|
|
5773
6664
|
}
|
|
5774
6665
|
}
|
|
5775
6666
|
workingTurnDelivery = null;
|
|
6667
|
+
workingTurnRequestContext = null;
|
|
5776
6668
|
workingBackgroundObservation = null;
|
|
5777
6669
|
/** Pure metadata read: never discovers sessions, captures a pane or reads backend files. */
|
|
5778
6670
|
getWorkingStateObservation() {
|
|
@@ -5910,8 +6802,13 @@ export class Daemon extends EventEmitter {
|
|
|
5910
6802
|
}
|
|
5911
6803
|
/** Shared Fleet inputs: socket and native transports retain the same wake, epoch and raw-paste semantics. */
|
|
5912
6804
|
handleFleetMessage(msg, send, current = () => true) {
|
|
6805
|
+
if (msg.type === "hub_room_tools_changed") {
|
|
6806
|
+
this.ipcServer?.broadcast({ type: "hub_room_tools_changed" });
|
|
6807
|
+
return true;
|
|
6808
|
+
}
|
|
5913
6809
|
if (msg.type === "query_sessions") {
|
|
5914
6810
|
send({ type: "query_sessions_response", sessions: [] });
|
|
6811
|
+
send(this.hubAnswerTurnStateMessage()); // M-3660
|
|
5915
6812
|
}
|
|
5916
6813
|
else if (msg.type === "fleet_inbound") {
|
|
5917
6814
|
const meta = msg.meta;
|
|
@@ -5922,7 +6819,11 @@ export class Daemon extends EventEmitter {
|
|
|
5922
6819
|
this.deferDurableDelivery(meta, "native channel owner changed before pane submission");
|
|
5923
6820
|
return;
|
|
5924
6821
|
}
|
|
5925
|
-
this.
|
|
6822
|
+
const inputId = this.requestContextLifecycle && isHubQuestionMeta(meta) && typeof msg.request_context_input_id === "string" ? msg.request_context_input_id : undefined;
|
|
6823
|
+
if (inputId)
|
|
6824
|
+
this.pushChannelMessage(msg.content, meta, targetSession, deliveryEpoch, inputId);
|
|
6825
|
+
else
|
|
6826
|
+
this.pushChannelMessage(msg.content, meta, targetSession, deliveryEpoch);
|
|
5926
6827
|
}).catch(err => {
|
|
5927
6828
|
this.deferDurableDelivery(meta, `target wake failed before pane submission: ${err.message}`);
|
|
5928
6829
|
this.logger.error({ err: err.message }, "Wake failed for inbound delivery");
|
|
@@ -6058,7 +6959,7 @@ export class Daemon extends EventEmitter {
|
|
|
6058
6959
|
this.pauseRequested = false;
|
|
6059
6960
|
return false;
|
|
6060
6961
|
}
|
|
6061
|
-
if (!ready() || admission && !admission.accepts(text) || this.backend?.backgroundWorkRunning?.(text)
|
|
6962
|
+
if (!ready() || admission && !admission.accepts(text) || this.backend?.isDraftIdlePane?.(text) === true || this.backend?.backgroundWorkRunning?.(text)
|
|
6062
6963
|
|| !allowStuck && !this.paneAuthoritativelyIdle(text)) {
|
|
6063
6964
|
this.pauseRequested = false;
|
|
6064
6965
|
return false;
|
|
@@ -6216,7 +7117,8 @@ export class Daemon extends EventEmitter {
|
|
|
6216
7117
|
// auth pause — otherwise the instance would pause again the moment it idles.
|
|
6217
7118
|
this.pausePending = false;
|
|
6218
7119
|
this.pauseReconfirmAuth = false;
|
|
6219
|
-
this.
|
|
7120
|
+
if (!this.staleAuthIssue())
|
|
7121
|
+
this.authFailureUnresolved = false;
|
|
6220
7122
|
this.unverifiedAuthMatch = null;
|
|
6221
7123
|
this.loginScreenReported = false;
|
|
6222
7124
|
this.fatalStartupReported = false;
|
|
@@ -6446,7 +7348,9 @@ export class Daemon extends EventEmitter {
|
|
|
6446
7348
|
this.logStateEdge(previous, snapshot);
|
|
6447
7349
|
this.publishWorkingState("execution");
|
|
6448
7350
|
this.emit("instance_state", { name: this.name, ...snapshot });
|
|
6449
|
-
this.broadcastFleetMessage({ type: "instance_state", instanceName: this.name, ...snapshot
|
|
7351
|
+
this.broadcastFleetMessage({ type: "instance_state", instanceName: this.name, ...snapshot,
|
|
7352
|
+
turnEvidence: this.turnEvidence(), turnActivityAt: this.turnWatch.activityAt });
|
|
7353
|
+
this.noteTurnEdge(snapshot.state);
|
|
6450
7354
|
if (snapshot.state === "stuck" && pane && this.instanceStateReadyPattern) {
|
|
6451
7355
|
this.handleStuckTransition(pane, snapshot, this.instanceStateReadyPattern);
|
|
6452
7356
|
}
|
|
@@ -6498,11 +7402,14 @@ export class Daemon extends EventEmitter {
|
|
|
6498
7402
|
* message can arrive mid-turn and sit queued, and marking at arrival would let
|
|
6499
7403
|
* the PREVIOUS turn's idle edge consume (and reset) the new turn's state.
|
|
6500
7404
|
*/
|
|
6501
|
-
markTurnStarted(meta, deliveredText, deliveryEpoch = this.deliveryEpoch, queuedHandoff = false) {
|
|
7405
|
+
markTurnStarted(meta, deliveredText, deliveryEpoch = this.deliveryEpoch, queuedHandoff = false, verdict) {
|
|
6502
7406
|
// Cancel may have interrupted an in-flight paste before its promise settled.
|
|
6503
7407
|
// Its late success must not re-arm the turn that the user just cancelled.
|
|
6504
7408
|
if (!this.isDeliveryEpochCurrent(deliveryEpoch))
|
|
6505
7409
|
return;
|
|
7410
|
+
// New input, including a peer/system input, cannot inherit an earlier draft.
|
|
7411
|
+
// If its transcript was already polled before paste confirmation, prefer a generic recovery.
|
|
7412
|
+
this.replyDraft.reset();
|
|
6506
7413
|
// Channel turns started by a person. Cross-instance, schedules (silent or
|
|
6507
7414
|
// not), and AgEnD system notices must not expect a reply to a person (#2544):
|
|
6508
7415
|
// a proxy or recovery notice would land in the last USER topic, or flag a
|
|
@@ -6510,7 +7417,9 @@ export class Daemon extends EventEmitter {
|
|
|
6510
7417
|
// chat platform has no chat_id (its reply goes to the web chat through the
|
|
6511
7418
|
// fleet's web-only sink), but it is a person waiting for an answer all the
|
|
6512
7419
|
// same: the guard arms for it (alpha.2).
|
|
6513
|
-
|
|
7420
|
+
const requestContext = this.requestContextTurnSnapshot();
|
|
7421
|
+
const ownedReplyTarget = requestContext ? this.requestContextLifecycle?.replyTarget?.(requestContext) : null;
|
|
7422
|
+
if (!turnExpectsPersonReply(meta) && !ownedReplyTarget) {
|
|
6514
7423
|
this.logger.debug({
|
|
6515
7424
|
source: meta.source || null,
|
|
6516
7425
|
user: meta.user || null,
|
|
@@ -6530,12 +7439,21 @@ export class Daemon extends EventEmitter {
|
|
|
6530
7439
|
threadId: meta.thread_id || undefined,
|
|
6531
7440
|
messageId: meta.message_id || undefined,
|
|
6532
7441
|
correlationId: meta.correlation_id || undefined,
|
|
7442
|
+
...(ownedReplyTarget ?? {}),
|
|
6533
7443
|
inboundMarker,
|
|
6534
7444
|
deliveredText,
|
|
6535
7445
|
deliveredAt,
|
|
6536
|
-
}, this.pendingWork.lastInboundTimestamp());
|
|
7446
|
+
}, this.pendingWork.lastInboundTimestamp(), requestContext && ownedReplyTarget ? { binding: requestContext.token, target: ownedReplyTarget } : undefined);
|
|
7447
|
+
if (requestContext && verdict?.pendingReply) {
|
|
7448
|
+
const route = this.captureRequestContextReplyRoute(requestContext);
|
|
7449
|
+
if (route)
|
|
7450
|
+
verdict.pendingReply.arm(route);
|
|
7451
|
+
else
|
|
7452
|
+
verdict.pendingReply.refuse();
|
|
7453
|
+
}
|
|
6537
7454
|
const armed = this.turnReplyGuard.snapshot();
|
|
6538
7455
|
this.workingTurnDelivery = { generation: armed.generation, deliveryId: meta.delivery_id || null };
|
|
7456
|
+
this.workingTurnRequestContext = requestContext ? { generation: armed.generation, snapshot: requestContext } : null;
|
|
6539
7457
|
this.publishWorkingState("turn_started");
|
|
6540
7458
|
// #1209: persist the in-flight turn with a seam checkpoint. A marker
|
|
6541
7459
|
// that survives a restart is an interrupted turn by construction —
|
|
@@ -6887,10 +7805,176 @@ export class Daemon extends EventEmitter {
|
|
|
6887
7805
|
* This launch's transcript monitor. #1510: its turn boundaries feed the reply guard's ledger, which starts empty
|
|
6888
7806
|
* with it — a new monitor re-baselines at the transcript's end, so nothing the old one read can be attributed.
|
|
6889
7807
|
*/
|
|
7808
|
+
/** M-3239: this launch's turn as its transcript tells it (dispatcher-liveness.ts). */
|
|
7809
|
+
turnWatch = new TurnWatch();
|
|
7810
|
+
turnActivitySentAt = 0;
|
|
7811
|
+
hubRoomInputEpoch = 0;
|
|
7812
|
+
hubRoomTranscriptActivity = 0;
|
|
7813
|
+
hubRoomTurnActivityStart = null;
|
|
7814
|
+
hubRoomTurnBoot = randomUUID();
|
|
7815
|
+
hubRoomTurnSequence = 0;
|
|
7816
|
+
turnEndTimer = null;
|
|
7817
|
+
/**
|
|
7818
|
+
* M-3660: the Hub question this pane is answering as a turn of its own — from just before its write until the idle edge
|
|
7819
|
+
* after that turn's work (or the next write into the idle pane). The fleet keeps the agent's contact window for exactly
|
|
7820
|
+
* this turn: hub_question_input opens it, hub_question_turn_ended closes it.
|
|
7821
|
+
*/
|
|
7822
|
+
// It is kept on disk too (hub-answer-turn.json): a daemon restarted mid-turn takes it up again, so deliveries keep
|
|
7823
|
+
// waiting behind it and its end is still announced; the fleet is told the current state again on every (re)connect.
|
|
7824
|
+
hubAnswerTurnState;
|
|
7825
|
+
/** Prism #4420 P2-2: the turn record exists but cannot be read — a turn may be running; fail closed until an idle edge. */
|
|
7826
|
+
hubAnswerTurnUnknown = false;
|
|
7827
|
+
get hubAnswerTurn() {
|
|
7828
|
+
if (this.hubAnswerTurnState === undefined) {
|
|
7829
|
+
const file = this.hubAnswerTurnFile(), read = file ? readHubAnswerTurn(file) : null;
|
|
7830
|
+
this.hubAnswerTurnUnknown = read === "unknown";
|
|
7831
|
+
this.hubAnswerTurnState = read === "unknown" ? null : read;
|
|
7832
|
+
}
|
|
7833
|
+
return this.hubAnswerTurnState;
|
|
7834
|
+
}
|
|
7835
|
+
/** M-3660: a turn is running, or may be (an unreadable record): nothing is handed into it. */
|
|
7836
|
+
hubAnswerTurnMayRun() { return this.hubAnswerTurn !== null || this.hubAnswerTurnUnknown; }
|
|
7837
|
+
/** The unknown is resolved (an idle edge, a write into the idle pane): no turn runs; the fleet is told "none". */
|
|
7838
|
+
resolveUnknownHubAnswerTurn() {
|
|
7839
|
+
if (!this.hubAnswerTurnUnknown)
|
|
7840
|
+
return;
|
|
7841
|
+
this.hubAnswerTurnUnknown = false;
|
|
7842
|
+
const file = this.hubAnswerTurnFile();
|
|
7843
|
+
try {
|
|
7844
|
+
if (file)
|
|
7845
|
+
rmSync(file, { force: true });
|
|
7846
|
+
}
|
|
7847
|
+
catch (err) {
|
|
7848
|
+
this.logger.warn({ err }, "Unreadable Hub answer turn record could not be removed");
|
|
7849
|
+
}
|
|
7850
|
+
this.broadcastFleetMessage({ type: "hub_question_turn_state", correlationId: null });
|
|
7851
|
+
}
|
|
7852
|
+
hubAnswerTurnFile() { return typeof this.instanceDir === "string" ? join(this.instanceDir, "hub-answer-turn.json") : null; }
|
|
7853
|
+
/** A turn's end is always kept in memory; a record that cannot be removed is read as a restored turn later (fail closed). */
|
|
7854
|
+
setHubAnswerTurn(turn) {
|
|
7855
|
+
this.hubAnswerTurnState = turn;
|
|
7856
|
+
const file = this.hubAnswerTurnFile();
|
|
7857
|
+
if (!file)
|
|
7858
|
+
return;
|
|
7859
|
+
try {
|
|
7860
|
+
if (turn)
|
|
7861
|
+
atomicWriteFileSync(file, JSON.stringify({ correlationId: turn.correlationId, contactLimit: turn.contactLimit }), { mode: 0o600 });
|
|
7862
|
+
else
|
|
7863
|
+
rmSync(file, { force: true });
|
|
7864
|
+
}
|
|
7865
|
+
catch (err) {
|
|
7866
|
+
// Prism #4420 P2-2: a turn that cannot be recorded is not begun — its question is not written (the caller throws).
|
|
7867
|
+
if (turn) {
|
|
7868
|
+
this.hubAnswerTurnState = null;
|
|
7869
|
+
throw err;
|
|
7870
|
+
}
|
|
7871
|
+
this.logger.warn({ err }, "Hub answer turn end could not be saved; a restart reads it as a turn that ends at its first idle edge");
|
|
7872
|
+
}
|
|
7873
|
+
}
|
|
7874
|
+
hubAnswerTurnBegins(correlationId, contactLimit = true) {
|
|
7875
|
+
if (correlationId !== undefined && this.hubAnswerTurn?.correlationId === correlationId)
|
|
7876
|
+
return; // a retried write
|
|
7877
|
+
this.resolveUnknownHubAnswerTurn(); // written into the idle pane: whatever might have run is over
|
|
7878
|
+
this.endHubAnswerTurn();
|
|
7879
|
+
if (correlationId === undefined)
|
|
7880
|
+
return;
|
|
7881
|
+
// Throws when the turn cannot be recorded: the question is then not written, and its delivery fails (reported).
|
|
7882
|
+
this.setHubAnswerTurn({ correlationId, contactLimit, sawWorking: false, restored: false });
|
|
7883
|
+
this.broadcastFleetMessage({ type: "hub_question_input", correlationId, contactLimit });
|
|
7884
|
+
}
|
|
7885
|
+
endHubAnswerTurn() {
|
|
7886
|
+
const turn = this.hubAnswerTurn;
|
|
7887
|
+
if (!turn)
|
|
7888
|
+
return;
|
|
7889
|
+
this.setHubAnswerTurn(null);
|
|
7890
|
+
this.broadcastFleetMessage({ type: "hub_question_turn_ended", correlationId: turn.correlationId });
|
|
7891
|
+
}
|
|
7892
|
+
/**
|
|
7893
|
+
* Lumen #4420 R2-A: a turn taken up from the record outlives nothing but the pane it ran in. A launch that starts a new
|
|
7894
|
+
* CLI (every launch but a native reattach) ends it, and an unreadable record resolves to "none", at once.
|
|
7895
|
+
*/
|
|
7896
|
+
settleHubAnswerTurnAtLaunch(reattached) {
|
|
7897
|
+
if (reattached)
|
|
7898
|
+
return;
|
|
7899
|
+
if (this.hubAnswerTurn?.restored)
|
|
7900
|
+
this.endHubAnswerTurn();
|
|
7901
|
+
this.resolveUnknownHubAnswerTurn();
|
|
7902
|
+
}
|
|
7903
|
+
/** M-3660: the current Hub answer turn, told to a fleet connection when it (re)connects (a signal may have been lost). */
|
|
7904
|
+
hubAnswerTurnStateMessage() {
|
|
7905
|
+
const turn = this.hubAnswerTurn;
|
|
7906
|
+
if (!turn && this.hubAnswerTurnUnknown)
|
|
7907
|
+
return { type: "hub_question_turn_state", correlationId: null, unknown: true };
|
|
7908
|
+
return { type: "hub_question_turn_state", correlationId: turn?.correlationId ?? null, ...(turn ? { contactLimit: turn.contactLimit } : {}) };
|
|
7909
|
+
}
|
|
7910
|
+
/** M-3239: Claude's and Codex's transcripts tell each tool call and answer; their pane's spinner alone is not a turn. */
|
|
7911
|
+
turnEvidence() {
|
|
7912
|
+
const bin = this.backend?.binaryName;
|
|
7913
|
+
return (bin === "claude" || bin === "codex") && this.transcriptMonitor?.following() === true;
|
|
7914
|
+
}
|
|
7915
|
+
/** M-3239: progress for the board's quiet clock, at most every 30 s while a turn runs (the idle edge carries the last). */
|
|
7916
|
+
reportTurnActivity() {
|
|
7917
|
+
const now = Date.now();
|
|
7918
|
+
if (now - this.turnActivitySentAt < TURN_ACTIVITY_REPORT_MS)
|
|
7919
|
+
return;
|
|
7920
|
+
this.turnActivitySentAt = now;
|
|
7921
|
+
this.broadcastFleetMessage({ type: "turn_activity", instanceName: this.name, at: now });
|
|
7922
|
+
}
|
|
7923
|
+
/**
|
|
7924
|
+
* M-3239: on the pane's idle edge, after a moment for the transcript's last lines: the turn's final text, when it
|
|
7925
|
+
* messaged no one — the fleet tells the dispatcher of a claimed card if that text asks a question.
|
|
7926
|
+
*/
|
|
7927
|
+
noteTurnEdge(state) {
|
|
7928
|
+
if (state !== "idle") {
|
|
7929
|
+
if (this.turnEndTimer) {
|
|
7930
|
+
clearTimeout(this.turnEndTimer);
|
|
7931
|
+
this.turnEndTimer = null;
|
|
7932
|
+
}
|
|
7933
|
+
if (state === "working") {
|
|
7934
|
+
this.turnWatch.begin(Date.now());
|
|
7935
|
+
this.hubRoomTurnActivityStart ??= this.hubRoomTranscriptActivity;
|
|
7936
|
+
{
|
|
7937
|
+
const hubTurn = this.hubAnswerTurn;
|
|
7938
|
+
if (hubTurn)
|
|
7939
|
+
hubTurn.sawWorking = true;
|
|
7940
|
+
}
|
|
7941
|
+
}
|
|
7942
|
+
return;
|
|
7943
|
+
}
|
|
7944
|
+
// Lumen #4420 R2-A: a turn taken up from the record ends on the first idle state, at once (no settle wait, no work proof).
|
|
7945
|
+
if (this.hubAnswerTurn?.restored)
|
|
7946
|
+
this.endHubAnswerTurn();
|
|
7947
|
+
if (this.turnEndTimer)
|
|
7948
|
+
return;
|
|
7949
|
+
const roomGeneration = this.roomConversationState ? this.roomConversationGeneration() : null, roomInputEpoch = this.hubRoomInputEpoch;
|
|
7950
|
+
this.turnEndTimer = setTimeout(() => {
|
|
7951
|
+
this.turnEndTimer = null; // a working edge before this cancels it: the turn went on
|
|
7952
|
+
const turn = this.turnWatch.end();
|
|
7953
|
+
// A Claude/Codex compaction spinner is not a completed model turn. Require fresh tool/text evidence.
|
|
7954
|
+
const bin = this.backend?.binaryName, needsTranscript = bin === "claude" || bin === "codex";
|
|
7955
|
+
const realWork = !needsTranscript || this.hubRoomTurnActivityStart !== null && this.hubRoomTranscriptActivity > this.hubRoomTurnActivityStart;
|
|
7956
|
+
this.hubRoomTurnActivityStart = null;
|
|
7957
|
+
// M-3660: the Hub answer turn ends only on real work (a compaction spinner is not its end: realWork needs a fresh
|
|
7958
|
+
// working edge AND transcript activity since it, so a flicker leaves the turn running until real work then idle) —
|
|
7959
|
+
// or, taken up again after a daemon restart, on the first idle edge.
|
|
7960
|
+
const hubTurn = this.hubAnswerTurn;
|
|
7961
|
+
if (hubTurn?.sawWorking && (realWork || hubTurn.restored))
|
|
7962
|
+
this.endHubAnswerTurn();
|
|
7963
|
+
else if (!hubTurn)
|
|
7964
|
+
this.resolveUnknownHubAnswerTurn(); // an unreadable record: the pane is idle now, nothing runs
|
|
7965
|
+
if (turn && realWork && roomGeneration && roomGeneration === this.roomConversationGeneration() && roomInputEpoch === this.hubRoomInputEpoch)
|
|
7966
|
+
this.broadcastFleetMessage({ type: "hub_room_turn_ended", generation: roomGeneration, turn: `${this.hubRoomTurnBoot}:${++this.hubRoomTurnSequence}` });
|
|
7967
|
+
if (!turn || turn.messaged || !turn.text.trim() || !this.turnEvidence())
|
|
7968
|
+
return;
|
|
7969
|
+
this.broadcastFleetMessage({ type: "turn_ended", instanceName: this.name, startedAt: turn.startedAt, text: turn.text.slice(-4000) });
|
|
7970
|
+
}, TURN_END_SETTLE_MS);
|
|
7971
|
+
this.turnEndTimer.unref?.();
|
|
7972
|
+
}
|
|
6890
7973
|
buildTranscriptMonitor(source) {
|
|
6891
7974
|
this.followLog.reset();
|
|
7975
|
+
this.replyDraft.reset();
|
|
6892
7976
|
const modelLaunch = this.backend?.modelObservationLaunch?.();
|
|
6893
|
-
const monitor = new TranscriptMonitor(this.instanceDir, this.logger, source, () => modelLaunch);
|
|
7977
|
+
const monitor = new TranscriptMonitor(this.instanceDir, this.logger, source, () => modelLaunch, !!this.requestContextLifecycle);
|
|
6894
7978
|
let savedModel;
|
|
6895
7979
|
try {
|
|
6896
7980
|
const path = join(this.instanceDir, "claude-model-observation.json");
|
|
@@ -6905,6 +7989,12 @@ export class Daemon extends EventEmitter {
|
|
|
6905
7989
|
this.claudeModelObserver = modelObserver;
|
|
6906
7990
|
this.modelObservationBound = false;
|
|
6907
7991
|
const owner = launchIdentity(this.interactionOwner());
|
|
7992
|
+
const credentialLaunch = source || !this.isClaudeCodeBackend() ? null : this.backend?.credentialObservationLaunch?.();
|
|
7993
|
+
monitor.on("claude_request", (record, launchId) => {
|
|
7994
|
+
if (!credentialLaunch || credentialLaunch.binding.kind === "subscription" || this.transcriptMonitor !== monitor || owner !== launchIdentity(this.interactionOwner()) || this.deliveryWritesStopping || this.startupAborted || launchId !== credentialLaunch.launch.id || this.backend?.credentialObservationLaunch?.()?.launch.id !== launchId || record.at < credentialLaunch.launch.startedAt || !credentialLaunch.sourceCurrent())
|
|
7995
|
+
return;
|
|
7996
|
+
this.emit("claude_credential_request", { binding: credentialLaunch.binding, record, owner: this.interactionOwner() });
|
|
7997
|
+
});
|
|
6908
7998
|
let reminderSession = modelObserver?.checkpoint().sessionId ?? null;
|
|
6909
7999
|
const observeReminderBoundary = (sessionId, before, after) => {
|
|
6910
8000
|
const selected = (s) => normalizeClaudeModel(s.session ?? s.launch);
|
|
@@ -6940,6 +8030,23 @@ export class Daemon extends EventEmitter {
|
|
|
6940
8030
|
if (changed)
|
|
6941
8031
|
this.emit("model_observation");
|
|
6942
8032
|
});
|
|
8033
|
+
monitor.on("reply_draft_record", (entry) => {
|
|
8034
|
+
if (this.transcriptMonitor === monitor && owner === launchIdentity(this.interactionOwner())) {
|
|
8035
|
+
const turn = this.turnReplyGuard?.snapshot();
|
|
8036
|
+
if (turn)
|
|
8037
|
+
this.replyDraft.observe(entry, turn.generation);
|
|
8038
|
+
else
|
|
8039
|
+
this.replyDraft.reset();
|
|
8040
|
+
}
|
|
8041
|
+
});
|
|
8042
|
+
for (const event of ["reset", "workspace_reset", "context_reset"])
|
|
8043
|
+
monitor.on(event, () => {
|
|
8044
|
+
if (this.transcriptMonitor === monitor) {
|
|
8045
|
+
this.replyDraft.reset();
|
|
8046
|
+
if (event !== "workspace_reset" && this.requestContextWrite)
|
|
8047
|
+
this.requestContextWrite.unknownEnd = "reset";
|
|
8048
|
+
}
|
|
8049
|
+
});
|
|
6943
8050
|
this.transcriptTurns.reset();
|
|
6944
8051
|
this.transcriptActivityAt = 0;
|
|
6945
8052
|
// Monotonic: a wall-clock correction must neither end nor extend the open-turn hold (#1641 R1).
|
|
@@ -6947,6 +8054,9 @@ export class Daemon extends EventEmitter {
|
|
|
6947
8054
|
monitor.on("turns", (turns) => {
|
|
6948
8055
|
this.transcriptTurns.observe(turns, performance.now());
|
|
6949
8056
|
touch();
|
|
8057
|
+
if (this.transcriptMonitor === monitor && owner === launchIdentity(this.interactionOwner())) {
|
|
8058
|
+
this.observeRequestContextTranscript(turns);
|
|
8059
|
+
}
|
|
6950
8060
|
});
|
|
6951
8061
|
// #3160: the files this turn reads, edits and searches, for the Files & changes panel's Follow (a few string checks;
|
|
6952
8062
|
// nothing is read from disk until someone asks). Claude's turn boundary is its next prompt.
|
|
@@ -6969,6 +8079,23 @@ export class Daemon extends EventEmitter {
|
|
|
6969
8079
|
});
|
|
6970
8080
|
for (const event of ["tool_use", "tool_result", "assistant_text"])
|
|
6971
8081
|
monitor.on(event, touch);
|
|
8082
|
+
// M-3239: the turn as the transcript tells it — progress for the board's quiet clock, and the question a turn ends on.
|
|
8083
|
+
const mine = () => this.transcriptMonitor === monitor;
|
|
8084
|
+
monitor.on("tool_use", (name, input) => { if (mine()) {
|
|
8085
|
+
this.hubRoomTranscriptActivity++;
|
|
8086
|
+
this.turnWatch.tool(name, input, Date.now());
|
|
8087
|
+
this.reportTurnActivity();
|
|
8088
|
+
} });
|
|
8089
|
+
monitor.on("tool_result", () => { if (mine()) {
|
|
8090
|
+
this.hubRoomTranscriptActivity++;
|
|
8091
|
+
this.turnWatch.result(Date.now());
|
|
8092
|
+
this.reportTurnActivity();
|
|
8093
|
+
} });
|
|
8094
|
+
monitor.on("assistant_text", (text) => { if (mine()) {
|
|
8095
|
+
this.hubRoomTranscriptActivity++;
|
|
8096
|
+
this.turnWatch.text(text, Date.now());
|
|
8097
|
+
this.reportTurnActivity();
|
|
8098
|
+
} });
|
|
6972
8099
|
return monitor;
|
|
6973
8100
|
}
|
|
6974
8101
|
/**
|
|
@@ -7056,8 +8183,26 @@ export class Daemon extends EventEmitter {
|
|
|
7056
8183
|
message: formatReplyDropDetection(turn, reason),
|
|
7057
8184
|
});
|
|
7058
8185
|
}
|
|
8186
|
+
_replyDraft;
|
|
8187
|
+
/** Also supports existing prototype-based lifecycle harnesses without constructor state. */
|
|
8188
|
+
get replyDraft() { return this._replyDraft ??= new ReplyDraft(); }
|
|
7059
8189
|
queueReplyRecoveryPrompt(turn) {
|
|
7060
8190
|
const deliveryEpoch = this.deliveryEpoch;
|
|
8191
|
+
const parent = this.workingTurnRequestContext?.generation === turn.generation ? this.workingTurnRequestContext.snapshot : null;
|
|
8192
|
+
const recoveryInputId = `reply-recovery:${this.bootId}:${turn.generation}:${deliveryEpoch}`;
|
|
8193
|
+
const registered = parent && this.requestContextLifecycle ? { root: parent.context.ref.rootContextId } : null;
|
|
8194
|
+
if (registered) {
|
|
8195
|
+
if (this.requestContextQueuedWork.has(recoveryInputId))
|
|
8196
|
+
return;
|
|
8197
|
+
try {
|
|
8198
|
+
this.requestContextQueuedWork.set(recoveryInputId, registered);
|
|
8199
|
+
}
|
|
8200
|
+
catch {
|
|
8201
|
+
this.turnReplyGuard.complete(turn.generation);
|
|
8202
|
+
this.reportUnrecoveredReplyDrop(turn, "recovery_prompt_delivery_failed");
|
|
8203
|
+
return;
|
|
8204
|
+
}
|
|
8205
|
+
}
|
|
7061
8206
|
this.pasteQueueDepth++;
|
|
7062
8207
|
this.pasteLock = this.pasteLock.then(async () => {
|
|
7063
8208
|
try {
|
|
@@ -7073,8 +8218,16 @@ export class Daemon extends EventEmitter {
|
|
|
7073
8218
|
});
|
|
7074
8219
|
return;
|
|
7075
8220
|
}
|
|
7076
|
-
|
|
8221
|
+
let prompt = REPLY_RECOVERY_PROMPT;
|
|
8222
|
+
try {
|
|
8223
|
+
prompt = this.replyDraft.recoveryPrompt(current, REPLY_RECOVERY_PROMPT);
|
|
8224
|
+
}
|
|
8225
|
+
catch { /* Draft evidence is best-effort; keep the existing generic recovery. */ }
|
|
8226
|
+
const recoveryText = parent && this.requestContextLifecycle ? `[agend-request-input:${recoveryInputId}]\n${prompt}` : prompt;
|
|
8227
|
+
const delivered = await this.deliverMessage(recoveryText, undefined, {
|
|
7077
8228
|
deliveryEpoch,
|
|
8229
|
+
...(parent ? { requestContextRecovery: { inputId: recoveryInputId, parent,
|
|
8230
|
+
current: () => !!this.currentReplyRecovery(turn.generation, deliveryEpoch) } } : {}),
|
|
7078
8231
|
});
|
|
7079
8232
|
if (!this.currentReplyRecovery(turn.generation, deliveryEpoch))
|
|
7080
8233
|
return;
|
|
@@ -7092,7 +8245,8 @@ export class Daemon extends EventEmitter {
|
|
|
7092
8245
|
return;
|
|
7093
8246
|
this.turnReplyGuard.complete(turn.generation);
|
|
7094
8247
|
this.reportUnrecoveredReplyDrop(turn, "recovery_prompt_delivery_failed");
|
|
7095
|
-
})
|
|
8248
|
+
}).finally(() => { if (registered && this.requestContextQueuedWork.get(recoveryInputId) === registered)
|
|
8249
|
+
this.requestContextQueuedWork.delete(recoveryInputId); });
|
|
7096
8250
|
}
|
|
7097
8251
|
/** Recheck after queue waits and IO; cancellation must not become a failure notice. */
|
|
7098
8252
|
currentReplyRecovery(generation, deliveryEpoch) {
|
|
@@ -7182,6 +8336,10 @@ export class Daemon extends EventEmitter {
|
|
|
7182
8336
|
}
|
|
7183
8337
|
/** Context-bound reply path shared by dead-MCP and malformed-call recovery. */
|
|
7184
8338
|
deliverDaemonReply(body, requestPrefix, logLabel, target) {
|
|
8339
|
+
// System proxy text has no originating call lease. Until its final-output generation proof is
|
|
8340
|
+
// installed, it cannot borrow a live turn or lastChat; proven-parent model recovery uses C instead.
|
|
8341
|
+
if (this.requestContextLifecycle)
|
|
8342
|
+
return Promise.resolve(false);
|
|
7185
8343
|
const args = { text: body };
|
|
7186
8344
|
const chatId = target?.chatId ?? this.lastChatId;
|
|
7187
8345
|
const threadId = target?.threadId ?? this.lastThreadId;
|
|
@@ -7398,7 +8556,7 @@ export class Daemon extends EventEmitter {
|
|
|
7398
8556
|
// work cannot hide behind this: it changes the layout, the next
|
|
7399
8557
|
// output arms another probe, and the debounce capture still fires.
|
|
7400
8558
|
// #1641: never while the transcript shows a turn running — that idle-looking screen is mid-turn.
|
|
7401
|
-
if (this.instanceState === "idle" && this.
|
|
8559
|
+
if (this.instanceState === "idle" && this.executionIdleProof()?.(pane) === true
|
|
7402
8560
|
&& this.transcriptTurnState() !== "open")
|
|
7403
8561
|
return;
|
|
7404
8562
|
// A second burst overtook the probe. Do not bless its stale capture as
|
|
@@ -7435,7 +8593,7 @@ export class Daemon extends EventEmitter {
|
|
|
7435
8593
|
// observe twice, which silently disabled the "content moved" branch.
|
|
7436
8594
|
if (this.backend?.periodicRedrawFrom)
|
|
7437
8595
|
this.periodicRedrawLayout = this.backend.periodicRedrawFrom(pane);
|
|
7438
|
-
const structuredPeriodicIdle = this.
|
|
8596
|
+
const structuredPeriodicIdle = this.executionIdleProof();
|
|
7439
8597
|
// #1641: the transcript outranks the pane: while it shows the turn running, no reading of this pane is idle (codex
|
|
7440
8598
|
// hides its status row while streaming, leaving the idle composer and footer in view mid-turn).
|
|
7441
8599
|
const transcriptTurn = this.transcriptTurnState();
|
|
@@ -7665,6 +8823,13 @@ export class Daemon extends EventEmitter {
|
|
|
7665
8823
|
return undefined;
|
|
7666
8824
|
return proof;
|
|
7667
8825
|
}
|
|
8826
|
+
/** Draft text can be execution-idle, but must not become empty-composer proof for delivery, pause or nudges. */
|
|
8827
|
+
executionIdleProof() {
|
|
8828
|
+
const empty = this.periodicIdleProof(), draft = this.backend?.isDraftIdlePane;
|
|
8829
|
+
if (!empty && !draft)
|
|
8830
|
+
return undefined;
|
|
8831
|
+
return pane => empty?.call(this.backend, pane) === true || draft?.call(this.backend, pane) === true;
|
|
8832
|
+
}
|
|
7668
8833
|
bindInstanceStateOutputListener(windowId) {
|
|
7669
8834
|
if (!this.controlClient || !this.instanceStateMonitorActive)
|
|
7670
8835
|
return;
|
|
@@ -7770,6 +8935,7 @@ export class Daemon extends EventEmitter {
|
|
|
7770
8935
|
this.cancelCapacityNudge("the instance was stopped, paused or respawned");
|
|
7771
8936
|
this.runtimeMonitorsFrozen = true;
|
|
7772
8937
|
this.launchFenceEpoch++;
|
|
8938
|
+
this.requestContextAdmission?.changed();
|
|
7773
8939
|
this.interactionObservation.reset(this.interactionOwner());
|
|
7774
8940
|
this.clearInteractionConfirmation();
|
|
7775
8941
|
if (this.healthCheckTimer) {
|
|
@@ -8140,7 +9306,7 @@ export class Daemon extends EventEmitter {
|
|
|
8140
9306
|
if (kind === "steer")
|
|
8141
9307
|
wire = Daemon.steerEnvelope(wire);
|
|
8142
9308
|
else if (kind === "btw")
|
|
8143
|
-
wire =
|
|
9309
|
+
wire = btwInboundEnvelope(wire, meta.delivery_id);
|
|
8144
9310
|
return prepareDeliveryWire(wire, kind === "raw_paste");
|
|
8145
9311
|
}
|
|
8146
9312
|
humanReceiptAttempt(meta, wire) {
|
|
@@ -8198,10 +9364,22 @@ export class Daemon extends EventEmitter {
|
|
|
8198
9364
|
if (meta.human_prepare_token)
|
|
8199
9365
|
this.humanPreparations.delete(meta.human_prepare_token);
|
|
8200
9366
|
this.humanReminderAttempts.delete(meta.human_receipt_id);
|
|
9367
|
+
const pending = this.requestContextHumanReplies?.get(meta.human_receipt_id);
|
|
9368
|
+
if (pending && !pending.accepted)
|
|
9369
|
+
pending.pending.refuse();
|
|
9370
|
+
this.requestContextHumanReplies?.delete(meta.human_receipt_id);
|
|
8201
9371
|
}
|
|
8202
9372
|
}
|
|
8203
9373
|
/** Synchronous acknowledgement from the manager after the existing receipt owner/authority checks. */
|
|
8204
9374
|
noteHumanReceiptSettlement(id, positive) {
|
|
9375
|
+
const pending = this.requestContextHumanReplies?.get(id);
|
|
9376
|
+
if (pending) {
|
|
9377
|
+
pending.accepted = positive;
|
|
9378
|
+
if (positive)
|
|
9379
|
+
pending.pending.confirm();
|
|
9380
|
+
else
|
|
9381
|
+
pending.pending.refuse();
|
|
9382
|
+
}
|
|
8205
9383
|
const stamp = this.humanReminderAttempts?.get(id);
|
|
8206
9384
|
if (!stamp || !positive || !this.humanReminders.current(stamp))
|
|
8207
9385
|
return;
|
|
@@ -8235,7 +9413,7 @@ export class Daemon extends EventEmitter {
|
|
|
8235
9413
|
// terminal state is announced by the outbox only after its retry/TTL policy
|
|
8236
9414
|
// is exhausted; emitting ❌ here would expose a transient gate timeout.
|
|
8237
9415
|
if (status && !verdict.durableAttempt)
|
|
8238
|
-
this.emit("message_failed", status); // ❌
|
|
9416
|
+
this.emit("message_failed", { ...status, phase, proof }); // ❌
|
|
8239
9417
|
return false;
|
|
8240
9418
|
}
|
|
8241
9419
|
/** Tell the fleet when an already-accepted cross-instance pane write failed. */
|
|
@@ -8318,7 +9496,7 @@ export class Daemon extends EventEmitter {
|
|
|
8318
9496
|
})) {
|
|
8319
9497
|
delivered = true;
|
|
8320
9498
|
this.finishDurableSubmission(durableAttempt, verdict);
|
|
8321
|
-
this.markTurnStarted(meta, formatted, deliveryEpoch);
|
|
9499
|
+
this.markTurnStarted(meta, formatted, deliveryEpoch, false, verdict);
|
|
8322
9500
|
}
|
|
8323
9501
|
else if (durableAttempt && verdict.paneWriteStarted) {
|
|
8324
9502
|
this.finishDurableDelivery(durableAttempt, "uncertain", `${verdict.phase ?? "post-submit"}:${verdict.proof ?? "unproven"}`, verdict);
|
|
@@ -8372,37 +9550,75 @@ export class Daemon extends EventEmitter {
|
|
|
8372
9550
|
this.updateLastChat(meta.chat_id, meta.thread_id, meta.adapter_id);
|
|
8373
9551
|
this.pendingWork.recordInbound();
|
|
8374
9552
|
this.recordRecentUserMessage(content, meta);
|
|
8375
|
-
const formatted =
|
|
9553
|
+
const formatted = btwInboundEnvelope(this.formatInboundMessage(content, meta), meta.delivery_id);
|
|
8376
9554
|
const status = channelStatus(meta);
|
|
9555
|
+
const durableAttempt = this.durableDeliveryAttempt(meta, content);
|
|
9556
|
+
if (durableAttempt === false) {
|
|
9557
|
+
this.deferDurableDelivery(meta, "invalid durable delivery attempt metadata");
|
|
9558
|
+
return;
|
|
9559
|
+
}
|
|
8377
9560
|
this.steerLock = this.steerLock.then(async () => {
|
|
8378
9561
|
if (!this.isDeliveryEpochCurrent(deliveryEpoch)) {
|
|
8379
|
-
this.
|
|
9562
|
+
this.deferDurableDelivery(meta, "delivery epoch changed before steer began");
|
|
8380
9563
|
this.noteCancelledHuman(meta);
|
|
8381
9564
|
return;
|
|
8382
9565
|
}
|
|
8383
9566
|
await this.wake();
|
|
8384
9567
|
if (!this.isDeliveryEpochCurrent(deliveryEpoch)) {
|
|
8385
|
-
this.
|
|
9568
|
+
this.deferDurableDelivery(meta, "delivery epoch changed while waking for steer");
|
|
8386
9569
|
this.noteCancelledHuman(meta);
|
|
8387
9570
|
return;
|
|
8388
9571
|
}
|
|
8389
9572
|
const verdict = { reached: false, humanReceipt: this.humanReceiptAttempt(meta, formatted) };
|
|
8390
9573
|
let delivered = false;
|
|
8391
9574
|
try {
|
|
8392
|
-
if (await this.deliverMessage(formatted, status, {
|
|
8393
|
-
|
|
9575
|
+
if (await this.deliverMessage(formatted, status, {
|
|
9576
|
+
steer: true,
|
|
9577
|
+
deliveryEpoch,
|
|
9578
|
+
submissionId: meta.message_id,
|
|
9579
|
+
...(meta.verification_id ? { humanVerificationId: meta.verification_id, humanMeta: meta } : {}),
|
|
9580
|
+
verdict,
|
|
9581
|
+
durableAttempt: durableAttempt || undefined,
|
|
9582
|
+
})) {
|
|
8394
9583
|
delivered = true;
|
|
8395
|
-
this.
|
|
9584
|
+
this.finishDurableSubmission(durableAttempt, verdict);
|
|
9585
|
+
this.markTurnStarted(meta, formatted, deliveryEpoch, false, verdict);
|
|
9586
|
+
}
|
|
9587
|
+
else if (durableAttempt && verdict.paneWriteStarted) {
|
|
9588
|
+
this.finishDurableDelivery(durableAttempt, "uncertain", `${verdict.phase ?? "post-submit"}:${verdict.proof ?? "unproven"}`, verdict);
|
|
9589
|
+
}
|
|
9590
|
+
else if (durableAttempt && verdict.durableBeginCommitted) {
|
|
9591
|
+
this.abortDurableDelivery(durableAttempt, `${verdict.phase ?? "delivery"}:${verdict.proof ?? "no-pane-write"}`);
|
|
9592
|
+
}
|
|
9593
|
+
else if (durableAttempt) {
|
|
9594
|
+
this.retryDurableDeliveryBeforeBegin(durableAttempt, `${verdict.phase ?? "delivery"}:${verdict.proof ?? "deferred"}`);
|
|
9595
|
+
}
|
|
9596
|
+
else if (verdict.reached && this.isDeliveryEpochCurrent(deliveryEpoch)) {
|
|
9597
|
+
// Legacy non-outbox path retains its existing failure surface.
|
|
9598
|
+
this.reportCrossInstanceDeliveryFailure(meta, verdict);
|
|
8396
9599
|
}
|
|
8397
9600
|
}
|
|
9601
|
+
catch (err) {
|
|
9602
|
+
// The verdict goes along: a write that started and then threw is still a hand-off the CLI may consume (#1201).
|
|
9603
|
+
if (durableAttempt && verdict.paneWriteStarted)
|
|
9604
|
+
this.finishDurableDelivery(durableAttempt, "uncertain", err.message, verdict);
|
|
9605
|
+
else if (durableAttempt && verdict.durableBeginCommitted)
|
|
9606
|
+
this.abortDurableDelivery(durableAttempt, err.message);
|
|
9607
|
+
else if (durableAttempt)
|
|
9608
|
+
this.retryDurableDeliveryBeforeBegin(durableAttempt, err.message);
|
|
9609
|
+
throw err;
|
|
9610
|
+
}
|
|
8398
9611
|
finally {
|
|
8399
9612
|
this.finishHumanReceipt(meta, verdict);
|
|
8400
9613
|
if (!delivered && !verdict.paneWriteStarted && !this.isDeliveryEpochCurrent(deliveryEpoch))
|
|
8401
9614
|
this.noteCancelledHuman(meta);
|
|
8402
9615
|
}
|
|
8403
9616
|
}).catch(err => {
|
|
8404
|
-
this.
|
|
9617
|
+
this.deferDurableDelivery(meta, `target wake/side-question failed before pane submission: ${err.message}`);
|
|
8405
9618
|
this.logger.warn({ err: err.message }, "btw delivery error");
|
|
9619
|
+
if (!durableAttempt && this.isDeliveryEpochCurrent(deliveryEpoch)) {
|
|
9620
|
+
this.reportCrossInstanceDeliveryFailure(meta, undefined, err.message);
|
|
9621
|
+
}
|
|
8406
9622
|
});
|
|
8407
9623
|
}
|
|
8408
9624
|
/**
|
|
@@ -8410,7 +9626,9 @@ export class Daemon extends EventEmitter {
|
|
|
8410
9626
|
* If targetSession is provided, only send to the matching socket.
|
|
8411
9627
|
* Otherwise send to the instance's own session (this.name).
|
|
8412
9628
|
*/
|
|
8413
|
-
pushChannelMessage(content, meta, _targetSession, deliveryEpoch = this.deliveryEpoch) {
|
|
9629
|
+
pushChannelMessage(content, meta, _targetSession, deliveryEpoch = this.deliveryEpoch, requestContextInputId) {
|
|
9630
|
+
if (requestContextInputId && !/^hub-input:[a-f0-9-]{36}$/.test(requestContextInputId))
|
|
9631
|
+
throw Error("Hub request input id is unavailable");
|
|
8414
9632
|
if (!this.isDeliveryEpochCurrent(deliveryEpoch)) {
|
|
8415
9633
|
this.logger.info("Pending channel delivery dropped by user cancel");
|
|
8416
9634
|
this.deferDurableDelivery(meta, "delivery epoch changed before queue admission");
|
|
@@ -8498,7 +9716,10 @@ export class Daemon extends EventEmitter {
|
|
|
8498
9716
|
// byte for byte (its proof is the wire's hash), so the notice waits for the next delivery without one.
|
|
8499
9717
|
const whatsNew = this.pendingWhatsNew && !meta.human_receipt_id && !meta.handoff_redelivery
|
|
8500
9718
|
? this.currentWhatsNew(this.pendingWhatsNew) : null;
|
|
8501
|
-
const
|
|
9719
|
+
const body = whatsNew ? withWhatsNew(formatted, whatsNew.notice) : formatted;
|
|
9720
|
+
const roomMarker = roomContextInputMarker(meta);
|
|
9721
|
+
const unmarked = roomMarker ? `${roomMarker}\n${body}` : body;
|
|
9722
|
+
const pasted = requestContextInputId && !roomMarker ? `[agend-request-input:${requestContextInputId}]\n${unmarked}` : unmarked;
|
|
8502
9723
|
const status = channelStatus(meta);
|
|
8503
9724
|
// A fresh delivery begins a fresh turn — its bubble must not inherit
|
|
8504
9725
|
// the previous turn's tool list.
|
|
@@ -8516,6 +9737,10 @@ export class Daemon extends EventEmitter {
|
|
|
8516
9737
|
this.logger.info({ handoff: meta.handoff_redelivery }, "Queued hand-off redelivery dropped: its CLI was replaced before the write");
|
|
8517
9738
|
return;
|
|
8518
9739
|
}
|
|
9740
|
+
if (meta.hub_room_context_generation && meta.hub_room_context_generation !== this.roomConversationGeneration()) {
|
|
9741
|
+
this.reportCrossInstanceDeliveryFailure(meta, { reached: true, phase: "room-context", proof: "stale-generation" });
|
|
9742
|
+
return;
|
|
9743
|
+
}
|
|
8519
9744
|
const durableAttempt = this.durableDeliveryAttempt(meta, content);
|
|
8520
9745
|
if (durableAttempt === false) {
|
|
8521
9746
|
this.deferDurableDelivery(meta, "invalid durable delivery attempt metadata");
|
|
@@ -8527,6 +9752,9 @@ export class Daemon extends EventEmitter {
|
|
|
8527
9752
|
sent = await this.deliverMessage(pasted, status, {
|
|
8528
9753
|
deliveryEpoch,
|
|
8529
9754
|
submissionId: meta.message_id,
|
|
9755
|
+
...(requestContextInputId ? { requestContextInputId } : {}),
|
|
9756
|
+
...(isHubQuestionMeta(meta) ? { hubQuestion: meta.correlation_id, hubContactLimit: meta.hub_contact_limit !== "off" } : {}),
|
|
9757
|
+
...(meta.hub_room_context_generation ? { roomContextGeneration: meta.hub_room_context_generation } : {}),
|
|
8530
9758
|
...(meta.verification_id ? { humanVerificationId: meta.verification_id, humanMeta: meta } : {}),
|
|
8531
9759
|
verdict,
|
|
8532
9760
|
durableAttempt: durableAttempt || undefined,
|
|
@@ -8542,7 +9770,7 @@ export class Daemon extends EventEmitter {
|
|
|
8542
9770
|
if (sent) {
|
|
8543
9771
|
delivered = true;
|
|
8544
9772
|
this.finishDurableSubmission(durable, verdict);
|
|
8545
|
-
this.markTurnStarted(meta, formatted, deliveryEpoch, !!verdict.handoff);
|
|
9773
|
+
this.markTurnStarted(meta, formatted, deliveryEpoch, !!verdict.handoff, verdict);
|
|
8546
9774
|
}
|
|
8547
9775
|
else if (durableAttempt && verdict.paneWriteStarted) {
|
|
8548
9776
|
this.finishDurableDelivery(durable, "uncertain", `${verdict.phase ?? "post-submit"}:${verdict.proof ?? "unproven"}`, verdict);
|
|
@@ -8620,10 +9848,25 @@ export class Daemon extends EventEmitter {
|
|
|
8620
9848
|
const verdict = opts?.verdict ?? { reached: false };
|
|
8621
9849
|
if (opts?.durableAttempt)
|
|
8622
9850
|
verdict.durableAttempt = true;
|
|
8623
|
-
const cancelled = () => opts?.deliveryEpoch !== undefined
|
|
8624
|
-
&&
|
|
9851
|
+
const cancelled = () => (opts?.deliveryEpoch !== undefined && !this.isDeliveryEpochCurrent(opts.deliveryEpoch))
|
|
9852
|
+
|| (!!opts?.roomContextGeneration && opts.roomContextGeneration !== this.roomConversationGeneration());
|
|
8625
9853
|
if (cancelled() || this.stormWindow?.isStopped())
|
|
8626
9854
|
return false;
|
|
9855
|
+
const admittedReceiptId = opts?.humanMeta?.verification_id ?? opts?.humanVerificationId;
|
|
9856
|
+
const admittedInputId = opts?.requestContextInputId ?? (admittedReceiptId ? `human:${admittedReceiptId}` : opts?.durableAttempt ? `delivery:${opts.durableAttempt.deliveryId}:${opts.durableAttempt.attemptNo}` : null);
|
|
9857
|
+
// Captured once for this input, before waiting. An ended steer never turns into a fresh owner root.
|
|
9858
|
+
const continuation = this.requestContextLifecycle?.continuation?.(admittedInputId, opts?.requestContextRecovery);
|
|
9859
|
+
let heldOwner;
|
|
9860
|
+
const admissionCurrent = () => !cancelled() && !this.deliveryWritesStopping && !this.startupAborted
|
|
9861
|
+
&& (heldOwner === undefined || heldOwner === JSON.stringify(this.interactionOwner()));
|
|
9862
|
+
const waitAdmission = async () => {
|
|
9863
|
+
const port = this.requestContextAdmission;
|
|
9864
|
+
if (!port.available(continuation))
|
|
9865
|
+
heldOwner ??= JSON.stringify(this.interactionOwner());
|
|
9866
|
+
return await port.wait(admissionCurrent, continuation) && admissionCurrent();
|
|
9867
|
+
};
|
|
9868
|
+
if (this.requestContextAdmission && !await waitAdmission())
|
|
9869
|
+
return false;
|
|
8627
9870
|
formatted = prepareDeliveryWire(formatted, opts?.preserveExactBytes);
|
|
8628
9871
|
// Direct paths such as /steer, /btw, /raw and schedules do not pass the
|
|
8629
9872
|
// FleetManager idle gate. Hold them at the final common pane-write path so
|
|
@@ -8648,7 +9891,7 @@ export class Daemon extends EventEmitter {
|
|
|
8648
9891
|
const settleFence = this.launchFenceEpoch;
|
|
8649
9892
|
if (cancelled())
|
|
8650
9893
|
return false;
|
|
8651
|
-
if (this.
|
|
9894
|
+
if (this.refuseBlockedDelivery(verdict, status))
|
|
8652
9895
|
return false;
|
|
8653
9896
|
let windowId = this.getWindowId();
|
|
8654
9897
|
const supportsQueuedInput = this.backend?.supportsQueuedInput?.() === true;
|
|
@@ -8659,7 +9902,10 @@ export class Daemon extends EventEmitter {
|
|
|
8659
9902
|
// normal Enter input has steering/interrupt semantics in several other CLIs.
|
|
8660
9903
|
let readiness = "ready";
|
|
8661
9904
|
const gateWindowId = windowId;
|
|
8662
|
-
|
|
9905
|
+
// M-3660: a Hub question is never handed into a running turn (Claude would merge it into that turn's work), and while
|
|
9906
|
+
// a Hub answer turn runs, nothing else is handed into it: each waits for the idle pane and becomes a turn of its own.
|
|
9907
|
+
const exclusiveTurn = opts?.hubQuestion !== undefined || this.hubAnswerTurnMayRun();
|
|
9908
|
+
const handOffEligible = !exclusiveTurn && (!this.requestContextLifecycle || opts?.steer === true) && !!(supportsQueuedInput || opts?.steer || composerQueue);
|
|
8663
9909
|
const handOffAdmissible = async () => (await this.probeBlockingDialog()).state === "clear"
|
|
8664
9910
|
&& await this.hasPositiveDeliveryInput(true)
|
|
8665
9911
|
&& ((!opts?.steer && !composerQueue) || (this.launchTakesSteer() && await this.steerComposerAdmits(false, opts?.steer === true)));
|
|
@@ -8731,29 +9977,50 @@ export class Daemon extends EventEmitter {
|
|
|
8731
9977
|
// must come back AND the check runs again — the stranded text may still
|
|
8732
9978
|
// be there. "failed" (the Enter could not be sent) fails the delivery:
|
|
8733
9979
|
// pasting now would submit both messages as one.
|
|
8734
|
-
|
|
8735
|
-
|
|
8736
|
-
|
|
8737
|
-
|
|
8738
|
-
|
|
8739
|
-
return
|
|
9980
|
+
const inputDeadline = Date.now() + 30 * 60_000;
|
|
9981
|
+
let submissions = 0;
|
|
9982
|
+
let unavailableProbes = 0;
|
|
9983
|
+
for (;;) {
|
|
9984
|
+
if (cancelled())
|
|
9985
|
+
return false;
|
|
9986
|
+
if (Date.now() >= inputDeadline) {
|
|
9987
|
+
this.logger.error("Input row stayed unavailable until the delivery deadline");
|
|
9988
|
+
return this.failDelivery(verdict, status, "stranded-input", "input-not-clear-timeout");
|
|
8740
9989
|
}
|
|
8741
|
-
|
|
9990
|
+
// Only actual recovery Enters spend the submission budget. A live pane's
|
|
9991
|
+
// unreadable/changing composer may need time, not three synchronous probes.
|
|
9992
|
+
const stranded = await this.submitStrandedInputIfAny(windowId, submissions < STRANDED_INPUT_MAX_ROUNDS);
|
|
8742
9993
|
if (cancelled())
|
|
8743
9994
|
return false;
|
|
8744
9995
|
if (stranded === "idle")
|
|
8745
9996
|
break;
|
|
9997
|
+
if (stranded === "exhausted") {
|
|
9998
|
+
this.logger.error({ submissions }, "Input row still not clear after the stranded-text recovery budget — reporting delivery failure");
|
|
9999
|
+
return this.failDelivery(verdict, status, "stranded-input", "retry-budget-exhausted");
|
|
10000
|
+
}
|
|
8746
10001
|
if (stranded === "failed") {
|
|
8747
|
-
this.logger.error({
|
|
10002
|
+
this.logger.error({ submissions }, "Could not submit the stranded text — reporting delivery failure");
|
|
8748
10003
|
return this.failDelivery(verdict, status, "stranded-input", "enter-failed");
|
|
8749
10004
|
}
|
|
8750
|
-
|
|
10005
|
+
if (stranded === "submitted")
|
|
10006
|
+
submissions++;
|
|
10007
|
+
// Only the proven empty unknown-footer candidate needs the timed
|
|
10008
|
+
// fallback. Preserve the existing bounded refusal for other unsafe
|
|
10009
|
+
// input (including a stranded draft whose footer cannot be proved).
|
|
10010
|
+
if (stranded === "busy" && this.footerFallbackPaneKey === null && ++unavailableProbes >= STRANDED_INPUT_MAX_ROUNDS) {
|
|
10011
|
+
return this.failDelivery(verdict, status, "stranded-input", "input-not-clear");
|
|
10012
|
+
}
|
|
10013
|
+
const readyAgain = await this.waitForPaneReadyForDelivery(windowId, inputDeadline - Date.now());
|
|
8751
10014
|
if (cancelled())
|
|
8752
10015
|
return false;
|
|
8753
10016
|
if (!readyAgain) {
|
|
8754
|
-
this.logger.error("Pane never returned to its prompt after
|
|
10017
|
+
this.logger.error("Pane never returned to its prompt after checking stranded input — reporting delivery failure");
|
|
8755
10018
|
return this.failDelivery(verdict, status, "stranded-input", "prompt-timeout");
|
|
8756
10019
|
}
|
|
10020
|
+
// After startup, the general idle gate can pass while the stricter input
|
|
10021
|
+
// proof is still collecting a stable composer. Yield before re-reading it.
|
|
10022
|
+
if (stranded === "busy")
|
|
10023
|
+
await new Promise(resolve => setTimeout(resolve, BOTTOM_READY_POLL_MS));
|
|
8757
10024
|
}
|
|
8758
10025
|
}
|
|
8759
10026
|
// Everything above is *waiting*; everything below owns the write lock.
|
|
@@ -8764,6 +10031,8 @@ export class Daemon extends EventEmitter {
|
|
|
8764
10031
|
const outcome = await this.paneWriteLock.run(async () => {
|
|
8765
10032
|
if (cancelled())
|
|
8766
10033
|
return false;
|
|
10034
|
+
if (this.requestContextAdmission && !this.requestContextAdmission.available(continuation) && !verdict.paneWriteStarted && !verdict.durableBeginCommitted)
|
|
10035
|
+
return "request-context-held";
|
|
8767
10036
|
// A spawn that started after the settle wait above invalidates the
|
|
8768
10037
|
// window id and every readiness verdict since: the pane about to be
|
|
8769
10038
|
// written may already belong to a replacement process. The same holds
|
|
@@ -8773,7 +10042,7 @@ export class Daemon extends EventEmitter {
|
|
|
8773
10042
|
// delivery from the top, where the settle wait runs again outside it.
|
|
8774
10043
|
if (!settledClean || settleGeneration !== this.spawnGeneration || this.spawning)
|
|
8775
10044
|
return "spawn-started";
|
|
8776
|
-
if (this.
|
|
10045
|
+
if (this.refuseBlockedDelivery(verdict, status))
|
|
8777
10046
|
return false;
|
|
8778
10047
|
// A passive startup phase may paint after the outer readiness probe.
|
|
8779
10048
|
// It clears without input, so waiting under the pane lock cannot starve
|
|
@@ -8807,18 +10076,47 @@ export class Daemon extends EventEmitter {
|
|
|
8807
10076
|
// same process, a pause/stop/respawn is not (launchFenceEpoch moves even
|
|
8808
10077
|
// when a failed pause resumes the monitors).
|
|
8809
10078
|
const writeCurrent = () => !cancelled()
|
|
10079
|
+
&& (!this.requestContextAdmission || admissionCurrent() && (this.requestContextAdmission.available(continuation) || !!verdict.paneWriteStarted || !!verdict.durableBeginCommitted))
|
|
10080
|
+
&& !this.staleAuthIssue()
|
|
8810
10081
|
&& !this.deliveryWritesStopping
|
|
8811
10082
|
&& !this.runtimeMonitorsFrozen
|
|
8812
10083
|
&& !this.spawning
|
|
8813
10084
|
&& settleGeneration === this.spawnGeneration
|
|
8814
10085
|
&& settleFence === this.launchFenceEpoch;
|
|
8815
|
-
const stale = () =>
|
|
10086
|
+
const stale = () => this.requestContextAdmission && !this.requestContextAdmission.available(continuation) && !verdict.paneWriteStarted && !verdict.durableBeginCommitted
|
|
10087
|
+
? "request-context-held" : this.spawning || settleGeneration !== this.spawnGeneration ? "spawn-started" : false;
|
|
8816
10088
|
const residue = await this.clearRestoredInputDraft(handingOffToNativeQueue, writeCurrent);
|
|
8817
10089
|
if (residue === "stale")
|
|
8818
10090
|
return stale();
|
|
8819
10091
|
if (residue !== "clear")
|
|
8820
10092
|
return this.failDelivery(verdict, status, "input-residue", residue);
|
|
8821
|
-
|
|
10093
|
+
let newlyBound = null;
|
|
10094
|
+
const written = await this.writeMessageToPane(formatted, windowId, handingOffToNativeQueue, status, opts?.submissionId, verdict, opts?.durableAttempt, opts?.steer === true, writeCurrent, opts?.humanVerificationId,
|
|
10095
|
+
// M-3660: written into an idle pane, so whatever Hub answer turn ran is over; a Hub question begins its own.
|
|
10096
|
+
(wireText) => {
|
|
10097
|
+
const receiptId = opts?.humanMeta?.verification_id ?? opts?.humanVerificationId;
|
|
10098
|
+
const inputId = opts?.requestContextInputId ?? (receiptId ? `human:${receiptId}` : opts?.durableAttempt
|
|
10099
|
+
? `delivery:${opts.durableAttempt.deliveryId}:${opts.durableAttempt.attemptNo}` : null);
|
|
10100
|
+
const prior = this.requestContextTurnSnapshot();
|
|
10101
|
+
this.bindRequestContextWrite(inputId, wireText, handingOffToNativeQueue, opts?.requestContextRecovery);
|
|
10102
|
+
const after = this.requestContextTurnSnapshot();
|
|
10103
|
+
if (after && after !== prior)
|
|
10104
|
+
newlyBound = after;
|
|
10105
|
+
if (after && inputId && (/^human:hmsg-/.test(inputId) || /^delivery:/.test(inputId))) {
|
|
10106
|
+
verdict.pendingReply = this.requestContextPendingReplies.stage(after, inputId, deliveryContentDigest(wireText), () => this.requestContextTurnCurrent(after));
|
|
10107
|
+
const humanId = opts?.humanMeta?.human_receipt_id;
|
|
10108
|
+
if (humanId && verdict.pendingReply)
|
|
10109
|
+
this.requestContextHumanReplies.set(humanId, { pending: verdict.pendingReply, accepted: false });
|
|
10110
|
+
}
|
|
10111
|
+
if (!handingOffToNativeQueue)
|
|
10112
|
+
this.hubAnswerTurnBegins(opts?.hubQuestion, opts?.hubContactLimit !== false);
|
|
10113
|
+
opts?.beforePaneWrite?.();
|
|
10114
|
+
}, opts?.lookBeforePaneWrite, opts?.humanMeta);
|
|
10115
|
+
if (written === false && newlyBound && this.nativePaneLifecycle?.lastInputWasNotSent?.()) {
|
|
10116
|
+
const owner = this.requestContextOwner();
|
|
10117
|
+
if (owner && this.requestContextLifecycle.turns.ended(newlyBound, owner))
|
|
10118
|
+
this.requestContextWrite = undefined;
|
|
10119
|
+
}
|
|
8822
10120
|
// #1690: still under the lock — whatever waits on it next must already see what this write started.
|
|
8823
10121
|
if (verdict.paneWriteStarted)
|
|
8824
10122
|
opts?.onPaneWritten?.();
|
|
@@ -8828,9 +10126,18 @@ export class Daemon extends EventEmitter {
|
|
|
8828
10126
|
// M-2267: the pane is in a tmux mode: nothing written — wait for readiness (it holds while the mode lasts), retry.
|
|
8829
10127
|
if (written === "pane-in-mode")
|
|
8830
10128
|
return "dialog";
|
|
10129
|
+
// A publication fence before input keeps this attempt at its producer; never turn the wait into failure.
|
|
10130
|
+
if (written === false && this.requestContextAdmission && !this.requestContextAdmission.available(continuation) && !verdict.paneWriteStarted && !verdict.durableBeginCommitted)
|
|
10131
|
+
return "request-context-held";
|
|
8831
10132
|
// Fenced before its first write: not attempted — redo after a spawn, else drop without a ❌.
|
|
8832
10133
|
return written === false && verdict.fenced ? stale() : written;
|
|
8833
10134
|
});
|
|
10135
|
+
if (outcome === "request-context-held") {
|
|
10136
|
+
if (!this.requestContextAdmission || !await waitAdmission())
|
|
10137
|
+
return false;
|
|
10138
|
+
round--;
|
|
10139
|
+
continue; // Waiting on admission consumes neither a dialog retry nor any input intent.
|
|
10140
|
+
}
|
|
8834
10141
|
if (outcome === "spawn-started") {
|
|
8835
10142
|
// The pane changed under this delivery: its queued paste must not land
|
|
8836
10143
|
// in the replacement process's first screen. Redo the whole delivery
|
|
@@ -9666,7 +10973,7 @@ export class Daemon extends EventEmitter {
|
|
|
9666
10973
|
locked: fn => this.paneWriteLock.run(fn),
|
|
9667
10974
|
// An unreadable screen (a failed capture, another spawn's pane) is unknown — never "the card closed".
|
|
9668
10975
|
read: async () => answerScreen = this.tmux === tmux ? await tmux.capturePane().catch(() => null) : null,
|
|
9669
|
-
key: key => this.tmux !== tmux || answerScreen === null ? Promise.resolve(false) : key === "Space" ? (this.nativePaneLifecycle ? tmux.sendKeys(" ", { kind: "dialog", screen: answerScreen }) : tmux.sendKeys(" ")) : (this.nativePaneLifecycle ? tmux.sendSpecialKey(key, undefined, { kind: "dialog", screen: answerScreen }) : tmux.sendSpecialKey(key)),
|
|
10976
|
+
key: key => this.tmux !== tmux || answerScreen === null ? Promise.resolve(false) : (key === "Space" || key === "q") ? (this.nativePaneLifecycle ? tmux.sendKeys(key === "q" ? "q" : " ", { kind: "dialog", screen: answerScreen }) : tmux.sendKeys(key === "q" ? "q" : " ")) : (this.nativePaneLifecycle ? tmux.sendSpecialKey(key, undefined, { kind: "dialog", screen: answerScreen }) : tmux.sendSpecialKey(key)),
|
|
9670
10977
|
paste: text => this.tmux !== tmux || answerScreen === null ? Promise.resolve(false) : this.nativePaneLifecycle ? tmux.pasteBuffer(text, { proof: { kind: "dialog", screen: answerScreen } }) : tmux.pasteBuffer(text),
|
|
9671
10978
|
sleep: ms => new Promise(resolve => setTimeout(resolve, ms)),
|
|
9672
10979
|
now: () => performance.now(),
|
|
@@ -10041,6 +11348,10 @@ export class Daemon extends EventEmitter {
|
|
|
10041
11348
|
* pane proves nothing. The silence gate comes first and costs no capture.
|
|
10042
11349
|
*/
|
|
10043
11350
|
async paneReadinessForDelivery(windowId) {
|
|
11351
|
+
if (this.staleAuthIssue()) {
|
|
11352
|
+
this.resetFooterFallback();
|
|
11353
|
+
return "dialog";
|
|
11354
|
+
}
|
|
10044
11355
|
// Each early return below is the pane seen outside the footer-fallback
|
|
10045
11356
|
// candidate state, and never reaches deliveryInputReadyPane: reset here.
|
|
10046
11357
|
if (!this.isPaneIdleForDelivery(windowId)) {
|
|
@@ -10313,7 +11624,7 @@ export class Daemon extends EventEmitter {
|
|
|
10313
11624
|
this.logger.error({ rows: rows.length }, "The input box did not empty — not writing this delivery onto it");
|
|
10314
11625
|
return "not-cleared";
|
|
10315
11626
|
}
|
|
10316
|
-
async submitStrandedInputIfAny(windowId) {
|
|
11627
|
+
async submitStrandedInputIfAny(windowId, allowSubmit = true) {
|
|
10317
11628
|
if (!this.tmux || !this.backend)
|
|
10318
11629
|
return "idle";
|
|
10319
11630
|
const prompt = this.backend.getBottomReadyPattern?.();
|
|
@@ -10344,6 +11655,8 @@ export class Daemon extends EventEmitter {
|
|
|
10344
11655
|
return "idle";
|
|
10345
11656
|
if (state !== "stranded")
|
|
10346
11657
|
return "busy"; // busy, or unreadable: no evidence the prompt is free
|
|
11658
|
+
if (!allowSubmit)
|
|
11659
|
+
return "exhausted"; // a final clear check is allowed, a fourth recovery Enter is not
|
|
10347
11660
|
const sent = await this.sendDeliveryEnter("stranded-input-submit");
|
|
10348
11661
|
return sent ? "submitted" : "failed";
|
|
10349
11662
|
});
|
|
@@ -10366,10 +11679,24 @@ export class Daemon extends EventEmitter {
|
|
|
10366
11679
|
return "busy";
|
|
10367
11680
|
if (this.backend?.getBusyPattern?.()?.test(pane))
|
|
10368
11681
|
return "busy";
|
|
11682
|
+
// The timed footer fallback is valid only in a live raw TUI, even
|
|
11683
|
+
// after the startup guard has retired. Historical shell scrollback is not
|
|
11684
|
+
// evidence that a composer still owns the terminal.
|
|
11685
|
+
const known = this.backend?.isDeliveryInputReadyPane?.(pane);
|
|
11686
|
+
if (known === false && this.backend?.isStableUnknownLayoutIdlePane?.(pane)) {
|
|
11687
|
+
if (this.nativePaneLifecycle || await this.tmux?.getPaneInputMode?.() !== "raw") {
|
|
11688
|
+
this.resetFooterFallback();
|
|
11689
|
+
return "busy";
|
|
11690
|
+
}
|
|
11691
|
+
}
|
|
10369
11692
|
if (!this.deliveryInputReadyPane(pane))
|
|
10370
11693
|
return "busy";
|
|
10371
|
-
if (strandedAgendMessageInInput(pane, prompt))
|
|
11694
|
+
if (strandedAgendMessageInInput(pane, prompt)) {
|
|
11695
|
+
// A cancelled human turn can restore its text here. Idle observation must not let a later delivery submit it.
|
|
11696
|
+
if (this.backend?.binaryName === "codex" && /\[user:/.test(inputAreaText(pane, prompt) ?? ""))
|
|
11697
|
+
return "busy";
|
|
10372
11698
|
return "stranded";
|
|
11699
|
+
}
|
|
10373
11700
|
// Kiro uses the bottom row; Codex's positive prompt/footer check above
|
|
10374
11701
|
// rules out a historical transcript echo or a transition/modal screen.
|
|
10375
11702
|
return !requireBottomReady || bottomRowIsReady(pane, prompt) ? "clear" : "busy";
|
|
@@ -10561,6 +11888,7 @@ export class Daemon extends EventEmitter {
|
|
|
10561
11888
|
}
|
|
10562
11889
|
}
|
|
10563
11890
|
/**
|
|
11891
|
+
* A stale process login refuses delivery before any write; durable attempts stay retryable.
|
|
10564
11892
|
* While the CLI is parked on a fatal startup screen (see fatalStartupBlocked),
|
|
10565
11893
|
* no pane write may happen: paste+Enter into the corrupt-config modal would
|
|
10566
11894
|
* confirm "Exit and fix manually" and exit the CLI. The message is failed (❌)
|
|
@@ -10568,7 +11896,11 @@ export class Daemon extends EventEmitter {
|
|
|
10568
11896
|
* what to fix, and holding would only build a queue that floods the pane the
|
|
10569
11897
|
* moment the flag clears.
|
|
10570
11898
|
*/
|
|
10571
|
-
|
|
11899
|
+
refuseBlockedDelivery(verdict, status) {
|
|
11900
|
+
if (this.staleAuthIssue()) {
|
|
11901
|
+
this.failDelivery(verdict, status, "pre-write", "stale-auth");
|
|
11902
|
+
return true;
|
|
11903
|
+
}
|
|
10572
11904
|
if (!this.fatalStartupBlocked && !this.modelMinimumBlocked)
|
|
10573
11905
|
return false;
|
|
10574
11906
|
this.logger.error("Delivery refused — CLI startup or model-version repair is held");
|
|
@@ -10926,6 +12258,8 @@ export class Daemon extends EventEmitter {
|
|
|
10926
12258
|
catch {
|
|
10927
12259
|
return hold("check_failed");
|
|
10928
12260
|
}
|
|
12261
|
+
if (this.codexInputOccupied(screen))
|
|
12262
|
+
return hold("input_occupied");
|
|
10929
12263
|
if (!current())
|
|
10930
12264
|
return false;
|
|
10931
12265
|
if (performance.now() >= deadline)
|
|
@@ -10984,12 +12318,27 @@ export class Daemon extends EventEmitter {
|
|
|
10984
12318
|
signature.takenMarker = leadMarker;
|
|
10985
12319
|
const rawPaste = durableAttempt?.submissionMode === "raw_paste";
|
|
10986
12320
|
const humanAttempt = verdict.humanReceipt;
|
|
12321
|
+
verdict.roomInputQueued = handingOffToNativeQueue || steer;
|
|
10987
12322
|
const humanMode = rawPaste ? "raw_paste" : steer ? "steer"
|
|
10988
12323
|
: handingOffToNativeQueue ? "native_queue_handoff" : "idle_submit";
|
|
10989
|
-
|
|
12324
|
+
// Retained controls lead with the delivery marker for strict transcript/restart proof. That marker is
|
|
12325
|
+
// usable for a human receipt only through the outbox's exact control/receipt/owner/wire join, never text lookup.
|
|
12326
|
+
const controlMarker = durableAttempt ? `[agend-delivery-id:${durableAttempt.deliveryId}]` : null;
|
|
12327
|
+
const ownsControlReceipt = () => !!humanAttempt && !!durableAttempt && !rawPaste
|
|
12328
|
+
&& this.deliveryOutbox?.ownsHumanControlReceipt?.(durableAttempt.deliveryId, this.bootId, durableAttempt.attemptNo, humanAttempt.receiptId, humanAttempt.ownerKey, humanAttempt.expectedWireHash) === true;
|
|
12329
|
+
const controlAlias = !!controlMarker && !!humanAttempt
|
|
12330
|
+
&& [`${controlMarker}\n${humanAttempt.marker}\n`,
|
|
12331
|
+
Daemon.steerEnvelope(`${controlMarker}\n${humanAttempt.marker}\n`),
|
|
12332
|
+
btwInboundEnvelope(`${controlMarker}\n${humanAttempt.marker}\n`, durableAttempt.deliveryId)].some(prefix => formatted.startsWith(prefix))
|
|
12333
|
+
&& ownsControlReceipt();
|
|
12334
|
+
if (controlAlias) {
|
|
12335
|
+
signature.value = controlMarker.slice(1, -1);
|
|
12336
|
+
signature.takenMarker = controlMarker;
|
|
12337
|
+
}
|
|
12338
|
+
if (humanAttempt && signature.unique && (controlAlias || signature.value === humanReceiptMarker(humanAttempt.verificationId, humanDialect).slice(1, -1))
|
|
10990
12339
|
&& humanBodyHash(formatted) === humanAttempt.expectedWireHash) {
|
|
10991
12340
|
signature.humanPositive = tag => {
|
|
10992
|
-
if (!humanAttempt.current() || (stillCurrent && !stillCurrent()))
|
|
12341
|
+
if (!humanAttempt.current() || (stillCurrent && !stillCurrent()) || controlAlias && !ownsControlReceipt())
|
|
10993
12342
|
return;
|
|
10994
12343
|
humanAttempt.proof = {
|
|
10995
12344
|
receipt_id: humanAttempt.receiptId, verification_id: humanAttempt.verificationId,
|
|
@@ -11024,6 +12373,8 @@ export class Daemon extends EventEmitter {
|
|
|
11024
12373
|
verdict.fenced = !verdict.durableBeginCommitted;
|
|
11025
12374
|
return false;
|
|
11026
12375
|
}
|
|
12376
|
+
if (pasteBaseline?.unsubmittedAgendInput)
|
|
12377
|
+
return this.failDelivery(verdict, status, "input-residue", "occupied-codex-composer");
|
|
11027
12378
|
// M-2267: the pane went into a tmux mode after the readiness wait. Nothing begun or written: the caller waits for
|
|
11028
12379
|
// readiness (which holds while it lasts) and tries again — as for a dialog that appeared before the write.
|
|
11029
12380
|
if (!verdict.durableBeginCommitted && await this.paneInTmuxMode("paste"))
|
|
@@ -11172,7 +12523,7 @@ export class Daemon extends EventEmitter {
|
|
|
11172
12523
|
return this.failDelivery(verdict, status, "paste", "pane-in-tmux-mode");
|
|
11173
12524
|
}
|
|
11174
12525
|
const pasteGeneration = this.spawnGeneration;
|
|
11175
|
-
beforePaste?.();
|
|
12526
|
+
beforePaste?.(formatted);
|
|
11176
12527
|
const pasted = await this.sendDeliveryPaste(formatted, nativeOwner);
|
|
11177
12528
|
if (!pasted && this.nativePaneLifecycle) {
|
|
11178
12529
|
// The native write attempt is retained as uncertain, including exhausted positive refusals. Never route an
|
|
@@ -11260,7 +12611,7 @@ export class Daemon extends EventEmitter {
|
|
|
11260
12611
|
if (!this.steerPasteIsOurs(before.pane, formatted))
|
|
11261
12612
|
return this.failDelivery(verdict, status, "steer-paste", "box-not-this-paste");
|
|
11262
12613
|
const shown = this.backend?.readSteerComposerText?.(before.pane)?.replace(/\s+/g, " ").trim();
|
|
11263
|
-
humanComposerOwned = !!humanAttempt && shown === (humanAttempt.marker ?? "[agend-human-id:" + humanAttempt.verificationId + "]");
|
|
12614
|
+
humanComposerOwned = !!humanAttempt && shown === (controlAlias ? controlMarker : humanAttempt.marker ?? "[agend-human-id:" + humanAttempt.verificationId + "]");
|
|
11264
12615
|
// …and so is the Enter: the key is sent only while the reading is still within it.
|
|
11265
12616
|
steerEnterDeadline = deadline;
|
|
11266
12617
|
}
|
|
@@ -11349,6 +12700,7 @@ export class Daemon extends EventEmitter {
|
|
|
11349
12700
|
: after === "queue" ? "composer-empty-queue" : "composer-empty-idle");
|
|
11350
12701
|
verdict.phase = steer ? "steer-accepted" : "composer-accepted";
|
|
11351
12702
|
verdict.proof = `${steer ? "steer" : "handoff"}-composer-${after}`;
|
|
12703
|
+
verdict.roomInputQueued = after === "queue";
|
|
11352
12704
|
if (status)
|
|
11353
12705
|
this.emit("message_confirmed", status); // ✅ taken from the box
|
|
11354
12706
|
return true;
|
|
@@ -11424,6 +12776,7 @@ export class Daemon extends EventEmitter {
|
|
|
11424
12776
|
if (verdict.handoff && !verdict.trackHandoff?.id)
|
|
11425
12777
|
this.dropQueuedHandoff(verdict);
|
|
11426
12778
|
verdict.handoff = undefined;
|
|
12779
|
+
verdict.roomInputQueued = false;
|
|
11427
12780
|
if (windowId && this.controlClient && !(await this.controlClient.waitUntilIdle(windowId))) {
|
|
11428
12781
|
verdict.phase = "native-queue-idle-wait";
|
|
11429
12782
|
verdict.proof = "idle-wait-failed";
|
|
@@ -12030,6 +13383,7 @@ export class Daemon extends EventEmitter {
|
|
|
12030
13383
|
// Grok cuts an echo to three rows, so the trailing message_id never shows after Enter; the marker always does.
|
|
12031
13384
|
// Placed after the strand checks: text of ours still in the box (or its collapsed paste) outranks it.
|
|
12032
13385
|
if (signature.takenMarker && after.inputReadable && this.backend?.readTakenMarkers?.(pane).includes(signature.takenMarker)) {
|
|
13386
|
+
signature.humanPositive?.("unique-id-pane");
|
|
12033
13387
|
return this.submittedProof();
|
|
12034
13388
|
}
|
|
12035
13389
|
// 2. Positive evidence. A unique signature needs no baseline: no earlier
|
|
@@ -12101,6 +13455,11 @@ export class Daemon extends EventEmitter {
|
|
|
12101
13455
|
* paste and once after, so confirmSubmitted can require a NEW marker or a NEW
|
|
12102
13456
|
* echo rather than accepting whatever was already there.
|
|
12103
13457
|
*/
|
|
13458
|
+
codexInputOccupied(pane) {
|
|
13459
|
+
const backend = this.backend, prompt = backend?.getBottomReadyPattern?.();
|
|
13460
|
+
return backend?.binaryName === "codex" && backend.ownsComposerRows?.(pane) === true && !!prompt
|
|
13461
|
+
&& strandedAgendMessageInInput(pane, prompt);
|
|
13462
|
+
}
|
|
12104
13463
|
async capturePaneEvidence(signature) {
|
|
12105
13464
|
if (!this.tmux)
|
|
12106
13465
|
return null;
|
|
@@ -12111,6 +13470,8 @@ export class Daemon extends EventEmitter {
|
|
|
12111
13470
|
try {
|
|
12112
13471
|
const pane = await this.tmux.capturePane();
|
|
12113
13472
|
const evidence = this.paneEvidence(pane, signature);
|
|
13473
|
+
if (this.codexInputOccupied(pane))
|
|
13474
|
+
evidence.unsubmittedAgendInput = true;
|
|
12114
13475
|
if (owner === this.tmux && window === owner.getWindowId?.() && spawn === this.spawnGeneration && fence === this.launchFenceEpoch && launch === this.launchAttempt) {
|
|
12115
13476
|
const counts = this.paneQuotaPatterns().map(ep => ({ key: Daemon.errorPatternKey(ep), count: Daemon.countOccurrences(ep.pattern, pane) }));
|
|
12116
13477
|
if (counts.length)
|
|
@@ -12118,10 +13479,7 @@ export class Daemon extends EventEmitter {
|
|
|
12118
13479
|
}
|
|
12119
13480
|
const input = this.inputRegion(pane);
|
|
12120
13481
|
if (input && agendMessageInInput(input.text)) {
|
|
12121
|
-
|
|
12122
|
-
// a single message. Nothing here can undo that; saying so beats
|
|
12123
|
-
// letting two messages silently merge.
|
|
12124
|
-
this.logger.warn("An unsubmitted message is already in the input row — this delivery will be appended to it");
|
|
13482
|
+
this.logger.warn("An unsubmitted message is already in the input row");
|
|
12125
13483
|
}
|
|
12126
13484
|
return evidence;
|
|
12127
13485
|
}
|
|
@@ -12459,11 +13817,17 @@ export class Daemon extends EventEmitter {
|
|
|
12459
13817
|
const current = () => lease.current() && lease.allowed(input.tool, input.args) && !this.deliveryWritesStopping && fence === this.launchFenceEpoch;
|
|
12460
13818
|
return new Promise(resolve => {
|
|
12461
13819
|
let settled = false;
|
|
13820
|
+
let call;
|
|
12462
13821
|
const finish = (value) => { if (settled)
|
|
12463
|
-
return; settled = true;
|
|
13822
|
+
return; settled = true; if (call)
|
|
13823
|
+
this.requestContextCalls.delete(call.id); clearTimeout(timer); resolve(value); };
|
|
12464
13824
|
const timer = setTimeout(() => finish({ result: null, error: "Pane tool result is unconfirmed; inspect its operation before retrying" }), daemonBudgetMs(input.tool) + 1000);
|
|
12465
13825
|
timer.unref?.();
|
|
12466
13826
|
try {
|
|
13827
|
+
const reply = lease.requestContext ? this.requestContextCapturedReply(lease.requestContext) : undefined;
|
|
13828
|
+
call = lease.requestContext ? Object.freeze({ id: randomUUID(), admission: lease.requestContext, get replyRoute() { return reply?.route(); }, waitForReplyRoute: reply?.wait, current: () => current() && (!reply || reply.current()) }) : undefined;
|
|
13829
|
+
if (call)
|
|
13830
|
+
this.requestContextCalls.set(call.id, call);
|
|
12467
13831
|
this.handleToolCall({ ...input, requestId: ++this.fleetRequestSeq }, undefined, {
|
|
12468
13832
|
current,
|
|
12469
13833
|
dispatch: (tool, args, respond) => {
|
|
@@ -12483,7 +13847,7 @@ export class Daemon extends EventEmitter {
|
|
|
12483
13847
|
...(typeof value.errorCode === "string" || typeof value.errorCode === "number" ? { errorCode: value.errorCode } : {}) });
|
|
12484
13848
|
return false;
|
|
12485
13849
|
},
|
|
12486
|
-
});
|
|
13850
|
+
}, call);
|
|
12487
13851
|
}
|
|
12488
13852
|
catch {
|
|
12489
13853
|
finish({ result: null, error: "Pane tool operation failed" });
|
|
@@ -12496,7 +13860,26 @@ export class Daemon extends EventEmitter {
|
|
|
12496
13860
|
return;
|
|
12497
13861
|
this.emit("mcp_tool_response_written", { operationId, daemonBootId: this.bootId });
|
|
12498
13862
|
}
|
|
12499
|
-
handleToolCall(msg, socket, peer) {
|
|
13863
|
+
handleToolCall(msg, socket, peer, originatingCall) {
|
|
13864
|
+
const finish = this.requestContextPendingWork?.begin(this.name);
|
|
13865
|
+
const dispatch = () => Daemon.prototype.handleTrackedToolCall.call(this, msg, socket, peer, originatingCall, finish);
|
|
13866
|
+
const expanded = originatingCall?.waitForReplyRoute ? expandReplyWaitCall(String(msg.tool), (msg.args ?? {})) : null;
|
|
13867
|
+
if (originatingCall?.waitForReplyRoute && expanded && !("error" in expanded) && ["reply", "edit_message", "react"].includes(expanded.name)) {
|
|
13868
|
+
// Submission proof progresses independently. No policy, adapter effect or
|
|
13869
|
+
// Fleet forward runs before this original call's delivery and arm settle.
|
|
13870
|
+
void originatingCall.waitForReplyRoute(daemonBudgetMs(expanded.name)).then(dispatch, dispatch).catch(() => finish?.());
|
|
13871
|
+
return;
|
|
13872
|
+
}
|
|
13873
|
+
try {
|
|
13874
|
+
dispatch();
|
|
13875
|
+
}
|
|
13876
|
+
catch (error) {
|
|
13877
|
+
finish?.();
|
|
13878
|
+
throw error;
|
|
13879
|
+
}
|
|
13880
|
+
}
|
|
13881
|
+
handleTrackedToolCall(msg, socket, peer, originatingCall, finish) {
|
|
13882
|
+
const runLocal = (work) => this.requestContextPendingWork ? this.requestContextPendingWork.run(this.name, work) : work();
|
|
12500
13883
|
const tool = msg.tool;
|
|
12501
13884
|
const args = (msg.args ?? {});
|
|
12502
13885
|
const requestId = msg.requestId;
|
|
@@ -12518,68 +13901,108 @@ export class Daemon extends EventEmitter {
|
|
|
12518
13901
|
: null;
|
|
12519
13902
|
// For now, log and respond. Full adapter routing will be wired in fleet manager.
|
|
12520
13903
|
const respond = (result, error, errorCode) => {
|
|
12521
|
-
|
|
12522
|
-
|
|
12523
|
-
|
|
12524
|
-
|
|
12525
|
-
|
|
12526
|
-
|
|
12527
|
-
|
|
12528
|
-
//
|
|
12529
|
-
|
|
12530
|
-
|
|
12531
|
-
this.
|
|
12532
|
-
|
|
12533
|
-
|
|
12534
|
-
|
|
12535
|
-
|
|
12536
|
-
|
|
12537
|
-
|
|
12538
|
-
|
|
12539
|
-
// replyGuardIdleConfirm is null) or at the next busy→idle edge.
|
|
12540
|
-
// Cancelled turns are excluded: their completion semantics are handled
|
|
12541
|
-
// by the idle edge's cancelledByUser check.
|
|
12542
|
-
// An older reply that satisfied an earlier obligation but not the latest
|
|
12543
|
-
// one (latestObligation > token.obligation) leaves completionDelivered
|
|
12544
|
-
// false and must not clear the window either.
|
|
12545
|
-
if (replyAttempt?.completionAction) {
|
|
12546
|
-
const snap = this.turnReplyGuard.snapshot();
|
|
12547
|
-
// generation 0 is a pre-arm token applied to the live generation (#2544).
|
|
12548
|
-
if (snap && (snap.generation === replyAttempt.generation || replyAttempt.generation === 0)
|
|
12549
|
-
&& snap.phase === "awaiting"
|
|
12550
|
-
&& snap.completionDelivered && !snap.cancelledByUser) {
|
|
12551
|
-
this.clearReplyGuardConfirm();
|
|
13904
|
+
try {
|
|
13905
|
+
if (originatingCall && !originatingCall.current()) {
|
|
13906
|
+
result = null;
|
|
13907
|
+
error = `Tool outcome is unconfirmed. ${operationId ? `Inspect operation ${operationId}` : "Inspect the tool operation status"}; do not repeat it.`;
|
|
13908
|
+
}
|
|
13909
|
+
if (originatingCall)
|
|
13910
|
+
this.requestContextCalls.delete(originatingCall.id);
|
|
13911
|
+
// A message that verifiably went out stands down the dead-MCP proxy reply
|
|
13912
|
+
// for this turn: the agent proved it can still speak for itself.
|
|
13913
|
+
if (!error && result != null && TURN_OUTBOUND_TOOLS.has(tool)) {
|
|
13914
|
+
this.turnReplyGuard.settleToolAttempt(replyAttempt, true);
|
|
13915
|
+
// #1209 P2: the user got an answer — the turn is over for resume
|
|
13916
|
+
// purposes even before the idle edge completes the guard. Without
|
|
13917
|
+
// this, a restart in the reply-to-idle window would re-inject a
|
|
13918
|
+
// continuation for an already-answered turn.
|
|
13919
|
+
if (replyAttempt?.completionAction) {
|
|
13920
|
+
clearInFlightTurnMarker(this.instanceDir);
|
|
13921
|
+
this.publishWorkingState("completion_delivered");
|
|
12552
13922
|
}
|
|
13923
|
+
// #1377: a confirmed completion action (reply/react/edit_message) ends
|
|
13924
|
+
// the human-facing obligation immediately — the idle edge does not need
|
|
13925
|
+
// to confirm it. Clear any pending confirmation window so a later
|
|
13926
|
+
// cross-instance busy→idle cycle cannot re-arm and fire false recovery.
|
|
13927
|
+
// The guard itself completes on the next steady-idle tick via
|
|
13928
|
+
// maybeConfirmReplyGuardIdle (which checks completionDelivered when
|
|
13929
|
+
// replyGuardIdleConfirm is null) or at the next busy→idle edge.
|
|
13930
|
+
// Cancelled turns are excluded: their completion semantics are handled
|
|
13931
|
+
// by the idle edge's cancelledByUser check.
|
|
13932
|
+
// An older reply that satisfied an earlier obligation but not the latest
|
|
13933
|
+
// one (latestObligation > token.obligation) leaves completionDelivered
|
|
13934
|
+
// false and must not clear the window either.
|
|
13935
|
+
if (replyAttempt?.completionAction) {
|
|
13936
|
+
const snap = this.turnReplyGuard.snapshot();
|
|
13937
|
+
// generation 0 is a pre-arm token applied to the live generation (#2544).
|
|
13938
|
+
if (snap && (snap.generation === replyAttempt.generation || replyAttempt.generation === 0)
|
|
13939
|
+
&& snap.phase === "awaiting"
|
|
13940
|
+
&& snap.completionDelivered && !snap.cancelledByUser) {
|
|
13941
|
+
this.clearReplyGuardConfirm();
|
|
13942
|
+
}
|
|
13943
|
+
}
|
|
13944
|
+
}
|
|
13945
|
+
else if ((error || result == null) && replyAttempt?.reply && TURN_OUTBOUND_TOOLS.has(tool)) {
|
|
13946
|
+
// #1377: the adapter returned a definitive error — record this so the
|
|
13947
|
+
// confirm window can distinguish "in-flight" (unknown) from "known
|
|
13948
|
+
// failed" and report unknown immediately rather than starting recovery.
|
|
13949
|
+
this.turnReplyGuard.settleToolAttempt(replyAttempt, false);
|
|
13950
|
+
}
|
|
13951
|
+
const packet = { requestId, result, error, operationId, ...(errorCode !== undefined ? { errorCode } : {}) };
|
|
13952
|
+
const sent = peer ? peer.current() && peer.send(packet) : socket ? this.ipcServer?.send(socket, packet) ?? false : false;
|
|
13953
|
+
if (!sent) {
|
|
13954
|
+
if (peer)
|
|
13955
|
+
this.logger.debug({ tool, requestId }, "Native MCP result awaits transport-written confirmation");
|
|
13956
|
+
else
|
|
13957
|
+
this.logger.warn({ tool, requestId }, "Tool result could not be returned — originating MCP socket is closed");
|
|
13958
|
+
}
|
|
13959
|
+
else if (operationId) {
|
|
13960
|
+
this.emit("mcp_tool_response_written", { operationId, daemonBootId: this.bootId });
|
|
12553
13961
|
}
|
|
12554
13962
|
}
|
|
12555
|
-
|
|
12556
|
-
|
|
12557
|
-
// confirm window can distinguish "in-flight" (unknown) from "known
|
|
12558
|
-
// failed" and report unknown immediately rather than starting recovery.
|
|
12559
|
-
this.turnReplyGuard.settleToolAttempt(replyAttempt, false);
|
|
13963
|
+
finally {
|
|
13964
|
+
finish?.();
|
|
12560
13965
|
}
|
|
12561
|
-
|
|
12562
|
-
|
|
12563
|
-
if (!
|
|
12564
|
-
|
|
12565
|
-
|
|
13966
|
+
};
|
|
13967
|
+
const sendFleet = (message) => {
|
|
13968
|
+
if (originatingCall && !originatingCall.current()) {
|
|
13969
|
+
const id = String(message.fleetRequestId ?? ""), callback = this.pendingIpcRequests.get(id);
|
|
13970
|
+
this.pendingIpcRequests.delete(id);
|
|
13971
|
+
if (callback)
|
|
13972
|
+
callback({ error: "Originating request context is no longer current" });
|
|
12566
13973
|
else
|
|
12567
|
-
|
|
12568
|
-
|
|
12569
|
-
else if (operationId) {
|
|
12570
|
-
this.emit("mcp_tool_response_written", { operationId, daemonBootId: this.bootId });
|
|
13974
|
+
respond(null, "Originating request context is no longer current");
|
|
13975
|
+
return;
|
|
12571
13976
|
}
|
|
13977
|
+
this.broadcastFleetMessage(originatingCall ? { ...message, requestContextCallId: originatingCall.id, sourceDaemonBootId: this.bootId } : message);
|
|
12572
13978
|
};
|
|
13979
|
+
try {
|
|
13980
|
+
if (this.requestContextPolicy)
|
|
13981
|
+
requireRequestContextPolicy(this, this.name, tool, args, originatingCall?.admission, originatingCall?.replyRoute);
|
|
13982
|
+
}
|
|
13983
|
+
catch (error) {
|
|
13984
|
+
respond(null, error.message);
|
|
13985
|
+
return;
|
|
13986
|
+
}
|
|
13987
|
+
if (this.requestContextLifecycle && !peer && !originatingCall || originatingCall && !originatingCall.current()) {
|
|
13988
|
+
respond(null, "Originating request context is unavailable");
|
|
13989
|
+
return;
|
|
13990
|
+
}
|
|
13991
|
+
// These local shell mutations have no scoped admission boundary yet (F); never imply coverage.
|
|
13992
|
+
if (originatingCall && (tool === "checkout_repo" || tool === "release_repo")) {
|
|
13993
|
+
respond(null, "This operation is not covered by request-context admission");
|
|
13994
|
+
return;
|
|
13995
|
+
}
|
|
12573
13996
|
// Native Fleet/task operations carry their lease to the existing dispatcher mutation admission points.
|
|
12574
13997
|
if (peer?.dispatch?.(tool, args, respond))
|
|
12575
13998
|
return;
|
|
12576
13999
|
// Repo checkout — handled locally in daemon (no fleet-manager)
|
|
12577
14000
|
if (tool === "checkout_repo") {
|
|
12578
|
-
this.handleCheckoutRepo(args, respond);
|
|
14001
|
+
void runLocal(() => this.handleCheckoutRepo(args, respond));
|
|
12579
14002
|
return;
|
|
12580
14003
|
}
|
|
12581
14004
|
if (tool === "release_repo") {
|
|
12582
|
-
this.handleReleaseRepo(args, respond);
|
|
14005
|
+
void runLocal(() => this.handleReleaseRepo(args, respond));
|
|
12583
14006
|
return;
|
|
12584
14007
|
}
|
|
12585
14008
|
if (tool === "set_display_name" || tool === "set_description" || tool === "list_emojis" || tool === "set_persona_emoji" || tool === "preview_emojis"
|
|
@@ -12601,7 +14024,7 @@ export class Daemon extends EventEmitter {
|
|
|
12601
14024
|
clearTimeout(timeout);
|
|
12602
14025
|
respond(respMsg.result, respMsg.error);
|
|
12603
14026
|
});
|
|
12604
|
-
|
|
14027
|
+
sendFleet({
|
|
12605
14028
|
type,
|
|
12606
14029
|
payload: args,
|
|
12607
14030
|
meta: { instance_name: this.name },
|
|
@@ -12627,9 +14050,9 @@ export class Daemon extends EventEmitter {
|
|
|
12627
14050
|
clearTimeout(timeout);
|
|
12628
14051
|
resolve({ result: respMsg.result, error: respMsg.error });
|
|
12629
14052
|
});
|
|
12630
|
-
|
|
14053
|
+
sendFleet({ type: WEB_THEME_IPC[tool], payload, meta: { instance_name: this.name }, fleetRequestId: fleetReqId });
|
|
12631
14054
|
});
|
|
12632
|
-
void (async () => {
|
|
14055
|
+
void runLocal(async () => {
|
|
12633
14056
|
if (tool === "preview_web_appearance") {
|
|
12634
14057
|
// The fleet builds the SVGs (whole, or in parts); they are written here, in the working directory.
|
|
12635
14058
|
const first = await ask({ ...(args.modes !== undefined ? { modes: args.modes } : {}) });
|
|
@@ -12691,25 +14114,37 @@ export class Daemon extends EventEmitter {
|
|
|
12691
14114
|
return (r.result && typeof r.result === "object" ? r.result : {});
|
|
12692
14115
|
});
|
|
12693
14116
|
reply(failed ? null : answer, failed);
|
|
12694
|
-
})
|
|
14117
|
+
}).catch((err) => reply(null, `${tool} failed: ${err instanceof Error ? err.message : "error"}`));
|
|
12695
14118
|
return;
|
|
12696
14119
|
}
|
|
12697
14120
|
if (tool === TASK_TOOL) {
|
|
12698
|
-
|
|
12699
|
-
const
|
|
12700
|
-
this.
|
|
12701
|
-
|
|
12702
|
-
|
|
12703
|
-
|
|
12704
|
-
|
|
12705
|
-
|
|
12706
|
-
|
|
12707
|
-
|
|
12708
|
-
|
|
12709
|
-
|
|
12710
|
-
|
|
12711
|
-
|
|
14121
|
+
// One call to the fleet's task tool; resolves with its answer or an error string (never rejects).
|
|
14122
|
+
const askTask = (payload) => new Promise((resolve) => {
|
|
14123
|
+
const fleetReqId = `task_${++this.fleetRequestSeq}_${requestId}`;
|
|
14124
|
+
const timeout = setTimeout(() => {
|
|
14125
|
+
this.pendingIpcRequests.delete(fleetReqId);
|
|
14126
|
+
resolve({ error: `Task operation timed out after ${daemonBudgetMs(tool) / 1000}s` });
|
|
14127
|
+
}, daemonBudgetMs(tool));
|
|
14128
|
+
this.pendingIpcRequests.set(fleetReqId, (respMsg) => {
|
|
14129
|
+
clearTimeout(timeout);
|
|
14130
|
+
resolve({ result: respMsg.result, error: respMsg.error });
|
|
14131
|
+
});
|
|
14132
|
+
sendFleet({
|
|
14133
|
+
type: "fleet_task",
|
|
14134
|
+
payload,
|
|
14135
|
+
meta: { instance_name: this.name },
|
|
14136
|
+
fleetRequestId: fleetReqId,
|
|
14137
|
+
});
|
|
12712
14138
|
});
|
|
14139
|
+
// files named in `attach` are read HERE, on the agent's side (its working directory, no symlink, size-capped),
|
|
14140
|
+
// and staged on the fleet in parts; the write itself then carries their ids. The fleet never opens a workspace path.
|
|
14141
|
+
void runLocal(async () => {
|
|
14142
|
+
const sent = await sendTaskWrite(args, { workspace: this.config.working_directory, configuredWorkspace: this.config.working_directory, stateDir: getAgendHome(), instance: this.name }, askTask);
|
|
14143
|
+
if (sent.staging)
|
|
14144
|
+
respond(null, sent.error);
|
|
14145
|
+
else
|
|
14146
|
+
respond(sent.answer.result, sent.answer.error);
|
|
14147
|
+
}).catch((err) => respond(null, `task failed: ${err instanceof Error ? err.message : "error"}`));
|
|
12713
14148
|
return;
|
|
12714
14149
|
}
|
|
12715
14150
|
if (DECISION_TOOLS.has(tool)) {
|
|
@@ -12727,7 +14162,7 @@ export class Daemon extends EventEmitter {
|
|
|
12727
14162
|
clearTimeout(timeout);
|
|
12728
14163
|
respond(respMsg.result, respMsg.error);
|
|
12729
14164
|
});
|
|
12730
|
-
|
|
14165
|
+
sendFleet({
|
|
12731
14166
|
type: typeMap[tool],
|
|
12732
14167
|
payload: args,
|
|
12733
14168
|
meta: { instance_name: this.name, working_directory: this.config.working_directory },
|
|
@@ -12754,7 +14189,7 @@ export class Daemon extends EventEmitter {
|
|
|
12754
14189
|
clearTimeout(timeout);
|
|
12755
14190
|
respond(respMsg.result, respMsg.error);
|
|
12756
14191
|
});
|
|
12757
|
-
|
|
14192
|
+
sendFleet({
|
|
12758
14193
|
type: typeMap[tool],
|
|
12759
14194
|
payload: args,
|
|
12760
14195
|
meta: {
|
|
@@ -12785,11 +14220,11 @@ export class Daemon extends EventEmitter {
|
|
|
12785
14220
|
clearTimeout(timeout);
|
|
12786
14221
|
respond(respMsg.result, respMsg.error);
|
|
12787
14222
|
});
|
|
12788
|
-
|
|
14223
|
+
sendFleet({
|
|
12789
14224
|
type: "fleet_outbound",
|
|
12790
14225
|
tool,
|
|
12791
14226
|
args,
|
|
12792
|
-
...(operationId ? { operationId, sourceDaemonBootId: this.bootId } : {}),
|
|
14227
|
+
...((operationId || (tool.startsWith("hub_room_") || tool === "hub_people_search")) ? { ...(operationId ? { operationId } : {}), sourceDaemonBootId: this.bootId } : {}),
|
|
12793
14228
|
fleetRequestId: fleetReqId,
|
|
12794
14229
|
senderSessionName,
|
|
12795
14230
|
});
|
|
@@ -12802,7 +14237,19 @@ export class Daemon extends EventEmitter {
|
|
|
12802
14237
|
// Context-bound routing: reply/react/edit_message always use the daemon's last known context.
|
|
12803
14238
|
// chat_id and thread_id are not exposed in the tool schema — daemon is solely responsible for routing.
|
|
12804
14239
|
// Must run before IPC forwarding so topic-mode (fleet manager) also receives the correct chat_id.
|
|
12805
|
-
|
|
14240
|
+
const ownedReplyRoute = this.requestContextPolicy && ["reply", "react", "edit_message"].includes(tool) ? originatingCall?.replyRoute : undefined;
|
|
14241
|
+
if (ownedReplyRoute) {
|
|
14242
|
+
if (!ownedReplyRoute.current()) {
|
|
14243
|
+
respond(null, "Originating request context is no longer current");
|
|
14244
|
+
return;
|
|
14245
|
+
}
|
|
14246
|
+
args.chat_id = ownedReplyRoute.target.chatId;
|
|
14247
|
+
if (ownedReplyRoute.target.threadId)
|
|
14248
|
+
args.thread_id = ownedReplyRoute.target.threadId;
|
|
14249
|
+
else
|
|
14250
|
+
delete args.thread_id;
|
|
14251
|
+
}
|
|
14252
|
+
if (!ownedReplyRoute && ["reply", "react", "edit_message"].includes(tool)) {
|
|
12806
14253
|
const adapters = this.messageBus.getAllAdapters();
|
|
12807
14254
|
const isTopicMode = adapters.length === 0;
|
|
12808
14255
|
if (!this.lastChatId && !isTopicMode) {
|
|
@@ -12844,7 +14291,7 @@ export class Daemon extends EventEmitter {
|
|
|
12844
14291
|
// Register the waiter before broadcasting. A fast/mock adapter can settle
|
|
12845
14292
|
// immediately; broadcasting first left a response-before-registration
|
|
12846
14293
|
// window that degraded into a timeout despite a completed POST.
|
|
12847
|
-
|
|
14294
|
+
sendFleet({
|
|
12848
14295
|
type: "fleet_outbound",
|
|
12849
14296
|
tool,
|
|
12850
14297
|
args,
|
|
@@ -12853,15 +14300,16 @@ export class Daemon extends EventEmitter {
|
|
|
12853
14300
|
// Preserve the exact adapter world that supplied the chat context. An
|
|
12854
14301
|
// instance binding is only a fallback: persisted/runtime context can be
|
|
12855
14302
|
// from a secondary world, and message ids are not portable across bots.
|
|
12856
|
-
adapterId: this.lastAdapterId,
|
|
14303
|
+
adapterId: ownedReplyRoute ? ownedReplyRoute.target.adapterId : this.lastAdapterId,
|
|
12857
14304
|
});
|
|
12858
14305
|
return;
|
|
12859
14306
|
}
|
|
12860
14307
|
// Same rule as deliverDaemonReply: one adapter is unambiguous, several with
|
|
12861
14308
|
// no bound world is a routing failure rather than a first-wins guess.
|
|
12862
|
-
const
|
|
12863
|
-
|
|
12864
|
-
|
|
14309
|
+
const selectedAdapter = ownedReplyRoute ? ownedReplyRoute.target.adapterId : this.lastAdapterId;
|
|
14310
|
+
const adapter = selectedAdapter
|
|
14311
|
+
? this.messageBus.getAdapter(selectedAdapter) ?? (!ownedReplyRoute && adapters.length === 1 ? adapters[0] : undefined)
|
|
14312
|
+
: (!ownedReplyRoute && adapters.length === 1 ? adapters[0] : undefined);
|
|
12865
14313
|
if (!adapter) {
|
|
12866
14314
|
respond(null, "No channel world bound to this chat context — awaiting an inbound message to establish it");
|
|
12867
14315
|
return;
|
|
@@ -12884,7 +14332,8 @@ export class Daemon extends EventEmitter {
|
|
|
12884
14332
|
delete routed.buttons;
|
|
12885
14333
|
}
|
|
12886
14334
|
}
|
|
12887
|
-
if (!routeToolCall(adapter, tool, routed, this.lastThreadId, respond))
|
|
14335
|
+
if (!routeToolCall(adapter, tool, routed, ownedReplyRoute ? ownedReplyRoute.target.threadId : this.lastThreadId, respond, ownedReplyRoute ? { beforeSend: () => { if (!originatingCall?.current() || !ownedReplyRoute.current() || !selectedAdapter || this.messageBus.getAdapter(selectedAdapter) !== adapter)
|
|
14336
|
+
throw Error("Originating request context is no longer current"); } } : {})) {
|
|
12888
14337
|
respond(null, `Unknown tool: ${tool}`);
|
|
12889
14338
|
}
|
|
12890
14339
|
}
|
|
@@ -12909,7 +14358,7 @@ export class Daemon extends EventEmitter {
|
|
|
12909
14358
|
};
|
|
12910
14359
|
}
|
|
12911
14360
|
/** Build config object for the CLI backend */
|
|
12912
|
-
buildBackendConfig() {
|
|
14361
|
+
buildBackendConfig(forLaunch = true) {
|
|
12913
14362
|
// Antigravity 1.1.17 has no per-workspace MCP config, but its global MCP
|
|
12914
14363
|
// children inherit the CLI process environment. The backend installs one
|
|
12915
14364
|
// environment-selecting launcher, so MCP is now the safe default here too.
|
|
@@ -12988,6 +14437,11 @@ export class Daemon extends EventEmitter {
|
|
|
12988
14437
|
? resolveToolSet(this.config, this.name, "general")
|
|
12989
14438
|
: resolveToolSet(this.config, this.name);
|
|
12990
14439
|
mcpEnv.AGEND_TOOL_SET = toolSet;
|
|
14440
|
+
if (this.classicRestriction)
|
|
14441
|
+
mcpEnv.AGEND_CLASSIC_ALLOWED_TOOLS = JSON.stringify(this.classicRestriction.allowedAgendTools);
|
|
14442
|
+
const helperLaunch = this.requestContextHelper?.environment();
|
|
14443
|
+
if (helperLaunch)
|
|
14444
|
+
mcpEnv.AGEND_LAUNCH_TOKEN = helperLaunch;
|
|
12991
14445
|
// The dashboard features the person switched off: out of the tool menu from this start (the fleet refuses them
|
|
12992
14446
|
// at once, whatever the menu still shows).
|
|
12993
14447
|
const dashboardOff = dashboardFeaturesOff(dashboardAccessOf(this.config));
|
|
@@ -13024,13 +14478,17 @@ export class Daemon extends EventEmitter {
|
|
|
13024
14478
|
}
|
|
13025
14479
|
catch { /* fallback to empty */ }
|
|
13026
14480
|
instructions = buildFleetInstructions({
|
|
14481
|
+
...(requestContextInstructionMode(this.requestContextPolicy) !== null && this.requestContextLifecycle && (!this.nativePaneLifecycle || this.nativePaneLifecycle.requestContextAvailable?.() === true)
|
|
14482
|
+
? { requestContextPolicyInstalled: true } : {}),
|
|
13027
14483
|
instanceName: this.name,
|
|
13028
14484
|
taskBoard: !dashboardOff.includes("task_board"),
|
|
13029
14485
|
workingDirectory: this.config.working_directory,
|
|
13030
14486
|
runtimeIdentity: this.runtimeIdentity,
|
|
14487
|
+
restrictedClassic: !!this.classicRestriction,
|
|
13031
14488
|
displayName: this.config.display_name,
|
|
13032
14489
|
description: this.config.description,
|
|
13033
14490
|
customPrompt: resolvedCustomPrompt,
|
|
14491
|
+
operations: this.config.operations,
|
|
13034
14492
|
workflow: resolvedWorkflow,
|
|
13035
14493
|
decisions,
|
|
13036
14494
|
statusEmojis,
|
|
@@ -13039,13 +14497,17 @@ export class Daemon extends EventEmitter {
|
|
|
13039
14497
|
}
|
|
13040
14498
|
else {
|
|
13041
14499
|
instructions = buildFleetInstructions({
|
|
14500
|
+
...(requestContextInstructionMode(this.requestContextPolicy) !== null && this.requestContextLifecycle && (!this.nativePaneLifecycle || this.nativePaneLifecycle.requestContextAvailable?.() === true)
|
|
14501
|
+
? { requestContextPolicyInstalled: true } : {}),
|
|
13042
14502
|
instanceName: this.name,
|
|
13043
14503
|
taskBoard: !dashboardOff.includes("task_board"),
|
|
13044
14504
|
workingDirectory: this.config.working_directory,
|
|
13045
14505
|
runtimeIdentity: this.runtimeIdentity,
|
|
14506
|
+
restrictedClassic: !!this.classicRestriction,
|
|
13046
14507
|
displayName: this.config.display_name,
|
|
13047
14508
|
description: this.config.description,
|
|
13048
14509
|
customPrompt: resolvedCustomPrompt,
|
|
14510
|
+
operations: this.config.operations,
|
|
13049
14511
|
workflow: resolvedWorkflow,
|
|
13050
14512
|
decisions,
|
|
13051
14513
|
statusEmojis,
|
|
@@ -13054,7 +14516,11 @@ export class Daemon extends EventEmitter {
|
|
|
13054
14516
|
const agentPort = parseInt(process.env.AGEND_PORT ?? "19280", 10);
|
|
13055
14517
|
const backendName = this.config.backend ?? "claude-code";
|
|
13056
14518
|
const backendOptions = this.config.backend_options?.[backendName];
|
|
14519
|
+
const managedClaudeCredential = forLaunch && backendName === "claude-code"
|
|
14520
|
+
? managedClaudeBinding(resolve(this.instanceDir, "..", ".."), resolveCredentialProfile(backendOptions)) : null;
|
|
13057
14521
|
return {
|
|
14522
|
+
...(managedClaudeCredential ? { managedClaudeCredential } : {}),
|
|
14523
|
+
...(this.classicRestriction ? { classicRestriction: this.classicRestriction } : {}),
|
|
13058
14524
|
workingDirectory: this.config.working_directory,
|
|
13059
14525
|
instanceDir: this.instanceDir,
|
|
13060
14526
|
instanceName: this.name,
|
|
@@ -13168,6 +14634,7 @@ export class Daemon extends EventEmitter {
|
|
|
13168
14634
|
this.humanReminderAttempts?.clear();
|
|
13169
14635
|
this.cliOomObservation = null;
|
|
13170
14636
|
this.spawnGeneration++;
|
|
14637
|
+
this.requestContextAdmission?.changed();
|
|
13171
14638
|
this.interactionObservation.reset(this.interactionOwner());
|
|
13172
14639
|
this.clearInteractionConfirmation();
|
|
13173
14640
|
this.inputTransientGuardGeneration = (this.backend?.getInputUnavailableTransients?.().length ?? 0) > 0
|
|
@@ -13549,6 +15016,8 @@ export class Daemon extends EventEmitter {
|
|
|
13549
15016
|
finally {
|
|
13550
15017
|
this.endSpawn();
|
|
13551
15018
|
}
|
|
15019
|
+
if (!resumedSuccessfully)
|
|
15020
|
+
this.requestContextNewWork("fresh");
|
|
13552
15021
|
return resumedSuccessfully;
|
|
13553
15022
|
}
|
|
13554
15023
|
/** The whole agent switch after a resume, on the monotonic clock (#906 §3). */
|
|
@@ -14016,6 +15485,7 @@ export class Daemon extends EventEmitter {
|
|
|
14016
15485
|
if (this.startupAborted)
|
|
14017
15486
|
return;
|
|
14018
15487
|
this.startupAborted = true;
|
|
15488
|
+
this.requestContextHelper?.revoke();
|
|
14019
15489
|
this.freezeRuntimeMonitors();
|
|
14020
15490
|
this.pendingIpcRequests.clear();
|
|
14021
15491
|
if (this.museUsageRelay) {
|
|
@@ -14432,12 +15902,20 @@ export class Daemon extends EventEmitter {
|
|
|
14432
15902
|
if (this.nativePaneLifecycle)
|
|
14433
15903
|
throw Error("Native relaunch requires its owned exit and a new lifecycle reservation");
|
|
14434
15904
|
let expectedAttempt = this.launchAttempt;
|
|
14435
|
-
const
|
|
14436
|
-
|
|
15905
|
+
const restrictionStamp = this.classicRestriction ? classicPlanDigest(this.classicRestriction) : null;
|
|
15906
|
+
const admit = () => {
|
|
15907
|
+
this.startupAdmission?.();
|
|
15908
|
+
this.assertClassicRestrictionLaunch(restrictionStamp);
|
|
15909
|
+
if (repairAdmission && !repairAdmission(expectedAttempt))
|
|
15910
|
+
throw new Error("CLI repair superseded by another launch, pause or stop");
|
|
15911
|
+
};
|
|
14437
15912
|
this.assertSessionOomAdmission();
|
|
14438
15913
|
admit();
|
|
14439
15914
|
const launchFence = this.launchFenceEpoch;
|
|
14440
|
-
const
|
|
15915
|
+
const helperLaunch = this.requestContextHelper?.begin();
|
|
15916
|
+
const backendConfig = this.buildBackendConfig(true);
|
|
15917
|
+
if (this.classicRestrictionFailed)
|
|
15918
|
+
throw Error("Restricted room policy is unavailable");
|
|
14441
15919
|
// A compatibility refusal is not a failed resume: no configuration, pin, history or pane may change.
|
|
14442
15920
|
if (this.backend?.assertLaunchSupported) {
|
|
14443
15921
|
this.backend.assertLaunchSupported(backendConfig);
|
|
@@ -14467,6 +15945,7 @@ export class Daemon extends EventEmitter {
|
|
|
14467
15945
|
if (launchFence !== this.launchFenceEpoch)
|
|
14468
15946
|
throw new Error("Launch cancelled: the instance was stopped or paused while the launch was being prepared");
|
|
14469
15947
|
this.backend.writeConfig(backendConfig);
|
|
15948
|
+
this.classicRestrictionNeedsRestart = false;
|
|
14470
15949
|
if (freshInboundInstructions)
|
|
14471
15950
|
this.installCompactInboundInstructions();
|
|
14472
15951
|
else {
|
|
@@ -14475,6 +15954,7 @@ export class Daemon extends EventEmitter {
|
|
|
14475
15954
|
this.resetInboundPresentation();
|
|
14476
15955
|
}
|
|
14477
15956
|
this.backend.preTrust?.(this.config.working_directory, backendConfig);
|
|
15957
|
+
this.checkClaudeMcpServers(backendConfig);
|
|
14478
15958
|
// Resolve working directory (e.g. symlink for hidden paths)
|
|
14479
15959
|
const resolvedCwd = this.backend.resolveWorkingDirectory?.(this.config.working_directory, this.name) ?? this.config.working_directory;
|
|
14480
15960
|
// Generate a fresh per-instance agent token each spawn. agent-cli reads
|
|
@@ -14562,20 +16042,42 @@ export class Daemon extends EventEmitter {
|
|
|
14562
16042
|
admit();
|
|
14563
16043
|
let windowId;
|
|
14564
16044
|
this.assertSessionOomAdmission();
|
|
14565
|
-
|
|
14566
|
-
|
|
14567
|
-
|
|
14568
|
-
|
|
16045
|
+
const retirementResources = this.requestContextStartupResources;
|
|
16046
|
+
if (retirementResources)
|
|
16047
|
+
retirementResources.pending++;
|
|
16048
|
+
try {
|
|
16049
|
+
if (reuseWindow) {
|
|
16050
|
+
this.controlClient?.unregisterWindow(this.tmux.getWindowId());
|
|
16051
|
+
await this.tmux.respawnWindow(cmd, resolvedCwd, repairAdmission ? admit : undefined);
|
|
16052
|
+
windowId = this.tmux.getWindowId();
|
|
16053
|
+
}
|
|
16054
|
+
else {
|
|
16055
|
+
// A crash respawn makes a brand new window. The dead one stays registered
|
|
16056
|
+
// unless we say so — the respawn branch above already does.
|
|
16057
|
+
const retired = this.tmux.getWindowId();
|
|
16058
|
+
windowId = await this.tmux.createWindow(cmd, resolvedCwd, this.name);
|
|
16059
|
+
if (retired && retired !== windowId)
|
|
16060
|
+
this.controlClient?.unregisterWindow(retired);
|
|
16061
|
+
}
|
|
16062
|
+
if (retirementResources) {
|
|
16063
|
+
const pid = await this.paneHost.getPanePid(this.tmuxSessionName, windowId);
|
|
16064
|
+
if (!pid || !Number.isSafeInteger(pid) || pid <= 1)
|
|
16065
|
+
throw Error("Request startup process identity unavailable");
|
|
16066
|
+
retirementResources.windows.push({ session: this.tmuxSessionName, window: windowId, pid });
|
|
16067
|
+
}
|
|
14569
16068
|
}
|
|
14570
|
-
|
|
14571
|
-
|
|
14572
|
-
|
|
14573
|
-
|
|
14574
|
-
|
|
14575
|
-
|
|
14576
|
-
|
|
16069
|
+
catch (error) {
|
|
16070
|
+
if (retirementResources)
|
|
16071
|
+
retirementResources.unknown = true;
|
|
16072
|
+
throw error;
|
|
16073
|
+
}
|
|
16074
|
+
finally {
|
|
16075
|
+
if (retirementResources)
|
|
16076
|
+
retirementResources.pending--;
|
|
14577
16077
|
}
|
|
14578
16078
|
admit();
|
|
16079
|
+
if (helperLaunch)
|
|
16080
|
+
this.requestContextHelper.confirm(helperLaunch);
|
|
14579
16081
|
this.writeWindowId(windowId);
|
|
14580
16082
|
// Enable remain-on-exit to capture exit codes on crash
|
|
14581
16083
|
await this.tmux.setRemainOnExit().catch(err => {
|
|
@@ -15041,11 +16543,41 @@ export class Daemon extends EventEmitter {
|
|
|
15041
16543
|
this.lastIdleSessionRefreshAt = now;
|
|
15042
16544
|
void refresh.call(this.backend).then(() => this.saveSessionId(), () => { });
|
|
15043
16545
|
}
|
|
16546
|
+
roomConversationState = null;
|
|
16547
|
+
roomConversationGeneration() {
|
|
16548
|
+
try {
|
|
16549
|
+
// Local non-Claude backends checkpoint their own session below; do not replace it with a Claude-only field.
|
|
16550
|
+
if (this.nativePaneLifecycle || (this.config.backend ?? "claude-code") === "claude-code")
|
|
16551
|
+
this.roomConversationState?.observeSession(this.ownedWorkingSession);
|
|
16552
|
+
}
|
|
16553
|
+
catch (err) {
|
|
16554
|
+
this.logger.warn({ err }, "Room conversation checkpoint failed");
|
|
16555
|
+
return null;
|
|
16556
|
+
}
|
|
16557
|
+
return this.roomConversationState?.current() ?? null;
|
|
16558
|
+
}
|
|
16559
|
+
resetRoomConversation(reattached = false) {
|
|
16560
|
+
this.roomConversationState ??= new RoomConversationGeneration(this.instanceDir);
|
|
16561
|
+
try {
|
|
16562
|
+
this.roomConversationState.start(reattached);
|
|
16563
|
+
}
|
|
16564
|
+
catch (err) {
|
|
16565
|
+
this.logger.warn({ err }, "Room conversation generation is unconfirmed");
|
|
16566
|
+
}
|
|
16567
|
+
}
|
|
16568
|
+
roomInputHandedOff(meta) {
|
|
16569
|
+
const generation = meta.hub_room_context_generation;
|
|
16570
|
+
if (meta.from_instance !== HUB_REPORT_TARGET || !generation || generation !== this.roomConversationGeneration())
|
|
16571
|
+
return;
|
|
16572
|
+
this.hubRoomInputEpoch++;
|
|
16573
|
+
this.broadcastFleetMessage({ type: "hub_room_input", correlationId: meta.correlation_id, generation });
|
|
16574
|
+
}
|
|
15044
16575
|
saveSessionId() {
|
|
15045
16576
|
if (this.nativePaneLifecycle) {
|
|
15046
16577
|
try {
|
|
15047
16578
|
this.nativePaneLifecycle.checkpointSession();
|
|
15048
16579
|
this.ownedWorkingSession = this.backend?.getSessionId() ?? null;
|
|
16580
|
+
this.roomConversationState?.observeSession(this.ownedWorkingSession);
|
|
15049
16581
|
}
|
|
15050
16582
|
catch (err) {
|
|
15051
16583
|
this.logger.warn({ err }, "Native conversation checkpoint is unconfirmed");
|
|
@@ -15060,6 +16592,7 @@ export class Daemon extends EventEmitter {
|
|
|
15060
16592
|
const sid = this.backend?.getSessionId();
|
|
15061
16593
|
if (!sid)
|
|
15062
16594
|
return;
|
|
16595
|
+
this.roomConversationState?.observeSession(sid);
|
|
15063
16596
|
if ((this.config.backend ?? "claude-code") === "claude-code" && Buffer.byteLength(sid) <= 256
|
|
15064
16597
|
&& !/[\u0000-\u001f\u007f]/.test(sid) && this.ownedWorkingSession !== sid) {
|
|
15065
16598
|
this.ownedWorkingSession = sid;
|