@songsid/agend 2.3.5-alpha.10 → 2.3.5-alpha.12
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/dist/accounts-view.d.ts +17 -0
- package/dist/accounts-view.js +24 -8
- package/dist/accounts-view.js.map +1 -1
- package/dist/agent-cli-instructions.md +2 -2
- package/dist/auth-api.d.ts +48 -16
- package/dist/auth-api.js +83 -32
- package/dist/auth-api.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/backend/claude-code.d.ts +2 -0
- package/dist/backend/claude-code.js +32 -6
- 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.d.ts +5 -3
- package/dist/backend/codex.js +31 -13
- package/dist/backend/codex.js.map +1 -1
- package/dist/backend/credential-profile.d.ts +18 -0
- package/dist/backend/credential-profile.js +46 -0
- package/dist/backend/credential-profile.js.map +1 -1
- package/dist/backend/kiro.js +1 -1
- package/dist/backend/kiro.js.map +1 -1
- package/dist/backend/muse.d.ts +3 -1
- package/dist/backend/muse.js +31 -1
- package/dist/backend/muse.js.map +1 -1
- package/dist/backend/types.d.ts +17 -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/build-provenance.json +1 -1
- package/dist/bundled-tmux-guard.d.ts +4 -0
- package/dist/bundled-tmux-guard.js +7 -0
- package/dist/bundled-tmux-guard.js.map +1 -1
- package/dist/claude-auth-status.d.ts +20 -8
- package/dist/claude-auth-status.js +38 -22
- package/dist/claude-auth-status.js.map +1 -1
- 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 +36 -5
- package/dist/cli-capability.js +2 -2
- package/dist/cli-capability.js.map +1 -1
- package/dist/cli-caps-module.d.ts +5 -1
- package/dist/cli-caps-module.js +4 -2
- package/dist/cli-caps-module.js.map +1 -1
- package/dist/cli-registry-check.js +16 -2
- package/dist/cli-registry-check.js.map +1 -1
- package/dist/cli-registry.d.ts +56 -4
- package/dist/cli-registry.js +1 -1
- package/dist/cli-registry.js.map +1 -1
- package/dist/cli-spec-antigravity.d.ts +12 -1
- package/dist/cli-spec-antigravity.js +13 -1
- package/dist/cli-spec-antigravity.js.map +1 -1
- package/dist/cli-spec-claude-code.d.ts +9 -0
- package/dist/cli-spec-claude-code.js +4 -2
- package/dist/cli-spec-claude-code.js.map +1 -1
- package/dist/cli-spec-codex.d.ts +10 -1
- package/dist/cli-spec-codex.js +5 -3
- package/dist/cli-spec-codex.js.map +1 -1
- package/dist/cli-spec-grok.d.ts +5 -0
- package/dist/cli-spec-grok.js +6 -1
- package/dist/cli-spec-grok.js.map +1 -1
- package/dist/cli-spec-kiro-cli.d.ts +7 -1
- package/dist/cli-spec-kiro-cli.js +7 -3
- package/dist/cli-spec-kiro-cli.js.map +1 -1
- package/dist/cli-spec-muse.d.ts +2 -0
- package/dist/cli-spec-muse.js +3 -1
- package/dist/cli-spec-muse.js.map +1 -1
- package/dist/cli-spec-opencode.d.ts +11 -1
- package/dist/cli-spec-opencode.js +7 -2
- package/dist/cli-spec-opencode.js.map +1 -1
- package/dist/cli.js +28 -1
- package/dist/cli.js.map +1 -1
- package/dist/create-host-account.d.ts +17 -0
- package/dist/create-host-account.js +47 -0
- package/dist/create-host-account.js.map +1 -0
- package/dist/daemon.d.ts +26 -0
- package/dist/daemon.js +131 -10
- package/dist/daemon.js.map +1 -1
- package/dist/delivery-outbox.js +7 -0
- package/dist/delivery-outbox.js.map +1 -1
- package/dist/fleet-context.d.ts +5 -1
- package/dist/fleet-manager.d.ts +363 -71
- package/dist/fleet-manager.js +1374 -367
- 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/general-knowledge/skills/concepts/SKILL.md +21 -14
- package/dist/general-knowledge/skills/credential-profiles/SKILL.md +9 -8
- package/dist/general-knowledge/skills/cross-instance-messaging/SKILL.md +9 -1
- package/dist/general-knowledge/skills/kiro-engine-migration/SKILL.md +1 -1
- package/dist/general-knowledge/skills/web-dashboard/SKILL.md +27 -20
- package/dist/instance-lifecycle.js +33 -3
- package/dist/instance-lifecycle.js.map +1 -1
- package/dist/instructions.js +29 -6
- package/dist/instructions.js.map +1 -1
- package/dist/locale.js +125 -81
- package/dist/locale.js.map +1 -1
- package/dist/login-manager.d.ts +2 -2
- package/dist/login-manager.js +3 -2
- package/dist/login-manager.js.map +1 -1
- package/dist/native-model-catalog.d.ts +20 -0
- package/dist/native-model-catalog.js +107 -2
- package/dist/native-model-catalog.js.map +1 -1
- package/dist/public-web-gateway.js +1 -1
- package/dist/public-web-gateway.js.map +1 -1
- package/dist/public-web-link.d.ts +5 -0
- package/dist/public-web-link.js +8 -0
- package/dist/public-web-link.js.map +1 -1
- package/dist/runtime-api.d.ts +1 -1
- package/dist/runtime-api.js +104 -12
- package/dist/runtime-api.js.map +1 -1
- 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.js +5 -5
- package/dist/runtime-build-info.js.map +1 -1
- 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 +148 -8
- package/dist/runtime-cli-install.js +253 -59
- package/dist/runtime-cli-install.js.map +1 -1
- package/dist/runtime-cli.d.ts +8 -1
- package/dist/runtime-cli.js +206 -44
- package/dist/runtime-cli.js.map +1 -1
- package/dist/runtime-client-store.d.ts +11 -0
- package/dist/runtime-client-store.js +20 -5
- package/dist/runtime-client-store.js.map +1 -1
- package/dist/runtime-client.d.ts +23 -1
- package/dist/runtime-client.js +92 -6
- package/dist/runtime-client.js.map +1 -1
- package/dist/runtime-connection.d.ts +1 -1
- package/dist/runtime-connection.js +1 -1
- package/dist/runtime-connection.js.map +1 -1
- package/dist/runtime-coordinator.d.ts +95 -1
- package/dist/runtime-coordinator.js +344 -10
- package/dist/runtime-coordinator.js.map +1 -1
- 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-pane-native.js +4 -4
- package/dist/runtime-pane-native.js.map +1 -1
- package/dist/runtime-protocol.d.ts +78 -1
- package/dist/runtime-protocol.js +95 -5
- package/dist/runtime-protocol.js.map +1 -1
- package/dist/runtime-remote-accounts.d.ts +12 -0
- package/dist/runtime-remote-accounts.js +56 -5
- package/dist/runtime-remote-accounts.js.map +1 -1
- package/dist/runtime-remote-setup.d.ts +4 -1
- package/dist/runtime-remote-setup.js +4 -1
- package/dist/runtime-remote-setup.js.map +1 -1
- package/dist/runtime-update-controller.d.ts +11 -0
- package/dist/runtime-update-controller.js +56 -4
- package/dist/runtime-update-controller.js.map +1 -1
- package/dist/settings-api.d.ts +13 -1
- package/dist/settings-api.js +44 -20
- package/dist/settings-api.js.map +1 -1
- package/dist/settings-change.d.ts +5 -13
- package/dist/settings-change.js.map +1 -1
- package/dist/settings-confirmation.d.ts +11 -13
- package/dist/settings-confirmation.js +2 -6
- package/dist/settings-confirmation.js.map +1 -1
- package/dist/settings-effect.d.ts +5 -0
- package/dist/settings-effect.js +76 -10
- package/dist/settings-effect.js.map +1 -1
- package/dist/settings-http-confirmation.d.ts +8 -1
- package/dist/settings-http-confirmation.js +39 -13
- package/dist/settings-http-confirmation.js.map +1 -1
- package/dist/settings-request-capability.d.ts +7 -0
- package/dist/settings-request-capability.js +3 -1
- package/dist/settings-request-capability.js.map +1 -1
- package/dist/setup-i18n.js +4 -4
- package/dist/setup-i18n.js.map +1 -1
- package/dist/signin-keepalive.d.ts +25 -1
- package/dist/signin-keepalive.js +44 -1
- package/dist/signin-keepalive.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/tmux-manager.d.ts +2 -2
- package/dist/tmux-manager.js +5 -3
- package/dist/tmux-manager.js.map +1 -1
- package/dist/ui/account-identity.js +7 -5
- package/dist/ui/accounts-keepalive.js +17 -17
- package/dist/ui/accounts-manage.js +34 -34
- package/dist/ui/accounts-view.js +68 -24
- package/dist/ui/agent-runtime-settings.js +1 -1
- package/dist/ui/backend-signin.js +67 -67
- package/dist/ui/chat-msg-actions.js +50 -4
- package/dist/ui/chat-quote.js +256 -0
- package/dist/ui/chat-store.js +9 -4
- package/dist/ui/cli-caps.js +7 -7
- package/dist/ui/credential-profile-select.js +4 -4
- package/dist/ui/general-location.js +1 -1
- package/dist/ui/host-install.js +290 -0
- package/dist/ui/hub-company-join-strings.js +3 -0
- package/dist/ui/hub-company-join.js +20 -2
- package/dist/ui/hub-owner-strings.js +5 -4
- package/dist/ui/hub-pairing-progress-strings.js +1 -1
- package/dist/ui/hub-quick-strings.js +4 -4
- package/dist/ui/hub-strings.js +6 -6
- package/dist/ui/machine-signin.js +4 -4
- package/dist/ui/model-picker.js +68 -0
- package/dist/ui/panel-chat.js +74 -13
- package/dist/ui/panel-fleet.js +8 -2
- package/dist/ui/panel-hub.js +8 -4
- package/dist/ui/panel-needs.js +2 -2
- package/dist/ui/panel-runtimes.js +232 -33
- package/dist/ui/panel-settings.js +7 -1
- package/dist/ui/panel-windows-cli.js +1 -1
- package/dist/ui/runtime-cli-install.js +99 -20
- package/dist/ui/runtime-commands.d.ts +2 -0
- package/dist/ui/runtime-commands.js +34 -1
- package/dist/ui/runtime-update-status.js +2 -2
- package/dist/ui/search-dialog.js +1 -0
- package/dist/ui/settings-access-overview.js +167 -0
- package/dist/ui/settings-access-strings.js +1 -1
- package/dist/ui/settings-catalog.js +19 -3
- package/dist/ui/settings-confirm.js +2 -2
- package/dist/ui/settings-devices.js +59 -25
- package/dist/ui/settings-dialogs.js +12 -13
- package/dist/ui/settings-guests.js +1 -1
- package/dist/ui/settings-hub-company-join.js +10 -7
- package/dist/ui/settings-hub-connection.js +121 -0
- package/dist/ui/settings-hub-membership.js +1 -1
- package/dist/ui/settings-hub-run.js +5 -6
- package/dist/ui/settings-hub-section.js +3 -6
- package/dist/ui/settings-hub.js +12 -7
- package/dist/ui/settings-layout.js +9 -7
- package/dist/ui/settings-outside.js +87 -19
- package/dist/ui/settings-registry.js +2 -1
- package/dist/ui/settings-revoke-strings.js +28 -0
- package/dist/ui/settings-strings.js +25 -25
- package/dist/ui/settings-web-authority.js +11 -4
- package/dist/ui/shared/accounts.css +11 -1
- package/dist/ui/shared/agend-auth.js +8 -1
- package/dist/ui/shared/app-i18n.js +10 -12
- package/dist/ui/shared/app-session.js +13 -16
- package/dist/ui/shared/app-shell.js +37 -37
- package/dist/ui/shared/app-store.js +2 -0
- package/dist/ui/shared/app.css +85 -14
- package/dist/ui/shared/chat-render.js +17 -5
- package/dist/ui/shared/chat-strings.js +4 -4
- package/dist/ui/shared/device-roles.js +27 -0
- package/dist/ui/shared/host-install.css +10 -0
- package/dist/ui/shared/hub-owner.css +6 -0
- package/dist/ui/shared/model-picker.css +21 -0
- package/dist/ui/shared/runtime-install.css +26 -1
- package/dist/ui/shared/setup-host-text.js +4 -4
- package/dist/ui/shared/signin.js +171 -64
- package/dist/ui/shared/subagent-row.css +15 -0
- package/dist/ui/shared/usage-dialog.js +28 -16
- package/dist/ui/shared/view-strings.js +7 -7
- package/dist/ui/shared/web-authorize.js +54 -4
- package/dist/ui/signin.html +19 -8
- package/dist/ui/structured-signin.js +30 -30
- package/dist/ui/subagent-row.js +72 -0
- package/dist/ui/web-terminal/terminal.js +9 -9
- package/dist/update-launch.js +4 -1
- package/dist/update-launch.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/format-rich.js +1 -1
- package/dist/usage/format-rich.js.map +1 -1
- package/dist/usage/providers.js +2 -2
- package/dist/usage/providers.js.map +1 -1
- package/dist/usage/usage-api.d.ts +8 -2
- package/dist/usage/usage-api.js +12 -5
- package/dist/usage/usage-api.js.map +1 -1
- package/dist/web-api.d.ts +38 -4
- package/dist/web-api.js +370 -18
- package/dist/web-api.js.map +1 -1
- package/dist/web-auth.js +1 -1
- package/dist/web-auth.js.map +1 -1
- package/dist/web-backend-login.d.ts +2 -0
- 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-commands.d.ts +9 -1
- package/dist/web-commands.js +7 -1
- package/dist/web-commands.js.map +1 -1
- 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-remote-access.d.ts +194 -11
- package/dist/web-remote-access.js +458 -34
- package/dist/web-remote-access.js.map +1 -1
- package/dist/web-session.d.ts +11 -3
- package/dist/web-session.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-update.js +3 -1
- package/dist/web-update.js.map +1 -1
- package/dist/windows-cli-api.js +2 -1
- package/dist/windows-cli-api.js.map +1 -1
- package/dist/windows-cli-worker.d.ts +14 -0
- package/dist/windows-cli-worker.js +145 -1
- package/dist/windows-cli-worker.js.map +1 -1
- package/dist/windows-cli.d.ts +4 -0
- package/dist/windows-cli.js +9 -1
- package/dist/windows-cli.js.map +1 -1
- package/launcher/agend-install.cjs +16 -3
- package/package.json +1 -1
- package/templates/runtime-install/install.ps1 +219 -12
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export type CreateAccountResult = {
|
|
2
|
+
ok: true;
|
|
3
|
+
backendOptions?: Record<string, Record<string, unknown>>;
|
|
4
|
+
} | {
|
|
5
|
+
ok: false;
|
|
6
|
+
status: number;
|
|
7
|
+
error: string;
|
|
8
|
+
code: string;
|
|
9
|
+
backend?: string;
|
|
10
|
+
profile?: string;
|
|
11
|
+
loginCommand?: string;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* `body` is the create request (already known to be an object); `defaultBackend` is the fleet default CLI, used when the
|
|
15
|
+
* request names none. On success `backendOptions` is what to create the agent with (the request's own, plus the account).
|
|
16
|
+
*/
|
|
17
|
+
export declare function resolveCreateAccount(dataDir: string, body: Record<string, unknown>, defaultBackend: string | undefined): CreateAccountResult;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* New agent on this host (WSL / Linux): the account the dashboard's create form picked, checked before anything is created.
|
|
3
|
+
*
|
|
4
|
+
* The form sends `credentialProfile` (a NAME, like the paired-Windows-computer form). It becomes the new agent's
|
|
5
|
+
* `backend_options.<cli>.credential_profile`, so the agent's first start already runs under that account. A name that cannot
|
|
6
|
+
* be used is refused with a clear reason — never dropped, never replaced by the fleet default. The same rule covers a
|
|
7
|
+
* `backend_options.<cli>.credential_profile` sent directly. Pure but for reading the profile folders and their sign-in state.
|
|
8
|
+
*/
|
|
9
|
+
import { isCredentialProfileName, signedOutCredentialProfile } from "./backend/credential-profile.js";
|
|
10
|
+
import { PROFILE_CLIS, profilesOnDisk } from "./accounts-view.js";
|
|
11
|
+
const fail = (status, code, error, extra = {}) => ({ ok: false, status, code, error, ...extra });
|
|
12
|
+
/**
|
|
13
|
+
* `body` is the create request (already known to be an object); `defaultBackend` is the fleet default CLI, used when the
|
|
14
|
+
* request names none. On success `backendOptions` is what to create the agent with (the request's own, plus the account).
|
|
15
|
+
*/
|
|
16
|
+
export function resolveCreateAccount(dataDir, body, defaultBackend) {
|
|
17
|
+
const backend = typeof body.backend === "string" && body.backend ? body.backend : defaultBackend || "claude-code";
|
|
18
|
+
const options = body.backend_options && typeof body.backend_options === "object" && !Array.isArray(body.backend_options)
|
|
19
|
+
? body.backend_options : undefined;
|
|
20
|
+
const own = options?.[backend]?.credential_profile;
|
|
21
|
+
const sent = body.credentialProfile;
|
|
22
|
+
if (sent !== undefined && typeof sent !== "string")
|
|
23
|
+
return fail(400, "credential_profile_invalid", "credentialProfile must be a string");
|
|
24
|
+
if (own !== undefined && own !== null && typeof own !== "string")
|
|
25
|
+
return fail(400, "credential_profile_invalid", "backend_options credential_profile must be a string");
|
|
26
|
+
const asked = (sent ?? "").trim(), inOptions = typeof own === "string" ? own.trim() : "";
|
|
27
|
+
if (asked && inOptions && asked.toLowerCase() !== inOptions.toLowerCase()) {
|
|
28
|
+
return fail(400, "credential_profile_conflict", "credentialProfile and backend_options credential_profile name different accounts");
|
|
29
|
+
}
|
|
30
|
+
const profile = asked || inOptions;
|
|
31
|
+
// No account chosen: the agent follows the fleet default, as before (an empty value in backend_options already means that).
|
|
32
|
+
if (!profile)
|
|
33
|
+
return { ok: true, ...(options ? { backendOptions: options } : {}) };
|
|
34
|
+
if (!PROFILE_CLIS.has(backend))
|
|
35
|
+
return fail(400, "credential_profile_unsupported", `${backend} does not support named accounts on this host`, { backend, profile });
|
|
36
|
+
if (!isCredentialProfileName(profile))
|
|
37
|
+
return fail(400, "credential_profile_invalid", `Account name ${JSON.stringify(profile)} is not a valid account name`, { backend, profile });
|
|
38
|
+
const known = profilesOnDisk(dataDir, backend).find(name => name === profile);
|
|
39
|
+
if (!known)
|
|
40
|
+
return fail(400, "credential_profile_not_found", `There is no ${backend} account named ${JSON.stringify(profile)} on this host — add it in Settings → Agents → Accounts first`, { backend, profile });
|
|
41
|
+
const login = signedOutCredentialProfile(dataDir, backend, known);
|
|
42
|
+
if (login) {
|
|
43
|
+
return fail(409, "credential_profile_signed_out", `The ${backend} account ${JSON.stringify(known)} is not connected — connect it in Settings → Agents → Accounts first`, { backend, profile: known, loginCommand: login.loginCommand });
|
|
44
|
+
}
|
|
45
|
+
return { ok: true, backendOptions: { ...(options || {}), [backend]: { ...(options?.[backend] || {}), credential_profile: known } } };
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=create-host-account.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-host-account.js","sourceRoot":"","sources":["../src/create-host-account.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAE,uBAAuB,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAC;AACtG,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAMlE,MAAM,IAAI,GAAG,CAAC,MAAc,EAAE,IAAY,EAAE,KAAa,EAAE,KAAK,GAAyD,EAAE,EAAuB,EAAE,CAAC,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,KAAK,EAAE,CAAC,CAAC;AAEpM;;;GAGG;AACH,MAAM,UAAU,oBAAoB,CAAC,OAAe,EAAE,IAA6B,EAAE,cAAkC;IACrH,MAAM,OAAO,GAAG,OAAO,IAAI,CAAC,OAAO,KAAK,QAAQ,IAAI,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,cAAc,IAAI,aAAa,CAAC;IAClH,MAAM,OAAO,GAAG,IAAI,CAAC,eAAe,IAAI,OAAO,IAAI,CAAC,eAAe,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,eAAe,CAAC;QACtH,CAAC,CAAC,IAAI,CAAC,eAA0D,CAAC,CAAC,CAAC,SAAS,CAAC;IAChF,MAAM,GAAG,GAAG,OAAO,EAAE,CAAC,OAAO,CAAC,EAAE,kBAAkB,CAAC;IACnD,MAAM,IAAI,GAAG,IAAI,CAAC,iBAAiB,CAAC;IACpC,IAAI,IAAI,KAAK,SAAS,IAAI,OAAO,IAAI,KAAK,QAAQ;QAAE,OAAO,IAAI,CAAC,GAAG,EAAE,4BAA4B,EAAE,oCAAoC,CAAC,CAAC;IACzI,IAAI,GAAG,KAAK,SAAS,IAAI,GAAG,KAAK,IAAI,IAAI,OAAO,GAAG,KAAK,QAAQ;QAAE,OAAO,IAAI,CAAC,GAAG,EAAE,4BAA4B,EAAE,qDAAqD,CAAC,CAAC;IACxK,MAAM,KAAK,GAAG,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,EAAE,SAAS,GAAG,OAAO,GAAG,KAAK,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IACzF,IAAI,KAAK,IAAI,SAAS,IAAI,KAAK,CAAC,WAAW,EAAE,KAAK,SAAS,CAAC,WAAW,EAAE,EAAE,CAAC;QAC1E,OAAO,IAAI,CAAC,GAAG,EAAE,6BAA6B,EAAE,kFAAkF,CAAC,CAAC;IACtI,CAAC;IACD,MAAM,OAAO,GAAG,KAAK,IAAI,SAAS,CAAC;IACnC,4HAA4H;IAC5H,IAAI,CAAC,OAAO;QAAE,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,cAAc,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC;IACnF,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,OAAO,CAAC;QAAE,OAAO,IAAI,CAAC,GAAG,EAAE,gCAAgC,EAAE,GAAG,OAAO,+CAA+C,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,CAAC;IACpK,IAAI,CAAC,uBAAuB,CAAC,OAAO,CAAC;QAAE,OAAO,IAAI,CAAC,GAAG,EAAE,4BAA4B,EAAE,gBAAgB,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,8BAA8B,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,CAAC;IACnL,MAAM,KAAK,GAAG,cAAc,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,KAAK,OAAO,CAAC,CAAC;IAC9E,IAAI,CAAC,KAAK;QAAE,OAAO,IAAI,CAAC,GAAG,EAAE,8BAA8B,EAAE,eAAe,OAAO,kBAAkB,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,8DAA8D,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,CAAC;IAClN,MAAM,KAAK,GAAG,0BAA0B,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;IAClE,IAAI,KAAK,EAAE,CAAC;QACV,OAAO,IAAI,CAAC,GAAG,EAAE,+BAA+B,EAAE,OAAO,OAAO,YAAY,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,sEAAsE,EACrK,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,YAAY,EAAE,KAAK,CAAC,YAAY,EAAE,CAAC,CAAC;IACnE,CAAC;IACD,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,cAAc,EAAE,EAAE,GAAG,CAAC,OAAO,IAAI,EAAE,CAAC,EAAE,CAAC,OAAO,CAAC,EAAE,EAAE,GAAG,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,EAAE,kBAAkB,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC;AACvI,CAAC"}
|
package/dist/daemon.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { SubagentSource } from "./subagent-service.js";
|
|
1
2
|
import type { RecoveryLive } from "./working-recovery.js";
|
|
2
3
|
import type { PaneContextSource } from "./pane-context-cache.js";
|
|
3
4
|
import type { WorkingStateObservation } from "./working-state-journal.js";
|
|
@@ -467,6 +468,8 @@ export declare class Daemon extends EventEmitter {
|
|
|
467
468
|
private transcriptMonitor;
|
|
468
469
|
/** #1218: the transcript this instance's monitor follows now (the Log tab reads it on demand; nothing runs for it here). */
|
|
469
470
|
logTranscriptPath(): string | null;
|
|
471
|
+
/** Optional read-only child lane: only a current owned tmux launch, never stopped/native/cwd discovery. */
|
|
472
|
+
subagentSource(): SubagentSource | null;
|
|
470
473
|
/** #1218 (kiro): the launch this daemon's backend last built, for the Log's reason only (kiro-log-gate.ts). */
|
|
471
474
|
logLaunch(): KiroLogLaunch | null;
|
|
472
475
|
kiroMigrationIdle(): Promise<boolean>;
|
|
@@ -645,6 +648,8 @@ export declare class Daemon extends EventEmitter {
|
|
|
645
648
|
/** Generation/signature fence for safety dialogs while their screen is still visible. */
|
|
646
649
|
private autoResolvedDialogKey;
|
|
647
650
|
private autoResolvedDialogGeneration;
|
|
651
|
+
/** RuntimeDialog.retrySafe: the sends made to the visible dialog of that key, in this spawn (monotonic time of the last). */
|
|
652
|
+
private retrySafeSends;
|
|
648
653
|
/** Per-launch safety phases survive startup handoff, redraws and failed/uncertain key ACKs. */
|
|
649
654
|
private launchDialogClaims;
|
|
650
655
|
/**
|
|
@@ -815,6 +820,8 @@ export declare class Daemon extends EventEmitter {
|
|
|
815
820
|
private pauseAllowStuck;
|
|
816
821
|
private pauseWakeState;
|
|
817
822
|
private pauseWakeTransition;
|
|
823
|
+
/** Includes a pause's pane admission, before it publishes pausing. */
|
|
824
|
+
private pauseAdmissions;
|
|
818
825
|
private modelOverride;
|
|
819
826
|
private recentUserMessages;
|
|
820
827
|
private recentEvents;
|
|
@@ -1578,6 +1585,11 @@ export declare class Daemon extends EventEmitter {
|
|
|
1578
1585
|
/** Native lifecycle pause uses the ordinary idle/background/admission proof before closing its owned Job. */
|
|
1579
1586
|
nativePauseReady(admission?: CapacityNudgePauseGuard): Promise<boolean>;
|
|
1580
1587
|
pause(reason?: PauseReason, admission?: CapacityNudgePauseGuard): Promise<void>;
|
|
1588
|
+
private pauseInner;
|
|
1589
|
+
/** Whether an admitted pause or published pause/wake still owns this launch. */
|
|
1590
|
+
get hasPendingPauseWake(): boolean;
|
|
1591
|
+
/** Settle pane admission as well as the published pause/wake transition. */
|
|
1592
|
+
waitForPauseWakeTransition(): Promise<void>;
|
|
1581
1593
|
/** Respawn the CLI in the preserved window and block until its prompt is ready. */
|
|
1582
1594
|
wake(timeoutMs?: number): Promise<void>;
|
|
1583
1595
|
/** A reset baseline must settle before a launch admits new work. */
|
|
@@ -1924,6 +1936,20 @@ export declare class Daemon extends EventEmitter {
|
|
|
1924
1936
|
/** Refresh the separate stdin-blocked observation from one pane capture. */
|
|
1925
1937
|
private updateInputBlockedState;
|
|
1926
1938
|
private hasAutoDialogClaim;
|
|
1939
|
+
/**
|
|
1940
|
+
* RuntimeDialog.retrySafe: may the claimed answer to this dialog — still on screen — be sent again now? Only for a
|
|
1941
|
+
* dialog that declares its keys safe to repeat, within its send budget, and once `afterMs` has passed since the last
|
|
1942
|
+
* send to it in this spawn.
|
|
1943
|
+
*/
|
|
1944
|
+
private retrySafeDue;
|
|
1945
|
+
/**
|
|
1946
|
+
* RuntimeDialog.retrySafe: a send to this dialog is on record in this spawn and the next one is not due (its budget
|
|
1947
|
+
* is spent, or `afterMs` has not passed). Holds even when the one-shot claim was released — a failed or uncertain key
|
|
1948
|
+
* ACK releases it — so the budget can never be bypassed (#3589 review).
|
|
1949
|
+
*/
|
|
1950
|
+
private retrySafeHeld;
|
|
1951
|
+
/** Count one send of a retrySafe dialog's keys (the first one included). */
|
|
1952
|
+
private noteRetrySafeSend;
|
|
1927
1953
|
private claimAutoDialog;
|
|
1928
1954
|
/** Whether a runtime prompt currently owns the pane's stdin. */
|
|
1929
1955
|
isInputBlocked(): boolean;
|
package/dist/daemon.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { nativePaneToolRefusal } from "./native-pane-tools.js";
|
|
2
2
|
import { generalByName } from "./general-instance.js";
|
|
3
|
+
import { codexMetadataHomes } from "./backend/codex-metadata.js";
|
|
3
4
|
import { claudeMinimumError, cliVersionBelow } from "./claude-model-minimum.js";
|
|
4
5
|
import { quotaNoticeProblem } from "./quota-notice-config.js";
|
|
5
6
|
import { quotaHistoryCount, quotaAfterInput } from "./pane-quota-history.js";
|
|
@@ -8,7 +9,7 @@ import { readActiveKiroModel } from "./backend/kiro.js";
|
|
|
8
9
|
import { dashboardAccessOf } from "./dashboard-permissions.js";
|
|
9
10
|
import { sendPackSources } from "./web-office-pack-read.js";
|
|
10
11
|
import { agendVersion, planWhatsNew, readWhatsNewRecord, recordWhatsNew, withWhatsNew } from "./agent-whats-new.js";
|
|
11
|
-
import { join, dirname, resolve } from "node:path";
|
|
12
|
+
import { join, dirname, basename, resolve } from "node:path";
|
|
12
13
|
import { checkoutTarget, readCheckouts, releaseCandidate, reposRoot, verifyWorktree, writeCheckouts } from "./repo-worktree-guard.js";
|
|
13
14
|
import { mkdirSync, writeFileSync, readFileSync, readdirSync, existsSync, unlinkSync, rmSync, appendFileSync, statSync, renameSync } from "node:fs";
|
|
14
15
|
import { COMPACT_WATCH_TIMEOUT_MS, launchIdentity } from "./compact-watch.js";
|
|
@@ -77,7 +78,7 @@ import { TranscriptDeltaReader } from "./transcript-delta-reader.js";
|
|
|
77
78
|
import { buildResumeContinuation, clearInFlightTurnMarker, consumeInFlightTurnMarker, decideTurnResume, normalizeResumeBackend, readResumeFingerprint, RESUME_BLOCKING_DELIVERY_STATES, writeInFlightTurnMarker, } from "./turn-resume.js";
|
|
78
79
|
import { codexLiveRowMatches } from "./backend/codex.js";
|
|
79
80
|
import { codexPackageProblemMessage } from "./backend/codex-package.js";
|
|
80
|
-
import { claudeConfigDirFor, claudeProfileConfigDir, claudeSwitchDialog, claudeSwitchTargetMatches } from "./backend/claude-code.js";
|
|
81
|
+
import { claudeConfigDirFor, claudeProfileConfigDir, claudeProjectKey, claudeSwitchDialog, claudeSwitchTargetMatches } from "./backend/claude-code.js";
|
|
81
82
|
import { MuseBackend } from "./backend/muse.js";
|
|
82
83
|
import { BACKEND_LABELS, InteractionObservation, INTERACTION_CONFIRM_MS, sameInteractionOwner } from "./interaction-observation.js";
|
|
83
84
|
import { unrecognisedPromptShape } from "./unrecognised-prompt.js";
|
|
@@ -1140,6 +1141,20 @@ export class Daemon extends EventEmitter {
|
|
|
1140
1141
|
transcriptMonitor = null;
|
|
1141
1142
|
/** #1218: the transcript this instance's monitor follows now (the Log tab reads it on demand; nothing runs for it here). */
|
|
1142
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
|
+
}
|
|
1143
1158
|
/** #1218 (kiro): the launch this daemon's backend last built, for the Log's reason only (kiro-log-gate.ts). */
|
|
1144
1159
|
logLaunch() { return this.backend?.logLaunch?.() ?? null; }
|
|
1145
1160
|
async kiroMigrationIdle() {
|
|
@@ -1373,6 +1388,8 @@ export class Daemon extends EventEmitter {
|
|
|
1373
1388
|
/** Generation/signature fence for safety dialogs while their screen is still visible. */
|
|
1374
1389
|
autoResolvedDialogKey = null;
|
|
1375
1390
|
autoResolvedDialogGeneration = 0;
|
|
1391
|
+
/** RuntimeDialog.retrySafe: the sends made to the visible dialog of that key, in this spawn (monotonic time of the last). */
|
|
1392
|
+
retrySafeSends = null;
|
|
1376
1393
|
/** Per-launch safety phases survive startup handoff, redraws and failed/uncertain key ACKs. */
|
|
1377
1394
|
launchDialogClaims = null;
|
|
1378
1395
|
/**
|
|
@@ -1574,6 +1591,8 @@ export class Daemon extends EventEmitter {
|
|
|
1574
1591
|
pauseAllowStuck = false;
|
|
1575
1592
|
pauseWakeState = "active";
|
|
1576
1593
|
pauseWakeTransition = null;
|
|
1594
|
+
/** Includes a pause's pane admission, before it publishes pausing. */
|
|
1595
|
+
pauseAdmissions = new Set();
|
|
1577
1596
|
// Model failover: override model on next spawn when rate-limited
|
|
1578
1597
|
modelOverride;
|
|
1579
1598
|
// Context rotation v3: ring buffers for daemon-side snapshot
|
|
@@ -4369,9 +4388,11 @@ export class Daemon extends EventEmitter {
|
|
|
4369
4388
|
continue;
|
|
4370
4389
|
}
|
|
4371
4390
|
const autoKey = dialog.autoResolutionKey;
|
|
4372
|
-
if (dialog.verifyAfterKeys && autoKey
|
|
4391
|
+
if (dialog.verifyAfterKeys && autoKey
|
|
4392
|
+
&& ((this.hasAutoDialogClaim(dialog) && !this.retrySafeDue(dialog)) || this.retrySafeHeld(dialog))) {
|
|
4373
4393
|
// A previous poll sent the safety choice but the CLI has not
|
|
4374
|
-
// repainted yet. Never send another Enter into the same screen
|
|
4394
|
+
// repainted yet. Never send another Enter into the same screen
|
|
4395
|
+
// (a retrySafe dialog's keys may be re-sent: retrySafeDue).
|
|
4375
4396
|
continue;
|
|
4376
4397
|
}
|
|
4377
4398
|
// These keys go straight into the pane. Sent while a message delivery is
|
|
@@ -4412,10 +4433,12 @@ export class Daemon extends EventEmitter {
|
|
|
4412
4433
|
// not evidence that the old request was answered, and the one-minute fallback must keep running.
|
|
4413
4434
|
if (this.dialogAnswers?.key === Daemon.answerKey(dialog) && this.dialogAnswers.screen !== before)
|
|
4414
4435
|
this.endDialogEpisode(dialog.requestIdentity !== undefined);
|
|
4415
|
-
if (dialog.verifyAfterKeys && autoKey
|
|
4436
|
+
if (dialog.verifyAfterKeys && autoKey
|
|
4437
|
+
&& ((this.hasAutoDialogClaim(dialog) && !this.retrySafeDue(dialog)) || this.retrySafeHeld(dialog)))
|
|
4416
4438
|
return;
|
|
4417
4439
|
if (dialog.verifyAfterKeys && autoKey)
|
|
4418
4440
|
this.claimAutoDialog(dialog);
|
|
4441
|
+
this.noteRetrySafeSend(dialog);
|
|
4419
4442
|
this.logger.info(Daemon.answerDetailOf(dialog, currentPane), `Auto-dismissing runtime dialog: ${dialog.description}`);
|
|
4420
4443
|
const SPECIAL_KEYS = new Set(["Up", "Down", "Enter", "Escape", "Right", "Left"]);
|
|
4421
4444
|
for (const key of dialog.keys) {
|
|
@@ -5986,6 +6009,17 @@ export class Daemon extends EventEmitter {
|
|
|
5986
6009
|
async pause(reason = "operator", admission) {
|
|
5987
6010
|
if (this.nativePaneLifecycle)
|
|
5988
6011
|
throw Error("Native pause is owned by its Fleet lifecycle transition");
|
|
6012
|
+
const flight = this.pauseInner(reason, admission);
|
|
6013
|
+
const admissions = this.pauseAdmissions ??= new Set();
|
|
6014
|
+
admissions.add(flight);
|
|
6015
|
+
try {
|
|
6016
|
+
await flight;
|
|
6017
|
+
}
|
|
6018
|
+
finally {
|
|
6019
|
+
admissions.delete(flight);
|
|
6020
|
+
}
|
|
6021
|
+
}
|
|
6022
|
+
async pauseInner(reason, admission) {
|
|
5989
6023
|
if (admission && !admission.current())
|
|
5990
6024
|
return;
|
|
5991
6025
|
if (this.pauseWakeState === "paused")
|
|
@@ -5995,7 +6029,7 @@ export class Daemon extends EventEmitter {
|
|
|
5995
6029
|
if (this.getPauseWakeState() !== "active")
|
|
5996
6030
|
return;
|
|
5997
6031
|
}
|
|
5998
|
-
if (admission && !admission.current())
|
|
6032
|
+
if (this.deliveryWritesStopping || this.startupAborted || (admission && !admission.current()))
|
|
5999
6033
|
return;
|
|
6000
6034
|
// `pauseAllowStuck` is consumed here, not merely read: it authorises exactly
|
|
6001
6035
|
// one pause from a stuck pane (the auth-deferred one) and must never leak
|
|
@@ -6028,7 +6062,8 @@ export class Daemon extends EventEmitter {
|
|
|
6028
6062
|
// #1730 P2-2: the await yields — the pane read is only valid for the
|
|
6029
6063
|
// world it was taken from. Revalidate owner, phase, state and queue
|
|
6030
6064
|
// before acting on it; anything that moved defers this cycle.
|
|
6031
|
-
if (
|
|
6065
|
+
if (this.deliveryWritesStopping || this.startupAborted
|
|
6066
|
+
|| (admission && (!admission.current() || pane === null || !admission.accepts(pane)))
|
|
6032
6067
|
|| this.tmux !== tmux
|
|
6033
6068
|
|| this.tmux?.getWindowId?.() !== windowId
|
|
6034
6069
|
|| this.spawnGeneration !== generation
|
|
@@ -6103,6 +6138,17 @@ export class Daemon extends EventEmitter {
|
|
|
6103
6138
|
this.pauseWakeTransition = null;
|
|
6104
6139
|
}
|
|
6105
6140
|
}
|
|
6141
|
+
/** Whether an admitted pause or published pause/wake still owns this launch. */
|
|
6142
|
+
get hasPendingPauseWake() {
|
|
6143
|
+
return !!this.pauseAdmissions?.size
|
|
6144
|
+
|| !!this.pauseWakeTransition && (this.pauseWakeState === "pausing" || this.pauseWakeState === "waking");
|
|
6145
|
+
}
|
|
6146
|
+
/** Settle pane admission as well as the published pause/wake transition. */
|
|
6147
|
+
async waitForPauseWakeTransition() {
|
|
6148
|
+
while (this.hasPendingPauseWake) {
|
|
6149
|
+
await Promise.all([...this.pauseAdmissions ?? [], ...(this.pauseWakeTransition ? [this.pauseWakeTransition] : [])]);
|
|
6150
|
+
}
|
|
6151
|
+
}
|
|
6106
6152
|
/** Respawn the CLI in the preserved window and block until its prompt is ready. */
|
|
6107
6153
|
async wake(timeoutMs = 30_000) {
|
|
6108
6154
|
this.assertSessionOomAdmission();
|
|
@@ -8966,6 +9012,9 @@ export class Daemon extends EventEmitter {
|
|
|
8966
9012
|
this.autoResolvedDialogKey = null;
|
|
8967
9013
|
this.autoResolvedDialogGeneration = 0;
|
|
8968
9014
|
}
|
|
9015
|
+
// A retrySafe dialog that is gone and comes back (Claude's idle cold-resume timer) is a new episode: a fresh budget.
|
|
9016
|
+
if (!active)
|
|
9017
|
+
this.retrySafeSends = null;
|
|
8969
9018
|
return active;
|
|
8970
9019
|
}
|
|
8971
9020
|
hasAutoDialogClaim(dialog) {
|
|
@@ -8979,6 +9028,40 @@ export class Daemon extends EventEmitter {
|
|
|
8979
9028
|
}
|
|
8980
9029
|
return this.autoResolvedDialogGeneration === this.spawnGeneration && this.autoResolvedDialogKey === key;
|
|
8981
9030
|
}
|
|
9031
|
+
/**
|
|
9032
|
+
* RuntimeDialog.retrySafe: may the claimed answer to this dialog — still on screen — be sent again now? Only for a
|
|
9033
|
+
* dialog that declares its keys safe to repeat, within its send budget, and once `afterMs` has passed since the last
|
|
9034
|
+
* send to it in this spawn.
|
|
9035
|
+
*/
|
|
9036
|
+
retrySafeDue(dialog) {
|
|
9037
|
+
const retry = dialog.retrySafe, key = dialog.autoResolutionKey;
|
|
9038
|
+
if (!retry || !key || dialog.oncePerLaunch || !dialog.verifyAfterKeys)
|
|
9039
|
+
return false;
|
|
9040
|
+
const sends = this.retrySafeSends;
|
|
9041
|
+
if (!sends || sends.key !== key || sends.spawn !== this.spawnGeneration)
|
|
9042
|
+
return false; // no send of ours to repeat
|
|
9043
|
+
return sends.count < retry.max && performance.now() - sends.lastMono >= retry.afterMs;
|
|
9044
|
+
}
|
|
9045
|
+
/**
|
|
9046
|
+
* RuntimeDialog.retrySafe: a send to this dialog is on record in this spawn and the next one is not due (its budget
|
|
9047
|
+
* is spent, or `afterMs` has not passed). Holds even when the one-shot claim was released — a failed or uncertain key
|
|
9048
|
+
* ACK releases it — so the budget can never be bypassed (#3589 review).
|
|
9049
|
+
*/
|
|
9050
|
+
retrySafeHeld(dialog) {
|
|
9051
|
+
const key = dialog.autoResolutionKey, sends = this.retrySafeSends;
|
|
9052
|
+
if (!dialog.retrySafe || !key || !sends || sends.key !== key || sends.spawn !== this.spawnGeneration)
|
|
9053
|
+
return false;
|
|
9054
|
+
return !this.retrySafeDue(dialog);
|
|
9055
|
+
}
|
|
9056
|
+
/** Count one send of a retrySafe dialog's keys (the first one included). */
|
|
9057
|
+
noteRetrySafeSend(dialog) {
|
|
9058
|
+
const key = dialog.autoResolutionKey;
|
|
9059
|
+
if (!dialog.retrySafe || !key)
|
|
9060
|
+
return;
|
|
9061
|
+
const sends = this.retrySafeSends;
|
|
9062
|
+
const same = sends !== null && sends.key === key && sends.spawn === this.spawnGeneration;
|
|
9063
|
+
this.retrySafeSends = { key, spawn: this.spawnGeneration, count: (same ? sends.count : 0) + 1, lastMono: performance.now() };
|
|
9064
|
+
}
|
|
8982
9065
|
claimAutoDialog(dialog) {
|
|
8983
9066
|
const key = dialog.autoResolutionKey;
|
|
8984
9067
|
if (!key)
|
|
@@ -11448,7 +11531,32 @@ export class Daemon extends EventEmitter {
|
|
|
11448
11531
|
}
|
|
11449
11532
|
if (proof !== "stranded" || !allowRecoveryEnter)
|
|
11450
11533
|
return false;
|
|
11451
|
-
|
|
11534
|
+
// A retained post-Enter frame can still hold the paste while Codex is already
|
|
11535
|
+
// submitting it. Readiness may stay false for the whole new turn (#3578):
|
|
11536
|
+
// keep asking the same positive judge rather than waiting out its 30s cap.
|
|
11537
|
+
// A strand, output alone or an unreadable frame never stops this wait, and
|
|
11538
|
+
// only actual readiness can authorize the existing recovery Enter below.
|
|
11539
|
+
let waiting = true;
|
|
11540
|
+
const observed = { proof: proof };
|
|
11541
|
+
let ready;
|
|
11542
|
+
try {
|
|
11543
|
+
ready = await this.waitForPaneReadyForDelivery(windowId, STRANDED_RETRY_READY_WAIT_MS, async () => {
|
|
11544
|
+
if (!current())
|
|
11545
|
+
return true;
|
|
11546
|
+
observed.proof = await this.confirmSubmitted(signature, baseline, () => waiting && current());
|
|
11547
|
+
return !current() || observed.proof === "submitted";
|
|
11548
|
+
});
|
|
11549
|
+
}
|
|
11550
|
+
finally {
|
|
11551
|
+
// An in-flight read can outlive the wait deadline. It must not settle a
|
|
11552
|
+
// receipt or retire an input guard after this observation was abandoned.
|
|
11553
|
+
waiting = false;
|
|
11554
|
+
}
|
|
11555
|
+
if (!current())
|
|
11556
|
+
return false;
|
|
11557
|
+
if (observed.proof === "submitted")
|
|
11558
|
+
return true;
|
|
11559
|
+
if (ready !== true)
|
|
11452
11560
|
return false;
|
|
11453
11561
|
proof = await proofNow();
|
|
11454
11562
|
if (!current())
|
|
@@ -14330,12 +14438,17 @@ export class Daemon extends EventEmitter {
|
|
|
14330
14438
|
// Try each startup dialog pattern before checking ready state
|
|
14331
14439
|
let matched = false;
|
|
14332
14440
|
lastDialog = null;
|
|
14441
|
+
// A safety choice already sent whose dialog is still on screen (the CLI dropped the key, or has not repainted
|
|
14442
|
+
// yet): it is never read as ready below — its own menu row can carry the ready glyph (`❯`).
|
|
14443
|
+
let answeredStillVisible = null;
|
|
14333
14444
|
for (const dialog of startupDialogs) {
|
|
14334
14445
|
if (Daemon.dialogMatches(dialog, pane)) {
|
|
14335
14446
|
if (dialog.autoResolutionKey
|
|
14336
|
-
&& (attemptedSafetyChoices.has(dialog.autoResolutionKey)
|
|
14337
|
-
|| this.
|
|
14447
|
+
&& (((attemptedSafetyChoices.has(dialog.autoResolutionKey) || this.hasAutoDialogClaim(dialog))
|
|
14448
|
+
&& !this.retrySafeDue(dialog)) || this.retrySafeHeld(dialog))) {
|
|
14449
|
+
answeredStillVisible ??= dialog;
|
|
14338
14450
|
continue;
|
|
14451
|
+
}
|
|
14339
14452
|
lastDialog = dialog;
|
|
14340
14453
|
this.noteCodexReserveDialog(dialog, pane);
|
|
14341
14454
|
this.noteLiveIncidentDialog(dialog, pane);
|
|
@@ -14409,6 +14522,7 @@ export class Daemon extends EventEmitter {
|
|
|
14409
14522
|
attemptedSafetyChoices.add(dialog.autoResolutionKey);
|
|
14410
14523
|
this.claimAutoDialog(dialog);
|
|
14411
14524
|
}
|
|
14525
|
+
this.noteRetrySafeSend(dialog);
|
|
14412
14526
|
for (const key of dialog.keys) {
|
|
14413
14527
|
this.startupAdmission?.();
|
|
14414
14528
|
// Before every key, synchronously: the lock wait, the capture and the gap after the previous key can
|
|
@@ -14455,6 +14569,13 @@ export class Daemon extends EventEmitter {
|
|
|
14455
14569
|
await sleep();
|
|
14456
14570
|
continue;
|
|
14457
14571
|
}
|
|
14572
|
+
if (answeredStillVisible) {
|
|
14573
|
+
// Answered, still up: wait for it to go (or, for a retrySafe one, for its next send to fall due).
|
|
14574
|
+
lastDialog = answeredStillVisible;
|
|
14575
|
+
cleanReadyPolls = 0;
|
|
14576
|
+
await sleep();
|
|
14577
|
+
continue;
|
|
14578
|
+
}
|
|
14458
14579
|
if (this.dialogParkedSince !== 0 && !this.deliveryBlockingDialogs().some(d => Daemon.dialogMatches(d, pane)))
|
|
14459
14580
|
this.trackDialogParked(null);
|
|
14460
14581
|
// A sign-in screen that carries the ready pattern's own glyph (Claude's
|