@celljs/ta-web 4.22.0 → 4.24.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 (177) hide show
  1. package/esm/browser/assistant/assistant-chat-list.js +3 -1
  2. package/esm/browser/assistant/assistant-conversation.js +1 -1
  3. package/esm/browser/assistant/assistant-initiative.d.ts +5 -1
  4. package/esm/browser/assistant/assistant-initiative.js +11 -3
  5. package/esm/browser/assistant/call-keeper.d.ts +2 -1
  6. package/esm/browser/assistant/call-keeper.js +4 -2
  7. package/esm/browser/assistant/call-screen.d.ts +1 -1
  8. package/esm/browser/assistant/call-turn-end.d.ts +11 -2
  9. package/esm/browser/assistant/call-turn-end.js +21 -5
  10. package/esm/browser/assistant/read-aloud.d.ts +1 -1
  11. package/esm/browser/assistant/realtime-voice.d.ts +1 -1
  12. package/esm/browser/assistant/voice-call-bar.d.ts +5 -2
  13. package/esm/browser/assistant/voice-call-bar.js +12 -0
  14. package/esm/browser/assistant/voice-call-protocol.d.ts +78 -0
  15. package/esm/browser/assistant/voice-call-protocol.js +2 -0
  16. package/esm/browser/assistant/voice-call.d.ts +17 -65
  17. package/esm/browser/assistant/voice-call.js +45 -1
  18. package/esm/browser/assistant/voice-reopen.d.ts +1 -1
  19. package/esm/browser/components/account-menu.js +28 -7
  20. package/esm/browser/components/app-shell-state.js +2 -1
  21. package/esm/browser/components/app-view.js +15 -7
  22. package/esm/browser/components/chat-home-util.d.ts +7 -0
  23. package/esm/browser/components/chat-home-util.js +10 -0
  24. package/esm/browser/components/chat-home.d.ts +3 -1
  25. package/esm/browser/components/chat-home.js +3 -2
  26. package/esm/browser/components/chat-list-util.d.ts +15 -3
  27. package/esm/browser/components/chat-list-util.js +26 -4
  28. package/esm/browser/components/chat-list.js +4 -3
  29. package/esm/browser/components/chat-seen.d.ts +4 -3
  30. package/esm/browser/components/chat-seen.js +6 -5
  31. package/esm/browser/components/chats-dot.d.ts +30 -0
  32. package/esm/browser/components/chats-dot.js +32 -0
  33. package/esm/browser/components/cloud-sign-in-view.d.ts +1 -1
  34. package/esm/browser/components/earlier-messages.d.ts +4 -0
  35. package/esm/browser/components/earlier-messages.js +10 -2
  36. package/esm/browser/components/host-view.d.ts +1 -1
  37. package/esm/browser/components/message-footer.d.ts +0 -2
  38. package/esm/browser/components/message-footer.js +1 -8
  39. package/esm/browser/components/message-images.d.ts +22 -0
  40. package/esm/browser/components/message-images.js +90 -1
  41. package/esm/browser/components/message-steps.js +9 -0
  42. package/esm/browser/components/message-user.js +8 -1
  43. package/esm/browser/components/partner-row-util.d.ts +28 -0
  44. package/esm/browser/components/partner-row-util.js +45 -0
  45. package/esm/browser/components/partner-row.d.ts +4 -3
  46. package/esm/browser/components/partner-row.js +21 -9
  47. package/esm/browser/components/profile-view.d.ts +2 -2
  48. package/esm/browser/components/profile-view.js +6 -3
  49. package/esm/browser/components/settings-files.d.ts +7 -0
  50. package/esm/browser/components/settings-files.js +61 -0
  51. package/esm/browser/components/settings-more.js +2 -0
  52. package/esm/browser/components/tool-view.js +23 -7
  53. package/esm/browser/components/web-composer.d.ts +5 -2
  54. package/esm/browser/components/web-composer.js +10 -5
  55. package/esm/browser/extension/extension-view.js +2 -2
  56. package/esm/browser/extension/icons.js +4 -1
  57. package/esm/browser/extension/web-api-call.d.ts +45 -0
  58. package/esm/browser/extension/web-api-call.js +2 -0
  59. package/esm/browser/extension/web-api-components.d.ts +37 -2
  60. package/esm/browser/extension/web-api-contributions.d.ts +4 -32
  61. package/esm/browser/extension/web-api-partners.d.ts +27 -2
  62. package/esm/browser/extension/web-extension-api.d.ts +9 -12
  63. package/esm/browser/extension/web-extension-context.d.ts +2 -3
  64. package/esm/browser/extension/web-extension-context.js +5 -5
  65. package/esm/browser/extension/web-view-util.d.ts +5 -0
  66. package/esm/browser/extension/web-view-util.js +8 -0
  67. package/esm/browser/i18n/locales.d.ts +18 -1
  68. package/esm/browser/i18n/messages-ja.js +17 -0
  69. package/esm/browser/i18n/messages-zh-tw.js +17 -0
  70. package/esm/browser/i18n/messages.d.ts +17 -0
  71. package/esm/browser/i18n/messages.js +34 -0
  72. package/esm/browser/partners/partners-extension.js +17 -0
  73. package/esm/browser/partners/partners-util.d.ts +6 -0
  74. package/esm/browser/partners/partners-util.js +9 -0
  75. package/esm/browser/style/chat-list.d.ts +1 -1
  76. package/esm/browser/style/chat-list.js +3 -0
  77. package/esm/browser/style/conversation-column.d.ts +1 -1
  78. package/esm/browser/style/conversation-column.js +21 -0
  79. package/esm/browser/style/conversation.d.ts +1 -1
  80. package/esm/browser/style/conversation.js +3 -2
  81. package/esm/browser/style/pages.d.ts +1 -1
  82. package/esm/browser/style/pages.js +8 -0
  83. package/esm/browser/style/shell.d.ts +1 -1
  84. package/esm/browser/style/shell.js +1 -1
  85. package/esm/browser/util/image-shrink.d.ts +26 -0
  86. package/esm/browser/util/image-shrink.js +60 -0
  87. package/esm/browser/util/process.d.ts +10 -4
  88. package/esm/browser/util/process.js +45 -18
  89. package/lib/browser/assistant/assistant-chat-list.js +3 -1
  90. package/lib/browser/assistant/assistant-conversation.js +1 -1
  91. package/lib/browser/assistant/assistant-initiative.d.ts +5 -1
  92. package/lib/browser/assistant/assistant-initiative.js +11 -3
  93. package/lib/browser/assistant/call-keeper.d.ts +2 -1
  94. package/lib/browser/assistant/call-keeper.js +4 -2
  95. package/lib/browser/assistant/call-screen.d.ts +1 -1
  96. package/lib/browser/assistant/call-turn-end.d.ts +11 -2
  97. package/lib/browser/assistant/call-turn-end.js +22 -6
  98. package/lib/browser/assistant/read-aloud.d.ts +1 -1
  99. package/lib/browser/assistant/realtime-voice.d.ts +1 -1
  100. package/lib/browser/assistant/voice-call-bar.d.ts +5 -2
  101. package/lib/browser/assistant/voice-call-bar.js +12 -0
  102. package/lib/browser/assistant/voice-call-protocol.d.ts +79 -0
  103. package/lib/browser/assistant/voice-call-protocol.js +3 -0
  104. package/lib/browser/assistant/voice-call.d.ts +17 -65
  105. package/lib/browser/assistant/voice-call.js +45 -1
  106. package/lib/browser/assistant/voice-reopen.d.ts +1 -1
  107. package/lib/browser/components/account-menu.js +27 -6
  108. package/lib/browser/components/app-shell-state.js +2 -1
  109. package/lib/browser/components/app-view.js +15 -7
  110. package/lib/browser/components/chat-home-util.d.ts +7 -0
  111. package/lib/browser/components/chat-home-util.js +10 -0
  112. package/lib/browser/components/chat-home.d.ts +3 -1
  113. package/lib/browser/components/chat-home.js +3 -2
  114. package/lib/browser/components/chat-list-util.d.ts +15 -3
  115. package/lib/browser/components/chat-list-util.js +26 -4
  116. package/lib/browser/components/chat-list.js +4 -3
  117. package/lib/browser/components/chat-seen.d.ts +4 -3
  118. package/lib/browser/components/chat-seen.js +6 -5
  119. package/lib/browser/components/chats-dot.d.ts +31 -0
  120. package/lib/browser/components/chats-dot.js +68 -0
  121. package/lib/browser/components/cloud-sign-in-view.d.ts +1 -1
  122. package/lib/browser/components/earlier-messages.d.ts +4 -0
  123. package/lib/browser/components/earlier-messages.js +10 -2
  124. package/lib/browser/components/host-view.d.ts +1 -1
  125. package/lib/browser/components/message-footer.d.ts +0 -2
  126. package/lib/browser/components/message-footer.js +0 -8
  127. package/lib/browser/components/message-images.d.ts +22 -0
  128. package/lib/browser/components/message-images.js +92 -2
  129. package/lib/browser/components/message-steps.js +9 -0
  130. package/lib/browser/components/message-user.js +7 -0
  131. package/lib/browser/components/partner-row-util.d.ts +29 -0
  132. package/lib/browser/components/partner-row-util.js +48 -0
  133. package/lib/browser/components/partner-row.d.ts +4 -3
  134. package/lib/browser/components/partner-row.js +21 -9
  135. package/lib/browser/components/profile-view.d.ts +2 -2
  136. package/lib/browser/components/profile-view.js +6 -3
  137. package/lib/browser/components/settings-files.d.ts +8 -0
  138. package/lib/browser/components/settings-files.js +97 -0
  139. package/lib/browser/components/settings-more.js +2 -0
  140. package/lib/browser/components/tool-view.js +23 -7
  141. package/lib/browser/components/web-composer.d.ts +5 -2
  142. package/lib/browser/components/web-composer.js +10 -5
  143. package/lib/browser/extension/extension-view.js +2 -2
  144. package/lib/browser/extension/icons.js +3 -0
  145. package/lib/browser/extension/web-api-call.d.ts +46 -0
  146. package/lib/browser/extension/web-api-call.js +3 -0
  147. package/lib/browser/extension/web-api-components.d.ts +37 -2
  148. package/lib/browser/extension/web-api-contributions.d.ts +4 -32
  149. package/lib/browser/extension/web-api-partners.d.ts +27 -2
  150. package/lib/browser/extension/web-extension-api.d.ts +9 -12
  151. package/lib/browser/extension/web-extension-context.d.ts +2 -3
  152. package/lib/browser/extension/web-extension-context.js +5 -5
  153. package/lib/browser/extension/web-view-util.d.ts +5 -0
  154. package/lib/browser/extension/web-view-util.js +8 -0
  155. package/lib/browser/i18n/locales.d.ts +18 -1
  156. package/lib/browser/i18n/messages-ja.js +17 -0
  157. package/lib/browser/i18n/messages-zh-tw.js +17 -0
  158. package/lib/browser/i18n/messages.d.ts +17 -0
  159. package/lib/browser/i18n/messages.js +34 -0
  160. package/lib/browser/partners/partners-extension.js +17 -0
  161. package/lib/browser/partners/partners-util.d.ts +6 -0
  162. package/lib/browser/partners/partners-util.js +9 -0
  163. package/lib/browser/style/chat-list.d.ts +1 -1
  164. package/lib/browser/style/chat-list.js +3 -0
  165. package/lib/browser/style/conversation-column.d.ts +1 -1
  166. package/lib/browser/style/conversation-column.js +21 -0
  167. package/lib/browser/style/conversation.d.ts +1 -1
  168. package/lib/browser/style/conversation.js +3 -2
  169. package/lib/browser/style/pages.d.ts +1 -1
  170. package/lib/browser/style/pages.js +8 -0
  171. package/lib/browser/style/shell.d.ts +1 -1
  172. package/lib/browser/style/shell.js +1 -1
  173. package/lib/browser/util/image-shrink.d.ts +27 -0
  174. package/lib/browser/util/image-shrink.js +63 -0
  175. package/lib/browser/util/process.d.ts +10 -4
  176. package/lib/browser/util/process.js +45 -18
  177. package/package.json +7 -7
