@celljs/ta-web 4.37.0 → 4.39.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 (237) hide show
  1. package/README.en.md +1 -1
  2. package/README.md +1 -1
  3. package/esm/browser/assistant/assistant-thread.d.ts +1 -1
  4. package/esm/browser/assistant/chat-task-source.js +2 -1
  5. package/esm/browser/components/app-contexts.js +11 -9
  6. package/esm/browser/components/chat-asks.d.ts +4 -1
  7. package/esm/browser/components/chat-asks.js +10 -0
  8. package/esm/browser/components/chat-list-row.js +5 -3
  9. package/esm/browser/components/cloud-network.d.ts +17 -0
  10. package/esm/browser/components/cloud-network.js +105 -0
  11. package/esm/browser/components/cloud-sign-in-view.d.ts +1 -1
  12. package/esm/browser/components/composer-box-protocol.d.ts +5 -0
  13. package/esm/browser/components/composer-box.js +11 -14
  14. package/esm/browser/components/composer-media.d.ts +26 -0
  15. package/esm/browser/components/composer-media.js +37 -0
  16. package/esm/browser/components/composer-target.d.ts +2 -2
  17. package/esm/browser/components/composer-target.js +3 -3
  18. package/esm/browser/components/composer.js +1 -0
  19. package/esm/browser/components/folder-picker.d.ts +3 -3
  20. package/esm/browser/components/folder-picker.js +5 -15
  21. package/esm/browser/components/host-view.d.ts +1 -1
  22. package/esm/browser/components/link.d.ts +7 -1
  23. package/esm/browser/components/link.js +24 -5
  24. package/esm/browser/components/markdown.d.ts +2 -2
  25. package/esm/browser/components/markdown.js +77 -5
  26. package/esm/browser/components/relay-services.d.ts +0 -2
  27. package/esm/browser/components/relay-services.js +1 -11
  28. package/esm/browser/components/remote-hosts.d.ts +11 -7
  29. package/esm/browser/components/remote-hosts.js +94 -50
  30. package/esm/browser/components/remote-machines.d.ts +21 -0
  31. package/esm/browser/components/remote-machines.js +56 -0
  32. package/esm/browser/components/remote-prompts.d.ts +2 -3
  33. package/esm/browser/components/remote-prompts.js +3 -15
  34. package/esm/browser/components/remote-steps.d.ts +19 -0
  35. package/esm/browser/components/remote-steps.js +26 -0
  36. package/esm/browser/components/session-view.js +10 -6
  37. package/esm/browser/components/settings-controls.d.ts +3 -1
  38. package/esm/browser/components/settings-controls.js +2 -2
  39. package/esm/browser/components/web-composer.d.ts +1 -1
  40. package/esm/browser/components/web-composer.js +12 -3
  41. package/esm/browser/device/photo-picker.d.ts +11 -3
  42. package/esm/browser/device/photo-picker.js +26 -9
  43. package/esm/browser/device/video-picks.d.ts +24 -0
  44. package/esm/browser/device/video-picks.js +104 -0
  45. package/esm/browser/extension/icons.js +3 -1
  46. package/esm/browser/extension/web-access.js +4 -1
  47. package/esm/browser/extension/web-api-code.d.ts +36 -0
  48. package/esm/browser/extension/web-api-code.js +3 -0
  49. package/esm/browser/extension/web-api-components.d.ts +22 -0
  50. package/esm/browser/extension/web-api-contributions.d.ts +0 -31
  51. package/esm/browser/extension/web-api-menus.d.ts +29 -3
  52. package/esm/browser/extension/web-api-play.d.ts +29 -0
  53. package/esm/browser/extension/web-api-play.js +2 -0
  54. package/esm/browser/extension/web-api-services.d.ts +6 -0
  55. package/esm/browser/extension/web-api-spec.js +5 -0
  56. package/esm/browser/extension/web-api-terminal.d.ts +20 -0
  57. package/esm/browser/extension/web-extension-api.d.ts +12 -17
  58. package/esm/browser/extension/web-extension-context.d.ts +1 -1
  59. package/esm/browser/extension/web-extension-context.js +6 -3
  60. package/esm/browser/extension/web-extension-protocol.d.ts +5 -1
  61. package/esm/browser/extension/web-extension-protocol.js +2 -0
  62. package/esm/browser/extension/web-extension-run.d.ts +6 -4
  63. package/esm/browser/extension/web-extension-run.js +18 -9
  64. package/esm/browser/extension/web-extensions-running.js +38 -7
  65. package/esm/browser/extension/web-on-demand.d.ts +5 -0
  66. package/esm/browser/extension/web-on-demand.js +11 -0
  67. package/esm/browser/i18n/en/assistant.d.ts +3 -0
  68. package/esm/browser/i18n/en/assistant.js +3 -0
  69. package/esm/browser/i18n/en/chat.d.ts +1 -0
  70. package/esm/browser/i18n/en/chat.js +1 -0
  71. package/esm/browser/i18n/en/common.d.ts +1 -0
  72. package/esm/browser/i18n/en/common.js +1 -0
  73. package/esm/browser/i18n/en/discover.d.ts +2 -0
  74. package/esm/browser/i18n/en/discover.js +2 -0
  75. package/esm/browser/i18n/en/service.d.ts +26 -2
  76. package/esm/browser/i18n/en/service.js +34 -10
  77. package/esm/browser/i18n/ja/assistant.js +3 -0
  78. package/esm/browser/i18n/ja/chat.js +1 -0
  79. package/esm/browser/i18n/ja/common.js +1 -0
  80. package/esm/browser/i18n/ja/discover.js +2 -0
  81. package/esm/browser/i18n/ja/service.js +34 -10
  82. package/esm/browser/i18n/locales.d.ts +34 -3
  83. package/esm/browser/i18n/messages.d.ts +33 -2
  84. package/esm/browser/i18n/zh/assistant.js +3 -0
  85. package/esm/browser/i18n/zh/chat.js +1 -0
  86. package/esm/browser/i18n/zh/common.js +1 -0
  87. package/esm/browser/i18n/zh/discover.js +2 -0
  88. package/esm/browser/i18n/zh/service.js +34 -10
  89. package/esm/browser/i18n/zh-tw/assistant.js +3 -0
  90. package/esm/browser/i18n/zh-tw/chat.js +1 -0
  91. package/esm/browser/i18n/zh-tw/common.js +1 -0
  92. package/esm/browser/i18n/zh-tw/discover.js +2 -0
  93. package/esm/browser/i18n/zh-tw/service.js +34 -10
  94. package/esm/browser/markdown/code-renderers.d.ts +6 -1
  95. package/esm/browser/markdown/code-renderers.js +4 -0
  96. package/esm/browser/sandbox/sandbox-runtime-code.js +1 -1
  97. package/esm/browser/sandbox/work/work-api.d.ts +113 -0
  98. package/esm/browser/sandbox/work/work-api.js +95 -0
  99. package/esm/browser/sandbox/work/work-docs.d.ts +18 -0
  100. package/esm/browser/sandbox/work/work-docs.js +66 -0
  101. package/esm/browser/sandbox/work/work-frame.d.ts +27 -0
  102. package/esm/browser/sandbox/work/work-frame.js +124 -0
  103. package/esm/browser/share/shared-extensions.d.ts +2 -1
  104. package/esm/browser/style/conversation.d.ts +1 -1
  105. package/esm/browser/style/conversation.js +10 -0
  106. package/esm/browser/style/dialogs.d.ts +1 -1
  107. package/esm/browser/style/dialogs.js +1 -4
  108. package/esm/browser/style/pages.d.ts +1 -1
  109. package/esm/browser/style/pages.js +10 -1
  110. package/esm/browser/terminal/terminal-osc.d.ts +15 -0
  111. package/esm/browser/terminal/terminal-osc.js +91 -0
  112. package/esm/browser/terminal/web-terminal.d.ts +4 -7
  113. package/esm/browser/terminal/web-terminal.js +22 -26
  114. package/esm/browser/util/link.d.ts +6 -1
  115. package/esm/browser/util/link.js +11 -0
  116. package/esm/browser/workbench-protocol.d.ts +2 -0
  117. package/esm/browser/workbench-services.d.ts +2 -0
  118. package/esm/browser/workbench-services.js +5 -0
  119. package/esm/browser/workbench.js +3 -0
  120. package/lib/browser/assistant/assistant-thread.d.ts +1 -1
  121. package/lib/browser/assistant/chat-task-source.js +2 -1
  122. package/lib/browser/components/app-contexts.js +10 -8
  123. package/lib/browser/components/chat-asks.d.ts +4 -1
  124. package/lib/browser/components/chat-asks.js +10 -0
  125. package/lib/browser/components/chat-list-row.js +5 -3
  126. package/lib/browser/components/cloud-network.d.ts +18 -0
  127. package/lib/browser/components/cloud-network.js +142 -0
  128. package/lib/browser/components/cloud-sign-in-view.d.ts +1 -1
  129. package/lib/browser/components/composer-box-protocol.d.ts +5 -0
  130. package/lib/browser/components/composer-box.js +9 -12
  131. package/lib/browser/components/composer-media.d.ts +27 -0
  132. package/lib/browser/components/composer-media.js +74 -0
  133. package/lib/browser/components/composer-target.d.ts +2 -2
  134. package/lib/browser/components/composer-target.js +3 -3
  135. package/lib/browser/components/composer.js +1 -0
  136. package/lib/browser/components/folder-picker.d.ts +3 -3
  137. package/lib/browser/components/folder-picker.js +5 -15
  138. package/lib/browser/components/host-view.d.ts +1 -1
  139. package/lib/browser/components/link.d.ts +7 -1
  140. package/lib/browser/components/link.js +25 -6
  141. package/lib/browser/components/markdown.d.ts +2 -2
  142. package/lib/browser/components/markdown.js +75 -3
  143. package/lib/browser/components/relay-services.d.ts +0 -2
  144. package/lib/browser/components/relay-services.js +1 -11
  145. package/lib/browser/components/remote-hosts.d.ts +11 -7
  146. package/lib/browser/components/remote-hosts.js +92 -48
  147. package/lib/browser/components/remote-machines.d.ts +22 -0
  148. package/lib/browser/components/remote-machines.js +59 -0
  149. package/lib/browser/components/remote-prompts.d.ts +2 -3
  150. package/lib/browser/components/remote-prompts.js +3 -15
  151. package/lib/browser/components/remote-steps.d.ts +20 -0
  152. package/lib/browser/components/remote-steps.js +63 -0
  153. package/lib/browser/components/session-view.js +8 -4
  154. package/lib/browser/components/settings-controls.d.ts +3 -1
  155. package/lib/browser/components/settings-controls.js +2 -2
  156. package/lib/browser/components/web-composer.d.ts +1 -1
  157. package/lib/browser/components/web-composer.js +12 -3
  158. package/lib/browser/device/photo-picker.d.ts +11 -3
  159. package/lib/browser/device/photo-picker.js +26 -9
  160. package/lib/browser/device/video-picks.d.ts +25 -0
  161. package/lib/browser/device/video-picks.js +107 -0
  162. package/lib/browser/extension/icons.js +2 -0
  163. package/lib/browser/extension/web-access.js +4 -1
  164. package/lib/browser/extension/web-api-code.d.ts +37 -0
  165. package/lib/browser/extension/web-api-code.js +4 -0
  166. package/lib/browser/extension/web-api-components.d.ts +22 -0
  167. package/lib/browser/extension/web-api-contributions.d.ts +0 -31
  168. package/lib/browser/extension/web-api-menus.d.ts +29 -3
  169. package/lib/browser/extension/web-api-play.d.ts +30 -0
  170. package/lib/browser/extension/web-api-play.js +3 -0
  171. package/lib/browser/extension/web-api-services.d.ts +6 -0
  172. package/lib/browser/extension/web-api-spec.js +5 -0
  173. package/lib/browser/extension/web-api-terminal.d.ts +20 -0
  174. package/lib/browser/extension/web-extension-api.d.ts +12 -17
  175. package/lib/browser/extension/web-extension-context.d.ts +1 -1
  176. package/lib/browser/extension/web-extension-context.js +6 -3
  177. package/lib/browser/extension/web-extension-protocol.d.ts +5 -1
  178. package/lib/browser/extension/web-extension-protocol.js +2 -0
  179. package/lib/browser/extension/web-extension-run.d.ts +6 -4
  180. package/lib/browser/extension/web-extension-run.js +18 -9
  181. package/lib/browser/extension/web-extensions-running.js +38 -7
  182. package/lib/browser/extension/web-on-demand.d.ts +5 -0
  183. package/lib/browser/extension/web-on-demand.js +11 -0
  184. package/lib/browser/i18n/en/assistant.d.ts +3 -0
  185. package/lib/browser/i18n/en/assistant.js +3 -0
  186. package/lib/browser/i18n/en/chat.d.ts +1 -0
  187. package/lib/browser/i18n/en/chat.js +1 -0
  188. package/lib/browser/i18n/en/common.d.ts +1 -0
  189. package/lib/browser/i18n/en/common.js +1 -0
  190. package/lib/browser/i18n/en/discover.d.ts +2 -0
  191. package/lib/browser/i18n/en/discover.js +2 -0
  192. package/lib/browser/i18n/en/service.d.ts +26 -2
  193. package/lib/browser/i18n/en/service.js +34 -10
  194. package/lib/browser/i18n/ja/assistant.js +3 -0
  195. package/lib/browser/i18n/ja/chat.js +1 -0
  196. package/lib/browser/i18n/ja/common.js +1 -0
  197. package/lib/browser/i18n/ja/discover.js +2 -0
  198. package/lib/browser/i18n/ja/service.js +34 -10
  199. package/lib/browser/i18n/locales.d.ts +34 -3
  200. package/lib/browser/i18n/messages.d.ts +33 -2
  201. package/lib/browser/i18n/zh/assistant.js +3 -0
  202. package/lib/browser/i18n/zh/chat.js +1 -0
  203. package/lib/browser/i18n/zh/common.js +1 -0
  204. package/lib/browser/i18n/zh/discover.js +2 -0
  205. package/lib/browser/i18n/zh/service.js +34 -10
  206. package/lib/browser/i18n/zh-tw/assistant.js +3 -0
  207. package/lib/browser/i18n/zh-tw/chat.js +1 -0
  208. package/lib/browser/i18n/zh-tw/common.js +1 -0
  209. package/lib/browser/i18n/zh-tw/discover.js +2 -0
  210. package/lib/browser/i18n/zh-tw/service.js +34 -10
  211. package/lib/browser/markdown/code-renderers.d.ts +6 -1
  212. package/lib/browser/markdown/code-renderers.js +5 -1
  213. package/lib/browser/sandbox/sandbox-runtime-code.js +1 -1
  214. package/lib/browser/sandbox/work/work-api.d.ts +114 -0
  215. package/lib/browser/sandbox/work/work-api.js +99 -0
  216. package/lib/browser/sandbox/work/work-docs.d.ts +19 -0
  217. package/lib/browser/sandbox/work/work-docs.js +69 -0
  218. package/lib/browser/sandbox/work/work-frame.d.ts +28 -0
  219. package/lib/browser/sandbox/work/work-frame.js +160 -0
  220. package/lib/browser/share/shared-extensions.d.ts +2 -1
  221. package/lib/browser/style/conversation.d.ts +1 -1
  222. package/lib/browser/style/conversation.js +10 -0
  223. package/lib/browser/style/dialogs.d.ts +1 -1
  224. package/lib/browser/style/dialogs.js +1 -4
  225. package/lib/browser/style/pages.d.ts +1 -1
  226. package/lib/browser/style/pages.js +10 -1
  227. package/lib/browser/terminal/terminal-osc.d.ts +16 -0
  228. package/lib/browser/terminal/terminal-osc.js +94 -0
  229. package/lib/browser/terminal/web-terminal.d.ts +4 -7
  230. package/lib/browser/terminal/web-terminal.js +25 -29
  231. package/lib/browser/util/link.d.ts +6 -1
  232. package/lib/browser/util/link.js +11 -0
  233. package/lib/browser/workbench-protocol.d.ts +2 -0
  234. package/lib/browser/workbench-services.d.ts +2 -0
  235. package/lib/browser/workbench-services.js +5 -0
  236. package/lib/browser/workbench.js +3 -0
  237. package/package.json +12 -12
