@celljs/ta-web 4.11.0 → 4.13.0

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 (281) hide show
  1. package/README.en.md +1 -1
  2. package/README.md +1 -1
  3. package/esm/browser/assistant/assistant-extension.js +14 -0
  4. package/esm/browser/assistant/assistant-initiative.d.ts +27 -0
  5. package/esm/browser/assistant/assistant-initiative.js +76 -0
  6. package/esm/browser/assistant/assistant-task-source.d.ts +7 -0
  7. package/esm/browser/assistant/assistant-task-source.js +12 -2
  8. package/esm/browser/assistant/assistant-view.js +10 -6
  9. package/esm/browser/assistant/assistant.d.ts +5 -0
  10. package/esm/browser/assistant/assistant.js +25 -6
  11. package/esm/browser/chat/chat-view.js +6 -5
  12. package/esm/browser/components/app-nav.d.ts +3 -1
  13. package/esm/browser/components/app-nav.js +5 -2
  14. package/esm/browser/components/app-view.js +26 -13
  15. package/esm/browser/components/asks-badge.d.ts +5 -0
  16. package/esm/browser/components/asks-badge.js +8 -0
  17. package/esm/browser/components/chat-asks.d.ts +46 -0
  18. package/esm/browser/components/chat-asks.js +101 -0
  19. package/esm/browser/components/chat-list.d.ts +7 -1
  20. package/esm/browser/components/chat-list.js +46 -17
  21. package/esm/browser/components/composer-addon-util.d.ts +11 -0
  22. package/esm/browser/components/composer-addon-util.js +40 -0
  23. package/esm/browser/components/composer-addons.d.ts +1 -7
  24. package/esm/browser/components/composer-addons.js +1 -27
  25. package/esm/browser/components/composer-box.d.ts +1 -0
  26. package/esm/browser/components/composer-box.js +50 -28
  27. package/esm/browser/components/composer.d.ts +10 -1
  28. package/esm/browser/components/composer.js +61 -22
  29. package/esm/browser/components/connection-bar.js +31 -12
  30. package/esm/browser/components/conversation-scroll-hooks.d.ts +16 -0
  31. package/esm/browser/components/conversation-scroll-hooks.js +98 -0
  32. package/esm/browser/components/conversation-scroll-util.d.ts +35 -0
  33. package/esm/browser/components/conversation-scroll-util.js +74 -0
  34. package/esm/browser/components/conversation-scroll.d.ts +57 -33
  35. package/esm/browser/components/conversation-scroll.js +188 -123
  36. package/esm/browser/components/discover-view.js +5 -1
  37. package/esm/browser/components/earlier-messages.d.ts +10 -3
  38. package/esm/browser/components/earlier-messages.js +14 -8
  39. package/esm/browser/components/face.d.ts +24 -0
  40. package/esm/browser/components/face.js +42 -0
  41. package/esm/browser/components/folder-picker.d.ts +2 -0
  42. package/esm/browser/components/folder-picker.js +7 -0
  43. package/esm/browser/components/host-view.d.ts +1 -1
  44. package/esm/browser/components/markdown.js +4 -2
  45. package/esm/browser/components/media.js +25 -11
  46. package/esm/browser/components/mermaid-view.js +45 -3
  47. package/esm/browser/components/message-actions.js +1 -0
  48. package/esm/browser/components/message-footer.d.ts +4 -0
  49. package/esm/browser/components/message-footer.js +8 -1
  50. package/esm/browser/components/message-list.d.ts +15 -1
  51. package/esm/browser/components/message-list.js +204 -41
  52. package/esm/browser/components/phone-shell.d.ts +7 -2
  53. package/esm/browser/components/phone-shell.js +9 -3
  54. package/esm/browser/components/relay-services.d.ts +24 -0
  55. package/esm/browser/components/relay-services.js +249 -0
  56. package/esm/browser/components/relay-view.js +17 -1
  57. package/esm/browser/components/remote-hosts.js +1 -1
  58. package/esm/browser/components/session-view.d.ts +3 -1
  59. package/esm/browser/components/session-view.js +23 -7
  60. package/esm/browser/components/settings-controls.js +3 -3
  61. package/esm/browser/components/settings-parts.js +13 -1
  62. package/esm/browser/components/stop-times.d.ts +47 -0
  63. package/esm/browser/components/stop-times.js +81 -0
  64. package/esm/browser/components/ta-avatar.js +6 -0
  65. package/esm/browser/components/tool-result.d.ts +13 -0
  66. package/esm/browser/components/tool-result.js +138 -0
  67. package/esm/browser/components/tool-view.js +5 -15
  68. package/esm/browser/components/use-stop-times.d.ts +3 -0
  69. package/esm/browser/components/use-stop-times.js +17 -0
  70. package/esm/browser/components/web-composer.js +2 -1
  71. package/esm/browser/device/photo-picker.d.ts +14 -0
  72. package/esm/browser/device/photo-picker.js +48 -0
  73. package/esm/browser/device/row-swipe.d.ts +2 -0
  74. package/esm/browser/device/row-swipe.js +8 -2
  75. package/esm/browser/device/sheet-swipe.d.ts +1 -1
  76. package/esm/browser/device/sheet-swipe.js +17 -3
  77. package/esm/browser/extension/extension-view.d.ts +3 -1
  78. package/esm/browser/extension/extension-view.js +7 -0
  79. package/esm/browser/extension/icons.js +10 -1
  80. package/esm/browser/extension/web-api-components.d.ts +21 -3
  81. package/esm/browser/extension/web-api-contributions.d.ts +128 -0
  82. package/esm/browser/extension/web-extension-api.d.ts +45 -48
  83. package/esm/browser/extension/web-extension-context.d.ts +6 -1
  84. package/esm/browser/extension/web-extension-context.js +72 -7
  85. package/esm/browser/extension/web-extension-protocol.d.ts +18 -2
  86. package/esm/browser/extension/web-extension-protocol.js +2 -0
  87. package/esm/browser/extension/web-extension-run.d.ts +3 -2
  88. package/esm/browser/extension/web-extension-run.js +3 -0
  89. package/esm/browser/extension/web-extensions.d.ts +2 -8
  90. package/esm/browser/extension/web-extensions.js +12 -35
  91. package/esm/browser/extension/web-page-list.d.ts +25 -0
  92. package/esm/browser/extension/web-page-list.js +35 -0
  93. package/esm/browser/extension/web-session-notices.d.ts +6 -1
  94. package/esm/browser/extension/web-session-notices.js +30 -4
  95. package/esm/browser/extension/web-sharing.d.ts +5 -2
  96. package/esm/browser/extension/web-sharing.js +10 -1
  97. package/esm/browser/i18n/locales.d.ts +77 -1
  98. package/esm/browser/i18n/messages.d.ts +76 -0
  99. package/esm/browser/i18n/messages.js +154 -2
  100. package/esm/browser/links/links-protocol.d.ts +2 -0
  101. package/esm/browser/links/links.d.ts +7 -2
  102. package/esm/browser/links/links.js +16 -9
  103. package/esm/browser/markdown/code-renderers.d.ts +4 -0
  104. package/esm/browser/markdown/code-renderers.js +4 -0
  105. package/esm/browser/markdown/lazy.d.ts +8 -0
  106. package/esm/browser/markdown/lazy.js +35 -0
  107. package/esm/browser/markdown/mermaid.d.ts +15 -3
  108. package/esm/browser/markdown/mermaid.js +45 -6
  109. package/esm/browser/notices/notices-protocol.d.ts +5 -0
  110. package/esm/browser/notices/notices.d.ts +19 -0
  111. package/esm/browser/notices/notices.js +85 -2
  112. package/esm/browser/notices/session-notices.d.ts +5 -2
  113. package/esm/browser/notices/session-notices.js +10 -1
  114. package/esm/browser/style/base.d.ts +1 -1
  115. package/esm/browser/style/base.js +2 -1
  116. package/esm/browser/style/conversation.d.ts +1 -1
  117. package/esm/browser/style/conversation.js +53 -0
  118. package/esm/browser/style/device.js +3 -0
  119. package/esm/browser/style/layout.d.ts +1 -1
  120. package/esm/browser/style/layout.js +27 -9
  121. package/esm/browser/style/pages.d.ts +1 -1
  122. package/esm/browser/style/pages.js +5 -0
  123. package/esm/browser/style/phone.d.ts +1 -1
  124. package/esm/browser/style/phone.js +2 -0
  125. package/esm/browser/style/shell.d.ts +1 -1
  126. package/esm/browser/style/shell.js +16 -3
  127. package/esm/browser/style/surfaces.d.ts +1 -1
  128. package/esm/browser/style/surfaces.js +19 -0
  129. package/esm/browser/util/desktop.d.ts +18 -1
  130. package/esm/browser/util/desktop.js +13 -0
  131. package/esm/browser/util/frame.d.ts +2 -0
  132. package/esm/browser/util/frame.js +2 -0
  133. package/esm/browser/util/process.d.ts +69 -2
  134. package/esm/browser/util/process.js +163 -8
  135. package/esm/browser/util/progress.d.ts +6 -1
  136. package/esm/browser/util/progress.js +11 -2
  137. package/esm/browser/util/scroll-rest.d.ts +10 -0
  138. package/esm/browser/util/scroll-rest.js +44 -0
  139. package/esm/browser/util/tool-result.d.ts +32 -0
  140. package/esm/browser/util/tool-result.js +85 -0
  141. package/esm/browser/util/tool.js +7 -0
  142. package/lib/browser/assistant/assistant-extension.js +14 -0
  143. package/lib/browser/assistant/assistant-initiative.d.ts +28 -0
  144. package/lib/browser/assistant/assistant-initiative.js +80 -0
  145. package/lib/browser/assistant/assistant-task-source.d.ts +7 -0
  146. package/lib/browser/assistant/assistant-task-source.js +12 -2
  147. package/lib/browser/assistant/assistant-view.js +8 -4
  148. package/lib/browser/assistant/assistant.d.ts +5 -0
  149. package/lib/browser/assistant/assistant.js +24 -5
  150. package/lib/browser/chat/chat-view.js +6 -5
  151. package/lib/browser/components/app-nav.d.ts +3 -1
  152. package/lib/browser/components/app-nav.js +5 -2
  153. package/lib/browser/components/app-view.js +25 -12
  154. package/lib/browser/components/asks-badge.d.ts +6 -0
  155. package/lib/browser/components/asks-badge.js +44 -0
  156. package/lib/browser/components/chat-asks.d.ts +47 -0
  157. package/lib/browser/components/chat-asks.js +104 -0
  158. package/lib/browser/components/chat-list.d.ts +7 -1
  159. package/lib/browser/components/chat-list.js +46 -17
  160. package/lib/browser/components/composer-addon-util.d.ts +12 -0
  161. package/lib/browser/components/composer-addon-util.js +76 -0
  162. package/lib/browser/components/composer-addons.d.ts +1 -7
  163. package/lib/browser/components/composer-addons.js +2 -29
  164. package/lib/browser/components/composer-box.d.ts +1 -0
  165. package/lib/browser/components/composer-box.js +48 -26
  166. package/lib/browser/components/composer.d.ts +10 -1
  167. package/lib/browser/components/composer.js +61 -21
  168. package/lib/browser/components/connection-bar.js +30 -11
  169. package/lib/browser/components/conversation-scroll-hooks.d.ts +17 -0
  170. package/lib/browser/components/conversation-scroll-hooks.js +135 -0
  171. package/lib/browser/components/conversation-scroll-util.d.ts +36 -0
  172. package/lib/browser/components/conversation-scroll-util.js +78 -0
  173. package/lib/browser/components/conversation-scroll.d.ts +57 -33
  174. package/lib/browser/components/conversation-scroll.js +189 -158
  175. package/lib/browser/components/discover-view.js +5 -1
  176. package/lib/browser/components/earlier-messages.d.ts +10 -3
  177. package/lib/browser/components/earlier-messages.js +16 -9
  178. package/lib/browser/components/face.d.ts +25 -0
  179. package/lib/browser/components/face.js +79 -0
  180. package/lib/browser/components/folder-picker.d.ts +2 -0
  181. package/lib/browser/components/folder-picker.js +7 -0
  182. package/lib/browser/components/host-view.d.ts +1 -1
  183. package/lib/browser/components/markdown.js +3 -1
  184. package/lib/browser/components/media.js +24 -10
  185. package/lib/browser/components/mermaid-view.js +45 -3
  186. package/lib/browser/components/message-actions.js +1 -0
  187. package/lib/browser/components/message-footer.d.ts +4 -0
  188. package/lib/browser/components/message-footer.js +8 -0
  189. package/lib/browser/components/message-list.d.ts +15 -1
  190. package/lib/browser/components/message-list.js +200 -35
  191. package/lib/browser/components/phone-shell.d.ts +7 -2
  192. package/lib/browser/components/phone-shell.js +9 -3
  193. package/lib/browser/components/relay-services.d.ts +25 -0
  194. package/lib/browser/components/relay-services.js +286 -0
  195. package/lib/browser/components/relay-view.js +17 -1
  196. package/lib/browser/components/remote-hosts.js +1 -1
  197. package/lib/browser/components/session-view.d.ts +3 -1
  198. package/lib/browser/components/session-view.js +23 -7
  199. package/lib/browser/components/settings-controls.js +3 -3
  200. package/lib/browser/components/settings-parts.js +13 -1
  201. package/lib/browser/components/stop-times.d.ts +48 -0
  202. package/lib/browser/components/stop-times.js +85 -0
  203. package/lib/browser/components/ta-avatar.js +6 -0
  204. package/lib/browser/components/tool-result.d.ts +14 -0
  205. package/lib/browser/components/tool-result.js +175 -0
  206. package/lib/browser/components/tool-view.js +10 -20
  207. package/lib/browser/components/use-stop-times.d.ts +4 -0
  208. package/lib/browser/components/use-stop-times.js +53 -0
  209. package/lib/browser/components/web-composer.js +2 -1
  210. package/lib/browser/device/photo-picker.d.ts +15 -0
  211. package/lib/browser/device/photo-picker.js +51 -0
  212. package/lib/browser/device/row-swipe.d.ts +2 -0
  213. package/lib/browser/device/row-swipe.js +8 -2
  214. package/lib/browser/device/sheet-swipe.d.ts +1 -1
  215. package/lib/browser/device/sheet-swipe.js +17 -3
  216. package/lib/browser/extension/extension-view.d.ts +3 -1
  217. package/lib/browser/extension/extension-view.js +8 -1
  218. package/lib/browser/extension/icons.js +9 -0
  219. package/lib/browser/extension/web-api-components.d.ts +21 -3
  220. package/lib/browser/extension/web-api-contributions.d.ts +128 -0
  221. package/lib/browser/extension/web-extension-api.d.ts +45 -48
  222. package/lib/browser/extension/web-extension-context.d.ts +6 -1
  223. package/lib/browser/extension/web-extension-context.js +73 -8
  224. package/lib/browser/extension/web-extension-protocol.d.ts +18 -2
  225. package/lib/browser/extension/web-extension-protocol.js +2 -0
  226. package/lib/browser/extension/web-extension-run.d.ts +3 -2
  227. package/lib/browser/extension/web-extension-run.js +3 -0
  228. package/lib/browser/extension/web-extensions.d.ts +2 -8
  229. package/lib/browser/extension/web-extensions.js +12 -35
  230. package/lib/browser/extension/web-page-list.d.ts +26 -0
  231. package/lib/browser/extension/web-page-list.js +39 -0
  232. package/lib/browser/extension/web-session-notices.d.ts +6 -1
  233. package/lib/browser/extension/web-session-notices.js +30 -4
  234. package/lib/browser/extension/web-sharing.d.ts +5 -2
  235. package/lib/browser/extension/web-sharing.js +10 -1
  236. package/lib/browser/i18n/locales.d.ts +77 -1
  237. package/lib/browser/i18n/messages.d.ts +76 -0
  238. package/lib/browser/i18n/messages.js +154 -2
  239. package/lib/browser/links/links-protocol.d.ts +2 -0
  240. package/lib/browser/links/links.d.ts +7 -2
  241. package/lib/browser/links/links.js +16 -9
  242. package/lib/browser/markdown/code-renderers.d.ts +4 -0
  243. package/lib/browser/markdown/code-renderers.js +5 -1
  244. package/lib/browser/markdown/lazy.d.ts +8 -0
  245. package/lib/browser/markdown/lazy.js +37 -1
  246. package/lib/browser/markdown/mermaid.d.ts +15 -3
  247. package/lib/browser/markdown/mermaid.js +44 -5
  248. package/lib/browser/notices/notices-protocol.d.ts +5 -0
  249. package/lib/browser/notices/notices.d.ts +19 -0
  250. package/lib/browser/notices/notices.js +84 -1
  251. package/lib/browser/notices/session-notices.d.ts +5 -2
  252. package/lib/browser/notices/session-notices.js +10 -1
  253. package/lib/browser/style/base.d.ts +1 -1
  254. package/lib/browser/style/base.js +2 -1
  255. package/lib/browser/style/conversation.d.ts +1 -1
  256. package/lib/browser/style/conversation.js +53 -0
  257. package/lib/browser/style/device.js +3 -0
  258. package/lib/browser/style/layout.d.ts +1 -1
  259. package/lib/browser/style/layout.js +27 -9
  260. package/lib/browser/style/pages.d.ts +1 -1
  261. package/lib/browser/style/pages.js +5 -0
  262. package/lib/browser/style/phone.d.ts +1 -1
  263. package/lib/browser/style/phone.js +2 -0
  264. package/lib/browser/style/shell.d.ts +1 -1
  265. package/lib/browser/style/shell.js +16 -3
  266. package/lib/browser/style/surfaces.d.ts +1 -1
  267. package/lib/browser/style/surfaces.js +19 -0
  268. package/lib/browser/util/desktop.d.ts +18 -1
  269. package/lib/browser/util/desktop.js +13 -0
  270. package/lib/browser/util/frame.d.ts +2 -0
  271. package/lib/browser/util/frame.js +2 -0
  272. package/lib/browser/util/process.d.ts +69 -2
  273. package/lib/browser/util/process.js +165 -9
  274. package/lib/browser/util/progress.d.ts +6 -1
  275. package/lib/browser/util/progress.js +11 -2
  276. package/lib/browser/util/scroll-rest.d.ts +11 -0
  277. package/lib/browser/util/scroll-rest.js +47 -0
  278. package/lib/browser/util/tool-result.d.ts +33 -0
  279. package/lib/browser/util/tool-result.js +88 -0
  280. package/lib/browser/util/tool.js +7 -0
  281. package/package.json +7 -7
