@songsid/agend 2.3.5-alpha.7 → 2.3.5-alpha.8
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 +33 -6
- package/dist/accounts-view.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/build-provenance.json +1 -1
- package/dist/config-validator.js +2 -1
- package/dist/config-validator.js.map +1 -1
- package/dist/fleet-manager.d.ts +25 -2
- package/dist/fleet-manager.js +158 -23
- package/dist/fleet-manager.js.map +1 -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 +2 -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 +7 -0
- package/dist/hub/compose/server.js +47 -6
- package/dist/hub/compose/server.js.map +1 -1
- 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 +17 -0
- package/dist/hub/group-policy/authorization.js +123 -1
- 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 +128 -6
- package/dist/hub/http/compose.js.map +1 -1
- package/dist/hub/http/deps.d.ts +7 -0
- package/dist/hub/member/pairing-api.d.ts +2 -0
- package/dist/hub/member/pairing-api.js +1 -0
- 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 +58 -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 +241 -0
- package/dist/hub/pairing-notices.js.map +1 -0
- package/dist/hub/pairing.d.ts +33 -1
- package/dist/hub/pairing.js +315 -15
- package/dist/hub/pairing.js.map +1 -1
- package/dist/hub/protocol.d.ts +32 -0
- package/dist/hub/protocol.js +6 -1
- package/dist/hub/protocol.js.map +1 -1
- package/dist/hub/runtime.d.ts +4 -1
- package/dist/hub/runtime.js +11 -0
- package/dist/hub/runtime.js.map +1 -1
- package/dist/hub/server.js +4 -0
- package/dist/hub/server.js.map +1 -1
- package/dist/hub/store.d.ts +10 -1
- package/dist/hub/store.js +7 -4
- package/dist/hub/store.js.map +1 -1
- package/dist/hub/types.d.ts +13 -2
- package/dist/locale.js +22 -16
- 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/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/settings-api.d.ts +2 -1
- package/dist/settings-api.js +4 -3
- package/dist/settings-api.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/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 +10 -1
- package/dist/ui/hub-client.js +43 -3
- package/dist/ui/hub-group-policy.js +170 -0
- package/dist/ui/hub-group-strings.js +97 -0
- package/dist/ui/hub-owner-strings.js +4 -4
- package/dist/ui/hub-pairing-progress-strings.js +15 -0
- package/dist/ui/hub-quick-pairing.js +202 -0
- package/dist/ui/hub-quick-strings.js +43 -0
- package/dist/ui/hub-read-strings.js +7 -0
- package/dist/ui/hub-welcome.js +99 -0
- package/dist/ui/panel-hub.js +47 -10
- 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-membership.js +18 -4
- package/dist/ui/settings-hub-section.js +26 -1
- package/dist/ui/settings-hub.js +52 -11
- 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 +3 -0
- package/dist/ui/shared/app-shell.js +18 -8
- package/dist/ui/shared/hub-groups.css +26 -0
- package/dist/ui/shared/hub.css +1 -0
- 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/update-marker.d.ts +2 -0
- package/dist/update-marker.js.map +1 -1
- package/dist/web-api.d.ts +5 -1
- package/dist/web-api.js +25 -5
- 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/fleet-manager.js
CHANGED
|
@@ -359,7 +359,7 @@ import { kiroHome } from "./backend/kiro-kas-store.js";
|
|
|
359
359
|
import { CHAT_PROFILE_LOGIN_BACKENDS, credentialHomeSpec, credentialProfileHome, credentialProfileEnv, credentialProfileLogin, credentialProfileLoginCommand, credentialProfileStoreHome, credentialSwitchCarriesConversation, credentialSwitchStartsFresh, instanceCredentialProfile, listConfiguredProfiles, resolveCredentialProfile } from "./backend/credential-profile.js";
|
|
360
360
|
import { carryClaudeConversation } from "./backend/claude-carry.js";
|
|
361
361
|
import { classicProfile, mergeBackendOptions, profileKey, profileName, profileOf, readClassicBindings, readClassicBindingsStrict } from "./classic-bindings.js";
|
|
362
|
-
import { ACCOUNT_CLIS, PROFILE_CLIS, buildAccountsView, profilesOnDisk, weeklyUsage } from "./accounts-view.js";
|
|
362
|
+
import { ACCOUNT_CLIS, PROFILE_CLIS, buildAccountsView, profilesOnDisk, shortUsage, weeklyUsage } from "./accounts-view.js";
|
|
363
363
|
import { addAccountProfile, removeAccountProfile } from "./accounts-profiles.js";
|
|
364
364
|
import { signOutAccount } from "./accounts-signout.js";
|
|
365
365
|
import { MachineAccounts, machineAgents } from "./machine-accounts.js";
|
|
@@ -521,6 +521,11 @@ const CANCEL_BTN_MAX_LIFETIME_MS = 24 * 60 * 60_000;
|
|
|
521
521
|
const STALE_CANCEL_CLICK_COOLDOWN_MS = 10_000;
|
|
522
522
|
/** Orphaned-button ledger, swept at startup. Lives in the fleet data dir. */
|
|
523
523
|
const CANCEL_BTN_LEDGER_FILE = "cancel-buttons.json";
|
|
524
|
+
/**
|
|
525
|
+
* S-92: the restart marker's target for a web-only fleet's Settings restart (no chat message carries its progress). It is
|
|
526
|
+
* known by its `surface: "web"` (#3373 review P3: never by this id, which a chat connection could also be called).
|
|
527
|
+
*/
|
|
528
|
+
const WEB_RESTART_TARGET = "web-settings";
|
|
524
529
|
/**
|
|
525
530
|
* How often the cancel button's text is refreshed with elapsed working time.
|
|
526
531
|
*
|
|
@@ -1317,6 +1322,7 @@ export class FleetManager {
|
|
|
1317
1322
|
attachHubMemberExposures(api) { this.hubMemberExposureApi = api; }
|
|
1318
1323
|
/** S3c PR B: the member's pairing API, attached by S5's member composition (null: no Hub member here). */
|
|
1319
1324
|
hubMemberPairingApi = null;
|
|
1325
|
+
hubPairingNotices = null;
|
|
1320
1326
|
hubMemberPairing() { return this.hubMemberPairingApi; }
|
|
1321
1327
|
attachHubMemberPairing(api) { this.hubMemberPairingApi = api; }
|
|
1322
1328
|
generalLocationFlights = new Map();
|
|
@@ -1828,6 +1834,7 @@ export class FleetManager {
|
|
|
1828
1834
|
},
|
|
1829
1835
|
attachExposures: api => this.attachHubMemberExposures(api),
|
|
1830
1836
|
attachAttention: read => this.attachHubExecutionAttention(read),
|
|
1837
|
+
attachPairingNotices: read => { this.hubPairingNotices = read; },
|
|
1831
1838
|
pokeAttention: () => this.needsYou?.poke(),
|
|
1832
1839
|
linkState: state => { this.hubMemberLink = state; },
|
|
1833
1840
|
},
|
|
@@ -1858,6 +1865,7 @@ export class FleetManager {
|
|
|
1858
1865
|
this.hubMemberBinding = currentBinding;
|
|
1859
1866
|
this.attachHubMemberPairing(createHubMemberPairingApi({
|
|
1860
1867
|
home: this.dataDir,
|
|
1868
|
+
notices: () => this.hubPairingNotices?.() ?? [],
|
|
1861
1869
|
enabled: () => this.rawFleetConfig?.hub_member?.enabled === true,
|
|
1862
1870
|
link: () => (this.hubMemberLink === "online" ? "online" : "offline"),
|
|
1863
1871
|
hold: () => (this.hubMemberLink === "revoked" ? "revoked" : null),
|
|
@@ -2132,6 +2140,8 @@ export class FleetManager {
|
|
|
2132
2140
|
}
|
|
2133
2141
|
hubBrowserCertificate() { return this.hubRuntime?.browserCertificateSettings() ?? null; }
|
|
2134
2142
|
hubRetention() { return this.hubRuntime?.retentionSettings() ?? null; }
|
|
2143
|
+
/** #3298 S-89: this fleet's own Hub offers group permissions (the page mark that shows Settings → Hub's Group permissions row). */
|
|
2144
|
+
hubGroupPermissions() { return this.hubRuntime?.groupPermissionsAvailable() ?? false; }
|
|
2135
2145
|
observeRuntimeSwitches() {
|
|
2136
2146
|
setConfiguredRuntimeSwitches(this.fleetConfig?.runtimes);
|
|
2137
2147
|
if (!this.runtimeEffects || this.runtimeEffectsScheduled)
|
|
@@ -10110,35 +10120,64 @@ export class FleetManager {
|
|
|
10110
10120
|
...(threadId ? { threadId } : {}),
|
|
10111
10121
|
messageId,
|
|
10112
10122
|
};
|
|
10123
|
+
return this.launchTrackedFullRestart(target, text => this.reportFullRestartFailure(adapter, chatId, threadId, messageId, text), () => this.startUpdateProgressMonitor(adapter));
|
|
10124
|
+
}
|
|
10125
|
+
/**
|
|
10126
|
+
* S-92: the same tracked reload for a web-only fleet's Settings restart — no chat message to carry its progress: the
|
|
10127
|
+
* marker names the web (WEB_RESTART_TARGET), a refusal is a fleet Notice, and the next fleet says it is back as one.
|
|
10128
|
+
*/
|
|
10129
|
+
async requestWebFullRestart(onLateFailure) {
|
|
10130
|
+
const target = { surface: "web", adapterId: WEB_RESTART_TARGET, chatId: WEB_RESTART_TARGET, messageId: `settings-${Date.now()}` };
|
|
10131
|
+
const say = async (text) => { this.recordWebNotice("fleet", text); };
|
|
10132
|
+
// No progress monitor reads the marker for the web: a helper that fails after its launch is said here, and settled.
|
|
10133
|
+
return this.launchTrackedFullRestart(target, say, null, (detail) => {
|
|
10134
|
+
void say(t("restart.full_launch_failed"));
|
|
10135
|
+
onLateFailure?.(detail);
|
|
10136
|
+
});
|
|
10137
|
+
}
|
|
10138
|
+
/**
|
|
10139
|
+
* S-92: a fleet (with no chat connection) that comes up from a web-only Settings restart says it is back as a fleet
|
|
10140
|
+
* Notice — the restart was announced as one. Anything else (a chat restart, an update, a plain boot): nothing here.
|
|
10141
|
+
*/
|
|
10142
|
+
async announceWebRestartDone(pending) {
|
|
10143
|
+
if (!pending || updateProgressOperation(pending.progress) !== "full-restart" || pending.progress.target.surface !== "web")
|
|
10144
|
+
return false;
|
|
10145
|
+
const { createRequire } = await import("node:module");
|
|
10146
|
+
const version = createRequire(import.meta.url)("../package.json").version ?? "unknown";
|
|
10147
|
+
return this.recordWebNotice("fleet", t("restart.settings_done", version));
|
|
10148
|
+
}
|
|
10149
|
+
async launchTrackedFullRestart(target, fail, startMonitor,
|
|
10150
|
+
/** After the launch: the helper failed before the hand-off (with no progress monitor to say so). */
|
|
10151
|
+
lateFailure) {
|
|
10113
10152
|
// This check is synchronous with the marker write below. A second command
|
|
10114
10153
|
// cannot slip through between them on Node's event loop and replace the
|
|
10115
10154
|
// first command's delivery target or launch a competing restart helper.
|
|
10116
10155
|
if (this.shuttingDown || isUpdateInProgress(this.dataDir)) {
|
|
10117
|
-
this.logger.warn({ adapterId:
|
|
10118
|
-
await
|
|
10156
|
+
this.logger.warn({ adapterId: target.adapterId }, "Full restart refused because another planned restart is active");
|
|
10157
|
+
await fail(t("restart.full_busy"));
|
|
10119
10158
|
return false;
|
|
10120
10159
|
}
|
|
10121
10160
|
if (!persistFullRestartProgress(this.dataDir, target)) {
|
|
10122
|
-
this.logger.error({ adapterId:
|
|
10123
|
-
await
|
|
10161
|
+
this.logger.error({ adapterId: target.adapterId }, "Full restart marker could not be persisted — reload refused");
|
|
10162
|
+
await fail(t("restart.full_launch_failed"));
|
|
10124
10163
|
return false;
|
|
10125
10164
|
}
|
|
10126
10165
|
const ownedMarker = readUpdateProgress(this.dataDir);
|
|
10127
10166
|
if (!ownedMarker) {
|
|
10128
|
-
this.logger.error({ adapterId:
|
|
10129
|
-
await
|
|
10167
|
+
this.logger.error({ adapterId: target.adapterId }, "Full restart marker disappeared after persistence — reload refused");
|
|
10168
|
+
await fail(t("restart.full_launch_failed"));
|
|
10130
10169
|
return false;
|
|
10131
10170
|
}
|
|
10132
10171
|
this.lastUpdateProgressText = null;
|
|
10133
|
-
|
|
10172
|
+
startMonitor?.();
|
|
10134
10173
|
await this.waitForFullRestartIdleGrace();
|
|
10135
10174
|
// An update can begin while the idle wait yields. Never launch a second
|
|
10136
10175
|
// process replacement against a marker we no longer own.
|
|
10137
10176
|
if (this.shuttingDown || !this.isOwnedFullRestartMarker(ownedMarker.startedAt, target)) {
|
|
10138
|
-
this.logger.warn({ adapterId:
|
|
10177
|
+
this.logger.warn({ adapterId: target.adapterId }, "Full restart superseded during idle wait — reload refused");
|
|
10139
10178
|
if (this.isOwnedFullRestartMarker(ownedMarker.startedAt, target))
|
|
10140
10179
|
clearUpdateMarker(this.dataDir);
|
|
10141
|
-
await
|
|
10180
|
+
await fail(t("restart.full_busy"));
|
|
10142
10181
|
return false;
|
|
10143
10182
|
}
|
|
10144
10183
|
let helper;
|
|
@@ -10149,7 +10188,7 @@ export class FleetManager {
|
|
|
10149
10188
|
this.logger.error({ err }, "Full restart helper failed to spawn — reload refused");
|
|
10150
10189
|
if (this.isOwnedFullRestartMarker(ownedMarker.startedAt, target))
|
|
10151
10190
|
clearUpdateMarker(this.dataDir);
|
|
10152
|
-
await
|
|
10191
|
+
await fail(t("restart.full_launch_failed"));
|
|
10153
10192
|
return false;
|
|
10154
10193
|
}
|
|
10155
10194
|
void helper.completion.then(result => {
|
|
@@ -10167,6 +10206,7 @@ export class FleetManager {
|
|
|
10167
10206
|
: `reload helper exited before process hand-off (code ${result.code ?? "null"}, signal ${result.signal ?? "none"})`;
|
|
10168
10207
|
this.logger.error({ result }, "Full restart helper exited before the fleet began shutting down");
|
|
10169
10208
|
setUpdateProgressStage(this.dataDir, "failed", { error: detail });
|
|
10209
|
+
lateFailure?.(detail);
|
|
10170
10210
|
});
|
|
10171
10211
|
return true;
|
|
10172
10212
|
}
|
|
@@ -10889,7 +10929,7 @@ export class FleetManager {
|
|
|
10889
10929
|
this.reportClassicUnrecoverableIds();
|
|
10890
10930
|
})();
|
|
10891
10931
|
progressStart = adapterStartup.then(() => {
|
|
10892
|
-
if (pendingUpdateProgress) {
|
|
10932
|
+
if (pendingUpdateProgress && pendingUpdateProgress.progress.target.surface !== "web") {
|
|
10893
10933
|
const saved = pendingUpdateProgress.progress.target;
|
|
10894
10934
|
const target = {
|
|
10895
10935
|
adapter: this.adapters.get(saved.adapterId),
|
|
@@ -11073,6 +11113,9 @@ export class FleetManager {
|
|
|
11073
11113
|
// #named-link-ttl: a named link with auto_open comes back now — after the web listener and the chat connections.
|
|
11074
11114
|
this.startPublicLinkAutoOpen();
|
|
11075
11115
|
}
|
|
11116
|
+
else {
|
|
11117
|
+
await this.announceWebRestartDone(pendingUpdateProgress);
|
|
11118
|
+
}
|
|
11076
11119
|
// #3008: connections from outside were on when the fleet stopped: the link opens again (its address is new for a
|
|
11077
11120
|
// quick link — Settings shows it on this computer).
|
|
11078
11121
|
if (this.outsideOn())
|
|
@@ -17331,6 +17374,17 @@ export class FleetManager {
|
|
|
17331
17374
|
this.emitSseEvent("notice", { notice, unread: store.unread() });
|
|
17332
17375
|
return true;
|
|
17333
17376
|
}
|
|
17377
|
+
/** #3373 review P2: recordWebNotice for a notice that must be on disk first — true only once it was written. */
|
|
17378
|
+
recordWebNoticeDurable(kind, text) {
|
|
17379
|
+
if (!this.webOnlyPromptPlace())
|
|
17380
|
+
return false;
|
|
17381
|
+
const store = this.webNoticeStore();
|
|
17382
|
+
const notice = store?.addDurable({ kind, text: stripPlaceRefs(text) }) ?? null;
|
|
17383
|
+
if (!notice)
|
|
17384
|
+
return false;
|
|
17385
|
+
this.emitSseEvent("notice", { notice, unread: store.unread() });
|
|
17386
|
+
return true;
|
|
17387
|
+
}
|
|
17334
17388
|
static FLEET_ERROR_THROTTLE_MS = 10 * 60_000;
|
|
17335
17389
|
fleetErrorNotices = new Map();
|
|
17336
17390
|
/**
|
|
@@ -20742,8 +20796,10 @@ export class FleetManager {
|
|
|
20742
20796
|
}
|
|
20743
20797
|
catch { /* safe metadata only */ }
|
|
20744
20798
|
broadcastSseEvent(this.sseClients, "backend_login", {}, err => this.logger.debug({ err }, "backend_login event failed"));
|
|
20745
|
-
if (event.phase === "done")
|
|
20799
|
+
if (event.phase === "done") {
|
|
20746
20800
|
this.forgetSignInIdentities(); // a sign-in may be a different account now
|
|
20801
|
+
this.keepAliveAfterSignIn(event.backend, null); // its file changed, whoever is watching: a "needs sign-in" left from before is no longer the answer
|
|
20802
|
+
}
|
|
20747
20803
|
this.needsYou?.poke();
|
|
20748
20804
|
if (!this.browserSignInOwnerCurrent(owner))
|
|
20749
20805
|
return;
|
|
@@ -20778,7 +20834,7 @@ export class FleetManager {
|
|
|
20778
20834
|
start: (backend, chat, opts) => this.startWebDashboardLogin(backend, chat, opts),
|
|
20779
20835
|
accessToken: sink => this.loginController?.webAccessToken(sink) ?? null,
|
|
20780
20836
|
isActiveFor: sink => this.loginController?.isActiveFor(sink) ?? false,
|
|
20781
|
-
cancelFor: sink => this.loginController?.cancelFor(sink) ?? Promise.resolve(false),
|
|
20837
|
+
cancelFor: (sink, opts) => this.loginController?.cancelFor(sink, opts) ?? Promise.resolve(false),
|
|
20782
20838
|
cancel: () => this.cancelLoginSession(),
|
|
20783
20839
|
notice: ({ shown, label, handle }) => this.notifyFleetError(t("login.web_dashboard_notice", shown, label, handle.slice(0, 8))),
|
|
20784
20840
|
// No details in the event: each page reads its own view (GET /ui/backend-login), as its session may see it.
|
|
@@ -20891,8 +20947,9 @@ export class FleetManager {
|
|
|
20891
20947
|
diskProfiles.set(backend, rows);
|
|
20892
20948
|
}
|
|
20893
20949
|
const { agents, classic, fleetDefaults } = this.accountUses();
|
|
20894
|
-
// Weekly usage, from the usage panel's own (cached, never forced) read.
|
|
20950
|
+
// Weekly and short-window (5h) usage, from the usage panel's own (cached, never forced) read.
|
|
20895
20951
|
const usage = new Map();
|
|
20952
|
+
const shortWindow = new Map();
|
|
20896
20953
|
const ids = new Map(); // provider id → backend\0profile
|
|
20897
20954
|
for (const backend of ACCOUNT_CLIS) {
|
|
20898
20955
|
const pid = usageProviderIdForBackend(backend);
|
|
@@ -20906,9 +20963,14 @@ export class FleetManager {
|
|
|
20906
20963
|
const payload = await Promise.race([getUsageSnapshot(false, undefined, { allowStale: true }), new Promise(r => { const tm = setTimeout(() => r(null), usageWaitMs); tm.unref?.(); })]);
|
|
20907
20964
|
for (const provider of payload?.providers ?? []) {
|
|
20908
20965
|
const at = ids.get(provider.id);
|
|
20909
|
-
|
|
20910
|
-
|
|
20966
|
+
if (!at)
|
|
20967
|
+
continue;
|
|
20968
|
+
const w = weeklyUsage(provider);
|
|
20969
|
+
if (w)
|
|
20911
20970
|
usage.set(at, w);
|
|
20971
|
+
const sh = shortUsage(provider);
|
|
20972
|
+
if (sh)
|
|
20973
|
+
shortWindow.set(at, sh);
|
|
20912
20974
|
}
|
|
20913
20975
|
}
|
|
20914
20976
|
catch { /* the view without usage */ }
|
|
@@ -20935,7 +20997,26 @@ export class FleetManager {
|
|
|
20935
20997
|
this.logger.debug({ err: err.message }, "Computer accounts not read");
|
|
20936
20998
|
}
|
|
20937
20999
|
}
|
|
20938
|
-
return buildAccountsView({ targets, diskProfiles, agents, classic, fleetDefaults, usage, keepAlive, machines });
|
|
21000
|
+
return buildAccountsView({ targets, diskProfiles, agents, classic, fleetDefaults, usage, shortUsage: shortWindow, keepAlive, machines });
|
|
21001
|
+
}
|
|
21002
|
+
/**
|
|
21003
|
+
* A sign-in just finished for this account: look at its Keep sign-in alive setting once now (when it is on), so what the Accounts row says about
|
|
21004
|
+
* "the last check" is not the one from before the sign-in. Never awaited, and never allowed to fail the sign-in's own follow-up.
|
|
21005
|
+
*/
|
|
21006
|
+
keepAliveAfterSignIn(backend, profile) {
|
|
21007
|
+
if (!isKeepAliveBackend(backend))
|
|
21008
|
+
return;
|
|
21009
|
+
// Building the service can throw as well as the check, and the follow-up of a sign-in (waking its agents) must not depend on either.
|
|
21010
|
+
const failed = (err) => { try {
|
|
21011
|
+
this.logger.debug({ err: String(err?.message ?? err), backend }, "Keep-alive check after a sign-in failed");
|
|
21012
|
+
}
|
|
21013
|
+
catch { /* nothing to say it to */ } };
|
|
21014
|
+
try {
|
|
21015
|
+
this.keepAliveService().tick({ only: { backend, profile } }).catch(failed);
|
|
21016
|
+
}
|
|
21017
|
+
catch (err) {
|
|
21018
|
+
failed(err);
|
|
21019
|
+
}
|
|
20939
21020
|
}
|
|
20940
21021
|
/** #3292: the keep-alive service (built on first use, so the Accounts view can read settings before startup finishes). */
|
|
20941
21022
|
keepAliveService() {
|
|
@@ -21179,11 +21260,16 @@ export class FleetManager {
|
|
|
21179
21260
|
* or the login window held for this backend by a sign-in whose profile is not known yet); see accounts-profiles.ts.
|
|
21180
21261
|
* The fleet log records who removed which backend's profile — never what was in it.
|
|
21181
21262
|
*/
|
|
21182
|
-
async removeAccountProfile(backend, name, confirm, by, machine) {
|
|
21263
|
+
async removeAccountProfile(backend, name, confirm, by, machine, opts) {
|
|
21183
21264
|
if (machine)
|
|
21184
21265
|
return this.machineAccounts.remove(backend, name, confirm, machine.id, machine, by); // #3190 Part 3c: that computer's Runtime deletes its own folder
|
|
21185
21266
|
const profile = typeof name === "string" ? name : "";
|
|
21186
21267
|
const shown = validCredentialProfileName(name) ? name : "(invalid)";
|
|
21268
|
+
// #3321 review ("Cancel sign-in and remove"): the sign-in of exactly this account is ended first — no other account's, and a start whose profile is
|
|
21269
|
+
// not known yet is not guessed at — and every Remove check below is then made as usual: what is still signing in refuses (`signing_in`).
|
|
21270
|
+
if (opts?.cancelSignIn && validCredentialProfileName(name) && await this.loginController?.cancelAccount(backend, name).catch(() => false)) {
|
|
21271
|
+
this.logger.info({ backend, profile: shown, by }, "Sign-in cancelled for Remove");
|
|
21272
|
+
}
|
|
21187
21273
|
const refused = (r) => { if (!r.ok)
|
|
21188
21274
|
this.logger.info({ backend, profile: shown, by, refused: r.error }, "Credential profile removal refused"); return r; };
|
|
21189
21275
|
// #3212 PR 3: on macOS, Claude Code keeps the account's token in the Keychain, outside the folder — its own logout
|
|
@@ -21766,6 +21852,7 @@ export class FleetManager {
|
|
|
21766
21852
|
async recoverBackendInstances(backend, deadlineMs = POST_LOGIN_RECOVERY_DEADLINE_MS,
|
|
21767
21853
|
/** #1699 part 2: the login just signed in — a profile, or null for the backend's default one. */
|
|
21768
21854
|
profile = null) {
|
|
21855
|
+
this.keepAliveAfterSignIn(backend, profile ?? null);
|
|
21769
21856
|
const woken = [];
|
|
21770
21857
|
const restarted = [];
|
|
21771
21858
|
const pending = [];
|
|
@@ -26193,7 +26280,7 @@ export class FleetManager {
|
|
|
26193
26280
|
* audit notice — and only once all of that holds is the attempt written to
|
|
26194
26281
|
* disk and fsynced, before anything spawns.
|
|
26195
26282
|
*/
|
|
26196
|
-
async requestSettingsSelfRestart(
|
|
26283
|
+
async requestSettingsSelfRestart(requestedJobId, key) {
|
|
26197
26284
|
// A retry after a lost response must not restart a second time. The key is
|
|
26198
26285
|
// recorded on the job, which survives the restart it triggers.
|
|
26199
26286
|
const already = this.applyJobs.findByRestartKey(key);
|
|
@@ -26210,6 +26297,31 @@ export class FleetManager {
|
|
|
26210
26297
|
error: `fleet.yaml and the running configuration disagree on ${this.fleetSignatureMismatch.join(", ")} — check daemon.log before restarting`,
|
|
26211
26298
|
};
|
|
26212
26299
|
}
|
|
26300
|
+
// S-92 (#3326 D1): a restart asked for the pending changes themselves (`requestedJobId` null) — the restart notice
|
|
26301
|
+
// with no Settings job behind it (a hand edit of fleet.yaml). Only when a fleet-level restart is pending
|
|
26302
|
+
// (settingsRestartPending, the notice's own test): its newest job carries it, else one is made here to carry it, once
|
|
26303
|
+
// (the next ask finds that one). Everything below is the same path as a Save's restart.
|
|
26304
|
+
let jobId = requestedJobId;
|
|
26305
|
+
if (jobId === null) {
|
|
26306
|
+
// One already asked for is in flight (its row "running"): never a second job, nor a second restart.
|
|
26307
|
+
// #3373 review P2: a consumed restart job (and its row) runs until the next process settles it (settleAfterRestart)
|
|
26308
|
+
// or its launch fails (finish) — so this sees only a restart still in flight, never an old one.
|
|
26309
|
+
if (this.applyJobs.all().some(item => item.restart_key && item.targets.some(r => r.target === APPLY_FLEET_TARGET && r.status === "running"))) {
|
|
26310
|
+
return { ok: false, status: 409, error: "a restart is already running" };
|
|
26311
|
+
}
|
|
26312
|
+
const pending = this.settingsRestartPending();
|
|
26313
|
+
if (!pending)
|
|
26314
|
+
return { ok: false, status: 409, error: "no fleet-level change is pending any more" };
|
|
26315
|
+
if (pending.job_id)
|
|
26316
|
+
jobId = pending.job_id;
|
|
26317
|
+
else {
|
|
26318
|
+
const made = this.applyJobs.create(`restart-pending:${key}`, [{ target: APPLY_FLEET_TARGET, kind: "restart" }]);
|
|
26319
|
+
this.applyJobs.setTargetStatus(made.id, APPLY_FLEET_TARGET, "restart-required");
|
|
26320
|
+
this.applyJobs.finish(made.id);
|
|
26321
|
+
this.logger.info({ jobId: made.id, keys: pending.keys }, "Settings restart for pending changes with no Settings job: a job now carries it");
|
|
26322
|
+
jobId = made.id;
|
|
26323
|
+
}
|
|
26324
|
+
}
|
|
26213
26325
|
const job = this.applyJobs.get(jobId);
|
|
26214
26326
|
const row = job?.targets.find(item => item.target === APPLY_FLEET_TARGET);
|
|
26215
26327
|
if (!job || !row || row.status !== "restart-required") {
|
|
@@ -26257,8 +26369,19 @@ export class FleetManager {
|
|
|
26257
26369
|
// the admins are. Refusing when it cannot be posted is the same rule as
|
|
26258
26370
|
// refusing when the progress marker cannot be written: no untraceable
|
|
26259
26371
|
// restarts.
|
|
26260
|
-
|
|
26261
|
-
|
|
26372
|
+
// S-92 (leader's ruling, cid-a6-ui-feedback): a web-only fleet has no General to announce it in — its trace is the
|
|
26373
|
+
// dashboard's own fleet Notice (where its admins are) plus the log line below. Every other guard above and below is
|
|
26374
|
+
// the same. A chat fleet is unchanged: General is the trace.
|
|
26375
|
+
const webOnly = this.isWebOnlyFleet();
|
|
26376
|
+
const notice = webOnly ? null : await this.postSelfRestartNotice();
|
|
26377
|
+
if (webOnly) {
|
|
26378
|
+
if (!this.recordWebNoticeDurable("fleet", t("restart.settings_triggered"))) {
|
|
26379
|
+
this.logger.error({ jobId }, "Could not record the Settings-triggered restart as a fleet Notice — refusing to restart silently");
|
|
26380
|
+
return { ok: false, status: 503, error: "couldn't record the restart; try again" };
|
|
26381
|
+
}
|
|
26382
|
+
this.logger.info({ jobId, trace: "web-notice" }, "Settings-triggered restart announced as a fleet Notice (web-only fleet)");
|
|
26383
|
+
}
|
|
26384
|
+
else if (!notice) {
|
|
26262
26385
|
return {
|
|
26263
26386
|
ok: false,
|
|
26264
26387
|
status: 409,
|
|
@@ -26271,11 +26394,23 @@ export class FleetManager {
|
|
|
26271
26394
|
const target = current.targets.find(item => item.target === APPLY_FLEET_TARGET);
|
|
26272
26395
|
if (target)
|
|
26273
26396
|
target.status = "running";
|
|
26397
|
+
// #3373 review P2: the job runs again while its restart does (its deadline is the restart's): the next process
|
|
26398
|
+
// settles it (settleAfterRestart only touches running jobs), a failed launch finishes it.
|
|
26399
|
+
current.status = "running";
|
|
26400
|
+
delete current.finishedAt;
|
|
26401
|
+
current.restartStartedAt = Date.now(); // its time counts from now, not from the Save (#3373 review P3)
|
|
26274
26402
|
current.restart_key = key;
|
|
26275
26403
|
current.deadlineMs = SELF_RESTART_DEADLINE_MS;
|
|
26276
26404
|
});
|
|
26277
26405
|
this.emitSseEvent("apply_progress", viewOf(this.applyJobs.get(jobId)));
|
|
26278
|
-
|
|
26406
|
+
// #3373 review P2: a web restart's helper that fails after it was launched (the answer already said "restarting") is
|
|
26407
|
+
// said as a fleet Notice by requestWebFullRestart, and its job settles here as failed.
|
|
26408
|
+
const settleLateFailure = (detail) => {
|
|
26409
|
+
this.applyJobs.setTargetStatus(jobId, APPLY_FLEET_TARGET, "failed", detail);
|
|
26410
|
+
this.applyJobs.finish(jobId, detail);
|
|
26411
|
+
this.emitSseEvent("apply_progress", viewOf(this.applyJobs.get(jobId)));
|
|
26412
|
+
};
|
|
26413
|
+
const launched = await (notice ? this.requestFullRestart(notice.adapter, notice.chatId, notice.threadId, notice.messageId) : this.requestWebFullRestart(settleLateFailure))
|
|
26279
26414
|
.catch(err => {
|
|
26280
26415
|
this.logger.error({ err }, "Settings-triggered self restart failed to launch");
|
|
26281
26416
|
return false;
|