@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,94 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TerminalOsc = void 0;
4
+ const PROGRESS_STATES = { '1': 'normal', '2': 'error', '3': 'busy', '4': 'paused' };
5
+ /** What OSC 7501 says, by its `state`: `none` for idle or cleared. */
6
+ const STATUS_STATES = {
7
+ working: 'working',
8
+ blocked: 'blocked',
9
+ done: 'done',
10
+ error: 'error',
11
+ idle: 'none',
12
+ clear: 'none',
13
+ };
14
+ const BLOCKED_KINDS = new Set(['permission', 'question', 'auth']);
15
+ const APP = /^[A-Za-z0-9_.+-]{1,32}$/;
16
+ /** OSC 9: the progress of ConEmu (`4;state;value`), else a notification of iTerm2 (its text). */
17
+ var TerminalOsc;
18
+ (function (TerminalOsc) {
19
+ function progress(data) {
20
+ var _a;
21
+ const match = /^4(?:;(\d*))?(?:;(\d*))?/.exec(data);
22
+ if (!match) {
23
+ return null;
24
+ }
25
+ const state = PROGRESS_STATES[(_a = match[1]) !== null && _a !== void 0 ? _a : '0'];
26
+ if (!state) {
27
+ return undefined;
28
+ }
29
+ const value = match[2] ? Math.min(100, Math.max(0, Number(match[2]))) : undefined;
30
+ // A state without a number keeps no value; busy has none.
31
+ return state === 'busy' || value === undefined ? { state } : { state, value };
32
+ }
33
+ TerminalOsc.progress = progress;
34
+ /** What a terminal that takes OSC 7501 answers its query (`?`) with: the same. */
35
+ TerminalOsc.STATUS_REPLY = '\x1b]7501;?\x1b\\';
36
+ function isStatusQuery(data) {
37
+ return data.startsWith('?');
38
+ }
39
+ TerminalOsc.isStatusQuery = isStatusQuery;
40
+ /**
41
+ * OSC 7501 (superlogical.com/rex/docs/build/program-status): `state=blocked:kind=permission:msg=<base64>`;
42
+ * undefined for idle or cleared, null for what is not a status.
43
+ */
44
+ function status(data) {
45
+ var _a;
46
+ const pairs = new Map();
47
+ for (const pair of data.split(':')) {
48
+ const at = pair.indexOf('=');
49
+ if (at > 0) {
50
+ pairs.set(pair.slice(0, at), pair.slice(at + 1));
51
+ }
52
+ }
53
+ const state = STATUS_STATES[(_a = pairs.get('state')) !== null && _a !== void 0 ? _a : ''];
54
+ if (!state) {
55
+ return null;
56
+ }
57
+ if (state === 'none') {
58
+ return undefined;
59
+ }
60
+ const kind = pairs.get('kind');
61
+ const message = text(pairs.get('msg'));
62
+ const app = pairs.get('app');
63
+ return {
64
+ state,
65
+ ...(state === 'blocked' && kind && BLOCKED_KINDS.has(kind) ? { kind: kind } : {}),
66
+ ...(message ? { message } : {}),
67
+ ...(app && APP.test(app) ? { app } : {}),
68
+ };
69
+ }
70
+ TerminalOsc.status = status;
71
+ /** The base64 UTF-8 of `msg`, one line; undefined for none, or what does not decode. */
72
+ function text(base64) {
73
+ if (!base64) {
74
+ return undefined;
75
+ }
76
+ try {
77
+ const bytes = Uint8Array.from(atob(base64), char => char.charCodeAt(0));
78
+ return (new TextDecoder('utf-8', { fatal: true })
79
+ .decode(bytes)
80
+ .replace(/\p{Cc}/gu, ' ')
81
+ .trim() || undefined);
82
+ }
83
+ catch (_a) {
84
+ return undefined;
85
+ }
86
+ }
87
+ /** OSC 777: `notify;title;body`, as rxvt and Ghostty take it; null for anything else. */
88
+ function notification(data) {
89
+ const [kind, ...rest] = data.split(';');
90
+ return kind === 'notify' ? rest.filter(Boolean).join(': ') : null;
91
+ }
92
+ TerminalOsc.notification = notification;
93
+ })(TerminalOsc || (exports.TerminalOsc = TerminalOsc = {}));
94
+ //# 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';
3
+ import type { WebTerminal, WebTerminalKey, WebTerminalOptions, WebTerminalProgress, WebTerminalStatus } from '../extension/web-extension-api';
4
4
  import type { OpenLinkOptions } from '../links/links-protocol';
5
5
  import { type TaSettings } from '../settings/settings-protocol';
6
6
  import type { LinkTarget } from '../util/link';
