@songsid/agend 2.3.5-beta.1 → 2.3.5-beta.2

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.
Files changed (106) hide show
  1. package/dist/agent-cli-instructions.md +1 -1
  2. package/dist/agent-cli.js +5 -2
  3. package/dist/agent-cli.js.map +1 -1
  4. package/dist/agent-whats-new.js +4 -0
  5. package/dist/agent-whats-new.js.map +1 -1
  6. package/dist/auth-api.d.ts +1 -1
  7. package/dist/auth-api.js +1 -1
  8. package/dist/auth-api.js.map +1 -1
  9. package/dist/backend/claude-code.d.ts +1 -0
  10. package/dist/backend/claude-code.js +56 -10
  11. package/dist/backend/claude-code.js.map +1 -1
  12. package/dist/backend/kiro.js +1 -1
  13. package/dist/backend/kiro.js.map +1 -1
  14. package/dist/backend/types.d.ts +4 -0
  15. package/dist/backend/types.js.map +1 -1
  16. package/dist/channel/access-manager.d.ts +1 -6
  17. package/dist/channel/access-manager.js +4 -94
  18. package/dist/channel/access-manager.js.map +1 -1
  19. package/dist/channel/adapters/discord.d.ts +0 -2
  20. package/dist/channel/adapters/discord.js +0 -8
  21. package/dist/channel/adapters/discord.js.map +1 -1
  22. package/dist/channel/adapters/telegram.d.ts +0 -3
  23. package/dist/channel/adapters/telegram.js +1 -30
  24. package/dist/channel/adapters/telegram.js.map +1 -1
  25. package/dist/channel/mcp-tools.js +2 -2
  26. package/dist/channel/mcp-tools.js.map +1 -1
  27. package/dist/channel/types.d.ts +0 -2
  28. package/dist/claude-model-minimum.d.ts +7 -0
  29. package/dist/claude-model-minimum.js +16 -0
  30. package/dist/claude-model-minimum.js.map +1 -0
  31. package/dist/cli.js +1 -19
  32. package/dist/cli.js.map +1 -1
  33. package/dist/config-validator.js +2 -1
  34. package/dist/config-validator.js.map +1 -1
  35. package/dist/daemon.d.ts +43 -1
  36. package/dist/daemon.js +176 -27
  37. package/dist/daemon.js.map +1 -1
  38. package/dist/decision-list.d.ts +2 -0
  39. package/dist/decision-list.js +1 -1
  40. package/dist/decision-list.js.map +1 -1
  41. package/dist/fleet-manager.d.ts +24 -0
  42. package/dist/fleet-manager.js +98 -21
  43. package/dist/fleet-manager.js.map +1 -1
  44. package/dist/general-knowledge/skills/concepts/SKILL.md +17 -6
  45. package/dist/general-knowledge/skills/delegation-playbook/SKILL.md +4 -1
  46. package/dist/general-knowledge/steering/core-rules.md +6 -4
  47. package/dist/instance-lifecycle.d.ts +3 -0
  48. package/dist/instance-lifecycle.js +4 -0
  49. package/dist/instance-lifecycle.js.map +1 -1
  50. package/dist/locale.js +44 -34
  51. package/dist/locale.js.map +1 -1
  52. package/dist/outbound-handlers.js +1 -1
  53. package/dist/outbound-handlers.js.map +1 -1
  54. package/dist/outbound-schemas.d.ts +2 -0
  55. package/dist/outbound-schemas.js +4 -2
  56. package/dist/outbound-schemas.js.map +1 -1
  57. package/dist/quickstart-api.js +2 -2
  58. package/dist/quickstart-api.js.map +1 -1
  59. package/dist/reply-buttons-controller.d.ts +5 -1
  60. package/dist/reply-buttons-controller.js +8 -4
  61. package/dist/reply-buttons-controller.js.map +1 -1
  62. package/dist/reply-buttons.d.ts +6 -2
  63. package/dist/reply-buttons.js +7 -3
  64. package/dist/reply-buttons.js.map +1 -1
  65. package/dist/scheduler/db.d.ts +10 -0
  66. package/dist/scheduler/db.js +38 -11
  67. package/dist/scheduler/db.js.map +1 -1
  68. package/dist/scheduler/types.d.ts +6 -1
  69. package/dist/structured-signin.js +3 -1
  70. package/dist/structured-signin.js.map +1 -1
  71. package/dist/team-membership.d.ts +7 -0
  72. package/dist/team-membership.js +10 -0
  73. package/dist/team-membership.js.map +1 -0
  74. package/dist/tips.js +4 -4
  75. package/dist/tips.js.map +1 -1
  76. package/dist/tmux-manager.d.ts +1 -1
  77. package/dist/tmux-manager.js +4 -1
  78. package/dist/tmux-manager.js.map +1 -1
  79. package/dist/topic-commands.js +1 -1
  80. package/dist/topic-commands.js.map +1 -1
  81. package/dist/types.d.ts +2 -0
  82. package/dist/types.js.map +1 -1
  83. package/dist/ui/backend-signin.js +1 -1
  84. package/dist/ui/chat-strings.js +7 -7
  85. package/dist/ui/settings-dialogs.js +3 -1
  86. package/dist/ui/settings-quota-notice.js +8 -6
  87. package/dist/ui/settings-strings.js +6 -4
  88. package/dist/ui/shared/app-i18n.js +4 -2
  89. package/dist/ui/shared/app-shell.js +8 -3
  90. package/dist/ui/shared/setup-host-text.js +4 -1
  91. package/dist/ui/shared/signin.js +3 -1
  92. package/dist/ui/shared/view-strings.js +4 -4
  93. package/dist/ui/shared/web-authorize.js +4 -4
  94. package/dist/update-dispatch.d.ts +32 -4
  95. package/dist/update-dispatch.js +146 -16
  96. package/dist/update-dispatch.js.map +1 -1
  97. package/dist/update-launch.d.ts +1 -1
  98. package/dist/update-launch.js +2 -2
  99. package/dist/update-launch.js.map +1 -1
  100. package/dist/usage/providers.d.ts +1 -0
  101. package/dist/usage/providers.js +13 -9
  102. package/dist/usage/providers.js.map +1 -1
  103. package/dist/view-api.d.ts +2 -8
  104. package/dist/view-api.js +3 -9
  105. package/dist/view-api.js.map +1 -1
  106. package/package.json +2 -1
