@songsid/agend 2.3.5-alpha.8 → 2.3.5-beta.2
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 +0 -2
- package/README.zh-TW.md +0 -2
- package/THIRD_PARTY_NOTICES.md +0 -67
- package/dist/agent-cli-instructions.md +1 -1
- package/dist/agent-cli.js +5 -2
- package/dist/agent-cli.js.map +1 -1
- package/dist/agent-endpoint.d.ts +1 -5
- package/dist/agent-endpoint.js +2 -12
- package/dist/agent-endpoint.js.map +1 -1
- package/dist/agent-file-read.js +1 -1
- package/dist/agent-file-read.js.map +1 -1
- package/dist/agent-whats-new.js +4 -0
- package/dist/agent-whats-new.js.map +1 -1
- package/dist/apply-job.d.ts +0 -5
- package/dist/apply-job.js +3 -10
- package/dist/apply-job.js.map +1 -1
- package/dist/auth-api.d.ts +0 -48
- package/dist/auth-api.js +9 -290
- package/dist/auth-api.js.map +1 -1
- package/dist/authority/web-authority.d.ts +2 -25
- package/dist/authority/web-authority.js +4 -37
- package/dist/authority/web-authority.js.map +1 -1
- package/dist/backend/claude-code.d.ts +13 -15
- package/dist/backend/claude-code.js +141 -152
- package/dist/backend/claude-code.js.map +1 -1
- package/dist/backend/codex-footer-hints.d.ts +0 -3
- package/dist/backend/codex-footer-hints.js +0 -14
- package/dist/backend/codex-footer-hints.js.map +1 -1
- package/dist/backend/codex-package.d.ts +2 -5
- package/dist/backend/codex-package.js +5 -1
- package/dist/backend/codex-package.js.map +1 -1
- package/dist/backend/codex-quota-history.js +19 -4
- package/dist/backend/codex-quota-history.js.map +1 -1
- package/dist/backend/codex.d.ts +115 -142
- package/dist/backend/codex.js +1094 -1188
- package/dist/backend/codex.js.map +1 -1
- package/dist/backend/grok.d.ts +0 -2
- package/dist/backend/grok.js +0 -22
- package/dist/backend/grok.js.map +1 -1
- package/dist/backend/kiro.js +1 -1
- package/dist/backend/kiro.js.map +1 -1
- package/dist/backend/types.d.ts +4 -7
- package/dist/backend/types.js.map +1 -1
- package/dist/bundled-tmux-guard.d.ts +2 -0
- package/dist/bundled-tmux-guard.js +23 -10
- package/dist/bundled-tmux-guard.js.map +1 -1
- package/dist/channel/ipc-bridge.d.ts +0 -2
- package/dist/channel/mcp-tools.js +4 -4
- package/dist/channel/mcp-tools.js.map +1 -1
- package/dist/classic-bindings.d.ts +0 -13
- package/dist/classic-bindings.js +2 -28
- package/dist/classic-bindings.js.map +1 -1
- package/dist/claude-model-minimum.d.ts +7 -0
- package/dist/claude-model-minimum.js +16 -0
- package/dist/claude-model-minimum.js.map +1 -0
- package/dist/cli.js +39 -241
- package/dist/cli.js.map +1 -1
- package/dist/config-validator.js +2 -74
- package/dist/config-validator.js.map +1 -1
- package/dist/config.js +0 -16
- package/dist/config.js.map +1 -1
- package/dist/daemon.d.ts +50 -100
- package/dist/daemon.js +451 -997
- package/dist/daemon.js.map +1 -1
- package/dist/decision-list.d.ts +2 -0
- package/dist/decision-list.js +1 -1
- package/dist/decision-list.js.map +1 -1
- package/dist/delivery-consumed-watch.d.ts +3 -15
- package/dist/delivery-consumed-watch.js +1 -23
- package/dist/delivery-consumed-watch.js.map +1 -1
- package/dist/delivery-outbox.d.ts +0 -5
- package/dist/delivery-outbox.js +4 -32
- package/dist/delivery-outbox.js.map +1 -1
- package/dist/delivery-reconciliation.d.ts +42 -2
- package/dist/delivery-reconciliation.js +164 -2
- package/dist/delivery-reconciliation.js.map +1 -1
- package/dist/doctor.js +9 -19
- package/dist/doctor.js.map +1 -1
- package/dist/e2e-isolation.js +2 -5
- package/dist/e2e-isolation.js.map +1 -1
- package/dist/fleet-context.d.ts +2 -2
- package/dist/fleet-control-audit.d.ts +1 -1
- package/dist/fleet-level-config.d.ts +1 -1
- package/dist/fleet-level-config.js +0 -2
- package/dist/fleet-level-config.js.map +1 -1
- package/dist/fleet-manager.d.ts +31 -706
- package/dist/fleet-manager.js +377 -4062
- package/dist/fleet-manager.js.map +1 -1
- package/dist/general-instance.d.ts +0 -7
- package/dist/general-instance.js +3 -20
- package/dist/general-instance.js.map +1 -1
- package/dist/general-knowledge/skills/concepts/SKILL.md +36 -72
- package/dist/general-knowledge/skills/credential-profiles/SKILL.md +2 -15
- package/dist/general-knowledge/skills/delegation-playbook/SKILL.md +4 -1
- package/dist/general-knowledge/skills/fleet-health/SKILL.md +2 -2
- package/dist/general-knowledge/skills/session-management/SKILL.md +1 -1
- package/dist/general-knowledge/skills/tui-effort/SKILL.md +10 -10
- package/dist/general-knowledge/skills/web-dashboard/SKILL.md +13 -23
- package/dist/general-knowledge/steering/core-rules.md +2 -2
- package/dist/instance-config-impact.js +0 -5
- package/dist/instance-config-impact.js.map +1 -1
- package/dist/instance-lifecycle.d.ts +6 -39
- package/dist/instance-lifecycle.js +179 -429
- package/dist/instance-lifecycle.js.map +1 -1
- package/dist/instructions.d.ts +0 -2
- package/dist/instructions.js +0 -6
- package/dist/instructions.js.map +1 -1
- package/dist/locale.js +12 -180
- package/dist/locale.js.map +1 -1
- package/dist/login-controller.d.ts +1 -14
- package/dist/login-controller.js +1 -31
- package/dist/login-controller.js.map +1 -1
- package/dist/login-flows.d.ts +7 -8
- package/dist/login-flows.js +3 -28
- package/dist/login-flows.js.map +1 -1
- package/dist/login-window-lock.d.ts +1 -2
- package/dist/login-window-lock.js.map +1 -1
- package/dist/ls-rows.d.ts +1 -1
- package/dist/ls-rows.js +4 -3
- package/dist/ls-rows.js.map +1 -1
- package/dist/needs-you-hub.d.ts +0 -8
- package/dist/needs-you-hub.js +3 -29
- package/dist/needs-you-hub.js.map +1 -1
- package/dist/needs-you.d.ts +2 -78
- package/dist/needs-you.js +2 -45
- package/dist/needs-you.js.map +1 -1
- package/dist/office-share-page.js +3 -3
- package/dist/office-share-page.js.map +1 -1
- package/dist/office-share.d.ts +0 -11
- package/dist/office-share.js +0 -14
- package/dist/office-share.js.map +1 -1
- package/dist/outbound-handlers.d.ts +2 -30
- package/dist/outbound-handlers.js +4 -109
- package/dist/outbound-handlers.js.map +1 -1
- package/dist/outbound-schemas.d.ts +3 -71
- package/dist/outbound-schemas.js +18 -38
- package/dist/outbound-schemas.js.map +1 -1
- package/dist/pane-quota-history.d.ts +0 -2
- package/dist/pane-quota-history.js +0 -20
- package/dist/pane-quota-history.js.map +1 -1
- 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/public-web-gateway.js +0 -16
- package/dist/public-web-gateway.js.map +1 -1
- package/dist/public-web-link.d.ts +0 -11
- package/dist/public-web-link.js +0 -13
- package/dist/public-web-link.js.map +1 -1
- package/dist/quickstart-api.js +5 -9
- package/dist/quickstart-api.js.map +1 -1
- package/dist/quickstart.d.ts +0 -6
- package/dist/quickstart.js +4 -31
- package/dist/quickstart.js.map +1 -1
- package/dist/scheduler/db.d.ts +10 -0
- package/dist/scheduler/db.js +38 -11
- package/dist/scheduler/db.js.map +1 -1
- package/dist/scheduler/task-board-text.js +1 -1
- package/dist/scheduler/task-board-text.js.map +1 -1
- package/dist/scheduler/task-board.d.ts +0 -4
- package/dist/scheduler/task-board.js +3 -9
- package/dist/scheduler/task-board.js.map +1 -1
- package/dist/scheduler/types.d.ts +6 -1
- package/dist/service-installer.d.ts +2 -7
- package/dist/service-installer.js +10 -13
- package/dist/service-installer.js.map +1 -1
- package/dist/settings-api.d.ts +1 -14
- package/dist/settings-api.js +6 -491
- package/dist/settings-api.js.map +1 -1
- package/dist/settings-baseline.d.ts +0 -7
- package/dist/settings-baseline.js +1 -3
- package/dist/settings-baseline.js.map +1 -1
- package/dist/settings-change.d.ts +0 -10
- package/dist/settings-change.js +1 -53
- package/dist/settings-change.js.map +1 -1
- package/dist/settings-confirmation.d.ts +2 -41
- package/dist/settings-confirmation.js +12 -58
- package/dist/settings-confirmation.js.map +1 -1
- package/dist/settings-effect.d.ts +0 -17
- package/dist/settings-effect.js +2 -168
- package/dist/settings-effect.js.map +1 -1
- package/dist/settings-http-confirmation.d.ts +0 -25
- package/dist/settings-http-confirmation.js +6 -117
- package/dist/settings-http-confirmation.js.map +1 -1
- package/dist/settings-request-capability.d.ts +0 -2
- package/dist/settings-request-capability.js +0 -4
- package/dist/settings-request-capability.js.map +1 -1
- package/dist/settings-transaction.d.ts +0 -4
- package/dist/settings-transaction.js +0 -9
- package/dist/settings-transaction.js.map +1 -1
- package/dist/setup-form.js +3 -6
- package/dist/setup-form.js.map +1 -1
- package/dist/setup-i18n.js +0 -3
- package/dist/setup-i18n.js.map +1 -1
- package/dist/setup-wizard.js +2 -4
- package/dist/setup-wizard.js.map +1 -1
- package/dist/structured-signin-transport.js +0 -4
- package/dist/structured-signin-transport.js.map +1 -1
- package/dist/structured-signin.d.ts +0 -7
- package/dist/structured-signin.js +1 -1
- package/dist/structured-signin.js.map +1 -1
- package/dist/task-board-tool.d.ts +1 -2
- package/dist/task-board-tool.js +6 -62
- package/dist/task-board-tool.js.map +1 -1
- package/dist/team-membership.d.ts +7 -0
- package/dist/team-membership.js +10 -0
- package/dist/team-membership.js.map +1 -0
- package/dist/tmux-control.d.ts +1 -2
- package/dist/tmux-control.js +4 -4
- package/dist/tmux-control.js.map +1 -1
- package/dist/tmux-exec-helper.js +1 -32
- package/dist/tmux-exec-helper.js.map +1 -1
- package/dist/tmux-manager.d.ts +3 -10
- package/dist/tmux-manager.js +41 -57
- package/dist/tmux-manager.js.map +1 -1
- package/dist/tmux-read.js +3 -4
- package/dist/tmux-read.js.map +1 -1
- package/dist/tool-permissions.js +1 -2
- package/dist/tool-permissions.js.map +1 -1
- package/dist/topic-commands.js +6 -10
- package/dist/topic-commands.js.map +1 -1
- package/dist/transcript-delta-reader.d.ts +1 -1
- package/dist/transcript-delta-reader.js +1 -1
- package/dist/transcript-delta-reader.js.map +1 -1
- package/dist/transcript-monitor.d.ts +0 -3
- package/dist/transcript-monitor.js +54 -68
- package/dist/transcript-monitor.js.map +1 -1
- package/dist/transcript-sources.d.ts +0 -5
- package/dist/transcript-sources.js +79 -11
- package/dist/transcript-sources.js.map +1 -1
- package/dist/types.d.ts +0 -29
- package/dist/ui/backend-signin.js +24 -60
- package/dist/ui/chat-ambient.js +1 -1
- package/dist/ui/chat-md-strings.js +9 -3
- package/dist/ui/chat-render.js +670 -3
- package/dist/ui/chat-store.js +3 -14
- package/dist/ui/chat-strings.js +285 -3
- package/dist/ui/chat-thread.js +969 -3
- package/dist/ui/chat-time.js +80 -3
- package/dist/ui/chat-tour.js +1 -1
- package/dist/ui/fleet-office-pack.d.ts +0 -9
- package/dist/ui/fleet-office-pack.js +4 -76
- package/dist/ui/fleet-office-skin.js +5 -23
- package/dist/ui/fleet-office-store.js +0 -5
- package/dist/ui/fleet-office.js +6 -173
- package/dist/ui/fleet-task-card.js +4 -8
- package/dist/ui/fleet-task-common.js +2 -2
- package/dist/ui/fleet-tasks.js +39 -125
- package/dist/ui/html-attachment.js +40 -3
- package/dist/ui/office-share-page.js +2 -4
- package/dist/ui/panel-chat.js +75 -90
- package/dist/ui/panel-details.js +2 -3
- package/dist/ui/panel-fleet.js +18 -105
- package/dist/ui/panel-log.js +4 -4
- package/dist/ui/panel-needs.js +6 -170
- package/dist/ui/panel-settings.js +200 -276
- package/dist/ui/preview-pages.js +41 -3
- package/dist/ui/preview-panel-actions.js +161 -3
- package/dist/ui/preview-panel.js +550 -11
- package/dist/ui/preview-versions.js +155 -3
- package/dist/ui/preview.js +476 -3
- package/dist/ui/search-dialog.js +0 -2
- package/dist/ui/settings-appearance.js +23 -122
- package/dist/ui/settings-apply.js +5 -12
- package/dist/ui/settings-catalog.js +10 -37
- package/dist/ui/settings-confirm.js +1 -31
- package/dist/ui/settings-dialogs.js +20 -48
- package/dist/ui/settings-guests.js +11 -25
- package/dist/ui/settings-model.js +1 -10
- package/dist/ui/settings-named-test.js +2 -2
- package/dist/ui/settings-quota-notice.js +3 -3
- package/dist/ui/settings-registry.js +4 -18
- package/dist/ui/settings-strings.js +36 -109
- package/dist/ui/settings-web-authority.js +11 -17
- package/dist/ui/shared/app-i18n.js +2 -5
- package/dist/ui/shared/app-route.js +3 -12
- package/dist/ui/shared/app-session.js +2 -6
- package/dist/ui/shared/app-shell.js +27 -196
- package/dist/ui/shared/app-store.js +0 -1
- package/dist/ui/shared/app-stream.js +1 -3
- package/dist/ui/shared/app.css +3 -1395
- package/dist/ui/shared/app.js +3 -16
- package/dist/ui/shared/header-tools.js +9 -9
- package/dist/ui/shared/instance-nav.js +7 -34
- package/dist/ui/shared/instance-switch.js +3 -4
- package/dist/ui/shared/signin.js +9 -276
- package/dist/ui/shared/tokens.css +0 -1
- package/dist/ui/shared/ui-dialog.js +2 -2
- package/dist/ui/shared/ui-menu.js +10 -30
- package/dist/ui/shared/usage-dialog.js +72 -3
- package/dist/ui/shared/vendor/vendor.json +2 -19
- package/dist/ui/shared/view-strings.js +4 -12
- package/dist/ui/signin.html +0 -22
- package/dist/ui/structured-signin.js +11 -43
- package/dist/unattended-install.js +1 -2
- package/dist/unattended-install.js.map +1 -1
- package/dist/update-dispatch.d.ts +32 -4
- package/dist/update-dispatch.js +146 -16
- package/dist/update-dispatch.js.map +1 -1
- package/dist/update-install.d.ts +0 -7
- package/dist/update-install.js +0 -23
- package/dist/update-install.js.map +1 -1
- package/dist/update-launch.d.ts +1 -1
- package/dist/update-launch.js +2 -2
- package/dist/update-launch.js.map +1 -1
- package/dist/update-marker.d.ts +0 -2
- package/dist/update-marker.js.map +1 -1
- package/dist/usage/providers.js +3 -4
- package/dist/usage/providers.js.map +1 -1
- package/dist/view-api.d.ts +2 -8
- package/dist/view-api.js +10 -14
- package/dist/view-api.js.map +1 -1
- package/dist/web-api.d.ts +2 -122
- package/dist/web-api.js +21 -887
- package/dist/web-api.js.map +1 -1
- package/dist/web-backend-login.d.ts +3 -39
- package/dist/web-backend-login.js +17 -25
- package/dist/web-backend-login.js.map +1 -1
- package/dist/web-chat-history.d.ts +2 -19
- package/dist/web-chat-history.js +3 -72
- package/dist/web-chat-history.js.map +1 -1
- package/dist/web-login.d.ts +1 -35
- package/dist/web-login.js +5 -51
- package/dist/web-login.js.map +1 -1
- package/dist/web-notices.d.ts +0 -9
- package/dist/web-notices.js +0 -19
- package/dist/web-notices.js.map +1 -1
- package/dist/web-office-skins.d.ts +0 -9
- package/dist/web-office-skins.js +1 -16
- package/dist/web-office-skins.js.map +1 -1
- package/dist/web-only-fleet.d.ts +0 -20
- package/dist/web-only-fleet.js +0 -21
- package/dist/web-only-fleet.js.map +1 -1
- package/dist/web-session.d.ts +0 -53
- package/dist/web-session.js +1 -47
- package/dist/web-session.js.map +1 -1
- package/dist/web-settings-patch.d.ts +1 -3
- package/dist/web-settings-patch.js +1 -4
- package/dist/web-settings-patch.js.map +1 -1
- package/dist/web-shell-routes.d.ts +1 -10
- package/dist/web-shell-routes.js +2 -14
- package/dist/web-shell-routes.js.map +1 -1
- package/dist/web-terminal.d.ts +30 -11
- package/dist/web-terminal.js +8 -23
- package/dist/web-terminal.js.map +1 -1
- package/dist/yaml-shared-nodes.js +3 -8
- package/dist/yaml-shared-nodes.js.map +1 -1
- package/launcher/agend-install.cjs +1 -8
- package/launcher/postinstall.cjs +2 -27
- package/package.json +4 -15
- package/templates/launchd.plist.ejs +1 -3
- package/dist/accounts-profiles.d.ts +0 -96
- package/dist/accounts-profiles.js +0 -178
- package/dist/accounts-profiles.js.map +0 -1
- package/dist/accounts-signout.d.ts +0 -59
- package/dist/accounts-signout.js +0 -184
- package/dist/accounts-signout.js.map +0 -1
- package/dist/accounts-view.d.ts +0 -168
- package/dist/accounts-view.js +0 -187
- package/dist/accounts-view.js.map +0 -1
- package/dist/agent-runtime-api.d.ts +0 -4
- package/dist/agent-runtime-api.js +0 -59
- package/dist/agent-runtime-api.js.map +0 -1
- package/dist/agent-runtime-change.d.ts +0 -76
- package/dist/agent-runtime-change.js +0 -114
- package/dist/agent-runtime-change.js.map +0 -1
- package/dist/agent-workspace.d.ts +0 -104
- package/dist/agent-workspace.js +0 -381
- package/dist/agent-workspace.js.map +0 -1
- package/dist/backend/grok-model-cache.d.ts +0 -7
- package/dist/backend/grok-model-cache.js +0 -65
- package/dist/backend/grok-model-cache.js.map +0 -1
- package/dist/backend/native-pane.d.ts +0 -11
- package/dist/backend/native-pane.js +0 -59
- package/dist/backend/native-pane.js.map +0 -1
- package/dist/build-provenance-cli.d.ts +0 -3
- package/dist/build-provenance-cli.js +0 -11
- package/dist/build-provenance-cli.js.map +0 -1
- package/dist/build-provenance.d.ts +0 -20
- package/dist/build-provenance.js +0 -67
- package/dist/build-provenance.js.map +0 -1
- package/dist/build-provenance.json +0 -1
- package/dist/claude-auth-status.d.ts +0 -48
- package/dist/claude-auth-status.js +0 -149
- package/dist/claude-auth-status.js.map +0 -1
- package/dist/fleet-windows-runtime.d.ts +0 -98
- package/dist/fleet-windows-runtime.js +0 -467
- package/dist/fleet-windows-runtime.js.map +0 -1
- package/dist/general-binding.d.ts +0 -85
- package/dist/general-binding.js +0 -298
- package/dist/general-binding.js.map +0 -1
- package/dist/general-host-owner.d.ts +0 -8
- package/dist/general-host-owner.js +0 -26
- package/dist/general-host-owner.js.map +0 -1
- package/dist/general-role.d.ts +0 -5
- package/dist/general-role.js +0 -27
- package/dist/general-role.js.map +0 -1
- package/dist/hub/admission.d.ts +0 -28
- package/dist/hub/admission.js +0 -62
- package/dist/hub/admission.js.map +0 -1
- package/dist/hub/attachments/limits.d.ts +0 -20
- package/dist/hub/attachments/limits.js +0 -48
- package/dist/hub/attachments/limits.js.map +0 -1
- package/dist/hub/attachments/store.d.ts +0 -116
- package/dist/hub/attachments/store.js +0 -246
- package/dist/hub/attachments/store.js.map +0 -1
- package/dist/hub/audit/index.d.ts +0 -62
- package/dist/hub/audit/index.js +0 -344
- package/dist/hub/audit/index.js.map +0 -1
- package/dist/hub/browser-certificate.d.ts +0 -38
- package/dist/hub/browser-certificate.js +0 -247
- package/dist/hub/browser-certificate.js.map +0 -1
- package/dist/hub/buttons-model.d.ts +0 -9
- package/dist/hub/buttons-model.js +0 -42
- package/dist/hub/buttons-model.js.map +0 -1
- package/dist/hub/buttons.d.ts +0 -54
- package/dist/hub/buttons.js +0 -348
- package/dist/hub/buttons.js.map +0 -1
- package/dist/hub/catalog.d.ts +0 -74
- package/dist/hub/catalog.js +0 -380
- package/dist/hub/catalog.js.map +0 -1
- package/dist/hub/client.d.ts +0 -69
- package/dist/hub/client.js +0 -302
- package/dist/hub/client.js.map +0 -1
- package/dist/hub/compose/member.d.ts +0 -145
- package/dist/hub/compose/member.js +0 -458
- package/dist/hub/compose/member.js.map +0 -1
- package/dist/hub/compose/server.d.ts +0 -87
- package/dist/hub/compose/server.js +0 -417
- package/dist/hub/compose/server.js.map +0 -1
- package/dist/hub/compose/views.d.ts +0 -12
- package/dist/hub/compose/views.js +0 -4
- package/dist/hub/compose/views.js.map +0 -1
- package/dist/hub/db.d.ts +0 -56
- package/dist/hub/db.js +0 -188
- package/dist/hub/db.js.map +0 -1
- package/dist/hub/directory/config.d.ts +0 -39
- package/dist/hub/directory/config.js +0 -108
- package/dist/hub/directory/config.js.map +0 -1
- package/dist/hub/directory/directory.d.ts +0 -18
- package/dist/hub/directory/directory.js +0 -441
- package/dist/hub/directory/directory.js.map +0 -1
- package/dist/hub/directory/groups.d.ts +0 -29
- package/dist/hub/directory/groups.js +0 -29
- package/dist/hub/directory/groups.js.map +0 -1
- package/dist/hub/directory/index.d.ts +0 -8
- package/dist/hub/directory/index.js +0 -4
- package/dist/hub/directory/index.js.map +0 -1
- package/dist/hub/directory/profiles.d.ts +0 -41
- package/dist/hub/directory/profiles.js +0 -90
- package/dist/hub/directory/profiles.js.map +0 -1
- package/dist/hub/directory/types.d.ts +0 -81
- package/dist/hub/directory/types.js +0 -14
- package/dist/hub/directory/types.js.map +0 -1
- package/dist/hub/execution/cli-provider.d.ts +0 -23
- package/dist/hub/execution/cli-provider.js +0 -341
- package/dist/hub/execution/cli-provider.js.map +0 -1
- package/dist/hub/execution/index.d.ts +0 -13
- package/dist/hub/execution/index.js +0 -8
- package/dist/hub/execution/index.js.map +0 -1
- package/dist/hub/execution/model-broker.d.ts +0 -24
- package/dist/hub/execution/model-broker.js +0 -208
- package/dist/hub/execution/model-broker.js.map +0 -1
- package/dist/hub/execution/provider-setup.d.ts +0 -11
- package/dist/hub/execution/provider-setup.js +0 -21
- package/dist/hub/execution/provider-setup.js.map +0 -1
- package/dist/hub/execution/sandbox-runner.d.ts +0 -1
- package/dist/hub/execution/sandbox-runner.js +0 -221
- package/dist/hub/execution/sandbox-runner.js.map +0 -1
- package/dist/hub/execution/service.d.ts +0 -136
- package/dist/hub/execution/service.js +0 -459
- package/dist/hub/execution/service.js.map +0 -1
- package/dist/hub/execution/store.d.ts +0 -61
- package/dist/hub/execution/store.js +0 -182
- package/dist/hub/execution/store.js.map +0 -1
- package/dist/hub/execution/views.d.ts +0 -20
- package/dist/hub/execution/views.js +0 -48
- package/dist/hub/execution/views.js.map +0 -1
- package/dist/hub/group-policy/admin-api.d.ts +0 -30
- package/dist/hub/group-policy/admin-api.js +0 -83
- package/dist/hub/group-policy/admin-api.js.map +0 -1
- package/dist/hub/group-policy/admin-context.d.ts +0 -23
- package/dist/hub/group-policy/admin-context.js +0 -52
- package/dist/hub/group-policy/admin-context.js.map +0 -1
- package/dist/hub/group-policy/admin-control.d.ts +0 -34
- package/dist/hub/group-policy/admin-control.js +0 -258
- package/dist/hub/group-policy/admin-control.js.map +0 -1
- package/dist/hub/group-policy/admin-dto.d.ts +0 -243
- package/dist/hub/group-policy/admin-dto.js +0 -55
- package/dist/hub/group-policy/admin-dto.js.map +0 -1
- package/dist/hub/group-policy/admin-facts.d.ts +0 -17
- package/dist/hub/group-policy/admin-facts.js +0 -33
- package/dist/hub/group-policy/admin-facts.js.map +0 -1
- package/dist/hub/group-policy/admin-impact.d.ts +0 -51
- package/dist/hub/group-policy/admin-impact.js +0 -88
- package/dist/hub/group-policy/admin-impact.js.map +0 -1
- package/dist/hub/group-policy/admin-inventory.d.ts +0 -24
- package/dist/hub/group-policy/admin-inventory.js +0 -72
- package/dist/hub/group-policy/admin-inventory.js.map +0 -1
- package/dist/hub/group-policy/admin-read.d.ts +0 -21
- package/dist/hub/group-policy/admin-read.js +0 -90
- package/dist/hub/group-policy/admin-read.js.map +0 -1
- package/dist/hub/group-policy/authorization.d.ts +0 -60
- package/dist/hub/group-policy/authorization.js +0 -292
- package/dist/hub/group-policy/authorization.js.map +0 -1
- package/dist/hub/group-policy/impact-inventory.d.ts +0 -21
- package/dist/hub/group-policy/impact-inventory.js +0 -75
- package/dist/hub/group-policy/impact-inventory.js.map +0 -1
- package/dist/hub/group-policy/model.d.ts +0 -56
- package/dist/hub/group-policy/model.js +0 -46
- package/dist/hub/group-policy/model.js.map +0 -1
- package/dist/hub/group-policy/resources.d.ts +0 -72
- package/dist/hub/group-policy/resources.js +0 -260
- package/dist/hub/group-policy/resources.js.map +0 -1
- package/dist/hub/group-policy/store.d.ts +0 -69
- package/dist/hub/group-policy/store.js +0 -210
- package/dist/hub/group-policy/store.js.map +0 -1
- package/dist/hub/group-policy/welcome.d.ts +0 -36
- package/dist/hub/group-policy/welcome.js +0 -55
- package/dist/hub/group-policy/welcome.js.map +0 -1
- package/dist/hub/http/compose.d.ts +0 -22
- package/dist/hub/http/compose.js +0 -640
- package/dist/hub/http/compose.js.map +0 -1
- package/dist/hub/http/core.d.ts +0 -69
- package/dist/hub/http/core.js +0 -257
- package/dist/hub/http/core.js.map +0 -1
- package/dist/hub/http/deps.d.ts +0 -71
- package/dist/hub/http/deps.js +0 -2
- package/dist/hub/http/deps.js.map +0 -1
- package/dist/hub/http/schema.d.ts +0 -14
- package/dist/hub/http/schema.js +0 -80
- package/dist/hub/http/schema.js.map +0 -1
- package/dist/hub/identity.d.ts +0 -32
- package/dist/hub/identity.js +0 -80
- package/dist/hub/identity.js.map +0 -1
- package/dist/hub/init/browser-certificate.d.ts +0 -9
- package/dist/hub/init/browser-certificate.js +0 -78
- package/dist/hub/init/browser-certificate.js.map +0 -1
- package/dist/hub/init/browser-tls.d.ts +0 -18
- package/dist/hub/init/browser-tls.js +0 -62
- package/dist/hub/init/browser-tls.js.map +0 -1
- package/dist/hub/init/cli.d.ts +0 -3
- package/dist/hub/init/cli.js +0 -83
- package/dist/hub/init/cli.js.map +0 -1
- package/dist/hub/init/directory-certificate.d.ts +0 -24
- package/dist/hub/init/directory-certificate.js +0 -222
- package/dist/hub/init/directory-certificate.js.map +0 -1
- package/dist/hub/init/existing-fleet.d.ts +0 -6
- package/dist/hub/init/existing-fleet.js +0 -58
- package/dist/hub/init/existing-fleet.js.map +0 -1
- package/dist/hub/init/handoff.d.ts +0 -8
- package/dist/hub/init/handoff.js +0 -36
- package/dist/hub/init/handoff.js.map +0 -1
- package/dist/hub/init/identity.d.ts +0 -5
- package/dist/hub/init/identity.js +0 -24
- package/dist/hub/init/identity.js.map +0 -1
- package/dist/hub/init/initializer.d.ts +0 -24
- package/dist/hub/init/initializer.js +0 -385
- package/dist/hub/init/initializer.js.map +0 -1
- package/dist/hub/init/inventory.d.ts +0 -17
- package/dist/hub/init/inventory.js +0 -33
- package/dist/hub/init/inventory.js.map +0 -1
- package/dist/hub/init/layout.d.ts +0 -32
- package/dist/hub/init/layout.js +0 -53
- package/dist/hub/init/layout.js.map +0 -1
- package/dist/hub/init/network.d.ts +0 -18
- package/dist/hub/init/network.js +0 -104
- package/dist/hub/init/network.js.map +0 -1
- package/dist/hub/init/plan-digest.d.ts +0 -5
- package/dist/hub/init/plan-digest.js +0 -47
- package/dist/hub/init/plan-digest.js.map +0 -1
- package/dist/hub/init/prompt.d.ts +0 -26
- package/dist/hub/init/prompt.js +0 -110
- package/dist/hub/init/prompt.js.map +0 -1
- package/dist/hub/init/secret-file.d.ts +0 -1
- package/dist/hub/init/secret-file.js +0 -59
- package/dist/hub/init/secret-file.js.map +0 -1
- package/dist/hub/init/text.d.ts +0 -127
- package/dist/hub/init/text.js +0 -247
- package/dist/hub/init/text.js.map +0 -1
- package/dist/hub/init/types.d.ts +0 -114
- package/dist/hub/init/types.js +0 -9
- package/dist/hub/init/types.js.map +0 -1
- package/dist/hub/init/wizard.d.ts +0 -34
- package/dist/hub/init/wizard.js +0 -554
- package/dist/hub/init/wizard.js.map +0 -1
- package/dist/hub/initialization.d.ts +0 -23
- package/dist/hub/initialization.js +0 -28
- package/dist/hub/initialization.js.map +0 -1
- package/dist/hub/member/agent-mode.d.ts +0 -6
- package/dist/hub/member/agent-mode.js +0 -23
- package/dist/hub/member/agent-mode.js.map +0 -1
- package/dist/hub/member/attachments.d.ts +0 -29
- package/dist/hub/member/attachments.js +0 -107
- package/dist/hub/member/attachments.js.map +0 -1
- package/dist/hub/member/exposure-api.d.ts +0 -87
- package/dist/hub/member/exposure-api.js +0 -64
- package/dist/hub/member/exposure-api.js.map +0 -1
- package/dist/hub/member/exposures.d.ts +0 -123
- package/dist/hub/member/exposures.js +0 -282
- package/dist/hub/member/exposures.js.map +0 -1
- package/dist/hub/member/pairing-api.d.ts +0 -87
- package/dist/hub/member/pairing-api.js +0 -386
- package/dist/hub/member/pairing-api.js.map +0 -1
- package/dist/hub/member/pairing-notices.d.ts +0 -18
- package/dist/hub/member/pairing-notices.js +0 -58
- package/dist/hub/member/pairing-notices.js.map +0 -1
- package/dist/hub/member/quota.d.ts +0 -20
- package/dist/hub/member/quota.js +0 -98
- package/dist/hub/member/quota.js.map +0 -1
- package/dist/hub/member-journal.d.ts +0 -104
- package/dist/hub/member-journal.js +0 -336
- package/dist/hub/member-journal.js.map +0 -1
- package/dist/hub/member-reconciliation.d.ts +0 -14
- package/dist/hub/member-reconciliation.js +0 -97
- package/dist/hub/member-reconciliation.js.map +0 -1
- package/dist/hub/mount.d.ts +0 -39
- package/dist/hub/mount.js +0 -123
- package/dist/hub/mount.js.map +0 -1
- package/dist/hub/pairing-client.d.ts +0 -17
- package/dist/hub/pairing-client.js +0 -108
- package/dist/hub/pairing-client.js.map +0 -1
- package/dist/hub/pairing-notices.d.ts +0 -47
- package/dist/hub/pairing-notices.js +0 -241
- package/dist/hub/pairing-notices.js.map +0 -1
- package/dist/hub/pairing.d.ts +0 -99
- package/dist/hub/pairing.js +0 -514
- package/dist/hub/pairing.js.map +0 -1
- package/dist/hub/policy.d.ts +0 -65
- package/dist/hub/policy.js +0 -154
- package/dist/hub/policy.js.map +0 -1
- package/dist/hub/preview.d.ts +0 -32
- package/dist/hub/preview.js +0 -64
- package/dist/hub/preview.js.map +0 -1
- package/dist/hub/private-files.d.ts +0 -5
- package/dist/hub/private-files.js +0 -44
- package/dist/hub/private-files.js.map +0 -1
- package/dist/hub/profile.d.ts +0 -59
- package/dist/hub/profile.js +0 -73
- package/dist/hub/profile.js.map +0 -1
- package/dist/hub/protocol.d.ts +0 -811
- package/dist/hub/protocol.js +0 -98
- package/dist/hub/protocol.js.map +0 -1
- package/dist/hub/quota.d.ts +0 -24
- package/dist/hub/quota.js +0 -112
- package/dist/hub/quota.js.map +0 -1
- package/dist/hub/representative.d.ts +0 -141
- package/dist/hub/representative.js +0 -528
- package/dist/hub/representative.js.map +0 -1
- package/dist/hub/retention.d.ts +0 -17
- package/dist/hub/retention.js +0 -45
- package/dist/hub/retention.js.map +0 -1
- package/dist/hub/rooms.d.ts +0 -121
- package/dist/hub/rooms.js +0 -585
- package/dist/hub/rooms.js.map +0 -1
- package/dist/hub/runtime.d.ts +0 -109
- package/dist/hub/runtime.js +0 -309
- package/dist/hub/runtime.js.map +0 -1
- package/dist/hub/server.d.ts +0 -58
- package/dist/hub/server.js +0 -216
- package/dist/hub/server.js.map +0 -1
- package/dist/hub/service-start.d.ts +0 -17
- package/dist/hub/service-start.js +0 -109
- package/dist/hub/service-start.js.map +0 -1
- package/dist/hub/sessions.d.ts +0 -53
- package/dist/hub/sessions.js +0 -197
- package/dist/hub/sessions.js.map +0 -1
- package/dist/hub/socket.d.ts +0 -24
- package/dist/hub/socket.js +0 -79
- package/dist/hub/socket.js.map +0 -1
- package/dist/hub/store.d.ts +0 -86
- package/dist/hub/store.js +0 -91
- package/dist/hub/store.js.map +0 -1
- package/dist/hub/tls.d.ts +0 -31
- package/dist/hub/tls.js +0 -135
- package/dist/hub/tls.js.map +0 -1
- package/dist/hub/types.d.ts +0 -414
- package/dist/hub/types.js +0 -2
- package/dist/hub/types.js.map +0 -1
- package/dist/hub/validation.d.ts +0 -33
- package/dist/hub/validation.js +0 -136
- package/dist/hub/validation.js.map +0 -1
- package/dist/hub/version-floor.d.ts +0 -10
- package/dist/hub/version-floor.js +0 -45
- package/dist/hub/version-floor.js.map +0 -1
- package/dist/hub-browser-certificate-policy.d.ts +0 -31
- package/dist/hub-browser-certificate-policy.js +0 -25
- package/dist/hub-browser-certificate-policy.js.map +0 -1
- package/dist/hub-membership-settings.d.ts +0 -6
- package/dist/hub-membership-settings.js +0 -21
- package/dist/hub-membership-settings.js.map +0 -1
- package/dist/hub-mode.d.ts +0 -15
- package/dist/hub-mode.js +0 -17
- package/dist/hub-mode.js.map +0 -1
- package/dist/hub-pairing-summary.d.ts +0 -48
- package/dist/hub-pairing-summary.js +0 -36
- package/dist/hub-pairing-summary.js.map +0 -1
- package/dist/hub-report-target.d.ts +0 -32
- package/dist/hub-report-target.js +0 -33
- package/dist/hub-report-target.js.map +0 -1
- package/dist/hub-retention-policy.d.ts +0 -14
- package/dist/hub-retention-policy.js +0 -15
- package/dist/hub-retention-policy.js.map +0 -1
- package/dist/launchd-service-domain.d.ts +0 -5
- package/dist/launchd-service-domain.js +0 -21
- package/dist/launchd-service-domain.js.map +0 -1
- package/dist/local-pane-endpoint.d.ts +0 -46
- package/dist/local-pane-endpoint.js +0 -189
- package/dist/local-pane-endpoint.js.map +0 -1
- package/dist/local-pane-launcher.d.ts +0 -2
- package/dist/local-pane-launcher.js +0 -38
- package/dist/local-pane-launcher.js.map +0 -1
- package/dist/local-pane-stage.ps1 +0 -101
- package/dist/machine-accounts.d.ts +0 -110
- package/dist/machine-accounts.js +0 -229
- package/dist/machine-accounts.js.map +0 -1
- package/dist/machine-signins.d.ts +0 -89
- package/dist/machine-signins.js +0 -182
- package/dist/machine-signins.js.map +0 -1
- package/dist/model-catalog-defaults.d.ts +0 -14
- package/dist/model-catalog-defaults.js +0 -20
- package/dist/model-catalog-defaults.js.map +0 -1
- package/dist/native-agent-admission.d.ts +0 -7
- package/dist/native-agent-admission.js +0 -26
- package/dist/native-agent-admission.js.map +0 -1
- package/dist/native-daemon-client.d.ts +0 -13
- package/dist/native-daemon-client.js +0 -28
- package/dist/native-daemon-client.js.map +0 -1
- package/dist/native-instance-api.d.ts +0 -13
- package/dist/native-instance-api.js +0 -217
- package/dist/native-instance-api.js.map +0 -1
- package/dist/native-instance-input.d.ts +0 -87
- package/dist/native-instance-input.js +0 -59
- package/dist/native-instance-input.js.map +0 -1
- package/dist/native-instance-registry.d.ts +0 -38
- package/dist/native-instance-registry.js +0 -129
- package/dist/native-instance-registry.js.map +0 -1
- package/dist/native-mcp.d.ts +0 -43
- package/dist/native-mcp.js +0 -291
- package/dist/native-mcp.js.map +0 -1
- package/dist/native-model-catalog.d.ts +0 -5
- package/dist/native-model-catalog.js +0 -76
- package/dist/native-model-catalog.js.map +0 -1
- package/dist/native-pane-crash-budget.d.ts +0 -20
- package/dist/native-pane-crash-budget.js +0 -60
- package/dist/native-pane-crash-budget.js.map +0 -1
- package/dist/native-pane-create.d.ts +0 -26
- package/dist/native-pane-create.js +0 -53
- package/dist/native-pane-create.js.map +0 -1
- package/dist/native-pane-lifecycle.d.ts +0 -73
- package/dist/native-pane-lifecycle.js +0 -239
- package/dist/native-pane-lifecycle.js.map +0 -1
- package/dist/native-pane-manager.d.ts +0 -59
- package/dist/native-pane-manager.js +0 -592
- package/dist/native-pane-manager.js.map +0 -1
- package/dist/native-pane-output-log.d.ts +0 -15
- package/dist/native-pane-output-log.js +0 -108
- package/dist/native-pane-output-log.js.map +0 -1
- package/dist/native-pane-reconciliation.d.ts +0 -4
- package/dist/native-pane-reconciliation.js +0 -40
- package/dist/native-pane-reconciliation.js.map +0 -1
- package/dist/native-pane-recovery.d.ts +0 -12
- package/dist/native-pane-recovery.js +0 -10
- package/dist/native-pane-recovery.js.map +0 -1
- package/dist/native-pane-tools.d.ts +0 -2
- package/dist/native-pane-tools.js +0 -14
- package/dist/native-pane-tools.js.map +0 -1
- package/dist/office-talk.d.ts +0 -26
- package/dist/office-talk.js +0 -50
- package/dist/office-talk.js.map +0 -1
- package/dist/pane-port.d.ts +0 -118
- package/dist/pane-port.js +0 -2
- package/dist/pane-port.js.map +0 -1
- package/dist/quiet-run.d.ts +0 -31
- package/dist/quiet-run.js +0 -50
- package/dist/quiet-run.js.map +0 -1
- package/dist/runtime-api.d.ts +0 -23
- package/dist/runtime-api.js +0 -321
- package/dist/runtime-api.js.map +0 -1
- package/dist/runtime-assets/@xterm/addon-serialize/LICENSE +0 -21
- package/dist/runtime-assets/@xterm/addon-serialize/lib/addon-serialize.js +0 -2
- package/dist/runtime-assets/@xterm/addon-serialize/lib/addon-serialize.mjs +0 -19
- package/dist/runtime-assets/@xterm/addon-serialize/package.json +0 -29
- package/dist/runtime-assets/@xterm/headless/LICENSE +0 -21
- package/dist/runtime-assets/@xterm/headless/lib-headless/xterm-headless.js +0 -2
- package/dist/runtime-assets/@xterm/headless/lib-headless/xterm-headless.mjs +0 -46
- package/dist/runtime-assets/@xterm/headless/package.json +0 -29
- package/dist/runtime-assets/node-pty/CONPTY-LICENSE +0 -21
- package/dist/runtime-assets/node-pty/CONPTY-NOTICE.md +0 -503
- package/dist/runtime-assets/node-pty/LICENSE +0 -69
- package/dist/runtime-assets/node-pty/lib/conpty_console_list_agent.js +0 -16
- package/dist/runtime-assets/node-pty/lib/eventEmitter2.js +0 -47
- package/dist/runtime-assets/node-pty/lib/index.js +0 -52
- package/dist/runtime-assets/node-pty/lib/interfaces.js +0 -7
- package/dist/runtime-assets/node-pty/lib/shared/conout.js +0 -11
- package/dist/runtime-assets/node-pty/lib/terminal.js +0 -190
- package/dist/runtime-assets/node-pty/lib/types.js +0 -7
- package/dist/runtime-assets/node-pty/lib/unixTerminal.js +0 -346
- package/dist/runtime-assets/node-pty/lib/utils.js +0 -39
- package/dist/runtime-assets/node-pty/lib/windowsConoutConnection.js +0 -125
- package/dist/runtime-assets/node-pty/lib/windowsPtyAgent.js +0 -320
- package/dist/runtime-assets/node-pty/lib/windowsTerminal.js +0 -199
- package/dist/runtime-assets/node-pty/lib/worker/conoutSocketWorker.js +0 -22
- package/dist/runtime-assets/node-pty/package.json +0 -64
- package/dist/runtime-assets/node-pty/prebuilds/win32-arm64/conpty/OpenConsole.exe +0 -0
- package/dist/runtime-assets/node-pty/prebuilds/win32-arm64/conpty/conpty.dll +0 -0
- package/dist/runtime-assets/node-pty/prebuilds/win32-arm64/conpty.node +0 -0
- package/dist/runtime-assets/node-pty/prebuilds/win32-arm64/conpty_console_list.node +0 -0
- package/dist/runtime-assets/node-pty/prebuilds/win32-x64/conpty/OpenConsole.exe +0 -0
- package/dist/runtime-assets/node-pty/prebuilds/win32-x64/conpty/conpty.dll +0 -0
- package/dist/runtime-assets/node-pty/prebuilds/win32-x64/conpty.node +0 -0
- package/dist/runtime-assets/node-pty/prebuilds/win32-x64/conpty_console_list.node +0 -0
- package/dist/runtime-build-info.d.ts +0 -10
- package/dist/runtime-build-info.js +0 -63
- package/dist/runtime-build-info.js.map +0 -1
- package/dist/runtime-bundle.d.ts +0 -22
- package/dist/runtime-bundle.js +0 -158
- package/dist/runtime-bundle.js.map +0 -1
- package/dist/runtime-cli-install.d.ts +0 -153
- package/dist/runtime-cli-install.js +0 -675
- package/dist/runtime-cli-install.js.map +0 -1
- package/dist/runtime-cli.d.ts +0 -14
- package/dist/runtime-cli.js +0 -416
- package/dist/runtime-cli.js.map +0 -1
- package/dist/runtime-client-store.d.ts +0 -75
- package/dist/runtime-client-store.js +0 -372
- package/dist/runtime-client-store.js.map +0 -1
- package/dist/runtime-client.d.ts +0 -236
- package/dist/runtime-client.js +0 -1267
- package/dist/runtime-client.js.map +0 -1
- package/dist/runtime-connection.d.ts +0 -22
- package/dist/runtime-connection.js +0 -93
- package/dist/runtime-connection.js.map +0 -1
- package/dist/runtime-coordinator.d.ts +0 -107
- package/dist/runtime-coordinator.js +0 -1180
- package/dist/runtime-coordinator.js.map +0 -1
- package/dist/runtime-credential-profiles.d.ts +0 -87
- package/dist/runtime-credential-profiles.js +0 -304
- package/dist/runtime-credential-profiles.js.map +0 -1
- package/dist/runtime-general-protocol.d.ts +0 -22
- package/dist/runtime-general-protocol.js +0 -57
- package/dist/runtime-general-protocol.js.map +0 -1
- package/dist/runtime-general-workspace.d.ts +0 -17
- package/dist/runtime-general-workspace.js +0 -213
- package/dist/runtime-general-workspace.js.map +0 -1
- package/dist/runtime-install.d.ts +0 -50
- package/dist/runtime-install.js +0 -189
- package/dist/runtime-install.js.map +0 -1
- package/dist/runtime-pane-assets.d.ts +0 -17
- package/dist/runtime-pane-assets.js +0 -23
- package/dist/runtime-pane-assets.js.map +0 -1
- package/dist/runtime-pane-boot.d.ts +0 -9
- package/dist/runtime-pane-boot.js +0 -47
- package/dist/runtime-pane-boot.js.map +0 -1
- package/dist/runtime-pane-codex-index.d.ts +0 -10
- package/dist/runtime-pane-codex-index.js +0 -151
- package/dist/runtime-pane-codex-index.js.map +0 -1
- package/dist/runtime-pane-config.d.ts +0 -16
- package/dist/runtime-pane-config.js +0 -54
- package/dist/runtime-pane-config.js.map +0 -1
- package/dist/runtime-pane-host.d.ts +0 -63
- package/dist/runtime-pane-host.js +0 -467
- package/dist/runtime-pane-host.js.map +0 -1
- package/dist/runtime-pane-job-owner.d.ts +0 -1
- package/dist/runtime-pane-job-owner.js +0 -29
- package/dist/runtime-pane-job-owner.js.map +0 -1
- package/dist/runtime-pane-job.ps1 +0 -116
- package/dist/runtime-pane-link.d.ts +0 -47
- package/dist/runtime-pane-link.js +0 -338
- package/dist/runtime-pane-link.js.map +0 -1
- package/dist/runtime-pane-mcp-protocol.d.ts +0 -32
- package/dist/runtime-pane-mcp-protocol.js +0 -39
- package/dist/runtime-pane-mcp-protocol.js.map +0 -1
- package/dist/runtime-pane-mcp-relay.d.ts +0 -18
- package/dist/runtime-pane-mcp-relay.js +0 -80
- package/dist/runtime-pane-mcp-relay.js.map +0 -1
- package/dist/runtime-pane-mcp.d.ts +0 -55
- package/dist/runtime-pane-mcp.js +0 -153
- package/dist/runtime-pane-mcp.js.map +0 -1
- package/dist/runtime-pane-native.d.ts +0 -75
- package/dist/runtime-pane-native.js +0 -114
- package/dist/runtime-pane-native.js.map +0 -1
- package/dist/runtime-pane-output.d.ts +0 -19
- package/dist/runtime-pane-output.js +0 -53
- package/dist/runtime-pane-output.js.map +0 -1
- package/dist/runtime-pane-port.d.ts +0 -144
- package/dist/runtime-pane-port.js +0 -574
- package/dist/runtime-pane-port.js.map +0 -1
- package/dist/runtime-pane-private.d.ts +0 -14
- package/dist/runtime-pane-private.js +0 -51
- package/dist/runtime-pane-private.js.map +0 -1
- package/dist/runtime-pane-private.ps1 +0 -14
- package/dist/runtime-pane-process.d.ts +0 -4
- package/dist/runtime-pane-process.js +0 -117
- package/dist/runtime-pane-process.js.map +0 -1
- package/dist/runtime-pane-protocol.d.ts +0 -182
- package/dist/runtime-pane-protocol.js +0 -217
- package/dist/runtime-pane-protocol.js.map +0 -1
- package/dist/runtime-pane-quota-history.d.ts +0 -6
- package/dist/runtime-pane-quota-history.js +0 -44
- package/dist/runtime-pane-quota-history.js.map +0 -1
- package/dist/runtime-pane-screen.d.ts +0 -19
- package/dist/runtime-pane-screen.js +0 -76
- package/dist/runtime-pane-screen.js.map +0 -1
- package/dist/runtime-pane-service.d.ts +0 -16
- package/dist/runtime-pane-service.js +0 -256
- package/dist/runtime-pane-service.js.map +0 -1
- package/dist/runtime-pane-stdio-protocol.d.ts +0 -54
- package/dist/runtime-pane-stdio-protocol.js +0 -94
- package/dist/runtime-pane-stdio-protocol.js.map +0 -1
- package/dist/runtime-pane-stdio.d.ts +0 -3
- package/dist/runtime-pane-stdio.js +0 -123
- package/dist/runtime-pane-stdio.js.map +0 -1
- package/dist/runtime-pane-store.d.ts +0 -43
- package/dist/runtime-pane-store.js +0 -176
- package/dist/runtime-pane-store.js.map +0 -1
- package/dist/runtime-pane-transcript-protocol.d.ts +0 -43
- package/dist/runtime-pane-transcript-protocol.js +0 -58
- package/dist/runtime-pane-transcript-protocol.js.map +0 -1
- package/dist/runtime-pane-transcript.d.ts +0 -50
- package/dist/runtime-pane-transcript.js +0 -666
- package/dist/runtime-pane-transcript.js.map +0 -1
- package/dist/runtime-pane-worker.d.ts +0 -1
- package/dist/runtime-pane-worker.js +0 -167
- package/dist/runtime-pane-worker.js.map +0 -1
- package/dist/runtime-profile-ownership.d.ts +0 -66
- package/dist/runtime-profile-ownership.js +0 -391
- package/dist/runtime-profile-ownership.js.map +0 -1
- package/dist/runtime-protocol.d.ts +0 -263
- package/dist/runtime-protocol.js +0 -89
- package/dist/runtime-protocol.js.map +0 -1
- package/dist/runtime-remote-accounts.d.ts +0 -197
- package/dist/runtime-remote-accounts.js +0 -663
- package/dist/runtime-remote-accounts.js.map +0 -1
- package/dist/runtime-remote-setup.d.ts +0 -105
- package/dist/runtime-remote-setup.js +0 -529
- package/dist/runtime-remote-setup.js.map +0 -1
- package/dist/runtime-signin-transport.d.ts +0 -39
- package/dist/runtime-signin-transport.js +0 -110
- package/dist/runtime-signin-transport.js.map +0 -1
- package/dist/runtime-signin.d.ts +0 -132
- package/dist/runtime-signin.js +0 -289
- package/dist/runtime-signin.js.map +0 -1
- package/dist/runtime-switches.d.ts +0 -79
- package/dist/runtime-switches.js +0 -90
- package/dist/runtime-switches.js.map +0 -1
- package/dist/runtime-transcript-delta-reader.d.ts +0 -23
- package/dist/runtime-transcript-delta-reader.js +0 -74
- package/dist/runtime-transcript-delta-reader.js.map +0 -1
- package/dist/runtime-transcript-source.d.ts +0 -36
- package/dist/runtime-transcript-source.js +0 -189
- package/dist/runtime-transcript-source.js.map +0 -1
- package/dist/runtime-update-activity.d.ts +0 -21
- package/dist/runtime-update-activity.js +0 -51
- package/dist/runtime-update-activity.js.map +0 -1
- package/dist/runtime-update-artifact.d.ts +0 -31
- package/dist/runtime-update-artifact.js +0 -252
- package/dist/runtime-update-artifact.js.map +0 -1
- package/dist/runtime-update-attention.d.ts +0 -4
- package/dist/runtime-update-attention.js +0 -11
- package/dist/runtime-update-attention.js.map +0 -1
- package/dist/runtime-update-controller.d.ts +0 -75
- package/dist/runtime-update-controller.js +0 -691
- package/dist/runtime-update-controller.js.map +0 -1
- package/dist/runtime-update-install.d.ts +0 -31
- package/dist/runtime-update-install.js +0 -205
- package/dist/runtime-update-install.js.map +0 -1
- package/dist/runtime-update-ipc.d.ts +0 -42
- package/dist/runtime-update-ipc.js +0 -144
- package/dist/runtime-update-ipc.js.map +0 -1
- package/dist/runtime-update-journal.d.ts +0 -49
- package/dist/runtime-update-journal.js +0 -128
- package/dist/runtime-update-journal.js.map +0 -1
- package/dist/runtime-update-lock.d.ts +0 -48
- package/dist/runtime-update-lock.js +0 -232
- package/dist/runtime-update-lock.js.map +0 -1
- package/dist/runtime-update-owners.d.ts +0 -29
- package/dist/runtime-update-owners.js +0 -240
- package/dist/runtime-update-owners.js.map +0 -1
- package/dist/runtime-update-protocol.d.ts +0 -15
- package/dist/runtime-update-protocol.js +0 -13
- package/dist/runtime-update-protocol.js.map +0 -1
- package/dist/runtime-update-status.d.ts +0 -30
- package/dist/runtime-update-status.js +0 -31
- package/dist/runtime-update-status.js.map +0 -1
- package/dist/runtime-windows-bridge.d.ts +0 -42
- package/dist/runtime-windows-bridge.js +0 -167
- package/dist/runtime-windows-bridge.js.map +0 -1
- package/dist/service-drain.d.ts +0 -19
- package/dist/service-drain.js +0 -64
- package/dist/service-drain.js.map +0 -1
- package/dist/settings-route-lifetime.d.ts +0 -14
- package/dist/settings-route-lifetime.js +0 -48
- package/dist/settings-route-lifetime.js.map +0 -1
- package/dist/signin-keepalive.d.ts +0 -205
- package/dist/signin-keepalive.js +0 -680
- package/dist/signin-keepalive.js.map +0 -1
- package/dist/tmux-binary.d.ts +0 -59
- package/dist/tmux-binary.js +0 -189
- package/dist/tmux-binary.js.map +0 -1
- package/dist/tmux-legacy.d.ts +0 -94
- package/dist/tmux-legacy.js +0 -309
- package/dist/tmux-legacy.js.map +0 -1
- package/dist/tmux-pane-host.d.ts +0 -26
- package/dist/tmux-pane-host.js +0 -25
- package/dist/tmux-pane-host.js.map +0 -1
- package/dist/tmux-rollback.d.ts +0 -31
- package/dist/tmux-rollback.js +0 -72
- package/dist/tmux-rollback.js.map +0 -1
- package/dist/tmux-server.d.ts +0 -102
- package/dist/tmux-server.js +0 -248
- package/dist/tmux-server.js.map +0 -1
- package/dist/transcript-needles.d.ts +0 -42
- package/dist/transcript-needles.js +0 -166
- package/dist/transcript-needles.js.map +0 -1
- package/dist/transcript-records.d.ts +0 -22
- package/dist/transcript-records.js +0 -144
- package/dist/transcript-records.js.map +0 -1
- package/dist/ui/account-identity.js +0 -27
- package/dist/ui/accounts-keepalive.js +0 -118
- package/dist/ui/accounts-manage.js +0 -255
- package/dist/ui/accounts-view.js +0 -416
- package/dist/ui/agent-proposals.js +0 -90
- package/dist/ui/agent-runtime-settings.js +0 -69
- package/dist/ui/agent-runtime.js +0 -124
- package/dist/ui/cli-picker.js +0 -42
- package/dist/ui/credential-profile-select.js +0 -54
- package/dist/ui/fleet-office-dialogue.d.ts +0 -30
- package/dist/ui/fleet-office-dialogue.js +0 -382
- package/dist/ui/fleet-task-menu.js +0 -188
- package/dist/ui/fleet-task-stats.js +0 -124
- package/dist/ui/fleet-task-view.js +0 -340
- package/dist/ui/general-location.js +0 -85
- package/dist/ui/hub-agent-copy.js +0 -23
- package/dist/ui/hub-attachments.js +0 -90
- package/dist/ui/hub-button-actions.js +0 -65
- package/dist/ui/hub-chat-store.js +0 -164
- package/dist/ui/hub-chat-strings.js +0 -77
- package/dist/ui/hub-client.js +0 -388
- package/dist/ui/hub-grant-strings.js +0 -13
- package/dist/ui/hub-group-policy.js +0 -170
- package/dist/ui/hub-group-strings.js +0 -97
- package/dist/ui/hub-owner-strings.js +0 -55
- package/dist/ui/hub-pairing-progress-strings.js +0 -15
- package/dist/ui/hub-preview.js +0 -101
- package/dist/ui/hub-provider-guidance.js +0 -31
- package/dist/ui/hub-quick-pairing.js +0 -202
- package/dist/ui/hub-quick-strings.js +0 -43
- package/dist/ui/hub-quota.js +0 -85
- package/dist/ui/hub-read-strings.js +0 -7
- package/dist/ui/hub-strings.js +0 -164
- package/dist/ui/hub-switcher.js +0 -27
- package/dist/ui/hub-welcome.js +0 -99
- package/dist/ui/machine-signin.js +0 -56
- package/dist/ui/native-instance-settings.js +0 -44
- package/dist/ui/native-pane-recovery.js +0 -45
- package/dist/ui/panel-hub.js +0 -796
- package/dist/ui/panel-runtimes.js +0 -446
- package/dist/ui/panel-windows-agent.js +0 -87
- package/dist/ui/panel-windows-cli.js +0 -189
- package/dist/ui/provider-marks.js +0 -83
- package/dist/ui/runtime-catalog.js +0 -55
- package/dist/ui/runtime-cli-install.js +0 -134
- package/dist/ui/runtime-commands.d.ts +0 -4
- package/dist/ui/runtime-commands.js +0 -59
- package/dist/ui/runtime-update-commands.d.ts +0 -2
- package/dist/ui/runtime-update-commands.js +0 -11
- package/dist/ui/runtime-update-status.js +0 -53
- package/dist/ui/settings-access-strings.js +0 -42
- package/dist/ui/settings-agent-filters.js +0 -94
- package/dist/ui/settings-build-version.js +0 -35
- package/dist/ui/settings-devices.js +0 -249
- package/dist/ui/settings-hub-browser-certificate.js +0 -76
- package/dist/ui/settings-hub-membership.js +0 -92
- package/dist/ui/settings-hub-retention.js +0 -54
- package/dist/ui/settings-hub-section.js +0 -60
- package/dist/ui/settings-hub.js +0 -249
- package/dist/ui/settings-layout.js +0 -246
- package/dist/ui/settings-outside.js +0 -242
- package/dist/ui/settings-restart-strings.js +0 -17
- package/dist/ui/settings-shared-strings.js +0 -143
- package/dist/ui/settings-shared.js +0 -345
- package/dist/ui/settings-shortcuts.js +0 -65
- package/dist/ui/shared/accounts-keepalive.css +0 -12
- package/dist/ui/shared/accounts.css +0 -78
- package/dist/ui/shared/chat-composer.js +0 -68
- package/dist/ui/shared/chat-md-strings.js +0 -9
- package/dist/ui/shared/chat-render.js +0 -682
- package/dist/ui/shared/chat-strings.js +0 -333
- package/dist/ui/shared/chat-thread.js +0 -969
- package/dist/ui/shared/chat-time.js +0 -80
- package/dist/ui/shared/html-attachment.js +0 -42
- package/dist/ui/shared/hub-chat.css +0 -86
- package/dist/ui/shared/hub-groups.css +0 -26
- package/dist/ui/shared/hub-owner.css +0 -33
- package/dist/ui/shared/hub-quota.css +0 -8
- package/dist/ui/shared/hub-signin.css +0 -24
- package/dist/ui/shared/hub.css +0 -72
- package/dist/ui/shared/machine-name.js +0 -13
- package/dist/ui/shared/page-head.js +0 -8
- package/dist/ui/shared/preview-pages.js +0 -41
- package/dist/ui/shared/preview-panel-actions.js +0 -168
- package/dist/ui/shared/preview-panel.js +0 -565
- package/dist/ui/shared/preview-versions.js +0 -155
- package/dist/ui/shared/preview.js +0 -476
- package/dist/ui/shared/qrcode.module.js +0 -2237
- package/dist/ui/shared/runtime-install.css +0 -30
- package/dist/ui/shared/settings-width.js +0 -31
- package/dist/ui/shared/side-rail.js +0 -15
- package/dist/ui/shared/task-board.css +0 -95
- package/dist/ui/shared/usage-meter.js +0 -84
- package/dist/ui/shared/vendor/qrcode-generator.LICENSE +0 -27
- package/dist/ui/shared/workspace-follow.css +0 -19
- package/dist/ui/shared/workspace.css +0 -20
- package/dist/ui/windows-agents-nav.js +0 -2
- package/dist/ui/windows-cli-catalog.js +0 -108
- package/dist/ui/workspace-follow-strings.js +0 -28
- package/dist/ui/workspace-panel.js +0 -378
- package/dist/ui/workspace-strings.js +0 -35
- package/dist/web-device-login.d.ts +0 -153
- package/dist/web-device-login.js +0 -278
- package/dist/web-device-login.js.map +0 -1
- package/dist/web-remote-access.d.ts +0 -158
- package/dist/web-remote-access.js +0 -377
- package/dist/web-remote-access.js.map +0 -1
- package/dist/web-signin-link.d.ts +0 -42
- package/dist/web-signin-link.js +0 -110
- package/dist/web-signin-link.js.map +0 -1
- package/dist/windows-agents.d.ts +0 -127
- package/dist/windows-agents.js +0 -491
- package/dist/windows-agents.js.map +0 -1
- package/dist/windows-cli-api.d.ts +0 -48
- package/dist/windows-cli-api.js +0 -206
- package/dist/windows-cli-api.js.map +0 -1
- package/dist/windows-cli-providers.d.ts +0 -106
- package/dist/windows-cli-providers.js +0 -424
- package/dist/windows-cli-providers.js.map +0 -1
- package/dist/windows-cli-worker.d.ts +0 -85
- package/dist/windows-cli-worker.js +0 -585
- package/dist/windows-cli-worker.js.map +0 -1
- package/dist/windows-cli.d.ts +0 -126
- package/dist/windows-cli.js +0 -416
- package/dist/windows-cli.js.map +0 -1
- package/dist/windows-native-mcp.d.ts +0 -19
- package/dist/windows-native-mcp.js +0 -143
- package/dist/windows-native-mcp.js.map +0 -1
- package/dist/windows-pane-mcp.d.ts +0 -26
- package/dist/windows-pane-mcp.js +0 -187
- package/dist/windows-pane-mcp.js.map +0 -1
- package/dist/workspace-follow-parse.d.ts +0 -36
- package/dist/workspace-follow-parse.js +0 -208
- package/dist/workspace-follow-parse.js.map +0 -1
- package/dist/workspace-follow-records.d.ts +0 -17
- package/dist/workspace-follow-records.js +0 -88
- package/dist/workspace-follow-records.js.map +0 -1
- package/dist/workspace-follow.d.ts +0 -41
- package/dist/workspace-follow.js +0 -143
- package/dist/workspace-follow.js.map +0 -1
- package/dist/wsl-detect.d.ts +0 -1
- package/dist/wsl-detect.js +0 -20
- package/dist/wsl-detect.js.map +0 -1
- package/launcher/launchd-session-type.cjs +0 -14
- package/launcher/tmux-bundle.cjs +0 -263
- package/templates/runtime-assets/conpty-LICENSE +0 -21
- package/templates/runtime-assets/conpty-NOTICE.md +0 -503
- package/templates/runtime-assets/local-pane-stage.ps1 +0 -101
- package/templates/runtime-assets/runtime-pane-job.ps1 +0 -116
- package/templates/runtime-assets/runtime-pane-private.ps1 +0 -14
- package/templates/runtime-assets/xterm-LICENSE +0 -21
- package/templates/runtime-install/install.ps1 +0 -411
package/dist/daemon.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { generalByName } from "./general-instance.js";
|
|
1
|
+
import { claudeMinimumError, cliVersionBelow } from "./claude-model-minimum.js";
|
|
3
2
|
import { quotaNoticeProblem } from "./quota-notice-config.js";
|
|
4
3
|
import { quotaHistoryCount, quotaAfterInput } from "./pane-quota-history.js";
|
|
5
4
|
import { dialogScreenText } from "./dialog-screen-text.js";
|
|
@@ -24,9 +23,8 @@ import { assertNoSessionOomStop, readSessionOomStop, writeSessionOomStop, Sessio
|
|
|
24
23
|
import { mcpServerState } from "./mcp-liveness.js";
|
|
25
24
|
import { clearPausedMarker, writePausedMarker } from "./pause-marker.js";
|
|
26
25
|
import { writeBackgroundWorkEndedMarker } from "./background-work-ended.js";
|
|
27
|
-
import {
|
|
26
|
+
import { TmuxManager, resolveTmuxLogicalSize } from "./tmux-manager.js";
|
|
28
27
|
import { TranscriptMonitor } from "./transcript-monitor.js";
|
|
29
|
-
import { FollowLog } from "./workspace-follow.js";
|
|
30
28
|
import { createTranscriptSource } from "./transcript-sources.js";
|
|
31
29
|
import { TranscriptTurnLedger } from "./transcript-turns.js";
|
|
32
30
|
import { credentialProfileStoreHome, resolveCredentialProfile } from "./backend/credential-profile.js";
|
|
@@ -34,8 +32,6 @@ import { resolveToolSet, toolsFor } from "./tool-permissions.js";
|
|
|
34
32
|
import { TOOLS } from "./channel/mcp-tools.js";
|
|
35
33
|
import { dashboardAccessProblem, dashboardFeaturesOff, withoutFeatures } from "./dashboard-permissions.js";
|
|
36
34
|
import { getAgendHome } from "./paths.js";
|
|
37
|
-
import { legacyTmuxSocket, tmuxSocket } from "./tmux-binary.js";
|
|
38
|
-
import { migrateLegacyWindow, tagWindowId } from "./tmux-legacy.js";
|
|
39
35
|
import { scopedFleetConfigEnvironment } from "./web-experimental.js";
|
|
40
36
|
import { readAgentFile } from "./agent-file-read.js";
|
|
41
37
|
import { ASSET_UPLOAD_MAX_BYTES, receivePreview, sendAssetInParts, writePreview } from "./web-asset-parts.js";
|
|
@@ -55,7 +51,6 @@ import { HangDetector } from "./hang-detector.js";
|
|
|
55
51
|
import { writeSecretFile } from "./secret-file.js";
|
|
56
52
|
import { PaneWriteLock } from "./pane-write-lock.js";
|
|
57
53
|
import { answerRemoteCard } from "./remote-card-answer.js";
|
|
58
|
-
import { tmuxPaneHost } from "./tmux-pane-host.js";
|
|
59
54
|
import { buildFleetInstructions } from "./instructions.js";
|
|
60
55
|
import { formatHumanInboundMessage, prepareDeliveryWire, steerInboundEnvelope, BTW_INBOUND_PREFIX, humanBodyHash, humanOwnerObjectId } from "./human-delivery-receipts.js";
|
|
61
56
|
import { formatCrossInstanceInboundMessage, renderCrossInstanceHandoffMetadata, } from "./cross-instance-envelope.js";
|
|
@@ -65,7 +60,6 @@ import { CLAUDE_CREDIT_BALANCE_LOW, CLAUDE_MODEL_USAGE_LIMIT, CLAUDE_USAGE_LIMIT
|
|
|
65
60
|
import { t } from "./locale.js";
|
|
66
61
|
import { claudeResetInstant, claudeResetTime, quotaPausedLine } from "./quota-notice.js";
|
|
67
62
|
import { MuseUsageRelay, clearMuseUsageSnapshot } from "./muse-usage-relay.js";
|
|
68
|
-
import { reconcileNativePaneTarget } from "./native-pane-reconciliation.js";
|
|
69
63
|
import { deliveryContentDigest } from "./delivery-outbox.js";
|
|
70
64
|
import { consumedWatches } from "./delivery-consumed-watch.js";
|
|
71
65
|
import { queueResumePolicyForAttempt } from "./delivery-queue-evidence.js";
|
|
@@ -199,20 +193,20 @@ export function sameProjectFamily(a, b) {
|
|
|
199
193
|
const fx = family(x), fy = family(y);
|
|
200
194
|
return fx.length > 0 && fx === fy;
|
|
201
195
|
}
|
|
196
|
+
/** At most this many fleet decisions, and this many team + directory ones, in one instance's Active Decisions. */
|
|
197
|
+
export const ACTIVE_DECISION_CAPS = { fleet: 20, scoped: 20 };
|
|
202
198
|
/**
|
|
203
|
-
*
|
|
204
|
-
*
|
|
205
|
-
* `scope: "fleet"` previously bypassed the project check outright, so every
|
|
206
|
-
* instance carried every other project's playbook — measured at 8 of 14 here,
|
|
207
|
-
* resent on every API call. A fleet decision must now also be relevant: global
|
|
208
|
-
* (no project_root), the same project, or the same project family.
|
|
209
|
-
*
|
|
210
|
-
* `isDispatcher` (a general) opts out of that narrowing on purpose: it routes
|
|
211
|
-
* work across all projects, so cross-project rules ("X 文件操作由 Y 負責") are
|
|
212
|
-
* precisely what it must know. Narrowing a general would cause misrouting.
|
|
199
|
+
* Bound an instance's already-selected decisions (newest first, as the store orders them): fleet ones and its own team
|
|
200
|
+
* and directory ones are capped apart, AFTER selection, so nobody else's rows take an instance's places.
|
|
213
201
|
*/
|
|
214
|
-
export function
|
|
202
|
+
export function capActiveDecisions(selected) {
|
|
203
|
+
let fleet = 0, scoped = 0;
|
|
204
|
+
return selected.filter(d => d.scope === "fleet" ? fleet++ < ACTIVE_DECISION_CAPS.fleet : scoped++ < ACTIVE_DECISION_CAPS.scoped);
|
|
205
|
+
}
|
|
206
|
+
export function selectRelevantDecisions(all, workDir, isDispatcher = false, teams = []) {
|
|
215
207
|
return all.filter(d => {
|
|
208
|
+
if (d.scope === "team")
|
|
209
|
+
return !!d.team && teams.includes(d.team);
|
|
216
210
|
if (d.project_root === workDir)
|
|
217
211
|
return true; // own project, any scope
|
|
218
212
|
if (d.scope !== "fleet")
|
|
@@ -1125,7 +1119,6 @@ export class Daemon extends EventEmitter {
|
|
|
1125
1119
|
spawnGate;
|
|
1126
1120
|
stormWindow;
|
|
1127
1121
|
backendOutage;
|
|
1128
|
-
paneTransport;
|
|
1129
1122
|
/** #1314: fleet-directory fallbacks already reported to the topic (once per daemon, per field and path). */
|
|
1130
1123
|
promptFileFallbackNoticed = new Set();
|
|
1131
1124
|
/** Identity of this live Daemon object; changes on object stop/restart. */
|
|
@@ -1552,6 +1545,12 @@ export class Daemon extends EventEmitter {
|
|
|
1552
1545
|
* when a startup scan reaches a real ready prompt, or on wake().
|
|
1553
1546
|
*/
|
|
1554
1547
|
fatalStartupBlocked = false;
|
|
1548
|
+
/** #3441: one repair budget survives every automatic spawn on this daemon. */
|
|
1549
|
+
modelMinimumRepairUsed = false;
|
|
1550
|
+
modelMinimumFlight = null;
|
|
1551
|
+
modelMinimumBlocked = false;
|
|
1552
|
+
modelMinimumUpdateNotified = false;
|
|
1553
|
+
cliRepairSessionId;
|
|
1555
1554
|
/** model_error seen mid-turn: notify only if it survives to the idle screen. */
|
|
1556
1555
|
pendingModelErrorKey = null;
|
|
1557
1556
|
/** Optional per-instance localhost relay used to observe Muse usage events. */
|
|
@@ -1804,7 +1803,6 @@ export class Daemon extends EventEmitter {
|
|
|
1804
1803
|
// still booting. Its new tmux window starts empty before resume restores the
|
|
1805
1804
|
// old transcript, so pre-ready scans must not lower this seeded baseline.
|
|
1806
1805
|
seededErrorCountBaselines = new Map();
|
|
1807
|
-
nativeQuotaReplayTaken = false;
|
|
1808
1806
|
quotaReplay = null;
|
|
1809
1807
|
paneQuotaPatterns() {
|
|
1810
1808
|
if (!["codex", "grok"].includes(this.backend?.binaryName ?? ""))
|
|
@@ -1840,11 +1838,7 @@ export class Daemon extends EventEmitter {
|
|
|
1840
1838
|
}
|
|
1841
1839
|
/** Before admission, this launch may absorb ONLY rows positively known before its resume. */
|
|
1842
1840
|
takeQuotaReplayBaseline(pane) {
|
|
1843
|
-
|
|
1844
|
-
const native = !this.nativeQuotaReplayTaken ? this.nativePaneLifecycle?.quotaReplayHistory?.() : null;
|
|
1845
|
-
if (this.nativePaneLifecycle)
|
|
1846
|
-
this.nativeQuotaReplayTaken = true;
|
|
1847
|
-
const history = this.quotaReplay ?? (native ? { ...native, spawn: this.spawnGeneration, fence: this.launchFenceEpoch, attempt: this.launchAttempt } : null);
|
|
1841
|
+
const history = this.quotaReplay;
|
|
1848
1842
|
if (!history)
|
|
1849
1843
|
return;
|
|
1850
1844
|
this.quotaReplay = null;
|
|
@@ -1910,23 +1904,14 @@ export class Daemon extends EventEmitter {
|
|
|
1910
1904
|
static USAGE_PAUSE_NOTICE_WINDOW_MS = 30 * 60_000;
|
|
1911
1905
|
/** The usage-pause notice told last: when (monotonic), Claude's words for the reset, and that reset (wall clock). */
|
|
1912
1906
|
usagePauseNotice = null;
|
|
1913
|
-
/** Coarse status for the representative quota hint; never exports model names or transcript text. */
|
|
1914
|
-
quotaPaused() {
|
|
1915
|
-
if (this.usageLimitHold)
|
|
1916
|
-
return true;
|
|
1917
|
-
const pause = this.usagePauseNotice;
|
|
1918
|
-
return !!pause && (pause.resetAt === null
|
|
1919
|
-
? performance.now() - pause.at < Daemon.USAGE_PAUSE_NOTICE_WINDOW_MS
|
|
1920
|
-
: Date.now() < pause.resetAt);
|
|
1921
|
-
}
|
|
1922
|
-
/** #3186 review: the lifecycle's second opinion dropped the notice (usage has capacity): nothing was told. */
|
|
1923
|
-
clearUsagePauseNotice() { this.usagePauseNotice = null; }
|
|
1924
1907
|
/**
|
|
1925
1908
|
* #2834 (#816): Claude paused itself until its usage window opens — the same notice the screen pattern gave. `at`: when
|
|
1926
1909
|
* Claude wrote it (its record's timestamp). One notice per pause: a reset time already past is not this pause (an old
|
|
1927
1910
|
* note), and its repeats ("reached again") within the window — or naming the same reset, until it comes — say nothing
|
|
1928
1911
|
* more. Claude's own "Usage limit reset" ends it.
|
|
1929
1912
|
*/
|
|
1913
|
+
/** #3186 review: the lifecycle's second opinion dropped the notice (usage has capacity): nothing was told. */
|
|
1914
|
+
clearUsagePauseNotice() { this.usagePauseNotice = null; }
|
|
1930
1915
|
noteClaudeInformational(text, at = null) {
|
|
1931
1916
|
const line = text.trim();
|
|
1932
1917
|
if (Daemon.USAGE_LIMIT_RESET.test(line)) {
|
|
@@ -2085,94 +2070,9 @@ export class Daemon extends EventEmitter {
|
|
|
2085
2070
|
this.errorRecoveryDeadlineAt = 0;
|
|
2086
2071
|
this.activeErrorPatternKey = null;
|
|
2087
2072
|
}
|
|
2088
|
-
/** Lazy default also preserves bare-prototype diagnostic/test construction. */
|
|
2089
|
-
get paneHost() { return this.paneTransport ?? tmuxPaneHost; }
|
|
2090
|
-
nativePaneLifecycle;
|
|
2091
|
-
nativeFleetBridge;
|
|
2092
|
-
nativeTranscriptSource;
|
|
2093
|
-
usesNativePane() { return !!this.nativePaneLifecycle; }
|
|
2094
|
-
/** cc3ce4fe: the CLI version this pane's launch actually ran, as its helper recorded it (undefined: not known). */
|
|
2095
|
-
nativePaneCliVersion() { try {
|
|
2096
|
-
return this.nativePaneLifecycle?.snapshot?.()?.cliVersion;
|
|
2097
|
-
}
|
|
2098
|
-
catch {
|
|
2099
|
-
return undefined;
|
|
2100
|
-
} }
|
|
2101
|
-
logNativeInputRefusal(details) {
|
|
2102
|
-
this.logger.warn({ component: "runtime-pane-host", reason: "expected_seq_changed", ...details }, "Native pane input refused before write");
|
|
2103
|
-
}
|
|
2104
|
-
logNativeToolFailure(details) {
|
|
2105
|
-
const turn = this.turnReplyGuard.snapshot();
|
|
2106
|
-
this.logger.warn({ ...details, currentMessageId: turn?.target.messageId ?? null,
|
|
2107
|
-
guardGeneration: turn?.generation ?? null, guardPhase: turn?.phase ?? null }, "Native pane tool operation failed");
|
|
2108
|
-
}
|
|
2109
|
-
nativePaneCurrent() { return this.nativePaneLifecycle?.current() ?? false; }
|
|
2110
|
-
nativeEnterHold = null;
|
|
2111
|
-
/** Per-launch attention for a native delivery whose bounded input attempts were refused or uncertain, including non-outbox input. */
|
|
2112
|
-
nativeDeliveryHold() {
|
|
2113
|
-
const hold = this.nativeEnterHold;
|
|
2114
|
-
return hold && this.nativePaneLifecycle && !this.deliveryWritesStopping && hold.spawn === this.spawnGeneration && hold.fence === this.launchFenceEpoch
|
|
2115
|
-
? { key: hold.key, since: hold.since } : null;
|
|
2116
|
-
}
|
|
2117
|
-
nativePaneHasExited() {
|
|
2118
|
-
const snapshot = this.nativePaneLifecycle?.snapshot?.();
|
|
2119
|
-
return snapshot?.state === "exited" && snapshot.instance === this.name && this.tmux?.getWindowId() === snapshot.paneId;
|
|
2120
|
-
}
|
|
2121
|
-
/** Positive native exit evidence only, fenced to this exact launch and Daemon owner. */
|
|
2122
|
-
nativePaneExitCurrent(snapshot, owner) {
|
|
2123
|
-
const actual = this.nativePaneLifecycle?.snapshot?.();
|
|
2124
|
-
return !!actual && actual.state === "exited" && snapshot.state === "exited"
|
|
2125
|
-
&& sameInteractionOwner(owner, this.interactionOwner()) && !this.runtimeMonitorsFrozen && !this.startupAborted
|
|
2126
|
-
&& ["hostBootId", "paneId", "launchId", "agentId", "instance", "sessionId", "commandSequence", "exitCode"].every(key => actual[key] === snapshot[key])
|
|
2127
|
-
&& this.tmux?.getWindowId() === snapshot.paneId;
|
|
2128
|
-
}
|
|
2129
|
-
async reconcileNativeDeliveries(outbox, current) {
|
|
2130
|
-
if (!this.nativePaneLifecycle)
|
|
2131
|
-
return false;
|
|
2132
|
-
return reconcileNativePaneTarget(outbox, this.name, this.nativePaneLifecycle, current);
|
|
2133
|
-
}
|
|
2134
|
-
/** Same-process transport for the owned native daemon; never exposed as a runner RPC. */
|
|
2135
|
-
setNativeFleetBridge(bridge) {
|
|
2136
|
-
if (!this.nativePaneLifecycle || this.nativeFleetBridge?.current())
|
|
2137
|
-
throw Error("Native Fleet bridge requires one bound pane owner");
|
|
2138
|
-
this.nativeFleetBridge = bridge;
|
|
2139
|
-
}
|
|
2140
|
-
/** Fleet admission and generation checks happen before this synchronous handoff. */
|
|
2141
|
-
acceptNativeFleetMessage(message) {
|
|
2142
|
-
if (!this.nativePaneLifecycle || !this.nativeFleetBridge?.current() || this.deliveryWritesStopping || this.runtimeMonitorsFrozen)
|
|
2143
|
-
return false;
|
|
2144
|
-
if (typeof message.type === "string" && FLEET_RESPONSE_TYPES.has(message.type)) {
|
|
2145
|
-
this.routeFleetResponse(message);
|
|
2146
|
-
return true;
|
|
2147
|
-
}
|
|
2148
|
-
const bridge = this.nativeFleetBridge;
|
|
2149
|
-
const current = () => this.nativeFleetBridge === bridge && bridge.current() && !this.deliveryWritesStopping && !this.runtimeMonitorsFrozen;
|
|
2150
|
-
return this.handleFleetMessage(message, reply => { if (current())
|
|
2151
|
-
this.broadcastFleetMessage(reply); }, current);
|
|
2152
|
-
}
|
|
2153
|
-
broadcastFleetMessage(message) {
|
|
2154
|
-
if (this.nativePaneLifecycle) {
|
|
2155
|
-
if (this.nativeFleetBridge?.current() && !this.runtimeMonitorsFrozen && !this.deliveryWritesStopping)
|
|
2156
|
-
this.nativeFleetBridge.send(message);
|
|
2157
|
-
}
|
|
2158
|
-
else
|
|
2159
|
-
this.ipcServer?.broadcast(message);
|
|
2160
|
-
}
|
|
2161
|
-
fleetTransportAvailable() {
|
|
2162
|
-
return this.nativePaneLifecycle ? !!this.nativeFleetBridge?.current() && !this.runtimeMonitorsFrozen : !!this.ipcServer;
|
|
2163
|
-
}
|
|
2164
|
-
/** Internal lifecycle injection, before start. Native paths and provider files stay on their runner. */
|
|
2165
|
-
setNativePaneLifecycle(native) {
|
|
2166
|
-
if (this.tmux || this.ipcServer || this.nativePaneLifecycle)
|
|
2167
|
-
throw Error("Native pane adapter must be bound before daemon startup");
|
|
2168
|
-
this.nativePaneLifecycle = native;
|
|
2169
|
-
this.backend = native.backend;
|
|
2170
|
-
this.paneTransport = native.host;
|
|
2171
|
-
this.controlClient = native.observation;
|
|
2172
|
-
}
|
|
2173
2073
|
constructor(name, config, instanceDir, topicMode = false, backend, controlClient, rootLogger, runtimeIdentity, spawnGate, stormWindow,
|
|
2174
2074
|
/** Fleet-level "is this CLI's backend down?" memory — see backend-outage.ts. */
|
|
2175
|
-
backendOutage
|
|
2075
|
+
backendOutage) {
|
|
2176
2076
|
super();
|
|
2177
2077
|
this.name = name;
|
|
2178
2078
|
this.config = config;
|
|
@@ -2184,7 +2084,6 @@ export class Daemon extends EventEmitter {
|
|
|
2184
2084
|
this.spawnGate = spawnGate;
|
|
2185
2085
|
this.stormWindow = stormWindow;
|
|
2186
2086
|
this.backendOutage = backendOutage;
|
|
2187
|
-
this.paneTransport = paneTransport;
|
|
2188
2087
|
// The live process owns its adopted configuration. Fleet defaults may be re-resolved in place after a save;
|
|
2189
2088
|
// sharing that object would activate cold changes before the normal restart/apply boundary.
|
|
2190
2089
|
this.config = structuredClone(config);
|
|
@@ -2207,8 +2106,7 @@ export class Daemon extends EventEmitter {
|
|
|
2207
2106
|
this.messageBus.setLogger(this.logger);
|
|
2208
2107
|
// General is the dispatcher — it must stay warm to route messages, so it is
|
|
2209
2108
|
// never auto-paused regardless of auto_pause_after.
|
|
2210
|
-
|
|
2211
|
-
const isGeneral = config.general_topic === true || generalByName(name, config);
|
|
2109
|
+
const isGeneral = config.general_topic === true || name === "general";
|
|
2212
2110
|
const autoPauseMinutes = isGeneral ? 0 : (typeof config.auto_pause_after === "number" ? config.auto_pause_after : 0); // default: disabled
|
|
2213
2111
|
this.autoPauseController = new AutoPauseController(Math.max(0, autoPauseMinutes) * 60_000, readLastInboundAt(instanceDir) ?? Date.now());
|
|
2214
2112
|
// #1209: every real completion clears the in-flight marker, so a
|
|
@@ -2229,6 +2127,12 @@ export class Daemon extends EventEmitter {
|
|
|
2229
2127
|
}
|
|
2230
2128
|
/** The fleet's other same-backend instances' working directories, read at spawn (#984). */
|
|
2231
2129
|
peerWorkingDirectories;
|
|
2130
|
+
/** This instance's teams (fleet.yaml), read at each spawn: their team decisions join its Active Decisions. */
|
|
2131
|
+
decisionTeams;
|
|
2132
|
+
setDecisionTeams(teams) { this.decisionTeams = teams; }
|
|
2133
|
+
/** The fleet's active decisions (startup snapshot), read at each spawn; absent: the AGEND_DECISIONS env (tests). */
|
|
2134
|
+
decisionSource;
|
|
2135
|
+
setDecisionSource(source) { this.decisionSource = source; }
|
|
2232
2136
|
setPeerWorkingDirectories(peers) {
|
|
2233
2137
|
this.peerWorkingDirectories = peers;
|
|
2234
2138
|
}
|
|
@@ -2270,19 +2174,12 @@ export class Daemon extends EventEmitter {
|
|
|
2270
2174
|
return outcome === "begun";
|
|
2271
2175
|
}
|
|
2272
2176
|
async durableAttemptEvidence(windowId, handingOffToNativeQueue, steer, rawPaste = false) {
|
|
2273
|
-
let checkpoint = null
|
|
2274
|
-
|
|
2275
|
-
|
|
2276
|
-
if (!runtimeTranscript || !this.nativePaneLifecycle.current(runtimeTranscript))
|
|
2277
|
-
throw Error("Native transcript checkpoint is not current; no delivery was written");
|
|
2177
|
+
let checkpoint = null;
|
|
2178
|
+
try {
|
|
2179
|
+
checkpoint = await this.transcriptMonitor?.reconciliationCheckpoint() ?? null;
|
|
2278
2180
|
}
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
checkpoint = await this.transcriptMonitor?.reconciliationCheckpoint() ?? null;
|
|
2282
|
-
}
|
|
2283
|
-
catch (err) {
|
|
2284
|
-
this.logger.debug({ err }, "Could not checkpoint transcript before durable delivery");
|
|
2285
|
-
}
|
|
2181
|
+
catch (err) {
|
|
2182
|
+
this.logger.debug({ err }, "Could not checkpoint transcript before durable delivery");
|
|
2286
2183
|
}
|
|
2287
2184
|
const submissionMode = rawPaste ? "raw_paste" : steer
|
|
2288
2185
|
? "steer"
|
|
@@ -2298,9 +2195,8 @@ export class Daemon extends EventEmitter {
|
|
|
2298
2195
|
backendVersion,
|
|
2299
2196
|
windowId: windowId ?? this.tmux?.getWindowId() ?? null,
|
|
2300
2197
|
transcriptPath: checkpoint?.path ?? null,
|
|
2301
|
-
transcriptOffset:
|
|
2302
|
-
transcriptSessionId:
|
|
2303
|
-
...(runtimeTranscript ? { runtimeTranscript } : {}),
|
|
2198
|
+
transcriptOffset: checkpoint?.offset ?? null,
|
|
2199
|
+
transcriptSessionId: checkpoint?.sessionId ?? null,
|
|
2304
2200
|
submissionMode,
|
|
2305
2201
|
queueResumePolicy: queueResumePolicyForAttempt(backend, backendVersion, submissionMode),
|
|
2306
2202
|
};
|
|
@@ -2343,25 +2239,17 @@ export class Daemon extends EventEmitter {
|
|
|
2343
2239
|
const outbox = this.deliveryOutbox;
|
|
2344
2240
|
if (!checkpoint || !outbox?.markConsumed)
|
|
2345
2241
|
return;
|
|
2346
|
-
if (this.nativePaneLifecycle && !checkpoint.runtime)
|
|
2347
|
-
return;
|
|
2348
2242
|
if (verdict.submissionMode !== "steer" && verdict.submissionMode !== "native_queue_handoff")
|
|
2349
2243
|
return;
|
|
2350
2244
|
if (!["claude-code", "codex"].includes(checkpoint.backend))
|
|
2351
2245
|
return;
|
|
2352
2246
|
const spawn = this.spawnGeneration, fence = this.launchFenceEpoch, boot = this.bootId;
|
|
2353
|
-
let location;
|
|
2354
|
-
try {
|
|
2355
|
-
location = checkpoint.runtime ? { reader: this.nativeTranscriptReader(checkpoint.runtime, delivery.deliveryId) } : { path: checkpoint.path, offset: checkpoint.offset };
|
|
2356
|
-
}
|
|
2357
|
-
catch {
|
|
2358
|
-
return;
|
|
2359
|
-
} // The owner changed; an unavailable consumed watch proves nothing.
|
|
2360
2247
|
consumedWatches.start({
|
|
2361
2248
|
deliveryId: delivery.deliveryId,
|
|
2362
2249
|
attemptNo: delivery.attemptNo,
|
|
2363
2250
|
backend: checkpoint.backend,
|
|
2364
|
-
|
|
2251
|
+
path: checkpoint.path,
|
|
2252
|
+
offset: checkpoint.offset,
|
|
2365
2253
|
current: () => !this.deliveryWritesStopping && spawn === this.spawnGeneration && fence === this.launchFenceEpoch,
|
|
2366
2254
|
consumed: (via, evidence) => {
|
|
2367
2255
|
try {
|
|
@@ -2403,18 +2291,15 @@ export class Daemon extends EventEmitter {
|
|
|
2403
2291
|
: humanVerificationId ? `[agend-human-id:${humanVerificationId}]` : null;
|
|
2404
2292
|
if (!marker || !formatted.startsWith(marker))
|
|
2405
2293
|
return;
|
|
2406
|
-
let
|
|
2407
|
-
if (!
|
|
2294
|
+
let checkpoint = verdict.transcriptCheckpoint ?? null;
|
|
2295
|
+
if (!checkpoint) {
|
|
2408
2296
|
try {
|
|
2409
|
-
|
|
2297
|
+
checkpoint = await this.transcriptMonitor?.reconciliationCheckpoint() ?? null;
|
|
2410
2298
|
}
|
|
2411
2299
|
catch (err) {
|
|
2412
2300
|
this.logger.debug({ err }, "Could not checkpoint the transcript before a queued hand-off");
|
|
2413
2301
|
}
|
|
2414
2302
|
}
|
|
2415
|
-
// main→alpha sync: a hand-off record is judged against a local transcript file. A native or remote runtime's
|
|
2416
|
-
// transcript (no local path) has none: it runs as before (✅ at the hand-off), as with no checkpoint at all.
|
|
2417
|
-
const checkpoint = found && typeof found.path === "string" && typeof found.offset === "number" ? { path: found.path, offset: found.offset } : null;
|
|
2418
2303
|
if (!checkpoint)
|
|
2419
2304
|
return; // nothing could judge it later: it runs as before (✅ at the hand-off)
|
|
2420
2305
|
const entry = {
|
|
@@ -2682,34 +2567,24 @@ export class Daemon extends EventEmitter {
|
|
|
2682
2567
|
const spawn = this.spawnGeneration;
|
|
2683
2568
|
const fence = this.launchFenceEpoch;
|
|
2684
2569
|
let last = "unavailable";
|
|
2685
|
-
|
|
2686
|
-
let
|
|
2687
|
-
let evidence = native ? "runtime-transcript-unconfirmed" : OUTPUT_EDGE_ONLY_EVIDENCE;
|
|
2570
|
+
let outcome = "delivered";
|
|
2571
|
+
let evidence = OUTPUT_EDGE_ONLY_EVIDENCE;
|
|
2688
2572
|
// #1647: a raw paste has no marker; its text is the needle, and its pane proof already failed — so without the turn
|
|
2689
2573
|
// in the transcript it stays uncertain (with the pane's reason), never the output-edge outcome.
|
|
2690
2574
|
const needle = rawPaste ? { rawText: rawPaste.text } : delivery.deliveryId;
|
|
2691
2575
|
let found = false;
|
|
2692
2576
|
try {
|
|
2693
|
-
if (this.nativePaneLifecycle && !checkpoint.runtime)
|
|
2694
|
-
throw Error("Native proof cannot read a coordinator-local transcript path");
|
|
2695
|
-
const nativeReader = checkpoint.runtime ? this.nativeTranscriptReader(checkpoint.runtime, needle) : null;
|
|
2696
2577
|
for (let polls = 0; polls <= TRANSCRIPT_PROOF_WINDOW_MS / TRANSCRIPT_PROOF_POLL_MS; polls++) {
|
|
2697
2578
|
if (this.deliveryWritesStopping)
|
|
2698
2579
|
return; // reconciliation owns the row now
|
|
2699
|
-
const look =
|
|
2700
|
-
if (this.deliveryWritesStopping)
|
|
2701
|
-
return;
|
|
2702
|
-
if (spawn !== this.spawnGeneration || fence !== this.launchFenceEpoch) {
|
|
2703
|
-
last = "unavailable";
|
|
2704
|
-
break;
|
|
2705
|
-
}
|
|
2580
|
+
const look = await scanTranscriptForDeliveryMarker(checkpoint.path, checkpoint.offset, checkpoint.backend, needle);
|
|
2706
2581
|
if (look === "user" || look === "absorbed" || look === "queued") {
|
|
2707
2582
|
found = true;
|
|
2708
2583
|
outcome = "delivered";
|
|
2709
2584
|
evidence = transcriptMarkerEvidence(look, !!rawPaste);
|
|
2710
2585
|
break;
|
|
2711
2586
|
}
|
|
2712
|
-
last = look
|
|
2587
|
+
last = look;
|
|
2713
2588
|
if (spawn !== this.spawnGeneration || fence !== this.launchFenceEpoch) {
|
|
2714
2589
|
last = "unavailable";
|
|
2715
2590
|
break;
|
|
@@ -2721,13 +2596,13 @@ export class Daemon extends EventEmitter {
|
|
|
2721
2596
|
// `uncertain`: re-check the same fixed epochs after the last await, before settling (#1207 P2).
|
|
2722
2597
|
if (spawn !== this.spawnGeneration || fence !== this.launchFenceEpoch)
|
|
2723
2598
|
last = "unavailable";
|
|
2724
|
-
if (last === "no-match" &&
|
|
2599
|
+
if (last === "no-match" && evidence === OUTPUT_EDGE_ONLY_EVIDENCE) {
|
|
2725
2600
|
outcome = "uncertain";
|
|
2726
2601
|
evidence = "unverifiable-no-transcript-marker";
|
|
2727
2602
|
}
|
|
2728
2603
|
}
|
|
2729
2604
|
catch (err) {
|
|
2730
|
-
this.logger.debug({ err }, "Transcript proof
|
|
2605
|
+
this.logger.debug({ err }, "Transcript proof of a delivery failed — keeping the output-edge outcome");
|
|
2731
2606
|
}
|
|
2732
2607
|
if (rawPaste && !found) {
|
|
2733
2608
|
outcome = "uncertain";
|
|
@@ -2914,150 +2789,128 @@ export class Daemon extends EventEmitter {
|
|
|
2914
2789
|
}
|
|
2915
2790
|
}
|
|
2916
2791
|
catch { /* corrupt/missing — ignore */ }
|
|
2917
|
-
|
|
2918
|
-
|
|
2919
|
-
|
|
2920
|
-
|
|
2921
|
-
|
|
2922
|
-
|
|
2923
|
-
|
|
2924
|
-
|
|
2925
|
-
|
|
2926
|
-
|
|
2927
|
-
|
|
2928
|
-
|
|
2929
|
-
|
|
2930
|
-
|
|
2931
|
-
|
|
2932
|
-
|
|
2933
|
-
|
|
2934
|
-
|
|
2935
|
-
|
|
2936
|
-
|
|
2937
|
-
|
|
2938
|
-
|
|
2939
|
-
|
|
2940
|
-
|
|
2941
|
-
|
|
2942
|
-
|
|
2943
|
-
|
|
2944
|
-
|
|
2945
|
-
|
|
2946
|
-
|
|
2947
|
-
|
|
2948
|
-
|
|
2949
|
-
|
|
2950
|
-
|
|
2951
|
-
|
|
2952
|
-
|
|
2953
|
-
|
|
2954
|
-
|
|
2955
|
-
|
|
2956
|
-
|
|
2957
|
-
sessions.push(sessionName);
|
|
2958
|
-
}
|
|
2792
|
+
// 1. IPC server — bridge between MCP server (Claude's child) and daemon
|
|
2793
|
+
const sockPath = join(this.instanceDir, "channel.sock");
|
|
2794
|
+
this.ipcServer = new IpcServer(sockPath, this.logger);
|
|
2795
|
+
// Forward IPC server errors as daemon events (prevents unhandled 'error' crash).
|
|
2796
|
+
// Guard: only forward post-listen errors — startup errors are handled by listen() rejection.
|
|
2797
|
+
let ipcListening = false;
|
|
2798
|
+
this.ipcServer.on("error", (err) => {
|
|
2799
|
+
if (!ipcListening)
|
|
2800
|
+
return; // startup errors handled by listen() rejection
|
|
2801
|
+
this.logger.error({ err, name: this.name }, "IPC server error");
|
|
2802
|
+
this.emit("error", err);
|
|
2803
|
+
});
|
|
2804
|
+
await this.ipcServer.listen();
|
|
2805
|
+
this.startupAdmission?.();
|
|
2806
|
+
ipcListening = true;
|
|
2807
|
+
// Permanent IPC dispatcher: routes responses to pending requests by type+id key
|
|
2808
|
+
this.ipcServer.on("message", (msg) => this.routeFleetResponse(msg));
|
|
2809
|
+
// IPC message relay: when daemon wants to push a channel message to Claude,
|
|
2810
|
+
// it broadcasts to all IPC clients (the MCP server is one of them).
|
|
2811
|
+
// When MCP server sends a tool_call, daemon handles it via the messageBus.
|
|
2812
|
+
this.ipcServer.on("message", (msg, socket) => {
|
|
2813
|
+
if (msg.type === "tool_call") {
|
|
2814
|
+
// MCP server forwarding a Claude tool call (reply, react, edit, download)
|
|
2815
|
+
this.handleToolCall(msg, socket);
|
|
2816
|
+
}
|
|
2817
|
+
else if (msg.type === "mcp_ready") {
|
|
2818
|
+
this.handleMcpReady(msg, socket);
|
|
2819
|
+
}
|
|
2820
|
+
else if (msg.type === "pong") {
|
|
2821
|
+
this.handleMcpPong(msg, socket);
|
|
2822
|
+
}
|
|
2823
|
+
else if (msg.type === "query_sessions") {
|
|
2824
|
+
// Fleet manager asks for all registered session names (catches sessions
|
|
2825
|
+
// that sent mcp_ready before fleet manager connected).
|
|
2826
|
+
const sessions = [];
|
|
2827
|
+
for (const [s, sessionName] of this.socketSessionNames) {
|
|
2828
|
+
if (!s.destroyed && sessionName !== this.name) {
|
|
2829
|
+
// Individual mcp_ready for initial registration path
|
|
2830
|
+
this.ipcServer?.send(socket, { type: "mcp_ready", sessionName });
|
|
2831
|
+
sessions.push(sessionName);
|
|
2959
2832
|
}
|
|
2960
|
-
// Batch response for prune path
|
|
2961
|
-
this.ipcServer?.send(socket, { type: "query_sessions_response", sessions });
|
|
2962
2833
|
}
|
|
2963
|
-
|
|
2964
|
-
|
|
2965
|
-
}
|
|
2966
|
-
|
|
2967
|
-
|
|
2968
|
-
|
|
2969
|
-
|
|
2970
|
-
|
|
2971
|
-
|
|
2972
|
-
this.
|
|
2973
|
-
|
|
2974
|
-
|
|
2834
|
+
// Batch response for prune path
|
|
2835
|
+
this.ipcServer?.send(socket, { type: "query_sessions_response", sessions });
|
|
2836
|
+
}
|
|
2837
|
+
else if (msg.type === "fleet_inbound") {
|
|
2838
|
+
// Fleet manager routed a message to us (topic mode)
|
|
2839
|
+
const meta = msg.meta;
|
|
2840
|
+
const targetSession = msg.targetSession;
|
|
2841
|
+
const deliveryEpoch = this.captureDeliveryEpoch(msg.delivery_epoch);
|
|
2842
|
+
void this.wake().then(() => {
|
|
2843
|
+
this.pushChannelMessage(msg.content, meta, targetSession, deliveryEpoch);
|
|
2844
|
+
}).catch(err => {
|
|
2845
|
+
this.deferDurableDelivery(meta, `target wake failed before pane submission: ${err.message}`);
|
|
2846
|
+
this.logger.error({ err: err.message }, "Wake failed for inbound delivery");
|
|
2975
2847
|
});
|
|
2976
|
-
this.tmux = acquired.pane;
|
|
2977
|
-
this.nativeTranscriptSource = acquired.source;
|
|
2978
|
-
nativeDisposition = acquired.disposition;
|
|
2979
|
-
this.lastSpawnAt = Date.now();
|
|
2980
|
-
this.setProcessStatus("running");
|
|
2981
|
-
this.bindInstanceStateOutputListener(this.tmux.getWindowId());
|
|
2982
|
-
this.saveSessionId();
|
|
2983
|
-
// New/resumed native processes can still be painting their first frame. Keep deliveries behind the same
|
|
2984
|
-
// bounded dialog/readiness scan as local startup. An already-running reattachment may be busy: do not
|
|
2985
|
-
// wait for that work to finish or inject a startup key into it.
|
|
2986
|
-
if (acquired.disposition === "reattached") {
|
|
2987
|
-
if (this.backend?.binaryName === "codex") {
|
|
2988
|
-
const native = this.nativePaneLifecycle, spawn = this.spawnGeneration, fence = this.launchFenceEpoch, attempt = this.launchAttempt;
|
|
2989
|
-
try {
|
|
2990
|
-
const pane = await acquired.pane.capturePane();
|
|
2991
|
-
this.startupAdmission?.();
|
|
2992
|
-
if (!this.startupAborted && !this.deliveryWritesStopping && this.nativePaneLifecycle === native && this.tmux === acquired.pane
|
|
2993
|
-
&& spawn === this.spawnGeneration && fence === this.launchFenceEpoch && attempt === this.launchAttempt && native.current())
|
|
2994
|
-
this.takeQuotaReplayBaseline(pane);
|
|
2995
|
-
}
|
|
2996
|
-
catch { /* An old runner or unavailable proof keeps the existing fail-closed scanner. */ }
|
|
2997
|
-
}
|
|
2998
|
-
}
|
|
2999
|
-
else {
|
|
3000
|
-
if (!await this.finishStartupScan(120_000))
|
|
3001
|
-
throw Error("Native CLI exited during startup; retained session was not replaced");
|
|
3002
|
-
this.startupAdmission?.();
|
|
3003
|
-
if (this.startupAborted || this.deliveryWritesStopping || !this.nativePaneLifecycle.current())
|
|
3004
|
-
throw Error("Native launch was superseded");
|
|
3005
|
-
}
|
|
3006
2848
|
}
|
|
3007
|
-
|
|
3008
|
-
this.
|
|
2849
|
+
else if (msg.type === "raw_paste") {
|
|
2850
|
+
this.handleRawPasteIpcMessage(msg);
|
|
3009
2851
|
}
|
|
3010
|
-
|
|
3011
|
-
|
|
3012
|
-
// 2. Tmux — ensure session, create window if not alive
|
|
3013
|
-
await this.paneHost.ensureSession(this.tmuxSessionName);
|
|
3014
|
-
this.startupAdmission?.();
|
|
3015
|
-
this.tmux = this.paneHost.bind(this.tmuxSessionName, "", resolveTmuxLogicalSize(this.config.terminal), this.controlClient);
|
|
3016
|
-
// M-2457 §6 rule 3: a window-id 2.3 wrote names a window of the SYSTEM tmux's default server.
|
|
3017
|
-
// That window is proven ours, checkpointed and closed (or this instance is held) — and the id is dropped, as it
|
|
3018
|
-
// means nothing on AgEnD's own server — before the fresh-start below can look at it.
|
|
3019
|
-
await migrateLegacyWindow({ agendHome: getAgendHome(), instance: this.name, instanceDir: this.instanceDir, session: this.tmuxSessionName, legacySocket: legacyTmuxSocket(), currentSocket: tmuxSocket(),
|
|
3020
|
-
backendBinary: this.backend?.binaryName ?? "", checkpoint: () => this.checkpointSessionId(),
|
|
3021
|
-
log: (msg, data) => this.logger.info(data ?? {}, msg) });
|
|
3022
|
-
this.startupAdmission?.();
|
|
3023
|
-
// Strategy A: always start fresh Claude window (MCP server has no reconnection)
|
|
3024
|
-
// Kill any existing window from previous run
|
|
3025
|
-
const windowIdFile = join(this.instanceDir, "window-id");
|
|
3026
|
-
if (existsSync(windowIdFile)) {
|
|
3027
|
-
const savedId = readFileSync(windowIdFile, "utf-8").trim();
|
|
3028
|
-
if (savedId) {
|
|
3029
|
-
const oldTmux = this.paneHost.bind(this.tmuxSessionName, savedId);
|
|
3030
|
-
if (await oldTmux.isWindowAlive()) {
|
|
3031
|
-
this.startupAdmission?.();
|
|
3032
|
-
await this.checkpointSessionId();
|
|
3033
|
-
this.startupAdmission?.();
|
|
3034
|
-
await oldTmux.killWindow();
|
|
3035
|
-
this.startupAdmission?.();
|
|
3036
|
-
this.logger.info({ savedId }, "Killed old tmux window for fresh start");
|
|
3037
|
-
}
|
|
3038
|
-
}
|
|
2852
|
+
else if (msg.type === "config_update") {
|
|
2853
|
+
this.applyConfigUpdate(msg.config);
|
|
3039
2854
|
}
|
|
3040
|
-
|
|
3041
|
-
|
|
3042
|
-
|
|
3043
|
-
if (!resumed) {
|
|
3044
|
-
await this.injectSnapshotMessage(this.startupAdmission);
|
|
3045
|
-
this.startupAdmission?.();
|
|
2855
|
+
else if (msg.type === "steer") {
|
|
2856
|
+
const meta = (msg.meta ?? {});
|
|
2857
|
+
this.steerMessage(msg.content, meta, this.captureDeliveryEpoch(msg.delivery_epoch));
|
|
3046
2858
|
}
|
|
3047
|
-
else {
|
|
3048
|
-
|
|
3049
|
-
|
|
3050
|
-
|
|
2859
|
+
else if (msg.type === "btw") {
|
|
2860
|
+
const meta = (msg.meta ?? {});
|
|
2861
|
+
this.btwMessage(msg.content, meta, this.captureDeliveryEpoch(msg.delivery_epoch));
|
|
2862
|
+
}
|
|
2863
|
+
else if (msg.type === "fleet_schedule_trigger") {
|
|
2864
|
+
const payload = msg.payload;
|
|
2865
|
+
const meta = msg.meta;
|
|
2866
|
+
const deliveryEpoch = this.captureDeliveryEpoch(msg.delivery_epoch);
|
|
2867
|
+
void this.wake().then(() => this.pushChannelMessage(payload.message, meta, undefined, deliveryEpoch)).catch(err => {
|
|
2868
|
+
this.logger.error({ err: err.message }, "Wake failed for scheduled delivery");
|
|
2869
|
+
});
|
|
2870
|
+
}
|
|
2871
|
+
else if (msg.type === "query_instance_state") {
|
|
2872
|
+
void this.respondToInstanceStateQuery(msg, socket);
|
|
2873
|
+
}
|
|
2874
|
+
});
|
|
2875
|
+
// 2. Tmux — ensure session, create window if not alive
|
|
2876
|
+
await TmuxManager.ensureSession(this.tmuxSessionName);
|
|
2877
|
+
this.startupAdmission?.();
|
|
2878
|
+
this.tmux = new TmuxManager(this.tmuxSessionName, "", resolveTmuxLogicalSize(this.config.terminal), this.controlClient);
|
|
2879
|
+
// Strategy A: always start fresh Claude window (MCP server has no reconnection)
|
|
2880
|
+
// Kill any existing window from previous run
|
|
2881
|
+
const windowIdFile = join(this.instanceDir, "window-id");
|
|
2882
|
+
if (existsSync(windowIdFile)) {
|
|
2883
|
+
const savedId = readFileSync(windowIdFile, "utf-8").trim();
|
|
2884
|
+
if (savedId) {
|
|
2885
|
+
const oldTmux = new TmuxManager(this.tmuxSessionName, savedId);
|
|
2886
|
+
if (await oldTmux.isWindowAlive()) {
|
|
2887
|
+
this.startupAdmission?.();
|
|
2888
|
+
await this.checkpointSessionId();
|
|
2889
|
+
this.startupAdmission?.();
|
|
2890
|
+
await oldTmux.killWindow();
|
|
2891
|
+
this.startupAdmission?.();
|
|
2892
|
+
this.logger.info({ savedId }, "Killed old tmux window for fresh start");
|
|
3051
2893
|
}
|
|
3052
|
-
catch { /* may not exist */ }
|
|
3053
2894
|
}
|
|
3054
2895
|
}
|
|
3055
|
-
|
|
3056
|
-
|
|
2896
|
+
const resumed = await this.spawnClaudeWindow();
|
|
2897
|
+
this.startupAdmission?.();
|
|
2898
|
+
this.isNewSession = !resumed;
|
|
2899
|
+
if (!resumed) {
|
|
2900
|
+
await this.injectSnapshotMessage(this.startupAdmission);
|
|
2901
|
+
this.startupAdmission?.();
|
|
2902
|
+
}
|
|
2903
|
+
else {
|
|
2904
|
+
// Clean up stale snapshot file — resume restored full context, snapshot not needed
|
|
2905
|
+
try {
|
|
2906
|
+
unlinkSync(join(this.instanceDir, "rotation-state.json"));
|
|
2907
|
+
}
|
|
2908
|
+
catch { /* may not exist */ }
|
|
2909
|
+
}
|
|
3057
2910
|
// #1209: conditional continuation for the turn interrupted by the last
|
|
3058
2911
|
// restart, if the gates allow. Detached; the gate
|
|
3059
2912
|
// consumes its one-shot marker first and never throws into boot.
|
|
3060
|
-
const legacyResume = this.
|
|
2913
|
+
const legacyResume = this.maybeResumeInterruptedTurn().catch(() => "unknown");
|
|
3061
2914
|
const recoveryOwner = JSON.stringify(this.interactionOwner());
|
|
3062
2915
|
void Promise.allSettled([legacyResume]).then(() => {
|
|
3063
2916
|
if (JSON.stringify(this.interactionOwner()) === recoveryOwner) {
|
|
@@ -3076,7 +2929,7 @@ export class Daemon extends EventEmitter {
|
|
|
3076
2929
|
// (statusline transcript); codex/kiro/opencode read their CLI's own
|
|
3077
2930
|
// conversation store via a pluggable source. Backends with no known
|
|
3078
2931
|
// source stay inert exactly as before.
|
|
3079
|
-
this.transcriptMonitor = this.buildTranscriptMonitor(
|
|
2932
|
+
this.transcriptMonitor = this.buildTranscriptMonitor(createTranscriptSource(this.config.backend ?? "claude-code", this.config.working_directory, this.credentialProfileStore(), () => this.backend?.transcriptLaunch?.() ?? null));
|
|
3080
2933
|
const transcriptMonitor = this.transcriptMonitor;
|
|
3081
2934
|
const transcriptFence = this.launchFenceEpoch;
|
|
3082
2935
|
// Baseline in the isolate before this daemon accepts new work. A
|
|
@@ -3132,15 +2985,13 @@ export class Daemon extends EventEmitter {
|
|
|
3132
2985
|
if (hangConfig?.enabled !== false) {
|
|
3133
2986
|
this.hangDetector = new HangDetector();
|
|
3134
2987
|
}
|
|
3135
|
-
|
|
3136
|
-
|
|
3137
|
-
|
|
3138
|
-
|
|
3139
|
-
|
|
3140
|
-
this.
|
|
3141
|
-
|
|
3142
|
-
});
|
|
3143
|
-
}
|
|
2988
|
+
// 8. Context guardian
|
|
2989
|
+
const statusFile = join(this.instanceDir, "statusline.json");
|
|
2990
|
+
this.guardian = new ContextGuardian(this.config.context_guardian ?? {}, this.logger, statusFile);
|
|
2991
|
+
this.guardian.startWatching();
|
|
2992
|
+
this.guardian.on("status_update", () => {
|
|
2993
|
+
this.saveSessionId();
|
|
2994
|
+
});
|
|
3144
2995
|
// Context rotation removed: all CLI backends have built-in auto-compact.
|
|
3145
2996
|
// Crash recovery (health check + respawn with snapshot) is retained below.
|
|
3146
2997
|
}
|
|
@@ -3193,7 +3044,7 @@ export class Daemon extends EventEmitter {
|
|
|
3193
3044
|
this.socketPids.delete(socket);
|
|
3194
3045
|
// Notify fleet manager so it can clean up sessionRegistry
|
|
3195
3046
|
if (sessionName !== this.name) {
|
|
3196
|
-
this.
|
|
3047
|
+
this.ipcServer?.broadcast({ type: "session_disconnected", sessionName });
|
|
3197
3048
|
}
|
|
3198
3049
|
});
|
|
3199
3050
|
}
|
|
@@ -3209,16 +3060,11 @@ export class Daemon extends EventEmitter {
|
|
|
3209
3060
|
// sub-agent's server may have left a dead pid in the slot).
|
|
3210
3061
|
this.noteMcpProofOfLife("mcp_ready", typeof msg.pid === "number" ? msg.pid : undefined);
|
|
3211
3062
|
}
|
|
3212
|
-
this.
|
|
3063
|
+
this.ipcServer?.broadcast({ type: "mcp_ready", sessionName });
|
|
3213
3064
|
}
|
|
3214
3065
|
checkMcpServerAlive() {
|
|
3215
3066
|
if (this.isPaused)
|
|
3216
3067
|
return;
|
|
3217
|
-
if (this.nativePaneLifecycle) {
|
|
3218
|
-
if (this.nativePaneLifecycle.mcpProof() === "alive")
|
|
3219
|
-
this.noteMcpProofOfLife("connection");
|
|
3220
|
-
return; // No native PID/socket guessing or restart from an unknown helper observation.
|
|
3221
|
-
}
|
|
3222
3068
|
const status = mcpServerState(this.instanceDir);
|
|
3223
3069
|
if (status.state === "alive") {
|
|
3224
3070
|
this.mcpServedGeneration = this.spawnGeneration;
|
|
@@ -3302,8 +3148,6 @@ export class Daemon extends EventEmitter {
|
|
|
3302
3148
|
* server from a third-party one, and failed the whole launch for either.
|
|
3303
3149
|
*/
|
|
3304
3150
|
checkFleetMcpNeverConnected() {
|
|
3305
|
-
if (this.nativePaneLifecycle)
|
|
3306
|
-
return; // Native helper presence owns this observation.
|
|
3307
3151
|
if (this.config.agent_mode === "cli")
|
|
3308
3152
|
return; // no MCP server by design
|
|
3309
3153
|
if (this.lastSpawnAt === 0 || this.mcpServedGeneration === this.spawnGeneration)
|
|
@@ -3514,8 +3358,6 @@ export class Daemon extends EventEmitter {
|
|
|
3514
3358
|
* proof that tools are being served, whatever channel.mcp.pid says.
|
|
3515
3359
|
*/
|
|
3516
3360
|
mcpServerAlive() {
|
|
3517
|
-
if (this.nativePaneLifecycle)
|
|
3518
|
-
return this.nativePaneLifecycle.mcpProof() === "alive" ? { alive: true, source: "connection" } : { alive: false, source: "none" };
|
|
3519
3361
|
const status = mcpServerState(this.instanceDir);
|
|
3520
3362
|
if (status.state === "alive")
|
|
3521
3363
|
return { alive: true, source: "pid", pid: status.pid };
|
|
@@ -3580,7 +3422,7 @@ export class Daemon extends EventEmitter {
|
|
|
3580
3422
|
this.mcpDeathNotifiedForPid = null;
|
|
3581
3423
|
this.mcpDeathDeferredForPid = null;
|
|
3582
3424
|
this.clearMcpRestartRequest();
|
|
3583
|
-
if (
|
|
3425
|
+
if (pid && mcpServerState(this.instanceDir).state !== "alive")
|
|
3584
3426
|
this.repairMcpPidSlot(pid, source);
|
|
3585
3427
|
}
|
|
3586
3428
|
emitMcpRecovered(source, pid) {
|
|
@@ -3627,26 +3469,6 @@ export class Daemon extends EventEmitter {
|
|
|
3627
3469
|
// ended this instance's health loop because scheduleNext() sat after the
|
|
3628
3470
|
// throwing code. Catch, log, and keep checking.
|
|
3629
3471
|
try {
|
|
3630
|
-
if (this.nativePaneLifecycle) {
|
|
3631
|
-
if (this.healthCheckPaused) {
|
|
3632
|
-
scheduleNext();
|
|
3633
|
-
return;
|
|
3634
|
-
}
|
|
3635
|
-
const native = this.nativePaneLifecycle, pane = this.tmux;
|
|
3636
|
-
const status = await pane?.getPaneStatus();
|
|
3637
|
-
if (this.runtimeMonitorsFrozen || native !== this.nativePaneLifecycle || pane !== this.tmux)
|
|
3638
|
-
return;
|
|
3639
|
-
const snapshot = native.snapshot?.();
|
|
3640
|
-
if (status?.alive === false && snapshot?.state === "exited") {
|
|
3641
|
-
this.healthCheckPaused = true;
|
|
3642
|
-
this.setProcessStatus(snapshot.exitCode === 0 ? "stopped" : "crashed");
|
|
3643
|
-
this.emit("native_pane_exited", { name: this.name, snapshot, owner: this.interactionOwner() });
|
|
3644
|
-
}
|
|
3645
|
-
else if (status?.alive)
|
|
3646
|
-
this.checkMcpServerAlive();
|
|
3647
|
-
scheduleNext();
|
|
3648
|
-
return;
|
|
3649
|
-
}
|
|
3650
3472
|
// Instance directory removed externally (e.g. `rm -rf ~/.agend/instances/<name>`).
|
|
3651
3473
|
// Stop the loop permanently — otherwise every tick triggers a respawn, whose
|
|
3652
3474
|
// writeRotationSnapshot fails with ENOENT and gets caught as "Failed to respawn",
|
|
@@ -3782,13 +3604,13 @@ export class Daemon extends EventEmitter {
|
|
|
3782
3604
|
let inWindowLossBurst = false;
|
|
3783
3605
|
let nullReason;
|
|
3784
3606
|
if (!paneStatus) {
|
|
3785
|
-
const serverAlive = await
|
|
3607
|
+
const serverAlive = await TmuxManager.sessionExists(this.tmuxSessionName);
|
|
3786
3608
|
if (discardStaleHealth())
|
|
3787
3609
|
return;
|
|
3788
3610
|
// A server may have already restarted before this daemon's health
|
|
3789
3611
|
// tick. The new PID is the durable generation boundary: treat it as
|
|
3790
3612
|
// a fleet storm even though `has-session` is true again.
|
|
3791
|
-
const serverPid = serverAlive ? await
|
|
3613
|
+
const serverPid = serverAlive ? await TmuxManager.getServerPid(this.tmuxSessionName) : null;
|
|
3792
3614
|
if (discardStaleHealth())
|
|
3793
3615
|
return;
|
|
3794
3616
|
const generationChanged = serverAlive && this.stormWindow?.observeServerAlive(serverPid) === true;
|
|
@@ -3817,7 +3639,7 @@ export class Daemon extends EventEmitter {
|
|
|
3817
3639
|
// the window truly no longer exists vs a transient query glitch.
|
|
3818
3640
|
nullReason = "no_window";
|
|
3819
3641
|
try {
|
|
3820
|
-
const windows = await
|
|
3642
|
+
const windows = await TmuxManager.listWindowsStrict(this.tmuxSessionName, this.controlClient);
|
|
3821
3643
|
if (discardStaleHealth())
|
|
3822
3644
|
return;
|
|
3823
3645
|
this.windowQueryFailureTicks = 0;
|
|
@@ -4064,10 +3886,10 @@ export class Daemon extends EventEmitter {
|
|
|
4064
3886
|
// Wrapped in try-catch: if tmux server is dead, listWindows throws —
|
|
4065
3887
|
// must not block spawnClaudeWindow (which calls ensureSession).
|
|
4066
3888
|
try {
|
|
4067
|
-
const windows = await
|
|
3889
|
+
const windows = await TmuxManager.listWindows(this.tmuxSessionName);
|
|
4068
3890
|
for (const w of windows) {
|
|
4069
3891
|
if (w.name === this.name) {
|
|
4070
|
-
const tm =
|
|
3892
|
+
const tm = new TmuxManager(this.tmuxSessionName, w.id);
|
|
4071
3893
|
await tm.killWindow();
|
|
4072
3894
|
}
|
|
4073
3895
|
}
|
|
@@ -4212,7 +4034,7 @@ export class Daemon extends EventEmitter {
|
|
|
4212
4034
|
// Force the next ready capture to emit a fresh transition after respawn.
|
|
4213
4035
|
this.instanceState = "working";
|
|
4214
4036
|
}
|
|
4215
|
-
this.
|
|
4037
|
+
this.ipcServer?.broadcast({
|
|
4216
4038
|
type: "instance_process_state",
|
|
4217
4039
|
instanceName: this.name,
|
|
4218
4040
|
status,
|
|
@@ -4408,15 +4230,12 @@ export class Daemon extends EventEmitter {
|
|
|
4408
4230
|
for (const key of dialog.keys) {
|
|
4409
4231
|
if (stale())
|
|
4410
4232
|
return;
|
|
4411
|
-
const keyScreen = this.nativePaneLifecycle ? await pollTmux.capturePane() : currentPane;
|
|
4412
|
-
if (stale() || !Daemon.dialogMatches(dialog, keyScreen))
|
|
4413
|
-
return;
|
|
4414
4233
|
let sent = false;
|
|
4415
4234
|
if (SPECIAL_KEYS.has(key)) {
|
|
4416
|
-
sent = await
|
|
4235
|
+
sent = await pollTmux.sendSpecialKey(key);
|
|
4417
4236
|
}
|
|
4418
4237
|
else if (dialog.literalKeys) {
|
|
4419
|
-
sent = await
|
|
4238
|
+
sent = await pollTmux.sendKeys(key); // typed, no Enter (#2872)
|
|
4420
4239
|
}
|
|
4421
4240
|
else {
|
|
4422
4241
|
sent = await pollTmux.pasteText(key, this.systemPasteOptions());
|
|
@@ -4719,6 +4538,14 @@ export class Daemon extends EventEmitter {
|
|
|
4719
4538
|
}
|
|
4720
4539
|
/** Arm the recovery gates and emit one detected error pattern. */
|
|
4721
4540
|
emitErrorPattern(ep, key, pane, now) {
|
|
4541
|
+
const minimum = this.backend?.binaryName === "claude" && ep.type === "outdated_cli" ? claudeMinimumError(pane) : null;
|
|
4542
|
+
if (minimum) {
|
|
4543
|
+
this.lastErrorNotifiedAt.set(key, now);
|
|
4544
|
+
void this.handleClaudeModelMinimum(minimum).catch(err => {
|
|
4545
|
+
this.logger.warn({ reason: String(err) }, "CLI launch repair failed");
|
|
4546
|
+
});
|
|
4547
|
+
return;
|
|
4548
|
+
}
|
|
4722
4549
|
// #2795: auth text on the pane proves nothing about the credentials (22 of 22 such matches on the main host were
|
|
4723
4550
|
// conversation text). It arms nothing here; it only asks the lifecycle's token-free check, and a failing check
|
|
4724
4551
|
// arms the auth state through confirmAuthFailure().
|
|
@@ -4787,20 +4614,7 @@ export class Daemon extends EventEmitter {
|
|
|
4787
4614
|
*/
|
|
4788
4615
|
async sendEscape() {
|
|
4789
4616
|
const cancelKey = this.backend?.getCancelKey() ?? "Escape";
|
|
4790
|
-
|
|
4791
|
-
if (!tmux)
|
|
4792
|
-
return;
|
|
4793
|
-
if (this.nativePaneLifecycle) {
|
|
4794
|
-
// A native pane's composer proof cannot see a permission dialog, so an unproved key is withheld there. The cancel
|
|
4795
|
-
// is the person's own interrupt, keyed on the screen read just before (as the dialog answer path is): what Esc
|
|
4796
|
-
// does on Linux's tmux pane, on the same screen, with the same key.
|
|
4797
|
-
const screen = await tmux.capturePane().catch(() => null);
|
|
4798
|
-
if (screen === null)
|
|
4799
|
-
return;
|
|
4800
|
-
await tmux.sendSpecialKey(cancelKey, undefined, { kind: "dialog", screen });
|
|
4801
|
-
return;
|
|
4802
|
-
}
|
|
4803
|
-
await tmux.sendSpecialKey(cancelKey);
|
|
4617
|
+
await this.tmux?.sendSpecialKey(cancelKey);
|
|
4804
4618
|
}
|
|
4805
4619
|
/**
|
|
4806
4620
|
* Drop every not-yet-started pane delivery which predates a user cancel.
|
|
@@ -4866,7 +4680,7 @@ export class Daemon extends EventEmitter {
|
|
|
4866
4680
|
return;
|
|
4867
4681
|
const outcome = follower.look(pane);
|
|
4868
4682
|
if (outcome) {
|
|
4869
|
-
this.
|
|
4683
|
+
this.ipcServer?.broadcast({ type: "compact_pane_result", id, owner, outcome });
|
|
4870
4684
|
return;
|
|
4871
4685
|
}
|
|
4872
4686
|
}
|
|
@@ -4886,7 +4700,7 @@ export class Daemon extends EventEmitter {
|
|
|
4886
4700
|
const reportSwitch = (result) => {
|
|
4887
4701
|
if (!ownSwitch)
|
|
4888
4702
|
return;
|
|
4889
|
-
this.
|
|
4703
|
+
this.ipcServer?.broadcast({ type: "runtime_switch_result", id: ownSwitch.id, ...result });
|
|
4890
4704
|
};
|
|
4891
4705
|
// Board 003648ac: the fleet follows a web /compact from just before its paste is written: the transcript's end then
|
|
4892
4706
|
// (taken here, under this launch, before the write) and the launch it was written under ride with the notice — once.
|
|
@@ -4901,7 +4715,7 @@ export class Daemon extends EventEmitter {
|
|
|
4901
4715
|
if (!notifyWritten || told)
|
|
4902
4716
|
return;
|
|
4903
4717
|
told = true;
|
|
4904
|
-
this.
|
|
4718
|
+
this.ipcServer?.broadcast({ type: "raw_paste_written", id: notifyWritten, outcome: written ? "written" : "not_written",
|
|
4905
4719
|
...(written ? { owner, checkpoint, ...(paneFollower ? { pane: true } : {}) } : {}) });
|
|
4906
4720
|
if (written && paneFollower)
|
|
4907
4721
|
void this.followCompactPane(notifyWritten, owner, paneFollower);
|
|
@@ -5063,11 +4877,10 @@ export class Daemon extends EventEmitter {
|
|
|
5063
4877
|
const press = (target, cursor, key) => this.paneWriteLock.run(async () => {
|
|
5064
4878
|
if (this.tmux !== tmux)
|
|
5065
4879
|
return false;
|
|
5066
|
-
const
|
|
5067
|
-
const now = claudeSwitchDialog(screen);
|
|
4880
|
+
const now = claudeSwitchDialog(await read());
|
|
5068
4881
|
if (!now || now.kind !== "model" || now.target !== target || (cursor !== null && now.cursor !== cursor))
|
|
5069
4882
|
return false;
|
|
5070
|
-
return
|
|
4883
|
+
return tmux.sendSpecialKey(key);
|
|
5071
4884
|
});
|
|
5072
4885
|
const gone = async () => {
|
|
5073
4886
|
const until = performance.now() + OWN_SWITCH_SETTLE_MS;
|
|
@@ -5156,12 +4969,9 @@ export class Daemon extends EventEmitter {
|
|
|
5156
4969
|
return false;
|
|
5157
4970
|
const specialKeys = new Set(["Up", "Down", "Enter", "Escape", "Right", "Left"]);
|
|
5158
4971
|
for (const key of dialog.keys) {
|
|
5159
|
-
const keyScreen = this.nativePaneLifecycle ? await this.tmux.capturePane() : currentPane;
|
|
5160
|
-
if (!matches(keyScreen))
|
|
5161
|
-
return false;
|
|
5162
4972
|
const ok = specialKeys.has(key)
|
|
5163
|
-
? await
|
|
5164
|
-
: await
|
|
4973
|
+
? await this.tmux.sendSpecialKey(key)
|
|
4974
|
+
: await this.tmux.sendKeys(key);
|
|
5165
4975
|
if (!ok)
|
|
5166
4976
|
return false;
|
|
5167
4977
|
await new Promise(resolve => setTimeout(resolve, 100));
|
|
@@ -5404,7 +5214,7 @@ export class Daemon extends EventEmitter {
|
|
|
5404
5214
|
await this.tmux.sendSpecialKey("Escape").catch(() => false);
|
|
5405
5215
|
return true;
|
|
5406
5216
|
}
|
|
5407
|
-
async stop(
|
|
5217
|
+
async stop() {
|
|
5408
5218
|
this.publishWorkingState("before_stop");
|
|
5409
5219
|
this.logger.info("Stopping daemon instance");
|
|
5410
5220
|
this.clearQuitRelaunchWatch();
|
|
@@ -5426,18 +5236,8 @@ export class Daemon extends EventEmitter {
|
|
|
5426
5236
|
}
|
|
5427
5237
|
if (this.adapter)
|
|
5428
5238
|
await this.adapter.stop();
|
|
5429
|
-
if (this.nativePaneLifecycle) {
|
|
5430
|
-
this.healthCheckPaused = true;
|
|
5431
|
-
this.saveSessionId();
|
|
5432
|
-
await this.nativePaneLifecycle.release(options.nativePane ?? "detach");
|
|
5433
|
-
try {
|
|
5434
|
-
unlinkSync(join(this.instanceDir, "daemon.pid"));
|
|
5435
|
-
}
|
|
5436
|
-
catch { /* metadata only */ }
|
|
5437
|
-
return;
|
|
5438
|
-
}
|
|
5439
5239
|
// Notify MCP servers of graceful shutdown (prevents reconnect attempts)
|
|
5440
|
-
this.
|
|
5240
|
+
this.ipcServer?.broadcast({ type: "shutdown" });
|
|
5441
5241
|
// Quit CLI FIRST — this kills MCP server child processes cleanly.
|
|
5442
5242
|
// IPC must stay open during quit so MCP servers receive the shutdown message.
|
|
5443
5243
|
if (this.tmux) {
|
|
@@ -5583,24 +5383,6 @@ export class Daemon extends EventEmitter {
|
|
|
5583
5383
|
freshChoice: this.recoveryFreshChoice || this.isNewSession && !this.bootSkippedResume, crashLoopFresh: this.recoveryCrashLoopFresh,
|
|
5584
5384
|
cancelled: this.recoveryCancelled, background: this.workingBackgroundObservation };
|
|
5585
5385
|
}
|
|
5586
|
-
/** Observe this host General before its approved switch. No keys, process signals or provider writes. */
|
|
5587
|
-
async generalHostOwner() {
|
|
5588
|
-
const pane = this.tmux, owner = JSON.stringify(this.interactionOwner());
|
|
5589
|
-
if (!this.config.general_topic || this.nativePaneLifecycle || !pane || !/^@\d+$/.test(pane.getWindowId()))
|
|
5590
|
-
throw Error("General host owner is unavailable");
|
|
5591
|
-
const status = await pane.getPaneStatus();
|
|
5592
|
-
if (!status?.alive || !status.pid || status.pid <= 1)
|
|
5593
|
-
throw Error("General host process cannot be proven");
|
|
5594
|
-
const checkpoint = await this.transcriptMonitor?.reconciliationCheckpoint();
|
|
5595
|
-
if (this.tmux !== pane || owner !== JSON.stringify(this.interactionOwner()))
|
|
5596
|
-
throw Error("General host owner changed during observation");
|
|
5597
|
-
const backend = this.config.backend ?? "claude-code";
|
|
5598
|
-
let sessionId = this.backend?.getSessionId() ?? undefined;
|
|
5599
|
-
if (backend === "codex" && checkpoint)
|
|
5600
|
-
sessionId = /([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})\.jsonl$/i.exec(checkpoint.path)?.[1];
|
|
5601
|
-
return { kind: "tmux", windowId: pane.getWindowId(), pid: status.pid,
|
|
5602
|
-
...(typeof sessionId === "string" && sessionId.length > 0 && sessionId.length <= 256 && !/[\p{Cc}\p{Cf}]/u.test(sessionId) ? { pin: { backend, sessionId } } : {}) };
|
|
5603
|
-
}
|
|
5604
5386
|
/** Local system work: no user turn, channel reply target, wake or replay of an original request. */
|
|
5605
5387
|
async deliverWorkingRecovery(content, delivery, admitted) {
|
|
5606
5388
|
const tmux = this.tmux, owner = JSON.stringify(this.interactionOwner()), epoch = this.deliveryEpoch;
|
|
@@ -5621,11 +5403,7 @@ export class Daemon extends EventEmitter {
|
|
|
5621
5403
|
|| !this.paneAuthoritativelyIdle(pane) || this.inputTransientInPane(pane)
|
|
5622
5404
|
|| this.backend?.backgroundWorkRunning?.(pane) === true)
|
|
5623
5405
|
return;
|
|
5624
|
-
if (
|
|
5625
|
-
|| !!this.backend?.isDeliveryInputReadyPane && !this.backend.isDeliveryInputReadyPane(pane)
|
|
5626
|
-
: await tmux.getPaneInputMode?.() !== "raw")
|
|
5627
|
-
return;
|
|
5628
|
-
if (!current())
|
|
5406
|
+
if (await tmux.getPaneInputMode?.() !== "raw" || !current())
|
|
5629
5407
|
return;
|
|
5630
5408
|
const evidence = await this.durableAttemptEvidence(tmux.getWindowId(), false, false);
|
|
5631
5409
|
if (!current())
|
|
@@ -5716,7 +5494,7 @@ export class Daemon extends EventEmitter {
|
|
|
5716
5494
|
this.logger.debug({ err }, "Interaction listener failed");
|
|
5717
5495
|
}
|
|
5718
5496
|
try {
|
|
5719
|
-
this.
|
|
5497
|
+
this.ipcServer?.broadcast({ type: "instance_interaction", instanceName: this.name, interaction });
|
|
5720
5498
|
}
|
|
5721
5499
|
catch (err) {
|
|
5722
5500
|
this.logger.debug({ err }, "Interaction broadcast failed");
|
|
@@ -5804,56 +5582,6 @@ export class Daemon extends EventEmitter {
|
|
|
5804
5582
|
}
|
|
5805
5583
|
return true;
|
|
5806
5584
|
}
|
|
5807
|
-
/** Shared Fleet inputs: socket and native transports retain the same wake, epoch and raw-paste semantics. */
|
|
5808
|
-
handleFleetMessage(msg, send, current = () => true) {
|
|
5809
|
-
if (msg.type === "query_sessions") {
|
|
5810
|
-
send({ type: "query_sessions_response", sessions: [] });
|
|
5811
|
-
}
|
|
5812
|
-
else if (msg.type === "fleet_inbound") {
|
|
5813
|
-
const meta = msg.meta;
|
|
5814
|
-
const targetSession = msg.targetSession;
|
|
5815
|
-
const deliveryEpoch = this.captureDeliveryEpoch(msg.delivery_epoch);
|
|
5816
|
-
void this.wake().then(() => {
|
|
5817
|
-
if (!current()) {
|
|
5818
|
-
this.deferDurableDelivery(meta, "native channel owner changed before pane submission");
|
|
5819
|
-
return;
|
|
5820
|
-
}
|
|
5821
|
-
this.pushChannelMessage(msg.content, meta, targetSession, deliveryEpoch);
|
|
5822
|
-
}).catch(err => {
|
|
5823
|
-
this.deferDurableDelivery(meta, `target wake failed before pane submission: ${err.message}`);
|
|
5824
|
-
this.logger.error({ err: err.message }, "Wake failed for inbound delivery");
|
|
5825
|
-
});
|
|
5826
|
-
}
|
|
5827
|
-
else if (msg.type === "raw_paste") {
|
|
5828
|
-
this.handleRawPasteIpcMessage(msg);
|
|
5829
|
-
}
|
|
5830
|
-
else if (msg.type === "config_update") {
|
|
5831
|
-
this.applyConfigUpdate(msg.config);
|
|
5832
|
-
}
|
|
5833
|
-
else if (msg.type === "steer") {
|
|
5834
|
-
const meta = (msg.meta ?? {});
|
|
5835
|
-
this.steerMessage(msg.content, meta, this.captureDeliveryEpoch(msg.delivery_epoch));
|
|
5836
|
-
}
|
|
5837
|
-
else if (msg.type === "btw") {
|
|
5838
|
-
const meta = (msg.meta ?? {});
|
|
5839
|
-
this.btwMessage(msg.content, meta, this.captureDeliveryEpoch(msg.delivery_epoch));
|
|
5840
|
-
}
|
|
5841
|
-
else if (msg.type === "fleet_schedule_trigger") {
|
|
5842
|
-
const payload = msg.payload;
|
|
5843
|
-
const meta = msg.meta;
|
|
5844
|
-
const deliveryEpoch = this.captureDeliveryEpoch(msg.delivery_epoch);
|
|
5845
|
-
void this.wake().then(() => { if (current())
|
|
5846
|
-
this.pushChannelMessage(payload.message, meta, undefined, deliveryEpoch); }).catch(err => {
|
|
5847
|
-
this.logger.error({ err: err.message }, "Wake failed for scheduled delivery");
|
|
5848
|
-
});
|
|
5849
|
-
}
|
|
5850
|
-
else if (msg.type === "query_instance_state") {
|
|
5851
|
-
void this.respondToInstanceStateQuery(msg, undefined, send);
|
|
5852
|
-
}
|
|
5853
|
-
else
|
|
5854
|
-
return false;
|
|
5855
|
-
return true;
|
|
5856
|
-
}
|
|
5857
5585
|
/**
|
|
5858
5586
|
* Answer a FleetManager state query. Most callers only need the cached state,
|
|
5859
5587
|
* but lifecycle decisions such as post-reply Cancel retirement need an
|
|
@@ -5861,7 +5589,7 @@ export class Daemon extends EventEmitter {
|
|
|
5861
5589
|
* the last transition can stay "working" even though the CLI has since
|
|
5862
5590
|
* settled without emitting another control-mode output record.
|
|
5863
5591
|
*/
|
|
5864
|
-
async respondToInstanceStateQuery(msg, socket
|
|
5592
|
+
async respondToInstanceStateQuery(msg, socket) {
|
|
5865
5593
|
try {
|
|
5866
5594
|
if (msg.deliveryIdle === true) {
|
|
5867
5595
|
await this.captureAndEvaluateInstanceState("delivery_idle_gate");
|
|
@@ -5870,7 +5598,7 @@ export class Daemon extends EventEmitter {
|
|
|
5870
5598
|
await this.captureAndEvaluateInstanceState("state_query");
|
|
5871
5599
|
}
|
|
5872
5600
|
const snapshot = this.getInstanceStateSnapshot();
|
|
5873
|
-
|
|
5601
|
+
this.ipcServer?.send(socket, {
|
|
5874
5602
|
type: "instance_state_response",
|
|
5875
5603
|
requestId: msg.requestId,
|
|
5876
5604
|
instanceName: this.name,
|
|
@@ -5878,11 +5606,7 @@ export class Daemon extends EventEmitter {
|
|
|
5878
5606
|
state: this.isPaused ? "paused" : snapshot.state,
|
|
5879
5607
|
processStatus: this.processStatus,
|
|
5880
5608
|
pausedAt: this.lastPausedAt,
|
|
5881
|
-
};
|
|
5882
|
-
if (send)
|
|
5883
|
-
send(reply);
|
|
5884
|
-
else if (socket)
|
|
5885
|
-
this.ipcServer?.send(socket, reply);
|
|
5609
|
+
});
|
|
5886
5610
|
}
|
|
5887
5611
|
catch (err) {
|
|
5888
5612
|
this.logger.debug({ err: err.message }, "Instance state query failed");
|
|
@@ -5922,49 +5646,7 @@ export class Daemon extends EventEmitter {
|
|
|
5922
5646
|
static AUTH_RECONFIRM_ROWS = 15;
|
|
5923
5647
|
/** Why the deferred pause was requested; what its marker records (Phase 2a). */
|
|
5924
5648
|
pendingPauseReason = "auth";
|
|
5925
|
-
nativePauseProof = null;
|
|
5926
|
-
/** Consume the exact idle proof synchronously after the lifecycle's await, before fencing and closing. */
|
|
5927
|
-
nativePauseStillReady() {
|
|
5928
|
-
const proof = this.nativePauseProof;
|
|
5929
|
-
this.nativePauseProof = null;
|
|
5930
|
-
if (proof?.())
|
|
5931
|
-
return true;
|
|
5932
|
-
this.pauseRequested = false;
|
|
5933
|
-
return false;
|
|
5934
|
-
}
|
|
5935
|
-
/** Native lifecycle pause uses the ordinary idle/background/admission proof before closing its owned Job. */
|
|
5936
|
-
async nativePauseReady(admission) {
|
|
5937
|
-
this.nativePauseProof = null;
|
|
5938
|
-
const native = this.nativePaneLifecycle, pane = this.tmux, owner = this.interactionOwner();
|
|
5939
|
-
const allowStuck = this.pauseAllowStuck;
|
|
5940
|
-
this.pauseAllowStuck = false;
|
|
5941
|
-
const ready = () => !!native && native === this.nativePaneLifecycle && native.current() && this.tmux === pane
|
|
5942
|
-
&& sameInteractionOwner(owner, this.interactionOwner()) && !this.runtimeMonitorsFrozen && !this.spawning
|
|
5943
|
-
&& this.processStatus === "running" && this.pasteQueueDepth === 0
|
|
5944
|
-
&& (this.instanceState === "idle" || allowStuck && this.instanceState === "stuck") && (!admission || admission.current());
|
|
5945
|
-
if (!pane || !ready()) {
|
|
5946
|
-
this.pauseRequested = false;
|
|
5947
|
-
return false;
|
|
5948
|
-
}
|
|
5949
|
-
let text;
|
|
5950
|
-
try {
|
|
5951
|
-
text = await pane.capturePane();
|
|
5952
|
-
}
|
|
5953
|
-
catch {
|
|
5954
|
-
this.pauseRequested = false;
|
|
5955
|
-
return false;
|
|
5956
|
-
}
|
|
5957
|
-
if (!ready() || admission && !admission.accepts(text) || this.backend?.backgroundWorkRunning?.(text)
|
|
5958
|
-
|| !allowStuck && !this.paneAuthoritativelyIdle(text)) {
|
|
5959
|
-
this.pauseRequested = false;
|
|
5960
|
-
return false;
|
|
5961
|
-
}
|
|
5962
|
-
this.nativePauseProof = ready;
|
|
5963
|
-
return true;
|
|
5964
|
-
}
|
|
5965
5649
|
async pause(reason = "operator", admission) {
|
|
5966
|
-
if (this.nativePaneLifecycle)
|
|
5967
|
-
throw Error("Native pause is owned by its Fleet lifecycle transition");
|
|
5968
5650
|
if (admission && !admission.current())
|
|
5969
5651
|
return;
|
|
5970
5652
|
if (this.pauseWakeState === "paused")
|
|
@@ -6060,7 +5742,7 @@ export class Daemon extends EventEmitter {
|
|
|
6060
5742
|
writePausedMarker(this.instanceDir, this.lastPausedAt ?? Date.now(), reason);
|
|
6061
5743
|
this.publishWorkingState("execution");
|
|
6062
5744
|
this.logger.info({ pausedAt: this.lastPausedAt }, "Instance auto-paused");
|
|
6063
|
-
this.
|
|
5745
|
+
this.ipcServer?.broadcast({
|
|
6064
5746
|
type: "instance_state", instanceName: this.name, state: "paused", pausedAt: this.lastPausedAt,
|
|
6065
5747
|
});
|
|
6066
5748
|
this.emit("auto_paused", { name: this.name, pausedAt: this.lastPausedAt });
|
|
@@ -6155,7 +5837,7 @@ export class Daemon extends EventEmitter {
|
|
|
6155
5837
|
this.resumeRuntimeMonitors();
|
|
6156
5838
|
this.publishWorkingState("execution");
|
|
6157
5839
|
this.logger.info("Instance auto-woke");
|
|
6158
|
-
this.
|
|
5840
|
+
this.ipcServer?.broadcast({
|
|
6159
5841
|
type: "instance_state", instanceName: this.name, state: this.instanceState, pausedAt: null,
|
|
6160
5842
|
});
|
|
6161
5843
|
this.emit("auto_woke", { name: this.name });
|
|
@@ -6319,7 +6001,7 @@ export class Daemon extends EventEmitter {
|
|
|
6319
6001
|
this.logStateEdge(previous, snapshot);
|
|
6320
6002
|
this.publishWorkingState("execution");
|
|
6321
6003
|
this.emit("instance_state", { name: this.name, ...snapshot });
|
|
6322
|
-
this.
|
|
6004
|
+
this.ipcServer?.broadcast({ type: "instance_state", instanceName: this.name, ...snapshot });
|
|
6323
6005
|
if (snapshot.state === "stuck" && pane && this.instanceStateReadyPattern) {
|
|
6324
6006
|
this.handleStuckTransition(pane, snapshot, this.instanceStateReadyPattern);
|
|
6325
6007
|
}
|
|
@@ -6421,7 +6103,7 @@ export class Daemon extends EventEmitter {
|
|
|
6421
6103
|
// writing a marker would re-inject a continuation for a finished turn.
|
|
6422
6104
|
// #3030: a message only queued in the busy CLI has not started a turn: the interrupted turn is still the running one,
|
|
6423
6105
|
// and a queued message lost to a restart is the hand-off record's to redeliver, not a continuation's.
|
|
6424
|
-
if (!
|
|
6106
|
+
if (!meta.resumedContinuationOf && !armed.completionDelivered && !queuedHandoff) {
|
|
6425
6107
|
const resumeBackend = this.config.backend ?? this.backend?.binaryName ?? this.runtimeIdentity?.backend;
|
|
6426
6108
|
const resumeCwd = this.config.working_directory ?? "";
|
|
6427
6109
|
writeInFlightTurnMarker(this.instanceDir, {
|
|
@@ -6653,7 +6335,7 @@ export class Daemon extends EventEmitter {
|
|
|
6653
6335
|
// outbound action suppresses a duplicate proxy; only a delivered
|
|
6654
6336
|
// human-facing channel action satisfies the completion guard below.
|
|
6655
6337
|
if (!turn.outboundDelivered && this.config.mcp_proxy_reply === true
|
|
6656
|
-
&&
|
|
6338
|
+
&& mcpServerState(this.instanceDir).state === "dead") {
|
|
6657
6339
|
this.turnReplyGuard.complete(turn.generation);
|
|
6658
6340
|
void this.sendProxyReply(pane, turn.target);
|
|
6659
6341
|
return;
|
|
@@ -6753,37 +6435,21 @@ export class Daemon extends EventEmitter {
|
|
|
6753
6435
|
|| this.config.backend === "claude-code"
|
|
6754
6436
|
|| this.backend?.binaryName === "claude";
|
|
6755
6437
|
}
|
|
6756
|
-
/** #3160: this agent's file steps in its current turn (the CLI's own record), for the Files & changes panel. */
|
|
6757
|
-
followLog = new FollowLog();
|
|
6758
|
-
workspaceFollow(after = 0, turn, scope) { return this.followLog.snapshot(after, turn, scope); }
|
|
6759
6438
|
/**
|
|
6760
6439
|
* This launch's transcript monitor. #1510: its turn boundaries feed the reply guard's ledger, which starts empty
|
|
6761
6440
|
* with it — a new monitor re-baselines at the transcript's end, so nothing the old one read can be attributed.
|
|
6762
6441
|
*/
|
|
6763
6442
|
buildTranscriptMonitor(source) {
|
|
6764
|
-
this.followLog.reset();
|
|
6765
6443
|
const monitor = new TranscriptMonitor(this.instanceDir, this.logger, source);
|
|
6766
6444
|
this.transcriptTurns.reset();
|
|
6767
6445
|
this.transcriptActivityAt = 0;
|
|
6768
6446
|
// Monotonic: a wall-clock correction must neither end nor extend the open-turn hold (#1641 R1).
|
|
6769
6447
|
const touch = () => { this.transcriptActivityAt = performance.now(); };
|
|
6770
|
-
monitor.on("turns", (turns) => {
|
|
6771
|
-
this.transcriptTurns.observe(turns, performance.now());
|
|
6772
|
-
touch();
|
|
6773
|
-
});
|
|
6774
|
-
// #3160: the files this turn reads, edits and searches, for the Files & changes panel's Follow (a few string checks;
|
|
6775
|
-
// nothing is read from disk until someone asks). Claude's turn boundary is its next prompt.
|
|
6776
|
-
const canFollow = () => this.transcriptMonitor === monitor && this.config.runtime !== "windows"
|
|
6777
|
-
&& (this.backend?.binaryName === "claude" || this.backend?.binaryName === "codex");
|
|
6778
|
-
monitor.on("workspace_follow", (event) => { if (canFollow())
|
|
6779
|
-
this.followLog.observe(event); });
|
|
6780
|
-
monitor.on("workspace_reset", () => { if (this.transcriptMonitor === monitor)
|
|
6781
|
-
this.followLog.reset(); });
|
|
6448
|
+
monitor.on("turns", (turns) => { this.transcriptTurns.observe(turns, performance.now()); touch(); });
|
|
6782
6449
|
// #1641 R2: a re-baselined source starts over, and so does what it said (an open turn read before is withdrawn).
|
|
6783
6450
|
monitor.on("reset", () => { if (this.transcriptMonitor === monitor) {
|
|
6784
6451
|
this.transcriptTurns.reset();
|
|
6785
6452
|
this.transcriptActivityAt = 0;
|
|
6786
|
-
this.followLog.reset();
|
|
6787
6453
|
} });
|
|
6788
6454
|
for (const event of ["tool_use", "tool_result", "assistant_text"])
|
|
6789
6455
|
monitor.on(event, touch);
|
|
@@ -7046,7 +6712,7 @@ export class Daemon extends EventEmitter {
|
|
|
7046
6712
|
}
|
|
7047
6713
|
});
|
|
7048
6714
|
}
|
|
7049
|
-
if (!this.
|
|
6715
|
+
if (!this.ipcServer) {
|
|
7050
6716
|
this.logger.error(`${logLabel} failed — no adapter or fleet IPC route`);
|
|
7051
6717
|
return Promise.resolve(false);
|
|
7052
6718
|
}
|
|
@@ -7070,7 +6736,7 @@ export class Daemon extends EventEmitter {
|
|
|
7070
6736
|
resolve(delivered);
|
|
7071
6737
|
});
|
|
7072
6738
|
try {
|
|
7073
|
-
this.
|
|
6739
|
+
this.ipcServer.broadcast({
|
|
7074
6740
|
type: "fleet_outbound",
|
|
7075
6741
|
tool: "reply",
|
|
7076
6742
|
args,
|
|
@@ -7641,7 +7307,7 @@ export class Daemon extends EventEmitter {
|
|
|
7641
7307
|
if (next === this.currentActivity)
|
|
7642
7308
|
return;
|
|
7643
7309
|
this.currentActivity = next;
|
|
7644
|
-
this.
|
|
7310
|
+
this.ipcServer?.broadcast({
|
|
7645
7311
|
type: "instance_activity",
|
|
7646
7312
|
instanceName: this.name,
|
|
7647
7313
|
activity: next,
|
|
@@ -7722,7 +7388,7 @@ export class Daemon extends EventEmitter {
|
|
|
7722
7388
|
else
|
|
7723
7389
|
this.config.auto_pause_after = nextAutoPause;
|
|
7724
7390
|
if (nextAutoPause !== previousAutoPause) {
|
|
7725
|
-
const isGeneral = this.config.general_topic === true ||
|
|
7391
|
+
const isGeneral = this.config.general_topic === true || this.name === "general";
|
|
7726
7392
|
this.autoPauseController.reconfigure((isGeneral ? 0 : nextAutoPause) * 60_000);
|
|
7727
7393
|
}
|
|
7728
7394
|
}
|
|
@@ -7802,7 +7468,7 @@ export class Daemon extends EventEmitter {
|
|
|
7802
7468
|
return;
|
|
7803
7469
|
this.lastProgressBroadcast = rendered;
|
|
7804
7470
|
this.lastProgressBroadcastAt = Date.now();
|
|
7805
|
-
this.
|
|
7471
|
+
this.ipcServer?.broadcast({
|
|
7806
7472
|
type: "instance_progress",
|
|
7807
7473
|
instanceName: this.name,
|
|
7808
7474
|
progress: rendered,
|
|
@@ -7818,7 +7484,7 @@ export class Daemon extends EventEmitter {
|
|
|
7818
7484
|
if (this.lastProgressBroadcast !== "") {
|
|
7819
7485
|
this.lastProgressBroadcast = "";
|
|
7820
7486
|
this.lastProgressBroadcastAt = Date.now();
|
|
7821
|
-
this.
|
|
7487
|
+
this.ipcServer?.broadcast({ type: "instance_progress", instanceName: this.name, progress: "" });
|
|
7822
7488
|
}
|
|
7823
7489
|
}
|
|
7824
7490
|
/**
|
|
@@ -7985,7 +7651,7 @@ export class Daemon extends EventEmitter {
|
|
|
7985
7651
|
reportCrossInstanceDeliveryFailure(meta, verdict, error) {
|
|
7986
7652
|
if (!meta.from_instance)
|
|
7987
7653
|
return;
|
|
7988
|
-
this.
|
|
7654
|
+
this.ipcServer?.broadcast({
|
|
7989
7655
|
type: "cross_instance_delivery_failed",
|
|
7990
7656
|
senderSession: meta.from_instance,
|
|
7991
7657
|
targetInstance: this.name,
|
|
@@ -9366,14 +9032,13 @@ export class Daemon extends EventEmitter {
|
|
|
9366
9032
|
if (this.remoteCardAnswering)
|
|
9367
9033
|
return { outcome: "refused", reason: "another answer to this card is being keyed in" };
|
|
9368
9034
|
this.remoteCardAnswering = true;
|
|
9369
|
-
let answerScreen = null;
|
|
9370
9035
|
try {
|
|
9371
9036
|
const outcome = await answerRemoteCard({
|
|
9372
9037
|
locked: fn => this.paneWriteLock.run(fn),
|
|
9373
9038
|
// An unreadable screen (a failed capture, another spawn's pane) is unknown — never "the card closed".
|
|
9374
|
-
read:
|
|
9375
|
-
key: key => this.tmux !== tmux
|
|
9376
|
-
paste: text => this.tmux !== tmux
|
|
9039
|
+
read: () => this.tmux === tmux ? tmux.capturePane().catch(() => null) : Promise.resolve(null),
|
|
9040
|
+
key: key => this.tmux !== tmux ? Promise.resolve(false) : key === "Space" ? tmux.sendKeys(" ") : tmux.sendSpecialKey(key),
|
|
9041
|
+
paste: text => this.tmux !== tmux ? Promise.resolve(false) : tmux.pasteBuffer(text),
|
|
9377
9042
|
sleep: ms => new Promise(resolve => setTimeout(resolve, ms)),
|
|
9378
9043
|
now: () => performance.now(),
|
|
9379
9044
|
}, pane => {
|
|
@@ -9644,19 +9309,12 @@ export class Daemon extends EventEmitter {
|
|
|
9644
9309
|
if (!check || !this.tmux)
|
|
9645
9310
|
return !check;
|
|
9646
9311
|
try {
|
|
9647
|
-
const
|
|
9648
|
-
|
|
9649
|
-
: await this.tmux.getPaneInputMode?.() === "raw";
|
|
9650
|
-
// ConPTY has no POSIX termios mode. Its closed launch plus current helper handshake is the input barrier;
|
|
9651
|
-
// the same strict composer detector below is still required. Never grant native unknown-layout fallback.
|
|
9652
|
-
if (!inputActive) {
|
|
9312
|
+
const mode = await this.tmux.getPaneInputMode?.();
|
|
9313
|
+
if (mode !== "raw") {
|
|
9653
9314
|
this.resetFooterFallback();
|
|
9654
9315
|
return false;
|
|
9655
9316
|
}
|
|
9656
|
-
|
|
9657
|
-
if (this.nativePaneLifecycle && (!this.nativePaneLifecycle.current() || this.nativePaneLifecycle.mcpProof() !== "alive"))
|
|
9658
|
-
return false;
|
|
9659
|
-
return this.deliveryInputReadyPane(pane);
|
|
9317
|
+
return this.deliveryInputReadyPane(await this.tmux.capturePane());
|
|
9660
9318
|
}
|
|
9661
9319
|
catch {
|
|
9662
9320
|
this.resetFooterFallback();
|
|
@@ -10275,9 +9933,9 @@ export class Daemon extends EventEmitter {
|
|
|
10275
9933
|
* moment the flag clears.
|
|
10276
9934
|
*/
|
|
10277
9935
|
refuseFatalStartupDelivery(verdict, status) {
|
|
10278
|
-
if (!this.fatalStartupBlocked)
|
|
9936
|
+
if (!this.fatalStartupBlocked && !this.modelMinimumBlocked)
|
|
10279
9937
|
return false;
|
|
10280
|
-
this.logger.error("Delivery refused — CLI
|
|
9938
|
+
this.logger.error("Delivery refused — CLI startup or model-version repair is held");
|
|
10281
9939
|
this.failDelivery(verdict, status, "fatal-startup", "blocked-before-write");
|
|
10282
9940
|
return true;
|
|
10283
9941
|
}
|
|
@@ -10430,86 +10088,34 @@ export class Daemon extends EventEmitter {
|
|
|
10430
10088
|
// tmux object and window — so the spawn generation and launch fence are part of the fence too: an Enter meant for
|
|
10431
10089
|
// the CLI this paste went to is never sent to its successor.
|
|
10432
10090
|
const tmux = this.tmux;
|
|
10433
|
-
const backend = this.backend;
|
|
10434
|
-
const native = !!this.nativePaneLifecycle;
|
|
10435
10091
|
const generation = this.spawnGeneration;
|
|
10436
10092
|
const fence = this.launchFenceEpoch;
|
|
10437
|
-
const windowId = native ? tmux?.getWindowId() : undefined;
|
|
10438
|
-
// M-2290 (#2985 review, Fable): the mode wait can last up to 10 minutes, and a respawn or relaunch reuses the same
|
|
10439
|
-
// tmux object and window — so the spawn generation and launch fence are part of every pane's fence: an Enter meant
|
|
10440
|
-
// for the CLI this paste went to is never sent to its successor. A native Windows pane keeps #2958's full fence too
|
|
10441
|
-
// (its launch can be replaced under the same handle).
|
|
10442
10093
|
const current = () => this.tmux === tmux && this.spawnGeneration === generation && this.launchFenceEpoch === fence
|
|
10443
|
-
&& !this.deliveryWritesStopping && (!stillCurrent || stillCurrent())
|
|
10444
|
-
&& (!native || (!!windowId && !!backend && this.backend === backend && tmux.getWindowId() === windowId));
|
|
10094
|
+
&& !this.deliveryWritesStopping && (!stillCurrent || stillCurrent());
|
|
10445
10095
|
if (!current())
|
|
10446
10096
|
return false;
|
|
10447
10097
|
// The pasted text may still be in the box: the caller keeps it uncertain (no false failure, no second paste).
|
|
10448
|
-
|
|
10449
|
-
|
|
10450
|
-
|
|
10451
|
-
if (reason === "output_changed" && current() && !this.nativeDeliveryHold())
|
|
10452
|
-
this.nativeEnterHold = {
|
|
10453
|
-
key: `${this.bootId}:${generation}:${fence}`, since: Date.now(), spawn: generation, fence,
|
|
10454
|
-
};
|
|
10455
|
-
if (reason === "pane-in-mode")
|
|
10456
|
-
this.logger.warn({ phase, reason }, "The pane stayed in a tmux mode; Enter withheld");
|
|
10457
|
-
else
|
|
10458
|
-
this.logger.warn({ ...tmux?.getLastInputDiagnostic?.(), phase, reason, retryCount: positiveRefusals }, "Native delivery Enter withheld by its safety check");
|
|
10098
|
+
const hold = () => {
|
|
10099
|
+
onInputHeld?.("pane-in-mode");
|
|
10100
|
+
this.logger.warn({ phase }, "The pane stayed in a tmux mode; Enter withheld");
|
|
10459
10101
|
return false;
|
|
10460
10102
|
};
|
|
10461
10103
|
// M-2267 (#2971): a pane in a tmux mode (a person left it in copy-mode) would take this Enter. Wait for the mode to
|
|
10462
10104
|
// end, then look once more within the same deadline — a pane flickering back into a mode is waited out again, never
|
|
10463
|
-
// past the bound.
|
|
10464
|
-
//
|
|
10465
|
-
// The fresh capture still binds the native host output sequence; ownership and positive-ACK-only retries remain.
|
|
10105
|
+
// past the bound. (beta.5: #2958's composer proof that used to sit between the two looks is reverted, decision
|
|
10106
|
+
// f57474aa: it rejected Codex's footer after a resume and while busy. #2957 is open again.)
|
|
10466
10107
|
const modeDeadline = performance.now() + PANE_MODE_ENTER_WAIT_MS;
|
|
10467
|
-
let pane;
|
|
10468
|
-
let positiveRefusals = 0, enterMarked = false, positiveRetryDeadline = Infinity, linuxDialogRead = false;
|
|
10469
10108
|
for (;;) {
|
|
10470
|
-
const mode = await this.waitWhilePaneInMode(phase, current,
|
|
10109
|
+
const mode = await this.waitWhilePaneInMode(phase, current, modeDeadline);
|
|
10471
10110
|
if (mode === "stale")
|
|
10472
10111
|
return false;
|
|
10473
10112
|
if (mode === "held")
|
|
10474
|
-
return hold(
|
|
10475
|
-
if (native) {
|
|
10476
|
-
// S-35: a native pane's capture refuses while output is still arriving ("Pane changed during capture; observe it
|
|
10477
|
-
// again"). Right after a turn the CLI repaints for a moment; one refused read left the message unsent for ever.
|
|
10478
|
-
// Read again a few times — reading types nothing — and still hold if it never settles.
|
|
10479
|
-
let captured;
|
|
10480
|
-
for (let attempt = 0; captured === undefined; attempt++) {
|
|
10481
|
-
try {
|
|
10482
|
-
captured = await tmux.capturePane();
|
|
10483
|
-
}
|
|
10484
|
-
catch {
|
|
10485
|
-
if (!current())
|
|
10486
|
-
return false;
|
|
10487
|
-
if (attempt >= 4)
|
|
10488
|
-
return hold("capture_failed");
|
|
10489
|
-
await new Promise(done => setTimeout(done, 150 * (attempt + 1)));
|
|
10490
|
-
if (!current())
|
|
10491
|
-
return false;
|
|
10492
|
-
}
|
|
10493
|
-
}
|
|
10494
|
-
const screen = captured;
|
|
10495
|
-
pane = screen;
|
|
10496
|
-
if (!current())
|
|
10497
|
-
return false;
|
|
10498
|
-
try {
|
|
10499
|
-
if (backend?.getRuntimeDialogs?.().some(dialog => Daemon.dialogMatches(dialog, screen)))
|
|
10500
|
-
return hold("dialog");
|
|
10501
|
-
}
|
|
10502
|
-
catch {
|
|
10503
|
-
return hold("check_failed");
|
|
10504
|
-
}
|
|
10505
|
-
if (!current())
|
|
10506
|
-
return false;
|
|
10507
|
-
}
|
|
10113
|
+
return hold();
|
|
10508
10114
|
if (await this.paneInTmuxMode(phase)) {
|
|
10509
10115
|
if (!current())
|
|
10510
10116
|
return false;
|
|
10511
10117
|
if (performance.now() >= modeDeadline)
|
|
10512
|
-
return hold(
|
|
10118
|
+
return hold();
|
|
10513
10119
|
await new Promise(r => setTimeout(r, PANE_MODE_POLL_MS));
|
|
10514
10120
|
if (!current())
|
|
10515
10121
|
return false;
|
|
@@ -10517,143 +10123,54 @@ export class Daemon extends EventEmitter {
|
|
|
10517
10123
|
}
|
|
10518
10124
|
if (!current())
|
|
10519
10125
|
return false;
|
|
10520
|
-
|
|
10521
|
-
|
|
10522
|
-
|
|
10523
|
-
|
|
10524
|
-
|
|
10525
|
-
|
|
10526
|
-
|
|
10527
|
-
|
|
10528
|
-
|
|
10529
|
-
|
|
10530
|
-
|
|
10531
|
-
|
|
10532
|
-
catch {
|
|
10533
|
-
finalPane = null;
|
|
10534
|
-
}
|
|
10535
|
-
if (!current())
|
|
10536
|
-
return false;
|
|
10537
|
-
let dialog;
|
|
10538
|
-
try {
|
|
10539
|
-
dialog = finalPane === null ? undefined : (this.backend?.getRuntimeDialogs?.() ?? []).find(d => Daemon.dialogMatches(d, finalPane))?.description;
|
|
10540
|
-
}
|
|
10541
|
-
catch {
|
|
10542
|
-
dialog = undefined;
|
|
10543
|
-
}
|
|
10544
|
-
if (dialog !== undefined) {
|
|
10545
|
-
onInputHeld("dialog");
|
|
10546
|
-
this.logger.warn({ phase, dialog }, "A dialog is on the pane; the delivery's Enter is withheld (it would answer it)");
|
|
10547
|
-
return false;
|
|
10548
|
-
}
|
|
10549
|
-
}
|
|
10550
|
-
if (positiveRefusals && performance.now() >= positiveRetryDeadline)
|
|
10551
|
-
return hold("output_changed");
|
|
10552
|
-
// W1: persist the "Enter may have happened" boundary before tmux receives
|
|
10553
|
-
// the key. A crash after this commit is never auto-replayed without a
|
|
10554
|
-
// positive transcript marker, even if the stale pane still shows composer.
|
|
10555
|
-
if (!enterMarked && durableAttempt && !this.deliveryOutbox?.markEnterStarted(durableAttempt.deliveryId, this.bootId, durableAttempt.attemptNo)) {
|
|
10556
|
-
this.logger.error({ phase, deliveryId: durableAttempt.deliveryId }, "Could not commit durable Enter write-ahead fence");
|
|
10557
|
-
return false;
|
|
10558
|
-
}
|
|
10559
|
-
enterMarked = true;
|
|
10560
|
-
const sent = await (native && pane !== undefined ? tmux.sendSpecialKey("Enter", undefined, { kind: "delivery", screen: pane, retryCount: positiveRefusals }) : tmux.sendSpecialKey("Enter"));
|
|
10561
|
-
// A busy renderer can change seq after our capture. Only a positive zero-input ACK admits a NEW proof/key;
|
|
10562
|
-
// An Enter retry never re-pastes, retries an uncertain write, reuses stale proof or re-commits the durable boundary.
|
|
10563
|
-
if (!sent && native && tmux.lastInputWasNotSent?.() === true
|
|
10564
|
-
&& tmux.getLastSendSpecialKeyError() === "Pane changed after observation; input was not sent"
|
|
10565
|
-
&& current()) {
|
|
10566
|
-
if (!positiveRefusals)
|
|
10567
|
-
positiveRetryDeadline = Math.min(modeDeadline, performance.now() + 2000);
|
|
10568
|
-
if (positiveRefusals >= 4 || performance.now() >= positiveRetryDeadline)
|
|
10569
|
-
return hold("output_changed");
|
|
10570
|
-
positiveRefusals++;
|
|
10571
|
-
await new Promise(done => setTimeout(done, 100));
|
|
10572
|
-
if (!current())
|
|
10573
|
-
return false;
|
|
10574
|
-
if (performance.now() >= positiveRetryDeadline)
|
|
10575
|
-
return hold("output_changed");
|
|
10576
|
-
continue;
|
|
10577
|
-
}
|
|
10578
|
-
if (!sent) {
|
|
10579
|
-
const details = { phase, tmuxError: this.tmux.getLastSendSpecialKeyError() ?? "unknown tmux send-keys failure" };
|
|
10580
|
-
if (native)
|
|
10581
|
-
this.logger.warn({ ...tmux?.getLastInputDiagnostic?.(), ...details, retryCount: positiveRefusals }, "Native delivery Enter gave up");
|
|
10582
|
-
else
|
|
10583
|
-
this.logger.error(details, "tmux send-keys Enter failed during message delivery");
|
|
10584
|
-
}
|
|
10585
|
-
if (sent && native && current())
|
|
10586
|
-
this.nativeEnterHold = null;
|
|
10587
|
-
return sent;
|
|
10588
|
-
}
|
|
10589
|
-
}
|
|
10590
|
-
/** A pre-existing native busy-paste race: retry bytes only after an exact, owned zero-input acknowledgement. */
|
|
10591
|
-
async sendDeliveryPaste(text, stillCurrent) {
|
|
10592
|
-
const pane = this.tmux, native = this.nativePaneLifecycle;
|
|
10593
|
-
if (!native)
|
|
10594
|
-
return pane.pasteBuffer(text);
|
|
10595
|
-
const backend = this.backend, generation = this.spawnGeneration, fence = this.launchFenceEpoch, windowId = pane.getWindowId();
|
|
10596
|
-
const current = () => !!windowId && this.tmux === pane && this.nativePaneLifecycle === native && this.backend === backend
|
|
10597
|
-
&& this.spawnGeneration === generation && this.launchFenceEpoch === fence && pane.getWindowId() === windowId
|
|
10598
|
-
&& !this.deliveryWritesStopping && (!stillCurrent || stillCurrent());
|
|
10599
|
-
let retryCount = 0;
|
|
10600
|
-
const hold = (reason) => {
|
|
10601
|
-
if (current() && !this.nativeDeliveryHold())
|
|
10602
|
-
this.nativeEnterHold = { key: `${this.bootId}:${generation}:${fence}`, since: Date.now(), spawn: generation, fence };
|
|
10603
|
-
this.logger.warn({ ...pane.getLastInputDiagnostic?.(), reason, retryCount }, "Native delivery paste held by its safety check");
|
|
10604
|
-
return false;
|
|
10605
|
-
};
|
|
10606
|
-
const deadline = performance.now() + 2000;
|
|
10607
|
-
for (let attempt = 0; attempt < 5; attempt++) {
|
|
10608
|
-
retryCount = attempt;
|
|
10609
|
-
if (!current())
|
|
10610
|
-
return false;
|
|
10611
|
-
if (performance.now() >= deadline)
|
|
10612
|
-
return hold("output_changed");
|
|
10613
|
-
let screen;
|
|
10614
|
-
for (let read = 0; read < 5 && screen === undefined; read++) {
|
|
10615
|
-
try {
|
|
10616
|
-
screen = await pane.capturePane();
|
|
10617
|
-
}
|
|
10618
|
-
catch { /* Reads do not construct an input operation. */ }
|
|
10619
|
-
if (!current())
|
|
10620
|
-
return false;
|
|
10621
|
-
if (performance.now() >= deadline)
|
|
10622
|
-
return hold("capture_failed");
|
|
10623
|
-
if (screen === undefined && read < 4)
|
|
10624
|
-
await new Promise(done => setTimeout(done, 100));
|
|
10625
|
-
}
|
|
10626
|
-
if (screen === undefined)
|
|
10627
|
-
return hold("capture_failed");
|
|
10126
|
+
break;
|
|
10127
|
+
}
|
|
10128
|
+
// M-2290 (the simple half of the #2957 redesign, leader xmsg-1793712561468): a dialog the backend RECOGNISES
|
|
10129
|
+
// (runtimeDialogs: a permission card, the dangerous-command card, …) that painted between the paste and this Enter
|
|
10130
|
+
// would take the key as its answer. Read the pane once more: such a dialog withholds the Enter, the caller keeps the
|
|
10131
|
+
// delivery uncertain (Needs-you), and the dialog scanner parks the dialog for a person. Nothing else is judged here
|
|
10132
|
+
// — an unknown or unreadable screen sends, exactly as before: #2958's composer proof (decision f57474aa) is NOT back.
|
|
10133
|
+
// Only a caller that can hold (onInputHeld: the delivery's initial submit, settled uncertain → Needs-you) asks: one
|
|
10134
|
+
// that cannot would read `false` as a failure and paste again. Only the backend's OWN dialogs count — not AgEnD's
|
|
10135
|
+
// unrecognised-prompt guess — so an unknown screen still sends.
|
|
10136
|
+
if (onInputHeld) {
|
|
10137
|
+
let finalPane = null;
|
|
10628
10138
|
try {
|
|
10629
|
-
|
|
10630
|
-
return hold("dialog");
|
|
10139
|
+
finalPane = await tmux.capturePane();
|
|
10631
10140
|
}
|
|
10632
10141
|
catch {
|
|
10633
|
-
|
|
10142
|
+
finalPane = null;
|
|
10634
10143
|
}
|
|
10635
10144
|
if (!current())
|
|
10636
10145
|
return false;
|
|
10637
|
-
|
|
10638
|
-
return hold("output_changed");
|
|
10639
|
-
let sent;
|
|
10146
|
+
let dialog;
|
|
10640
10147
|
try {
|
|
10641
|
-
|
|
10148
|
+
dialog = finalPane === null ? undefined : (this.backend?.getRuntimeDialogs?.() ?? []).find(d => Daemon.dialogMatches(d, finalPane))?.description;
|
|
10642
10149
|
}
|
|
10643
10150
|
catch {
|
|
10644
|
-
|
|
10151
|
+
dialog = undefined;
|
|
10645
10152
|
}
|
|
10646
|
-
if (
|
|
10647
|
-
|
|
10648
|
-
|
|
10153
|
+
if (dialog !== undefined) {
|
|
10154
|
+
onInputHeld?.("dialog");
|
|
10155
|
+
this.logger.warn({ phase, dialog }, "A dialog is on the pane; the delivery's Enter is withheld (it would answer it)");
|
|
10649
10156
|
return false;
|
|
10650
|
-
|
|
10651
|
-
|
|
10652
|
-
|
|
10653
|
-
|
|
10654
|
-
|
|
10157
|
+
}
|
|
10158
|
+
}
|
|
10159
|
+
// W1: persist the "Enter may have happened" boundary before tmux receives
|
|
10160
|
+
// the key. A crash after this commit is never auto-replayed without a
|
|
10161
|
+
// positive transcript marker, even if the stale pane still shows composer.
|
|
10162
|
+
if (durableAttempt && !this.deliveryOutbox?.markEnterStarted(durableAttempt.deliveryId, this.bootId, durableAttempt.attemptNo)) {
|
|
10163
|
+
this.logger.error({ phase, deliveryId: durableAttempt.deliveryId }, "Could not commit durable Enter write-ahead fence");
|
|
10164
|
+
return false;
|
|
10655
10165
|
}
|
|
10656
|
-
|
|
10166
|
+
const sent = await tmux.sendSpecialKey("Enter");
|
|
10167
|
+
if (!sent) {
|
|
10168
|
+
this.logger.error({
|
|
10169
|
+
phase,
|
|
10170
|
+
tmuxError: this.tmux.getLastSendSpecialKeyError() ?? "unknown tmux send-keys failure",
|
|
10171
|
+
}, "tmux send-keys Enter failed during message delivery");
|
|
10172
|
+
}
|
|
10173
|
+
return sent;
|
|
10657
10174
|
}
|
|
10658
10175
|
async writeMessageToPane(formatted, initialWindowId, handingOffToNativeQueue, status, submissionId,
|
|
10659
10176
|
// Last and defaulted so the positional callers that ignore the outcome stay
|
|
@@ -10691,9 +10208,6 @@ export class Daemon extends EventEmitter {
|
|
|
10691
10208
|
const tmuxAtWrite = this.tmux;
|
|
10692
10209
|
const steerCurrent = () => (!stillCurrent || stillCurrent()) && !this.deliveryWritesStopping
|
|
10693
10210
|
&& this.tmux === tmuxAtWrite && this.spawnGeneration === spawnAtWrite;
|
|
10694
|
-
// Alpha (S-36, Prism #2989 P2): a NATIVE pane keeps #2958's pre-paste owner fence through the initial Enter and every
|
|
10695
|
-
// retry Enter (a pane replaced while the paste awaits never takes this delivery's Enter); a tmux pane follows main.
|
|
10696
|
-
const nativeOwner = this.nativePaneLifecycle ? steerCurrent : undefined;
|
|
10697
10211
|
// Bug A: paste with backoff. Transient failures are usually a stale window id
|
|
10698
10212
|
// after a crash/respawn — recover by name and retry (max 3 attempts, 2s apart).
|
|
10699
10213
|
const maxAttempts = 3;
|
|
@@ -10761,8 +10275,8 @@ export class Daemon extends EventEmitter {
|
|
|
10761
10275
|
}
|
|
10762
10276
|
verdict.durableBeginCommitted = true;
|
|
10763
10277
|
verdict.submissionMode = attemptEvidence.submissionMode;
|
|
10764
|
-
if (attemptEvidence.
|
|
10765
|
-
verdict.transcriptCheckpoint =
|
|
10278
|
+
if (attemptEvidence.transcriptPath && attemptEvidence.transcriptOffset !== null) {
|
|
10279
|
+
verdict.transcriptCheckpoint = {
|
|
10766
10280
|
backend: attemptEvidence.backend,
|
|
10767
10281
|
path: attemptEvidence.transcriptPath,
|
|
10768
10282
|
offset: attemptEvidence.transcriptOffset,
|
|
@@ -10838,15 +10352,7 @@ export class Daemon extends EventEmitter {
|
|
|
10838
10352
|
}
|
|
10839
10353
|
const pasteGeneration = this.spawnGeneration;
|
|
10840
10354
|
beforePaste?.();
|
|
10841
|
-
const pasted = await this.
|
|
10842
|
-
if (!pasted && this.nativePaneLifecycle) {
|
|
10843
|
-
// The native write attempt is retained as uncertain, including exhausted positive refusals. Never route an
|
|
10844
|
-
// unknown/partial write through legacy window recovery or abort it back to an automatically replayable row.
|
|
10845
|
-
verdict.paneWriteStarted = true;
|
|
10846
|
-
verdict.phase = "paste";
|
|
10847
|
-
verdict.proof = "native-paste-held";
|
|
10848
|
-
return false;
|
|
10849
|
-
}
|
|
10355
|
+
const pasted = await this.tmux.pasteBuffer(formatted);
|
|
10850
10356
|
if (pasted)
|
|
10851
10357
|
this.rememberPaste(formatted, pasteGeneration);
|
|
10852
10358
|
if (!pasted) {
|
|
@@ -10933,18 +10439,15 @@ export class Daemon extends EventEmitter {
|
|
|
10933
10439
|
const enterMono = performance.now();
|
|
10934
10440
|
const steerEnterCurrent = () => steerCurrent() && performance.now() <= steerEnterDeadline;
|
|
10935
10441
|
let inputHeld = null;
|
|
10936
|
-
if (!(await this.sendDeliveryEnter("initial-submit", steerComposerProof
|
|
10442
|
+
if (!(await this.sendDeliveryEnter("initial-submit", steerComposerProof ? steerEnterCurrent : undefined, durableAttempt, (why) => { inputHeld = why; }))) {
|
|
10937
10443
|
if (inputHeld) {
|
|
10938
10444
|
// #2971: held in a tmux mode past the bound; M-2290: a recognised dialog on the pane. The paste may still be in
|
|
10939
10445
|
// the CLI: keep it uncertain (Needs-you), never re-paste, never answer the dialog.
|
|
10940
10446
|
verdict.phase = "submit-enter";
|
|
10941
|
-
|
|
10942
|
-
// and each native safety check say which.
|
|
10943
|
-
verdict.proof = inputHeld === "pane-in-mode" ? "pane-in-mode-held" : nativeOwner ? `native-input-${inputHeld}`
|
|
10944
|
-
: inputHeld === "dialog" ? "dialog-on-pane" : `input-held-${inputHeld}`;
|
|
10447
|
+
verdict.proof = inputHeld === "dialog" ? "dialog-on-pane" : "pane-in-mode-held";
|
|
10945
10448
|
return false;
|
|
10946
10449
|
}
|
|
10947
|
-
if (
|
|
10450
|
+
if (steerComposerProof && !steerCurrent()) {
|
|
10948
10451
|
verdict.phase = "submit-enter";
|
|
10949
10452
|
verdict.proof = "fenced-before-enter";
|
|
10950
10453
|
return false;
|
|
@@ -10974,7 +10477,7 @@ export class Daemon extends EventEmitter {
|
|
|
10974
10477
|
if (!rawPaste && !steerComposerProof && this.backend?.requiresDeliveryEnterRetry?.() === true) {
|
|
10975
10478
|
await new Promise(r => setTimeout(r, 1_000));
|
|
10976
10479
|
const retryAt = Date.now();
|
|
10977
|
-
if (await this.sendDeliveryEnter("queue-less-defensive-retry"
|
|
10480
|
+
if (await this.sendDeliveryEnter("queue-less-defensive-retry")) {
|
|
10978
10481
|
enterAt = retryAt;
|
|
10979
10482
|
enterRetry = true;
|
|
10980
10483
|
this.logger.debug("Sent defensive Enter retry (queue-less TUI can swallow the first)");
|
|
@@ -11112,7 +10615,7 @@ export class Daemon extends EventEmitter {
|
|
|
11112
10615
|
// again. The prompt is back now, so an Enter can land.
|
|
11113
10616
|
this.logger.warn("Message still in the input row after idle — submitting the existing text instead of pasting it again");
|
|
11114
10617
|
const strandedAt = Date.now();
|
|
11115
|
-
if (!(await this.sendDeliveryEnter("native-queue-stranded-submit"
|
|
10618
|
+
if (!(await this.sendDeliveryEnter("native-queue-stranded-submit"))) {
|
|
11116
10619
|
return this.failDelivery(verdict, status, "native-queue-submit", "tmux-send-keys-failed");
|
|
11117
10620
|
}
|
|
11118
10621
|
// The recovery Enter can be accepted before Codex paints its new
|
|
@@ -11165,7 +10668,7 @@ export class Daemon extends EventEmitter {
|
|
|
11165
10668
|
}
|
|
11166
10669
|
await new Promise(r => setTimeout(r, NORMAL_ENTER_SETTLE_MS));
|
|
11167
10670
|
const retryAt = Date.now();
|
|
11168
|
-
if (!(await this.sendDeliveryEnter("native-queue-idle-redelivery"
|
|
10671
|
+
if (!(await this.sendDeliveryEnter("native-queue-idle-redelivery"))) {
|
|
11169
10672
|
return this.failDelivery(verdict, status, "native-queue-redelivery", "tmux-send-keys-failed");
|
|
11170
10673
|
}
|
|
11171
10674
|
if (windowId && this.controlClient) {
|
|
@@ -11217,7 +10720,7 @@ export class Daemon extends EventEmitter {
|
|
|
11217
10720
|
this.logger.warn("Message not submitted after Enter — waiting for the prompt, then re-sending Enter once");
|
|
11218
10721
|
const promptBack = await this.waitForPaneReadyForDelivery(windowId, STRANDED_RETRY_READY_WAIT_MS);
|
|
11219
10722
|
const retryAt = Date.now();
|
|
11220
|
-
if (promptBack && !(await this.sendDeliveryEnter("stranded-text-retry"
|
|
10723
|
+
if (promptBack && !(await this.sendDeliveryEnter("stranded-text-retry"))) {
|
|
11221
10724
|
return this.failDelivery(verdict, status, "stranded-text-retry", "tmux-send-keys-failed");
|
|
11222
10725
|
}
|
|
11223
10726
|
submitted = promptBack && await this.confirmSubmittedAfterEnter(windowId, retryAt, formatted);
|
|
@@ -11305,7 +10808,7 @@ export class Daemon extends EventEmitter {
|
|
|
11305
10808
|
}
|
|
11306
10809
|
// No control client to observe output: fall back to the legacy double-Enter.
|
|
11307
10810
|
await new Promise(r => setTimeout(r, 1000));
|
|
11308
|
-
await this.sendDeliveryEnter("unobserved-defensive-retry"
|
|
10811
|
+
await this.sendDeliveryEnter("unobserved-defensive-retry");
|
|
11309
10812
|
if (status)
|
|
11310
10813
|
this.emit("message_confirmed", status); // ✅ (best-effort)
|
|
11311
10814
|
}
|
|
@@ -11525,22 +11028,14 @@ export class Daemon extends EventEmitter {
|
|
|
11525
11028
|
* and the caller's own fence — so a look that lands after any of them is never used (#1380 review).
|
|
11526
11029
|
*/
|
|
11527
11030
|
transcriptProofFor(checkpoint, needle, spawnAtWrite, stillCurrent, onProof) {
|
|
11528
|
-
if (this.nativePaneLifecycle && !checkpoint.runtime)
|
|
11529
|
-
throw Error("Native proof cannot read a coordinator-local transcript path");
|
|
11530
11031
|
const launchAtWrite = this.launchFenceEpoch;
|
|
11531
11032
|
return {
|
|
11532
|
-
reader:
|
|
11033
|
+
reader: new TranscriptDeltaReader(checkpoint.path, checkpoint.offset, checkpoint.backend, needle),
|
|
11533
11034
|
current: () => !this.deliveryWritesStopping && this.spawnGeneration === spawnAtWrite
|
|
11534
|
-
&& this.launchFenceEpoch === launchAtWrite && (stillCurrent?.() ?? true)
|
|
11535
|
-
&& (!checkpoint.runtime || this.nativePaneLifecycle?.current(checkpoint.runtime) === true),
|
|
11035
|
+
&& this.launchFenceEpoch === launchAtWrite && (stillCurrent?.() ?? true),
|
|
11536
11036
|
onProof,
|
|
11537
11037
|
};
|
|
11538
11038
|
}
|
|
11539
|
-
nativeTranscriptReader(reference, needle) {
|
|
11540
|
-
if (!this.nativePaneLifecycle || !this.nativePaneLifecycle.current(reference))
|
|
11541
|
-
throw Error("Native delivery transcript owner is unavailable");
|
|
11542
|
-
return this.nativePaneLifecycle.proofReader(reference, needle);
|
|
11543
|
-
}
|
|
11544
11039
|
/** The CLI this daemon drives, for log lines shared by every backend ("claude-code", "codex", …). */
|
|
11545
11040
|
cliLabel() {
|
|
11546
11041
|
return this.config.backend ?? this.backend?.binaryName ?? "CLI";
|
|
@@ -11790,14 +11285,7 @@ export class Daemon extends EventEmitter {
|
|
|
11790
11285
|
* (the retries included). Without a guard it is exactly the old unconditional path.
|
|
11791
11286
|
*/
|
|
11792
11287
|
async submitSystemPaste(text, label, guard, admission) {
|
|
11793
|
-
|
|
11794
|
-
// (#2958's fence, reverted on main for tmux panes) — a pane replaced while the paste awaits never takes its Enter.
|
|
11795
|
-
const native = !!this.nativePaneLifecycle;
|
|
11796
|
-
const ownerTmux = this.tmux, ownerGeneration = this.spawnGeneration, ownerFence = this.launchFenceEpoch;
|
|
11797
|
-
const ownerWindow = native ? ownerTmux?.getWindowId() : undefined;
|
|
11798
|
-
const owner = () => !native || (!!ownerTmux && !!ownerWindow && this.tmux === ownerTmux && ownerTmux.getWindowId() === ownerWindow
|
|
11799
|
-
&& this.spawnGeneration === ownerGeneration && this.launchFenceEpoch === ownerFence && !this.deliveryWritesStopping);
|
|
11800
|
-
const current = guard || admission || native ? () => { admission?.(); return owner() && (guard?.current() ?? true); } : undefined;
|
|
11288
|
+
const current = guard || admission ? () => { admission?.(); return guard?.current() ?? true; } : undefined;
|
|
11801
11289
|
if (current && !current())
|
|
11802
11290
|
return false;
|
|
11803
11291
|
if (!this.tmux)
|
|
@@ -11815,10 +11303,6 @@ export class Daemon extends EventEmitter {
|
|
|
11815
11303
|
if (!current() || !guard.accept(pane))
|
|
11816
11304
|
return false;
|
|
11817
11305
|
baseline = this.paneEvidence(pane, signature);
|
|
11818
|
-
if (native && this.backend?.binaryName === "codex") {
|
|
11819
|
-
const counts = this.paneQuotaPatterns().map(ep => ({ key: Daemon.errorPatternKey(ep), count: Daemon.countOccurrences(ep.pattern, pane) }));
|
|
11820
|
-
baseline.quotaHistory = { spawn: ownerGeneration, fence: ownerFence, attempt: this.launchAttempt, tmux: ownerTmux, window: ownerWindow, counts, marker: signature.value, occurrences: baseline.payload };
|
|
11821
|
-
}
|
|
11822
11306
|
}
|
|
11823
11307
|
else {
|
|
11824
11308
|
baseline = await this.capturePaneEvidence(signature);
|
|
@@ -11922,15 +11406,15 @@ export class Daemon extends EventEmitter {
|
|
|
11922
11406
|
&& sameInteractionOwner(recoveryOwner, this.interactionOwner());
|
|
11923
11407
|
const previousWindowId = this.tmux?.getWindowId();
|
|
11924
11408
|
try {
|
|
11925
|
-
const windows = await
|
|
11409
|
+
const windows = await TmuxManager.listWindows(this.tmuxSessionName, this.controlClient);
|
|
11926
11410
|
if (!recoveryCurrent() || this.tmux !== previousTmux)
|
|
11927
11411
|
return undefined;
|
|
11928
11412
|
const match = windows.find(w => w.name === this.name);
|
|
11929
11413
|
if (!match)
|
|
11930
11414
|
return undefined;
|
|
11931
|
-
this.tmux =
|
|
11415
|
+
this.tmux = new TmuxManager(this.tmuxSessionName, match.id, resolveTmuxLogicalSize(this.config.terminal), this.controlClient);
|
|
11932
11416
|
const recoveredTmux = this.tmux;
|
|
11933
|
-
this.
|
|
11417
|
+
writeFileSync(join(this.instanceDir, "window-id"), match.id);
|
|
11934
11418
|
// The window we were talking to is gone; leaving it registered means the
|
|
11935
11419
|
// control client re-resolves a dead id — one bounded read — on every
|
|
11936
11420
|
// reconnect, for the life of the fleet process.
|
|
@@ -11991,8 +11475,6 @@ export class Daemon extends EventEmitter {
|
|
|
11991
11475
|
return false;
|
|
11992
11476
|
}
|
|
11993
11477
|
getWindowId() {
|
|
11994
|
-
if (this.nativePaneLifecycle)
|
|
11995
|
-
return this.nativePaneLifecycle.current() ? this.tmux?.getWindowId() : undefined;
|
|
11996
11478
|
try {
|
|
11997
11479
|
return readFileSync(join(this.instanceDir, "window-id"), "utf-8").trim() || undefined;
|
|
11998
11480
|
}
|
|
@@ -12024,55 +11506,7 @@ export class Daemon extends EventEmitter {
|
|
|
12024
11506
|
* Handle a tool call from the MCP server (forwarded by Claude).
|
|
12025
11507
|
* Routes to the channel adapter via MessageBus.
|
|
12026
11508
|
*/
|
|
12027
|
-
|
|
12028
|
-
handlePaneToolCall(input, lease) {
|
|
12029
|
-
const refusal = nativePaneToolRefusal(input.tool, input.args);
|
|
12030
|
-
if (refusal)
|
|
12031
|
-
return Promise.resolve({ result: null, error: refusal });
|
|
12032
|
-
if (!lease.current() || !lease.allowed(input.tool, input.args) || this.deliveryWritesStopping)
|
|
12033
|
-
return Promise.resolve({ result: null, error: "Pane tool permission is no longer current" });
|
|
12034
|
-
const fence = this.launchFenceEpoch;
|
|
12035
|
-
const current = () => lease.current() && lease.allowed(input.tool, input.args) && !this.deliveryWritesStopping && fence === this.launchFenceEpoch;
|
|
12036
|
-
return new Promise(resolve => {
|
|
12037
|
-
let settled = false;
|
|
12038
|
-
const finish = (value) => { if (settled)
|
|
12039
|
-
return; settled = true; clearTimeout(timer); resolve(value); };
|
|
12040
|
-
const timer = setTimeout(() => finish({ result: null, error: "Pane tool result is unconfirmed; inspect its operation before retrying" }), daemonBudgetMs(input.tool) + 1000);
|
|
12041
|
-
timer.unref?.();
|
|
12042
|
-
try {
|
|
12043
|
-
this.handleToolCall({ ...input, requestId: ++this.fleetRequestSeq }, undefined, {
|
|
12044
|
-
current,
|
|
12045
|
-
dispatch: (tool, args, respond) => {
|
|
12046
|
-
if (!current()) {
|
|
12047
|
-
respond(null, "Pane tool permission was revoked before dispatch");
|
|
12048
|
-
return true;
|
|
12049
|
-
}
|
|
12050
|
-
const dispatched = lease.dispatch?.(tool, args);
|
|
12051
|
-
if (!dispatched)
|
|
12052
|
-
return false;
|
|
12053
|
-
void dispatched.then(result => respond(result), () => respond(null, "Pane tool operation was refused"));
|
|
12054
|
-
return true;
|
|
12055
|
-
},
|
|
12056
|
-
// Resolving the relay is not proof that its HTTP response reached the provider. No response-written receipt yet.
|
|
12057
|
-
send: value => {
|
|
12058
|
-
finish({ result: value.result, ...(typeof value.error === "string" ? { error: value.error } : {}),
|
|
12059
|
-
...(typeof value.errorCode === "string" || typeof value.errorCode === "number" ? { errorCode: value.errorCode } : {}) });
|
|
12060
|
-
return false;
|
|
12061
|
-
},
|
|
12062
|
-
});
|
|
12063
|
-
}
|
|
12064
|
-
catch {
|
|
12065
|
-
finish({ result: null, error: "Pane tool operation failed" });
|
|
12066
|
-
}
|
|
12067
|
-
});
|
|
12068
|
-
}
|
|
12069
|
-
/** Only the authority lease with a verified helper stdout ACK calls this internal barrier. */
|
|
12070
|
-
paneToolResponseWritten(operationId, current) {
|
|
12071
|
-
if (!current() || this.deliveryWritesStopping || !/^[a-f0-9-]{36}$/i.test(operationId))
|
|
12072
|
-
return;
|
|
12073
|
-
this.emit("mcp_tool_response_written", { operationId, daemonBootId: this.bootId });
|
|
12074
|
-
}
|
|
12075
|
-
handleToolCall(msg, socket, peer) {
|
|
11509
|
+
handleToolCall(msg, socket) {
|
|
12076
11510
|
const tool = msg.tool;
|
|
12077
11511
|
const args = (msg.args ?? {});
|
|
12078
11512
|
const requestId = msg.requestId;
|
|
@@ -12080,20 +11514,20 @@ export class Daemon extends EventEmitter {
|
|
|
12080
11514
|
this.logger.debug({ tool, requestId }, "Tool call from MCP server");
|
|
12081
11515
|
// A tool call can only come from a live MCP server of ours — proof of life
|
|
12082
11516
|
// that outranks whatever the pid slot says.
|
|
12083
|
-
if (
|
|
12084
|
-
this.noteMcpProofOfLife("tool_call",
|
|
11517
|
+
if (this.socketSessionNames.get(socket) === this.name) {
|
|
11518
|
+
this.noteMcpProofOfLife("tool_call", this.socketPids.get(socket));
|
|
12085
11519
|
}
|
|
12086
11520
|
// A tool invocation is not delivery evidence. Capture which obligation it
|
|
12087
11521
|
// belongs to now, then settle it only after the adapter/fleet responds.
|
|
12088
11522
|
// Explicitly mapped sibling sessions must not satisfy this instance's turn;
|
|
12089
11523
|
// an unmapped socket is retained for legacy/tests where mcp_ready was not
|
|
12090
11524
|
// observed before the first tool call.
|
|
12091
|
-
const sourceSession =
|
|
11525
|
+
const sourceSession = this.socketSessionNames.get(socket);
|
|
12092
11526
|
const replyAttempt = TURN_OUTBOUND_TOOLS.has(tool) && (!sourceSession || sourceSession === this.name)
|
|
12093
11527
|
? this.turnReplyGuard.beginToolAttempt(tool === "reply", TURN_COMPLETION_TOOLS.has(tool))
|
|
12094
11528
|
: null;
|
|
12095
11529
|
// For now, log and respond. Full adapter routing will be wired in fleet manager.
|
|
12096
|
-
const respond = (result, error
|
|
11530
|
+
const respond = (result, error) => {
|
|
12097
11531
|
// A message that verifiably went out stands down the dead-MCP proxy reply
|
|
12098
11532
|
// for this turn: the agent proved it can still speak for itself.
|
|
12099
11533
|
if (!error && result != null && TURN_OUTBOUND_TOOLS.has(tool)) {
|
|
@@ -12134,21 +11568,14 @@ export class Daemon extends EventEmitter {
|
|
|
12134
11568
|
// failed" and report unknown immediately rather than starting recovery.
|
|
12135
11569
|
this.turnReplyGuard.settleToolAttempt(replyAttempt, false);
|
|
12136
11570
|
}
|
|
12137
|
-
const
|
|
12138
|
-
const sent = peer ? peer.current() && peer.send(packet) : socket ? this.ipcServer?.send(socket, packet) ?? false : false;
|
|
11571
|
+
const sent = this.ipcServer?.send(socket, { requestId, result, error, operationId }) ?? false;
|
|
12139
11572
|
if (!sent) {
|
|
12140
|
-
|
|
12141
|
-
this.logger.debug({ tool, requestId }, "Native MCP result awaits transport-written confirmation");
|
|
12142
|
-
else
|
|
12143
|
-
this.logger.warn({ tool, requestId }, "Tool result could not be returned — originating MCP socket is closed");
|
|
11573
|
+
this.logger.warn({ tool, requestId }, "Tool result could not be returned — originating MCP socket is closed");
|
|
12144
11574
|
}
|
|
12145
11575
|
else if (operationId) {
|
|
12146
11576
|
this.emit("mcp_tool_response_written", { operationId, daemonBootId: this.bootId });
|
|
12147
11577
|
}
|
|
12148
11578
|
};
|
|
12149
|
-
// Native Fleet/task operations carry their lease to the existing dispatcher mutation admission points.
|
|
12150
|
-
if (peer?.dispatch?.(tool, args, respond))
|
|
12151
|
-
return;
|
|
12152
11579
|
// Repo checkout — handled locally in daemon (no fleet-manager)
|
|
12153
11580
|
if (tool === "checkout_repo") {
|
|
12154
11581
|
this.handleCheckoutRepo(args, respond);
|
|
@@ -12177,7 +11604,7 @@ export class Daemon extends EventEmitter {
|
|
|
12177
11604
|
clearTimeout(timeout);
|
|
12178
11605
|
respond(respMsg.result, respMsg.error);
|
|
12179
11606
|
});
|
|
12180
|
-
this.
|
|
11607
|
+
this.ipcServer?.broadcast({
|
|
12181
11608
|
type,
|
|
12182
11609
|
payload: args,
|
|
12183
11610
|
meta: { instance_name: this.name },
|
|
@@ -12203,7 +11630,7 @@ export class Daemon extends EventEmitter {
|
|
|
12203
11630
|
clearTimeout(timeout);
|
|
12204
11631
|
resolve({ result: respMsg.result, error: respMsg.error });
|
|
12205
11632
|
});
|
|
12206
|
-
this.
|
|
11633
|
+
this.ipcServer?.broadcast({ type: WEB_THEME_IPC[tool], payload, meta: { instance_name: this.name }, fleetRequestId: fleetReqId });
|
|
12207
11634
|
});
|
|
12208
11635
|
void (async () => {
|
|
12209
11636
|
if (tool === "preview_web_appearance") {
|
|
@@ -12280,7 +11707,7 @@ export class Daemon extends EventEmitter {
|
|
|
12280
11707
|
clearTimeout(timeout);
|
|
12281
11708
|
respond(respMsg.result, respMsg.error);
|
|
12282
11709
|
});
|
|
12283
|
-
this.
|
|
11710
|
+
this.ipcServer?.broadcast({
|
|
12284
11711
|
type: "fleet_task",
|
|
12285
11712
|
payload: args,
|
|
12286
11713
|
meta: { instance_name: this.name },
|
|
@@ -12303,7 +11730,7 @@ export class Daemon extends EventEmitter {
|
|
|
12303
11730
|
clearTimeout(timeout);
|
|
12304
11731
|
respond(respMsg.result, respMsg.error);
|
|
12305
11732
|
});
|
|
12306
|
-
this.
|
|
11733
|
+
this.ipcServer?.broadcast({
|
|
12307
11734
|
type: typeMap[tool],
|
|
12308
11735
|
payload: args,
|
|
12309
11736
|
meta: { instance_name: this.name, working_directory: this.config.working_directory },
|
|
@@ -12330,7 +11757,7 @@ export class Daemon extends EventEmitter {
|
|
|
12330
11757
|
clearTimeout(timeout);
|
|
12331
11758
|
respond(respMsg.result, respMsg.error);
|
|
12332
11759
|
});
|
|
12333
|
-
this.
|
|
11760
|
+
this.ipcServer?.broadcast({
|
|
12334
11761
|
type: typeMap[tool],
|
|
12335
11762
|
payload: args,
|
|
12336
11763
|
meta: {
|
|
@@ -12345,11 +11772,11 @@ export class Daemon extends EventEmitter {
|
|
|
12345
11772
|
}
|
|
12346
11773
|
if (CROSS_INSTANCE_TOOLS.has(tool)) {
|
|
12347
11774
|
// Route to fleet manager via IPC (topic mode only)
|
|
12348
|
-
if (this.topicMode && this.
|
|
11775
|
+
if (this.topicMode && this.ipcServer) {
|
|
12349
11776
|
// Use fleetRequestId (not requestId) to avoid MCP server resolving the
|
|
12350
11777
|
// pending tool call prematurely when it receives the broadcast.
|
|
12351
11778
|
const fleetReqId = `xmsg_${++this.fleetRequestSeq}_${requestId}`;
|
|
12352
|
-
const senderSessionName =
|
|
11779
|
+
const senderSessionName = this.socketSessionNames.get(socket);
|
|
12353
11780
|
// Shared table, so delete_instance and the deployment tools get the same
|
|
12354
11781
|
// budget here as the MCP client expects (the ad-hoc list omitted them).
|
|
12355
11782
|
const crossTimeoutMs = daemonBudgetMs(tool);
|
|
@@ -12361,7 +11788,7 @@ export class Daemon extends EventEmitter {
|
|
|
12361
11788
|
clearTimeout(timeout);
|
|
12362
11789
|
respond(respMsg.result, respMsg.error);
|
|
12363
11790
|
});
|
|
12364
|
-
this.
|
|
11791
|
+
this.ipcServer.broadcast({
|
|
12365
11792
|
type: "fleet_outbound",
|
|
12366
11793
|
tool,
|
|
12367
11794
|
args,
|
|
@@ -12415,12 +11842,12 @@ export class Daemon extends EventEmitter {
|
|
|
12415
11842
|
}, daemonBudgetMs(tool));
|
|
12416
11843
|
this.pendingIpcRequests.set(outboundKey, (respMsg) => {
|
|
12417
11844
|
clearTimeout(timeout);
|
|
12418
|
-
respond(respMsg.result, respMsg.error
|
|
11845
|
+
respond(respMsg.result, respMsg.error);
|
|
12419
11846
|
});
|
|
12420
11847
|
// Register the waiter before broadcasting. A fast/mock adapter can settle
|
|
12421
11848
|
// immediately; broadcasting first left a response-before-registration
|
|
12422
11849
|
// window that degraded into a timeout despite a completed POST.
|
|
12423
|
-
this.
|
|
11850
|
+
this.ipcServer?.broadcast({
|
|
12424
11851
|
type: "fleet_outbound",
|
|
12425
11852
|
tool,
|
|
12426
11853
|
args,
|
|
@@ -12510,9 +11937,10 @@ export class Daemon extends EventEmitter {
|
|
|
12510
11937
|
// Comma-separated parts (`file:role.md, file:rules.md`) only when a part is a file ref; otherwise one inline prompt.
|
|
12511
11938
|
const resolvedCustomPrompt = this.config.systemPrompt ? assembleSystemPrompt(this.config.systemPrompt, promptFiles) : undefined;
|
|
12512
11939
|
let decisions;
|
|
12513
|
-
|
|
11940
|
+
const source = this.decisionSource;
|
|
11941
|
+
if (source || process.env.AGEND_DECISIONS) {
|
|
12514
11942
|
try {
|
|
12515
|
-
const all = JSON.parse(process.env.AGEND_DECISIONS);
|
|
11943
|
+
const all = source ? source() : JSON.parse(process.env.AGEND_DECISIONS);
|
|
12516
11944
|
const workDir = this.config.working_directory;
|
|
12517
11945
|
// `scope: "fleet"` used to bypass the project check entirely, so a
|
|
12518
11946
|
// single-project worker inherited every other project's playbook (8 of
|
|
@@ -12521,7 +11949,12 @@ export class Daemon extends EventEmitter {
|
|
|
12521
11949
|
// same project, or the same project family (worktrees/checkouts of one
|
|
12522
11950
|
// repo). A general is exempt: it dispatches across all projects, so
|
|
12523
11951
|
// cross-project routing rules are exactly what it needs.
|
|
12524
|
-
|
|
11952
|
+
let teams = [];
|
|
11953
|
+
try {
|
|
11954
|
+
teams = this.decisionTeams?.() ?? [];
|
|
11955
|
+
}
|
|
11956
|
+
catch { /* no team list: fleet and project decisions only */ }
|
|
11957
|
+
decisions = capActiveDecisions(selectRelevantDecisions([...all], workDir, this.config.general_topic === true, teams));
|
|
12525
11958
|
// Stable ordering so identical decision sets always build byte-identical
|
|
12526
11959
|
// instructions — otherwise source ordering jitter flips the warmup hash.
|
|
12527
11960
|
decisions.sort((a, b) => a.title.localeCompare(b.title));
|
|
@@ -12551,7 +11984,7 @@ export class Daemon extends EventEmitter {
|
|
|
12551
11984
|
// The daemon used to read `general_topic` alone while `isGeneralInstance`
|
|
12552
11985
|
// also accepted the name, so an instance called `general` without the flag
|
|
12553
11986
|
// was a worker here and a general everywhere else.
|
|
12554
|
-
const isGeneral = this.config.general_topic === true ||
|
|
11987
|
+
const isGeneral = this.config.general_topic === true || this.name === "general";
|
|
12555
11988
|
// No third argument for an ordinary instance: the default is `worker` now,
|
|
12556
11989
|
// and naming it here would be a second place to change it.
|
|
12557
11990
|
const toolSet = isGeneral
|
|
@@ -12641,6 +12074,7 @@ export class Daemon extends EventEmitter {
|
|
|
12641
12074
|
effort: this.config.effort,
|
|
12642
12075
|
kiroUi: this.config.kiro_ui,
|
|
12643
12076
|
skipResume: this.skipResume,
|
|
12077
|
+
...(this.cliRepairSessionId ? { resumeSessionId: this.cliRepairSessionId } : {}),
|
|
12644
12078
|
instructions,
|
|
12645
12079
|
agentMode: isCliMode ? "cli" : "mcp",
|
|
12646
12080
|
agentPort: isCliMode ? agentPort : undefined,
|
|
@@ -12714,7 +12148,6 @@ export class Daemon extends EventEmitter {
|
|
|
12714
12148
|
this.cancelCapacityNudge("the instance was stopped, paused or respawned");
|
|
12715
12149
|
this.lastErrorEpisode = null;
|
|
12716
12150
|
this.quotaReplay = null;
|
|
12717
|
-
this.nativeQuotaReplayTaken = false;
|
|
12718
12151
|
this.quotaInput = null;
|
|
12719
12152
|
this.nudgeBaselines = null;
|
|
12720
12153
|
// A relaunch settles any outstanding quit watch: the CLI came back.
|
|
@@ -12930,8 +12363,6 @@ export class Daemon extends EventEmitter {
|
|
|
12930
12363
|
catch { /* best effort */ }
|
|
12931
12364
|
}
|
|
12932
12365
|
async spawnClaudeWindow() {
|
|
12933
|
-
if (this.nativePaneLifecycle)
|
|
12934
|
-
throw Error("Native panes never enter local resume/fresh fallback");
|
|
12935
12366
|
this.assertSessionOomAdmission();
|
|
12936
12367
|
this.beginSpawn();
|
|
12937
12368
|
let resumedSuccessfully = false;
|
|
@@ -13508,71 +12939,6 @@ export class Daemon extends EventEmitter {
|
|
|
13508
12939
|
* retries. Idempotent, and fast: no graceful CLI quit, the CLI never reached
|
|
13509
12940
|
* its prompt.
|
|
13510
12941
|
*/
|
|
13511
|
-
/**
|
|
13512
|
-
* #3313 review r2: after a failed start (abortStartup), whether this start's CLI is positively gone — no window was ever
|
|
13513
|
-
* asked for, or its window (by id, or by name while its creation was pending) is positively absent after another kill.
|
|
13514
|
-
* False when that cannot be told (tmux could not list). The failed start's OWN cleanup: called once, by that start,
|
|
13515
|
-
* while the window is still its own. When it cannot tell, the window and its pane process are remembered for
|
|
13516
|
-
* `startupIncarnationEnded()`.
|
|
13517
|
-
*/
|
|
13518
|
-
async startupCliEnded() {
|
|
13519
|
-
if (this.nativePaneLifecycle)
|
|
13520
|
-
return true;
|
|
13521
|
-
if (!this.tmux)
|
|
13522
|
-
return true;
|
|
13523
|
-
const windowId = this.tmux.getWindowId();
|
|
13524
|
-
let pid = null;
|
|
13525
|
-
if (windowId?.trim()) {
|
|
13526
|
-
try {
|
|
13527
|
-
pid = await this.paneHost.getPanePid(this.tmuxSessionName, windowId);
|
|
13528
|
-
}
|
|
13529
|
-
catch {
|
|
13530
|
-
pid = null;
|
|
13531
|
-
}
|
|
13532
|
-
}
|
|
13533
|
-
let gone = false;
|
|
13534
|
-
try {
|
|
13535
|
-
gone = await this.tmux.killWindowConfirmed();
|
|
13536
|
-
}
|
|
13537
|
-
catch {
|
|
13538
|
-
gone = false;
|
|
13539
|
-
}
|
|
13540
|
-
if (!gone)
|
|
13541
|
-
this.failedStartupIncarnation = windowId?.trim() ? { windowId, pid } : { windowId: null, pid: null };
|
|
13542
|
-
return gone;
|
|
13543
|
-
}
|
|
13544
|
-
failedStartupIncarnation = null;
|
|
13545
|
-
/**
|
|
13546
|
-
* #3313 review r3: the later re-checks of a failed start whose end was not proven — READ-ONLY (never kills: a retry of
|
|
13547
|
-
* the same agent may already run in a window with the same id). Ended when that window is gone, or when it now runs a
|
|
13548
|
-
* different pane process (it was respawned: the one this start left has been replaced). False when it cannot be told.
|
|
13549
|
-
*/
|
|
13550
|
-
async startupIncarnationEnded() {
|
|
13551
|
-
const inc = this.failedStartupIncarnation;
|
|
13552
|
-
if (!inc)
|
|
13553
|
-
return true;
|
|
13554
|
-
if (!inc.windowId)
|
|
13555
|
-
return false; // its window was never learned: nothing proves it gone
|
|
13556
|
-
let windows;
|
|
13557
|
-
try {
|
|
13558
|
-
windows = await TmuxManager.listWindowsStrict(this.tmuxSessionName);
|
|
13559
|
-
}
|
|
13560
|
-
catch {
|
|
13561
|
-
return false;
|
|
13562
|
-
}
|
|
13563
|
-
if (!windows.some(w => w.id === inc.windowId))
|
|
13564
|
-
return true;
|
|
13565
|
-
if (inc.pid === null)
|
|
13566
|
-
return false;
|
|
13567
|
-
let now;
|
|
13568
|
-
try {
|
|
13569
|
-
now = await this.paneHost.getPanePid(this.tmuxSessionName, inc.windowId);
|
|
13570
|
-
}
|
|
13571
|
-
catch {
|
|
13572
|
-
return false;
|
|
13573
|
-
}
|
|
13574
|
-
return now !== null && now !== inc.pid;
|
|
13575
|
-
}
|
|
13576
12942
|
async abortStartup() {
|
|
13577
12943
|
if (this.startupAborted)
|
|
13578
12944
|
return;
|
|
@@ -13583,14 +12949,6 @@ export class Daemon extends EventEmitter {
|
|
|
13583
12949
|
await this.museUsageRelay.stop().catch(() => { });
|
|
13584
12950
|
this.museUsageRelay = null;
|
|
13585
12951
|
}
|
|
13586
|
-
if (this.nativePaneLifecycle) {
|
|
13587
|
-
await this.nativePaneLifecycle.release("detach");
|
|
13588
|
-
try {
|
|
13589
|
-
unlinkSync(join(this.instanceDir, "daemon.pid"));
|
|
13590
|
-
}
|
|
13591
|
-
catch { /* metadata only */ }
|
|
13592
|
-
return;
|
|
13593
|
-
}
|
|
13594
12952
|
try {
|
|
13595
12953
|
await this.killProcessTree("SIGTERM", "startup aborted");
|
|
13596
12954
|
}
|
|
@@ -13620,15 +12978,13 @@ export class Daemon extends EventEmitter {
|
|
|
13620
12978
|
}
|
|
13621
12979
|
/** Kill the entire process tree of the current tmux pane (CLI + MCP server). */
|
|
13622
12980
|
async killProcessTree(signal = "SIGTERM", reason = "unspecified") {
|
|
13623
|
-
if (this.nativePaneLifecycle)
|
|
13624
|
-
throw Error("Native processes can only be closed through their owned runtime pane");
|
|
13625
12981
|
const windowId = this.tmux?.getWindowId();
|
|
13626
12982
|
// Before createWindow succeeds there is no pane owned by this daemon.
|
|
13627
12983
|
// tmux interprets an empty selector as the session's active window.
|
|
13628
12984
|
if (!windowId?.trim())
|
|
13629
12985
|
return;
|
|
13630
12986
|
try {
|
|
13631
|
-
const pid = await
|
|
12987
|
+
const pid = await TmuxManager.getPanePid(this.tmuxSessionName, windowId);
|
|
13632
12988
|
if (pid) {
|
|
13633
12989
|
this.noteStopRequest(signal, reason);
|
|
13634
12990
|
process.kill(-pid, signal);
|
|
@@ -13643,14 +12999,14 @@ export class Daemon extends EventEmitter {
|
|
|
13643
12999
|
* Handles confirmation dialogs (trust folder, bypass permissions).
|
|
13644
13000
|
* Returns true if CLI is ready, false if it failed or got stuck.
|
|
13645
13001
|
*/
|
|
13646
|
-
async trySpawn(reuseWindow = false, startupTimeoutMs) {
|
|
13002
|
+
async trySpawn(reuseWindow = false, startupTimeoutMs, repairAdmission) {
|
|
13647
13003
|
const recoveryOwner = this.collateralOomRecovery ? this.interactionOwner() : null;
|
|
13648
13004
|
const enter = () => {
|
|
13649
13005
|
if (recoveryOwner && (!sameInteractionOwner(recoveryOwner, this.interactionOwner())
|
|
13650
13006
|
|| this.startupAborted || this.deliveryWritesStopping || this.runtimeMonitorsFrozen || this.healthCheckPaused)) {
|
|
13651
13007
|
throw new Error("OOM recovery cancelled: the instance was stopped, paused or replaced while memory was unavailable");
|
|
13652
13008
|
}
|
|
13653
|
-
return this.trySpawnInsideGate(reuseWindow, startupTimeoutMs).catch(err => {
|
|
13009
|
+
return this.trySpawnInsideGate(reuseWindow, startupTimeoutMs, repairAdmission).catch(err => {
|
|
13654
13010
|
// Includes an in-place binary replacement during asynchronous launch preparation.
|
|
13655
13011
|
if (err instanceof KiroCompatibilityError)
|
|
13656
13012
|
this.emit("kiro_compatibility_hold", err.message);
|
|
@@ -13675,6 +13031,122 @@ export class Daemon extends EventEmitter {
|
|
|
13675
13031
|
this.startupAdmission?.();
|
|
13676
13032
|
return ready;
|
|
13677
13033
|
}
|
|
13034
|
+
/** Resolve the installed launcher; never run Claude to discover its version. */
|
|
13035
|
+
async resolveClaudeInstallPath() {
|
|
13036
|
+
const { binaryProbe } = await import("./binary-probe.js");
|
|
13037
|
+
const { resolveBackendBinary } = await import("./backend-availability.js");
|
|
13038
|
+
binaryProbe.invalidate("claude");
|
|
13039
|
+
return await resolveBackendBinary("claude-code") ?? null;
|
|
13040
|
+
}
|
|
13041
|
+
async installedClaudeVersion(path) {
|
|
13042
|
+
const { staticBackendVersion } = await import("./backend-availability.js");
|
|
13043
|
+
return staticBackendVersion("claude-code", path);
|
|
13044
|
+
}
|
|
13045
|
+
/** #3441: only the CLI's own refusal can request this one, non-renewable repair. */
|
|
13046
|
+
handleClaudeModelMinimum(minimum) {
|
|
13047
|
+
if (this.modelMinimumRepairUsed || this.modelMinimumBlocked || this.spawning || this.healthCheckPaused
|
|
13048
|
+
|| this.pauseWakeState !== "active" || this.backend?.binaryName !== "claude"
|
|
13049
|
+
|| !this.backend.refreshLaunchBinary)
|
|
13050
|
+
return Promise.resolve();
|
|
13051
|
+
if (this.modelMinimumFlight)
|
|
13052
|
+
return this.modelMinimumFlight;
|
|
13053
|
+
const flight = this.repairClaudeModelMinimum(minimum).finally(() => {
|
|
13054
|
+
if (this.modelMinimumFlight === flight)
|
|
13055
|
+
this.modelMinimumFlight = null;
|
|
13056
|
+
});
|
|
13057
|
+
this.modelMinimumFlight = flight;
|
|
13058
|
+
return flight;
|
|
13059
|
+
}
|
|
13060
|
+
async repairClaudeModelMinimum(minimum) {
|
|
13061
|
+
const tmux = this.tmux, backend = this.backend, window = tmux?.getWindowId();
|
|
13062
|
+
let spawn = this.spawnGeneration, claimed = false;
|
|
13063
|
+
const fence = this.launchFenceEpoch, attempt = this.launchAttempt, phase = this.pauseWakeState;
|
|
13064
|
+
const baseCurrent = () => this.tmux === tmux && this.backend === backend && tmux?.getWindowId() === window
|
|
13065
|
+
&& this.spawnGeneration === spawn && this.launchFenceEpoch === fence && this.pauseWakeState === phase
|
|
13066
|
+
&& !this.startupAborted && !this.deliveryWritesStopping && !this.runtimeMonitorsFrozen && !this.healthCheckPaused;
|
|
13067
|
+
const current = () => baseCurrent() && this.launchAttempt === attempt;
|
|
13068
|
+
const failed = () => new Error(t("inst.cli_repair_failed"));
|
|
13069
|
+
try {
|
|
13070
|
+
// Read the newly resolved install, not a cached old prefix or the running image.
|
|
13071
|
+
const path = await this.resolveClaudeInstallPath();
|
|
13072
|
+
if (!current())
|
|
13073
|
+
return;
|
|
13074
|
+
const version = path ? await this.installedClaudeVersion(path) : null;
|
|
13075
|
+
if (!current())
|
|
13076
|
+
return;
|
|
13077
|
+
if (!version || cliVersionBelow(version, minimum.required)) {
|
|
13078
|
+
if (!this.modelMinimumUpdateNotified) {
|
|
13079
|
+
this.modelMinimumUpdateNotified = true;
|
|
13080
|
+
this.logger.warn({ required: minimum.required, installed: version }, "Claude Code needs an update for this model");
|
|
13081
|
+
this.emit("backend_launch_warning", { name: this.name, message: t("inst.cli_update_needed", minimum.required) });
|
|
13082
|
+
}
|
|
13083
|
+
return;
|
|
13084
|
+
}
|
|
13085
|
+
await this.paneWriteLock.run(async () => {
|
|
13086
|
+
if (!current())
|
|
13087
|
+
return;
|
|
13088
|
+
if (!await this.isPaneAuthoritativelyIdle())
|
|
13089
|
+
throw failed();
|
|
13090
|
+
if (!current())
|
|
13091
|
+
return;
|
|
13092
|
+
// Claim before yielding the write lock; queued delivery remains held until readiness settles.
|
|
13093
|
+
this.modelMinimumRepairUsed = true;
|
|
13094
|
+
this.beginSpawn();
|
|
13095
|
+
claimed = true;
|
|
13096
|
+
spawn = this.spawnGeneration;
|
|
13097
|
+
});
|
|
13098
|
+
if (!claimed || !current())
|
|
13099
|
+
return;
|
|
13100
|
+
await this.checkpointSessionId();
|
|
13101
|
+
if (!current())
|
|
13102
|
+
return;
|
|
13103
|
+
let session;
|
|
13104
|
+
if (!this.skipResume) {
|
|
13105
|
+
try {
|
|
13106
|
+
const value = readFileSync(join(this.instanceDir, "session-id"), "utf8").trim();
|
|
13107
|
+
if (/^[a-f0-9]{8}-(?:[a-f0-9]{4}-){3}[a-f0-9]{12}$/i.test(value))
|
|
13108
|
+
session = value;
|
|
13109
|
+
}
|
|
13110
|
+
catch { /* Unknown is not permission to select another conversation. */ }
|
|
13111
|
+
}
|
|
13112
|
+
if (!session)
|
|
13113
|
+
throw failed();
|
|
13114
|
+
// Recheck disk evidence after checkpointing; an update may have changed it while we waited.
|
|
13115
|
+
const finalVersion = await this.installedClaudeVersion(path);
|
|
13116
|
+
if (!current())
|
|
13117
|
+
return;
|
|
13118
|
+
if (!finalVersion || cliVersionBelow(finalVersion, minimum.required))
|
|
13119
|
+
throw failed();
|
|
13120
|
+
if (!await this.isPaneAuthoritativelyIdle())
|
|
13121
|
+
throw failed();
|
|
13122
|
+
if (!current())
|
|
13123
|
+
return;
|
|
13124
|
+
this.logger.warn({ running: minimum.running, required: minimum.required, installed: finalVersion }, "Claude model-version refusal — attempting one same-session restart");
|
|
13125
|
+
backend.refreshLaunchBinary(path);
|
|
13126
|
+
this.cliRepairSessionId = session;
|
|
13127
|
+
const ready = await this.trySpawn(true, this.startupBudgetFor(true), next => baseCurrent() && this.launchAttempt === next && next >= attempt && next <= attempt + 1);
|
|
13128
|
+
this.cliRepairSessionId = undefined;
|
|
13129
|
+
if (!baseCurrent() || this.launchAttempt !== attempt + 1)
|
|
13130
|
+
return;
|
|
13131
|
+
if (!ready)
|
|
13132
|
+
throw failed();
|
|
13133
|
+
this.logger.info("Claude model-version restart completed; session retained");
|
|
13134
|
+
this.emit("backend_launch_warning", { name: this.name, message: t("inst.cli_repaired") });
|
|
13135
|
+
}
|
|
13136
|
+
catch (error) {
|
|
13137
|
+
if (!baseCurrent() || this.launchAttempt > attempt + 1)
|
|
13138
|
+
return;
|
|
13139
|
+
this.modelMinimumBlocked = true;
|
|
13140
|
+
this.healthCheckPaused = true;
|
|
13141
|
+
this.logger.error({ reason: error instanceof Error ? error.message : String(error) }, "Claude model-version repair held; no automatic retry");
|
|
13142
|
+
this.emit("backend_launch_warning", { name: this.name, message: t("inst.cli_repair_failed") });
|
|
13143
|
+
}
|
|
13144
|
+
finally {
|
|
13145
|
+
this.cliRepairSessionId = undefined;
|
|
13146
|
+
if (claimed)
|
|
13147
|
+
this.endSpawn();
|
|
13148
|
+
}
|
|
13149
|
+
}
|
|
13678
13150
|
/**
|
|
13679
13151
|
* One fresh pane capture judged as ready && !busy && !dialog. Transcript
|
|
13680
13152
|
* silence is deliberately NOT the gate: its monitor is inert for muse, so a
|
|
@@ -13847,7 +13319,7 @@ export class Daemon extends EventEmitter {
|
|
|
13847
13319
|
whatsNewRoles() {
|
|
13848
13320
|
if (this.runtimeIdentity?.kind === "classic")
|
|
13849
13321
|
return ["classic"];
|
|
13850
|
-
if (this.config.general_topic === true ||
|
|
13322
|
+
if (this.config.general_topic === true || this.name === "general")
|
|
13851
13323
|
return ["general"];
|
|
13852
13324
|
const set = resolveToolSet(this.config, this.name);
|
|
13853
13325
|
return set === "coordinator" || set === "full" ? ["worker", "coordinator"] : ["worker"];
|
|
@@ -13873,11 +13345,12 @@ export class Daemon extends EventEmitter {
|
|
|
13873
13345
|
this.logger.debug({ err }, "what's-new not prepared");
|
|
13874
13346
|
}
|
|
13875
13347
|
}
|
|
13876
|
-
async trySpawnInsideGate(reuseWindow = false, startupTimeoutMs) {
|
|
13877
|
-
|
|
13878
|
-
|
|
13348
|
+
async trySpawnInsideGate(reuseWindow = false, startupTimeoutMs, repairAdmission) {
|
|
13349
|
+
let expectedAttempt = this.launchAttempt;
|
|
13350
|
+
const admit = () => { this.startupAdmission?.(); if (repairAdmission && !repairAdmission(expectedAttempt))
|
|
13351
|
+
throw new Error("CLI repair superseded by another launch, pause or stop"); };
|
|
13879
13352
|
this.assertSessionOomAdmission();
|
|
13880
|
-
|
|
13353
|
+
admit();
|
|
13881
13354
|
const launchFence = this.launchFenceEpoch;
|
|
13882
13355
|
const backendConfig = this.buildBackendConfig();
|
|
13883
13356
|
// A compatibility refusal is not a failed resume: no configuration, pin, history or pane may change.
|
|
@@ -13903,7 +13376,7 @@ export class Daemon extends EventEmitter {
|
|
|
13903
13376
|
catch { /* unknown capability → the backend's conservative form */ }
|
|
13904
13377
|
// Thrown, not `false`: a false verdict reads as "the CLI failed to start" and sends the startup path
|
|
13905
13378
|
// into its resume-retry / set-the-session-aside handling, for an instance somebody just stopped.
|
|
13906
|
-
|
|
13379
|
+
admit();
|
|
13907
13380
|
this.assertSessionOomAdmission();
|
|
13908
13381
|
if (launchFence !== this.launchFenceEpoch)
|
|
13909
13382
|
throw new Error("Launch cancelled: the instance was stopped or paused while the launch was being prepared");
|
|
@@ -13962,13 +13435,14 @@ export class Daemon extends EventEmitter {
|
|
|
13962
13435
|
// The CLI's own shell sets a zero coredump_filter first (#1113): this pane
|
|
13963
13436
|
// may belong to a tmux server the fleet did not start, which would hand
|
|
13964
13437
|
// the CLI its own (full) filter instead of the fleet's.
|
|
13965
|
-
|
|
13438
|
+
admit();
|
|
13966
13439
|
const cmd = coredumpFilterLaunchPrefix() + `${envPrefix} ` + this.backend.buildCommand(launchConfig);
|
|
13967
13440
|
// Every launched command re-arms the passive-transient check, including a
|
|
13968
13441
|
// retry inside the same spawn: its load is a new one.
|
|
13969
|
-
this.launchAttempt
|
|
13442
|
+
expectedAttempt = ++this.launchAttempt;
|
|
13443
|
+
admit();
|
|
13970
13444
|
await this.prepareQuotaReplayHistory(reuseWindow);
|
|
13971
|
-
|
|
13445
|
+
admit();
|
|
13972
13446
|
this.interactionObservation.reset(this.interactionOwner());
|
|
13973
13447
|
this.clearInteractionConfirmation();
|
|
13974
13448
|
// A launch that cannot paint a passive transient (Codex: a fresh start
|
|
@@ -13988,16 +13462,16 @@ export class Daemon extends EventEmitter {
|
|
|
13988
13462
|
this.emit("backend_launch_warning", { name: this.name, message: note, quiet: true });
|
|
13989
13463
|
}
|
|
13990
13464
|
// Ensure tmux session exists (may have been destroyed if all windows died)
|
|
13991
|
-
await
|
|
13992
|
-
if (this.stormWindow?.observeServerAlive(await
|
|
13465
|
+
await TmuxManager.ensureSession(this.tmuxSessionName);
|
|
13466
|
+
if (this.stormWindow?.observeServerAlive(await TmuxManager.getServerPid(this.tmuxSessionName))) {
|
|
13993
13467
|
this.emit("tmux_server_crash", this.name);
|
|
13994
13468
|
}
|
|
13995
|
-
|
|
13469
|
+
admit();
|
|
13996
13470
|
let windowId;
|
|
13997
13471
|
this.assertSessionOomAdmission();
|
|
13998
13472
|
if (reuseWindow) {
|
|
13999
13473
|
this.controlClient?.unregisterWindow(this.tmux.getWindowId());
|
|
14000
|
-
await this.tmux.respawnWindow(cmd, resolvedCwd);
|
|
13474
|
+
await this.tmux.respawnWindow(cmd, resolvedCwd, repairAdmission ? admit : undefined);
|
|
14001
13475
|
windowId = this.tmux.getWindowId();
|
|
14002
13476
|
}
|
|
14003
13477
|
else {
|
|
@@ -14008,8 +13482,8 @@ export class Daemon extends EventEmitter {
|
|
|
14008
13482
|
if (retired && retired !== windowId)
|
|
14009
13483
|
this.controlClient?.unregisterWindow(retired);
|
|
14010
13484
|
}
|
|
14011
|
-
|
|
14012
|
-
this.
|
|
13485
|
+
admit();
|
|
13486
|
+
writeFileSync(join(this.instanceDir, "window-id"), windowId);
|
|
14013
13487
|
// Enable remain-on-exit to capture exit codes on crash
|
|
14014
13488
|
await this.tmux.setRemainOnExit().catch(err => {
|
|
14015
13489
|
this.logger.warn({ err }, "Failed to set remain-on-exit — exit codes will not be captured");
|
|
@@ -14043,6 +13517,7 @@ export class Daemon extends EventEmitter {
|
|
|
14043
13517
|
else {
|
|
14044
13518
|
await new Promise(r => setTimeout(r, 10_000));
|
|
14045
13519
|
}
|
|
13520
|
+
admit();
|
|
14046
13521
|
// Dismiss confirmation dialogs and verify CLI reached prompt.
|
|
14047
13522
|
// With remain-on-exit, isWindowAlive() returns true even for dead panes,
|
|
14048
13523
|
// but a startup crash would already be caught by waitForOutput/waitForIdle above.
|
|
@@ -14266,15 +13741,12 @@ export class Daemon extends EventEmitter {
|
|
|
14266
13741
|
// each have seen a respawn, pause or stop.
|
|
14267
13742
|
if (!owned())
|
|
14268
13743
|
return false;
|
|
14269
|
-
const keyScreen = this.nativePaneLifecycle ? await this.tmux.capturePane() : answeredPane;
|
|
14270
|
-
if (!owned() || !Daemon.dialogMatches(dialog, keyScreen))
|
|
14271
|
-
return false;
|
|
14272
13744
|
if (key === "Up" || key === "Down" || key === "Enter" || key === "Escape") {
|
|
14273
|
-
if (!await
|
|
13745
|
+
if (!await this.tmux.sendSpecialKey(key))
|
|
14274
13746
|
return false;
|
|
14275
13747
|
}
|
|
14276
13748
|
else {
|
|
14277
|
-
if (!await
|
|
13749
|
+
if (!await this.tmux.sendKeys(key))
|
|
14278
13750
|
return false;
|
|
14279
13751
|
}
|
|
14280
13752
|
await new Promise(r => setTimeout(r, 200));
|
|
@@ -14288,8 +13760,7 @@ export class Daemon extends EventEmitter {
|
|
|
14288
13760
|
// Wait for next screen to render — bounded by what is left of the budget.
|
|
14289
13761
|
const renderWait = Math.max(0, Math.min(10_000, remaining()));
|
|
14290
13762
|
if (this.controlClient) {
|
|
14291
|
-
const wid = this.
|
|
14292
|
-
: readFileSync(join(this.instanceDir, "window-id"), "utf-8").trim();
|
|
13763
|
+
const wid = readFileSync(join(this.instanceDir, "window-id"), "utf-8").trim();
|
|
14293
13764
|
await this.controlClient.waitForIdle(wid, renderWait);
|
|
14294
13765
|
}
|
|
14295
13766
|
else {
|
|
@@ -14325,9 +13796,7 @@ export class Daemon extends EventEmitter {
|
|
|
14325
13796
|
// scan parked on the old limit text.
|
|
14326
13797
|
const codexReady = this.backend.binaryName !== "codex"
|
|
14327
13798
|
|| this.isCodexLivePaneSnapshot(pane);
|
|
14328
|
-
|
|
14329
|
-
? this.backend.readInputRow(pane) !== null : this.backend?.isDeliveryInputReadyPane?.(pane) === true);
|
|
14330
|
-
if (readyPatternMatches && codexReady && nativeComposerReady) {
|
|
13799
|
+
if (readyPatternMatches && codexReady) {
|
|
14331
13800
|
cleanReadyPolls++;
|
|
14332
13801
|
if (cleanReadyPolls >= 2 || remaining() <= 0) {
|
|
14333
13802
|
// A real ready prompt (with no fatal dialog on screen — those are
|
|
@@ -14423,11 +13892,6 @@ export class Daemon extends EventEmitter {
|
|
|
14423
13892
|
* lookup is the backend's own single-flight one: an idle observation already running it is joined,
|
|
14424
13893
|
* not repeated. Never rejects.
|
|
14425
13894
|
*/
|
|
14426
|
-
/** The window-id file and its socket tag: a window-id without it is 2.3's (tmux-legacy.ts). */
|
|
14427
|
-
writeWindowId(windowId) {
|
|
14428
|
-
writeFileSync(join(this.instanceDir, "window-id"), windowId);
|
|
14429
|
-
tagWindowId(this.instanceDir, tmuxSocket(), windowId);
|
|
14430
|
-
}
|
|
14431
13895
|
checkpointSessionId() {
|
|
14432
13896
|
const refresh = this.backend?.refreshSessionId;
|
|
14433
13897
|
if (this.skipResume || !refresh) {
|
|
@@ -14461,16 +13925,6 @@ export class Daemon extends EventEmitter {
|
|
|
14461
13925
|
void refresh.call(this.backend).then(() => this.saveSessionId(), () => { });
|
|
14462
13926
|
}
|
|
14463
13927
|
saveSessionId() {
|
|
14464
|
-
if (this.nativePaneLifecycle) {
|
|
14465
|
-
try {
|
|
14466
|
-
this.nativePaneLifecycle.checkpointSession();
|
|
14467
|
-
this.ownedWorkingSession = this.backend?.getSessionId() ?? null;
|
|
14468
|
-
}
|
|
14469
|
-
catch (err) {
|
|
14470
|
-
this.logger.warn({ err }, "Native conversation checkpoint is unconfirmed");
|
|
14471
|
-
}
|
|
14472
|
-
return;
|
|
14473
|
-
}
|
|
14474
13928
|
// When a resume failure has forced a fresh start, don't persist the stale id
|
|
14475
13929
|
// back from statusline.json — that would re-arm --continue and re-loop.
|
|
14476
13930
|
if (this.skipResume)
|