@songsid/agend 2.3.4 → 2.3.5-alpha.11
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 +182 -0
- package/dist/accounts-view.js +204 -0
- package/dist/accounts-view.js.map +1 -0
- package/dist/agent-cli-instructions.md +3 -3
- 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 +81 -1
- package/dist/auth-api.js +365 -14
- 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/settings-role.d.ts +56 -0
- package/dist/authority/settings-role.js +48 -0
- package/dist/authority/settings-role.js.map +1 -0
- 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 +18 -12
- package/dist/backend/claude-code.js +228 -145
- package/dist/backend/claude-code.js.map +1 -1
- package/dist/backend/cli-env-probe.js +6 -2
- package/dist/backend/cli-env-probe.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-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.d.ts +148 -116
- package/dist/backend/codex.js +1355 -1225
- package/dist/backend/codex.js.map +1 -1
- package/dist/backend/credential-profile.d.ts +2 -0
- package/dist/backend/credential-profile.js +4 -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 +1 -1
- 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 +25 -1
- package/dist/backend/types.js.map +1 -1
- package/dist/backend-availability.d.ts +15 -0
- package/dist/backend-availability.js +37 -1
- package/dist/backend-availability.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 +23 -0
- package/dist/bundled-tmux-guard.js +90 -0
- package/dist/bundled-tmux-guard.js.map +1 -0
- 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 +0 -3
- package/dist/channel/adapters/telegram.js +1 -30
- 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 +0 -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 +60 -0
- package/dist/claude-auth-status.js +165 -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-audited.d.ts +60 -0
- package/dist/cli-audited.js +84 -0
- package/dist/cli-audited.js.map +1 -0
- package/dist/cli-capability.d.ts +217 -0
- package/dist/cli-capability.js +55 -0
- package/dist/cli-capability.js.map +1 -0
- package/dist/cli-caps-module.d.ts +33 -0
- package/dist/cli-caps-module.js +45 -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 +237 -0
- package/dist/cli-registry-check.js.map +1 -0
- package/dist/cli-registry.d.ts +578 -0
- package/dist/cli-registry.js +83 -0
- package/dist/cli-registry.js.map +1 -0
- package/dist/cli-spec-antigravity.d.ts +71 -0
- package/dist/cli-spec-antigravity.js +47 -0
- package/dist/cli-spec-antigravity.js.map +1 -0
- package/dist/cli-spec-claude-code.d.ts +93 -0
- package/dist/cli-spec-claude-code.js +37 -0
- package/dist/cli-spec-claude-code.js.map +1 -0
- package/dist/cli-spec-codex.d.ts +87 -0
- package/dist/cli-spec-codex.js +40 -0
- package/dist/cli-spec-codex.js.map +1 -0
- package/dist/cli-spec-grok.d.ts +64 -0
- package/dist/cli-spec-grok.js +40 -0
- package/dist/cli-spec-grok.js.map +1 -0
- package/dist/cli-spec-kiro-cli.d.ts +79 -0
- package/dist/cli-spec-kiro-cli.js +40 -0
- package/dist/cli-spec-kiro-cli.js.map +1 -0
- package/dist/cli-spec-muse.d.ts +54 -0
- package/dist/cli-spec-muse.js +40 -0
- package/dist/cli-spec-muse.js.map +1 -0
- package/dist/cli-spec-opencode.d.ts +60 -0
- package/dist/cli-spec-opencode.js +42 -0
- package/dist/cli-spec-opencode.js.map +1 -0
- package/dist/cli.js +286 -68
- package/dist/cli.js.map +1 -1
- package/dist/config-validator.js +99 -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 +165 -7
- package/dist/daemon.js +1307 -307
- 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 +7 -3
- 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 +1108 -27
- package/dist/fleet-manager.js +5735 -462
- package/dist/fleet-manager.js.map +1 -1
- package/dist/fleet-process-handlers.d.ts +1 -1
- package/dist/fleet-process-handlers.js +3 -2
- package/dist/fleet-process-handlers.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 +101 -39
- package/dist/general-knowledge/skills/credential-profiles/SKILL.md +23 -9
- package/dist/general-knowledge/skills/cross-instance-messaging/SKILL.md +9 -1
- 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 +51 -33
- 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 +9 -3
- package/dist/instance-config-impact.js.map +1 -1
- package/dist/instance-lifecycle.d.ts +52 -5
- package/dist/instance-lifecycle.js +493 -200
- package/dist/instance-lifecycle.js.map +1 -1
- package/dist/instructions.d.ts +2 -0
- package/dist/instructions.js +35 -6
- 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 +345 -99
- package/dist/locale.js.map +1 -1
- package/dist/logger.d.ts +5 -3
- package/dist/logger.js +323 -85
- 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.d.ts +2 -2
- package/dist/login-manager.js +28 -6
- 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/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 +25 -0
- package/dist/native-model-catalog.js +181 -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 +8 -0
- package/dist/needs-you-hub.js +29 -3
- package/dist/needs-you-hub.js.map +1 -1
- package/dist/needs-you.d.ts +78 -2
- package/dist/needs-you.js +45 -2
- 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 +17 -1
- 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 +413 -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-autostart.d.ts +61 -0
- package/dist/runtime-autostart.js +161 -0
- package/dist/runtime-autostart.js.map +1 -0
- package/dist/runtime-background.d.ts +200 -0
- package/dist/runtime-background.js +480 -0
- package/dist/runtime-background.js.map +1 -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-background.d.ts +92 -0
- package/dist/runtime-cli-background.js +336 -0
- package/dist/runtime-cli-background.js.map +1 -0
- package/dist/runtime-cli-install.d.ts +295 -0
- package/dist/runtime-cli-install.js +869 -0
- package/dist/runtime-cli-install.js.map +1 -0
- package/dist/runtime-cli.d.ts +21 -0
- package/dist/runtime-cli.js +578 -0
- package/dist/runtime-cli.js.map +1 -0
- package/dist/runtime-client-store.d.ts +86 -0
- package/dist/runtime-client-store.js +387 -0
- package/dist/runtime-client-store.js.map +1 -0
- package/dist/runtime-client.d.ts +258 -0
- package/dist/runtime-client.js +1353 -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 +201 -0
- package/dist/runtime-coordinator.js +1514 -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-enroll-notice.d.ts +4 -0
- package/dist/runtime-enroll-notice.js +21 -0
- package/dist/runtime-enroll-notice.js.map +1 -0
- package/dist/runtime-enrollment.d.ts +21 -0
- package/dist/runtime-enrollment.js +52 -0
- package/dist/runtime-enrollment.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 +340 -0
- package/dist/runtime-protocol.js +179 -0
- package/dist/runtime-protocol.js.map +1 -0
- package/dist/runtime-remote-accounts.d.ts +209 -0
- package/dist/runtime-remote-accounts.js +714 -0
- package/dist/runtime-remote-accounts.js.map +1 -0
- package/dist/runtime-remote-setup.d.ts +108 -0
- package/dist/runtime-remote-setup.js +532 -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 +86 -0
- package/dist/runtime-update-controller.js +743 -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 +36 -2
- package/dist/settings-api.js +734 -9
- 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 +5 -3
- package/dist/settings-change.js +61 -1
- package/dist/settings-change.js.map +1 -1
- package/dist/settings-confirmation.d.ts +44 -7
- package/dist/settings-confirmation.js +56 -14
- package/dist/settings-confirmation.js.map +1 -1
- package/dist/settings-effect.d.ts +22 -0
- package/dist/settings-effect.js +294 -4
- package/dist/settings-effect.js.map +1 -1
- package/dist/settings-http-confirmation.d.ts +35 -0
- package/dist/settings-http-confirmation.js +153 -13
- package/dist/settings-http-confirmation.js.map +1 -1
- package/dist/settings-instance-patch.js +1 -1
- package/dist/settings-instance-patch.js.map +1 -1
- package/dist/settings-request-capability.d.ts +14 -0
- package/dist/settings-request-capability.js +12 -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 +7 -4
- 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/subagent-records.d.ts +45 -0
- package/dist/subagent-records.js +214 -0
- package/dist/subagent-records.js.map +1 -0
- package/dist/subagent-service.d.ts +27 -0
- package/dist/subagent-service.js +199 -0
- package/dist/subagent-service.js.map +1 -0
- 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 +11 -4
- package/dist/tmux-manager.js +64 -40
- 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 +29 -0
- package/dist/ui/accounts-keepalive.js +118 -0
- package/dist/ui/accounts-manage.js +256 -0
- package/dist/ui/accounts-view.js +460 -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 +169 -97
- package/dist/ui/chat-ambient.js +1 -1
- package/dist/ui/chat-commands.js +7 -0
- package/dist/ui/chat-md-strings.js +3 -9
- package/dist/ui/chat-msg-actions.js +50 -4
- package/dist/ui/chat-quote.js +256 -0
- package/dist/ui/chat-render.js +3 -670
- package/dist/ui/chat-store.js +23 -7
- package/dist/ui/chat-strings.js +3 -285
- package/dist/ui/chat-thread.js +3 -969
- 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/host-install.js +290 -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 +77 -0
- package/dist/ui/hub-company-join.js +137 -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 +56 -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/model-picker.js +68 -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 +167 -87
- package/dist/ui/panel-details.js +3 -2
- package/dist/ui/panel-fleet.js +183 -32
- package/dist/ui/panel-hub.js +974 -0
- package/dist/ui/panel-log.js +4 -4
- package/dist/ui/panel-needs.js +179 -13
- package/dist/ui/panel-notices.js +4 -3
- package/dist/ui/panel-runtimes.js +645 -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 -548
- 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 +214 -0
- package/dist/ui/runtime-commands.d.ts +6 -0
- package/dist/ui/runtime-commands.js +92 -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 +6 -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 +57 -13
- package/dist/ui/settings-confirm.js +108 -10
- package/dist/ui/settings-devices.js +283 -0
- package/dist/ui/settings-dialogs.js +72 -28
- package/dist/ui/settings-guests.js +29 -14
- package/dist/ui/settings-hub-browser-certificate.js +76 -0
- package/dist/ui/settings-hub-company-join.js +165 -0
- package/dist/ui/settings-hub-connection.js +121 -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 +61 -0
- package/dist/ui/settings-hub-section.js +63 -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 +266 -0
- package/dist/ui/settings-layout.js +246 -0
- package/dist/ui/settings-model.js +10 -1
- package/dist/ui/settings-named-test.js +2 -2
- package/dist/ui/settings-outside.js +310 -0
- package/dist/ui/settings-quota-notice.js +102 -0
- package/dist/ui/settings-registry.js +26 -6
- package/dist/ui/settings-restart-strings.js +17 -0
- package/dist/ui/settings-revoke-strings.js +28 -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 +146 -71
- package/dist/ui/settings-update.js +69 -0
- package/dist/ui/settings-web-authority.js +29 -15
- package/dist/ui/shared/accounts-keepalive.css +12 -0
- package/dist/ui/shared/accounts.css +88 -0
- package/dist/ui/shared/agend-auth.js +8 -1
- package/dist/ui/shared/app-i18n.js +25 -18
- package/dist/ui/shared/app-route.js +12 -3
- package/dist/ui/shared/app-session.js +13 -12
- package/dist/ui/shared/app-shell.js +320 -48
- 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 +1542 -8
- 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/device-roles.js +27 -0
- package/dist/ui/shared/header-tools.js +9 -9
- package/dist/ui/shared/host-install.css +10 -0
- 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 +57 -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/model-picker.css +21 -0
- package/dist/ui/shared/page-head.js +8 -0
- 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 +55 -0
- package/dist/ui/shared/settings-width.js +31 -0
- package/dist/ui/shared/setup-host-text.js +8 -5
- package/dist/ui/shared/side-rail.js +15 -0
- package/dist/ui/shared/signin-authenticator.js +60 -0
- package/dist/ui/shared/signin.js +315 -25
- package/dist/ui/shared/subagent-row.css +15 -0
- 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 +4 -73
- 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-strings.js +26 -18
- package/dist/ui/shared/web-authorize.js +55 -5
- package/dist/ui/shared/workspace-follow.css +19 -0
- package/dist/ui/shared/workspace.css +20 -0
- package/dist/ui/signin-authenticator.html +60 -0
- package/dist/ui/signin.html +27 -2
- package/dist/ui/structured-signin.js +89 -39
- package/dist/ui/subagent-row.js +72 -0
- package/dist/ui/web-terminal/terminal.js +9 -9
- 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 +6 -3
- 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/update-npm-env.d.ts +70 -0
- package/dist/update-npm-env.js +128 -0
- package/dist/update-npm-env.js.map +1 -0
- 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 +3 -0
- package/dist/usage-rollup.js +2 -0
- package/dist/usage-rollup.js.map +1 -1
- package/dist/view-api.d.ts +2 -8
- package/dist/view-api.js +8 -16
- package/dist/view-api.js.map +1 -1
- package/dist/web-api.d.ts +163 -3
- package/dist/web-api.js +1391 -32
- 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-channel-echo.js +3 -1
- package/dist/web-channel-echo.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-commands.d.ts +9 -1
- package/dist/web-commands.js +7 -1
- package/dist/web-commands.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-host-install.d.ts +127 -0
- package/dist/web-host-install.js +165 -0
- package/dist/web-host-install.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 +273 -0
- package/dist/web-remote-access.js +610 -0
- package/dist/web-remote-access.js.map +1 -0
- package/dist/web-session.d.ts +61 -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-device.d.ts +16 -0
- package/dist/web-signin-device.js +81 -0
- package/dist/web-signin-device.js.map +1 -0
- 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 +106 -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 +207 -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 +99 -0
- package/dist/windows-cli-worker.js +729 -0
- package/dist/windows-cli-worker.js.map +1 -0
- package/dist/windows-cli.d.ts +130 -0
- package/dist/windows-cli.js +424 -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 +24 -4
- package/launcher/launchd-session-type.cjs +14 -0
- package/launcher/postinstall.cjs +27 -2
- 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 +618 -0
package/dist/daemon.js
CHANGED
|
@@ -1,9 +1,15 @@
|
|
|
1
|
+
import { nativePaneToolRefusal } from "./native-pane-tools.js";
|
|
2
|
+
import { generalByName } from "./general-instance.js";
|
|
3
|
+
import { codexMetadataHomes } from "./backend/codex-metadata.js";
|
|
4
|
+
import { claudeMinimumError, cliVersionBelow } from "./claude-model-minimum.js";
|
|
5
|
+
import { quotaNoticeProblem } from "./quota-notice-config.js";
|
|
6
|
+
import { quotaHistoryCount, quotaAfterInput } from "./pane-quota-history.js";
|
|
1
7
|
import { dialogScreenText } from "./dialog-screen-text.js";
|
|
2
8
|
import { readActiveKiroModel } from "./backend/kiro.js";
|
|
3
9
|
import { dashboardAccessOf } from "./dashboard-permissions.js";
|
|
4
10
|
import { sendPackSources } from "./web-office-pack-read.js";
|
|
5
11
|
import { agendVersion, planWhatsNew, readWhatsNewRecord, recordWhatsNew, withWhatsNew } from "./agent-whats-new.js";
|
|
6
|
-
import { join, dirname, resolve } from "node:path";
|
|
12
|
+
import { join, dirname, basename, resolve } from "node:path";
|
|
7
13
|
import { checkoutTarget, readCheckouts, releaseCandidate, reposRoot, verifyWorktree, writeCheckouts } from "./repo-worktree-guard.js";
|
|
8
14
|
import { mkdirSync, writeFileSync, readFileSync, readdirSync, existsSync, unlinkSync, rmSync, appendFileSync, statSync, renameSync } from "node:fs";
|
|
9
15
|
import { COMPACT_WATCH_TIMEOUT_MS, launchIdentity } from "./compact-watch.js";
|
|
@@ -20,8 +26,9 @@ import { assertNoSessionOomStop, readSessionOomStop, writeSessionOomStop, Sessio
|
|
|
20
26
|
import { mcpServerState } from "./mcp-liveness.js";
|
|
21
27
|
import { clearPausedMarker, writePausedMarker } from "./pause-marker.js";
|
|
22
28
|
import { writeBackgroundWorkEndedMarker } from "./background-work-ended.js";
|
|
23
|
-
import {
|
|
29
|
+
import { resolveTmuxLogicalSize, TmuxManager } from "./tmux-manager.js";
|
|
24
30
|
import { TranscriptMonitor } from "./transcript-monitor.js";
|
|
31
|
+
import { FollowLog } from "./workspace-follow.js";
|
|
25
32
|
import { createTranscriptSource } from "./transcript-sources.js";
|
|
26
33
|
import { TranscriptTurnLedger } from "./transcript-turns.js";
|
|
27
34
|
import { credentialProfileStoreHome, resolveCredentialProfile } from "./backend/credential-profile.js";
|
|
@@ -29,6 +36,8 @@ import { resolveToolSet, toolsFor } from "./tool-permissions.js";
|
|
|
29
36
|
import { TOOLS } from "./channel/mcp-tools.js";
|
|
30
37
|
import { dashboardAccessProblem, dashboardFeaturesOff, withoutFeatures } from "./dashboard-permissions.js";
|
|
31
38
|
import { getAgendHome } from "./paths.js";
|
|
39
|
+
import { legacyTmuxSocket, tmuxSocket } from "./tmux-binary.js";
|
|
40
|
+
import { migrateLegacyWindow, tagWindowId } from "./tmux-legacy.js";
|
|
32
41
|
import { scopedFleetConfigEnvironment } from "./web-experimental.js";
|
|
33
42
|
import { readAgentFile } from "./agent-file-read.js";
|
|
34
43
|
import { ASSET_UPLOAD_MAX_BYTES, receivePreview, sendAssetInParts, writePreview } from "./web-asset-parts.js";
|
|
@@ -48,6 +57,7 @@ import { HangDetector } from "./hang-detector.js";
|
|
|
48
57
|
import { writeSecretFile } from "./secret-file.js";
|
|
49
58
|
import { PaneWriteLock } from "./pane-write-lock.js";
|
|
50
59
|
import { answerRemoteCard } from "./remote-card-answer.js";
|
|
60
|
+
import { tmuxPaneHost } from "./tmux-pane-host.js";
|
|
51
61
|
import { buildFleetInstructions } from "./instructions.js";
|
|
52
62
|
import { formatHumanInboundMessage, prepareDeliveryWire, steerInboundEnvelope, BTW_INBOUND_PREFIX, humanBodyHash, humanOwnerObjectId } from "./human-delivery-receipts.js";
|
|
53
63
|
import { formatCrossInstanceInboundMessage, renderCrossInstanceHandoffMetadata, } from "./cross-instance-envelope.js";
|
|
@@ -55,8 +65,9 @@ import { agendMessageInInput, bottomRowIsReady, inputAreaText, inputShowsPastedT
|
|
|
55
65
|
import { TurnReplyGuard, formatReplyDropDetection, turnExpectsPersonReply } from "./turn-reply-guard.js";
|
|
56
66
|
import { CLAUDE_CREDIT_BALANCE_LOW, CLAUDE_MODEL_USAGE_LIMIT, CLAUDE_USAGE_LIMIT_PAUSE } from "./backend/claude-transcript-errors.js";
|
|
57
67
|
import { t } from "./locale.js";
|
|
58
|
-
import { claudeResetTime, quotaPausedLine } from "./quota-notice.js";
|
|
68
|
+
import { claudeResetInstant, claudeResetTime, quotaPausedLine } from "./quota-notice.js";
|
|
59
69
|
import { MuseUsageRelay, clearMuseUsageSnapshot } from "./muse-usage-relay.js";
|
|
70
|
+
import { reconcileNativePaneTarget } from "./native-pane-reconciliation.js";
|
|
60
71
|
import { deliveryContentDigest } from "./delivery-outbox.js";
|
|
61
72
|
import { consumedWatches } from "./delivery-consumed-watch.js";
|
|
62
73
|
import { queueResumePolicyForAttempt } from "./delivery-queue-evidence.js";
|
|
@@ -67,7 +78,7 @@ import { TranscriptDeltaReader } from "./transcript-delta-reader.js";
|
|
|
67
78
|
import { buildResumeContinuation, clearInFlightTurnMarker, consumeInFlightTurnMarker, decideTurnResume, normalizeResumeBackend, readResumeFingerprint, RESUME_BLOCKING_DELIVERY_STATES, writeInFlightTurnMarker, } from "./turn-resume.js";
|
|
68
79
|
import { codexLiveRowMatches } from "./backend/codex.js";
|
|
69
80
|
import { codexPackageProblemMessage } from "./backend/codex-package.js";
|
|
70
|
-
import { claudeConfigDirFor, claudeProfileConfigDir, claudeSwitchDialog, claudeSwitchTargetMatches } from "./backend/claude-code.js";
|
|
81
|
+
import { claudeConfigDirFor, claudeProfileConfigDir, claudeProjectKey, claudeSwitchDialog, claudeSwitchTargetMatches } from "./backend/claude-code.js";
|
|
71
82
|
import { MuseBackend } from "./backend/muse.js";
|
|
72
83
|
import { BACKEND_LABELS, InteractionObservation, INTERACTION_CONFIRM_MS, sameInteractionOwner } from "./interaction-observation.js";
|
|
73
84
|
import { unrecognisedPromptShape } from "./unrecognised-prompt.js";
|
|
@@ -190,20 +201,20 @@ export function sameProjectFamily(a, b) {
|
|
|
190
201
|
const fx = family(x), fy = family(y);
|
|
191
202
|
return fx.length > 0 && fx === fy;
|
|
192
203
|
}
|
|
204
|
+
/** At most this many fleet decisions, and this many team + directory ones, in one instance's Active Decisions. */
|
|
205
|
+
export const ACTIVE_DECISION_CAPS = { fleet: 20, scoped: 20 };
|
|
193
206
|
/**
|
|
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.
|
|
207
|
+
* Bound an instance's already-selected decisions (newest first, as the store orders them): fleet ones and its own team
|
|
208
|
+
* and directory ones are capped apart, AFTER selection, so nobody else's rows take an instance's places.
|
|
204
209
|
*/
|
|
205
|
-
export function
|
|
210
|
+
export function capActiveDecisions(selected) {
|
|
211
|
+
let fleet = 0, scoped = 0;
|
|
212
|
+
return selected.filter(d => d.scope === "fleet" ? fleet++ < ACTIVE_DECISION_CAPS.fleet : scoped++ < ACTIVE_DECISION_CAPS.scoped);
|
|
213
|
+
}
|
|
214
|
+
export function selectRelevantDecisions(all, workDir, isDispatcher = false, teams = []) {
|
|
206
215
|
return all.filter(d => {
|
|
216
|
+
if (d.scope === "team")
|
|
217
|
+
return !!d.team && teams.includes(d.team);
|
|
207
218
|
if (d.project_root === workDir)
|
|
208
219
|
return true; // own project, any scope
|
|
209
220
|
if (d.scope !== "fleet")
|
|
@@ -1116,6 +1127,7 @@ export class Daemon extends EventEmitter {
|
|
|
1116
1127
|
spawnGate;
|
|
1117
1128
|
stormWindow;
|
|
1118
1129
|
backendOutage;
|
|
1130
|
+
paneTransport;
|
|
1119
1131
|
/** #1314: fleet-directory fallbacks already reported to the topic (once per daemon, per field and path). */
|
|
1120
1132
|
promptFileFallbackNoticed = new Set();
|
|
1121
1133
|
/** Identity of this live Daemon object; changes on object stop/restart. */
|
|
@@ -1129,6 +1141,20 @@ export class Daemon extends EventEmitter {
|
|
|
1129
1141
|
transcriptMonitor = null;
|
|
1130
1142
|
/** #1218: the transcript this instance's monitor follows now (the Log tab reads it on demand; nothing runs for it here). */
|
|
1131
1143
|
logTranscriptPath() { return this.transcriptMonitor?.currentPath() ?? null; }
|
|
1144
|
+
/** Optional read-only child lane: only a current owned tmux launch, never stopped/native/cwd discovery. */
|
|
1145
|
+
subagentSource() {
|
|
1146
|
+
const backend = this.config.backend ?? "claude-code", path = this.logTranscriptPath();
|
|
1147
|
+
if (this.nativePaneLifecycle || (backend !== "claude-code" && backend !== "codex") || !path || !this.tmux || this.processStatus !== "running"
|
|
1148
|
+
|| this.spawning || this.runtimeMonitorsFrozen)
|
|
1149
|
+
return null;
|
|
1150
|
+
const cwd = this.config.working_directory || process.cwd();
|
|
1151
|
+
const match = /([a-f0-9]{8}(?:-[a-f0-9]{4}){3}-[a-f0-9]{12})\.jsonl$/i.exec(path);
|
|
1152
|
+
if (!match || (backend === "claude-code" && basename(path) !== match[1] + ".jsonl"))
|
|
1153
|
+
return null;
|
|
1154
|
+
return { backend, path, sessionId: match[1], cwd,
|
|
1155
|
+
root: backend === "claude-code" ? join(this.claudeConfigDir(), "projects", claudeProjectKey(cwd)) : join(codexMetadataHomes(this.instanceDir).sharedHome, "sessions"),
|
|
1156
|
+
owner: JSON.stringify(this.getInteractionSnapshot().owner) };
|
|
1157
|
+
}
|
|
1132
1158
|
/** #1218 (kiro): the launch this daemon's backend last built, for the Log's reason only (kiro-log-gate.ts). */
|
|
1133
1159
|
logLaunch() { return this.backend?.logLaunch?.() ?? null; }
|
|
1134
1160
|
async kiroMigrationIdle() {
|
|
@@ -1542,6 +1568,12 @@ export class Daemon extends EventEmitter {
|
|
|
1542
1568
|
* when a startup scan reaches a real ready prompt, or on wake().
|
|
1543
1569
|
*/
|
|
1544
1570
|
fatalStartupBlocked = false;
|
|
1571
|
+
/** #3441: one repair budget survives every automatic spawn on this daemon. */
|
|
1572
|
+
modelMinimumRepairUsed = false;
|
|
1573
|
+
modelMinimumFlight = null;
|
|
1574
|
+
modelMinimumBlocked = false;
|
|
1575
|
+
modelMinimumUpdateNotified = false;
|
|
1576
|
+
cliRepairSessionId;
|
|
1545
1577
|
/** model_error seen mid-turn: notify only if it survives to the idle screen. */
|
|
1546
1578
|
pendingModelErrorKey = null;
|
|
1547
1579
|
/** Optional per-instance localhost relay used to observe Muse usage events. */
|
|
@@ -1794,6 +1826,85 @@ export class Daemon extends EventEmitter {
|
|
|
1794
1826
|
// still booting. Its new tmux window starts empty before resume restores the
|
|
1795
1827
|
// old transcript, so pre-ready scans must not lower this seeded baseline.
|
|
1796
1828
|
seededErrorCountBaselines = new Map();
|
|
1829
|
+
nativeQuotaReplayTaken = false;
|
|
1830
|
+
quotaReplay = null;
|
|
1831
|
+
paneQuotaPatterns() {
|
|
1832
|
+
if (!["codex", "grok"].includes(this.backend?.binaryName ?? ""))
|
|
1833
|
+
return [];
|
|
1834
|
+
const patterns = this.backend?.getErrorPatterns?.() ?? [];
|
|
1835
|
+
return this.backend?.binaryName === "codex" ? patterns.filter(ep => Daemon.isCodexUsageLimitPause(ep)) : patterns.filter(ep => ep.type === "quota");
|
|
1836
|
+
}
|
|
1837
|
+
async prepareQuotaReplayHistory(reuseWindow) {
|
|
1838
|
+
this.quotaReplay = null;
|
|
1839
|
+
const backend = this.backend, owner = this.tmux, window = owner?.getWindowId?.();
|
|
1840
|
+
const spawn = this.spawnGeneration, fence = this.launchFenceEpoch, attempt = this.launchAttempt;
|
|
1841
|
+
const current = () => backend === this.backend && owner === this.tmux && window === owner?.getWindowId?.()
|
|
1842
|
+
&& spawn === this.spawnGeneration && fence === this.launchFenceEpoch && attempt === this.launchAttempt;
|
|
1843
|
+
const replay = backend?.quotaReplayHistory?.();
|
|
1844
|
+
if (replay)
|
|
1845
|
+
this.quotaReplay = { ...replay, spawn, fence, attempt };
|
|
1846
|
+
// A Grok wake keeps its exited pane. The replacement's first ready pane is not history proof.
|
|
1847
|
+
if (reuseWindow && backend?.resumesPreservedQuotaHistory?.()) {
|
|
1848
|
+
let oldPane;
|
|
1849
|
+
try {
|
|
1850
|
+
oldPane = await owner.capturePane();
|
|
1851
|
+
}
|
|
1852
|
+
catch {
|
|
1853
|
+
return;
|
|
1854
|
+
}
|
|
1855
|
+
this.startupAdmission?.();
|
|
1856
|
+
if (!current())
|
|
1857
|
+
return;
|
|
1858
|
+
const patterns = this.paneQuotaPatterns();
|
|
1859
|
+
const messages = oldPane.split(/\r?\n/).filter(row => patterns.some(ep => ep.pattern.test(row)));
|
|
1860
|
+
this.quotaReplay = { messages, current: () => true, spawn, fence, attempt };
|
|
1861
|
+
}
|
|
1862
|
+
}
|
|
1863
|
+
/** Before admission, this launch may absorb ONLY rows positively known before its resume. */
|
|
1864
|
+
takeQuotaReplayBaseline(pane) {
|
|
1865
|
+
// Native captures carry only a runner-frozen pre-launch proof, revalidated with this capture's owner and seq.
|
|
1866
|
+
const native = !this.nativeQuotaReplayTaken ? this.nativePaneLifecycle?.quotaReplayHistory?.() : null;
|
|
1867
|
+
if (this.nativePaneLifecycle)
|
|
1868
|
+
this.nativeQuotaReplayTaken = true;
|
|
1869
|
+
const history = this.quotaReplay ?? (native ? { ...native, spawn: this.spawnGeneration, fence: this.launchFenceEpoch, attempt: this.launchAttempt } : null);
|
|
1870
|
+
if (!history)
|
|
1871
|
+
return;
|
|
1872
|
+
this.quotaReplay = null;
|
|
1873
|
+
if (history.spawn !== this.spawnGeneration || history.fence !== this.launchFenceEpoch || history.attempt !== this.launchAttempt || !history.current())
|
|
1874
|
+
return;
|
|
1875
|
+
for (const ep of this.paneQuotaPatterns()) {
|
|
1876
|
+
const count = Math.min(Daemon.countOccurrences(ep.pattern, pane), quotaHistoryCount(pane, ep.pattern, history.messages));
|
|
1877
|
+
if (!count)
|
|
1878
|
+
continue;
|
|
1879
|
+
const key = Daemon.errorPatternKey(ep);
|
|
1880
|
+
this.lastErrorCount.set(key, Math.max(this.lastErrorCount.get(key) ?? 0, count));
|
|
1881
|
+
this.logger.debug({ backend: this.backend?.binaryName, count, evidence: "before-resume" }, "Quota rows restored from history — not a new incident");
|
|
1882
|
+
}
|
|
1883
|
+
}
|
|
1884
|
+
// Submission makes captured rows history even when no monitor reported them yet. Keep this acknowledged input's
|
|
1885
|
+
// marker as well: a new error can replace an old row in the viewport without increasing the total match count.
|
|
1886
|
+
quotaInput = null;
|
|
1887
|
+
commitPreInputQuotaHistory(evidence) {
|
|
1888
|
+
const history = evidence?.quotaHistory;
|
|
1889
|
+
if (!history || history.spawn !== this.spawnGeneration || history.fence !== this.launchFenceEpoch || history.attempt !== this.launchAttempt
|
|
1890
|
+
|| history.tmux !== this.tmux || history.window !== this.tmux?.getWindowId?.() || this.deliveryWritesStopping)
|
|
1891
|
+
return;
|
|
1892
|
+
for (const row of history.counts)
|
|
1893
|
+
this.lastErrorCount.set(row.key, row.count);
|
|
1894
|
+
this.quotaInput = history.marker && history.occurrences === 0 ? { history, reported: new Map() } : null;
|
|
1895
|
+
}
|
|
1896
|
+
quotaOccurrencesAfterInput(pane, ep) {
|
|
1897
|
+
if (!(this.backend?.binaryName === "codex" && Daemon.isCodexUsageLimitPause(ep)
|
|
1898
|
+
|| this.backend?.binaryName === "grok" && ep.type === "quota"))
|
|
1899
|
+
return null;
|
|
1900
|
+
const input = this.quotaInput, history = input?.history;
|
|
1901
|
+
if (!input || !history || history.spawn !== this.spawnGeneration || history.fence !== this.launchFenceEpoch
|
|
1902
|
+
|| history.attempt !== this.launchAttempt || history.tmux !== this.tmux || history.window !== this.tmux?.getWindowId?.()
|
|
1903
|
+
|| this.deliveryWritesStopping)
|
|
1904
|
+
return null;
|
|
1905
|
+
const suffix = quotaAfterInput(pane, history.marker);
|
|
1906
|
+
return suffix === null ? null : { input, count: Daemon.countOccurrences(ep.pattern, suffix) };
|
|
1907
|
+
}
|
|
1797
1908
|
lastDetectedErrorType = null;
|
|
1798
1909
|
/**
|
|
1799
1910
|
* #2822: Claude's per-model usage limit (`You've reached your <model> limit.`), known only from Claude's own record of
|
|
@@ -1815,12 +1926,55 @@ export class Daemon extends EventEmitter {
|
|
|
1815
1926
|
static CREDIT_BALANCE_LOW = CLAUDE_CREDIT_BALANCE_LOW;
|
|
1816
1927
|
/** #2834 (#816): Claude's usage-limit auto-continue note, as it records it (`system` / `informational`). */
|
|
1817
1928
|
static USAGE_LIMIT_PAUSE = CLAUDE_USAGE_LIMIT_PAUSE;
|
|
1818
|
-
/**
|
|
1819
|
-
|
|
1820
|
-
|
|
1929
|
+
/** Claude's note that its usage window opened again ("Usage limit reset · continuing automatically"). */
|
|
1930
|
+
static USAGE_LIMIT_RESET = /^Usage limit reset\b/i;
|
|
1931
|
+
/** Repeats of one usage pause ("reached again" every few minutes) collapse into the first notice for this long. */
|
|
1932
|
+
static USAGE_PAUSE_NOTICE_WINDOW_MS = 30 * 60_000;
|
|
1933
|
+
/** The usage-pause notice told last: when (monotonic), Claude's words for the reset, and that reset (wall clock). */
|
|
1934
|
+
usagePauseNotice = null;
|
|
1935
|
+
/** Coarse status for the representative quota hint; never exports model names or transcript text. */
|
|
1936
|
+
quotaPaused() {
|
|
1937
|
+
if (this.usageLimitHold)
|
|
1938
|
+
return true;
|
|
1939
|
+
const pause = this.usagePauseNotice;
|
|
1940
|
+
return !!pause && (pause.resetAt === null
|
|
1941
|
+
? performance.now() - pause.at < Daemon.USAGE_PAUSE_NOTICE_WINDOW_MS
|
|
1942
|
+
: Date.now() < pause.resetAt);
|
|
1943
|
+
}
|
|
1944
|
+
/** #3186 review: the lifecycle's second opinion dropped the notice (usage has capacity): nothing was told. */
|
|
1945
|
+
clearUsagePauseNotice() { this.usagePauseNotice = null; }
|
|
1946
|
+
/**
|
|
1947
|
+
* #2834 (#816): Claude paused itself until its usage window opens — the same notice the screen pattern gave. `at`: when
|
|
1948
|
+
* Claude wrote it (its record's timestamp). One notice per pause: a reset time already past is not this pause (an old
|
|
1949
|
+
* note), and its repeats ("reached again") within the window — or naming the same reset, until it comes — say nothing
|
|
1950
|
+
* more. Claude's own "Usage limit reset" ends it.
|
|
1951
|
+
*/
|
|
1952
|
+
noteClaudeInformational(text, at = null) {
|
|
1953
|
+
const line = text.trim();
|
|
1954
|
+
if (Daemon.USAGE_LIMIT_RESET.test(line)) {
|
|
1955
|
+
this.usagePauseNotice = null;
|
|
1956
|
+
return;
|
|
1957
|
+
}
|
|
1958
|
+
const match = Daemon.USAGE_LIMIT_PAUSE.exec(line);
|
|
1821
1959
|
if (!match)
|
|
1822
1960
|
return;
|
|
1823
1961
|
const when = match[1].trim();
|
|
1962
|
+
const wallNow = Date.now(), now = performance.now();
|
|
1963
|
+
const resetAt = claudeResetInstant(when, at ?? wallNow);
|
|
1964
|
+
if (resetAt !== null && resetAt <= wallNow) {
|
|
1965
|
+
this.logger.debug({ when, writtenAt: at }, "Claude usage-limit note names a reset already past — an old note, not told");
|
|
1966
|
+
return;
|
|
1967
|
+
}
|
|
1968
|
+
// A pause told earlier is this one while its own reset has not come (unknown: within the window): its repeats —
|
|
1969
|
+
// "reached again", or a relative time drifting ("in 3h", "in 2h 55m") — within the window, or naming the same reset.
|
|
1970
|
+
// Once its reset has passed, a later note is a new pause even without Claude's "Usage limit reset" (#3186 review).
|
|
1971
|
+
const told = this.usagePauseNotice;
|
|
1972
|
+
const toldOpen = !!told && (told.resetAt === null || wallNow < told.resetAt);
|
|
1973
|
+
if (told && toldOpen && (now - told.at < Daemon.USAGE_PAUSE_NOTICE_WINDOW_MS || (told.when === when && told.resetAt !== null))) {
|
|
1974
|
+
this.logger.debug({ when }, "Claude usage-limit note repeats a pause already told — collapsed");
|
|
1975
|
+
return;
|
|
1976
|
+
}
|
|
1977
|
+
this.usagePauseNotice = { at: now, when, resetAt };
|
|
1824
1978
|
this.emit("pty_error", { name: this.name, type: "quota", action: "notify", verifyQuota: true, skipCooldown: true, skipRecoveryWait: true,
|
|
1825
1979
|
message: `Claude Code usage limit reached — paused; continuing automatically ${when}`,
|
|
1826
1980
|
notice: quotaPausedLine("Claude", "usage", claudeResetTime(when)) });
|
|
@@ -1953,9 +2107,94 @@ export class Daemon extends EventEmitter {
|
|
|
1953
2107
|
this.errorRecoveryDeadlineAt = 0;
|
|
1954
2108
|
this.activeErrorPatternKey = null;
|
|
1955
2109
|
}
|
|
2110
|
+
/** Lazy default also preserves bare-prototype diagnostic/test construction. */
|
|
2111
|
+
get paneHost() { return this.paneTransport ?? tmuxPaneHost; }
|
|
2112
|
+
nativePaneLifecycle;
|
|
2113
|
+
nativeFleetBridge;
|
|
2114
|
+
nativeTranscriptSource;
|
|
2115
|
+
usesNativePane() { return !!this.nativePaneLifecycle; }
|
|
2116
|
+
/** cc3ce4fe: the CLI version this pane's launch actually ran, as its helper recorded it (undefined: not known). */
|
|
2117
|
+
nativePaneCliVersion() { try {
|
|
2118
|
+
return this.nativePaneLifecycle?.snapshot?.()?.cliVersion;
|
|
2119
|
+
}
|
|
2120
|
+
catch {
|
|
2121
|
+
return undefined;
|
|
2122
|
+
} }
|
|
2123
|
+
logNativeInputRefusal(details) {
|
|
2124
|
+
this.logger.warn({ component: "runtime-pane-host", reason: "expected_seq_changed", ...details }, "Native pane input refused before write");
|
|
2125
|
+
}
|
|
2126
|
+
logNativeToolFailure(details) {
|
|
2127
|
+
const turn = this.turnReplyGuard.snapshot();
|
|
2128
|
+
this.logger.warn({ ...details, currentMessageId: turn?.target.messageId ?? null,
|
|
2129
|
+
guardGeneration: turn?.generation ?? null, guardPhase: turn?.phase ?? null }, "Native pane tool operation failed");
|
|
2130
|
+
}
|
|
2131
|
+
nativePaneCurrent() { return this.nativePaneLifecycle?.current() ?? false; }
|
|
2132
|
+
nativeEnterHold = null;
|
|
2133
|
+
/** Per-launch attention for a native delivery whose bounded input attempts were refused or uncertain, including non-outbox input. */
|
|
2134
|
+
nativeDeliveryHold() {
|
|
2135
|
+
const hold = this.nativeEnterHold;
|
|
2136
|
+
return hold && this.nativePaneLifecycle && !this.deliveryWritesStopping && hold.spawn === this.spawnGeneration && hold.fence === this.launchFenceEpoch
|
|
2137
|
+
? { key: hold.key, since: hold.since } : null;
|
|
2138
|
+
}
|
|
2139
|
+
nativePaneHasExited() {
|
|
2140
|
+
const snapshot = this.nativePaneLifecycle?.snapshot?.();
|
|
2141
|
+
return snapshot?.state === "exited" && snapshot.instance === this.name && this.tmux?.getWindowId() === snapshot.paneId;
|
|
2142
|
+
}
|
|
2143
|
+
/** Positive native exit evidence only, fenced to this exact launch and Daemon owner. */
|
|
2144
|
+
nativePaneExitCurrent(snapshot, owner) {
|
|
2145
|
+
const actual = this.nativePaneLifecycle?.snapshot?.();
|
|
2146
|
+
return !!actual && actual.state === "exited" && snapshot.state === "exited"
|
|
2147
|
+
&& sameInteractionOwner(owner, this.interactionOwner()) && !this.runtimeMonitorsFrozen && !this.startupAborted
|
|
2148
|
+
&& ["hostBootId", "paneId", "launchId", "agentId", "instance", "sessionId", "commandSequence", "exitCode"].every(key => actual[key] === snapshot[key])
|
|
2149
|
+
&& this.tmux?.getWindowId() === snapshot.paneId;
|
|
2150
|
+
}
|
|
2151
|
+
async reconcileNativeDeliveries(outbox, current) {
|
|
2152
|
+
if (!this.nativePaneLifecycle)
|
|
2153
|
+
return false;
|
|
2154
|
+
return reconcileNativePaneTarget(outbox, this.name, this.nativePaneLifecycle, current);
|
|
2155
|
+
}
|
|
2156
|
+
/** Same-process transport for the owned native daemon; never exposed as a runner RPC. */
|
|
2157
|
+
setNativeFleetBridge(bridge) {
|
|
2158
|
+
if (!this.nativePaneLifecycle || this.nativeFleetBridge?.current())
|
|
2159
|
+
throw Error("Native Fleet bridge requires one bound pane owner");
|
|
2160
|
+
this.nativeFleetBridge = bridge;
|
|
2161
|
+
}
|
|
2162
|
+
/** Fleet admission and generation checks happen before this synchronous handoff. */
|
|
2163
|
+
acceptNativeFleetMessage(message) {
|
|
2164
|
+
if (!this.nativePaneLifecycle || !this.nativeFleetBridge?.current() || this.deliveryWritesStopping || this.runtimeMonitorsFrozen)
|
|
2165
|
+
return false;
|
|
2166
|
+
if (typeof message.type === "string" && FLEET_RESPONSE_TYPES.has(message.type)) {
|
|
2167
|
+
this.routeFleetResponse(message);
|
|
2168
|
+
return true;
|
|
2169
|
+
}
|
|
2170
|
+
const bridge = this.nativeFleetBridge;
|
|
2171
|
+
const current = () => this.nativeFleetBridge === bridge && bridge.current() && !this.deliveryWritesStopping && !this.runtimeMonitorsFrozen;
|
|
2172
|
+
return this.handleFleetMessage(message, reply => { if (current())
|
|
2173
|
+
this.broadcastFleetMessage(reply); }, current);
|
|
2174
|
+
}
|
|
2175
|
+
broadcastFleetMessage(message) {
|
|
2176
|
+
if (this.nativePaneLifecycle) {
|
|
2177
|
+
if (this.nativeFleetBridge?.current() && !this.runtimeMonitorsFrozen && !this.deliveryWritesStopping)
|
|
2178
|
+
this.nativeFleetBridge.send(message);
|
|
2179
|
+
}
|
|
2180
|
+
else
|
|
2181
|
+
this.ipcServer?.broadcast(message);
|
|
2182
|
+
}
|
|
2183
|
+
fleetTransportAvailable() {
|
|
2184
|
+
return this.nativePaneLifecycle ? !!this.nativeFleetBridge?.current() && !this.runtimeMonitorsFrozen : !!this.ipcServer;
|
|
2185
|
+
}
|
|
2186
|
+
/** Internal lifecycle injection, before start. Native paths and provider files stay on their runner. */
|
|
2187
|
+
setNativePaneLifecycle(native) {
|
|
2188
|
+
if (this.tmux || this.ipcServer || this.nativePaneLifecycle)
|
|
2189
|
+
throw Error("Native pane adapter must be bound before daemon startup");
|
|
2190
|
+
this.nativePaneLifecycle = native;
|
|
2191
|
+
this.backend = native.backend;
|
|
2192
|
+
this.paneTransport = native.host;
|
|
2193
|
+
this.controlClient = native.observation;
|
|
2194
|
+
}
|
|
1956
2195
|
constructor(name, config, instanceDir, topicMode = false, backend, controlClient, rootLogger, runtimeIdentity, spawnGate, stormWindow,
|
|
1957
2196
|
/** Fleet-level "is this CLI's backend down?" memory — see backend-outage.ts. */
|
|
1958
|
-
backendOutage) {
|
|
2197
|
+
backendOutage, paneTransport) {
|
|
1959
2198
|
super();
|
|
1960
2199
|
this.name = name;
|
|
1961
2200
|
this.config = config;
|
|
@@ -1967,6 +2206,7 @@ export class Daemon extends EventEmitter {
|
|
|
1967
2206
|
this.spawnGate = spawnGate;
|
|
1968
2207
|
this.stormWindow = stormWindow;
|
|
1969
2208
|
this.backendOutage = backendOutage;
|
|
2209
|
+
this.paneTransport = paneTransport;
|
|
1970
2210
|
// The live process owns its adopted configuration. Fleet defaults may be re-resolved in place after a save;
|
|
1971
2211
|
// sharing that object would activate cold changes before the normal restart/apply boundary.
|
|
1972
2212
|
this.config = structuredClone(config);
|
|
@@ -1989,7 +2229,8 @@ export class Daemon extends EventEmitter {
|
|
|
1989
2229
|
this.messageBus.setLogger(this.logger);
|
|
1990
2230
|
// General is the dispatcher — it must stay warm to route messages, so it is
|
|
1991
2231
|
// never auto-paused regardless of auto_pause_after.
|
|
1992
|
-
|
|
2232
|
+
// #3035 review: the one rule (an agent named general unticked — general_topic: false — is a worker).
|
|
2233
|
+
const isGeneral = config.general_topic === true || generalByName(name, config);
|
|
1993
2234
|
const autoPauseMinutes = isGeneral ? 0 : (typeof config.auto_pause_after === "number" ? config.auto_pause_after : 0); // default: disabled
|
|
1994
2235
|
this.autoPauseController = new AutoPauseController(Math.max(0, autoPauseMinutes) * 60_000, readLastInboundAt(instanceDir) ?? Date.now());
|
|
1995
2236
|
// #1209: every real completion clears the in-flight marker, so a
|
|
@@ -2010,6 +2251,12 @@ export class Daemon extends EventEmitter {
|
|
|
2010
2251
|
}
|
|
2011
2252
|
/** The fleet's other same-backend instances' working directories, read at spawn (#984). */
|
|
2012
2253
|
peerWorkingDirectories;
|
|
2254
|
+
/** This instance's teams (fleet.yaml), read at each spawn: their team decisions join its Active Decisions. */
|
|
2255
|
+
decisionTeams;
|
|
2256
|
+
setDecisionTeams(teams) { this.decisionTeams = teams; }
|
|
2257
|
+
/** The fleet's active decisions (startup snapshot), read at each spawn; absent: the AGEND_DECISIONS env (tests). */
|
|
2258
|
+
decisionSource;
|
|
2259
|
+
setDecisionSource(source) { this.decisionSource = source; }
|
|
2013
2260
|
setPeerWorkingDirectories(peers) {
|
|
2014
2261
|
this.peerWorkingDirectories = peers;
|
|
2015
2262
|
}
|
|
@@ -2051,12 +2298,19 @@ export class Daemon extends EventEmitter {
|
|
|
2051
2298
|
return outcome === "begun";
|
|
2052
2299
|
}
|
|
2053
2300
|
async durableAttemptEvidence(windowId, handingOffToNativeQueue, steer, rawPaste = false) {
|
|
2054
|
-
let checkpoint = null;
|
|
2055
|
-
|
|
2056
|
-
|
|
2301
|
+
let checkpoint = null, runtimeTranscript = null;
|
|
2302
|
+
if (this.nativePaneLifecycle) {
|
|
2303
|
+
runtimeTranscript = await this.transcriptMonitor?.reconciliationRuntimeCheckpoint() ?? null;
|
|
2304
|
+
if (!runtimeTranscript || !this.nativePaneLifecycle.current(runtimeTranscript))
|
|
2305
|
+
throw Error("Native transcript checkpoint is not current; no delivery was written");
|
|
2057
2306
|
}
|
|
2058
|
-
|
|
2059
|
-
|
|
2307
|
+
else {
|
|
2308
|
+
try {
|
|
2309
|
+
checkpoint = await this.transcriptMonitor?.reconciliationCheckpoint() ?? null;
|
|
2310
|
+
}
|
|
2311
|
+
catch (err) {
|
|
2312
|
+
this.logger.debug({ err }, "Could not checkpoint transcript before durable delivery");
|
|
2313
|
+
}
|
|
2060
2314
|
}
|
|
2061
2315
|
const submissionMode = rawPaste ? "raw_paste" : steer
|
|
2062
2316
|
? "steer"
|
|
@@ -2072,8 +2326,9 @@ export class Daemon extends EventEmitter {
|
|
|
2072
2326
|
backendVersion,
|
|
2073
2327
|
windowId: windowId ?? this.tmux?.getWindowId() ?? null,
|
|
2074
2328
|
transcriptPath: checkpoint?.path ?? null,
|
|
2075
|
-
transcriptOffset: checkpoint?.offset ?? null,
|
|
2076
|
-
transcriptSessionId: checkpoint?.sessionId ?? null,
|
|
2329
|
+
transcriptOffset: runtimeTranscript?.cursor.offset ?? checkpoint?.offset ?? null,
|
|
2330
|
+
transcriptSessionId: runtimeTranscript?.cursor.sessionId ?? checkpoint?.sessionId ?? null,
|
|
2331
|
+
...(runtimeTranscript ? { runtimeTranscript } : {}),
|
|
2077
2332
|
submissionMode,
|
|
2078
2333
|
queueResumePolicy: queueResumePolicyForAttempt(backend, backendVersion, submissionMode),
|
|
2079
2334
|
};
|
|
@@ -2116,17 +2371,25 @@ export class Daemon extends EventEmitter {
|
|
|
2116
2371
|
const outbox = this.deliveryOutbox;
|
|
2117
2372
|
if (!checkpoint || !outbox?.markConsumed)
|
|
2118
2373
|
return;
|
|
2374
|
+
if (this.nativePaneLifecycle && !checkpoint.runtime)
|
|
2375
|
+
return;
|
|
2119
2376
|
if (verdict.submissionMode !== "steer" && verdict.submissionMode !== "native_queue_handoff")
|
|
2120
2377
|
return;
|
|
2121
2378
|
if (!["claude-code", "codex"].includes(checkpoint.backend))
|
|
2122
2379
|
return;
|
|
2123
2380
|
const spawn = this.spawnGeneration, fence = this.launchFenceEpoch, boot = this.bootId;
|
|
2381
|
+
let location;
|
|
2382
|
+
try {
|
|
2383
|
+
location = checkpoint.runtime ? { reader: this.nativeTranscriptReader(checkpoint.runtime, delivery.deliveryId) } : { path: checkpoint.path, offset: checkpoint.offset };
|
|
2384
|
+
}
|
|
2385
|
+
catch {
|
|
2386
|
+
return;
|
|
2387
|
+
} // The owner changed; an unavailable consumed watch proves nothing.
|
|
2124
2388
|
consumedWatches.start({
|
|
2125
2389
|
deliveryId: delivery.deliveryId,
|
|
2126
2390
|
attemptNo: delivery.attemptNo,
|
|
2127
2391
|
backend: checkpoint.backend,
|
|
2128
|
-
|
|
2129
|
-
offset: checkpoint.offset,
|
|
2392
|
+
...location,
|
|
2130
2393
|
current: () => !this.deliveryWritesStopping && spawn === this.spawnGeneration && fence === this.launchFenceEpoch,
|
|
2131
2394
|
consumed: (via, evidence) => {
|
|
2132
2395
|
try {
|
|
@@ -2168,15 +2431,18 @@ export class Daemon extends EventEmitter {
|
|
|
2168
2431
|
: humanVerificationId ? `[agend-human-id:${humanVerificationId}]` : null;
|
|
2169
2432
|
if (!marker || !formatted.startsWith(marker))
|
|
2170
2433
|
return;
|
|
2171
|
-
let
|
|
2172
|
-
if (!
|
|
2434
|
+
let found = verdict.transcriptCheckpoint ?? null;
|
|
2435
|
+
if (!found) {
|
|
2173
2436
|
try {
|
|
2174
|
-
|
|
2437
|
+
found = await this.transcriptMonitor?.reconciliationCheckpoint() ?? null;
|
|
2175
2438
|
}
|
|
2176
2439
|
catch (err) {
|
|
2177
2440
|
this.logger.debug({ err }, "Could not checkpoint the transcript before a queued hand-off");
|
|
2178
2441
|
}
|
|
2179
2442
|
}
|
|
2443
|
+
// main→alpha sync: a hand-off record is judged against a local transcript file. A native or remote runtime's
|
|
2444
|
+
// transcript (no local path) has none: it runs as before (✅ at the hand-off), as with no checkpoint at all.
|
|
2445
|
+
const checkpoint = found && typeof found.path === "string" && typeof found.offset === "number" ? { path: found.path, offset: found.offset } : null;
|
|
2180
2446
|
if (!checkpoint)
|
|
2181
2447
|
return; // nothing could judge it later: it runs as before (✅ at the hand-off)
|
|
2182
2448
|
const entry = {
|
|
@@ -2444,24 +2710,34 @@ export class Daemon extends EventEmitter {
|
|
|
2444
2710
|
const spawn = this.spawnGeneration;
|
|
2445
2711
|
const fence = this.launchFenceEpoch;
|
|
2446
2712
|
let last = "unavailable";
|
|
2447
|
-
|
|
2448
|
-
let
|
|
2713
|
+
const native = !!checkpoint.runtime || !!this.nativePaneLifecycle;
|
|
2714
|
+
let outcome = native ? "uncertain" : "delivered";
|
|
2715
|
+
let evidence = native ? "runtime-transcript-unconfirmed" : OUTPUT_EDGE_ONLY_EVIDENCE;
|
|
2449
2716
|
// #1647: a raw paste has no marker; its text is the needle, and its pane proof already failed — so without the turn
|
|
2450
2717
|
// in the transcript it stays uncertain (with the pane's reason), never the output-edge outcome.
|
|
2451
2718
|
const needle = rawPaste ? { rawText: rawPaste.text } : delivery.deliveryId;
|
|
2452
2719
|
let found = false;
|
|
2453
2720
|
try {
|
|
2721
|
+
if (this.nativePaneLifecycle && !checkpoint.runtime)
|
|
2722
|
+
throw Error("Native proof cannot read a coordinator-local transcript path");
|
|
2723
|
+
const nativeReader = checkpoint.runtime ? this.nativeTranscriptReader(checkpoint.runtime, needle) : null;
|
|
2454
2724
|
for (let polls = 0; polls <= TRANSCRIPT_PROOF_WINDOW_MS / TRANSCRIPT_PROOF_POLL_MS; polls++) {
|
|
2455
2725
|
if (this.deliveryWritesStopping)
|
|
2456
2726
|
return; // reconciliation owns the row now
|
|
2457
|
-
const look = await scanTranscriptForDeliveryMarker(checkpoint.path, checkpoint.offset, checkpoint.backend, needle);
|
|
2727
|
+
const look = nativeReader ? await nativeReader.look() : await scanTranscriptForDeliveryMarker(checkpoint.path, checkpoint.offset, checkpoint.backend, needle);
|
|
2728
|
+
if (this.deliveryWritesStopping)
|
|
2729
|
+
return;
|
|
2730
|
+
if (spawn !== this.spawnGeneration || fence !== this.launchFenceEpoch) {
|
|
2731
|
+
last = "unavailable";
|
|
2732
|
+
break;
|
|
2733
|
+
}
|
|
2458
2734
|
if (look === "user" || look === "absorbed" || look === "queued") {
|
|
2459
2735
|
found = true;
|
|
2460
2736
|
outcome = "delivered";
|
|
2461
2737
|
evidence = transcriptMarkerEvidence(look, !!rawPaste);
|
|
2462
2738
|
break;
|
|
2463
2739
|
}
|
|
2464
|
-
last = look;
|
|
2740
|
+
last = look === "pending" ? "unavailable" : look;
|
|
2465
2741
|
if (spawn !== this.spawnGeneration || fence !== this.launchFenceEpoch) {
|
|
2466
2742
|
last = "unavailable";
|
|
2467
2743
|
break;
|
|
@@ -2473,13 +2749,13 @@ export class Daemon extends EventEmitter {
|
|
|
2473
2749
|
// `uncertain`: re-check the same fixed epochs after the last await, before settling (#1207 P2).
|
|
2474
2750
|
if (spawn !== this.spawnGeneration || fence !== this.launchFenceEpoch)
|
|
2475
2751
|
last = "unavailable";
|
|
2476
|
-
if (last === "no-match" &&
|
|
2752
|
+
if (last === "no-match" && !found) {
|
|
2477
2753
|
outcome = "uncertain";
|
|
2478
2754
|
evidence = "unverifiable-no-transcript-marker";
|
|
2479
2755
|
}
|
|
2480
2756
|
}
|
|
2481
2757
|
catch (err) {
|
|
2482
|
-
this.logger.debug({ err }, "Transcript proof
|
|
2758
|
+
this.logger.debug({ err }, "Transcript proof unavailable — preserving the conservative outcome");
|
|
2483
2759
|
}
|
|
2484
2760
|
if (rawPaste && !found) {
|
|
2485
2761
|
outcome = "uncertain";
|
|
@@ -2666,128 +2942,150 @@ export class Daemon extends EventEmitter {
|
|
|
2666
2942
|
}
|
|
2667
2943
|
}
|
|
2668
2944
|
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
|
-
|
|
2945
|
+
if (!this.nativePaneLifecycle) {
|
|
2946
|
+
// 1. IPC server — bridge between MCP server (Claude's child) and daemon
|
|
2947
|
+
const sockPath = join(this.instanceDir, "channel.sock");
|
|
2948
|
+
this.ipcServer = new IpcServer(sockPath, this.logger);
|
|
2949
|
+
// Forward IPC server errors as daemon events (prevents unhandled 'error' crash).
|
|
2950
|
+
// Guard: only forward post-listen errors — startup errors are handled by listen() rejection.
|
|
2951
|
+
let ipcListening = false;
|
|
2952
|
+
this.ipcServer.on("error", (err) => {
|
|
2953
|
+
if (!ipcListening)
|
|
2954
|
+
return; // startup errors handled by listen() rejection
|
|
2955
|
+
this.logger.error({ err, name: this.name }, "IPC server error");
|
|
2956
|
+
this.emit("error", err);
|
|
2957
|
+
});
|
|
2958
|
+
await this.ipcServer.listen();
|
|
2959
|
+
this.startupAdmission?.();
|
|
2960
|
+
ipcListening = true;
|
|
2961
|
+
// Permanent IPC dispatcher: routes responses to pending requests by type+id key
|
|
2962
|
+
this.ipcServer.on("message", (msg) => this.routeFleetResponse(msg));
|
|
2963
|
+
// IPC message relay: when daemon wants to push a channel message to Claude,
|
|
2964
|
+
// it broadcasts to all IPC clients (the MCP server is one of them).
|
|
2965
|
+
// When MCP server sends a tool_call, daemon handles it via the messageBus.
|
|
2966
|
+
this.ipcServer.on("message", (msg, socket) => {
|
|
2967
|
+
if (msg.type === "tool_call") {
|
|
2968
|
+
// MCP server forwarding a Claude tool call (reply, react, edit, download)
|
|
2969
|
+
this.handleToolCall(msg, socket);
|
|
2970
|
+
}
|
|
2971
|
+
else if (msg.type === "mcp_ready") {
|
|
2972
|
+
this.handleMcpReady(msg, socket);
|
|
2973
|
+
}
|
|
2974
|
+
else if (msg.type === "pong") {
|
|
2975
|
+
this.handleMcpPong(msg, socket);
|
|
2976
|
+
}
|
|
2977
|
+
else if (msg.type === "query_sessions") {
|
|
2978
|
+
// Fleet manager asks for all registered session names (catches sessions
|
|
2979
|
+
// that sent mcp_ready before fleet manager connected).
|
|
2980
|
+
const sessions = [];
|
|
2981
|
+
for (const [s, sessionName] of this.socketSessionNames) {
|
|
2982
|
+
if (!s.destroyed && sessionName !== this.name) {
|
|
2983
|
+
// Individual mcp_ready for initial registration path
|
|
2984
|
+
this.ipcServer?.send(socket, { type: "mcp_ready", sessionName });
|
|
2985
|
+
sessions.push(sessionName);
|
|
2986
|
+
}
|
|
2709
2987
|
}
|
|
2988
|
+
// Batch response for prune path
|
|
2989
|
+
this.ipcServer?.send(socket, { type: "query_sessions_response", sessions });
|
|
2710
2990
|
}
|
|
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();
|
|
2991
|
+
else
|
|
2992
|
+
this.handleFleetMessage(msg, reply => { this.ipcServer?.send(socket, reply); });
|
|
2993
|
+
});
|
|
2994
|
+
}
|
|
2995
|
+
let nativeDisposition;
|
|
2996
|
+
if (this.nativePaneLifecycle) {
|
|
2997
|
+
this.beginSpawn();
|
|
2998
|
+
try {
|
|
2999
|
+
const acquired = await this.nativePaneLifecycle.acquire(() => {
|
|
2766
3000
|
this.startupAdmission?.();
|
|
2767
|
-
|
|
3001
|
+
if (this.startupAborted)
|
|
3002
|
+
throw Error("Native launch was superseded");
|
|
3003
|
+
});
|
|
3004
|
+
this.tmux = acquired.pane;
|
|
3005
|
+
this.nativeTranscriptSource = acquired.source;
|
|
3006
|
+
nativeDisposition = acquired.disposition;
|
|
3007
|
+
this.lastSpawnAt = Date.now();
|
|
3008
|
+
this.setProcessStatus("running");
|
|
3009
|
+
this.bindInstanceStateOutputListener(this.tmux.getWindowId());
|
|
3010
|
+
this.saveSessionId();
|
|
3011
|
+
// New/resumed native processes can still be painting their first frame. Keep deliveries behind the same
|
|
3012
|
+
// bounded dialog/readiness scan as local startup. An already-running reattachment may be busy: do not
|
|
3013
|
+
// wait for that work to finish or inject a startup key into it.
|
|
3014
|
+
if (acquired.disposition === "reattached") {
|
|
3015
|
+
if (this.backend?.binaryName === "codex") {
|
|
3016
|
+
const native = this.nativePaneLifecycle, spawn = this.spawnGeneration, fence = this.launchFenceEpoch, attempt = this.launchAttempt;
|
|
3017
|
+
try {
|
|
3018
|
+
const pane = await acquired.pane.capturePane();
|
|
3019
|
+
this.startupAdmission?.();
|
|
3020
|
+
if (!this.startupAborted && !this.deliveryWritesStopping && this.nativePaneLifecycle === native && this.tmux === acquired.pane
|
|
3021
|
+
&& spawn === this.spawnGeneration && fence === this.launchFenceEpoch && attempt === this.launchAttempt && native.current())
|
|
3022
|
+
this.takeQuotaReplayBaseline(pane);
|
|
3023
|
+
}
|
|
3024
|
+
catch { /* An old runner or unavailable proof keeps the existing fail-closed scanner. */ }
|
|
3025
|
+
}
|
|
3026
|
+
}
|
|
3027
|
+
else {
|
|
3028
|
+
if (!await this.finishStartupScan(120_000))
|
|
3029
|
+
throw Error("Native CLI exited during startup; retained session was not replaced");
|
|
2768
3030
|
this.startupAdmission?.();
|
|
2769
|
-
this.
|
|
3031
|
+
if (this.startupAborted || this.deliveryWritesStopping || !this.nativePaneLifecycle.current())
|
|
3032
|
+
throw Error("Native launch was superseded");
|
|
2770
3033
|
}
|
|
2771
3034
|
}
|
|
2772
|
-
|
|
2773
|
-
|
|
2774
|
-
|
|
2775
|
-
this.isNewSession = !resumed;
|
|
2776
|
-
if (!resumed) {
|
|
2777
|
-
await this.injectSnapshotMessage(this.startupAdmission);
|
|
2778
|
-
this.startupAdmission?.();
|
|
3035
|
+
finally {
|
|
3036
|
+
this.endSpawn();
|
|
3037
|
+
}
|
|
2779
3038
|
}
|
|
2780
3039
|
else {
|
|
2781
|
-
//
|
|
2782
|
-
|
|
2783
|
-
|
|
3040
|
+
// 2. Tmux — ensure session, create window if not alive
|
|
3041
|
+
await this.paneHost.ensureSession(this.tmuxSessionName);
|
|
3042
|
+
this.startupAdmission?.();
|
|
3043
|
+
this.tmux = this.paneHost.bind(this.tmuxSessionName, "", resolveTmuxLogicalSize(this.config.terminal), this.controlClient);
|
|
3044
|
+
// M-2457 §6 rule 3: a window-id 2.3 wrote names a window of the SYSTEM tmux's default server.
|
|
3045
|
+
// That window is proven ours, checkpointed and closed (or this instance is held) — and the id is dropped, as it
|
|
3046
|
+
// means nothing on AgEnD's own server — before the fresh-start below can look at it.
|
|
3047
|
+
await migrateLegacyWindow({ agendHome: getAgendHome(), instance: this.name, instanceDir: this.instanceDir, session: this.tmuxSessionName, legacySocket: legacyTmuxSocket(), currentSocket: tmuxSocket(),
|
|
3048
|
+
backendBinary: this.backend?.binaryName ?? "", checkpoint: () => this.checkpointSessionId(),
|
|
3049
|
+
log: (msg, data) => this.logger.info(data ?? {}, msg) });
|
|
3050
|
+
this.startupAdmission?.();
|
|
3051
|
+
// Strategy A: always start fresh Claude window (MCP server has no reconnection)
|
|
3052
|
+
// Kill any existing window from previous run
|
|
3053
|
+
const windowIdFile = join(this.instanceDir, "window-id");
|
|
3054
|
+
if (existsSync(windowIdFile)) {
|
|
3055
|
+
const savedId = readFileSync(windowIdFile, "utf-8").trim();
|
|
3056
|
+
if (savedId) {
|
|
3057
|
+
const oldTmux = this.paneHost.bind(this.tmuxSessionName, savedId);
|
|
3058
|
+
if (await oldTmux.isWindowAlive()) {
|
|
3059
|
+
this.startupAdmission?.();
|
|
3060
|
+
await this.checkpointSessionId();
|
|
3061
|
+
this.startupAdmission?.();
|
|
3062
|
+
await oldTmux.killWindow();
|
|
3063
|
+
this.startupAdmission?.();
|
|
3064
|
+
this.logger.info({ savedId }, "Killed old tmux window for fresh start");
|
|
3065
|
+
}
|
|
3066
|
+
}
|
|
3067
|
+
}
|
|
3068
|
+
const resumed = await this.spawnClaudeWindow();
|
|
3069
|
+
this.startupAdmission?.();
|
|
3070
|
+
this.isNewSession = !resumed;
|
|
3071
|
+
if (!resumed) {
|
|
3072
|
+
await this.injectSnapshotMessage(this.startupAdmission);
|
|
3073
|
+
this.startupAdmission?.();
|
|
3074
|
+
}
|
|
3075
|
+
else {
|
|
3076
|
+
// Clean up stale snapshot file — resume restored full context, snapshot not needed
|
|
3077
|
+
try {
|
|
3078
|
+
unlinkSync(join(this.instanceDir, "rotation-state.json"));
|
|
3079
|
+
}
|
|
3080
|
+
catch { /* may not exist */ }
|
|
2784
3081
|
}
|
|
2785
|
-
catch { /* may not exist */ }
|
|
2786
3082
|
}
|
|
3083
|
+
if (nativeDisposition)
|
|
3084
|
+
this.isNewSession = nativeDisposition === "fresh";
|
|
2787
3085
|
// #1209: conditional continuation for the turn interrupted by the last
|
|
2788
3086
|
// restart, if the gates allow. Detached; the gate
|
|
2789
3087
|
// consumes its one-shot marker first and never throws into boot.
|
|
2790
|
-
const legacyResume = this.maybeResumeInterruptedTurn().catch(() => "unknown");
|
|
3088
|
+
const legacyResume = this.nativePaneLifecycle ? Promise.resolve("unknown") : this.maybeResumeInterruptedTurn().catch(() => "unknown");
|
|
2791
3089
|
const recoveryOwner = JSON.stringify(this.interactionOwner());
|
|
2792
3090
|
void Promise.allSettled([legacyResume]).then(() => {
|
|
2793
3091
|
if (JSON.stringify(this.interactionOwner()) === recoveryOwner) {
|
|
@@ -2806,7 +3104,7 @@ export class Daemon extends EventEmitter {
|
|
|
2806
3104
|
// (statusline transcript); codex/kiro/opencode read their CLI's own
|
|
2807
3105
|
// conversation store via a pluggable source. Backends with no known
|
|
2808
3106
|
// 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));
|
|
3107
|
+
this.transcriptMonitor = this.buildTranscriptMonitor(this.nativeTranscriptSource ?? createTranscriptSource(this.config.backend ?? "claude-code", this.config.working_directory, this.credentialProfileStore(), () => this.backend?.transcriptLaunch?.() ?? null));
|
|
2810
3108
|
const transcriptMonitor = this.transcriptMonitor;
|
|
2811
3109
|
const transcriptFence = this.launchFenceEpoch;
|
|
2812
3110
|
// Baseline in the isolate before this daemon accepts new work. A
|
|
@@ -2842,7 +3140,7 @@ export class Daemon extends EventEmitter {
|
|
|
2842
3140
|
this.publishActivity(null);
|
|
2843
3141
|
});
|
|
2844
3142
|
this.transcriptMonitor.on("api_error", (text, status, _at, errorKind) => this.noteClaudeApiError(text, status, errorKind));
|
|
2845
|
-
this.transcriptMonitor.on("system_informational", (text) => this.noteClaudeInformational(text));
|
|
3143
|
+
this.transcriptMonitor.on("system_informational", (text, at) => this.noteClaudeInformational(text, at));
|
|
2846
3144
|
this.transcriptMonitor.on("user_prompt", () => this.noteClaudePrompt());
|
|
2847
3145
|
this.transcriptMonitor.on("assistant_text", (text) => {
|
|
2848
3146
|
this.noteClaudeOutput();
|
|
@@ -2862,13 +3160,15 @@ export class Daemon extends EventEmitter {
|
|
|
2862
3160
|
if (hangConfig?.enabled !== false) {
|
|
2863
3161
|
this.hangDetector = new HangDetector();
|
|
2864
3162
|
}
|
|
2865
|
-
|
|
2866
|
-
|
|
2867
|
-
|
|
2868
|
-
|
|
2869
|
-
|
|
2870
|
-
this.
|
|
2871
|
-
|
|
3163
|
+
if (!this.nativePaneLifecycle) {
|
|
3164
|
+
// 8. Context guardian
|
|
3165
|
+
const statusFile = join(this.instanceDir, "statusline.json");
|
|
3166
|
+
this.guardian = new ContextGuardian(this.config.context_guardian ?? {}, this.logger, statusFile);
|
|
3167
|
+
this.guardian.startWatching();
|
|
3168
|
+
this.guardian.on("status_update", () => {
|
|
3169
|
+
this.saveSessionId();
|
|
3170
|
+
});
|
|
3171
|
+
}
|
|
2872
3172
|
// Context rotation removed: all CLI backends have built-in auto-compact.
|
|
2873
3173
|
// Crash recovery (health check + respawn with snapshot) is retained below.
|
|
2874
3174
|
}
|
|
@@ -2921,7 +3221,7 @@ export class Daemon extends EventEmitter {
|
|
|
2921
3221
|
this.socketPids.delete(socket);
|
|
2922
3222
|
// Notify fleet manager so it can clean up sessionRegistry
|
|
2923
3223
|
if (sessionName !== this.name) {
|
|
2924
|
-
this.
|
|
3224
|
+
this.broadcastFleetMessage({ type: "session_disconnected", sessionName });
|
|
2925
3225
|
}
|
|
2926
3226
|
});
|
|
2927
3227
|
}
|
|
@@ -2937,11 +3237,16 @@ export class Daemon extends EventEmitter {
|
|
|
2937
3237
|
// sub-agent's server may have left a dead pid in the slot).
|
|
2938
3238
|
this.noteMcpProofOfLife("mcp_ready", typeof msg.pid === "number" ? msg.pid : undefined);
|
|
2939
3239
|
}
|
|
2940
|
-
this.
|
|
3240
|
+
this.broadcastFleetMessage({ type: "mcp_ready", sessionName });
|
|
2941
3241
|
}
|
|
2942
3242
|
checkMcpServerAlive() {
|
|
2943
3243
|
if (this.isPaused)
|
|
2944
3244
|
return;
|
|
3245
|
+
if (this.nativePaneLifecycle) {
|
|
3246
|
+
if (this.nativePaneLifecycle.mcpProof() === "alive")
|
|
3247
|
+
this.noteMcpProofOfLife("connection");
|
|
3248
|
+
return; // No native PID/socket guessing or restart from an unknown helper observation.
|
|
3249
|
+
}
|
|
2945
3250
|
const status = mcpServerState(this.instanceDir);
|
|
2946
3251
|
if (status.state === "alive") {
|
|
2947
3252
|
this.mcpServedGeneration = this.spawnGeneration;
|
|
@@ -3025,6 +3330,8 @@ export class Daemon extends EventEmitter {
|
|
|
3025
3330
|
* server from a third-party one, and failed the whole launch for either.
|
|
3026
3331
|
*/
|
|
3027
3332
|
checkFleetMcpNeverConnected() {
|
|
3333
|
+
if (this.nativePaneLifecycle)
|
|
3334
|
+
return; // Native helper presence owns this observation.
|
|
3028
3335
|
if (this.config.agent_mode === "cli")
|
|
3029
3336
|
return; // no MCP server by design
|
|
3030
3337
|
if (this.lastSpawnAt === 0 || this.mcpServedGeneration === this.spawnGeneration)
|
|
@@ -3235,6 +3542,8 @@ export class Daemon extends EventEmitter {
|
|
|
3235
3542
|
* proof that tools are being served, whatever channel.mcp.pid says.
|
|
3236
3543
|
*/
|
|
3237
3544
|
mcpServerAlive() {
|
|
3545
|
+
if (this.nativePaneLifecycle)
|
|
3546
|
+
return this.nativePaneLifecycle.mcpProof() === "alive" ? { alive: true, source: "connection" } : { alive: false, source: "none" };
|
|
3238
3547
|
const status = mcpServerState(this.instanceDir);
|
|
3239
3548
|
if (status.state === "alive")
|
|
3240
3549
|
return { alive: true, source: "pid", pid: status.pid };
|
|
@@ -3299,7 +3608,7 @@ export class Daemon extends EventEmitter {
|
|
|
3299
3608
|
this.mcpDeathNotifiedForPid = null;
|
|
3300
3609
|
this.mcpDeathDeferredForPid = null;
|
|
3301
3610
|
this.clearMcpRestartRequest();
|
|
3302
|
-
if (pid && mcpServerState(this.instanceDir).state !== "alive")
|
|
3611
|
+
if (!this.nativePaneLifecycle && pid && mcpServerState(this.instanceDir).state !== "alive")
|
|
3303
3612
|
this.repairMcpPidSlot(pid, source);
|
|
3304
3613
|
}
|
|
3305
3614
|
emitMcpRecovered(source, pid) {
|
|
@@ -3346,6 +3655,26 @@ export class Daemon extends EventEmitter {
|
|
|
3346
3655
|
// ended this instance's health loop because scheduleNext() sat after the
|
|
3347
3656
|
// throwing code. Catch, log, and keep checking.
|
|
3348
3657
|
try {
|
|
3658
|
+
if (this.nativePaneLifecycle) {
|
|
3659
|
+
if (this.healthCheckPaused) {
|
|
3660
|
+
scheduleNext();
|
|
3661
|
+
return;
|
|
3662
|
+
}
|
|
3663
|
+
const native = this.nativePaneLifecycle, pane = this.tmux;
|
|
3664
|
+
const status = await pane?.getPaneStatus();
|
|
3665
|
+
if (this.runtimeMonitorsFrozen || native !== this.nativePaneLifecycle || pane !== this.tmux)
|
|
3666
|
+
return;
|
|
3667
|
+
const snapshot = native.snapshot?.();
|
|
3668
|
+
if (status?.alive === false && snapshot?.state === "exited") {
|
|
3669
|
+
this.healthCheckPaused = true;
|
|
3670
|
+
this.setProcessStatus(snapshot.exitCode === 0 ? "stopped" : "crashed");
|
|
3671
|
+
this.emit("native_pane_exited", { name: this.name, snapshot, owner: this.interactionOwner() });
|
|
3672
|
+
}
|
|
3673
|
+
else if (status?.alive)
|
|
3674
|
+
this.checkMcpServerAlive();
|
|
3675
|
+
scheduleNext();
|
|
3676
|
+
return;
|
|
3677
|
+
}
|
|
3349
3678
|
// Instance directory removed externally (e.g. `rm -rf ~/.agend/instances/<name>`).
|
|
3350
3679
|
// Stop the loop permanently — otherwise every tick triggers a respawn, whose
|
|
3351
3680
|
// writeRotationSnapshot fails with ENOENT and gets caught as "Failed to respawn",
|
|
@@ -3481,13 +3810,13 @@ export class Daemon extends EventEmitter {
|
|
|
3481
3810
|
let inWindowLossBurst = false;
|
|
3482
3811
|
let nullReason;
|
|
3483
3812
|
if (!paneStatus) {
|
|
3484
|
-
const serverAlive = await
|
|
3813
|
+
const serverAlive = await this.paneHost.sessionExists(this.tmuxSessionName);
|
|
3485
3814
|
if (discardStaleHealth())
|
|
3486
3815
|
return;
|
|
3487
3816
|
// A server may have already restarted before this daemon's health
|
|
3488
3817
|
// tick. The new PID is the durable generation boundary: treat it as
|
|
3489
3818
|
// a fleet storm even though `has-session` is true again.
|
|
3490
|
-
const serverPid = serverAlive ? await
|
|
3819
|
+
const serverPid = serverAlive ? await this.paneHost.getServerPid(this.tmuxSessionName) : null;
|
|
3491
3820
|
if (discardStaleHealth())
|
|
3492
3821
|
return;
|
|
3493
3822
|
const generationChanged = serverAlive && this.stormWindow?.observeServerAlive(serverPid) === true;
|
|
@@ -3516,7 +3845,7 @@ export class Daemon extends EventEmitter {
|
|
|
3516
3845
|
// the window truly no longer exists vs a transient query glitch.
|
|
3517
3846
|
nullReason = "no_window";
|
|
3518
3847
|
try {
|
|
3519
|
-
const windows = await
|
|
3848
|
+
const windows = await this.paneHost.listWindowsStrict(this.tmuxSessionName, this.controlClient);
|
|
3520
3849
|
if (discardStaleHealth())
|
|
3521
3850
|
return;
|
|
3522
3851
|
this.windowQueryFailureTicks = 0;
|
|
@@ -3763,10 +4092,10 @@ export class Daemon extends EventEmitter {
|
|
|
3763
4092
|
// Wrapped in try-catch: if tmux server is dead, listWindows throws —
|
|
3764
4093
|
// must not block spawnClaudeWindow (which calls ensureSession).
|
|
3765
4094
|
try {
|
|
3766
|
-
const windows = await
|
|
4095
|
+
const windows = await this.paneHost.listWindows(this.tmuxSessionName);
|
|
3767
4096
|
for (const w of windows) {
|
|
3768
4097
|
if (w.name === this.name) {
|
|
3769
|
-
const tm =
|
|
4098
|
+
const tm = this.paneHost.bind(this.tmuxSessionName, w.id);
|
|
3770
4099
|
await tm.killWindow();
|
|
3771
4100
|
}
|
|
3772
4101
|
}
|
|
@@ -3911,7 +4240,7 @@ export class Daemon extends EventEmitter {
|
|
|
3911
4240
|
// Force the next ready capture to emit a fresh transition after respawn.
|
|
3912
4241
|
this.instanceState = "working";
|
|
3913
4242
|
}
|
|
3914
|
-
this.
|
|
4243
|
+
this.broadcastFleetMessage({
|
|
3915
4244
|
type: "instance_process_state",
|
|
3916
4245
|
instanceName: this.name,
|
|
3917
4246
|
status,
|
|
@@ -4107,12 +4436,15 @@ export class Daemon extends EventEmitter {
|
|
|
4107
4436
|
for (const key of dialog.keys) {
|
|
4108
4437
|
if (stale())
|
|
4109
4438
|
return;
|
|
4439
|
+
const keyScreen = this.nativePaneLifecycle ? await pollTmux.capturePane() : currentPane;
|
|
4440
|
+
if (stale() || !Daemon.dialogMatches(dialog, keyScreen))
|
|
4441
|
+
return;
|
|
4110
4442
|
let sent = false;
|
|
4111
4443
|
if (SPECIAL_KEYS.has(key)) {
|
|
4112
|
-
sent = await pollTmux.sendSpecialKey(key);
|
|
4444
|
+
sent = await (this.nativePaneLifecycle ? pollTmux.sendSpecialKey(key, undefined, { kind: "dialog", screen: keyScreen }) : pollTmux.sendSpecialKey(key));
|
|
4113
4445
|
}
|
|
4114
4446
|
else if (dialog.literalKeys) {
|
|
4115
|
-
sent = await pollTmux.sendKeys(key); // typed, no Enter (#2872)
|
|
4447
|
+
sent = await (this.nativePaneLifecycle ? pollTmux.sendKeys(key, { kind: "dialog", screen: keyScreen }) : pollTmux.sendKeys(key)); // typed, no Enter (#2872)
|
|
4116
4448
|
}
|
|
4117
4449
|
else {
|
|
4118
4450
|
sent = await pollTmux.pasteText(key, this.systemPasteOptions());
|
|
@@ -4312,7 +4644,13 @@ export class Daemon extends EventEmitter {
|
|
|
4312
4644
|
for (const ep of patterns) {
|
|
4313
4645
|
const key = Daemon.errorPatternKey(ep);
|
|
4314
4646
|
const count = countMatches(ep.pattern);
|
|
4315
|
-
|
|
4647
|
+
let seen = this.lastErrorCount.get(key) ?? 0;
|
|
4648
|
+
const afterInput = this.quotaOccurrencesAfterInput(pane, ep);
|
|
4649
|
+
// Only a new echo of our acknowledged input can re-arm a same-count replacement. Old rows before that echo,
|
|
4650
|
+
// an ambiguous/missing marker or a superseded input owner retain the ordinary count-based decision.
|
|
4651
|
+
const newQuotaAfterInput = !!afterInput && afterInput.count > (afterInput.input.reported.get(key) ?? 0);
|
|
4652
|
+
if (newQuotaAfterInput)
|
|
4653
|
+
seen = Math.min(seen, count - 1);
|
|
4316
4654
|
// #2282: a resumed exhausted429 row is history, not even a new
|
|
4317
4655
|
// notification/failover incident; so is a resumed codex workspace-limit row
|
|
4318
4656
|
// (#2844: a wake must not pause again on it). Wait for the first live
|
|
@@ -4334,7 +4672,7 @@ export class Daemon extends EventEmitter {
|
|
|
4334
4672
|
// the lifecycle, whose usage probe decides (available / reserve / exhausted).
|
|
4335
4673
|
if (Daemon.isCodexUsageLimitPause(ep)) {
|
|
4336
4674
|
const ack = this.codexReserveAck;
|
|
4337
|
-
if (ack && ack.generation === this.spawnGeneration && count <= ack.count) {
|
|
4675
|
+
if (ack && ack.generation === this.spawnGeneration && count <= ack.count && !newQuotaAfterInput) {
|
|
4338
4676
|
// The handled incident's lines can scroll out of the capture buffer as
|
|
4339
4677
|
// the reserve session talks on. Lower the proof (and the occurrence
|
|
4340
4678
|
// baseline) with them: otherwise `count <= ack.count` would keep
|
|
@@ -4375,6 +4713,8 @@ export class Daemon extends EventEmitter {
|
|
|
4375
4713
|
continue;
|
|
4376
4714
|
}
|
|
4377
4715
|
this.lastErrorCount.set(key, count);
|
|
4716
|
+
if (afterInput)
|
|
4717
|
+
afterInput.input.reported.set(key, Math.max(afterInput.input.reported.get(key) ?? 0, afterInput.count));
|
|
4378
4718
|
// Kiro's `auto` model picks a concrete model per turn and reroutes around
|
|
4379
4719
|
// a temporarily unavailable one on its own — telling the user to run
|
|
4380
4720
|
// /model would ask them to fix something the CLI is already handling.
|
|
@@ -4407,6 +4747,14 @@ export class Daemon extends EventEmitter {
|
|
|
4407
4747
|
}
|
|
4408
4748
|
/** Arm the recovery gates and emit one detected error pattern. */
|
|
4409
4749
|
emitErrorPattern(ep, key, pane, now) {
|
|
4750
|
+
const minimum = !this.nativePaneLifecycle && this.backend?.binaryName === "claude" && ep.type === "outdated_cli" ? claudeMinimumError(pane) : null;
|
|
4751
|
+
if (minimum) {
|
|
4752
|
+
this.lastErrorNotifiedAt.set(key, now);
|
|
4753
|
+
void this.handleClaudeModelMinimum(minimum).catch(err => {
|
|
4754
|
+
this.logger.warn({ reason: String(err) }, "CLI launch repair failed");
|
|
4755
|
+
});
|
|
4756
|
+
return;
|
|
4757
|
+
}
|
|
4410
4758
|
// #2795: auth text on the pane proves nothing about the credentials (22 of 22 such matches on the main host were
|
|
4411
4759
|
// conversation text). It arms nothing here; it only asks the lifecycle's token-free check, and a failing check
|
|
4412
4760
|
// arms the auth state through confirmAuthFailure().
|
|
@@ -4475,7 +4823,20 @@ export class Daemon extends EventEmitter {
|
|
|
4475
4823
|
*/
|
|
4476
4824
|
async sendEscape() {
|
|
4477
4825
|
const cancelKey = this.backend?.getCancelKey() ?? "Escape";
|
|
4478
|
-
|
|
4826
|
+
const tmux = this.tmux;
|
|
4827
|
+
if (!tmux)
|
|
4828
|
+
return;
|
|
4829
|
+
if (this.nativePaneLifecycle) {
|
|
4830
|
+
// A native pane's composer proof cannot see a permission dialog, so an unproved key is withheld there. The cancel
|
|
4831
|
+
// is the person's own interrupt, keyed on the screen read just before (as the dialog answer path is): what Esc
|
|
4832
|
+
// does on Linux's tmux pane, on the same screen, with the same key.
|
|
4833
|
+
const screen = await tmux.capturePane().catch(() => null);
|
|
4834
|
+
if (screen === null)
|
|
4835
|
+
return;
|
|
4836
|
+
await tmux.sendSpecialKey(cancelKey, undefined, { kind: "dialog", screen });
|
|
4837
|
+
return;
|
|
4838
|
+
}
|
|
4839
|
+
await tmux.sendSpecialKey(cancelKey);
|
|
4479
4840
|
}
|
|
4480
4841
|
/**
|
|
4481
4842
|
* Drop every not-yet-started pane delivery which predates a user cancel.
|
|
@@ -4541,7 +4902,7 @@ export class Daemon extends EventEmitter {
|
|
|
4541
4902
|
return;
|
|
4542
4903
|
const outcome = follower.look(pane);
|
|
4543
4904
|
if (outcome) {
|
|
4544
|
-
this.
|
|
4905
|
+
this.broadcastFleetMessage({ type: "compact_pane_result", id, owner, outcome });
|
|
4545
4906
|
return;
|
|
4546
4907
|
}
|
|
4547
4908
|
}
|
|
@@ -4561,7 +4922,7 @@ export class Daemon extends EventEmitter {
|
|
|
4561
4922
|
const reportSwitch = (result) => {
|
|
4562
4923
|
if (!ownSwitch)
|
|
4563
4924
|
return;
|
|
4564
|
-
this.
|
|
4925
|
+
this.broadcastFleetMessage({ type: "runtime_switch_result", id: ownSwitch.id, ...result });
|
|
4565
4926
|
};
|
|
4566
4927
|
// Board 003648ac: the fleet follows a web /compact from just before its paste is written: the transcript's end then
|
|
4567
4928
|
// (taken here, under this launch, before the write) and the launch it was written under ride with the notice — once.
|
|
@@ -4576,7 +4937,7 @@ export class Daemon extends EventEmitter {
|
|
|
4576
4937
|
if (!notifyWritten || told)
|
|
4577
4938
|
return;
|
|
4578
4939
|
told = true;
|
|
4579
|
-
this.
|
|
4940
|
+
this.broadcastFleetMessage({ type: "raw_paste_written", id: notifyWritten, outcome: written ? "written" : "not_written",
|
|
4580
4941
|
...(written ? { owner, checkpoint, ...(paneFollower ? { pane: true } : {}) } : {}) });
|
|
4581
4942
|
if (written && paneFollower)
|
|
4582
4943
|
void this.followCompactPane(notifyWritten, owner, paneFollower);
|
|
@@ -4738,10 +5099,11 @@ export class Daemon extends EventEmitter {
|
|
|
4738
5099
|
const press = (target, cursor, key) => this.paneWriteLock.run(async () => {
|
|
4739
5100
|
if (this.tmux !== tmux)
|
|
4740
5101
|
return false;
|
|
4741
|
-
const
|
|
5102
|
+
const screen = await read();
|
|
5103
|
+
const now = claudeSwitchDialog(screen);
|
|
4742
5104
|
if (!now || now.kind !== "model" || now.target !== target || (cursor !== null && now.cursor !== cursor))
|
|
4743
5105
|
return false;
|
|
4744
|
-
return tmux.sendSpecialKey(key);
|
|
5106
|
+
return this.nativePaneLifecycle ? tmux.sendSpecialKey(key, undefined, { kind: "dialog", screen }) : tmux.sendSpecialKey(key);
|
|
4745
5107
|
});
|
|
4746
5108
|
const gone = async () => {
|
|
4747
5109
|
const until = performance.now() + OWN_SWITCH_SETTLE_MS;
|
|
@@ -4830,9 +5192,12 @@ export class Daemon extends EventEmitter {
|
|
|
4830
5192
|
return false;
|
|
4831
5193
|
const specialKeys = new Set(["Up", "Down", "Enter", "Escape", "Right", "Left"]);
|
|
4832
5194
|
for (const key of dialog.keys) {
|
|
5195
|
+
const keyScreen = this.nativePaneLifecycle ? await this.tmux.capturePane() : currentPane;
|
|
5196
|
+
if (!matches(keyScreen))
|
|
5197
|
+
return false;
|
|
4833
5198
|
const ok = specialKeys.has(key)
|
|
4834
|
-
? await this.tmux.sendSpecialKey(key)
|
|
4835
|
-
: await this.tmux.sendKeys(key);
|
|
5199
|
+
? await (this.nativePaneLifecycle ? this.tmux.sendSpecialKey(key, undefined, { kind: "dialog", screen: keyScreen }) : this.tmux.sendSpecialKey(key))
|
|
5200
|
+
: await (this.nativePaneLifecycle ? this.tmux.sendKeys(key, { kind: "dialog", screen: keyScreen }) : this.tmux.sendKeys(key));
|
|
4836
5201
|
if (!ok)
|
|
4837
5202
|
return false;
|
|
4838
5203
|
await new Promise(resolve => setTimeout(resolve, 100));
|
|
@@ -5075,7 +5440,7 @@ export class Daemon extends EventEmitter {
|
|
|
5075
5440
|
await this.tmux.sendSpecialKey("Escape").catch(() => false);
|
|
5076
5441
|
return true;
|
|
5077
5442
|
}
|
|
5078
|
-
async stop() {
|
|
5443
|
+
async stop(options = {}) {
|
|
5079
5444
|
this.publishWorkingState("before_stop");
|
|
5080
5445
|
this.logger.info("Stopping daemon instance");
|
|
5081
5446
|
this.clearQuitRelaunchWatch();
|
|
@@ -5097,8 +5462,18 @@ export class Daemon extends EventEmitter {
|
|
|
5097
5462
|
}
|
|
5098
5463
|
if (this.adapter)
|
|
5099
5464
|
await this.adapter.stop();
|
|
5465
|
+
if (this.nativePaneLifecycle) {
|
|
5466
|
+
this.healthCheckPaused = true;
|
|
5467
|
+
this.saveSessionId();
|
|
5468
|
+
await this.nativePaneLifecycle.release(options.nativePane ?? "detach");
|
|
5469
|
+
try {
|
|
5470
|
+
unlinkSync(join(this.instanceDir, "daemon.pid"));
|
|
5471
|
+
}
|
|
5472
|
+
catch { /* metadata only */ }
|
|
5473
|
+
return;
|
|
5474
|
+
}
|
|
5100
5475
|
// Notify MCP servers of graceful shutdown (prevents reconnect attempts)
|
|
5101
|
-
this.
|
|
5476
|
+
this.broadcastFleetMessage({ type: "shutdown" });
|
|
5102
5477
|
// Quit CLI FIRST — this kills MCP server child processes cleanly.
|
|
5103
5478
|
// IPC must stay open during quit so MCP servers receive the shutdown message.
|
|
5104
5479
|
if (this.tmux) {
|
|
@@ -5244,6 +5619,24 @@ export class Daemon extends EventEmitter {
|
|
|
5244
5619
|
freshChoice: this.recoveryFreshChoice || this.isNewSession && !this.bootSkippedResume, crashLoopFresh: this.recoveryCrashLoopFresh,
|
|
5245
5620
|
cancelled: this.recoveryCancelled, background: this.workingBackgroundObservation };
|
|
5246
5621
|
}
|
|
5622
|
+
/** Observe this host General before its approved switch. No keys, process signals or provider writes. */
|
|
5623
|
+
async generalHostOwner() {
|
|
5624
|
+
const pane = this.tmux, owner = JSON.stringify(this.interactionOwner());
|
|
5625
|
+
if (!this.config.general_topic || this.nativePaneLifecycle || !pane || !/^@\d+$/.test(pane.getWindowId()))
|
|
5626
|
+
throw Error("General host owner is unavailable");
|
|
5627
|
+
const status = await pane.getPaneStatus();
|
|
5628
|
+
if (!status?.alive || !status.pid || status.pid <= 1)
|
|
5629
|
+
throw Error("General host process cannot be proven");
|
|
5630
|
+
const checkpoint = await this.transcriptMonitor?.reconciliationCheckpoint();
|
|
5631
|
+
if (this.tmux !== pane || owner !== JSON.stringify(this.interactionOwner()))
|
|
5632
|
+
throw Error("General host owner changed during observation");
|
|
5633
|
+
const backend = this.config.backend ?? "claude-code";
|
|
5634
|
+
let sessionId = this.backend?.getSessionId() ?? undefined;
|
|
5635
|
+
if (backend === "codex" && checkpoint)
|
|
5636
|
+
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];
|
|
5637
|
+
return { kind: "tmux", windowId: pane.getWindowId(), pid: status.pid,
|
|
5638
|
+
...(typeof sessionId === "string" && sessionId.length > 0 && sessionId.length <= 256 && !/[\p{Cc}\p{Cf}]/u.test(sessionId) ? { pin: { backend, sessionId } } : {}) };
|
|
5639
|
+
}
|
|
5247
5640
|
/** Local system work: no user turn, channel reply target, wake or replay of an original request. */
|
|
5248
5641
|
async deliverWorkingRecovery(content, delivery, admitted) {
|
|
5249
5642
|
const tmux = this.tmux, owner = JSON.stringify(this.interactionOwner()), epoch = this.deliveryEpoch;
|
|
@@ -5264,7 +5657,11 @@ export class Daemon extends EventEmitter {
|
|
|
5264
5657
|
|| !this.paneAuthoritativelyIdle(pane) || this.inputTransientInPane(pane)
|
|
5265
5658
|
|| this.backend?.backgroundWorkRunning?.(pane) === true)
|
|
5266
5659
|
return;
|
|
5267
|
-
if (
|
|
5660
|
+
if (this.nativePaneLifecycle ? !this.nativePaneLifecycle.current() || this.nativePaneLifecycle.mcpProof() !== "alive"
|
|
5661
|
+
|| !!this.backend?.isDeliveryInputReadyPane && !this.backend.isDeliveryInputReadyPane(pane)
|
|
5662
|
+
: await tmux.getPaneInputMode?.() !== "raw")
|
|
5663
|
+
return;
|
|
5664
|
+
if (!current())
|
|
5268
5665
|
return;
|
|
5269
5666
|
const evidence = await this.durableAttemptEvidence(tmux.getWindowId(), false, false);
|
|
5270
5667
|
if (!current())
|
|
@@ -5355,7 +5752,7 @@ export class Daemon extends EventEmitter {
|
|
|
5355
5752
|
this.logger.debug({ err }, "Interaction listener failed");
|
|
5356
5753
|
}
|
|
5357
5754
|
try {
|
|
5358
|
-
this.
|
|
5755
|
+
this.broadcastFleetMessage({ type: "instance_interaction", instanceName: this.name, interaction });
|
|
5359
5756
|
}
|
|
5360
5757
|
catch (err) {
|
|
5361
5758
|
this.logger.debug({ err }, "Interaction broadcast failed");
|
|
@@ -5443,6 +5840,56 @@ export class Daemon extends EventEmitter {
|
|
|
5443
5840
|
}
|
|
5444
5841
|
return true;
|
|
5445
5842
|
}
|
|
5843
|
+
/** Shared Fleet inputs: socket and native transports retain the same wake, epoch and raw-paste semantics. */
|
|
5844
|
+
handleFleetMessage(msg, send, current = () => true) {
|
|
5845
|
+
if (msg.type === "query_sessions") {
|
|
5846
|
+
send({ type: "query_sessions_response", sessions: [] });
|
|
5847
|
+
}
|
|
5848
|
+
else if (msg.type === "fleet_inbound") {
|
|
5849
|
+
const meta = msg.meta;
|
|
5850
|
+
const targetSession = msg.targetSession;
|
|
5851
|
+
const deliveryEpoch = this.captureDeliveryEpoch(msg.delivery_epoch);
|
|
5852
|
+
void this.wake().then(() => {
|
|
5853
|
+
if (!current()) {
|
|
5854
|
+
this.deferDurableDelivery(meta, "native channel owner changed before pane submission");
|
|
5855
|
+
return;
|
|
5856
|
+
}
|
|
5857
|
+
this.pushChannelMessage(msg.content, meta, targetSession, deliveryEpoch);
|
|
5858
|
+
}).catch(err => {
|
|
5859
|
+
this.deferDurableDelivery(meta, `target wake failed before pane submission: ${err.message}`);
|
|
5860
|
+
this.logger.error({ err: err.message }, "Wake failed for inbound delivery");
|
|
5861
|
+
});
|
|
5862
|
+
}
|
|
5863
|
+
else if (msg.type === "raw_paste") {
|
|
5864
|
+
this.handleRawPasteIpcMessage(msg);
|
|
5865
|
+
}
|
|
5866
|
+
else if (msg.type === "config_update") {
|
|
5867
|
+
this.applyConfigUpdate(msg.config);
|
|
5868
|
+
}
|
|
5869
|
+
else if (msg.type === "steer") {
|
|
5870
|
+
const meta = (msg.meta ?? {});
|
|
5871
|
+
this.steerMessage(msg.content, meta, this.captureDeliveryEpoch(msg.delivery_epoch));
|
|
5872
|
+
}
|
|
5873
|
+
else if (msg.type === "btw") {
|
|
5874
|
+
const meta = (msg.meta ?? {});
|
|
5875
|
+
this.btwMessage(msg.content, meta, this.captureDeliveryEpoch(msg.delivery_epoch));
|
|
5876
|
+
}
|
|
5877
|
+
else if (msg.type === "fleet_schedule_trigger") {
|
|
5878
|
+
const payload = msg.payload;
|
|
5879
|
+
const meta = msg.meta;
|
|
5880
|
+
const deliveryEpoch = this.captureDeliveryEpoch(msg.delivery_epoch);
|
|
5881
|
+
void this.wake().then(() => { if (current())
|
|
5882
|
+
this.pushChannelMessage(payload.message, meta, undefined, deliveryEpoch); }).catch(err => {
|
|
5883
|
+
this.logger.error({ err: err.message }, "Wake failed for scheduled delivery");
|
|
5884
|
+
});
|
|
5885
|
+
}
|
|
5886
|
+
else if (msg.type === "query_instance_state") {
|
|
5887
|
+
void this.respondToInstanceStateQuery(msg, undefined, send);
|
|
5888
|
+
}
|
|
5889
|
+
else
|
|
5890
|
+
return false;
|
|
5891
|
+
return true;
|
|
5892
|
+
}
|
|
5446
5893
|
/**
|
|
5447
5894
|
* Answer a FleetManager state query. Most callers only need the cached state,
|
|
5448
5895
|
* but lifecycle decisions such as post-reply Cancel retirement need an
|
|
@@ -5450,7 +5897,7 @@ export class Daemon extends EventEmitter {
|
|
|
5450
5897
|
* the last transition can stay "working" even though the CLI has since
|
|
5451
5898
|
* settled without emitting another control-mode output record.
|
|
5452
5899
|
*/
|
|
5453
|
-
async respondToInstanceStateQuery(msg, socket) {
|
|
5900
|
+
async respondToInstanceStateQuery(msg, socket, send) {
|
|
5454
5901
|
try {
|
|
5455
5902
|
if (msg.deliveryIdle === true) {
|
|
5456
5903
|
await this.captureAndEvaluateInstanceState("delivery_idle_gate");
|
|
@@ -5459,7 +5906,7 @@ export class Daemon extends EventEmitter {
|
|
|
5459
5906
|
await this.captureAndEvaluateInstanceState("state_query");
|
|
5460
5907
|
}
|
|
5461
5908
|
const snapshot = this.getInstanceStateSnapshot();
|
|
5462
|
-
|
|
5909
|
+
const reply = {
|
|
5463
5910
|
type: "instance_state_response",
|
|
5464
5911
|
requestId: msg.requestId,
|
|
5465
5912
|
instanceName: this.name,
|
|
@@ -5467,7 +5914,11 @@ export class Daemon extends EventEmitter {
|
|
|
5467
5914
|
state: this.isPaused ? "paused" : snapshot.state,
|
|
5468
5915
|
processStatus: this.processStatus,
|
|
5469
5916
|
pausedAt: this.lastPausedAt,
|
|
5470
|
-
}
|
|
5917
|
+
};
|
|
5918
|
+
if (send)
|
|
5919
|
+
send(reply);
|
|
5920
|
+
else if (socket)
|
|
5921
|
+
this.ipcServer?.send(socket, reply);
|
|
5471
5922
|
}
|
|
5472
5923
|
catch (err) {
|
|
5473
5924
|
this.logger.debug({ err: err.message }, "Instance state query failed");
|
|
@@ -5507,7 +5958,49 @@ export class Daemon extends EventEmitter {
|
|
|
5507
5958
|
static AUTH_RECONFIRM_ROWS = 15;
|
|
5508
5959
|
/** Why the deferred pause was requested; what its marker records (Phase 2a). */
|
|
5509
5960
|
pendingPauseReason = "auth";
|
|
5961
|
+
nativePauseProof = null;
|
|
5962
|
+
/** Consume the exact idle proof synchronously after the lifecycle's await, before fencing and closing. */
|
|
5963
|
+
nativePauseStillReady() {
|
|
5964
|
+
const proof = this.nativePauseProof;
|
|
5965
|
+
this.nativePauseProof = null;
|
|
5966
|
+
if (proof?.())
|
|
5967
|
+
return true;
|
|
5968
|
+
this.pauseRequested = false;
|
|
5969
|
+
return false;
|
|
5970
|
+
}
|
|
5971
|
+
/** Native lifecycle pause uses the ordinary idle/background/admission proof before closing its owned Job. */
|
|
5972
|
+
async nativePauseReady(admission) {
|
|
5973
|
+
this.nativePauseProof = null;
|
|
5974
|
+
const native = this.nativePaneLifecycle, pane = this.tmux, owner = this.interactionOwner();
|
|
5975
|
+
const allowStuck = this.pauseAllowStuck;
|
|
5976
|
+
this.pauseAllowStuck = false;
|
|
5977
|
+
const ready = () => !!native && native === this.nativePaneLifecycle && native.current() && this.tmux === pane
|
|
5978
|
+
&& sameInteractionOwner(owner, this.interactionOwner()) && !this.runtimeMonitorsFrozen && !this.spawning
|
|
5979
|
+
&& this.processStatus === "running" && this.pasteQueueDepth === 0
|
|
5980
|
+
&& (this.instanceState === "idle" || allowStuck && this.instanceState === "stuck") && (!admission || admission.current());
|
|
5981
|
+
if (!pane || !ready()) {
|
|
5982
|
+
this.pauseRequested = false;
|
|
5983
|
+
return false;
|
|
5984
|
+
}
|
|
5985
|
+
let text;
|
|
5986
|
+
try {
|
|
5987
|
+
text = await pane.capturePane();
|
|
5988
|
+
}
|
|
5989
|
+
catch {
|
|
5990
|
+
this.pauseRequested = false;
|
|
5991
|
+
return false;
|
|
5992
|
+
}
|
|
5993
|
+
if (!ready() || admission && !admission.accepts(text) || this.backend?.backgroundWorkRunning?.(text)
|
|
5994
|
+
|| !allowStuck && !this.paneAuthoritativelyIdle(text)) {
|
|
5995
|
+
this.pauseRequested = false;
|
|
5996
|
+
return false;
|
|
5997
|
+
}
|
|
5998
|
+
this.nativePauseProof = ready;
|
|
5999
|
+
return true;
|
|
6000
|
+
}
|
|
5510
6001
|
async pause(reason = "operator", admission) {
|
|
6002
|
+
if (this.nativePaneLifecycle)
|
|
6003
|
+
throw Error("Native pause is owned by its Fleet lifecycle transition");
|
|
5511
6004
|
if (admission && !admission.current())
|
|
5512
6005
|
return;
|
|
5513
6006
|
if (this.pauseWakeState === "paused")
|
|
@@ -5603,7 +6096,7 @@ export class Daemon extends EventEmitter {
|
|
|
5603
6096
|
writePausedMarker(this.instanceDir, this.lastPausedAt ?? Date.now(), reason);
|
|
5604
6097
|
this.publishWorkingState("execution");
|
|
5605
6098
|
this.logger.info({ pausedAt: this.lastPausedAt }, "Instance auto-paused");
|
|
5606
|
-
this.
|
|
6099
|
+
this.broadcastFleetMessage({
|
|
5607
6100
|
type: "instance_state", instanceName: this.name, state: "paused", pausedAt: this.lastPausedAt,
|
|
5608
6101
|
});
|
|
5609
6102
|
this.emit("auto_paused", { name: this.name, pausedAt: this.lastPausedAt });
|
|
@@ -5698,7 +6191,7 @@ export class Daemon extends EventEmitter {
|
|
|
5698
6191
|
this.resumeRuntimeMonitors();
|
|
5699
6192
|
this.publishWorkingState("execution");
|
|
5700
6193
|
this.logger.info("Instance auto-woke");
|
|
5701
|
-
this.
|
|
6194
|
+
this.broadcastFleetMessage({
|
|
5702
6195
|
type: "instance_state", instanceName: this.name, state: this.instanceState, pausedAt: null,
|
|
5703
6196
|
});
|
|
5704
6197
|
this.emit("auto_woke", { name: this.name });
|
|
@@ -5862,7 +6355,7 @@ export class Daemon extends EventEmitter {
|
|
|
5862
6355
|
this.logStateEdge(previous, snapshot);
|
|
5863
6356
|
this.publishWorkingState("execution");
|
|
5864
6357
|
this.emit("instance_state", { name: this.name, ...snapshot });
|
|
5865
|
-
this.
|
|
6358
|
+
this.broadcastFleetMessage({ type: "instance_state", instanceName: this.name, ...snapshot });
|
|
5866
6359
|
if (snapshot.state === "stuck" && pane && this.instanceStateReadyPattern) {
|
|
5867
6360
|
this.handleStuckTransition(pane, snapshot, this.instanceStateReadyPattern);
|
|
5868
6361
|
}
|
|
@@ -5964,7 +6457,7 @@ export class Daemon extends EventEmitter {
|
|
|
5964
6457
|
// writing a marker would re-inject a continuation for a finished turn.
|
|
5965
6458
|
// #3030: a message only queued in the busy CLI has not started a turn: the interrupted turn is still the running one,
|
|
5966
6459
|
// 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) {
|
|
6460
|
+
if (!this.nativePaneLifecycle && !meta.resumedContinuationOf && !armed.completionDelivered && !queuedHandoff) {
|
|
5968
6461
|
const resumeBackend = this.config.backend ?? this.backend?.binaryName ?? this.runtimeIdentity?.backend;
|
|
5969
6462
|
const resumeCwd = this.config.working_directory ?? "";
|
|
5970
6463
|
writeInFlightTurnMarker(this.instanceDir, {
|
|
@@ -6196,7 +6689,7 @@ export class Daemon extends EventEmitter {
|
|
|
6196
6689
|
// outbound action suppresses a duplicate proxy; only a delivered
|
|
6197
6690
|
// human-facing channel action satisfies the completion guard below.
|
|
6198
6691
|
if (!turn.outboundDelivered && this.config.mcp_proxy_reply === true
|
|
6199
|
-
&& mcpServerState(this.instanceDir).state === "dead") {
|
|
6692
|
+
&& (this.nativePaneLifecycle ? this.nativePaneLifecycle.mcpProof() === "dead" : mcpServerState(this.instanceDir).state === "dead")) {
|
|
6200
6693
|
this.turnReplyGuard.complete(turn.generation);
|
|
6201
6694
|
void this.sendProxyReply(pane, turn.target);
|
|
6202
6695
|
return;
|
|
@@ -6296,21 +6789,37 @@ export class Daemon extends EventEmitter {
|
|
|
6296
6789
|
|| this.config.backend === "claude-code"
|
|
6297
6790
|
|| this.backend?.binaryName === "claude";
|
|
6298
6791
|
}
|
|
6792
|
+
/** #3160: this agent's file steps in its current turn (the CLI's own record), for the Files & changes panel. */
|
|
6793
|
+
followLog = new FollowLog();
|
|
6794
|
+
workspaceFollow(after = 0, turn, scope) { return this.followLog.snapshot(after, turn, scope); }
|
|
6299
6795
|
/**
|
|
6300
6796
|
* This launch's transcript monitor. #1510: its turn boundaries feed the reply guard's ledger, which starts empty
|
|
6301
6797
|
* with it — a new monitor re-baselines at the transcript's end, so nothing the old one read can be attributed.
|
|
6302
6798
|
*/
|
|
6303
6799
|
buildTranscriptMonitor(source) {
|
|
6800
|
+
this.followLog.reset();
|
|
6304
6801
|
const monitor = new TranscriptMonitor(this.instanceDir, this.logger, source);
|
|
6305
6802
|
this.transcriptTurns.reset();
|
|
6306
6803
|
this.transcriptActivityAt = 0;
|
|
6307
6804
|
// Monotonic: a wall-clock correction must neither end nor extend the open-turn hold (#1641 R1).
|
|
6308
6805
|
const touch = () => { this.transcriptActivityAt = performance.now(); };
|
|
6309
|
-
monitor.on("turns", (turns) => {
|
|
6806
|
+
monitor.on("turns", (turns) => {
|
|
6807
|
+
this.transcriptTurns.observe(turns, performance.now());
|
|
6808
|
+
touch();
|
|
6809
|
+
});
|
|
6810
|
+
// #3160: the files this turn reads, edits and searches, for the Files & changes panel's Follow (a few string checks;
|
|
6811
|
+
// nothing is read from disk until someone asks). Claude's turn boundary is its next prompt.
|
|
6812
|
+
const canFollow = () => this.transcriptMonitor === monitor && this.config.runtime !== "windows"
|
|
6813
|
+
&& (this.backend?.binaryName === "claude" || this.backend?.binaryName === "codex");
|
|
6814
|
+
monitor.on("workspace_follow", (event) => { if (canFollow())
|
|
6815
|
+
this.followLog.observe(event); });
|
|
6816
|
+
monitor.on("workspace_reset", () => { if (this.transcriptMonitor === monitor)
|
|
6817
|
+
this.followLog.reset(); });
|
|
6310
6818
|
// #1641 R2: a re-baselined source starts over, and so does what it said (an open turn read before is withdrawn).
|
|
6311
6819
|
monitor.on("reset", () => { if (this.transcriptMonitor === monitor) {
|
|
6312
6820
|
this.transcriptTurns.reset();
|
|
6313
6821
|
this.transcriptActivityAt = 0;
|
|
6822
|
+
this.followLog.reset();
|
|
6314
6823
|
} });
|
|
6315
6824
|
for (const event of ["tool_use", "tool_result", "assistant_text"])
|
|
6316
6825
|
monitor.on(event, touch);
|
|
@@ -6573,7 +7082,7 @@ export class Daemon extends EventEmitter {
|
|
|
6573
7082
|
}
|
|
6574
7083
|
});
|
|
6575
7084
|
}
|
|
6576
|
-
if (!this.
|
|
7085
|
+
if (!this.fleetTransportAvailable()) {
|
|
6577
7086
|
this.logger.error(`${logLabel} failed — no adapter or fleet IPC route`);
|
|
6578
7087
|
return Promise.resolve(false);
|
|
6579
7088
|
}
|
|
@@ -6597,7 +7106,7 @@ export class Daemon extends EventEmitter {
|
|
|
6597
7106
|
resolve(delivered);
|
|
6598
7107
|
});
|
|
6599
7108
|
try {
|
|
6600
|
-
this.
|
|
7109
|
+
this.broadcastFleetMessage({
|
|
6601
7110
|
type: "fleet_outbound",
|
|
6602
7111
|
tool: "reply",
|
|
6603
7112
|
args,
|
|
@@ -7168,7 +7677,7 @@ export class Daemon extends EventEmitter {
|
|
|
7168
7677
|
if (next === this.currentActivity)
|
|
7169
7678
|
return;
|
|
7170
7679
|
this.currentActivity = next;
|
|
7171
|
-
this.
|
|
7680
|
+
this.broadcastFleetMessage({
|
|
7172
7681
|
type: "instance_activity",
|
|
7173
7682
|
instanceName: this.name,
|
|
7174
7683
|
activity: next,
|
|
@@ -7221,6 +7730,10 @@ export class Daemon extends EventEmitter {
|
|
|
7221
7730
|
else if (update.reply_completion_guard === null) {
|
|
7222
7731
|
delete this.config.reply_completion_guard;
|
|
7223
7732
|
}
|
|
7733
|
+
if (update.quota_notice === null)
|
|
7734
|
+
delete this.config.quota_notice;
|
|
7735
|
+
else if (update.quota_notice !== undefined && !quotaNoticeProblem(update.quota_notice))
|
|
7736
|
+
this.config.quota_notice = structuredClone(update.quota_notice);
|
|
7224
7737
|
if (typeof update.mcp_proxy_reply === "boolean")
|
|
7225
7738
|
this.config.mcp_proxy_reply = update.mcp_proxy_reply;
|
|
7226
7739
|
else if (update.mcp_proxy_reply === null)
|
|
@@ -7245,7 +7758,7 @@ export class Daemon extends EventEmitter {
|
|
|
7245
7758
|
else
|
|
7246
7759
|
this.config.auto_pause_after = nextAutoPause;
|
|
7247
7760
|
if (nextAutoPause !== previousAutoPause) {
|
|
7248
|
-
const isGeneral = this.config.general_topic === true || this.name
|
|
7761
|
+
const isGeneral = this.config.general_topic === true || generalByName(this.name, this.config);
|
|
7249
7762
|
this.autoPauseController.reconfigure((isGeneral ? 0 : nextAutoPause) * 60_000);
|
|
7250
7763
|
}
|
|
7251
7764
|
}
|
|
@@ -7325,7 +7838,7 @@ export class Daemon extends EventEmitter {
|
|
|
7325
7838
|
return;
|
|
7326
7839
|
this.lastProgressBroadcast = rendered;
|
|
7327
7840
|
this.lastProgressBroadcastAt = Date.now();
|
|
7328
|
-
this.
|
|
7841
|
+
this.broadcastFleetMessage({
|
|
7329
7842
|
type: "instance_progress",
|
|
7330
7843
|
instanceName: this.name,
|
|
7331
7844
|
progress: rendered,
|
|
@@ -7341,7 +7854,7 @@ export class Daemon extends EventEmitter {
|
|
|
7341
7854
|
if (this.lastProgressBroadcast !== "") {
|
|
7342
7855
|
this.lastProgressBroadcast = "";
|
|
7343
7856
|
this.lastProgressBroadcastAt = Date.now();
|
|
7344
|
-
this.
|
|
7857
|
+
this.broadcastFleetMessage({ type: "instance_progress", instanceName: this.name, progress: "" });
|
|
7345
7858
|
}
|
|
7346
7859
|
}
|
|
7347
7860
|
/**
|
|
@@ -7508,7 +8021,7 @@ export class Daemon extends EventEmitter {
|
|
|
7508
8021
|
reportCrossInstanceDeliveryFailure(meta, verdict, error) {
|
|
7509
8022
|
if (!meta.from_instance)
|
|
7510
8023
|
return;
|
|
7511
|
-
this.
|
|
8024
|
+
this.broadcastFleetMessage({
|
|
7512
8025
|
type: "cross_instance_delivery_failed",
|
|
7513
8026
|
senderSession: meta.from_instance,
|
|
7514
8027
|
targetInstance: this.name,
|
|
@@ -8889,13 +9402,14 @@ export class Daemon extends EventEmitter {
|
|
|
8889
9402
|
if (this.remoteCardAnswering)
|
|
8890
9403
|
return { outcome: "refused", reason: "another answer to this card is being keyed in" };
|
|
8891
9404
|
this.remoteCardAnswering = true;
|
|
9405
|
+
let answerScreen = null;
|
|
8892
9406
|
try {
|
|
8893
9407
|
const outcome = await answerRemoteCard({
|
|
8894
9408
|
locked: fn => this.paneWriteLock.run(fn),
|
|
8895
9409
|
// 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),
|
|
9410
|
+
read: async () => answerScreen = this.tmux === tmux ? await tmux.capturePane().catch(() => null) : null,
|
|
9411
|
+
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)),
|
|
9412
|
+
paste: text => this.tmux !== tmux || answerScreen === null ? Promise.resolve(false) : this.nativePaneLifecycle ? tmux.pasteBuffer(text, { proof: { kind: "dialog", screen: answerScreen } }) : tmux.pasteBuffer(text),
|
|
8899
9413
|
sleep: ms => new Promise(resolve => setTimeout(resolve, ms)),
|
|
8900
9414
|
now: () => performance.now(),
|
|
8901
9415
|
}, pane => {
|
|
@@ -9166,12 +9680,19 @@ export class Daemon extends EventEmitter {
|
|
|
9166
9680
|
if (!check || !this.tmux)
|
|
9167
9681
|
return !check;
|
|
9168
9682
|
try {
|
|
9169
|
-
const
|
|
9170
|
-
|
|
9683
|
+
const inputActive = this.nativePaneLifecycle
|
|
9684
|
+
? this.nativePaneLifecycle.current() && this.nativePaneLifecycle.mcpProof() === "alive"
|
|
9685
|
+
: await this.tmux.getPaneInputMode?.() === "raw";
|
|
9686
|
+
// ConPTY has no POSIX termios mode. Its closed launch plus current helper handshake is the input barrier;
|
|
9687
|
+
// the same strict composer detector below is still required. Never grant native unknown-layout fallback.
|
|
9688
|
+
if (!inputActive) {
|
|
9171
9689
|
this.resetFooterFallback();
|
|
9172
9690
|
return false;
|
|
9173
9691
|
}
|
|
9174
|
-
|
|
9692
|
+
const pane = await this.tmux.capturePane();
|
|
9693
|
+
if (this.nativePaneLifecycle && (!this.nativePaneLifecycle.current() || this.nativePaneLifecycle.mcpProof() !== "alive"))
|
|
9694
|
+
return false;
|
|
9695
|
+
return this.deliveryInputReadyPane(pane);
|
|
9175
9696
|
}
|
|
9176
9697
|
catch {
|
|
9177
9698
|
this.resetFooterFallback();
|
|
@@ -9790,9 +10311,9 @@ export class Daemon extends EventEmitter {
|
|
|
9790
10311
|
* moment the flag clears.
|
|
9791
10312
|
*/
|
|
9792
10313
|
refuseFatalStartupDelivery(verdict, status) {
|
|
9793
|
-
if (!this.fatalStartupBlocked)
|
|
10314
|
+
if (!this.fatalStartupBlocked && !this.modelMinimumBlocked)
|
|
9794
10315
|
return false;
|
|
9795
|
-
this.logger.error("Delivery refused — CLI
|
|
10316
|
+
this.logger.error("Delivery refused — CLI startup or model-version repair is held");
|
|
9796
10317
|
this.failDelivery(verdict, status, "fatal-startup", "blocked-before-write");
|
|
9797
10318
|
return true;
|
|
9798
10319
|
}
|
|
@@ -9945,34 +10466,86 @@ export class Daemon extends EventEmitter {
|
|
|
9945
10466
|
// tmux object and window — so the spawn generation and launch fence are part of the fence too: an Enter meant for
|
|
9946
10467
|
// the CLI this paste went to is never sent to its successor.
|
|
9947
10468
|
const tmux = this.tmux;
|
|
10469
|
+
const backend = this.backend;
|
|
10470
|
+
const native = !!this.nativePaneLifecycle;
|
|
9948
10471
|
const generation = this.spawnGeneration;
|
|
9949
10472
|
const fence = this.launchFenceEpoch;
|
|
10473
|
+
const windowId = native ? tmux?.getWindowId() : undefined;
|
|
10474
|
+
// M-2290 (#2985 review, Fable): the mode wait can last up to 10 minutes, and a respawn or relaunch reuses the same
|
|
10475
|
+
// tmux object and window — so the spawn generation and launch fence are part of every pane's fence: an Enter meant
|
|
10476
|
+
// for the CLI this paste went to is never sent to its successor. A native Windows pane keeps #2958's full fence too
|
|
10477
|
+
// (its launch can be replaced under the same handle).
|
|
9950
10478
|
const current = () => this.tmux === tmux && this.spawnGeneration === generation && this.launchFenceEpoch === fence
|
|
9951
|
-
&& !this.deliveryWritesStopping && (!stillCurrent || stillCurrent())
|
|
10479
|
+
&& !this.deliveryWritesStopping && (!stillCurrent || stillCurrent())
|
|
10480
|
+
&& (!native || (!!windowId && !!backend && this.backend === backend && tmux.getWindowId() === windowId));
|
|
9952
10481
|
if (!current())
|
|
9953
10482
|
return false;
|
|
9954
10483
|
// The pasted text may still be in the box: the caller keeps it uncertain (no false failure, no second paste).
|
|
9955
|
-
|
|
9956
|
-
|
|
9957
|
-
|
|
10484
|
+
// S-35: say which check withheld Enter.
|
|
10485
|
+
const hold = (reason) => {
|
|
10486
|
+
onInputHeld?.(reason);
|
|
10487
|
+
if (reason === "output_changed" && current() && !this.nativeDeliveryHold())
|
|
10488
|
+
this.nativeEnterHold = {
|
|
10489
|
+
key: `${this.bootId}:${generation}:${fence}`, since: Date.now(), spawn: generation, fence,
|
|
10490
|
+
};
|
|
10491
|
+
if (reason === "pane-in-mode")
|
|
10492
|
+
this.logger.warn({ phase, reason }, "The pane stayed in a tmux mode; Enter withheld");
|
|
10493
|
+
else
|
|
10494
|
+
this.logger.warn({ ...tmux?.getLastInputDiagnostic?.(), phase, reason, retryCount: positiveRefusals }, "Native delivery Enter withheld by its safety check");
|
|
9958
10495
|
return false;
|
|
9959
10496
|
};
|
|
9960
10497
|
// 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
10498
|
// 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
|
-
//
|
|
10499
|
+
// past the bound.
|
|
10500
|
+
// Native delivery follows main #2990: only this backend's recognised runtime dialog vetoes Enter.
|
|
10501
|
+
// The fresh capture still binds the native host output sequence; ownership and positive-ACK-only retries remain.
|
|
9964
10502
|
const modeDeadline = performance.now() + PANE_MODE_ENTER_WAIT_MS;
|
|
10503
|
+
let pane;
|
|
10504
|
+
let positiveRefusals = 0, enterMarked = false, positiveRetryDeadline = Infinity, linuxDialogRead = false;
|
|
9965
10505
|
for (;;) {
|
|
9966
|
-
const mode = await this.waitWhilePaneInMode(phase, current, modeDeadline);
|
|
10506
|
+
const mode = await this.waitWhilePaneInMode(phase, current, Math.min(modeDeadline, positiveRetryDeadline));
|
|
9967
10507
|
if (mode === "stale")
|
|
9968
10508
|
return false;
|
|
9969
10509
|
if (mode === "held")
|
|
9970
|
-
return hold();
|
|
10510
|
+
return hold("pane-in-mode");
|
|
10511
|
+
if (native) {
|
|
10512
|
+
// S-35: a native pane's capture refuses while output is still arriving ("Pane changed during capture; observe it
|
|
10513
|
+
// again"). Right after a turn the CLI repaints for a moment; one refused read left the message unsent for ever.
|
|
10514
|
+
// Read again a few times — reading types nothing — and still hold if it never settles.
|
|
10515
|
+
let captured;
|
|
10516
|
+
for (let attempt = 0; captured === undefined; attempt++) {
|
|
10517
|
+
try {
|
|
10518
|
+
captured = await tmux.capturePane();
|
|
10519
|
+
}
|
|
10520
|
+
catch {
|
|
10521
|
+
if (!current())
|
|
10522
|
+
return false;
|
|
10523
|
+
if (attempt >= 4)
|
|
10524
|
+
return hold("capture_failed");
|
|
10525
|
+
await new Promise(done => setTimeout(done, 150 * (attempt + 1)));
|
|
10526
|
+
if (!current())
|
|
10527
|
+
return false;
|
|
10528
|
+
}
|
|
10529
|
+
}
|
|
10530
|
+
const screen = captured;
|
|
10531
|
+
pane = screen;
|
|
10532
|
+
if (!current())
|
|
10533
|
+
return false;
|
|
10534
|
+
try {
|
|
10535
|
+
if (backend?.getRuntimeDialogs?.().some(dialog => Daemon.dialogMatches(dialog, screen)))
|
|
10536
|
+
return hold("dialog");
|
|
10537
|
+
}
|
|
10538
|
+
catch {
|
|
10539
|
+
return hold("check_failed");
|
|
10540
|
+
}
|
|
10541
|
+
if (!current())
|
|
10542
|
+
return false;
|
|
10543
|
+
}
|
|
9971
10544
|
if (await this.paneInTmuxMode(phase)) {
|
|
9972
10545
|
if (!current())
|
|
9973
10546
|
return false;
|
|
9974
10547
|
if (performance.now() >= modeDeadline)
|
|
9975
|
-
return hold();
|
|
10548
|
+
return hold("pane-in-mode");
|
|
9976
10549
|
await new Promise(r => setTimeout(r, PANE_MODE_POLL_MS));
|
|
9977
10550
|
if (!current())
|
|
9978
10551
|
return false;
|
|
@@ -9980,54 +10553,143 @@ export class Daemon extends EventEmitter {
|
|
|
9980
10553
|
}
|
|
9981
10554
|
if (!current())
|
|
9982
10555
|
return false;
|
|
9983
|
-
|
|
9984
|
-
|
|
9985
|
-
|
|
9986
|
-
|
|
9987
|
-
|
|
9988
|
-
|
|
9989
|
-
|
|
9990
|
-
|
|
9991
|
-
|
|
9992
|
-
|
|
9993
|
-
|
|
9994
|
-
|
|
10556
|
+
// M-2290 (the simple half of the #2957 redesign, leader xmsg-1793712561468; main): on a Linux pane, a dialog the
|
|
10557
|
+
// backend RECOGNISES (runtimeDialogs: a permission card, the dangerous-command card, …) that painted between the
|
|
10558
|
+
// paste and this Enter would take the key as its answer. Read the pane once more: such a dialog withholds the
|
|
10559
|
+
// Enter (the caller keeps the delivery uncertain → Needs-you; the dialog scanner parks it for a person). Nothing
|
|
10560
|
+
// else is judged — an unknown or unreadable screen sends: #2958's composer proof (decision f57474aa) is NOT back.
|
|
10561
|
+
// Only a caller that can hold asks (onInputHeld); a native pane read its own screen above, every round.
|
|
10562
|
+
if (!native && onInputHeld && !linuxDialogRead) {
|
|
10563
|
+
linuxDialogRead = true;
|
|
10564
|
+
let finalPane = null;
|
|
10565
|
+
try {
|
|
10566
|
+
finalPane = await tmux.capturePane();
|
|
10567
|
+
}
|
|
10568
|
+
catch {
|
|
10569
|
+
finalPane = null;
|
|
10570
|
+
}
|
|
10571
|
+
if (!current())
|
|
10572
|
+
return false;
|
|
10573
|
+
let dialog;
|
|
10574
|
+
try {
|
|
10575
|
+
dialog = finalPane === null ? undefined : (this.backend?.getRuntimeDialogs?.() ?? []).find(d => Daemon.dialogMatches(d, finalPane))?.description;
|
|
10576
|
+
}
|
|
10577
|
+
catch {
|
|
10578
|
+
dialog = undefined;
|
|
10579
|
+
}
|
|
10580
|
+
if (dialog !== undefined) {
|
|
10581
|
+
onInputHeld("dialog");
|
|
10582
|
+
this.logger.warn({ phase, dialog }, "A dialog is on the pane; the delivery's Enter is withheld (it would answer it)");
|
|
10583
|
+
return false;
|
|
10584
|
+
}
|
|
10585
|
+
}
|
|
10586
|
+
if (positiveRefusals && performance.now() >= positiveRetryDeadline)
|
|
10587
|
+
return hold("output_changed");
|
|
10588
|
+
// W1: persist the "Enter may have happened" boundary before tmux receives
|
|
10589
|
+
// the key. A crash after this commit is never auto-replayed without a
|
|
10590
|
+
// positive transcript marker, even if the stale pane still shows composer.
|
|
10591
|
+
if (!enterMarked && durableAttempt && !this.deliveryOutbox?.markEnterStarted(durableAttempt.deliveryId, this.bootId, durableAttempt.attemptNo)) {
|
|
10592
|
+
this.logger.error({ phase, deliveryId: durableAttempt.deliveryId }, "Could not commit durable Enter write-ahead fence");
|
|
10593
|
+
return false;
|
|
10594
|
+
}
|
|
10595
|
+
enterMarked = true;
|
|
10596
|
+
const sent = await (native && pane !== undefined ? tmux.sendSpecialKey("Enter", undefined, { kind: "delivery", screen: pane, retryCount: positiveRefusals }) : tmux.sendSpecialKey("Enter"));
|
|
10597
|
+
// A busy renderer can change seq after our capture. Only a positive zero-input ACK admits a NEW proof/key;
|
|
10598
|
+
// An Enter retry never re-pastes, retries an uncertain write, reuses stale proof or re-commits the durable boundary.
|
|
10599
|
+
if (!sent && native && tmux.lastInputWasNotSent?.() === true
|
|
10600
|
+
&& tmux.getLastSendSpecialKeyError() === "Pane changed after observation; input was not sent"
|
|
10601
|
+
&& current()) {
|
|
10602
|
+
if (!positiveRefusals)
|
|
10603
|
+
positiveRetryDeadline = Math.min(modeDeadline, performance.now() + 2000);
|
|
10604
|
+
if (positiveRefusals >= 4 || performance.now() >= positiveRetryDeadline)
|
|
10605
|
+
return hold("output_changed");
|
|
10606
|
+
positiveRefusals++;
|
|
10607
|
+
await new Promise(done => setTimeout(done, 100));
|
|
10608
|
+
if (!current())
|
|
10609
|
+
return false;
|
|
10610
|
+
if (performance.now() >= positiveRetryDeadline)
|
|
10611
|
+
return hold("output_changed");
|
|
10612
|
+
continue;
|
|
10613
|
+
}
|
|
10614
|
+
if (!sent) {
|
|
10615
|
+
const details = { phase, tmuxError: this.tmux.getLastSendSpecialKeyError() ?? "unknown tmux send-keys failure" };
|
|
10616
|
+
if (native)
|
|
10617
|
+
this.logger.warn({ ...tmux?.getLastInputDiagnostic?.(), ...details, retryCount: positiveRefusals }, "Native delivery Enter gave up");
|
|
10618
|
+
else
|
|
10619
|
+
this.logger.error(details, "tmux send-keys Enter failed during message delivery");
|
|
10620
|
+
}
|
|
10621
|
+
if (sent && native && current())
|
|
10622
|
+
this.nativeEnterHold = null;
|
|
10623
|
+
return sent;
|
|
10624
|
+
}
|
|
10625
|
+
}
|
|
10626
|
+
/** A pre-existing native busy-paste race: retry bytes only after an exact, owned zero-input acknowledgement. */
|
|
10627
|
+
async sendDeliveryPaste(text, stillCurrent) {
|
|
10628
|
+
const pane = this.tmux, native = this.nativePaneLifecycle;
|
|
10629
|
+
if (!native)
|
|
10630
|
+
return pane.pasteBuffer(text);
|
|
10631
|
+
const backend = this.backend, generation = this.spawnGeneration, fence = this.launchFenceEpoch, windowId = pane.getWindowId();
|
|
10632
|
+
const current = () => !!windowId && this.tmux === pane && this.nativePaneLifecycle === native && this.backend === backend
|
|
10633
|
+
&& this.spawnGeneration === generation && this.launchFenceEpoch === fence && pane.getWindowId() === windowId
|
|
10634
|
+
&& !this.deliveryWritesStopping && (!stillCurrent || stillCurrent());
|
|
10635
|
+
let retryCount = 0;
|
|
10636
|
+
const hold = (reason) => {
|
|
10637
|
+
if (current() && !this.nativeDeliveryHold())
|
|
10638
|
+
this.nativeEnterHold = { key: `${this.bootId}:${generation}:${fence}`, since: Date.now(), spawn: generation, fence };
|
|
10639
|
+
this.logger.warn({ ...pane.getLastInputDiagnostic?.(), reason, retryCount }, "Native delivery paste held by its safety check");
|
|
10640
|
+
return false;
|
|
10641
|
+
};
|
|
10642
|
+
const deadline = performance.now() + 2000;
|
|
10643
|
+
for (let attempt = 0; attempt < 5; attempt++) {
|
|
10644
|
+
retryCount = attempt;
|
|
10645
|
+
if (!current())
|
|
10646
|
+
return false;
|
|
10647
|
+
if (performance.now() >= deadline)
|
|
10648
|
+
return hold("output_changed");
|
|
10649
|
+
let screen;
|
|
10650
|
+
for (let read = 0; read < 5 && screen === undefined; read++) {
|
|
10651
|
+
try {
|
|
10652
|
+
screen = await pane.capturePane();
|
|
10653
|
+
}
|
|
10654
|
+
catch { /* Reads do not construct an input operation. */ }
|
|
10655
|
+
if (!current())
|
|
10656
|
+
return false;
|
|
10657
|
+
if (performance.now() >= deadline)
|
|
10658
|
+
return hold("capture_failed");
|
|
10659
|
+
if (screen === undefined && read < 4)
|
|
10660
|
+
await new Promise(done => setTimeout(done, 100));
|
|
10661
|
+
}
|
|
10662
|
+
if (screen === undefined)
|
|
10663
|
+
return hold("capture_failed");
|
|
9995
10664
|
try {
|
|
9996
|
-
|
|
10665
|
+
if (backend?.getRuntimeDialogs?.().some(dialog => Daemon.dialogMatches(dialog, screen)))
|
|
10666
|
+
return hold("dialog");
|
|
9997
10667
|
}
|
|
9998
10668
|
catch {
|
|
9999
|
-
|
|
10669
|
+
return hold("check_failed");
|
|
10000
10670
|
}
|
|
10001
10671
|
if (!current())
|
|
10002
10672
|
return false;
|
|
10003
|
-
|
|
10673
|
+
if (performance.now() >= deadline)
|
|
10674
|
+
return hold("output_changed");
|
|
10675
|
+
let sent;
|
|
10004
10676
|
try {
|
|
10005
|
-
|
|
10677
|
+
sent = await pane.pasteBuffer(text, { guard: current, proof: { kind: "composer", screen, retryCount: attempt } });
|
|
10006
10678
|
}
|
|
10007
10679
|
catch {
|
|
10008
|
-
|
|
10680
|
+
return hold("unconfirmed");
|
|
10009
10681
|
}
|
|
10010
|
-
if (
|
|
10011
|
-
|
|
10012
|
-
|
|
10682
|
+
if (sent)
|
|
10683
|
+
return true; // Exactly one successful paste ends the loop, before any Enter.
|
|
10684
|
+
if (!current())
|
|
10013
10685
|
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");
|
|
10686
|
+
if (pane.lastInputWasNotSent?.() !== true || pane.getLastPasteError?.() !== "Pane changed after observation; input was not sent")
|
|
10687
|
+
return hold("unconfirmed");
|
|
10688
|
+
if (attempt >= 4 || performance.now() >= deadline)
|
|
10689
|
+
return hold("output_changed");
|
|
10690
|
+
await new Promise(done => setTimeout(done, 100));
|
|
10029
10691
|
}
|
|
10030
|
-
return
|
|
10692
|
+
return hold("output_changed");
|
|
10031
10693
|
}
|
|
10032
10694
|
async writeMessageToPane(formatted, initialWindowId, handingOffToNativeQueue, status, submissionId,
|
|
10033
10695
|
// Last and defaulted so the positional callers that ignore the outcome stay
|
|
@@ -10065,6 +10727,9 @@ export class Daemon extends EventEmitter {
|
|
|
10065
10727
|
const tmuxAtWrite = this.tmux;
|
|
10066
10728
|
const steerCurrent = () => (!stillCurrent || stillCurrent()) && !this.deliveryWritesStopping
|
|
10067
10729
|
&& this.tmux === tmuxAtWrite && this.spawnGeneration === spawnAtWrite;
|
|
10730
|
+
// Alpha (S-36, Prism #2989 P2): a NATIVE pane keeps #2958's pre-paste owner fence through the initial Enter and every
|
|
10731
|
+
// retry Enter (a pane replaced while the paste awaits never takes this delivery's Enter); a tmux pane follows main.
|
|
10732
|
+
const nativeOwner = this.nativePaneLifecycle ? steerCurrent : undefined;
|
|
10068
10733
|
// Bug A: paste with backoff. Transient failures are usually a stale window id
|
|
10069
10734
|
// after a crash/respawn — recover by name and retry (max 3 attempts, 2s apart).
|
|
10070
10735
|
const maxAttempts = 3;
|
|
@@ -10132,8 +10797,8 @@ export class Daemon extends EventEmitter {
|
|
|
10132
10797
|
}
|
|
10133
10798
|
verdict.durableBeginCommitted = true;
|
|
10134
10799
|
verdict.submissionMode = attemptEvidence.submissionMode;
|
|
10135
|
-
if (attemptEvidence.transcriptPath && attemptEvidence.transcriptOffset !== null) {
|
|
10136
|
-
verdict.transcriptCheckpoint = {
|
|
10800
|
+
if (attemptEvidence.runtimeTranscript || attemptEvidence.transcriptPath && attemptEvidence.transcriptOffset !== null) {
|
|
10801
|
+
verdict.transcriptCheckpoint = attemptEvidence.runtimeTranscript ? { backend: attemptEvidence.backend, runtime: attemptEvidence.runtimeTranscript } : {
|
|
10137
10802
|
backend: attemptEvidence.backend,
|
|
10138
10803
|
path: attemptEvidence.transcriptPath,
|
|
10139
10804
|
offset: attemptEvidence.transcriptOffset,
|
|
@@ -10209,7 +10874,15 @@ export class Daemon extends EventEmitter {
|
|
|
10209
10874
|
}
|
|
10210
10875
|
const pasteGeneration = this.spawnGeneration;
|
|
10211
10876
|
beforePaste?.();
|
|
10212
|
-
const pasted = await this.
|
|
10877
|
+
const pasted = await this.sendDeliveryPaste(formatted, nativeOwner);
|
|
10878
|
+
if (!pasted && this.nativePaneLifecycle) {
|
|
10879
|
+
// The native write attempt is retained as uncertain, including exhausted positive refusals. Never route an
|
|
10880
|
+
// unknown/partial write through legacy window recovery or abort it back to an automatically replayable row.
|
|
10881
|
+
verdict.paneWriteStarted = true;
|
|
10882
|
+
verdict.phase = "paste";
|
|
10883
|
+
verdict.proof = "native-paste-held";
|
|
10884
|
+
return false;
|
|
10885
|
+
}
|
|
10213
10886
|
if (pasted)
|
|
10214
10887
|
this.rememberPaste(formatted, pasteGeneration);
|
|
10215
10888
|
if (!pasted) {
|
|
@@ -10296,15 +10969,18 @@ export class Daemon extends EventEmitter {
|
|
|
10296
10969
|
const enterMono = performance.now();
|
|
10297
10970
|
const steerEnterCurrent = () => steerCurrent() && performance.now() <= steerEnterDeadline;
|
|
10298
10971
|
let inputHeld = null;
|
|
10299
|
-
if (!(await this.sendDeliveryEnter("initial-submit", steerComposerProof ? steerEnterCurrent : undefined, durableAttempt, (why) => { inputHeld = why; }))) {
|
|
10972
|
+
if (!(await this.sendDeliveryEnter("initial-submit", steerComposerProof || nativeOwner ? steerEnterCurrent : undefined, durableAttempt, (why) => { inputHeld = why; }))) {
|
|
10300
10973
|
if (inputHeld) {
|
|
10301
10974
|
// #2971: held in a tmux mode past the bound; M-2290: a recognised dialog on the pane. The paste may still be in
|
|
10302
10975
|
// the CLI: keep it uncertain (Needs-you), never re-paste, never answer the dialog.
|
|
10303
10976
|
verdict.phase = "submit-enter";
|
|
10304
|
-
|
|
10977
|
+
// The merge of #2957/M-2290 (main) and the alpha's native holds: a tmux mode, a recognised dialog on a Linux pane,
|
|
10978
|
+
// and each native safety check say which.
|
|
10979
|
+
verdict.proof = inputHeld === "pane-in-mode" ? "pane-in-mode-held" : nativeOwner ? `native-input-${inputHeld}`
|
|
10980
|
+
: inputHeld === "dialog" ? "dialog-on-pane" : `input-held-${inputHeld}`;
|
|
10305
10981
|
return false;
|
|
10306
10982
|
}
|
|
10307
|
-
if (steerComposerProof && !steerCurrent()) {
|
|
10983
|
+
if ((steerComposerProof || nativeOwner) && !steerCurrent()) {
|
|
10308
10984
|
verdict.phase = "submit-enter";
|
|
10309
10985
|
verdict.proof = "fenced-before-enter";
|
|
10310
10986
|
return false;
|
|
@@ -10313,6 +10989,7 @@ export class Daemon extends EventEmitter {
|
|
|
10313
10989
|
return this.failDelivery(verdict, status, "submit-enter", "pre-enter-deadline");
|
|
10314
10990
|
return this.failDelivery(verdict, status, "submit-enter", "tmux-send-keys-failed");
|
|
10315
10991
|
}
|
|
10992
|
+
this.commitPreInputQuotaHistory(pasteBaseline);
|
|
10316
10993
|
// The proof's whole budget, from the Enter: every capture and dialog probe inside it, a late answer dropped.
|
|
10317
10994
|
const steerProofDeadline = performance.now() + NATIVE_QUEUE_PASTE_VERIFY_MS + POST_ENTER_PROOF_WINDOW_MS;
|
|
10318
10995
|
// Kiro's legacy TUI can swallow Enter while it is still processing a large
|
|
@@ -10333,7 +11010,7 @@ export class Daemon extends EventEmitter {
|
|
|
10333
11010
|
if (!rawPaste && !steerComposerProof && this.backend?.requiresDeliveryEnterRetry?.() === true) {
|
|
10334
11011
|
await new Promise(r => setTimeout(r, 1_000));
|
|
10335
11012
|
const retryAt = Date.now();
|
|
10336
|
-
if (await this.sendDeliveryEnter("queue-less-defensive-retry")) {
|
|
11013
|
+
if (await this.sendDeliveryEnter("queue-less-defensive-retry", nativeOwner)) {
|
|
10337
11014
|
enterAt = retryAt;
|
|
10338
11015
|
enterRetry = true;
|
|
10339
11016
|
this.logger.debug("Sent defensive Enter retry (queue-less TUI can swallow the first)");
|
|
@@ -10471,7 +11148,7 @@ export class Daemon extends EventEmitter {
|
|
|
10471
11148
|
// again. The prompt is back now, so an Enter can land.
|
|
10472
11149
|
this.logger.warn("Message still in the input row after idle — submitting the existing text instead of pasting it again");
|
|
10473
11150
|
const strandedAt = Date.now();
|
|
10474
|
-
if (!(await this.sendDeliveryEnter("native-queue-stranded-submit"))) {
|
|
11151
|
+
if (!(await this.sendDeliveryEnter("native-queue-stranded-submit", nativeOwner))) {
|
|
10475
11152
|
return this.failDelivery(verdict, status, "native-queue-submit", "tmux-send-keys-failed");
|
|
10476
11153
|
}
|
|
10477
11154
|
// The recovery Enter can be accepted before Codex paints its new
|
|
@@ -10524,7 +11201,7 @@ export class Daemon extends EventEmitter {
|
|
|
10524
11201
|
}
|
|
10525
11202
|
await new Promise(r => setTimeout(r, NORMAL_ENTER_SETTLE_MS));
|
|
10526
11203
|
const retryAt = Date.now();
|
|
10527
|
-
if (!(await this.sendDeliveryEnter("native-queue-idle-redelivery"))) {
|
|
11204
|
+
if (!(await this.sendDeliveryEnter("native-queue-idle-redelivery", nativeOwner))) {
|
|
10528
11205
|
return this.failDelivery(verdict, status, "native-queue-redelivery", "tmux-send-keys-failed");
|
|
10529
11206
|
}
|
|
10530
11207
|
if (windowId && this.controlClient) {
|
|
@@ -10576,7 +11253,7 @@ export class Daemon extends EventEmitter {
|
|
|
10576
11253
|
this.logger.warn("Message not submitted after Enter — waiting for the prompt, then re-sending Enter once");
|
|
10577
11254
|
const promptBack = await this.waitForPaneReadyForDelivery(windowId, STRANDED_RETRY_READY_WAIT_MS);
|
|
10578
11255
|
const retryAt = Date.now();
|
|
10579
|
-
if (promptBack && !(await this.sendDeliveryEnter("stranded-text-retry"))) {
|
|
11256
|
+
if (promptBack && !(await this.sendDeliveryEnter("stranded-text-retry", nativeOwner))) {
|
|
10580
11257
|
return this.failDelivery(verdict, status, "stranded-text-retry", "tmux-send-keys-failed");
|
|
10581
11258
|
}
|
|
10582
11259
|
submitted = promptBack && await this.confirmSubmittedAfterEnter(windowId, retryAt, formatted);
|
|
@@ -10664,7 +11341,7 @@ export class Daemon extends EventEmitter {
|
|
|
10664
11341
|
}
|
|
10665
11342
|
// No control client to observe output: fall back to the legacy double-Enter.
|
|
10666
11343
|
await new Promise(r => setTimeout(r, 1000));
|
|
10667
|
-
await this.sendDeliveryEnter("unobserved-defensive-retry");
|
|
11344
|
+
await this.sendDeliveryEnter("unobserved-defensive-retry", nativeOwner);
|
|
10668
11345
|
if (status)
|
|
10669
11346
|
this.emit("message_confirmed", status); // ✅ (best-effort)
|
|
10670
11347
|
}
|
|
@@ -10884,14 +11561,22 @@ export class Daemon extends EventEmitter {
|
|
|
10884
11561
|
* and the caller's own fence — so a look that lands after any of them is never used (#1380 review).
|
|
10885
11562
|
*/
|
|
10886
11563
|
transcriptProofFor(checkpoint, needle, spawnAtWrite, stillCurrent, onProof) {
|
|
11564
|
+
if (this.nativePaneLifecycle && !checkpoint.runtime)
|
|
11565
|
+
throw Error("Native proof cannot read a coordinator-local transcript path");
|
|
10887
11566
|
const launchAtWrite = this.launchFenceEpoch;
|
|
10888
11567
|
return {
|
|
10889
|
-
reader: new TranscriptDeltaReader(checkpoint.path, checkpoint.offset, checkpoint.backend, needle),
|
|
11568
|
+
reader: checkpoint.runtime ? this.nativeTranscriptReader(checkpoint.runtime, needle) : new TranscriptDeltaReader(checkpoint.path, checkpoint.offset, checkpoint.backend, needle),
|
|
10890
11569
|
current: () => !this.deliveryWritesStopping && this.spawnGeneration === spawnAtWrite
|
|
10891
|
-
&& this.launchFenceEpoch === launchAtWrite && (stillCurrent?.() ?? true)
|
|
11570
|
+
&& this.launchFenceEpoch === launchAtWrite && (stillCurrent?.() ?? true)
|
|
11571
|
+
&& (!checkpoint.runtime || this.nativePaneLifecycle?.current(checkpoint.runtime) === true),
|
|
10892
11572
|
onProof,
|
|
10893
11573
|
};
|
|
10894
11574
|
}
|
|
11575
|
+
nativeTranscriptReader(reference, needle) {
|
|
11576
|
+
if (!this.nativePaneLifecycle || !this.nativePaneLifecycle.current(reference))
|
|
11577
|
+
throw Error("Native delivery transcript owner is unavailable");
|
|
11578
|
+
return this.nativePaneLifecycle.proofReader(reference, needle);
|
|
11579
|
+
}
|
|
10895
11580
|
/** The CLI this daemon drives, for log lines shared by every backend ("claude-code", "codex", …). */
|
|
10896
11581
|
cliLabel() {
|
|
10897
11582
|
return this.config.backend ?? this.backend?.binaryName ?? "CLI";
|
|
@@ -11031,12 +11716,18 @@ export class Daemon extends EventEmitter {
|
|
|
11031
11716
|
async capturePaneEvidence(signature) {
|
|
11032
11717
|
if (!this.tmux)
|
|
11033
11718
|
return null;
|
|
11719
|
+
const owner = this.tmux, window = owner.getWindowId?.(), spawn = this.spawnGeneration, fence = this.launchFenceEpoch, launch = this.launchAttempt;
|
|
11034
11720
|
// Bounded re-probe: a capture that fails here costs the delivery its only
|
|
11035
11721
|
// "before" picture, and a momentary failure should not decide anything.
|
|
11036
11722
|
for (let attempt = 1; attempt <= BASELINE_CAPTURE_ATTEMPTS; attempt++) {
|
|
11037
11723
|
try {
|
|
11038
11724
|
const pane = await this.tmux.capturePane();
|
|
11039
11725
|
const evidence = this.paneEvidence(pane, signature);
|
|
11726
|
+
if (owner === this.tmux && window === owner.getWindowId?.() && spawn === this.spawnGeneration && fence === this.launchFenceEpoch && launch === this.launchAttempt) {
|
|
11727
|
+
const counts = this.paneQuotaPatterns().map(ep => ({ key: Daemon.errorPatternKey(ep), count: Daemon.countOccurrences(ep.pattern, pane) }));
|
|
11728
|
+
if (counts.length)
|
|
11729
|
+
evidence.quotaHistory = { spawn, fence, attempt: launch, tmux: owner, window, counts, marker: signature.value, occurrences: evidence.payload };
|
|
11730
|
+
}
|
|
11040
11731
|
const input = this.inputRegion(pane);
|
|
11041
11732
|
if (input && agendMessageInInput(input.text)) {
|
|
11042
11733
|
// Whatever we paste now lands after it, and one Enter submits both as
|
|
@@ -11135,7 +11826,14 @@ export class Daemon extends EventEmitter {
|
|
|
11135
11826
|
* (the retries included). Without a guard it is exactly the old unconditional path.
|
|
11136
11827
|
*/
|
|
11137
11828
|
async submitSystemPaste(text, label, guard, admission) {
|
|
11138
|
-
|
|
11829
|
+
// Alpha (S-36, Prism #2989 P2): a NATIVE pane's system paste keeps the pane owner from before its first await
|
|
11830
|
+
// (#2958's fence, reverted on main for tmux panes) — a pane replaced while the paste awaits never takes its Enter.
|
|
11831
|
+
const native = !!this.nativePaneLifecycle;
|
|
11832
|
+
const ownerTmux = this.tmux, ownerGeneration = this.spawnGeneration, ownerFence = this.launchFenceEpoch;
|
|
11833
|
+
const ownerWindow = native ? ownerTmux?.getWindowId() : undefined;
|
|
11834
|
+
const owner = () => !native || (!!ownerTmux && !!ownerWindow && this.tmux === ownerTmux && ownerTmux.getWindowId() === ownerWindow
|
|
11835
|
+
&& this.spawnGeneration === ownerGeneration && this.launchFenceEpoch === ownerFence && !this.deliveryWritesStopping);
|
|
11836
|
+
const current = guard || admission || native ? () => { admission?.(); return owner() && (guard?.current() ?? true); } : undefined;
|
|
11139
11837
|
if (current && !current())
|
|
11140
11838
|
return false;
|
|
11141
11839
|
if (!this.tmux)
|
|
@@ -11153,6 +11851,10 @@ export class Daemon extends EventEmitter {
|
|
|
11153
11851
|
if (!current() || !guard.accept(pane))
|
|
11154
11852
|
return false;
|
|
11155
11853
|
baseline = this.paneEvidence(pane, signature);
|
|
11854
|
+
if (native && this.backend?.binaryName === "codex") {
|
|
11855
|
+
const counts = this.paneQuotaPatterns().map(ep => ({ key: Daemon.errorPatternKey(ep), count: Daemon.countOccurrences(ep.pattern, pane) }));
|
|
11856
|
+
baseline.quotaHistory = { spawn: ownerGeneration, fence: ownerFence, attempt: this.launchAttempt, tmux: ownerTmux, window: ownerWindow, counts, marker: signature.value, occurrences: baseline.payload };
|
|
11857
|
+
}
|
|
11156
11858
|
}
|
|
11157
11859
|
else {
|
|
11158
11860
|
baseline = await this.capturePaneEvidence(signature);
|
|
@@ -11171,6 +11873,7 @@ export class Daemon extends EventEmitter {
|
|
|
11171
11873
|
await new Promise(r => setTimeout(r, NORMAL_ENTER_SETTLE_MS));
|
|
11172
11874
|
if (!(await this.sendDeliveryEnter(label, current)))
|
|
11173
11875
|
return false;
|
|
11876
|
+
this.commitPreInputQuotaHistory(baseline);
|
|
11174
11877
|
let proof = await this.confirmSubmitted(signature, baseline);
|
|
11175
11878
|
if (current && !current())
|
|
11176
11879
|
return false;
|
|
@@ -11255,15 +11958,15 @@ export class Daemon extends EventEmitter {
|
|
|
11255
11958
|
&& sameInteractionOwner(recoveryOwner, this.interactionOwner());
|
|
11256
11959
|
const previousWindowId = this.tmux?.getWindowId();
|
|
11257
11960
|
try {
|
|
11258
|
-
const windows = await
|
|
11961
|
+
const windows = await this.paneHost.listWindows(this.tmuxSessionName, this.controlClient);
|
|
11259
11962
|
if (!recoveryCurrent() || this.tmux !== previousTmux)
|
|
11260
11963
|
return undefined;
|
|
11261
11964
|
const match = windows.find(w => w.name === this.name);
|
|
11262
11965
|
if (!match)
|
|
11263
11966
|
return undefined;
|
|
11264
|
-
this.tmux =
|
|
11967
|
+
this.tmux = this.paneHost.bind(this.tmuxSessionName, match.id, resolveTmuxLogicalSize(this.config.terminal), this.controlClient);
|
|
11265
11968
|
const recoveredTmux = this.tmux;
|
|
11266
|
-
|
|
11969
|
+
this.writeWindowId(match.id);
|
|
11267
11970
|
// The window we were talking to is gone; leaving it registered means the
|
|
11268
11971
|
// control client re-resolves a dead id — one bounded read — on every
|
|
11269
11972
|
// reconnect, for the life of the fleet process.
|
|
@@ -11324,6 +12027,8 @@ export class Daemon extends EventEmitter {
|
|
|
11324
12027
|
return false;
|
|
11325
12028
|
}
|
|
11326
12029
|
getWindowId() {
|
|
12030
|
+
if (this.nativePaneLifecycle)
|
|
12031
|
+
return this.nativePaneLifecycle.current() ? this.tmux?.getWindowId() : undefined;
|
|
11327
12032
|
try {
|
|
11328
12033
|
return readFileSync(join(this.instanceDir, "window-id"), "utf-8").trim() || undefined;
|
|
11329
12034
|
}
|
|
@@ -11355,7 +12060,55 @@ export class Daemon extends EventEmitter {
|
|
|
11355
12060
|
* Handle a tool call from the MCP server (forwarded by Claude).
|
|
11356
12061
|
* Routes to the channel adapter via MessageBus.
|
|
11357
12062
|
*/
|
|
11358
|
-
|
|
12063
|
+
/** Internal native-MCP admission. The pane/machine/launch owner supplies a current, dynamically checked tool lease. */
|
|
12064
|
+
handlePaneToolCall(input, lease) {
|
|
12065
|
+
const refusal = nativePaneToolRefusal(input.tool, input.args);
|
|
12066
|
+
if (refusal)
|
|
12067
|
+
return Promise.resolve({ result: null, error: refusal });
|
|
12068
|
+
if (!lease.current() || !lease.allowed(input.tool, input.args) || this.deliveryWritesStopping)
|
|
12069
|
+
return Promise.resolve({ result: null, error: "Pane tool permission is no longer current" });
|
|
12070
|
+
const fence = this.launchFenceEpoch;
|
|
12071
|
+
const current = () => lease.current() && lease.allowed(input.tool, input.args) && !this.deliveryWritesStopping && fence === this.launchFenceEpoch;
|
|
12072
|
+
return new Promise(resolve => {
|
|
12073
|
+
let settled = false;
|
|
12074
|
+
const finish = (value) => { if (settled)
|
|
12075
|
+
return; settled = true; clearTimeout(timer); resolve(value); };
|
|
12076
|
+
const timer = setTimeout(() => finish({ result: null, error: "Pane tool result is unconfirmed; inspect its operation before retrying" }), daemonBudgetMs(input.tool) + 1000);
|
|
12077
|
+
timer.unref?.();
|
|
12078
|
+
try {
|
|
12079
|
+
this.handleToolCall({ ...input, requestId: ++this.fleetRequestSeq }, undefined, {
|
|
12080
|
+
current,
|
|
12081
|
+
dispatch: (tool, args, respond) => {
|
|
12082
|
+
if (!current()) {
|
|
12083
|
+
respond(null, "Pane tool permission was revoked before dispatch");
|
|
12084
|
+
return true;
|
|
12085
|
+
}
|
|
12086
|
+
const dispatched = lease.dispatch?.(tool, args);
|
|
12087
|
+
if (!dispatched)
|
|
12088
|
+
return false;
|
|
12089
|
+
void dispatched.then(result => respond(result), () => respond(null, "Pane tool operation was refused"));
|
|
12090
|
+
return true;
|
|
12091
|
+
},
|
|
12092
|
+
// Resolving the relay is not proof that its HTTP response reached the provider. No response-written receipt yet.
|
|
12093
|
+
send: value => {
|
|
12094
|
+
finish({ result: value.result, ...(typeof value.error === "string" ? { error: value.error } : {}),
|
|
12095
|
+
...(typeof value.errorCode === "string" || typeof value.errorCode === "number" ? { errorCode: value.errorCode } : {}) });
|
|
12096
|
+
return false;
|
|
12097
|
+
},
|
|
12098
|
+
});
|
|
12099
|
+
}
|
|
12100
|
+
catch {
|
|
12101
|
+
finish({ result: null, error: "Pane tool operation failed" });
|
|
12102
|
+
}
|
|
12103
|
+
});
|
|
12104
|
+
}
|
|
12105
|
+
/** Only the authority lease with a verified helper stdout ACK calls this internal barrier. */
|
|
12106
|
+
paneToolResponseWritten(operationId, current) {
|
|
12107
|
+
if (!current() || this.deliveryWritesStopping || !/^[a-f0-9-]{36}$/i.test(operationId))
|
|
12108
|
+
return;
|
|
12109
|
+
this.emit("mcp_tool_response_written", { operationId, daemonBootId: this.bootId });
|
|
12110
|
+
}
|
|
12111
|
+
handleToolCall(msg, socket, peer) {
|
|
11359
12112
|
const tool = msg.tool;
|
|
11360
12113
|
const args = (msg.args ?? {});
|
|
11361
12114
|
const requestId = msg.requestId;
|
|
@@ -11363,20 +12116,20 @@ export class Daemon extends EventEmitter {
|
|
|
11363
12116
|
this.logger.debug({ tool, requestId }, "Tool call from MCP server");
|
|
11364
12117
|
// A tool call can only come from a live MCP server of ours — proof of life
|
|
11365
12118
|
// that outranks whatever the pid slot says.
|
|
11366
|
-
if (this.socketSessionNames.get(socket) === this.name) {
|
|
11367
|
-
this.noteMcpProofOfLife("tool_call", this.socketPids.get(socket));
|
|
12119
|
+
if (peer?.current() || socket && this.socketSessionNames.get(socket) === this.name) {
|
|
12120
|
+
this.noteMcpProofOfLife("tool_call", socket ? this.socketPids.get(socket) : undefined);
|
|
11368
12121
|
}
|
|
11369
12122
|
// A tool invocation is not delivery evidence. Capture which obligation it
|
|
11370
12123
|
// belongs to now, then settle it only after the adapter/fleet responds.
|
|
11371
12124
|
// Explicitly mapped sibling sessions must not satisfy this instance's turn;
|
|
11372
12125
|
// an unmapped socket is retained for legacy/tests where mcp_ready was not
|
|
11373
12126
|
// observed before the first tool call.
|
|
11374
|
-
const sourceSession = this.socketSessionNames.get(socket);
|
|
12127
|
+
const sourceSession = peer ? this.name : socket ? this.socketSessionNames.get(socket) : undefined;
|
|
11375
12128
|
const replyAttempt = TURN_OUTBOUND_TOOLS.has(tool) && (!sourceSession || sourceSession === this.name)
|
|
11376
12129
|
? this.turnReplyGuard.beginToolAttempt(tool === "reply", TURN_COMPLETION_TOOLS.has(tool))
|
|
11377
12130
|
: null;
|
|
11378
12131
|
// For now, log and respond. Full adapter routing will be wired in fleet manager.
|
|
11379
|
-
const respond = (result, error) => {
|
|
12132
|
+
const respond = (result, error, errorCode) => {
|
|
11380
12133
|
// A message that verifiably went out stands down the dead-MCP proxy reply
|
|
11381
12134
|
// for this turn: the agent proved it can still speak for itself.
|
|
11382
12135
|
if (!error && result != null && TURN_OUTBOUND_TOOLS.has(tool)) {
|
|
@@ -11417,14 +12170,21 @@ export class Daemon extends EventEmitter {
|
|
|
11417
12170
|
// failed" and report unknown immediately rather than starting recovery.
|
|
11418
12171
|
this.turnReplyGuard.settleToolAttempt(replyAttempt, false);
|
|
11419
12172
|
}
|
|
11420
|
-
const
|
|
12173
|
+
const packet = { requestId, result, error, operationId, ...(errorCode !== undefined ? { errorCode } : {}) };
|
|
12174
|
+
const sent = peer ? peer.current() && peer.send(packet) : socket ? this.ipcServer?.send(socket, packet) ?? false : false;
|
|
11421
12175
|
if (!sent) {
|
|
11422
|
-
|
|
12176
|
+
if (peer)
|
|
12177
|
+
this.logger.debug({ tool, requestId }, "Native MCP result awaits transport-written confirmation");
|
|
12178
|
+
else
|
|
12179
|
+
this.logger.warn({ tool, requestId }, "Tool result could not be returned — originating MCP socket is closed");
|
|
11423
12180
|
}
|
|
11424
12181
|
else if (operationId) {
|
|
11425
12182
|
this.emit("mcp_tool_response_written", { operationId, daemonBootId: this.bootId });
|
|
11426
12183
|
}
|
|
11427
12184
|
};
|
|
12185
|
+
// Native Fleet/task operations carry their lease to the existing dispatcher mutation admission points.
|
|
12186
|
+
if (peer?.dispatch?.(tool, args, respond))
|
|
12187
|
+
return;
|
|
11428
12188
|
// Repo checkout — handled locally in daemon (no fleet-manager)
|
|
11429
12189
|
if (tool === "checkout_repo") {
|
|
11430
12190
|
this.handleCheckoutRepo(args, respond);
|
|
@@ -11453,7 +12213,7 @@ export class Daemon extends EventEmitter {
|
|
|
11453
12213
|
clearTimeout(timeout);
|
|
11454
12214
|
respond(respMsg.result, respMsg.error);
|
|
11455
12215
|
});
|
|
11456
|
-
this.
|
|
12216
|
+
this.broadcastFleetMessage({
|
|
11457
12217
|
type,
|
|
11458
12218
|
payload: args,
|
|
11459
12219
|
meta: { instance_name: this.name },
|
|
@@ -11479,7 +12239,7 @@ export class Daemon extends EventEmitter {
|
|
|
11479
12239
|
clearTimeout(timeout);
|
|
11480
12240
|
resolve({ result: respMsg.result, error: respMsg.error });
|
|
11481
12241
|
});
|
|
11482
|
-
this.
|
|
12242
|
+
this.broadcastFleetMessage({ type: WEB_THEME_IPC[tool], payload, meta: { instance_name: this.name }, fleetRequestId: fleetReqId });
|
|
11483
12243
|
});
|
|
11484
12244
|
void (async () => {
|
|
11485
12245
|
if (tool === "preview_web_appearance") {
|
|
@@ -11556,7 +12316,7 @@ export class Daemon extends EventEmitter {
|
|
|
11556
12316
|
clearTimeout(timeout);
|
|
11557
12317
|
respond(respMsg.result, respMsg.error);
|
|
11558
12318
|
});
|
|
11559
|
-
this.
|
|
12319
|
+
this.broadcastFleetMessage({
|
|
11560
12320
|
type: "fleet_task",
|
|
11561
12321
|
payload: args,
|
|
11562
12322
|
meta: { instance_name: this.name },
|
|
@@ -11579,7 +12339,7 @@ export class Daemon extends EventEmitter {
|
|
|
11579
12339
|
clearTimeout(timeout);
|
|
11580
12340
|
respond(respMsg.result, respMsg.error);
|
|
11581
12341
|
});
|
|
11582
|
-
this.
|
|
12342
|
+
this.broadcastFleetMessage({
|
|
11583
12343
|
type: typeMap[tool],
|
|
11584
12344
|
payload: args,
|
|
11585
12345
|
meta: { instance_name: this.name, working_directory: this.config.working_directory },
|
|
@@ -11606,7 +12366,7 @@ export class Daemon extends EventEmitter {
|
|
|
11606
12366
|
clearTimeout(timeout);
|
|
11607
12367
|
respond(respMsg.result, respMsg.error);
|
|
11608
12368
|
});
|
|
11609
|
-
this.
|
|
12369
|
+
this.broadcastFleetMessage({
|
|
11610
12370
|
type: typeMap[tool],
|
|
11611
12371
|
payload: args,
|
|
11612
12372
|
meta: {
|
|
@@ -11621,11 +12381,11 @@ export class Daemon extends EventEmitter {
|
|
|
11621
12381
|
}
|
|
11622
12382
|
if (CROSS_INSTANCE_TOOLS.has(tool)) {
|
|
11623
12383
|
// Route to fleet manager via IPC (topic mode only)
|
|
11624
|
-
if (this.topicMode && this.
|
|
12384
|
+
if (this.topicMode && this.fleetTransportAvailable()) {
|
|
11625
12385
|
// Use fleetRequestId (not requestId) to avoid MCP server resolving the
|
|
11626
12386
|
// pending tool call prematurely when it receives the broadcast.
|
|
11627
12387
|
const fleetReqId = `xmsg_${++this.fleetRequestSeq}_${requestId}`;
|
|
11628
|
-
const senderSessionName =
|
|
12388
|
+
const senderSessionName = sourceSession;
|
|
11629
12389
|
// Shared table, so delete_instance and the deployment tools get the same
|
|
11630
12390
|
// budget here as the MCP client expects (the ad-hoc list omitted them).
|
|
11631
12391
|
const crossTimeoutMs = daemonBudgetMs(tool);
|
|
@@ -11637,7 +12397,7 @@ export class Daemon extends EventEmitter {
|
|
|
11637
12397
|
clearTimeout(timeout);
|
|
11638
12398
|
respond(respMsg.result, respMsg.error);
|
|
11639
12399
|
});
|
|
11640
|
-
this.
|
|
12400
|
+
this.broadcastFleetMessage({
|
|
11641
12401
|
type: "fleet_outbound",
|
|
11642
12402
|
tool,
|
|
11643
12403
|
args,
|
|
@@ -11691,12 +12451,12 @@ export class Daemon extends EventEmitter {
|
|
|
11691
12451
|
}, daemonBudgetMs(tool));
|
|
11692
12452
|
this.pendingIpcRequests.set(outboundKey, (respMsg) => {
|
|
11693
12453
|
clearTimeout(timeout);
|
|
11694
|
-
respond(respMsg.result, respMsg.error);
|
|
12454
|
+
respond(respMsg.result, respMsg.error, respMsg.errorCode);
|
|
11695
12455
|
});
|
|
11696
12456
|
// Register the waiter before broadcasting. A fast/mock adapter can settle
|
|
11697
12457
|
// immediately; broadcasting first left a response-before-registration
|
|
11698
12458
|
// window that degraded into a timeout despite a completed POST.
|
|
11699
|
-
this.
|
|
12459
|
+
this.broadcastFleetMessage({
|
|
11700
12460
|
type: "fleet_outbound",
|
|
11701
12461
|
tool,
|
|
11702
12462
|
args,
|
|
@@ -11786,9 +12546,10 @@ export class Daemon extends EventEmitter {
|
|
|
11786
12546
|
// Comma-separated parts (`file:role.md, file:rules.md`) only when a part is a file ref; otherwise one inline prompt.
|
|
11787
12547
|
const resolvedCustomPrompt = this.config.systemPrompt ? assembleSystemPrompt(this.config.systemPrompt, promptFiles) : undefined;
|
|
11788
12548
|
let decisions;
|
|
11789
|
-
|
|
12549
|
+
const source = this.decisionSource;
|
|
12550
|
+
if (source || process.env.AGEND_DECISIONS) {
|
|
11790
12551
|
try {
|
|
11791
|
-
const all = JSON.parse(process.env.AGEND_DECISIONS);
|
|
12552
|
+
const all = source ? source() : JSON.parse(process.env.AGEND_DECISIONS);
|
|
11792
12553
|
const workDir = this.config.working_directory;
|
|
11793
12554
|
// `scope: "fleet"` used to bypass the project check entirely, so a
|
|
11794
12555
|
// single-project worker inherited every other project's playbook (8 of
|
|
@@ -11797,7 +12558,12 @@ export class Daemon extends EventEmitter {
|
|
|
11797
12558
|
// same project, or the same project family (worktrees/checkouts of one
|
|
11798
12559
|
// repo). A general is exempt: it dispatches across all projects, so
|
|
11799
12560
|
// cross-project routing rules are exactly what it needs.
|
|
11800
|
-
|
|
12561
|
+
let teams = [];
|
|
12562
|
+
try {
|
|
12563
|
+
teams = this.decisionTeams?.() ?? [];
|
|
12564
|
+
}
|
|
12565
|
+
catch { /* no team list: fleet and project decisions only */ }
|
|
12566
|
+
decisions = capActiveDecisions(selectRelevantDecisions([...all], workDir, this.config.general_topic === true, teams));
|
|
11801
12567
|
// Stable ordering so identical decision sets always build byte-identical
|
|
11802
12568
|
// instructions — otherwise source ordering jitter flips the warmup hash.
|
|
11803
12569
|
decisions.sort((a, b) => a.title.localeCompare(b.title));
|
|
@@ -11827,7 +12593,7 @@ export class Daemon extends EventEmitter {
|
|
|
11827
12593
|
// The daemon used to read `general_topic` alone while `isGeneralInstance`
|
|
11828
12594
|
// also accepted the name, so an instance called `general` without the flag
|
|
11829
12595
|
// was a worker here and a general everywhere else.
|
|
11830
|
-
const isGeneral = this.config.general_topic === true || this.name
|
|
12596
|
+
const isGeneral = this.config.general_topic === true || generalByName(this.name, this.config);
|
|
11831
12597
|
// No third argument for an ordinary instance: the default is `worker` now,
|
|
11832
12598
|
// and naming it here would be a second place to change it.
|
|
11833
12599
|
const toolSet = isGeneral
|
|
@@ -11917,6 +12683,7 @@ export class Daemon extends EventEmitter {
|
|
|
11917
12683
|
effort: this.config.effort,
|
|
11918
12684
|
kiroUi: this.config.kiro_ui,
|
|
11919
12685
|
skipResume: this.skipResume,
|
|
12686
|
+
...(this.cliRepairSessionId ? { resumeSessionId: this.cliRepairSessionId } : {}),
|
|
11920
12687
|
instructions,
|
|
11921
12688
|
agentMode: isCliMode ? "cli" : "mcp",
|
|
11922
12689
|
agentPort: isCliMode ? agentPort : undefined,
|
|
@@ -11989,6 +12756,9 @@ export class Daemon extends EventEmitter {
|
|
|
11989
12756
|
}
|
|
11990
12757
|
this.cancelCapacityNudge("the instance was stopped, paused or respawned");
|
|
11991
12758
|
this.lastErrorEpisode = null;
|
|
12759
|
+
this.quotaReplay = null;
|
|
12760
|
+
this.nativeQuotaReplayTaken = false;
|
|
12761
|
+
this.quotaInput = null;
|
|
11992
12762
|
this.nudgeBaselines = null;
|
|
11993
12763
|
// A relaunch settles any outstanding quit watch: the CLI came back.
|
|
11994
12764
|
this.clearQuitRelaunchWatch();
|
|
@@ -12203,6 +12973,8 @@ export class Daemon extends EventEmitter {
|
|
|
12203
12973
|
catch { /* best effort */ }
|
|
12204
12974
|
}
|
|
12205
12975
|
async spawnClaudeWindow() {
|
|
12976
|
+
if (this.nativePaneLifecycle)
|
|
12977
|
+
throw Error("Native panes never enter local resume/fresh fallback");
|
|
12206
12978
|
this.assertSessionOomAdmission();
|
|
12207
12979
|
this.beginSpawn();
|
|
12208
12980
|
let resumedSuccessfully = false;
|
|
@@ -12779,6 +13551,71 @@ export class Daemon extends EventEmitter {
|
|
|
12779
13551
|
* retries. Idempotent, and fast: no graceful CLI quit, the CLI never reached
|
|
12780
13552
|
* its prompt.
|
|
12781
13553
|
*/
|
|
13554
|
+
/**
|
|
13555
|
+
* #3313 review r2: after a failed start (abortStartup), whether this start's CLI is positively gone — no window was ever
|
|
13556
|
+
* asked for, or its window (by id, or by name while its creation was pending) is positively absent after another kill.
|
|
13557
|
+
* False when that cannot be told (tmux could not list). The failed start's OWN cleanup: called once, by that start,
|
|
13558
|
+
* while the window is still its own. When it cannot tell, the window and its pane process are remembered for
|
|
13559
|
+
* `startupIncarnationEnded()`.
|
|
13560
|
+
*/
|
|
13561
|
+
async startupCliEnded() {
|
|
13562
|
+
if (this.nativePaneLifecycle)
|
|
13563
|
+
return true;
|
|
13564
|
+
if (!this.tmux)
|
|
13565
|
+
return true;
|
|
13566
|
+
const windowId = this.tmux.getWindowId();
|
|
13567
|
+
let pid = null;
|
|
13568
|
+
if (windowId?.trim()) {
|
|
13569
|
+
try {
|
|
13570
|
+
pid = await this.paneHost.getPanePid(this.tmuxSessionName, windowId);
|
|
13571
|
+
}
|
|
13572
|
+
catch {
|
|
13573
|
+
pid = null;
|
|
13574
|
+
}
|
|
13575
|
+
}
|
|
13576
|
+
let gone = false;
|
|
13577
|
+
try {
|
|
13578
|
+
gone = await this.tmux.killWindowConfirmed();
|
|
13579
|
+
}
|
|
13580
|
+
catch {
|
|
13581
|
+
gone = false;
|
|
13582
|
+
}
|
|
13583
|
+
if (!gone)
|
|
13584
|
+
this.failedStartupIncarnation = windowId?.trim() ? { windowId, pid } : { windowId: null, pid: null };
|
|
13585
|
+
return gone;
|
|
13586
|
+
}
|
|
13587
|
+
failedStartupIncarnation = null;
|
|
13588
|
+
/**
|
|
13589
|
+
* #3313 review r3: the later re-checks of a failed start whose end was not proven — READ-ONLY (never kills: a retry of
|
|
13590
|
+
* 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
|
|
13591
|
+
* different pane process (it was respawned: the one this start left has been replaced). False when it cannot be told.
|
|
13592
|
+
*/
|
|
13593
|
+
async startupIncarnationEnded() {
|
|
13594
|
+
const inc = this.failedStartupIncarnation;
|
|
13595
|
+
if (!inc)
|
|
13596
|
+
return true;
|
|
13597
|
+
if (!inc.windowId)
|
|
13598
|
+
return false; // its window was never learned: nothing proves it gone
|
|
13599
|
+
let windows;
|
|
13600
|
+
try {
|
|
13601
|
+
windows = await TmuxManager.listWindowsStrict(this.tmuxSessionName);
|
|
13602
|
+
}
|
|
13603
|
+
catch {
|
|
13604
|
+
return false;
|
|
13605
|
+
}
|
|
13606
|
+
if (!windows.some(w => w.id === inc.windowId))
|
|
13607
|
+
return true;
|
|
13608
|
+
if (inc.pid === null)
|
|
13609
|
+
return false;
|
|
13610
|
+
let now;
|
|
13611
|
+
try {
|
|
13612
|
+
now = await this.paneHost.getPanePid(this.tmuxSessionName, inc.windowId);
|
|
13613
|
+
}
|
|
13614
|
+
catch {
|
|
13615
|
+
return false;
|
|
13616
|
+
}
|
|
13617
|
+
return now !== null && now !== inc.pid;
|
|
13618
|
+
}
|
|
12782
13619
|
async abortStartup() {
|
|
12783
13620
|
if (this.startupAborted)
|
|
12784
13621
|
return;
|
|
@@ -12789,6 +13626,14 @@ export class Daemon extends EventEmitter {
|
|
|
12789
13626
|
await this.museUsageRelay.stop().catch(() => { });
|
|
12790
13627
|
this.museUsageRelay = null;
|
|
12791
13628
|
}
|
|
13629
|
+
if (this.nativePaneLifecycle) {
|
|
13630
|
+
await this.nativePaneLifecycle.release("detach");
|
|
13631
|
+
try {
|
|
13632
|
+
unlinkSync(join(this.instanceDir, "daemon.pid"));
|
|
13633
|
+
}
|
|
13634
|
+
catch { /* metadata only */ }
|
|
13635
|
+
return;
|
|
13636
|
+
}
|
|
12792
13637
|
try {
|
|
12793
13638
|
await this.killProcessTree("SIGTERM", "startup aborted");
|
|
12794
13639
|
}
|
|
@@ -12818,13 +13663,15 @@ export class Daemon extends EventEmitter {
|
|
|
12818
13663
|
}
|
|
12819
13664
|
/** Kill the entire process tree of the current tmux pane (CLI + MCP server). */
|
|
12820
13665
|
async killProcessTree(signal = "SIGTERM", reason = "unspecified") {
|
|
13666
|
+
if (this.nativePaneLifecycle)
|
|
13667
|
+
throw Error("Native processes can only be closed through their owned runtime pane");
|
|
12821
13668
|
const windowId = this.tmux?.getWindowId();
|
|
12822
13669
|
// Before createWindow succeeds there is no pane owned by this daemon.
|
|
12823
13670
|
// tmux interprets an empty selector as the session's active window.
|
|
12824
13671
|
if (!windowId?.trim())
|
|
12825
13672
|
return;
|
|
12826
13673
|
try {
|
|
12827
|
-
const pid = await
|
|
13674
|
+
const pid = await this.paneHost.getPanePid(this.tmuxSessionName, windowId);
|
|
12828
13675
|
if (pid) {
|
|
12829
13676
|
this.noteStopRequest(signal, reason);
|
|
12830
13677
|
process.kill(-pid, signal);
|
|
@@ -12839,14 +13686,14 @@ export class Daemon extends EventEmitter {
|
|
|
12839
13686
|
* Handles confirmation dialogs (trust folder, bypass permissions).
|
|
12840
13687
|
* Returns true if CLI is ready, false if it failed or got stuck.
|
|
12841
13688
|
*/
|
|
12842
|
-
async trySpawn(reuseWindow = false, startupTimeoutMs) {
|
|
13689
|
+
async trySpawn(reuseWindow = false, startupTimeoutMs, repairAdmission) {
|
|
12843
13690
|
const recoveryOwner = this.collateralOomRecovery ? this.interactionOwner() : null;
|
|
12844
13691
|
const enter = () => {
|
|
12845
13692
|
if (recoveryOwner && (!sameInteractionOwner(recoveryOwner, this.interactionOwner())
|
|
12846
13693
|
|| this.startupAborted || this.deliveryWritesStopping || this.runtimeMonitorsFrozen || this.healthCheckPaused)) {
|
|
12847
13694
|
throw new Error("OOM recovery cancelled: the instance was stopped, paused or replaced while memory was unavailable");
|
|
12848
13695
|
}
|
|
12849
|
-
return this.trySpawnInsideGate(reuseWindow, startupTimeoutMs).catch(err => {
|
|
13696
|
+
return this.trySpawnInsideGate(reuseWindow, startupTimeoutMs, repairAdmission).catch(err => {
|
|
12850
13697
|
// Includes an in-place binary replacement during asynchronous launch preparation.
|
|
12851
13698
|
if (err instanceof KiroCompatibilityError)
|
|
12852
13699
|
this.emit("kiro_compatibility_hold", err.message);
|
|
@@ -12871,6 +13718,122 @@ export class Daemon extends EventEmitter {
|
|
|
12871
13718
|
this.startupAdmission?.();
|
|
12872
13719
|
return ready;
|
|
12873
13720
|
}
|
|
13721
|
+
/** Resolve the installed launcher; never run Claude to discover its version. */
|
|
13722
|
+
async resolveClaudeInstallPath() {
|
|
13723
|
+
const { binaryProbe } = await import("./binary-probe.js");
|
|
13724
|
+
const { resolveBackendBinary } = await import("./backend-availability.js");
|
|
13725
|
+
binaryProbe.invalidate("claude");
|
|
13726
|
+
return await resolveBackendBinary("claude-code") ?? null;
|
|
13727
|
+
}
|
|
13728
|
+
async installedClaudeVersion(path) {
|
|
13729
|
+
const { staticBackendVersion } = await import("./backend-availability.js");
|
|
13730
|
+
return staticBackendVersion("claude-code", path);
|
|
13731
|
+
}
|
|
13732
|
+
/** #3441: only the CLI's own refusal can request this one, non-renewable repair. */
|
|
13733
|
+
handleClaudeModelMinimum(minimum) {
|
|
13734
|
+
if (this.modelMinimumRepairUsed || this.modelMinimumBlocked || this.spawning || this.healthCheckPaused
|
|
13735
|
+
|| this.pauseWakeState !== "active" || this.backend?.binaryName !== "claude"
|
|
13736
|
+
|| !this.backend.refreshLaunchBinary)
|
|
13737
|
+
return Promise.resolve();
|
|
13738
|
+
if (this.modelMinimumFlight)
|
|
13739
|
+
return this.modelMinimumFlight;
|
|
13740
|
+
const flight = this.repairClaudeModelMinimum(minimum).finally(() => {
|
|
13741
|
+
if (this.modelMinimumFlight === flight)
|
|
13742
|
+
this.modelMinimumFlight = null;
|
|
13743
|
+
});
|
|
13744
|
+
this.modelMinimumFlight = flight;
|
|
13745
|
+
return flight;
|
|
13746
|
+
}
|
|
13747
|
+
async repairClaudeModelMinimum(minimum) {
|
|
13748
|
+
const tmux = this.tmux, backend = this.backend, window = tmux?.getWindowId();
|
|
13749
|
+
let spawn = this.spawnGeneration, claimed = false;
|
|
13750
|
+
const fence = this.launchFenceEpoch, attempt = this.launchAttempt, phase = this.pauseWakeState;
|
|
13751
|
+
const baseCurrent = () => this.tmux === tmux && this.backend === backend && tmux?.getWindowId() === window
|
|
13752
|
+
&& this.spawnGeneration === spawn && this.launchFenceEpoch === fence && this.pauseWakeState === phase
|
|
13753
|
+
&& !this.startupAborted && !this.deliveryWritesStopping && !this.runtimeMonitorsFrozen && !this.healthCheckPaused;
|
|
13754
|
+
const current = () => baseCurrent() && this.launchAttempt === attempt;
|
|
13755
|
+
const failed = () => new Error(t("inst.cli_repair_failed"));
|
|
13756
|
+
try {
|
|
13757
|
+
// Read the newly resolved install, not a cached old prefix or the running image.
|
|
13758
|
+
const path = await this.resolveClaudeInstallPath();
|
|
13759
|
+
if (!current())
|
|
13760
|
+
return;
|
|
13761
|
+
const version = path ? await this.installedClaudeVersion(path) : null;
|
|
13762
|
+
if (!current())
|
|
13763
|
+
return;
|
|
13764
|
+
if (!version || cliVersionBelow(version, minimum.required)) {
|
|
13765
|
+
if (!this.modelMinimumUpdateNotified) {
|
|
13766
|
+
this.modelMinimumUpdateNotified = true;
|
|
13767
|
+
this.logger.warn({ required: minimum.required, installed: version }, "Claude Code needs an update for this model");
|
|
13768
|
+
this.emit("backend_launch_warning", { name: this.name, message: t("inst.cli_update_needed", minimum.required) });
|
|
13769
|
+
}
|
|
13770
|
+
return;
|
|
13771
|
+
}
|
|
13772
|
+
await this.paneWriteLock.run(async () => {
|
|
13773
|
+
if (!current())
|
|
13774
|
+
return;
|
|
13775
|
+
if (!await this.isPaneAuthoritativelyIdle())
|
|
13776
|
+
throw failed();
|
|
13777
|
+
if (!current())
|
|
13778
|
+
return;
|
|
13779
|
+
// Claim before yielding the write lock; queued delivery remains held until readiness settles.
|
|
13780
|
+
this.modelMinimumRepairUsed = true;
|
|
13781
|
+
this.beginSpawn();
|
|
13782
|
+
claimed = true;
|
|
13783
|
+
spawn = this.spawnGeneration;
|
|
13784
|
+
});
|
|
13785
|
+
if (!claimed || !current())
|
|
13786
|
+
return;
|
|
13787
|
+
await this.checkpointSessionId();
|
|
13788
|
+
if (!current())
|
|
13789
|
+
return;
|
|
13790
|
+
let session;
|
|
13791
|
+
if (!this.skipResume) {
|
|
13792
|
+
try {
|
|
13793
|
+
const value = readFileSync(join(this.instanceDir, "session-id"), "utf8").trim();
|
|
13794
|
+
if (/^[a-f0-9]{8}-(?:[a-f0-9]{4}-){3}[a-f0-9]{12}$/i.test(value))
|
|
13795
|
+
session = value;
|
|
13796
|
+
}
|
|
13797
|
+
catch { /* Unknown is not permission to select another conversation. */ }
|
|
13798
|
+
}
|
|
13799
|
+
if (!session)
|
|
13800
|
+
throw failed();
|
|
13801
|
+
// Recheck disk evidence after checkpointing; an update may have changed it while we waited.
|
|
13802
|
+
const finalVersion = await this.installedClaudeVersion(path);
|
|
13803
|
+
if (!current())
|
|
13804
|
+
return;
|
|
13805
|
+
if (!finalVersion || cliVersionBelow(finalVersion, minimum.required))
|
|
13806
|
+
throw failed();
|
|
13807
|
+
if (!await this.isPaneAuthoritativelyIdle())
|
|
13808
|
+
throw failed();
|
|
13809
|
+
if (!current())
|
|
13810
|
+
return;
|
|
13811
|
+
this.logger.warn({ running: minimum.running, required: minimum.required, installed: finalVersion }, "Claude model-version refusal — attempting one same-session restart");
|
|
13812
|
+
backend.refreshLaunchBinary(path);
|
|
13813
|
+
this.cliRepairSessionId = session;
|
|
13814
|
+
const ready = await this.trySpawn(true, this.startupBudgetFor(true), next => baseCurrent() && this.launchAttempt === next && next >= attempt && next <= attempt + 1);
|
|
13815
|
+
this.cliRepairSessionId = undefined;
|
|
13816
|
+
if (!baseCurrent() || this.launchAttempt !== attempt + 1)
|
|
13817
|
+
return;
|
|
13818
|
+
if (!ready)
|
|
13819
|
+
throw failed();
|
|
13820
|
+
this.logger.info("Claude model-version restart completed; session retained");
|
|
13821
|
+
this.emit("backend_launch_warning", { name: this.name, message: t("inst.cli_repaired") });
|
|
13822
|
+
}
|
|
13823
|
+
catch (error) {
|
|
13824
|
+
if (!baseCurrent() || this.launchAttempt > attempt + 1)
|
|
13825
|
+
return;
|
|
13826
|
+
this.modelMinimumBlocked = true;
|
|
13827
|
+
this.healthCheckPaused = true;
|
|
13828
|
+
this.logger.error({ reason: error instanceof Error ? error.message : String(error) }, "Claude model-version repair held; no automatic retry");
|
|
13829
|
+
this.emit("backend_launch_warning", { name: this.name, message: t("inst.cli_repair_failed") });
|
|
13830
|
+
}
|
|
13831
|
+
finally {
|
|
13832
|
+
this.cliRepairSessionId = undefined;
|
|
13833
|
+
if (claimed)
|
|
13834
|
+
this.endSpawn();
|
|
13835
|
+
}
|
|
13836
|
+
}
|
|
12874
13837
|
/**
|
|
12875
13838
|
* One fresh pane capture judged as ready && !busy && !dialog. Transcript
|
|
12876
13839
|
* silence is deliberately NOT the gate: its monitor is inert for muse, so a
|
|
@@ -13043,7 +14006,7 @@ export class Daemon extends EventEmitter {
|
|
|
13043
14006
|
whatsNewRoles() {
|
|
13044
14007
|
if (this.runtimeIdentity?.kind === "classic")
|
|
13045
14008
|
return ["classic"];
|
|
13046
|
-
if (this.config.general_topic === true || this.name
|
|
14009
|
+
if (this.config.general_topic === true || generalByName(this.name, this.config))
|
|
13047
14010
|
return ["general"];
|
|
13048
14011
|
const set = resolveToolSet(this.config, this.name);
|
|
13049
14012
|
return set === "coordinator" || set === "full" ? ["worker", "coordinator"] : ["worker"];
|
|
@@ -13069,9 +14032,14 @@ export class Daemon extends EventEmitter {
|
|
|
13069
14032
|
this.logger.debug({ err }, "what's-new not prepared");
|
|
13070
14033
|
}
|
|
13071
14034
|
}
|
|
13072
|
-
async trySpawnInsideGate(reuseWindow = false, startupTimeoutMs) {
|
|
14035
|
+
async trySpawnInsideGate(reuseWindow = false, startupTimeoutMs, repairAdmission) {
|
|
14036
|
+
if (this.nativePaneLifecycle)
|
|
14037
|
+
throw Error("Native relaunch requires its owned exit and a new lifecycle reservation");
|
|
14038
|
+
let expectedAttempt = this.launchAttempt;
|
|
14039
|
+
const admit = () => { this.startupAdmission?.(); if (repairAdmission && !repairAdmission(expectedAttempt))
|
|
14040
|
+
throw new Error("CLI repair superseded by another launch, pause or stop"); };
|
|
13073
14041
|
this.assertSessionOomAdmission();
|
|
13074
|
-
|
|
14042
|
+
admit();
|
|
13075
14043
|
const launchFence = this.launchFenceEpoch;
|
|
13076
14044
|
const backendConfig = this.buildBackendConfig();
|
|
13077
14045
|
// A compatibility refusal is not a failed resume: no configuration, pin, history or pane may change.
|
|
@@ -13097,7 +14065,7 @@ export class Daemon extends EventEmitter {
|
|
|
13097
14065
|
catch { /* unknown capability → the backend's conservative form */ }
|
|
13098
14066
|
// Thrown, not `false`: a false verdict reads as "the CLI failed to start" and sends the startup path
|
|
13099
14067
|
// into its resume-retry / set-the-session-aside handling, for an instance somebody just stopped.
|
|
13100
|
-
|
|
14068
|
+
admit();
|
|
13101
14069
|
this.assertSessionOomAdmission();
|
|
13102
14070
|
if (launchFence !== this.launchFenceEpoch)
|
|
13103
14071
|
throw new Error("Launch cancelled: the instance was stopped or paused while the launch was being prepared");
|
|
@@ -13156,11 +14124,14 @@ export class Daemon extends EventEmitter {
|
|
|
13156
14124
|
// The CLI's own shell sets a zero coredump_filter first (#1113): this pane
|
|
13157
14125
|
// may belong to a tmux server the fleet did not start, which would hand
|
|
13158
14126
|
// the CLI its own (full) filter instead of the fleet's.
|
|
13159
|
-
|
|
14127
|
+
admit();
|
|
13160
14128
|
const cmd = coredumpFilterLaunchPrefix() + `${envPrefix} ` + this.backend.buildCommand(launchConfig);
|
|
13161
14129
|
// Every launched command re-arms the passive-transient check, including a
|
|
13162
14130
|
// retry inside the same spawn: its load is a new one.
|
|
13163
|
-
this.launchAttempt
|
|
14131
|
+
expectedAttempt = ++this.launchAttempt;
|
|
14132
|
+
admit();
|
|
14133
|
+
await this.prepareQuotaReplayHistory(reuseWindow);
|
|
14134
|
+
admit();
|
|
13164
14135
|
this.interactionObservation.reset(this.interactionOwner());
|
|
13165
14136
|
this.clearInteractionConfirmation();
|
|
13166
14137
|
// A launch that cannot paint a passive transient (Codex: a fresh start
|
|
@@ -13180,16 +14151,16 @@ export class Daemon extends EventEmitter {
|
|
|
13180
14151
|
this.emit("backend_launch_warning", { name: this.name, message: note, quiet: true });
|
|
13181
14152
|
}
|
|
13182
14153
|
// Ensure tmux session exists (may have been destroyed if all windows died)
|
|
13183
|
-
await
|
|
13184
|
-
if (this.stormWindow?.observeServerAlive(await
|
|
14154
|
+
await this.paneHost.ensureSession(this.tmuxSessionName);
|
|
14155
|
+
if (this.stormWindow?.observeServerAlive(await this.paneHost.getServerPid(this.tmuxSessionName))) {
|
|
13185
14156
|
this.emit("tmux_server_crash", this.name);
|
|
13186
14157
|
}
|
|
13187
|
-
|
|
14158
|
+
admit();
|
|
13188
14159
|
let windowId;
|
|
13189
14160
|
this.assertSessionOomAdmission();
|
|
13190
14161
|
if (reuseWindow) {
|
|
13191
14162
|
this.controlClient?.unregisterWindow(this.tmux.getWindowId());
|
|
13192
|
-
await this.tmux.respawnWindow(cmd, resolvedCwd);
|
|
14163
|
+
await this.tmux.respawnWindow(cmd, resolvedCwd, repairAdmission ? admit : undefined);
|
|
13193
14164
|
windowId = this.tmux.getWindowId();
|
|
13194
14165
|
}
|
|
13195
14166
|
else {
|
|
@@ -13200,8 +14171,8 @@ export class Daemon extends EventEmitter {
|
|
|
13200
14171
|
if (retired && retired !== windowId)
|
|
13201
14172
|
this.controlClient?.unregisterWindow(retired);
|
|
13202
14173
|
}
|
|
13203
|
-
|
|
13204
|
-
|
|
14174
|
+
admit();
|
|
14175
|
+
this.writeWindowId(windowId);
|
|
13205
14176
|
// Enable remain-on-exit to capture exit codes on crash
|
|
13206
14177
|
await this.tmux.setRemainOnExit().catch(err => {
|
|
13207
14178
|
this.logger.warn({ err }, "Failed to set remain-on-exit — exit codes will not be captured");
|
|
@@ -13235,6 +14206,7 @@ export class Daemon extends EventEmitter {
|
|
|
13235
14206
|
else {
|
|
13236
14207
|
await new Promise(r => setTimeout(r, 10_000));
|
|
13237
14208
|
}
|
|
14209
|
+
admit();
|
|
13238
14210
|
// Dismiss confirmation dialogs and verify CLI reached prompt.
|
|
13239
14211
|
// With remain-on-exit, isWindowAlive() returns true even for dead panes,
|
|
13240
14212
|
// but a startup crash would already be caught by waitForOutput/waitForIdle above.
|
|
@@ -13317,6 +14289,7 @@ export class Daemon extends EventEmitter {
|
|
|
13317
14289
|
let lastDialog = null;
|
|
13318
14290
|
let lastTransient = null;
|
|
13319
14291
|
let captureFailures = 0;
|
|
14292
|
+
let lastPane = null;
|
|
13320
14293
|
let attempts = 0;
|
|
13321
14294
|
// A safety-critical startup choice is one-shot. If the CLI has not
|
|
13322
14295
|
// repainted after Enter, let the following hold-only entry report it
|
|
@@ -13340,11 +14313,13 @@ export class Daemon extends EventEmitter {
|
|
|
13340
14313
|
try {
|
|
13341
14314
|
pane = await this.tmux.capturePane();
|
|
13342
14315
|
this.startupAdmission?.();
|
|
14316
|
+
lastPane = pane;
|
|
13343
14317
|
}
|
|
13344
14318
|
catch (err) {
|
|
13345
14319
|
this.startupAdmission?.();
|
|
13346
14320
|
// Transient tmux trouble is not evidence about the CLI. Returning false
|
|
13347
14321
|
// here would clear the session; retry within the budget instead.
|
|
14322
|
+
lastPane = null;
|
|
13348
14323
|
captureFailures++;
|
|
13349
14324
|
this.logger.debug({ err, captureFailures }, "capture-pane failed during the startup dialog scan — retrying");
|
|
13350
14325
|
// Only a POSITIVE dead pane ends the scan; an unanswerable liveness
|
|
@@ -13455,12 +14430,15 @@ export class Daemon extends EventEmitter {
|
|
|
13455
14430
|
// each have seen a respawn, pause or stop.
|
|
13456
14431
|
if (!owned())
|
|
13457
14432
|
return false;
|
|
14433
|
+
const keyScreen = this.nativePaneLifecycle ? await this.tmux.capturePane() : answeredPane;
|
|
14434
|
+
if (!owned() || !Daemon.dialogMatches(dialog, keyScreen))
|
|
14435
|
+
return false;
|
|
13458
14436
|
if (key === "Up" || key === "Down" || key === "Enter" || key === "Escape") {
|
|
13459
|
-
if (!await this.tmux.sendSpecialKey(key))
|
|
14437
|
+
if (!await (this.nativePaneLifecycle ? this.tmux.sendSpecialKey(key, undefined, { kind: "dialog", screen: keyScreen }) : this.tmux.sendSpecialKey(key)))
|
|
13460
14438
|
return false;
|
|
13461
14439
|
}
|
|
13462
14440
|
else {
|
|
13463
|
-
if (!await this.tmux.sendKeys(key))
|
|
14441
|
+
if (!await (this.nativePaneLifecycle ? this.tmux.sendKeys(key, { kind: "dialog", screen: keyScreen }) : this.tmux.sendKeys(key)))
|
|
13464
14442
|
return false;
|
|
13465
14443
|
}
|
|
13466
14444
|
await new Promise(r => setTimeout(r, 200));
|
|
@@ -13474,7 +14452,8 @@ export class Daemon extends EventEmitter {
|
|
|
13474
14452
|
// Wait for next screen to render — bounded by what is left of the budget.
|
|
13475
14453
|
const renderWait = Math.max(0, Math.min(10_000, remaining()));
|
|
13476
14454
|
if (this.controlClient) {
|
|
13477
|
-
const wid =
|
|
14455
|
+
const wid = this.nativePaneLifecycle ? ownerTmux.getWindowId()
|
|
14456
|
+
: readFileSync(join(this.instanceDir, "window-id"), "utf-8").trim();
|
|
13478
14457
|
await this.controlClient.waitForIdle(wid, renderWait);
|
|
13479
14458
|
}
|
|
13480
14459
|
else {
|
|
@@ -13510,13 +14489,17 @@ export class Daemon extends EventEmitter {
|
|
|
13510
14489
|
// scan parked on the old limit text.
|
|
13511
14490
|
const codexReady = this.backend.binaryName !== "codex"
|
|
13512
14491
|
|| this.isCodexLivePaneSnapshot(pane);
|
|
13513
|
-
|
|
14492
|
+
const nativeComposerReady = !this.nativePaneLifecycle || (this.backend?.readInputRow
|
|
14493
|
+
? this.backend.readInputRow(pane) !== null : this.backend?.isDeliveryInputReadyPane?.(pane) === true);
|
|
14494
|
+
if (readyPatternMatches && codexReady && nativeComposerReady) {
|
|
13514
14495
|
cleanReadyPolls++;
|
|
13515
14496
|
if (cleanReadyPolls >= 2 || remaining() <= 0) {
|
|
13516
14497
|
// A real ready prompt (with no fatal dialog on screen — those are
|
|
13517
14498
|
// matched above, before this check) means the fatal screen is gone,
|
|
13518
14499
|
// e.g. the user fixed the config and the instance respawned.
|
|
13519
14500
|
this.fatalStartupBlocked = false;
|
|
14501
|
+
if (owned())
|
|
14502
|
+
this.takeQuotaReplayBaseline(pane);
|
|
13520
14503
|
return true;
|
|
13521
14504
|
}
|
|
13522
14505
|
await sleep();
|
|
@@ -13555,6 +14538,8 @@ export class Daemon extends EventEmitter {
|
|
|
13555
14538
|
this.logger.warn({ attempts, budgetMs, captureFailures }, "Startup scan exhausted without a ready prompt or a known dialog — assuming ready (unknown CLI screen)");
|
|
13556
14539
|
}
|
|
13557
14540
|
this.startupAdmission?.();
|
|
14541
|
+
if (owned() && lastPane !== null && !lastDialog && !lastTransient)
|
|
14542
|
+
this.takeQuotaReplayBaseline(lastPane);
|
|
13558
14543
|
return true;
|
|
13559
14544
|
}
|
|
13560
14545
|
/**
|
|
@@ -13602,6 +14587,11 @@ export class Daemon extends EventEmitter {
|
|
|
13602
14587
|
* lookup is the backend's own single-flight one: an idle observation already running it is joined,
|
|
13603
14588
|
* not repeated. Never rejects.
|
|
13604
14589
|
*/
|
|
14590
|
+
/** The window-id file and its socket tag: a window-id without it is 2.3's (tmux-legacy.ts). */
|
|
14591
|
+
writeWindowId(windowId) {
|
|
14592
|
+
writeFileSync(join(this.instanceDir, "window-id"), windowId);
|
|
14593
|
+
tagWindowId(this.instanceDir, tmuxSocket(), windowId);
|
|
14594
|
+
}
|
|
13605
14595
|
checkpointSessionId() {
|
|
13606
14596
|
const refresh = this.backend?.refreshSessionId;
|
|
13607
14597
|
if (this.skipResume || !refresh) {
|
|
@@ -13635,6 +14625,16 @@ export class Daemon extends EventEmitter {
|
|
|
13635
14625
|
void refresh.call(this.backend).then(() => this.saveSessionId(), () => { });
|
|
13636
14626
|
}
|
|
13637
14627
|
saveSessionId() {
|
|
14628
|
+
if (this.nativePaneLifecycle) {
|
|
14629
|
+
try {
|
|
14630
|
+
this.nativePaneLifecycle.checkpointSession();
|
|
14631
|
+
this.ownedWorkingSession = this.backend?.getSessionId() ?? null;
|
|
14632
|
+
}
|
|
14633
|
+
catch (err) {
|
|
14634
|
+
this.logger.warn({ err }, "Native conversation checkpoint is unconfirmed");
|
|
14635
|
+
}
|
|
14636
|
+
return;
|
|
14637
|
+
}
|
|
13638
14638
|
// When a resume failure has forced a fresh start, don't persist the stale id
|
|
13639
14639
|
// back from statusline.json — that would re-arm --continue and re-loop.
|
|
13640
14640
|
if (this.skipResume)
|