@skillcdn/console 0.6.0 → 0.6.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 (415) hide show
  1. package/README.md +7 -7
  2. package/dist/agent-page.d.ts.map +1 -1
  3. package/dist/agent-page.js +58 -35
  4. package/dist/agent-page.js.map +1 -1
  5. package/dist/agent-usage.d.ts +51 -0
  6. package/dist/agent-usage.d.ts.map +1 -0
  7. package/dist/agent-usage.js +77 -0
  8. package/dist/agent-usage.js.map +1 -0
  9. package/dist/api.d.ts +4 -2
  10. package/dist/api.d.ts.map +1 -1
  11. package/dist/api.js +4 -2
  12. package/dist/api.js.map +1 -1
  13. package/dist/cli/cli.d.ts +9 -2
  14. package/dist/cli/cli.d.ts.map +1 -1
  15. package/dist/cli/cli.js +491 -125
  16. package/dist/cli/cli.js.map +1 -1
  17. package/dist/cli/format.d.ts +46 -4
  18. package/dist/cli/format.d.ts.map +1 -1
  19. package/dist/cli/format.js +163 -45
  20. package/dist/cli/format.js.map +1 -1
  21. package/dist/cli/help.d.ts.map +1 -1
  22. package/dist/cli/help.js +62 -13
  23. package/dist/cli/help.js.map +1 -1
  24. package/dist/cli/machine-check.d.ts +24 -5
  25. package/dist/cli/machine-check.d.ts.map +1 -1
  26. package/dist/cli/machine-check.js +128 -16
  27. package/dist/cli/machine-check.js.map +1 -1
  28. package/dist/cli/pack.d.ts +11 -8
  29. package/dist/cli/pack.d.ts.map +1 -1
  30. package/dist/cli/pack.js +63 -28
  31. package/dist/cli/pack.js.map +1 -1
  32. package/dist/cli/runner-host.d.ts +2 -0
  33. package/dist/cli/runner-host.d.ts.map +1 -1
  34. package/dist/cli/runner-host.js +1 -0
  35. package/dist/cli/runner-host.js.map +1 -1
  36. package/dist/cli/secret-notes.d.ts.map +1 -1
  37. package/dist/cli/secret-notes.js +9 -1
  38. package/dist/cli/secret-notes.js.map +1 -1
  39. package/dist/cli/terminal.d.ts +10 -2
  40. package/dist/cli/terminal.d.ts.map +1 -1
  41. package/dist/cli/terminal.js +16 -4
  42. package/dist/cli/terminal.js.map +1 -1
  43. package/dist/client.d.ts +30 -7
  44. package/dist/client.d.ts.map +1 -1
  45. package/dist/client.js +13 -1
  46. package/dist/client.js.map +1 -1
  47. package/dist/components/agent-page.d.ts +76 -18
  48. package/dist/components/agent-page.d.ts.map +1 -1
  49. package/dist/components/agent-page.js +183 -53
  50. package/dist/components/agent-page.js.map +1 -1
  51. package/dist/components/agents.d.ts +2 -0
  52. package/dist/components/agents.d.ts.map +1 -1
  53. package/dist/components/agents.js +6 -5
  54. package/dist/components/agents.js.map +1 -1
  55. package/dist/components/calendar.d.ts +24 -4
  56. package/dist/components/calendar.d.ts.map +1 -1
  57. package/dist/components/calendar.js +79 -36
  58. package/dist/components/calendar.js.map +1 -1
  59. package/dist/components/categories.js +2 -2
  60. package/dist/components/categories.js.map +1 -1
  61. package/dist/components/comments.js +2 -2
  62. package/dist/components/comments.js.map +1 -1
  63. package/dist/components/decision-list.d.ts.map +1 -1
  64. package/dist/components/decision-list.js +5 -5
  65. package/dist/components/decision-list.js.map +1 -1
  66. package/dist/components/documents.d.ts.map +1 -1
  67. package/dist/components/documents.js +4 -4
  68. package/dist/components/documents.js.map +1 -1
  69. package/dist/components/event-feed.d.ts +2 -3
  70. package/dist/components/event-feed.d.ts.map +1 -1
  71. package/dist/components/event-feed.js +4 -184
  72. package/dist/components/event-feed.js.map +1 -1
  73. package/dist/components/goals.d.ts.map +1 -1
  74. package/dist/components/goals.js +3 -3
  75. package/dist/components/goals.js.map +1 -1
  76. package/dist/components/home.js +9 -9
  77. package/dist/components/home.js.map +1 -1
  78. package/dist/components/icon.d.ts.map +1 -1
  79. package/dist/components/icon.js +11 -2
  80. package/dist/components/icon.js.map +1 -1
  81. package/dist/components/notifications.d.ts +65 -0
  82. package/dist/components/notifications.d.ts.map +1 -0
  83. package/dist/components/notifications.js +162 -0
  84. package/dist/components/notifications.js.map +1 -0
  85. package/dist/components/pack-connect.js +1 -1
  86. package/dist/components/pack-connect.js.map +1 -1
  87. package/dist/components/pack-token.js +1 -1
  88. package/dist/components/pack-token.js.map +1 -1
  89. package/dist/components/people.js +2 -2
  90. package/dist/components/people.js.map +1 -1
  91. package/dist/components/pictures.js +1 -1
  92. package/dist/components/pictures.js.map +1 -1
  93. package/dist/components/plugin-settings.d.ts +22 -1
  94. package/dist/components/plugin-settings.d.ts.map +1 -1
  95. package/dist/components/plugin-settings.js +63 -11
  96. package/dist/components/plugin-settings.js.map +1 -1
  97. package/dist/components/projects.js +1 -1
  98. package/dist/components/projects.js.map +1 -1
  99. package/dist/components/roadmap.js +2 -2
  100. package/dist/components/roadmap.js.map +1 -1
  101. package/dist/components/rules.js +2 -2
  102. package/dist/components/rules.js.map +1 -1
  103. package/dist/components/runs.d.ts.map +1 -1
  104. package/dist/components/runs.js +1 -1
  105. package/dist/components/runs.js.map +1 -1
  106. package/dist/components/sessions.js +1 -1
  107. package/dist/components/sessions.js.map +1 -1
  108. package/dist/components/shell.d.ts +2 -0
  109. package/dist/components/shell.d.ts.map +1 -1
  110. package/dist/components/shell.js +1 -1
  111. package/dist/components/shell.js.map +1 -1
  112. package/dist/components/sign-in.js +2 -2
  113. package/dist/components/sign-in.js.map +1 -1
  114. package/dist/components/skills.d.ts.map +1 -1
  115. package/dist/components/skills.js +1 -1
  116. package/dist/components/skills.js.map +1 -1
  117. package/dist/components/task-view.d.ts +6 -0
  118. package/dist/components/task-view.d.ts.map +1 -1
  119. package/dist/components/task-view.js +3 -2
  120. package/dist/components/task-view.js.map +1 -1
  121. package/dist/components/tokens.js +1 -1
  122. package/dist/components/tokens.js.map +1 -1
  123. package/dist/components/ui.d.ts +21 -2
  124. package/dist/components/ui.d.ts.map +1 -1
  125. package/dist/components/ui.js +24 -3
  126. package/dist/components/ui.js.map +1 -1
  127. package/dist/components/work.js +1 -1
  128. package/dist/components/work.js.map +1 -1
  129. package/dist/console.css +506 -289
  130. package/dist/console.d.ts.map +1 -1
  131. package/dist/console.js +193 -16
  132. package/dist/console.js.map +1 -1
  133. package/dist/data.d.ts +17 -1
  134. package/dist/data.d.ts.map +1 -1
  135. package/dist/data.js +31 -0
  136. package/dist/data.js.map +1 -1
  137. package/dist/desk-page.js +5 -5
  138. package/dist/desk-page.js.map +1 -1
  139. package/dist/feed-words.d.ts +5 -0
  140. package/dist/feed-words.d.ts.map +1 -0
  141. package/dist/feed-words.js +193 -0
  142. package/dist/feed-words.js.map +1 -0
  143. package/dist/i18n/en.d.ts +93 -1
  144. package/dist/i18n/en.d.ts.map +1 -1
  145. package/dist/i18n/en.js +103 -15
  146. package/dist/i18n/en.js.map +1 -1
  147. package/dist/i18n/ko.d.ts.map +1 -1
  148. package/dist/i18n/ko.js +105 -22
  149. package/dist/i18n/ko.js.map +1 -1
  150. package/dist/icons/glyphs.d.ts +370 -104
  151. package/dist/icons/glyphs.d.ts.map +1 -1
  152. package/dist/icons/glyphs.js +72 -66
  153. package/dist/icons/glyphs.js.map +1 -1
  154. package/dist/icons/index.d.ts.map +1 -1
  155. package/dist/icons/index.js +9 -1
  156. package/dist/icons/index.js.map +1 -1
  157. package/dist/index.d.ts +3 -2
  158. package/dist/index.d.ts.map +1 -1
  159. package/dist/index.js +3 -2
  160. package/dist/index.js.map +1 -1
  161. package/dist/limits.d.ts +7 -0
  162. package/dist/limits.d.ts.map +1 -1
  163. package/dist/limits.js +7 -0
  164. package/dist/limits.js.map +1 -1
  165. package/dist/notifications.d.ts +124 -0
  166. package/dist/notifications.d.ts.map +1 -0
  167. package/dist/notifications.js +147 -0
  168. package/dist/notifications.js.map +1 -0
  169. package/dist/onboarding.d.ts.map +1 -1
  170. package/dist/onboarding.js +7 -12
  171. package/dist/onboarding.js.map +1 -1
  172. package/dist/plugin/capabilities.d.ts +1 -1
  173. package/dist/plugin/capabilities.d.ts.map +1 -1
  174. package/dist/plugin/capabilities.js +10 -0
  175. package/dist/plugin/capabilities.js.map +1 -1
  176. package/dist/plugin/context.d.ts +85 -1
  177. package/dist/plugin/context.d.ts.map +1 -1
  178. package/dist/plugin/limits.d.ts +7 -0
  179. package/dist/plugin/limits.d.ts.map +1 -1
  180. package/dist/plugin/limits.js +7 -0
  181. package/dist/plugin/limits.js.map +1 -1
  182. package/dist/plugin/manifest.d.ts +8 -0
  183. package/dist/plugin/manifest.d.ts.map +1 -1
  184. package/dist/plugin/manifest.js +13 -0
  185. package/dist/plugin/manifest.js.map +1 -1
  186. package/dist/plugin/rest-schemas.d.ts +22 -0
  187. package/dist/plugin/rest-schemas.d.ts.map +1 -1
  188. package/dist/plugin/rest-schemas.js +19 -3
  189. package/dist/plugin/rest-schemas.js.map +1 -1
  190. package/dist/plugin/testing.d.ts +2 -0
  191. package/dist/plugin/testing.d.ts.map +1 -1
  192. package/dist/plugin/testing.js +2 -0
  193. package/dist/plugin/testing.js.map +1 -1
  194. package/dist/plugin.d.ts +1 -1
  195. package/dist/plugin.d.ts.map +1 -1
  196. package/dist/plugin.js +1 -1
  197. package/dist/plugin.js.map +1 -1
  198. package/dist/router.d.ts +6 -0
  199. package/dist/router.d.ts.map +1 -1
  200. package/dist/router.js +5 -0
  201. package/dist/router.js.map +1 -1
  202. package/dist/routes.d.ts +2 -0
  203. package/dist/routes.d.ts.map +1 -1
  204. package/dist/routes.js +2 -0
  205. package/dist/routes.js.map +1 -1
  206. package/dist/rules.js +1 -1
  207. package/dist/rules.js.map +1 -1
  208. package/dist/runner/acp.d.ts.map +1 -1
  209. package/dist/runner/acp.js +12 -97
  210. package/dist/runner/acp.js.map +1 -1
  211. package/dist/runner/browser.d.ts +50 -0
  212. package/dist/runner/browser.d.ts.map +1 -0
  213. package/dist/runner/browser.js +104 -0
  214. package/dist/runner/browser.js.map +1 -0
  215. package/dist/runner/claude.d.ts +1 -2
  216. package/dist/runner/claude.d.ts.map +1 -1
  217. package/dist/runner/claude.js +352 -13
  218. package/dist/runner/claude.js.map +1 -1
  219. package/dist/runner/codex.d.ts +9 -10
  220. package/dist/runner/codex.d.ts.map +1 -1
  221. package/dist/runner/codex.js +809 -346
  222. package/dist/runner/codex.js.map +1 -1
  223. package/dist/runner/config.d.ts +14 -3
  224. package/dist/runner/config.d.ts.map +1 -1
  225. package/dist/runner/config.js +27 -7
  226. package/dist/runner/config.js.map +1 -1
  227. package/dist/runner/desk.d.ts +3 -1
  228. package/dist/runner/desk.d.ts.map +1 -1
  229. package/dist/runner/desk.js +17 -5
  230. package/dist/runner/desk.js.map +1 -1
  231. package/dist/runner/message.d.ts +53 -3
  232. package/dist/runner/message.d.ts.map +1 -1
  233. package/dist/runner/message.js +201 -20
  234. package/dist/runner/message.js.map +1 -1
  235. package/dist/runner/registry.d.ts +6 -0
  236. package/dist/runner/registry.d.ts.map +1 -1
  237. package/dist/runner/registry.js.map +1 -1
  238. package/dist/runner/rpc.d.ts +31 -0
  239. package/dist/runner/rpc.d.ts.map +1 -0
  240. package/dist/runner/rpc.js +102 -0
  241. package/dist/runner/rpc.js.map +1 -0
  242. package/dist/runner/runner.d.ts +41 -1
  243. package/dist/runner/runner.d.ts.map +1 -1
  244. package/dist/runner/runner.js +695 -52
  245. package/dist/runner/runner.js.map +1 -1
  246. package/dist/runner/slack.d.ts +17 -8
  247. package/dist/runner/slack.d.ts.map +1 -1
  248. package/dist/runner/slack.js +1250 -78
  249. package/dist/runner/slack.js.map +1 -1
  250. package/dist/runner/types.d.ts +160 -8
  251. package/dist/runner/types.d.ts.map +1 -1
  252. package/dist/runner/types.js.map +1 -1
  253. package/dist/runner/usage.d.ts +105 -0
  254. package/dist/runner/usage.d.ts.map +1 -0
  255. package/dist/runner/usage.js +218 -0
  256. package/dist/runner/usage.js.map +1 -0
  257. package/dist/runner.d.ts +4 -4
  258. package/dist/runner.d.ts.map +1 -1
  259. package/dist/runner.js +3 -3
  260. package/dist/runner.js.map +1 -1
  261. package/dist/schemas.d.ts +673 -0
  262. package/dist/schemas.d.ts.map +1 -1
  263. package/dist/schemas.js +205 -1
  264. package/dist/schemas.js.map +1 -1
  265. package/dist/services.js +3 -3
  266. package/dist/services.js.map +1 -1
  267. package/dist/setup-guide.d.ts +4 -3
  268. package/dist/setup-guide.d.ts.map +1 -1
  269. package/dist/setup-guide.js +11 -13
  270. package/dist/setup-guide.js.map +1 -1
  271. package/dist/text.d.ts +7 -0
  272. package/dist/text.d.ts.map +1 -1
  273. package/dist/text.js +18 -0
  274. package/dist/text.js.map +1 -1
  275. package/dist/vocabulary.d.ts +4 -2
  276. package/dist/vocabulary.d.ts.map +1 -1
  277. package/dist/vocabulary.js +4 -1
  278. package/dist/vocabulary.js.map +1 -1
  279. package/docs/specs/cli.md +26 -19
  280. package/docs/specs/plugins.md +16 -10
  281. package/docs/specs/rest.md +28 -10
  282. package/docs/specs/runner.md +132 -44
  283. package/package.json +4 -4
  284. package/skills/building-a-console/SKILL.md +2 -2
  285. package/skills/building-a-console/references/configuring.md +1 -1
  286. package/skills/building-a-plugin/SKILL.md +4 -4
  287. package/skills/planning-the-board/SKILL.md +1 -1
  288. package/skills/planning-the-board/references/setting-up.md +2 -2
  289. package/skills/running-an-agent/SKILL.md +15 -64
  290. package/skills/running-an-agent/references/preparing-the-machine.md +17 -0
  291. package/skills/running-an-agent/references/several-tasks.md +37 -0
  292. package/skills/running-an-agent/references/slack-app.md +70 -13
  293. package/skills/running-an-agent/references/the-account-and-the-invitation.md +5 -0
  294. package/skills/running-an-agent/references/what-was-not-seen-run-yet.md +3 -0
  295. package/skills/running-an-agent/references/when-the-agent-could-not-go-on.md +16 -0
  296. package/skills/running-an-agent/references/your-first-task.md +14 -0
  297. package/skills/working-the-board/SKILL.md +9 -12
  298. package/skills/working-the-board/references/a-pack-skills-questions.md +3 -0
  299. package/skills/working-the-board/references/a-plugins-commands.md +3 -0
  300. package/skills/working-the-board/references/a-review.md +3 -0
  301. package/skills/working-the-board/references/an-open-run.md +3 -0
  302. package/skills/working-the-board/references/requirements.md +7 -0
  303. package/skills/working-the-board/references/the-pack.md +2 -2
  304. package/skills/working-the-board/references/what-they-were-told.md +3 -0
  305. package/skills/working-the-board/references/work-given-in-chat.md +5 -0
  306. package/src/agent-page.tsx +76 -47
  307. package/src/agent-usage.ts +113 -0
  308. package/src/api.ts +62 -0
  309. package/src/cli/cli.ts +634 -162
  310. package/src/cli/format.ts +190 -47
  311. package/src/cli/help.ts +77 -12
  312. package/src/cli/machine-check.ts +182 -29
  313. package/src/cli/pack.ts +81 -40
  314. package/src/cli/runner-host.ts +3 -0
  315. package/src/cli/secret-notes.ts +9 -1
  316. package/src/cli/terminal.ts +20 -4
  317. package/src/client.ts +94 -6
  318. package/src/components/agent-page.tsx +280 -63
  319. package/src/components/agents.tsx +23 -3
  320. package/src/components/calendar.tsx +93 -37
  321. package/src/components/categories.tsx +2 -2
  322. package/src/components/comments.tsx +5 -5
  323. package/src/components/decision-list.tsx +13 -10
  324. package/src/components/documents.tsx +13 -8
  325. package/src/components/event-feed.tsx +4 -203
  326. package/src/components/goals.tsx +6 -4
  327. package/src/components/home.tsx +12 -12
  328. package/src/components/icon.tsx +16 -3
  329. package/src/components/notifications.tsx +419 -0
  330. package/src/components/pack-connect.tsx +1 -1
  331. package/src/components/pack-token.tsx +5 -5
  332. package/src/components/people.tsx +3 -3
  333. package/src/components/pictures.tsx +1 -1
  334. package/src/components/plugin-settings.tsx +128 -23
  335. package/src/components/projects.tsx +1 -1
  336. package/src/components/roadmap.tsx +2 -2
  337. package/src/components/rules.tsx +2 -2
  338. package/src/components/runs.tsx +6 -3
  339. package/src/components/sessions.tsx +2 -2
  340. package/src/components/shell.tsx +3 -0
  341. package/src/components/sign-in.tsx +3 -3
  342. package/src/components/skills.tsx +5 -3
  343. package/src/components/task-view.tsx +18 -7
  344. package/src/components/tokens.tsx +2 -2
  345. package/src/components/ui.tsx +70 -5
  346. package/src/components/work.tsx +2 -2
  347. package/src/console.tsx +269 -12
  348. package/src/data.ts +54 -0
  349. package/src/desk-page.tsx +5 -5
  350. package/src/feed-words.ts +214 -0
  351. package/src/i18n/en.ts +114 -15
  352. package/src/i18n/ko.ts +115 -22
  353. package/src/icons/glyphs.ts +74 -68
  354. package/src/icons/index.ts +9 -1
  355. package/src/index.ts +11 -0
  356. package/src/limits.ts +7 -0
  357. package/src/notifications.ts +205 -0
  358. package/src/onboarding.ts +10 -14
  359. package/src/plugin/capabilities.ts +13 -0
  360. package/src/plugin/context.ts +87 -0
  361. package/src/plugin/limits.ts +7 -0
  362. package/src/plugin/manifest.ts +14 -0
  363. package/src/plugin/rest-schemas.ts +27 -3
  364. package/src/plugin/testing.ts +4 -0
  365. package/src/plugin.ts +2 -0
  366. package/src/router.ts +7 -0
  367. package/src/routes.ts +2 -0
  368. package/src/rules.ts +1 -1
  369. package/src/runner/acp.ts +12 -118
  370. package/src/runner/browser.ts +128 -0
  371. package/src/runner/claude.ts +399 -12
  372. package/src/runner/codex.ts +904 -400
  373. package/src/runner/config.ts +30 -7
  374. package/src/runner/desk.ts +22 -6
  375. package/src/runner/message.ts +251 -21
  376. package/src/runner/registry.ts +6 -0
  377. package/src/runner/rpc.ts +140 -0
  378. package/src/runner/runner.ts +863 -53
  379. package/src/runner/slack.ts +1535 -85
  380. package/src/runner/types.ts +150 -5
  381. package/src/runner/usage.ts +299 -0
  382. package/src/runner.ts +16 -1
  383. package/src/schemas.ts +249 -0
  384. package/src/services.ts +3 -3
  385. package/src/setup-guide.ts +12 -14
  386. package/src/styles/README.md +11 -7
  387. package/src/styles/console.css +2 -0
  388. package/src/styles/drawn-by-pages.json +7 -82
  389. package/src/styles/pages/agents.css +46 -35
  390. package/src/styles/pages/calendar.css +0 -1
  391. package/src/styles/pages/connect.css +0 -14
  392. package/src/styles/pages/decisions.css +2 -43
  393. package/src/styles/pages/documents.css +0 -29
  394. package/src/styles/pages/home.css +4 -16
  395. package/src/styles/pages/people.css +2 -17
  396. package/src/styles/pages/plugins.css +9 -12
  397. package/src/styles/pages/roadmap.css +0 -16
  398. package/src/styles/pages/settings.css +0 -28
  399. package/src/styles/pages/sign-in.css +2 -17
  400. package/src/styles/pages/thread.css +4 -50
  401. package/src/styles/pages/work.css +0 -5
  402. package/src/styles/parts/button.css +31 -0
  403. package/src/styles/parts/count.css +10 -0
  404. package/src/styles/parts/divider.css +17 -0
  405. package/src/styles/parts/frame.css +12 -0
  406. package/src/styles/parts/icon.css +39 -0
  407. package/src/styles/parts/menu.css +184 -0
  408. package/src/styles/parts/panel.css +7 -0
  409. package/src/styles/parts/progress.css +63 -0
  410. package/src/styles/parts/settings.css +2 -0
  411. package/src/styles/parts/sheet.css +28 -0
  412. package/src/styles/parts/text.css +34 -0
  413. package/src/text.ts +19 -0
  414. package/src/vocabulary.ts +4 -1
  415. package/template/plugin/package.json +1 -1
