@songsid/agend 2.4.0-alpha.1 → 2.4.0-alpha.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 (235) hide show
  1. package/README.md +1 -1
  2. package/README.zh-TW.md +1 -1
  3. package/dist/agent-whats-new.js +2 -0
  4. package/dist/agent-whats-new.js.map +1 -1
  5. package/dist/auth-api.js +3 -1
  6. package/dist/auth-api.js.map +1 -1
  7. package/dist/backend/claude-code.js +4 -0
  8. package/dist/backend/claude-code.js.map +1 -1
  9. package/dist/backend/types.d.ts +6 -0
  10. package/dist/backend/types.js.map +1 -1
  11. package/dist/backend-availability.d.ts +1 -1
  12. package/dist/backend-availability.js +28 -1
  13. package/dist/backend-availability.js.map +1 -1
  14. package/dist/browser-backend-signins.d.ts +7 -1
  15. package/dist/browser-backend-signins.js +8 -4
  16. package/dist/browser-backend-signins.js.map +1 -1
  17. package/dist/build-provenance.json +1 -1
  18. package/dist/channel/mcp-tools.js +1 -1
  19. package/dist/channel/mcp-tools.js.map +1 -1
  20. package/dist/config-validator.js +47 -7
  21. package/dist/config-validator.js.map +1 -1
  22. package/dist/daemon.d.ts +3 -0
  23. package/dist/daemon.js +4 -0
  24. package/dist/daemon.js.map +1 -1
  25. package/dist/fleet-manager.d.ts +33 -4
  26. package/dist/fleet-manager.js +143 -61
  27. package/dist/fleet-manager.js.map +1 -1
  28. package/dist/general-knowledge/skills/credential-profiles/SKILL.md +19 -0
  29. package/dist/hub/audit/index.js +12 -5
  30. package/dist/hub/audit/index.js.map +1 -1
  31. package/dist/hub/catalog.d.ts +6 -0
  32. package/dist/hub/catalog.js +14 -4
  33. package/dist/hub/catalog.js.map +1 -1
  34. package/dist/hub/client.js +2 -0
  35. package/dist/hub/client.js.map +1 -1
  36. package/dist/hub/compose/member.d.ts +2 -0
  37. package/dist/hub/compose/member.js +11 -2
  38. package/dist/hub/compose/member.js.map +1 -1
  39. package/dist/hub/compose/server.js +2 -1
  40. package/dist/hub/compose/server.js.map +1 -1
  41. package/dist/hub/enrolment-code.d.ts +126 -0
  42. package/dist/hub/enrolment-code.js +266 -0
  43. package/dist/hub/enrolment-code.js.map +1 -0
  44. package/dist/hub/group-policy/admin-impact.js +4 -2
  45. package/dist/hub/group-policy/admin-impact.js.map +1 -1
  46. package/dist/hub/group-policy/admin-inventory.js +6 -6
  47. package/dist/hub/group-policy/admin-inventory.js.map +1 -1
  48. package/dist/hub/group-policy/authorization.d.ts +16 -2
  49. package/dist/hub/group-policy/authorization.js +69 -5
  50. package/dist/hub/group-policy/authorization.js.map +1 -1
  51. package/dist/hub/group-policy/impact-inventory.js +3 -3
  52. package/dist/hub/group-policy/impact-inventory.js.map +1 -1
  53. package/dist/hub/group-policy/resources.d.ts +40 -1
  54. package/dist/hub/group-policy/resources.js +51 -13
  55. package/dist/hub/group-policy/resources.js.map +1 -1
  56. package/dist/hub/group-policy/store.d.ts +6 -0
  57. package/dist/hub/group-policy/store.js +49 -4
  58. package/dist/hub/group-policy/store.js.map +1 -1
  59. package/dist/hub/http/compose.js +30 -6
  60. package/dist/hub/http/compose.js.map +1 -1
  61. package/dist/hub/init/text.js +2 -2
  62. package/dist/hub/init/text.js.map +1 -1
  63. package/dist/hub/init/web.d.ts +7 -0
  64. package/dist/hub/init/web.js +6 -1
  65. package/dist/hub/init/web.js.map +1 -1
  66. package/dist/hub/join/local.d.ts +27 -0
  67. package/dist/hub/join/local.js +70 -5
  68. package/dist/hub/join/local.js.map +1 -1
  69. package/dist/hub/join/receipt.d.ts +1 -0
  70. package/dist/hub/join/receipt.js +1 -1
  71. package/dist/hub/join/receipt.js.map +1 -1
  72. package/dist/hub/join/service.d.ts +92 -6
  73. package/dist/hub/join/service.js +199 -28
  74. package/dist/hub/join/service.js.map +1 -1
  75. package/dist/hub/join/store.d.ts +2 -1
  76. package/dist/hub/join/store.js +7 -7
  77. package/dist/hub/join/store.js.map +1 -1
  78. package/dist/hub/member/exposure-api.d.ts +2 -0
  79. package/dist/hub/member/exposure-api.js +3 -2
  80. package/dist/hub/member/exposure-api.js.map +1 -1
  81. package/dist/hub/member/exposures.d.ts +4 -0
  82. package/dist/hub/member/exposures.js +12 -2
  83. package/dist/hub/member/exposures.js.map +1 -1
  84. package/dist/hub/member/pairing-notices.js +8 -6
  85. package/dist/hub/member/pairing-notices.js.map +1 -1
  86. package/dist/hub/pairing-notices.d.ts +5 -2
  87. package/dist/hub/pairing-notices.js +38 -13
  88. package/dist/hub/pairing-notices.js.map +1 -1
  89. package/dist/hub/pairing.d.ts +7 -2
  90. package/dist/hub/protocol.d.ts +47 -0
  91. package/dist/hub/protocol.js +3 -1
  92. package/dist/hub/protocol.js.map +1 -1
  93. package/dist/hub/server.js +15 -1
  94. package/dist/hub/server.js.map +1 -1
  95. package/dist/hub/types.d.ts +12 -4
  96. package/dist/hub-pairing-summary.js +1 -1
  97. package/dist/hub-pairing-summary.js.map +1 -1
  98. package/dist/instance-config-impact.js +4 -0
  99. package/dist/instance-config-impact.js.map +1 -1
  100. package/dist/instance-lifecycle.js +4 -0
  101. package/dist/instance-lifecycle.js.map +1 -1
  102. package/dist/locale.js +6 -2
  103. package/dist/locale.js.map +1 -1
  104. package/dist/log-service.d.ts +62 -6
  105. package/dist/log-service.js +135 -28
  106. package/dist/log-service.js.map +1 -1
  107. package/dist/log-steps-agy-grok.d.ts +74 -0
  108. package/dist/log-steps-agy-grok.js +440 -0
  109. package/dist/log-steps-agy-grok.js.map +1 -0
  110. package/dist/log-steps.d.ts +62 -3
  111. package/dist/log-steps.js +188 -22
  112. package/dist/log-steps.js.map +1 -1
  113. package/dist/log-transcript-paths.d.ts +29 -0
  114. package/dist/log-transcript-paths.js +109 -0
  115. package/dist/log-transcript-paths.js.map +1 -0
  116. package/dist/login-controller.d.ts +17 -3
  117. package/dist/login-controller.js +57 -5
  118. package/dist/login-controller.js.map +1 -1
  119. package/dist/login-window-lock.d.ts +20 -8
  120. package/dist/login-window-lock.js +35 -16
  121. package/dist/login-window-lock.js.map +1 -1
  122. package/dist/outbound-handlers.d.ts +14 -0
  123. package/dist/outbound-handlers.js +49 -1
  124. package/dist/outbound-handlers.js.map +1 -1
  125. package/dist/profile-signins.d.ts +2 -0
  126. package/dist/profile-signins.js +1 -1
  127. package/dist/profile-signins.js.map +1 -1
  128. package/dist/settings-api.d.ts +34 -0
  129. package/dist/settings-api.js +184 -6
  130. package/dist/settings-api.js.map +1 -1
  131. package/dist/settings-change.js +38 -1
  132. package/dist/settings-change.js.map +1 -1
  133. package/dist/settings-effect.js +14 -0
  134. package/dist/settings-effect.js.map +1 -1
  135. package/dist/tool-progress.d.ts +7 -0
  136. package/dist/tool-progress.js +21 -9
  137. package/dist/tool-progress.js.map +1 -1
  138. package/dist/types.d.ts +13 -0
  139. package/dist/ui/accounts-view.js +14 -4
  140. package/dist/ui/agent-details-settings.js +2 -2
  141. package/dist/ui/agent-page-strings.js +2 -2
  142. package/dist/ui/backend-signin.js +47 -14
  143. package/dist/ui/chat-activity-groups.js +225 -0
  144. package/dist/ui/chat-activity.js +355 -0
  145. package/dist/ui/chat-popout-header.js +35 -0
  146. package/dist/ui/chat-popout-transport.js +80 -0
  147. package/dist/ui/chat-popout.js +63 -0
  148. package/dist/ui/chat-quote.js +3 -1
  149. package/dist/ui/chat-store.js +45 -4
  150. package/dist/ui/chat-workspace-gestures.js +177 -0
  151. package/dist/ui/chat-workspace-navigation.js +34 -10
  152. package/dist/ui/chat-workspace.js +96 -32
  153. package/dist/ui/host-install.js +2 -2
  154. package/dist/ui/hub-agent-copy.js +7 -7
  155. package/dist/ui/hub-chat-strings.js +3 -3
  156. package/dist/ui/hub-client.js +77 -17
  157. package/dist/ui/hub-company-join-strings.js +12 -10
  158. package/dist/ui/hub-company-join.js +52 -39
  159. package/dist/ui/hub-confirm-place.js +44 -0
  160. package/dist/ui/hub-directory-editor-strings.js +3 -3
  161. package/dist/ui/hub-directory-notice-strings.js +1 -1
  162. package/dist/ui/hub-enrolment-code-strings.js +44 -0
  163. package/dist/ui/hub-enrolment-code.js +159 -0
  164. package/dist/ui/hub-group-search.js +82 -0
  165. package/dist/ui/hub-group-strings.js +8 -8
  166. package/dist/ui/hub-join-approval.js +31 -0
  167. package/dist/ui/hub-join-code-input.js +66 -0
  168. package/dist/ui/hub-join-queue.js +62 -0
  169. package/dist/ui/hub-join-steps.js +231 -0
  170. package/dist/ui/hub-joincode-flow-strings.js +22 -0
  171. package/dist/ui/hub-owner-strings.js +9 -9
  172. package/dist/ui/hub-pairing-progress-strings.js +1 -1
  173. package/dist/ui/hub-quick-pairing.js +8 -4
  174. package/dist/ui/hub-quick-strings.js +11 -11
  175. package/dist/ui/hub-share-refused.js +17 -0
  176. package/dist/ui/hub-strings.js +61 -61
  177. package/dist/ui/hub-this-hub.js +2 -2
  178. package/dist/ui/hub-welcome.js +26 -5
  179. package/dist/ui/image-annotate.js +283 -0
  180. package/dist/ui/image-lightbox.js +26 -6
  181. package/dist/ui/log-row.js +327 -0
  182. package/dist/ui/panel-chat.js +151 -12
  183. package/dist/ui/panel-details.js +14 -6
  184. package/dist/ui/panel-hub.js +42 -13
  185. package/dist/ui/panel-log.js +9 -154
  186. package/dist/ui/panel-settings.js +48 -11
  187. package/dist/ui/search-dialog.js +1 -0
  188. package/dist/ui/settings-access-overview.js +1 -1
  189. package/dist/ui/settings-hub-browser-certificate.js +3 -3
  190. package/dist/ui/settings-hub-company-join.js +41 -30
  191. package/dist/ui/settings-hub-connection.js +8 -5
  192. package/dist/ui/settings-hub-membership.js +3 -3
  193. package/dist/ui/settings-hub-section.js +1 -1
  194. package/dist/ui/settings-hub-setup-strings.js +6 -6
  195. package/dist/ui/settings-hub-setup.js +44 -6
  196. package/dist/ui/settings-hub.js +35 -10
  197. package/dist/ui/settings-layout.js +6 -4
  198. package/dist/ui/settings-public-session-strings.js +37 -0
  199. package/dist/ui/settings-registry.js +4 -0
  200. package/dist/ui/settings-strings.js +2 -2
  201. package/dist/ui/shared/app-shell.js +16 -10
  202. package/dist/ui/shared/app.css +195 -30
  203. package/dist/ui/shared/app.js +8 -1
  204. package/dist/ui/shared/chat-render.js +11 -2
  205. package/dist/ui/shared/chat-thread.js +20 -3
  206. package/dist/ui/shared/chat-work-bar.css +7 -0
  207. package/dist/ui/shared/chat-workspace-model.js +39 -9
  208. package/dist/ui/shared/hub-owner.css +8 -0
  209. package/dist/ui/shared/identity-color.js +9 -3
  210. package/dist/ui/shared/image-annotate.css +45 -0
  211. package/dist/ui/shared/instance-nav.js +59 -22
  212. package/dist/ui/shared/pane-geometry.js +29 -0
  213. package/dist/ui/shared/signin.js +2 -2
  214. package/dist/ui/shared/tokens.css +14 -0
  215. package/dist/ui/shared/ui-menu.js +22 -7
  216. package/dist/ui/signin.html +1 -1
  217. package/dist/ui/structured-signin.js +11 -4
  218. package/dist/web-api.d.ts +1 -0
  219. package/dist/web-api.js +34 -4
  220. package/dist/web-api.js.map +1 -1
  221. package/dist/web-backend-login.d.ts +9 -3
  222. package/dist/web-backend-login.js +7 -4
  223. package/dist/web-backend-login.js.map +1 -1
  224. package/dist/web-chat-history.d.ts +11 -0
  225. package/dist/web-chat-history.js +9 -1
  226. package/dist/web-chat-history.js.map +1 -1
  227. package/dist/web-guest-access.js +2 -2
  228. package/dist/web-guest-access.js.map +1 -1
  229. package/dist/web-session.d.ts +31 -3
  230. package/dist/web-session.js +25 -4
  231. package/dist/web-session.js.map +1 -1
  232. package/dist/web-settings-patch.d.ts +8 -2
  233. package/dist/web-settings-patch.js +22 -10
  234. package/dist/web-settings-patch.js.map +1 -1
  235. package/package.json +1 -1
