@celljs/ta-web 4.38.0 → 4.40.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 (219) hide show
  1. package/esm/browser/assistant/assistant-thread.d.ts +1 -1
  2. package/esm/browser/assistant/chat-task-source.js +2 -1
  3. package/esm/browser/chat/chat-shown.js +2 -2
  4. package/esm/browser/components/app-contexts.js +11 -10
  5. package/esm/browser/components/busy.d.ts +5 -0
  6. package/esm/browser/components/busy.js +17 -0
  7. package/esm/browser/components/chat-asks.d.ts +4 -1
  8. package/esm/browser/components/chat-asks.js +10 -0
  9. package/esm/browser/components/chat-list-row.js +5 -3
  10. package/esm/browser/components/cloud-sign-in-view.d.ts +1 -1
  11. package/esm/browser/components/composer-box-protocol.d.ts +5 -0
  12. package/esm/browser/components/composer-box.js +11 -14
  13. package/esm/browser/components/composer-media.d.ts +26 -0
  14. package/esm/browser/components/composer-media.js +37 -0
  15. package/esm/browser/components/composer-target.d.ts +2 -2
  16. package/esm/browser/components/composer-target.js +3 -3
  17. package/esm/browser/components/composer.js +1 -0
  18. package/esm/browser/components/host-view.d.ts +1 -1
  19. package/esm/browser/components/link.d.ts +7 -1
  20. package/esm/browser/components/link.js +24 -5
  21. package/esm/browser/components/markdown.d.ts +1 -1
  22. package/esm/browser/components/markdown.js +70 -4
  23. package/esm/browser/components/remote-hosts.d.ts +3 -1
  24. package/esm/browser/components/remote-hosts.js +10 -5
  25. package/esm/browser/components/session-view.js +10 -6
  26. package/esm/browser/components/web-composer.d.ts +1 -1
  27. package/esm/browser/components/web-composer.js +12 -3
  28. package/esm/browser/device/photo-picker.d.ts +11 -3
  29. package/esm/browser/device/photo-picker.js +26 -9
  30. package/esm/browser/device/video-picks.d.ts +24 -0
  31. package/esm/browser/device/video-picks.js +104 -0
  32. package/esm/browser/extension/icons.js +17 -1
  33. package/esm/browser/extension/web-access.js +4 -1
  34. package/esm/browser/extension/web-api-code.d.ts +36 -0
  35. package/esm/browser/extension/web-api-code.js +3 -0
  36. package/esm/browser/extension/web-api-components.d.ts +22 -0
  37. package/esm/browser/extension/web-api-contributions.d.ts +0 -31
  38. package/esm/browser/extension/web-api-hosts.d.ts +22 -0
  39. package/esm/browser/extension/web-api-hosts.js +2 -0
  40. package/esm/browser/extension/web-api-menus.d.ts +17 -5
  41. package/esm/browser/extension/web-api-play.d.ts +29 -0
  42. package/esm/browser/extension/web-api-play.js +2 -0
  43. package/esm/browser/extension/web-api-spec.js +5 -0
  44. package/esm/browser/extension/web-api-terminal.d.ts +20 -0
  45. package/esm/browser/extension/web-extension-api.d.ts +19 -17
  46. package/esm/browser/extension/web-extension-context.d.ts +1 -1
  47. package/esm/browser/extension/web-extension-context.js +8 -6
  48. package/esm/browser/extension/web-extension-protocol.d.ts +2 -0
  49. package/esm/browser/extension/web-extension-protocol.js +1 -0
  50. package/esm/browser/extension/web-extension-run.d.ts +4 -3
  51. package/esm/browser/extension/web-extension-run.js +15 -8
  52. package/esm/browser/extension/web-extensions-running.js +38 -7
  53. package/esm/browser/extension/web-file-drag.d.ts +3 -0
  54. package/esm/browser/extension/web-file-drag.js +4 -0
  55. package/esm/browser/extension/web-hosts.d.ts +7 -0
  56. package/esm/browser/extension/web-hosts.js +29 -0
  57. package/esm/browser/extension/web-on-demand.d.ts +5 -0
  58. package/esm/browser/extension/web-on-demand.js +11 -0
  59. package/esm/browser/hosts.d.ts +2 -0
  60. package/esm/browser/hosts.js +9 -0
  61. package/esm/browser/i18n/en/assistant.d.ts +3 -0
  62. package/esm/browser/i18n/en/assistant.js +3 -0
  63. package/esm/browser/i18n/en/chat.d.ts +1 -0
  64. package/esm/browser/i18n/en/chat.js +1 -0
  65. package/esm/browser/i18n/en/common.d.ts +1 -0
  66. package/esm/browser/i18n/en/common.js +1 -0
  67. package/esm/browser/i18n/en/discover.d.ts +2 -0
  68. package/esm/browser/i18n/en/discover.js +2 -0
  69. package/esm/browser/i18n/en/service.js +6 -6
  70. package/esm/browser/i18n/ja/assistant.js +3 -0
  71. package/esm/browser/i18n/ja/chat.js +1 -0
  72. package/esm/browser/i18n/ja/common.js +1 -0
  73. package/esm/browser/i18n/ja/discover.js +2 -0
  74. package/esm/browser/i18n/ja/service.js +6 -6
  75. package/esm/browser/i18n/locales.d.ts +8 -1
  76. package/esm/browser/i18n/messages.d.ts +7 -0
  77. package/esm/browser/i18n/zh/assistant.js +3 -0
  78. package/esm/browser/i18n/zh/chat.js +1 -0
  79. package/esm/browser/i18n/zh/common.js +1 -0
  80. package/esm/browser/i18n/zh/discover.js +2 -0
  81. package/esm/browser/i18n/zh/service.js +6 -6
  82. package/esm/browser/i18n/zh-tw/assistant.js +3 -0
  83. package/esm/browser/i18n/zh-tw/chat.js +1 -0
  84. package/esm/browser/i18n/zh-tw/common.js +1 -0
  85. package/esm/browser/i18n/zh-tw/discover.js +2 -0
  86. package/esm/browser/i18n/zh-tw/service.js +6 -6
  87. package/esm/browser/markdown/code-renderers.d.ts +3 -1
  88. package/esm/browser/markdown/code-renderers.js +2 -0
  89. package/esm/browser/sandbox/sandbox-runtime-code.js +1 -1
  90. package/esm/browser/sandbox/work/work-api.d.ts +113 -0
  91. package/esm/browser/sandbox/work/work-api.js +95 -0
  92. package/esm/browser/sandbox/work/work-docs.d.ts +18 -0
  93. package/esm/browser/sandbox/work/work-docs.js +66 -0
  94. package/esm/browser/sandbox/work/work-frame.d.ts +27 -0
  95. package/esm/browser/sandbox/work/work-frame.js +124 -0
  96. package/esm/browser/share/shared-extensions.d.ts +2 -1
  97. package/esm/browser/style/conversation.d.ts +1 -1
  98. package/esm/browser/style/conversation.js +10 -0
  99. package/esm/browser/style/pages.d.ts +1 -1
  100. package/esm/browser/style/pages.js +1 -0
  101. package/esm/browser/terminal/terminal-osc.d.ts +15 -0
  102. package/esm/browser/terminal/terminal-osc.js +91 -0
  103. package/esm/browser/terminal/web-terminal.d.ts +4 -7
  104. package/esm/browser/terminal/web-terminal.js +22 -26
  105. package/esm/browser/util/link.d.ts +6 -1
  106. package/esm/browser/util/link.js +11 -0
  107. package/esm/browser/workbench-hosts.d.ts +1 -0
  108. package/esm/browser/workbench-hosts.js +9 -0
  109. package/esm/browser/workbench-protocol.d.ts +5 -0
  110. package/lib/browser/assistant/assistant-thread.d.ts +1 -1
  111. package/lib/browser/assistant/chat-task-source.js +2 -1
  112. package/lib/browser/chat/chat-shown.js +2 -2
  113. package/lib/browser/components/app-contexts.js +10 -9
  114. package/lib/browser/components/busy.d.ts +5 -0
  115. package/lib/browser/components/busy.js +17 -0
  116. package/lib/browser/components/chat-asks.d.ts +4 -1
  117. package/lib/browser/components/chat-asks.js +10 -0
  118. package/lib/browser/components/chat-list-row.js +5 -3
  119. package/lib/browser/components/cloud-sign-in-view.d.ts +1 -1
  120. package/lib/browser/components/composer-box-protocol.d.ts +5 -0
  121. package/lib/browser/components/composer-box.js +9 -12
  122. package/lib/browser/components/composer-media.d.ts +27 -0
  123. package/lib/browser/components/composer-media.js +74 -0
  124. package/lib/browser/components/composer-target.d.ts +2 -2
  125. package/lib/browser/components/composer-target.js +3 -3
  126. package/lib/browser/components/composer.js +1 -0
  127. package/lib/browser/components/host-view.d.ts +1 -1
  128. package/lib/browser/components/link.d.ts +7 -1
  129. package/lib/browser/components/link.js +25 -6
  130. package/lib/browser/components/markdown.d.ts +1 -1
  131. package/lib/browser/components/markdown.js +68 -2
  132. package/lib/browser/components/remote-hosts.d.ts +3 -1
  133. package/lib/browser/components/remote-hosts.js +10 -5
  134. package/lib/browser/components/session-view.js +8 -4
  135. package/lib/browser/components/web-composer.d.ts +1 -1
  136. package/lib/browser/components/web-composer.js +12 -3
  137. package/lib/browser/device/photo-picker.d.ts +11 -3
  138. package/lib/browser/device/photo-picker.js +26 -9
  139. package/lib/browser/device/video-picks.d.ts +25 -0
  140. package/lib/browser/device/video-picks.js +107 -0
  141. package/lib/browser/extension/icons.js +16 -0
  142. package/lib/browser/extension/web-access.js +4 -1
  143. package/lib/browser/extension/web-api-code.d.ts +37 -0
  144. package/lib/browser/extension/web-api-code.js +4 -0
  145. package/lib/browser/extension/web-api-components.d.ts +22 -0
  146. package/lib/browser/extension/web-api-contributions.d.ts +0 -31
  147. package/lib/browser/extension/web-api-hosts.d.ts +23 -0
  148. package/lib/browser/extension/web-api-hosts.js +3 -0
  149. package/lib/browser/extension/web-api-menus.d.ts +17 -5
  150. package/lib/browser/extension/web-api-play.d.ts +30 -0
  151. package/lib/browser/extension/web-api-play.js +3 -0
  152. package/lib/browser/extension/web-api-spec.js +5 -0
  153. package/lib/browser/extension/web-api-terminal.d.ts +20 -0
  154. package/lib/browser/extension/web-extension-api.d.ts +19 -17
  155. package/lib/browser/extension/web-extension-context.d.ts +1 -1
  156. package/lib/browser/extension/web-extension-context.js +8 -6
  157. package/lib/browser/extension/web-extension-protocol.d.ts +2 -0
  158. package/lib/browser/extension/web-extension-protocol.js +1 -0
  159. package/lib/browser/extension/web-extension-run.d.ts +4 -3
  160. package/lib/browser/extension/web-extension-run.js +15 -8
  161. package/lib/browser/extension/web-extensions-running.js +38 -7
  162. package/lib/browser/extension/web-file-drag.d.ts +4 -0
  163. package/lib/browser/extension/web-file-drag.js +7 -0
  164. package/lib/browser/extension/web-hosts.d.ts +8 -0
  165. package/lib/browser/extension/web-hosts.js +32 -0
  166. package/lib/browser/extension/web-on-demand.d.ts +5 -0
  167. package/lib/browser/extension/web-on-demand.js +11 -0
  168. package/lib/browser/hosts.d.ts +2 -0
  169. package/lib/browser/hosts.js +9 -0
  170. package/lib/browser/i18n/en/assistant.d.ts +3 -0
  171. package/lib/browser/i18n/en/assistant.js +3 -0
  172. package/lib/browser/i18n/en/chat.d.ts +1 -0
  173. package/lib/browser/i18n/en/chat.js +1 -0
  174. package/lib/browser/i18n/en/common.d.ts +1 -0
  175. package/lib/browser/i18n/en/common.js +1 -0
  176. package/lib/browser/i18n/en/discover.d.ts +2 -0
  177. package/lib/browser/i18n/en/discover.js +2 -0
  178. package/lib/browser/i18n/en/service.js +6 -6
  179. package/lib/browser/i18n/ja/assistant.js +3 -0
  180. package/lib/browser/i18n/ja/chat.js +1 -0
  181. package/lib/browser/i18n/ja/common.js +1 -0
  182. package/lib/browser/i18n/ja/discover.js +2 -0
  183. package/lib/browser/i18n/ja/service.js +6 -6
  184. package/lib/browser/i18n/locales.d.ts +8 -1
  185. package/lib/browser/i18n/messages.d.ts +7 -0
  186. package/lib/browser/i18n/zh/assistant.js +3 -0
  187. package/lib/browser/i18n/zh/chat.js +1 -0
  188. package/lib/browser/i18n/zh/common.js +1 -0
  189. package/lib/browser/i18n/zh/discover.js +2 -0
  190. package/lib/browser/i18n/zh/service.js +6 -6
  191. package/lib/browser/i18n/zh-tw/assistant.js +3 -0
  192. package/lib/browser/i18n/zh-tw/chat.js +1 -0
  193. package/lib/browser/i18n/zh-tw/common.js +1 -0
  194. package/lib/browser/i18n/zh-tw/discover.js +2 -0
  195. package/lib/browser/i18n/zh-tw/service.js +6 -6
  196. package/lib/browser/markdown/code-renderers.d.ts +3 -1
  197. package/lib/browser/markdown/code-renderers.js +3 -1
  198. package/lib/browser/sandbox/sandbox-runtime-code.js +1 -1
  199. package/lib/browser/sandbox/work/work-api.d.ts +114 -0
  200. package/lib/browser/sandbox/work/work-api.js +99 -0
  201. package/lib/browser/sandbox/work/work-docs.d.ts +19 -0
  202. package/lib/browser/sandbox/work/work-docs.js +69 -0
  203. package/lib/browser/sandbox/work/work-frame.d.ts +28 -0
  204. package/lib/browser/sandbox/work/work-frame.js +160 -0
  205. package/lib/browser/share/shared-extensions.d.ts +2 -1
  206. package/lib/browser/style/conversation.d.ts +1 -1
  207. package/lib/browser/style/conversation.js +10 -0
  208. package/lib/browser/style/pages.d.ts +1 -1
  209. package/lib/browser/style/pages.js +1 -0
  210. package/lib/browser/terminal/terminal-osc.d.ts +16 -0
  211. package/lib/browser/terminal/terminal-osc.js +94 -0
  212. package/lib/browser/terminal/web-terminal.d.ts +4 -7
  213. package/lib/browser/terminal/web-terminal.js +25 -29
  214. package/lib/browser/util/link.d.ts +6 -1
  215. package/lib/browser/util/link.js +11 -0
  216. package/lib/browser/workbench-hosts.d.ts +1 -0
  217. package/lib/browser/workbench-hosts.js +9 -0
  218. package/lib/browser/workbench-protocol.d.ts +5 -0
  219. package/package.json +7 -7