@@ -1,12 +1,12 @@
1
1
  import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { memo, useCallback, useEffect, useMemo, useRef, useState, } from "react";
3
- import { MAX_FILE_BYTES, MAX_SIGNAL_ATTACHMENTS, MAX_SIGNAL_LENGTH, } from "../api.js";
3
+ import { MAX_FILE_BYTES, MAX_SIGNAL_ATTACHMENTS, MAX_SIGNAL_LENGTH, usageNear, usageSaidTogether, usedHundredths, } from "../api.js";
4
4
  import { today } from "../dates.js";
5
5
  import { useWords } from "../i18n/index.js";
6
6
  import { isPicture } from "./files.js";
7
7
  import { Markdown } from "./markdown.js";
8
8
  import { Lightbox, PictureThumb, usePicture } from "./pictures.js";
9
- import { Avatar, Badge, Button, Callout, cx, formatBytes, personName, Time } from "./ui.js";
9
+ import { Avatar, Badge, Button, Callout, cx, formatBytes, Meter, personName, Time } from "./ui.js";
10
10
  // The parts of an agent account's page (ADR-0085, ADR-0086): how it stands, what it is doing as
11
11
  // it happens, read as a conversation in a pane that follows its end, what a supervisor says to
12
12
  // it, shown as waiting until the agent takes it, what changes how it stands, its sessions, and