@@ -9,13 +9,13 @@ import { NativePaneRecovery } from "./native-pane-recovery.js";
9
9
  // ⋯), pause / wake (Settings' agent row). Deletion stays where it already lives (Chat's ⋯, Settings).
10
10
  // One read of /ui/instance/<name> when it opens (#1374: nothing recurring); the live status is the app's.
11
11
  import { html, useEffect, useLayoutEffect, useRef, useState } from "/assets/app-html.js";
12
- import { t } from "/assets/app-i18n.js";
12
+ import { register, t } from "/assets/app-i18n.js";
13
13
  import { appStore, useStore } from "/assets/app-store.js";
14
14
  import { useLease } from "/assets/app-ctx.js";
15
15
  import * as paneContext from "/assets/app-ctx.js";
16
16
  import { PanelHeader, setTitle, statusClass, statusLabel, openDrawer } from "/assets/app-shell.js";
17
17
  import { navigate } from "/assets/app-nav.js";
18
- import { detailsPath } from "/assets/app-route.js";
18
+ import { chatPath, detailsPath } from "/assets/app-route.js";
19
19
  import { InstanceSwitch } from "/assets/instance-switch.js";
20
20
  import { modelText } from "/assets/instance-nav.js";
21
21
  import { HeaderTools } from "/assets/header-tools.js";