@@ -28,6 +28,11 @@ export declare namespace UserImageUtil {
28
28
  height: number;
29
29
  } | undefined): React.CSSProperties | undefined;
30
30
  }
31
+ /** From this many pictures at once, a message shows them stacked, as WeChat does, until the user unfolds them. */
32
+ export declare const STACK_FROM = 4;
33
+ export declare namespace ImageStackUtil {
34
+ function stacked(count: number, key: string | undefined): boolean;
35
+ }
31
36
  /**
32
37
  * The images of a message of the user: one keeps its own shape at the size of a bubble, a few stand as
33
38
  * squares of one size, and a click on any of them opens it full size over the page. Each has its place
@@ -38,4 +43,21 @@ export declare function UserImages({ blocks, timestamp }: {
38
43
  blocks: Blocks;
39
44
  timestamp?: number;
40
45
  }): React.JSX.Element | null;
46
+ /** A picture of a chat of an extension (`ui.ChatImages`): its bytes as a URL once they are here, a thumbnail meanwhile. */
47
+ export interface ChatImage {
48
+ key: string;
49
+ src?: string;
50
+ thumb?: string;
51
+ width: number;
52
+ height: number;
53
+ }
54
+ /**
55
+ * The pictures of a message of a chat an extension draws (a group chat, a channel), as those of the user in a
56
+ * conversation: one alone in its shape, more in squares, full size over the page on a click, those still on their way
57
+ * blurred from their thumbnail.
58
+ */
59
+ export declare function ChatImages({ images, alt }: {
60
+ images: readonly ChatImage[];
61
+ alt?: string;
62
+ }): React.JSX.Element | null;
41
63
  export {};
