@celljs/ta-web 4.9.0 → 4.9.1

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 (127) hide show
  1. package/README.en.md +1 -1
  2. package/README.md +1 -1
  3. package/esm/browser/assistant/assistant-extension.js +13 -5
  4. package/esm/browser/assistant/assistant-task-source.d.ts +2 -0
  5. package/esm/browser/assistant/assistant-task-source.js +2 -0
  6. package/esm/browser/assistant/assistant-task-util.d.ts +6 -0
  7. package/esm/browser/assistant/assistant-task-util.js +8 -0
  8. package/esm/browser/assistant/assistant-tasks.js +3 -2
  9. package/esm/browser/assistant/assistant.d.ts +20 -0
  10. package/esm/browser/assistant/assistant.js +45 -1
  11. package/esm/browser/assistant/task-views.d.ts +40 -6
  12. package/esm/browser/assistant/task-views.js +73 -21
  13. package/esm/browser/avatar/dino-avatar.d.ts +3 -4
  14. package/esm/browser/avatar/dino-avatar.js +4 -178
  15. package/esm/browser/avatar/dino-face.d.ts +19 -0
  16. package/esm/browser/avatar/dino-face.js +142 -0
  17. package/esm/browser/avatar/dino-geometry.d.ts +11 -0
  18. package/esm/browser/avatar/dino-geometry.js +38 -0
  19. package/esm/browser/avatar/dino-kinds.d.ts +15 -0
  20. package/esm/browser/avatar/dino-kinds.js +544 -0
  21. package/esm/browser/avatar/dino-motion.js +1 -1
  22. package/esm/browser/avatar/dino-shape.d.ts +80 -0
  23. package/esm/browser/avatar/dino-shape.js +113 -0
  24. package/esm/browser/avatar/dino-species.d.ts +1 -61
  25. package/esm/browser/avatar/dino-species.js +2 -653
  26. package/esm/browser/components/access-view.js +1 -1
  27. package/esm/browser/components/account-menu.js +1 -1
  28. package/esm/browser/components/app-shell-hooks.d.ts +47 -0
  29. package/esm/browser/components/app-shell-hooks.js +165 -0
  30. package/esm/browser/components/app-view.js +6 -151
  31. package/esm/browser/components/auth-view.js +1 -1
  32. package/esm/browser/components/composer.js +17 -10
  33. package/esm/browser/components/dino.js +1 -1
  34. package/esm/browser/components/folder-picker.js +4 -1
  35. package/esm/browser/components/host-view.d.ts +1 -1
  36. package/esm/browser/components/host-view.js +1 -1
  37. package/esm/browser/components/select-bar.d.ts +9 -0
  38. package/esm/browser/components/select-bar.js +24 -0
  39. package/esm/browser/components/settings-choices.d.ts +35 -0
  40. package/esm/browser/components/settings-choices.js +117 -0
  41. package/esm/browser/components/settings-parts.d.ts +21 -0
  42. package/esm/browser/components/settings-parts.js +300 -0
  43. package/esm/browser/components/settings-view.d.ts +0 -6
  44. package/esm/browser/components/settings-view.js +4 -406
  45. package/esm/browser/components/workbench-view.js +1 -1
  46. package/esm/browser/extension/icons.js +2 -1
  47. package/esm/browser/extension/web-extension-api.d.ts +38 -1
  48. package/esm/browser/extension/web-extensions.js +6 -1
  49. package/esm/browser/extension/web-tasks.d.ts +9 -1
  50. package/esm/browser/extension/web-tasks.js +24 -0
  51. package/esm/browser/hooks.d.ts +3 -1
  52. package/esm/browser/hooks.js +8 -0
  53. package/esm/browser/i18n/locales.d.ts +6 -1
  54. package/esm/browser/i18n/messages.d.ts +5 -0
  55. package/esm/browser/i18n/messages.js +10 -0
  56. package/esm/browser/style/device.js +16 -0
  57. package/esm/browser/style/shell.d.ts +1 -1
  58. package/esm/browser/style/shell.js +1 -0
  59. package/esm/browser/style/tasks.d.ts +1 -1
  60. package/esm/browser/style/tasks.js +2 -0
  61. package/esm/browser/workbench-util.d.ts +61 -0
  62. package/esm/browser/workbench-util.js +138 -0
  63. package/esm/browser/workbench.d.ts +1 -37
  64. package/esm/browser/workbench.js +2 -136
  65. package/lib/browser/assistant/assistant-extension.js +13 -5
  66. package/lib/browser/assistant/assistant-task-source.d.ts +2 -0
  67. package/lib/browser/assistant/assistant-task-source.js +2 -0
  68. package/lib/browser/assistant/assistant-task-util.d.ts +6 -0
  69. package/lib/browser/assistant/assistant-task-util.js +8 -0
  70. package/lib/browser/assistant/assistant-tasks.js +2 -1
  71. package/lib/browser/assistant/assistant.d.ts +20 -0
  72. package/lib/browser/assistant/assistant.js +45 -1
  73. package/lib/browser/assistant/task-views.d.ts +40 -6
  74. package/lib/browser/assistant/task-views.js +74 -21
  75. package/lib/browser/avatar/dino-avatar.d.ts +3 -4
  76. package/lib/browser/avatar/dino-avatar.js +27 -202
  77. package/lib/browser/avatar/dino-face.d.ts +20 -0
  78. package/lib/browser/avatar/dino-face.js +148 -0
  79. package/lib/browser/avatar/dino-geometry.d.ts +12 -0
  80. package/lib/browser/avatar/dino-geometry.js +47 -0
  81. package/lib/browser/avatar/dino-kinds.d.ts +16 -0
  82. package/lib/browser/avatar/dino-kinds.js +547 -0
  83. package/lib/browser/avatar/dino-motion.js +2 -2
  84. package/lib/browser/avatar/dino-shape.d.ts +81 -0
  85. package/lib/browser/avatar/dino-shape.js +126 -0
  86. package/lib/browser/avatar/dino-species.d.ts +1 -61
  87. package/lib/browser/avatar/dino-species.js +34 -687
  88. package/lib/browser/components/access-view.js +2 -2
  89. package/lib/browser/components/account-menu.js +2 -2
  90. package/lib/browser/components/app-shell-hooks.d.ts +48 -0
  91. package/lib/browser/components/app-shell-hooks.js +207 -0
  92. package/lib/browser/components/app-view.js +16 -161
  93. package/lib/browser/components/auth-view.js +3 -3
  94. package/lib/browser/components/composer.js +17 -10
  95. package/lib/browser/components/dino.js +3 -3
  96. package/lib/browser/components/folder-picker.js +4 -1
  97. package/lib/browser/components/host-view.d.ts +1 -1
  98. package/lib/browser/components/host-view.js +5 -5
  99. package/lib/browser/components/select-bar.d.ts +10 -0
  100. package/lib/browser/components/select-bar.js +61 -0
  101. package/lib/browser/components/settings-choices.d.ts +36 -0
  102. package/lib/browser/components/settings-choices.js +156 -0
  103. package/lib/browser/components/settings-parts.d.ts +22 -0
  104. package/lib/browser/components/settings-parts.js +336 -0
  105. package/lib/browser/components/settings-view.d.ts +0 -6
  106. package/lib/browser/components/settings-view.js +2 -405
  107. package/lib/browser/components/workbench-view.js +3 -3
  108. package/lib/browser/extension/icons.js +1 -0
  109. package/lib/browser/extension/web-extension-api.d.ts +38 -1
  110. package/lib/browser/extension/web-extensions.js +5 -0
  111. package/lib/browser/extension/web-tasks.d.ts +9 -1
  112. package/lib/browser/extension/web-tasks.js +24 -0
  113. package/lib/browser/hooks.d.ts +3 -1
  114. package/lib/browser/hooks.js +9 -0
  115. package/lib/browser/i18n/locales.d.ts +6 -1
  116. package/lib/browser/i18n/messages.d.ts +5 -0
  117. package/lib/browser/i18n/messages.js +10 -0
  118. package/lib/browser/style/device.js +16 -0
  119. package/lib/browser/style/shell.d.ts +1 -1
  120. package/lib/browser/style/shell.js +1 -0
  121. package/lib/browser/style/tasks.d.ts +1 -1
  122. package/lib/browser/style/tasks.js +2 -0
  123. package/lib/browser/workbench-util.d.ts +62 -0
  124. package/lib/browser/workbench-util.js +144 -0
  125. package/lib/browser/workbench.d.ts +1 -37
  126. package/lib/browser/workbench.js +24 -159
  127. package/package.json +7 -7