@@ -0,0 +1,91 @@
1
+ const PROGRESS_STATES = { '1': 'normal', '2': 'error', '3': 'busy', '4': 'paused' };
2
+ /** What OSC 7501 says, by its `state`: `none` for idle or cleared. */
3
+ const STATUS_STATES = {
4
+ working: 'working',
5
+ blocked: 'blocked',
6
+ done: 'done',
7
+ error: 'error',
8
+ idle: 'none',
9
+ clear: 'none',
10
+ };
11
+ const BLOCKED_KINDS = new Set(['permission', 'question', 'auth']);
12
+ const APP = /^[A-Za-z0-9_.+-]{1,32}$/;
13
+ /** OSC 9: the progress of ConEmu (`4;state;value`), else a notification of iTerm2 (its text). */
14
+ export var TerminalOsc;
15
+ (function (TerminalOsc) {
16
+ function progress(data) {
17
+ var _a;
18
+ const match = /^4(?:;(\d*))?(?:;(\d*))?/.exec(data);
19
+ if (!match) {
20
+ return null;
21
+ }
22
+ const state = PROGRESS_STATES[(_a = match[1]) !== null && _a !== void 0 ? _a : '0'];
23
+ if (!state) {
24
+ return undefined;
25
+ }
26
+ const value = match[2] ? Math.min(100, Math.max(0, Number(match[2]))) : undefined;
27
+ // A state without a number keeps no value; busy has none.
28
+ return state === 'busy' || value === undefined ? { state } : { state, value };
29
+ }
30
+ TerminalOsc.progress = progress;
31
+ /** What a terminal that takes OSC 7501 answers its query (`?`) with: the same. */
32
+ TerminalOsc.STATUS_REPLY = '\x1b]7501;?\x1b\\';
33
+ function isStatusQuery(data) {
34
+ return data.startsWith('?');
35
+ }
36
+ TerminalOsc.isStatusQuery = isStatusQuery;
37
+ /**
38
+ * OSC 7501 (superlogical.com/rex/docs/build/program-status): `state=blocked:kind=permission:msg=<base64>`;
39
+ * undefined for idle or cleared, null for what is not a status.
40
+ */
41
+ function status(data) {
42
+ var _a;
43
+ const pairs = new Map();
44
+ for (const pair of data.split(':')) {
45
+ const at = pair.indexOf('=');
46
+ if (at > 0) {
47
+ pairs.set(pair.slice(0, at), pair.slice(at + 1));
48
+ }
49
+ }
50
+ const state = STATUS_STATES[(_a = pairs.get('state')) !== null && _a !== void 0 ? _a : ''];
51
+ if (!state) {
52
+ return null;
53
+ }
54
+ if (state === 'none') {
55
+ return undefined;
56
+ }
57
+ const kind = pairs.get('kind');
58
+ const message = text(pairs.get('msg'));
59
+ const app = pairs.get('app');
60
+ return {
61
+ state,
62
+ ...(state === 'blocked' && kind && BLOCKED_KINDS.has(kind) ? { kind: kind } : {}),
63
+ ...(message ? { message } : {}),
64
+ ...(app && APP.test(app) ? { app } : {}),
65
+ };
66
+ }
67
+ TerminalOsc.status = status;
68
+ /** The base64 UTF-8 of `msg`, one line; undefined for none, or what does not decode. */
69
+ function text(base64) {
70
+ if (!base64) {
71
+ return undefined;
72
+ }
73
+ try {
74
+ const bytes = Uint8Array.from(atob(base64), char => char.charCodeAt(0));
75
+ return (new TextDecoder('utf-8', { fatal: true })
76
+ .decode(bytes)
77
+ .replace(/\p{Cc}/gu, ' ')
78
+ .trim() || undefined);
79
+ }
80
+ catch (_a) {
81
+ return undefined;
82
+ }
83
+ }
84
+ /** OSC 777: `notify;title;body`, as rxvt and Ghostty take it; null for anything else. */
85
+ function notification(data) {
86
+ const [kind, ...rest] = data.split(';');
87
+ return kind === 'notify' ? rest.filter(Boolean).join(': ') : null;
88
+ }
89
+ TerminalOsc.notification = notification;
90
+ })(TerminalOsc || (TerminalOsc = {}));
91
+ //# sourceMappingURL=terminal-osc.js.map
@@ -1,6 +1,6 @@
1
1
  import type { FitAddon } from '@xterm/addon-fit';