@@ -24,6 +24,35 @@ const STATE_TONES = {
24
24
  failed: "danger",
25
25
  unheard: "warning",
26
26
  };
27
+ /**
28
+ * What an agent account's product last said of what its subscription allows (ADR-0156): a
29
+ * window a line, by the name its driver gives it, with how much of it is used and when it
30
+ * resets. One near its limit is marked, and one used up. `usage` is the windows that still
31
+ * stand (`usageStanding`); `said` adds when the product said so, where there is room.
32
+ */
33
+ export function AgentUsage(props) {
34
+ const words = useWords().agents.usage;
35
+ // When they were said: once for all where the product said them together, and beside each
36
+ // where it did not, so that a window kept from days ago does not read as said just now.
37
+ const together = usageSaidTogether(props.usage);
38
+ const said = (iso) => (_jsxs(_Fragment, { children: [words.said.before, _jsx(Time, { iso: iso, precision: "clock" }), words.said.after] }));
39
+ return (_jsxs("div", { className: "sc-agent-usage", children: [props.usage.map((window, place) => {
40
+ // A name is what a runner sent: read as a word of the pack only where the pack itself
41
+ // holds it, and no key by itself, since two windows may be named alike.
42
+ const name = usageWindowName(words, window.name);
43
+ const near = usageNear(window);
44
+ const hundredths = window.used === null ? undefined : usedHundredths(window.used);
45
+ const resets = window.resetsAt !== null && (_jsxs(_Fragment, { children: [words.resets.before, _jsx(Time, { iso: window.resetsAt, precision: "week" }), words.resets.after] }));
46
+ const apart = props.said === true && together === undefined && said(window.at);
47
+ return (_jsx(Meter
48
+ // biome-ignore lint/suspicious/noArrayIndexKey: the windows are told apart by their place
49
+ , { label: name, share: window.used ?? undefined, figure: hundredths === undefined ? (near ? words.near : undefined) : `${hundredths}%`, tone: hundredths !== undefined && hundredths >= 100
50
+ ? "danger"
51
+ : near
52
+ ? "warning"
53
+ : undefined, note: resets === false && apart === false ? undefined : (_jsxs(_Fragment, { children: [resets, resets !== false && apart !== false && " · ", apart] })) }, place));
54
+ }), props.said === true && together !== undefined && (_jsx("span", { className: "sc-progress-words", children: said(together) }))] }));
55
+ }
27
56
  /** The state of an agent account as a badge: the word, and why and since when where there is room. */