@@ -4,6 +4,8 @@ export interface FrameScheduler {
4
4
  cancel(handle: number): void;
5
5
  }
6
6
  export declare namespace FrameUtil {
7
+ /** requestAnimationFrame, or a timer of one frame where there is none. */
8
+ const animation: FrameScheduler;
7
9
  /**
8
10
  * The listener, called at most once a frame however often the returned function is: a store that
9
11
  * changes many times between two frames costs one render. `cancel` drops a call not made yet.
@@ -4,6 +4,8 @@ const ANIMATION_FRAME = typeof requestAnimationFrame === 'function'
4
4
  : { request: callback => setTimeout(callback, 16), cancel: handle => clearTimeout(handle) };
5
5
  export var FrameUtil;
6
6
  (function (FrameUtil) {
7
+ /** requestAnimationFrame, or a timer of one frame where there is none. */
8
+ FrameUtil.animation = ANIMATION_FRAME;
7
9
  /**
8
10
  * The listener, called at most once a frame however often the returned function is: a store that
9
11
  * changes many times between two frames costs one render. `cancel` drops a call not made yet.
@@ -20,12 +20,31 @@ export type ProcessStep = {
20
20
  kind: 'tool';
21
21
  key: string;
22
22
  call: ContentBlock;
23
+ }
24
+ /** A request that failed on the way, which the work went on after (pi retried it, or the user said to go on). */
25
+ | {
26
+ kind: 'error';
27
+ key: string;
28
+ text: string;
29
+ }
30
+ /** What the user said while it worked, which pi gave it after the results of its tools (steering): it went on with it. */
31
+ | {
32
+ kind: 'said';
33
+ key: string;
34
+ message: SessionMessage;
23
35
  };
36
+ /**
37
+ * How a turn that is over ended, when not with a reply: an error, stopped by the user, cut off in the middle of
38
+ * its work (the service stopped, the agent ended its turn with calls not done), or without a word after its work.
39
+ */
40
+ export type TurnEnding = 'error' | 'aborted' | 'interrupted' | 'silent';
24
41
  /** A message shown as it is: from the user, a `!command`, a message of an extension, a summary. */
25
42
  export interface MessageItem {
26
43
  kind: 'message';
27
44
  key: string;
28
45
  message: SessionMessage;
46
+ /** A message of the user written while the agent was at its reply: it waited for the reply to end (a follow-up). */
47
+ queued?: boolean;
29
48
  }
30
49
  /**
31
50
  * The assistant and tool result messages in a row: the work (thinking, tool calls, what ta said on
@@ -37,7 +56,7 @@ export interface TurnItem {
37
56
  /** The messages it is made of; the same objects while they do not change. */
38
57
  messages: SessionMessage[];
39
58
  steps: ProcessStep[];
40
- /** The text at the end, after the last tool call. */
59
+ /** The text at the end, after the last tool call; while active and after steps, it is still among them. */
41
60
  reply: string[];
42
61
  /** The last assistant message: its stop reason and error. */
43
62
  last?: SessionMessage;
@@ -60,9 +79,31 @@ export declare namespace ProcessUtil {
60
79
  * fills, not another put in its place. `offset`: where `messages` start in the conversation, so that
61
80
  * the keys stay as earlier messages come in front. A message not shown (see `hidden`) in the middle of
62
81
  * the work stays in its turn: an external agent that goes on on its own, with the files it changed
63
- * noted between, reads as one turn, not as a turn for each time it went on.
82
+ * noted between, reads as one turn, not as a turn for each time it went on. So does a message of the user it was
83
+ * given on the way (`steered`): a step of the turn, not the start of another.
64
84
  */
65
85
  function items(messages: SessionMessage[], working: boolean, offset?: number, renderers?: Readonly<Record<string, unknown>>): ThreadItem[];
86
+ /**
87
+ * The message at `index`, of the user, steered a turn: it came after the result of a tool and was written before
88
+ * it, while the agent worked; pi gave it to the agent with the results, and the work went on. One after another
89
+ * that did (written at once) did too. A message of the user that steered is a step of its turn, not an ask.
90
+ */
91
+ function steered(messages: readonly SessionMessage[], index: number): boolean;
92
+ /**
93
+ * Words on the way with a fenced block a web extension draws (WebExtensionAPI.registerCodeRenderer,
94
+ * `renderers` by language in lower case): a card for the user, as a choice to make, stays in sight when
95
+ * the steps fold.
96
+ */
97
+ function pinned(step: ProcessStep, renderers: Readonly<Record<string, unknown>>): step is Extract<ProcessStep, {
98
+ kind: 'text';
99
+ }>;
100
+ /** How `item` ended, when it is over and did not end with a reply. */
101
+ function ending(item: TurnItem): TurnEnding | undefined;
102
+ /**
103
+ * The summary of a turn that only compacted the context of an external agent (`/compact`): over, no tool
104
+ * called, no reply, its summary last; else undefined. It shows as pi's own compaction does, not as a turn.
105
+ */
106
+ function compaction(item: TurnItem): string | undefined;
66
107
  /** The tool calls: what "N steps" counts. */
67
108
  function tools(steps: ProcessStep[]): ContentBlock[];
68
109
  /** The steps shown: all of them, or while it works the latest few when more than two would fold. */
@@ -88,6 +129,11 @@ export declare namespace ProcessUtil {
88
129
  function shown(item: ThreadItem, renderers: Readonly<Record<string, unknown>>): boolean;
89
130
  /** A custom message the page draws nothing for: `display` false and no renderer of a web extension for its type. */
90
131
  function hidden(message: SessionMessage, renderers: Readonly<Record<string, unknown>>): boolean;
132
+ /**
133
+ * What the user said next after each turn (`said` reads a message of theirs), undefined for one they did not answer
134
+ * yet and for every other item: a card of the turn that asked them to pick knows it was answered, typed or tapped.
135
+ */
136
+ function answers(items: readonly ThreadItem[], said: (message: SessionMessage) => string): (string | undefined)[];
91
137
  /**
92
138
  * The time to show above each item, as WeChat does between messages: above the first item with a time,
93
139
  * and above one that began `TIME_BREAK_MS` or more after the one shown before it; else undefined. An
@@ -105,3 +151,24 @@ export declare namespace ProcessUtil {
105
151
  /** The two items show the same: their messages are the same objects, and so is whether it works. */
106
152
  function same(a: ThreadItem, b: ThreadItem): boolean;
107
153
  }
154
+ /**
155
+ * Which rows of a conversation came in after it was drawn (they come in with a motion): those after the row that was
156
+ * last when it was drawn, by key. Rows put in front (earlier messages, more of the row window) move the indexes of all
157
+ * rows, not which are new; more than MAX at the end at once, or the row they count from gone (a rewind), start again
158
+ * from the end.
159
+ */
160
+ export declare class FreshRows {
161
+ /** More rows than this at the end at once: the conversation loaded again, not messages that came in. */
162
+ static readonly MAX = 2;
163
+ private still;
164
+ private last;
165
+ constructor(items: readonly {
166
+ key: string;
167
+ }[]);
168
+ /** From which index `items` (as drawn now) came in after the list was drawn. */
169
+ from(items: readonly {
170
+ key: string;
171
+ }[]): number;
172
+ /** Searched from the end, where new rows are. */
173
+ private static lastIndexOf;
174
+ }
@@ -17,7 +17,8 @@ export var ProcessUtil;
17
17
  * fills, not another put in its place. `offset`: where `messages` start in the conversation, so that
18
18
  * the keys stay as earlier messages come in front. A message not shown (see `hidden`) in the middle of
19
19
  * the work stays in its turn: an external agent that goes on on its own, with the files it changed
20
- * noted between, reads as one turn, not as a turn for each time it went on.
20
+ * noted between, reads as one turn, not as a turn for each time it went on. So does a message of the user it was
21
+ * given on the way (`steered`): a step of the turn, not the start of another.
21
22
  */
22
23
  function items(messages, working, offset = 0, renderers = {}) {
23
24
  var _a;
@@ -26,12 +27,17 @@ export var ProcessUtil;
26
27
  while (index < messages.length) {
27
28
  const role = messages[index].role;
28
29
  if (!TURN_ROLES.has(role)) {
29
- items.push({ kind: 'message', key: `m${offset + index}`, message: messages[index] });
30
+ const item = { kind: 'message', key: `m${offset + index}`, message: messages[index] };
31
+ if (index > 0 && writtenBefore(messages[index], messages[index - 1])) {
32
+ item.queued = true;
33
+ }
34
+ items.push(item);
30
35
  index++;
31
36
  continue;
32
37
  }
33
38
  const start = index;
34
- while (index < messages.length && (TURN_ROLES.has(messages[index].role) || hidden(messages[index], renderers))) {
39
+ while (index < messages.length &&
40
+ (TURN_ROLES.has(messages[index].role) || hidden(messages[index], renderers) || steered(messages, index))) {
35
41
  index++;
36
42
  }
37
43
  items.push(turn(messages.slice(start, index), offset + start, working && index === messages.length));
@@ -42,14 +48,55 @@ export var ProcessUtil;
42
48
  return items;
43
49
  }
44
50
  ProcessUtil.items = items;
51
+ /**
52
+ * The message at `index`, of the user, steered a turn: it came after the result of a tool and was written before
53
+ * it, while the agent worked; pi gave it to the agent with the results, and the work went on. One after another
54
+ * that did (written at once) did too. A message of the user that steered is a step of its turn, not an ask.
55
+ */
56
+ function steered(messages, index) {
57
+ var _a;
58
+ if (((_a = messages[index]) === null || _a === void 0 ? void 0 : _a.role) !== 'user') {
59
+ return false;
60
+ }
61
+ for (let before = index - 1; before >= 0; before--) {
62
+ const { role } = messages[before];
63
+ if (role === 'user') {
64
+ return steered(messages, before);
65
+ }
66
+ if (TURN_ROLES.has(role)) {
67
+ return role === 'toolResult' && writtenBefore(messages[index], messages[before]);
68
+ }
69
+ }
70
+ return false;
71
+ }
72
+ ProcessUtil.steered = steered;
73
+ /** `message`, of the user, was written before `previous`, of the agent, came: while the agent worked. */
74
+ function writtenBefore(message, previous) {
75
+ const { role, timestamp } = message;
76
+ const { role: was, timestamp: at } = previous;
77
+ return role === 'user' && !!was && TURN_ROLES.has(was) && typeof timestamp === 'number' && typeof at === 'number' && timestamp < at;
78
+ }
45
79
  function turn(messages, start, active) {
46
80
  const steps = [];
47
81
  let last;
82
+ let final = messages.length - 1;
83
+ while (final >= 0 && messages[final].role !== 'assistant') {
84
+ final--;
85
+ }
48
86
  messages.forEach((message, offset) => {
49
- if (message.role !== 'assistant') {
87
+ var _a;
88
+ const { role } = message;
89
+ if (role === 'user') {
90
+ steps.push({ kind: 'said', key: `${start + offset}.u`, message });
91
+ }
92
+ if (role !== 'assistant') {
50
93
  return;
51
94
  }
52
95
  last = message;
96
+ const { errorMessage } = message;
97
+ if (offset !== final && MessageUtil.stopReason(message) === 'error') {
98
+ steps.push({ kind: 'error', key: `${start + offset}.e`, text: (_a = errorMessage === null || errorMessage === void 0 ? void 0 : errorMessage.trim()) !== null && _a !== void 0 ? _a : '' });
99
+ }
53
100
  MessageUtil.blocks(message).forEach((block, position) => {
54
101
  var _a, _b;
55
102
  const key = `${start + offset}.${position}`;
@@ -69,9 +116,63 @@ export var ProcessUtil;
69
116
  while (end > 0 && steps[end - 1].kind === 'text') {
70
117
  end--;
71
118
  }
119
+ // While ta works after steps, what it says is one more step: a tool may follow it. The reply is what it ends with.
120
+ if (active && end > 0) {
121
+ end = steps.length;
122
+ }
72
123
  const reply = steps.slice(end).map(step => (step.kind === 'text' ? step.text : ''));
73
124
  return { kind: 'turn', key: `t${start}`, messages, steps: steps.slice(0, end), reply, last, active };
74
125
  }
126
+ /**
127
+ * Words on the way with a fenced block a web extension draws (WebExtensionAPI.registerCodeRenderer,
128
+ * `renderers` by language in lower case): a card for the user, as a choice to make, stays in sight when
129
+ * the steps fold.
130
+ */
131
+ function pinned(step, renderers) {
132
+ if (step.kind !== 'text') {
133
+ return false;
134
+ }
135
+ for (const [, language] of step.text.matchAll(/^ {0,3}(?:`{3,}|~{3,})[ \t]*([^\s`{]+)/gm)) {
136
+ if (renderers[language.toLowerCase()] !== undefined) {
137
+ return true;
138
+ }
139
+ }
140
+ return false;
141
+ }
142
+ ProcessUtil.pinned = pinned;
143
+ /** How `item` ended, when it is over and did not end with a reply. */
144
+ function ending(item) {
145
+ var _a;
146
+ if (item.active) {
147
+ return undefined;
148
+ }
149
+ const stopReason = MessageUtil.stopReason(item.last);
150
+ if (stopReason === 'error' || stopReason === 'aborted') {
151
+ return stopReason;
152
+ }
153
+ const roles = item.messages.map(message => message.role).filter(role => TURN_ROLES.has(role));
154
+ if (roles[roles.length - 1] === 'toolResult' || stopReason === 'toolUse') {
155
+ return 'interrupted';
156
+ }
157
+ // An external agent that compacted its context (/compact) ends its turn with the summary, not a reply.
158
+ if (((_a = item.steps[item.steps.length - 1]) === null || _a === void 0 ? void 0 : _a.kind) === 'summary') {
159
+ return undefined;
160
+ }
161
+ return item.last && !item.reply.some(text => text.trim()) ? 'silent' : undefined;
162
+ }
163
+ ProcessUtil.ending = ending;
164
+ /**
165
+ * The summary of a turn that only compacted the context of an external agent (`/compact`): over, no tool
166
+ * called, no reply, its summary last; else undefined. It shows as pi's own compaction does, not as a turn.
167
+ */
168
+ function compaction(item) {
169
+ const last = item.steps[item.steps.length - 1];
170
+ if (item.active || (last === null || last === void 0 ? void 0 : last.kind) !== 'summary' || item.reply.some(text => text.trim()) || item.steps.some(step => step.kind === 'tool')) {
171
+ return undefined;
172
+ }
173
+ return last.text;
174
+ }
175
+ ProcessUtil.compaction = compaction;
75
176
  /** The tool calls: what "N steps" counts. */
76
177
  function tools(steps) {
77
178
  return steps.flatMap(step => (step.kind === 'tool' ? [step.call] : []));
@@ -122,11 +223,11 @@ export var ProcessUtil;
122
223
  const phase = ProcessUtil.phase(item.messages);
123
224
  return phase === 'thinking' ? 'thinking' : phase === 'writing' ? 'speaking' : 'working';
124
225
  }
125
- const stopReason = MessageUtil.stopReason(item.last);
126
- if (stopReason === 'error') {
226
+ const ended = ending(item);
227
+ if (ended === 'error' || ended === 'interrupted' || ended === 'silent') {
127
228
  return 'attention';
128
229
  }
129
- return last && stopReason !== 'aborted' ? 'done' : 'idle';
230
+ return last && ended !== 'aborted' ? 'done' : 'idle';
130
231
  }
131
232
  ProcessUtil.mood = mood;
132
233
  /** When each item began: its first message; one still empty (a turn about to come), when the one before did. */
@@ -154,6 +255,25 @@ export var ProcessUtil;
154
255
  return role === 'custom' && !display && (customType === undefined || renderers[customType] === undefined);
155
256
  }
156
257
  ProcessUtil.hidden = hidden;
258
+ /**
259
+ * What the user said next after each turn (`said` reads a message of theirs), undefined for one they did not answer
260
+ * yet and for every other item: a card of the turn that asked them to pick knows it was answered, typed or tapped.
261
+ */
262
+ function answers(items, said) {
263
+ const out = new Array(items.length).fill(undefined);
264
+ let next;
265
+ for (let index = items.length - 1; index >= 0; index--) {
266
+ const item = items[index];
267
+ if (item.kind === 'message' && item.message.role === 'user') {
268
+ next = said(item.message);
269
+ }
270
+ else if (item.kind === 'turn') {
271
+ out[index] = next;
272
+ }
273
+ }
274
+ return out;
275
+ }
276
+ ProcessUtil.answers = answers;
157
277
  /**
158
278
  * The time to show above each item, as WeChat does between messages: above the first item with a time,
159
279
  * and above one that began `TIME_BREAK_MS` or more after the one shown before it; else undefined. An
@@ -201,10 +321,45 @@ export var ProcessUtil;
201
321
  /** The two items show the same: their messages are the same objects, and so is whether it works. */
202
322
  function same(a, b) {
203
323
  if (a.kind === 'message' || b.kind === 'message') {
204
- return a.kind === b.kind && a.message === b.message;
324
+ return a.kind === b.kind && a.message === b.message && a.queued === b.queued;
205
325
  }
206
326
  return a.active === b.active && a.messages.length === b.messages.length && a.messages.every((message, index) => message === b.messages[index]);
207
327
  }
208
328
  ProcessUtil.same = same;
209
329
  })(ProcessUtil || (ProcessUtil = {}));
330
+ /**
331
+ * Which rows of a conversation came in after it was drawn (they come in with a motion): those after the row that was
332
+ * last when it was drawn, by key. Rows put in front (earlier messages, more of the row window) move the indexes of all
333
+ * rows, not which are new; more than MAX at the end at once, or the row they count from gone (a rewind), start again
334
+ * from the end.
335
+ */
336
+ export class FreshRows {
337
+ constructor(items) {
338
+ var _a;
339
+ this.still = this.last = (_a = items.at(-1)) === null || _a === void 0 ? void 0 : _a.key;
340
+ }
341
+ /** From which index `items` (as drawn now) came in after the list was drawn. */
342
+ from(items) {
343
+ var _a;
344
+ const previous = FreshRows.lastIndexOf(items, this.last);
345
+ this.last = (_a = items.at(-1)) === null || _a === void 0 ? void 0 : _a.key;
346
+ let from = FreshRows.lastIndexOf(items, this.still);
347
+ if (previous < 0 || from < 0 || items.length - 1 - previous > FreshRows.MAX) {
348
+ this.still = this.last;
349
+ from = items.length - 1;
350
+ }
351
+ return from + 1;
352
+ }
353
+ /** Searched from the end, where new rows are. */
354
+ static lastIndexOf(items, key) {
355
+ for (let index = items.length - 1; index >= 0; index--) {
356
+ if (items[index].key === key) {
357
+ return index;
358
+ }
359
+ }
360
+ return -1;
361
+ }
362
+ }
363
+ /** More rows than this at the end at once: the conversation loaded again, not messages that came in. */
364
+ FreshRows.MAX = 2;
210
365
  //# sourceMappingURL=process.js.map
@@ -24,12 +24,15 @@ export type Phase = {
24
24
  kind: 'attention';
25
25
  } | {
26
26
  kind: 'compacting';
27
- } | {
27
+ }
28
+ /** `error`: what the provider said, for a reason without a word of its own. */
29
+ | {
28
30
  kind: 'retrying';
29
31
  attempt: number;
30
32
  maxAttempts: number;
31
33
  seconds: number;
32
34
  reason: RetryReason;
35
+ error?: string;
33
36
  };
34
37
  /** Why pi retries, read from the error of the provider: what the loading line says before its countdown. */
35
38
  export type RetryReason = 'rateLimit' | 'overloaded' | 'network' | 'error';
@@ -50,6 +53,8 @@ export declare namespace ProgressUtil {
50
53
  }): string;
51
54
  /** What ta does now, the most pressing first: a question for the user, then pi's own work, then the model's. */
52
55
  function phase(state: SessionState, renderers?: readonly WebToolRendererResolver[]): Phase;
56
+ /** The first line of an error, short enough for the loading line. */
57
+ function brief(error: string | undefined, length?: number): string;
53
58
  /** Why a request failed, as the provider said it: a rate limit, a model too busy, the network, or another error. */
54
59
  function retryReason(errorMessage: string | undefined): RetryReason;
55
60
  /** The seconds left of a wait of `delayMs` that began at `since`, rounded up: 0 once it is over. */
@@ -38,7 +38,8 @@ export var ProgressUtil;
38
38
  case 'compacting':
39
39
  return t('ta.progress.compacting');
40
40
  case 'retrying': {
41
- const reason = t(`ta.progress.retry.${phase.reason}`);
41
+ const error = phase.reason === 'error' ? ProgressUtil.brief(phase.error) : '';
42
+ const reason = error || t(`ta.progress.retry.${phase.reason}`);
42
43
  const seconds = (_b = options.secondsLeft) !== null && _b !== void 0 ? _b : phase.seconds;
43
44
  return seconds > 0
44
45
  ? t('ta.progress.retrying', { reason, seconds, attempt: phase.attempt, max: phase.maxAttempts })
@@ -58,7 +59,9 @@ export var ProgressUtil;
58
59
  }
59
60
  if (state.retry) {
60
61
  const { attempt, maxAttempts, delayMs, errorMessage } = state.retry;
61
- return { kind: 'retrying', attempt, maxAttempts, seconds: Math.max(1, Math.round(delayMs / 1000)), reason: retryReason(errorMessage) };
62
+ const reason = retryReason(errorMessage);
63
+ const seconds = Math.max(1, Math.round(delayMs / 1000));
64
+ return { kind: 'retrying', attempt, maxAttempts, seconds, reason, ...(reason === 'error' && errorMessage ? { error: errorMessage } : {}) };
62
65
  }
63
66
  const [request] = state.pendingClientTools;
64
67
  if (request) {
@@ -87,6 +90,12 @@ export var ProgressUtil;
87
90
  }
88
91
  }
89
92
  ProgressUtil.phase = phase;
93
+ /** The first line of an error, short enough for the loading line. */
94
+ function brief(error, length = 60) {
95
+ const line = (error !== null && error !== void 0 ? error : '').trim().split('\n')[0].trim();
96
+ return line.length > length ? `${line.slice(0, length - 1)}…` : line;
97
+ }
98
+ ProgressUtil.brief = brief;
90
99
  /** Why a request failed, as the provider said it: a rate limit, a model too busy, the network, or another error. */
91
100
  function retryReason(errorMessage) {
92
101
  const message = errorMessage !== null && errorMessage !== void 0 ? errorMessage : '';
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Whether the user scrolls the page, anywhere in it: what costs a frame and need not happen now (a diagram drawn,
3
+ * the avatars moving) waits for it to rest, QUIET_MS without a scroll and no finger on it, for a fling not to stutter.
4
+ */
5
+ export declare namespace ScrollRest {
6
+ /** Whether the page scrolls now (or a finger holds it). */
7
+ function moving(now?: number): boolean;
8
+ /** Once the page rests, or WAIT_MS at most. */
9
+ function wait(): Promise<void>;
10
+ }
@@ -0,0 +1,44 @@
1
+ /**
2
+ * Whether the user scrolls the page, anywhere in it: what costs a frame and need not happen now (a diagram drawn,
3
+ * the avatars moving) waits for it to rest, QUIET_MS without a scroll and no finger on it, for a fling not to stutter.
4
+ */
5
+ export var ScrollRest;
6
+ (function (ScrollRest) {
7
+ const QUIET_MS = 150;
8
+ /** At most this long: what follows a reply streaming scrolls on and on. */
9
+ const WAIT_MS = 1000;
10
+ let last = Number.NEGATIVE_INFINITY;
11
+ let touching = false;
12
+ let listening = false;
13
+ function listen() {
14
+ if (listening || typeof document === 'undefined') {
15
+ return;
16
+ }
17
+ listening = true;
18
+ const passive = { capture: true, passive: true };
19
+ document.addEventListener('scroll', () => (last = performance.now()), passive);
20
+ document.addEventListener('touchstart', () => (touching = true), passive);
21
+ const lifted = (event) => {
22
+ touching = event.touches.length > 0;
23
+ last = performance.now();
24
+ };
25
+ document.addEventListener('touchend', lifted, passive);
26
+ document.addEventListener('touchcancel', lifted, passive);
27
+ }
28
+ /** Whether the page scrolls now (or a finger holds it). */
29
+ function moving(now = performance.now()) {
30
+ listen();
31
+ return touching || now - last < QUIET_MS;
32
+ }
33
+ ScrollRest.moving = moving;
34
+ /** Once the page rests, or WAIT_MS at most. */
35
+ async function wait() {
36
+ listen();
37
+ const until = performance.now() + WAIT_MS;
38
+ for (let now = performance.now(); now < until && moving(now); now = performance.now()) {
39
+ await new Promise(resolve => setTimeout(resolve, Math.max(16, QUIET_MS - (now - last))));
40
+ }
41
+ }
42
+ ScrollRest.wait = wait;
43
+ })(ScrollRest || (ScrollRest = {}));
44
+ //# sourceMappingURL=scroll-rest.js.map
@@ -0,0 +1,32 @@
1
+ /** What an external agent's tool wrote when it returned nothing (`AgentTool` of @celljs/ta-agents). */
2
+ export declare const NO_OUTPUT = "(no output)";
3
+ /** What a script returned, the shape code mode scripts of agents answer with. */
4
+ export interface ScriptResult {
5
+ result: unknown;
6
+ stdout: string;
7
+ stderr: string;
8
+ failures: {
9
+ tool: string;
10
+ error: string;
11
+ }[];
12
+ }
13
+ /** What a command printed. */
14
+ export interface ShellResult {
15
+ stdout: string;
16
+ stderr: string;
17
+ exitCode?: number;
18
+ }
19
+ /** The output of a tool as a person reads it: JSON opened, the colors of a terminal left out. */
20
+ export declare namespace ResultUtil {
21
+ function clean(text: string): string;
22
+ /** The object or array a text holds, when the whole text is JSON of one. */
23
+ function json(text: string): object | undefined;
24
+ /** A script's answer: `{ result, stdout, stderr, toolFailures }`, the result being what it returned. */
25
+ function script(value: unknown): ScriptResult | undefined;
26
+ /** What a command printed: `{ stdout, stderr, exitCode }`. */
27
+ function shell(value: unknown): ShellResult | undefined;
28
+ /** Whether a value shows in the line of its key: a number, a word, a short line. */
29
+ function inline(value: unknown): boolean;
30
+ /** How a value that shows in a line reads. */
31
+ function atom(value: unknown): string;
32
+ }
@@ -0,0 +1,85 @@
1
+ /** What an external agent's tool wrote when it returned nothing (`AgentTool` of @celljs/ta-agents). */
2
+ export const NO_OUTPUT = '(no output)';
3
+ // biome-ignore lint/suspicious/noControlCharactersInRegex: the escape that starts a color of a terminal
4
+ const ANSI = /\u001b\[[0-9;?]*[ -/]*[@-~]/g;
5
+ const SCRIPT_KEYS = new Set(['result', 'stdout', 'stderr', 'toolFailures', 'toolFailureNotice']);
6
+ const SHELL_KEYS = new Set(['stdout', 'stderr', 'exitCode', 'signal', 'interrupted', 'denied', 'sandboxHint']);
7
+ /** The longest string shown in a line beside its key. */
8
+ const INLINE_CHARS = 72;
9
+ function str(value) {
10
+ return typeof value === 'string' ? value : '';
11
+ }
12
+ function record(value) {
13
+ return value && typeof value === 'object' && !Array.isArray(value) ? value : undefined;
14
+ }
15
+ /** The output of a tool as a person reads it: JSON opened, the colors of a terminal left out. */
16
+ export var ResultUtil;
17
+ (function (ResultUtil) {
18
+ function clean(text) {
19
+ return text.replace(ANSI, '').replace(/\n+$/, '');
20
+ }
21
+ ResultUtil.clean = clean;
22
+ /** The object or array a text holds, when the whole text is JSON of one. */
23
+ function json(text) {
24
+ const trimmed = text.trim();
25
+ if (!/^[[{]/.test(trimmed)) {
26
+ return undefined;
27
+ }
28
+ try {
29
+ const value = JSON.parse(trimmed);
30
+ return value && typeof value === 'object' ? value : undefined;
31
+ }
32
+ catch (_a) {
33
+ return undefined;
34
+ }
35
+ }
36
+ ResultUtil.json = json;
37
+ /** A script's answer: `{ result, stdout, stderr, toolFailures }`, the result being what it returned. */
38
+ function script(value) {
39
+ var _a;
40
+ const object = record(value);
41
+ if (!object || !('result' in object) || !Object.keys(object).every(key => SCRIPT_KEYS.has(key))) {
42
+ return undefined;
43
+ }
44
+ const calls = (_a = record(object.toolFailures)) === null || _a === void 0 ? void 0 : _a.calls;
45
+ const failures = (Array.isArray(calls) ? calls : []).map(call => { var _a, _b; return ({
46
+ tool: str((_a = record(call)) === null || _a === void 0 ? void 0 : _a.tool),
47
+ error: clean(str((_b = record(call)) === null || _b === void 0 ? void 0 : _b.error)),
48
+ }); });
49
+ return { result: object.result, stdout: clean(str(object.stdout)), stderr: clean(str(object.stderr)), failures };
50
+ }
51
+ ResultUtil.script = script;
52
+ /** What a command printed: `{ stdout, stderr, exitCode }`. */
53
+ function shell(value) {
54
+ const object = record(value);
55
+ if (!object || typeof object.stdout !== 'string' || !('stderr' in object || 'exitCode' in object)) {
56
+ return undefined;
57
+ }
58
+ if (!Object.keys(object).every(key => SHELL_KEYS.has(key))) {
59
+ return undefined;
60
+ }
61
+ const exitCode = typeof object.exitCode === 'number' ? object.exitCode : undefined;
62
+ return { stdout: clean(object.stdout), stderr: clean(str(object.stderr)), exitCode };
63
+ }
64
+ ResultUtil.shell = shell;
65
+ /** Whether a value shows in the line of its key: a number, a word, a short line. */
66
+ function inline(value) {
67
+ if (typeof value === 'string') {
68
+ return value.length <= INLINE_CHARS && !value.includes('\n') && !json(value);
69
+ }
70
+ return value === null || typeof value !== 'object' || (Array.isArray(value) ? value.length === 0 : Object.keys(value).length === 0);
71
+ }
72
+ ResultUtil.inline = inline;
73
+ /** How a value that shows in a line reads. */
74
+ function atom(value) {
75
+ if (Array.isArray(value)) {
76
+ return '[]';
77
+ }
78
+ if (value && typeof value === 'object') {
79
+ return '{}';
80
+ }
81
+ return typeof value === 'string' ? value || '""' : String(value);
82
+ }
83
+ ResultUtil.atom = atom;
84
+ })(ResultUtil || (ResultUtil = {}));
85
+ //# sourceMappingURL=tool-result.js.map
@@ -49,6 +49,13 @@ const AGENT_TOOL_VERBS = {
49
49
  TaskOutput: 'ta.tool.verb.getTask',
50
50
  TaskStop: 'ta.tool.verb.stopTask',
51
51
  Skill: 'ta.tool.verb.skill',
52
+ SendMessage: 'ta.tool.verb.sendMessage',
53
+ TeamDelete: 'ta.tool.verb.deleteTeam',
54
+ CronCreate: 'ta.tool.verb.scheduleTask',
55
+ CronList: 'ta.tool.verb.listScheduled',
56
+ CronDelete: 'ta.tool.verb.deleteScheduled',
57
+ Artifact: 'ta.tool.verb.publish',
58
+ ImageEdit: 'ta.tool.verb.editImage',
52
59
  };
53
60
  const TARGET_CHARS = 160;
54
61
  function str(value) {
@@ -46,6 +46,7 @@ exports.AssistantWebExtension = void 0;
46
46
  const core_1 = require("@celljs/core");
47
47
  const lucide_react_1 = require("lucide-react");
48
48
  const React = __importStar(require("react"));
49
+ const chat_asks_1 = require("../components/chat-asks");
49
50
  const dino_look_picker_1 = require("../components/dino-look-picker");
50
51
  const web_extension_protocol_1 = require("../extension/web-extension-protocol");
51
52
  const messages_1 = require("../i18n/messages");
@@ -132,6 +133,19 @@ let AssistantWebExtension = class AssistantWebExtension {
132
133
  openDouble: () => pi.ui.showView(`${assistant_view_1.ASSISTANT_NAME}/assistant`),
133
134
  menu: taskMenu,
134
135
  remove,
136
+ asking: task => {
137
+ var _a;
138
+ const info = this.workbench.state.sessions.find(each => each.sessionId === task.sessionId);
139
+ return info && ((_a = chat_asks_1.ChatAskUtil.asking(info, this.persisted.get(chat_asks_1.LET_GO_ASKS))) === null || _a === void 0 ? void 0 : _a.question);
140
+ },
141
+ watchAsking: listener => {
142
+ const stops = [this.workbench.subscribe(() => listener()), this.persisted.subscribe(() => listener())];
143
+ return () => {
144
+ for (const stop of stops) {
145
+ stop();
146
+ }
147
+ };
148
+ },
135
149
  });
136
150
  pi.registerTasks(tasks);
137
151
  const registerPage = () => pi.registerView('assistant', {