@songsid/agend 2.3.5-alpha.7 → 2.3.5-alpha.9
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-profiles.d.ts +6 -0
- package/dist/accounts-profiles.js +16 -0
- package/dist/accounts-profiles.js.map +1 -1
- package/dist/accounts-view.d.ts +17 -0
- package/dist/accounts-view.js +33 -6
- package/dist/accounts-view.js.map +1 -1
- package/dist/agent-cli-instructions.md +1 -1
- package/dist/agent-cli.js +5 -2
- package/dist/agent-cli.js.map +1 -1
- package/dist/agent-whats-new.js +5 -0
- package/dist/agent-whats-new.js.map +1 -1
- 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 +1 -1
- package/dist/auth-api.js +4 -2
- 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/backend/claude-code.d.ts +1 -0
- package/dist/backend/claude-code.js +13 -0
- package/dist/backend/claude-code.js.map +1 -1
- package/dist/backend/types.d.ts +4 -0
- package/dist/backend/types.js.map +1 -1
- package/dist/build-provenance.json +1 -1
- package/dist/channel/mcp-tools.js +2 -2
- package/dist/channel/mcp-tools.js.map +1 -1
- package/dist/claude-model-minimum.d.ts +7 -0
- package/dist/claude-model-minimum.js +16 -0
- package/dist/claude-model-minimum.js.map +1 -0
- package/dist/config-validator.js +2 -1
- package/dist/config-validator.js.map +1 -1
- package/dist/daemon.d.ts +43 -1
- package/dist/daemon.js +176 -27
- package/dist/daemon.js.map +1 -1
- package/dist/decision-list.d.ts +2 -0
- package/dist/decision-list.js +1 -1
- package/dist/decision-list.js.map +1 -1
- package/dist/fleet-manager.d.ts +75 -3
- package/dist/fleet-manager.js +462 -53
- package/dist/fleet-manager.js.map +1 -1
- package/dist/general-knowledge/skills/concepts/SKILL.md +14 -3
- package/dist/general-knowledge/skills/delegation-playbook/SKILL.md +4 -1
- package/dist/general-knowledge/steering/core-rules.md +1 -1
- package/dist/hub/catalog.d.ts +1 -1
- package/dist/hub/catalog.js +151 -33
- package/dist/hub/catalog.js.map +1 -1
- package/dist/hub/client.js +4 -0
- package/dist/hub/client.js.map +1 -1
- package/dist/hub/compose/member.d.ts +6 -0
- package/dist/hub/compose/member.js +9 -1
- package/dist/hub/compose/member.js.map +1 -1
- package/dist/hub/compose/server.d.ts +55 -1
- package/dist/hub/compose/server.js +76 -10
- package/dist/hub/compose/server.js.map +1 -1
- package/dist/hub/directory/directory.d.ts +2 -0
- package/dist/hub/directory/directory.js +49 -4
- package/dist/hub/directory/directory.js.map +1 -1
- package/dist/hub/directory/types.d.ts +2 -0
- package/dist/hub/directory/types.js.map +1 -1
- 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/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-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 +9 -1
- package/dist/hub/group-policy/admin-dto.js.map +1 -1
- 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/authorization.d.ts +22 -0
- package/dist/hub/group-policy/authorization.js +147 -2
- package/dist/hub/group-policy/authorization.js.map +1 -1
- 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/resources.d.ts +13 -1
- package/dist/hub/group-policy/resources.js +92 -23
- package/dist/hub/group-policy/resources.js.map +1 -1
- package/dist/hub/group-policy/store.d.ts +11 -0
- package/dist/hub/group-policy/store.js +57 -2
- package/dist/hub/group-policy/store.js.map +1 -1
- 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 +2 -0
- package/dist/hub/http/compose.js +184 -8
- package/dist/hub/http/compose.js.map +1 -1
- package/dist/hub/http/core.d.ts +2 -0
- package/dist/hub/http/core.js +10 -1
- package/dist/hub/http/core.js.map +1 -1
- package/dist/hub/http/deps.d.ts +10 -0
- package/dist/hub/http/schema.js +4 -0
- package/dist/hub/http/schema.js.map +1 -1
- package/dist/hub/init/browser-certificate.d.ts +6 -1
- package/dist/hub/init/browser-certificate.js +22 -1
- package/dist/hub/init/browser-certificate.js.map +1 -1
- package/dist/hub/init/initializer.d.ts +11 -1
- package/dist/hub/init/initializer.js +202 -83
- package/dist/hub/init/initializer.js.map +1 -1
- package/dist/hub/init/layout.js +1 -1
- package/dist/hub/init/layout.js.map +1 -1
- package/dist/hub/init/text.js +2 -2
- package/dist/hub/init/text.js.map +1 -1
- package/dist/hub/init/types.d.ts +32 -4
- package/dist/hub/init/types.js.map +1 -1
- 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.js +1 -3
- package/dist/hub/init/wizard.js.map +1 -1
- 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/pairing-api.d.ts +2 -0
- package/dist/hub/member/pairing-api.js +7 -1
- package/dist/hub/member/pairing-api.js.map +1 -1
- 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/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 +39 -1
- package/dist/hub/pairing.js +316 -16
- package/dist/hub/pairing.js.map +1 -1
- package/dist/hub/protocol.d.ts +61 -0
- package/dist/hub/protocol.js +8 -1
- package/dist/hub/protocol.js.map +1 -1
- 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 +7 -1
- package/dist/hub/rooms.js +25 -13
- package/dist/hub/rooms.js.map +1 -1
- package/dist/hub/runtime.d.ts +8 -1
- package/dist/hub/runtime.js +13 -0
- package/dist/hub/runtime.js.map +1 -1
- package/dist/hub/server.d.ts +3 -0
- package/dist/hub/server.js +18 -0
- package/dist/hub/server.js.map +1 -1
- 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 +13 -0
- package/dist/hub/sessions.js +36 -16
- package/dist/hub/sessions.js.map +1 -1
- 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 +95 -0
- package/dist/hub/settings-commit.js +490 -0
- package/dist/hub/settings-commit.js.map +1 -0
- package/dist/hub/settings-directory-decision.d.ts +433 -0
- package/dist/hub/settings-directory-decision.js +236 -0
- package/dist/hub/settings-directory-decision.js.map +1 -0
- package/dist/hub/settings-directory-proof.d.ts +77 -0
- package/dist/hub/settings-directory-proof.js +303 -0
- package/dist/hub/settings-directory-proof.js.map +1 -0
- package/dist/hub/store.d.ts +12 -2
- package/dist/hub/store.js +9 -5
- package/dist/hub/store.js.map +1 -1
- package/dist/hub/types.d.ts +15 -2
- 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/instance-lifecycle.d.ts +3 -0
- package/dist/instance-lifecycle.js +4 -0
- package/dist/instance-lifecycle.js.map +1 -1
- package/dist/locale.js +54 -30
- package/dist/locale.js.map +1 -1
- package/dist/login-controller.d.ts +9 -1
- package/dist/login-controller.js +20 -1
- package/dist/login-controller.js.map +1 -1
- package/dist/login-flows.js +4 -2
- package/dist/login-flows.js.map +1 -1
- package/dist/office-share-page.js +1 -1
- package/dist/office-share-page.js.map +1 -1
- package/dist/outbound-handlers.js +1 -1
- package/dist/outbound-handlers.js.map +1 -1
- package/dist/outbound-schemas.d.ts +2 -0
- package/dist/outbound-schemas.js +4 -2
- package/dist/outbound-schemas.js.map +1 -1
- package/dist/pane-port.d.ts +1 -1
- 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/quickstart-api.js +2 -2
- package/dist/quickstart-api.js.map +1 -1
- package/dist/reply-buttons-controller.d.ts +5 -1
- package/dist/reply-buttons-controller.js +8 -4
- 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/scheduler/db.d.ts +10 -0
- package/dist/scheduler/db.js +38 -11
- package/dist/scheduler/db.js.map +1 -1
- package/dist/scheduler/types.d.ts +6 -1
- package/dist/settings-api.d.ts +9 -1
- package/dist/settings-api.js +200 -4
- package/dist/settings-api.js.map +1 -1
- package/dist/settings-confirmation.d.ts +1 -1
- package/dist/settings-confirmation.js +1 -1
- package/dist/settings-confirmation.js.map +1 -1
- package/dist/settings-effect.js +58 -0
- package/dist/settings-effect.js.map +1 -1
- package/dist/settings-http-confirmation.d.ts +3 -0
- package/dist/settings-http-confirmation.js +8 -5
- package/dist/settings-http-confirmation.js.map +1 -1
- package/dist/settings-request-capability.d.ts +5 -0
- package/dist/settings-request-capability.js +6 -1
- package/dist/settings-request-capability.js.map +1 -1
- package/dist/signin-keepalive.d.ts +2 -0
- package/dist/signin-keepalive.js +30 -2
- package/dist/signin-keepalive.js.map +1 -1
- package/dist/structured-signin-transport.d.ts +20 -2
- package/dist/structured-signin-transport.js +57 -6
- package/dist/structured-signin-transport.js.map +1 -1
- package/dist/team-membership.d.ts +7 -0
- package/dist/team-membership.js +10 -0
- package/dist/team-membership.js.map +1 -0
- package/dist/tmux-manager.d.ts +1 -1
- package/dist/tmux-manager.js +4 -1
- package/dist/tmux-manager.js.map +1 -1
- package/dist/topic-commands.js +1 -1
- package/dist/topic-commands.js.map +1 -1
- package/dist/ui/accounts-keepalive.js +10 -5
- package/dist/ui/accounts-manage.js +29 -11
- package/dist/ui/accounts-view.js +75 -28
- package/dist/ui/backend-signin.js +61 -16
- package/dist/ui/hub-attachments.js +3 -3
- package/dist/ui/hub-chat-strings.js +2 -0
- package/dist/ui/hub-client.js +50 -4
- package/dist/ui/hub-company-join-strings.js +74 -0
- package/dist/ui/hub-company-join.js +119 -0
- package/dist/ui/hub-group-policy.js +175 -0
- package/dist/ui/hub-group-strings.js +97 -0
- package/dist/ui/hub-owner-strings.js +12 -12
- package/dist/ui/hub-pairing-progress-strings.js +15 -0
- package/dist/ui/hub-quick-pairing.js +209 -0
- package/dist/ui/hub-quick-strings.js +43 -0
- package/dist/ui/hub-read-strings.js +7 -0
- package/dist/ui/hub-this-hub.js +112 -0
- package/dist/ui/hub-welcome.js +102 -0
- package/dist/ui/panel-hub.js +217 -28
- package/dist/ui/panel-needs.js +1 -1
- package/dist/ui/panel-settings.js +7 -4
- package/dist/ui/settings-apply.js +12 -5
- package/dist/ui/settings-devices.js +2 -2
- package/dist/ui/settings-dialogs.js +3 -1
- package/dist/ui/settings-hub-company-join.js +90 -0
- package/dist/ui/settings-hub-membership.js +20 -5
- package/dist/ui/settings-hub-preview.js +74 -0
- package/dist/ui/settings-hub-run.js +60 -0
- package/dist/ui/settings-hub-section.js +30 -3
- package/dist/ui/settings-hub.js +52 -11
- package/dist/ui/settings-registry.js +2 -0
- package/dist/ui/settings-restart-strings.js +17 -0
- package/dist/ui/settings-strings.js +6 -4
- package/dist/ui/shared/accounts-keepalive.css +11 -6
- package/dist/ui/shared/accounts.css +68 -18
- package/dist/ui/shared/app-i18n.js +4 -1
- package/dist/ui/shared/app-shell.js +39 -25
- package/dist/ui/shared/app.css +9 -8
- package/dist/ui/shared/chat-strings.js +13 -13
- package/dist/ui/shared/hub-chat.css +12 -0
- package/dist/ui/shared/hub-groups.css +28 -0
- package/dist/ui/shared/hub-owner.css +19 -1
- package/dist/ui/shared/hub.css +8 -1
- package/dist/ui/shared/setup-host-text.js +4 -1
- package/dist/ui/shared/signin.js +3 -1
- package/dist/ui/shared/usage-dialog.js +3 -72
- package/dist/ui/shared/usage-meter.js +84 -0
- package/dist/ui/shared/web-authorize.js +4 -4
- package/dist/ui/structured-signin.js +24 -6
- 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-launch.d.ts +1 -1
- package/dist/update-launch.js +2 -2
- package/dist/update-launch.js.map +1 -1
- package/dist/update-marker.d.ts +2 -0
- package/dist/update-marker.js.map +1 -1
- package/dist/view-api.d.ts +2 -8
- package/dist/view-api.js +3 -9
- package/dist/view-api.js.map +1 -1
- package/dist/web-api.d.ts +7 -1
- package/dist/web-api.js +91 -14
- package/dist/web-api.js.map +1 -1
- package/dist/web-backend-login.d.ts +16 -2
- package/dist/web-backend-login.js +14 -0
- package/dist/web-backend-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-terminal.d.ts +7 -0
- package/dist/web-terminal.js +14 -2
- package/dist/web-terminal.js.map +1 -1
- package/package.json +1 -1
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 { claudeMinimumError, cliVersionBelow } from "./claude-model-minimum.js";
|
|
3
4
|
import { quotaNoticeProblem } from "./quota-notice-config.js";
|
|
4
5
|
import { quotaHistoryCount, quotaAfterInput } from "./pane-quota-history.js";
|
|
5
6
|
import { dialogScreenText } from "./dialog-screen-text.js";
|
|
@@ -199,20 +200,20 @@ export function sameProjectFamily(a, b) {
|
|
|
199
200
|
const fx = family(x), fy = family(y);
|
|
200
201
|
return fx.length > 0 && fx === fy;
|
|
201
202
|
}
|
|
203
|
+
/** At most this many fleet decisions, and this many team + directory ones, in one instance's Active Decisions. */
|
|
204
|
+
export const ACTIVE_DECISION_CAPS = { fleet: 20, scoped: 20 };
|
|
202
205
|
/**
|
|
203
|
-
*
|
|
204
|
-
*
|
|
205
|
-
* `scope: "fleet"` previously bypassed the project check outright, so every
|
|
206
|
-
* instance carried every other project's playbook — measured at 8 of 14 here,
|
|
207
|
-
* resent on every API call. A fleet decision must now also be relevant: global
|
|
208
|
-
* (no project_root), the same project, or the same project family.
|
|
209
|
-
*
|
|
210
|
-
* `isDispatcher` (a general) opts out of that narrowing on purpose: it routes
|
|
211
|
-
* work across all projects, so cross-project rules ("X 文件操作由 Y 負責") are
|
|
212
|
-
* precisely what it must know. Narrowing a general would cause misrouting.
|
|
206
|
+
* Bound an instance's already-selected decisions (newest first, as the store orders them): fleet ones and its own team
|
|
207
|
+
* and directory ones are capped apart, AFTER selection, so nobody else's rows take an instance's places.
|
|
213
208
|
*/
|
|
214
|
-
export function
|
|
209
|
+
export function capActiveDecisions(selected) {
|
|
210
|
+
let fleet = 0, scoped = 0;
|
|
211
|
+
return selected.filter(d => d.scope === "fleet" ? fleet++ < ACTIVE_DECISION_CAPS.fleet : scoped++ < ACTIVE_DECISION_CAPS.scoped);
|
|
212
|
+
}
|
|
213
|
+
export function selectRelevantDecisions(all, workDir, isDispatcher = false, teams = []) {
|
|
215
214
|
return all.filter(d => {
|
|
215
|
+
if (d.scope === "team")
|
|
216
|
+
return !!d.team && teams.includes(d.team);
|
|
216
217
|
if (d.project_root === workDir)
|
|
217
218
|
return true; // own project, any scope
|
|
218
219
|
if (d.scope !== "fleet")
|
|
@@ -1552,6 +1553,12 @@ export class Daemon extends EventEmitter {
|
|
|
1552
1553
|
* when a startup scan reaches a real ready prompt, or on wake().
|
|
1553
1554
|
*/
|
|
1554
1555
|
fatalStartupBlocked = false;
|
|
1556
|
+
/** #3441: one repair budget survives every automatic spawn on this daemon. */
|
|
1557
|
+
modelMinimumRepairUsed = false;
|
|
1558
|
+
modelMinimumFlight = null;
|
|
1559
|
+
modelMinimumBlocked = false;
|
|
1560
|
+
modelMinimumUpdateNotified = false;
|
|
1561
|
+
cliRepairSessionId;
|
|
1555
1562
|
/** model_error seen mid-turn: notify only if it survives to the idle screen. */
|
|
1556
1563
|
pendingModelErrorKey = null;
|
|
1557
1564
|
/** Optional per-instance localhost relay used to observe Muse usage events. */
|
|
@@ -2229,6 +2236,12 @@ export class Daemon extends EventEmitter {
|
|
|
2229
2236
|
}
|
|
2230
2237
|
/** The fleet's other same-backend instances' working directories, read at spawn (#984). */
|
|
2231
2238
|
peerWorkingDirectories;
|
|
2239
|
+
/** This instance's teams (fleet.yaml), read at each spawn: their team decisions join its Active Decisions. */
|
|
2240
|
+
decisionTeams;
|
|
2241
|
+
setDecisionTeams(teams) { this.decisionTeams = teams; }
|
|
2242
|
+
/** The fleet's active decisions (startup snapshot), read at each spawn; absent: the AGEND_DECISIONS env (tests). */
|
|
2243
|
+
decisionSource;
|
|
2244
|
+
setDecisionSource(source) { this.decisionSource = source; }
|
|
2232
2245
|
setPeerWorkingDirectories(peers) {
|
|
2233
2246
|
this.peerWorkingDirectories = peers;
|
|
2234
2247
|
}
|
|
@@ -4719,6 +4732,14 @@ export class Daemon extends EventEmitter {
|
|
|
4719
4732
|
}
|
|
4720
4733
|
/** Arm the recovery gates and emit one detected error pattern. */
|
|
4721
4734
|
emitErrorPattern(ep, key, pane, now) {
|
|
4735
|
+
const minimum = !this.nativePaneLifecycle && this.backend?.binaryName === "claude" && ep.type === "outdated_cli" ? claudeMinimumError(pane) : null;
|
|
4736
|
+
if (minimum) {
|
|
4737
|
+
this.lastErrorNotifiedAt.set(key, now);
|
|
4738
|
+
void this.handleClaudeModelMinimum(minimum).catch(err => {
|
|
4739
|
+
this.logger.warn({ reason: String(err) }, "CLI launch repair failed");
|
|
4740
|
+
});
|
|
4741
|
+
return;
|
|
4742
|
+
}
|
|
4722
4743
|
// #2795: auth text on the pane proves nothing about the credentials (22 of 22 such matches on the main host were
|
|
4723
4744
|
// conversation text). It arms nothing here; it only asks the lifecycle's token-free check, and a failing check
|
|
4724
4745
|
// arms the auth state through confirmAuthFailure().
|
|
@@ -10275,9 +10296,9 @@ export class Daemon extends EventEmitter {
|
|
|
10275
10296
|
* moment the flag clears.
|
|
10276
10297
|
*/
|
|
10277
10298
|
refuseFatalStartupDelivery(verdict, status) {
|
|
10278
|
-
if (!this.fatalStartupBlocked)
|
|
10299
|
+
if (!this.fatalStartupBlocked && !this.modelMinimumBlocked)
|
|
10279
10300
|
return false;
|
|
10280
|
-
this.logger.error("Delivery refused — CLI
|
|
10301
|
+
this.logger.error("Delivery refused — CLI startup or model-version repair is held");
|
|
10281
10302
|
this.failDelivery(verdict, status, "fatal-startup", "blocked-before-write");
|
|
10282
10303
|
return true;
|
|
10283
10304
|
}
|
|
@@ -12510,9 +12531,10 @@ export class Daemon extends EventEmitter {
|
|
|
12510
12531
|
// Comma-separated parts (`file:role.md, file:rules.md`) only when a part is a file ref; otherwise one inline prompt.
|
|
12511
12532
|
const resolvedCustomPrompt = this.config.systemPrompt ? assembleSystemPrompt(this.config.systemPrompt, promptFiles) : undefined;
|
|
12512
12533
|
let decisions;
|
|
12513
|
-
|
|
12534
|
+
const source = this.decisionSource;
|
|
12535
|
+
if (source || process.env.AGEND_DECISIONS) {
|
|
12514
12536
|
try {
|
|
12515
|
-
const all = JSON.parse(process.env.AGEND_DECISIONS);
|
|
12537
|
+
const all = source ? source() : JSON.parse(process.env.AGEND_DECISIONS);
|
|
12516
12538
|
const workDir = this.config.working_directory;
|
|
12517
12539
|
// `scope: "fleet"` used to bypass the project check entirely, so a
|
|
12518
12540
|
// single-project worker inherited every other project's playbook (8 of
|
|
@@ -12521,7 +12543,12 @@ export class Daemon extends EventEmitter {
|
|
|
12521
12543
|
// same project, or the same project family (worktrees/checkouts of one
|
|
12522
12544
|
// repo). A general is exempt: it dispatches across all projects, so
|
|
12523
12545
|
// cross-project routing rules are exactly what it needs.
|
|
12524
|
-
|
|
12546
|
+
let teams = [];
|
|
12547
|
+
try {
|
|
12548
|
+
teams = this.decisionTeams?.() ?? [];
|
|
12549
|
+
}
|
|
12550
|
+
catch { /* no team list: fleet and project decisions only */ }
|
|
12551
|
+
decisions = capActiveDecisions(selectRelevantDecisions([...all], workDir, this.config.general_topic === true, teams));
|
|
12525
12552
|
// Stable ordering so identical decision sets always build byte-identical
|
|
12526
12553
|
// instructions — otherwise source ordering jitter flips the warmup hash.
|
|
12527
12554
|
decisions.sort((a, b) => a.title.localeCompare(b.title));
|
|
@@ -12641,6 +12668,7 @@ export class Daemon extends EventEmitter {
|
|
|
12641
12668
|
effort: this.config.effort,
|
|
12642
12669
|
kiroUi: this.config.kiro_ui,
|
|
12643
12670
|
skipResume: this.skipResume,
|
|
12671
|
+
...(this.cliRepairSessionId ? { resumeSessionId: this.cliRepairSessionId } : {}),
|
|
12644
12672
|
instructions,
|
|
12645
12673
|
agentMode: isCliMode ? "cli" : "mcp",
|
|
12646
12674
|
agentPort: isCliMode ? agentPort : undefined,
|
|
@@ -13643,14 +13671,14 @@ export class Daemon extends EventEmitter {
|
|
|
13643
13671
|
* Handles confirmation dialogs (trust folder, bypass permissions).
|
|
13644
13672
|
* Returns true if CLI is ready, false if it failed or got stuck.
|
|
13645
13673
|
*/
|
|
13646
|
-
async trySpawn(reuseWindow = false, startupTimeoutMs) {
|
|
13674
|
+
async trySpawn(reuseWindow = false, startupTimeoutMs, repairAdmission) {
|
|
13647
13675
|
const recoveryOwner = this.collateralOomRecovery ? this.interactionOwner() : null;
|
|
13648
13676
|
const enter = () => {
|
|
13649
13677
|
if (recoveryOwner && (!sameInteractionOwner(recoveryOwner, this.interactionOwner())
|
|
13650
13678
|
|| this.startupAborted || this.deliveryWritesStopping || this.runtimeMonitorsFrozen || this.healthCheckPaused)) {
|
|
13651
13679
|
throw new Error("OOM recovery cancelled: the instance was stopped, paused or replaced while memory was unavailable");
|
|
13652
13680
|
}
|
|
13653
|
-
return this.trySpawnInsideGate(reuseWindow, startupTimeoutMs).catch(err => {
|
|
13681
|
+
return this.trySpawnInsideGate(reuseWindow, startupTimeoutMs, repairAdmission).catch(err => {
|
|
13654
13682
|
// Includes an in-place binary replacement during asynchronous launch preparation.
|
|
13655
13683
|
if (err instanceof KiroCompatibilityError)
|
|
13656
13684
|
this.emit("kiro_compatibility_hold", err.message);
|
|
@@ -13675,6 +13703,122 @@ export class Daemon extends EventEmitter {
|
|
|
13675
13703
|
this.startupAdmission?.();
|
|
13676
13704
|
return ready;
|
|
13677
13705
|
}
|
|
13706
|
+
/** Resolve the installed launcher; never run Claude to discover its version. */
|
|
13707
|
+
async resolveClaudeInstallPath() {
|
|
13708
|
+
const { binaryProbe } = await import("./binary-probe.js");
|
|
13709
|
+
const { resolveBackendBinary } = await import("./backend-availability.js");
|
|
13710
|
+
binaryProbe.invalidate("claude");
|
|
13711
|
+
return await resolveBackendBinary("claude-code") ?? null;
|
|
13712
|
+
}
|
|
13713
|
+
async installedClaudeVersion(path) {
|
|
13714
|
+
const { staticBackendVersion } = await import("./backend-availability.js");
|
|
13715
|
+
return staticBackendVersion("claude-code", path);
|
|
13716
|
+
}
|
|
13717
|
+
/** #3441: only the CLI's own refusal can request this one, non-renewable repair. */
|
|
13718
|
+
handleClaudeModelMinimum(minimum) {
|
|
13719
|
+
if (this.modelMinimumRepairUsed || this.modelMinimumBlocked || this.spawning || this.healthCheckPaused
|
|
13720
|
+
|| this.pauseWakeState !== "active" || this.backend?.binaryName !== "claude"
|
|
13721
|
+
|| !this.backend.refreshLaunchBinary)
|
|
13722
|
+
return Promise.resolve();
|
|
13723
|
+
if (this.modelMinimumFlight)
|
|
13724
|
+
return this.modelMinimumFlight;
|
|
13725
|
+
const flight = this.repairClaudeModelMinimum(minimum).finally(() => {
|
|
13726
|
+
if (this.modelMinimumFlight === flight)
|
|
13727
|
+
this.modelMinimumFlight = null;
|
|
13728
|
+
});
|
|
13729
|
+
this.modelMinimumFlight = flight;
|
|
13730
|
+
return flight;
|
|
13731
|
+
}
|
|
13732
|
+
async repairClaudeModelMinimum(minimum) {
|
|
13733
|
+
const tmux = this.tmux, backend = this.backend, window = tmux?.getWindowId();
|
|
13734
|
+
let spawn = this.spawnGeneration, claimed = false;
|
|
13735
|
+
const fence = this.launchFenceEpoch, attempt = this.launchAttempt, phase = this.pauseWakeState;
|
|
13736
|
+
const baseCurrent = () => this.tmux === tmux && this.backend === backend && tmux?.getWindowId() === window
|
|
13737
|
+
&& this.spawnGeneration === spawn && this.launchFenceEpoch === fence && this.pauseWakeState === phase
|
|
13738
|
+
&& !this.startupAborted && !this.deliveryWritesStopping && !this.runtimeMonitorsFrozen && !this.healthCheckPaused;
|
|
13739
|
+
const current = () => baseCurrent() && this.launchAttempt === attempt;
|
|
13740
|
+
const failed = () => new Error(t("inst.cli_repair_failed"));
|
|
13741
|
+
try {
|
|
13742
|
+
// Read the newly resolved install, not a cached old prefix or the running image.
|
|
13743
|
+
const path = await this.resolveClaudeInstallPath();
|
|
13744
|
+
if (!current())
|
|
13745
|
+
return;
|
|
13746
|
+
const version = path ? await this.installedClaudeVersion(path) : null;
|
|
13747
|
+
if (!current())
|
|
13748
|
+
return;
|
|
13749
|
+
if (!version || cliVersionBelow(version, minimum.required)) {
|
|
13750
|
+
if (!this.modelMinimumUpdateNotified) {
|
|
13751
|
+
this.modelMinimumUpdateNotified = true;
|
|
13752
|
+
this.logger.warn({ required: minimum.required, installed: version }, "Claude Code needs an update for this model");
|
|
13753
|
+
this.emit("backend_launch_warning", { name: this.name, message: t("inst.cli_update_needed", minimum.required) });
|
|
13754
|
+
}
|
|
13755
|
+
return;
|
|
13756
|
+
}
|
|
13757
|
+
await this.paneWriteLock.run(async () => {
|
|
13758
|
+
if (!current())
|
|
13759
|
+
return;
|
|
13760
|
+
if (!await this.isPaneAuthoritativelyIdle())
|
|
13761
|
+
throw failed();
|
|
13762
|
+
if (!current())
|
|
13763
|
+
return;
|
|
13764
|
+
// Claim before yielding the write lock; queued delivery remains held until readiness settles.
|
|
13765
|
+
this.modelMinimumRepairUsed = true;
|
|
13766
|
+
this.beginSpawn();
|
|
13767
|
+
claimed = true;
|
|
13768
|
+
spawn = this.spawnGeneration;
|
|
13769
|
+
});
|
|
13770
|
+
if (!claimed || !current())
|
|
13771
|
+
return;
|
|
13772
|
+
await this.checkpointSessionId();
|
|
13773
|
+
if (!current())
|
|
13774
|
+
return;
|
|
13775
|
+
let session;
|
|
13776
|
+
if (!this.skipResume) {
|
|
13777
|
+
try {
|
|
13778
|
+
const value = readFileSync(join(this.instanceDir, "session-id"), "utf8").trim();
|
|
13779
|
+
if (/^[a-f0-9]{8}-(?:[a-f0-9]{4}-){3}[a-f0-9]{12}$/i.test(value))
|
|
13780
|
+
session = value;
|
|
13781
|
+
}
|
|
13782
|
+
catch { /* Unknown is not permission to select another conversation. */ }
|
|
13783
|
+
}
|
|
13784
|
+
if (!session)
|
|
13785
|
+
throw failed();
|
|
13786
|
+
// Recheck disk evidence after checkpointing; an update may have changed it while we waited.
|
|
13787
|
+
const finalVersion = await this.installedClaudeVersion(path);
|
|
13788
|
+
if (!current())
|
|
13789
|
+
return;
|
|
13790
|
+
if (!finalVersion || cliVersionBelow(finalVersion, minimum.required))
|
|
13791
|
+
throw failed();
|
|
13792
|
+
if (!await this.isPaneAuthoritativelyIdle())
|
|
13793
|
+
throw failed();
|
|
13794
|
+
if (!current())
|
|
13795
|
+
return;
|
|
13796
|
+
this.logger.warn({ running: minimum.running, required: minimum.required, installed: finalVersion }, "Claude model-version refusal — attempting one same-session restart");
|
|
13797
|
+
backend.refreshLaunchBinary(path);
|
|
13798
|
+
this.cliRepairSessionId = session;
|
|
13799
|
+
const ready = await this.trySpawn(true, this.startupBudgetFor(true), next => baseCurrent() && this.launchAttempt === next && next >= attempt && next <= attempt + 1);
|
|
13800
|
+
this.cliRepairSessionId = undefined;
|
|
13801
|
+
if (!baseCurrent() || this.launchAttempt !== attempt + 1)
|
|
13802
|
+
return;
|
|
13803
|
+
if (!ready)
|
|
13804
|
+
throw failed();
|
|
13805
|
+
this.logger.info("Claude model-version restart completed; session retained");
|
|
13806
|
+
this.emit("backend_launch_warning", { name: this.name, message: t("inst.cli_repaired") });
|
|
13807
|
+
}
|
|
13808
|
+
catch (error) {
|
|
13809
|
+
if (!baseCurrent() || this.launchAttempt > attempt + 1)
|
|
13810
|
+
return;
|
|
13811
|
+
this.modelMinimumBlocked = true;
|
|
13812
|
+
this.healthCheckPaused = true;
|
|
13813
|
+
this.logger.error({ reason: error instanceof Error ? error.message : String(error) }, "Claude model-version repair held; no automatic retry");
|
|
13814
|
+
this.emit("backend_launch_warning", { name: this.name, message: t("inst.cli_repair_failed") });
|
|
13815
|
+
}
|
|
13816
|
+
finally {
|
|
13817
|
+
this.cliRepairSessionId = undefined;
|
|
13818
|
+
if (claimed)
|
|
13819
|
+
this.endSpawn();
|
|
13820
|
+
}
|
|
13821
|
+
}
|
|
13678
13822
|
/**
|
|
13679
13823
|
* One fresh pane capture judged as ready && !busy && !dialog. Transcript
|
|
13680
13824
|
* silence is deliberately NOT the gate: its monitor is inert for muse, so a
|
|
@@ -13873,11 +14017,14 @@ export class Daemon extends EventEmitter {
|
|
|
13873
14017
|
this.logger.debug({ err }, "what's-new not prepared");
|
|
13874
14018
|
}
|
|
13875
14019
|
}
|
|
13876
|
-
async trySpawnInsideGate(reuseWindow = false, startupTimeoutMs) {
|
|
14020
|
+
async trySpawnInsideGate(reuseWindow = false, startupTimeoutMs, repairAdmission) {
|
|
13877
14021
|
if (this.nativePaneLifecycle)
|
|
13878
14022
|
throw Error("Native relaunch requires its owned exit and a new lifecycle reservation");
|
|
14023
|
+
let expectedAttempt = this.launchAttempt;
|
|
14024
|
+
const admit = () => { this.startupAdmission?.(); if (repairAdmission && !repairAdmission(expectedAttempt))
|
|
14025
|
+
throw new Error("CLI repair superseded by another launch, pause or stop"); };
|
|
13879
14026
|
this.assertSessionOomAdmission();
|
|
13880
|
-
|
|
14027
|
+
admit();
|
|
13881
14028
|
const launchFence = this.launchFenceEpoch;
|
|
13882
14029
|
const backendConfig = this.buildBackendConfig();
|
|
13883
14030
|
// A compatibility refusal is not a failed resume: no configuration, pin, history or pane may change.
|
|
@@ -13903,7 +14050,7 @@ export class Daemon extends EventEmitter {
|
|
|
13903
14050
|
catch { /* unknown capability → the backend's conservative form */ }
|
|
13904
14051
|
// Thrown, not `false`: a false verdict reads as "the CLI failed to start" and sends the startup path
|
|
13905
14052
|
// into its resume-retry / set-the-session-aside handling, for an instance somebody just stopped.
|
|
13906
|
-
|
|
14053
|
+
admit();
|
|
13907
14054
|
this.assertSessionOomAdmission();
|
|
13908
14055
|
if (launchFence !== this.launchFenceEpoch)
|
|
13909
14056
|
throw new Error("Launch cancelled: the instance was stopped or paused while the launch was being prepared");
|
|
@@ -13962,13 +14109,14 @@ export class Daemon extends EventEmitter {
|
|
|
13962
14109
|
// The CLI's own shell sets a zero coredump_filter first (#1113): this pane
|
|
13963
14110
|
// may belong to a tmux server the fleet did not start, which would hand
|
|
13964
14111
|
// the CLI its own (full) filter instead of the fleet's.
|
|
13965
|
-
|
|
14112
|
+
admit();
|
|
13966
14113
|
const cmd = coredumpFilterLaunchPrefix() + `${envPrefix} ` + this.backend.buildCommand(launchConfig);
|
|
13967
14114
|
// Every launched command re-arms the passive-transient check, including a
|
|
13968
14115
|
// retry inside the same spawn: its load is a new one.
|
|
13969
|
-
this.launchAttempt
|
|
14116
|
+
expectedAttempt = ++this.launchAttempt;
|
|
14117
|
+
admit();
|
|
13970
14118
|
await this.prepareQuotaReplayHistory(reuseWindow);
|
|
13971
|
-
|
|
14119
|
+
admit();
|
|
13972
14120
|
this.interactionObservation.reset(this.interactionOwner());
|
|
13973
14121
|
this.clearInteractionConfirmation();
|
|
13974
14122
|
// A launch that cannot paint a passive transient (Codex: a fresh start
|
|
@@ -13992,12 +14140,12 @@ export class Daemon extends EventEmitter {
|
|
|
13992
14140
|
if (this.stormWindow?.observeServerAlive(await this.paneHost.getServerPid(this.tmuxSessionName))) {
|
|
13993
14141
|
this.emit("tmux_server_crash", this.name);
|
|
13994
14142
|
}
|
|
13995
|
-
|
|
14143
|
+
admit();
|
|
13996
14144
|
let windowId;
|
|
13997
14145
|
this.assertSessionOomAdmission();
|
|
13998
14146
|
if (reuseWindow) {
|
|
13999
14147
|
this.controlClient?.unregisterWindow(this.tmux.getWindowId());
|
|
14000
|
-
await this.tmux.respawnWindow(cmd, resolvedCwd);
|
|
14148
|
+
await this.tmux.respawnWindow(cmd, resolvedCwd, repairAdmission ? admit : undefined);
|
|
14001
14149
|
windowId = this.tmux.getWindowId();
|
|
14002
14150
|
}
|
|
14003
14151
|
else {
|
|
@@ -14008,7 +14156,7 @@ export class Daemon extends EventEmitter {
|
|
|
14008
14156
|
if (retired && retired !== windowId)
|
|
14009
14157
|
this.controlClient?.unregisterWindow(retired);
|
|
14010
14158
|
}
|
|
14011
|
-
|
|
14159
|
+
admit();
|
|
14012
14160
|
this.writeWindowId(windowId);
|
|
14013
14161
|
// Enable remain-on-exit to capture exit codes on crash
|
|
14014
14162
|
await this.tmux.setRemainOnExit().catch(err => {
|
|
@@ -14043,6 +14191,7 @@ export class Daemon extends EventEmitter {
|
|
|
14043
14191
|
else {
|
|
14044
14192
|
await new Promise(r => setTimeout(r, 10_000));
|
|
14045
14193
|
}
|
|
14194
|
+
admit();
|
|
14046
14195
|
// Dismiss confirmation dialogs and verify CLI reached prompt.
|
|
14047
14196
|
// With remain-on-exit, isWindowAlive() returns true even for dead panes,
|
|
14048
14197
|
// but a startup crash would already be caught by waitForOutput/waitForIdle above.
|