@@ -30,10 +30,13 @@ import "/assets/chat-strings.js";
30
30
  import { api } from "./settings-confirm.js";
31
31
  import { InstanceBoardWork } from "./fleet-task-work.js";
32
32
  import { Icon } from "/assets/ui-icons.js";
33
- import { AgentCategoryNav, AgentPageHead, AgentSettingsPanels, agentKind, categoryFromSearch, categoryLabel, useAgentSettings } from "./agent-details-settings.js";
33
+ import { AgentCategoryNav, AgentPageHead, AgentSettingsPanels, agentKind, categoryFromSearch, useAgentSettings } from "./agent-details-settings.js";
34
34
  import "./agent-page-strings.js";
35
35
  import { pt } from "./agent-page-strings.js";
36
36
 
37
+ // Local registration also works when this lazy page is paired with retained string modules.
38
+ register("agentNavigation", { en: { backToChat: "Back to chat" }, "zh-TW": { backToChat: "回到聊天" } });
39
+
37
40
  export function DetailsPanel({ route, navKey }) {
38
41
  const pane = paneContext.usePane?.();
39
42
  const app = useStore(appStore);
@@ -171,6 +174,12 @@ function DetailsView({ name, inst, navKey, exec, awaiting }) {
171
174
  <span class="ev">${a.event}</span> ${a.summary || ""}</div>`) : html`<p class="note">${t("chat.dNoActivity")}</p>`}</section>`;
172
175
  }
173
176
  const actions = items.filter((i) => i && ["start", "restart", "stop", "pause", "wake"].includes(i.key));
177
+ const backToChat = { path: chatPath(name), label: t("agentNavigation.backToChat") };
178
+ const followBack = (event) => {
179
+ if (!pane?.navigate || event.defaultPrevented || event.button !== 0 || event.metaKey || event.ctrlKey || event.altKey || event.shiftKey) return;
180
+ event.preventDefault(); pane.navigate(backToChat.path);
181
+ };
182
+ const backLink = () => html`<a class="icon-btn agent-back-chat" href=${backToChat.path} aria-label=${backToChat.label} title=${backToChat.label} onClick=${followBack}><${Icon} name="close" /></a>`;
174
183
  const overview = html`<${NativePaneRecovery} name=${name} inst=${inst} lease=${lease} />${busy ? html`<p class="note" role="status">${t("chat.dWorking")}</p>` : null}<${IdentityCard} name=${name} card=${card} />
175
184
  <${AgentWidget} slot="details" widget=${widgetFor(name, "details")} binds=${instanceBinds(inst, exec, awaiting)} />${content}
176
185
  ${actions.length ? html`<section class="card d-actions"><h3>${pt("actions")}</h3><div class="field-row">${actions.map((i) => html`<button key=${i.key} type="button" class="btn btn-sm" disabled=${i.disabled} onClick=${i.onSelect}>${i.label}</button>`)}</div>
@@ -178,10 +187,9 @@ function DetailsView({ name, inst, navKey, exec, awaiting }) {
178
187
  const Pending = sess.mod && sess.mod.PendingBar, OpCard = sess.mod && sess.mod.OperationCard;
179
188
  return html`<div data-effect-panel="details" class="panel p-details p-settings p-agent-page" data-view=${cat ? "section" : "index"}>
180
189
  <${PanelHeader} title=${name} sub=${sub} pageControls=${{ navKey }} pageActions=${items} nav=${html`<${InstanceSwitch} name=${name} current="details" />`}><${HeaderTools} navKey=${navKey} /><${Menu} items=${items} label=${t("app.more")} /></${PanelHeader}>
181
- <${AgentCategoryNav} name=${name} kind=${kind} cat=${shownCat} dirty=${dirty} />
190
+ <${AgentCategoryNav} name=${name} kind=${kind} cat=${shownCat} dirty=${dirty}>${!cat ? html`<div class="only-narrow"><div class="s-row agent-settings-index-return"><h2>${pt("title")}</h2>${backLink()}</div></div>` : null}</${AgentCategoryNav}>
182
191
  <div data-trust="panel-content" class="panel-body"><div class="col" ref=${body}>
183
- <a class="s-back" href=${detailsPath(name)}><${Icon} name="back" size=${16} /><span>${t("app.details")}</span><span class="s-back-here">${categoryLabel(kind, shownCat)}</span></a>
184
- <${AgentPageHead} name=${name} kind=${kind} cat=${shownCat} inst=${null} />
192
+ <div class="s-row agent-settings-heading"><a class="s-back" href=${detailsPath(name)}><${Icon} name="back" size=${16} /><span>${t("app.details")}</span></a><${AgentPageHead} name=${name} kind=${kind} cat=${shownCat} inst=${null} />${backLink()}</div>
185
193
  ${OpCard && sess.op ? html`<${OpCard} op=${sess.op} schema=${sess.data && sess.data.schema} />` : null}
186
194
  <div class="s-section-layout" data-agent-category=${shownCat}>
187
195
  <div class="ap-panel" id=${pane ? `pane-${pane.id}-ap-panel-overview` : "ap-panel-overview"} hidden=${shownCat !== "overview"}>${overview}</div>
@@ -1,6 +1,8 @@
1
1
  import * as ownerEntryWords from "./hub-owner-strings.js";
2
2
  import * as companyViews from "./hub-company-join.js";
3
3
  import { hj, joinError } from "./hub-company-join-strings.js";
4
+ import { useJoinApproval } from "./hub-join-approval.js";
5
+ import { queueMessage } from "./hub-joincode-flow-strings.js";
4
6
  import { joinRequest, companyInfoRequest, CompanyJoinInfoPage, useCompanyJoinContext, CompanyJoinLead, approveCompanyJoin, HubCompanyJoinPage, CompanyJoinAdminCard } from "./hub-company-join.js";
5
7
  // AgEnD Hub P1, slice 3: the Hub workspace's pages — the chats (/ui/hub, a room at /ui/hub?room=<id>; #3226 B), My
6
8
  // exposures and Administration (/ui/hub/exposures, /ui/hub/admin; reached from the session row's menu) — and its session row. Served only by a Hub's own listener at its own origin, over the Hub's /hub/v1/*
@@ -45,10 +47,17 @@ register("hubAccess", {
45
47
  "zh-TW": { tag: "需要確認權限", refused: "提問遭到拒絕。請先重新檢查權限,再試一次。", check: "重新檢查權限", limited: "提問遭到拒絕,先前的權限資訊需要重新確認。" },
46
48
  });
47
49
  const ha = key => t(`hubAccess.${key}`);
50
+ // Kept with the fresh renderer: retained owner dictionaries do not know this label.
51
+ register("hubGrantStatus", {
52
+ en: { grantNeverSignedIn: "Hasn't signed in to Hub yet" },
53
+ "zh-TW": { grantNeverSignedIn: "還沒登入過 Hub" },
54
+ });
48
55
 
49
56
  // #3298 S-89 (experimental): the group permissions editor and the signed-in welcome are their own LAZY modules, loaded only
50
57
  // when the Hub's session says "group-policy-v1" and this tab's client has the calls — a Hub without them never serves or loads them.
51
58
  // The one group-permissions sentence this module draws itself (shown when the lazy modules are NOT loaded: this Hub lacks them).
59
+ // Hub UX U2 (spec 1.2): the fleet list's own words (an older cached owner dictionary has none of them).
60
+ register("hubFleetList", { en: { revoked: "Revoked ({0})" }, "zh-TW": { revoked: "已撤銷({0})" } });
52
61
  register("hubGroupsNote", {
53
62
  en: { unavailable: "Group permissions aren't available on this Hub yet. Update the Hub, then try again." },
54
63
  "zh-TW": { unavailable: "這個 Hub 還沒有群組權限。請更新 Hub 後再試。" },
@@ -101,6 +110,8 @@ function useSession() {
101
110
  return s;
102
111
  }
103
112
  const when = (ms) => new Date(ms).toLocaleString(undefined, { dateStyle: "medium", timeStyle: "short" });
113
+ // M-2988: words added after a release; a tab holding the older hub-strings dictionary falls back to the older sentence.
114
+ const newer = (key, args, older) => { const s = hw(key, ...args); return s === `hub.${key}` ? older() : s; };
104
115
  const errText = (r) => hw(r.code === "conflict" || r.code === "stale" ? "errConflictHub" : r.code === "not-found" ? "errNotFound"
105
116
  : r.code === "backpressure" ? "errBusyHub" : r.code === "revoked" || r.code === "denied" ? "errDenied" : r.code === "unreachable" ? "errUnreachableHub" : "errFailed");
106
117
 
@@ -176,6 +187,8 @@ function linkHubSigninCss(doc = typeof document !== "undefined" ? document : nul
176
187
  }
177
188
  function HubSignIn() {
178
189
  const company = useCompanyJoinContext();
190
+ const generation = useRef(0);
191
+ const approval = useJoinApproval({ requestId: company.requestId, deadline: company.view?.outerDeadline, approve: approveCompanyJoin, current: () => joinRequest() === company.requestId });
179
192
  useEffect(() => {
180
193
  linkHubSigninCss();
181
194
  // #3318 review F1: signed out from the phone drawer's session menu (or a session that ended while it was open), the
@@ -190,6 +203,7 @@ function HubSignIn() {
190
203
  const [form, setForm] = useState({ login: "", password: "" });
191
204
  const [busy, setBusy] = useState(false);
192
205
  const [msg, setMsg] = useState(null);
206
+ useEffect(() => { setBusy(false); setMsg(null); return () => { generation.current++; }; }, [company.requestId]);
193
207
  const submit = async (e) => {
194
208
  e.preventDefault();
195
209
  if (busy) return;
@@ -199,13 +213,16 @@ function HubSignIn() {
199
213
  doc?.getElementById(!form.login.trim() ? "hubLogin" : "hubPassword")?.focus();
200
214
  return;
201
215
  }
216
+ const mine = ++generation.current, requestId = company.requestId;
202
217
  setBusy(true); setMsg(null);
203
218
  const r = await hubClient().signIn(form.login.trim(), form.password);
219
+ if (mine !== generation.current || joinRequest() !== requestId) return;
204
220
  if (r.ok) {
205
221
  setForm({ login: "", password: "" });
206
222
  if (company.requestId) {
207
- const joined = await approveCompanyJoin(company.requestId, r.csrf);
208
- if (!joined.ok) { setBusy(false); setSession({ ...r, companyJoinFailure: { requestId: company.requestId, code: joined.code } }); return; }
223
+ const joined = await approval.run(r.csrf);
224
+ if (mine !== generation.current || joined.code === "retired") return;
225
+ if (!joined.ok) { setBusy(false); setSession({ ...r, companyJoinFailure: { requestId: company.requestId, code: joined.code, reason: joined.reason } }); return; }
209
226
  }
210
227
  setBusy(false); setSession(r); return;
211
228
  }
@@ -227,6 +244,7 @@ function HubSignIn() {
227
244
  value=${form.password} onInput=${(e) => { const v = e.target.value; setForm((f) => ({ ...f, password: v })); }} />
228
245
  <button type="submit" class="hub-signin-go" disabled=${busy || company.requestId && !company.view?.ok}>${company.requestId ? hj("signInConnect") : hw("signIn")}</button>
229
246
  </form>` : company.view?.ok ? html`<p role="status">${joinError(company.view.reason || company.view.state)}</p>` : null}
247
+ ${approval.queued ? html`<p class="note" role="status">${queueMessage(approval.retryAttempt)}</p>` : null}
230
248
  <p class="hub-signin-msg" role=${msg ? "alert" : undefined}>${msg || ""}</p>
231
249
  ${company.requestId && (msg || company.view?.state !== "pending") && company.view?.returnPath ? html`<a class="btn btn-sm" href=${company.view.returnPath} rel="noreferrer">${hj("return")}</a>` : null}
232
250
  </section></main>`;
@@ -477,7 +495,7 @@ function HubChats() {
477
495
  return html`<${PanelHeader} title=${hc("chats")} />
478
496
  <div class=${`hub-home${groupPolicyOn(s, hubClient()) ? " has-welcome" : ""}`}>
479
497
  <div class="hub-home-list"><${HubHomeList} /></div>
480
- ${groupPolicyOn(s, hubClient()) ? html`<div class="hub-home-pick hub-home-welcome"><${LazyGroups} pick=${(m) => m.HubWelcome} props=${{ name: s.displayName, quick: s.features.includes("quick-pairing-v1"), onChats: () => setPicking(true) }} /></div>`
498
+ ${groupPolicyOn(s, hubClient()) ? html`<div class="hub-home-pick hub-home-welcome"><${LazyGroups} pick=${(m) => m.HubWelcome} props=${{ name: s.displayName, quick: s.features.includes("quick-pairing-v1"), onChats: () => setPicking(true), admin: s.admin === true, features: s.features }} /></div>`
481
499
  : html`<div class="hub-home-pick center">${!rs.loaded ? html`<${Skeleton} variant="rows" lines=${4} />` : rs.error && !rs.rooms.length ? html`<${ErrorState} message=${rs.error} onRetry=${refreshRooms} />` : !rs.rooms.length
482
500
  ? html`<${Empty} icon="chat" title=${hc("noChats")} />`
483
501
  : html`<${Empty} icon="chat" title=${hc("choose")} hint=${hc("chooseHint")} />`}</div>`}
@@ -819,7 +837,7 @@ function HubAgentPage({ x, act, msg }) {
819
837
  <section class="card"><div class="hub-card-head"><h3>${ho("whoMayAsk")}</h3>${shared ? html`<button type="button" class="btn btn-sm" onClick=${() => setAllowing(true)}><${Icon} name="plus" size=${14} />${ho("allow")}</button>` : null}</div>
820
838
  ${grants.length ? html`<div class="hub-rows">${grants.map((g) => html`<div key=${g.id} class="s-row hub-row">
821
839
  <${Avatar} name=${g.subjectName || g.subjectLogin} size="sm" />
822
- <span class="hub-row-text"><strong>${g.subjectName || g.subjectLogin}</strong><small class="note">${g.subjectLogin ? html`<code>${g.subjectLogin}</code> · ` : null}${ho("untilLeft", dateOnly(g.expiresAt), DAYS_LEFT(g.expiresAt))}</small></span>
840
+ <span class="hub-row-text"><strong>${g.subjectName || g.subjectLogin}</strong><small class="note">${g.subjectLogin ? html`<code>${g.subjectLogin}</code> · ` : null}${ho("untilLeft", dateOnly(g.expiresAt), DAYS_LEFT(g.expiresAt))}</small>${g.subjectSignedIn === false ? html`<small class="tag warn">${t("hubGrantStatus.grantNeverSignedIn")}</small>` : null}</span>
823
841
  <${Menu} label=${ho("rowMenu", g.subjectName || g.subjectLogin)} items=${[{ key: "revoke", label: ho("revokeItem"), icon: "trash", danger: true, onSelect: () => revoke(g) }]} />
824
842
  </div>`)}</div>` : html`<p class="note">${hw("noGrants")}</p>`}
825
843
  </section>
@@ -914,11 +932,15 @@ function HubAdminPage({ groups = false, companyJoin = false, directory = false }
914
932
  if (!(await confirmDialog({ message: hw("approveAsk", compareGroups(p.fingerprint)), confirmLabel: hw("approve") }))) return;
915
933
  setMsg(null);
916
934
  const r = await hubClient().approvePairing(p.id, p.fingerprint);
917
- if (!r.ok) setMsg(errText(r));
935
+ // M-2988 #12: "denied" here is the owner — no longer eligible in the directory, or blocked from connecting a Fleet — not you.
936
+ if (!r.ok) setMsg(r.code === "denied" && p.owner && p.owner.name ? newer("approveOwnerDenied", [p.owner.name], () => errText(r)) : errText(r));
918
937
  reload();
919
938
  };
920
939
  const revoke = async (f) => {
921
- if (!(await confirmDialog({ message: hw("revokeFleetAsk", f.owner ? f.owner.name : f.id), confirmLabel: hw("revoke"), danger: true }))) return;
940
+ // M-2988 #16: name the Fleet as the list does, so one owner's two Fleets can be told apart.
941
+ const who = f.owner ? f.owner.name : f.id;
942
+ const message = typeof f.label === "string" && f.label ? newer("revokeFleetNamedAsk", [f.label, who], () => hw("revokeFleetAsk", who)) : hw("revokeFleetAsk", who);
943
+ if (!(await confirmDialog({ message, confirmLabel: hw("revoke"), danger: true }))) return;
922
944
  setMsg(null);
923
945
  const r = await hubClient().revokeFleet(f.id);
924
946
  if (!r.ok) setMsg(errText(r));
@@ -958,13 +980,20 @@ function HubAdminPage({ groups = false, companyJoin = false, directory = false }
958
980
  : html`<span class="tag warn">${ho("waitingOwner")}</span>`}
959
981
  </div>`)}</div>` : null}
960
982
  </section></${ManualFrame}>
961
- <section class="card"><h3>${ho("pairedFleets", fleets.length)}</h3>
962
- ${fleets.length ? html`<div class="hub-rows">${fleets.map((f) => html`<div key=${f.id} class="s-row hub-row">
963
- <${Avatar} name=${f.owner ? f.owner.name : "?"} size="sm" />
964
- <span class="hub-row-text"><strong>${ho("fleetOf", f.owner ? f.owner.name : "—")}</strong>${f.owner ? html`<small class="note"><code>${f.owner.login}</code></small>` : null}</span>
965
- ${f.status === "active" ? html`<span class="tag ok">${ho("active")}</span><${Menu} label=${ho("rowMenu", f.owner ? f.owner.name : f.id)} items=${[{ key: "revoke", label: ho("revokeItem"), icon: "trash", danger: true, onSelect: () => revoke(f) }]} />`
966
- : html`<span class="tag">${ho("revokedTag")}</span>`}
967
- </div>`)}</div>` : html`<p class="note">${ho("noFleets")}</p>`}
983
+ <section class="card hub-fleet-list"><h3>${ho("pairedFleets", fleets.filter((f) => f.status !== "revoked").length)}</h3>
984
+ ${fleets.length ? (() => {
985
+ // Spec 1.2: the row's title is the Fleet's label (S1 overview), its subtitle the owner; active first, revoked folded.
986
+ const row = (f) => html`<div key=${f.id} class="s-row hub-row" data-fleet=${f.id}>
987
+ <${Avatar} name=${f.owner ? f.owner.name : "?"} size="sm" />
988
+ <span class="hub-row-text"><strong>${typeof f.label === "string" && f.label ? f.label : ho("fleetOf", f.owner ? f.owner.name : "—")}</strong>${f.owner ? html`<small class="note">${f.owner.name}${f.owner.login ? html` · <code>${f.owner.login}</code>` : null}</small>` : null}</span>
989
+ ${f.status === "active" ? html`<span class="tag ok">${ho("active")}</span><${Menu} label=${ho("rowMenu", f.label || (f.owner ? f.owner.name : f.id))} items=${[{ key: "revoke", label: ho("revokeItem"), icon: "trash", danger: true, onSelect: () => revoke(f) }]} />`
990
+ : html`<span class="tag">${ho("revokedTag")}</span>`}
991
+ </div>`;
992
+ const current = fleets.filter((f) => f.status !== "revoked").sort((a, b) => (a.status === "active" ? 0 : 1) - (b.status === "active" ? 0 : 1));
993
+ const revoked = fleets.filter((f) => f.status === "revoked");
994
+ return html`${current.length ? html`<div class="hub-rows">${current.map(row)}</div>` : html`<p class="note">${ho("noFleets")}</p>`}
995
+ ${revoked.length ? html`<details class="s-ui-disclosure hub-fleets-revoked"><summary>${t("hubFleetList.revoked", revoked.length)}</summary><div class="hub-rows">${revoked.map(row)}</div></details>` : null}`;
996
+ })() : html`<p class="note">${ho("noFleets")}</p>`}
968
997
  </section>
969
998
  <${LazyThisHub} directory=${directory} />
970
999
  </div></div>`;
@@ -1,6 +1,8 @@
1
- // #1218 phase 1: one instance's Log (紀錄) — its work step by step: what it was asked, what it answered (never its
2
- // thinking), each tool call with its arguments and result, errors, where each turn ended, and fleet events (a crash, a
3
- // restart, a prompt waiting). Between View and Details (/ui/log/<name>). Behind the session gate (/ui/js/); offered on
1
+ // #1218 phase 1: one instance's Log (紀錄) — its work step by step: what it was asked, what it answered, each tool call with its
2
+ // arguments and result, errors, where each turn ended, and fleet events (a crash, a restart, a prompt waiting). This page never asks
3
+ // for thinking (GET /ui/steps without `thinking`); the chat's activity timeline does, for an admin session on the local dashboard
4
+ // (AGEND-181, chat-activity.js) — the step row is the one they share (log-row.js), so the row can draw thinking, this page just never
5
+ // receives any. Between View and Details (/ui/log/<name>). Behind the session gate (/ui/js/); offered on
4
6
  // the public link too (the user's decision), read-only, with the same masking.
5
7
  //
6
8
  // On demand only (the user's decision on load): off by default (web.log_tab) — the tab says so, and offers to turn it
@@ -20,11 +22,11 @@ import { PanelHeader, setTitle, statusClass, statusLabel, openDrawer } from "/as
20
22
  import { InstanceSwitch } from "/assets/instance-switch.js";
21
23
  import { HeaderSlot, HeaderTools } from "/assets/header-tools.js";
22
24
  import { Empty, ErrorState, Skeleton } from "/assets/ui-states.js";
23
- import { Icon } from "/assets/ui-icons.js";
24
25
  import { toast } from "/assets/ui-toast.js";
25
- import "/assets/chat-strings.js";
26
- import { chatTime, chatTimeFull } from "/assets/chat-time.js";
27
26
  import { confirmedWrite } from "./settings-confirm.js";
27
+ import { LogRow, mergeSteps, timeline, collapse, tl } from "./log-row.js";
28
+ // The step helpers live with the row (log-row.js, shared with the chat's timeline); the Log's own tests read them here.
29
+ export { mergeSteps, timeline, collapse };
28
30
 
29
31
  register("log", {
30
32
  en: {
@@ -47,15 +49,6 @@ register("log", {
47
49
  empty: "Nothing here yet.", olderLoad: "Load older steps", olderStart: "The start of what can be read.", loading: "Loading…",
48
50
  olderTrimmed: "Older steps were let go to keep this page light. Open the Log again to read further back.",
49
51
  all: "All", tools: "Tools", errors: "Errors", filter: "Show", live: "Live", reset: "A new conversation began: showing it from its latest steps.",
50
- user: "Asked", assistant: "Replied", error: "Error", errorCode: "Error {0}", turnEnd: "Turn ended", turnEndIn: "Turn ended · {0}",
51
- compacted: "Conversation compacted", turn: "Turn",
52
- running: "running", done: "done", failed: "failed", interrupted: "interrupted", exit: "exit {0}",
53
- showScreen: "Show what was on screen", hideScreen: "Hide what was on screen",
54
- showOutput: "Show output", hideOutput: "Hide output", args: "Arguments", output: "Output", noOutput: "No output.",
55
- showAll: "Show all", showLess: "Show less", cut: "… {0} more characters not shown.", tooLarge: "Output of {0}: only its start is shown.",
56
- times: "×{0}", newer: "{0} new",
57
- cat_read: "Read", cat_edit: "Edit", cat_search: "Search", cat_run: "Run", cat_web: "Web", cat_mcp: "MCP", cat_agent: "Sub-agent",
58
- cat_plan: "Plan", cat_message: "Message", cat_other: "Tool", plan_items: "{0} items",
59
52
  ev_crash_respawn: "Crashed and restarted", ev_crash_loop: "Keeps crashing", ev_hang_detected: "Looks stuck", ev_hang_action: "Stuck: acted on",
60
53
  ev_instance_paused: "Paused", ev_instance_resumed: "Resumed", ev_interactive_prompt: "Waiting at a prompt", ev_interactive_prompt_assist: "Prompt: asked for help", ev_remote_card: "Asked a question (posted to chat)", ev_remote_card_answer: "Question answered from chat",
61
54
  ev_dialog_parked: "A dialog waits", ev_model_failover: "Switched to another model", ev_model_recovered: "Model back",
@@ -86,15 +79,6 @@ register("log", {
86
79
  empty: "目前還沒有內容。", olderLoad: "載入更早的步驟", olderStart: "已經是能讀到的最早內容。", loading: "載入中…",
87
80
  olderTrimmed: "為了讓頁面保持輕快,較早的步驟已移出。重新開啟「紀錄」就能往前讀。",
88
81
  all: "全部", tools: "工具", errors: "錯誤", filter: "顯示", live: "即時", reset: "開始了新的對話:從它最新的步驟顯示。",
89
- user: "收到要求", assistant: "回覆", error: "錯誤", errorCode: "錯誤 {0}", turnEnd: "回合結束", turnEndIn: "回合結束 · {0}",
90
- compacted: "對話已壓縮", turn: "回合",
91
- running: "執行中", done: "完成", failed: "失敗", interrupted: "中斷", exit: "結束碼 {0}",
92
- showScreen: "顯示當時的畫面", hideScreen: "隱藏當時的畫面",
93
- showOutput: "顯示輸出", hideOutput: "隱藏輸出", args: "參數", output: "輸出", noOutput: "沒有輸出。",
94
- showAll: "顯示全部", showLess: "收合", cut: "… 還有 {0} 個字元沒有顯示。", tooLarge: "輸出共 {0},只顯示開頭。",
95
- times: "×{0}", newer: "{0} 則新的",
96
- cat_read: "讀取", cat_edit: "編輯", cat_search: "搜尋", cat_run: "執行", cat_web: "網頁", cat_mcp: "MCP", cat_agent: "子 agent",
97
- cat_plan: "計畫", cat_message: "訊息", cat_other: "工具", plan_items: "{0} 項",
98
82
  ev_crash_respawn: "當機後重新啟動", ev_crash_loop: "反覆當機", ev_hang_detected: "看起來卡住了", ev_hang_action: "卡住:已處理",
99
83
  ev_instance_paused: "已暫停", ev_instance_resumed: "已繼續", ev_interactive_prompt: "停在提示上等待", ev_interactive_prompt_assist: "提示:已請求協助", ev_remote_card: "提出問題(已貼到聊天)", ev_remote_card_answer: "問題已從聊天回答",
100
84
  ev_dialog_parked: "有對話框在等待", ev_model_failover: "改用另一個模型", ev_model_recovered: "模型恢復",
@@ -106,7 +90,6 @@ register("log", {
106
90
  ev_supervision_ended: "監督結束", ev_tmux_server_crash: "tmux 當掉", ev_malformed_tool_call: "格式錯誤的工具呼叫", ev_health_check_error: "健康檢查錯誤", ev_context_lost: "改用全新對話:context 遺失", ev_working_state: "工作狀態紀錄", ev_kiro_reconcile: "Kiro 對話接續處理",
107
91
  },
108
92
  });
109
- const tl = (key, ...a) => t(`log.${key}`, ...a);
110
93
  /** Why a kiro Log shows fleet events only (kiro-log-gate.ts): each is worded above. */
111
94
  export const KIRO_REASONS = new Set(["kiro_not_running", "kiro_v3", "kiro_engine_unknown", "kiro_legacy", "kiro_fresh", "kiro_v2_root", "kiro_no_profile", "kiro_session_unobservable"]);
112
95
 
@@ -116,87 +99,8 @@ export const POLL_MS = 4000;
116
99
  export const RENEW_MS = 30_000;
117
100
  /** Steps kept in the page; older ones beyond it are dropped from the top (the server still has them). */
118
101
  export const PAGE_MAX = 1000;
119
- /** A text longer than this many lines is folded until opened. */
120
- const FOLD_LINES = 8;
121
-
122
- // The app's own SVG icons (never emoji: a device without an emoji font shows boxes).
123
- const CAT_ICON = { read: "file", edit: "edit", search: "search", run: "code", web: "globe", mcp: "plug", agent: "team", plan: "tasks", message: "send", other: "sliders" };
124
- const KIND_ICON = { user: "user", assistant: "bot", error: "alert", turn_end: "stop", state: "info", event: "bell" };
125
-
126
- function size(bytes) {
127
- if (bytes >= 1024 * 1024) return `${(bytes / 1024 / 1024).toFixed(1)} MB`;
128
- if (bytes >= 1024) return `${Math.round(bytes / 1024)} KB`;
129
- return `${bytes} B`;
130
- }
131
- function duration(ms) {
132
- if (!(ms >= 0)) return "";
133
- if (ms < 1000) return `${ms} ms`;
134
- const s = ms / 1000;
135
- if (s < 60) return `${s < 10 ? s.toFixed(1) : Math.round(s)} s`;
136
- const m = Math.floor(s / 60);
137
- return `${m} m ${Math.round(s - m * 60)} s`;
138
- }
139
- const eventLabel = (type) => { const k = `log.ev_${type}`; const v = t(k); return v === k ? String(type).replace(/_/g, " ") : v; };
140
-
141
- /**
142
- * Merge `incoming` steps into `list` (array, in order): one with an id already there replaces it in place (a result
143
- * completing its call); a new one is added — at the end, or before everything when `older`. Returns a new array.
144
- */
145
- export function mergeSteps(list, incoming, older = false) {
146
- const at = new Map(list.map((s, i) => [s.id, i]));
147
- const fresh = new Map();
148
- const next = list.slice();
149
- const added = [];
150
- for (const s of incoming) {
151
- const i = at.get(s.id);
152
- if (i !== undefined) {
153
- // An older page never overwrites what a newer read already said about the same step — except to name a call the
154
- // newer page knew only by its result (the call's record was older than that page): its tool, subject and input.
155
- // A newer read that saw only a call's result (the call was before where it read) never unnames the call: its tool,
156
- // category and start time stay; the outcome is the newer read's.
157
- if (!older) next[i] = s.kind === "tool" && !s.tool && next[i].tool
158
- ? { ...next[i], ...s, tool: next[i].tool, cat: next[i].cat, ts: next[i].ts }
159
- : { ...next[i], ...s };
160
- else if (next[i].kind === "tool" && !next[i].tool && s.tool) {
161
- const { tool, cat, subject, input, ts } = s;
162
- next[i] = { ...next[i], tool, cat, ...(subject !== undefined ? { subject } : {}), ...(input !== undefined ? { input } : {}), ...(ts ? { ts } : {}) };
163
- }
164
- } else if (fresh.has(s.id)) {
165
- // The same step twice in one answer (never from the server's parser, whose ids are unique): the later one wins.
166
- added[fresh.get(s.id)] = { ...added[fresh.get(s.id)], ...s };
167
- } else { fresh.set(s.id, added.length); added.push(s); }
168
- }
169
- return older ? [...added, ...next] : [...next, ...added];
170
- }
171
-
172
- /** Steps and fleet events in one timeline: events placed by time among the steps (steps keep their file order). */
173
- export function timeline(steps, events) {
174
- const evs = events.slice().sort((a, b) => a.ts - b.ts || a.id - b.id);
175
- const out = [];
176
- let e = 0;
177
- for (const s of steps) {
178
- while (e < evs.length && s.ts > 0 && evs[e].ts <= s.ts) out.push({ kind: "event", ...evs[e++] });
179
- out.push(s);
180
- }
181
- while (e < evs.length) out.push({ kind: "event", ...evs[e++] });
182
- return out;
183
- }
184
102
 
185
103
  const isError = (x) => x.kind === "error" || (x.kind === "event" && x.type !== "working_state") || x.status === "failed" || x.status === "interrupted";
186
- /** Consecutive identical finished tool steps (same tool, subject and status) as one row with a count: a loop shows. */
187
- export function collapse(items) {
188
- const out = [];
189
- for (const x of items) {
190
- const prev = out[out.length - 1];
191
- if (prev && x.kind === "tool" && prev.kind === "tool" && x.status !== "running" && prev.status === x.status
192
- && prev.tool === x.tool && (prev.subject || "") === (x.subject || "") && prev.turn === x.turn) {
193
- prev.repeat = (prev.repeat || 1) + 1;
194
- continue;
195
- }
196
- out.push({ ...x });
197
- }
198
- return out;
199
- }
200
104
 
201
105
  export function LogPanel({ route, navKey }) {
202
106
  const pane = paneContext.usePane?.();
@@ -373,7 +277,7 @@ function LogView({ name, inst, navKey, exec, awaiting }) {
373
277
  ? html`<div class="log-older"><button type="button" class="btn btn-sm" disabled=${older.busy} onClick=${loadOlder}>${older.busy ? tl("loading") : tl("olderLoad")}</button></div>`
374
278
  : cursor.current.trimmed ? html`<p class="note log-start">${tl("olderTrimmed")}</p>`
375
279
  : steps.length ? html`<p class="note log-start">${tl("olderStart")}</p>` : null}
376
- ${items.length ? html`<ol class="log-list" role="log" aria-label=${t("app.log")}>${items.map((x, i) => html`<${Row} key=${`${x.kind}:${x.id}`} x=${x} prev=${items[i - 1]} />`)}</ol>`
280
+ ${items.length ? html`<ol class="log-list" role="log" aria-label=${t("app.log")}>${items.map((x, i) => html`<${LogRow} key=${`${x.kind}:${x.id}`} x=${x} prev=${items[i - 1]} />`)}</ol>`
377
281
  : html`<p class="note log-empty">${tl("empty")}</p>`}`;
378
282
  }
379
283
  const tools = state.phase === "on" ? html`<div data-trust="panel-controls" class="log-bar" role="group" aria-label=${tl("filter")}>
@@ -385,53 +289,4 @@ function LogView({ name, inst, navKey, exec, awaiting }) {
385
289
  <div data-trust="panel-content" class="panel-body log-body" ref=${scroller} onScroll=${onScroll}><div class="col log-col">${content}</div></div>
386
290
  </div>`;
387
291
  }
388
-
389
- /** One line of the Log. */
390
- function Row({ x, prev }) {
391
- const [open, setOpen] = useState(false);
392
- const [full, setFull] = useState(false);
393
- const time = x.ts ? chatTime(x.ts, { yesterday: (hm) => t("chat.yesterdayAt", hm) }) : "";
394
- const title = x.ts ? chatTimeFull(x.ts) : "";
395
- const newTurn = x.kind === "user" && prev && prev.turn !== x.turn;
396
- const head = (icon, label, extra) => html`<div class="log-head"><span class="log-icon" aria-hidden="true"><${Icon} name=${icon} size=${14} /></span>
397
- <span class="log-label">${label}</span>${extra || null}<span class="grow"></span><span class="log-time" title=${title}>${time}</span></div>`;
398
- const text = (body, cut, bytes) => {
399
- if (!body) return null;
400
- const lines = body.split("\n").length;
401
- const folded = !full && lines > FOLD_LINES;
402
- return html`<div class=${`log-text${folded ? " folded" : ""}`}>${body}</div>
403
- ${lines > FOLD_LINES ? html`<button type="button" class="link-btn log-more" onClick=${() => setFull(!full)}>${full ? tl("showLess") : tl("showAll")}</button>` : null}
404
- ${cut ? html`<p class="note">${tl("cut", cut.toLocaleString())}</p>` : null}
405
- ${bytes ? html`<p class="note">${tl("tooLarge", size(bytes))}</p>` : null}`;
406
- };
407
- let row;
408
- if (x.kind === "event") {
409
- // M-2269: a dialog or prompt AgEnD saw (the CLI never writes it to its transcript): its text as it was on screen,
410
- // folded until asked for. Text only (a text node), masked by the server.
411
- row = html`${head(KIND_ICON.event, eventLabel(x.type))}${x.detail ? html`<div class="log-text muted">${x.detail}</div>` : null}
412
- ${x.screen ? html`<button type="button" class="link-btn log-toggle log-screen-toggle" aria-expanded=${open ? "true" : "false"} onClick=${() => setOpen(!open)}>${open ? tl("hideScreen") : tl("showScreen")}</button>` : null}
413
- ${x.screen && open ? html`<div class="log-detail"><div class="log-text mono log-screen">${x.screen}</div></div>` : null}`;
414
- } else if (x.kind === "user" || x.kind === "assistant") {
415
- row = html`${head(KIND_ICON[x.kind], tl(x.kind))}${text(x.body, x.bodyCut)}`;
416
- } else if (x.kind === "error") {
417
- row = html`${head(KIND_ICON.error, x.note ? tl("errorCode", x.note) : tl("error"))}${text(x.body, x.bodyCut)}`;
418
- } else if (x.kind === "turn_end") {
419
- row = head(KIND_ICON.turn_end, x.durationMs ? tl("turnEndIn", duration(x.durationMs)) : tl("turnEnd"),
420
- x.status && x.status !== "done" ? html`<span class=${`log-status ${x.status}`}>${tl(x.status)}</span>` : null);
421
- } else if (x.kind === "state") {
422
- row = head(KIND_ICON.state, x.note === "compacted" ? tl("compacted") : x.note || "");
423
- } else {
424
- const cat = x.cat || "other";
425
- const subject = cat === "plan" && x.subject ? tl("plan_items", x.subject) : x.subject || "";
426
- const status = html`<span class=${`log-status ${x.status || "done"}`}>${x.status === "running" ? html`<span class="spinner" aria-hidden="true"></span>` : null}${tl(x.status || "done")}${typeof x.exitCode === "number" && x.exitCode !== 0 ? ` · ${tl("exit", x.exitCode)}` : ""}${x.durationMs ? ` · ${duration(x.durationMs)}` : ""}</span>`;
427
- const label = html`<span class="log-cat">${tl(`cat_${cat}`)}</span>${subject ? html` <span class="log-subject mono">${subject}</span>` : null}${x.tool && !subject ? html` <span class="log-tool mono muted">${x.tool}</span>` : null}`;
428
- const has = !!(x.body || x.input || x.bodyBytes);
429
- row = html`${head(CAT_ICON[cat] || CAT_ICON.other, label, html`${x.repeat ? html`<span class="log-repeat">${tl("times", x.repeat)}</span>` : null}${status}`)}
430
- ${has ? html`<button type="button" class="link-btn log-toggle" aria-expanded=${open ? "true" : "false"} onClick=${() => setOpen(!open)}>${open ? tl("hideOutput") : tl("showOutput")}</button>` : null}
431
- ${open ? html`<div class="log-detail">
432
- ${x.input ? html`<div class="log-sec"><span class="log-sec-h">${tl("args")}</span><div class="log-text mono">${x.input}</div>${x.inputCut ? html`<p class="note">${tl("cut", x.inputCut.toLocaleString())}</p>` : null}</div>` : null}
433
- <div class="log-sec"><span class="log-sec-h">${tl("output")}</span>${x.body ? text(x.body, x.bodyCut, x.bodyBytes) : html`<p class="note">${tl("noOutput")}</p>`}</div></div>` : null}`;
434
- }
435
- return html`<li class=${`log-item k-${x.kind}${x.status ? ` s-${x.status}` : ""}${newTurn ? " turn-start" : ""}`}>${row}</li>`;
436
- }
437
292
  LogPanel.workspaceVersion = 1;