2
2
  import type { ILink, Terminal } from '@xterm/xterm';
3
- import type { WebTerminal, WebTerminalKey, WebTerminalOptions, WebTerminalProgress } from '../extension/web-extension-api.js';
3
+ import type { WebTerminal, WebTerminalKey, WebTerminalOptions, WebTerminalProgress, WebTerminalStatus } from '../extension/web-extension-api.js';
4
4
  import type { OpenLinkOptions } from '../links/links-protocol.js';
5
5
  import { type TaSettings } from '../settings/settings-protocol.js';
6
6
  import type { LinkTarget } from '../util/link.js';
@@ -9,12 +9,6 @@ type XtermModule = typeof import('./xterm.js');
9
9
  export declare namespace XtermLoader {
10
10
  function load(): Promise<XtermModule>;
11
11
  }
12
- /** OSC 9: the progress of ConEmu (`4;state;value`), else a notification of iTerm2 (its text). */
13
- export declare namespace TerminalOsc {
14
- function progress(data: string): WebTerminalProgress | undefined | null;
15
- /** OSC 777: `notify;title;body`, as rxvt and Ghostty take it; null for anything else. */
16
- function notification(data: string): string | null;
17
- }
18
12
  /** What a key of a terminal does besides typing: clear, copy, paste. */
