@songsid/agend 2.3.4-beta.9 → 2.3.5-alpha.10
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 +2 -0
- package/README.zh-TW.md +2 -0
- package/THIRD_PARTY_NOTICES.md +67 -0
- package/dist/accounts-profiles.d.ts +102 -0
- package/dist/accounts-profiles.js +194 -0
- package/dist/accounts-profiles.js.map +1 -0
- package/dist/accounts-signout.d.ts +59 -0
- package/dist/accounts-signout.js +181 -0
- package/dist/accounts-signout.js.map +1 -0
- package/dist/accounts-view.d.ts +168 -0
- package/dist/accounts-view.js +188 -0
- package/dist/accounts-view.js.map +1 -0
- 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 +5 -1
- package/dist/agent-endpoint.js +12 -2
- 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-runtime-api.d.ts +4 -0
- package/dist/agent-runtime-api.js +59 -0
- package/dist/agent-runtime-api.js.map +1 -0
- package/dist/agent-runtime-change.d.ts +76 -0
- package/dist/agent-runtime-change.js +114 -0
- package/dist/agent-runtime-change.js.map +1 -0
- package/dist/agent-whats-new.js +5 -0
- package/dist/agent-whats-new.js.map +1 -1
- package/dist/agent-workspace.d.ts +104 -0
- package/dist/agent-workspace.js +381 -0
- package/dist/agent-workspace.js.map +1 -0
- package/dist/apply-job.d.ts +5 -0
- package/dist/apply-job.js +10 -3
- package/dist/apply-job.js.map +1 -1
- package/dist/auth-api.d.ts +49 -1
- package/dist/auth-api.js +299 -10
- package/dist/auth-api.js.map +1 -1
- package/dist/authority/company-join.d.ts +16 -0
- package/dist/authority/company-join.js +37 -0
- package/dist/authority/company-join.js.map +1 -0
- package/dist/authority/hub-initialization.d.ts +13 -0
- package/dist/authority/hub-initialization.js +30 -0
- package/dist/authority/hub-initialization.js.map +1 -0
- package/dist/authority/session-authorizations.d.ts +2 -0
- package/dist/authority/session-authorizations.js +7 -1
- package/dist/authority/session-authorizations.js.map +1 -1
- package/dist/authority/web-authority.d.ts +25 -2
- package/dist/authority/web-authority.js +37 -4
- package/dist/authority/web-authority.js.map +1 -1
- package/dist/backend/claude-code.d.ts +16 -12
- package/dist/backend/claude-code.js +212 -142
- package/dist/backend/claude-code.js.map +1 -1
- package/dist/backend/codex-footer-hints.d.ts +3 -0
- package/dist/backend/codex-footer-hints.js +14 -0
- package/dist/backend/codex-footer-hints.js.map +1 -1
- package/dist/backend/codex-metadata.d.ts +14 -0
- package/dist/backend/codex-metadata.js +45 -0
- package/dist/backend/codex-metadata.js.map +1 -1
- package/dist/backend/codex-package.d.ts +5 -2
- package/dist/backend/codex-package.js +1 -5
- package/dist/backend/codex-package.js.map +1 -1
- package/dist/backend/codex-quota-history.d.ts +7 -0
- package/dist/backend/codex-quota-history.js +57 -0
- package/dist/backend/codex-quota-history.js.map +1 -0
- package/dist/backend/codex-session-lookup.d.ts +6 -0
- package/dist/backend/codex-session-lookup.js +1 -1
- package/dist/backend/codex-session-lookup.js.map +1 -1
- package/dist/backend/codex-speed.d.ts +14 -0
- package/dist/backend/codex-speed.js +35 -0
- package/dist/backend/codex-speed.js.map +1 -0
- package/dist/backend/codex.d.ts +143 -113
- package/dist/backend/codex.js +1352 -1233
- package/dist/backend/codex.js.map +1 -1
- package/dist/backend/credential-profile.js +2 -1
- package/dist/backend/credential-profile.js.map +1 -1
- package/dist/backend/grok-model-cache.d.ts +7 -0
- package/dist/backend/grok-model-cache.js +65 -0
- package/dist/backend/grok-model-cache.js.map +1 -0
- package/dist/backend/grok-weekly-reset.d.ts +24 -0
- package/dist/backend/grok-weekly-reset.js +95 -0
- package/dist/backend/grok-weekly-reset.js.map +1 -0
- package/dist/backend/grok.d.ts +32 -1
- package/dist/backend/grok.js +323 -54
- package/dist/backend/grok.js.map +1 -1
- package/dist/backend/kiro.js +12 -2
- package/dist/backend/kiro.js.map +1 -1
- package/dist/backend/native-pane.d.ts +11 -0
- package/dist/backend/native-pane.js +59 -0
- package/dist/backend/native-pane.js.map +1 -0
- package/dist/backend/types.d.ts +20 -0
- package/dist/backend/types.js.map +1 -1
- package/dist/backend-signin-pending.d.ts +8 -2
- package/dist/backend-signin-pending.js +6 -2
- package/dist/backend-signin-pending.js.map +1 -1
- package/dist/browser-backend-signins.d.ts +2 -1
- package/dist/browser-backend-signins.js +1 -1
- package/dist/browser-backend-signins.js.map +1 -1
- package/dist/build-provenance-cli.d.ts +3 -0
- package/dist/build-provenance-cli.js +11 -0
- package/dist/build-provenance-cli.js.map +1 -0
- package/dist/build-provenance.d.ts +20 -0
- package/dist/build-provenance.js +67 -0
- package/dist/build-provenance.js.map +1 -0
- package/dist/build-provenance.json +1 -0
- package/dist/bundled-tmux-guard.d.ts +19 -0
- package/dist/bundled-tmux-guard.js +83 -0
- package/dist/bundled-tmux-guard.js.map +1 -0
- package/dist/cache-ledger.d.ts +10 -0
- package/dist/cache-ledger.js +49 -12
- package/dist/cache-ledger.js.map +1 -1
- package/dist/cache-service.d.ts +6 -0
- package/dist/cache-service.js +105 -0
- package/dist/cache-service.js.map +1 -1
- package/dist/channel/access-manager.d.ts +1 -6
- package/dist/channel/access-manager.js +4 -94
- package/dist/channel/access-manager.js.map +1 -1
- package/dist/channel/adapters/discord.d.ts +0 -2
- package/dist/channel/adapters/discord.js +0 -8
- package/dist/channel/adapters/discord.js.map +1 -1
- package/dist/channel/adapters/telegram.d.ts +51 -3
- package/dist/channel/adapters/telegram.js +232 -44
- package/dist/channel/adapters/telegram.js.map +1 -1
- package/dist/channel/ipc-bridge.d.ts +2 -0
- package/dist/channel/mcp-tools.js +7 -7
- package/dist/channel/mcp-tools.js.map +1 -1
- package/dist/channel/types.d.ts +2 -2
- package/dist/classic-bindings.d.ts +13 -0
- package/dist/classic-bindings.js +28 -2
- package/dist/classic-bindings.js.map +1 -1
- package/dist/classic-channel-manager.d.ts +2 -0
- package/dist/classic-channel-manager.js +5 -1
- package/dist/classic-channel-manager.js.map +1 -1
- package/dist/claude-auth-status.d.ts +48 -0
- package/dist/claude-auth-status.js +149 -0
- package/dist/claude-auth-status.js.map +1 -0
- 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-capability.d.ts +186 -0
- package/dist/cli-capability.js +55 -0
- package/dist/cli-capability.js.map +1 -0
- package/dist/cli-caps-module.d.ts +29 -0
- package/dist/cli-caps-module.js +43 -0
- package/dist/cli-caps-module.js.map +1 -0
- package/dist/cli-registry-check.d.ts +28 -0
- package/dist/cli-registry-check.js +223 -0
- package/dist/cli-registry-check.js.map +1 -0
- package/dist/cli-registry.d.ts +526 -0
- package/dist/cli-registry.js +83 -0
- package/dist/cli-registry.js.map +1 -0
- package/dist/cli-spec-antigravity.d.ts +60 -0
- package/dist/cli-spec-antigravity.js +35 -0
- package/dist/cli-spec-antigravity.js.map +1 -0
- package/dist/cli-spec-claude-code.d.ts +84 -0
- package/dist/cli-spec-claude-code.js +35 -0
- package/dist/cli-spec-claude-code.js.map +1 -0
- package/dist/cli-spec-codex.d.ts +78 -0
- package/dist/cli-spec-codex.js +38 -0
- package/dist/cli-spec-codex.js.map +1 -0
- package/dist/cli-spec-grok.d.ts +59 -0
- package/dist/cli-spec-grok.js +35 -0
- package/dist/cli-spec-grok.js.map +1 -0
- package/dist/cli-spec-kiro-cli.d.ts +73 -0
- package/dist/cli-spec-kiro-cli.js +36 -0
- package/dist/cli-spec-kiro-cli.js.map +1 -0
- package/dist/cli-spec-muse.d.ts +52 -0
- package/dist/cli-spec-muse.js +38 -0
- package/dist/cli-spec-muse.js.map +1 -0
- package/dist/cli-spec-opencode.d.ts +50 -0
- package/dist/cli-spec-opencode.js +37 -0
- package/dist/cli-spec-opencode.js.map +1 -0
- package/dist/cli.js +258 -67
- package/dist/cli.js.map +1 -1
- package/dist/config-validator.js +104 -2
- package/dist/config-validator.js.map +1 -1
- package/dist/config.js +19 -1
- package/dist/config.js.map +1 -1
- package/dist/daemon.d.ts +162 -7
- package/dist/daemon.js +1290 -305
- package/dist/daemon.js.map +1 -1
- package/dist/dashboard-permissions.d.ts +8 -0
- package/dist/dashboard-permissions.js +16 -0
- package/dist/dashboard-permissions.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 +15 -3
- package/dist/delivery-consumed-watch.js +23 -1
- package/dist/delivery-consumed-watch.js.map +1 -1
- package/dist/delivery-outbox.d.ts +5 -0
- package/dist/delivery-outbox.js +32 -4
- package/dist/delivery-outbox.js.map +1 -1
- package/dist/delivery-reconciliation.d.ts +2 -42
- package/dist/delivery-reconciliation.js +2 -164
- package/dist/delivery-reconciliation.js.map +1 -1
- package/dist/doctor.js +19 -9
- package/dist/doctor.js.map +1 -1
- package/dist/e2e-isolation.js +5 -2
- 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 +2 -0
- package/dist/fleet-level-config.js.map +1 -1
- package/dist/fleet-manager.d.ts +831 -7
- package/dist/fleet-manager.js +4894 -433
- package/dist/fleet-manager.js.map +1 -1
- package/dist/fleet-windows-runtime.d.ts +98 -0
- package/dist/fleet-windows-runtime.js +467 -0
- package/dist/fleet-windows-runtime.js.map +1 -0
- package/dist/general-binding.d.ts +85 -0
- package/dist/general-binding.js +298 -0
- package/dist/general-binding.js.map +1 -0
- package/dist/general-host-owner.d.ts +8 -0
- package/dist/general-host-owner.js +26 -0
- package/dist/general-host-owner.js.map +1 -0
- package/dist/general-instance.d.ts +7 -0
- package/dist/general-instance.js +20 -3
- package/dist/general-instance.js.map +1 -1
- package/dist/general-knowledge/skills/concepts/SKILL.md +97 -39
- package/dist/general-knowledge/skills/credential-profiles/SKILL.md +15 -2
- package/dist/general-knowledge/skills/delegation-playbook/SKILL.md +4 -1
- package/dist/general-knowledge/skills/fleet-config/SKILL.md +12 -0
- package/dist/general-knowledge/skills/fleet-health/SKILL.md +3 -3
- package/dist/general-knowledge/skills/instance-lifecycle/SKILL.md +4 -0
- 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 +31 -15
- package/dist/general-knowledge/steering/core-rules.md +7 -5
- package/dist/general-role.d.ts +5 -0
- package/dist/general-role.js +27 -0
- package/dist/general-role.js.map +1 -0
- package/dist/hub/admission.d.ts +28 -0
- package/dist/hub/admission.js +62 -0
- package/dist/hub/admission.js.map +1 -0
- package/dist/hub/attachments/limits.d.ts +20 -0
- package/dist/hub/attachments/limits.js +48 -0
- package/dist/hub/attachments/limits.js.map +1 -0
- package/dist/hub/attachments/store.d.ts +116 -0
- package/dist/hub/attachments/store.js +246 -0
- package/dist/hub/attachments/store.js.map +1 -0
- package/dist/hub/audit/index.d.ts +62 -0
- package/dist/hub/audit/index.js +344 -0
- package/dist/hub/audit/index.js.map +1 -0
- package/dist/hub/browser-certificate.d.ts +38 -0
- package/dist/hub/browser-certificate.js +247 -0
- package/dist/hub/browser-certificate.js.map +1 -0
- package/dist/hub/buttons-model.d.ts +9 -0
- package/dist/hub/buttons-model.js +42 -0
- package/dist/hub/buttons-model.js.map +1 -0
- package/dist/hub/buttons.d.ts +54 -0
- package/dist/hub/buttons.js +348 -0
- package/dist/hub/buttons.js.map +1 -0
- package/dist/hub/catalog.d.ts +74 -0
- package/dist/hub/catalog.js +380 -0
- package/dist/hub/catalog.js.map +1 -0
- package/dist/hub/client.d.ts +69 -0
- package/dist/hub/client.js +304 -0
- package/dist/hub/client.js.map +1 -0
- package/dist/hub/compose/member.d.ts +145 -0
- package/dist/hub/compose/member.js +458 -0
- package/dist/hub/compose/member.js.map +1 -0
- package/dist/hub/compose/server.d.ts +167 -0
- package/dist/hub/compose/server.js +477 -0
- package/dist/hub/compose/server.js.map +1 -0
- package/dist/hub/compose/storage.d.ts +5 -0
- package/dist/hub/compose/storage.js +28 -0
- package/dist/hub/compose/storage.js.map +1 -0
- package/dist/hub/compose/views.d.ts +12 -0
- package/dist/hub/compose/views.js +4 -0
- package/dist/hub/compose/views.js.map +1 -0
- package/dist/hub/db.d.ts +58 -0
- package/dist/hub/db.js +215 -0
- package/dist/hub/db.js.map +1 -0
- package/dist/hub/directory/config.d.ts +39 -0
- package/dist/hub/directory/config.js +108 -0
- package/dist/hub/directory/config.js.map +1 -0
- package/dist/hub/directory/directory.d.ts +25 -0
- package/dist/hub/directory/directory.js +526 -0
- package/dist/hub/directory/directory.js.map +1 -0
- package/dist/hub/directory/groups.d.ts +41 -0
- package/dist/hub/directory/groups.js +30 -0
- package/dist/hub/directory/groups.js.map +1 -0
- package/dist/hub/directory/index.d.ts +8 -0
- package/dist/hub/directory/index.js +4 -0
- package/dist/hub/directory/index.js.map +1 -0
- package/dist/hub/directory/profiles.d.ts +41 -0
- package/dist/hub/directory/profiles.js +90 -0
- package/dist/hub/directory/profiles.js.map +1 -0
- package/dist/hub/directory/types.d.ts +83 -0
- package/dist/hub/directory/types.js +14 -0
- package/dist/hub/directory/types.js.map +1 -0
- package/dist/hub/directory-response-owner.d.ts +38 -0
- package/dist/hub/directory-response-owner.js +191 -0
- package/dist/hub/directory-response-owner.js.map +1 -0
- package/dist/hub/enrollment-budget.d.ts +6 -0
- package/dist/hub/enrollment-budget.js +24 -0
- package/dist/hub/enrollment-budget.js.map +1 -0
- package/dist/hub/execution/cli-provider.d.ts +23 -0
- package/dist/hub/execution/cli-provider.js +341 -0
- package/dist/hub/execution/cli-provider.js.map +1 -0
- package/dist/hub/execution/index.d.ts +13 -0
- package/dist/hub/execution/index.js +8 -0
- package/dist/hub/execution/index.js.map +1 -0
- package/dist/hub/execution/model-broker.d.ts +24 -0
- package/dist/hub/execution/model-broker.js +208 -0
- package/dist/hub/execution/model-broker.js.map +1 -0
- package/dist/hub/execution/provider-setup.d.ts +11 -0
- package/dist/hub/execution/provider-setup.js +21 -0
- package/dist/hub/execution/provider-setup.js.map +1 -0
- package/dist/hub/execution/sandbox-runner.d.ts +1 -0
- package/dist/hub/execution/sandbox-runner.js +221 -0
- package/dist/hub/execution/sandbox-runner.js.map +1 -0
- package/dist/hub/execution/service.d.ts +136 -0
- package/dist/hub/execution/service.js +459 -0
- package/dist/hub/execution/service.js.map +1 -0
- package/dist/hub/execution/store.d.ts +61 -0
- package/dist/hub/execution/store.js +182 -0
- package/dist/hub/execution/store.js.map +1 -0
- package/dist/hub/execution/views.d.ts +20 -0
- package/dist/hub/execution/views.js +48 -0
- package/dist/hub/execution/views.js.map +1 -0
- package/dist/hub/group-policy/admin-api.d.ts +30 -0
- package/dist/hub/group-policy/admin-api.js +83 -0
- package/dist/hub/group-policy/admin-api.js.map +1 -0
- package/dist/hub/group-policy/admin-context.d.ts +23 -0
- package/dist/hub/group-policy/admin-context.js +52 -0
- package/dist/hub/group-policy/admin-context.js.map +1 -0
- package/dist/hub/group-policy/admin-control.d.ts +34 -0
- package/dist/hub/group-policy/admin-control.js +258 -0
- package/dist/hub/group-policy/admin-control.js.map +1 -0
- package/dist/hub/group-policy/admin-dto.d.ts +249 -0
- package/dist/hub/group-policy/admin-dto.js +55 -0
- package/dist/hub/group-policy/admin-dto.js.map +1 -0
- package/dist/hub/group-policy/admin-facts.d.ts +17 -0
- package/dist/hub/group-policy/admin-facts.js +33 -0
- package/dist/hub/group-policy/admin-facts.js.map +1 -0
- package/dist/hub/group-policy/admin-impact.d.ts +51 -0
- package/dist/hub/group-policy/admin-impact.js +88 -0
- package/dist/hub/group-policy/admin-impact.js.map +1 -0
- package/dist/hub/group-policy/admin-inventory.d.ts +24 -0
- package/dist/hub/group-policy/admin-inventory.js +72 -0
- package/dist/hub/group-policy/admin-inventory.js.map +1 -0
- package/dist/hub/group-policy/admin-read.d.ts +21 -0
- package/dist/hub/group-policy/admin-read.js +95 -0
- package/dist/hub/group-policy/admin-read.js.map +1 -0
- package/dist/hub/group-policy/authorization.d.ts +65 -0
- package/dist/hub/group-policy/authorization.js +315 -0
- package/dist/hub/group-policy/authorization.js.map +1 -0
- package/dist/hub/group-policy/impact-inventory.d.ts +21 -0
- package/dist/hub/group-policy/impact-inventory.js +75 -0
- package/dist/hub/group-policy/impact-inventory.js.map +1 -0
- package/dist/hub/group-policy/model.d.ts +56 -0
- package/dist/hub/group-policy/model.js +46 -0
- package/dist/hub/group-policy/model.js.map +1 -0
- package/dist/hub/group-policy/resources.d.ts +72 -0
- package/dist/hub/group-policy/resources.js +260 -0
- package/dist/hub/group-policy/resources.js.map +1 -0
- package/dist/hub/group-policy/store.d.ts +69 -0
- package/dist/hub/group-policy/store.js +210 -0
- package/dist/hub/group-policy/store.js.map +1 -0
- package/dist/hub/group-policy/welcome.d.ts +36 -0
- package/dist/hub/group-policy/welcome.js +55 -0
- package/dist/hub/group-policy/welcome.js.map +1 -0
- package/dist/hub/http/compose.d.ts +24 -0
- package/dist/hub/http/compose.js +739 -0
- package/dist/hub/http/compose.js.map +1 -0
- package/dist/hub/http/core.d.ts +71 -0
- package/dist/hub/http/core.js +266 -0
- package/dist/hub/http/core.js.map +1 -0
- package/dist/hub/http/deps.d.ts +79 -0
- package/dist/hub/http/deps.js +2 -0
- package/dist/hub/http/deps.js.map +1 -0
- package/dist/hub/http/schema.d.ts +14 -0
- package/dist/hub/http/schema.js +84 -0
- package/dist/hub/http/schema.js.map +1 -0
- package/dist/hub/identity.d.ts +32 -0
- package/dist/hub/identity.js +80 -0
- package/dist/hub/identity.js.map +1 -0
- package/dist/hub/init/browser-certificate.d.ts +14 -0
- package/dist/hub/init/browser-certificate.js +99 -0
- package/dist/hub/init/browser-certificate.js.map +1 -0
- package/dist/hub/init/browser-tls.d.ts +18 -0
- package/dist/hub/init/browser-tls.js +62 -0
- package/dist/hub/init/browser-tls.js.map +1 -0
- package/dist/hub/init/cli.d.ts +3 -0
- package/dist/hub/init/cli.js +83 -0
- package/dist/hub/init/cli.js.map +1 -0
- package/dist/hub/init/directory-certificate.d.ts +24 -0
- package/dist/hub/init/directory-certificate.js +229 -0
- package/dist/hub/init/directory-certificate.js.map +1 -0
- package/dist/hub/init/existing-fleet.d.ts +6 -0
- package/dist/hub/init/existing-fleet.js +58 -0
- package/dist/hub/init/existing-fleet.js.map +1 -0
- package/dist/hub/init/handoff.d.ts +8 -0
- package/dist/hub/init/handoff.js +36 -0
- package/dist/hub/init/handoff.js.map +1 -0
- package/dist/hub/init/identity.d.ts +5 -0
- package/dist/hub/init/identity.js +24 -0
- package/dist/hub/init/identity.js.map +1 -0
- package/dist/hub/init/initializer.d.ts +34 -0
- package/dist/hub/init/initializer.js +504 -0
- package/dist/hub/init/initializer.js.map +1 -0
- package/dist/hub/init/inventory.d.ts +17 -0
- package/dist/hub/init/inventory.js +33 -0
- package/dist/hub/init/inventory.js.map +1 -0
- package/dist/hub/init/layout.d.ts +32 -0
- package/dist/hub/init/layout.js +53 -0
- package/dist/hub/init/layout.js.map +1 -0
- package/dist/hub/init/network.d.ts +18 -0
- package/dist/hub/init/network.js +104 -0
- package/dist/hub/init/network.js.map +1 -0
- package/dist/hub/init/plan-digest.d.ts +5 -0
- package/dist/hub/init/plan-digest.js +47 -0
- package/dist/hub/init/plan-digest.js.map +1 -0
- package/dist/hub/init/prompt.d.ts +26 -0
- package/dist/hub/init/prompt.js +110 -0
- package/dist/hub/init/prompt.js.map +1 -0
- package/dist/hub/init/secret-file.d.ts +1 -0
- package/dist/hub/init/secret-file.js +59 -0
- package/dist/hub/init/secret-file.js.map +1 -0
- package/dist/hub/init/text.d.ts +127 -0
- package/dist/hub/init/text.js +247 -0
- package/dist/hub/init/text.js.map +1 -0
- package/dist/hub/init/types.d.ts +142 -0
- package/dist/hub/init/types.js +9 -0
- package/dist/hub/init/types.js.map +1 -0
- package/dist/hub/init/web-audit-import.d.ts +12 -0
- package/dist/hub/init/web-audit-import.js +39 -0
- package/dist/hub/init/web-audit-import.js.map +1 -0
- package/dist/hub/init/web-audit.d.ts +30 -0
- package/dist/hub/init/web-audit.js +42 -0
- package/dist/hub/init/web-audit.js.map +1 -0
- package/dist/hub/init/web-error.d.ts +6 -0
- package/dist/hub/init/web-error.js +8 -0
- package/dist/hub/init/web-error.js.map +1 -0
- package/dist/hub/init/web-http.d.ts +9 -0
- package/dist/hub/init/web-http.js +103 -0
- package/dist/hub/init/web-http.js.map +1 -0
- package/dist/hub/init/web.d.ts +118 -0
- package/dist/hub/init/web.js +428 -0
- package/dist/hub/init/web.js.map +1 -0
- package/dist/hub/init/wizard.d.ts +34 -0
- package/dist/hub/init/wizard.js +552 -0
- package/dist/hub/init/wizard.js.map +1 -0
- package/dist/hub/initialization.d.ts +23 -0
- package/dist/hub/initialization.js +28 -0
- package/dist/hub/initialization.js.map +1 -0
- package/dist/hub/join/client.d.ts +35 -0
- package/dist/hub/join/client.js +112 -0
- package/dist/hub/join/client.js.map +1 -0
- package/dist/hub/join/descriptor.d.ts +45 -0
- package/dist/hub/join/descriptor.js +52 -0
- package/dist/hub/join/descriptor.js.map +1 -0
- package/dist/hub/join/fleet-authority.d.ts +2 -0
- package/dist/hub/join/fleet-authority.js +3 -0
- package/dist/hub/join/fleet-authority.js.map +1 -0
- package/dist/hub/join/http.d.ts +8 -0
- package/dist/hub/join/http.js +112 -0
- package/dist/hub/join/http.js.map +1 -0
- package/dist/hub/join/invitation.d.ts +28 -0
- package/dist/hub/join/invitation.js +28 -0
- package/dist/hub/join/invitation.js.map +1 -0
- package/dist/hub/join/local-journal.d.ts +84 -0
- package/dist/hub/join/local-journal.js +65 -0
- package/dist/hub/join/local-journal.js.map +1 -0
- package/dist/hub/join/local.d.ts +116 -0
- package/dist/hub/join/local.js +419 -0
- package/dist/hub/join/local.js.map +1 -0
- package/dist/hub/join/private.d.ts +3 -0
- package/dist/hub/join/private.js +46 -0
- package/dist/hub/join/private.js.map +1 -0
- package/dist/hub/join/protocol.d.ts +69 -0
- package/dist/hub/join/protocol.js +96 -0
- package/dist/hub/join/protocol.js.map +1 -0
- package/dist/hub/join/receipt.d.ts +42 -0
- package/dist/hub/join/receipt.js +75 -0
- package/dist/hub/join/receipt.js.map +1 -0
- package/dist/hub/join/service.d.ts +177 -0
- package/dist/hub/join/service.js +564 -0
- package/dist/hub/join/service.js.map +1 -0
- package/dist/hub/join/store.d.ts +97 -0
- package/dist/hub/join/store.js +87 -0
- package/dist/hub/join/store.js.map +1 -0
- package/dist/hub/join/trust.d.ts +13 -0
- package/dist/hub/join/trust.js +68 -0
- package/dist/hub/join/trust.js.map +1 -0
- package/dist/hub/member/agent-mode.d.ts +6 -0
- package/dist/hub/member/agent-mode.js +23 -0
- package/dist/hub/member/agent-mode.js.map +1 -0
- package/dist/hub/member/attachments.d.ts +29 -0
- package/dist/hub/member/attachments.js +107 -0
- package/dist/hub/member/attachments.js.map +1 -0
- package/dist/hub/member/exposure-api.d.ts +87 -0
- package/dist/hub/member/exposure-api.js +64 -0
- package/dist/hub/member/exposure-api.js.map +1 -0
- package/dist/hub/member/exposures.d.ts +123 -0
- package/dist/hub/member/exposures.js +282 -0
- package/dist/hub/member/exposures.js.map +1 -0
- package/dist/hub/member/pairing-api.d.ts +87 -0
- package/dist/hub/member/pairing-api.js +391 -0
- package/dist/hub/member/pairing-api.js.map +1 -0
- package/dist/hub/member/pairing-notices.d.ts +18 -0
- package/dist/hub/member/pairing-notices.js +60 -0
- package/dist/hub/member/pairing-notices.js.map +1 -0
- package/dist/hub/member/quota.d.ts +20 -0
- package/dist/hub/member/quota.js +98 -0
- package/dist/hub/member/quota.js.map +1 -0
- package/dist/hub/member-journal.d.ts +104 -0
- package/dist/hub/member-journal.js +336 -0
- package/dist/hub/member-journal.js.map +1 -0
- package/dist/hub/member-reconciliation.d.ts +14 -0
- package/dist/hub/member-reconciliation.js +97 -0
- package/dist/hub/member-reconciliation.js.map +1 -0
- package/dist/hub/mount.d.ts +48 -0
- package/dist/hub/mount.js +146 -0
- package/dist/hub/mount.js.map +1 -0
- package/dist/hub/pairing-client.d.ts +17 -0
- package/dist/hub/pairing-client.js +108 -0
- package/dist/hub/pairing-client.js.map +1 -0
- package/dist/hub/pairing-notices.d.ts +47 -0
- package/dist/hub/pairing-notices.js +246 -0
- package/dist/hub/pairing-notices.js.map +1 -0
- package/dist/hub/pairing.d.ts +105 -0
- package/dist/hub/pairing.js +514 -0
- package/dist/hub/pairing.js.map +1 -0
- package/dist/hub/policy.d.ts +65 -0
- package/dist/hub/policy.js +154 -0
- package/dist/hub/policy.js.map +1 -0
- package/dist/hub/preview.d.ts +32 -0
- package/dist/hub/preview.js +64 -0
- package/dist/hub/preview.js.map +1 -0
- package/dist/hub/private-files.d.ts +5 -0
- package/dist/hub/private-files.js +44 -0
- package/dist/hub/private-files.js.map +1 -0
- package/dist/hub/profile.d.ts +59 -0
- package/dist/hub/profile.js +73 -0
- package/dist/hub/profile.js.map +1 -0
- package/dist/hub/protocol.d.ts +840 -0
- package/dist/hub/protocol.js +100 -0
- package/dist/hub/protocol.js.map +1 -0
- package/dist/hub/quota.d.ts +24 -0
- package/dist/hub/quota.js +112 -0
- package/dist/hub/quota.js.map +1 -0
- package/dist/hub/representative.d.ts +141 -0
- package/dist/hub/representative.js +528 -0
- package/dist/hub/representative.js.map +1 -0
- package/dist/hub/retention.d.ts +17 -0
- package/dist/hub/retention.js +45 -0
- package/dist/hub/retention.js.map +1 -0
- package/dist/hub/room-read-pacer.d.ts +14 -0
- package/dist/hub/room-read-pacer.js +51 -0
- package/dist/hub/room-read-pacer.js.map +1 -0
- package/dist/hub/rooms.d.ts +127 -0
- package/dist/hub/rooms.js +597 -0
- package/dist/hub/rooms.js.map +1 -0
- package/dist/hub/runtime.d.ts +155 -0
- package/dist/hub/runtime.js +651 -0
- package/dist/hub/runtime.js.map +1 -0
- package/dist/hub/server.d.ts +61 -0
- package/dist/hub/server.js +235 -0
- package/dist/hub/server.js.map +1 -0
- package/dist/hub/service-start.d.ts +17 -0
- package/dist/hub/service-start.js +109 -0
- package/dist/hub/service-start.js.map +1 -0
- package/dist/hub/session-directory-transition.d.ts +48 -0
- package/dist/hub/session-directory-transition.js +118 -0
- package/dist/hub/session-directory-transition.js.map +1 -0
- package/dist/hub/session-epoch.d.ts +16 -0
- package/dist/hub/session-epoch.js +50 -0
- package/dist/hub/session-epoch.js.map +1 -0
- package/dist/hub/sessions.d.ts +66 -0
- package/dist/hub/sessions.js +217 -0
- package/dist/hub/sessions.js.map +1 -0
- package/dist/hub/settings-api.d.ts +50 -0
- package/dist/hub/settings-api.js +92 -0
- package/dist/hub/settings-api.js.map +1 -0
- package/dist/hub/settings-commit.d.ts +102 -0
- package/dist/hub/settings-commit.js +522 -0
- package/dist/hub/settings-commit.js.map +1 -0
- package/dist/hub/settings-directory-ca.d.ts +31 -0
- package/dist/hub/settings-directory-ca.js +115 -0
- package/dist/hub/settings-directory-ca.js.map +1 -0
- package/dist/hub/settings-directory-control.d.ts +58 -0
- package/dist/hub/settings-directory-control.js +117 -0
- package/dist/hub/settings-directory-control.js.map +1 -0
- package/dist/hub/settings-directory-decision.d.ts +465 -0
- package/dist/hub/settings-directory-decision.js +322 -0
- package/dist/hub/settings-directory-decision.js.map +1 -0
- package/dist/hub/settings-directory-host-http.d.ts +9 -0
- package/dist/hub/settings-directory-host-http.js +75 -0
- package/dist/hub/settings-directory-host-http.js.map +1 -0
- package/dist/hub/settings-directory-host-notice-http.d.ts +9 -0
- package/dist/hub/settings-directory-host-notice-http.js +78 -0
- package/dist/hub/settings-directory-host-notice-http.js.map +1 -0
- package/dist/hub/settings-directory-host-notices.d.ts +11 -0
- package/dist/hub/settings-directory-host-notices.js +39 -0
- package/dist/hub/settings-directory-host-notices.js.map +1 -0
- package/dist/hub/settings-directory-http.d.ts +33 -0
- package/dist/hub/settings-directory-http.js +109 -0
- package/dist/hub/settings-directory-http.js.map +1 -0
- package/dist/hub/settings-directory-mount.d.ts +24 -0
- package/dist/hub/settings-directory-mount.js +77 -0
- package/dist/hub/settings-directory-mount.js.map +1 -0
- package/dist/hub/settings-directory-notices.d.ts +61 -0
- package/dist/hub/settings-directory-notices.js +132 -0
- package/dist/hub/settings-directory-notices.js.map +1 -0
- package/dist/hub/settings-directory-proof.d.ts +77 -0
- package/dist/hub/settings-directory-proof.js +313 -0
- package/dist/hub/settings-directory-proof.js.map +1 -0
- package/dist/hub/settings-directory-recovery-intent.d.ts +13 -0
- package/dist/hub/settings-directory-recovery-intent.js +29 -0
- package/dist/hub/settings-directory-recovery-intent.js.map +1 -0
- package/dist/hub/settings-directory-recovery.d.ts +37 -0
- package/dist/hub/settings-directory-recovery.js +173 -0
- package/dist/hub/settings-directory-recovery.js.map +1 -0
- package/dist/hub/settings-directory-runtime.d.ts +17 -0
- package/dist/hub/settings-directory-runtime.js +2 -0
- package/dist/hub/settings-directory-runtime.js.map +1 -0
- package/dist/hub/settings-directory-save.d.ts +37 -0
- package/dist/hub/settings-directory-save.js +175 -0
- package/dist/hub/settings-directory-save.js.map +1 -0
- package/dist/hub/socket.d.ts +24 -0
- package/dist/hub/socket.js +79 -0
- package/dist/hub/socket.js.map +1 -0
- package/dist/hub/store.d.ts +87 -0
- package/dist/hub/store.js +92 -0
- package/dist/hub/store.js.map +1 -0
- package/dist/hub/tls.d.ts +31 -0
- package/dist/hub/tls.js +135 -0
- package/dist/hub/tls.js.map +1 -0
- package/dist/hub/types.d.ts +416 -0
- package/dist/hub/types.js +2 -0
- package/dist/hub/types.js.map +1 -0
- package/dist/hub/validation.d.ts +33 -0
- package/dist/hub/validation.js +136 -0
- package/dist/hub/validation.js.map +1 -0
- package/dist/hub/version-floor.d.ts +10 -0
- package/dist/hub/version-floor.js +45 -0
- package/dist/hub/version-floor.js.map +1 -0
- package/dist/hub-browser-certificate-policy.d.ts +31 -0
- package/dist/hub-browser-certificate-policy.js +25 -0
- package/dist/hub-browser-certificate-policy.js.map +1 -0
- package/dist/hub-host-settings.d.ts +48 -0
- package/dist/hub-host-settings.js +85 -0
- package/dist/hub-host-settings.js.map +1 -0
- package/dist/hub-membership-settings.d.ts +6 -0
- package/dist/hub-membership-settings.js +21 -0
- package/dist/hub-membership-settings.js.map +1 -0
- package/dist/hub-mode.d.ts +15 -0
- package/dist/hub-mode.js +17 -0
- package/dist/hub-mode.js.map +1 -0
- package/dist/hub-pairing-summary.d.ts +48 -0
- package/dist/hub-pairing-summary.js +36 -0
- package/dist/hub-pairing-summary.js.map +1 -0
- package/dist/hub-report-target.d.ts +32 -0
- package/dist/hub-report-target.js +33 -0
- package/dist/hub-report-target.js.map +1 -0
- package/dist/hub-retention-policy.d.ts +14 -0
- package/dist/hub-retention-policy.js +15 -0
- package/dist/hub-retention-policy.js.map +1 -0
- package/dist/instance-config-impact.js +11 -3
- package/dist/instance-config-impact.js.map +1 -1
- package/dist/instance-lifecycle.d.ts +52 -5
- package/dist/instance-lifecycle.js +489 -198
- package/dist/instance-lifecycle.js.map +1 -1
- package/dist/instructions.d.ts +2 -0
- package/dist/instructions.js +6 -0
- package/dist/instructions.js.map +1 -1
- package/dist/kiro-history-scan.d.ts +26 -0
- package/dist/kiro-history-scan.js +141 -0
- package/dist/kiro-history-scan.js.map +1 -0
- package/dist/kiro-history-worker.d.ts +1 -0
- package/dist/kiro-history-worker.js +9 -0
- package/dist/kiro-history-worker.js.map +1 -0
- package/dist/kiro-history.d.ts +20 -0
- package/dist/kiro-history.js +96 -0
- package/dist/kiro-history.js.map +1 -0
- package/dist/kiro-usage-run.d.ts +2 -0
- package/dist/kiro-usage-run.js +4 -1
- package/dist/kiro-usage-run.js.map +1 -1
- package/dist/launchd-service-domain.d.ts +5 -0
- package/dist/launchd-service-domain.js +21 -0
- package/dist/launchd-service-domain.js.map +1 -0
- package/dist/local-pane-endpoint.d.ts +46 -0
- package/dist/local-pane-endpoint.js +189 -0
- package/dist/local-pane-endpoint.js.map +1 -0
- package/dist/local-pane-launcher.d.ts +2 -0
- package/dist/local-pane-launcher.js +38 -0
- package/dist/local-pane-launcher.js.map +1 -0
- package/dist/local-pane-stage.ps1 +101 -0
- package/dist/locale.js +246 -34
- package/dist/locale.js.map +1 -1
- package/dist/log-service.d.ts +28 -0
- package/dist/log-service.js +29 -0
- package/dist/log-service.js.map +1 -1
- package/dist/logger.d.ts +16 -2
- package/dist/logger.js +346 -66
- package/dist/logger.js.map +1 -1
- package/dist/login-controller.d.ts +14 -1
- package/dist/login-controller.js +31 -1
- package/dist/login-controller.js.map +1 -1
- package/dist/login-flows.d.ts +21 -8
- package/dist/login-flows.js +40 -18
- package/dist/login-flows.js.map +1 -1
- package/dist/login-manager.js +25 -4
- package/dist/login-manager.js.map +1 -1
- package/dist/login-window-lock.d.ts +2 -1
- package/dist/login-window-lock.js.map +1 -1
- package/dist/ls-rows.d.ts +1 -1
- package/dist/ls-rows.js +3 -4
- package/dist/ls-rows.js.map +1 -1
- package/dist/machine-accounts.d.ts +110 -0
- package/dist/machine-accounts.js +229 -0
- package/dist/machine-accounts.js.map +1 -0
- package/dist/machine-signins.d.ts +89 -0
- package/dist/machine-signins.js +182 -0
- package/dist/machine-signins.js.map +1 -0
- package/dist/missed-offline.d.ts +25 -0
- package/dist/missed-offline.js +79 -0
- package/dist/missed-offline.js.map +1 -0
- package/dist/model-catalog-defaults.d.ts +14 -0
- package/dist/model-catalog-defaults.js +20 -0
- package/dist/model-catalog-defaults.js.map +1 -0
- package/dist/muse-usage-relay.d.ts +2 -0
- package/dist/muse-usage-relay.js +5 -3
- package/dist/muse-usage-relay.js.map +1 -1
- package/dist/native-agent-admission.d.ts +7 -0
- package/dist/native-agent-admission.js +26 -0
- package/dist/native-agent-admission.js.map +1 -0
- package/dist/native-daemon-client.d.ts +13 -0
- package/dist/native-daemon-client.js +28 -0
- package/dist/native-daemon-client.js.map +1 -0
- package/dist/native-instance-api.d.ts +13 -0
- package/dist/native-instance-api.js +217 -0
- package/dist/native-instance-api.js.map +1 -0
- package/dist/native-instance-input.d.ts +87 -0
- package/dist/native-instance-input.js +59 -0
- package/dist/native-instance-input.js.map +1 -0
- package/dist/native-instance-registry.d.ts +38 -0
- package/dist/native-instance-registry.js +129 -0
- package/dist/native-instance-registry.js.map +1 -0
- package/dist/native-mcp.d.ts +43 -0
- package/dist/native-mcp.js +291 -0
- package/dist/native-mcp.js.map +1 -0
- package/dist/native-model-catalog.d.ts +5 -0
- package/dist/native-model-catalog.js +76 -0
- package/dist/native-model-catalog.js.map +1 -0
- package/dist/native-pane-crash-budget.d.ts +20 -0
- package/dist/native-pane-crash-budget.js +60 -0
- package/dist/native-pane-crash-budget.js.map +1 -0
- package/dist/native-pane-create.d.ts +26 -0
- package/dist/native-pane-create.js +53 -0
- package/dist/native-pane-create.js.map +1 -0
- package/dist/native-pane-lifecycle.d.ts +73 -0
- package/dist/native-pane-lifecycle.js +239 -0
- package/dist/native-pane-lifecycle.js.map +1 -0
- package/dist/native-pane-manager.d.ts +59 -0
- package/dist/native-pane-manager.js +592 -0
- package/dist/native-pane-manager.js.map +1 -0
- package/dist/native-pane-output-log.d.ts +15 -0
- package/dist/native-pane-output-log.js +108 -0
- package/dist/native-pane-output-log.js.map +1 -0
- package/dist/native-pane-reconciliation.d.ts +4 -0
- package/dist/native-pane-reconciliation.js +40 -0
- package/dist/native-pane-reconciliation.js.map +1 -0
- package/dist/native-pane-recovery.d.ts +12 -0
- package/dist/native-pane-recovery.js +10 -0
- package/dist/native-pane-recovery.js.map +1 -0
- package/dist/native-pane-tools.d.ts +2 -0
- package/dist/native-pane-tools.js +14 -0
- package/dist/native-pane-tools.js.map +1 -0
- package/dist/needs-you-hub.d.ts +14 -1
- package/dist/needs-you-hub.js +57 -8
- package/dist/needs-you-hub.js.map +1 -1
- package/dist/needs-you.d.ts +92 -2
- package/dist/needs-you.js +54 -3
- package/dist/needs-you.js.map +1 -1
- package/dist/office-levels.d.ts +4 -3
- package/dist/office-levels.js +3 -3
- package/dist/office-levels.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 +11 -0
- package/dist/office-share.js +14 -0
- package/dist/office-share.js.map +1 -1
- package/dist/office-talk.d.ts +26 -0
- package/dist/office-talk.js +50 -0
- package/dist/office-talk.js.map +1 -0
- package/dist/outbound-handlers.d.ts +30 -2
- package/dist/outbound-handlers.js +156 -18
- package/dist/outbound-handlers.js.map +1 -1
- package/dist/outbound-schemas.d.ts +94 -1
- package/dist/outbound-schemas.js +44 -16
- package/dist/outbound-schemas.js.map +1 -1
- package/dist/pane-port.d.ts +118 -0
- package/dist/pane-port.js +2 -0
- package/dist/pane-port.js.map +1 -0
- package/dist/pane-quota-history.d.ts +9 -0
- package/dist/pane-quota-history.js +67 -0
- package/dist/pane-quota-history.js.map +1 -0
- package/dist/pause-marker.d.ts +1 -1
- package/dist/pause-marker.js +1 -1
- package/dist/pause-marker.js.map +1 -1
- package/dist/platform-general.d.ts +46 -0
- package/dist/platform-general.js +91 -0
- package/dist/platform-general.js.map +1 -0
- package/dist/profile-signins.d.ts +107 -0
- package/dist/profile-signins.js +249 -0
- package/dist/profile-signins.js.map +1 -0
- package/dist/public-web-gateway.js +16 -0
- package/dist/public-web-gateway.js.map +1 -1
- package/dist/public-web-link.d.ts +11 -0
- package/dist/public-web-link.js +13 -0
- package/dist/public-web-link.js.map +1 -1
- package/dist/quickstart-api.js +11 -7
- package/dist/quickstart-api.js.map +1 -1
- package/dist/quickstart.d.ts +14 -0
- package/dist/quickstart.js +72 -4
- package/dist/quickstart.js.map +1 -1
- package/dist/quiet-run.d.ts +31 -0
- package/dist/quiet-run.js +50 -0
- package/dist/quiet-run.js.map +1 -0
- package/dist/quota-notice-config.d.ts +22 -0
- package/dist/quota-notice-config.js +41 -0
- package/dist/quota-notice-config.js.map +1 -0
- package/dist/quota-notice.d.ts +7 -0
- package/dist/quota-notice.js +40 -0
- package/dist/quota-notice.js.map +1 -1
- package/dist/reply-buttons-controller.d.ts +5 -1
- package/dist/reply-buttons-controller.js +18 -10
- package/dist/reply-buttons-controller.js.map +1 -1
- package/dist/reply-buttons.d.ts +6 -2
- package/dist/reply-buttons.js +7 -3
- package/dist/reply-buttons.js.map +1 -1
- package/dist/reply-polls.d.ts +2 -2
- package/dist/reply-polls.js +3 -3
- package/dist/reply-polls.js.map +1 -1
- package/dist/runtime-api.d.ts +23 -0
- package/dist/runtime-api.js +321 -0
- package/dist/runtime-api.js.map +1 -0
- package/dist/runtime-assets/@xterm/addon-serialize/LICENSE +21 -0
- package/dist/runtime-assets/@xterm/addon-serialize/lib/addon-serialize.js +2 -0
- package/dist/runtime-assets/@xterm/addon-serialize/lib/addon-serialize.mjs +19 -0
- package/dist/runtime-assets/@xterm/addon-serialize/package.json +29 -0
- package/dist/runtime-assets/@xterm/headless/LICENSE +21 -0
- package/dist/runtime-assets/@xterm/headless/lib-headless/xterm-headless.js +2 -0
- package/dist/runtime-assets/@xterm/headless/lib-headless/xterm-headless.mjs +46 -0
- package/dist/runtime-assets/@xterm/headless/package.json +29 -0
- package/dist/runtime-assets/node-pty/CONPTY-LICENSE +21 -0
- package/dist/runtime-assets/node-pty/CONPTY-NOTICE.md +503 -0
- package/dist/runtime-assets/node-pty/LICENSE +69 -0
- package/dist/runtime-assets/node-pty/lib/conpty_console_list_agent.js +16 -0
- package/dist/runtime-assets/node-pty/lib/eventEmitter2.js +47 -0
- package/dist/runtime-assets/node-pty/lib/index.js +52 -0
- package/dist/runtime-assets/node-pty/lib/interfaces.js +7 -0
- package/dist/runtime-assets/node-pty/lib/shared/conout.js +11 -0
- package/dist/runtime-assets/node-pty/lib/terminal.js +190 -0
- package/dist/runtime-assets/node-pty/lib/types.js +7 -0
- package/dist/runtime-assets/node-pty/lib/unixTerminal.js +346 -0
- package/dist/runtime-assets/node-pty/lib/utils.js +39 -0
- package/dist/runtime-assets/node-pty/lib/windowsConoutConnection.js +125 -0
- package/dist/runtime-assets/node-pty/lib/windowsPtyAgent.js +320 -0
- package/dist/runtime-assets/node-pty/lib/windowsTerminal.js +199 -0
- package/dist/runtime-assets/node-pty/lib/worker/conoutSocketWorker.js +22 -0
- package/dist/runtime-assets/node-pty/package.json +64 -0
- 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 +10 -0
- package/dist/runtime-build-info.js +64 -0
- package/dist/runtime-build-info.js.map +1 -0
- package/dist/runtime-bundle.d.ts +22 -0
- package/dist/runtime-bundle.js +158 -0
- package/dist/runtime-bundle.js.map +1 -0
- package/dist/runtime-cli-install.d.ts +155 -0
- package/dist/runtime-cli-install.js +675 -0
- package/dist/runtime-cli-install.js.map +1 -0
- package/dist/runtime-cli.d.ts +14 -0
- package/dist/runtime-cli.js +416 -0
- package/dist/runtime-cli.js.map +1 -0
- package/dist/runtime-client-store.d.ts +75 -0
- package/dist/runtime-client-store.js +372 -0
- package/dist/runtime-client-store.js.map +1 -0
- package/dist/runtime-client.d.ts +236 -0
- package/dist/runtime-client.js +1267 -0
- package/dist/runtime-client.js.map +1 -0
- package/dist/runtime-connection.d.ts +22 -0
- package/dist/runtime-connection.js +93 -0
- package/dist/runtime-connection.js.map +1 -0
- package/dist/runtime-coordinator.d.ts +107 -0
- package/dist/runtime-coordinator.js +1180 -0
- package/dist/runtime-coordinator.js.map +1 -0
- package/dist/runtime-credential-profiles.d.ts +89 -0
- package/dist/runtime-credential-profiles.js +304 -0
- package/dist/runtime-credential-profiles.js.map +1 -0
- package/dist/runtime-general-protocol.d.ts +22 -0
- package/dist/runtime-general-protocol.js +57 -0
- package/dist/runtime-general-protocol.js.map +1 -0
- package/dist/runtime-general-workspace.d.ts +17 -0
- package/dist/runtime-general-workspace.js +213 -0
- package/dist/runtime-general-workspace.js.map +1 -0
- package/dist/runtime-install.d.ts +50 -0
- package/dist/runtime-install.js +189 -0
- package/dist/runtime-install.js.map +1 -0
- package/dist/runtime-pane-assets.d.ts +17 -0
- package/dist/runtime-pane-assets.js +23 -0
- package/dist/runtime-pane-assets.js.map +1 -0
- package/dist/runtime-pane-boot.d.ts +9 -0
- package/dist/runtime-pane-boot.js +47 -0
- package/dist/runtime-pane-boot.js.map +1 -0
- package/dist/runtime-pane-codex-index.d.ts +10 -0
- package/dist/runtime-pane-codex-index.js +151 -0
- package/dist/runtime-pane-codex-index.js.map +1 -0
- package/dist/runtime-pane-config.d.ts +16 -0
- package/dist/runtime-pane-config.js +54 -0
- package/dist/runtime-pane-config.js.map +1 -0
- package/dist/runtime-pane-host.d.ts +63 -0
- package/dist/runtime-pane-host.js +467 -0
- package/dist/runtime-pane-host.js.map +1 -0
- package/dist/runtime-pane-job-owner.d.ts +1 -0
- package/dist/runtime-pane-job-owner.js +29 -0
- package/dist/runtime-pane-job-owner.js.map +1 -0
- package/dist/runtime-pane-job.ps1 +116 -0
- package/dist/runtime-pane-link.d.ts +47 -0
- package/dist/runtime-pane-link.js +338 -0
- package/dist/runtime-pane-link.js.map +1 -0
- package/dist/runtime-pane-mcp-protocol.d.ts +32 -0
- package/dist/runtime-pane-mcp-protocol.js +39 -0
- package/dist/runtime-pane-mcp-protocol.js.map +1 -0
- package/dist/runtime-pane-mcp-relay.d.ts +18 -0
- package/dist/runtime-pane-mcp-relay.js +80 -0
- package/dist/runtime-pane-mcp-relay.js.map +1 -0
- package/dist/runtime-pane-mcp.d.ts +55 -0
- package/dist/runtime-pane-mcp.js +153 -0
- package/dist/runtime-pane-mcp.js.map +1 -0
- package/dist/runtime-pane-native.d.ts +75 -0
- package/dist/runtime-pane-native.js +114 -0
- package/dist/runtime-pane-native.js.map +1 -0
- package/dist/runtime-pane-output.d.ts +19 -0
- package/dist/runtime-pane-output.js +53 -0
- package/dist/runtime-pane-output.js.map +1 -0
- package/dist/runtime-pane-port.d.ts +144 -0
- package/dist/runtime-pane-port.js +574 -0
- package/dist/runtime-pane-port.js.map +1 -0
- package/dist/runtime-pane-private.d.ts +14 -0
- package/dist/runtime-pane-private.js +51 -0
- package/dist/runtime-pane-private.js.map +1 -0
- package/dist/runtime-pane-private.ps1 +14 -0
- package/dist/runtime-pane-process.d.ts +4 -0
- package/dist/runtime-pane-process.js +117 -0
- package/dist/runtime-pane-process.js.map +1 -0
- package/dist/runtime-pane-protocol.d.ts +182 -0
- package/dist/runtime-pane-protocol.js +217 -0
- package/dist/runtime-pane-protocol.js.map +1 -0
- package/dist/runtime-pane-quota-history.d.ts +6 -0
- package/dist/runtime-pane-quota-history.js +44 -0
- package/dist/runtime-pane-quota-history.js.map +1 -0
- package/dist/runtime-pane-screen.d.ts +19 -0
- package/dist/runtime-pane-screen.js +76 -0
- package/dist/runtime-pane-screen.js.map +1 -0
- package/dist/runtime-pane-service.d.ts +16 -0
- package/dist/runtime-pane-service.js +256 -0
- package/dist/runtime-pane-service.js.map +1 -0
- package/dist/runtime-pane-stdio-protocol.d.ts +54 -0
- package/dist/runtime-pane-stdio-protocol.js +94 -0
- package/dist/runtime-pane-stdio-protocol.js.map +1 -0
- package/dist/runtime-pane-stdio.d.ts +3 -0
- package/dist/runtime-pane-stdio.js +123 -0
- package/dist/runtime-pane-stdio.js.map +1 -0
- package/dist/runtime-pane-store.d.ts +43 -0
- package/dist/runtime-pane-store.js +176 -0
- package/dist/runtime-pane-store.js.map +1 -0
- package/dist/runtime-pane-transcript-protocol.d.ts +43 -0
- package/dist/runtime-pane-transcript-protocol.js +58 -0
- package/dist/runtime-pane-transcript-protocol.js.map +1 -0
- package/dist/runtime-pane-transcript.d.ts +50 -0
- package/dist/runtime-pane-transcript.js +666 -0
- package/dist/runtime-pane-transcript.js.map +1 -0
- package/dist/runtime-pane-worker.d.ts +1 -0
- package/dist/runtime-pane-worker.js +167 -0
- package/dist/runtime-pane-worker.js.map +1 -0
- package/dist/runtime-profile-ownership.d.ts +66 -0
- package/dist/runtime-profile-ownership.js +391 -0
- package/dist/runtime-profile-ownership.js.map +1 -0
- package/dist/runtime-protocol.d.ts +263 -0
- package/dist/runtime-protocol.js +89 -0
- package/dist/runtime-protocol.js.map +1 -0
- package/dist/runtime-remote-accounts.d.ts +197 -0
- package/dist/runtime-remote-accounts.js +663 -0
- package/dist/runtime-remote-accounts.js.map +1 -0
- package/dist/runtime-remote-setup.d.ts +105 -0
- package/dist/runtime-remote-setup.js +529 -0
- package/dist/runtime-remote-setup.js.map +1 -0
- package/dist/runtime-signin-transport.d.ts +39 -0
- package/dist/runtime-signin-transport.js +111 -0
- package/dist/runtime-signin-transport.js.map +1 -0
- package/dist/runtime-signin.d.ts +132 -0
- package/dist/runtime-signin.js +290 -0
- package/dist/runtime-signin.js.map +1 -0
- package/dist/runtime-switches.d.ts +79 -0
- package/dist/runtime-switches.js +90 -0
- package/dist/runtime-switches.js.map +1 -0
- package/dist/runtime-transcript-delta-reader.d.ts +23 -0
- package/dist/runtime-transcript-delta-reader.js +74 -0
- package/dist/runtime-transcript-delta-reader.js.map +1 -0
- package/dist/runtime-transcript-source.d.ts +36 -0
- package/dist/runtime-transcript-source.js +189 -0
- package/dist/runtime-transcript-source.js.map +1 -0
- package/dist/runtime-update-activity.d.ts +21 -0
- package/dist/runtime-update-activity.js +51 -0
- package/dist/runtime-update-activity.js.map +1 -0
- package/dist/runtime-update-artifact.d.ts +31 -0
- package/dist/runtime-update-artifact.js +252 -0
- package/dist/runtime-update-artifact.js.map +1 -0
- package/dist/runtime-update-attention.d.ts +4 -0
- package/dist/runtime-update-attention.js +11 -0
- package/dist/runtime-update-attention.js.map +1 -0
- package/dist/runtime-update-controller.d.ts +75 -0
- package/dist/runtime-update-controller.js +691 -0
- package/dist/runtime-update-controller.js.map +1 -0
- package/dist/runtime-update-install.d.ts +31 -0
- package/dist/runtime-update-install.js +205 -0
- package/dist/runtime-update-install.js.map +1 -0
- package/dist/runtime-update-ipc.d.ts +42 -0
- package/dist/runtime-update-ipc.js +144 -0
- package/dist/runtime-update-ipc.js.map +1 -0
- package/dist/runtime-update-journal.d.ts +49 -0
- package/dist/runtime-update-journal.js +128 -0
- package/dist/runtime-update-journal.js.map +1 -0
- package/dist/runtime-update-lock.d.ts +48 -0
- package/dist/runtime-update-lock.js +232 -0
- package/dist/runtime-update-lock.js.map +1 -0
- package/dist/runtime-update-owners.d.ts +29 -0
- package/dist/runtime-update-owners.js +240 -0
- package/dist/runtime-update-owners.js.map +1 -0
- package/dist/runtime-update-protocol.d.ts +15 -0
- package/dist/runtime-update-protocol.js +13 -0
- package/dist/runtime-update-protocol.js.map +1 -0
- package/dist/runtime-update-status.d.ts +30 -0
- package/dist/runtime-update-status.js +31 -0
- package/dist/runtime-update-status.js.map +1 -0
- package/dist/runtime-windows-bridge.d.ts +42 -0
- package/dist/runtime-windows-bridge.js +167 -0
- package/dist/runtime-windows-bridge.js.map +1 -0
- 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 +13 -0
- package/dist/scheduler/task-board.js +28 -3
- package/dist/scheduler/task-board.js.map +1 -1
- package/dist/scheduler/types.d.ts +6 -1
- package/dist/service-drain.d.ts +19 -0
- package/dist/service-drain.js +64 -0
- package/dist/service-drain.js.map +1 -0
- package/dist/service-installer.d.ts +7 -2
- package/dist/service-installer.js +13 -10
- package/dist/service-installer.js.map +1 -1
- package/dist/settings-api.d.ts +23 -1
- package/dist/settings-api.js +705 -6
- package/dist/settings-api.js.map +1 -1
- package/dist/settings-baseline.d.ts +7 -0
- package/dist/settings-baseline.js +3 -1
- package/dist/settings-baseline.js.map +1 -1
- package/dist/settings-change.d.ts +10 -0
- package/dist/settings-change.js +76 -1
- package/dist/settings-change.js.map +1 -1
- package/dist/settings-confirmation.d.ts +42 -3
- package/dist/settings-confirmation.js +58 -12
- package/dist/settings-confirmation.js.map +1 -1
- package/dist/settings-effect.d.ts +17 -0
- package/dist/settings-effect.js +226 -2
- package/dist/settings-effect.js.map +1 -1
- package/dist/settings-http-confirmation.d.ts +28 -0
- package/dist/settings-http-confirmation.js +123 -9
- package/dist/settings-http-confirmation.js.map +1 -1
- package/dist/settings-instance-patch.js +28 -1
- package/dist/settings-instance-patch.js.map +1 -1
- package/dist/settings-request-capability.d.ts +7 -0
- package/dist/settings-request-capability.js +10 -1
- package/dist/settings-request-capability.js.map +1 -1
- package/dist/settings-route-lifetime.d.ts +14 -0
- package/dist/settings-route-lifetime.js +48 -0
- package/dist/settings-route-lifetime.js.map +1 -0
- package/dist/settings-transaction.d.ts +4 -0
- package/dist/settings-transaction.js +9 -0
- package/dist/settings-transaction.js.map +1 -1
- package/dist/setup-form.js +6 -3
- package/dist/setup-form.js.map +1 -1
- package/dist/setup-host.js +1 -1
- package/dist/setup-host.js.map +1 -1
- package/dist/setup-i18n.js +3 -0
- package/dist/setup-i18n.js.map +1 -1
- package/dist/setup-wizard.js +4 -2
- package/dist/setup-wizard.js.map +1 -1
- package/dist/signin-keepalive.d.ts +207 -0
- package/dist/signin-keepalive.js +682 -0
- package/dist/signin-keepalive.js.map +1 -0
- package/dist/structured-signin-transport.d.ts +20 -2
- package/dist/structured-signin-transport.js +57 -2
- package/dist/structured-signin-transport.js.map +1 -1
- package/dist/structured-signin.d.ts +11 -2
- package/dist/structured-signin.js +8 -8
- package/dist/structured-signin.js.map +1 -1
- package/dist/task-board-tool.d.ts +13 -1
- package/dist/task-board-tool.js +104 -4
- package/dist/task-board-tool.js.map +1 -1
- package/dist/task-board-waker.d.ts +6 -0
- package/dist/task-board-waker.js +4 -0
- package/dist/task-board-waker.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/tips.js +4 -4
- package/dist/tips.js.map +1 -1
- package/dist/tmux-binary.d.ts +59 -0
- package/dist/tmux-binary.js +189 -0
- package/dist/tmux-binary.js.map +1 -0
- package/dist/tmux-control.d.ts +2 -1
- package/dist/tmux-control.js +4 -4
- package/dist/tmux-control.js.map +1 -1
- package/dist/tmux-exec-helper.js +32 -1
- package/dist/tmux-exec-helper.js.map +1 -1
- package/dist/tmux-legacy.d.ts +94 -0
- package/dist/tmux-legacy.js +309 -0
- package/dist/tmux-legacy.js.map +1 -0
- package/dist/tmux-manager.d.ts +10 -3
- package/dist/tmux-manager.js +60 -38
- package/dist/tmux-manager.js.map +1 -1
- package/dist/tmux-pane-host.d.ts +26 -0
- package/dist/tmux-pane-host.js +25 -0
- package/dist/tmux-pane-host.js.map +1 -0
- package/dist/tmux-read.js +4 -3
- package/dist/tmux-read.js.map +1 -1
- package/dist/tmux-rollback.d.ts +31 -0
- package/dist/tmux-rollback.js +72 -0
- package/dist/tmux-rollback.js.map +1 -0
- package/dist/tmux-server.d.ts +102 -0
- package/dist/tmux-server.js +248 -0
- package/dist/tmux-server.js.map +1 -0
- package/dist/tool-permissions.d.ts +2 -3
- package/dist/tool-permissions.js +5 -4
- package/dist/tool-permissions.js.map +1 -1
- package/dist/topic-commands.js +10 -6
- 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 +23 -0
- package/dist/transcript-monitor.js +107 -49
- package/dist/transcript-monitor.js.map +1 -1
- package/dist/transcript-needles.d.ts +42 -0
- package/dist/transcript-needles.js +166 -0
- package/dist/transcript-needles.js.map +1 -0
- package/dist/transcript-records.d.ts +22 -0
- package/dist/transcript-records.js +144 -0
- package/dist/transcript-records.js.map +1 -0
- package/dist/transcript-sources.d.ts +5 -0
- package/dist/transcript-sources.js +11 -79
- package/dist/transcript-sources.js.map +1 -1
- package/dist/types.d.ts +34 -0
- package/dist/types.js.map +1 -1
- package/dist/ui/account-identity.js +27 -0
- package/dist/ui/accounts-keepalive.js +118 -0
- package/dist/ui/accounts-manage.js +256 -0
- package/dist/ui/accounts-view.js +418 -0
- package/dist/ui/agent-proposals.js +90 -0
- package/dist/ui/agent-runtime-settings.js +69 -0
- package/dist/ui/agent-runtime.js +124 -0
- package/dist/ui/app.html +8 -1
- package/dist/ui/backend-signin.js +108 -36
- package/dist/ui/chat-ambient.js +1 -1
- package/dist/ui/chat-commands.js +7 -0
- package/dist/ui/chat-md-strings.js +3 -0
- package/dist/ui/chat-render.js +3 -670
- package/dist/ui/chat-store.js +14 -3
- package/dist/ui/chat-strings.js +3 -285
- package/dist/ui/chat-thread.js +3 -919
- package/dist/ui/chat-time.js +3 -80
- package/dist/ui/chat-tour.js +1 -1
- package/dist/ui/cli-caps.js +15 -0
- package/dist/ui/cli-picker.js +42 -0
- package/dist/ui/credential-profile-select.js +54 -0
- package/dist/ui/fleet-cache.js +3 -3
- package/dist/ui/fleet-canvas.js +2 -2
- package/dist/ui/fleet-office-dialogue.d.ts +30 -0
- package/dist/ui/fleet-office-dialogue.js +382 -0
- package/dist/ui/fleet-office-editor.js +1 -1
- package/dist/ui/fleet-office-pack.d.ts +9 -0
- package/dist/ui/fleet-office-pack.js +76 -4
- package/dist/ui/fleet-office-skin.js +23 -5
- package/dist/ui/fleet-office-store.js +5 -0
- package/dist/ui/fleet-office.js +174 -7
- package/dist/ui/fleet-org.js +2 -2
- package/dist/ui/fleet-task-card.js +11 -7
- package/dist/ui/fleet-task-common.js +18 -8
- package/dist/ui/fleet-task-menu.js +188 -0
- package/dist/ui/fleet-task-stats.js +124 -0
- package/dist/ui/fleet-task-view.js +340 -0
- package/dist/ui/fleet-tasks.js +131 -43
- package/dist/ui/general-location.js +85 -0
- package/dist/ui/html-attachment.js +3 -40
- package/dist/ui/hub-agent-copy.js +23 -0
- package/dist/ui/hub-attachments.js +90 -0
- package/dist/ui/hub-button-actions.js +65 -0
- package/dist/ui/hub-chat-store.js +168 -0
- package/dist/ui/hub-chat-strings.js +79 -0
- package/dist/ui/hub-client.js +410 -0
- package/dist/ui/hub-company-join-strings.js +74 -0
- package/dist/ui/hub-company-join.js +119 -0
- package/dist/ui/hub-directory-editor-strings.js +56 -0
- package/dist/ui/hub-directory-editor.js +163 -0
- package/dist/ui/hub-directory-notice-strings.js +28 -0
- package/dist/ui/hub-directory-notices.js +66 -0
- package/dist/ui/hub-grant-strings.js +13 -0
- package/dist/ui/hub-group-policy.js +183 -0
- package/dist/ui/hub-group-strings.js +110 -0
- package/dist/ui/hub-host-security-notices.js +28 -0
- package/dist/ui/hub-owner-strings.js +55 -0
- package/dist/ui/hub-pairing-progress-strings.js +15 -0
- package/dist/ui/hub-preview.js +101 -0
- package/dist/ui/hub-provider-guidance.js +31 -0
- package/dist/ui/hub-quick-pairing.js +209 -0
- package/dist/ui/hub-quick-strings.js +43 -0
- package/dist/ui/hub-quota.js +85 -0
- package/dist/ui/hub-read-strings.js +7 -0
- package/dist/ui/hub-strings.js +164 -0
- package/dist/ui/hub-switcher.js +27 -0
- package/dist/ui/hub-this-hub.js +113 -0
- package/dist/ui/hub-welcome.js +102 -0
- package/dist/ui/machine-signin.js +56 -0
- package/dist/ui/native-instance-settings.js +44 -0
- package/dist/ui/native-pane-recovery.js +45 -0
- package/dist/ui/office-share-page.js +4 -2
- package/dist/ui/panel-chat.js +98 -77
- package/dist/ui/panel-details.js +3 -2
- package/dist/ui/panel-fleet.js +183 -32
- package/dist/ui/panel-hub.js +970 -0
- package/dist/ui/panel-log.js +4 -4
- package/dist/ui/panel-needs.js +189 -15
- package/dist/ui/panel-notices.js +4 -3
- package/dist/ui/panel-runtimes.js +446 -0
- package/dist/ui/panel-settings.js +292 -201
- package/dist/ui/panel-windows-agent.js +87 -0
- package/dist/ui/panel-windows-cli.js +189 -0
- package/dist/ui/preview-pages.js +3 -41
- package/dist/ui/preview-panel-actions.js +3 -161
- package/dist/ui/preview-panel.js +11 -472
- package/dist/ui/preview-versions.js +3 -155
- package/dist/ui/preview.js +3 -476
- package/dist/ui/provider-marks.js +83 -0
- package/dist/ui/runtime-catalog.js +55 -0
- package/dist/ui/runtime-cli-install.js +135 -0
- package/dist/ui/runtime-commands.d.ts +4 -0
- package/dist/ui/runtime-commands.js +59 -0
- package/dist/ui/runtime-update-commands.d.ts +2 -0
- package/dist/ui/runtime-update-commands.js +11 -0
- package/dist/ui/runtime-update-status.js +53 -0
- package/dist/ui/search-dialog.js +5 -2
- package/dist/ui/settings-access-strings.js +42 -0
- package/dist/ui/settings-agent-filters.js +94 -0
- package/dist/ui/settings-appearance.js +122 -23
- package/dist/ui/settings-apply.js +12 -5
- package/dist/ui/settings-build-version.js +35 -0
- package/dist/ui/settings-catalog.js +39 -11
- package/dist/ui/settings-codex-copy.js +19 -0
- package/dist/ui/settings-confirm.js +108 -10
- package/dist/ui/settings-devices.js +249 -0
- package/dist/ui/settings-dialogs.js +78 -25
- package/dist/ui/settings-guests.js +28 -13
- package/dist/ui/settings-hub-browser-certificate.js +76 -0
- package/dist/ui/settings-hub-company-join.js +162 -0
- package/dist/ui/settings-hub-directory.js +29 -0
- package/dist/ui/settings-hub-membership.js +93 -0
- package/dist/ui/settings-hub-preview.js +74 -0
- package/dist/ui/settings-hub-retention.js +54 -0
- package/dist/ui/settings-hub-run.js +62 -0
- package/dist/ui/settings-hub-section.js +66 -0
- package/dist/ui/settings-hub-setup-strings.js +70 -0
- package/dist/ui/settings-hub-setup.js +195 -0
- package/dist/ui/settings-hub.js +261 -0
- package/dist/ui/settings-layout.js +246 -0
- package/dist/ui/settings-model.js +26 -3
- package/dist/ui/settings-named-test.js +2 -2
- package/dist/ui/settings-outside.js +242 -0
- package/dist/ui/settings-quota-notice.js +102 -0
- package/dist/ui/settings-registry.js +24 -5
- package/dist/ui/settings-restart-strings.js +17 -0
- package/dist/ui/settings-shared-strings.js +143 -0
- package/dist/ui/settings-shared.js +345 -0
- package/dist/ui/settings-shortcuts.js +65 -0
- package/dist/ui/settings-strings.js +127 -52
- package/dist/ui/settings-update.js +69 -0
- package/dist/ui/settings-web-authority.js +19 -12
- package/dist/ui/shared/accounts-keepalive.css +12 -0
- package/dist/ui/shared/accounts.css +78 -0
- package/dist/ui/shared/app-i18n.js +18 -9
- package/dist/ui/shared/app-route.js +12 -3
- package/dist/ui/shared/app-session.js +6 -2
- package/dist/ui/shared/app-shell.js +312 -40
- package/dist/ui/shared/app-store.js +3 -2
- package/dist/ui/shared/app-stream.js +3 -1
- package/dist/ui/shared/app-update.js +215 -0
- package/dist/ui/shared/app.css +1511 -6
- package/dist/ui/shared/app.js +18 -4
- package/dist/ui/shared/chat-composer.js +68 -0
- package/dist/ui/shared/chat-md-strings.js +9 -0
- package/dist/ui/shared/chat-render.js +682 -0
- package/dist/ui/shared/chat-strings.js +333 -0
- package/dist/ui/shared/chat-thread.js +969 -0
- package/dist/ui/shared/chat-time.js +80 -0
- package/dist/ui/shared/header-tools.js +9 -9
- package/dist/ui/shared/html-attachment.js +42 -0
- package/dist/ui/shared/hub-chat.css +98 -0
- package/dist/ui/shared/hub-groups.css +28 -0
- package/dist/ui/shared/hub-owner.css +51 -0
- package/dist/ui/shared/hub-quota.css +8 -0
- package/dist/ui/shared/hub-signin.css +24 -0
- package/dist/ui/shared/hub.css +78 -0
- package/dist/ui/shared/instance-nav.js +35 -8
- package/dist/ui/shared/instance-switch.js +4 -3
- package/dist/ui/shared/loading.css +37 -0
- package/dist/ui/shared/machine-name.js +13 -0
- package/dist/ui/shared/page-head.js +8 -0
- package/dist/ui/shared/panel-view.js +77 -4
- package/dist/ui/shared/preview-pages.js +41 -0
- package/dist/ui/shared/preview-panel-actions.js +168 -0
- package/dist/ui/shared/preview-panel.js +565 -0
- package/dist/ui/shared/preview-versions.js +155 -0
- package/dist/ui/shared/preview.js +476 -0
- package/dist/ui/shared/qrcode.module.js +2237 -0
- package/dist/ui/shared/runtime-install.css +30 -0
- package/dist/ui/shared/settings-width.js +31 -0
- package/dist/ui/shared/setup-host-text.js +4 -1
- package/dist/ui/shared/side-rail.js +15 -0
- package/dist/ui/shared/signin.js +280 -10
- package/dist/ui/shared/task-board.css +95 -0
- package/dist/ui/shared/tokens.css +1 -0
- package/dist/ui/shared/ui-dialog.js +2 -2
- package/dist/ui/shared/ui-menu.js +30 -10
- package/dist/ui/shared/ui-states.js +14 -3
- package/dist/ui/shared/usage-dialog.js +3 -72
- package/dist/ui/shared/usage-meter.js +84 -0
- package/dist/ui/shared/vendor/qrcode-generator.LICENSE +27 -0
- package/dist/ui/shared/vendor/vendor.json +19 -2
- package/dist/ui/shared/view-history.css +17 -0
- package/dist/ui/shared/view-history.js +438 -0
- package/dist/ui/shared/view-strings.js +23 -15
- package/dist/ui/shared/web-authorize.js +4 -4
- package/dist/ui/shared/workspace-follow.css +19 -0
- package/dist/ui/shared/workspace.css +20 -0
- package/dist/ui/signin.html +27 -2
- package/dist/ui/structured-signin.js +65 -15
- package/dist/ui/windows-agents-nav.js +2 -0
- package/dist/ui/windows-cli-catalog.js +108 -0
- package/dist/ui/workspace-follow-strings.js +28 -0
- package/dist/ui/workspace-panel.js +378 -0
- package/dist/ui/workspace-strings.js +35 -0
- package/dist/unattended-install.d.ts +11 -2
- package/dist/unattended-install.js +41 -6
- 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 +7 -0
- package/dist/update-install.js +23 -0
- 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 +4 -2
- package/dist/update-marker.js +4 -3
- package/dist/update-marker.js.map +1 -1
- package/dist/usage/providers.d.ts +8 -0
- package/dist/usage/providers.js +36 -26
- package/dist/usage/providers.js.map +1 -1
- package/dist/usage/quota-notices.d.ts +38 -0
- package/dist/usage/quota-notices.js +160 -0
- package/dist/usage/quota-notices.js.map +1 -0
- package/dist/usage/usage-api.d.ts +2 -1
- package/dist/usage/usage-api.js +19 -10
- package/dist/usage/usage-api.js.map +1 -1
- package/dist/usage-rollup.d.ts +5 -0
- package/dist/usage-rollup.js +11 -6
- package/dist/usage-rollup.js.map +1 -1
- package/dist/view-api.d.ts +18 -8
- package/dist/view-api.js +108 -32
- package/dist/view-api.js.map +1 -1
- package/dist/view-history.d.ts +84 -0
- package/dist/view-history.js +116 -0
- package/dist/view-history.js.map +1 -0
- package/dist/web-api.d.ts +133 -2
- package/dist/web-api.js +1091 -26
- package/dist/web-api.js.map +1 -1
- package/dist/web-auth.js +2 -1
- package/dist/web-auth.js.map +1 -1
- package/dist/web-backend-login.d.ts +39 -3
- package/dist/web-backend-login.js +25 -17
- package/dist/web-backend-login.js.map +1 -1
- package/dist/web-chat-history.d.ts +19 -2
- package/dist/web-chat-history.js +72 -3
- package/dist/web-chat-history.js.map +1 -1
- package/dist/web-device-login.d.ts +153 -0
- package/dist/web-device-login.js +278 -0
- package/dist/web-device-login.js.map +1 -0
- package/dist/web-login.d.ts +35 -1
- package/dist/web-login.js +51 -5
- package/dist/web-login.js.map +1 -1
- package/dist/web-notices.d.ts +9 -0
- package/dist/web-notices.js +19 -0
- package/dist/web-notices.js.map +1 -1
- package/dist/web-office-skins.d.ts +9 -0
- package/dist/web-office-skins.js +16 -1
- package/dist/web-office-skins.js.map +1 -1
- package/dist/web-only-fleet.d.ts +20 -0
- package/dist/web-only-fleet.js +21 -0
- package/dist/web-only-fleet.js.map +1 -1
- package/dist/web-remote-access.d.ts +158 -0
- package/dist/web-remote-access.js +377 -0
- package/dist/web-remote-access.js.map +1 -0
- package/dist/web-session.d.ts +53 -0
- package/dist/web-session.js +47 -1
- package/dist/web-session.js.map +1 -1
- package/dist/web-settings-patch.d.ts +3 -1
- package/dist/web-settings-patch.js +4 -1
- package/dist/web-settings-patch.js.map +1 -1
- package/dist/web-shell-routes.d.ts +10 -1
- package/dist/web-shell-routes.js +14 -2
- package/dist/web-shell-routes.js.map +1 -1
- package/dist/web-signin-link.d.ts +42 -0
- package/dist/web-signin-link.js +110 -0
- package/dist/web-signin-link.js.map +1 -0
- package/dist/web-terminal.d.ts +11 -30
- package/dist/web-terminal.js +23 -8
- package/dist/web-terminal.js.map +1 -1
- package/dist/web-update.d.ts +78 -0
- package/dist/web-update.js +104 -0
- package/dist/web-update.js.map +1 -0
- package/dist/windows-agents.d.ts +127 -0
- package/dist/windows-agents.js +491 -0
- package/dist/windows-agents.js.map +1 -0
- package/dist/windows-cli-api.d.ts +48 -0
- package/dist/windows-cli-api.js +206 -0
- package/dist/windows-cli-api.js.map +1 -0
- package/dist/windows-cli-providers.d.ts +109 -0
- package/dist/windows-cli-providers.js +396 -0
- package/dist/windows-cli-providers.js.map +1 -0
- package/dist/windows-cli-worker.d.ts +85 -0
- package/dist/windows-cli-worker.js +585 -0
- package/dist/windows-cli-worker.js.map +1 -0
- package/dist/windows-cli.d.ts +126 -0
- package/dist/windows-cli.js +416 -0
- package/dist/windows-cli.js.map +1 -0
- package/dist/windows-native-mcp.d.ts +19 -0
- package/dist/windows-native-mcp.js +143 -0
- package/dist/windows-native-mcp.js.map +1 -0
- package/dist/windows-pane-mcp.d.ts +26 -0
- package/dist/windows-pane-mcp.js +187 -0
- package/dist/windows-pane-mcp.js.map +1 -0
- package/dist/workspace-follow-parse.d.ts +36 -0
- package/dist/workspace-follow-parse.js +208 -0
- package/dist/workspace-follow-parse.js.map +1 -0
- package/dist/workspace-follow-records.d.ts +17 -0
- package/dist/workspace-follow-records.js +88 -0
- package/dist/workspace-follow-records.js.map +1 -0
- package/dist/workspace-follow.d.ts +41 -0
- package/dist/workspace-follow.js +143 -0
- package/dist/workspace-follow.js.map +1 -0
- package/dist/wsl-detect.d.ts +1 -0
- package/dist/wsl-detect.js +20 -0
- package/dist/wsl-detect.js.map +1 -0
- package/dist/yaml-shared-nodes.js +8 -3
- package/dist/yaml-shared-nodes.js.map +1 -1
- package/launcher/agend-install.cjs +8 -1
- package/launcher/launchd-session-type.cjs +14 -0
- package/launcher/postinstall.cjs +27 -2
- package/launcher/private-home.cjs +1 -1
- package/launcher/tmux-bundle.cjs +263 -0
- package/package.json +16 -4
- package/templates/launchd.plist.ejs +3 -1
- package/templates/runtime-assets/conpty-LICENSE +21 -0
- package/templates/runtime-assets/conpty-NOTICE.md +503 -0
- package/templates/runtime-assets/local-pane-stage.ps1 +101 -0
- package/templates/runtime-assets/runtime-pane-job.ps1 +116 -0
- package/templates/runtime-assets/runtime-pane-private.ps1 +14 -0
- package/templates/runtime-assets/xterm-LICENSE +21 -0
- package/templates/runtime-install/install.ps1 +411 -0
package/dist/daemon.js
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
import { nativePaneToolRefusal } from "./native-pane-tools.js";
|
|
2
|
+
import { generalByName } from "./general-instance.js";
|
|
3
|
+
import { claudeMinimumError, cliVersionBelow } from "./claude-model-minimum.js";
|
|
4
|
+
import { quotaNoticeProblem } from "./quota-notice-config.js";
|
|
5
|
+
import { quotaHistoryCount, quotaAfterInput } from "./pane-quota-history.js";
|
|
1
6
|
import { dialogScreenText } from "./dialog-screen-text.js";
|
|
2
7
|
import { readActiveKiroModel } from "./backend/kiro.js";
|
|
3
8
|
import { dashboardAccessOf } from "./dashboard-permissions.js";
|
|
@@ -20,8 +25,9 @@ import { assertNoSessionOomStop, readSessionOomStop, writeSessionOomStop, Sessio
|
|
|
20
25
|
import { mcpServerState } from "./mcp-liveness.js";
|
|
21
26
|
import { clearPausedMarker, writePausedMarker } from "./pause-marker.js";
|
|
22
27
|
import { writeBackgroundWorkEndedMarker } from "./background-work-ended.js";
|
|
23
|
-
import {
|
|
28
|
+
import { resolveTmuxLogicalSize, TmuxManager } from "./tmux-manager.js";
|
|
24
29
|
import { TranscriptMonitor } from "./transcript-monitor.js";
|
|
30
|
+
import { FollowLog } from "./workspace-follow.js";
|
|
25
31
|
import { createTranscriptSource } from "./transcript-sources.js";
|
|
26
32
|
import { TranscriptTurnLedger } from "./transcript-turns.js";
|
|
27
33
|
import { credentialProfileStoreHome, resolveCredentialProfile } from "./backend/credential-profile.js";
|
|
@@ -29,6 +35,8 @@ import { resolveToolSet, toolsFor } from "./tool-permissions.js";
|
|
|
29
35
|
import { TOOLS } from "./channel/mcp-tools.js";
|
|
30
36
|
import { dashboardAccessProblem, dashboardFeaturesOff, withoutFeatures } from "./dashboard-permissions.js";
|
|
31
37
|
import { getAgendHome } from "./paths.js";
|
|
38
|
+
import { legacyTmuxSocket, tmuxSocket } from "./tmux-binary.js";
|
|
39
|
+
import { migrateLegacyWindow, tagWindowId } from "./tmux-legacy.js";
|
|
32
40
|
import { scopedFleetConfigEnvironment } from "./web-experimental.js";
|
|
33
41
|
import { readAgentFile } from "./agent-file-read.js";
|
|
34
42
|
import { ASSET_UPLOAD_MAX_BYTES, receivePreview, sendAssetInParts, writePreview } from "./web-asset-parts.js";
|
|
@@ -48,6 +56,7 @@ import { HangDetector } from "./hang-detector.js";
|
|
|
48
56
|
import { writeSecretFile } from "./secret-file.js";
|
|
49
57
|
import { PaneWriteLock } from "./pane-write-lock.js";
|
|
50
58
|
import { answerRemoteCard } from "./remote-card-answer.js";
|
|
59
|
+
import { tmuxPaneHost } from "./tmux-pane-host.js";
|
|
51
60
|
import { buildFleetInstructions } from "./instructions.js";
|
|
52
61
|
import { formatHumanInboundMessage, prepareDeliveryWire, steerInboundEnvelope, BTW_INBOUND_PREFIX, humanBodyHash, humanOwnerObjectId } from "./human-delivery-receipts.js";
|
|
53
62
|
import { formatCrossInstanceInboundMessage, renderCrossInstanceHandoffMetadata, } from "./cross-instance-envelope.js";
|
|
@@ -55,8 +64,9 @@ import { agendMessageInInput, bottomRowIsReady, inputAreaText, inputShowsPastedT
|
|
|
55
64
|
import { TurnReplyGuard, formatReplyDropDetection, turnExpectsPersonReply } from "./turn-reply-guard.js";
|
|
56
65
|
import { CLAUDE_CREDIT_BALANCE_LOW, CLAUDE_MODEL_USAGE_LIMIT, CLAUDE_USAGE_LIMIT_PAUSE } from "./backend/claude-transcript-errors.js";
|
|
57
66
|
import { t } from "./locale.js";
|
|
58
|
-
import { claudeResetTime, quotaPausedLine } from "./quota-notice.js";
|
|
67
|
+
import { claudeResetInstant, claudeResetTime, quotaPausedLine } from "./quota-notice.js";
|
|
59
68
|
import { MuseUsageRelay, clearMuseUsageSnapshot } from "./muse-usage-relay.js";
|
|
69
|
+
import { reconcileNativePaneTarget } from "./native-pane-reconciliation.js";
|
|
60
70
|
import { deliveryContentDigest } from "./delivery-outbox.js";
|
|
61
71
|
import { consumedWatches } from "./delivery-consumed-watch.js";
|
|
62
72
|
import { queueResumePolicyForAttempt } from "./delivery-queue-evidence.js";
|
|
@@ -190,20 +200,20 @@ export function sameProjectFamily(a, b) {
|
|
|
190
200
|
const fx = family(x), fy = family(y);
|
|
191
201
|
return fx.length > 0 && fx === fy;
|
|
192
202
|
}
|
|
203
|
+
/** At most this many fleet decisions, and this many team + directory ones, in one instance's Active Decisions. */
|
|
204
|
+
export const ACTIVE_DECISION_CAPS = { fleet: 20, scoped: 20 };
|
|
193
205
|
/**
|
|
194
|
-
*
|
|
195
|
-
*
|
|
196
|
-
* `scope: "fleet"` previously bypassed the project check outright, so every
|
|
197
|
-
* instance carried every other project's playbook — measured at 8 of 14 here,
|
|
198
|
-
* resent on every API call. A fleet decision must now also be relevant: global
|
|
199
|
-
* (no project_root), the same project, or the same project family.
|
|
200
|
-
*
|
|
201
|
-
* `isDispatcher` (a general) opts out of that narrowing on purpose: it routes
|
|
202
|
-
* work across all projects, so cross-project rules ("X 文件操作由 Y 負責") are
|
|
203
|
-
* precisely what it must know. Narrowing a general would cause misrouting.
|
|
206
|
+
* Bound an instance's already-selected decisions (newest first, as the store orders them): fleet ones and its own team
|
|
207
|
+
* and directory ones are capped apart, AFTER selection, so nobody else's rows take an instance's places.
|
|
204
208
|
*/
|
|
205
|
-
export function
|
|
209
|
+
export function capActiveDecisions(selected) {
|
|
210
|
+
let fleet = 0, scoped = 0;
|
|
211
|
+
return selected.filter(d => d.scope === "fleet" ? fleet++ < ACTIVE_DECISION_CAPS.fleet : scoped++ < ACTIVE_DECISION_CAPS.scoped);
|
|
212
|
+
}
|
|
213
|
+
export function selectRelevantDecisions(all, workDir, isDispatcher = false, teams = []) {
|
|
206
214
|
return all.filter(d => {
|
|
215
|
+
if (d.scope === "team")
|
|
216
|
+
return !!d.team && teams.includes(d.team);
|
|
207
217
|
if (d.project_root === workDir)
|
|
208
218
|
return true; // own project, any scope
|
|
209
219
|
if (d.scope !== "fleet")
|
|
@@ -1116,6 +1126,7 @@ export class Daemon extends EventEmitter {
|
|
|
1116
1126
|
spawnGate;
|
|
1117
1127
|
stormWindow;
|
|
1118
1128
|
backendOutage;
|
|
1129
|
+
paneTransport;
|
|
1119
1130
|
/** #1314: fleet-directory fallbacks already reported to the topic (once per daemon, per field and path). */
|
|
1120
1131
|
promptFileFallbackNoticed = new Set();
|
|
1121
1132
|
/** Identity of this live Daemon object; changes on object stop/restart. */
|
|
@@ -1542,6 +1553,12 @@ export class Daemon extends EventEmitter {
|
|
|
1542
1553
|
* when a startup scan reaches a real ready prompt, or on wake().
|
|
1543
1554
|
*/
|
|
1544
1555
|
fatalStartupBlocked = false;
|
|
1556
|
+
/** #3441: one repair budget survives every automatic spawn on this daemon. */
|
|
1557
|
+
modelMinimumRepairUsed = false;
|
|
1558
|
+
modelMinimumFlight = null;
|
|
1559
|
+
modelMinimumBlocked = false;
|
|
1560
|
+
modelMinimumUpdateNotified = false;
|
|
1561
|
+
cliRepairSessionId;
|
|
1545
1562
|
/** model_error seen mid-turn: notify only if it survives to the idle screen. */
|
|
1546
1563
|
pendingModelErrorKey = null;
|
|
1547
1564
|
/** Optional per-instance localhost relay used to observe Muse usage events. */
|
|
@@ -1794,6 +1811,85 @@ export class Daemon extends EventEmitter {
|
|
|
1794
1811
|
// still booting. Its new tmux window starts empty before resume restores the
|
|
1795
1812
|
// old transcript, so pre-ready scans must not lower this seeded baseline.
|
|
1796
1813
|
seededErrorCountBaselines = new Map();
|
|
1814
|
+
nativeQuotaReplayTaken = false;
|
|
1815
|
+
quotaReplay = null;
|
|
1816
|
+
paneQuotaPatterns() {
|
|
1817
|
+
if (!["codex", "grok"].includes(this.backend?.binaryName ?? ""))
|
|
1818
|
+
return [];
|
|
1819
|
+
const patterns = this.backend?.getErrorPatterns?.() ?? [];
|
|
1820
|
+
return this.backend?.binaryName === "codex" ? patterns.filter(ep => Daemon.isCodexUsageLimitPause(ep)) : patterns.filter(ep => ep.type === "quota");
|
|
1821
|
+
}
|
|
1822
|
+
async prepareQuotaReplayHistory(reuseWindow) {
|
|
1823
|
+
this.quotaReplay = null;
|
|
1824
|
+
const backend = this.backend, owner = this.tmux, window = owner?.getWindowId?.();
|
|
1825
|
+
const spawn = this.spawnGeneration, fence = this.launchFenceEpoch, attempt = this.launchAttempt;
|
|
1826
|
+
const current = () => backend === this.backend && owner === this.tmux && window === owner?.getWindowId?.()
|
|
1827
|
+
&& spawn === this.spawnGeneration && fence === this.launchFenceEpoch && attempt === this.launchAttempt;
|
|
1828
|
+
const replay = backend?.quotaReplayHistory?.();
|
|
1829
|
+
if (replay)
|
|
1830
|
+
this.quotaReplay = { ...replay, spawn, fence, attempt };
|
|
1831
|
+
// A Grok wake keeps its exited pane. The replacement's first ready pane is not history proof.
|
|
1832
|
+
if (reuseWindow && backend?.resumesPreservedQuotaHistory?.()) {
|
|
1833
|
+
let oldPane;
|
|
1834
|
+
try {
|
|
1835
|
+
oldPane = await owner.capturePane();
|
|
1836
|
+
}
|
|
1837
|
+
catch {
|
|
1838
|
+
return;
|
|
1839
|
+
}
|
|
1840
|
+
this.startupAdmission?.();
|
|
1841
|
+
if (!current())
|
|
1842
|
+
return;
|
|
1843
|
+
const patterns = this.paneQuotaPatterns();
|
|
1844
|
+
const messages = oldPane.split(/\r?\n/).filter(row => patterns.some(ep => ep.pattern.test(row)));
|
|
1845
|
+
this.quotaReplay = { messages, current: () => true, spawn, fence, attempt };
|
|
1846
|
+
}
|
|
1847
|
+
}
|
|
1848
|
+
/** Before admission, this launch may absorb ONLY rows positively known before its resume. */
|
|
1849
|
+
takeQuotaReplayBaseline(pane) {
|
|
1850
|
+
// Native captures carry only a runner-frozen pre-launch proof, revalidated with this capture's owner and seq.
|
|
1851
|
+
const native = !this.nativeQuotaReplayTaken ? this.nativePaneLifecycle?.quotaReplayHistory?.() : null;
|
|
1852
|
+
if (this.nativePaneLifecycle)
|
|
1853
|
+
this.nativeQuotaReplayTaken = true;
|
|
1854
|
+
const history = this.quotaReplay ?? (native ? { ...native, spawn: this.spawnGeneration, fence: this.launchFenceEpoch, attempt: this.launchAttempt } : null);
|
|
1855
|
+
if (!history)
|
|
1856
|
+
return;
|
|
1857
|
+
this.quotaReplay = null;
|
|
1858
|
+
if (history.spawn !== this.spawnGeneration || history.fence !== this.launchFenceEpoch || history.attempt !== this.launchAttempt || !history.current())
|
|
1859
|
+
return;
|
|
1860
|
+
for (const ep of this.paneQuotaPatterns()) {
|
|
1861
|
+
const count = Math.min(Daemon.countOccurrences(ep.pattern, pane), quotaHistoryCount(pane, ep.pattern, history.messages));
|
|
1862
|
+
if (!count)
|
|
1863
|
+
continue;
|
|
1864
|
+
const key = Daemon.errorPatternKey(ep);
|
|
1865
|
+
this.lastErrorCount.set(key, Math.max(this.lastErrorCount.get(key) ?? 0, count));
|
|
1866
|
+
this.logger.debug({ backend: this.backend?.binaryName, count, evidence: "before-resume" }, "Quota rows restored from history — not a new incident");
|
|
1867
|
+
}
|
|
1868
|
+
}
|
|
1869
|
+
// Submission makes captured rows history even when no monitor reported them yet. Keep this acknowledged input's
|
|
1870
|
+
// marker as well: a new error can replace an old row in the viewport without increasing the total match count.
|
|
1871
|
+
quotaInput = null;
|
|
1872
|
+
commitPreInputQuotaHistory(evidence) {
|
|
1873
|
+
const history = evidence?.quotaHistory;
|
|
1874
|
+
if (!history || history.spawn !== this.spawnGeneration || history.fence !== this.launchFenceEpoch || history.attempt !== this.launchAttempt
|
|
1875
|
+
|| history.tmux !== this.tmux || history.window !== this.tmux?.getWindowId?.() || this.deliveryWritesStopping)
|
|
1876
|
+
return;
|
|
1877
|
+
for (const row of history.counts)
|
|
1878
|
+
this.lastErrorCount.set(row.key, row.count);
|
|
1879
|
+
this.quotaInput = history.marker && history.occurrences === 0 ? { history, reported: new Map() } : null;
|
|
1880
|
+
}
|
|
1881
|
+
quotaOccurrencesAfterInput(pane, ep) {
|
|
1882
|
+
if (!(this.backend?.binaryName === "codex" && Daemon.isCodexUsageLimitPause(ep)
|
|
1883
|
+
|| this.backend?.binaryName === "grok" && ep.type === "quota"))
|
|
1884
|
+
return null;
|
|
1885
|
+
const input = this.quotaInput, history = input?.history;
|
|
1886
|
+
if (!input || !history || history.spawn !== this.spawnGeneration || history.fence !== this.launchFenceEpoch
|
|
1887
|
+
|| history.attempt !== this.launchAttempt || history.tmux !== this.tmux || history.window !== this.tmux?.getWindowId?.()
|
|
1888
|
+
|| this.deliveryWritesStopping)
|
|
1889
|
+
return null;
|
|
1890
|
+
const suffix = quotaAfterInput(pane, history.marker);
|
|
1891
|
+
return suffix === null ? null : { input, count: Daemon.countOccurrences(ep.pattern, suffix) };
|
|
1892
|
+
}
|
|
1797
1893
|
lastDetectedErrorType = null;
|
|
1798
1894
|
/**
|
|
1799
1895
|
* #2822: Claude's per-model usage limit (`You've reached your <model> limit.`), known only from Claude's own record of
|
|
@@ -1815,12 +1911,55 @@ export class Daemon extends EventEmitter {
|
|
|
1815
1911
|
static CREDIT_BALANCE_LOW = CLAUDE_CREDIT_BALANCE_LOW;
|
|
1816
1912
|
/** #2834 (#816): Claude's usage-limit auto-continue note, as it records it (`system` / `informational`). */
|
|
1817
1913
|
static USAGE_LIMIT_PAUSE = CLAUDE_USAGE_LIMIT_PAUSE;
|
|
1818
|
-
/**
|
|
1819
|
-
|
|
1820
|
-
|
|
1914
|
+
/** Claude's note that its usage window opened again ("Usage limit reset · continuing automatically"). */
|
|
1915
|
+
static USAGE_LIMIT_RESET = /^Usage limit reset\b/i;
|
|
1916
|
+
/** Repeats of one usage pause ("reached again" every few minutes) collapse into the first notice for this long. */
|
|
1917
|
+
static USAGE_PAUSE_NOTICE_WINDOW_MS = 30 * 60_000;
|
|
1918
|
+
/** The usage-pause notice told last: when (monotonic), Claude's words for the reset, and that reset (wall clock). */
|
|
1919
|
+
usagePauseNotice = null;
|
|
1920
|
+
/** Coarse status for the representative quota hint; never exports model names or transcript text. */
|
|
1921
|
+
quotaPaused() {
|
|
1922
|
+
if (this.usageLimitHold)
|
|
1923
|
+
return true;
|
|
1924
|
+
const pause = this.usagePauseNotice;
|
|
1925
|
+
return !!pause && (pause.resetAt === null
|
|
1926
|
+
? performance.now() - pause.at < Daemon.USAGE_PAUSE_NOTICE_WINDOW_MS
|
|
1927
|
+
: Date.now() < pause.resetAt);
|
|
1928
|
+
}
|
|
1929
|
+
/** #3186 review: the lifecycle's second opinion dropped the notice (usage has capacity): nothing was told. */
|
|
1930
|
+
clearUsagePauseNotice() { this.usagePauseNotice = null; }
|
|
1931
|
+
/**
|
|
1932
|
+
* #2834 (#816): Claude paused itself until its usage window opens — the same notice the screen pattern gave. `at`: when
|
|
1933
|
+
* Claude wrote it (its record's timestamp). One notice per pause: a reset time already past is not this pause (an old
|
|
1934
|
+
* note), and its repeats ("reached again") within the window — or naming the same reset, until it comes — say nothing
|
|
1935
|
+
* more. Claude's own "Usage limit reset" ends it.
|
|
1936
|
+
*/
|
|
1937
|
+
noteClaudeInformational(text, at = null) {
|
|
1938
|
+
const line = text.trim();
|
|
1939
|
+
if (Daemon.USAGE_LIMIT_RESET.test(line)) {
|
|
1940
|
+
this.usagePauseNotice = null;
|
|
1941
|
+
return;
|
|
1942
|
+
}
|
|
1943
|
+
const match = Daemon.USAGE_LIMIT_PAUSE.exec(line);
|
|
1821
1944
|
if (!match)
|
|
1822
1945
|
return;
|
|
1823
1946
|
const when = match[1].trim();
|
|
1947
|
+
const wallNow = Date.now(), now = performance.now();
|
|
1948
|
+
const resetAt = claudeResetInstant(when, at ?? wallNow);
|
|
1949
|
+
if (resetAt !== null && resetAt <= wallNow) {
|
|
1950
|
+
this.logger.debug({ when, writtenAt: at }, "Claude usage-limit note names a reset already past — an old note, not told");
|
|
1951
|
+
return;
|
|
1952
|
+
}
|
|
1953
|
+
// A pause told earlier is this one while its own reset has not come (unknown: within the window): its repeats —
|
|
1954
|
+
// "reached again", or a relative time drifting ("in 3h", "in 2h 55m") — within the window, or naming the same reset.
|
|
1955
|
+
// Once its reset has passed, a later note is a new pause even without Claude's "Usage limit reset" (#3186 review).
|
|
1956
|
+
const told = this.usagePauseNotice;
|
|
1957
|
+
const toldOpen = !!told && (told.resetAt === null || wallNow < told.resetAt);
|
|
1958
|
+
if (told && toldOpen && (now - told.at < Daemon.USAGE_PAUSE_NOTICE_WINDOW_MS || (told.when === when && told.resetAt !== null))) {
|
|
1959
|
+
this.logger.debug({ when }, "Claude usage-limit note repeats a pause already told — collapsed");
|
|
1960
|
+
return;
|
|
1961
|
+
}
|
|
1962
|
+
this.usagePauseNotice = { at: now, when, resetAt };
|
|
1824
1963
|
this.emit("pty_error", { name: this.name, type: "quota", action: "notify", verifyQuota: true, skipCooldown: true, skipRecoveryWait: true,
|
|
1825
1964
|
message: `Claude Code usage limit reached — paused; continuing automatically ${when}`,
|
|
1826
1965
|
notice: quotaPausedLine("Claude", "usage", claudeResetTime(when)) });
|
|
@@ -1953,9 +2092,94 @@ export class Daemon extends EventEmitter {
|
|
|
1953
2092
|
this.errorRecoveryDeadlineAt = 0;
|
|
1954
2093
|
this.activeErrorPatternKey = null;
|
|
1955
2094
|
}
|
|
2095
|
+
/** Lazy default also preserves bare-prototype diagnostic/test construction. */
|
|
2096
|
+
get paneHost() { return this.paneTransport ?? tmuxPaneHost; }
|
|
2097
|
+
nativePaneLifecycle;
|
|
2098
|
+
nativeFleetBridge;
|
|
2099
|
+
nativeTranscriptSource;
|
|
2100
|
+
usesNativePane() { return !!this.nativePaneLifecycle; }
|
|
2101
|
+
/** cc3ce4fe: the CLI version this pane's launch actually ran, as its helper recorded it (undefined: not known). */
|
|
2102
|
+
nativePaneCliVersion() { try {
|
|
2103
|
+
return this.nativePaneLifecycle?.snapshot?.()?.cliVersion;
|
|
2104
|
+
}
|
|
2105
|
+
catch {
|
|
2106
|
+
return undefined;
|
|
2107
|
+
} }
|
|
2108
|
+
logNativeInputRefusal(details) {
|
|
2109
|
+
this.logger.warn({ component: "runtime-pane-host", reason: "expected_seq_changed", ...details }, "Native pane input refused before write");
|
|
2110
|
+
}
|
|
2111
|
+
logNativeToolFailure(details) {
|
|
2112
|
+
const turn = this.turnReplyGuard.snapshot();
|
|
2113
|
+
this.logger.warn({ ...details, currentMessageId: turn?.target.messageId ?? null,
|
|
2114
|
+
guardGeneration: turn?.generation ?? null, guardPhase: turn?.phase ?? null }, "Native pane tool operation failed");
|
|
2115
|
+
}
|
|
2116
|
+
nativePaneCurrent() { return this.nativePaneLifecycle?.current() ?? false; }
|
|
2117
|
+
nativeEnterHold = null;
|
|
2118
|
+
/** Per-launch attention for a native delivery whose bounded input attempts were refused or uncertain, including non-outbox input. */
|
|
2119
|
+
nativeDeliveryHold() {
|
|
2120
|
+
const hold = this.nativeEnterHold;
|
|
2121
|
+
return hold && this.nativePaneLifecycle && !this.deliveryWritesStopping && hold.spawn === this.spawnGeneration && hold.fence === this.launchFenceEpoch
|
|
2122
|
+
? { key: hold.key, since: hold.since } : null;
|
|
2123
|
+
}
|
|
2124
|
+
nativePaneHasExited() {
|
|
2125
|
+
const snapshot = this.nativePaneLifecycle?.snapshot?.();
|
|
2126
|
+
return snapshot?.state === "exited" && snapshot.instance === this.name && this.tmux?.getWindowId() === snapshot.paneId;
|
|
2127
|
+
}
|
|
2128
|
+
/** Positive native exit evidence only, fenced to this exact launch and Daemon owner. */
|
|
2129
|
+
nativePaneExitCurrent(snapshot, owner) {
|
|
2130
|
+
const actual = this.nativePaneLifecycle?.snapshot?.();
|
|
2131
|
+
return !!actual && actual.state === "exited" && snapshot.state === "exited"
|
|
2132
|
+
&& sameInteractionOwner(owner, this.interactionOwner()) && !this.runtimeMonitorsFrozen && !this.startupAborted
|
|
2133
|
+
&& ["hostBootId", "paneId", "launchId", "agentId", "instance", "sessionId", "commandSequence", "exitCode"].every(key => actual[key] === snapshot[key])
|
|
2134
|
+
&& this.tmux?.getWindowId() === snapshot.paneId;
|
|
2135
|
+
}
|
|
2136
|
+
async reconcileNativeDeliveries(outbox, current) {
|
|
2137
|
+
if (!this.nativePaneLifecycle)
|
|
2138
|
+
return false;
|
|
2139
|
+
return reconcileNativePaneTarget(outbox, this.name, this.nativePaneLifecycle, current);
|
|
2140
|
+
}
|
|
2141
|
+
/** Same-process transport for the owned native daemon; never exposed as a runner RPC. */
|
|
2142
|
+
setNativeFleetBridge(bridge) {
|
|
2143
|
+
if (!this.nativePaneLifecycle || this.nativeFleetBridge?.current())
|
|
2144
|
+
throw Error("Native Fleet bridge requires one bound pane owner");
|
|
2145
|
+
this.nativeFleetBridge = bridge;
|
|
2146
|
+
}
|
|
2147
|
+
/** Fleet admission and generation checks happen before this synchronous handoff. */
|
|
2148
|
+
acceptNativeFleetMessage(message) {
|
|
2149
|
+
if (!this.nativePaneLifecycle || !this.nativeFleetBridge?.current() || this.deliveryWritesStopping || this.runtimeMonitorsFrozen)
|
|
2150
|
+
return false;
|
|
2151
|
+
if (typeof message.type === "string" && FLEET_RESPONSE_TYPES.has(message.type)) {
|
|
2152
|
+
this.routeFleetResponse(message);
|
|
2153
|
+
return true;
|
|
2154
|
+
}
|
|
2155
|
+
const bridge = this.nativeFleetBridge;
|
|
2156
|
+
const current = () => this.nativeFleetBridge === bridge && bridge.current() && !this.deliveryWritesStopping && !this.runtimeMonitorsFrozen;
|
|
2157
|
+
return this.handleFleetMessage(message, reply => { if (current())
|
|
2158
|
+
this.broadcastFleetMessage(reply); }, current);
|
|
2159
|
+
}
|
|
2160
|
+
broadcastFleetMessage(message) {
|
|
2161
|
+
if (this.nativePaneLifecycle) {
|
|
2162
|
+
if (this.nativeFleetBridge?.current() && !this.runtimeMonitorsFrozen && !this.deliveryWritesStopping)
|
|
2163
|
+
this.nativeFleetBridge.send(message);
|
|
2164
|
+
}
|
|
2165
|
+
else
|
|
2166
|
+
this.ipcServer?.broadcast(message);
|
|
2167
|
+
}
|
|
2168
|
+
fleetTransportAvailable() {
|
|
2169
|
+
return this.nativePaneLifecycle ? !!this.nativeFleetBridge?.current() && !this.runtimeMonitorsFrozen : !!this.ipcServer;
|
|
2170
|
+
}
|
|
2171
|
+
/** Internal lifecycle injection, before start. Native paths and provider files stay on their runner. */
|
|
2172
|
+
setNativePaneLifecycle(native) {
|
|
2173
|
+
if (this.tmux || this.ipcServer || this.nativePaneLifecycle)
|
|
2174
|
+
throw Error("Native pane adapter must be bound before daemon startup");
|
|
2175
|
+
this.nativePaneLifecycle = native;
|
|
2176
|
+
this.backend = native.backend;
|
|
2177
|
+
this.paneTransport = native.host;
|
|
2178
|
+
this.controlClient = native.observation;
|
|
2179
|
+
}
|
|
1956
2180
|
constructor(name, config, instanceDir, topicMode = false, backend, controlClient, rootLogger, runtimeIdentity, spawnGate, stormWindow,
|
|
1957
2181
|
/** Fleet-level "is this CLI's backend down?" memory — see backend-outage.ts. */
|
|
1958
|
-
backendOutage) {
|
|
2182
|
+
backendOutage, paneTransport) {
|
|
1959
2183
|
super();
|
|
1960
2184
|
this.name = name;
|
|
1961
2185
|
this.config = config;
|
|
@@ -1967,6 +2191,7 @@ export class Daemon extends EventEmitter {
|
|
|
1967
2191
|
this.spawnGate = spawnGate;
|
|
1968
2192
|
this.stormWindow = stormWindow;
|
|
1969
2193
|
this.backendOutage = backendOutage;
|
|
2194
|
+
this.paneTransport = paneTransport;
|
|
1970
2195
|
// The live process owns its adopted configuration. Fleet defaults may be re-resolved in place after a save;
|
|
1971
2196
|
// sharing that object would activate cold changes before the normal restart/apply boundary.
|
|
1972
2197
|
this.config = structuredClone(config);
|
|
@@ -1989,7 +2214,8 @@ export class Daemon extends EventEmitter {
|
|
|
1989
2214
|
this.messageBus.setLogger(this.logger);
|
|
1990
2215
|
// General is the dispatcher — it must stay warm to route messages, so it is
|
|
1991
2216
|
// never auto-paused regardless of auto_pause_after.
|
|
1992
|
-
|
|
2217
|
+
// #3035 review: the one rule (an agent named general unticked — general_topic: false — is a worker).
|
|
2218
|
+
const isGeneral = config.general_topic === true || generalByName(name, config);
|
|
1993
2219
|
const autoPauseMinutes = isGeneral ? 0 : (typeof config.auto_pause_after === "number" ? config.auto_pause_after : 0); // default: disabled
|
|
1994
2220
|
this.autoPauseController = new AutoPauseController(Math.max(0, autoPauseMinutes) * 60_000, readLastInboundAt(instanceDir) ?? Date.now());
|
|
1995
2221
|
// #1209: every real completion clears the in-flight marker, so a
|
|
@@ -2010,6 +2236,12 @@ export class Daemon extends EventEmitter {
|
|
|
2010
2236
|
}
|
|
2011
2237
|
/** The fleet's other same-backend instances' working directories, read at spawn (#984). */
|
|
2012
2238
|
peerWorkingDirectories;
|
|
2239
|
+
/** This instance's teams (fleet.yaml), read at each spawn: their team decisions join its Active Decisions. */
|
|
2240
|
+
decisionTeams;
|
|
2241
|
+
setDecisionTeams(teams) { this.decisionTeams = teams; }
|
|
2242
|
+
/** The fleet's active decisions (startup snapshot), read at each spawn; absent: the AGEND_DECISIONS env (tests). */
|
|
2243
|
+
decisionSource;
|
|
2244
|
+
setDecisionSource(source) { this.decisionSource = source; }
|
|
2013
2245
|
setPeerWorkingDirectories(peers) {
|
|
2014
2246
|
this.peerWorkingDirectories = peers;
|
|
2015
2247
|
}
|
|
@@ -2051,12 +2283,19 @@ export class Daemon extends EventEmitter {
|
|
|
2051
2283
|
return outcome === "begun";
|
|
2052
2284
|
}
|
|
2053
2285
|
async durableAttemptEvidence(windowId, handingOffToNativeQueue, steer, rawPaste = false) {
|
|
2054
|
-
let checkpoint = null;
|
|
2055
|
-
|
|
2056
|
-
|
|
2286
|
+
let checkpoint = null, runtimeTranscript = null;
|
|
2287
|
+
if (this.nativePaneLifecycle) {
|
|
2288
|
+
runtimeTranscript = await this.transcriptMonitor?.reconciliationRuntimeCheckpoint() ?? null;
|
|
2289
|
+
if (!runtimeTranscript || !this.nativePaneLifecycle.current(runtimeTranscript))
|
|
2290
|
+
throw Error("Native transcript checkpoint is not current; no delivery was written");
|
|
2057
2291
|
}
|
|
2058
|
-
|
|
2059
|
-
|
|
2292
|
+
else {
|
|
2293
|
+
try {
|
|
2294
|
+
checkpoint = await this.transcriptMonitor?.reconciliationCheckpoint() ?? null;
|
|
2295
|
+
}
|
|
2296
|
+
catch (err) {
|
|
2297
|
+
this.logger.debug({ err }, "Could not checkpoint transcript before durable delivery");
|
|
2298
|
+
}
|
|
2060
2299
|
}
|
|
2061
2300
|
const submissionMode = rawPaste ? "raw_paste" : steer
|
|
2062
2301
|
? "steer"
|
|
@@ -2072,8 +2311,9 @@ export class Daemon extends EventEmitter {
|
|
|
2072
2311
|
backendVersion,
|
|
2073
2312
|
windowId: windowId ?? this.tmux?.getWindowId() ?? null,
|
|
2074
2313
|
transcriptPath: checkpoint?.path ?? null,
|
|
2075
|
-
transcriptOffset: checkpoint?.offset ?? null,
|
|
2076
|
-
transcriptSessionId: checkpoint?.sessionId ?? null,
|
|
2314
|
+
transcriptOffset: runtimeTranscript?.cursor.offset ?? checkpoint?.offset ?? null,
|
|
2315
|
+
transcriptSessionId: runtimeTranscript?.cursor.sessionId ?? checkpoint?.sessionId ?? null,
|
|
2316
|
+
...(runtimeTranscript ? { runtimeTranscript } : {}),
|
|
2077
2317
|
submissionMode,
|
|
2078
2318
|
queueResumePolicy: queueResumePolicyForAttempt(backend, backendVersion, submissionMode),
|
|
2079
2319
|
};
|
|
@@ -2116,17 +2356,25 @@ export class Daemon extends EventEmitter {
|
|
|
2116
2356
|
const outbox = this.deliveryOutbox;
|
|
2117
2357
|
if (!checkpoint || !outbox?.markConsumed)
|
|
2118
2358
|
return;
|
|
2359
|
+
if (this.nativePaneLifecycle && !checkpoint.runtime)
|
|
2360
|
+
return;
|
|
2119
2361
|
if (verdict.submissionMode !== "steer" && verdict.submissionMode !== "native_queue_handoff")
|
|
2120
2362
|
return;
|
|
2121
2363
|
if (!["claude-code", "codex"].includes(checkpoint.backend))
|
|
2122
2364
|
return;
|
|
2123
2365
|
const spawn = this.spawnGeneration, fence = this.launchFenceEpoch, boot = this.bootId;
|
|
2366
|
+
let location;
|
|
2367
|
+
try {
|
|
2368
|
+
location = checkpoint.runtime ? { reader: this.nativeTranscriptReader(checkpoint.runtime, delivery.deliveryId) } : { path: checkpoint.path, offset: checkpoint.offset };
|
|
2369
|
+
}
|
|
2370
|
+
catch {
|
|
2371
|
+
return;
|
|
2372
|
+
} // The owner changed; an unavailable consumed watch proves nothing.
|
|
2124
2373
|
consumedWatches.start({
|
|
2125
2374
|
deliveryId: delivery.deliveryId,
|
|
2126
2375
|
attemptNo: delivery.attemptNo,
|
|
2127
2376
|
backend: checkpoint.backend,
|
|
2128
|
-
|
|
2129
|
-
offset: checkpoint.offset,
|
|
2377
|
+
...location,
|
|
2130
2378
|
current: () => !this.deliveryWritesStopping && spawn === this.spawnGeneration && fence === this.launchFenceEpoch,
|
|
2131
2379
|
consumed: (via, evidence) => {
|
|
2132
2380
|
try {
|
|
@@ -2168,15 +2416,18 @@ export class Daemon extends EventEmitter {
|
|
|
2168
2416
|
: humanVerificationId ? `[agend-human-id:${humanVerificationId}]` : null;
|
|
2169
2417
|
if (!marker || !formatted.startsWith(marker))
|
|
2170
2418
|
return;
|
|
2171
|
-
let
|
|
2172
|
-
if (!
|
|
2419
|
+
let found = verdict.transcriptCheckpoint ?? null;
|
|
2420
|
+
if (!found) {
|
|
2173
2421
|
try {
|
|
2174
|
-
|
|
2422
|
+
found = await this.transcriptMonitor?.reconciliationCheckpoint() ?? null;
|
|
2175
2423
|
}
|
|
2176
2424
|
catch (err) {
|
|
2177
2425
|
this.logger.debug({ err }, "Could not checkpoint the transcript before a queued hand-off");
|
|
2178
2426
|
}
|
|
2179
2427
|
}
|
|
2428
|
+
// main→alpha sync: a hand-off record is judged against a local transcript file. A native or remote runtime's
|
|
2429
|
+
// transcript (no local path) has none: it runs as before (✅ at the hand-off), as with no checkpoint at all.
|
|
2430
|
+
const checkpoint = found && typeof found.path === "string" && typeof found.offset === "number" ? { path: found.path, offset: found.offset } : null;
|
|
2180
2431
|
if (!checkpoint)
|
|
2181
2432
|
return; // nothing could judge it later: it runs as before (✅ at the hand-off)
|
|
2182
2433
|
const entry = {
|
|
@@ -2444,24 +2695,34 @@ export class Daemon extends EventEmitter {
|
|
|
2444
2695
|
const spawn = this.spawnGeneration;
|
|
2445
2696
|
const fence = this.launchFenceEpoch;
|
|
2446
2697
|
let last = "unavailable";
|
|
2447
|
-
|
|
2448
|
-
let
|
|
2698
|
+
const native = !!checkpoint.runtime || !!this.nativePaneLifecycle;
|
|
2699
|
+
let outcome = native ? "uncertain" : "delivered";
|
|
2700
|
+
let evidence = native ? "runtime-transcript-unconfirmed" : OUTPUT_EDGE_ONLY_EVIDENCE;
|
|
2449
2701
|
// #1647: a raw paste has no marker; its text is the needle, and its pane proof already failed — so without the turn
|
|
2450
2702
|
// in the transcript it stays uncertain (with the pane's reason), never the output-edge outcome.
|
|
2451
2703
|
const needle = rawPaste ? { rawText: rawPaste.text } : delivery.deliveryId;
|
|
2452
2704
|
let found = false;
|
|
2453
2705
|
try {
|
|
2706
|
+
if (this.nativePaneLifecycle && !checkpoint.runtime)
|
|
2707
|
+
throw Error("Native proof cannot read a coordinator-local transcript path");
|
|
2708
|
+
const nativeReader = checkpoint.runtime ? this.nativeTranscriptReader(checkpoint.runtime, needle) : null;
|
|
2454
2709
|
for (let polls = 0; polls <= TRANSCRIPT_PROOF_WINDOW_MS / TRANSCRIPT_PROOF_POLL_MS; polls++) {
|
|
2455
2710
|
if (this.deliveryWritesStopping)
|
|
2456
2711
|
return; // reconciliation owns the row now
|
|
2457
|
-
const look = await scanTranscriptForDeliveryMarker(checkpoint.path, checkpoint.offset, checkpoint.backend, needle);
|
|
2712
|
+
const look = nativeReader ? await nativeReader.look() : await scanTranscriptForDeliveryMarker(checkpoint.path, checkpoint.offset, checkpoint.backend, needle);
|
|
2713
|
+
if (this.deliveryWritesStopping)
|
|
2714
|
+
return;
|
|
2715
|
+
if (spawn !== this.spawnGeneration || fence !== this.launchFenceEpoch) {
|
|
2716
|
+
last = "unavailable";
|
|
2717
|
+
break;
|
|
2718
|
+
}
|
|
2458
2719
|
if (look === "user" || look === "absorbed" || look === "queued") {
|
|
2459
2720
|
found = true;
|
|
2460
2721
|
outcome = "delivered";
|
|
2461
2722
|
evidence = transcriptMarkerEvidence(look, !!rawPaste);
|
|
2462
2723
|
break;
|
|
2463
2724
|
}
|
|
2464
|
-
last = look;
|
|
2725
|
+
last = look === "pending" ? "unavailable" : look;
|
|
2465
2726
|
if (spawn !== this.spawnGeneration || fence !== this.launchFenceEpoch) {
|
|
2466
2727
|
last = "unavailable";
|
|
2467
2728
|
break;
|
|
@@ -2473,13 +2734,13 @@ export class Daemon extends EventEmitter {
|
|
|
2473
2734
|
// `uncertain`: re-check the same fixed epochs after the last await, before settling (#1207 P2).
|
|
2474
2735
|
if (spawn !== this.spawnGeneration || fence !== this.launchFenceEpoch)
|
|
2475
2736
|
last = "unavailable";
|
|
2476
|
-
if (last === "no-match" &&
|
|
2737
|
+
if (last === "no-match" && !found) {
|
|
2477
2738
|
outcome = "uncertain";
|
|
2478
2739
|
evidence = "unverifiable-no-transcript-marker";
|
|
2479
2740
|
}
|
|
2480
2741
|
}
|
|
2481
2742
|
catch (err) {
|
|
2482
|
-
this.logger.debug({ err }, "Transcript proof
|
|
2743
|
+
this.logger.debug({ err }, "Transcript proof unavailable — preserving the conservative outcome");
|
|
2483
2744
|
}
|
|
2484
2745
|
if (rawPaste && !found) {
|
|
2485
2746
|
outcome = "uncertain";
|
|
@@ -2666,128 +2927,150 @@ export class Daemon extends EventEmitter {
|
|
|
2666
2927
|
}
|
|
2667
2928
|
}
|
|
2668
2929
|
catch { /* corrupt/missing — ignore */ }
|
|
2669
|
-
|
|
2670
|
-
|
|
2671
|
-
|
|
2672
|
-
|
|
2673
|
-
|
|
2674
|
-
|
|
2675
|
-
|
|
2676
|
-
|
|
2677
|
-
|
|
2678
|
-
|
|
2679
|
-
|
|
2680
|
-
|
|
2681
|
-
|
|
2682
|
-
|
|
2683
|
-
|
|
2684
|
-
|
|
2685
|
-
|
|
2686
|
-
|
|
2687
|
-
|
|
2688
|
-
|
|
2689
|
-
|
|
2690
|
-
|
|
2691
|
-
|
|
2692
|
-
|
|
2693
|
-
|
|
2694
|
-
|
|
2695
|
-
|
|
2696
|
-
|
|
2697
|
-
|
|
2698
|
-
|
|
2699
|
-
|
|
2700
|
-
|
|
2701
|
-
|
|
2702
|
-
|
|
2703
|
-
|
|
2704
|
-
|
|
2705
|
-
|
|
2706
|
-
|
|
2707
|
-
|
|
2708
|
-
|
|
2930
|
+
if (!this.nativePaneLifecycle) {
|
|
2931
|
+
// 1. IPC server — bridge between MCP server (Claude's child) and daemon
|
|
2932
|
+
const sockPath = join(this.instanceDir, "channel.sock");
|
|
2933
|
+
this.ipcServer = new IpcServer(sockPath, this.logger);
|
|
2934
|
+
// Forward IPC server errors as daemon events (prevents unhandled 'error' crash).
|
|
2935
|
+
// Guard: only forward post-listen errors — startup errors are handled by listen() rejection.
|
|
2936
|
+
let ipcListening = false;
|
|
2937
|
+
this.ipcServer.on("error", (err) => {
|
|
2938
|
+
if (!ipcListening)
|
|
2939
|
+
return; // startup errors handled by listen() rejection
|
|
2940
|
+
this.logger.error({ err, name: this.name }, "IPC server error");
|
|
2941
|
+
this.emit("error", err);
|
|
2942
|
+
});
|
|
2943
|
+
await this.ipcServer.listen();
|
|
2944
|
+
this.startupAdmission?.();
|
|
2945
|
+
ipcListening = true;
|
|
2946
|
+
// Permanent IPC dispatcher: routes responses to pending requests by type+id key
|
|
2947
|
+
this.ipcServer.on("message", (msg) => this.routeFleetResponse(msg));
|
|
2948
|
+
// IPC message relay: when daemon wants to push a channel message to Claude,
|
|
2949
|
+
// it broadcasts to all IPC clients (the MCP server is one of them).
|
|
2950
|
+
// When MCP server sends a tool_call, daemon handles it via the messageBus.
|
|
2951
|
+
this.ipcServer.on("message", (msg, socket) => {
|
|
2952
|
+
if (msg.type === "tool_call") {
|
|
2953
|
+
// MCP server forwarding a Claude tool call (reply, react, edit, download)
|
|
2954
|
+
this.handleToolCall(msg, socket);
|
|
2955
|
+
}
|
|
2956
|
+
else if (msg.type === "mcp_ready") {
|
|
2957
|
+
this.handleMcpReady(msg, socket);
|
|
2958
|
+
}
|
|
2959
|
+
else if (msg.type === "pong") {
|
|
2960
|
+
this.handleMcpPong(msg, socket);
|
|
2961
|
+
}
|
|
2962
|
+
else if (msg.type === "query_sessions") {
|
|
2963
|
+
// Fleet manager asks for all registered session names (catches sessions
|
|
2964
|
+
// that sent mcp_ready before fleet manager connected).
|
|
2965
|
+
const sessions = [];
|
|
2966
|
+
for (const [s, sessionName] of this.socketSessionNames) {
|
|
2967
|
+
if (!s.destroyed && sessionName !== this.name) {
|
|
2968
|
+
// Individual mcp_ready for initial registration path
|
|
2969
|
+
this.ipcServer?.send(socket, { type: "mcp_ready", sessionName });
|
|
2970
|
+
sessions.push(sessionName);
|
|
2971
|
+
}
|
|
2709
2972
|
}
|
|
2973
|
+
// Batch response for prune path
|
|
2974
|
+
this.ipcServer?.send(socket, { type: "query_sessions_response", sessions });
|
|
2710
2975
|
}
|
|
2711
|
-
|
|
2712
|
-
|
|
2713
|
-
}
|
|
2714
|
-
|
|
2715
|
-
|
|
2716
|
-
|
|
2717
|
-
|
|
2718
|
-
|
|
2719
|
-
|
|
2720
|
-
this.pushChannelMessage(msg.content, meta, targetSession, deliveryEpoch);
|
|
2721
|
-
}).catch(err => {
|
|
2722
|
-
this.deferDurableDelivery(meta, `target wake failed before pane submission: ${err.message}`);
|
|
2723
|
-
this.logger.error({ err: err.message }, "Wake failed for inbound delivery");
|
|
2724
|
-
});
|
|
2725
|
-
}
|
|
2726
|
-
else if (msg.type === "raw_paste") {
|
|
2727
|
-
this.handleRawPasteIpcMessage(msg);
|
|
2728
|
-
}
|
|
2729
|
-
else if (msg.type === "config_update") {
|
|
2730
|
-
this.applyConfigUpdate(msg.config);
|
|
2731
|
-
}
|
|
2732
|
-
else if (msg.type === "steer") {
|
|
2733
|
-
const meta = (msg.meta ?? {});
|
|
2734
|
-
this.steerMessage(msg.content, meta, this.captureDeliveryEpoch(msg.delivery_epoch));
|
|
2735
|
-
}
|
|
2736
|
-
else if (msg.type === "btw") {
|
|
2737
|
-
const meta = (msg.meta ?? {});
|
|
2738
|
-
this.btwMessage(msg.content, meta, this.captureDeliveryEpoch(msg.delivery_epoch));
|
|
2739
|
-
}
|
|
2740
|
-
else if (msg.type === "fleet_schedule_trigger") {
|
|
2741
|
-
const payload = msg.payload;
|
|
2742
|
-
const meta = msg.meta;
|
|
2743
|
-
const deliveryEpoch = this.captureDeliveryEpoch(msg.delivery_epoch);
|
|
2744
|
-
void this.wake().then(() => this.pushChannelMessage(payload.message, meta, undefined, deliveryEpoch)).catch(err => {
|
|
2745
|
-
this.logger.error({ err: err.message }, "Wake failed for scheduled delivery");
|
|
2746
|
-
});
|
|
2747
|
-
}
|
|
2748
|
-
else if (msg.type === "query_instance_state") {
|
|
2749
|
-
void this.respondToInstanceStateQuery(msg, socket);
|
|
2750
|
-
}
|
|
2751
|
-
});
|
|
2752
|
-
// 2. Tmux — ensure session, create window if not alive
|
|
2753
|
-
await TmuxManager.ensureSession(this.tmuxSessionName);
|
|
2754
|
-
this.startupAdmission?.();
|
|
2755
|
-
this.tmux = new TmuxManager(this.tmuxSessionName, "", resolveTmuxLogicalSize(this.config.terminal), this.controlClient);
|
|
2756
|
-
// Strategy A: always start fresh Claude window (MCP server has no reconnection)
|
|
2757
|
-
// Kill any existing window from previous run
|
|
2758
|
-
const windowIdFile = join(this.instanceDir, "window-id");
|
|
2759
|
-
if (existsSync(windowIdFile)) {
|
|
2760
|
-
const savedId = readFileSync(windowIdFile, "utf-8").trim();
|
|
2761
|
-
if (savedId) {
|
|
2762
|
-
const oldTmux = new TmuxManager(this.tmuxSessionName, savedId);
|
|
2763
|
-
if (await oldTmux.isWindowAlive()) {
|
|
2764
|
-
this.startupAdmission?.();
|
|
2765
|
-
await this.checkpointSessionId();
|
|
2976
|
+
else
|
|
2977
|
+
this.handleFleetMessage(msg, reply => { this.ipcServer?.send(socket, reply); });
|
|
2978
|
+
});
|
|
2979
|
+
}
|
|
2980
|
+
let nativeDisposition;
|
|
2981
|
+
if (this.nativePaneLifecycle) {
|
|
2982
|
+
this.beginSpawn();
|
|
2983
|
+
try {
|
|
2984
|
+
const acquired = await this.nativePaneLifecycle.acquire(() => {
|
|
2766
2985
|
this.startupAdmission?.();
|
|
2767
|
-
|
|
2986
|
+
if (this.startupAborted)
|
|
2987
|
+
throw Error("Native launch was superseded");
|
|
2988
|
+
});
|
|
2989
|
+
this.tmux = acquired.pane;
|
|
2990
|
+
this.nativeTranscriptSource = acquired.source;
|
|
2991
|
+
nativeDisposition = acquired.disposition;
|
|
2992
|
+
this.lastSpawnAt = Date.now();
|
|
2993
|
+
this.setProcessStatus("running");
|
|
2994
|
+
this.bindInstanceStateOutputListener(this.tmux.getWindowId());
|
|
2995
|
+
this.saveSessionId();
|
|
2996
|
+
// New/resumed native processes can still be painting their first frame. Keep deliveries behind the same
|
|
2997
|
+
// bounded dialog/readiness scan as local startup. An already-running reattachment may be busy: do not
|
|
2998
|
+
// wait for that work to finish or inject a startup key into it.
|
|
2999
|
+
if (acquired.disposition === "reattached") {
|
|
3000
|
+
if (this.backend?.binaryName === "codex") {
|
|
3001
|
+
const native = this.nativePaneLifecycle, spawn = this.spawnGeneration, fence = this.launchFenceEpoch, attempt = this.launchAttempt;
|
|
3002
|
+
try {
|
|
3003
|
+
const pane = await acquired.pane.capturePane();
|
|
3004
|
+
this.startupAdmission?.();
|
|
3005
|
+
if (!this.startupAborted && !this.deliveryWritesStopping && this.nativePaneLifecycle === native && this.tmux === acquired.pane
|
|
3006
|
+
&& spawn === this.spawnGeneration && fence === this.launchFenceEpoch && attempt === this.launchAttempt && native.current())
|
|
3007
|
+
this.takeQuotaReplayBaseline(pane);
|
|
3008
|
+
}
|
|
3009
|
+
catch { /* An old runner or unavailable proof keeps the existing fail-closed scanner. */ }
|
|
3010
|
+
}
|
|
3011
|
+
}
|
|
3012
|
+
else {
|
|
3013
|
+
if (!await this.finishStartupScan(120_000))
|
|
3014
|
+
throw Error("Native CLI exited during startup; retained session was not replaced");
|
|
2768
3015
|
this.startupAdmission?.();
|
|
2769
|
-
this.
|
|
3016
|
+
if (this.startupAborted || this.deliveryWritesStopping || !this.nativePaneLifecycle.current())
|
|
3017
|
+
throw Error("Native launch was superseded");
|
|
2770
3018
|
}
|
|
2771
3019
|
}
|
|
2772
|
-
|
|
2773
|
-
|
|
2774
|
-
|
|
2775
|
-
this.isNewSession = !resumed;
|
|
2776
|
-
if (!resumed) {
|
|
2777
|
-
await this.injectSnapshotMessage(this.startupAdmission);
|
|
2778
|
-
this.startupAdmission?.();
|
|
3020
|
+
finally {
|
|
3021
|
+
this.endSpawn();
|
|
3022
|
+
}
|
|
2779
3023
|
}
|
|
2780
3024
|
else {
|
|
2781
|
-
//
|
|
2782
|
-
|
|
2783
|
-
|
|
3025
|
+
// 2. Tmux — ensure session, create window if not alive
|
|
3026
|
+
await this.paneHost.ensureSession(this.tmuxSessionName);
|
|
3027
|
+
this.startupAdmission?.();
|
|
3028
|
+
this.tmux = this.paneHost.bind(this.tmuxSessionName, "", resolveTmuxLogicalSize(this.config.terminal), this.controlClient);
|
|
3029
|
+
// M-2457 §6 rule 3: a window-id 2.3 wrote names a window of the SYSTEM tmux's default server.
|
|
3030
|
+
// That window is proven ours, checkpointed and closed (or this instance is held) — and the id is dropped, as it
|
|
3031
|
+
// means nothing on AgEnD's own server — before the fresh-start below can look at it.
|
|
3032
|
+
await migrateLegacyWindow({ agendHome: getAgendHome(), instance: this.name, instanceDir: this.instanceDir, session: this.tmuxSessionName, legacySocket: legacyTmuxSocket(), currentSocket: tmuxSocket(),
|
|
3033
|
+
backendBinary: this.backend?.binaryName ?? "", checkpoint: () => this.checkpointSessionId(),
|
|
3034
|
+
log: (msg, data) => this.logger.info(data ?? {}, msg) });
|
|
3035
|
+
this.startupAdmission?.();
|
|
3036
|
+
// Strategy A: always start fresh Claude window (MCP server has no reconnection)
|
|
3037
|
+
// Kill any existing window from previous run
|
|
3038
|
+
const windowIdFile = join(this.instanceDir, "window-id");
|
|
3039
|
+
if (existsSync(windowIdFile)) {
|
|
3040
|
+
const savedId = readFileSync(windowIdFile, "utf-8").trim();
|
|
3041
|
+
if (savedId) {
|
|
3042
|
+
const oldTmux = this.paneHost.bind(this.tmuxSessionName, savedId);
|
|
3043
|
+
if (await oldTmux.isWindowAlive()) {
|
|
3044
|
+
this.startupAdmission?.();
|
|
3045
|
+
await this.checkpointSessionId();
|
|
3046
|
+
this.startupAdmission?.();
|
|
3047
|
+
await oldTmux.killWindow();
|
|
3048
|
+
this.startupAdmission?.();
|
|
3049
|
+
this.logger.info({ savedId }, "Killed old tmux window for fresh start");
|
|
3050
|
+
}
|
|
3051
|
+
}
|
|
3052
|
+
}
|
|
3053
|
+
const resumed = await this.spawnClaudeWindow();
|
|
3054
|
+
this.startupAdmission?.();
|
|
3055
|
+
this.isNewSession = !resumed;
|
|
3056
|
+
if (!resumed) {
|
|
3057
|
+
await this.injectSnapshotMessage(this.startupAdmission);
|
|
3058
|
+
this.startupAdmission?.();
|
|
3059
|
+
}
|
|
3060
|
+
else {
|
|
3061
|
+
// Clean up stale snapshot file — resume restored full context, snapshot not needed
|
|
3062
|
+
try {
|
|
3063
|
+
unlinkSync(join(this.instanceDir, "rotation-state.json"));
|
|
3064
|
+
}
|
|
3065
|
+
catch { /* may not exist */ }
|
|
2784
3066
|
}
|
|
2785
|
-
catch { /* may not exist */ }
|
|
2786
3067
|
}
|
|
3068
|
+
if (nativeDisposition)
|
|
3069
|
+
this.isNewSession = nativeDisposition === "fresh";
|
|
2787
3070
|
// #1209: conditional continuation for the turn interrupted by the last
|
|
2788
3071
|
// restart, if the gates allow. Detached; the gate
|
|
2789
3072
|
// consumes its one-shot marker first and never throws into boot.
|
|
2790
|
-
const legacyResume = this.maybeResumeInterruptedTurn().catch(() => "unknown");
|
|
3073
|
+
const legacyResume = this.nativePaneLifecycle ? Promise.resolve("unknown") : this.maybeResumeInterruptedTurn().catch(() => "unknown");
|
|
2791
3074
|
const recoveryOwner = JSON.stringify(this.interactionOwner());
|
|
2792
3075
|
void Promise.allSettled([legacyResume]).then(() => {
|
|
2793
3076
|
if (JSON.stringify(this.interactionOwner()) === recoveryOwner) {
|
|
@@ -2806,7 +3089,7 @@ export class Daemon extends EventEmitter {
|
|
|
2806
3089
|
// (statusline transcript); codex/kiro/opencode read their CLI's own
|
|
2807
3090
|
// conversation store via a pluggable source. Backends with no known
|
|
2808
3091
|
// source stay inert exactly as before.
|
|
2809
|
-
this.transcriptMonitor = this.buildTranscriptMonitor(createTranscriptSource(this.config.backend ?? "claude-code", this.config.working_directory, this.credentialProfileStore(), () => this.backend?.transcriptLaunch?.() ?? null));
|
|
3092
|
+
this.transcriptMonitor = this.buildTranscriptMonitor(this.nativeTranscriptSource ?? createTranscriptSource(this.config.backend ?? "claude-code", this.config.working_directory, this.credentialProfileStore(), () => this.backend?.transcriptLaunch?.() ?? null));
|
|
2810
3093
|
const transcriptMonitor = this.transcriptMonitor;
|
|
2811
3094
|
const transcriptFence = this.launchFenceEpoch;
|
|
2812
3095
|
// Baseline in the isolate before this daemon accepts new work. A
|
|
@@ -2842,7 +3125,7 @@ export class Daemon extends EventEmitter {
|
|
|
2842
3125
|
this.publishActivity(null);
|
|
2843
3126
|
});
|
|
2844
3127
|
this.transcriptMonitor.on("api_error", (text, status, _at, errorKind) => this.noteClaudeApiError(text, status, errorKind));
|
|
2845
|
-
this.transcriptMonitor.on("system_informational", (text) => this.noteClaudeInformational(text));
|
|
3128
|
+
this.transcriptMonitor.on("system_informational", (text, at) => this.noteClaudeInformational(text, at));
|
|
2846
3129
|
this.transcriptMonitor.on("user_prompt", () => this.noteClaudePrompt());
|
|
2847
3130
|
this.transcriptMonitor.on("assistant_text", (text) => {
|
|
2848
3131
|
this.noteClaudeOutput();
|
|
@@ -2862,13 +3145,15 @@ export class Daemon extends EventEmitter {
|
|
|
2862
3145
|
if (hangConfig?.enabled !== false) {
|
|
2863
3146
|
this.hangDetector = new HangDetector();
|
|
2864
3147
|
}
|
|
2865
|
-
|
|
2866
|
-
|
|
2867
|
-
|
|
2868
|
-
|
|
2869
|
-
|
|
2870
|
-
this.
|
|
2871
|
-
|
|
3148
|
+
if (!this.nativePaneLifecycle) {
|
|
3149
|
+
// 8. Context guardian
|
|
3150
|
+
const statusFile = join(this.instanceDir, "statusline.json");
|
|
3151
|
+
this.guardian = new ContextGuardian(this.config.context_guardian ?? {}, this.logger, statusFile);
|
|
3152
|
+
this.guardian.startWatching();
|
|
3153
|
+
this.guardian.on("status_update", () => {
|
|
3154
|
+
this.saveSessionId();
|
|
3155
|
+
});
|
|
3156
|
+
}
|
|
2872
3157
|
// Context rotation removed: all CLI backends have built-in auto-compact.
|
|
2873
3158
|
// Crash recovery (health check + respawn with snapshot) is retained below.
|
|
2874
3159
|
}
|
|
@@ -2921,7 +3206,7 @@ export class Daemon extends EventEmitter {
|
|
|
2921
3206
|
this.socketPids.delete(socket);
|
|
2922
3207
|
// Notify fleet manager so it can clean up sessionRegistry
|
|
2923
3208
|
if (sessionName !== this.name) {
|
|
2924
|
-
this.
|
|
3209
|
+
this.broadcastFleetMessage({ type: "session_disconnected", sessionName });
|
|
2925
3210
|
}
|
|
2926
3211
|
});
|
|
2927
3212
|
}
|
|
@@ -2937,11 +3222,16 @@ export class Daemon extends EventEmitter {
|
|
|
2937
3222
|
// sub-agent's server may have left a dead pid in the slot).
|
|
2938
3223
|
this.noteMcpProofOfLife("mcp_ready", typeof msg.pid === "number" ? msg.pid : undefined);
|
|
2939
3224
|
}
|
|
2940
|
-
this.
|
|
3225
|
+
this.broadcastFleetMessage({ type: "mcp_ready", sessionName });
|
|
2941
3226
|
}
|
|
2942
3227
|
checkMcpServerAlive() {
|
|
2943
3228
|
if (this.isPaused)
|
|
2944
3229
|
return;
|
|
3230
|
+
if (this.nativePaneLifecycle) {
|
|
3231
|
+
if (this.nativePaneLifecycle.mcpProof() === "alive")
|
|
3232
|
+
this.noteMcpProofOfLife("connection");
|
|
3233
|
+
return; // No native PID/socket guessing or restart from an unknown helper observation.
|
|
3234
|
+
}
|
|
2945
3235
|
const status = mcpServerState(this.instanceDir);
|
|
2946
3236
|
if (status.state === "alive") {
|
|
2947
3237
|
this.mcpServedGeneration = this.spawnGeneration;
|
|
@@ -3025,6 +3315,8 @@ export class Daemon extends EventEmitter {
|
|
|
3025
3315
|
* server from a third-party one, and failed the whole launch for either.
|
|
3026
3316
|
*/
|
|
3027
3317
|
checkFleetMcpNeverConnected() {
|
|
3318
|
+
if (this.nativePaneLifecycle)
|
|
3319
|
+
return; // Native helper presence owns this observation.
|
|
3028
3320
|
if (this.config.agent_mode === "cli")
|
|
3029
3321
|
return; // no MCP server by design
|
|
3030
3322
|
if (this.lastSpawnAt === 0 || this.mcpServedGeneration === this.spawnGeneration)
|
|
@@ -3235,6 +3527,8 @@ export class Daemon extends EventEmitter {
|
|
|
3235
3527
|
* proof that tools are being served, whatever channel.mcp.pid says.
|
|
3236
3528
|
*/
|
|
3237
3529
|
mcpServerAlive() {
|
|
3530
|
+
if (this.nativePaneLifecycle)
|
|
3531
|
+
return this.nativePaneLifecycle.mcpProof() === "alive" ? { alive: true, source: "connection" } : { alive: false, source: "none" };
|
|
3238
3532
|
const status = mcpServerState(this.instanceDir);
|
|
3239
3533
|
if (status.state === "alive")
|
|
3240
3534
|
return { alive: true, source: "pid", pid: status.pid };
|
|
@@ -3299,7 +3593,7 @@ export class Daemon extends EventEmitter {
|
|
|
3299
3593
|
this.mcpDeathNotifiedForPid = null;
|
|
3300
3594
|
this.mcpDeathDeferredForPid = null;
|
|
3301
3595
|
this.clearMcpRestartRequest();
|
|
3302
|
-
if (pid && mcpServerState(this.instanceDir).state !== "alive")
|
|
3596
|
+
if (!this.nativePaneLifecycle && pid && mcpServerState(this.instanceDir).state !== "alive")
|
|
3303
3597
|
this.repairMcpPidSlot(pid, source);
|
|
3304
3598
|
}
|
|
3305
3599
|
emitMcpRecovered(source, pid) {
|
|
@@ -3346,6 +3640,26 @@ export class Daemon extends EventEmitter {
|
|
|
3346
3640
|
// ended this instance's health loop because scheduleNext() sat after the
|
|
3347
3641
|
// throwing code. Catch, log, and keep checking.
|
|
3348
3642
|
try {
|
|
3643
|
+
if (this.nativePaneLifecycle) {
|
|
3644
|
+
if (this.healthCheckPaused) {
|
|
3645
|
+
scheduleNext();
|
|
3646
|
+
return;
|
|
3647
|
+
}
|
|
3648
|
+
const native = this.nativePaneLifecycle, pane = this.tmux;
|
|
3649
|
+
const status = await pane?.getPaneStatus();
|
|
3650
|
+
if (this.runtimeMonitorsFrozen || native !== this.nativePaneLifecycle || pane !== this.tmux)
|
|
3651
|
+
return;
|
|
3652
|
+
const snapshot = native.snapshot?.();
|
|
3653
|
+
if (status?.alive === false && snapshot?.state === "exited") {
|
|
3654
|
+
this.healthCheckPaused = true;
|
|
3655
|
+
this.setProcessStatus(snapshot.exitCode === 0 ? "stopped" : "crashed");
|
|
3656
|
+
this.emit("native_pane_exited", { name: this.name, snapshot, owner: this.interactionOwner() });
|
|
3657
|
+
}
|
|
3658
|
+
else if (status?.alive)
|
|
3659
|
+
this.checkMcpServerAlive();
|
|
3660
|
+
scheduleNext();
|
|
3661
|
+
return;
|
|
3662
|
+
}
|
|
3349
3663
|
// Instance directory removed externally (e.g. `rm -rf ~/.agend/instances/<name>`).
|
|
3350
3664
|
// Stop the loop permanently — otherwise every tick triggers a respawn, whose
|
|
3351
3665
|
// writeRotationSnapshot fails with ENOENT and gets caught as "Failed to respawn",
|
|
@@ -3481,13 +3795,13 @@ export class Daemon extends EventEmitter {
|
|
|
3481
3795
|
let inWindowLossBurst = false;
|
|
3482
3796
|
let nullReason;
|
|
3483
3797
|
if (!paneStatus) {
|
|
3484
|
-
const serverAlive = await
|
|
3798
|
+
const serverAlive = await this.paneHost.sessionExists(this.tmuxSessionName);
|
|
3485
3799
|
if (discardStaleHealth())
|
|
3486
3800
|
return;
|
|
3487
3801
|
// A server may have already restarted before this daemon's health
|
|
3488
3802
|
// tick. The new PID is the durable generation boundary: treat it as
|
|
3489
3803
|
// a fleet storm even though `has-session` is true again.
|
|
3490
|
-
const serverPid = serverAlive ? await
|
|
3804
|
+
const serverPid = serverAlive ? await this.paneHost.getServerPid(this.tmuxSessionName) : null;
|
|
3491
3805
|
if (discardStaleHealth())
|
|
3492
3806
|
return;
|
|
3493
3807
|
const generationChanged = serverAlive && this.stormWindow?.observeServerAlive(serverPid) === true;
|
|
@@ -3516,7 +3830,7 @@ export class Daemon extends EventEmitter {
|
|
|
3516
3830
|
// the window truly no longer exists vs a transient query glitch.
|
|
3517
3831
|
nullReason = "no_window";
|
|
3518
3832
|
try {
|
|
3519
|
-
const windows = await
|
|
3833
|
+
const windows = await this.paneHost.listWindowsStrict(this.tmuxSessionName, this.controlClient);
|
|
3520
3834
|
if (discardStaleHealth())
|
|
3521
3835
|
return;
|
|
3522
3836
|
this.windowQueryFailureTicks = 0;
|
|
@@ -3763,10 +4077,10 @@ export class Daemon extends EventEmitter {
|
|
|
3763
4077
|
// Wrapped in try-catch: if tmux server is dead, listWindows throws —
|
|
3764
4078
|
// must not block spawnClaudeWindow (which calls ensureSession).
|
|
3765
4079
|
try {
|
|
3766
|
-
const windows = await
|
|
4080
|
+
const windows = await this.paneHost.listWindows(this.tmuxSessionName);
|
|
3767
4081
|
for (const w of windows) {
|
|
3768
4082
|
if (w.name === this.name) {
|
|
3769
|
-
const tm =
|
|
4083
|
+
const tm = this.paneHost.bind(this.tmuxSessionName, w.id);
|
|
3770
4084
|
await tm.killWindow();
|
|
3771
4085
|
}
|
|
3772
4086
|
}
|
|
@@ -3911,7 +4225,7 @@ export class Daemon extends EventEmitter {
|
|
|
3911
4225
|
// Force the next ready capture to emit a fresh transition after respawn.
|
|
3912
4226
|
this.instanceState = "working";
|
|
3913
4227
|
}
|
|
3914
|
-
this.
|
|
4228
|
+
this.broadcastFleetMessage({
|
|
3915
4229
|
type: "instance_process_state",
|
|
3916
4230
|
instanceName: this.name,
|
|
3917
4231
|
status,
|
|
@@ -4107,12 +4421,15 @@ export class Daemon extends EventEmitter {
|
|
|
4107
4421
|
for (const key of dialog.keys) {
|
|
4108
4422
|
if (stale())
|
|
4109
4423
|
return;
|
|
4424
|
+
const keyScreen = this.nativePaneLifecycle ? await pollTmux.capturePane() : currentPane;
|
|
4425
|
+
if (stale() || !Daemon.dialogMatches(dialog, keyScreen))
|
|
4426
|
+
return;
|
|
4110
4427
|
let sent = false;
|
|
4111
4428
|
if (SPECIAL_KEYS.has(key)) {
|
|
4112
|
-
sent = await pollTmux.sendSpecialKey(key);
|
|
4429
|
+
sent = await (this.nativePaneLifecycle ? pollTmux.sendSpecialKey(key, undefined, { kind: "dialog", screen: keyScreen }) : pollTmux.sendSpecialKey(key));
|
|
4113
4430
|
}
|
|
4114
4431
|
else if (dialog.literalKeys) {
|
|
4115
|
-
sent = await pollTmux.sendKeys(key); // typed, no Enter (#2872)
|
|
4432
|
+
sent = await (this.nativePaneLifecycle ? pollTmux.sendKeys(key, { kind: "dialog", screen: keyScreen }) : pollTmux.sendKeys(key)); // typed, no Enter (#2872)
|
|
4116
4433
|
}
|
|
4117
4434
|
else {
|
|
4118
4435
|
sent = await pollTmux.pasteText(key, this.systemPasteOptions());
|
|
@@ -4312,7 +4629,13 @@ export class Daemon extends EventEmitter {
|
|
|
4312
4629
|
for (const ep of patterns) {
|
|
4313
4630
|
const key = Daemon.errorPatternKey(ep);
|
|
4314
4631
|
const count = countMatches(ep.pattern);
|
|
4315
|
-
|
|
4632
|
+
let seen = this.lastErrorCount.get(key) ?? 0;
|
|
4633
|
+
const afterInput = this.quotaOccurrencesAfterInput(pane, ep);
|
|
4634
|
+
// Only a new echo of our acknowledged input can re-arm a same-count replacement. Old rows before that echo,
|
|
4635
|
+
// an ambiguous/missing marker or a superseded input owner retain the ordinary count-based decision.
|
|
4636
|
+
const newQuotaAfterInput = !!afterInput && afterInput.count > (afterInput.input.reported.get(key) ?? 0);
|
|
4637
|
+
if (newQuotaAfterInput)
|
|
4638
|
+
seen = Math.min(seen, count - 1);
|
|
4316
4639
|
// #2282: a resumed exhausted429 row is history, not even a new
|
|
4317
4640
|
// notification/failover incident; so is a resumed codex workspace-limit row
|
|
4318
4641
|
// (#2844: a wake must not pause again on it). Wait for the first live
|
|
@@ -4334,7 +4657,7 @@ export class Daemon extends EventEmitter {
|
|
|
4334
4657
|
// the lifecycle, whose usage probe decides (available / reserve / exhausted).
|
|
4335
4658
|
if (Daemon.isCodexUsageLimitPause(ep)) {
|
|
4336
4659
|
const ack = this.codexReserveAck;
|
|
4337
|
-
if (ack && ack.generation === this.spawnGeneration && count <= ack.count) {
|
|
4660
|
+
if (ack && ack.generation === this.spawnGeneration && count <= ack.count && !newQuotaAfterInput) {
|
|
4338
4661
|
// The handled incident's lines can scroll out of the capture buffer as
|
|
4339
4662
|
// the reserve session talks on. Lower the proof (and the occurrence
|
|
4340
4663
|
// baseline) with them: otherwise `count <= ack.count` would keep
|
|
@@ -4375,6 +4698,8 @@ export class Daemon extends EventEmitter {
|
|
|
4375
4698
|
continue;
|
|
4376
4699
|
}
|
|
4377
4700
|
this.lastErrorCount.set(key, count);
|
|
4701
|
+
if (afterInput)
|
|
4702
|
+
afterInput.input.reported.set(key, Math.max(afterInput.input.reported.get(key) ?? 0, afterInput.count));
|
|
4378
4703
|
// Kiro's `auto` model picks a concrete model per turn and reroutes around
|
|
4379
4704
|
// a temporarily unavailable one on its own — telling the user to run
|
|
4380
4705
|
// /model would ask them to fix something the CLI is already handling.
|
|
@@ -4407,6 +4732,14 @@ export class Daemon extends EventEmitter {
|
|
|
4407
4732
|
}
|
|
4408
4733
|
/** Arm the recovery gates and emit one detected error pattern. */
|
|
4409
4734
|
emitErrorPattern(ep, key, pane, now) {
|
|
4735
|
+
const minimum = !this.nativePaneLifecycle && this.backend?.binaryName === "claude" && ep.type === "outdated_cli" ? claudeMinimumError(pane) : null;
|
|
4736
|
+
if (minimum) {
|
|
4737
|
+
this.lastErrorNotifiedAt.set(key, now);
|
|
4738
|
+
void this.handleClaudeModelMinimum(minimum).catch(err => {
|
|
4739
|
+
this.logger.warn({ reason: String(err) }, "CLI launch repair failed");
|
|
4740
|
+
});
|
|
4741
|
+
return;
|
|
4742
|
+
}
|
|
4410
4743
|
// #2795: auth text on the pane proves nothing about the credentials (22 of 22 such matches on the main host were
|
|
4411
4744
|
// conversation text). It arms nothing here; it only asks the lifecycle's token-free check, and a failing check
|
|
4412
4745
|
// arms the auth state through confirmAuthFailure().
|
|
@@ -4475,7 +4808,20 @@ export class Daemon extends EventEmitter {
|
|
|
4475
4808
|
*/
|
|
4476
4809
|
async sendEscape() {
|
|
4477
4810
|
const cancelKey = this.backend?.getCancelKey() ?? "Escape";
|
|
4478
|
-
|
|
4811
|
+
const tmux = this.tmux;
|
|
4812
|
+
if (!tmux)
|
|
4813
|
+
return;
|
|
4814
|
+
if (this.nativePaneLifecycle) {
|
|
4815
|
+
// A native pane's composer proof cannot see a permission dialog, so an unproved key is withheld there. The cancel
|
|
4816
|
+
// is the person's own interrupt, keyed on the screen read just before (as the dialog answer path is): what Esc
|
|
4817
|
+
// does on Linux's tmux pane, on the same screen, with the same key.
|
|
4818
|
+
const screen = await tmux.capturePane().catch(() => null);
|
|
4819
|
+
if (screen === null)
|
|
4820
|
+
return;
|
|
4821
|
+
await tmux.sendSpecialKey(cancelKey, undefined, { kind: "dialog", screen });
|
|
4822
|
+
return;
|
|
4823
|
+
}
|
|
4824
|
+
await tmux.sendSpecialKey(cancelKey);
|
|
4479
4825
|
}
|
|
4480
4826
|
/**
|
|
4481
4827
|
* Drop every not-yet-started pane delivery which predates a user cancel.
|
|
@@ -4541,7 +4887,7 @@ export class Daemon extends EventEmitter {
|
|
|
4541
4887
|
return;
|
|
4542
4888
|
const outcome = follower.look(pane);
|
|
4543
4889
|
if (outcome) {
|
|
4544
|
-
this.
|
|
4890
|
+
this.broadcastFleetMessage({ type: "compact_pane_result", id, owner, outcome });
|
|
4545
4891
|
return;
|
|
4546
4892
|
}
|
|
4547
4893
|
}
|
|
@@ -4561,7 +4907,7 @@ export class Daemon extends EventEmitter {
|
|
|
4561
4907
|
const reportSwitch = (result) => {
|
|
4562
4908
|
if (!ownSwitch)
|
|
4563
4909
|
return;
|
|
4564
|
-
this.
|
|
4910
|
+
this.broadcastFleetMessage({ type: "runtime_switch_result", id: ownSwitch.id, ...result });
|
|
4565
4911
|
};
|
|
4566
4912
|
// Board 003648ac: the fleet follows a web /compact from just before its paste is written: the transcript's end then
|
|
4567
4913
|
// (taken here, under this launch, before the write) and the launch it was written under ride with the notice — once.
|
|
@@ -4576,7 +4922,7 @@ export class Daemon extends EventEmitter {
|
|
|
4576
4922
|
if (!notifyWritten || told)
|
|
4577
4923
|
return;
|
|
4578
4924
|
told = true;
|
|
4579
|
-
this.
|
|
4925
|
+
this.broadcastFleetMessage({ type: "raw_paste_written", id: notifyWritten, outcome: written ? "written" : "not_written",
|
|
4580
4926
|
...(written ? { owner, checkpoint, ...(paneFollower ? { pane: true } : {}) } : {}) });
|
|
4581
4927
|
if (written && paneFollower)
|
|
4582
4928
|
void this.followCompactPane(notifyWritten, owner, paneFollower);
|
|
@@ -4738,10 +5084,11 @@ export class Daemon extends EventEmitter {
|
|
|
4738
5084
|
const press = (target, cursor, key) => this.paneWriteLock.run(async () => {
|
|
4739
5085
|
if (this.tmux !== tmux)
|
|
4740
5086
|
return false;
|
|
4741
|
-
const
|
|
5087
|
+
const screen = await read();
|
|
5088
|
+
const now = claudeSwitchDialog(screen);
|
|
4742
5089
|
if (!now || now.kind !== "model" || now.target !== target || (cursor !== null && now.cursor !== cursor))
|
|
4743
5090
|
return false;
|
|
4744
|
-
return tmux.sendSpecialKey(key);
|
|
5091
|
+
return this.nativePaneLifecycle ? tmux.sendSpecialKey(key, undefined, { kind: "dialog", screen }) : tmux.sendSpecialKey(key);
|
|
4745
5092
|
});
|
|
4746
5093
|
const gone = async () => {
|
|
4747
5094
|
const until = performance.now() + OWN_SWITCH_SETTLE_MS;
|
|
@@ -4830,9 +5177,12 @@ export class Daemon extends EventEmitter {
|
|
|
4830
5177
|
return false;
|
|
4831
5178
|
const specialKeys = new Set(["Up", "Down", "Enter", "Escape", "Right", "Left"]);
|
|
4832
5179
|
for (const key of dialog.keys) {
|
|
5180
|
+
const keyScreen = this.nativePaneLifecycle ? await this.tmux.capturePane() : currentPane;
|
|
5181
|
+
if (!matches(keyScreen))
|
|
5182
|
+
return false;
|
|
4833
5183
|
const ok = specialKeys.has(key)
|
|
4834
|
-
? await this.tmux.sendSpecialKey(key)
|
|
4835
|
-
: await this.tmux.sendKeys(key);
|
|
5184
|
+
? await (this.nativePaneLifecycle ? this.tmux.sendSpecialKey(key, undefined, { kind: "dialog", screen: keyScreen }) : this.tmux.sendSpecialKey(key))
|
|
5185
|
+
: await (this.nativePaneLifecycle ? this.tmux.sendKeys(key, { kind: "dialog", screen: keyScreen }) : this.tmux.sendKeys(key));
|
|
4836
5186
|
if (!ok)
|
|
4837
5187
|
return false;
|
|
4838
5188
|
await new Promise(resolve => setTimeout(resolve, 100));
|
|
@@ -5075,7 +5425,7 @@ export class Daemon extends EventEmitter {
|
|
|
5075
5425
|
await this.tmux.sendSpecialKey("Escape").catch(() => false);
|
|
5076
5426
|
return true;
|
|
5077
5427
|
}
|
|
5078
|
-
async stop() {
|
|
5428
|
+
async stop(options = {}) {
|
|
5079
5429
|
this.publishWorkingState("before_stop");
|
|
5080
5430
|
this.logger.info("Stopping daemon instance");
|
|
5081
5431
|
this.clearQuitRelaunchWatch();
|
|
@@ -5097,8 +5447,18 @@ export class Daemon extends EventEmitter {
|
|
|
5097
5447
|
}
|
|
5098
5448
|
if (this.adapter)
|
|
5099
5449
|
await this.adapter.stop();
|
|
5450
|
+
if (this.nativePaneLifecycle) {
|
|
5451
|
+
this.healthCheckPaused = true;
|
|
5452
|
+
this.saveSessionId();
|
|
5453
|
+
await this.nativePaneLifecycle.release(options.nativePane ?? "detach");
|
|
5454
|
+
try {
|
|
5455
|
+
unlinkSync(join(this.instanceDir, "daemon.pid"));
|
|
5456
|
+
}
|
|
5457
|
+
catch { /* metadata only */ }
|
|
5458
|
+
return;
|
|
5459
|
+
}
|
|
5100
5460
|
// Notify MCP servers of graceful shutdown (prevents reconnect attempts)
|
|
5101
|
-
this.
|
|
5461
|
+
this.broadcastFleetMessage({ type: "shutdown" });
|
|
5102
5462
|
// Quit CLI FIRST — this kills MCP server child processes cleanly.
|
|
5103
5463
|
// IPC must stay open during quit so MCP servers receive the shutdown message.
|
|
5104
5464
|
if (this.tmux) {
|
|
@@ -5244,6 +5604,24 @@ export class Daemon extends EventEmitter {
|
|
|
5244
5604
|
freshChoice: this.recoveryFreshChoice || this.isNewSession && !this.bootSkippedResume, crashLoopFresh: this.recoveryCrashLoopFresh,
|
|
5245
5605
|
cancelled: this.recoveryCancelled, background: this.workingBackgroundObservation };
|
|
5246
5606
|
}
|
|
5607
|
+
/** Observe this host General before its approved switch. No keys, process signals or provider writes. */
|
|
5608
|
+
async generalHostOwner() {
|
|
5609
|
+
const pane = this.tmux, owner = JSON.stringify(this.interactionOwner());
|
|
5610
|
+
if (!this.config.general_topic || this.nativePaneLifecycle || !pane || !/^@\d+$/.test(pane.getWindowId()))
|
|
5611
|
+
throw Error("General host owner is unavailable");
|
|
5612
|
+
const status = await pane.getPaneStatus();
|
|
5613
|
+
if (!status?.alive || !status.pid || status.pid <= 1)
|
|
5614
|
+
throw Error("General host process cannot be proven");
|
|
5615
|
+
const checkpoint = await this.transcriptMonitor?.reconciliationCheckpoint();
|
|
5616
|
+
if (this.tmux !== pane || owner !== JSON.stringify(this.interactionOwner()))
|
|
5617
|
+
throw Error("General host owner changed during observation");
|
|
5618
|
+
const backend = this.config.backend ?? "claude-code";
|
|
5619
|
+
let sessionId = this.backend?.getSessionId() ?? undefined;
|
|
5620
|
+
if (backend === "codex" && checkpoint)
|
|
5621
|
+
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];
|
|
5622
|
+
return { kind: "tmux", windowId: pane.getWindowId(), pid: status.pid,
|
|
5623
|
+
...(typeof sessionId === "string" && sessionId.length > 0 && sessionId.length <= 256 && !/[\p{Cc}\p{Cf}]/u.test(sessionId) ? { pin: { backend, sessionId } } : {}) };
|
|
5624
|
+
}
|
|
5247
5625
|
/** Local system work: no user turn, channel reply target, wake or replay of an original request. */
|
|
5248
5626
|
async deliverWorkingRecovery(content, delivery, admitted) {
|
|
5249
5627
|
const tmux = this.tmux, owner = JSON.stringify(this.interactionOwner()), epoch = this.deliveryEpoch;
|
|
@@ -5264,7 +5642,11 @@ export class Daemon extends EventEmitter {
|
|
|
5264
5642
|
|| !this.paneAuthoritativelyIdle(pane) || this.inputTransientInPane(pane)
|
|
5265
5643
|
|| this.backend?.backgroundWorkRunning?.(pane) === true)
|
|
5266
5644
|
return;
|
|
5267
|
-
if (
|
|
5645
|
+
if (this.nativePaneLifecycle ? !this.nativePaneLifecycle.current() || this.nativePaneLifecycle.mcpProof() !== "alive"
|
|
5646
|
+
|| !!this.backend?.isDeliveryInputReadyPane && !this.backend.isDeliveryInputReadyPane(pane)
|
|
5647
|
+
: await tmux.getPaneInputMode?.() !== "raw")
|
|
5648
|
+
return;
|
|
5649
|
+
if (!current())
|
|
5268
5650
|
return;
|
|
5269
5651
|
const evidence = await this.durableAttemptEvidence(tmux.getWindowId(), false, false);
|
|
5270
5652
|
if (!current())
|
|
@@ -5355,7 +5737,7 @@ export class Daemon extends EventEmitter {
|
|
|
5355
5737
|
this.logger.debug({ err }, "Interaction listener failed");
|
|
5356
5738
|
}
|
|
5357
5739
|
try {
|
|
5358
|
-
this.
|
|
5740
|
+
this.broadcastFleetMessage({ type: "instance_interaction", instanceName: this.name, interaction });
|
|
5359
5741
|
}
|
|
5360
5742
|
catch (err) {
|
|
5361
5743
|
this.logger.debug({ err }, "Interaction broadcast failed");
|
|
@@ -5443,6 +5825,56 @@ export class Daemon extends EventEmitter {
|
|
|
5443
5825
|
}
|
|
5444
5826
|
return true;
|
|
5445
5827
|
}
|
|
5828
|
+
/** Shared Fleet inputs: socket and native transports retain the same wake, epoch and raw-paste semantics. */
|
|
5829
|
+
handleFleetMessage(msg, send, current = () => true) {
|
|
5830
|
+
if (msg.type === "query_sessions") {
|
|
5831
|
+
send({ type: "query_sessions_response", sessions: [] });
|
|
5832
|
+
}
|
|
5833
|
+
else if (msg.type === "fleet_inbound") {
|
|
5834
|
+
const meta = msg.meta;
|
|
5835
|
+
const targetSession = msg.targetSession;
|
|
5836
|
+
const deliveryEpoch = this.captureDeliveryEpoch(msg.delivery_epoch);
|
|
5837
|
+
void this.wake().then(() => {
|
|
5838
|
+
if (!current()) {
|
|
5839
|
+
this.deferDurableDelivery(meta, "native channel owner changed before pane submission");
|
|
5840
|
+
return;
|
|
5841
|
+
}
|
|
5842
|
+
this.pushChannelMessage(msg.content, meta, targetSession, deliveryEpoch);
|
|
5843
|
+
}).catch(err => {
|
|
5844
|
+
this.deferDurableDelivery(meta, `target wake failed before pane submission: ${err.message}`);
|
|
5845
|
+
this.logger.error({ err: err.message }, "Wake failed for inbound delivery");
|
|
5846
|
+
});
|
|
5847
|
+
}
|
|
5848
|
+
else if (msg.type === "raw_paste") {
|
|
5849
|
+
this.handleRawPasteIpcMessage(msg);
|
|
5850
|
+
}
|
|
5851
|
+
else if (msg.type === "config_update") {
|
|
5852
|
+
this.applyConfigUpdate(msg.config);
|
|
5853
|
+
}
|
|
5854
|
+
else if (msg.type === "steer") {
|
|
5855
|
+
const meta = (msg.meta ?? {});
|
|
5856
|
+
this.steerMessage(msg.content, meta, this.captureDeliveryEpoch(msg.delivery_epoch));
|
|
5857
|
+
}
|
|
5858
|
+
else if (msg.type === "btw") {
|
|
5859
|
+
const meta = (msg.meta ?? {});
|
|
5860
|
+
this.btwMessage(msg.content, meta, this.captureDeliveryEpoch(msg.delivery_epoch));
|
|
5861
|
+
}
|
|
5862
|
+
else if (msg.type === "fleet_schedule_trigger") {
|
|
5863
|
+
const payload = msg.payload;
|
|
5864
|
+
const meta = msg.meta;
|
|
5865
|
+
const deliveryEpoch = this.captureDeliveryEpoch(msg.delivery_epoch);
|
|
5866
|
+
void this.wake().then(() => { if (current())
|
|
5867
|
+
this.pushChannelMessage(payload.message, meta, undefined, deliveryEpoch); }).catch(err => {
|
|
5868
|
+
this.logger.error({ err: err.message }, "Wake failed for scheduled delivery");
|
|
5869
|
+
});
|
|
5870
|
+
}
|
|
5871
|
+
else if (msg.type === "query_instance_state") {
|
|
5872
|
+
void this.respondToInstanceStateQuery(msg, undefined, send);
|
|
5873
|
+
}
|
|
5874
|
+
else
|
|
5875
|
+
return false;
|
|
5876
|
+
return true;
|
|
5877
|
+
}
|
|
5446
5878
|
/**
|
|
5447
5879
|
* Answer a FleetManager state query. Most callers only need the cached state,
|
|
5448
5880
|
* but lifecycle decisions such as post-reply Cancel retirement need an
|
|
@@ -5450,7 +5882,7 @@ export class Daemon extends EventEmitter {
|
|
|
5450
5882
|
* the last transition can stay "working" even though the CLI has since
|
|
5451
5883
|
* settled without emitting another control-mode output record.
|
|
5452
5884
|
*/
|
|
5453
|
-
async respondToInstanceStateQuery(msg, socket) {
|
|
5885
|
+
async respondToInstanceStateQuery(msg, socket, send) {
|
|
5454
5886
|
try {
|
|
5455
5887
|
if (msg.deliveryIdle === true) {
|
|
5456
5888
|
await this.captureAndEvaluateInstanceState("delivery_idle_gate");
|
|
@@ -5459,7 +5891,7 @@ export class Daemon extends EventEmitter {
|
|
|
5459
5891
|
await this.captureAndEvaluateInstanceState("state_query");
|
|
5460
5892
|
}
|
|
5461
5893
|
const snapshot = this.getInstanceStateSnapshot();
|
|
5462
|
-
|
|
5894
|
+
const reply = {
|
|
5463
5895
|
type: "instance_state_response",
|
|
5464
5896
|
requestId: msg.requestId,
|
|
5465
5897
|
instanceName: this.name,
|
|
@@ -5467,7 +5899,11 @@ export class Daemon extends EventEmitter {
|
|
|
5467
5899
|
state: this.isPaused ? "paused" : snapshot.state,
|
|
5468
5900
|
processStatus: this.processStatus,
|
|
5469
5901
|
pausedAt: this.lastPausedAt,
|
|
5470
|
-
}
|
|
5902
|
+
};
|
|
5903
|
+
if (send)
|
|
5904
|
+
send(reply);
|
|
5905
|
+
else if (socket)
|
|
5906
|
+
this.ipcServer?.send(socket, reply);
|
|
5471
5907
|
}
|
|
5472
5908
|
catch (err) {
|
|
5473
5909
|
this.logger.debug({ err: err.message }, "Instance state query failed");
|
|
@@ -5507,7 +5943,49 @@ export class Daemon extends EventEmitter {
|
|
|
5507
5943
|
static AUTH_RECONFIRM_ROWS = 15;
|
|
5508
5944
|
/** Why the deferred pause was requested; what its marker records (Phase 2a). */
|
|
5509
5945
|
pendingPauseReason = "auth";
|
|
5946
|
+
nativePauseProof = null;
|
|
5947
|
+
/** Consume the exact idle proof synchronously after the lifecycle's await, before fencing and closing. */
|
|
5948
|
+
nativePauseStillReady() {
|
|
5949
|
+
const proof = this.nativePauseProof;
|
|
5950
|
+
this.nativePauseProof = null;
|
|
5951
|
+
if (proof?.())
|
|
5952
|
+
return true;
|
|
5953
|
+
this.pauseRequested = false;
|
|
5954
|
+
return false;
|
|
5955
|
+
}
|
|
5956
|
+
/** Native lifecycle pause uses the ordinary idle/background/admission proof before closing its owned Job. */
|
|
5957
|
+
async nativePauseReady(admission) {
|
|
5958
|
+
this.nativePauseProof = null;
|
|
5959
|
+
const native = this.nativePaneLifecycle, pane = this.tmux, owner = this.interactionOwner();
|
|
5960
|
+
const allowStuck = this.pauseAllowStuck;
|
|
5961
|
+
this.pauseAllowStuck = false;
|
|
5962
|
+
const ready = () => !!native && native === this.nativePaneLifecycle && native.current() && this.tmux === pane
|
|
5963
|
+
&& sameInteractionOwner(owner, this.interactionOwner()) && !this.runtimeMonitorsFrozen && !this.spawning
|
|
5964
|
+
&& this.processStatus === "running" && this.pasteQueueDepth === 0
|
|
5965
|
+
&& (this.instanceState === "idle" || allowStuck && this.instanceState === "stuck") && (!admission || admission.current());
|
|
5966
|
+
if (!pane || !ready()) {
|
|
5967
|
+
this.pauseRequested = false;
|
|
5968
|
+
return false;
|
|
5969
|
+
}
|
|
5970
|
+
let text;
|
|
5971
|
+
try {
|
|
5972
|
+
text = await pane.capturePane();
|
|
5973
|
+
}
|
|
5974
|
+
catch {
|
|
5975
|
+
this.pauseRequested = false;
|
|
5976
|
+
return false;
|
|
5977
|
+
}
|
|
5978
|
+
if (!ready() || admission && !admission.accepts(text) || this.backend?.backgroundWorkRunning?.(text)
|
|
5979
|
+
|| !allowStuck && !this.paneAuthoritativelyIdle(text)) {
|
|
5980
|
+
this.pauseRequested = false;
|
|
5981
|
+
return false;
|
|
5982
|
+
}
|
|
5983
|
+
this.nativePauseProof = ready;
|
|
5984
|
+
return true;
|
|
5985
|
+
}
|
|
5510
5986
|
async pause(reason = "operator", admission) {
|
|
5987
|
+
if (this.nativePaneLifecycle)
|
|
5988
|
+
throw Error("Native pause is owned by its Fleet lifecycle transition");
|
|
5511
5989
|
if (admission && !admission.current())
|
|
5512
5990
|
return;
|
|
5513
5991
|
if (this.pauseWakeState === "paused")
|
|
@@ -5603,7 +6081,7 @@ export class Daemon extends EventEmitter {
|
|
|
5603
6081
|
writePausedMarker(this.instanceDir, this.lastPausedAt ?? Date.now(), reason);
|
|
5604
6082
|
this.publishWorkingState("execution");
|
|
5605
6083
|
this.logger.info({ pausedAt: this.lastPausedAt }, "Instance auto-paused");
|
|
5606
|
-
this.
|
|
6084
|
+
this.broadcastFleetMessage({
|
|
5607
6085
|
type: "instance_state", instanceName: this.name, state: "paused", pausedAt: this.lastPausedAt,
|
|
5608
6086
|
});
|
|
5609
6087
|
this.emit("auto_paused", { name: this.name, pausedAt: this.lastPausedAt });
|
|
@@ -5698,7 +6176,7 @@ export class Daemon extends EventEmitter {
|
|
|
5698
6176
|
this.resumeRuntimeMonitors();
|
|
5699
6177
|
this.publishWorkingState("execution");
|
|
5700
6178
|
this.logger.info("Instance auto-woke");
|
|
5701
|
-
this.
|
|
6179
|
+
this.broadcastFleetMessage({
|
|
5702
6180
|
type: "instance_state", instanceName: this.name, state: this.instanceState, pausedAt: null,
|
|
5703
6181
|
});
|
|
5704
6182
|
this.emit("auto_woke", { name: this.name });
|
|
@@ -5862,7 +6340,7 @@ export class Daemon extends EventEmitter {
|
|
|
5862
6340
|
this.logStateEdge(previous, snapshot);
|
|
5863
6341
|
this.publishWorkingState("execution");
|
|
5864
6342
|
this.emit("instance_state", { name: this.name, ...snapshot });
|
|
5865
|
-
this.
|
|
6343
|
+
this.broadcastFleetMessage({ type: "instance_state", instanceName: this.name, ...snapshot });
|
|
5866
6344
|
if (snapshot.state === "stuck" && pane && this.instanceStateReadyPattern) {
|
|
5867
6345
|
this.handleStuckTransition(pane, snapshot, this.instanceStateReadyPattern);
|
|
5868
6346
|
}
|
|
@@ -5964,7 +6442,7 @@ export class Daemon extends EventEmitter {
|
|
|
5964
6442
|
// writing a marker would re-inject a continuation for a finished turn.
|
|
5965
6443
|
// #3030: a message only queued in the busy CLI has not started a turn: the interrupted turn is still the running one,
|
|
5966
6444
|
// and a queued message lost to a restart is the hand-off record's to redeliver, not a continuation's.
|
|
5967
|
-
if (!meta.resumedContinuationOf && !armed.completionDelivered && !queuedHandoff) {
|
|
6445
|
+
if (!this.nativePaneLifecycle && !meta.resumedContinuationOf && !armed.completionDelivered && !queuedHandoff) {
|
|
5968
6446
|
const resumeBackend = this.config.backend ?? this.backend?.binaryName ?? this.runtimeIdentity?.backend;
|
|
5969
6447
|
const resumeCwd = this.config.working_directory ?? "";
|
|
5970
6448
|
writeInFlightTurnMarker(this.instanceDir, {
|
|
@@ -6196,7 +6674,7 @@ export class Daemon extends EventEmitter {
|
|
|
6196
6674
|
// outbound action suppresses a duplicate proxy; only a delivered
|
|
6197
6675
|
// human-facing channel action satisfies the completion guard below.
|
|
6198
6676
|
if (!turn.outboundDelivered && this.config.mcp_proxy_reply === true
|
|
6199
|
-
&& mcpServerState(this.instanceDir).state === "dead") {
|
|
6677
|
+
&& (this.nativePaneLifecycle ? this.nativePaneLifecycle.mcpProof() === "dead" : mcpServerState(this.instanceDir).state === "dead")) {
|
|
6200
6678
|
this.turnReplyGuard.complete(turn.generation);
|
|
6201
6679
|
void this.sendProxyReply(pane, turn.target);
|
|
6202
6680
|
return;
|
|
@@ -6296,21 +6774,37 @@ export class Daemon extends EventEmitter {
|
|
|
6296
6774
|
|| this.config.backend === "claude-code"
|
|
6297
6775
|
|| this.backend?.binaryName === "claude";
|
|
6298
6776
|
}
|
|
6777
|
+
/** #3160: this agent's file steps in its current turn (the CLI's own record), for the Files & changes panel. */
|
|
6778
|
+
followLog = new FollowLog();
|
|
6779
|
+
workspaceFollow(after = 0, turn, scope) { return this.followLog.snapshot(after, turn, scope); }
|
|
6299
6780
|
/**
|
|
6300
6781
|
* This launch's transcript monitor. #1510: its turn boundaries feed the reply guard's ledger, which starts empty
|
|
6301
6782
|
* with it — a new monitor re-baselines at the transcript's end, so nothing the old one read can be attributed.
|
|
6302
6783
|
*/
|
|
6303
6784
|
buildTranscriptMonitor(source) {
|
|
6785
|
+
this.followLog.reset();
|
|
6304
6786
|
const monitor = new TranscriptMonitor(this.instanceDir, this.logger, source);
|
|
6305
6787
|
this.transcriptTurns.reset();
|
|
6306
6788
|
this.transcriptActivityAt = 0;
|
|
6307
6789
|
// Monotonic: a wall-clock correction must neither end nor extend the open-turn hold (#1641 R1).
|
|
6308
6790
|
const touch = () => { this.transcriptActivityAt = performance.now(); };
|
|
6309
|
-
monitor.on("turns", (turns) => {
|
|
6791
|
+
monitor.on("turns", (turns) => {
|
|
6792
|
+
this.transcriptTurns.observe(turns, performance.now());
|
|
6793
|
+
touch();
|
|
6794
|
+
});
|
|
6795
|
+
// #3160: the files this turn reads, edits and searches, for the Files & changes panel's Follow (a few string checks;
|
|
6796
|
+
// nothing is read from disk until someone asks). Claude's turn boundary is its next prompt.
|
|
6797
|
+
const canFollow = () => this.transcriptMonitor === monitor && this.config.runtime !== "windows"
|
|
6798
|
+
&& (this.backend?.binaryName === "claude" || this.backend?.binaryName === "codex");
|
|
6799
|
+
monitor.on("workspace_follow", (event) => { if (canFollow())
|
|
6800
|
+
this.followLog.observe(event); });
|
|
6801
|
+
monitor.on("workspace_reset", () => { if (this.transcriptMonitor === monitor)
|
|
6802
|
+
this.followLog.reset(); });
|
|
6310
6803
|
// #1641 R2: a re-baselined source starts over, and so does what it said (an open turn read before is withdrawn).
|
|
6311
6804
|
monitor.on("reset", () => { if (this.transcriptMonitor === monitor) {
|
|
6312
6805
|
this.transcriptTurns.reset();
|
|
6313
6806
|
this.transcriptActivityAt = 0;
|
|
6807
|
+
this.followLog.reset();
|
|
6314
6808
|
} });
|
|
6315
6809
|
for (const event of ["tool_use", "tool_result", "assistant_text"])
|
|
6316
6810
|
monitor.on(event, touch);
|
|
@@ -6573,7 +7067,7 @@ export class Daemon extends EventEmitter {
|
|
|
6573
7067
|
}
|
|
6574
7068
|
});
|
|
6575
7069
|
}
|
|
6576
|
-
if (!this.
|
|
7070
|
+
if (!this.fleetTransportAvailable()) {
|
|
6577
7071
|
this.logger.error(`${logLabel} failed — no adapter or fleet IPC route`);
|
|
6578
7072
|
return Promise.resolve(false);
|
|
6579
7073
|
}
|
|
@@ -6597,7 +7091,7 @@ export class Daemon extends EventEmitter {
|
|
|
6597
7091
|
resolve(delivered);
|
|
6598
7092
|
});
|
|
6599
7093
|
try {
|
|
6600
|
-
this.
|
|
7094
|
+
this.broadcastFleetMessage({
|
|
6601
7095
|
type: "fleet_outbound",
|
|
6602
7096
|
tool: "reply",
|
|
6603
7097
|
args,
|
|
@@ -7168,7 +7662,7 @@ export class Daemon extends EventEmitter {
|
|
|
7168
7662
|
if (next === this.currentActivity)
|
|
7169
7663
|
return;
|
|
7170
7664
|
this.currentActivity = next;
|
|
7171
|
-
this.
|
|
7665
|
+
this.broadcastFleetMessage({
|
|
7172
7666
|
type: "instance_activity",
|
|
7173
7667
|
instanceName: this.name,
|
|
7174
7668
|
activity: next,
|
|
@@ -7221,6 +7715,10 @@ export class Daemon extends EventEmitter {
|
|
|
7221
7715
|
else if (update.reply_completion_guard === null) {
|
|
7222
7716
|
delete this.config.reply_completion_guard;
|
|
7223
7717
|
}
|
|
7718
|
+
if (update.quota_notice === null)
|
|
7719
|
+
delete this.config.quota_notice;
|
|
7720
|
+
else if (update.quota_notice !== undefined && !quotaNoticeProblem(update.quota_notice))
|
|
7721
|
+
this.config.quota_notice = structuredClone(update.quota_notice);
|
|
7224
7722
|
if (typeof update.mcp_proxy_reply === "boolean")
|
|
7225
7723
|
this.config.mcp_proxy_reply = update.mcp_proxy_reply;
|
|
7226
7724
|
else if (update.mcp_proxy_reply === null)
|
|
@@ -7245,7 +7743,7 @@ export class Daemon extends EventEmitter {
|
|
|
7245
7743
|
else
|
|
7246
7744
|
this.config.auto_pause_after = nextAutoPause;
|
|
7247
7745
|
if (nextAutoPause !== previousAutoPause) {
|
|
7248
|
-
const isGeneral = this.config.general_topic === true || this.name
|
|
7746
|
+
const isGeneral = this.config.general_topic === true || generalByName(this.name, this.config);
|
|
7249
7747
|
this.autoPauseController.reconfigure((isGeneral ? 0 : nextAutoPause) * 60_000);
|
|
7250
7748
|
}
|
|
7251
7749
|
}
|
|
@@ -7325,7 +7823,7 @@ export class Daemon extends EventEmitter {
|
|
|
7325
7823
|
return;
|
|
7326
7824
|
this.lastProgressBroadcast = rendered;
|
|
7327
7825
|
this.lastProgressBroadcastAt = Date.now();
|
|
7328
|
-
this.
|
|
7826
|
+
this.broadcastFleetMessage({
|
|
7329
7827
|
type: "instance_progress",
|
|
7330
7828
|
instanceName: this.name,
|
|
7331
7829
|
progress: rendered,
|
|
@@ -7341,7 +7839,7 @@ export class Daemon extends EventEmitter {
|
|
|
7341
7839
|
if (this.lastProgressBroadcast !== "") {
|
|
7342
7840
|
this.lastProgressBroadcast = "";
|
|
7343
7841
|
this.lastProgressBroadcastAt = Date.now();
|
|
7344
|
-
this.
|
|
7842
|
+
this.broadcastFleetMessage({ type: "instance_progress", instanceName: this.name, progress: "" });
|
|
7345
7843
|
}
|
|
7346
7844
|
}
|
|
7347
7845
|
/**
|
|
@@ -7508,7 +8006,7 @@ export class Daemon extends EventEmitter {
|
|
|
7508
8006
|
reportCrossInstanceDeliveryFailure(meta, verdict, error) {
|
|
7509
8007
|
if (!meta.from_instance)
|
|
7510
8008
|
return;
|
|
7511
|
-
this.
|
|
8009
|
+
this.broadcastFleetMessage({
|
|
7512
8010
|
type: "cross_instance_delivery_failed",
|
|
7513
8011
|
senderSession: meta.from_instance,
|
|
7514
8012
|
targetInstance: this.name,
|
|
@@ -8889,13 +9387,14 @@ export class Daemon extends EventEmitter {
|
|
|
8889
9387
|
if (this.remoteCardAnswering)
|
|
8890
9388
|
return { outcome: "refused", reason: "another answer to this card is being keyed in" };
|
|
8891
9389
|
this.remoteCardAnswering = true;
|
|
9390
|
+
let answerScreen = null;
|
|
8892
9391
|
try {
|
|
8893
9392
|
const outcome = await answerRemoteCard({
|
|
8894
9393
|
locked: fn => this.paneWriteLock.run(fn),
|
|
8895
9394
|
// An unreadable screen (a failed capture, another spawn's pane) is unknown — never "the card closed".
|
|
8896
|
-
read: () => this.tmux === tmux ? tmux.capturePane().catch(() => null) :
|
|
8897
|
-
key: key => this.tmux !== tmux ? Promise.resolve(false) : key === "Space" ? tmux.sendKeys(" ") : tmux.sendSpecialKey(key),
|
|
8898
|
-
paste: text => this.tmux !== tmux ? Promise.resolve(false) : tmux.pasteBuffer(text),
|
|
9395
|
+
read: async () => answerScreen = this.tmux === tmux ? await tmux.capturePane().catch(() => null) : null,
|
|
9396
|
+
key: key => this.tmux !== tmux || answerScreen === null ? Promise.resolve(false) : key === "Space" ? (this.nativePaneLifecycle ? tmux.sendKeys(" ", { kind: "dialog", screen: answerScreen }) : tmux.sendKeys(" ")) : (this.nativePaneLifecycle ? tmux.sendSpecialKey(key, undefined, { kind: "dialog", screen: answerScreen }) : tmux.sendSpecialKey(key)),
|
|
9397
|
+
paste: text => this.tmux !== tmux || answerScreen === null ? Promise.resolve(false) : this.nativePaneLifecycle ? tmux.pasteBuffer(text, { proof: { kind: "dialog", screen: answerScreen } }) : tmux.pasteBuffer(text),
|
|
8899
9398
|
sleep: ms => new Promise(resolve => setTimeout(resolve, ms)),
|
|
8900
9399
|
now: () => performance.now(),
|
|
8901
9400
|
}, pane => {
|
|
@@ -9166,12 +9665,19 @@ export class Daemon extends EventEmitter {
|
|
|
9166
9665
|
if (!check || !this.tmux)
|
|
9167
9666
|
return !check;
|
|
9168
9667
|
try {
|
|
9169
|
-
const
|
|
9170
|
-
|
|
9668
|
+
const inputActive = this.nativePaneLifecycle
|
|
9669
|
+
? this.nativePaneLifecycle.current() && this.nativePaneLifecycle.mcpProof() === "alive"
|
|
9670
|
+
: await this.tmux.getPaneInputMode?.() === "raw";
|
|
9671
|
+
// ConPTY has no POSIX termios mode. Its closed launch plus current helper handshake is the input barrier;
|
|
9672
|
+
// the same strict composer detector below is still required. Never grant native unknown-layout fallback.
|
|
9673
|
+
if (!inputActive) {
|
|
9171
9674
|
this.resetFooterFallback();
|
|
9172
9675
|
return false;
|
|
9173
9676
|
}
|
|
9174
|
-
|
|
9677
|
+
const pane = await this.tmux.capturePane();
|
|
9678
|
+
if (this.nativePaneLifecycle && (!this.nativePaneLifecycle.current() || this.nativePaneLifecycle.mcpProof() !== "alive"))
|
|
9679
|
+
return false;
|
|
9680
|
+
return this.deliveryInputReadyPane(pane);
|
|
9175
9681
|
}
|
|
9176
9682
|
catch {
|
|
9177
9683
|
this.resetFooterFallback();
|
|
@@ -9790,9 +10296,9 @@ export class Daemon extends EventEmitter {
|
|
|
9790
10296
|
* moment the flag clears.
|
|
9791
10297
|
*/
|
|
9792
10298
|
refuseFatalStartupDelivery(verdict, status) {
|
|
9793
|
-
if (!this.fatalStartupBlocked)
|
|
10299
|
+
if (!this.fatalStartupBlocked && !this.modelMinimumBlocked)
|
|
9794
10300
|
return false;
|
|
9795
|
-
this.logger.error("Delivery refused — CLI
|
|
10301
|
+
this.logger.error("Delivery refused — CLI startup or model-version repair is held");
|
|
9796
10302
|
this.failDelivery(verdict, status, "fatal-startup", "blocked-before-write");
|
|
9797
10303
|
return true;
|
|
9798
10304
|
}
|
|
@@ -9945,34 +10451,86 @@ export class Daemon extends EventEmitter {
|
|
|
9945
10451
|
// tmux object and window — so the spawn generation and launch fence are part of the fence too: an Enter meant for
|
|
9946
10452
|
// the CLI this paste went to is never sent to its successor.
|
|
9947
10453
|
const tmux = this.tmux;
|
|
10454
|
+
const backend = this.backend;
|
|
10455
|
+
const native = !!this.nativePaneLifecycle;
|
|
9948
10456
|
const generation = this.spawnGeneration;
|
|
9949
10457
|
const fence = this.launchFenceEpoch;
|
|
10458
|
+
const windowId = native ? tmux?.getWindowId() : undefined;
|
|
10459
|
+
// M-2290 (#2985 review, Fable): the mode wait can last up to 10 minutes, and a respawn or relaunch reuses the same
|
|
10460
|
+
// tmux object and window — so the spawn generation and launch fence are part of every pane's fence: an Enter meant
|
|
10461
|
+
// for the CLI this paste went to is never sent to its successor. A native Windows pane keeps #2958's full fence too
|
|
10462
|
+
// (its launch can be replaced under the same handle).
|
|
9950
10463
|
const current = () => this.tmux === tmux && this.spawnGeneration === generation && this.launchFenceEpoch === fence
|
|
9951
|
-
&& !this.deliveryWritesStopping && (!stillCurrent || stillCurrent())
|
|
10464
|
+
&& !this.deliveryWritesStopping && (!stillCurrent || stillCurrent())
|
|
10465
|
+
&& (!native || (!!windowId && !!backend && this.backend === backend && tmux.getWindowId() === windowId));
|
|
9952
10466
|
if (!current())
|
|
9953
10467
|
return false;
|
|
9954
10468
|
// The pasted text may still be in the box: the caller keeps it uncertain (no false failure, no second paste).
|
|
9955
|
-
|
|
9956
|
-
|
|
9957
|
-
|
|
10469
|
+
// S-35: say which check withheld Enter.
|
|
10470
|
+
const hold = (reason) => {
|
|
10471
|
+
onInputHeld?.(reason);
|
|
10472
|
+
if (reason === "output_changed" && current() && !this.nativeDeliveryHold())
|
|
10473
|
+
this.nativeEnterHold = {
|
|
10474
|
+
key: `${this.bootId}:${generation}:${fence}`, since: Date.now(), spawn: generation, fence,
|
|
10475
|
+
};
|
|
10476
|
+
if (reason === "pane-in-mode")
|
|
10477
|
+
this.logger.warn({ phase, reason }, "The pane stayed in a tmux mode; Enter withheld");
|
|
10478
|
+
else
|
|
10479
|
+
this.logger.warn({ ...tmux?.getLastInputDiagnostic?.(), phase, reason, retryCount: positiveRefusals }, "Native delivery Enter withheld by its safety check");
|
|
9958
10480
|
return false;
|
|
9959
10481
|
};
|
|
9960
10482
|
// 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
|
|
9961
10483
|
// end, then look once more within the same deadline — a pane flickering back into a mode is waited out again, never
|
|
9962
|
-
// past the bound.
|
|
9963
|
-
//
|
|
10484
|
+
// past the bound.
|
|
10485
|
+
// Native delivery follows main #2990: only this backend's recognised runtime dialog vetoes Enter.
|
|
10486
|
+
// The fresh capture still binds the native host output sequence; ownership and positive-ACK-only retries remain.
|
|
9964
10487
|
const modeDeadline = performance.now() + PANE_MODE_ENTER_WAIT_MS;
|
|
10488
|
+
let pane;
|
|
10489
|
+
let positiveRefusals = 0, enterMarked = false, positiveRetryDeadline = Infinity, linuxDialogRead = false;
|
|
9965
10490
|
for (;;) {
|
|
9966
|
-
const mode = await this.waitWhilePaneInMode(phase, current, modeDeadline);
|
|
10491
|
+
const mode = await this.waitWhilePaneInMode(phase, current, Math.min(modeDeadline, positiveRetryDeadline));
|
|
9967
10492
|
if (mode === "stale")
|
|
9968
10493
|
return false;
|
|
9969
10494
|
if (mode === "held")
|
|
9970
|
-
return hold();
|
|
10495
|
+
return hold("pane-in-mode");
|
|
10496
|
+
if (native) {
|
|
10497
|
+
// S-35: a native pane's capture refuses while output is still arriving ("Pane changed during capture; observe it
|
|
10498
|
+
// again"). Right after a turn the CLI repaints for a moment; one refused read left the message unsent for ever.
|
|
10499
|
+
// Read again a few times — reading types nothing — and still hold if it never settles.
|
|
10500
|
+
let captured;
|
|
10501
|
+
for (let attempt = 0; captured === undefined; attempt++) {
|
|
10502
|
+
try {
|
|
10503
|
+
captured = await tmux.capturePane();
|
|
10504
|
+
}
|
|
10505
|
+
catch {
|
|
10506
|
+
if (!current())
|
|
10507
|
+
return false;
|
|
10508
|
+
if (attempt >= 4)
|
|
10509
|
+
return hold("capture_failed");
|
|
10510
|
+
await new Promise(done => setTimeout(done, 150 * (attempt + 1)));
|
|
10511
|
+
if (!current())
|
|
10512
|
+
return false;
|
|
10513
|
+
}
|
|
10514
|
+
}
|
|
10515
|
+
const screen = captured;
|
|
10516
|
+
pane = screen;
|
|
10517
|
+
if (!current())
|
|
10518
|
+
return false;
|
|
10519
|
+
try {
|
|
10520
|
+
if (backend?.getRuntimeDialogs?.().some(dialog => Daemon.dialogMatches(dialog, screen)))
|
|
10521
|
+
return hold("dialog");
|
|
10522
|
+
}
|
|
10523
|
+
catch {
|
|
10524
|
+
return hold("check_failed");
|
|
10525
|
+
}
|
|
10526
|
+
if (!current())
|
|
10527
|
+
return false;
|
|
10528
|
+
}
|
|
9971
10529
|
if (await this.paneInTmuxMode(phase)) {
|
|
9972
10530
|
if (!current())
|
|
9973
10531
|
return false;
|
|
9974
10532
|
if (performance.now() >= modeDeadline)
|
|
9975
|
-
return hold();
|
|
10533
|
+
return hold("pane-in-mode");
|
|
9976
10534
|
await new Promise(r => setTimeout(r, PANE_MODE_POLL_MS));
|
|
9977
10535
|
if (!current())
|
|
9978
10536
|
return false;
|
|
@@ -9980,54 +10538,143 @@ export class Daemon extends EventEmitter {
|
|
|
9980
10538
|
}
|
|
9981
10539
|
if (!current())
|
|
9982
10540
|
return false;
|
|
9983
|
-
|
|
9984
|
-
|
|
9985
|
-
|
|
9986
|
-
|
|
9987
|
-
|
|
9988
|
-
|
|
9989
|
-
|
|
9990
|
-
|
|
9991
|
-
|
|
9992
|
-
|
|
9993
|
-
|
|
9994
|
-
|
|
10541
|
+
// M-2290 (the simple half of the #2957 redesign, leader xmsg-1793712561468; main): on a Linux pane, a dialog the
|
|
10542
|
+
// backend RECOGNISES (runtimeDialogs: a permission card, the dangerous-command card, …) that painted between the
|
|
10543
|
+
// paste and this Enter would take the key as its answer. Read the pane once more: such a dialog withholds the
|
|
10544
|
+
// Enter (the caller keeps the delivery uncertain → Needs-you; the dialog scanner parks it for a person). Nothing
|
|
10545
|
+
// else is judged — an unknown or unreadable screen sends: #2958's composer proof (decision f57474aa) is NOT back.
|
|
10546
|
+
// Only a caller that can hold asks (onInputHeld); a native pane read its own screen above, every round.
|
|
10547
|
+
if (!native && onInputHeld && !linuxDialogRead) {
|
|
10548
|
+
linuxDialogRead = true;
|
|
10549
|
+
let finalPane = null;
|
|
10550
|
+
try {
|
|
10551
|
+
finalPane = await tmux.capturePane();
|
|
10552
|
+
}
|
|
10553
|
+
catch {
|
|
10554
|
+
finalPane = null;
|
|
10555
|
+
}
|
|
10556
|
+
if (!current())
|
|
10557
|
+
return false;
|
|
10558
|
+
let dialog;
|
|
10559
|
+
try {
|
|
10560
|
+
dialog = finalPane === null ? undefined : (this.backend?.getRuntimeDialogs?.() ?? []).find(d => Daemon.dialogMatches(d, finalPane))?.description;
|
|
10561
|
+
}
|
|
10562
|
+
catch {
|
|
10563
|
+
dialog = undefined;
|
|
10564
|
+
}
|
|
10565
|
+
if (dialog !== undefined) {
|
|
10566
|
+
onInputHeld("dialog");
|
|
10567
|
+
this.logger.warn({ phase, dialog }, "A dialog is on the pane; the delivery's Enter is withheld (it would answer it)");
|
|
10568
|
+
return false;
|
|
10569
|
+
}
|
|
10570
|
+
}
|
|
10571
|
+
if (positiveRefusals && performance.now() >= positiveRetryDeadline)
|
|
10572
|
+
return hold("output_changed");
|
|
10573
|
+
// W1: persist the "Enter may have happened" boundary before tmux receives
|
|
10574
|
+
// the key. A crash after this commit is never auto-replayed without a
|
|
10575
|
+
// positive transcript marker, even if the stale pane still shows composer.
|
|
10576
|
+
if (!enterMarked && durableAttempt && !this.deliveryOutbox?.markEnterStarted(durableAttempt.deliveryId, this.bootId, durableAttempt.attemptNo)) {
|
|
10577
|
+
this.logger.error({ phase, deliveryId: durableAttempt.deliveryId }, "Could not commit durable Enter write-ahead fence");
|
|
10578
|
+
return false;
|
|
10579
|
+
}
|
|
10580
|
+
enterMarked = true;
|
|
10581
|
+
const sent = await (native && pane !== undefined ? tmux.sendSpecialKey("Enter", undefined, { kind: "delivery", screen: pane, retryCount: positiveRefusals }) : tmux.sendSpecialKey("Enter"));
|
|
10582
|
+
// A busy renderer can change seq after our capture. Only a positive zero-input ACK admits a NEW proof/key;
|
|
10583
|
+
// An Enter retry never re-pastes, retries an uncertain write, reuses stale proof or re-commits the durable boundary.
|
|
10584
|
+
if (!sent && native && tmux.lastInputWasNotSent?.() === true
|
|
10585
|
+
&& tmux.getLastSendSpecialKeyError() === "Pane changed after observation; input was not sent"
|
|
10586
|
+
&& current()) {
|
|
10587
|
+
if (!positiveRefusals)
|
|
10588
|
+
positiveRetryDeadline = Math.min(modeDeadline, performance.now() + 2000);
|
|
10589
|
+
if (positiveRefusals >= 4 || performance.now() >= positiveRetryDeadline)
|
|
10590
|
+
return hold("output_changed");
|
|
10591
|
+
positiveRefusals++;
|
|
10592
|
+
await new Promise(done => setTimeout(done, 100));
|
|
10593
|
+
if (!current())
|
|
10594
|
+
return false;
|
|
10595
|
+
if (performance.now() >= positiveRetryDeadline)
|
|
10596
|
+
return hold("output_changed");
|
|
10597
|
+
continue;
|
|
10598
|
+
}
|
|
10599
|
+
if (!sent) {
|
|
10600
|
+
const details = { phase, tmuxError: this.tmux.getLastSendSpecialKeyError() ?? "unknown tmux send-keys failure" };
|
|
10601
|
+
if (native)
|
|
10602
|
+
this.logger.warn({ ...tmux?.getLastInputDiagnostic?.(), ...details, retryCount: positiveRefusals }, "Native delivery Enter gave up");
|
|
10603
|
+
else
|
|
10604
|
+
this.logger.error(details, "tmux send-keys Enter failed during message delivery");
|
|
10605
|
+
}
|
|
10606
|
+
if (sent && native && current())
|
|
10607
|
+
this.nativeEnterHold = null;
|
|
10608
|
+
return sent;
|
|
10609
|
+
}
|
|
10610
|
+
}
|
|
10611
|
+
/** A pre-existing native busy-paste race: retry bytes only after an exact, owned zero-input acknowledgement. */
|
|
10612
|
+
async sendDeliveryPaste(text, stillCurrent) {
|
|
10613
|
+
const pane = this.tmux, native = this.nativePaneLifecycle;
|
|
10614
|
+
if (!native)
|
|
10615
|
+
return pane.pasteBuffer(text);
|
|
10616
|
+
const backend = this.backend, generation = this.spawnGeneration, fence = this.launchFenceEpoch, windowId = pane.getWindowId();
|
|
10617
|
+
const current = () => !!windowId && this.tmux === pane && this.nativePaneLifecycle === native && this.backend === backend
|
|
10618
|
+
&& this.spawnGeneration === generation && this.launchFenceEpoch === fence && pane.getWindowId() === windowId
|
|
10619
|
+
&& !this.deliveryWritesStopping && (!stillCurrent || stillCurrent());
|
|
10620
|
+
let retryCount = 0;
|
|
10621
|
+
const hold = (reason) => {
|
|
10622
|
+
if (current() && !this.nativeDeliveryHold())
|
|
10623
|
+
this.nativeEnterHold = { key: `${this.bootId}:${generation}:${fence}`, since: Date.now(), spawn: generation, fence };
|
|
10624
|
+
this.logger.warn({ ...pane.getLastInputDiagnostic?.(), reason, retryCount }, "Native delivery paste held by its safety check");
|
|
10625
|
+
return false;
|
|
10626
|
+
};
|
|
10627
|
+
const deadline = performance.now() + 2000;
|
|
10628
|
+
for (let attempt = 0; attempt < 5; attempt++) {
|
|
10629
|
+
retryCount = attempt;
|
|
10630
|
+
if (!current())
|
|
10631
|
+
return false;
|
|
10632
|
+
if (performance.now() >= deadline)
|
|
10633
|
+
return hold("output_changed");
|
|
10634
|
+
let screen;
|
|
10635
|
+
for (let read = 0; read < 5 && screen === undefined; read++) {
|
|
10636
|
+
try {
|
|
10637
|
+
screen = await pane.capturePane();
|
|
10638
|
+
}
|
|
10639
|
+
catch { /* Reads do not construct an input operation. */ }
|
|
10640
|
+
if (!current())
|
|
10641
|
+
return false;
|
|
10642
|
+
if (performance.now() >= deadline)
|
|
10643
|
+
return hold("capture_failed");
|
|
10644
|
+
if (screen === undefined && read < 4)
|
|
10645
|
+
await new Promise(done => setTimeout(done, 100));
|
|
10646
|
+
}
|
|
10647
|
+
if (screen === undefined)
|
|
10648
|
+
return hold("capture_failed");
|
|
9995
10649
|
try {
|
|
9996
|
-
|
|
10650
|
+
if (backend?.getRuntimeDialogs?.().some(dialog => Daemon.dialogMatches(dialog, screen)))
|
|
10651
|
+
return hold("dialog");
|
|
9997
10652
|
}
|
|
9998
10653
|
catch {
|
|
9999
|
-
|
|
10654
|
+
return hold("check_failed");
|
|
10000
10655
|
}
|
|
10001
10656
|
if (!current())
|
|
10002
10657
|
return false;
|
|
10003
|
-
|
|
10658
|
+
if (performance.now() >= deadline)
|
|
10659
|
+
return hold("output_changed");
|
|
10660
|
+
let sent;
|
|
10004
10661
|
try {
|
|
10005
|
-
|
|
10662
|
+
sent = await pane.pasteBuffer(text, { guard: current, proof: { kind: "composer", screen, retryCount: attempt } });
|
|
10006
10663
|
}
|
|
10007
10664
|
catch {
|
|
10008
|
-
|
|
10665
|
+
return hold("unconfirmed");
|
|
10009
10666
|
}
|
|
10010
|
-
if (
|
|
10011
|
-
|
|
10012
|
-
|
|
10667
|
+
if (sent)
|
|
10668
|
+
return true; // Exactly one successful paste ends the loop, before any Enter.
|
|
10669
|
+
if (!current())
|
|
10013
10670
|
return false;
|
|
10014
|
-
|
|
10015
|
-
|
|
10016
|
-
|
|
10017
|
-
|
|
10018
|
-
|
|
10019
|
-
if (durableAttempt && !this.deliveryOutbox?.markEnterStarted(durableAttempt.deliveryId, this.bootId, durableAttempt.attemptNo)) {
|
|
10020
|
-
this.logger.error({ phase, deliveryId: durableAttempt.deliveryId }, "Could not commit durable Enter write-ahead fence");
|
|
10021
|
-
return false;
|
|
10022
|
-
}
|
|
10023
|
-
const sent = await tmux.sendSpecialKey("Enter");
|
|
10024
|
-
if (!sent) {
|
|
10025
|
-
this.logger.error({
|
|
10026
|
-
phase,
|
|
10027
|
-
tmuxError: this.tmux.getLastSendSpecialKeyError() ?? "unknown tmux send-keys failure",
|
|
10028
|
-
}, "tmux send-keys Enter failed during message delivery");
|
|
10671
|
+
if (pane.lastInputWasNotSent?.() !== true || pane.getLastPasteError?.() !== "Pane changed after observation; input was not sent")
|
|
10672
|
+
return hold("unconfirmed");
|
|
10673
|
+
if (attempt >= 4 || performance.now() >= deadline)
|
|
10674
|
+
return hold("output_changed");
|
|
10675
|
+
await new Promise(done => setTimeout(done, 100));
|
|
10029
10676
|
}
|
|
10030
|
-
return
|
|
10677
|
+
return hold("output_changed");
|
|
10031
10678
|
}
|
|
10032
10679
|
async writeMessageToPane(formatted, initialWindowId, handingOffToNativeQueue, status, submissionId,
|
|
10033
10680
|
// Last and defaulted so the positional callers that ignore the outcome stay
|
|
@@ -10065,6 +10712,9 @@ export class Daemon extends EventEmitter {
|
|
|
10065
10712
|
const tmuxAtWrite = this.tmux;
|
|
10066
10713
|
const steerCurrent = () => (!stillCurrent || stillCurrent()) && !this.deliveryWritesStopping
|
|
10067
10714
|
&& this.tmux === tmuxAtWrite && this.spawnGeneration === spawnAtWrite;
|
|
10715
|
+
// Alpha (S-36, Prism #2989 P2): a NATIVE pane keeps #2958's pre-paste owner fence through the initial Enter and every
|
|
10716
|
+
// retry Enter (a pane replaced while the paste awaits never takes this delivery's Enter); a tmux pane follows main.
|
|
10717
|
+
const nativeOwner = this.nativePaneLifecycle ? steerCurrent : undefined;
|
|
10068
10718
|
// Bug A: paste with backoff. Transient failures are usually a stale window id
|
|
10069
10719
|
// after a crash/respawn — recover by name and retry (max 3 attempts, 2s apart).
|
|
10070
10720
|
const maxAttempts = 3;
|
|
@@ -10132,8 +10782,8 @@ export class Daemon extends EventEmitter {
|
|
|
10132
10782
|
}
|
|
10133
10783
|
verdict.durableBeginCommitted = true;
|
|
10134
10784
|
verdict.submissionMode = attemptEvidence.submissionMode;
|
|
10135
|
-
if (attemptEvidence.transcriptPath && attemptEvidence.transcriptOffset !== null) {
|
|
10136
|
-
verdict.transcriptCheckpoint = {
|
|
10785
|
+
if (attemptEvidence.runtimeTranscript || attemptEvidence.transcriptPath && attemptEvidence.transcriptOffset !== null) {
|
|
10786
|
+
verdict.transcriptCheckpoint = attemptEvidence.runtimeTranscript ? { backend: attemptEvidence.backend, runtime: attemptEvidence.runtimeTranscript } : {
|
|
10137
10787
|
backend: attemptEvidence.backend,
|
|
10138
10788
|
path: attemptEvidence.transcriptPath,
|
|
10139
10789
|
offset: attemptEvidence.transcriptOffset,
|
|
@@ -10209,7 +10859,15 @@ export class Daemon extends EventEmitter {
|
|
|
10209
10859
|
}
|
|
10210
10860
|
const pasteGeneration = this.spawnGeneration;
|
|
10211
10861
|
beforePaste?.();
|
|
10212
|
-
const pasted = await this.
|
|
10862
|
+
const pasted = await this.sendDeliveryPaste(formatted, nativeOwner);
|
|
10863
|
+
if (!pasted && this.nativePaneLifecycle) {
|
|
10864
|
+
// The native write attempt is retained as uncertain, including exhausted positive refusals. Never route an
|
|
10865
|
+
// unknown/partial write through legacy window recovery or abort it back to an automatically replayable row.
|
|
10866
|
+
verdict.paneWriteStarted = true;
|
|
10867
|
+
verdict.phase = "paste";
|
|
10868
|
+
verdict.proof = "native-paste-held";
|
|
10869
|
+
return false;
|
|
10870
|
+
}
|
|
10213
10871
|
if (pasted)
|
|
10214
10872
|
this.rememberPaste(formatted, pasteGeneration);
|
|
10215
10873
|
if (!pasted) {
|
|
@@ -10296,15 +10954,18 @@ export class Daemon extends EventEmitter {
|
|
|
10296
10954
|
const enterMono = performance.now();
|
|
10297
10955
|
const steerEnterCurrent = () => steerCurrent() && performance.now() <= steerEnterDeadline;
|
|
10298
10956
|
let inputHeld = null;
|
|
10299
|
-
if (!(await this.sendDeliveryEnter("initial-submit", steerComposerProof ? steerEnterCurrent : undefined, durableAttempt, (why) => { inputHeld = why; }))) {
|
|
10957
|
+
if (!(await this.sendDeliveryEnter("initial-submit", steerComposerProof || nativeOwner ? steerEnterCurrent : undefined, durableAttempt, (why) => { inputHeld = why; }))) {
|
|
10300
10958
|
if (inputHeld) {
|
|
10301
10959
|
// #2971: held in a tmux mode past the bound; M-2290: a recognised dialog on the pane. The paste may still be in
|
|
10302
10960
|
// the CLI: keep it uncertain (Needs-you), never re-paste, never answer the dialog.
|
|
10303
10961
|
verdict.phase = "submit-enter";
|
|
10304
|
-
|
|
10962
|
+
// The merge of #2957/M-2290 (main) and the alpha's native holds: a tmux mode, a recognised dialog on a Linux pane,
|
|
10963
|
+
// and each native safety check say which.
|
|
10964
|
+
verdict.proof = inputHeld === "pane-in-mode" ? "pane-in-mode-held" : nativeOwner ? `native-input-${inputHeld}`
|
|
10965
|
+
: inputHeld === "dialog" ? "dialog-on-pane" : `input-held-${inputHeld}`;
|
|
10305
10966
|
return false;
|
|
10306
10967
|
}
|
|
10307
|
-
if (steerComposerProof && !steerCurrent()) {
|
|
10968
|
+
if ((steerComposerProof || nativeOwner) && !steerCurrent()) {
|
|
10308
10969
|
verdict.phase = "submit-enter";
|
|
10309
10970
|
verdict.proof = "fenced-before-enter";
|
|
10310
10971
|
return false;
|
|
@@ -10313,6 +10974,7 @@ export class Daemon extends EventEmitter {
|
|
|
10313
10974
|
return this.failDelivery(verdict, status, "submit-enter", "pre-enter-deadline");
|
|
10314
10975
|
return this.failDelivery(verdict, status, "submit-enter", "tmux-send-keys-failed");
|
|
10315
10976
|
}
|
|
10977
|
+
this.commitPreInputQuotaHistory(pasteBaseline);
|
|
10316
10978
|
// The proof's whole budget, from the Enter: every capture and dialog probe inside it, a late answer dropped.
|
|
10317
10979
|
const steerProofDeadline = performance.now() + NATIVE_QUEUE_PASTE_VERIFY_MS + POST_ENTER_PROOF_WINDOW_MS;
|
|
10318
10980
|
// Kiro's legacy TUI can swallow Enter while it is still processing a large
|
|
@@ -10333,7 +10995,7 @@ export class Daemon extends EventEmitter {
|
|
|
10333
10995
|
if (!rawPaste && !steerComposerProof && this.backend?.requiresDeliveryEnterRetry?.() === true) {
|
|
10334
10996
|
await new Promise(r => setTimeout(r, 1_000));
|
|
10335
10997
|
const retryAt = Date.now();
|
|
10336
|
-
if (await this.sendDeliveryEnter("queue-less-defensive-retry")) {
|
|
10998
|
+
if (await this.sendDeliveryEnter("queue-less-defensive-retry", nativeOwner)) {
|
|
10337
10999
|
enterAt = retryAt;
|
|
10338
11000
|
enterRetry = true;
|
|
10339
11001
|
this.logger.debug("Sent defensive Enter retry (queue-less TUI can swallow the first)");
|
|
@@ -10471,7 +11133,7 @@ export class Daemon extends EventEmitter {
|
|
|
10471
11133
|
// again. The prompt is back now, so an Enter can land.
|
|
10472
11134
|
this.logger.warn("Message still in the input row after idle — submitting the existing text instead of pasting it again");
|
|
10473
11135
|
const strandedAt = Date.now();
|
|
10474
|
-
if (!(await this.sendDeliveryEnter("native-queue-stranded-submit"))) {
|
|
11136
|
+
if (!(await this.sendDeliveryEnter("native-queue-stranded-submit", nativeOwner))) {
|
|
10475
11137
|
return this.failDelivery(verdict, status, "native-queue-submit", "tmux-send-keys-failed");
|
|
10476
11138
|
}
|
|
10477
11139
|
// The recovery Enter can be accepted before Codex paints its new
|
|
@@ -10524,7 +11186,7 @@ export class Daemon extends EventEmitter {
|
|
|
10524
11186
|
}
|
|
10525
11187
|
await new Promise(r => setTimeout(r, NORMAL_ENTER_SETTLE_MS));
|
|
10526
11188
|
const retryAt = Date.now();
|
|
10527
|
-
if (!(await this.sendDeliveryEnter("native-queue-idle-redelivery"))) {
|
|
11189
|
+
if (!(await this.sendDeliveryEnter("native-queue-idle-redelivery", nativeOwner))) {
|
|
10528
11190
|
return this.failDelivery(verdict, status, "native-queue-redelivery", "tmux-send-keys-failed");
|
|
10529
11191
|
}
|
|
10530
11192
|
if (windowId && this.controlClient) {
|
|
@@ -10576,7 +11238,7 @@ export class Daemon extends EventEmitter {
|
|
|
10576
11238
|
this.logger.warn("Message not submitted after Enter — waiting for the prompt, then re-sending Enter once");
|
|
10577
11239
|
const promptBack = await this.waitForPaneReadyForDelivery(windowId, STRANDED_RETRY_READY_WAIT_MS);
|
|
10578
11240
|
const retryAt = Date.now();
|
|
10579
|
-
if (promptBack && !(await this.sendDeliveryEnter("stranded-text-retry"))) {
|
|
11241
|
+
if (promptBack && !(await this.sendDeliveryEnter("stranded-text-retry", nativeOwner))) {
|
|
10580
11242
|
return this.failDelivery(verdict, status, "stranded-text-retry", "tmux-send-keys-failed");
|
|
10581
11243
|
}
|
|
10582
11244
|
submitted = promptBack && await this.confirmSubmittedAfterEnter(windowId, retryAt, formatted);
|
|
@@ -10664,7 +11326,7 @@ export class Daemon extends EventEmitter {
|
|
|
10664
11326
|
}
|
|
10665
11327
|
// No control client to observe output: fall back to the legacy double-Enter.
|
|
10666
11328
|
await new Promise(r => setTimeout(r, 1000));
|
|
10667
|
-
await this.sendDeliveryEnter("unobserved-defensive-retry");
|
|
11329
|
+
await this.sendDeliveryEnter("unobserved-defensive-retry", nativeOwner);
|
|
10668
11330
|
if (status)
|
|
10669
11331
|
this.emit("message_confirmed", status); // ✅ (best-effort)
|
|
10670
11332
|
}
|
|
@@ -10884,14 +11546,22 @@ export class Daemon extends EventEmitter {
|
|
|
10884
11546
|
* and the caller's own fence — so a look that lands after any of them is never used (#1380 review).
|
|
10885
11547
|
*/
|
|
10886
11548
|
transcriptProofFor(checkpoint, needle, spawnAtWrite, stillCurrent, onProof) {
|
|
11549
|
+
if (this.nativePaneLifecycle && !checkpoint.runtime)
|
|
11550
|
+
throw Error("Native proof cannot read a coordinator-local transcript path");
|
|
10887
11551
|
const launchAtWrite = this.launchFenceEpoch;
|
|
10888
11552
|
return {
|
|
10889
|
-
reader: new TranscriptDeltaReader(checkpoint.path, checkpoint.offset, checkpoint.backend, needle),
|
|
11553
|
+
reader: checkpoint.runtime ? this.nativeTranscriptReader(checkpoint.runtime, needle) : new TranscriptDeltaReader(checkpoint.path, checkpoint.offset, checkpoint.backend, needle),
|
|
10890
11554
|
current: () => !this.deliveryWritesStopping && this.spawnGeneration === spawnAtWrite
|
|
10891
|
-
&& this.launchFenceEpoch === launchAtWrite && (stillCurrent?.() ?? true)
|
|
11555
|
+
&& this.launchFenceEpoch === launchAtWrite && (stillCurrent?.() ?? true)
|
|
11556
|
+
&& (!checkpoint.runtime || this.nativePaneLifecycle?.current(checkpoint.runtime) === true),
|
|
10892
11557
|
onProof,
|
|
10893
11558
|
};
|
|
10894
11559
|
}
|
|
11560
|
+
nativeTranscriptReader(reference, needle) {
|
|
11561
|
+
if (!this.nativePaneLifecycle || !this.nativePaneLifecycle.current(reference))
|
|
11562
|
+
throw Error("Native delivery transcript owner is unavailable");
|
|
11563
|
+
return this.nativePaneLifecycle.proofReader(reference, needle);
|
|
11564
|
+
}
|
|
10895
11565
|
/** The CLI this daemon drives, for log lines shared by every backend ("claude-code", "codex", …). */
|
|
10896
11566
|
cliLabel() {
|
|
10897
11567
|
return this.config.backend ?? this.backend?.binaryName ?? "CLI";
|
|
@@ -11031,12 +11701,18 @@ export class Daemon extends EventEmitter {
|
|
|
11031
11701
|
async capturePaneEvidence(signature) {
|
|
11032
11702
|
if (!this.tmux)
|
|
11033
11703
|
return null;
|
|
11704
|
+
const owner = this.tmux, window = owner.getWindowId?.(), spawn = this.spawnGeneration, fence = this.launchFenceEpoch, launch = this.launchAttempt;
|
|
11034
11705
|
// Bounded re-probe: a capture that fails here costs the delivery its only
|
|
11035
11706
|
// "before" picture, and a momentary failure should not decide anything.
|
|
11036
11707
|
for (let attempt = 1; attempt <= BASELINE_CAPTURE_ATTEMPTS; attempt++) {
|
|
11037
11708
|
try {
|
|
11038
11709
|
const pane = await this.tmux.capturePane();
|
|
11039
11710
|
const evidence = this.paneEvidence(pane, signature);
|
|
11711
|
+
if (owner === this.tmux && window === owner.getWindowId?.() && spawn === this.spawnGeneration && fence === this.launchFenceEpoch && launch === this.launchAttempt) {
|
|
11712
|
+
const counts = this.paneQuotaPatterns().map(ep => ({ key: Daemon.errorPatternKey(ep), count: Daemon.countOccurrences(ep.pattern, pane) }));
|
|
11713
|
+
if (counts.length)
|
|
11714
|
+
evidence.quotaHistory = { spawn, fence, attempt: launch, tmux: owner, window, counts, marker: signature.value, occurrences: evidence.payload };
|
|
11715
|
+
}
|
|
11040
11716
|
const input = this.inputRegion(pane);
|
|
11041
11717
|
if (input && agendMessageInInput(input.text)) {
|
|
11042
11718
|
// Whatever we paste now lands after it, and one Enter submits both as
|
|
@@ -11135,7 +11811,14 @@ export class Daemon extends EventEmitter {
|
|
|
11135
11811
|
* (the retries included). Without a guard it is exactly the old unconditional path.
|
|
11136
11812
|
*/
|
|
11137
11813
|
async submitSystemPaste(text, label, guard, admission) {
|
|
11138
|
-
|
|
11814
|
+
// Alpha (S-36, Prism #2989 P2): a NATIVE pane's system paste keeps the pane owner from before its first await
|
|
11815
|
+
// (#2958's fence, reverted on main for tmux panes) — a pane replaced while the paste awaits never takes its Enter.
|
|
11816
|
+
const native = !!this.nativePaneLifecycle;
|
|
11817
|
+
const ownerTmux = this.tmux, ownerGeneration = this.spawnGeneration, ownerFence = this.launchFenceEpoch;
|
|
11818
|
+
const ownerWindow = native ? ownerTmux?.getWindowId() : undefined;
|
|
11819
|
+
const owner = () => !native || (!!ownerTmux && !!ownerWindow && this.tmux === ownerTmux && ownerTmux.getWindowId() === ownerWindow
|
|
11820
|
+
&& this.spawnGeneration === ownerGeneration && this.launchFenceEpoch === ownerFence && !this.deliveryWritesStopping);
|
|
11821
|
+
const current = guard || admission || native ? () => { admission?.(); return owner() && (guard?.current() ?? true); } : undefined;
|
|
11139
11822
|
if (current && !current())
|
|
11140
11823
|
return false;
|
|
11141
11824
|
if (!this.tmux)
|
|
@@ -11153,6 +11836,10 @@ export class Daemon extends EventEmitter {
|
|
|
11153
11836
|
if (!current() || !guard.accept(pane))
|
|
11154
11837
|
return false;
|
|
11155
11838
|
baseline = this.paneEvidence(pane, signature);
|
|
11839
|
+
if (native && this.backend?.binaryName === "codex") {
|
|
11840
|
+
const counts = this.paneQuotaPatterns().map(ep => ({ key: Daemon.errorPatternKey(ep), count: Daemon.countOccurrences(ep.pattern, pane) }));
|
|
11841
|
+
baseline.quotaHistory = { spawn: ownerGeneration, fence: ownerFence, attempt: this.launchAttempt, tmux: ownerTmux, window: ownerWindow, counts, marker: signature.value, occurrences: baseline.payload };
|
|
11842
|
+
}
|
|
11156
11843
|
}
|
|
11157
11844
|
else {
|
|
11158
11845
|
baseline = await this.capturePaneEvidence(signature);
|
|
@@ -11171,6 +11858,7 @@ export class Daemon extends EventEmitter {
|
|
|
11171
11858
|
await new Promise(r => setTimeout(r, NORMAL_ENTER_SETTLE_MS));
|
|
11172
11859
|
if (!(await this.sendDeliveryEnter(label, current)))
|
|
11173
11860
|
return false;
|
|
11861
|
+
this.commitPreInputQuotaHistory(baseline);
|
|
11174
11862
|
let proof = await this.confirmSubmitted(signature, baseline);
|
|
11175
11863
|
if (current && !current())
|
|
11176
11864
|
return false;
|
|
@@ -11255,15 +11943,15 @@ export class Daemon extends EventEmitter {
|
|
|
11255
11943
|
&& sameInteractionOwner(recoveryOwner, this.interactionOwner());
|
|
11256
11944
|
const previousWindowId = this.tmux?.getWindowId();
|
|
11257
11945
|
try {
|
|
11258
|
-
const windows = await
|
|
11946
|
+
const windows = await this.paneHost.listWindows(this.tmuxSessionName, this.controlClient);
|
|
11259
11947
|
if (!recoveryCurrent() || this.tmux !== previousTmux)
|
|
11260
11948
|
return undefined;
|
|
11261
11949
|
const match = windows.find(w => w.name === this.name);
|
|
11262
11950
|
if (!match)
|
|
11263
11951
|
return undefined;
|
|
11264
|
-
this.tmux =
|
|
11952
|
+
this.tmux = this.paneHost.bind(this.tmuxSessionName, match.id, resolveTmuxLogicalSize(this.config.terminal), this.controlClient);
|
|
11265
11953
|
const recoveredTmux = this.tmux;
|
|
11266
|
-
|
|
11954
|
+
this.writeWindowId(match.id);
|
|
11267
11955
|
// The window we were talking to is gone; leaving it registered means the
|
|
11268
11956
|
// control client re-resolves a dead id — one bounded read — on every
|
|
11269
11957
|
// reconnect, for the life of the fleet process.
|
|
@@ -11324,6 +12012,8 @@ export class Daemon extends EventEmitter {
|
|
|
11324
12012
|
return false;
|
|
11325
12013
|
}
|
|
11326
12014
|
getWindowId() {
|
|
12015
|
+
if (this.nativePaneLifecycle)
|
|
12016
|
+
return this.nativePaneLifecycle.current() ? this.tmux?.getWindowId() : undefined;
|
|
11327
12017
|
try {
|
|
11328
12018
|
return readFileSync(join(this.instanceDir, "window-id"), "utf-8").trim() || undefined;
|
|
11329
12019
|
}
|
|
@@ -11355,7 +12045,55 @@ export class Daemon extends EventEmitter {
|
|
|
11355
12045
|
* Handle a tool call from the MCP server (forwarded by Claude).
|
|
11356
12046
|
* Routes to the channel adapter via MessageBus.
|
|
11357
12047
|
*/
|
|
11358
|
-
|
|
12048
|
+
/** Internal native-MCP admission. The pane/machine/launch owner supplies a current, dynamically checked tool lease. */
|
|
12049
|
+
handlePaneToolCall(input, lease) {
|
|
12050
|
+
const refusal = nativePaneToolRefusal(input.tool, input.args);
|
|
12051
|
+
if (refusal)
|
|
12052
|
+
return Promise.resolve({ result: null, error: refusal });
|
|
12053
|
+
if (!lease.current() || !lease.allowed(input.tool, input.args) || this.deliveryWritesStopping)
|
|
12054
|
+
return Promise.resolve({ result: null, error: "Pane tool permission is no longer current" });
|
|
12055
|
+
const fence = this.launchFenceEpoch;
|
|
12056
|
+
const current = () => lease.current() && lease.allowed(input.tool, input.args) && !this.deliveryWritesStopping && fence === this.launchFenceEpoch;
|
|
12057
|
+
return new Promise(resolve => {
|
|
12058
|
+
let settled = false;
|
|
12059
|
+
const finish = (value) => { if (settled)
|
|
12060
|
+
return; settled = true; clearTimeout(timer); resolve(value); };
|
|
12061
|
+
const timer = setTimeout(() => finish({ result: null, error: "Pane tool result is unconfirmed; inspect its operation before retrying" }), daemonBudgetMs(input.tool) + 1000);
|
|
12062
|
+
timer.unref?.();
|
|
12063
|
+
try {
|
|
12064
|
+
this.handleToolCall({ ...input, requestId: ++this.fleetRequestSeq }, undefined, {
|
|
12065
|
+
current,
|
|
12066
|
+
dispatch: (tool, args, respond) => {
|
|
12067
|
+
if (!current()) {
|
|
12068
|
+
respond(null, "Pane tool permission was revoked before dispatch");
|
|
12069
|
+
return true;
|
|
12070
|
+
}
|
|
12071
|
+
const dispatched = lease.dispatch?.(tool, args);
|
|
12072
|
+
if (!dispatched)
|
|
12073
|
+
return false;
|
|
12074
|
+
void dispatched.then(result => respond(result), () => respond(null, "Pane tool operation was refused"));
|
|
12075
|
+
return true;
|
|
12076
|
+
},
|
|
12077
|
+
// Resolving the relay is not proof that its HTTP response reached the provider. No response-written receipt yet.
|
|
12078
|
+
send: value => {
|
|
12079
|
+
finish({ result: value.result, ...(typeof value.error === "string" ? { error: value.error } : {}),
|
|
12080
|
+
...(typeof value.errorCode === "string" || typeof value.errorCode === "number" ? { errorCode: value.errorCode } : {}) });
|
|
12081
|
+
return false;
|
|
12082
|
+
},
|
|
12083
|
+
});
|
|
12084
|
+
}
|
|
12085
|
+
catch {
|
|
12086
|
+
finish({ result: null, error: "Pane tool operation failed" });
|
|
12087
|
+
}
|
|
12088
|
+
});
|
|
12089
|
+
}
|
|
12090
|
+
/** Only the authority lease with a verified helper stdout ACK calls this internal barrier. */
|
|
12091
|
+
paneToolResponseWritten(operationId, current) {
|
|
12092
|
+
if (!current() || this.deliveryWritesStopping || !/^[a-f0-9-]{36}$/i.test(operationId))
|
|
12093
|
+
return;
|
|
12094
|
+
this.emit("mcp_tool_response_written", { operationId, daemonBootId: this.bootId });
|
|
12095
|
+
}
|
|
12096
|
+
handleToolCall(msg, socket, peer) {
|
|
11359
12097
|
const tool = msg.tool;
|
|
11360
12098
|
const args = (msg.args ?? {});
|
|
11361
12099
|
const requestId = msg.requestId;
|
|
@@ -11363,20 +12101,20 @@ export class Daemon extends EventEmitter {
|
|
|
11363
12101
|
this.logger.debug({ tool, requestId }, "Tool call from MCP server");
|
|
11364
12102
|
// A tool call can only come from a live MCP server of ours — proof of life
|
|
11365
12103
|
// that outranks whatever the pid slot says.
|
|
11366
|
-
if (this.socketSessionNames.get(socket) === this.name) {
|
|
11367
|
-
this.noteMcpProofOfLife("tool_call", this.socketPids.get(socket));
|
|
12104
|
+
if (peer?.current() || socket && this.socketSessionNames.get(socket) === this.name) {
|
|
12105
|
+
this.noteMcpProofOfLife("tool_call", socket ? this.socketPids.get(socket) : undefined);
|
|
11368
12106
|
}
|
|
11369
12107
|
// A tool invocation is not delivery evidence. Capture which obligation it
|
|
11370
12108
|
// belongs to now, then settle it only after the adapter/fleet responds.
|
|
11371
12109
|
// Explicitly mapped sibling sessions must not satisfy this instance's turn;
|
|
11372
12110
|
// an unmapped socket is retained for legacy/tests where mcp_ready was not
|
|
11373
12111
|
// observed before the first tool call.
|
|
11374
|
-
const sourceSession = this.socketSessionNames.get(socket);
|
|
12112
|
+
const sourceSession = peer ? this.name : socket ? this.socketSessionNames.get(socket) : undefined;
|
|
11375
12113
|
const replyAttempt = TURN_OUTBOUND_TOOLS.has(tool) && (!sourceSession || sourceSession === this.name)
|
|
11376
12114
|
? this.turnReplyGuard.beginToolAttempt(tool === "reply", TURN_COMPLETION_TOOLS.has(tool))
|
|
11377
12115
|
: null;
|
|
11378
12116
|
// For now, log and respond. Full adapter routing will be wired in fleet manager.
|
|
11379
|
-
const respond = (result, error) => {
|
|
12117
|
+
const respond = (result, error, errorCode) => {
|
|
11380
12118
|
// A message that verifiably went out stands down the dead-MCP proxy reply
|
|
11381
12119
|
// for this turn: the agent proved it can still speak for itself.
|
|
11382
12120
|
if (!error && result != null && TURN_OUTBOUND_TOOLS.has(tool)) {
|
|
@@ -11417,14 +12155,21 @@ export class Daemon extends EventEmitter {
|
|
|
11417
12155
|
// failed" and report unknown immediately rather than starting recovery.
|
|
11418
12156
|
this.turnReplyGuard.settleToolAttempt(replyAttempt, false);
|
|
11419
12157
|
}
|
|
11420
|
-
const
|
|
12158
|
+
const packet = { requestId, result, error, operationId, ...(errorCode !== undefined ? { errorCode } : {}) };
|
|
12159
|
+
const sent = peer ? peer.current() && peer.send(packet) : socket ? this.ipcServer?.send(socket, packet) ?? false : false;
|
|
11421
12160
|
if (!sent) {
|
|
11422
|
-
|
|
12161
|
+
if (peer)
|
|
12162
|
+
this.logger.debug({ tool, requestId }, "Native MCP result awaits transport-written confirmation");
|
|
12163
|
+
else
|
|
12164
|
+
this.logger.warn({ tool, requestId }, "Tool result could not be returned — originating MCP socket is closed");
|
|
11423
12165
|
}
|
|
11424
12166
|
else if (operationId) {
|
|
11425
12167
|
this.emit("mcp_tool_response_written", { operationId, daemonBootId: this.bootId });
|
|
11426
12168
|
}
|
|
11427
12169
|
};
|
|
12170
|
+
// Native Fleet/task operations carry their lease to the existing dispatcher mutation admission points.
|
|
12171
|
+
if (peer?.dispatch?.(tool, args, respond))
|
|
12172
|
+
return;
|
|
11428
12173
|
// Repo checkout — handled locally in daemon (no fleet-manager)
|
|
11429
12174
|
if (tool === "checkout_repo") {
|
|
11430
12175
|
this.handleCheckoutRepo(args, respond);
|
|
@@ -11453,7 +12198,7 @@ export class Daemon extends EventEmitter {
|
|
|
11453
12198
|
clearTimeout(timeout);
|
|
11454
12199
|
respond(respMsg.result, respMsg.error);
|
|
11455
12200
|
});
|
|
11456
|
-
this.
|
|
12201
|
+
this.broadcastFleetMessage({
|
|
11457
12202
|
type,
|
|
11458
12203
|
payload: args,
|
|
11459
12204
|
meta: { instance_name: this.name },
|
|
@@ -11479,7 +12224,7 @@ export class Daemon extends EventEmitter {
|
|
|
11479
12224
|
clearTimeout(timeout);
|
|
11480
12225
|
resolve({ result: respMsg.result, error: respMsg.error });
|
|
11481
12226
|
});
|
|
11482
|
-
this.
|
|
12227
|
+
this.broadcastFleetMessage({ type: WEB_THEME_IPC[tool], payload, meta: { instance_name: this.name }, fleetRequestId: fleetReqId });
|
|
11483
12228
|
});
|
|
11484
12229
|
void (async () => {
|
|
11485
12230
|
if (tool === "preview_web_appearance") {
|
|
@@ -11556,7 +12301,7 @@ export class Daemon extends EventEmitter {
|
|
|
11556
12301
|
clearTimeout(timeout);
|
|
11557
12302
|
respond(respMsg.result, respMsg.error);
|
|
11558
12303
|
});
|
|
11559
|
-
this.
|
|
12304
|
+
this.broadcastFleetMessage({
|
|
11560
12305
|
type: "fleet_task",
|
|
11561
12306
|
payload: args,
|
|
11562
12307
|
meta: { instance_name: this.name },
|
|
@@ -11579,7 +12324,7 @@ export class Daemon extends EventEmitter {
|
|
|
11579
12324
|
clearTimeout(timeout);
|
|
11580
12325
|
respond(respMsg.result, respMsg.error);
|
|
11581
12326
|
});
|
|
11582
|
-
this.
|
|
12327
|
+
this.broadcastFleetMessage({
|
|
11583
12328
|
type: typeMap[tool],
|
|
11584
12329
|
payload: args,
|
|
11585
12330
|
meta: { instance_name: this.name, working_directory: this.config.working_directory },
|
|
@@ -11606,7 +12351,7 @@ export class Daemon extends EventEmitter {
|
|
|
11606
12351
|
clearTimeout(timeout);
|
|
11607
12352
|
respond(respMsg.result, respMsg.error);
|
|
11608
12353
|
});
|
|
11609
|
-
this.
|
|
12354
|
+
this.broadcastFleetMessage({
|
|
11610
12355
|
type: typeMap[tool],
|
|
11611
12356
|
payload: args,
|
|
11612
12357
|
meta: {
|
|
@@ -11621,11 +12366,11 @@ export class Daemon extends EventEmitter {
|
|
|
11621
12366
|
}
|
|
11622
12367
|
if (CROSS_INSTANCE_TOOLS.has(tool)) {
|
|
11623
12368
|
// Route to fleet manager via IPC (topic mode only)
|
|
11624
|
-
if (this.topicMode && this.
|
|
12369
|
+
if (this.topicMode && this.fleetTransportAvailable()) {
|
|
11625
12370
|
// Use fleetRequestId (not requestId) to avoid MCP server resolving the
|
|
11626
12371
|
// pending tool call prematurely when it receives the broadcast.
|
|
11627
12372
|
const fleetReqId = `xmsg_${++this.fleetRequestSeq}_${requestId}`;
|
|
11628
|
-
const senderSessionName =
|
|
12373
|
+
const senderSessionName = sourceSession;
|
|
11629
12374
|
// Shared table, so delete_instance and the deployment tools get the same
|
|
11630
12375
|
// budget here as the MCP client expects (the ad-hoc list omitted them).
|
|
11631
12376
|
const crossTimeoutMs = daemonBudgetMs(tool);
|
|
@@ -11637,7 +12382,7 @@ export class Daemon extends EventEmitter {
|
|
|
11637
12382
|
clearTimeout(timeout);
|
|
11638
12383
|
respond(respMsg.result, respMsg.error);
|
|
11639
12384
|
});
|
|
11640
|
-
this.
|
|
12385
|
+
this.broadcastFleetMessage({
|
|
11641
12386
|
type: "fleet_outbound",
|
|
11642
12387
|
tool,
|
|
11643
12388
|
args,
|
|
@@ -11691,12 +12436,12 @@ export class Daemon extends EventEmitter {
|
|
|
11691
12436
|
}, daemonBudgetMs(tool));
|
|
11692
12437
|
this.pendingIpcRequests.set(outboundKey, (respMsg) => {
|
|
11693
12438
|
clearTimeout(timeout);
|
|
11694
|
-
respond(respMsg.result, respMsg.error);
|
|
12439
|
+
respond(respMsg.result, respMsg.error, respMsg.errorCode);
|
|
11695
12440
|
});
|
|
11696
12441
|
// Register the waiter before broadcasting. A fast/mock adapter can settle
|
|
11697
12442
|
// immediately; broadcasting first left a response-before-registration
|
|
11698
12443
|
// window that degraded into a timeout despite a completed POST.
|
|
11699
|
-
this.
|
|
12444
|
+
this.broadcastFleetMessage({
|
|
11700
12445
|
type: "fleet_outbound",
|
|
11701
12446
|
tool,
|
|
11702
12447
|
args,
|
|
@@ -11786,9 +12531,10 @@ export class Daemon extends EventEmitter {
|
|
|
11786
12531
|
// Comma-separated parts (`file:role.md, file:rules.md`) only when a part is a file ref; otherwise one inline prompt.
|
|
11787
12532
|
const resolvedCustomPrompt = this.config.systemPrompt ? assembleSystemPrompt(this.config.systemPrompt, promptFiles) : undefined;
|
|
11788
12533
|
let decisions;
|
|
11789
|
-
|
|
12534
|
+
const source = this.decisionSource;
|
|
12535
|
+
if (source || process.env.AGEND_DECISIONS) {
|
|
11790
12536
|
try {
|
|
11791
|
-
const all = JSON.parse(process.env.AGEND_DECISIONS);
|
|
12537
|
+
const all = source ? source() : JSON.parse(process.env.AGEND_DECISIONS);
|
|
11792
12538
|
const workDir = this.config.working_directory;
|
|
11793
12539
|
// `scope: "fleet"` used to bypass the project check entirely, so a
|
|
11794
12540
|
// single-project worker inherited every other project's playbook (8 of
|
|
@@ -11797,7 +12543,12 @@ export class Daemon extends EventEmitter {
|
|
|
11797
12543
|
// same project, or the same project family (worktrees/checkouts of one
|
|
11798
12544
|
// repo). A general is exempt: it dispatches across all projects, so
|
|
11799
12545
|
// cross-project routing rules are exactly what it needs.
|
|
11800
|
-
|
|
12546
|
+
let teams = [];
|
|
12547
|
+
try {
|
|
12548
|
+
teams = this.decisionTeams?.() ?? [];
|
|
12549
|
+
}
|
|
12550
|
+
catch { /* no team list: fleet and project decisions only */ }
|
|
12551
|
+
decisions = capActiveDecisions(selectRelevantDecisions([...all], workDir, this.config.general_topic === true, teams));
|
|
11801
12552
|
// Stable ordering so identical decision sets always build byte-identical
|
|
11802
12553
|
// instructions — otherwise source ordering jitter flips the warmup hash.
|
|
11803
12554
|
decisions.sort((a, b) => a.title.localeCompare(b.title));
|
|
@@ -11827,7 +12578,7 @@ export class Daemon extends EventEmitter {
|
|
|
11827
12578
|
// The daemon used to read `general_topic` alone while `isGeneralInstance`
|
|
11828
12579
|
// also accepted the name, so an instance called `general` without the flag
|
|
11829
12580
|
// was a worker here and a general everywhere else.
|
|
11830
|
-
const isGeneral = this.config.general_topic === true || this.name
|
|
12581
|
+
const isGeneral = this.config.general_topic === true || generalByName(this.name, this.config);
|
|
11831
12582
|
// No third argument for an ordinary instance: the default is `worker` now,
|
|
11832
12583
|
// and naming it here would be a second place to change it.
|
|
11833
12584
|
const toolSet = isGeneral
|
|
@@ -11917,6 +12668,7 @@ export class Daemon extends EventEmitter {
|
|
|
11917
12668
|
effort: this.config.effort,
|
|
11918
12669
|
kiroUi: this.config.kiro_ui,
|
|
11919
12670
|
skipResume: this.skipResume,
|
|
12671
|
+
...(this.cliRepairSessionId ? { resumeSessionId: this.cliRepairSessionId } : {}),
|
|
11920
12672
|
instructions,
|
|
11921
12673
|
agentMode: isCliMode ? "cli" : "mcp",
|
|
11922
12674
|
agentPort: isCliMode ? agentPort : undefined,
|
|
@@ -11989,6 +12741,9 @@ export class Daemon extends EventEmitter {
|
|
|
11989
12741
|
}
|
|
11990
12742
|
this.cancelCapacityNudge("the instance was stopped, paused or respawned");
|
|
11991
12743
|
this.lastErrorEpisode = null;
|
|
12744
|
+
this.quotaReplay = null;
|
|
12745
|
+
this.nativeQuotaReplayTaken = false;
|
|
12746
|
+
this.quotaInput = null;
|
|
11992
12747
|
this.nudgeBaselines = null;
|
|
11993
12748
|
// A relaunch settles any outstanding quit watch: the CLI came back.
|
|
11994
12749
|
this.clearQuitRelaunchWatch();
|
|
@@ -12203,6 +12958,8 @@ export class Daemon extends EventEmitter {
|
|
|
12203
12958
|
catch { /* best effort */ }
|
|
12204
12959
|
}
|
|
12205
12960
|
async spawnClaudeWindow() {
|
|
12961
|
+
if (this.nativePaneLifecycle)
|
|
12962
|
+
throw Error("Native panes never enter local resume/fresh fallback");
|
|
12206
12963
|
this.assertSessionOomAdmission();
|
|
12207
12964
|
this.beginSpawn();
|
|
12208
12965
|
let resumedSuccessfully = false;
|
|
@@ -12779,6 +13536,71 @@ export class Daemon extends EventEmitter {
|
|
|
12779
13536
|
* retries. Idempotent, and fast: no graceful CLI quit, the CLI never reached
|
|
12780
13537
|
* its prompt.
|
|
12781
13538
|
*/
|
|
13539
|
+
/**
|
|
13540
|
+
* #3313 review r2: after a failed start (abortStartup), whether this start's CLI is positively gone — no window was ever
|
|
13541
|
+
* asked for, or its window (by id, or by name while its creation was pending) is positively absent after another kill.
|
|
13542
|
+
* False when that cannot be told (tmux could not list). The failed start's OWN cleanup: called once, by that start,
|
|
13543
|
+
* while the window is still its own. When it cannot tell, the window and its pane process are remembered for
|
|
13544
|
+
* `startupIncarnationEnded()`.
|
|
13545
|
+
*/
|
|
13546
|
+
async startupCliEnded() {
|
|
13547
|
+
if (this.nativePaneLifecycle)
|
|
13548
|
+
return true;
|
|
13549
|
+
if (!this.tmux)
|
|
13550
|
+
return true;
|
|
13551
|
+
const windowId = this.tmux.getWindowId();
|
|
13552
|
+
let pid = null;
|
|
13553
|
+
if (windowId?.trim()) {
|
|
13554
|
+
try {
|
|
13555
|
+
pid = await this.paneHost.getPanePid(this.tmuxSessionName, windowId);
|
|
13556
|
+
}
|
|
13557
|
+
catch {
|
|
13558
|
+
pid = null;
|
|
13559
|
+
}
|
|
13560
|
+
}
|
|
13561
|
+
let gone = false;
|
|
13562
|
+
try {
|
|
13563
|
+
gone = await this.tmux.killWindowConfirmed();
|
|
13564
|
+
}
|
|
13565
|
+
catch {
|
|
13566
|
+
gone = false;
|
|
13567
|
+
}
|
|
13568
|
+
if (!gone)
|
|
13569
|
+
this.failedStartupIncarnation = windowId?.trim() ? { windowId, pid } : { windowId: null, pid: null };
|
|
13570
|
+
return gone;
|
|
13571
|
+
}
|
|
13572
|
+
failedStartupIncarnation = null;
|
|
13573
|
+
/**
|
|
13574
|
+
* #3313 review r3: the later re-checks of a failed start whose end was not proven — READ-ONLY (never kills: a retry of
|
|
13575
|
+
* 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
|
|
13576
|
+
* different pane process (it was respawned: the one this start left has been replaced). False when it cannot be told.
|
|
13577
|
+
*/
|
|
13578
|
+
async startupIncarnationEnded() {
|
|
13579
|
+
const inc = this.failedStartupIncarnation;
|
|
13580
|
+
if (!inc)
|
|
13581
|
+
return true;
|
|
13582
|
+
if (!inc.windowId)
|
|
13583
|
+
return false; // its window was never learned: nothing proves it gone
|
|
13584
|
+
let windows;
|
|
13585
|
+
try {
|
|
13586
|
+
windows = await TmuxManager.listWindowsStrict(this.tmuxSessionName);
|
|
13587
|
+
}
|
|
13588
|
+
catch {
|
|
13589
|
+
return false;
|
|
13590
|
+
}
|
|
13591
|
+
if (!windows.some(w => w.id === inc.windowId))
|
|
13592
|
+
return true;
|
|
13593
|
+
if (inc.pid === null)
|
|
13594
|
+
return false;
|
|
13595
|
+
let now;
|
|
13596
|
+
try {
|
|
13597
|
+
now = await this.paneHost.getPanePid(this.tmuxSessionName, inc.windowId);
|
|
13598
|
+
}
|
|
13599
|
+
catch {
|
|
13600
|
+
return false;
|
|
13601
|
+
}
|
|
13602
|
+
return now !== null && now !== inc.pid;
|
|
13603
|
+
}
|
|
12782
13604
|
async abortStartup() {
|
|
12783
13605
|
if (this.startupAborted)
|
|
12784
13606
|
return;
|
|
@@ -12789,6 +13611,14 @@ export class Daemon extends EventEmitter {
|
|
|
12789
13611
|
await this.museUsageRelay.stop().catch(() => { });
|
|
12790
13612
|
this.museUsageRelay = null;
|
|
12791
13613
|
}
|
|
13614
|
+
if (this.nativePaneLifecycle) {
|
|
13615
|
+
await this.nativePaneLifecycle.release("detach");
|
|
13616
|
+
try {
|
|
13617
|
+
unlinkSync(join(this.instanceDir, "daemon.pid"));
|
|
13618
|
+
}
|
|
13619
|
+
catch { /* metadata only */ }
|
|
13620
|
+
return;
|
|
13621
|
+
}
|
|
12792
13622
|
try {
|
|
12793
13623
|
await this.killProcessTree("SIGTERM", "startup aborted");
|
|
12794
13624
|
}
|
|
@@ -12818,13 +13648,15 @@ export class Daemon extends EventEmitter {
|
|
|
12818
13648
|
}
|
|
12819
13649
|
/** Kill the entire process tree of the current tmux pane (CLI + MCP server). */
|
|
12820
13650
|
async killProcessTree(signal = "SIGTERM", reason = "unspecified") {
|
|
13651
|
+
if (this.nativePaneLifecycle)
|
|
13652
|
+
throw Error("Native processes can only be closed through their owned runtime pane");
|
|
12821
13653
|
const windowId = this.tmux?.getWindowId();
|
|
12822
13654
|
// Before createWindow succeeds there is no pane owned by this daemon.
|
|
12823
13655
|
// tmux interprets an empty selector as the session's active window.
|
|
12824
13656
|
if (!windowId?.trim())
|
|
12825
13657
|
return;
|
|
12826
13658
|
try {
|
|
12827
|
-
const pid = await
|
|
13659
|
+
const pid = await this.paneHost.getPanePid(this.tmuxSessionName, windowId);
|
|
12828
13660
|
if (pid) {
|
|
12829
13661
|
this.noteStopRequest(signal, reason);
|
|
12830
13662
|
process.kill(-pid, signal);
|
|
@@ -12839,14 +13671,14 @@ export class Daemon extends EventEmitter {
|
|
|
12839
13671
|
* Handles confirmation dialogs (trust folder, bypass permissions).
|
|
12840
13672
|
* Returns true if CLI is ready, false if it failed or got stuck.
|
|
12841
13673
|
*/
|
|
12842
|
-
async trySpawn(reuseWindow = false, startupTimeoutMs) {
|
|
13674
|
+
async trySpawn(reuseWindow = false, startupTimeoutMs, repairAdmission) {
|
|
12843
13675
|
const recoveryOwner = this.collateralOomRecovery ? this.interactionOwner() : null;
|
|
12844
13676
|
const enter = () => {
|
|
12845
13677
|
if (recoveryOwner && (!sameInteractionOwner(recoveryOwner, this.interactionOwner())
|
|
12846
13678
|
|| this.startupAborted || this.deliveryWritesStopping || this.runtimeMonitorsFrozen || this.healthCheckPaused)) {
|
|
12847
13679
|
throw new Error("OOM recovery cancelled: the instance was stopped, paused or replaced while memory was unavailable");
|
|
12848
13680
|
}
|
|
12849
|
-
return this.trySpawnInsideGate(reuseWindow, startupTimeoutMs).catch(err => {
|
|
13681
|
+
return this.trySpawnInsideGate(reuseWindow, startupTimeoutMs, repairAdmission).catch(err => {
|
|
12850
13682
|
// Includes an in-place binary replacement during asynchronous launch preparation.
|
|
12851
13683
|
if (err instanceof KiroCompatibilityError)
|
|
12852
13684
|
this.emit("kiro_compatibility_hold", err.message);
|
|
@@ -12871,6 +13703,122 @@ export class Daemon extends EventEmitter {
|
|
|
12871
13703
|
this.startupAdmission?.();
|
|
12872
13704
|
return ready;
|
|
12873
13705
|
}
|
|
13706
|
+
/** Resolve the installed launcher; never run Claude to discover its version. */
|
|
13707
|
+
async resolveClaudeInstallPath() {
|
|
13708
|
+
const { binaryProbe } = await import("./binary-probe.js");
|
|
13709
|
+
const { resolveBackendBinary } = await import("./backend-availability.js");
|
|
13710
|
+
binaryProbe.invalidate("claude");
|
|
13711
|
+
return await resolveBackendBinary("claude-code") ?? null;
|
|
13712
|
+
}
|
|
13713
|
+
async installedClaudeVersion(path) {
|
|
13714
|
+
const { staticBackendVersion } = await import("./backend-availability.js");
|
|
13715
|
+
return staticBackendVersion("claude-code", path);
|
|
13716
|
+
}
|
|
13717
|
+
/** #3441: only the CLI's own refusal can request this one, non-renewable repair. */
|
|
13718
|
+
handleClaudeModelMinimum(minimum) {
|
|
13719
|
+
if (this.modelMinimumRepairUsed || this.modelMinimumBlocked || this.spawning || this.healthCheckPaused
|
|
13720
|
+
|| this.pauseWakeState !== "active" || this.backend?.binaryName !== "claude"
|
|
13721
|
+
|| !this.backend.refreshLaunchBinary)
|
|
13722
|
+
return Promise.resolve();
|
|
13723
|
+
if (this.modelMinimumFlight)
|
|
13724
|
+
return this.modelMinimumFlight;
|
|
13725
|
+
const flight = this.repairClaudeModelMinimum(minimum).finally(() => {
|
|
13726
|
+
if (this.modelMinimumFlight === flight)
|
|
13727
|
+
this.modelMinimumFlight = null;
|
|
13728
|
+
});
|
|
13729
|
+
this.modelMinimumFlight = flight;
|
|
13730
|
+
return flight;
|
|
13731
|
+
}
|
|
13732
|
+
async repairClaudeModelMinimum(minimum) {
|
|
13733
|
+
const tmux = this.tmux, backend = this.backend, window = tmux?.getWindowId();
|
|
13734
|
+
let spawn = this.spawnGeneration, claimed = false;
|
|
13735
|
+
const fence = this.launchFenceEpoch, attempt = this.launchAttempt, phase = this.pauseWakeState;
|
|
13736
|
+
const baseCurrent = () => this.tmux === tmux && this.backend === backend && tmux?.getWindowId() === window
|
|
13737
|
+
&& this.spawnGeneration === spawn && this.launchFenceEpoch === fence && this.pauseWakeState === phase
|
|
13738
|
+
&& !this.startupAborted && !this.deliveryWritesStopping && !this.runtimeMonitorsFrozen && !this.healthCheckPaused;
|
|
13739
|
+
const current = () => baseCurrent() && this.launchAttempt === attempt;
|
|
13740
|
+
const failed = () => new Error(t("inst.cli_repair_failed"));
|
|
13741
|
+
try {
|
|
13742
|
+
// Read the newly resolved install, not a cached old prefix or the running image.
|
|
13743
|
+
const path = await this.resolveClaudeInstallPath();
|
|
13744
|
+
if (!current())
|
|
13745
|
+
return;
|
|
13746
|
+
const version = path ? await this.installedClaudeVersion(path) : null;
|
|
13747
|
+
if (!current())
|
|
13748
|
+
return;
|
|
13749
|
+
if (!version || cliVersionBelow(version, minimum.required)) {
|
|
13750
|
+
if (!this.modelMinimumUpdateNotified) {
|
|
13751
|
+
this.modelMinimumUpdateNotified = true;
|
|
13752
|
+
this.logger.warn({ required: minimum.required, installed: version }, "Claude Code needs an update for this model");
|
|
13753
|
+
this.emit("backend_launch_warning", { name: this.name, message: t("inst.cli_update_needed", minimum.required) });
|
|
13754
|
+
}
|
|
13755
|
+
return;
|
|
13756
|
+
}
|
|
13757
|
+
await this.paneWriteLock.run(async () => {
|
|
13758
|
+
if (!current())
|
|
13759
|
+
return;
|
|
13760
|
+
if (!await this.isPaneAuthoritativelyIdle())
|
|
13761
|
+
throw failed();
|
|
13762
|
+
if (!current())
|
|
13763
|
+
return;
|
|
13764
|
+
// Claim before yielding the write lock; queued delivery remains held until readiness settles.
|
|
13765
|
+
this.modelMinimumRepairUsed = true;
|
|
13766
|
+
this.beginSpawn();
|
|
13767
|
+
claimed = true;
|
|
13768
|
+
spawn = this.spawnGeneration;
|
|
13769
|
+
});
|
|
13770
|
+
if (!claimed || !current())
|
|
13771
|
+
return;
|
|
13772
|
+
await this.checkpointSessionId();
|
|
13773
|
+
if (!current())
|
|
13774
|
+
return;
|
|
13775
|
+
let session;
|
|
13776
|
+
if (!this.skipResume) {
|
|
13777
|
+
try {
|
|
13778
|
+
const value = readFileSync(join(this.instanceDir, "session-id"), "utf8").trim();
|
|
13779
|
+
if (/^[a-f0-9]{8}-(?:[a-f0-9]{4}-){3}[a-f0-9]{12}$/i.test(value))
|
|
13780
|
+
session = value;
|
|
13781
|
+
}
|
|
13782
|
+
catch { /* Unknown is not permission to select another conversation. */ }
|
|
13783
|
+
}
|
|
13784
|
+
if (!session)
|
|
13785
|
+
throw failed();
|
|
13786
|
+
// Recheck disk evidence after checkpointing; an update may have changed it while we waited.
|
|
13787
|
+
const finalVersion = await this.installedClaudeVersion(path);
|
|
13788
|
+
if (!current())
|
|
13789
|
+
return;
|
|
13790
|
+
if (!finalVersion || cliVersionBelow(finalVersion, minimum.required))
|
|
13791
|
+
throw failed();
|
|
13792
|
+
if (!await this.isPaneAuthoritativelyIdle())
|
|
13793
|
+
throw failed();
|
|
13794
|
+
if (!current())
|
|
13795
|
+
return;
|
|
13796
|
+
this.logger.warn({ running: minimum.running, required: minimum.required, installed: finalVersion }, "Claude model-version refusal — attempting one same-session restart");
|
|
13797
|
+
backend.refreshLaunchBinary(path);
|
|
13798
|
+
this.cliRepairSessionId = session;
|
|
13799
|
+
const ready = await this.trySpawn(true, this.startupBudgetFor(true), next => baseCurrent() && this.launchAttempt === next && next >= attempt && next <= attempt + 1);
|
|
13800
|
+
this.cliRepairSessionId = undefined;
|
|
13801
|
+
if (!baseCurrent() || this.launchAttempt !== attempt + 1)
|
|
13802
|
+
return;
|
|
13803
|
+
if (!ready)
|
|
13804
|
+
throw failed();
|
|
13805
|
+
this.logger.info("Claude model-version restart completed; session retained");
|
|
13806
|
+
this.emit("backend_launch_warning", { name: this.name, message: t("inst.cli_repaired") });
|
|
13807
|
+
}
|
|
13808
|
+
catch (error) {
|
|
13809
|
+
if (!baseCurrent() || this.launchAttempt > attempt + 1)
|
|
13810
|
+
return;
|
|
13811
|
+
this.modelMinimumBlocked = true;
|
|
13812
|
+
this.healthCheckPaused = true;
|
|
13813
|
+
this.logger.error({ reason: error instanceof Error ? error.message : String(error) }, "Claude model-version repair held; no automatic retry");
|
|
13814
|
+
this.emit("backend_launch_warning", { name: this.name, message: t("inst.cli_repair_failed") });
|
|
13815
|
+
}
|
|
13816
|
+
finally {
|
|
13817
|
+
this.cliRepairSessionId = undefined;
|
|
13818
|
+
if (claimed)
|
|
13819
|
+
this.endSpawn();
|
|
13820
|
+
}
|
|
13821
|
+
}
|
|
12874
13822
|
/**
|
|
12875
13823
|
* One fresh pane capture judged as ready && !busy && !dialog. Transcript
|
|
12876
13824
|
* silence is deliberately NOT the gate: its monitor is inert for muse, so a
|
|
@@ -13043,7 +13991,7 @@ export class Daemon extends EventEmitter {
|
|
|
13043
13991
|
whatsNewRoles() {
|
|
13044
13992
|
if (this.runtimeIdentity?.kind === "classic")
|
|
13045
13993
|
return ["classic"];
|
|
13046
|
-
if (this.config.general_topic === true || this.name
|
|
13994
|
+
if (this.config.general_topic === true || generalByName(this.name, this.config))
|
|
13047
13995
|
return ["general"];
|
|
13048
13996
|
const set = resolveToolSet(this.config, this.name);
|
|
13049
13997
|
return set === "coordinator" || set === "full" ? ["worker", "coordinator"] : ["worker"];
|
|
@@ -13069,9 +14017,14 @@ export class Daemon extends EventEmitter {
|
|
|
13069
14017
|
this.logger.debug({ err }, "what's-new not prepared");
|
|
13070
14018
|
}
|
|
13071
14019
|
}
|
|
13072
|
-
async trySpawnInsideGate(reuseWindow = false, startupTimeoutMs) {
|
|
14020
|
+
async trySpawnInsideGate(reuseWindow = false, startupTimeoutMs, repairAdmission) {
|
|
14021
|
+
if (this.nativePaneLifecycle)
|
|
14022
|
+
throw Error("Native relaunch requires its owned exit and a new lifecycle reservation");
|
|
14023
|
+
let expectedAttempt = this.launchAttempt;
|
|
14024
|
+
const admit = () => { this.startupAdmission?.(); if (repairAdmission && !repairAdmission(expectedAttempt))
|
|
14025
|
+
throw new Error("CLI repair superseded by another launch, pause or stop"); };
|
|
13073
14026
|
this.assertSessionOomAdmission();
|
|
13074
|
-
|
|
14027
|
+
admit();
|
|
13075
14028
|
const launchFence = this.launchFenceEpoch;
|
|
13076
14029
|
const backendConfig = this.buildBackendConfig();
|
|
13077
14030
|
// A compatibility refusal is not a failed resume: no configuration, pin, history or pane may change.
|
|
@@ -13097,7 +14050,7 @@ export class Daemon extends EventEmitter {
|
|
|
13097
14050
|
catch { /* unknown capability → the backend's conservative form */ }
|
|
13098
14051
|
// Thrown, not `false`: a false verdict reads as "the CLI failed to start" and sends the startup path
|
|
13099
14052
|
// into its resume-retry / set-the-session-aside handling, for an instance somebody just stopped.
|
|
13100
|
-
|
|
14053
|
+
admit();
|
|
13101
14054
|
this.assertSessionOomAdmission();
|
|
13102
14055
|
if (launchFence !== this.launchFenceEpoch)
|
|
13103
14056
|
throw new Error("Launch cancelled: the instance was stopped or paused while the launch was being prepared");
|
|
@@ -13156,11 +14109,14 @@ export class Daemon extends EventEmitter {
|
|
|
13156
14109
|
// The CLI's own shell sets a zero coredump_filter first (#1113): this pane
|
|
13157
14110
|
// may belong to a tmux server the fleet did not start, which would hand
|
|
13158
14111
|
// the CLI its own (full) filter instead of the fleet's.
|
|
13159
|
-
|
|
14112
|
+
admit();
|
|
13160
14113
|
const cmd = coredumpFilterLaunchPrefix() + `${envPrefix} ` + this.backend.buildCommand(launchConfig);
|
|
13161
14114
|
// Every launched command re-arms the passive-transient check, including a
|
|
13162
14115
|
// retry inside the same spawn: its load is a new one.
|
|
13163
|
-
this.launchAttempt
|
|
14116
|
+
expectedAttempt = ++this.launchAttempt;
|
|
14117
|
+
admit();
|
|
14118
|
+
await this.prepareQuotaReplayHistory(reuseWindow);
|
|
14119
|
+
admit();
|
|
13164
14120
|
this.interactionObservation.reset(this.interactionOwner());
|
|
13165
14121
|
this.clearInteractionConfirmation();
|
|
13166
14122
|
// A launch that cannot paint a passive transient (Codex: a fresh start
|
|
@@ -13180,16 +14136,16 @@ export class Daemon extends EventEmitter {
|
|
|
13180
14136
|
this.emit("backend_launch_warning", { name: this.name, message: note, quiet: true });
|
|
13181
14137
|
}
|
|
13182
14138
|
// Ensure tmux session exists (may have been destroyed if all windows died)
|
|
13183
|
-
await
|
|
13184
|
-
if (this.stormWindow?.observeServerAlive(await
|
|
14139
|
+
await this.paneHost.ensureSession(this.tmuxSessionName);
|
|
14140
|
+
if (this.stormWindow?.observeServerAlive(await this.paneHost.getServerPid(this.tmuxSessionName))) {
|
|
13185
14141
|
this.emit("tmux_server_crash", this.name);
|
|
13186
14142
|
}
|
|
13187
|
-
|
|
14143
|
+
admit();
|
|
13188
14144
|
let windowId;
|
|
13189
14145
|
this.assertSessionOomAdmission();
|
|
13190
14146
|
if (reuseWindow) {
|
|
13191
14147
|
this.controlClient?.unregisterWindow(this.tmux.getWindowId());
|
|
13192
|
-
await this.tmux.respawnWindow(cmd, resolvedCwd);
|
|
14148
|
+
await this.tmux.respawnWindow(cmd, resolvedCwd, repairAdmission ? admit : undefined);
|
|
13193
14149
|
windowId = this.tmux.getWindowId();
|
|
13194
14150
|
}
|
|
13195
14151
|
else {
|
|
@@ -13200,8 +14156,8 @@ export class Daemon extends EventEmitter {
|
|
|
13200
14156
|
if (retired && retired !== windowId)
|
|
13201
14157
|
this.controlClient?.unregisterWindow(retired);
|
|
13202
14158
|
}
|
|
13203
|
-
|
|
13204
|
-
|
|
14159
|
+
admit();
|
|
14160
|
+
this.writeWindowId(windowId);
|
|
13205
14161
|
// Enable remain-on-exit to capture exit codes on crash
|
|
13206
14162
|
await this.tmux.setRemainOnExit().catch(err => {
|
|
13207
14163
|
this.logger.warn({ err }, "Failed to set remain-on-exit — exit codes will not be captured");
|
|
@@ -13235,6 +14191,7 @@ export class Daemon extends EventEmitter {
|
|
|
13235
14191
|
else {
|
|
13236
14192
|
await new Promise(r => setTimeout(r, 10_000));
|
|
13237
14193
|
}
|
|
14194
|
+
admit();
|
|
13238
14195
|
// Dismiss confirmation dialogs and verify CLI reached prompt.
|
|
13239
14196
|
// With remain-on-exit, isWindowAlive() returns true even for dead panes,
|
|
13240
14197
|
// but a startup crash would already be caught by waitForOutput/waitForIdle above.
|
|
@@ -13317,6 +14274,7 @@ export class Daemon extends EventEmitter {
|
|
|
13317
14274
|
let lastDialog = null;
|
|
13318
14275
|
let lastTransient = null;
|
|
13319
14276
|
let captureFailures = 0;
|
|
14277
|
+
let lastPane = null;
|
|
13320
14278
|
let attempts = 0;
|
|
13321
14279
|
// A safety-critical startup choice is one-shot. If the CLI has not
|
|
13322
14280
|
// repainted after Enter, let the following hold-only entry report it
|
|
@@ -13340,11 +14298,13 @@ export class Daemon extends EventEmitter {
|
|
|
13340
14298
|
try {
|
|
13341
14299
|
pane = await this.tmux.capturePane();
|
|
13342
14300
|
this.startupAdmission?.();
|
|
14301
|
+
lastPane = pane;
|
|
13343
14302
|
}
|
|
13344
14303
|
catch (err) {
|
|
13345
14304
|
this.startupAdmission?.();
|
|
13346
14305
|
// Transient tmux trouble is not evidence about the CLI. Returning false
|
|
13347
14306
|
// here would clear the session; retry within the budget instead.
|
|
14307
|
+
lastPane = null;
|
|
13348
14308
|
captureFailures++;
|
|
13349
14309
|
this.logger.debug({ err, captureFailures }, "capture-pane failed during the startup dialog scan — retrying");
|
|
13350
14310
|
// Only a POSITIVE dead pane ends the scan; an unanswerable liveness
|
|
@@ -13455,12 +14415,15 @@ export class Daemon extends EventEmitter {
|
|
|
13455
14415
|
// each have seen a respawn, pause or stop.
|
|
13456
14416
|
if (!owned())
|
|
13457
14417
|
return false;
|
|
14418
|
+
const keyScreen = this.nativePaneLifecycle ? await this.tmux.capturePane() : answeredPane;
|
|
14419
|
+
if (!owned() || !Daemon.dialogMatches(dialog, keyScreen))
|
|
14420
|
+
return false;
|
|
13458
14421
|
if (key === "Up" || key === "Down" || key === "Enter" || key === "Escape") {
|
|
13459
|
-
if (!await this.tmux.sendSpecialKey(key))
|
|
14422
|
+
if (!await (this.nativePaneLifecycle ? this.tmux.sendSpecialKey(key, undefined, { kind: "dialog", screen: keyScreen }) : this.tmux.sendSpecialKey(key)))
|
|
13460
14423
|
return false;
|
|
13461
14424
|
}
|
|
13462
14425
|
else {
|
|
13463
|
-
if (!await this.tmux.sendKeys(key))
|
|
14426
|
+
if (!await (this.nativePaneLifecycle ? this.tmux.sendKeys(key, { kind: "dialog", screen: keyScreen }) : this.tmux.sendKeys(key)))
|
|
13464
14427
|
return false;
|
|
13465
14428
|
}
|
|
13466
14429
|
await new Promise(r => setTimeout(r, 200));
|
|
@@ -13474,7 +14437,8 @@ export class Daemon extends EventEmitter {
|
|
|
13474
14437
|
// Wait for next screen to render — bounded by what is left of the budget.
|
|
13475
14438
|
const renderWait = Math.max(0, Math.min(10_000, remaining()));
|
|
13476
14439
|
if (this.controlClient) {
|
|
13477
|
-
const wid =
|
|
14440
|
+
const wid = this.nativePaneLifecycle ? ownerTmux.getWindowId()
|
|
14441
|
+
: readFileSync(join(this.instanceDir, "window-id"), "utf-8").trim();
|
|
13478
14442
|
await this.controlClient.waitForIdle(wid, renderWait);
|
|
13479
14443
|
}
|
|
13480
14444
|
else {
|
|
@@ -13510,13 +14474,17 @@ export class Daemon extends EventEmitter {
|
|
|
13510
14474
|
// scan parked on the old limit text.
|
|
13511
14475
|
const codexReady = this.backend.binaryName !== "codex"
|
|
13512
14476
|
|| this.isCodexLivePaneSnapshot(pane);
|
|
13513
|
-
|
|
14477
|
+
const nativeComposerReady = !this.nativePaneLifecycle || (this.backend?.readInputRow
|
|
14478
|
+
? this.backend.readInputRow(pane) !== null : this.backend?.isDeliveryInputReadyPane?.(pane) === true);
|
|
14479
|
+
if (readyPatternMatches && codexReady && nativeComposerReady) {
|
|
13514
14480
|
cleanReadyPolls++;
|
|
13515
14481
|
if (cleanReadyPolls >= 2 || remaining() <= 0) {
|
|
13516
14482
|
// A real ready prompt (with no fatal dialog on screen — those are
|
|
13517
14483
|
// matched above, before this check) means the fatal screen is gone,
|
|
13518
14484
|
// e.g. the user fixed the config and the instance respawned.
|
|
13519
14485
|
this.fatalStartupBlocked = false;
|
|
14486
|
+
if (owned())
|
|
14487
|
+
this.takeQuotaReplayBaseline(pane);
|
|
13520
14488
|
return true;
|
|
13521
14489
|
}
|
|
13522
14490
|
await sleep();
|
|
@@ -13555,6 +14523,8 @@ export class Daemon extends EventEmitter {
|
|
|
13555
14523
|
this.logger.warn({ attempts, budgetMs, captureFailures }, "Startup scan exhausted without a ready prompt or a known dialog — assuming ready (unknown CLI screen)");
|
|
13556
14524
|
}
|
|
13557
14525
|
this.startupAdmission?.();
|
|
14526
|
+
if (owned() && lastPane !== null && !lastDialog && !lastTransient)
|
|
14527
|
+
this.takeQuotaReplayBaseline(lastPane);
|
|
13558
14528
|
return true;
|
|
13559
14529
|
}
|
|
13560
14530
|
/**
|
|
@@ -13602,6 +14572,11 @@ export class Daemon extends EventEmitter {
|
|
|
13602
14572
|
* lookup is the backend's own single-flight one: an idle observation already running it is joined,
|
|
13603
14573
|
* not repeated. Never rejects.
|
|
13604
14574
|
*/
|
|
14575
|
+
/** The window-id file and its socket tag: a window-id without it is 2.3's (tmux-legacy.ts). */
|
|
14576
|
+
writeWindowId(windowId) {
|
|
14577
|
+
writeFileSync(join(this.instanceDir, "window-id"), windowId);
|
|
14578
|
+
tagWindowId(this.instanceDir, tmuxSocket(), windowId);
|
|
14579
|
+
}
|
|
13605
14580
|
checkpointSessionId() {
|
|
13606
14581
|
const refresh = this.backend?.refreshSessionId;
|
|
13607
14582
|
if (this.skipResume || !refresh) {
|
|
@@ -13635,6 +14610,16 @@ export class Daemon extends EventEmitter {
|
|
|
13635
14610
|
void refresh.call(this.backend).then(() => this.saveSessionId(), () => { });
|
|
13636
14611
|
}
|
|
13637
14612
|
saveSessionId() {
|
|
14613
|
+
if (this.nativePaneLifecycle) {
|
|
14614
|
+
try {
|
|
14615
|
+
this.nativePaneLifecycle.checkpointSession();
|
|
14616
|
+
this.ownedWorkingSession = this.backend?.getSessionId() ?? null;
|
|
14617
|
+
}
|
|
14618
|
+
catch (err) {
|
|
14619
|
+
this.logger.warn({ err }, "Native conversation checkpoint is unconfirmed");
|
|
14620
|
+
}
|
|
14621
|
+
return;
|
|
14622
|
+
}
|
|
13638
14623
|
// When a resume failure has forced a fresh start, don't persist the stale id
|
|
13639
14624
|
// back from statusline.json — that would re-arm --continue and re-loop.
|
|
13640
14625
|
if (this.skipResume)
|