28
57
  export function AgentStateBadge(props) {
29
58
  const words = useWords().agents.page.state;
@@ -31,7 +60,7 @@ export function AgentStateBadge(props) {
31
60
  if (state === null) {
32
61
  // Where there is room, an account no runner has spoken for says so as the others say how they
33
62
  // stand: a word in a badge, and why beside it.
34
- return props.full === true ? (_jsxs("span", { className: "sc-agent-state", children: [_jsx(Badge, { tone: "neutral", kind: "state", children: words.unset }), _jsx("span", { className: "sc-agent-state-why", children: words.none })] })) : null;
63
+ return props.full === true ? (_jsxs("span", { className: "sc-agent-state", children: [_jsx(Badge, { tone: "neutral", kind: "state", children: words.unset }), _jsx("span", { className: "sc-note", children: words.none })] })) : null;
35
64
  }
36
65
  const reasons = words.reasons;
37
66
  const reason = state.reason === null ? undefined : (reasons[state.reason] ?? state.reason);
@@ -39,7 +68,7 @@ export function AgentStateBadge(props) {
39
68
  if (props.full !== true) {
40
69
  return badge;
41
70
  }
42
- return (_jsxs("span", { className: "sc-agent-state", children: [badge, _jsxs("span", { className: "sc-agent-state-why", children: [reason !== undefined && `${reason} · `, words.since.before, _jsx(Time, { iso: state.since, precision: "clock" }), words.since.after, state.heardAt !== null && (_jsxs(_Fragment, { children: [" · ", words.heard, " ", _jsx(Time, { iso: state.heardAt, precision: "clock" })] }))] })] }));
71
+ return (_jsxs("span", { className: "sc-agent-state", children: [badge, _jsxs("span", { className: "sc-note", children: [reason !== undefined && `${reason} · `, words.since.before, _jsx(Time, { iso: state.since, precision: "clock" }), words.since.after, state.until !== undefined && state.until !== null && (_jsxs(_Fragment, { children: [" · ", words.until.before, _jsx(Time, { iso: state.until, precision: "clock" }), words.until.after] })), state.heardAt !== null && (_jsxs(_Fragment, { children: [" · ", words.heard, " ", _jsx(Time, { iso: state.heardAt, precision: "clock" })] }))] })] }));
43
72
  }
44
73
  /** What a runner says of an event that is said apart from the rest: the tool it names. */
45
74
  const TOOL = "tool";
@@ -72,6 +101,21 @@ const idOf = (event) => {
72
101
  const endsTurn = (event) => event.kind === "status" &&
73
102
  event.sealed === null &&
74
103
  (event.data.turn === "completed" || typeof event.data.ended === "string");
104
+ /** Whether an event is a sub-agent's word that it ended: a runner writes how under `over` (ADR-0161). */
105
+ const saysOver = (event) => event.kind === "status" && typeof event.data.over === "string";
106
+ /**
107
+ * The kinds of event by which a sub-agent that ended is at work again: what it says, thinks and
108
+ * calls, and its own word that it was started again. A tool's answer is none: a product that
109
+ * stops a sub-agent in the middle of a call says first that it ended, and then what became of
110
+ * the call.
111
+ */
112
+ const AT_WORK = new Set(["assistant", "thinking", "tool_call", "status"]);
113
+ /**
114
+ * Whether a call was answered with the word that its sub-agent goes on in the background
115
+ * (`background` on its answer, ADR-0161): the answer is then not the sub-agent's, which goes on
116
+ * past it, and past the turn it was started in.
117
+ */
118
+ const goesOn = (item) => item.result?.data.background === true;
75
119
  /**
76
120
  * The events of a session as the things a person reads, in order. A tool's call, what it
77
121
  * answered and what was asked before it ran are one thing, joined by the id the product gave
@@ -83,7 +127,9 @@ const endsTurn = (event) => event.kind === "status" &&
83
127
  * not a thing of the line the call stands in. A call that says it starts a sub-agent (`starts`)
84
128
  * has such a line from the first, empty; one a runner of before wrote has it from the first
85
129
  * event that names it. An event that names a call the events do not hold stays where it stood.
86
- * A turn or a session that ended ends every sub-agent still open in it.
130
+ * A turn or a session that ended ends every sub-agent still open in it, but for one that goes on
131
+ * in the background (ADR-0161): its own line says when it ended, and nothing but its session's
132
+ * end ends it before.
87
133
  */
88
134
  export function talkOf(events) {
89
135
  const top = [];
@@ -93,7 +139,7 @@ export function talkOf(events) {
93
139
  const calls = new Map();
94
140
  /** The line of each sub-agent, by the id of the call that started it. */
95
141
  const lines = new Map();
96
- /** The calls that started a sub-agent and were not answered, as far as the events read say. */
142
+ /** The calls that started a sub-agent that nothing ended yet, as far as the events read say. */
97
143
  let running = [];
98
144
  const toolAt = (place) => {
99
145
  const item = place === undefined ? undefined : place.line[place.at];
@@ -140,6 +186,13 @@ export function talkOf(events) {
140
186
  const parent = parentOf(event);
141
187
  const starter = parent === undefined ? undefined : calls.get(parent);
142
188
  const line = parent === undefined || starter === undefined ? top : lineOf(parent, starter);
189
+ // What a sub-agent's own line says of its end stands until the sub-agent does something
190
+ // after it, as one that was started again does: then it is at work again.
191
+ const begun = toolAt(starter);
192
+ if (starter !== undefined && begun !== undefined && event.sealed === null) {
193
+ const over = saysOver(event) ? event : AT_WORK.has(event.kind) ? undefined : begun.over;
194
+ set(starter, { ...begun, over });
195
+ }
143
196
  // A sealed event says who sealed it and why, wherever it stood.
144
197
  if (event.sealed !== null) {
145
198
  line.push({ type: "note", event });
@@ -220,15 +273,25 @@ export function talkOf(events) {
220
273
  else {
221
274
  line.push({ type: "note", event });
222
275
  // Where the session's own line says a turn ended, or the session did, nothing started in
223
- // it goes on: a sub-agent that was not answered by then is ended there.
276
+ // it goes on: a sub-agent that was not answered by then is ended there. One that goes on
277
+ // in the background goes on past a turn's end, and is ended by its session's alone.
224
278
  if (parent === undefined && endsTurn(event)) {
279
+ const session = typeof event.data.ended === "string";
280
+ const still = [];
225
281
  for (const place of running) {
226
282
  const tool = toolAt(place);
227
- if (tool !== undefined && tool.result === undefined && tool.endedAt === undefined) {
283
+ if (tool === undefined) {
284
+ continue;
285
+ }
286
+ if (goesOn(tool) && !session) {
287
+ still.push(place);
288
+ }
289
+ else if ((goesOn(tool) ? tool.over === undefined : tool.result === undefined) &&
290
+ tool.endedAt === undefined) {
228
291
  set(place, { ...tool, endedAt: event.at });
229
292
  }
230
293
  }
231
- running = [];
294
+ running = still;
232
295
  }
233
296
  }
234
297
  }
@@ -268,6 +331,11 @@ function atOf(steps) {
268
331
  * otherwise, which only an open session's is (`live`); how long it ran, to its answer, to where
269
332
  * it was ended or to the last thing it did, and to `now` while it runs; how many tools it
270
333
  * called; and what it is at. Nothing for a thing that is no call that started a sub-agent.
334
+ *
335
+ * One that goes on in the background (ADR-0161) is not answered for by its call's answer, which
336
+ * says only that it was started: it stands by its own word that it ended, done, failed or
337
+ * stopped, is ended where its session ended first, and is at work otherwise, whatever turn
338
+ * ended meanwhile.
271
339
  */
272
340
  export function subAgentOf(item, input) {
273
341
  if (item.type !== "tool" || item.steps === undefined) {
@@ -282,22 +350,32 @@ export function subAgentOf(item, input) {
282
350
  const named = typeof said === "string" ? said : steps.map(firstOf).find(Boolean)?.data.subagent;
283
351
  const name = typeof named === "string" ? named.trim().slice(0, MAX_SUBAGENT_NAME) : "";
284
352
  const started = Date.parse(first.at);
285
- const answered = item.result === undefined ? Number.NaN : Date.parse(item.result.at);
353
+ // What the sub-agent answered: the call's answer, but for one that says the sub-agent goes on.
354
+ const answer = goesOn(item) ? undefined : item.result;
355
+ const how = item.over?.data.over;
286
356
  const cut = item.endedAt === undefined ? Number.NaN : Date.parse(item.endedAt);
287
- const state = item.result !== undefined
288
- ? item.result.data.error === true
357
+ const state = answer !== undefined
358
+ ? answer.data.error === true
289
359
  ? "failed"
290
360
  : "done"
291
- : item.endedAt !== undefined || refusedOf(item) || !input.live
292
- ? "ended"
293
- : "running";
361
+ : item.over !== undefined
362
+ ? how === "failed"
363
+ ? "failed"
364
+ : how === "stopped"
365
+ ? "ended"
366
+ : "done"
367
+ : item.endedAt !== undefined || refusedOf(item) || !input.live
368
+ ? "ended"
369
+ : "running";
294
370
  const until = state === "running"
295
371
  ? input.now
296
- : item.result !== undefined
297
- ? answered
298
- : item.endedAt !== undefined
299
- ? cut
300
- : Math.max(started, ...steps.flatMap(momentsOf));
372
+ : answer !== undefined
373
+ ? Date.parse(answer.at)
374
+ : item.over !== undefined
375
+ ? Date.parse(item.over.at)
376
+ : item.endedAt !== undefined
377
+ ? cut
378
+ : Math.max(started, ...steps.flatMap(momentsOf));
301
379
  const seconds = Math.floor((until - started) / 1000);
302
380
  return {
303
381
  n: first.n,
@@ -319,20 +397,32 @@ function subAgentsIn(items, input) {
319
397
  });
320
398
  }
321
399
  /**
322
- * The sub-agents at work in the turn under way, read off a session's events alone, in the order
323
- * they were started: those a call of this turn started that was not answered yet. None where the
324
- * session has no event, or its last turn is over.
400
+ * The sub-agents at work in an open session, read off its events alone, in the order they were
401
+ * started: those a call of the turn under way started that was not answered yet, and those that
402
+ * go on in the background, whatever turn started them, until each says it ended (ADR-0161).
403
+ * None where the session has no event; none but those in the background where its last turn is
404
+ * over.
325
405
  */
326
406
  export function atWorkOf(events, now) {
327
- let from = 0;
328
- for (let at = events.length - 1; at >= 0; at -= 1) {
329
- const event = events[at];
330
- if (event !== undefined && parentOf(event) === undefined && endsTurn(event)) {
331
- from = at + 1;
332
- break;
407
+ return subAgentsIn(talkOf(events), { now, live: true }).filter((one) => one.state === "running");
408
+ }
409
+ /**
410
+ * Whether the events read hold what a sub-agent did and not the call that started it: the call
411
+ * then stands before them, as it does once a sub-agent has worked for long, and what it did is
412
+ * read under it only once the events before are read too.
413
+ */
414
+ export function lacksStarter(events) {
415
+ const calls = new Set();
416
+ for (const event of events) {
417
+ const id = event.kind === "tool_call" ? idOf(event) : undefined;
418
+ if (id !== undefined) {
419
+ calls.add(id);
333
420
  }
334
421
  }
335
- return subAgentsIn(talkOf(events.slice(from)), { now, live: true }).filter((one) => one.state === "running");
422
+ return events.some((event) => {
423
+ const parent = parentOf(event);
424
+ return parent !== undefined && !calls.has(parent);
425
+ });
336
426
  }
337
427
  /**
338
428
  * Whether a turn is under way, and what the agent is at, read off a session's events alone:
@@ -396,19 +486,36 @@ export function takenOf(events) {
396
486
  return most;
397
487
  }
398
488
  /**
399
- * The words supervisors sent that the agent has not taken: the tells, and the interrupts that
400
- * carry words or files, after the last signal the record says it took, the oldest first. A
401
- * signal is taken in order, so everything up to that one was.
489
+ * The words sent that the agent has not taken: the tells, the interrupts that carry words or
490
+ * files, and the resets that carry words, a supervisor's or the account's own (ADR-0154),
491
+ * which a new conversation begins with, after the last signal the record says it took, the
492
+ * oldest first. A signal is taken in order, so everything up to that one was.
402
493
  */
403
494
  export function waitingOf(signals, taken) {
404
495
  return signals
405
496
  .filter((signal) => signal.number > taken &&
406
497
  signal.source === "person" &&
407
- (signal.kind === "tell" || signal.kind === "interrupt") &&
498
+ (signal.kind === "tell" || signal.kind === "interrupt" || signal.kind === "reset") &&
408
499
  (signal.text.trim().length > 0 || signal.attachments.length > 0))
409
500
  .slice()
410
501
  .sort((a, b) => a.number - b.number);
411
502
  }
503
+ /** Whether a signal is a reset the account itself sent (ADR-0154): who sent it tells it from a supervisor's. */
504
+ export const isOwnReset = (signal, account) => signal.kind === "reset" && signal.source === "person" && signal.by?.id === account;
505
+ /**
506
+ * The account's own reset that waits (ADR-0154), or nothing. It waits for the turn under way
507
+ * to end, whatever its product takes in a turn and whatever was taken after it, so the count
508
+ * of what was taken does not say it: taking it ends the session, so one sent since the open
509
+ * session began waits still, the last of them standing for those before it. `began` is when
510
+ * the open session began; with none open, nothing waits so.
511
+ */
512
+ export function ownResetWaiting(signals, account, began) {
513
+ const from = began === undefined ? Number.NaN : Date.parse(began);
514
+ return signals
515
+ .filter((signal) => isOwnReset(signal, account) && Date.parse(signal.at) >= from)
516
+ .sort((a, b) => a.number - b.number)
517
+ .at(-1);
518
+ }
412
519
  /** Nothing read whole yet. */
413
520
  export const NO_WHOLE = { of: undefined, texts: {} };
414
521
  /**
@@ -472,6 +579,23 @@ export function saidLine(text) {
472
579
  }
473
580
  /** A fact of an event as a word, or nothing where it is none. */
474
581
  const word = (value) => typeof value === "string" && value.length > 0 ? value : undefined;
582
+ /**
583
+ * A window of an allowance by the words a person has for it (ADR-0156): the plan's two by the
584
+ * pack's words, and a window of a part of the allowance, which a driver names by the plan's
585
+ * window with what it is of after it (`weekly fable`), as that window's word with the rest
586
+ * beside it, "Week (Fable)". Any other name is what a runner sent, and is shown as it came.
587
+ */
588
+ export function usageWindowName(words, name) {
589
+ if (Object.hasOwn(words.windows, name)) {
590
+ return words.windows[name] ?? name;
591
+ }
592
+ const space = name.indexOf(" ");
593
+ const window = space > 0 ? name.slice(0, space) : "";
594
+ const of = space > 0 ? name.slice(space + 1).trim() : "";
595
+ return Object.hasOwn(words.windows, window) && of !== ""
596
+ ? words.windowOf(words.windows[window] ?? window, `${of.charAt(0).toUpperCase()}${of.slice(1)}`)
597
+ : name;
598
+ }
475
599
  /**
476
600
  * What the record names in a word of its own, a signal's kind, an answer, a fact's name, in the
477
601
  * page's words: the pack's word for it, or the word as it came where the pack has none, as for
@@ -522,7 +646,8 @@ function sameItem(a, b) {
522
646
  a.call === b.call &&
523
647
  a.result === b.result &&
524
648
  a.permission === b.permission &&
525
- a.endedAt === b.endedAt);
649
+ a.endedAt === b.endedAt &&
650
+ a.over === b.over);
526
651
  }
527
652
  return a.type === b.type && a.event === b.event;
528
653
  }
@@ -654,7 +779,7 @@ const TalkLine = memo(function Line(props) {
654
779
  const shown = read ?? event.text;
655
780
  const readWhole = hands.readWhole;
656
781
  return (_jsxs(_Fragment, { children: [shown.length > 0 &&
657
- (said ? (_jsx(Markdown, { source: shown, picturesAsLinks: true })) : (_jsx("pre", { className: className, children: shown }))), event.whole !== null && read === undefined && (_jsxs("p", { className: "sc-talk-cut", children: [words.cutAt(formatBytes(event.whole)), " ", readWhole !== undefined && (_jsx(Button, { variant: "ghost", size: "sm", disabled: props.reading === event.n, onClick: () => readWhole(event.n), children: words.whole }))] }))] }));
782
+ (said ? (_jsx(Markdown, { source: shown, picturesAsLinks: true })) : (_jsx("pre", { className: className, children: shown }))), event.whole !== null && read === undefined && (_jsxs("p", { className: "sc-talk-cut sc-fine", children: [words.cutAt(formatBytes(event.whole)), " ", readWhole !== undefined && (_jsx(Button, { variant: "ghost", size: "sm", disabled: props.reading === event.n, onClick: () => readWhole(event.n), children: words.whole }))] }))] }));
658
783
  };
659
784
  const pictures = (event) => event === undefined || event.files.length === 0 ? null : (_jsx("ul", { className: "sc-talk-pictures", children: event.files.map((file) => (_jsx("li", { children: _jsx(PictureThumb, { picture: {
660
785
  src: hands.fileHref(file.id),
@@ -686,7 +811,7 @@ const TalkLine = memo(function Line(props) {
686
811
  const calls = words.agent.calls(started.calls);
687
812
  // What it is called: by the call, by its events, or as the tool that started it is.
688
813
  const called = started.name.length === 0 ? (name ?? kinds.tool_call) : started.name;
689
- return (_jsxs("li", { className: cx("sc-talk-item", "sc-talk-step", "sc-talk-tool", (started.state === "failed" || refused) && "sc-talk-tool-failed"), "data-n": first.n, children: [_jsxs("details", { className: "sc-talk-tool-fold", children: [_jsxs("summary", { className: "sc-talk-tool-head sc-talk-agent-head", children: [_jsx("span", { className: "sc-talk-who sc-talk-agent-name", title: called, children: called }), sub !== undefined && _jsx(Badge, { children: words.subagent(sub) }), refused ? (_jsx(Badge, { tone: "warning", children: words.toolRefused })) : started.state === "running" ? (_jsx(Badge, { tone: "success", kind: "state", live: true, children: words.agent.states.running })) : started.state === "failed" ? (_jsx(Badge, { tone: "danger", children: words.agent.states.failed })) : (_jsx(Badge, { children: words.agent.states[started.state] })), when(first), _jsxs("span", { className: "sc-muted sc-talk-agent-facts", children: [_jsx("span", { className: "sc-talk-kind", children: words.agent.label }), started.state === "running" ? (_jsxs(_Fragment, { children: [workingWord(words.working, started.at), " \u00B7 ", calls, " \u00B7", " ", _jsx(RunningFor, { since: started.startedAt })] })) : (`${calls} · ${clockOf(started.seconds)}`)] })] }), _jsxs("div", { className: "sc-talk-tool-body", children: [one.permission !== undefined && (_jsxs("p", { className: "sc-talk-note-line", children: [kinds.permission, answer === undefined ? "" : ` · ${wordOf(words.answers, answer)}`, one.permission.text.length > 0 && ` · ${one.permission.text}`] })), one.call !== undefined && text(one.call, "sc-talk-code", props.whole), steps.length > 0 && (_jsx("ol", { className: "sc-talk sc-talk-steps", "aria-label": words.agent.steps, children: steps.map(({ key, ...step }) => (_jsx(TalkLine, { ...step }, key))) })), one.result !== undefined &&
814
+ return (_jsxs("li", { className: cx("sc-talk-item", "sc-talk-step", "sc-talk-tool", (started.state === "failed" || refused) && "sc-talk-tool-failed"), "data-n": first.n, children: [_jsxs("details", { className: "sc-talk-tool-fold", children: [_jsxs("summary", { className: "sc-talk-tool-head sc-talk-agent-head", children: [_jsx("span", { className: "sc-name sc-talk-agent-name", title: called, children: called }), sub !== undefined && _jsx(Badge, { children: words.subagent(sub) }), refused ? (_jsx(Badge, { tone: "warning", children: words.toolRefused })) : started.state === "running" ? (_jsx(Badge, { tone: "success", kind: "state", live: true, children: words.agent.states.running })) : started.state === "failed" ? (_jsx(Badge, { tone: "danger", children: words.agent.states.failed })) : (_jsx(Badge, { children: words.agent.states[started.state] })), when(first), _jsxs("span", { className: "sc-muted sc-talk-agent-facts", children: [_jsx("span", { className: "sc-talk-kind", children: words.agent.label }), started.state === "running" ? (_jsxs(_Fragment, { children: [workingWord(words.working, started.at), " \u00B7 ", calls, " \u00B7", " ", _jsx(RunningFor, { since: started.startedAt })] })) : (`${calls} · ${clockOf(started.seconds)}`)] })] }), _jsxs("div", { className: "sc-talk-tool-body", children: [one.permission !== undefined && (_jsxs("p", { className: "sc-talk-note-line", children: [kinds.permission, answer === undefined ? "" : ` · ${wordOf(words.answers, answer)}`, one.permission.text.length > 0 && ` · ${one.permission.text}`] })), one.call !== undefined && text(one.call, "sc-talk-code", props.whole), steps.length > 0 && (_jsx("ol", { className: "sc-talk sc-talk-steps", "aria-label": words.agent.steps, children: steps.map(({ key, ...step }) => (_jsx(TalkLine, { ...step }, key))) })), one.result !== undefined &&
690
815
  text(one.result, "sc-talk-code sc-talk-code-answer", props.wholeAnswer)] })] }), pictures(one.result)] }));
691
816
  }
692
817
  return (_jsxs("li", { className: cx("sc-talk-item", "sc-talk-step", "sc-talk-tool", (failed || refused) && "sc-talk-tool-failed"), "data-n": first.n, children: [_jsxs("details", { className: "sc-talk-tool-fold", children: [_jsxs("summary", { className: "sc-talk-tool-head", children: [_jsx("code", { className: "sc-talk-tool-name", children: name ?? kinds.tool_call }), _jsx("span", { className: "sc-talk-tool-line", children: line }), sub !== undefined && _jsx(Badge, { children: words.subagent(sub) }), failed && _jsx(Badge, { tone: "danger", children: words.toolFailed }), refused && _jsx(Badge, { tone: "warning", children: words.toolRefused }), one.result === undefined && one.call !== undefined && !refused && (_jsx("span", { className: "sc-muted", children: words.toolRunning })), when(first)] }), _jsxs("div", { className: "sc-talk-tool-body", children: [one.permission !== undefined && (_jsxs("p", { className: "sc-talk-note-line", children: [kinds.permission, answer === undefined ? "" : ` · ${wordOf(words.answers, answer)}`, one.permission.text.length > 0 && ` · ${one.permission.text}`] })), one.call !== undefined && text(one.call, "sc-talk-code", props.whole), one.result !== undefined &&
@@ -694,7 +819,7 @@ const TalkLine = memo(function Line(props) {
694
819
  }
695
820
  const { event } = one;
696
821
  if (event.sealed !== null) {
697
- return (_jsxs("li", { className: "sc-talk-item sc-talk-note", "data-n": event.n, children: [_jsx("span", { className: "sc-talk-note-line", children: words.sealed(event.sealed.by === null ? "?" : (event.sealed.by.name ?? event.sealed.by.login), event.sealed.reason) }), when(event)] }));
822
+ return (_jsxs("li", { className: "sc-talk-item sc-talk-note sc-fine", "data-n": event.n, children: [_jsx("span", { className: "sc-talk-note-line", children: words.sealed(event.sealed.by === null ? "?" : (event.sealed.by.name ?? event.sealed.by.login), event.sealed.reason) }), when(event)] }));
698
823
  }
699
824
  if (one.type === "told") {
700
825
  const number = typeof event.data.signal === "number" ? event.data.signal : undefined;
@@ -712,10 +837,10 @@ const TalkLine = memo(function Line(props) {
712
837
  event.text.length === 0 &&
713
838
  event.files.length === 0 &&
714
839
  others === undefined) {
715
- return (_jsx("li", { className: "sc-talk-item sc-talk-note", "data-n": event.n, children: _jsxs("span", { className: "sc-talk-note-line", children: [words.interrupted(who), when(event)] }) }));
840
+ return (_jsx("li", { className: "sc-talk-item sc-talk-note sc-fine", "data-n": event.n, children: _jsxs("span", { className: "sc-talk-note-line", children: [words.interrupted(who), when(event)] }) }));
716
841
  }
717
842
  const signalFileHref = hands.signalFileHref;
718
- return (_jsxs("li", { className: "sc-talk-item sc-talk-told", "data-n": event.n, children: [_jsxs("div", { className: "sc-talk-bubble", children: [text(event, "sc-talk-text", props.whole), pictures(event), listed !== undefined && listed.length > 0 ? (_jsx("ul", { className: "sc-chosen-files", "aria-label": words.files, children: listed.map((file) => (_jsxs("li", { className: "sc-chosen-file", children: [signalFileHref === undefined || number === undefined ? (_jsx("span", { children: file.name })) : (_jsx("a", { href: signalFileHref(number, file.id), download: file.name, children: file.name })), " ", _jsx("span", { className: "sc-muted", children: formatBytes(file.size) })] }, file.id))) })) : (others !== undefined && (_jsxs("p", { className: "sc-talk-note-line", children: [words.files, ": ", others] }))), unseen !== undefined && (_jsx("p", { className: "sc-talk-note-line sc-talk-unseen", children: words.unseen(unseen) }))] }), _jsxs("div", { className: "sc-talk-meta", children: [_jsx("span", { className: "sc-talk-who", children: who }), through !== undefined && _jsx("span", { children: words.through(through) }), kind !== undefined && kind !== "tell" && (_jsx(Badge, { children: wordOf(words.signalKinds, kind) })), when(event)] }), event.data.unread === true && (_jsx("p", { className: "sc-talk-note-line sc-talk-unread", children: words.unread }))] }));
843
+ return (_jsxs("li", { className: "sc-talk-item sc-talk-told", "data-n": event.n, children: [_jsxs("div", { className: "sc-talk-bubble", children: [text(event, "sc-talk-text", props.whole), pictures(event), listed !== undefined && listed.length > 0 ? (_jsx("ul", { className: "sc-chosen-files", "aria-label": words.files, children: listed.map((file) => (_jsxs("li", { className: "sc-chosen-file", children: [signalFileHref === undefined || number === undefined ? (_jsx("span", { children: file.name })) : (_jsx("a", { href: signalFileHref(number, file.id), download: file.name, children: file.name })), " ", _jsx("span", { className: "sc-muted", children: formatBytes(file.size) })] }, file.id))) })) : (others !== undefined && (_jsxs("p", { className: "sc-talk-note-line", children: [words.files, ": ", others] }))), unseen !== undefined && (_jsx("p", { className: "sc-talk-note-line sc-talk-unseen", children: words.unseen(unseen) }))] }), _jsxs("div", { className: "sc-talk-meta sc-fine", children: [_jsx("span", { className: "sc-name", children: who }), through !== undefined && _jsx("span", { children: words.through(through) }), kind !== undefined && kind !== "tell" && (_jsx(Badge, { children: wordOf(words.signalKinds, kind) })), when(event)] }), event.data.unread === true && (_jsx("p", { className: "sc-talk-note-line sc-talk-unread", children: words.unread }))] }));
719
844
  }
720
845
  if (one.type === "said") {
721
846
  const sub = subagentOf(event);
@@ -739,17 +864,19 @@ const TalkLine = memo(function Line(props) {
739
864
  return (_jsx("li", { className: "sc-talk-item sc-talk-turn", "data-n": event.n, children: _jsxs("span", { className: "sc-talk-note-line", children: [words.turnDone(Number.isFinite(seconds) ? seconds : undefined), when(event)] }) }));
740
865
  }
741
866
  // A wake, a status, an error, and whatever a newer runner calls otherwise: a note between.
742
- // What the note's own words say already, how a session ended, is not said twice as a fact.
867
+ // What the note's own words say already, how a session or a sub-agent ended, is not said
868
+ // twice as a fact.
743
869
  // The id of the call that started a sub-agent is for joining, and says nothing to a reader;
744
870
  // whose a note is, is not said again under the sub-agent that made it.
745
871
  const facts = Object.entries(event.data).filter(([name, fact]) => fact !== null &&
746
872
  name !== "signal" &&
747
873
  name !== "kind" &&
748
874
  name !== "ended" &&
875
+ name !== "over" &&
749
876
  name !== "parent" &&
750
877
  !(name === "subagent" && props.inside === true));
751
878
  const lines = event.text.split("\n").filter((line) => line.trim().length > 0);
752
- return (_jsxs("li", { className: cx("sc-talk-item", "sc-talk-note", event.kind === "error" && "sc-talk-note-error"), "data-n": event.n, children: [_jsxs("span", { className: "sc-talk-note-line", children: [_jsx("span", { className: "sc-talk-kind", children: kinds[event.kind] ?? event.kind }), facts.map(([name, fact]) => (_jsxs("span", { className: "sc-talk-fact", children: [wordOf(words.facts, name), " ", String(fact)] }, name))), lines.length === 1 && _jsx("span", { children: lines[0] }), when(event)] }), lines.length > 1 && text(event, "sc-talk-text sc-talk-text-note", props.whole), pictures(event)] }));
879
+ return (_jsxs("li", { className: cx("sc-talk-item", "sc-talk-note", "sc-fine", event.kind === "error" && "sc-talk-note-error"), "data-n": event.n, children: [_jsxs("span", { className: "sc-talk-note-line", children: [_jsx("span", { className: "sc-talk-kind", children: kinds[event.kind] ?? event.kind }), facts.map(([name, fact]) => (_jsxs("span", { className: "sc-talk-fact", children: [wordOf(words.facts, name), " ", String(fact)] }, name))), lines.length === 1 && _jsx("span", { children: lines[0] }), when(event)] }), lines.length > 1 && text(event, "sc-talk-text sc-talk-text-note", props.whole), pictures(event)] }));
753
880
  }, sameLine);
754
881
  /**
755
882
  * A session as a conversation: what the agent was told at the right, as whoever said it wrote
@@ -823,9 +950,10 @@ export function TranscriptView(props) {
823
950
  return (_jsxs(_Fragment, { children: [_jsxs("ol", { className: "sc-talk", "aria-label": words.transcript, children: [lines.map(({ key, ...line }) => (_jsx(TalkLine, { ...line }, key))), props.foot] }), _jsx(Lightbox, { picture: shown.shown, onClose: shown.close })] }));
824
951
  }
825
952
  /**
826
- * What supervisors said and the agent has not taken yet, at the foot of the conversation: each
827
- * as it will stand there, quieter, with when it is read; and under the last, while a turn is
828
- * under way, the way to have them read now. Rows of the conversation's list.
953
+ * What was said and the agent has not taken yet, at the foot of the conversation: each as it
954
+ * will stand there, quieter, with what it was where it was more than a tell and when it is
955
+ * read; and under the last, while a turn is under way, the way to have them read now. Rows of
956
+ * the conversation's list.
829
957
  */
830
958
  export function TalkWaiting(props) {
831
959
  const words = useWords().agents.page.live;
@@ -838,25 +966,27 @@ export function TalkWaiting(props) {
838
966
  const last = index === props.signals.length - 1;
839
967
  const pictures = signal.attachments.filter((file) => isPicture(file.contentType));
840
968
  const others = signal.attachments.filter((file) => !isPicture(file.contentType));
841
- return (_jsxs("li", { className: "sc-talk-item sc-talk-told sc-talk-waiting", "data-signal": signal.number, children: [_jsxs("div", { className: "sc-talk-bubble", children: [signal.text.length > 0 && _jsx("pre", { className: "sc-talk-text", children: signal.text }), pictures.length > 0 && props.fileHref !== undefined && (_jsx("ul", { className: "sc-talk-pictures", children: pictures.map((file) => (_jsx("li", { children: _jsx("img", { src: props.fileHref?.(signal.number, file.id), alt: file.name, title: `${file.name} · ${formatBytes(file.size)}`, loading: "lazy" }) }, file.id))) })), others.length > 0 && (_jsx("ul", { className: "sc-chosen-files", "aria-label": words.files, children: others.map((file) => (_jsxs("li", { className: "sc-chosen-file", children: [_jsx("span", { children: file.name }), " ", _jsx("span", { className: "sc-muted", children: formatBytes(file.size) })] }, file.id))) }))] }), _jsxs("div", { className: "sc-talk-meta", children: [_jsx("span", { className: "sc-talk-who", children: signal.by === null ? words.kinds.person : personName(signal.by) }), _jsx(Time, { iso: signal.at, precision: "clock" })] }), last && (_jsxs("p", { className: "sc-talk-wait", role: "status", children: [_jsx("span", { children: waits[props.why] }), stops && (_jsx(Button, { size: "sm", disabled: props.busy === true, title: waits.interruptHint, onClick: props.onInterrupt, children: waits.interrupt }))] }))] }, signal.number));
969
+ return (_jsxs("li", { className: "sc-talk-item sc-talk-told sc-talk-waiting", "data-signal": signal.number, children: [_jsxs("div", { className: "sc-talk-bubble", children: [signal.text.length > 0 && _jsx("pre", { className: "sc-talk-text", children: signal.text }), pictures.length > 0 && props.fileHref !== undefined && (_jsx("ul", { className: "sc-talk-pictures", children: pictures.map((file) => (_jsx("li", { children: _jsx("img", { src: props.fileHref?.(signal.number, file.id), alt: file.name, title: `${file.name} · ${formatBytes(file.size)}`, loading: "lazy" }) }, file.id))) })), others.length > 0 && (_jsx("ul", { className: "sc-chosen-files", "aria-label": words.files, children: others.map((file) => (_jsxs("li", { className: "sc-chosen-file", children: [_jsx("span", { children: file.name }), " ", _jsx("span", { className: "sc-muted", children: formatBytes(file.size) })] }, file.id))) }))] }), _jsxs("div", { className: "sc-talk-meta sc-fine", children: [_jsx("span", { className: "sc-name", children: signal.by === null ? words.kinds.person : personName(signal.by) }), signal.kind !== "tell" && _jsx(Badge, { children: wordOf(words.signalKinds, signal.kind) }), _jsx(Time, { iso: signal.at, precision: "clock" })] }), last && (_jsxs("p", { className: "sc-talk-wait sc-fine", role: "status", children: [_jsx("span", { children: waits[props.why] }), stops && (_jsx(Button, { size: "sm", disabled: props.busy === true, title: waits.interruptHint, onClick: props.onInterrupt, children: waits.interrupt }))] }))] }, signal.number));
842
970
  }) }));
843
971
  }
844
972
  /**
845
973
  * The sign that the agent is at work while a turn is under way: its picture, three dots, and
846
974
  * what it is at, a thought, a tool by its name, or the work between. Where sub-agents run, it
847
975
  * says how many, with each under it: its name, what it is at, how many tools it called and how
848
- * long it has run, which the page counts by itself (ADR-0141). A row of the conversation's list;
849
- * nothing where no turn is under way.
976
+ * long it has run, which the page counts by itself (ADR-0141). Sub-agents that go on in the
977
+ * background are at work past the turn that started them (ADR-0161), and the sign stands for
978
+ * them alone then. A row of the conversation's list; nothing where no turn is under way and no
979
+ * sub-agent is at work.
850
980
  */
851
981
  export function TalkWorking(props) {
852
982
  const live = useWords().agents.page.live;
853
983
  const words = live.working;
854
984
  const { working } = props;
855
- if (working === undefined) {
985
+ const agents = props.agents ?? [];
986
+ if (working === undefined && agents.length === 0) {
856
987
  return null;
857
988
  }
858
- const agents = props.agents ?? [];
859
- return (_jsxs("li", { className: cx("sc-talk-item", "sc-talk-working", agents.length > 0 && "sc-talk-working-agents"), role: "status", children: [props.agent !== undefined && _jsx(Avatar, { person: props.agent, size: "sm" }), _jsxs("span", { className: "sc-talk-dots", "aria-hidden": "true", children: [_jsx("span", {}), _jsx("span", {}), _jsx("span", {})] }), _jsx("span", { children: agents.length > 0 ? words.agents(agents.length) : workingWord(words, working) }), agents.length > 0 && (_jsx("ul", { className: "sc-talk-agents", "aria-live": "off", children: agents.map((one) => (_jsxs("li", { className: "sc-talk-agents-row", children: [_jsx("span", { className: "sc-talk-who sc-talk-agent-name", children: one.name.length === 0 ? live.agent.label : one.name }), _jsxs("span", { className: "sc-talk-agents-facts", children: [workingWord(words, one.at), " \u00B7 ", live.agent.calls(one.calls), " \u00B7", " ", _jsx(RunningFor, { since: one.startedAt })] })] }, one.n))) }))] }));
989
+ return (_jsxs("li", { className: cx("sc-talk-item", "sc-talk-working", "sc-note", agents.length > 0 && "sc-talk-working-agents"), role: "status", children: [props.agent !== undefined && _jsx(Avatar, { person: props.agent, size: "sm" }), _jsxs("span", { className: "sc-talk-dots", "aria-hidden": "true", children: [_jsx("span", {}), _jsx("span", {}), _jsx("span", {})] }), _jsx("span", { children: agents.length > 0 ? words.agents(agents.length) : workingWord(words, working) }), agents.length > 0 && (_jsx("ul", { className: "sc-talk-agents", "aria-live": "off", children: agents.map((one) => (_jsxs("li", { className: "sc-talk-agents-row", children: [_jsx("span", { className: "sc-name sc-talk-agent-name", children: one.name.length === 0 ? live.agent.label : one.name }), _jsxs("span", { className: "sc-talk-agents-facts", children: [workingWord(words, one.at), " \u00B7 ", live.agent.calls(one.calls), " \u00B7", " ", _jsx(RunningFor, { since: one.startedAt })] })] }, one.n))) }))] }));
860
990
  }
861
991
  /**
862
992
  * A conversation in a pane of its own, as a chat is read: it scrolls within the pane, with the
@@ -1197,7 +1327,7 @@ export function AgentSessionList(props) {
1197
1327
  return _jsx(_Fragment, { children: props.empty ?? null });
1198
1328
  }
1199
1329
  const ends = words.ends;
1200
- return (_jsx("ul", { className: "sc-agent-sessions", "aria-label": words.title, children: props.sessions.map((session) => (_jsxs("li", { className: "sc-agent-session", children: [_jsxs("span", { className: "sc-agent-session-when", children: [_jsx("a", { className: "sc-agent-session-link", href: props.href(session), children: _jsx(Time, { iso: session.startedAt }) }), session.endedAt !== null && (_jsxs("span", { className: "sc-agent-session-until", children: [" – ", _jsx(Time, { iso: session.endedAt, precision: "clock", against: session.startedAt })] }))] }), _jsxs("span", { className: "sc-agent-session-badges", children: [session.ended === null ? (_jsx(Badge, { tone: "success", kind: "state", children: words.open })) : (_jsx(Badge, { tone: session.ended === "crashed" ? "danger" : "neutral", children: ends[session.ended] ?? session.ended })), session.away && _jsx(Badge, { tone: "warning", children: words.away })] }), _jsx("span", { className: "sc-agent-session-facts", children: [
1330
+ return (_jsx("ul", { className: "sc-agent-sessions", "aria-label": words.title, children: props.sessions.map((session) => (_jsxs("li", { className: "sc-agent-session", children: [_jsxs("span", { className: "sc-agent-session-when", children: [_jsx("a", { className: "sc-agent-session-link", href: props.href(session), children: _jsx(Time, { iso: session.startedAt }) }), session.endedAt !== null && (_jsxs("span", { className: "sc-agent-session-until", children: [" – ", _jsx(Time, { iso: session.endedAt, precision: "clock", against: session.startedAt })] }))] }), _jsxs("span", { className: "sc-agent-session-badges", children: [session.ended === null ? (_jsx(Badge, { tone: "success", kind: "state", children: words.open })) : (_jsx(Badge, { tone: session.ended === "crashed" ? "danger" : "neutral", children: ends[session.ended] ?? session.ended })), session.away && _jsx(Badge, { tone: "warning", children: words.away })] }), _jsx("span", { className: "sc-agent-session-facts sc-note", children: [
1201
1331
  `${session.product.name}${session.product.version === null ? "" : ` ${session.product.version}`}`,
1202
1332
  ...(session.model === null ? [] : [session.model]),
1203
1333
  ...(session.resumed ? [words.resumed] : []),
@@ -1269,6 +1399,6 @@ export function AgentSecretList(props) {
1269
1399
  setName("");
1270
1400
  setValue("");
1271
1401
  };
1272
- return (_jsxs("div", { children: [props.secrets.length === 0 ? (_jsx("p", { className: "sc-field-hint", children: words.empty })) : (_jsx("ul", { className: "sc-agent-secret-list", "aria-label": words.title, children: props.secrets.map((secret) => (_jsxs("li", { className: "sc-agent-secret", children: [_jsx("code", { children: secret.name }), _jsxs("span", { className: "sc-muted", children: [_jsx(Time, { iso: secret.setAt, precision: "day" }), secret.seeded && ` · ${words.seeded}`, secret.expiresOn !== null && ` · ${words.expires(secret.expiresOn)}`] }), _jsx(Button, { variant: "ghost", size: "sm", disabled: busy, onClick: () => props.onRemove(secret.name), children: words.remove })] }, secret.name))) })), _jsxs("form", { className: "sc-agent-secret-form", "aria-label": words.seedAria, onSubmit: submit, children: [_jsx("input", { className: "sc-input", "aria-label": words.name, placeholder: words.namePlaceholder, value: name, autoComplete: "off", onChange: (event) => setName(event.target.value) }), _jsx("input", { className: "sc-input", type: "password", "aria-label": words.value, placeholder: words.value, value: value, autoComplete: "new-password", onChange: (event) => setValue(event.target.value) }), _jsx(Button, { type: "submit", disabled: busy || name.trim().length === 0 || value.length === 0, children: words.seed })] }), _jsx("p", { className: "sc-field-hint", children: words.intro })] }));
1402
+ return (_jsxs("div", { children: [props.secrets.length === 0 ? (_jsx("p", { className: "sc-field-hint", children: words.empty })) : (_jsx("ul", { className: "sc-divided sc-agent-secret-list", "aria-label": words.title, children: props.secrets.map((secret) => (_jsxs("li", { className: "sc-small sc-agent-secret", children: [_jsx("code", { children: secret.name }), _jsxs("span", { className: "sc-muted", children: [_jsx(Time, { iso: secret.setAt, precision: "day" }), secret.seeded && ` · ${words.seeded}`, secret.expiresOn !== null && ` · ${words.expires(secret.expiresOn)}`] }), _jsx(Button, { variant: "ghost", size: "sm", disabled: busy, onClick: () => props.onRemove(secret.name), children: words.remove })] }, secret.name))) })), _jsxs("form", { className: "sc-agent-secret-form", "aria-label": words.seedAria, onSubmit: submit, children: [_jsx("input", { className: "sc-input", "aria-label": words.name, placeholder: words.namePlaceholder, value: name, autoComplete: "off", onChange: (event) => setName(event.target.value) }), _jsx("input", { className: "sc-input", type: "password", "aria-label": words.value, placeholder: words.value, value: value, autoComplete: "new-password", onChange: (event) => setValue(event.target.value) }), _jsx(Button, { type: "submit", disabled: busy || name.trim().length === 0 || value.length === 0, children: words.seed })] }), _jsx("p", { className: "sc-field-hint", children: words.intro })] }));
1273
1403
  }
1274
1404
  //# sourceMappingURL=agent-page.js.map