@celljs/ta-web 4.44.0 → 4.45.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. package/README.en.md +1 -1
  2. package/README.md +1 -1
  3. package/esm/browser/components/cloud-sign-in-view.d.ts +1 -1
  4. package/esm/browser/components/composer-target.d.ts +2 -0
  5. package/esm/browser/components/composer-target.js +4 -0
  6. package/esm/browser/components/hearing-host.d.ts +2 -1
  7. package/esm/browser/components/hearing-host.js +10 -7
  8. package/esm/browser/components/host-view.d.ts +1 -1
  9. package/esm/browser/extension/web-api-desktop.d.ts +14 -0
  10. package/esm/browser/extension/web-api-spec.js +1 -0
  11. package/esm/browser/extension/web-extension-api.d.ts +9 -2
  12. package/esm/browser/extension/web-extension-context.js +3 -0
  13. package/esm/browser/i18n/en/chat.d.ts +1 -0
  14. package/esm/browser/i18n/en/chat.js +1 -0
  15. package/esm/browser/i18n/en/service.js +1 -1
  16. package/esm/browser/i18n/en/tools.d.ts +5 -0
  17. package/esm/browser/i18n/en/tools.js +5 -0
  18. package/esm/browser/i18n/ja/chat.js +1 -0
  19. package/esm/browser/i18n/ja/service.js +1 -1
  20. package/esm/browser/i18n/ja/tools.js +5 -0
  21. package/esm/browser/i18n/locales.d.ts +7 -1
  22. package/esm/browser/i18n/messages.d.ts +6 -0
  23. package/esm/browser/i18n/zh/chat.js +1 -0
  24. package/esm/browser/i18n/zh/service.js +1 -1
  25. package/esm/browser/i18n/zh/tools.js +5 -0
  26. package/esm/browser/i18n/zh-tw/chat.js +1 -0
  27. package/esm/browser/i18n/zh-tw/service.js +1 -1
  28. package/esm/browser/i18n/zh-tw/tools.js +5 -0
  29. package/esm/browser/sandbox/sandbox-runtime-code.js +1 -1
  30. package/esm/browser/util/desktop.d.ts +11 -1
  31. package/esm/browser/util/desktop.js +30 -0
  32. package/esm/browser/util/tool.js +15 -5
  33. package/esm/browser/util/voice.js +10 -2
  34. package/lib/browser/components/cloud-sign-in-view.d.ts +1 -1
  35. package/lib/browser/components/composer-target.d.ts +2 -0
  36. package/lib/browser/components/composer-target.js +4 -0
  37. package/lib/browser/components/hearing-host.d.ts +2 -1
  38. package/lib/browser/components/hearing-host.js +9 -6
  39. package/lib/browser/components/host-view.d.ts +1 -1
  40. package/lib/browser/extension/web-api-desktop.d.ts +14 -0
  41. package/lib/browser/extension/web-api-spec.js +1 -0
  42. package/lib/browser/extension/web-extension-api.d.ts +9 -2
  43. package/lib/browser/extension/web-extension-context.js +3 -0
  44. package/lib/browser/i18n/en/chat.d.ts +1 -0
  45. package/lib/browser/i18n/en/chat.js +1 -0
  46. package/lib/browser/i18n/en/service.js +1 -1
  47. package/lib/browser/i18n/en/tools.d.ts +5 -0
  48. package/lib/browser/i18n/en/tools.js +5 -0
  49. package/lib/browser/i18n/ja/chat.js +1 -0
  50. package/lib/browser/i18n/ja/service.js +1 -1
  51. package/lib/browser/i18n/ja/tools.js +5 -0
  52. package/lib/browser/i18n/locales.d.ts +7 -1
  53. package/lib/browser/i18n/messages.d.ts +6 -0
  54. package/lib/browser/i18n/zh/chat.js +1 -0
  55. package/lib/browser/i18n/zh/service.js +1 -1
  56. package/lib/browser/i18n/zh/tools.js +5 -0
  57. package/lib/browser/i18n/zh-tw/chat.js +1 -0
  58. package/lib/browser/i18n/zh-tw/service.js +1 -1
  59. package/lib/browser/i18n/zh-tw/tools.js +5 -0
  60. package/lib/browser/sandbox/sandbox-runtime-code.js +1 -1
  61. package/lib/browser/util/desktop.d.ts +11 -1
  62. package/lib/browser/util/desktop.js +30 -0
  63. package/lib/browser/util/tool.js +15 -5
  64. package/lib/browser/util/voice.js +10 -2
  65. package/package.json +7 -7