package/README.en.md CHANGED
@@ -23,7 +23,7 @@ Initially, the interface shows only conversations. You tell Ta what you want thi
23
23
  Everything new in the interface comes from **web extensions** within packages, using the same mechanism and terminology as pi extensions:
24
24
 
25
25
  - **Packages** are pi packages. In the `pi` field of `package.json`, `extensions` are extensions for Ta (terminal and server), and `web` are extensions for this page; when not declared, modules in the `web/` directory are used. Packages can be placed in `~/.ta/agent/extensions/<name>/` or the project's `.ta/extensions/` to take effect, or installed with `ta install`.
26
- - **Web extensions** are ES modules without import statements, with a default export of a function that the page calls with `pi`; the returned function is called on unload. The `pi` interface follows pi's ExtensionAPI naming: `ui.setWidget` (default above the input box, same as pi; `placement: 'panel'` puts it in the right workbench's card tabs), `registerView` (pages in the navigation bar, or a list of the sidebar at the top of the navigation bar; `location: 'panel'` is a tool in the right workbench; `discover: true` keeps a page not used every day under Discover until the user pins it), `registerMessageRenderer` (displays custom messages sent by pi extensions with `sendMessage`), `registerTool` (tools executed by the browser in conversations opened on the page), `registerTasks` / `ui.useTasks` (work done for the user, listed by the double with its own tasks and those of other extensions; see docs/design/ta-double.md), `registerOpener` (opens links in replies: files and their lines, directories, web pages, asked in registration order, returns true if opened), `registerComposerAddon` (adds to the message box of every conversation: `actions(conversation)` is a section of its own in the + menu, entries may have `items`, a list in its place; `above` is drawn above the box; `subscribe` says the entries changed. `conversation` says which: `sessionId`, `sessionFile`, `cwd`, `kind` `double` or `chat`, `group`, `title`; the double, agents and plain conversations all have it), `ui.QrCode` (a QR code of a text, black on white in any theme), `on` (events of the current conversation), `sendUserMessage` (sends to current conversation; `/commands` execute pi extension commands), `switchSession` (displays another open session in ta serve as the current conversation; given a promise of the id, it is in front at once showing that it opens, under the title of `opening`), `callHost` (calls methods of this package's `pi.host`, via `callPackageHost`), `reloadExtensions` (after the exten... [truncated]
26
+ - **Web extensions** are ES modules without import statements, with a default export of a function that the page calls with `pi`; the returned function is called on unload. The `pi` interface follows pi's ExtensionAPI naming: `ui.setWidget` (default above the input box, same as pi; `placement: 'panel'` puts it in the right workbench's card tabs), `registerView` (pages in the navigation bar, or a list of the sidebar at the top of the navigation bar; `location: 'panel'` is a tool in the right workbench; `discover: true` keeps a page not used every day under Discover until the user pins it), `registerMessageRenderer` (displays custom messages sent by pi extensions with `sendMessage`), `registerTool` (tools executed by the browser in conversations opened on the page), `registerTasks` / `ui.useTasks` (work done for the user, listed by the double with its own tasks and those of other extensions; see docs/design/ta-double.md. A task with `remove` and `removeHint` can be swiped away in the lists, or selected with others and deleted at once; `ui.removeTasks` asks the user), `ui.SelectCheck` / `ui.SelectBar` (the round mark at the start of a row and the bar under a list while it selects several, as the lists of the page), `registerOpener` (opens links in replies: files and their lines, directories, web pages, asked in registration order, returns true if opened), `registerComposerAddon` (adds to the message box of every conversation: `actions(conversation)` is a section of its own in the + menu, entries may have `items`, a list in its place; `above` is drawn above the box; `subscribe` says the entries changed. `conversation` says which: `sessionId`, `sessionFile`, `cwd`, `kind` `double` or `chat`, `group`, `title`; the double, agents and plain conversations all have it), `ui.QrCode` (a QR code of a text, black on white in any theme), `on` (events of the current conversation), `sendUserMessage` (sends to current conversation; `/commands` execute pi extension commands), `switchSession` (displays another open session in ta serve as the current conversation; given a promise of the id, it is in front at once showing that it opens, under the title of `opening`), `callHost` (calls methods of this package's `pi.host`, via `callPackageHost`), `reloadExtensions` (after the exten... [truncated]
27
27
  - **Make packages with natural language**: the built-in extension [@celljs/ta-extensions](../ta-extensions/README.md) includes the skill `ta-package` (also available in the Ta terminal) and adds an "Extensions" page in the navigation bar (create an extension in one sentence, export or import). It documents package format, the web extension interface, and validation steps. At the end of each reply in the current conversation, the page reloads web extensions: new ones load, changed ones reload, and deleted ones unload; when tools change, the conversation reopens that part in the same session file (only for conversations opened on this page); when packages change, the session reloads pi extensions. The page checks again when redisplayed (packages might change in the terminal too).
28
28
  - **Stable**: each extension owns what it registers and removes it all on unload; if one extension fails to load or render, only that extension's area shows an error, without affecting the page or other extensions.
29
29
 
package/README.md CHANGED
@@ -23,7 +23,7 @@ Web 客户端可以装成桌面或手机上的应用:Chrome / Edge 地址栏
23
23
  界面上新增的一切都来自包里的 **Web 扩展**,和 pi 的扩展同一套机制、同一套叫法:
24
24
 
25
25
  - **包**就是 pi 的包。`package.json` 的 `pi` 里,`extensions` 是给 Ta(终端和服务端)的扩展,`web` 是给这个页面的扩展;没有声明时取 `web/` 目录下的模块。包放在 `~/.ta/agent/extensions/<名字>/`(项目的 `.ta/extensions/`)即可生效,也可以用 `ta install` 安装。
26
- - **Web 扩展**是一个不带 import 的 ES 模块,默认导出一个函数,页面用 `pi` 调用它;返回的函数在卸载时调用。`pi` 的接口照 pi 的 ExtensionAPI 命名:`ui.setWidget`(默认在输入框上方,和 pi 一样;`placement: 'panel'` 放进右侧工作台的卡片标签)、`registerView`(导航栏里的页面,或导航栏上方的一个侧栏列表;`location: 'panel'` 是右侧工作台的工具)、`registerMessageRenderer`(显示 pi 扩展用 `sendMessage` 发出的自定义消息)、`registerTool`(页面打开的对话里由浏览器执行的工具)、`registerTasks` / `ui.useTasks`(替用户做的事,由分身和其他扩展的任务一起列出,见 docs/design/ta-double.md)、`registerOpener`(打开回复里的链接:文件及其行、目录、网页,按注册顺序询问,返回 true 表示已打开)、`registerComposerAddon`(给所有对话的输入框加东西:`actions(conversation)` 是 + 菜单里自己的一组,条目可以带 `items` 二级列表;`above` 画在输入框上方;`subscribe` 通知条目变了。`conversation` 说明是哪个对话:`sessionId`、`sessionFile`、`cwd`、`kind` 为 `double` 或 `chat`、`group`、`title`;分身、智能体和普通对话都有)、`ui.QrCode`(文字的二维码,任何主题下都是白底黑码)、`on`(当前对话的事件)、`sendUserMessage`(发到当前对话;`/命令` 会执行 pi 扩展的命令)、`switchSession`(把 ta serve 里另一个打开的会话显示为当前对话;传会话 id 的 Promise 时立即切过去显示"正在打开",`opening` 给出占位的标题)、`callHost`(调用本包 `pi.host` 的方法,经 `callPackageHost`)、`reloadExtensions`(扩展自己安装、导入或移除了包之后,像回复结束时一样重新加载 Web 扩展和当前对话的 pi 扩展)、`ui.showView` / `ui.useView`(显示、查看任意扩展的视图)、`ui.Composer` / `ui.Markdown`(和对话一样的输入框与 Markdown)、`ui.Empty`(列表或视图为空时的提示:一行标题加至多一行说明,在所在区域居中;菜单、选择器和弹窗里用 `compact`;`picture` 在上方放一张插图)、`ui.Picture` / `ui.PictureCards`(和 Ta 一样的小插图:SVG 里的图形用 `ta-pic-*` 类名,跟随主题;一排可点的插图卡片,带标签和一行说明)、`ui.Dialog`(盖住整页的弹窗)、`ui.openEditor` 的 `preview`(单击打开的预览标签,标题斜体,下一个预览会替换它,双击或 `ui.pinEditor` 固定)、`ui.setEditorDirty`(标签显示未保存圆点,关闭前确认)、`ui.useActiveEditor`(工作台当前标签)、`ui.DiffEditor`(Monaco 差异编辑器,并排或内联,可编辑右侧)、`ui.confirm` 的 `confirmLabel` / `danger`、视图的 `head`(自己的顶栏)、`ui.input` / `ui.editor`(向用户要一行或多行文字,取消时为 `undefined`)、页面的 `menu`(侧栏列出该页面时悬浮显示的 … 菜单)与 `pages`(侧栏列出的页面,导航栏不再单列)、`discover`(不常用的页面默认收在"发现",用户固定后才进导航栏)、`ui.notify`(页面右下角的通知)、`ui.confirm`(继续前先确认,返回用户是否同意)、`ui.theme`、`ui.language`、`ui.supportsWebview`(能否用 `<webview>` 显示网站,Ta 桌面版里可以,其他地方用 iframe)、`ui.debugWebview`(Ta 桌面版:向这种 webview 里的网页发 Chrome DevTools Protocol 命令,只限网页本身)、`ui.desktop.browserData`(Ta 桌面版,macOS 和 Windows:用户在应用的原生对话框里同意后,把其浏览器某个个... [truncated]
26
+ - **Web 扩展**是一个不带 import 的 ES 模块,默认导出一个函数,页面用 `pi` 调用它;返回的函数在卸载时调用。`pi` 的接口照 pi 的 ExtensionAPI 命名:`ui.setWidget`(默认在输入框上方,和 pi 一样;`placement: 'panel'` 放进右侧工作台的卡片标签)、`registerView`(导航栏里的页面,或导航栏上方的一个侧栏列表;`location: 'panel'` 是右侧工作台的工具)、`registerMessageRenderer`(显示 pi 扩展用 `sendMessage` 发出的自定义消息)、`registerTool`(页面打开的对话里由浏览器执行的工具)、`registerTasks` / `ui.useTasks`(替用户做的事,由分身和其他扩展的任务一起列出,见 docs/design/ta-double.md;任务带 `remove` 和 `removeHint` 时,列表里可以左滑删除、多选后批量删除,询问统一由 `ui.removeTasks` 做)、`ui.SelectCheck` / `ui.SelectBar`(列表多选时行首的圆形勾选和列表底部的操作栏,样式与页面一致)、`registerOpener`(打开回复里的链接:文件及其行、目录、网页,按注册顺序询问,返回 true 表示已打开)、`registerComposerAddon`(给所有对话的输入框加东西:`actions(conversation)` 是 + 菜单里自己的一组,条目可以带 `items` 二级列表;`above` 画在输入框上方;`subscribe` 通知条目变了。`conversation` 说明是哪个对话:`sessionId`、`sessionFile`、`cwd`、`kind` 为 `double` 或 `chat`、`group`、`title`;分身、智能体和普通对话都有)、`ui.QrCode`(文字的二维码,任何主题下都是白底黑码)、`on`(当前对话的事件)、`sendUserMessage`(发到当前对话;`/命令` 会执行 pi 扩展的命令)、`switchSession`(把 ta serve 里另一个打开的会话显示为当前对话;传会话 id 的 Promise 时立即切过去显示"正在打开",`opening` 给出占位的标题)、`callHost`(调用本包 `pi.host` 的方法,经 `callPackageHost`)、`reloadExtensions`(扩展自己安装、导入或移除了包之后,像回复结束时一样重新加载 Web 扩展和当前对话的 pi 扩展)、`ui.showView` / `ui.useView`(显示、查看任意扩展的视图)、`ui.Composer` / `ui.Markdown`(和对话一样的输入框与 Markdown)、`ui.Empty`(列表或视图为空时的提示:一行标题加至多一行说明,在所在区域居中;菜单、选择器和弹窗里用 `compact`;`picture` 在上方放一张插图)、`ui.Picture` / `ui.PictureCards`(和 Ta 一样的小插图:SVG 里的图形用 `ta-pic-*` 类名,跟随主题;一排可点的插图卡片,带标签和一行说明)、`ui.Dialog`(盖住整页的弹窗)、`ui.openEditor` 的 `preview`(单击打开的预览标签,标题斜体,下一个预览会替换它,双击或 `ui.pinEditor` 固定)、`ui.setEditorDirty`(标签显示未保存圆点,关闭前确认)、`ui.useActiveEditor`(工作台当前标签)、`ui.DiffEditor`(Monaco 差异编辑器,并排或内联,可编辑右侧)、`ui.confirm` 的 `confirmLabel` / `danger`、视图的 `head`(自己的顶栏)、`ui.input` / `ui.editor`(向用户要一行或多行文字,取消时为 `undefined`)、页面的 `menu`(侧栏列出该页面时悬浮显示的 … 菜单)与 `pages`(侧栏列出的页面,导航栏不再单列)、`discover`(不常用的页面默认收在"发现",用户固定后才进导航栏)、`ui.notify`(页面右下角的通知)、`ui.confirm`(继续前先确认,返回用户是否同意)、`ui.theme`、`ui.language`、`ui.supportsWebview`(能否用 `<webview>` 显示网站,Ta 桌面版里可以,其他地方用 iframe)、`ui.debugWebview`(Ta 桌面版:向这种 webview 里的网页发 Chrome DevTools Protocol 命令,只限网页本身)、`ui.desktop.browserData`(Ta 桌面版,macOS 和 Windows:用户在应用的原生对话框里同意后,把其浏览器某个个... [truncated]
27
27
  - **用自然语言做包**:内置扩展 [@celljs/ta-extensions](../ta-extensions/README.md) 带技能 `ta-package`(终端里的 Ta 也有),并在导航栏加了"扩展"页(一句话做扩展、导出导入),写明了包的格式、Web 扩展接口和验证步骤。当前对话每次回复结束,页面重新读取 Web 扩展:新的加载、改过的重新加载、删掉的卸载;工具有变化时,用同一个会话文件重新打开这段对话(只限本页打开的对话),包有改动时让会话重新加载 pi 扩展。页面重新显示时也会检查一次(包也可能在终端里改)。
28
28
  - **稳定**:每个扩展注册的东西归它自己,卸载时一并撤掉;一个扩展加载失败或渲染出错,只在它自己的位置显示错误,不影响页面和其他扩展。
29
29
 
@@ -54,11 +54,10 @@ let AssistantWebExtension = class AssistantWebExtension {
54
54
  })
55
55
  .catch(fail);
56
56
  };
57
+ /** Deletes it without asking: the lists ask (ui.removeTasks), for one or for many. */
57
58
  const remove = async (task) => {
58
- if (await pi.ui.confirm(t('ta.task.removeTitle').replace('{title}', task.title), t('ta.task.removeHint'))) {
59
- await this.assistant.removeTask(task.id);
60
- pi.ui.closeEditor(editorId(task));
61
- }
59
+ await this.assistant.removeTask(task.id);
60
+ pi.ui.closeEditor(editorId(task));
62
61
  };
63
62
  /** What can be done with a task, in its … wherever it shows: stop or take over, then remove (a running one is stopped first). */
64
63
  const taskMenu = (task) => {
@@ -70,7 +69,15 @@ let AssistantWebExtension = class AssistantWebExtension {
70
69
  : []),
71
70
  ...(task.takenOver ? [] : [{ key: 'takeOver', label: t('ta.task.takeOver'), icon: Hand, run: () => takeOver(task) }]),
72
71
  ],
73
- [{ key: 'remove', label: t('ta.task.remove'), icon: Trash2, danger: true, run: () => void remove(task).catch(fail) }],
72
+ [
73
+ {
74
+ key: 'remove',
75
+ label: t('ta.task.remove'),
76
+ icon: Trash2,
77
+ danger: true,
78
+ run: () => void pi.ui.removeTasks([{ title: task.title, removeHint: t('ta.task.removeHint'), remove: () => remove(task) }]),
79
+ },
80
+ ],
74
81
  ].filter(section => section.length > 0);