19
13
  export type TerminalShortcut = 'clear' | 'copy' | 'paste';
20
14
  export declare namespace TerminalKeys {
@@ -61,8 +55,10 @@ export declare class DefaultWebTerminal implements WebTerminal {
61
55
  protected readonly titleListeners: Set<(title: string | undefined) => void>;
62
56
  protected readonly progressListeners: Set<(progress: WebTerminalProgress | undefined) => void>;
63
57
  protected readonly attentionListeners: Set<(message: string | undefined) => void>;
58
+ protected readonly statusListeners: Set<(status: WebTerminalStatus | undefined) => void>;
64
59
  title?: string;
65
60
  progress?: WebTerminalProgress;
61
+ status?: WebTerminalStatus;
66
62
  protected readonly host: HTMLDivElement;
67
63
  protected parent?: HTMLElement;
68
64
  protected observer?: ResizeObserver;
@@ -78,6 +74,7 @@ export declare class DefaultWebTerminal implements WebTerminal {
78
74
  onCwdChange(listener: (cwd: string) => void): () => void;
79
75
  onTitleChange(listener: (title: string | undefined) => void): () => void;
80
76
  onProgressChange(listener: (progress: WebTerminalProgress | undefined) => void): () => void;
77
+ onStatusChange(listener: (status: WebTerminalStatus | undefined) => void): () => void;
81
78
  onAttention(listener: (message: string | undefined) => void): () => void;
82
79
  getSelection(): string;
83
80
  selectAll(): void;
@@ -3,6 +3,7 @@ import { message } from '../i18n/messages.js';
3
3
  import { ShortcutUtil } from '../settings/agent-settings.js';
4
4
  import { SettingsUtil } from '../settings/settings-protocol.js';
5
5
  import { TerminalLinkUtil } from './terminal-links.js';
6
+ import { TerminalOsc } from './terminal-osc.js';
6
7
  import { TerminalTheme } from './terminal-theme.js';
7
8
  /** Loads xterm.js the first time a terminal is made, not with the page. */
8
9
  export var XtermLoader;
@@ -25,32 +26,6 @@ const MAX_WRAPPED_ROWS = 50;
25
26
  /** A view being dragged to a new size fits once it stops. */
26
27
  const FIT_MS = 50;
27
28
  const ARROWS = { ArrowUp: 'A', ArrowDown: 'B', ArrowRight: 'C', ArrowLeft: 'D' };
28
- const PROGRESS_STATES = { '1': 'normal', '2': 'error', '3': 'busy', '4': 'paused' };
29
- /** OSC 9: the progress of ConEmu (`4;state;value`), else a notification of iTerm2 (its text). */
30
- export var TerminalOsc;
31
- (function (TerminalOsc) {
32
- function progress(data) {
33
- var _a;
34
- const match = /^4(?:;(\d*))?(?:;(\d*))?/.exec(data);
35
- if (!match) {
36
- return null;
37
- }
38
- const state = PROGRESS_STATES[(_a = match[1]) !== null && _a !== void 0 ? _a : '0'];
39
- if (!state) {
40
- return undefined;
41
- }
42
- const value = match[2] ? Math.min(100, Math.max(0, Number(match[2]))) : undefined;
43
- // A state without a number keeps no value; busy has none.
44
- return state === 'busy' || value === undefined ? { state } : { state, value };
45
- }
46
- TerminalOsc.progress = progress;
47
- /** OSC 777: `notify;title;body`, as rxvt and Ghostty take it; null for anything else. */
48
- function notification(data) {
49
- const [kind, ...rest] = data.split(';');
50
- return kind === 'notify' ? rest.filter(Boolean).join(': ') : null;
51
- }
52
- TerminalOsc.notification = notification;
53
- })(TerminalOsc || (TerminalOsc = {}));
54
29
  export var TerminalKeys;
55
30
  (function (TerminalKeys) {
56
31
  /**
@@ -112,6 +87,7 @@ export class DefaultWebTerminal {
112
87
  this.titleListeners = new Set();
113
88
  this.progressListeners = new Set();
114
89
  this.attentionListeners = new Set();
90
+ this.statusListeners = new Set();
115
91
  this.host = document.createElement('div');
116
92
  this.cols = (_a = options.cols) !== null && _a !== void 0 ? _a : DEFAULT_COLS;
117
93
  this.rows = (_b = options.rows) !== null && _b !== void 0 ? _b : DEFAULT_ROWS;
@@ -147,6 +123,10 @@ export class DefaultWebTerminal {
147
123
  this.progressListeners.add(listener);
148
124
  return () => this.progressListeners.delete(listener);
149
125
  }
126
+ onStatusChange(listener) {
127
+ this.statusListeners.add(listener);
128
+ return () => this.statusListeners.delete(listener);
129
+ }
150
130
  onAttention(listener) {
151
131
  this.attentionListeners.add(listener);
152
132
  return () => this.attentionListeners.delete(listener);
@@ -222,6 +202,7 @@ export class DefaultWebTerminal {
222
202
  this.titleListeners.clear();
223
203
  this.progressListeners.clear();
224
204
  this.attentionListeners.clear();
205
+ this.statusListeners.clear();
225
206
  }
226
207
  start(module) {
227
208
  if (this.disposed) {
@@ -313,6 +294,21 @@ export class DefaultWebTerminal {
313
294
  }
314
295
  return message !== null;
315
296
  });
297
+ // OSC 7501: answered when asked, so that a program (pi) says what it does; the tab shows it.
298
+ term.parser.registerOscHandler(7501, data => {
299
+ if (TerminalOsc.isStatusQuery(data)) {
300
+ this.emitData(TerminalOsc.STATUS_REPLY);
301
+ return true;
302
+ }
303
+ const status = TerminalOsc.status(data);
304
+ if (status !== null && JSON.stringify(status) !== JSON.stringify(this.status)) {
305
+ this.status = status;
306
+ for (const listener of this.statusListeners) {
307
+ listener(status);
308
+ }
309
+ }
310
+ return status !== null;
311
+ });
316
312
  term.onBell(() => this.emitAttention(undefined));
317
313
  term.parser.registerOscHandler(7, data => {
318
314
  const cwd = TerminalLinkUtil.cwdOf(data);
@@ -1,4 +1,4 @@
1
- import type { TextSelection } from '../extension/web-extension-api.js';
1
+ import type { TextSelection, WebFileRef } from '../extension/web-extension-api.js';
2
2
  /** What a link of a reply points to, as written: a page of the web, a mail, or a path on the machine of the conversation. */
3
3
  export type LinkTarget = {
4
4
  type: 'url';
@@ -76,4 +76,9 @@ export declare namespace LinkUtil {
76
76
  * (the domain and those under it), `localhost:3000` (that port only), or `*` for all.
77
77
  */
78
78
  function trusted(url: string, domains: readonly string[], ownHost?: string): boolean;
79
+ /**
80
+ * A file of a conversation in `cwd` as the menus of files take it (WebFileRef): relative to `cwd` when inside it,
81
+ * else as the agent wrote it (an absolute path, which TaWorkspaceServer.fileUrl serves alone).
82
+ */
83
+ function fileRef(cwd: string, path: string): WebFileRef;
79
84
  }
@@ -1,3 +1,4 @@
1
+ import { TaLocation } from '@celljs/ta-protocol';
1
2
  const WEB = /^https?:\/\//i;
2
3
  const SCHEME = /^[a-z][a-z\d+.-]*:/i;
3
4
  const WINDOWS_PATH = /^[a-z]:[\\/]/i;
@@ -301,6 +302,16 @@ export var LinkUtil;
301
302
  ...(endLine && endLine >= startLine && endColumn && { endColumn }),
302
303
  };
303
304
  }
305
+ /**
306
+ * A file of a conversation in `cwd` as the menus of files take it (WebFileRef): relative to `cwd` when inside it,
307
+ * else as the agent wrote it (an absolute path, which TaWorkspaceServer.fileUrl serves alone).
308
+ */
309
+ function fileRef(cwd, path) {
310
+ const base = TaLocation.path(cwd).replace(/\/+$/, '');
311
+ const relative = base && path.startsWith(`${base}/`) ? path.slice(base.length + 1) : path;
312
+ return { cwd, path: relative, name: path.replace(/\/+$/, '').split('/').pop() || path, kind: 'file' };
313
+ }
314
+ LinkUtil.fileRef = fileRef;
304
315
  function count(text, char) {
305
316
  return text.split(char).length - 1;
306
317
  }
@@ -16,6 +16,7 @@ export declare abstract class WorkbenchHosts extends WorkbenchLists {
16
16
  * used at once when none is.
17
17
  */
18
18
  addAccountHost(link: string, account: string): Promise<void>;
19
+ keepHost(link: string, name?: string): string;
19
20
  markAccountHost(hostId: string, account: string): void;
20
21
  /** The computers the account brought: those of `account`, or all of them when the device left the account. */
21
22
  forgetAccountHosts(account?: string): void;
@@ -43,6 +43,15 @@ export class WorkbenchHosts extends WorkbenchLists {
43
43
  }
44
44
  this.keepHosts(HostUtil.keep(this.list, id, credential, account, Date.now()));
45
45
  }
46
+ keepHost(link, name) {
47
+ const credential = WorkbenchUtil.credential(link.trim());
48
+ if (!('pairing' in credential)) {
49
+ throw new WorkbenchError('refused');
50
+ }
51
+ const id = WorkbenchUtil.serverOf(credential, pageHost());
52
+ this.keepHosts(HostUtil.add(this.list, id, credential, name, Date.now()));
53
+ return id;
54
+ }
46
55
  markAccountHost(hostId, account) {
47
56
  // The way the account brought to the same computer before: the one scanned and in use is kept alone.
48
57
  for (let other = HostUtil.other(this.list, hostId, account); other; other = HostUtil.other(this.list, hostId, account)) {
@@ -134,6 +134,11 @@ export interface TaWorkbench {
134
134
  rename(hostId: string, name: string): void;
135
135
  /** A way into a computer of the user's account (docs/design/ta-account.md): kept, used at once when none is. */
136
136
  addAccountHost(link: string, account: string): Promise<void>;
137
+ /**
138
+ * Keeps the computer of a pairing link on this device, named `name`, without switching to it (WebHosts.keep): its id.
139
+ * Kept already, its way in is the new one.
140
+ */
141
+ keepHost(link: string, name?: string): string;
137
142
  /** A computer this device brought into its account (docs/design/ta-me.md 4) is its device `account` there. */
138
143
  markAccountHost(hostId: string, account: string): void;
139
144
  /** The computers the account brought: those of `account`, or all when the device left the account. */
@@ -1,7 +1,7 @@
1
1
  import type { SessionState } from '@celljs/ta-client';
2
2
  import * as React from 'react';
3
3
  import type { RowWindow } from '../components/earlier-messages';
4
- import type { WebCodeRendererProps } from '../extension/web-api-contributions';
4
+ import type { WebCodeRendererProps } from '../extension/web-api-code';
5
5
  import type { WebTaskEntry } from '../extension/web-extension-api';
6
6
  import type { Translate } from '../i18n/use-t';
7
7
  interface AssistantThreadProps {
@@ -62,7 +62,8 @@ class ChatTaskSource {
62
62
  const { t } = this.actions;
63
63
  const asked = chat_asks_1.ChatAskUtil.asking(entry, letGo);
64
64
  const title = chat_list_util_1.ChatListUtil.title(entry, t);
65
- const detail = asked && !(chat_list_util_1.ChatListUtil.isOpen(entry) && entry.waiting) ? asked.question : t('ta.task.waiting');
65
+ const dialog = chat_list_util_1.ChatListUtil.isOpen(entry) && entry.waiting;
66
+ const detail = asked && !dialog ? asked.question : t(chat_asks_1.ChatAskUtil.waitingText(dialog ? entry.waitingFor : undefined));
66
67
  const startedAt = (_a = asked === null || asked === void 0 ? void 0 : asked.at) !== null && _a !== void 0 ? _a : entry.updatedAt;
67
68
  if (before && before.title === title && before.detail === detail && before.startedAt === startedAt) {
68
69
  return before;
@@ -205,8 +205,8 @@ class ChatShown {
205
205
  this.unfollow = [
206
206
  store.subscribe(state => {
207
207
  if (state.closed) {
208
- // Closed by another client.
209
- void this.enqueue(() => (this.current.store === store ? this.replace() : Promise.resolve()));
208
+ // Closed by another client; or it goes on elsewhere (to the cloud and back): followed there, opened again from its file.
209
+ void this.enqueue(() => (this.current.store === store ? (state.reopen ? this.recover() : this.replace()) : Promise.resolve()));
210
210
  }
211
211
  else if (working && !state.working) {
212
212
  void this.packages.settled(store);
@@ -55,14 +55,15 @@ function AppContexts({ fileUrl, openLink, children, }) {
55
55
  React.createElement(link_1.OpenLink.Provider, { value: openLink },
56
56
  React.createElement(extension_view_1.MessageRenderers.Provider, { value: extensions.renderers },
57
57
  React.createElement(code_renderers_1.CodeRenderers.Provider, { value: extensions.codeRenderers },
58
- React.createElement(code_renderers_1.CodeMenus.Provider, { value: extensions.codeMenus },
59
- React.createElement(extension_view_1.ToolRenderers.Provider, { value: extensions.toolRenderers },
60
- React.createElement(extension_view_1.SessionAvatars.Provider, { value: extensions.avatars },
61
- React.createElement(chat_icon_1.ChatIconsProvider, { entries: extensions.chatIcons },
62
- React.createElement(chat_tag_1.ChatTagsProvider, { entries: extensions.chatTags },
63
- React.createElement(extension_view_1.SessionMenus.Provider, { value: extensions.sessionMenus },
64
- React.createElement(extension_view_1.LoadedExtensions.Provider, { value: extensions.extensions },
65
- React.createElement(extension_view_1.CallGroup.Provider, { value: extensions.callGroup },
66
- React.createElement(secret_text_1.SecretPeeks.Provider, { value: secretPeek }, children))))))))))))));
58
+ React.createElement(code_renderers_1.CodePointable.Provider, { value: extensions.codePointable },
59
+ React.createElement(code_renderers_1.CodeMenus.Provider, { value: extensions.codeMenus },
60
+ React.createElement(extension_view_1.ToolRenderers.Provider, { value: extensions.toolRenderers },
61
+ React.createElement(extension_view_1.SessionAvatars.Provider, { value: extensions.avatars },
62
+ React.createElement(chat_icon_1.ChatIconsProvider, { entries: extensions.chatIcons },
63
+ React.createElement(chat_tag_1.ChatTagsProvider, { entries: extensions.chatTags },
64
+ React.createElement(extension_view_1.SessionMenus.Provider, { value: extensions.sessionMenus },
65
+ React.createElement(extension_view_1.LoadedExtensions.Provider, { value: extensions.extensions },
66
+ React.createElement(extension_view_1.CallGroup.Provider, { value: extensions.callGroup },
67
+ React.createElement(secret_text_1.SecretPeeks.Provider, { value: secretPeek }, children)))))))))))))));
67
68
  }
68
69
  //# sourceMappingURL=app-contexts.js.map
@@ -3,6 +3,11 @@ import * as React from 'react';
3
3
  export type BusyRun = <T>(action: () => T | PromiseLike<T>) => Promise<T | undefined>;
4
4
  export declare namespace BusyUtil {
5
5
  function thenable(value: unknown): value is PromiseLike<unknown>;
6
+ /**
7
+ * The button of Ta's look (`ta-button`) the click that is being handled was on, unless it is marked busy already:
8
+ * a button handing its click to `run` that only goes disabled would show nothing else for as long as it waits.
9
+ */
10
+ function clicked(): Element | undefined;
6
11
  }
7
12
  /**
8
13
  * What waits on something slow (ta serve, code to load): `run` marks it busy until what it returns settles, and
@@ -43,6 +43,19 @@ var BusyUtil;
43
43
  return !!value && typeof value.then === 'function';
44
44
  }
45
45
  BusyUtil.thenable = thenable;
46
+ /**
47
+ * The button of Ta's look (`ta-button`) the click that is being handled was on, unless it is marked busy already:
48
+ * a button handing its click to `run` that only goes disabled would show nothing else for as long as it waits.
49
+ */
50
+ function clicked() {
51
+ const event = globalThis.event;
52
+ if ((event === null || event === void 0 ? void 0 : event.type) !== 'click' || typeof Element === 'undefined' || !(event.target instanceof Element)) {
53
+ return undefined;
54
+ }
55
+ const button = event.target.closest('.ta-button');
56
+ return button && !button.classList.contains('ta-busy') ? button : undefined;
57
+ }
58
+ BusyUtil.clicked = clicked;
46
59
  })(BusyUtil || (exports.BusyUtil = BusyUtil = {}));
47
60
  /**
48
61
  * What waits on something slow (ta serve, code to load): `run` marks it busy until what it returns settles, and
@@ -76,8 +89,12 @@ class BusyGate {
76
89
  return Promise.resolve(result);
77
90
  }
78
91
  this.running = true;
92
+ // Marked here, so that a button busy by `run` alone says it waits as one marked `ta-busy` by its view does.
93
+ const clicked = BusyUtil.clicked();
94
+ clicked === null || clicked === void 0 ? void 0 : clicked.classList.add('ta-busy');
79
95
  this.changed(true);
80
96
  return Promise.resolve(result).finally(() => {
97
+ clicked === null || clicked === void 0 ? void 0 : clicked.classList.remove('ta-busy');
81
98
  this.running = false;
82
99
  this.changed(false);
83
100
  });
@@ -1,5 +1,6 @@
1
- import type { TaAsking, TaSavedSessionInfo, TaSessionInfo } from '@celljs/ta-protocol';
1
+ import type { TaAsking, TaBlockedKind, TaSavedSessionInfo, TaSessionInfo } from '@celljs/ta-protocol';
2
2
  import type { WebAsk } from '../extension/web-api-contributions';
3
+ import type { MessageId } from '../i18n/messages';
3
4
  import type { StateSpec } from '../state/state-protocol';
4
5
  /**
5
6
  * The asks the user let go without answering (`Not now` of a row), by the file of their conversation: when the
@@ -22,6 +23,8 @@ export interface AskingEntry {
22
23
  * typed or tapped, or letting it go.
23
24
  */
24
25
  export declare namespace ChatAskUtil {
26
+ /** The words of one whose dialog waits: what it waits for (TaSessionInfo.waitingFor), when its Ta says. */
27
+ function waitingText(kind: TaBlockedKind | undefined): MessageId;
25
28
  function parse(value: unknown): LetGoAsks | undefined;
26
29
  /** Each let go as late as either page let it go; `a` itself when `b` adds nothing. */
27
30
  function merge(a: LetGoAsks, b: LetGoAsks): LetGoAsks;
@@ -18,6 +18,16 @@ exports.LET_GO_ASKS = {
18
18
  */
19
19
  var ChatAskUtil;
20
20
  (function (ChatAskUtil) {
21
+ const WAITING = {
22
+ permission: 'ta.task.waitingPermission',
23
+ question: 'ta.task.waitingQuestion',
24
+ auth: 'ta.task.waitingAuth',
25
+ };
26
+ /** The words of one whose dialog waits: what it waits for (TaSessionInfo.waitingFor), when its Ta says. */
27
+ function waitingText(kind) {
28
+ return (kind && WAITING[kind]) || 'ta.task.waiting';
29
+ }
30
+ ChatAskUtil.waitingText = waitingText;
21
31
  function parse(value) {
22
32
  if (!value || typeof value !== 'object' || Array.isArray(value)) {
23
33
  return undefined;
@@ -44,6 +44,7 @@ const use_t_1 = require("../i18n/use-t");
44
44
  const screen_protocol_1 = require("../screen/screen-protocol");
45
45
  const message_1 = require("../util/message");
46
46
  const busy_1 = require("./busy");
47
+ const chat_asks_1 = require("./chat-asks");
47
48
  const chat_icon_1 = require("./chat-icon");
48
49
  const chat_list_util_1 = require("./chat-list-util");
49
50
  const chat_tag_1 = require("./chat-tag");
@@ -80,12 +81,12 @@ function ChatAvatar({ session, source, who, size, mood }) {
80
81
  React.createElement(Avatar, { session: session, mood: mood, size: size }))));
81
82
  }
82
83
  /** What goes on in it, on the line of a row of one line: waiting for the user, answering now, or how the double's task ended. */
83
- function ChatState({ streaming, waiting, task }) {
84
+ function ChatState({ streaming, waiting, waitingFor, task }) {
84
85
  const t = (0, use_t_1.useT)();
85
86
  if (waiting) {
86
87
  return (React.createElement("span", { className: "ta-chat-state ta-waiting" },
87
88
  React.createElement("span", { className: "ta-status ta-status-waiting" }),
88
- t('ta.task.waiting')));
89
+ t(chat_asks_1.ChatAskUtil.waitingText(waitingFor))));
89
90
  }
90
91
  if (streaming) {
91
92
  return (React.createElement("span", { className: "ta-chat-state" },
@@ -199,7 +200,8 @@ exports.ChatItem = React.memo(function ChatItem({ session, source, selected, tim
199
200
  const streaming = chat_list_util_1.ChatListUtil.isOpen(session) && session.isStreaming && !waiting;
200
201
  const asks = waiting || (!!asking && !streaming);
201
202
  const mood = asks ? 'attention' : streaming ? 'working' : 'idle';
202
- const state = React.createElement(ChatState, { streaming: streaming, waiting: waiting, task: task });
203
+ const waitingFor = chat_list_util_1.ChatListUtil.isOpen(session) ? session.waitingFor : undefined;
204
+ const state = React.createElement(ChatState, { streaming: streaming, waiting: waiting, waitingFor: waitingFor, task: task });
203
205
  // Others in the same Ta: their faces while they look at it, and whose message it answers.
204
206
  const people = chat_list_util_1.ChatListUtil.isOpen(session) ? session.people : undefined;
205
207
  const viewers = React.createElement(people_1.PeopleFaces, { people: people_1.PresenceUtil.viewing(people), size: 14, max: 3 });