@@ -1,5 +1,8 @@
1
+ import type { WebviewTabEvent } from '../extension/web-api-desktop';
1
2
  /** What Ta Desktop can do for the page beyond a tab of a browser. */
2
- export type DesktopFeature = 'webview' | 'debugWebview' | 'showItemInFolder' | 'browserData' | 'recentShots' | 'notices' | 'speech' | 'restart' | 'links' | 'call'
3
+ export type DesktopFeature = 'webview' | 'debugWebview'
4
+ /** What the pages of its webviews open as tabs, and Cmd+T and Cmd+W in them, go to the page (webviewTabs). */
5
+ | 'webviewTabs' | 'showItemInFolder' | 'browserData' | 'recentShots' | 'notices' | 'speech' | 'restart' | 'links' | 'call'
3
6
  /** It lets the page open the window of a video call (window.open('about:blank', 'ta-video-call')). */
4
7
  | 'callWindow'
5
8
  /** It pins the window of a video call above every window, or not (callWindowPin). */
@@ -119,6 +122,13 @@ export declare namespace DesktopUtil {
119
122
  /** The pages installed as apps, where Ta Desktop installs them. */
120
123
  function apps(scope?: object): DesktopApps | undefined;
121
124
  function browserData(scope?: object): DesktopBrowserData | undefined;
125
+ /**
126
+ * Hears the tabs the pages of this page's webviews open or close (a link to a new tab, Cmd+T, Cmd+W); hearing tells
127
+ * Ta Desktop the page has tabs, until it loads again. `undefined` elsewhere, and in an older Ta Desktop.
128
+ */
129
+ function webviewTabs(scope?: object): ((listener: (event: WebviewTabEvent) => void) => () => void) | undefined;
130
+ /** A tab Ta Desktop tells of, as it should be; `undefined` otherwise. */
131
+ function webviewTab(event: unknown): WebviewTabEvent | undefined;
122
132
  /** `debugWebview` of Ta Desktop; `undefined` elsewhere. */
123
133
  function debugWebview(scope?: object): DebugWebview | undefined;
124
134
  /**
@@ -94,6 +94,36 @@ var DesktopUtil;
94
94
  });
95
95
  }
96
96
  DesktopUtil.browserData = browserData;
97
+ /**
98
+ * Hears the tabs the pages of this page's webviews open or close (a link to a new tab, Cmd+T, Cmd+W); hearing tells
99
+ * Ta Desktop the page has tabs, until it loads again. `undefined` elsewhere, and in an older Ta Desktop.
100
+ */
101
+ function webviewTabs(scope = globalThis) {
102
+ var _a, _b;
103
+ const onEvent = (_b = (_a = scope.taDesktop) === null || _a === void 0 ? void 0 : _a.webviewTabs) === null || _b === void 0 ? void 0 : _b.onEvent;
104
+ if (!has('webviewTabs', scope) || typeof onEvent !== 'function') {
105
+ return undefined;
106
+ }
107
+ return listener => onEvent((event) => {
108
+ const tab = webviewTab(event);
109
+ if (tab) {
110
+ listener(tab);
111
+ }
112
+ });
113
+ }
114
+ DesktopUtil.webviewTabs = webviewTabs;
115
+ /** A tab Ta Desktop tells of, as it should be; `undefined` otherwise. */
116
+ function webviewTab(event) {
117
+ const { type, from, url, background } = (event !== null && event !== void 0 ? event : {});
118
+ if (typeof from !== 'number') {
119
+ return undefined;
120
+ }
121
+ if (type === 'open') {
122
+ return typeof url === 'string' ? { type, url, background: background === true, from } : undefined;
123
+ }
124
+ return type === 'new' || type === 'close' ? { type, from } : undefined;
125
+ }
126
+ DesktopUtil.webviewTab = webviewTab;
97
127
  /** `debugWebview` of Ta Desktop; `undefined` elsewhere. */
98
128
  function debugWebview(scope = globalThis) {
99
129
  const desktop = scope.taDesktop;
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ToolUtil = void 0;
4
+ const ta_protocol_1 = require("@celljs/ta-protocol");
4
5
  const mcp_words_1 = require("./mcp-words");
5
6
  const message_1 = require("./message");
6
7
  const shell_words_1 = require("./shell-words");
@@ -61,6 +62,11 @@ const AGENT_TOOL_VERBS = {
61
62
  CronDelete: 'ta.tool.verb.deleteScheduled',
62
63
  Artifact: 'ta.tool.verb.publish',
63
64
  ImageEdit: 'ta.tool.verb.editImage',
65
+ ImageGen: 'ta.tool.verb.generateImage',
66
+ VideoGen: 'ta.tool.verb.generateVideo',
67
+ ToolSearch: 'ta.tool.verb.findTools',
68
+ DeferExecuteTool: 'ta.tool.verb.callTool',
69
+ PushNotification: 'ta.tool.verb.notify',
64
70
  };
65
71
  const TARGET_CHARS = 160;
66
72
  function str(value) {
@@ -112,7 +118,7 @@ var ToolUtil;
112
118
  */
113
119
  function summary(name, args, resolvers, input) {
114
120
  var _a, _b;
115
- var _c, _d;
121
+ var _c, _d, _e;
116
122
  if (resolvers === null || resolvers === void 0 ? void 0 : resolvers.length) {
117
123
  try {
118
124
  const drawn = (_b = (_a = renderer(resolvers, name)) === null || _a === void 0 ? void 0 : _a.renderCall) === null || _b === void 0 ? void 0 : _b.call(_a, args);
@@ -172,14 +178,18 @@ var ToolUtil;
172
178
  if (kind === 'execute') {
173
179
  return { ...command(tool, str(args.target) || str(args.title)), name: tool };
174
180
  }
175
- if (str(args.tool) === 'REPL' && target && target !== tool) {
176
- return { verb: AGENT_TOOL_VERBS.REPL, name: tool, target, code: false, titled: true };
181
+ // What it is on, when the agent said it only after the call was shown: from what it was given, a
182
+ // path by its end.
183
+ const given = line((_d = ta_protocol_1.TaAgentToolUtil.target(kind, input !== null && input !== void 0 ? input : {})) !== null && _d !== void 0 ? _d : '');
184
+ const on = target && target !== tool ? target : given.startsWith('/') ? short(given) : given;
185
+ if (str(args.tool) === 'REPL' && on) {
186
+ return { verb: AGENT_TOOL_VERBS.REPL, name: tool, target: on, code: false, titled: true };
177
187
  }
178
188
  const file = ['read', 'edit', 'delete', 'move'].includes(kind);
179
189
  return {
180
- verb: (_d = AGENT_TOOL_VERBS[str(args.tool)]) !== null && _d !== void 0 ? _d : AGENT_VERBS[kind],
190
+ verb: (_e = AGENT_TOOL_VERBS[str(args.tool)]) !== null && _e !== void 0 ? _e : AGENT_VERBS[kind],
181
191
  name: tool,
182
- target: target === tool ? '' : file ? short(target) : target,
192
+ target: file ? short(on) : on,
183
193
  code: kind === 'execute' || kind === 'search',
184
194
  };
185
195
  }
@@ -63,10 +63,18 @@ var Voice;
63
63
  'Swift',
64
64
  'Cell',
65
65
  ];
66
+ /**
67
+ * The recognition of the browser. Not in the Ta app on Android: its web-view has Chromium's, with no service behind
68
+ * it, which fails (`audio-capture`, `network`) or waits without end whatever the phone has; Ta listens there.
69
+ */
66
70
  function recognitionClass() {
67
- var _a;
71
+ var _a, _b;
72
+ var _c;
73
+ if (((_b = (_a = globalThis.Capacitor) === null || _a === void 0 ? void 0 : _a.getPlatform) === null || _b === void 0 ? void 0 : _b.call(_a)) === 'android') {
74
+ return undefined;
75
+ }
68
76
  const scope = globalThis;
69
- return (_a = scope.SpeechRecognition) !== null && _a !== void 0 ? _a : scope.webkitSpeechRecognition;
77
+ return (_c = scope.SpeechRecognition) !== null && _c !== void 0 ? _c : scope.webkitSpeechRecognition;
70
78
  }
71
79
  /**
72
80
  * Apple's recognizer: of the Ta app on iOS, where WebKit's repeats what it heard and leaves out punctuation, and of
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@celljs/ta-web",
3
- "version": "4.44.0",
3
+ "version": "4.45.1",
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.44.0",
37
- "@celljs/react": "4.44.0",
38
- "@celljs/ta-client": "4.44.0",
39
- "@celljs/ta-protocol": "4.44.0",
40
- "@celljs/ta-relay": "4.44.0",
41
- "@celljs/widget": "4.44.0",
36
+ "@celljs/core": "4.45.1",
37
+ "@celljs/react": "4.45.1",
38
+ "@celljs/ta-client": "4.45.1",
39
+ "@celljs/ta-protocol": "4.45.1",
40
+ "@celljs/ta-relay": "4.45.1",
41
+ "@celljs/widget": "4.45.1",
42
42
  "@types/three": "^0.187.0",
43
43
  "@xterm/addon-fit": "^0.11.0",
44
44
  "@xterm/addon-unicode11": "^0.9.0",