75
82
  };
76
83
  const showTasks = () => pi.ui.showView(`${ASSISTANT_NAME}/${ASSISTANT_TASKS_VIEW}`);
@@ -88,6 +95,7 @@ let AssistantWebExtension = class AssistantWebExtension {
88
95
  open: openTask,
89
96
  openDouble: () => pi.ui.showView(`${ASSISTANT_NAME}/assistant`),
90
97
  menu: taskMenu,
98
+ remove,
91
99
  });
92
100
  pi.registerTasks(tasks);
93
101
  const registerPage = () => pi.registerView('assistant', {
@@ -11,6 +11,8 @@ export interface AssistantTaskActions {
11
11
  /** Shows the double, where a start waits for the user's go. */
12
12
  openDouble(): void;
13
13
  menu(task: AssistantTask): WebMenuItem[][];
14
+ /** Deletes it without asking (WebTask.remove). */
15
+ remove(task: AssistantTask): Promise<void>;
14
16
  }
15
17
  /** What of a task's session the list shows: a new task object only when it changes. */
16
18
  interface Shown {
@@ -150,6 +150,8 @@ export class AssistantTaskSource {
150
150
  origin: task.origin,
151
151
  open: () => this.actions.open(task),
152
152
  menu: () => this.actions.menu(task),
153
+ remove: () => this.actions.remove(task),
154
+ removeHint: this.actions.t('ta.task.removeHint'),
153
155
  };
154
156
  }
155
157
  }
@@ -43,6 +43,12 @@ export declare namespace AssistantTaskUtil {
43
43
  function lastWords(messages: readonly SessionMessage[]): string | undefined;
44
44
  /** What the double reads when a task ended. */
45
45
  function updateNote(task: AssistantTask): string;
46
+ /** The task a note of updateNote is about, if `text` is one. */
47
+ function noteOf(text: string): {
48
+ id: string;
49
+ title: string;
50
+ status: AssistantTask['status'];
51
+ } | undefined;
46
52
  /** What the double reads when the user hands it one of their conversations. */
47
53
  function adoptedNote(task: AssistantTask, said: string): string;
48
54
  }
@@ -3,6 +3,8 @@ import { MessageUtil } from '../util/message.js';
3
3
  export const MAX_TASKS = 50;
4
4
  /** As much of what a task said as the double reads. */
5
5
  const RESULT_CHARS = 4000;
6
+ /** The start of a note of updateNote. */
7
+ const NOTE = /^<task_update id="([^"]+)" title="([^"]*)" status="(\w+)">/;
6
8
  /**
7
9
  * What the pages of the double agree on about its tasks. Every page of the user lists them, follows those
8
10
  * that run and keeps the list on the server: no one page owns them, so a change is a newer copy of a task,
@@ -90,6 +92,12 @@ export var AssistantTaskUtil;
90
92
  return `<task_update id="${task.id}" title="${task.title}" status="${task.status}">\n${((_a = task.result) !== null && _a !== void 0 ? _a : '').slice(0, RESULT_CHARS)}\n</task_update>`;
91
93
  }
92
94
  AssistantTaskUtil.updateNote = updateNote;
95
+ /** The task a note of updateNote is about, if `text` is one. */
96
+ function noteOf(text) {
97
+ const match = NOTE.exec(text);
98
+ return match ? { id: match[1], title: match[2], status: match[3] } : undefined;
99
+ }
100
+ AssistantTaskUtil.noteOf = noteOf;
93
101
  /** What the double reads when the user hands it one of their conversations. */
94
102
  function adoptedNote(task, said) {
95
103
  return `<task_adopted id="${task.id}" title="${task.title}" status="${task.status}">\nThe user handed you one of their conversations, in ${task.cwd}: follow it as your task ${task.id}. Its last words:\n${said.slice(0, RESULT_CHARS)}\n</task_adopted>`;
@@ -6,7 +6,7 @@ import { Icon, IconButton } from '../components/icon.js';
6
6
  import { ListSkeleton } from '../components/list-skeleton.js';
7
7
  import { Markdown } from '../components/markdown.js';
8
8
  import { SessionView } from '../components/session-view.js';
9
- import { useTasks, useWorkbench } from '../hooks.js';
9
+ import { useRemoveTasks, useTasks, useWorkbench } from '../hooks.js';
10
10
  import { useT } from '../i18n/use-t.js';
11
11
  import { MessageUtil } from '../util/message.js';
12
12
  import { useAssistant } from './assistant-hooks.js';
@@ -23,8 +23,9 @@ export const ASSISTANT_TASKS_VIEW = 'tasks';
23
23
  /** Every task, the double's and those of extensions, what waits for the user first: a tool of the workbench beside the conversation. */
24
24
  export function AssistantTasks() {
25
25
  const tasks = useTasks();
26
+ const remove = useRemoveTasks();
26
27
  return (React.createElement("div", { className: "ta-assistant-tasks" },
27
- React.createElement(TaskBoardList, { tasks: tasks })));
28
+ React.createElement(TaskBoardList, { tasks: tasks, onRemove: remove })));
28
29
  }
29
30
  /** The … of a task, from the sections its extension gives: the same entries as in the lists. */
30
31
  function sectionItems(sections) {
@@ -5,6 +5,12 @@ import { TaState } from '../state/state-protocol.js';
5
5
  import { TaWorkbench } from '../workbench-protocol.js';
6
6
  import { type AssistantAsk, type AssistantState, type AssistantTask, TaAssistant } from './assistant-protocol.js';
7
7
  import { AssistantTaskBook } from './assistant-task-book.js';
8
+ /** What the double is to hear of a task that ended (finished), and when it ended. */
9
+ interface TaskNote {
10
+ text: string;
11
+ clientMessageId: string;
12
+ at: number;
13
+ }
8
14
  export declare class TaAssistantImpl implements TaAssistant {
9
15
  protected readonly workbench: TaWorkbench;
10
16
  protected readonly persisted: TaState;
@@ -23,6 +29,14 @@ export declare class TaAssistantImpl implements TaAssistant {
23
29
  protected readonly following: Map<string, () => void>;
24
30
  /** The answers the asks wait for, by ask id. */
25
31
  protected readonly answers: Map<string, (start: boolean) => void>;
32
+ /**
33
+ * The notes of tasks that ended, by task id, held while the double works and until the task stayed
34
+ * ended a moment (flushNotes): one per task, the last, so that a task that ends again and again does
35
+ * not pile notes up in the double's queue.
36
+ */
37
+ protected readonly notes: Map<string, TaskNote>;
38
+ protected noteTimer?: ReturnType<typeof setTimeout>;
39
+ protected noteSettleMs: number;
26
40
  protected unwatchSettings?: () => void;
27
41
  protected unwatchTasks?: () => void;
28
42
  protected unwatchOnline?: () => void;
@@ -120,5 +134,11 @@ export declare class TaAssistantImpl implements TaAssistant {
120
134
  * id of the message is the same in each: the time of the task's last answer, by the computer's clock).
121
135
  */
122
136
  protected finished(id: string, state: SessionState): void;
137
+ /**
138
+ * Sends the notes of the tasks that stayed ended a moment, once the double is not at work: what it
139
+ * did not hear yet waits here rather than in its queue, where a task that ended again would add one more.
140
+ */
141
+ protected flushNotes(): void;
123
142
  protected update(change: Partial<AssistantState>): void;
124
143
  }
144
+ export {};
@@ -18,6 +18,8 @@ import { ASSISTANT_NAME_STATE, AssistantStates } from './assistant-state.js';
18
18
  import { AssistantTaskBook } from './assistant-task-book.js';
19
19
  import { AssistantTaskUtil } from './assistant-task-util.js';
20
20
  const { FILE, TASKS, PROMPT, ASKING } = AssistantStates;
21
+ /** How long a task stays ended before the double hears of it: an agent that goes on by itself ends and runs again within seconds. */
22
+ const NOTE_SETTLE_MS = 5000;
21
23
  let TaAssistantImpl = class TaAssistantImpl {
22
24
  constructor() {
23
25
  this.current = { ready: false, tasks: [], asks: [] };
@@ -29,6 +31,13 @@ let TaAssistantImpl = class TaAssistantImpl {
29
31
  this.following = new Map();
30
32
  /** The answers the asks wait for, by ask id. */
31
33
  this.answers = new Map();
34
+ /**
35
+ * The notes of tasks that ended, by task id, held while the double works and until the task stayed
36
+ * ended a moment (flushNotes): one per task, the last, so that a task that ends again and again does
37
+ * not pile notes up in the double's queue.
38
+ */
39
+ this.notes = new Map();
40
+ this.noteSettleMs = NOTE_SETTLE_MS;
32
41
  this.asked = 0;
33
42
  this.listeners = new Set();
34
43
  }
@@ -372,8 +381,14 @@ let TaAssistantImpl = class TaAssistantImpl {
372
381
  const store = this.workbench.createStore(sessionId, { clientTools });
373
382
  await Promise.all([named ? this.server.setSessionName(sessionId, 'Ta') : undefined, this.applyModel(sessionId, info.model), store.attach()]);
374
383
  store.onGone(() => void this.recover(store));
384
+ store.subscribe(state => {
385
+ if (!state.working && this.assistant === store) {
386
+ this.flushNotes();
387
+ }
388
+ });
375
389
  this.assistant = store;
376
390
  this.update({ ready: true, error: undefined });
391
+ this.flushNotes();
377
392
  await this.followRunning(sessions);
378
393
  }
379
394
  /**
@@ -516,6 +531,8 @@ let TaAssistantImpl = class TaAssistantImpl {
516
531
  return;
517
532
  }
518
533
  if (state.working) {
534
+ // Not ended after all: the double hears of it when it ends again.
535
+ this.notes.delete(id);
519
536
  if (task.status !== 'running') {
520
537
  this.book.change(id, { status: 'running', endedAt: undefined, result: undefined });
521
538
  }
@@ -532,7 +549,34 @@ let TaAssistantImpl = class TaAssistantImpl {
532
549
  const { status, result, endedAt, key } = AssistantTaskUtil.outcome(state);
533
550
  this.book.change(id, { status, endedAt: endedAt !== null && endedAt !== void 0 ? endedAt : Date.now(), result });
534
551
  this.update({ lastFinished: Date.now() });
535
- void this.send(AssistantTaskUtil.updateNote(this.book.get(id)), 'followUp', `task-update:${id}:${key}`).catch(() => undefined);
552
+ this.notes.set(id, { text: AssistantTaskUtil.updateNote(this.book.get(id)), clientMessageId: `task-update:${id}:${key}`, at: Date.now() });
553
+ this.flushNotes();
554
+ }
555
+ /**
556
+ * Sends the notes of the tasks that stayed ended a moment, once the double is not at work: what it
557
+ * did not hear yet waits here rather than in its queue, where a task that ended again would add one more.
558
+ */
559
+ flushNotes() {
560
+ clearTimeout(this.noteTimer);
561
+ this.noteTimer = undefined;
562
+ const store = this.assistant;
563
+ if (!this.notes.size || !store || store.state.working) {
564
+ return;
565
+ }
566
+ const now = Date.now();
567
+ let next = Number.POSITIVE_INFINITY;
568
+ for (const [id, note] of this.notes) {
569
+ const wait = note.at + this.noteSettleMs - now;
570
+ if (wait > 0) {
571
+ next = Math.min(next, wait);
572
+ continue;
573
+ }
574
+ this.notes.delete(id);
575
+ void this.send(note.text, 'followUp', note.clientMessageId).catch(() => undefined);
576
+ }
577
+ if (next !== Number.POSITIVE_INFINITY) {
578
+ this.noteTimer = setTimeout(() => this.flushNotes(), next);
579
+ }
536
580
  }
537
581
  update(change) {
538
582
  this.current = { ...this.current, ...change };
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import type { WebTask, WebTaskEntry } from '../extension/web-extension-api.js';
2
+ import type { WebTask, WebTaskEntry, WebTaskRemoval } from '../extension/web-extension-api.js';
3
3
  import { type Translate } from '../i18n/use-t.js';
4
4
  import type { AssistantAsk } from './assistant-protocol.js';
5
5
  /** The dot of a status, in the colors of the steps of a turn. */
@@ -23,13 +23,47 @@ export declare const TaskCard: React.MemoExoticComponent<({ task }: {
23
23
  export declare function TaskCards({ tasks }: {
24
24
  tasks: WebTaskEntry[];
25
25
  }): React.JSX.Element | null;
26
- /** A task in a list: its face, its title and what it is at, its time. */
27
- export declare const TaskRow: React.MemoExoticComponent<({ task }: {
26
+ /** What a list of tasks does with its rows: the same functions for every row, so that a row draws again only for its own change. */
27
+ export interface TaskListActions {
28
+ /** Deletes it once the user agrees. */
29
+ remove(task: WebTaskEntry): void;
30
+ /** The list starts selecting, with it chosen. */
31
+ select(key: string): void;
32
+ /** Chooses it, or no longer, while the list selects. */
33
+ toggle(key: string): void;
34
+ }
35
+ export interface TaskRowProps {
28
36
  task: WebTaskEntry;
29
- }) => React.JSX.Element>;
30
- /** Every task: what waits for the user, what runs, then what ended, the latest first. */
31
- export declare function TaskBoardList({ tasks }: {
37
+ actions?: TaskListActions;
38
+ /** The list selects: a tap chooses the row, `checked` once chosen. */
39
+ selecting?: boolean;
40
+ checked?: boolean;
41
+ }
42
+ /**
43
+ * A task in a list: its face, its title and what it is at, its time. On a phone a swipe to the left shows
44
+ * Delete behind it, as the other lists; its menu starts selecting several, to delete them at once.
45
+ */
46
+ export declare const TaskRow: React.MemoExoticComponent<({ task, actions, selecting, checked }: TaskRowProps) => React.JSX.Element>;
47
+ /**
48
+ * Which tasks of a list are chosen while it selects (undefined while it does not), and what its rows do: a
49
+ * swipe deletes one, the menu of one starts selecting, and the bar deletes those chosen, asked once. Those
50
+ * gone from the list are no longer chosen; with none left that can be deleted, it stops selecting.
51
+ */
52
+ export declare function useTaskSelection(tasks: readonly WebTaskEntry[], remove: (tasks: readonly WebTaskRemoval[]) => Promise<boolean>): {
53
+ actions: TaskListActions;
54
+ selecting: boolean;
55
+ isChosen: (task: WebTaskEntry) => boolean;
56
+ selected: WebTaskEntry[];
57
+ removable: WebTaskEntry[];
58
+ selectAll: (all: boolean) => void;
59
+ done: () => void;
60
+ /** Deletes those chosen once the user agrees, and stops selecting. */
61
+ removeSelected: () => Promise<void>;
62
+ };
63
+ /** Every task: what waits for the user, what runs, then what ended, the latest first. `onRemove` deletes some once the user agrees (useRemoveTasks). */
64
+ export declare function TaskBoardList({ tasks, onRemove }: {
32
65
  tasks: readonly WebTaskEntry[];
66
+ onRemove(tasks: readonly WebTaskRemoval[]): Promise<boolean>;
33
67
  }): React.JSX.Element;
34
68
  /** In the head of the double: how many run and how many wait for the user; the tasks open on a click. */
35
69
  export declare function TasksChip({ tasks, onOpen }: {
@@ -4,6 +4,8 @@ import { useContextMenu } from '../components/context-menu.js';
4
4
  import { TasksPicture } from '../components/empty-pictures.js';
5
5
  import { EmptyState } from '../components/empty-state.js';
6
6
  import { Icon, IconButton } from '../components/icon.js';
7
+ import { SelectBar, SelectCheck } from '../components/select-bar.js';
8
+ import { SwipeRow } from '../components/swipe-row.js';
7
9
  import { WebTaskUtil } from '../extension/web-tasks.js';
8
10
  import { useT } from '../i18n/use-t.js';
9
11
  // The tasks of the double and of extensions, drawn alike: a card in the turn that started it, a row in the lists.
@@ -66,21 +68,21 @@ export function taskLine(task, t) {
66
68
  const detail = (_a = task.detail) === null || _a === void 0 ? void 0 : _a.trim();
67
69
  return detail && detail !== status ? detail : status;
68
70
  }
69
- function menuItems(task) {
71
+ function menuItems(task, more) {
70
72
  var _a;
71
73
  var _b;
72
- return ((_b = (_a = task.menu) === null || _a === void 0 ? void 0 : _a.call(task)) !== null && _b !== void 0 ? _b : [])
74
+ return [
75
+ ...((_b = (_a = task.menu) === null || _a === void 0 ? void 0 : _a.call(task)) !== null && _b !== void 0 ? _b : []).map(section => section.map(item => ({ label: item.label, disabled: item.disabled, danger: item.danger, run: item.run }))),
76
+ more,
77
+ ]
73
78
  .filter(section => section.length > 0)
74
- .flatMap((section, index) => [
75
- ...(index > 0 ? ['-'] : []),
76
- ...section.map(item => ({ label: item.label, disabled: item.disabled, danger: item.danger, run: item.run })),
77
- ]);
79
+ .flatMap((section, index) => [...(index > 0 ? ['-'] : []), ...section]);
78
80
  }
79
- /** A held finger or a right click opens its …; so does the button that shows on hover. */
80
- function useTaskMenu(task) {
81
+ /** A held finger or a right click opens its …; so does the button that shows on hover. `more`: what the list adds, last. */
82
+ function useTaskMenu(task, more = []) {
81
83
  const [menu, openMenu] = useContextMenu();
82
84
  const open = (event) => {
83
- const items = menuItems(task);
85
+ const items = menuItems(task, more);
84
86
  if (items.length > 0) {
85
87
  openMenu(event, items);
86
88
  }
@@ -112,12 +114,18 @@ export function TaskCards({ tasks }) {
112
114
  }
113
115
  return (React.createElement("div", { className: "ta-task-cards" }, tasks.map(task => (React.createElement(TaskCard, { key: task.key, task: task })))));
114
116
  }
115
- /** A task in a list: its face, its title and what it is at, its time. */
116
- export const TaskRow = React.memo(function TaskRow({ task }) {
117
+ /**
118
+ * A task in a list: its face, its title and what it is at, its time. On a phone a swipe to the left shows
119
+ * Delete behind it, as the other lists; its menu starts selecting several, to delete them at once.
120
+ */
121
+ export const TaskRow = React.memo(function TaskRow({ task, actions, selecting = false, checked = false }) {
117
122
  const t = useT();
118
- const [menu, openMenu] = useTaskMenu(task);
119
- return (React.createElement("li", { className: `ta-task-row ta-task-${task.status}`, onContextMenu: openMenu },
120
- React.createElement("button", { type: "button", className: "ta-task-row-main", onClick: () => task.open() },
123
+ const removable = !!task.remove && !!actions;
124
+ const [menu, openMenu] = useTaskMenu(task, removable ? [{ label: t('ta.tasks.select'), run: () => actions === null || actions === void 0 ? void 0 : actions.select(task.key) }] : []);
125
+ const swipe = removable && !selecting ? [{ key: 'remove', label: t('ta.task.remove'), danger: true, run: () => actions === null || actions === void 0 ? void 0 : actions.remove(task) }] : undefined;
126
+ return (React.createElement(SwipeRow, { as: "li", className: `ta-task-row ta-task-${task.status}${selecting ? ' ta-selecting' : ''}`, actions: swipe, overlay: menu, onContextMenu: selecting ? undefined : openMenu },
127
+ React.createElement("button", { type: "button", className: "ta-task-row-main", "aria-pressed": selecting ? checked : undefined, disabled: selecting && !removable, onClick: selecting ? () => actions === null || actions === void 0 ? void 0 : actions.toggle(task.key) : () => task.open() },
128
+ selecting && React.createElement(SelectCheck, { checked: checked, disabled: !removable }),
121
129
  React.createElement(TaskIcon, { task: task, size: 28 }),
122
130
  React.createElement("span", { className: "ta-task-row-text" },
123
131
  React.createElement("span", { className: "ta-task-row-title" }, task.title),
@@ -125,29 +133,73 @@ export const TaskRow = React.memo(function TaskRow({ task }) {
125
133
  React.createElement("span", { className: `ta-status ta-status-${TASK_DOT[task.status]}` }),
126
134
  React.createElement("span", null, taskLine(task, t)))),
127
135
  React.createElement(Elapsed, { task: task })),
128
- task.menu && React.createElement(IconButton, { icon: MoreHorizontal, label: t('ta.more'), className: "ta-task-more", onClick: openMenu }),
129
- menu));
136
+ (task.menu || removable) && !selecting && React.createElement(IconButton, { icon: MoreHorizontal, label: t('ta.more'), className: "ta-task-more", onClick: openMenu })));
130
137
  });
131
138
  const ENDED_SHOWN = 8;
132
- /** Every task: what waits for the user, what runs, then what ended, the latest first. */
133
- export function TaskBoardList({ tasks }) {
139
+ /**
140
+ * Which tasks of a list are chosen while it selects (undefined while it does not), and what its rows do: a
141
+ * swipe deletes one, the menu of one starts selecting, and the bar deletes those chosen, asked once. Those
142
+ * gone from the list are no longer chosen; with none left that can be deleted, it stops selecting.
143
+ */
144
+ export function useTaskSelection(tasks, remove) {
145
+ const [chosen, setChosen] = React.useState();
146
+ const removable = React.useMemo(() => tasks.filter(task => task.remove), [tasks]);
147
+ const selected = chosen ? removable.filter(task => chosen.has(task.key)) : [];
148
+ const selecting = !!chosen && removable.length > 0;
149
+ React.useEffect(() => {
150
+ if (chosen && removable.length === 0) {
151
+ setChosen(undefined);
152
+ }
153
+ }, [chosen, removable.length]);
154
+ const actions = React.useMemo(() => ({
155
+ remove: task => void remove([task]),
156
+ select: key => setChosen(new Set([key])),
157
+ toggle: key => setChosen(before => {
158
+ const next = new Set(before);
159
+ if (!next.delete(key)) {
160
+ next.add(key);
161
+ }
162
+ return next;
163
+ }),
164
+ }), [remove]);
165
+ return {
166
+ actions,
167
+ selecting,
168
+ isChosen: (task) => !!(chosen === null || chosen === void 0 ? void 0 : chosen.has(task.key)),
169
+ selected,
170
+ removable,
171
+ selectAll: (all) => setChosen(new Set(all ? removable.map(task => task.key) : [])),
172
+ done: () => setChosen(undefined),
173
+ /** Deletes those chosen once the user agrees, and stops selecting. */
174
+ removeSelected: async () => {
175
+ if (await remove(selected)) {
176
+ setChosen(undefined);
177
+ }
178
+ },
179
+ };
180
+ }
181
+ /** Every task: what waits for the user, what runs, then what ended, the latest first. `onRemove` deletes some once the user agrees (useRemoveTasks). */
182
+ export function TaskBoardList({ tasks, onRemove }) {
134
183
  const t = useT();
135
184
  const [all, setAll] = React.useState(false);
136
185
  const groups = React.useMemo(() => WebTaskUtil.groups(tasks), [tasks]);
186
+ const selection = useTaskSelection(tasks, onRemove);
137
187
  if (tasks.length === 0) {
138
188
  return React.createElement(EmptyState, { picture: React.createElement(TasksPicture, null), title: t('ta.assistant.noTasks'), hint: t('ta.assistant.noTasksHint') });
139
189
  }
140
- const ended = all ? groups.ended : groups.ended.slice(0, ENDED_SHOWN);
190
+ // Selecting, every row shows: Select all chooses what the user sees.
191
+ const ended = all || selection.selecting ? groups.ended : groups.ended.slice(0, ENDED_SHOWN);
141
192
  const group = (title, list, more) => list.length > 0 && (React.createElement("section", { className: "ta-task-group" },
142
193
  React.createElement("div", { className: "ta-task-group-title" },
143
194
  React.createElement("span", null, t(title)),
144
195
  React.createElement("span", { className: "ta-task-group-count" }, list === ended ? groups.ended.length : list.length)),
145
- React.createElement("ul", { className: "ta-task-rows" }, list.map(task => (React.createElement(TaskRow, { key: task.key, task: task })))),
196
+ React.createElement("ul", { className: "ta-task-rows" }, list.map(task => (React.createElement(TaskRow, { key: task.key, task: task, actions: selection.actions, selecting: selection.selecting, checked: selection.isChosen(task) })))),
146
197
  more));
147
198
  return (React.createElement(React.Fragment, null,
148
199
  group('ta.tasks.waiting', groups.waiting),
149
200
  group('ta.tasks.running', groups.running),
150
- group('ta.tasks.ended', ended, groups.ended.length > ENDED_SHOWN && (React.createElement("button", { type: "button", className: "ta-task-more-rows", onClick: () => setAll(!all) }, t(all ? 'ta.tasks.fewer' : 'ta.tasks.all', { count: groups.ended.length }))))));
201
+ group('ta.tasks.ended', ended, groups.ended.length > ENDED_SHOWN && !selection.selecting && (React.createElement("button", { type: "button", className: "ta-task-more-rows", onClick: () => setAll(!all) }, t(all ? 'ta.tasks.fewer' : 'ta.tasks.all', { count: groups.ended.length })))),
202
+ selection.selecting && (React.createElement(SelectBar, { count: selection.selected.length, total: selection.removable.length, onSelectAll: selection.selectAll, onDone: selection.done, actions: [{ key: 'remove', label: t('ta.task.remove'), danger: true, run: () => void selection.removeSelected() }] }))));
151
203
  }
152
204
  /** In the head of the double: how many run and how many wait for the user; the tasks open on a click. */
153
205
  export function TasksChip({ tasks, onOpen }) {
@@ -1,4 +1,6 @@
1
- import { type Bone, DinoSpecies, type Point } from './dino-species.js';
1
+ import { type Matrix } from './dino-geometry.js';
2
+ import { type Bone, type Point } from './dino-shape.js';
3
+ import { DinoSpecies } from './dino-species.js';
2
4
  /** What ta is doing, as its face and pose show it. */
3
5
  export type Mood = 'idle' | 'listening' | 'thinking' | 'working' | 'speaking' | 'attention' | 'done' | 'sleeping';
4
6
  export declare const MOODS: Mood[];
@@ -39,8 +41,6 @@ export interface Pose {
39
41
  wing: number;
40
42
  }
41
43
  export declare const REST: Pose;
42
- /** A 2D affine transform [a, b, c, d, e, f], as in SVG's matrix(). */
43
- export type Matrix = [number, number, number, number, number, number];
44
44
  /**
45
45
  * How many pieces the rounded side of the head and body is made of, from the far side to the near one.
46
46
  * Between two pieces the outline is swept, not stacked, so the side is smooth at every angle.
@@ -70,7 +70,6 @@ export declare function rig(pose: Pose, species?: DinoSpecies): Rig;
70
70
  export declare function skin(r: Rig): string;
71
71
  /** Where the middle of the head is in a pose, in the coordinates of the drawing; the eyes follow what is around it from there. */
72
72
  export declare function headAt(pose: Pose, species?: DinoSpecies): Point;
73
- export declare function matrix(m: Matrix): string;
74
73
  /** The transforms and the outline a pose draws, ready for the attributes of the drawing. */
75
74
  export interface Frame {
76
75
  skin: string;