@@ -90,6 +90,38 @@ function useImageSources(images, timestamp) {
90
90
  });
91
91
  return images.map(({ index }, at) => { var _a; return (_a = own[at]) !== null && _a !== void 0 ? _a : loaded[index]; });
92
92
  }
93
+ /** From this many pictures at once, a message shows them stacked, as WeChat does, until the user unfolds them. */
94
+ export const STACK_FROM = 4;
95
+ /** The messages whose pictures the user unfolded, by a key of each: they stay unfolded while the page lives. */
96
+ const unfolded = new Set();
97
+ export var ImageStackUtil;
98
+ (function (ImageStackUtil) {
99
+ function stacked(count, key) {
100
+ return count >= STACK_FROM && !(key !== undefined && unfolded.has(key));
101
+ }
102
+ ImageStackUtil.stacked = stacked;
103
+ })(ImageStackUtil || (ImageStackUtil = {}));
104
+ /**
105
+ * Pictures sent together, folded as WeChat folds them: the first in its own shape, two more peeking from behind it, and
106
+ * beside it a pill that unfolds them all (`展开 N`). A tap on the stack opens the first full size, the others beside it.
107
+ */
108
+ function ImageStack({ sources, first, count, onOpen, onUnfold, }) {
109
+ var _a;
110
+ const t = useT();
111
+ const box = (_a = UserImageUtil.box(first)) !== null && _a !== void 0 ? _a : { width: 160, aspectRatio: '4 / 3' };
112
+ const card = (at, className) => sources[at] ? React.createElement("img", { className: className, src: sources[at], alt: "", style: box }) : React.createElement("span", { className: `${className} ta-thumb-waiting`, style: box });
113
+ return (React.createElement("div", { className: "ta-image-stack" },
114
+ React.createElement("button", { type: "button", className: "ta-stack-unfold", onClick: onUnfold }, t('ta.images.expand', { count })),
115
+ React.createElement("button", { type: "button", className: "ta-stack-cards", title: t('ta.markdown.enlarge'), disabled: !sources[0], onClick: onOpen },
116
+ card(2, 'ta-stack-card ta-stack-right'),
117
+ card(1, 'ta-stack-card ta-stack-left'),
118
+ card(0, 'ta-stack-card ta-stack-front'))));
119
+ }
120
+ /** Folds pictures unfolded before, under the grid of them. */
121
+ function FoldButton({ onFold }) {
122
+ const t = useT();
123
+ return (React.createElement("button", { type: "button", className: "ta-stack-fold", onClick: onFold }, t('ta.images.collapse')));
124
+ }
93
125
  /**
94
126
  * The images of a message of the user: one keeps its own shape at the size of a bubble, a few stand as
95
127
  * squares of one size, and a click on any of them opens it full size over the page. Each has its place
@@ -102,11 +134,26 @@ export function UserImages({ blocks, timestamp }) {
102
134
  const [menu, openMenu] = useImageMenu();
103
135
  const images = UserImageUtil.images(blocks);
104
136
  const sources = useImageSources(images, timestamp);
137
+ const fold = timestamp === undefined ? undefined : `user:${timestamp}`;
138
+ const [, redraw] = React.useReducer((n) => n + 1, 0);
105
139
  if (images.length === 0) {
106
140
  return null;
107
141
  }
108
142
  const single = images.length === 1 ? UserImageUtil.box(UserImageUtil.size(images[0].block)) : undefined;
109
143
  const shown = open !== undefined ? sources[open] : undefined;
144
+ const lightbox = open !== undefined && shown && (React.createElement(Lightbox, { src: shown, alt: "", count: { at: open, of: images.length }, onClose: () => setOpen(undefined), onPrevious: open > 0 && sources[open - 1] ? () => setOpen(open - 1) : undefined, onNext: open < images.length - 1 && sources[open + 1] ? () => setOpen(open + 1) : undefined, previousSrc: open > 0 ? sources[open - 1] : undefined, nextSrc: sources[open + 1] }));
145
+ if (ImageStackUtil.stacked(images.length, fold)) {
146
+ return (React.createElement(React.Fragment, null,
147
+ React.createElement(ImageStack, { sources: sources, first: UserImageUtil.size(images[0].block), count: images.length, onOpen: () => setOpen(0), onUnfold: () => {
148
+ unfolded.add(fold !== null && fold !== void 0 ? fold : '');
149
+ redraw();
150
+ } }),
151
+ lightbox));
152
+ }
153
+ const folding = images.length >= STACK_FROM && fold ? (React.createElement(FoldButton, { onFold: () => {
154
+ unfolded.delete(fold);
155
+ redraw();
156
+ } })) : null;
110
157
  return (React.createElement("div", { className: "ta-user-images", "data-count": Math.min(images.length, 3), style: { '--ta-user-image-columns': GalleryUtil.columns(images.length) } },
111
158
  images.map(({ index }, at) => (React.createElement("button", { key: index, type: "button", className: "ta-user-image", title: t('ta.markdown.enlarge'), disabled: !sources[at], onClick: () => setOpen(at), onContextMenu: event => {
112
159
  const source = sources[at];
@@ -115,6 +162,48 @@ export function UserImages({ blocks, timestamp }) {
115
162
  }
116
163
  } }, sources[at] ? (React.createElement("img", { className: "ta-thumb", src: sources[at], alt: "", style: single })) : (React.createElement("span", { className: "ta-thumb ta-thumb-waiting", style: single }))))),
117
164
  menu,
118
- open !== undefined && shown && (React.createElement(Lightbox, { src: shown, alt: "", count: { at: open, of: images.length }, onClose: () => setOpen(undefined), onPrevious: open > 0 && sources[open - 1] ? () => setOpen(open - 1) : undefined, onNext: open < images.length - 1 && sources[open + 1] ? () => setOpen(open + 1) : undefined, previousSrc: open > 0 ? sources[open - 1] : undefined, nextSrc: sources[open + 1] }))));
165
+ lightbox,
166
+ folding));
167
+ }
168
+ /**
169
+ * The pictures of a message of a chat an extension draws (a group chat, a channel), as those of the user in a
170
+ * conversation: one alone in its shape, more in squares, full size over the page on a click, those still on their way
171
+ * blurred from their thumbnail.
172
+ */
173
+ export function ChatImages({ images, alt = '' }) {
174
+ var _a, _b, _c, _d, _e;
175
+ const t = useT();
176
+ const [open, setOpen] = React.useState();
177
+ const [menu, openMenu] = useImageMenu();
178
+ const [, redraw] = React.useReducer((n) => n + 1, 0);
179
+ if (images.length === 0) {
180
+ return null;
181
+ }
182
+ const fold = `chat:${images[0].key}`;
183
+ const single = images.length === 1 ? UserImageUtil.box({ width: images[0].width, height: images[0].height }) : undefined;
184
+ const shown = open !== undefined ? (_a = images[open]) === null || _a === void 0 ? void 0 : _a.src : undefined;
185
+ const lightbox = open !== undefined && shown && (React.createElement(Lightbox, { src: shown, alt: alt, count: { at: open, of: images.length }, onClose: () => setOpen(undefined), onPrevious: open > 0 && ((_b = images[open - 1]) === null || _b === void 0 ? void 0 : _b.src) ? () => setOpen(open - 1) : undefined, onNext: open < images.length - 1 && ((_c = images[open + 1]) === null || _c === void 0 ? void 0 : _c.src) ? () => setOpen(open + 1) : undefined, previousSrc: open > 0 ? (_d = images[open - 1]) === null || _d === void 0 ? void 0 : _d.src : undefined, nextSrc: (_e = images[open + 1]) === null || _e === void 0 ? void 0 : _e.src }));
186
+ if (ImageStackUtil.stacked(images.length, fold)) {
187
+ return (React.createElement(React.Fragment, null,
188
+ React.createElement(ImageStack, { sources: images.map(image => { var _a; return (_a = image.src) !== null && _a !== void 0 ? _a : image.thumb; }), first: { width: images[0].width, height: images[0].height }, count: images.length, onOpen: () => setOpen(0), onUnfold: () => {
189
+ unfolded.add(fold);
190
+ redraw();
191
+ } }),
192
+ lightbox));
193
+ }
194
+ return (React.createElement("div", { className: "ta-user-images ta-chat-images", "data-count": Math.min(images.length, 3), style: { '--ta-user-image-columns': GalleryUtil.columns(images.length) } },
195
+ images.map((image, at) => (React.createElement("button", { key: image.key, type: "button", className: "ta-user-image", title: image.src ? t('ta.markdown.enlarge') : alt, disabled: !image.src, onClick: () => setOpen(at), onContextMenu: event => {
196
+ const source = image.src;
197
+ if (source) {
198
+ openMenu(event, { full: () => source, enlarge: () => setOpen(at) });
199
+ }
200
+ } }, image.src ? (React.createElement("img", { className: "ta-thumb", src: image.src, alt: alt, style: single })) : image.thumb ? (React.createElement("span", { className: "ta-thumb ta-thumb-blurred", style: single },
201
+ React.createElement("img", { src: image.thumb, alt: "" }))) : (React.createElement("span", { className: "ta-thumb ta-thumb-waiting", style: single }))))),
202
+ menu,
203
+ lightbox,
204
+ images.length >= STACK_FROM && (React.createElement(FoldButton, { onFold: () => {
205
+ unfolded.delete(fold);
206
+ redraw();
207
+ } }))));
119
208
  }