@@ -0,0 +1,20 @@
1
+ import type { TaRemoteEvent, TaRemoteStep } from '@celljs/ta-protocol';
2
+ /** What a host is doing that takes a while: a step of connecting, or of making it a cloud workspace. */
3
+ export interface RemoteStepInfo {
4
+ step: TaRemoteStep;
5
+ detail?: string;
6
+ }
7
+ /** What gives the events of TaRemoteServer: the workbench. */
8
+ export interface RemoteEvents {
9
+ onRemoteEvent(listener: (event: TaRemoteEvent) => void): () => void;
10
+ }
11
+ export declare namespace RemoteSteps {
12
+ /** The steps by host after `event`: a step until the host connects, fails or its work ends. */
13
+ function next(steps: Readonly<Record<string, RemoteStepInfo>>, event: TaRemoteEvent): Readonly<Record<string, RemoteStepInfo>>;
14
+ }
15
+ /**
16
+ * What the hosts do now, by host, shown where the user looks at them (a row of Remote hosts, the picker of folders),
17
+ * never over the page.
18
+ */
19
+ export declare function useRemoteSteps(events: RemoteEvents | undefined): Readonly<Record<string, RemoteStepInfo>>;
20
+ //# sourceMappingURL=remote-steps.d.ts.map
@@ -0,0 +1,63 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.RemoteSteps = void 0;
37
+ exports.useRemoteSteps = useRemoteSteps;
38
+ const React = __importStar(require("react"));
39
+ var RemoteSteps;
40
+ (function (RemoteSteps) {
41
+ /** The steps by host after `event`: a step until the host connects, fails or its work ends. */
42
+ function next(steps, event) {
43
+ if (event.type === 'progress') {
44
+ return { ...steps, [event.host]: { step: event.step, ...(event.detail ? { detail: event.detail } : {}) } };
45
+ }
46
+ if ((event.type === 'connection' || event.type === 'progress_end') && event.host in steps) {
47
+ const { [event.host]: _over, ...rest } = steps;
48
+ return rest;
49
+ }
50
+ return steps;
51
+ }
52
+ RemoteSteps.next = next;
53
+ })(RemoteSteps || (exports.RemoteSteps = RemoteSteps = {}));
54
+ /**
55
+ * What the hosts do now, by host, shown where the user looks at them (a row of Remote hosts, the picker of folders),
56
+ * never over the page.
57
+ */
58
+ function useRemoteSteps(events) {
59
+ const [steps, setSteps] = React.useState({});
60
+ React.useEffect(() => events === null || events === void 0 ? void 0 : events.onRemoteEvent(event => setSteps(shown => RemoteSteps.next(shown, event))), [events]);
61
+ return steps;
62
+ }
63
+ //# sourceMappingURL=remote-steps.js.map
@@ -236,11 +236,14 @@ function SessionView({ store, server, workspace, info, onClosed, onActivity, lea
236
236
  text: () => { var _a; var _b; return (_b = (_a = composer.current) === null || _a === void 0 ? void 0 : _a.text()) !== null && _b !== void 0 ? _b : ''; },
237
237
  setText: text => { var _a; return (_a = composer.current) === null || _a === void 0 ? void 0 : _a.setText(text); },
238
238
  addFiles: files => { var _a, _b; return (_b = (_a = composer.current) === null || _a === void 0 ? void 0 : _a.addFiles) === null || _b === void 0 ? void 0 : _b.call(_a, files); },
239
+ shown: () => { var _a; var _b; return (_b = (_a = composer.current) === null || _a === void 0 ? void 0 : _a.shown()) !== null && _b !== void 0 ? _b : false; },
239
240
  }), [compact]);