@@ -162,8 +162,8 @@ register("chat", {
162
162
 
163
163
  cmdConfirm: "清空", cmdConfirmBackend: "切換並重新啟動", cmdRunning: "執行 /{0} 中…", cmdNotCommand: "這裡沒有這個指令——按 Enter 會當成一般訊息送出。", cmdNotGuests: "訪客在這裡不能使用這個指令。", cmdDismiss: "關閉", cmdCommands: "指令",
164
164
  compactRunning: "壓縮中…", compactDone: "✅ 對話已壓縮", compactUnknown: "這個後端不會回報壓縮何時完成。",
165
- compactTimeout: "{0} 分鐘內沒有看到壓縮完成的紀錄,請到代理自己的對話確認。",
166
- compactLost: "無法再追蹤這次壓縮:指令沒有送到代理,或代理已停止、換了後端。",
165
+ compactTimeout: "{0} 分鐘內沒有看到壓縮完成的紀錄,請到 Agent 自己的對話確認。",
166
+ compactLost: "無法再追蹤這次壓縮:指令沒有送到 Agent,或 Agent 已停止、換了後端。",
167
167
  compactNotCompacted: "kiro 沒有壓縮對話:對話太短,或壓縮被中止了。",
168
168
  cmdChoose: "選擇", cmdCurrent: "目前", cmdSignIn: "登入", cmdSignInTo: "登入 {0}", chipCompact: "壓縮", chipClear: "清空…", chipContext: "已用 {0}% 的 context",
169
169
  chipModel: "模型:{0}——選擇其他", chipEffort: "推理強度:{0}——選擇其他",
@@ -189,7 +189,7 @@ register("chat", {
189
189
  pvChanged: "預覽已停止——訊息內容變了。請再預覽一次。", pvTruncated: "內容被截斷——請 agent 改用 .html 檔案傳送。",
190
190
  pvLoading: "正在讀取檔案…", pvAttOver: "這個檔案超過 50 MB,不提供預覽,請下載後開啟。",
191
191
  pvLarge: "這個檔案比較大({0}),仍要預覽嗎?", pvAnyway: "仍要預覽",
192
- pvAttGone: "這裡已無法取得這個檔案(檔案已變更,或艦隊已重新啟動)。請 agent 再傳一次。",
192
+ pvAttGone: "這裡已無法取得這個檔案(檔案已變更,或 Fleet 已重新啟動)。請 agent 再傳一次。",
193
193
  pvAttFailed: "無法讀取這個檔案,請再試一次。",
194
194
  pvBannerAck: "我知道了", pvBannerAckTitle: "隱藏這則提醒,直到下次登入",
195
195
  attGone: "AgEnD 重新啟動後找不到這個檔案(已移動、刪除或變更)。請 agent 再傳一次。", attUnavailable: "無法取得", yesterdayAt: "昨天 {0}",
@@ -221,17 +221,17 @@ register("chat", {
221
221
  pvWhyOptin: "還沒允許 HTML 預覽。可從這張卡片的 ⋯ 選單或「設定 → 偏好設定」允許。",
222
222
  pvWhyOptinPanel: "還沒允許 HTML 預覽。",
223
223
  pvWhyNever: "這台裝置在這個工作階段已關閉預覽。",
224
- pvWhyOrigin: "預覽已關閉:這個頁面位於 {0},但艦隊認為它位於 {1}(有會改寫 Host 的代理)。請讓外部 Host 原樣傳入,或設定 web.preview_origin。",
224
+ pvWhyOrigin: "預覽已關閉:這個頁面位於 {0},但 Fleet 認為它位於 {1}(有會改寫 Host 的反向代理)。請讓外部 Host 原樣傳入,或設定 web.preview_origin。",
225
225
  pvUnknownAddress: "未知的網址", pvWhyServer: "這裡無法使用預覽。",
226
226
  pvHtmlOver: "這段 HTML 超過 50 MB,不提供預覽,請下載後開啟。",
227
227
  pvNoAnswer: "無法預覽:預覽在 3 秒內沒有回應。如果先前的預覽卡住了,它可能還在執行——請在新分頁開啟儀表板。透過 SSH 使用時,也要轉送預覽的連接埠。",
228
228
  pvStoppedAnswering: "預覽沒有回應,已將它關閉。", pvSwitchedOff: "這台裝置已關閉預覽。",
229
- pvAnother: "另一個預覽已開始。", pvWrongBoot: "無法預覽:預覽連接埠上回應的不是這個艦隊。",
229
+ pvAnother: "另一個預覽已開始。", pvWrongBoot: "無法預覽:預覽連接埠上回應的不是這個 Fleet。",
230
230
  pvBanner: "預覽會在隔離的框架裡執行 agent 的 HTML。它無法使用你的登入,但可能把資料傳出去。只預覽你信任的內容。預覽可能讓這個分頁變慢或卡住。",
231
- pvServer_fleetOff: "這個艦隊已關閉預覽(web.preview: false)。", pvServer_unchecked: "無法確認這個網址。",
231
+ pvServer_fleetOff: "這個 Fleet 已關閉預覽(web.preview: false)。", pvServer_unchecked: "無法確認這個網址。",
232
232
  pvServer_noPort: "預覽沒有可用的連接埠:請設定 web.preview_port(health_port 已是最大的連接埠)。",
233
233
  pvServer_notListed: "{0} 不提供預覽:請把這個網址(含連接埠)加入 web.allowed_hosts,並設定 web.preview_origin。",
234
- pvServer_needOrigin: "透過通道或代理開啟儀表板時,預覽需要設定 web.preview_origin。",
234
+ pvServer_needOrigin: "透過通道或反向代理開啟儀表板時,預覽需要設定 web.preview_origin。",
235
235
  pvServer_needHttps: "以 https 開啟儀表板時,預覽需要 https 的 web.preview_origin。",
236
236
  pvServer_sameOrigin: "預覽的來源不能和儀表板相同。",
237
237
  pvServer_publicLink: "公開連結的預覽已關閉(web.preview_on_public_link: false)。要預覽,請在執行 AgEnD 的那台機器上開啟儀表板。",
@@ -33,6 +33,8 @@ const CODEX_SPEED_CHOICES = ["", "standard", "fast"];
33
33
  const byId = (id) => (typeof document !== "undefined" ? document.getElementById(id) : null);
34
34
 
35
35
  const tn = (k, ...v) => t(`settings.${k}`, ...v);
36
+ // A cached older dictionary keeps the old alias label until reload, never a missing translation key.
37
+ const legacyPairingLabel = () => { const label = tn("legacyPairing"); return label === "settings.legacyPairing" ? "pairing" : label; };
36
38
  export const impactText = (kind) => tn(kind === "now" ? "impactNow" : kind === "fleet" ? "impactFleet" : "impactAgent");
37
39
  /** Ask in the app's own dialog (#1408 step 5): resolves true for the confirm button, false otherwise. */
38
40
  export const ask = (message, opts = {}) => confirmDialog({ message, ...opts });
@@ -516,7 +518,7 @@ export function BotDialog({ id, ctx, onClose }) {
516
518
  if (!ch) return null;
517
519
  return html`<${EditDialog} title=${type === "telegram" ? "Telegram" : "Discord"} subtitle=${id} onClose=${onClose} onStage=${stage} impacts=${pendingImpacts()} schema=${schema}>
518
520
  <div class="grid2">
519
- <div class="field">${L(tn("accessMode"), "fleet.channel.access.mode", "bot-mode")}<${Select} id="bot-mode" value=${mode} onChange=${setMode} options=${ACCESS_MODES} />
521
+ <div class="field">${L(tn("accessMode"), "fleet.channel.access.mode", "bot-mode")}<${Select} id="bot-mode" value=${mode} onChange=${setMode} options=${ACCESS_MODES.map((value) => value === "pairing" ? { value, label: legacyPairingLabel() } : value)} />
520
522
  <${Feedback} warning=${accessWarn} /></div>
521
523
  <div class="field">${L(tn("allowedUsers"), "fleet.channel.access.allowed_users")}<${ChipList} items=${users} onChange=${setUsers} placeholder=${tn("userIdPlaceholder")} label=${tn("allowedUsers")} /></div>
522
524
  </div>
@@ -80,10 +80,12 @@ export function QuotaNoticeSettings({ ctx }) {
80
80
  const effective = { enabled: true, thresholds: [10], periods: ["weekly"], ...parsed.fleet,
81
81
  ...(selectedBackend ? parsed[`backend:${selectedBackend}`] : {}), ...(scope.startsWith("agent:") || scope.startsWith("classic:") ? parsed[scope] : {}) };
82
82
  const update = k => e => setFields(f => ({ ...f, [fieldKey(scope, k)]: e.target.value }));
83
- return html`<section class="s-card" id="quota-notices"><h2>${text.heading}</h2><p>${text.hint}</p><p class="muted">${text.defaults}</p>
83
+ // alpha.6 feedback (#3, main twin of #3320): a Settings card like the others here (card, its h3 and notes, the fields in
84
+ // the grid), not a bare heading over full-width fields on the page background (class "s-card" had no style).
85
+ return html`<section class="card" id="quota-notices"><h3>${text.heading}</h3><p class="note">${text.hint}</p><p class="note">${text.defaults}</p>
84
86
  ${!supported ? html`<p role="status">${text.old}</p>` : null}
85
- ${!invalid ? html`<p class="muted" data-quota-effective>${text.effective}: ${effective.enabled ? text.on : text.off} · ${effective.thresholds.map(v => `${v}%`).join(", ") || "—"} · ${effective.periods.join(", ") || "—"}</p>` : null}
86
- <fieldset disabled=${!supported} class="s-quota-fields">
87
+ ${!invalid ? html`<p class="note" data-quota-effective>${text.effective}: ${effective.enabled ? text.on : text.off} · ${effective.thresholds.map(v => `${v}%`).join(", ") || "—"} · ${effective.periods.join(", ") || "—"}</p>` : null}
88
+ <fieldset disabled=${!supported} class="s-quota-fields grid2">
87
89
  <div class="field"><label for="qn-target">${text.target}</label><select id="qn-target" value=${form.target} onChange=${e => setFields(f => ({ ...f, target: e.target.value }))}>
88
90
  <option value="general">${text.general}</option>${Object.entries(instances).filter(([n]) => n !== "general").map(([n, c]) => html`<option value=${n}>${c.display_name || n}</option>`)}
89
91
  ${form.target !== "general" && !Object.hasOwn(instances, form.target) ? html`<option value=${form.target}>${form.target}</option>` : null}
@@ -94,7 +96,7 @@ export function QuotaNoticeSettings({ ctx }) {
94
96
  ${Object.entries(classic).map(([n, c]) => html`<option value=${`classic:${n}`}>${text.classic} · ${c.name || c.instanceName || n}</option>`)}
95
97
  </select></div>
96
98
  <div class="field"><label for="qn-enabled">${text.enabled}</label><select id="qn-enabled" value=${value.enabled} onChange=${update("enabled")}><option value="">${text.inherit}</option><option value="on">${text.on}</option><option value="off">${text.off}</option></select></div>
97
- <div class="field"><label for="qn-thresholds">${text.thresholds}</label><input id="qn-thresholds" value=${value.thresholds} onInput=${update("thresholds")} placeholder="10" /><p class="muted">${text.thresholdHint}</p></div>
98
- <div class="field"><label for="qn-periods">${text.periods}</label><input id="qn-periods" value=${value.periods} onInput=${update("periods")} placeholder=${text.periodExample} /><p class="muted">${text.periodHint}</p></div>
99
- </fieldset>${invalid ? html`<p class="feedback error" role="alert">${text.error}</p>` : null}<p class="muted">${text.sources}</p></section>`;
99
+ <div class="field"><label for="qn-thresholds">${text.thresholds}</label><input id="qn-thresholds" value=${value.thresholds} onInput=${update("thresholds")} placeholder="10" /><p class="note">${text.thresholdHint}</p></div>
100
+ <div class="field"><label for="qn-periods">${text.periods}</label><input id="qn-periods" value=${value.periods} onInput=${update("periods")} placeholder=${text.periodExample} /><p class="note">${text.periodHint}</p></div>
101
+ </fieldset>${invalid ? html`<p class="feedback error" role="alert">${text.error}</p>` : null}<p class="note">${text.sources}</p></section>`;
100
102
  }
@@ -132,6 +132,7 @@ register("settings", {
132
132
  pause: "Pause",
133
133
  wake: "Wake",
134
134
  accessMode: "Access mode",
135
+ legacyPairing: "pairing (legacy; same as locked)",
135
136
  affected: "Affected instances",
136
137
  language: "Language (bot replies)",
137
138
  defaultBackend: "Default backend",
@@ -570,10 +571,10 @@ register("settings", {
570
571
  vaSessionsTitle: "Authorized sessions", vaSessionsNone: "No session is authorized now.", vaSessionUntil: "Authorized {0} · until {1}",
571
572
  vaRevoke: "Revoke web authority", vaRevokeTitle: "Revoke all web authority?", vaRevokeConfirm: "Every authority given from the web so far reads as none from now on, and every session's authorization ends. Nobody is signed out: a session carries authority again once it is authorized again.",
572
573
  vaRevoked: "Web authority given so far is revoked.", vaRevokedNotDurable: "Revoked for now, but it could not be saved: web authority stays off until it can be, and a restart before then undoes the revocation.", vaRevokeFailed: "That did not work — try again.",
573
- webReadOnlyLead: "Read-only here: these decide what the dashboard listens on and exposes. Edit fleet.yaml, then run agend reload (web.preview_port and web.preview_origin take a restart of AgEnD).",
574
+ webReadOnlyLead: "Read-only: these values control the dashboard's listeners and exposure. This page cannot change them.",
574
575
  searchRetentionUnset: "not set (no age limit; 300,000-row cap)",
575
576
  searchRetentionZero: "0 (no age limit; 300,000-row cap)",
576
- webSearchHint: "Global search keeps entries with no age limit by default. The daily prune still caps the index at 300,000 rows (oldest first). Set web.search.retention_days in fleet.yaml (1–3650 days, or 0 for no age limit); it takes effect at the next fleet start.",
577
+ webSearchHint: "Global search keeps entries with no age limit by default. The daily prune still caps the index at 300,000 rows (oldest first). Retention cannot be changed here.",
577
578
  defaultsTitle: "Defaults",
578
579
  classicBackend: "ClassicBot default backend",
579
580
  whoUsesClassic: "Who can use ClassicBot",
@@ -789,6 +790,7 @@ register("settings", {
789
790
  pause: "暫停",
790
791
  wake: "喚醒",
791
792
  accessMode: "存取模式",
793
+ legacyPairing: "pairing(舊版;等同 locked)",
792
794
  affected: "受影響 instances",
793
795
  language: "語言(bot 回覆)",
794
796
  defaultBackend: "預設後端",
@@ -1225,10 +1227,10 @@ register("settings", {
1225
1227
  vaSessionsTitle: "已授權的 session", vaSessionsNone: "目前沒有已授權的 session。", vaSessionUntil: "{0} 授權 · 到 {1}",
1226
1228
  vaRevoke: "撤銷網頁授權", vaRevokeTitle: "撤銷所有網頁授權?", vaRevokeConfirm: "到目前為止從網頁給出的授權,從現在起都視為無,所有 session 的授權也會結束。不會登出任何人:session 再授權一次後,送出的訊息會再帶有授權。",
1227
1229
  vaRevoked: "已撤銷到目前為止的網頁授權。", vaRevokedNotDurable: "已暫時撤銷,但無法保存:在可以保存之前網頁授權會保持關閉,而在那之前重新啟動會讓這次撤銷失效。", vaRevokeFailed: "沒有成功,請再試一次。",
1228
- webReadOnlyLead: "這裡僅供檢視:這些設定決定儀表板監聽和公開的內容。請編輯 fleet.yaml 後執行 agend reload(web.preview_port 與 web.preview_origin 需要重新啟動 AgEnD)。",
1230
+ webReadOnlyLead: "僅供檢視:這些設定決定儀表板監聽和公開的內容。這個頁面無法修改。",
1229
1231
  searchRetentionUnset: "未設定(不限天數;上限 30 萬筆)",
1230
1232
  searchRetentionZero: "0(不限天數;上限 30 萬筆)",
1231
- webSearchHint: "全域搜尋預設不限天數。每日清理仍會把索引上限維持在 30 萬筆(先刪最舊的)。在 fleet.yaml 設定 web.search.retention_days(1–3650 天,或 0 代表不限天數),下次啟動 fleet 後生效。",
1233
+ webSearchHint: "全域搜尋預設不限天數。每日清理仍會把索引上限維持在 30 萬筆(先刪最舊的)。這裡無法變更保存期限。",
1232
1234
  defaultsTitle: "預設值",
1233
1235
  classicBackend: "ClassicBot 預設 backend",
1234
1236
  whoUsesClassic: "誰可以使用 ClassicBot",
@@ -101,7 +101,8 @@ register("app", {
101
101
  opFailed: "Settings were not applied", openSettings: "Open Settings",
102
102
  restartWaiting: "{0} saved change(s) take effect after AgEnD restarts", restartNow: "Restart now", restartLater: "Later",
103
103
  restartConfirm: "Restart AgEnD now?\n\nEvery agent stops and starts again, work in progress is interrupted, and the panel is unreachable for up to a minute. A notice is posted to your chat channel.",
104
- restartOnHost: "Run agend restart on the host to use them.",
104
+ restartOnHost: "Restart AgEnD to use them.",
105
+ restartOnHostChat: "Send /restart in General to use them.",
105
106
  restartRefused: "Restart refused: {0}",
106
107
  pendingSent: "Sent for confirmation — a fleet admin confirms it in chat.",
107
108
  pendingSelfSent: "Confirmed by your account (this browser is web-verified) — applying.",
@@ -148,7 +149,8 @@ register("app", {
148
149
  opFailed: "設定沒有套用", openSettings: "開啟設定",
149
150
  restartWaiting: "{0} 項已儲存的變更要在 AgEnD 重新啟動後才會生效", restartNow: "立即重新啟動", restartLater: "稍後",
150
151
  restartConfirm: "現在重新啟動 AgEnD?\n\n所有 agent 都會停止再啟動,進行中的工作會被中斷,面板會有最多約一分鐘無法連線。聊天頻道會收到一則通知。",
151
- restartOnHost: "請在主機上執行 agend restart 讓它們生效。",
152
+ restartOnHost: "請重新啟動 AgEnD 讓它們生效。",
153
+ restartOnHostChat: "請在 General 傳 /restart 讓它們生效。",
152
154
  restartRefused: "重新啟動被拒絕:{0}",
153
155
  pendingSent: "已送出確認——由 fleet 管理員在聊天中確認。",
154
156
  pendingSelfSent: "已由你的帳號確認(這個瀏覽器已通過網頁驗證)——套用中。",
@@ -664,10 +664,12 @@ export async function refreshRestartPending() {
664
664
  * Restart now asks first and is never automatic (the leader's default: a Save that restarted on its own once took 33
665
665
  * agents down at once). Asked again whenever a Save or a restart settles. Left to the Save in hand while it runs or offers
666
666
  * its own restart (Settings' card, or the line above in another panel). Over a temporary public link it says so and
667
- * offers nothing; with no Settings job to carry the restart (a hand edit), it says how to restart on the host.
667
+ * offers nothing. Restart now is a separate button when a Settings job exists. This muted hint is the no-job case
668
+ * only (a hand edit of fleet.yaml): chat fleets send /restart in General; web-only fleets are told to restart AgEnD,
669
+ * with no command. web-claude will add a button for that case separately.
668
670
  */
669
671
  function RestartLine() {
670
- const { restartPending: pending, settingsOp: op, restartRunner } = useStore(appStore);
672
+ const { restartPending: pending, settingsOp: op, restartRunner, connections } = useStore(appStore);
671
673
  const [later, setLater] = useState(null);
672
674
  const [busy, setBusy] = useState(false);
673
675
  const settled = !op || (!["writing", "posting", "watching"].includes(op.phase) && op.restart !== "busy");
@@ -677,6 +679,9 @@ function RestartLine() {
677
679
  const seen = `${pending.jobId}|${pending.keys.join(",")}`;
678
680
  if (later === seen) return null;
679
681
  const canRestart = !!pending.jobId && typeof restartRunner === "function";
682
+ const hint = !pending.jobId
683
+ ? t(connections > 0 ? "app.restartOnHostChat" : "app.restartOnHost")
684
+ : null;
680
685
  const restart = async () => {
681
686
  if (!(await confirmDialog({ title: t("app.restartNow"), message: t("app.restartConfirm"), confirmLabel: t("app.restartNow"), danger: true }))) return;
682
687
  setBusy(true);
@@ -692,7 +697,7 @@ function RestartLine() {
692
697
  return html`<div data-trust="status" class="conn restart-line lbar" role="status">
693
698
  <span>${t("app.restartWaiting", Math.max(1, pending.keys.length))}</span>
694
699
  ${pending.keys.length ? html`<span class="muted restart-keys">${pending.keys.join(", ")}</span>` : null}
695
- ${!pending.jobId ? html`<span class="muted">${t("app.restartOnHost")}</span>` : null}
700
+ ${hint ? html`<span class="muted">${hint}</span>` : null}
696
701
  ${canRestart ? html`<button type="button" class="btn btn-sm btn-primary" disabled=${busy} onClick=${restart}>${t("app.restartNow")}</button>` : null}
697
702
  <button type="button" class="btn btn-sm" onClick=${() => setLater(seen)}>${t("app.restartLater")}</button></div>`;
698
703
  }
@@ -50,7 +50,7 @@ export const HOST_MESSAGES = [
50
50
  ["unknown probe", "不支援的檢查"],
51
51
  ["fleet not loaded", "設定尚未載入"],
52
52
  ["another secret operation is still running", "另一個寫入 token 的操作還在進行中"],
53
- ["setup cleanup failed; inspect configuration on the host", "設定的復原失敗;請在主機上檢查設定"],
53
+ ["setup cleanup failed; some saved changes may not have been undone. This page cannot repair the incomplete rollback", "設定的復原失敗;部分已儲存的變更可能未能撤銷。這個頁面無法修復未完成的復原"],
54
54
  ["setup was not committed", "設定沒有寫入"],
55
55
  ["Token verification is not permitted over a public link", "公開連結不能驗證 token"],
56
56
  ["This bot token is already being polled by the running fleet. Enter the group id by hand, or stop AgEnD first.", "執行中的 fleet 正在使用這個 bot token。請手動輸入群組 id,或先停止 AgEnD。"],
@@ -64,6 +64,8 @@ export const HOST_MESSAGES = [
64
64
  /** What the host answers with a code instead of words (the confirmation gate, settings-effect.ts; the finish step). */
65
65
  export const HOST_CODES = {
66
66
  en: {
67
+ // Cached servers may still return this older message; its recovery copy follows the current page.
68
+ "setup cleanup failed; inspect configuration on the host": "setup cleanup failed; some saved changes may not have been undone. This page cannot repair the incomplete rollback",
67
69
  invalid_quickstart: "This setup is not valid. Review it and try again.",
68
70
  connection_exists: "That connection already exists — a new connection never replaces one.",
69
71
  agent_conflict: "That agent name is taken, or that agent does not exist.",
@@ -76,6 +78,7 @@ export const HOST_CODES = {
76
78
  signin_cleanup_failed: "The login process could not be confirmed closed. Close it on the host and restart setup before retrying.",
77
79
  },
78
80
  "zh-TW": {
81
+ "setup cleanup failed; inspect configuration on the host": "設定的復原失敗;部分已儲存的變更可能未能撤銷。這個頁面無法修復未完成的復原",
79
82
  invalid_quickstart: "這份設定無效。請檢查後再試一次。",
80
83
  connection_exists: "這個連線已存在 —— 新的連線不會取代既有的連線。",
81
84
  agent_conflict: "這個 agent 名稱已被使用,或那個 agent 不存在。",
@@ -11,6 +11,7 @@
11
11
  const $ = (id) => document.getElementById(id);
12
12
  const T = {
13
13
  en: {
14
+ signout_unsaved: "Signed out for now, but the change could not be saved: a restart may bring the session back. This page cannot repair session storage.",
14
15
  checking: "Checking your session…", title: "Sign in to AgEnD", lead: "Enter your sign-in code.",
15
16
  label: "One-time code", submit: "Sign in", working: "Signing in…",
16
17
  hint: "No code? Send /web in General, then press a sign-in button to get one.",
@@ -29,6 +30,7 @@
29
30
  resend_refused_web: "A new code could not be sent. Run agend web --code on the AgEnD computer for one.",
30
31
  },
31
32
  "zh-TW": {
33
+ signout_unsaved: "暫時登出了,但變更沒能儲存:重新啟動後這個工作階段可能會回來。這個頁面無法修復工作階段的儲存問題。",
32
34
  checking: "正在確認登入狀態…", title: "登入 AgEnD", lead: "輸入登入碼。",
33
35
  label: "一次性登入碼", submit: "登入", working: "登入中…",
34
36
  hint: "沒收到?在 General 傳 /web,再按登入按鈕取碼。",
@@ -120,7 +122,7 @@
120
122
  // A sign-out the server could not make durable says so here, once (agend-auth.js signOut).
121
123
  try {
122
124
  const note = sessionStorage.getItem("agend_signout_note");
123
- if (note) { sessionStorage.removeItem("agend_signout_note"); $("msg").textContent = note; }
125
+ if (note) { sessionStorage.removeItem("agend_signout_note"); $("msg").textContent = note.startsWith("Signed out for now, but the change could not be saved") ? t("signout_unsaved") : note; }
124
126
  } catch { /* private mode */ }
125
127
  $("code").focus();
126
128
  offerResend();
@@ -140,8 +140,8 @@ register("view", {
140
140
  "usage.hint.grok_no_login": "auth.json has no usable login. Run `grok login`.",
141
141
  "usage.hint.login_kiro": "Log in with the Kiro CLI (`kiro-cli`).",
142
142
  "usage.hint.kiro_signed_out": "Signed out — run `kiro-cli` to log in.",
143
- "usage.hint.claude_profile_signed_out": "Not logged in — sign in with: {0}",
144
- "usage.hint.claude_profile_signed_out_chat": "Not logged in — sign in with `{0}` (or run `{1}` on the host).",
143
+ "usage.hint.claude_profile_signed_out": "Not logged in — sign in from Settings → Agents → Sign-ins.",
144
+ "usage.hint.claude_profile_signed_out_chat": "Not logged in — sign in from Settings → Agents → Sign-ins, or with `{0}`.",
145
145
  "usage.hint.token_refreshing": "Token refreshing — try again in a moment.",
146
146
  "usage.hint.subscription_no_credit": "Subscription — no credit usage to report.",
147
147
  "usage.hint.no_quota_account": "No quota information available for this account type.",
@@ -408,8 +408,8 @@ register("view", {
408
408
  "usage.hint.grok_no_login": "auth.json 沒有可用的登入資料。請執行 `grok login`。",
409
409
  "usage.hint.login_kiro": "請使用 Kiro CLI(`kiro-cli`)登入。",
410
410
  "usage.hint.kiro_signed_out": "目前已登出;請執行 `kiro-cli` 登入。",
411
- "usage.hint.claude_profile_signed_out": "尚未登入;請用這行指令登入:{0}",
412
- "usage.hint.claude_profile_signed_out_chat": "尚未登入;請用 `{0}` 登入(或在主機上執行 `{1}`)。",
411
+ "usage.hint.claude_profile_signed_out": "尚未登入;請到設定 → Agents →「登入」。",
412
+ "usage.hint.claude_profile_signed_out_chat": "尚未登入;請到設定 → Agents →「登入」,或用 `{0}` 登入。",
413
413
  "usage.hint.token_refreshing": "Token 更新中 — 請稍候再試。",
414
414
  "usage.hint.subscription_no_credit": "訂閱方案沒有可回報的額度用量。",
415
415
  "usage.hint.no_quota_account": "此帳號類型沒有可用的額度資訊。",
@@ -14,8 +14,8 @@ register("webauth", {
14
14
  sent: "Sent — confirm it in your DM within 5 minutes.",
15
15
  reason_disabled: "Web authority is turned off.",
16
16
  reason_loopback_only: "Only this computer can authorize, and this browser is not on it.",
17
- reason_no_account: "This browser was not signed in as an account (agend web): sign in with /web to authorize.",
18
- reason_host_sign_in: "To speak as this computer's admin, sign in again on this computer with agend web --code.",
17
+ reason_no_account: "This browser has no chat-account identity. Open General in Telegram or Discord and send /web to sign in as your account.",
18
+ reason_host_sign_in: "This browser no longer has this computer's admin authority. This sign-in cannot be renewed on this page.",
19
19
  reason_not_admin: "Your account is not a fleet admin here.",
20
20
  reason_not_admin_session: "Guests can't authorize.",
21
21
  reason_token_rotated: "The dashboard's token changed: sign in again.",
@@ -43,8 +43,8 @@ register("webauth", {
43
43
  sent: "已送出——請在 5 分鐘內到私訊確認。",
44
44
  reason_disabled: "網頁授權已關閉。",
45
45
  reason_loopback_only: "只有這台電腦可以授權,而這個瀏覽器不在這台電腦上。",
46
- reason_no_account: "這個瀏覽器不是用帳號登入的(agend web):請用 /web 登入後再授權。",
47
- reason_host_sign_in: "要以這台電腦的管理者身分發言,請在這台電腦上執行 agend web --code 重新登入。",
46
+ reason_no_account: "這個瀏覽器沒有聊天帳號身分。請到 Telegram 或 Discord 的 General 傳送 /web,以你的帳號登入。",
47
+ reason_host_sign_in: "這個瀏覽器已沒有這台電腦的管理者授權。這個頁面無法重新取得這個登入的授權。",
48
48
  reason_not_admin: "你的帳號在這裡不是 fleet 管理者。",
49
49
  reason_not_admin_session: "訪客無法授權。",
50
50
  reason_token_rotated: "儀表板的 token 已變更:請重新登入。",
@@ -1,16 +1,39 @@
1
1
  export interface DispatchDeps {
2
- run(command: string, args: string[], timeoutMs: number): Promise<{
2
+ /** `env.PATH` (#3440) replaces PATH for that one program: an npm is asked in the PATH the update will run with. */
3
+ run(command: string, args: string[], timeoutMs: number, env?: {
4
+ PATH: string;
5
+ }): Promise<{
3
6
  status: number | null;
4
7
  stdout: string;
5
8
  }>;
6
9
  readFile(path: string): Promise<string>;
7
10
  realpath(path: string): Promise<string>;
11
+ /** An executable file there (#3440). */
12
+ isExecutable?(path: string): Promise<boolean>;
13
+ /** The package directory this code runs from — whose global root the npm asked must have (#3440). Null: unknown. */
14
+ packageDir?: string | null;
15
+ /** The Node running this process (#3440): the npm beside it is a candidate when AgEnD runs on a plain Node. */
16
+ execPath?: string;
17
+ /** This process's PATH (#3440): where PATH's `npm` lives. */
18
+ pathEnv?: string;
8
19
  }
9
20
  export declare const defaultDispatchDeps: DispatchDeps;
21
+ /**
22
+ * #3440: the `npm` beside a POSIX global install of this package: `<prefix>/lib/node_modules/@songsid/agend` →
23
+ * `<prefix>/bin/npm`, run by `<prefix>/bin/node`. npm takes its global prefix from the Node that runs it, and its
24
+ * `#!/usr/bin/env node` would pick PATH's Node — the same system one that hid the install — so the prefix's own Node runs
25
+ * it explicitly. Null for anything else (a checkout, a Windows prefix). (From the 雲晴家 fleet operator's patch.)
26
+ */
27
+ export declare function colocatedNpm(packageDir: string | null | undefined, platform?: NodeJS.Platform): {
28
+ command: string;
29
+ args: string[];
30
+ } | null;
31
+ /** `npmDir` (#3440): the directory of the npm that proved this install — the update runs with it first on PATH. */
10
32
  export type InstalledAgend = {
11
33
  ok: true;
12
34
  agend: string;
13
35
  version: string;
36
+ npmDir?: string;
14
37
  } | {
15
38
  ok: false;
16
39
  reason: string;
@@ -19,10 +42,15 @@ export type InstalledAgend = {
19
42
  export declare function resolveInstalledAgend(deps?: DispatchDeps): Promise<InstalledAgend>;
20
43
  /**
21
44
  * `<installed agend> update`, 2 s from now, from a detached `sh`. Service callers must wrap it in an independent scope before launch. The
22
- * path is a positional argument, never spliced into the script.
45
+ * path is a positional argument, never spliced into the script. #3440: the agend's own bin directory (`<prefix>/bin`,
46
+ * where its `npm` and `node` live) goes first on PATH, so the CLI's npm checks and install use the npm that installed
47
+ * it, not a system npm the service's PATH happens to list first. (From the 雲晴家 fleet operator's patch.) That also puts
48
+ * every global package's bin ahead of the system tools for the updater's run — as in an nvm user's own shell.
23
49
  */
24
- export declare const DELAYED_UPDATE_SCRIPT = "sleep 2 && exec \"$1\" update";
25
- export declare function updateCommand(agend: string): {
50
+ export declare const DELAYED_UPDATE_SCRIPT = "sleep 2 && PATH=\"${1%/*}:$PATH\" && export PATH && exec \"$1\" update";
51
+ /** #3443 review: with the proving npm's directory (`$2`, data) ahead of the agend's own — it may hold no npm (a custom prefix). */
52
+ export declare const DELAYED_UPDATE_SCRIPT_NPM = "sleep 2 && PATH=\"$2:${1%/*}:$PATH\" && export PATH && exec \"$1\" update";
53
+ export declare function updateCommand(agend: string, npmDir?: string): {
26
54
  command: string;
27
55
  args: string[];
28
56
  };
@@ -5,16 +5,23 @@
5
5
  * replaces). No unverified fallback: when npm cannot say where it installed AgEnD, or what it says does not hold
6
6
  * together, `/update` refuses and says to run `agend update` from a shell.
7
7
  *
8
+ * #3440: which `npm` is asked matters. A fleet service's PATH can put a system npm (e.g. `/usr/bin/npm`) ahead of the
9
+ * nvm Node that installed AgEnD, and that npm's global root has no AgEnD in it. The npm that manages THIS running
10
+ * package is the one asked: an npm is accepted only when its global root is the running package's own root. With the
11
+ * patch from the 雲晴家 fleet operator, who verified it on the original failing machine.
12
+ *
8
13
  * Runs on the fleet's event loop: every step is async and bounded.
9
14
  */
10
15
  import { execFile } from "./child-process.js";
11
- import { readFile, realpath } from "node:fs/promises";
12
- import { join } from "node:path";
16
+ import { access, readFile, realpath } from "node:fs/promises";
17
+ import { constants } from "node:fs";
18
+ import { basename, delimiter, dirname, isAbsolute, join } from "node:path";
19
+ import { fileURLToPath } from "node:url";
13
20
  import { promisify } from "node:util";
14
21
  export const defaultDispatchDeps = {
15
- run: async (command, args, timeoutMs) => {
22
+ run: async (command, args, timeoutMs, env) => {
16
23
  try {
17
- const { stdout } = await promisify(execFile)(command, args, { encoding: "utf8", timeout: timeoutMs });
24
+ const { stdout } = await promisify(execFile)(command, args, { encoding: "utf8", timeout: timeoutMs, ...(env ? { env: { ...process.env, ...env } } : {}) });
18
25
  return { status: 0, stdout: String(stdout) };
19
26
  }
20
27
  catch (err) {
@@ -24,15 +31,131 @@ export const defaultDispatchDeps = {
24
31
  },
25
32
  readFile: path => readFile(path, "utf8"),
26
33
  realpath: path => realpath(path),
34
+ isExecutable: async (path) => { try {
35
+ await access(path, constants.X_OK);
36
+ return true;
37
+ }
38
+ catch {
39
+ return false;
40
+ } },
41
+ packageDir: fileURLToPath(new URL("..", import.meta.url)),
42
+ execPath: process.execPath,
27
43
  };
28
- /** npm's global root and prefix → the installed package, its bin target, and the bin link that must lead to it. */
29
- export async function resolveInstalledAgend(deps = defaultDispatchDeps) {
44
+ /**
45
+ * #3440: the `npm` beside a POSIX global install of this package: `<prefix>/lib/node_modules/@songsid/agend` →
46
+ * `<prefix>/bin/npm`, run by `<prefix>/bin/node`. npm takes its global prefix from the Node that runs it, and its
47
+ * `#!/usr/bin/env node` would pick PATH's Node — the same system one that hid the install — so the prefix's own Node runs
48
+ * it explicitly. Null for anything else (a checkout, a Windows prefix). (From the 雲晴家 fleet operator's patch.)
49
+ */
50
+ export function colocatedNpm(packageDir, platform = process.platform) {
51
+ if (!packageDir || platform === "win32")
52
+ return null;
53
+ const pkg = packageDir.replace(/\/+$/, "");
54
+ const scope = dirname(pkg), root = dirname(scope), lib = dirname(root);
55
+ if (basename(pkg) !== "agend" || basename(scope) !== "@songsid" || basename(root) !== "node_modules" || basename(lib) !== "lib")
56
+ return null;
57
+ const bin = join(dirname(lib), "bin");
58
+ return { command: join(bin, "node"), args: [join(bin, "npm")] };
59
+ }
60
+ async function runningInstall(deps) {
61
+ if (!deps.packageDir)
62
+ return { kind: "checkout" };
63
+ let real;
64
+ try {
65
+ real = await deps.realpath(deps.packageDir);
66
+ }
67
+ catch (err) {
68
+ const code = err.code;
69
+ return { kind: "unreadable", reason: `cannot read where the running AgEnD is installed (${deps.packageDir}${typeof code === "string" ? `: ${code}` : ""}), so it cannot tell which install to update` };
70
+ }
71
+ const scope = dirname(real), root = dirname(scope);
72
+ return basename(real) === "agend" && basename(scope) === "@songsid" && basename(root) === "node_modules" ? { kind: "global", root } : { kind: "checkout" };
73
+ }
74
+ /** `npm root -g` / `npm prefix -g`, run as bare `npm` — in `env.PATH` when given, the way the update will run it. */
75
+ async function askNpm(deps, env) {
30
76
  const last = (text) => text.trim().split("\n").pop()?.trim() ?? "";
31
- const [root, prefix] = await Promise.all([deps.run("npm", ["root", "-g"], 15_000), deps.run("npm", ["prefix", "-g"], 15_000)]);
32
- if (root.status !== 0 || prefix.status !== 0 || !last(root.stdout) || !last(prefix.stdout)) {
33
- return { ok: false, reason: "npm could not say where AgEnD is installed" };
77
+ const ask = (what) => deps.run("npm", [what, "-g"], 15_000, env);
78
+ const [root, prefix] = await Promise.all([ask("root"), ask("prefix")]);
79
+ return root.status === 0 && prefix.status === 0 && last(root.stdout) && last(prefix.stdout) ? { root: last(root.stdout), prefix: last(prefix.stdout) } : null;
80
+ }
81
+ /**
82
+ * #3440: the npm that manages the running install — never merely the first one on the fleet's PATH — PROVED IN THE
83
+ * ENVIRONMENT THE UPDATE WILL RUN IN (#3442/#3443 review). The updater runs bare `npm` (its checks and install), and npm
84
+ * runs on the first `node` its PATH finds, from which it takes its global prefix. So each candidate is a launch PATH —
85
+ * an optional directory first, then the install's own bin (`<prefix>/bin`, as the launch script puts it), then the
86
+ * fleet's PATH — and `npm root -g` is asked under exactly that PATH. Candidates, in order:
87
+ * 1. nothing extra: the install's bin first (its own npm and Node — the 雲晴家 operator's colocated npm — or, with no
88
+ * npm there, PATH's npm on the Node that order picks);
89
+ * 2. the directory of the Node running AgEnD, when an npm is beside it (AgEnD on a plain Node);
90
+ * 3. the first PATH directory holding an npm, ahead of the install's bin.
91
+ * One is accepted only when its global root IS the running package's root; its directory (2, 3) is then `npmDir`, which
92
+ * the launch puts first — so what runs is what was proved. None: a refusal naming the root and what each answered.
93
+ * A source checkout keeps the old rule: PATH's npm as it is.
94
+ */
95
+ async function npmForRunningInstall(deps) {
96
+ const running = await runningInstall(deps);
97
+ if (running.kind === "unreadable")
98
+ return { reason: running.reason };
99
+ if (running.kind === "checkout")
100
+ return (await askNpm(deps)) ?? { reason: "npm could not say where AgEnD is installed" };
101
+ const expected = running.root;
102
+ const executable = deps.isExecutable ?? defaultDispatchDeps.isExecutable;
103
+ const pathEnv = deps.pathEnv ?? process.env.PATH ?? "";
104
+ // <prefix>/lib/node_modules → <prefix>/bin, where the colocated npm and its Node live (the 雲晴家 operator's colocatedNpm).
105
+ const ownBin = dirname(colocatedNpm(join(expected, "@songsid", "agend"))?.args[0] ?? join(dirname(dirname(expected)), "bin", "npm"));
106
+ const firstNpmOnPath = async (path) => {
107
+ for (const dir of path.split(delimiter))
108
+ if (dir && isAbsolute(dir) && await executable(join(dir, "npm")))
109
+ return join(dir, "npm");
110
+ return null;
111
+ };
112
+ const candidates = [];
113
+ const own = await firstNpmOnPath([ownBin, pathEnv].join(delimiter));
114
+ candidates.push({ label: own ? (dirname(own) === ownBin ? own : `${own} (PATH's)`) : "npm on PATH" });
115
+ const nodeDir = dirname(deps.execPath ?? process.execPath);
116
+ if (nodeDir !== ownBin && await executable(join(nodeDir, "npm")))
117
+ candidates.push({ npmDir: nodeDir, label: `${join(nodeDir, "npm")} (beside the Node running AgEnD)` });
118
+ const onPath = await firstNpmOnPath(pathEnv);
119
+ if (onPath && dirname(onPath) !== ownBin && dirname(onPath) !== nodeDir)
120
+ candidates.push({ npmDir: dirname(onPath), label: `${onPath} (first on PATH, ahead of ${ownBin})` });
121
+ const tried = [];
122
+ const realRoot = async (answer) => {
123
+ if (!answer)
124
+ return null;
125
+ try {
126
+ return await deps.realpath(answer.root);
127
+ }
128
+ catch {
129
+ return answer.root;
130
+ }
131
+ };
132
+ for (const c of candidates) {
133
+ const answer = await askNpm(deps, { PATH: [c.npmDir, ownBin, pathEnv].filter(Boolean).join(delimiter) });
134
+ const root = await realRoot(answer);
135
+ tried.push(`${c.label} → ${root ?? "no answer"}`);
136
+ if (!answer || root !== expected)
137
+ continue;
138
+ // #3443 review: the launch's `${1%/*}` is the bin of the prefix npm REPORTS (agend = <prefix>/bin/agend), which a
139
+ // symlinked prefix makes differ from the bin guessed from the real root. Proved again in that exact PATH, or refused.
140
+ const launchBin = join(answer.prefix, "bin");
141
+ if (launchBin !== ownBin) {
142
+ const again = await askNpm(deps, { PATH: [c.npmDir, launchBin, pathEnv].filter(Boolean).join(delimiter) });
143
+ const againRoot = await realRoot(again);
144
+ if (!again || againRoot !== expected || again.prefix !== answer.prefix) {
145
+ tried.push(`${c.label}, in the launch PATH (${launchBin} first) → ${againRoot ?? "no answer"}`);
146
+ continue;
147
+ }
148
+ }
149
+ return { ...answer, ...(c.npmDir ? { npmDir: c.npmDir } : {}) };
34
150
  }
35
- const pkgDir = join(last(root.stdout), "@songsid", "agend");
151
+ return { reason: `no npm here manages the running AgEnD: expected the npm whose global root is ${expected} (tried ${tried.join("; ")})` };
152
+ }
153
+ /** npm's global root and prefix → the installed package, its bin target, and the bin link that must lead to it. */
154
+ export async function resolveInstalledAgend(deps = defaultDispatchDeps) {
155
+ const found = await npmForRunningInstall(deps);
156
+ if ("reason" in found)
157
+ return { ok: false, reason: found.reason };
158
+ const pkgDir = join(found.root, "@songsid", "agend");
36
159
  const notAgend = { ok: false, reason: `${pkgDir} is not an installed AgEnD package` };
37
160
  let parsed;
38
161
  try {
@@ -50,7 +173,7 @@ export async function resolveInstalledAgend(deps = defaultDispatchDeps) {
50
173
  : typeof bin === "object" && bin !== null && !Array.isArray(bin) && typeof bin.agend === "string" ? bin.agend : null;
51
174
  if (manifest.name !== "@songsid/agend" || typeof manifest.version !== "string" || !manifest.version || !binRel)
52
175
  return notAgend;
53
- const agend = join(last(prefix.stdout), "bin", "agend");
176
+ const agend = join(found.prefix, "bin", "agend");
54
177
  let target, linked;
55
178
  try {
56
179
  [target, linked] = await Promise.all([deps.realpath(join(pkgDir, binRel)), deps.realpath(agend)]);
@@ -60,14 +183,21 @@ export async function resolveInstalledAgend(deps = defaultDispatchDeps) {
60
183
  }
61
184
  if (target !== linked)
62
185
  return { ok: false, reason: `${agend} leads to ${linked}, not the installed package's ${target}` };
63
- return { ok: true, agend, version: manifest.version };
186
+ return { ok: true, agend, version: manifest.version, ...(found.npmDir ? { npmDir: found.npmDir } : {}) };
64
187
  }
65
188
  /**
66
189
  * `<installed agend> update`, 2 s from now, from a detached `sh`. Service callers must wrap it in an independent scope before launch. The
67
- * path is a positional argument, never spliced into the script.
190
+ * path is a positional argument, never spliced into the script. #3440: the agend's own bin directory (`<prefix>/bin`,
191
+ * where its `npm` and `node` live) goes first on PATH, so the CLI's npm checks and install use the npm that installed
192
+ * it, not a system npm the service's PATH happens to list first. (From the 雲晴家 fleet operator's patch.) That also puts
193
+ * every global package's bin ahead of the system tools for the updater's run — as in an nvm user's own shell.
68
194
  */
69
- export const DELAYED_UPDATE_SCRIPT = 'sleep 2 && exec "$1" update';
70
- export function updateCommand(agend) {
71
- return { command: "sh", args: ["-c", DELAYED_UPDATE_SCRIPT, "sh", agend] };
195
+ export const DELAYED_UPDATE_SCRIPT = 'sleep 2 && PATH="${1%/*}:$PATH" && export PATH && exec "$1" update';
196
+ /** #3443 review: with the proving npm's directory (`$2`, data) ahead of the agend's own — it may hold no npm (a custom prefix). */
197
+ export const DELAYED_UPDATE_SCRIPT_NPM = 'sleep 2 && PATH="$2:${1%/*}:$PATH" && export PATH && exec "$1" update';
198
+ export function updateCommand(agend, npmDir) {
199
+ return npmDir && isAbsolute(npmDir)
200
+ ? { command: "sh", args: ["-c", DELAYED_UPDATE_SCRIPT_NPM, "sh", agend, npmDir] }
201
+ : { command: "sh", args: ["-c", DELAYED_UPDATE_SCRIPT, "sh", agend] };
72
202
  }
73
203
  //# sourceMappingURL=update-dispatch.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"update-dispatch.js","sourceRoot":"","sources":["../src/update-dispatch.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAQtC,MAAM,CAAC,MAAM,mBAAmB,GAAiB;IAC/C,GAAG,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,E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