@@ -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;
@@ -1,11 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DefaultWebTerminal = exports.TerminalKeys = exports.TerminalOsc = exports.XtermLoader = void 0;
3
+ exports.DefaultWebTerminal = exports.TerminalKeys = exports.XtermLoader = void 0;
4
4
  const device_1 = require("../device/device");
5
5
  const messages_1 = require("../i18n/messages");
6
6
  const agent_settings_1 = require("../settings/agent-settings");
7
7
  const settings_protocol_1 = require("../settings/settings-protocol");
8
8
  const terminal_links_1 = require("./terminal-links");
9
+ const terminal_osc_1 = require("./terminal-osc");
9
10
  const terminal_theme_1 = require("./terminal-theme");
10
11
  /** Loads xterm.js the first time a terminal is made, not with the page. */
11
12
  var XtermLoader;
@@ -28,32 +29,6 @@ const MAX_WRAPPED_ROWS = 50;
28
29
  /** A view being dragged to a new size fits once it stops. */
29
30
  const FIT_MS = 50;
30
31
  const ARROWS = { ArrowUp: 'A', ArrowDown: 'B', ArrowRight: 'C', ArrowLeft: 'D' };
31
- const PROGRESS_STATES = { '1': 'normal', '2': 'error', '3': 'busy', '4': 'paused' };
32
- /** OSC 9: the progress of ConEmu (`4;state;value`), else a notification of iTerm2 (its text). */
33
- var TerminalOsc;
34
- (function (TerminalOsc) {
35
- function progress(data) {
36
- var _a;
37
- const match = /^4(?:;(\d*))?(?:;(\d*))?/.exec(data);
38
- if (!match) {
39
- return null;
40
- }
41
- const state = PROGRESS_STATES[(_a = match[1]) !== null && _a !== void 0 ? _a : '0'];
42
- if (!state) {
43
- return undefined;
44
- }
45
- const value = match[2] ? Math.min(100, Math.max(0, Number(match[2]))) : undefined;
46
- // A state without a number keeps no value; busy has none.
47
- return state === 'busy' || value === undefined ? { state } : { state, value };
48
- }
49
- TerminalOsc.progress = progress;
50
- /** OSC 777: `notify;title;body`, as rxvt and Ghostty take it; null for anything else. */
51
- function notification(data) {
52
- const [kind, ...rest] = data.split(';');
53
- return kind === 'notify' ? rest.filter(Boolean).join(': ') : null;
54
- }
55
- TerminalOsc.notification = notification;
56
- })(TerminalOsc || (exports.TerminalOsc = TerminalOsc = {}));
57
32
  var TerminalKeys;