120
209
  //# sourceMappingURL=message-images.js.map
@@ -48,6 +48,13 @@ const SaidStep = React.memo(function SaidStep({ message }) {
48
48
  React.createElement(MessageOrigin, { blocks: blocks })),
49
49
  React.createElement(UserSaid, { blocks: blocks, text: text, bubble: "ta-said-bubble", timestamp: message.timestamp })));
50
50
  });
51
+ /** Where Ta restarted in the middle of the work and went on with it: one quiet line on the string of the steps. */
52
+ function ResumedStep() {
53
+ const t = useT();
54
+ return (React.createElement("div", { className: "ta-step-resumed" },
55
+ React.createElement("span", { className: "ta-status ta-status-thought" }),
56
+ React.createElement("span", null, t('ta.message.resumed'))));
57
+ }
51
58
  const TextStep = React.memo(function TextStep({ text, streaming }) {
52
59
  return (React.createElement("div", { className: "ta-step-text" },
53
60
  React.createElement("span", { className: "ta-status ta-status-thought" }),
@@ -65,6 +72,8 @@ function Step({ step, results, tools, tagged, streaming, }) {
65
72
  return React.createElement(ErrorStep, { text: step.text });
66
73
  case 'said':
67
74
  return React.createElement(SaidStep, { message: step.message });
75
+ case 'resumed':
76
+ return React.createElement(ResumedStep, null);
68
77
  default:
69
78
  return React.createElement(ActView, { act: step, results: results, runs: tools });
70
79
  }
@@ -10,7 +10,7 @@ import { Face } from './face.js';
10
10
  import { Icon } from './icon.js';
11
11
  import { Markdown } from './markdown.js';
12
12
  import { UserFooter } from './message-footer.js';
13
- import { UserImages, UserImageUtil } from './message-images.js';
13
+ import { STACK_FROM, UserImages, UserImageUtil } from './message-images.js';
14
14
  import { useMessageMenu } from './message-menu.js';
15
15
  import { MessagePeople } from './people.js';
16
16
  import { SaidText } from './said-text.js';
@@ -50,6 +50,13 @@ export function UserSaid({ blocks, text, bubble = 'ta-bubble', timestamp }) {
50
50
  return text ? (React.createElement("div", { className: bubble },
51
51
  React.createElement(SaidText, { text: text }))) : null;
52
52
  }
53
+ // Many pictures stand on their own (folded, ImageStack, or unfolded), the words in a bubble of their own under them.
54
+ if (UserImageUtil.images(blocks).length >= STACK_FROM) {
55
+ return (React.createElement(React.Fragment, null,
56
+ React.createElement(UserImages, { blocks: blocks, timestamp: timestamp }),
57
+ text && (React.createElement("div", { className: bubble },
58
+ React.createElement(SaidText, { text: text })))));
59
+ }
53
60
  return (React.createElement("div", { className: `${bubble} ta-bubble-media${text ? '' : ' ta-bubble-bare'}` },
54
61
  React.createElement(UserImages, { blocks: blocks, timestamp: timestamp }),
55
62
  text && React.createElement(SaidText, { text: text, className: "ta-bubble-text" })));
@@ -0,0 +1,28 @@
1
+ import type { WebSwipeAction } from '../extension/web-api-components.js';
2
+ import type { WebMenuItem } from '../extension/web-api-contributions.js';
3
+ import type { WebPartner, WebPartnerKind } from '../extension/web-api-partners.js';
4
+ import type { MessageId } from '../i18n/messages.js';
5
+ /** An action of a row, as its menu and its swipe take it. */
6
+ interface RowAction {
7
+ label: string;
8
+ /** Behind the row, where the label is too long. */
9
+ short?: string;
10
+ run(): void;
11
+ }
12
+ /**
13
+ * What a partner's row offers, the same for every kind (docs/design/ta-partners.md): its menu is Open, Pin (a
14
+ * conversation of the double's list), its info; then its own; then what takes it away, in red. A swipe shows the first
15
+ * of these and that last: Pin and Delete chat in the double's list, Info and Remove on the page of the partners.
16
+ */
17
+ export declare namespace PartnerRowUtil {
18
+ function infoLabel(kind: WebPartnerKind): MessageId;
19
+ function infoShort(kind: WebPartnerKind): MessageId;
20
+ /**
21
+ * What takes it away where it is listed: in the double's list its conversation (a chat of two closed; a group chat
22
+ * left, its conversation being all of it); among the partners, the partner. None for one not a partner yet.
23
+ */
24
+ function away(partner: Pick<WebPartner, 'kind' | 'status' | 'chat' | 'remove'>, asChat: boolean): WebMenuItem | undefined;
25
+ /** Behind the row: Pin or Info first, what takes it away at the edge, in red. */
26
+ function swipe(pin: RowAction | undefined, info: RowAction | undefined, away: WebMenuItem | undefined): WebSwipeAction[];
27
+ }
28
+ export {};
@@ -0,0 +1,45 @@
1
+ /**
2
+ * What a partner's row offers, the same for every kind (docs/design/ta-partners.md): its menu is Open, Pin (a
3
+ * conversation of the double's list), its info; then its own; then what takes it away, in red. A swipe shows the first
4
+ * of these and that last: Pin and Delete chat in the double's list, Info and Remove on the page of the partners.
5
+ */
6
+ export var PartnerRowUtil;
7
+ (function (PartnerRowUtil) {
8
+ const INFO = {
9
+ agent: 'ta.partners.infoAgent',
10
+ friend: 'ta.partners.infoFriend',
11
+ group: 'ta.partners.infoGroup',
12
+ };
13
+ function infoLabel(kind) {
14
+ return INFO[kind];
15
+ }
16
+ PartnerRowUtil.infoLabel = infoLabel;
17
+ function infoShort(kind) {
18
+ return kind === 'group' ? 'ta.partners.infoShortGroup' : 'ta.partners.infoShort';
19
+ }
20
+ PartnerRowUtil.infoShort = infoShort;
21
+ /**
22
+ * What takes it away where it is listed: in the double's list its conversation (a chat of two closed; a group chat
23
+ * left, its conversation being all of it); among the partners, the partner. None for one not a partner yet.
24
+ */
25
+ function away(partner, asChat) {
26
+ var _a;
27
+ var _b;
28
+ if (partner.status) {
29
+ return undefined;
30
+ }
31
+ if (asChat) {
32
+ return (_b = (_a = partner.chat) === null || _a === void 0 ? void 0 : _a.close) !== null && _b !== void 0 ? _b : (partner.kind === 'group' ? partner.remove : undefined);
33
+ }
34
+ return partner.remove;
35
+ }
36
+ PartnerRowUtil.away = away;
37
+ /** Behind the row: Pin or Info first, what takes it away at the edge, in red. */
38
+ function swipe(pin, info, away) {
39
+ var _a;
40
+ const first = pin ? { key: 'pin', label: pin.label, run: pin.run } : info ? { key: 'info', label: (_a = info.short) !== null && _a !== void 0 ? _a : info.label, run: info.run } : undefined;
41
+ return [...(first ? [first] : []), ...(away ? [{ key: `away-${away.key}`, label: away.label, danger: true, run: away.run }] : [])];
42
+ }
43
+ PartnerRowUtil.swipe = swipe;
44
+ })(PartnerRowUtil || (PartnerRowUtil = {}));
45
+ //# sourceMappingURL=partner-row-util.js.map
@@ -2,9 +2,10 @@ import * as React from 'react';
2
2
  import type { WebPartnerEntry } from '../extension/web-api-partners.js';
3
3
  /**
4
4
  * A partner (docs/design/ta-partners.md), the same row wherever it is: on the page of the partners as a contact, in the
5
- * double's list as a conversation. Its face (or its icon on a tile of its tint), its name, what was said last (else
6
- * what it is), when; an amber dot for what the user has not seen or one asking, a blue ? while it waits for them, a
7
- * spinner while it answers. Its menu is Open, then its own; pinned as a conversation is where `onPin` is given.
5
+ * double's list as a conversation (`onPin` given). Its face (or its icon on a tile of its tint), its name, what was said
6
+ * last (else what it is), when; an amber dot for what the user has not seen or one asking, a blue ? while it waits for
7
+ * them, a spinner while it answers. Its menu (a right click, a long press) and what a swipe shows behind it are the
8
+ * same for every kind (PartnerRowUtil).
8
9
  */
9
10
  export declare function PartnerRow({ partner, time, selected, open, pinned, onPin, }: {
10
11
  partner: WebPartnerEntry;
@@ -6,12 +6,14 @@ import { ChatHomeUtil } from './chat-home-util.js';
6
6
  import { ChatDot } from './chat-list-row.js';
7
7
  import { ContextMenuUtil, useContextMenu } from './context-menu.js';
8
8
  import { HostTag } from './host-tag.js';
9
+ import { PartnerRowUtil } from './partner-row-util.js';
9
10
  import { SwipeRow } from './swipe-row.js';
10
11
  /**
11
12
  * A partner (docs/design/ta-partners.md), the same row wherever it is: on the page of the partners as a contact, in the
12
- * double's list as a conversation. Its face (or its icon on a tile of its tint), its name, what was said last (else
13
- * what it is), when; an amber dot for what the user has not seen or one asking, a blue ? while it waits for them, a
14
- * spinner while it answers. Its menu is Open, then its own; pinned as a conversation is where `onPin` is given.
13
+ * double's list as a conversation (`onPin` given). Its face (or its icon on a tile of its tint), its name, what was said
14
+ * last (else what it is), when; an amber dot for what the user has not seen or one asking, a blue ? while it waits for
15
+ * them, a spinner while it answers. Its menu (a right click, a long press) and what a swipe shows behind it are the
16
+ * same for every kind (PartnerRowUtil).
15
17
  */
16
18
  export function PartnerRow({ partner, time, selected, open, pinned, onPin, }) {
17
19
  var _a, _b;
@@ -29,12 +31,22 @@ export function PartnerRow({ partner, time, selected, open, pinned, onPin, }) {
29
31
  .finally(() => setOpening(false));
30
32
  };
31
33
  const pin = onPin && { label: t(pinned ? 'ta.chat.unpin' : 'ta.chat.pin'), run: () => onPin(!pinned) };
32
- const own = () => (partner.menu ? ChatHomeUtil.menu(partner.menu()) : []);
33
- return (React.createElement(SwipeRow, { as: "li", className: `ta-chat-row ta-partner-row${selected ? ' ta-selected' : ''}`, "data-unseen": unseen && !asks ? '' : undefined, "data-asks": asks ? '' : undefined, actions: pin ? [{ key: 'pin', ...pin }] : undefined, overlay: menu, onContextMenu: event => {
34
- const items = own();
34
+ // Opened as the row opens what it is (TaWebExtensions.openHome): a page it shows is the row's, as its conversation is.
35
+ const info = partner.info && {
36
+ label: t(PartnerRowUtil.infoLabel(partner.kind)),
37
+ short: t(PartnerRowUtil.infoShort(partner.kind)),
38
+ run: () => void open({ ...partner, open: () => { var _a; return (_a = partner.info) === null || _a === void 0 ? void 0 : _a.call(partner); } }).catch(error => console.error(`The info of a partner of ${partner.extension} failed to open:`, error)),
39
+ };
40
+ const away = PartnerRowUtil.away(partner, !!onPin);
41
+ const swipe = PartnerRowUtil.swipe(pin, info, away);
42
+ return (React.createElement(SwipeRow, { as: "li", className: `ta-chat-row ta-partner-row${selected ? ' ta-selected' : ''}`, "data-unseen": unseen && !asks ? '' : undefined, "data-asks": asks ? '' : undefined, actions: swipe.length ? swipe : undefined, overlay: menu, onContextMenu: event => {
43
+ const own = partner.menu ? ChatHomeUtil.menu(partner.menu()) : [];
44
+ const first = [{ label: t('ta.chat.open'), run: go }, ...(pin ? [pin] : []), ...(info ? [{ label: info.label, run: info.run }] : [])];
45
+ const last = away ? [{ label: away.label, run: away.run, danger: true }] : [];
35
46
  openMenu(event, [
36
- ...ContextMenuUtil.sections([{ label: t('ta.chat.open'), run: go }], pin ? [pin] : []),
37
- ...(items.length ? ['-', ...items] : []),
47
+ ...ContextMenuUtil.sections(first),
48
+ ...(own.length ? ['-', ...own] : []),
49
+ ...(last.length ? ['-', ...last] : []),
38
50
  ]);
39
51
  } },
40
52
  React.createElement("button", { type: "button", className: "ta-chat-item", title: partner.name, "aria-current": selected ? 'true' : undefined, onClick: go },
@@ -43,6 +55,6 @@ export function PartnerRow({ partner, time, selected, open, pinned, onPin, }) {
43
55
  React.createElement(Own, { size: 38 }))) : (React.createElement("span", { className: "ta-chat-avatar ta-chat-icon", style: { background: `var(--ta-tint-${partner.tone})`, color: `var(--ta-tint-ink-${partner.tone})`, width: 38, height: 38 }, "aria-hidden": "true" }, opening ? React.createElement("span", { className: "ta-spinner" }) : React.createElement(Glyph, { size: 18, strokeWidth: 1.8 }))),
44
56
  partner.online && React.createElement("span", { className: "ta-partner-online", "aria-hidden": "true" }),
45
57
  React.createElement(ChatDot, { unseen: unseen, asks: asks })),
46
- React.createElement(RowText, { title: partner.name, time: time, line: PartnersUtil.line(partner, t('ta.partners.waiting')), unseen: unseen, busy: !partner.status && !!((_b = partner.chat) === null || _b === void 0 ? void 0 : _b.busy), tag: partner.location ? React.createElement(HostTag, { location: partner.location }) : undefined }))));
58
+ React.createElement(RowText, { title: partner.name, time: time, line: PartnersUtil.line(partner, t('ta.partners.waiting')), unseen: unseen, busy: !partner.status && !!((_b = partner.chat) === null || _b === void 0 ? void 0 : _b.busy), tag: partner.location ? React.createElement(HostTag, { location: partner.location }) : undefined, badge: partner.friends ? t('ta.partners.withFriends') : undefined }))));
47
59
  }
48
60
  //# sourceMappingURL=partner-row.js.map
@@ -2,8 +2,8 @@ import type { TaIdentity } from '@celljs/ta-protocol';
2
2
  import * as React from 'react';
3
3
  /** The identity of the computer in use, its name and picture: read once connected, and again when it changes. */
4
4
  export declare function useIdentity(): TaIdentity | undefined;
5
- /** The account in use as a line: "Company account · su", or none while signed out. */
6
- export declare function useAccountLine(): string | undefined;
5
+ /** The account in use as a line: "Company account · su"; null while signed out, undefined until read. */
6
+ export declare function useAccountLine(): string | null | undefined;
7
7
  /** The profile, over the page: the picture, the name, and the account, which opens My devices. */
8
8
  export declare function ProfileDialog({ onClose, onDevices }: {
9
9
  onClose(): void;
@@ -38,12 +38,15 @@ export function useIdentity() {
38
38
  }, [online, workbench]);
39
39
  return identity;
40
40
  }
41
- /** The account in use as a line: "Company account · su", or none while signed out. */
41
+ /** The account in use as a line: "Company account · su"; null while signed out, undefined until read. */
42
42
  export function useAccountLine() {
43
43
  const side = useAccountSide();
44
- const { info } = useAccountInfo(side, 15000);
44
+ const { info, failed } = useAccountInfo(side, 15000);
45
45
  const way = useAccountWay();
46
- return (info === null || info === void 0 ? void 0 : info.account) && !info.waiting ? `${way(info.account.id)} · ${accountName(info.account)}` : undefined;
46
+ if ((info === null || info === void 0 ? void 0 : info.account) && !info.waiting) {
47
+ return `${way(info.account.id)} · ${accountName(info.account)}`;
48
+ }
49
+ return info || failed ? null : undefined;
47
50
  }
48
51
  /** The profile, over the page: the picture, the name, and the account, which opens My devices. */
49
52
  export function ProfileDialog({ onClose, onDevices }) {
@@ -0,0 +1,7 @@
1
+ import * as React from 'react';
2
+ /**
3
+ * Whether the files of settings written by hand read (TaSettingsServer.checkFiles): pi and Ta leave out one that is
4
+ * not JSON, saying little, so a setting typed there seems to do nothing. Each that does not read says where it goes
5
+ * wrong, and opens there. Nothing from a Ta service of before, which cannot say.
6
+ */
7
+ export declare function SettingsFilesRow(): React.JSX.Element | null;
@@ -0,0 +1,61 @@
1
+ import { CircleAlert, CircleCheck, RefreshCw } from 'lucide-react';
2
+ import * as React from 'react';
3
+ import { useWorkbench } from '../hooks.js';
4
+ import { useT } from '../i18n/use-t.js';
5
+ import { LinkUtil } from '../util/link.js';
6
+ import { Icon, IconButton } from './icon.js';
7
+ import { OpenLink } from './link.js';
8
+ import { Row } from './settings-controls.js';
9
+ /** A path of the user's home as `~/…`. */
10
+ function shown(path, home) {
11
+ return home && path.startsWith(`${home}/`) ? `~${path.slice(home.length)}` : path;
12
+ }
13
+ /**
14
+ * Whether the files of settings written by hand read (TaSettingsServer.checkFiles): pi and Ta leave out one that is
15
+ * not JSON, saying little, so a setting typed there seems to do nothing. Each that does not read says where it goes
16
+ * wrong, and opens there. Nothing from a Ta service of before, which cannot say.
17
+ */
18
+ export function SettingsFilesRow() {
19
+ var _a;
20
+ var _b;
21
+ const t = useT();
22
+ const [workbench, bench] = useWorkbench();
23
+ const open = React.useContext(OpenLink);
24
+ const [files, setFiles] = React.useState();
25
+ const [checking, setChecking] = React.useState(false);
26
+ const check = React.useCallback(() => {
27
+ setChecking(true);
28
+ Promise.resolve()
29
+ .then(() => { var _a, _b; return (_b = (_a = bench.settings).checkFiles) === null || _b === void 0 ? void 0 : _b.call(_a); })
30
+ .then(next => setFiles(next !== null && next !== void 0 ? next : null), () => setFiles(null))
31
+ .finally(() => setChecking(false));
32
+ }, [bench]);
33
+ React.useEffect(check, [check]);
34
+ if (files === null) {
35
+ return null;
36
+ }
37
+ const home = (_a = workbench.server) === null || _a === void 0 ? void 0 : _a.home;
38
+ const problems = (_b = files === null || files === void 0 ? void 0 : files.problems) !== null && _b !== void 0 ? _b : [];
39
+ const description = !files
40
+ ? t('ta.settings.files.checking')
41
+ : problems.length
42
+ ? t('ta.settings.files.problems', { count: problems.length })
43
+ : t('ta.settings.files.ok', { count: files.checked.length });
44
+ return (React.createElement(Row, { label: t('ta.settings.files'), description: description, stacked: problems.length > 0 },
45
+ problems.length > 0 && (React.createElement("ul", { className: "ta-settings-files" }, problems.map(problem => {
46
+ var _a, _b;
47
+ const target = LinkUtil.codeReference(problem.line ? `${problem.file}:${problem.line}:${(_a = problem.column) !== null && _a !== void 0 ? _a : 1}` : problem.file);
48
+ return (React.createElement("li", { key: problem.file },
49
+ React.createElement(Icon, { icon: CircleAlert, size: 15, className: "ta-settings-files-icon" }),
50
+ target && open ? (React.createElement("button", { type: "button", className: "ta-link ta-mono", title: t('ta.link.openFile'), onClick: () => open(target, false) }, shown(problem.file, home))) : (React.createElement("code", null, shown(problem.file, home))),
51
+ React.createElement("span", { className: "ta-settings-files-why" }, problem.problem === 'object'
52
+ ? t('ta.settings.files.notObject')
53
+ : problem.line
54
+ ? t('ta.settings.files.notJsonAt', { line: problem.line, column: (_b = problem.column) !== null && _b !== void 0 ? _b : 1 })
55
+ : t('ta.settings.files.notJson'))));
56
+ }))),
57
+ React.createElement("span", { className: "ta-settings-files-tools" },
58
+ files && !problems.length && React.createElement(Icon, { icon: CircleCheck, size: 16, className: "ta-settings-files-ok" }),
59
+ React.createElement(IconButton, { icon: RefreshCw, label: t('ta.settings.files.check'), busy: checking, onClick: check }))));
60
+ }
61
+ //# sourceMappingURL=settings-files.js.map
@@ -16,6 +16,7 @@ import { RemoteHosts } from './remote-hosts.js';
16
16
  import { ServeRestartUtil, useRestartTa } from './serve-restart.js';
17
17
  import { packageLabel, SETTINGS_GROUPS, SHORTCUTS, usePackages } from './settings-choices.js';
18
18
  import { EmptyRow, Keys, Row, row, Switch } from './settings-controls.js';
19
+ import { SettingsFilesRow } from './settings-files.js';
19
20
  import { SignInSetupSettings, useSignInConfig } from './sign-in-setup.js';
20
21
  /**
21
22
  * The sections besides those of the page and of pi's settings, each in its part (SectionEntry.group): the packages,
@@ -204,6 +205,7 @@ export function useMoreSections(onClose, onDialog) {
204
205
  t('ta.restart.button')))),
205
206
  ]
206
207
  : []),
208
+ row('settings-files', [t('ta.settings.files'), 'settings.json', 'models.json', 'JSON'], React.createElement(SettingsFilesRow, null)),
207
209
  row('cwd', [t('ta.settings.cwd'), workbench.server.cwd], React.createElement(Row, { label: t('ta.settings.cwd'), description: t('ta.settings.cwdDescription', { path: workbench.server.cwd }) },
208
210
  React.createElement("button", { type: "button", className: "ta-button", onClick: () => onDialog('directory') },
209
211
  React.createElement(Icon, { icon: FolderOpen, size: 15 }),
@@ -25,7 +25,7 @@ function StatusDot({ status }) {
25
25
  return React.createElement("span", { className: `ta-status ta-status-${status}` });
26
26
  }
27
27
  /** One step in one line: a dot for its state and what it does; a click opens what it did. */
28
- function ToolRow({ name, args, status, trailing, details, count = 0 }) {
28
+ function ToolRow({ name, args, status, trailing, details, count = 0, times = 1 }) {
29
29
  const t = useT();
30
30
  const [open, setOpen] = React.useState(false);
31
31
  const summary = ToolUtil.summary(name, args, React.useContext(ToolRenderers));
@@ -38,6 +38,9 @@ function ToolRow({ name, args, status, trailing, details, count = 0 }) {
38
38
  React.createElement(ToolIcon, { size: 18 })))),
39
39
  summary.target && (React.createElement("span", { className: summary.titled ? 'ta-tool-verb ta-tool-title-text' : `ta-tool-target ${summary.code ? 'ta-mono' : ''}` }, summary.target)),
40
40
  count > 1 && React.createElement("span", { className: "ta-tool-count" }, t('ta.process.steps', { count })),
41
+ times > 1 && (React.createElement("span", { className: "ta-tool-count", title: t('ta.process.timesTitle', { count: times }) },
42
+ "\u00D7",
43
+ times)),
41
44
  React.createElement(Icon, { icon: ChevronRight, size: 13, className: "ta-tool-chevron" })));
42
45
  return (React.createElement("div", { className: `ta-tool ta-tool-${status}` },
43
46
  React.createElement("div", { className: "ta-tool-line" },
@@ -88,13 +91,13 @@ function same(a, b) {
88
91
  export const ActView = React.memo(Act, (previous, next) => {
89
92
  const a = previous.act;
90
93
  const b = next.act;
91
- if (a.call !== b.call || !same(a.nested, b.nested) || a.thoughts.join('\0') !== b.thoughts.join('\0')) {
94
+ if (a.call !== b.call || !same(a.nested, b.nested) || !same(a.earlier, b.earlier) || a.thoughts.join('\0') !== b.thoughts.join('\0')) {
92
95
  return false;
93
96
  }
94
97
  if (b.call.name === 'codemode' && previous.runs !== next.runs) {
95
98
  return false;
96
99
  }
97
- return [b.call, ...b.nested].every(call => {
100
+ return [b.call, ...b.nested, ...b.earlier].every(call => {
98
101
  var _a;
99
102
  const id = (_a = call.id) !== null && _a !== void 0 ? _a : '';
100
103
  return previous.runs[id] === next.runs[id] && previous.results.get(id) === next.results.get(id);
@@ -102,8 +105,9 @@ export const ActView = React.memo(Act, (previous, next) => {
102
105
  });
103
106
  function Act({ act, results, runs }) {
104
107
  var _a;
108
+ var _b;
105
109
  const { id = '', name = '', arguments: raw } = act.call;
106
- const args = (_a = raw) !== null && _a !== void 0 ? _a : {};
110
+ const args = (_b = raw) !== null && _b !== void 0 ? _b : {};
107
111
  const run = id ? runs[id] : undefined;
108
112
  const output = MessageUtil.output(run, id ? results.get(id) : undefined);
109
113
  const status = MessageUtil.status(run, output);
@@ -113,10 +117,22 @@ function Act({ act, results, runs }) {
113
117
  }
114
118
  const own = details(name, args, output, status);
115
119
  if (!act.nested.length) {
116
- const body = thoughts || own ? (React.createElement(React.Fragment, null,
120
+ // The same call made more than once in a row: what each did, the earliest first.
121
+ const all = act.earlier.length
122
+ ? [
123
+ ...act.earlier.map(call => {
124
+ var _a, _b;
125
+ const key = (_a = call.id) !== null && _a !== void 0 ? _a : '';
126
+ const earlier = MessageUtil.output(runs[key], results.get(key));
127
+ return { key, shown: details(name, (_b = call.arguments) !== null && _b !== void 0 ? _b : {}, earlier, MessageUtil.status(runs[key], earlier)) };
128
+ }),
129
+ { key: id, shown: own },
130
+ ].filter(each => each.shown)
131
+ : [];
132
+ const body = thoughts || own || all.length ? (React.createElement(React.Fragment, null,
117
133
  thoughts,
118
- own)) : undefined;
119
- return React.createElement(ToolRow, { name: name, args: args, status: status, details: body });
134
+ all.length > 1 ? (React.createElement("div", { className: "ta-tool-repeats" }, all.map(each => (React.createElement(React.Fragment, { key: each.key }, each.shown))))) : (own || ((_a = all[0]) === null || _a === void 0 ? void 0 : _a.shown)))) : undefined;
135
+ return React.createElement(ToolRow, { name: name, args: args, status: status, details: body, times: act.earlier.length + 1 });
120
136
  }
121
137
  // The script of another agent and the calls it made: one line, which opens to the calls, then the script.
122
138
  const steps = act.nested.map(call => {
@@ -15,5 +15,8 @@ export interface WebComposerHostProps extends WebComposerProps {
15
15
  /** The hosts of ssh, which the button offers too. */
16
16
  remote?: FolderPickerRemote;
17
17
  }
18
- /** The message box as web extensions get it (`pi.ui.Composer`): text only, `@` for the names they give; a failure is a notice of the page. */
19
- export declare function WebComposer({ notices, placeholder, onSend, mentions, mentionLabel, actions, cwd, onPickCwd, commands, working, onStop, voiceSends, onTalkSent, onListening, after, draft, server, listDirectory, serverCwd, remote, }: WebComposerHostProps): React.JSX.Element;
18
+ /**
19
+ * The message box as web extensions get it (`pi.ui.Composer`): text, and pictures when it takes them (shrunk within
20
+ * the limits given), `@` for the names they give; a failure is a notice of the page.
21
+ */
22
+ export declare function WebComposer({ notices, placeholder, onSend, images, mentions, mentionLabel, actions, cwd, onPickCwd, commands, working, onStop, voiceSends, onTalkSent, onListening, after, draft, server, listDirectory, serverCwd, remote, }: WebComposerHostProps): React.JSX.Element;
@@ -1,20 +1,25 @@
1
1
  import * as React from 'react';
2
2
  import { useLanguage, useT } from '../i18n/use-t.js';
3
3
  import { ComposerUtil } from '../util/composer.js';
4
+ import { ImageShrink } from '../util/image-shrink.js';
4
5
  import { ComposerAddonUtil } from './composer-addon-util.js';
5
6
  import { ComposerBox } from './composer-box.js';
6
7
  import { useDirectoryCommands } from './directory-commands.js';
7
8
  import { DirectoryButton } from './folder-picker.js';
8
- /** The message box as web extensions get it (`pi.ui.Composer`): text only, `@` for the names they give; a failure is a notice of the page. */
9
- export function WebComposer({ notices, placeholder, onSend, mentions, mentionLabel, actions, cwd, onPickCwd, commands, working, onStop, voiceSends, onTalkSent, onListening, after, draft, server, listDirectory, serverCwd, remote, }) {
9
+ /**
10
+ * The message box as web extensions get it (`pi.ui.Composer`): text, and pictures when it takes them (shrunk within
11
+ * the limits given), `@` for the names they give; a failure is a notice of the page.
12
+ */
13
+ export function WebComposer({ notices, placeholder, onSend, images, mentions, mentionLabel, actions, cwd, onPickCwd, commands, working, onStop, voiceSends, onTalkSent, onListening, after, draft, server, listDirectory, serverCwd, remote, }) {
10
14
  const t = useT();
11
15
  const language = useLanguage();
12
16
  const [query, setQuery] = React.useState();
13
17
  const found = useDirectoryCommands(server, commands ? cwd || serverCwd : undefined);
14
18
  const listed = React.useMemo(() => found.map(command => ({ name: command.name, description: ComposerUtil.commandDescription(command, language, t) })), [found, language, t]);
15
- return (React.createElement(ComposerBox, { placeholder: placeholder !== null && placeholder !== void 0 ? placeholder : t('ta.composer.label'), onSend: async (text) => {
16
- await onSend(text);
17
- }, commands: listed, onMentionQuery: mentions ? setQuery : undefined, mentions: mentions && query !== undefined
19
+ return (React.createElement(ComposerBox, { placeholder: placeholder !== null && placeholder !== void 0 ? placeholder : t('ta.composer.label'), onSend: async (text, attached) => {
20
+ const limits = typeof images === 'object' ? images : undefined;
21
+ await onSend(text, limits ? await Promise.all(attached.map(image => ImageShrink.shrink(image, limits))) : attached);
22
+ }, images: !!images, commands: listed, onMentionQuery: mentions ? setQuery : undefined, mentions: mentions && query !== undefined
18
23
  ? {
19
24
  items: ComposerUtil.commands(mentions, query).map(mention => ({
20
25
  key: mention.name,
@@ -2,7 +2,6 @@ import { TA_RESUME_MESSAGE } from '@celljs/ta-protocol';
2
2
  import * as React from 'react';
3
3
  import { Callout } from '../components/callout.js';
4
4
  import { Markdown } from '../components/markdown.js';
5
- import { ResumeBreak } from '../components/message-footer.js';
6
5
  import { useT } from '../i18n/use-t.js';
7
6
  import { MessageUtil } from '../util/message.js';
8
7
  /** The renderers of custom messages that web extensions registered. */
@@ -49,8 +48,9 @@ function ExtensionError({ name, error }) {
49
48
  /** A custom message of pi: with the renderer of its type, or as text when it is to be shown. */
50
49
  export function CustomMessage({ message }) {
51
50
  const Renderer = React.useContext(MessageRenderers)[message.customType];
51
+ // A step of the turn it went on with (ProcessUtil.items), not a message of its own.
52
52
  if (message.customType === TA_RESUME_MESSAGE) {
53
- return React.createElement(ResumeBreak, null);
53
+ return null;
54
54
  }
55
55
  if (Renderer) {
56
56
  return (React.createElement(ExtensionBoundary, { name: message.customType, resetKey: Renderer },