240
241
  const files = (0, react_1.useInject)(files_protocol_1.TaFiles);
241
242
  const fileUrl = React.useCallback(async (path, box) => files.loadable(thumbnail_1.ThumbnailUtil.boxed(await workspace.fileUrl(path, cwd), box)), [workspace, cwd, files]);
242
243
  const namedPaths = React.useCallback(() => message_1.MessageUtil.namedPaths(store.state.messages), [store]);
243
244
  const openLink = (0, hooks_1.useOpenLink)(cwd, namedPaths);
245
+ const [{ fileMenus }] = (0, hooks_1.useWebExtensions)();
246
+ const fileMenu = React.useCallback((path) => (cwd ? fileMenus.flatMap(menu => menu(link_1.LinkUtil.fileRef(cwd, path))) : []), [cwd, fileMenus]);
244
247
  // biome-ignore lint/correctness/useExhaustiveDependencies: runs when a run starts or settles
245
248
  React.useEffect(() => onActivity(), [state.working, onActivity]);
246
249
  React.useEffect(() => {
@@ -402,10 +405,11 @@ function SessionView({ store, server, workspace, info, onClosed, onActivity, lea
402
405
  React.createElement(message_footer_1.MessageActions.Provider, { value: messageActions },
403
406
  React.createElement(media_1.FileUrls.Provider, { value: fileUrl },
404
407
  React.createElement(link_2.OpenLink.Provider, { value: openLink },
405
- React.createElement(message_images_1.MessageImages.Provider, { value: images },
406
- React.createElement(code_renderers_1.CodeReply.Provider, { value: reply },
407
- React.createElement(code_renderers_1.CodeConversation.Provider, { value: info === null || info === void 0 ? void 0 : info.sessionFile },
408
- React.createElement(message_list_1.MessageList, { state: state, outbox: outbox, rows: rows }))))))))))),
408
+ React.createElement(link_2.FileMenu.Provider, { value: fileMenu },
409
+ React.createElement(message_images_1.MessageImages.Provider, { value: images },
410
+ React.createElement(code_renderers_1.CodeReply.Provider, { value: reply },
411
+ React.createElement(code_renderers_1.CodeConversation.Provider, { value: info === null || info === void 0 ? void 0 : info.sessionFile },
412
+ React.createElement(message_list_1.MessageList, { state: state, outbox: outbox, rows: rows })))))))))))),
409
413
  React.createElement("div", { className: "ta-bottom" },
410
414
  away &&
411
415
  (asking ? (React.createElement("button", { type: "button", className: "ta-to-bottom ta-to-ask", title: t('ta.chat.toAsk', { question: asking.question }), onClick: toBottom },
@@ -38,10 +38,12 @@ export interface RowProps {
38
38
  stacked?: boolean;
39
39
  /** Set in the file shown: a bar on its left, as in an IDE. */
40
40
  modified?: boolean;
41
+ /** Belongs to the row above (a setting of a host listed there): it starts under that row's label. */
42
+ inset?: boolean;
41
43
  children?: React.ReactNode;
42
44
  }
43
45
  /** Label and description on the left, the control on the right; stacked when the control is wide. */
44
- export declare function Row({ label, icon, description, stacked, modified, children }: RowProps): React.JSX.Element;
46
+ export declare function Row({ label, icon, description, stacked, modified, inset, children }: RowProps): React.JSX.Element;
45
47
  /** A choice of several as a row of its own, checked on its right: a phone's Segmented when the labels are too many to fit. */
46
48
  export declare function ChoiceRow({ label, checked, onPick }: {
47
49
  label: string;
@@ -69,8 +69,8 @@ function Switch({ checked, onChange, label, disabled }) {
69
69
  } }));
70
70
  }
71
71
  /** Label and description on the left, the control on the right; stacked when the control is wide. */
72
- function Row({ label, icon, description, stacked, modified, children }) {
73
- return (React.createElement("div", { className: `ta-setting-row${stacked ? ' ta-stacked' : ''}${modified ? ' ta-modified' : ''}` },
72
+ function Row({ label, icon, description, stacked, modified, inset, children }) {
73
+ return (React.createElement("div", { className: `ta-setting-row${stacked ? ' ta-stacked' : ''}${modified ? ' ta-modified' : ''}${inset ? ' ta-inset' : ''}` },
74
74
  icon && (React.createElement("span", { className: "ta-setting-icon", "aria-hidden": "true" },
75
75
  React.createElement(icon_1.Icon, { icon: icon, size: 16 }))),
76
76
  (label || description) && (React.createElement("div", { className: "ta-setting-text" },
@@ -19,5 +19,5 @@ export interface WebComposerHostProps extends WebComposerProps {
19
19
  * The message box as web extensions get it (`pi.ui.Composer`): text, and pictures when it takes them (shrunk within
20
20
  * the limits given), `@` for the names they give; a failure is a notice of the page.
21
21
  */
22
- export declare function WebComposer({ notices, placeholder, onSend, images, emoji, autoFocus, mentions, mentionLabel, actions, cwd, onPickCwd, commands, working, onStop, voiceSends, onTalkSent, onListening, after, draft, server, listDirectory, serverCwd, remote, }: WebComposerHostProps): React.JSX.Element;
22
+ export declare function WebComposer({ notices, placeholder, onSend, images, videos, emoji, autoFocus, mentions, mentionLabel, actions, cwd, onPickCwd, commands, working, onStop, voiceSends, onTalkSent, onListening, after, draft, server, listDirectory, serverCwd, remote, }: WebComposerHostProps): React.JSX.Element;
23
23
  //# sourceMappingURL=web-composer.d.ts.map
@@ -40,22 +40,31 @@ const composer_1 = require("../util/composer");
40
40
  const image_shrink_1 = require("../util/image-shrink");
41
41
  const composer_addon_util_1 = require("./composer-addon-util");
42
42
  const composer_box_1 = require("./composer-box");
43
+ const composer_target_1 = require("./composer-target");
43
44
  const directory_commands_1 = require("./directory-commands");
44
45
  const folder_picker_1 = require("./folder-picker");
45
46
  /**
46
47
  * The message box as web extensions get it (`pi.ui.Composer`): text, and pictures when it takes them (shrunk within
47
48
  * the limits given), `@` for the names they give; a failure is a notice of the page.
48
49
  */
49
- function WebComposer({ notices, placeholder, onSend, images, emoji, autoFocus, mentions, mentionLabel, actions, cwd, onPickCwd, commands, working, onStop, voiceSends, onTalkSent, onListening, after, draft, server, listDirectory, serverCwd, remote, }) {
50
+ function WebComposer({ notices, placeholder, onSend, images, videos, emoji, autoFocus, mentions, mentionLabel, actions, cwd, onPickCwd, commands, working, onStop, voiceSends, onTalkSent, onListening, after, draft, server, listDirectory, serverCwd, remote, }) {
50
51
  const t = (0, use_t_1.useT)();
51
52
  const language = (0, use_t_1.useLanguage)();
52
53
  const [query, setQuery] = React.useState();
54
+ // It takes what extensions put in the box in front (WebUiAPI.addToComposer), a message quoted in a group chat say.
55
+ const box = React.useRef(null);
56
+ React.useEffect(() => composer_target_1.ComposerTarget.set({
57
+ text: () => { var _a; var _b; return (_b = (_a = box.current) === null || _a === void 0 ? void 0 : _a.text()) !== null && _b !== void 0 ? _b : ''; },
58
+ setText: text => { var _a; return (_a = box.current) === null || _a === void 0 ? void 0 : _a.setText(text); },
59
+ addFiles: files => { var _a, _b; return (_b = (_a = box.current) === null || _a === void 0 ? void 0 : _a.addFiles) === null || _b === void 0 ? void 0 : _b.call(_a, files); },
60
+ shown: () => { var _a; var _b; return (_b = (_a = box.current) === null || _a === void 0 ? void 0 : _a.shown()) !== null && _b !== void 0 ? _b : false; },
61
+ }), []);
53
62
  const found = (0, directory_commands_1.useDirectoryCommands)(server, commands ? cwd || serverCwd : undefined);
54
63
  const listed = React.useMemo(() => found.map(command => ({ name: command.name, description: composer_1.ComposerUtil.commandDescription(command, language, t) })), [found, language, t]);
55
- return (React.createElement(composer_box_1.ComposerBox, { placeholder: placeholder !== null && placeholder !== void 0 ? placeholder : t('ta.composer.label'), onSend: async (text, attached) => {
64
+ return (React.createElement(composer_box_1.ComposerBox, { ref: box, placeholder: placeholder !== null && placeholder !== void 0 ? placeholder : t('ta.composer.label'), onSend: async (text, attached) => {
56
65
  const limits = typeof images === 'object' ? images : undefined;
57
66
  await onSend(text, limits ? await Promise.all(attached.map(image => image_shrink_1.ImageShrink.shrink(image, limits))) : attached);
58
- }, images: !!images, emoji: emoji, autoFocus: autoFocus, commands: listed, onMentionQuery: mentions ? setQuery : undefined, mentions: mentions && query !== undefined
67
+ }, images: !!images, videos: videos, emoji: emoji, autoFocus: autoFocus, commands: listed, onMentionQuery: mentions ? setQuery : undefined, mentions: mentions && query !== undefined
59
68
  ? {
60
69
  items: composer_1.ComposerUtil.commands(mentions, query).map(mention => ({
61
70
  key: mention.name,
@@ -1,3 +1,9 @@
1
+ import type { WebPickedVideo } from '../extension/web-api-components';
2
+ /** What was picked: the photos, and the videos when asked for. */
3
+ export interface PhotoPick {
4
+ images: File[];
5
+ videos: WebPickedVideo[];
6
+ }
1
7
  /**
2
8
  * The photos of the device, picked in the library itself as WeChat's Album does: the Ta app on iOS opens it at once
3
9
  * (PHPicker, which asks for no permission), where a file field shows a menu first (Photo Library, Take Photo,
@@ -7,9 +13,11 @@ export declare namespace PhotoPicker {
7
13
  /** Whether the library opens at once here. */
8
14
  function available(): boolean;
9
15
  /**
10
- * Up to `limit` photos, in the order picked; none when the user cancels. Not timed out: the user takes the time
11
- * they need, and a pick started again ends the one before with none.
16
+ * Up to `limit` photos (and videos, with `videos`), in the order picked; none when the user cancels. Not timed
17
+ * out: the user takes the time they need, and a pick started again ends the one before with none.
12
18
  */
13
- function pick(limit: number): Promise<File[]>;
19
+ function pick(limit: number, videos?: boolean): Promise<PhotoPick>;
20
+ /** Picks, the photos to `images`, the videos to `videos` (asked for only with it). */
21
+ function pickInto(limit: number, images: (files: File[]) => void, videos?: (videos: WebPickedVideo[]) => void): void;
14
22
  }
15
23
  //# sourceMappingURL=photo-picker.d.ts.map
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.PhotoPicker = void 0;
4
4
  const recent_shots_1 = require("./recent-shots");
5
+ const video_picks_1 = require("./video-picks");
5
6
  /**
6
7
  * The photos of the device, picked in the library itself as WeChat's Album does: the Ta app on iOS opens it at once
7
8
  * (PHPicker, which asks for no permission), where a file field shows a menu first (Photo Library, Take Photo,
@@ -20,13 +21,13 @@ var PhotoPicker;
20
21
  }
21
22
  PhotoPicker.available = available;
22
23
  /**
23
- * Up to `limit` photos, in the order picked; none when the user cancels. Not timed out: the user takes the time
24
- * they need, and a pick started again ends the one before with none.
24
+ * Up to `limit` photos (and videos, with `videos`), in the order picked; none when the user cancels. Not timed
25
+ * out: the user takes the time they need, and a pick started again ends the one before with none.
25
26
  */
26
- function pick(limit) {
27
+ function pick(limit, videos = false) {
27
28
  const photos = native();
28
29
  if (!photos) {
29
- return Promise.resolve([]);
30
+ return Promise.resolve({ images: [], videos: [] });
30
31
  }
31
32
  const id = `p${++next}`;
32
33
  return new Promise(resolve => {
@@ -37,15 +38,31 @@ var PhotoPicker;
37
38
  }
38
39
  globalThis.removeEventListener(recent_shots_1.RecentShots.EVENT, onEvent);
39
40
  const images = Array.isArray(detail.images) ? detail.images : [];
40
- resolve(images
41
- .filter((image) => typeof image === 'string')
42
- .map((image, index) => recent_shots_1.RecentShots.file(image, `photo-${index + 1}`))
43
- .filter((file) => file !== undefined));
41
+ const kept = Array.isArray(detail.videos) ? detail.videos : [];
42
+ resolve({
43
+ images: images
44
+ .filter((image) => typeof image === 'string')
45
+ .map((image, index) => recent_shots_1.RecentShots.file(image, `photo-${index + 1}`))
46
+ .filter((file) => file !== undefined),
47
+ videos: kept.filter((video) => typeof (video === null || video === void 0 ? void 0 : video.url) === 'string').map(video_picks_1.VideoPicks.ofNative),
48
+ });
44
49
  };
45
50
  globalThis.addEventListener(recent_shots_1.RecentShots.EVENT, onEvent);
46
- photos.postMessage({ id, action: 'pick', limit: Math.max(1, limit) });
51
+ photos.postMessage({ id, action: 'pick', limit: Math.max(1, limit), ...(videos ? { videos: true } : {}) });
47
52
  });
48
53
  }
49
54
  PhotoPicker.pick = pick;
55
+ /** Picks, the photos to `images`, the videos to `videos` (asked for only with it). */
56
+ function pickInto(limit, images, videos) {
57
+ void pick(limit, !!videos).then(picked => {
58
+ if (picked.images.length) {
59
+ images(picked.images);
60
+ }
61
+ if (picked.videos.length) {
62
+ videos === null || videos === void 0 ? void 0 : videos(picked.videos);
63
+ }
64
+ });
65
+ }
66
+ PhotoPicker.pickInto = pickInto;
50
67
  })(PhotoPicker || (exports.PhotoPicker = PhotoPicker = {}));
51
68
  //# sourceMappingURL=photo-picker.js.map
@@ -0,0 +1,25 @@
1
+ import type { WebPickedVideo } from '../extension/web-api-components';
2
+ /** A video as the Ta app on iOS hands it from its picker (TaVideos.swift): an address of the app to read it at. */
3
+ export interface NativeVideo {
4
+ url: string;
5
+ name?: string;
6
+ type?: string;
7
+ bytes?: number;
8
+ }
9
+ /**
10
+ * The videos the message box takes with the pictures (WebComposerProps.videos), as WeChat's album: a file of a
11
+ * field, or one the picker of the Ta app on iOS kept, which it also makes smaller there, as WeChat sends a video.
12
+ */
13
+ export declare namespace VideoPicks {
14
+ function isVideo(file: Pick<File, 'type'>): boolean;
15
+ /** What of the files pasted the box takes: the pictures, and the videos when it takes them. */
16
+ function pasted(files: FileList, videos: boolean): File[];
17
+ /** What a field of files takes: the pictures, and the videos when the box takes them. */
18
+ function accept(images: readonly string[], videos: boolean): string;
19
+ /** Hands the videos among `files` to `take` (none without it), and returns the rest. */
20
+ function take(files: FileList | readonly File[], take?: (videos: WebPickedVideo[]) => void): File[];
21
+ function ofFile(file: File): WebPickedVideo;
22
+ /** One kept by the app's picker: read at its address, made smaller by the app. */
23
+ function ofNative(video: NativeVideo): WebPickedVideo;
24
+ }
25
+ //# sourceMappingURL=video-picks.d.ts.map
@@ -0,0 +1,107 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.VideoPicks = void 0;
4
+ const recent_shots_1 = require("./recent-shots");
5
+ /**
6
+ * The videos the message box takes with the pictures (WebComposerProps.videos), as WeChat's album: a file of a
7
+ * field, or one the picker of the Ta app on iOS kept, which it also makes smaller there, as WeChat sends a video.
8
+ */
9
+ var VideoPicks;
10
+ (function (VideoPicks) {
11
+ let next = 0;
12
+ function isVideo(file) {
13
+ return file.type.startsWith('video/');
14
+ }
15
+ VideoPicks.isVideo = isVideo;
16
+ /** What of the files pasted the box takes: the pictures, and the videos when it takes them. */
17
+ function pasted(files, videos) {
18
+ return Array.from(files).filter(file => file.type.startsWith('image/') || (videos && isVideo(file)));
19
+ }
20
+ VideoPicks.pasted = pasted;
21
+ /** What a field of files takes: the pictures, and the videos when the box takes them. */
22
+ function accept(images, videos) {
23
+ return videos ? [...images, 'video/*'].join(',') : images.join(',');
24
+ }
25
+ VideoPicks.accept = accept;
26
+ /** Hands the videos among `files` to `take` (none without it), and returns the rest. */
27
+ function take(files, take) {
28
+ const all = Array.from(files);
29
+ const videos = take ? all.filter(isVideo) : [];
30
+ if (videos.length) {
31
+ take === null || take === void 0 ? void 0 : take(videos.map(ofFile));
32
+ }
33
+ return all.filter(file => !videos.includes(file));
34
+ }
35
+ VideoPicks.take = take;
36
+ function ofFile(file) {
37
+ return { name: file.name, type: file.type, bytes: file.size, read: async () => file };
38
+ }
39
+ VideoPicks.ofFile = ofFile;
40
+ /** One kept by the app's picker: read at its address, made smaller by the app. */
41
+ function ofNative(video) {
42
+ const read = async (url) => {
43
+ const response = await fetch(url);
44
+ if (!response.ok) {
45
+ throw new Error(`The video could not be read (${response.status}).`);
46
+ }
47
+ return response.blob();
48
+ };
49
+ return {
50
+ name: video.name || 'video.mov',
51
+ type: video.type || 'video/quicktime',
52
+ ...(typeof video.bytes === 'number' ? { bytes: video.bytes } : {}),
53
+ read: () => read(video.url),
54
+ shrink: (limit, progress, signal) => shrinkNative(video.url, limit, progress, signal).then(read),
55
+ };
56
+ }
57
+ VideoPicks.ofNative = ofNative;
58
+ function native() {
59
+ var _a, _b;
60
+ return (_b = (_a = globalThis.webkit) === null || _a === void 0 ? void 0 : _a.messageHandlers) === null || _b === void 0 ? void 0 : _b.taShots;
61
+ }
62
+ /** The app makes the video at `url` smaller: the address of what it wrote. */
63
+ function shrinkNative(url, limit, progress, signal) {
64
+ const videos = native();
65
+ if (!videos) {
66
+ return Promise.reject(new Error('Not in the Ta app.'));
67
+ }
68
+ const id = `v${++next}`;
69
+ return new Promise((resolve, reject) => {
70
+ const end = () => {
71
+ globalThis.removeEventListener(recent_shots_1.RecentShots.EVENT, onEvent);
72
+ signal.removeEventListener('abort', onAbort);
73
+ };
74
+ const onEvent = (event) => {
75
+ const detail = event.detail;
76
+ if ((detail === null || detail === void 0 ? void 0 : detail.id) !== id) {
77
+ return;
78
+ }
79
+ if (typeof detail.progress === 'number') {
80
+ progress(detail.progress);
81
+ }
82
+ else {
83
+ end();
84
+ if (detail.url) {
85
+ resolve(detail.url);
86
+ }
87
+ else {
88
+ reject(new Error(detail.error || 'The video could not be made smaller.'));
89
+ }
90
+ }
91
+ };
92
+ const onAbort = () => {
93
+ end();
94
+ videos.postMessage({ id, action: 'cancelShrink' });
95
+ reject(new DOMException('Aborted', 'AbortError'));
96
+ };
97
+ if (signal.aborted) {
98
+ onAbort();
99
+ return;
100
+ }
101
+ globalThis.addEventListener(recent_shots_1.RecentShots.EVENT, onEvent);
102
+ signal.addEventListener('abort', onAbort);
103
+ videos.postMessage({ id, action: 'shrinkVideo', url, limit });
104
+ });
105
+ }
106
+ })(VideoPicks || (exports.VideoPicks = VideoPicks = {}));
107
+ //# sourceMappingURL=video-picks.js.map
@@ -128,6 +128,7 @@ exports.WEB_ICONS = Object.freeze({
128
128
  Plus: lucide_react_1.Plus,
129
129
  Pointer: lucide_react_1.Pointer,
130
130
  Power: lucide_react_1.Power,
131
+ Presentation: lucide_react_1.Presentation,
131
132
  Puzzle: lucide_react_1.Puzzle,
132
133
  Quote: lucide_react_1.Quote,
133
134
  QrCode: lucide_react_1.QrCode,
@@ -147,6 +148,7 @@ exports.WEB_ICONS = Object.freeze({
147
148
  Send: lucide_react_1.Send,
148
149
  Server: lucide_react_1.Server,
149
150
  Share2: lucide_react_1.Share2,
151
+ Sheet: lucide_react_1.Sheet,
150
152
  Shield: lucide_react_1.Shield,
151
153
  ShieldAlert: lucide_react_1.ShieldAlert,
152
154
  ShieldCheck: lucide_react_1.ShieldCheck,
@@ -19,13 +19,16 @@ var WebAccessUtil;
19
19
  WebAccessUtil.granted = granted;
20
20
  /** Where it came from, as the user knows it: never a link itself, whose key opens what it shares. */
21
21
  function source(info, say) {
22
- var _a, _b;
22
+ var _a, _b, _c;
23
23
  if (((_a = info.temporary) === null || _a === void 0 ? void 0 : _a.from) === 'link') {
24
24
  return say('ta.access.fromLink');
25
25
  }
26
26
  if (((_b = info.temporary) === null || _b === void 0 ? void 0 : _b.from) === 'market') {
27
27
  return say('ta.access.fromMarket');
28
28
  }
29
+ if (((_c = info.temporary) === null || _c === void 0 ? void 0 : _c.from) === 'agent') {
30
+ return say('ta.access.fromAgent');
31
+ }
29
32
  return info.source;
30
33
  }
31
34
  WebAccessUtil.source = source;
@@ -0,0 +1,37 @@
1
+ /** Part of the web extension API (web-extension-api.ts, which exports it all): the fenced blocks extensions draw. */
2
+ import type { TaWorkPoint } from '@celljs/ta-protocol';
3
+ /** What else a code renderer says of its blocks (WebExtensionAPI.registerCodeRenderer). */
4
+ export interface WebCodeRendererOptions {
5
+ /**
6
+ * What of a block is said aloud, in a call or a reply read out (SpokenReply), the rest being on the screen: what
7
+ * the user must hear (a choice to make, a failure, a risk), in a sentence or two; nothing for none. Its code is whole.
8
+ */
9
+ spoken?(code: string): string | undefined;
10
+ pointable?: boolean;
11
+ }
12
+ /** A fenced block of the language of a code renderer (WebExtensionAPI.registerCodeRenderer). */
13
+ export interface WebCodeRendererProps {
14
+ /** Its lines, as written. */
15
+ code: string;
16
+ /** As written after the fence. */
17
+ language: string;
18
+ /** False while the reply still streams it: the code may stop anywhere. */
19
+ closed: boolean;
20
+ /**
21
+ * Sends words as the user to the conversation the block is in (after its turn, if it works): a choice in it
22
+ * answered with a tap. None where no conversation holds the block (`ui.Markdown` of a page given none). Newer than some
23
+ * Ta apps, whose props have no `send`: there `pi.sendUserMessage` reaches the conversation shown.
24
+ */
25
+ send?: (text: string) => Promise<void>;
26
+ /**
27
+ * What the user said after the reply the block is in, once they did: a choice it offers was made (the words sent
28
+ * by `send`, or typed). None while they did not answer, and where no conversation holds the block. Newer than
29
+ * some Ta apps.
30
+ */
31
+ answer?: string;
32
+ conversation?: string;
33
+ embedded?: boolean;
34
+ point?: (point: TaWorkPoint) => void;
35
+ }
36
+ /** pi's custom message, as the conversation holds it. */
37
+ //# sourceMappingURL=web-api-code.d.ts.map
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ /** pi's custom message, as the conversation holds it. */
4
+ //# sourceMappingURL=web-api-code.js.map
@@ -329,6 +329,23 @@ export interface WebTranscribing {
329
329
  /** Ends it: the words heard so far come as final, then `onEnd`. */
330
330
  stop(): void;
331
331
  }
332
+ /**
333
+ * A video picked in the message box (WebComposerProps.videos), with the pictures as WeChat's album does: read as it
334
+ * is, or made smaller on the device where it can be (the Ta app on iOS).
335
+ */
336
+ export interface WebPickedVideo {
337
+ name: string;
338
+ type: string;
339
+ /** Its size in bytes, when known before it is read. */
340
+ bytes?: number;
341
+ /** Its bytes as they are. */
342
+ read(): Promise<Blob>;
343
+ /**
344
+ * Made smaller on the device to fit in `limit` bytes, `progress` from 0 to 1; rejects as `signal` aborts, or when
345
+ * it cannot. None where the device cannot: the computer makes it smaller, or it goes as it is.
346
+ */
347
+ shrink?(limit: number, progress: (done: number) => void, signal: AbortSignal): Promise<Blob>;
348
+ }
332
349
  export interface WebComposerProps {
333
350
  placeholder?: string;
334
351
  /**
@@ -342,6 +359,11 @@ export interface WebComposerProps {
342
359
  * Newer than some Ta apps, which take none.
343
360
  */
344
361
  images?: boolean | WebComposerImageLimits;
362
+ /**
363
+ * Videos are picked with the pictures (the album, the camera), pasted and dropped, and handed here as they come,
364
+ * never in the box. Newer than some Ta apps (`ui.composerVideos` says the box takes it).
365
+ */
366
+ videos?(videos: WebPickedVideo[]): void;
345
367
  /** An emoji button on the right of the field, as WeChat's: on a phone its panel takes the place of the keyboard. Newer than some Ta apps. */
346
368
  emoji?: boolean;
347
369
  /** The field takes the focus as the box shows (the keyboard comes up on a phone), as a box opened to comment. Newer than some Ta apps. */
@@ -482,37 +482,6 @@ export interface WebTaskEntry extends WebTask {
482
482
  /** The name of the extension it is of. */
483
483
  extension: string;
484
484
  }
485
- /** What else a code renderer says of its blocks (WebExtensionAPI.registerCodeRenderer). */
486
- export interface WebCodeRendererOptions {
487
- /**
488
- * What of a block is said aloud, in a call or a reply read out (SpokenReply), the rest being on the screen: what
489
- * the user must hear (a choice to make, a failure, a risk), in a sentence or two; nothing for none. Its code is whole.
490
- */
491
- spoken?(code: string): string | undefined;
492
- }
493
- /** A fenced block of the language of a code renderer (WebExtensionAPI.registerCodeRenderer). */
494
- export interface WebCodeRendererProps {
495
- /** Its lines, as written. */
496
- code: string;
497
- /** As written after the fence. */
498
- language: string;
499
- /** False while the reply still streams it: the code may stop anywhere. */
500
- closed: boolean;
501
- /**
502
- * Sends words as the user to the conversation the block is in (after its turn, if it works): a choice in it
503
- * answered with a tap. None where no conversation holds the block (`ui.Markdown` of a page given none). Newer than some
504
- * Ta apps, whose props have no `send`: there `pi.sendUserMessage` reaches the conversation shown.
505
- */
506
- send?: (text: string) => Promise<void>;
507
- /**
508
- * What the user said after the reply the block is in, once they did: a choice it offers was made (the words sent
509
- * by `send`, or typed). None while they did not answer, and where no conversation holds the block. Newer than
510
- * some Ta apps.
511
- */
512
- answer?: string;
513
- conversation?: string;
514
- embedded?: boolean;
515
- }
516
485
  /** pi's custom message, as the conversation holds it. */
517
486
  export interface WebCustomMessage {
518
487
  role: 'custom';
@@ -1,4 +1,5 @@
1
1
  /** Part of the web extension API (web-extension-api.ts, which exports it all): the entries extensions add to menus of the page. */
2
+ import type { TaWorkPoint } from '@celljs/ta-protocol';
2
3
  import type { WebMenuItem } from './web-api-contributions';
3
4
  /** A conversation as a list shows it: an open one has its session, one kept on the disk its file only. */
4
5
  export interface WebSessionRef {
@@ -12,11 +13,11 @@ export interface WebSessionRef {
12
13
  }
13
14
  /** The entries an extension adds to the menu of a conversation of a list (registerSessionMenu); none for some. */
14
15
  export type WebSessionMenu = (session: WebSessionRef) => WebMenuItem[];
15
- /** A file or a folder of a workspace, as a list of files (the explorer) shows it. */
16
+ /** A file or a folder of a workspace, as a list of files (the explorer) or a turn that changed it shows it. */
16
17
  export interface WebFileRef {
17
18
  /** The directory of the workspace: a path, or `ssh://…` (TaLocation). */
18
19
  cwd: string;
19
- /** Relative to `cwd`, with `/`. */
20
+ /** Relative to `cwd`, with `/`; absolute for a file a turn changed outside `cwd` (TaWorkspaceServer.fileUrl serves it alone). */
20
21
  path: string;
21
22
  name: string;
22
23
  kind: 'file' | 'directory';
@@ -24,6 +25,23 @@ export interface WebFileRef {
24
25
  }
25
26
  /** The entries an extension adds to the menu of a file or a folder of a list of files (registerFileMenu); none for some. */
26
27
  export type WebFileMenu = (file: WebFileRef) => WebMenuItem[];
28
+ /** A block of code as a reply shows it (a fenced block of Markdown, a command a tool ran). */
29
+ export interface WebCodeRef {
30
+ /** As the fence names it, in lower case; empty for none. */
31
+ language: string;
32
+ code: string;
33
+ /** Drawn by a renderer (registerCodeRenderer), once its fence ended: its actions are buttons with their words under it. */
34
+ drawn?: boolean;
35
+ /** The file of the conversation it is in, when it is drawn in one. */
36
+ conversation?: string;
37
+ /**
38
+ * Of a block drawn by a renderer that tells its parts apart (WebCodeRendererOptions.pointable): lets the user
39
+ * point at one, the page saying so above it; the part tapped, or undefined when they gave up.
40
+ */
41
+ point?: () => Promise<TaWorkPoint | undefined>;
42
+ }
43
+ /** The actions an extension adds to a block of code (registerCodeMenu); none for some. */
44
+ export type WebCodeMenu = (block: WebCodeRef) => WebMenuItem[];
27
45
  /** What a web extension adds to the menus of the page (WebExtensionAPI extends it). */
28
46
  export interface WebMenus {
29
47
  /**
@@ -33,9 +51,17 @@ export interface WebMenus {
33
51
  registerSessionMenu(menu: WebSessionMenu): void;
34
52
  /**
35
53
  * Entries of the menu of a file or a folder where a list of files shows it (the explorer: a right click or a held
36
- * finger on its row), in a section of their own: read each time the menu opens. Newer than some Ta apps:
54
+ * finger on its row; the files a turn changed; the tab of a file in the workbench), in a section of their own: read
55
+ * each time the menu opens. Newer than some Ta apps:
37
56
  * `pi.registerFileMenu?.(…)`.
38
57
  */
39
58
  registerFileMenu(menu: WebFileMenu): void;
59
+ /**
60
+ * Actions of a block of code (a fenced block of a reply, a command a tool ran): of one drawn as code, each a button
61
+ * by its icon beside Copy (one without an icon is not drawn); of one a renderer drew (`drawn`), a button with its
62
+ * words under it. Read each time the block is drawn.
63
+ * Newer than some Ta apps: `pi.registerCodeMenu?.(…)`.
64
+ */
65
+ registerCodeMenu(menu: WebCodeMenu): void;
40
66
  }
41
67
  //# sourceMappingURL=web-api-menus.d.ts.map