58
33
  (function (TerminalKeys) {
59
34
  /**
@@ -115,6 +90,7 @@ class DefaultWebTerminal {
115
90
  this.titleListeners = new Set();
116
91
  this.progressListeners = new Set();
117
92
  this.attentionListeners = new Set();
93
+ this.statusListeners = new Set();
118
94
  this.host = document.createElement('div');
119
95
  this.cols = (_a = options.cols) !== null && _a !== void 0 ? _a : DEFAULT_COLS;
120
96
  this.rows = (_b = options.rows) !== null && _b !== void 0 ? _b : DEFAULT_ROWS;
@@ -150,6 +126,10 @@ class DefaultWebTerminal {
150
126
  this.progressListeners.add(listener);
151
127
  return () => this.progressListeners.delete(listener);
152
128
  }
129
+ onStatusChange(listener) {
130
+ this.statusListeners.add(listener);
131
+ return () => this.statusListeners.delete(listener);
132
+ }
153
133
  onAttention(listener) {
154
134
  this.attentionListeners.add(listener);
155
135
  return () => this.attentionListeners.delete(listener);
@@ -225,6 +205,7 @@ class DefaultWebTerminal {
225
205
  this.titleListeners.clear();
226
206
  this.progressListeners.clear();
227
207
  this.attentionListeners.clear();
208
+ this.statusListeners.clear();
228
209
  }
229
210
  start(module) {
230
211
  if (this.disposed) {
@@ -297,7 +278,7 @@ class DefaultWebTerminal {
297
278
  });
298
279
  term.parser.registerOscHandler(9, data => {
299
280
  var _a, _b;
300
- const progress = TerminalOsc.progress(data);
281
+ const progress = terminal_osc_1.TerminalOsc.progress(data);
301
282
  if (progress === null) {
302
283
  this.emitAttention(data || undefined);
303
284
  }
@@ -310,12 +291,27 @@ class DefaultWebTerminal {
310
291
  return true;
311
292
  });
312
293
  term.parser.registerOscHandler(777, data => {
313
- const message = TerminalOsc.notification(data);
294
+ const message = terminal_osc_1.TerminalOsc.notification(data);
314
295
  if (message !== null) {
315
296
  this.emitAttention(message || undefined);
316
297
  }
317
298
  return message !== null;
318
299
  });
300
+ // OSC 7501: answered when asked, so that a program (pi) says what it does; the tab shows it.
301
+ term.parser.registerOscHandler(7501, data => {
302
+ if (terminal_osc_1.TerminalOsc.isStatusQuery(data)) {
303
+ this.emitData(terminal_osc_1.TerminalOsc.STATUS_REPLY);
304
+ return true;
305
+ }
306
+ const status = terminal_osc_1.TerminalOsc.status(data);
307
+ if (status !== null && JSON.stringify(status) !== JSON.stringify(this.status)) {
308
+ this.status = status;
309
+ for (const listener of this.statusListeners) {
310
+ listener(status);
311
+ }
312
+ }
313
+ return status !== null;
314
+ });
319
315
  term.onBell(() => this.emitAttention(undefined));
320
316
  term.parser.registerOscHandler(7, data => {
321
317
  const cwd = terminal_links_1.TerminalLinkUtil.cwdOf(data);
@@ -1,4 +1,4 @@
1
- import type { TextSelection } from '../extension/web-extension-api';
1
+ import type { TextSelection, WebFileRef } from '../extension/web-extension-api';
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,5 +76,10 @@ 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
  }
80
85
  //# sourceMappingURL=link.d.ts.map
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.LinkUtil = void 0;
4
+ const ta_protocol_1 = require("@celljs/ta-protocol");
4
5
  const WEB = /^https?:\/\//i;
5
6
  const SCHEME = /^[a-z][a-z\d+.-]*:/i;
6
7
  const WINDOWS_PATH = /^[a-z]:[\\/]/i;
@@ -304,6 +305,16 @@ var LinkUtil;
304
305
  ...(endLine && endLine >= startLine && endColumn && { endColumn }),
305
306
  };
306
307
  }
308
+ /**
309
+ * A file of a conversation in `cwd` as the menus of files take it (WebFileRef): relative to `cwd` when inside it,
310
+ * else as the agent wrote it (an absolute path, which TaWorkspaceServer.fileUrl serves alone).
311
+ */
312
+ function fileRef(cwd, path) {
313
+ const base = ta_protocol_1.TaLocation.path(cwd).replace(/\/+$/, '');
314
+ const relative = base && path.startsWith(`${base}/`) ? path.slice(base.length + 1) : path;
315
+ return { cwd, path: relative, name: path.replace(/\/+$/, '').split('/').pop() || path, kind: 'file' };
316
+ }
317
+ LinkUtil.fileRef = fileRef;
307
318
  function count(text, char) {
308
319
  return text.split(char).length - 1;
309
320
  }
@@ -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;
@@ -46,6 +46,15 @@ class WorkbenchHosts extends workbench_lists_1.WorkbenchLists {
46
46
  }
47
47
  this.keepHosts(hosts_1.HostUtil.keep(this.list, id, credential, account, Date.now()));
48
48
  }
49
+ keepHost(link, name) {
50
+ const credential = workbench_util_1.WorkbenchUtil.credential(link.trim());
51
+ if (!('pairing' in credential)) {
52
+ throw new workbench_util_1.WorkbenchError('refused');
53
+ }
54
+ const id = workbench_util_1.WorkbenchUtil.serverOf(credential, (0, workbench_util_1.pageHost)());
55
+ this.keepHosts(hosts_1.HostUtil.add(this.list, id, credential, name, Date.now()));
56
+ return id;
57
+ }
49
58
  markAccountHost(hostId, account) {
50
59
  // The way the account brought to the same computer before: the one scanned and in use is kept alone.
51
60
  for (let other = hosts_1.HostUtil.other(this.list, hostId, account); other; other = hosts_1.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. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@celljs/ta-web",
3
- "version": "4.38.0",
3
+ "version": "4.40.0",
4
4
  "description": "The web client of ta serve: sessions, streaming messages, tool runs with diffs, and dialogs",
5
5
  "keywords": [
6
6
  "cell-component"
@@ -33,12 +33,12 @@
33
33
  "watch": "tsc -b -w --preserveWatchOutput"
34
34
  },
35
35
  "dependencies": {
36
- "@celljs/core": "4.38.0",
37
- "@celljs/react": "4.38.0",
38
- "@celljs/ta-client": "4.38.0",
39
- "@celljs/ta-protocol": "4.38.0",
40
- "@celljs/ta-relay": "4.38.0",
41
- "@celljs/widget": "4.38.0",
36
+ "@celljs/core": "4.40.0",
37
+ "@celljs/react": "4.40.0",
38
+ "@celljs/ta-client": "4.40.0",
39
+ "@celljs/ta-protocol": "4.40.0",
40
+ "@celljs/ta-relay": "4.40.0",
41
+ "@celljs/widget": "4.40.0",
42
42
  "@types/three": "^0.187.0",
43
43
  "@xterm/addon-fit": "^0.11.0",
44
44
  "@xterm/addon-unicode11": "^0.9.0",