@songsid/agend 2.4.0-beta.34 → 2.4.0-beta.36
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/agent-whats-new.js +10 -0
- package/dist/agent-whats-new.js.map +1 -1
- package/dist/build-provenance.json +1 -1
- package/dist/cli-audited.js +8 -2
- package/dist/cli-audited.js.map +1 -1
- package/dist/delivery-outbox.d.ts +12 -0
- package/dist/delivery-outbox.js +26 -2
- package/dist/delivery-outbox.js.map +1 -1
- package/dist/fleet-context.d.ts +11 -0
- package/dist/fleet-manager.d.ts +45 -2
- package/dist/fleet-manager.js +298 -47
- package/dist/fleet-manager.js.map +1 -1
- package/dist/general-knowledge/skills/concepts/SKILL.md +60 -0
- package/dist/general-knowledge/skills/hub/SKILL.md +32 -6
- package/dist/general-knowledge/skills/web-dashboard/SKILL.md +16 -40
- package/dist/hub/client.js +22 -4
- package/dist/hub/client.js.map +1 -1
- package/dist/hub/compose/server.d.ts +2 -0
- package/dist/hub/compose/server.js +36 -2
- package/dist/hub/compose/server.js.map +1 -1
- package/dist/hub/directory/directory.d.ts +1 -1
- package/dist/hub/directory/directory.js +88 -5
- package/dist/hub/directory/directory.js.map +1 -1
- package/dist/hub/directory/people-index.d.ts +72 -0
- package/dist/hub/directory/people-index.js +265 -0
- package/dist/hub/directory/people-index.js.map +1 -0
- package/dist/hub/directory/types.d.ts +49 -0
- package/dist/hub/directory/types.js +1 -0
- package/dist/hub/directory/types.js.map +1 -1
- package/dist/hub/grant-search.js +38 -23
- package/dist/hub/grant-search.js.map +1 -1
- package/dist/hub/group-policy/admin-api.js +10 -1
- package/dist/hub/group-policy/admin-api.js.map +1 -1
- package/dist/hub/group-policy/admin-control.d.ts +1 -0
- package/dist/hub/group-policy/admin-control.js +1 -1
- package/dist/hub/group-policy/admin-control.js.map +1 -1
- package/dist/hub/group-policy/admin-dto.d.ts +16 -14
- package/dist/hub/group-policy/admin-dto.js +5 -1
- package/dist/hub/group-policy/admin-dto.js.map +1 -1
- package/dist/hub/group-policy/admin-search.d.ts +2 -1
- package/dist/hub/group-policy/admin-search.js +45 -5
- package/dist/hub/group-policy/admin-search.js.map +1 -1
- package/dist/hub/group-policy/resources.d.ts +1 -1
- package/dist/hub/http/compose.js +68 -2
- package/dist/hub/http/compose.js.map +1 -1
- package/dist/hub/http/deps.d.ts +2 -0
- package/dist/hub/mcp/catalog.d.ts +0 -1
- package/dist/hub/mcp/catalog.js +2 -1
- package/dist/hub/mcp/catalog.js.map +1 -1
- package/dist/hub/mcp/http.js +6 -1
- package/dist/hub/mcp/http.js.map +1 -1
- package/dist/hub/mcp/policy.d.ts +9 -2
- package/dist/hub/mcp/policy.js +23 -1
- package/dist/hub/mcp/policy.js.map +1 -1
- package/dist/hub/people-query.d.ts +1 -0
- package/dist/hub/people-query.js +13 -0
- package/dist/hub/people-query.js.map +1 -0
- package/dist/hub/people-resolve.d.ts +34 -0
- package/dist/hub/people-resolve.js +38 -0
- package/dist/hub/people-resolve.js.map +1 -0
- package/dist/hub/protocol.d.ts +2 -0
- package/dist/hub/protocol.js +5 -2
- package/dist/hub/protocol.js.map +1 -1
- package/dist/hub/roles/admin-control.d.ts +0 -1
- package/dist/hub/roles/admin-control.js +29 -1
- package/dist/hub/roles/admin-control.js.map +1 -1
- package/dist/hub/roles/admin-types.d.ts +2 -0
- package/dist/hub/roles/allowed-list-control.d.ts +2 -0
- package/dist/hub/roles/allowed-list-control.js +17 -0
- package/dist/hub/roles/allowed-list-control.js.map +1 -1
- package/dist/hub/rooms/direct-view.js +2 -1
- package/dist/hub/rooms/direct-view.js.map +1 -1
- package/dist/hub/rooms/directory.d.ts +3 -0
- package/dist/hub/rooms/directory.js +38 -0
- package/dist/hub/rooms/directory.js.map +1 -1
- package/dist/hub/rooms/service.d.ts +7 -0
- package/dist/hub/rooms/service.js +17 -1
- package/dist/hub/rooms/service.js.map +1 -1
- package/dist/hub/server.d.ts +7 -0
- package/dist/hub/server.js +26 -4
- package/dist/hub/server.js.map +1 -1
- package/dist/hub/socket.d.ts +14 -0
- package/dist/hub/socket.js +19 -2
- package/dist/hub/socket.js.map +1 -1
- package/dist/hub/teams/index.js +35 -20
- package/dist/hub/teams/index.js.map +1 -1
- package/dist/hub/teams/types.d.ts +7 -1
- package/dist/locale.js +42 -10
- package/dist/locale.js.map +1 -1
- package/dist/request-context-control-api.d.ts +18 -0
- package/dist/request-context-control-api.js +9 -1
- package/dist/request-context-control-api.js.map +1 -1
- package/dist/runtime-cli-install.js +7 -3
- package/dist/runtime-cli-install.js.map +1 -1
- package/dist/settings-effect.js +5 -2
- package/dist/settings-effect.js.map +1 -1
- package/dist/tips.js +1 -1
- package/dist/tips.js.map +1 -1
- package/dist/topic-commands.js +10 -1
- package/dist/topic-commands.js.map +1 -1
- package/dist/ui/hub-admin-rooms.js +6 -4
- package/dist/ui/hub-ai-apps.js +2 -1
- package/dist/ui/hub-client.js +12 -0
- package/dist/ui/hub-grant-picker.js +42 -5
- package/dist/ui/hub-group-policy.js +3 -1
- package/dist/ui/hub-join-steps.js +3 -1
- package/dist/ui/hub-people-index.js +96 -0
- package/dist/ui/hub-people-paste.js +161 -0
- package/dist/ui/hub-people-query.js +8 -0
- package/dist/ui/hub-personal-agent.js +7 -2
- package/dist/ui/hub-role-forms.js +12 -3
- package/dist/ui/hub-room-new.js +12 -2
- package/dist/ui/hub-room-owner-requests.js +1 -1
- package/dist/ui/hub-room-settings.js +11 -4
- package/dist/ui/hub-room-thread.js +3 -3
- package/dist/ui/hub-subject-picker.js +16 -7
- package/dist/ui/hub-teams-strings.js +2 -2
- package/dist/ui/hub-teams.js +21 -5
- package/dist/ui/panel-chat.js +3 -3
- package/dist/ui/panel-hub.js +2 -0
- package/dist/ui/request-context-control.js +72 -12
- package/dist/ui/shared/app-update.js +54 -5
- package/dist/ui/shared/app.css +58 -0
- package/dist/ui/shared/chat-strings.js +2 -2
- package/dist/ui/shared/update-card-ui.js +21 -7
- package/dist/update-card.d.ts +21 -2
- package/dist/update-card.js +65 -9
- package/dist/update-card.js.map +1 -1
- package/package.json +1 -1
|
@@ -27,7 +27,7 @@ register("update", {
|
|
|
27
27
|
failed_network: "Update failed: the update source could not be reached.", failed_permission: "Update failed: no permission to install the new version.",
|
|
28
28
|
failed_other: "Update failed: the update did not finish.", unchanged: "AgEnD is still v{0}; nothing was changed.",
|
|
29
29
|
afterInstall: "The new version may be installed, but AgEnD did not finish restarting.", retry: "Try again", fullLog: "See the full log",
|
|
30
|
-
logTitle: "Update log", logEmpty: "No update log yet.", logCause: "What the updater said",
|
|
30
|
+
logTitle: "Update log", logEmpty: "No update log yet.", logCause: "What the updater said", cardTitle: "AgEnD update",
|
|
31
31
|
current: "AgEnD is up to date (v{0}).", updated: "AgEnD is updated to v{0}", reloadSub: "Reload this tab to use the new version.", reload: "Reload",
|
|
32
32
|
dismiss: "Dismiss", adminOnly: "Only a fleet admin can update AgEnD.", running: "An update is already running.",
|
|
33
33
|
upToDate: "AgEnD v{0} is up to date.", stableOnly: "v{0} (stable) is available. Updating from the web stays on this install's line.",
|
|
@@ -48,7 +48,7 @@ register("update", {
|
|
|
48
48
|
failed_network: "更新失敗:連不上更新來源。", failed_permission: "更新失敗:沒有權限安裝新版。",
|
|
49
49
|
failed_other: "更新失敗:更新沒有完成。", unchanged: "AgEnD 仍是 v{0},沒有任何變更。",
|
|
50
50
|
afterInstall: "新版可能已經安裝,但 AgEnD 沒能完成重新啟動。", retry: "再試一次", fullLog: "看完整紀錄",
|
|
51
|
-
logTitle: "更新紀錄", logEmpty: "還沒有更新紀錄。", logCause: "更新程式回報的原因",
|
|
51
|
+
logTitle: "更新紀錄", logEmpty: "還沒有更新紀錄。", logCause: "更新程式回報的原因", cardTitle: "AgEnD 更新",
|
|
52
52
|
current: "AgEnD 已是最新版(v{0})。", updated: "AgEnD 已更新到 v{0}", reloadSub: "重新載入這個分頁即可使用新版。", reload: "重新載入",
|
|
53
53
|
dismiss: "關閉", adminOnly: "只有 fleet 管理員可以更新 AgEnD。", running: "已經有一個更新在進行中。",
|
|
54
54
|
upToDate: "AgEnD v{0} 已是最新版。", stableOnly: "v{0}(穩定版)已推出。網頁更新會留在這個安裝的版本線。",
|
|
@@ -73,7 +73,7 @@ const LATER_HUB_KEY = "agend_update_later_hub", LATER_HUB_MS = 24 * 60 * 60 * 10
|
|
|
73
73
|
* tab was loaded on (the first answer's): a later answer naming another one means this tab runs the old page.
|
|
74
74
|
*/
|
|
75
75
|
export const updateStore = createStore({ info: null, loadedVersion: null, skew: 0, starting: false, later: remembered(LATER_KEY),
|
|
76
|
-
dismissed: remembered(DISMISSED_KEY), reloadDismissed: null, log: null, laterHub: remembered(LATER_HUB_KEY) });
|
|
76
|
+
dismissed: remembered(DISMISSED_KEY), reloadDismissed: null, log: null, laterHub: remembered(LATER_HUB_KEY), cardOpen: false, cardAsking: false });
|
|
77
77
|
// #4487 review P2: AgEnD's own update item (a failure, or can't update here) counts in Needs you like any other — its badge,
|
|
78
78
|
// the tab's and the page's count and empty state read it from appStore (app-shell.js needsCount; panel-needs.js).
|
|
79
79
|
updateStore.subscribe((st) => { const n = updateAttention(st && st.info) ? 1 : 0; if ((appStore.get().updateNeeds || 0) !== n) appStore.set({ updateNeeds: n }); });
|
|
@@ -143,6 +143,21 @@ function sameLine(channel) { return t(`update.same_${channel === "alpha" || chan
|
|
|
143
143
|
|
|
144
144
|
/** The one confirmation (the leader's D1: the admin's own, no General card), then the start. From the line, Settings or /update. */
|
|
145
145
|
export async function openUpdateDialog() { return startUpdate(null); }
|
|
146
|
+
/**
|
|
147
|
+
* M-3967: `/update` in a web chat: a fresh check, then the update card itself in a dialog — the top line's own words and
|
|
148
|
+
* buttons (Update now asks once, naming who works), as `/update` shows it in Discord and Telegram. A server without the
|
|
149
|
+
* card, or nothing the card shows, keeps the old question (which says up to date, running, or admin only).
|
|
150
|
+
*/
|
|
151
|
+
export async function openUpdateCard() {
|
|
152
|
+
let info = updateStore.get().info;
|
|
153
|
+
if (!info) info = await refreshUpdate();
|
|
154
|
+
if (!info || !info.admin) { toast(t("update.adminOnly"), false); return { ok: false }; }
|
|
155
|
+
await checkUpdateNow();
|
|
156
|
+
info = updateStore.get().info || info;
|
|
157
|
+
if (info.card === undefined || !cardLine(info, { Line, busy: false, deps: cardDeps, full: true })) return startUpdate(null);
|
|
158
|
+
updateStore.set({ cardOpen: true });
|
|
159
|
+
return { ok: true };
|
|
160
|
+
}
|
|
146
161
|
/** M-3140: the same confirmation and start, pinned to the Hub's recommended version (the server re-reads its own advice). */
|
|
147
162
|
export async function openHubUpdateDialog() { return startUpdate("hub"); }
|
|
148
163
|
|
|
@@ -253,16 +268,46 @@ function LogDialog() {
|
|
|
253
268
|
</${Dialog}>`;
|
|
254
269
|
}
|
|
255
270
|
|
|
271
|
+
/** M-3967: the card opened by a web chat's /update. It closes by itself once the card has nothing to show (updating, done). */
|
|
272
|
+
function CardDialog() {
|
|
273
|
+
const s = useStore(updateStore);
|
|
274
|
+
const line = s.cardOpen && s.info ? cardLine(s.info, { Line, busy: s.starting, deps: dialogDeps, full: true }) : null;
|
|
275
|
+
useEffect(() => { if (s.cardOpen && !line && !s.cardAsking) updateStore.set({ cardOpen: false }); }, [s.cardOpen, !line]);
|
|
276
|
+
if (!s.cardOpen || !line || s.cardAsking) return null;
|
|
277
|
+
const close = () => updateStore.set({ cardOpen: false });
|
|
278
|
+
return html`<${Dialog} title=${t("update.cardTitle")} wide onClose=${close}
|
|
279
|
+
actions=${html`<button type="button" class="btn" onClick=${close}>${t("app.close")}</button>`}>
|
|
280
|
+
<div class="update-card-dialog">${line}</div>
|
|
281
|
+
</${Dialog}>`;
|
|
282
|
+
}
|
|
283
|
+
|
|
256
284
|
/** The app-wide line. Admins see the offer, the progress and its failure; any signed-in tab on an old version, the reload. */
|
|
285
|
+
/**
|
|
286
|
+
* S-277 (beta.36): phone width, the same breakpoint as agent-sheet.js's usePhone (not imported: agent-sheet imports
|
|
287
|
+
* app-shell, which imports this module).
|
|
288
|
+
*/
|
|
289
|
+
const PHONE_QUERY = "(max-width: 899px), (pointer: coarse) and (max-height: 500px) and (max-width: 1023px)";
|
|
290
|
+
function usePhoneWidth() {
|
|
291
|
+
const read = () => typeof matchMedia === "function" && matchMedia(PHONE_QUERY).matches;
|
|
292
|
+
const [on, setOn] = useState(read);
|
|
293
|
+
useEffect(() => {
|
|
294
|
+
if (typeof matchMedia !== "function") return undefined;
|
|
295
|
+
const mq = matchMedia(PHONE_QUERY), changed = () => setOn(mq.matches);
|
|
296
|
+
changed(); mq.addEventListener?.("change", changed);
|
|
297
|
+
return () => mq.removeEventListener?.("change", changed);
|
|
298
|
+
}, []);
|
|
299
|
+
return on;
|
|
300
|
+
}
|
|
257
301
|
export function UpdateLine() {
|
|
258
302
|
usePolling();
|
|
259
303
|
const s = useStore(updateStore);
|
|
304
|
+
const phone = usePhoneWidth();
|
|
260
305
|
const nav = useStore(navStore);
|
|
261
306
|
const [, tick] = useState(0);
|
|
262
307
|
const info = s.info;
|
|
263
308
|
const active = updateActive(info);
|
|
264
309
|
useEffect(() => { if (!active) return undefined; const id = setInterval(() => tick((n) => n + 1), 1000); return () => clearInterval(id); }, [active]);
|
|
265
|
-
if (!info) return html`<${LogDialog} />`;
|
|
310
|
+
if (!info) return html`<${LogDialog} /><${CardDialog} />`;
|
|
266
311
|
const p = info.progress;
|
|
267
312
|
let line = null;
|
|
268
313
|
if (s.loadedVersion && info.current !== s.loadedVersion && s.reloadDismissed !== info.current) {
|
|
@@ -305,8 +350,12 @@ export function UpdateLine() {
|
|
|
305
350
|
<button type="button" class="btn btn-sm btn-primary" disabled=${s.starting} onClick=${openUpdateDialog}>${t("update.now")}</button>
|
|
306
351
|
<button type="button" class="btn btn-sm" onClick=${() => { remember(LATER_KEY, o.version); updateStore.set({ later: o.version }); }}>${t("update.later")}</button></${Line}>`;
|
|
307
352
|
}
|
|
308
|
-
|
|
353
|
+
// S-277: on a phone, the /update card (or its question) fills the screen; the top line's own buttons would show twice.
|
|
354
|
+
if (phone && (s.cardOpen || s.cardAsking)) line = null;
|
|
355
|
+
return html`${line}<${LogDialog} /><${CardDialog} /><${PickTimeHost} />`;
|
|
309
356
|
}
|
|
310
357
|
/** M-3770 1.4: what update-card-ui.js needs from this module, passed in (it never imports this one). */
|
|
311
358
|
export const cardDeps = { refresh: () => refreshUpdate(), setInfo: (info) => updateStore.set({ info }), getInfo: () => updateStore.get().info,
|
|
312
359
|
setStarting: (starting) => updateStore.set({ starting }) };
|
|
360
|
+
/** M-3967: the card's dialog steps aside while its own question (Update now, Pick a time) is open, and comes back after a Cancel. */
|
|
361
|
+
const dialogDeps = { ...cardDeps, asking: (open, answered = false) => updateStore.set(open ? { cardAsking: true } : { cardAsking: false, ...(answered ? { cardOpen: false } : {}) }) };
|
package/dist/ui/shared/app.css
CHANGED
|
@@ -810,9 +810,21 @@ html:has(.shell), html:has(.shell) body { overflow: hidden; }
|
|
|
810
810
|
.s-setting-row .note { margin: 5px 0 0; }
|
|
811
811
|
.request-context-toggle { display: flex; align-items: center; gap: 12px; min-height: 44px; cursor: pointer; }
|
|
812
812
|
.request-context-control, .request-context-blocked { overflow-wrap: anywhere; }
|
|
813
|
+
/* M-3963: every line wraps inside the card, whatever an outer container sets (a busy-agent line ran off the right edge). */
|
|
814
|
+
.request-context-control, .request-context-need, .request-context-blocked { min-width: 0; max-width: 100%; }
|
|
815
|
+
.request-context-blocked p, .request-context-control > p { white-space: normal; word-break: normal; overflow-wrap: anywhere; max-width: 100%; }
|
|
813
816
|
.request-context-control .btn, .request-context-need .btn { min-height: 44px; }
|
|
814
817
|
.request-context-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
|
|
815
818
|
.request-context-actions > .btn { width: auto; flex: 0 0 auto; }
|
|
819
|
+
.request-context-uncertain { display: grid; gap: 8px; margin: 4px 0 8px; }
|
|
820
|
+
.request-context-uncertain > p { margin: 0; color: var(--text-2); }
|
|
821
|
+
.request-context-uncertain-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--border); border-radius: 8px; }
|
|
822
|
+
.request-context-uncertain-list > li { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 4px 12px; padding: 6px 10px; }
|
|
823
|
+
.request-context-uncertain-list > li + li { border-top: 1px solid var(--border); }
|
|
824
|
+
.request-context-uncertain-list > li > span { min-width: 0; }
|
|
825
|
+
.request-context-uncertain-list .btn { width: auto; flex: 0 0 auto; border-color: var(--border-strong); }
|
|
826
|
+
.request-context-nowrap { white-space: nowrap; }
|
|
827
|
+
.request-context-uncertain-when { display: block; color: var(--text-2); font-size: 0.92em; }
|
|
816
828
|
.p-settings .request-context-toggle input.s-ui-toggle:not(:checked) { border-color: var(--text-2); background: var(--surface-3, var(--surface-2)); }
|
|
817
829
|
.p-settings .request-context-toggle input.s-ui-toggle:indeterminate::after { transform: translateX(8px); border-radius: 2px; }
|
|
818
830
|
.p-settings input.s-ui-toggle, .p-hub input.s-ui-toggle, .p-fleet input.s-ui-toggle { appearance: none; position: relative; display: inline-block; flex: none; width: 38px; height: 22px; min-height: 0; margin: 0; padding: 0; border: 1px solid var(--border-strong); border-radius: 20px; background: var(--surface-3, var(--surface-2)); cursor: pointer; }
|
|
@@ -1120,6 +1132,43 @@ html.lb-open .scroller { overflow: hidden; }
|
|
|
1120
1132
|
.pv-note .pv-fix { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
|
|
1121
1133
|
/* Chinese wraps between words, not inside one (建立, 查得到, 使用). */
|
|
1122
1134
|
:lang(zh) .pv-note, :lang(zh) .fixed-preview, :lang(zh) .s-public-entry .note { word-break: keep-all; overflow-wrap: anywhere; }
|
|
1135
|
+
/* M-3975: paste a list of people (hub-people-paste.js): one review list, then one Add button. */
|
|
1136
|
+
.hub-paste { margin-top: 8px; min-width: 0; }
|
|
1137
|
+
.hub-paste-text { width: 100%; box-sizing: border-box; resize: vertical; }
|
|
1138
|
+
.hub-paste-rows { list-style: none; padding: 0; margin: 8px 0; display: grid; gap: 6px; }
|
|
1139
|
+
.hub-paste-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; min-width: 0; }
|
|
1140
|
+
.hub-paste-row > .hub-paste-main { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
|
|
1141
|
+
.hub-paste-row > .chip-btn { flex: 0 0 auto; align-self: flex-start; }
|
|
1142
|
+
.hub-paste .hub-paste-rows input[type=checkbox], .hub-paste .hub-paste-rows input[type=radio] { width: 18px; height: 18px; min-width: 0; min-height: 0; flex: 0 0 auto; margin: 2px 8px 0 0; padding: 0; }
|
|
1143
|
+
/* The leader's capture check: the unticked box and radio need ≥ 3:1 against the card in dark mode too, so they draw their
|
|
1144
|
+
own body-coloured 2 px outline instead of the native control's dim grey. */
|
|
1145
|
+
.hub-paste .hub-paste-rows input[type=checkbox], .hub-paste .hub-paste-rows input[type=radio] {
|
|
1146
|
+
appearance: none; -webkit-appearance: none; display: inline-grid; place-content: center; box-sizing: border-box;
|
|
1147
|
+
border: 2px solid var(--text-2); border-radius: 4px; background: var(--surface); cursor: pointer; }
|
|
1148
|
+
.hub-paste .hub-paste-rows input[type=radio] { border-radius: 50%; }
|
|
1149
|
+
.hub-paste .hub-paste-rows input:checked { background: var(--accent-fill); border-color: var(--accent-fill); }
|
|
1150
|
+
.hub-paste .hub-paste-rows input[type=checkbox]:checked::after { content: ""; width: 4px; height: 8px; margin-top: -2px; border: solid var(--on-accent); border-width: 0 2px 2px 0; transform: rotate(45deg); }
|
|
1151
|
+
.hub-paste .hub-paste-rows input[type=radio]:checked::after { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--on-accent); }
|
|
1152
|
+
.hub-paste .hub-paste-rows input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
|
|
1153
|
+
.hub-paste .hub-paste-rows input:disabled { opacity: .5; cursor: default; }
|
|
1154
|
+
.hub-paste-detail { display: block; }
|
|
1155
|
+
.hub-paste-pick-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
|
|
1156
|
+
.hub-paste label.check { display: flex; align-items: flex-start; gap: 0; }
|
|
1157
|
+
:lang(zh) .hub-team-search .note { word-break: keep-all; overflow-wrap: anywhere; text-wrap: pretty; }
|
|
1158
|
+
.hub-paste-already { color: var(--text-2); }
|
|
1159
|
+
.hub-paste-already .note { color: var(--text-2); }
|
|
1160
|
+
.hub-paste-status { color: var(--text-2); font-weight: 600; }
|
|
1161
|
+
.hub-paste-missing { color: var(--text); }
|
|
1162
|
+
.hub-paste .chip-btn { color: var(--text-2); }
|
|
1163
|
+
.hub-paste-done { color: var(--text); margin: 6px 0 0; word-break: keep-all; overflow-wrap: anywhere; }
|
|
1164
|
+
.hub-paste-entry { color: var(--text-3); }
|
|
1165
|
+
.hub-paste-pick { display: grid; gap: 4px; min-width: 0; }
|
|
1166
|
+
.hub-paste-rows { font-size: var(--fs-sm); }
|
|
1167
|
+
.hub-paste-actions { display: flex; flex-wrap: wrap; gap: 8px; }
|
|
1168
|
+
.hub-paste .note, .hub-paste .err, .hub-paste-pick-head { word-break: keep-all; overflow-wrap: anywhere; text-wrap: pretty; }
|
|
1169
|
+
/* M-3975: Administration → People search. zh words stay whole (a line breaks at punctuation), and no lone last word. */
|
|
1170
|
+
.hub-people-index p { word-break: keep-all; overflow-wrap: anywhere; text-wrap: pretty; }
|
|
1171
|
+
.hub-people-index .hub-people-index-lead, .hub-people-index .hub-people-index-status { color: var(--text); }
|
|
1123
1172
|
/* M-3814: the fixed preview address's Cloudflare step, under the fixed hostname. */
|
|
1124
1173
|
.fixed-preview { margin-top: var(--s-3); }
|
|
1125
1174
|
/* No fixed public hostname yet: why there is no preview field — body-size, set apart (the 429 link lands here). */
|
|
@@ -2288,6 +2337,8 @@ textarea.s-yaml { white-space: pre; overflow-x: auto; }
|
|
|
2288
2337
|
.update-line { justify-content: flex-start; }
|
|
2289
2338
|
.update-text { flex: 1 1 100%; }
|
|
2290
2339
|
.update-actions.indent { margin-left: 26px; }
|
|
2340
|
+
/* M-3967: four buttons (Update now first) wrap to a second row rather than run off a phone's edge. */
|
|
2341
|
+
.update-actions { flex: 0 1 auto; flex-wrap: wrap; min-width: 0; }
|
|
2291
2342
|
}
|
|
2292
2343
|
/* S-241 (Lumen's point 8): an answered update card (waiting for idle, scheduled) is one line on a phone — its short words
|
|
2293
2344
|
and Change; Change opens the full line. The desk never shows the short words or Change. "A phone" is the app's own
|
|
@@ -2308,6 +2359,13 @@ textarea.s-yaml { white-space: pre; overflow-x: auto; }
|
|
|
2308
2359
|
.uc-answered:not(.open) .uc-short { display: inline; }
|
|
2309
2360
|
.uc-answered:not(.open) .update-actions.indent { margin-left: 0; }
|
|
2310
2361
|
}
|
|
2362
|
+
/* M-3967: the card in /update's dialog: no banner band; its words and buttons share one left edge. */
|
|
2363
|
+
.update-card-dialog .update-line { justify-content: flex-start; background: none; border: 0; padding: 0; }
|
|
2364
|
+
.update-card-dialog .update-text { flex: 1 1 100%; } /* the buttons always on their own row, under the words */
|
|
2365
|
+
.update-card-dialog .update-actions { flex: 0 1 auto; flex-wrap: wrap; min-width: 0; }
|
|
2366
|
+
/* In line with the words, past the spinner (16 px) or the icon (18 px) and the gap. */
|
|
2367
|
+
.update-card-dialog .update-text:has(.update-spinner) + .update-actions { margin-left: calc(16px + var(--s-2)); }
|
|
2368
|
+
.update-card-dialog .update-text:has(.update-icon) + .update-actions { margin-left: calc(18px + var(--s-2)); }
|
|
2311
2369
|
/* M-2738: Settings → Advanced → Version and update */
|
|
2312
2370
|
/* M-3770 1.4: the update card's Settings part — its state, "Updates on this machine", and the controls (pause windows;
|
|
2313
2371
|
Advanced: pin, longest wait). Phone: every control a 44 px box, the day ticks wrap. */
|
|
@@ -60,7 +60,7 @@ register("chat", {
|
|
|
60
60
|
cmd_ctx: "Context use, model and effort", cmd_compact: "Compact the conversation", cmd_clear: "Clear the conversation (asks first)",
|
|
61
61
|
cmd_model: "Show or switch the model", cmd_backend: "Switch the CLI backend, then model and effort (restarts)", cmd_effort: "Show or set the reasoning effort", cmd_cancel: "Stop the current reply",
|
|
62
62
|
cmd_btw: "A side question that does not interrupt", cmd_steer: "Send into the current turn", cmd_pause: "Pause the instance",
|
|
63
|
-
cmd_wake: "Wake a paused instance", cmd_save: "Save the conversation to a file", cmd_update: "Update AgEnD (
|
|
63
|
+
cmd_wake: "Wake a paused instance", cmd_save: "Save the conversation to a file", cmd_update: "Update AgEnD (shows the update card)",
|
|
64
64
|
tourTitle: "Welcome to web chat", tourStep: "{0} of {1}", tourBack: "Back", tourNext: "Next", tourDone: "Got it", tourSkip: "Skip",
|
|
65
65
|
tour1: "Pick an instance in the list to chat with it. On a phone, ☰ opens the list.",
|
|
66
66
|
tour2: "This is the agent's conversation. If it also has a Telegram or Discord chat, web echo (Settings → Chat & connections) decides whether what you send here shows there too.",
|
|
@@ -239,7 +239,7 @@ register("chat", {
|
|
|
239
239
|
cmd_ctx: "上下文用量、模型與推理強度", cmd_compact: "壓縮對話", cmd_clear: "清空對話(會先確認)",
|
|
240
240
|
cmd_model: "查看或切換模型", cmd_backend: "切換 CLI 後端,再選模型和推理強度(會重新啟動)", cmd_effort: "查看或設定推理強度", cmd_cancel: "停止目前的回覆",
|
|
241
241
|
cmd_btw: "不打斷目前工作的旁問", cmd_steer: "送進目前這一輪", cmd_pause: "暫停 Agent",
|
|
242
|
-
cmd_wake: "喚醒已暫停的 Agent", cmd_save: "把對話存成檔案", cmd_update: "更新 AgEnD
|
|
242
|
+
cmd_wake: "喚醒已暫停的 Agent", cmd_save: "把對話存成檔案", cmd_update: "更新 AgEnD(顯示更新卡片)",
|
|
243
243
|
tourTitle: "歡迎使用網頁聊天", tourStep: "{0} / {1}", tourBack: "上一步", tourNext: "下一步", tourDone: "知道了", tourSkip: "略過",
|
|
244
244
|
tour1: "在清單裡選一個 Agent,就能跟它對話。手機上請按 ☰ 打開清單。",
|
|
245
245
|
tour2: "這是這個 Agent 的對話。如果它也有 Telegram 或 Discord 聊天,在這裡送出的訊息是否也出現在那裡,由「設定 → 聊天與連線」的網頁轉發決定。",
|
|
@@ -24,7 +24,7 @@ register("updatecard", {
|
|
|
24
24
|
scheduled: "Updating to {0} at {1}, when your agents are idle.", notNowUntil: "You chose Not now. The card comes back on {0}.",
|
|
25
25
|
waitingShort: "AgEnD updates when idle", scheduledShort: "AgEnD updates {0}", foldOpen: "Change", foldClose: "Hide",
|
|
26
26
|
starting: "Starting the update to {0}…", cantTitle: "AgEnD can't update itself on this machine.",
|
|
27
|
-
nowTitle: "Update now?", nowBody: "{0} agents are working. They stop for a few minutes while AgEnD restarts, then pick up where they were.",
|
|
27
|
+
nowTitle: "Update AgEnD to {0} now?", nowBody: "{0} agents are working ({1}). They stop for a few minutes while AgEnD restarts, then pick up where they were.", nowBodyOne: "1 agent is working ({1}). It stops for a few minutes while AgEnD restarts, then picks up where it was.",
|
|
28
28
|
nowBodyIdle: "AgEnD restarts for a few minutes; your agents pick up where they were.", nowGo: "Update now",
|
|
29
29
|
pickTitle: "When should AgEnD update?", pickTonight: "Tonight", pickMorning: "Tomorrow morning", pickOther: "Another time", pickDay: "Day", pickAt: "Time",
|
|
30
30
|
pickHint: "It still waits until your agents are idle at that time. Within the next 7 days.", pickGo: "Schedule", pickBad: "Pick a time in the next 7 days.",
|
|
@@ -90,7 +90,7 @@ register("updatecard", {
|
|
|
90
90
|
scheduled: "排定在 {1},等 Agent 閒置後更新到 {0}。", notNowUntil: "你選了「先不要」,{0} 會再提醒。",
|
|
91
91
|
waitingShort: "AgEnD 閒置時更新", scheduledShort: "AgEnD {0} 更新", foldOpen: "變更", foldClose: "收起",
|
|
92
92
|
starting: "正在開始更新到 {0}…", cantTitle: "AgEnD 無法在這台機器上自行更新。",
|
|
93
|
-
nowTitle: "
|
|
93
|
+
nowTitle: "現在就把 AgEnD 更新到 {0}?", nowBody: "有 {0} 個 Agent 正在工作({1})。AgEnD 重新啟動時會停下幾分鐘,之後從原處繼續。", nowBodyOne: "有 1 個 Agent 正在工作({1})。AgEnD 重新啟動時會停下幾分鐘,之後從原處繼續。",
|
|
94
94
|
nowBodyIdle: "AgEnD 會重新啟動幾分鐘,Agent 之後從原處繼續。", nowGo: "立即更新",
|
|
95
95
|
pickTitle: "要在什麼時候更新?", pickTonight: "今晚", pickMorning: "明天早上", pickOther: "其他時間", pickDay: "日期", pickAt: "時間",
|
|
96
96
|
pickHint: "到了那個時間,仍會等 Agent 閒置才開始。可排定在未來 7 天內。", pickGo: "排定", pickBad: "請選擇未來 7 天內的時間。",
|
|
@@ -335,10 +335,18 @@ export async function answerCard(body, { refresh, setInfo, getInfo }) {
|
|
|
335
335
|
return { ok: false };
|
|
336
336
|
}
|
|
337
337
|
|
|
338
|
-
/**
|
|
338
|
+
/**
|
|
339
|
+
* Update now: one question naming the version and the agents at work (the card's waitingFor, or its working while nothing
|
|
340
|
+
* waits) — M-3967: the chat card's words exactly — then the answer. `deps.asking(true|false)` lets a dialog that holds the
|
|
341
|
+
* card step aside while the question is open (no dialog over a dialog).
|
|
342
|
+
*/
|
|
339
343
|
export async function updateNow(info, deps) {
|
|
340
|
-
const
|
|
341
|
-
const
|
|
344
|
+
const c = info && info.card;
|
|
345
|
+
const names = c && Array.isArray(c.waitingFor) && c.waitingFor.length ? c.waitingFor : c && Array.isArray(c.working) ? c.working : [];
|
|
346
|
+
if (deps && typeof deps.asking === "function") deps.asking(true);
|
|
347
|
+
const yes = await confirmDialog({ title: tc("nowTitle", c ? c.version : ""), confirmLabel: tc("nowGo"),
|
|
348
|
+
message: names.length ? tc(names.length === 1 ? "nowBodyOne" : "nowBody", names.length, namesShown(names)) : tc("nowBodyIdle") });
|
|
349
|
+
if (deps && typeof deps.asking === "function") deps.asking(false, yes);
|
|
342
350
|
if (!yes) return { ok: false };
|
|
343
351
|
return answerCard({ action: "now", confirm: "update-agend" }, deps);
|
|
344
352
|
}
|
|
@@ -386,7 +394,9 @@ export function PickTimeHost() {
|
|
|
386
394
|
</${Dialog}>`;
|
|
387
395
|
}
|
|
388
396
|
export async function pickTime(deps) {
|
|
397
|
+
if (deps && typeof deps.asking === "function") deps.asking(true);
|
|
389
398
|
const at = await pickTimeDialog();
|
|
399
|
+
if (deps && typeof deps.asking === "function") deps.asking(false, !!at);
|
|
390
400
|
if (!at) return { ok: false };
|
|
391
401
|
return answerCard({ action: "pick-time", at }, deps);
|
|
392
402
|
}
|
|
@@ -413,13 +423,14 @@ export function cardActions(info, deps) {
|
|
|
413
423
|
const later = act("not-now", tc("notNow"), () => answerCard({ action: "not-now" }, deps));
|
|
414
424
|
const cancel = act("cancel", tc("cancel"), () => answerCard({ action: "cancel" }, deps));
|
|
415
425
|
const now = act("now", tc("updateNow"), () => updateNow(info, deps));
|
|
416
|
-
|
|
426
|
+
// M-3967 (the user): an offer has Update now too, first, as the chat card does; Update when idle stays the filled one.
|
|
427
|
+
if (c.state === "offered") return [press && now, press && whenIdle, sched && pick, later].filter(Boolean);
|
|
417
428
|
if (c.state === "not-now") return [press && whenIdle, sched && pick].filter(Boolean);
|
|
418
429
|
if (c.state === "waiting-idle") return [press && now, sched && pick, cancel].filter(Boolean);
|
|
419
430
|
if (c.state === "scheduled") return [press && now, cancel].filter(Boolean);
|
|
420
431
|
return [];
|
|
421
432
|
}
|
|
422
|
-
export function cardLine(info, { Line, busy, deps }) {
|
|
433
|
+
export function cardLine(info, { Line, busy, deps, full = false }) {
|
|
423
434
|
const c = info && info.card;
|
|
424
435
|
if (!c || !info.admin) return null;
|
|
425
436
|
const press = pressHere(info), fails = failedChecks(info.preflight);
|
|
@@ -433,8 +444,11 @@ export function cardLine(info, { Line, busy, deps }) {
|
|
|
433
444
|
}
|
|
434
445
|
if (c.state === "waiting-idle") {
|
|
435
446
|
const names = Array.isArray(c.waitingFor) && c.waitingFor.length ? tc("waitingFor", namesShown(c.waitingFor)) : null;
|
|
447
|
+
// M-3967: `full` (the card in /update's dialog) is never folded to the phone's one line.
|
|
448
|
+
if (full) return html`<${Line} key="waiting-idle" spinner title=${tc("waiting", c.version)} sub=${[names]}>${buttons}</${Line}>`;
|
|
436
449
|
return html`<${AnsweredLine} key="waiting-idle" Line=${Line} spinner title=${tc("waiting", c.version)} short=${tc("waitingShort")} sub=${[names]} buttons=${buttons} />`;
|
|
437
450
|
}
|
|
451
|
+
if (c.state === "scheduled" && full) return html`<${Line} key="scheduled" icon="clock" title=${tc("scheduled", c.version, fmtTime(c.scheduledAt))}>${buttons}</${Line}>`;
|
|
438
452
|
if (c.state === "scheduled") return html`<${AnsweredLine} key="scheduled" Line=${Line} icon="clock" title=${tc("scheduled", c.version, fmtTime(c.scheduledAt))}
|
|
439
453
|
short=${tc("scheduledShort", fmtShort(c.scheduledAt))} buttons=${buttons} />`;
|
|
440
454
|
if (c.state === "updating" && !(info.progress && info.progress.stage)) return html`<${Line} spinner title=${tc("starting", c.version)} />`;
|
package/dist/update-card.d.ts
CHANGED
|
@@ -3,6 +3,8 @@ import { readUpdateProgress } from "./update-marker.js";
|
|
|
3
3
|
import { type UpdatesSettings } from "./update-settings.js";
|
|
4
4
|
export declare const NOT_NOW_MS: number;
|
|
5
5
|
export declare const PICK_WITHIN_MS: number;
|
|
6
|
+
/** M-3970: a leftover `updating` card is settled only this long after its run started (the updater's first-marker gap). */
|
|
7
|
+
export declare const LEFTOVER_RUN_GRACE_MS: number;
|
|
6
8
|
/** Progress-marker name for one local idle launch. The Hub uses its own prefix. */
|
|
7
9
|
export declare function idleUpdateMessageId(id: string): string;
|
|
8
10
|
type IdleMarker = NonNullable<ReturnType<typeof readUpdateProgress>>;
|
|
@@ -24,6 +26,8 @@ export interface UpdateCardView {
|
|
|
24
26
|
notNowUntil?: number;
|
|
25
27
|
scheduledAt?: number;
|
|
26
28
|
waitingFor?: string[];
|
|
29
|
+
/** M-3967: the agents at work now, for Update now's question while nothing waits (offered, scheduled). */
|
|
30
|
+
working?: string[];
|
|
27
31
|
waitingSince?: number;
|
|
28
32
|
lastAnswer?: {
|
|
29
33
|
action: UpdateCardAction;
|
|
@@ -133,6 +137,8 @@ export declare class UpdateOfferCard {
|
|
|
133
137
|
private quiet;
|
|
134
138
|
private timer?;
|
|
135
139
|
private readonly answers;
|
|
140
|
+
/** M-3964: a run that began before this is a previous process's. */
|
|
141
|
+
private readonly openedAt;
|
|
136
142
|
constructor(deps: UpdateCardDeps);
|
|
137
143
|
close(): void;
|
|
138
144
|
/** Drop an offer the latest check no longer makes. Leaves a wait or an update alone. */
|
|
@@ -141,8 +147,10 @@ export declare class UpdateOfferCard {
|
|
|
141
147
|
/** The immediate path has claimed the machine. Does not overwrite lastAnswer. */
|
|
142
148
|
beginRun(version: string): void;
|
|
143
149
|
/**
|
|
144
|
-
* A progress marker for this run. A marker that started before the run
|
|
145
|
-
* Null (no marker) does not settle.
|
|
150
|
+
* A progress marker for this run. A marker that started before the run is left alone; with no run time, so is one that
|
|
151
|
+
* names another version. Null (no marker) does not settle.
|
|
152
|
+
* M-3964: an unpinned run installs the newest on the install's line, which can be newer than the version the card was
|
|
153
|
+
* labelled with (an update check from hours ago). The marker names what was installed; the card settles with it.
|
|
146
154
|
*/
|
|
147
155
|
noteMarker(marker: {
|
|
148
156
|
startedAt: number;
|
|
@@ -155,6 +163,7 @@ export declare class UpdateOfferCard {
|
|
|
155
163
|
state: "done" | "failed";
|
|
156
164
|
cause?: UpdateFailCause;
|
|
157
165
|
rolledBack?: boolean;
|
|
166
|
+
version?: string;
|
|
158
167
|
}): void;
|
|
159
168
|
/** A Hub admission is the same card. It does not open a second local queue row. */
|
|
160
169
|
observeHub(row: IdleUpdate): void;
|
|
@@ -177,6 +186,16 @@ export declare class UpdateOfferCard {
|
|
|
177
186
|
private retarget;
|
|
178
187
|
private promote;
|
|
179
188
|
private mirrorLocal;
|
|
189
|
+
/**
|
|
190
|
+
* M-3964: a previous process left the card `updating` from an Update now (web or chat), which has no queue row, and no
|
|
191
|
+
* update is in progress any more. Its marker was cleared, aged out, or named another version, so nothing else will
|
|
192
|
+
* settle it, and the page said "Starting the update to …" for good. Settle it against the version running now: at
|
|
193
|
+
* least the card's is done (with the version that runs), older is a run that did not finish. A Hub-owned run follows
|
|
194
|
+
* its Hub row; an idle claim is reconcileIdleClaim's. A run younger than LEFTOVER_RUN_GRACE_MS is left alone (M-3970):
|
|
195
|
+
* a previous process that died right after launching may not have let the updater write its first marker yet, and a
|
|
196
|
+
* card settled `failed` then would never be revisited.
|
|
197
|
+
*/
|
|
198
|
+
private settleLeftoverRun;
|
|
180
199
|
/** A previous process left an `updating` row. This process did not launch it, so settle it before anyone reads the card. */
|
|
181
200
|
private reconcileIdleClaim;
|
|
182
201
|
private idleMarker;
|
package/dist/update-card.js
CHANGED
|
@@ -11,14 +11,16 @@ import { join } from "node:path";
|
|
|
11
11
|
import Database from "better-sqlite3";
|
|
12
12
|
import { atomicWriteFileSync } from "./atomic-write.js";
|
|
13
13
|
import { IdleUpdateQueue, IDLE_UPDATE_MIGRATION } from "./update-idle.js";
|
|
14
|
-
import { installedChannel } from "./update-check.js";
|
|
14
|
+
import { compareSemver, installedChannel } from "./update-check.js";
|
|
15
15
|
import { formatFleetTime } from "./tz-utils.js";
|
|
16
|
-
import { readUpdateProgress } from "./update-marker.js";
|
|
16
|
+
import { isUpdateInProgress, readUpdateProgress } from "./update-marker.js";
|
|
17
17
|
import { inUpdatePause, resolveUpdates } from "./update-settings.js";
|
|
18
18
|
export const NOT_NOW_MS = 7 * 24 * 60 * 60_000;
|
|
19
19
|
export const PICK_WITHIN_MS = NOT_NOW_MS;
|
|
20
20
|
/** Same cadence as the Hub member's update tick: look again while a local row is waiting. */
|
|
21
21
|
const IDLE_POLL_MS = 5_000;
|
|
22
|
+
/** M-3970: a leftover `updating` card is settled only this long after its run started (the updater's first-marker gap). */
|
|
23
|
+
export const LEFTOVER_RUN_GRACE_MS = 2 * 60_000;
|
|
22
24
|
const CARD_FILE = "update-card.json";
|
|
23
25
|
const QUEUE_FILE = "update-idle.sqlite";
|
|
24
26
|
/** Progress-marker name for one local idle launch. The Hub uses its own prefix. */
|
|
@@ -50,6 +52,11 @@ function stamp(ms, tz) {
|
|
|
50
52
|
return "";
|
|
51
53
|
return formatFleetTime(ms, tz);
|
|
52
54
|
}
|
|
55
|
+
/** At most five names, then how many more. */
|
|
56
|
+
function waitingList(names) {
|
|
57
|
+
const shown = names.slice(0, 5).join(", ");
|
|
58
|
+
return names.length > 5 ? `${shown} +${names.length - 5}` : shown;
|
|
59
|
+
}
|
|
53
60
|
/** Which chat line `/update` (not `/update now`) replies with. */
|
|
54
61
|
export function updateOfferReply(card, current, pinned, tz) {
|
|
55
62
|
if (pinned)
|
|
@@ -62,7 +69,10 @@ export function updateOfferReply(card, current, pinned, tz) {
|
|
|
62
69
|
return { key: "update.offer.stable", args: [version, have] };
|
|
63
70
|
switch (card.state) {
|
|
64
71
|
case "not-now": return { key: "update.offer.not_now", args: [version, have, stamp(card.notNowUntil, tz)] };
|
|
65
|
-
|
|
72
|
+
// M-3964: a wait names who it waits for (the agents still busy) and that /update now goes ahead at once.
|
|
73
|
+
case "waiting-idle": return card.waitingFor?.length
|
|
74
|
+
? { key: "update.offer.waiting_for", args: [version, waitingList(card.waitingFor)] }
|
|
75
|
+
: { key: "update.offer.waiting", args: [version] };
|
|
66
76
|
case "scheduled": return { key: "update.offer.scheduled", args: [version, stamp(card.scheduledAt, tz)] };
|
|
67
77
|
case "updating": return { key: "update.offer.updating", args: [version] };
|
|
68
78
|
case "done": return { key: "update.offer.done", args: [version] };
|
|
@@ -81,8 +91,11 @@ export class UpdateOfferCard {
|
|
|
81
91
|
quiet = 0;
|
|
82
92
|
timer;
|
|
83
93
|
answers = new Map();
|
|
94
|
+
/** M-3964: a run that began before this is a previous process's. */
|
|
95
|
+
openedAt;
|
|
84
96
|
constructor(deps) {
|
|
85
97
|
this.deps = deps;
|
|
98
|
+
this.openedAt = deps.now();
|
|
86
99
|
mkdirSync(deps.dataDir, { recursive: true });
|
|
87
100
|
this.db = new Database(join(deps.dataDir, QUEUE_FILE));
|
|
88
101
|
this.db.pragma("busy_timeout = 5000");
|
|
@@ -101,6 +114,7 @@ export class UpdateOfferCard {
|
|
|
101
114
|
});
|
|
102
115
|
this.stored = this.read();
|
|
103
116
|
this.reconcileIdleClaim();
|
|
117
|
+
this.settleLeftoverRun();
|
|
104
118
|
}
|
|
105
119
|
close() {
|
|
106
120
|
this.stopped = true;
|
|
@@ -166,8 +180,10 @@ export class UpdateOfferCard {
|
|
|
166
180
|
this.save();
|
|
167
181
|
}
|
|
168
182
|
/**
|
|
169
|
-
* A progress marker for this run. A marker that started before the run
|
|
170
|
-
* Null (no marker) does not settle.
|
|
183
|
+
* A progress marker for this run. A marker that started before the run is left alone; with no run time, so is one that
|
|
184
|
+
* names another version. Null (no marker) does not settle.
|
|
185
|
+
* M-3964: an unpinned run installs the newest on the install's line, which can be newer than the version the card was
|
|
186
|
+
* labelled with (an update check from hours ago). The marker names what was installed; the card settles with it.
|
|
171
187
|
*/
|
|
172
188
|
noteMarker(marker) {
|
|
173
189
|
if (!marker || marker.operation === "full-restart")
|
|
@@ -179,17 +195,17 @@ export class UpdateOfferCard {
|
|
|
179
195
|
return;
|
|
180
196
|
if (card.runAt !== undefined && marker.startedAt + 2_000 < card.runAt)
|
|
181
197
|
return;
|
|
182
|
-
if (marker.version && card.version && marker.version !== card.version)
|
|
198
|
+
if (card.runAt === undefined && marker.version && card.version && marker.version !== card.version)
|
|
183
199
|
return;
|
|
184
200
|
this.settleRunning(marker.stage === "complete"
|
|
185
|
-
? { state: "done" }
|
|
201
|
+
? { state: "done", ...(marker.version ? { version: marker.version } : {}) }
|
|
186
202
|
: { state: "failed", cause: marker.cause ?? "other", rolledBack: false });
|
|
187
203
|
}
|
|
188
204
|
settleRunning(outcome) {
|
|
189
205
|
if (this.stored?.state !== "updating")
|
|
190
206
|
return;
|
|
191
207
|
this.stored = outcome.state === "done"
|
|
192
|
-
? { ...this.stored, state: "done", owner: "local" }
|
|
208
|
+
? { ...this.stored, state: "done", owner: "local", ...(outcome.version ? { version: outcome.version } : {}) }
|
|
193
209
|
: { ...this.stored, state: "failed", owner: "local", failed: { cause: outcome.cause ?? "other", rolledBack: outcome.rolledBack === true } };
|
|
194
210
|
delete this.stored.queueId;
|
|
195
211
|
delete this.stored.waitingSince;
|
|
@@ -248,6 +264,7 @@ export class UpdateOfferCard {
|
|
|
248
264
|
return this.toView();
|
|
249
265
|
}
|
|
250
266
|
tick() {
|
|
267
|
+
this.settleLeftoverRun();
|
|
251
268
|
this.promote();
|
|
252
269
|
void this.queue.pump();
|
|
253
270
|
this.arm();
|
|
@@ -502,6 +519,42 @@ export class UpdateOfferCard {
|
|
|
502
519
|
return;
|
|
503
520
|
this.save();
|
|
504
521
|
}
|
|
522
|
+
/**
|
|
523
|
+
* M-3964: a previous process left the card `updating` from an Update now (web or chat), which has no queue row, and no
|
|
524
|
+
* update is in progress any more. Its marker was cleared, aged out, or named another version, so nothing else will
|
|
525
|
+
* settle it, and the page said "Starting the update to …" for good. Settle it against the version running now: at
|
|
526
|
+
* least the card's is done (with the version that runs), older is a run that did not finish. A Hub-owned run follows
|
|
527
|
+
* its Hub row; an idle claim is reconcileIdleClaim's. A run younger than LEFTOVER_RUN_GRACE_MS is left alone (M-3970):
|
|
528
|
+
* a previous process that died right after launching may not have let the updater write its first marker yet, and a
|
|
529
|
+
* card settled `failed` then would never be revisited.
|
|
530
|
+
*/
|
|
531
|
+
settleLeftoverRun() {
|
|
532
|
+
const card = this.stored;
|
|
533
|
+
if (card?.state !== "updating" || card.owner === "hub")
|
|
534
|
+
return;
|
|
535
|
+
if (card.runAt !== undefined && card.runAt >= this.openedAt)
|
|
536
|
+
return;
|
|
537
|
+
// M-3970: the updater may not have written its first marker yet, so a fresh run is left for a later tick.
|
|
538
|
+
if (card.runAt !== undefined && this.deps.now() - card.runAt < LEFTOVER_RUN_GRACE_MS)
|
|
539
|
+
return;
|
|
540
|
+
if (this.queue.pending()?.state === "updating")
|
|
541
|
+
return;
|
|
542
|
+
if (isUpdateInProgress(this.deps.dataDir, this.deps.now()))
|
|
543
|
+
return;
|
|
544
|
+
let current = null;
|
|
545
|
+
try {
|
|
546
|
+
current = this.deps.currentVersion() ?? null;
|
|
547
|
+
}
|
|
548
|
+
catch {
|
|
549
|
+
current = null;
|
|
550
|
+
}
|
|
551
|
+
if (!current)
|
|
552
|
+
return;
|
|
553
|
+
if ((compareSemver(current, card.version) ?? 0) < 0)
|
|
554
|
+
this.settleRunning({ state: "failed", cause: "other", rolledBack: false });
|
|
555
|
+
else
|
|
556
|
+
this.settleRunning({ state: "done", version: current });
|
|
557
|
+
}
|
|
505
558
|
/** A previous process left an `updating` row. This process did not launch it, so settle it before anyone reads the card. */
|
|
506
559
|
reconcileIdleClaim() {
|
|
507
560
|
const row = this.queue.pending();
|
|
@@ -560,7 +613,9 @@ export class UpdateOfferCard {
|
|
|
560
613
|
const card = this.stored;
|
|
561
614
|
if (!card)
|
|
562
615
|
return null;
|
|
563
|
-
const
|
|
616
|
+
const busy = card.state === "waiting-idle" || card.state === "offered" || card.state === "scheduled" ? this.deps.busyNames().filter(name => name.trim()) : [];
|
|
617
|
+
const waiting = card.state === "waiting-idle" ? busy : [];
|
|
618
|
+
const working = card.state === "waiting-idle" ? [] : busy;
|
|
564
619
|
return {
|
|
565
620
|
version: card.version,
|
|
566
621
|
channel: card.channel,
|
|
@@ -570,6 +625,7 @@ export class UpdateOfferCard {
|
|
|
570
625
|
...(card.state === "not-now" && card.notNowUntil !== undefined ? { notNowUntil: card.notNowUntil } : {}),
|
|
571
626
|
...(card.state === "scheduled" && card.scheduledAt !== undefined ? { scheduledAt: card.scheduledAt } : {}),
|
|
572
627
|
...(waiting.length ? { waitingFor: waiting } : {}),
|
|
628
|
+
...(working.length ? { working } : {}),
|
|
573
629
|
...(card.state === "waiting-idle" && card.waitingSince !== undefined ? { waitingSince: card.waitingSince } : {}),
|
|
574
630
|
...(card.lastAnswer ? { lastAnswer: card.lastAnswer } : {}),
|
|
575
631
|
...(card.state === "failed" && card.failed ? { failed: card.failed } : {}),
|