@celljs/ta-host 4.16.0 → 4.17.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 (75) hide show
  1. package/esm/node/app-commands.d.ts +111 -0
  2. package/esm/node/app-commands.js +629 -0
  3. package/esm/node/delegate-extension.d.ts +11 -0
  4. package/esm/node/delegate-extension.js +33 -0
  5. package/esm/node/directory-relocator.d.ts +49 -0
  6. package/esm/node/directory-relocator.js +267 -0
  7. package/esm/node/extension-providers.d.ts +16 -1
  8. package/esm/node/extension-providers.js +23 -3
  9. package/esm/node/index.d.ts +6 -0
  10. package/esm/node/index.js +6 -0
  11. package/esm/node/keep-awake.d.ts +5 -1
  12. package/esm/node/keep-awake.js +18 -2
  13. package/esm/node/message-page.d.ts +6 -1
  14. package/esm/node/message-page.js +50 -2
  15. package/esm/node/package-hosts.d.ts +6 -0
  16. package/esm/node/package-hosts.js +35 -0
  17. package/esm/node/package-webhooks.d.ts +26 -0
  18. package/esm/node/package-webhooks.js +101 -0
  19. package/esm/node/page-book.d.ts +48 -0
  20. package/esm/node/page-book.js +117 -0
  21. package/esm/node/relay-bridge.d.ts +2 -0
  22. package/esm/node/relay-bridge.js +35 -1
  23. package/esm/node/rooms-bridge.d.ts +3 -0
  24. package/esm/node/rooms-bridge.js +4 -0
  25. package/esm/node/session-info-util.d.ts +3 -1
  26. package/esm/node/session-info-util.js +32 -6
  27. package/esm/node/ta-server-impl.d.ts +5 -1
  28. package/esm/node/ta-server-impl.js +22 -0
  29. package/esm/node/ta-session-factory.d.ts +13 -1
  30. package/esm/node/ta-session-factory.js +39 -4
  31. package/esm/node/ta-session.d.ts +2 -0
  32. package/esm/node/ta-session.js +1 -0
  33. package/esm/node/team/team-calls.js +22 -0
  34. package/esm/node/voice-bridge.d.ts +68 -0
  35. package/esm/node/voice-bridge.js +273 -0
  36. package/esm/node/voices-file.d.ts +33 -0
  37. package/esm/node/voices-file.js +89 -0
  38. package/lib/node/app-commands.d.ts +112 -0
  39. package/lib/node/app-commands.js +633 -0
  40. package/lib/node/delegate-extension.d.ts +12 -0
  41. package/lib/node/delegate-extension.js +37 -0
  42. package/lib/node/directory-relocator.d.ts +50 -0
  43. package/lib/node/directory-relocator.js +270 -0
  44. package/lib/node/extension-providers.d.ts +16 -1
  45. package/lib/node/extension-providers.js +23 -3
  46. package/lib/node/index.d.ts +6 -0
  47. package/lib/node/index.js +6 -0
  48. package/lib/node/keep-awake.d.ts +5 -1
  49. package/lib/node/keep-awake.js +18 -2
  50. package/lib/node/message-page.d.ts +6 -1
  51. package/lib/node/message-page.js +50 -2
  52. package/lib/node/package-hosts.d.ts +6 -0
  53. package/lib/node/package-hosts.js +35 -0
  54. package/lib/node/package-webhooks.d.ts +27 -0
  55. package/lib/node/package-webhooks.js +104 -0
  56. package/lib/node/page-book.d.ts +49 -0
  57. package/lib/node/page-book.js +120 -0
  58. package/lib/node/relay-bridge.d.ts +2 -0
  59. package/lib/node/relay-bridge.js +34 -0
  60. package/lib/node/rooms-bridge.d.ts +3 -0
  61. package/lib/node/rooms-bridge.js +4 -0
  62. package/lib/node/session-info-util.d.ts +3 -1
  63. package/lib/node/session-info-util.js +31 -5
  64. package/lib/node/ta-server-impl.d.ts +5 -1
  65. package/lib/node/ta-server-impl.js +22 -0
  66. package/lib/node/ta-session-factory.d.ts +13 -1
  67. package/lib/node/ta-session-factory.js +38 -3
  68. package/lib/node/ta-session.d.ts +2 -0
  69. package/lib/node/ta-session.js +1 -0
  70. package/lib/node/team/team-calls.js +22 -0
  71. package/lib/node/voice-bridge.d.ts +69 -0
  72. package/lib/node/voice-bridge.js +274 -0
  73. package/lib/node/voices-file.d.ts +34 -0
  74. package/lib/node/voices-file.js +93 -0
  75. package/package.json +10 -10
@@ -13,11 +13,12 @@ var SessionInfoUtil;
13
13
  * a skill the user ran is `/skill:name` and what follows, not the skill's file.
14
14
  */
15
15
  function firstMessage(messages) {
16
+ var _a;
16
17
  for (const message of messages) {
17
18
  if (message.role !== 'user') {
18
19
  continue;
19
20
  }
20
- const line = userWords(text(message.content))
21
+ const line = ((_a = noteWords(userWords(text(message.content)))) !== null && _a !== void 0 ? _a : '')
21
22
  .split('\n')
22
23
  .map(part => part.trim())
23
24
  .find(Boolean);
@@ -32,7 +33,9 @@ var SessionInfoUtil;
32
33
  * The text of the last message of the user or the agent that has some, on one line and cut to a preview's
33
34
  * length, as a messaging app shows the last thing said under its name: without its context, the marks of
34
35
  * markdown at the start of its lines, and the thinking and tool calls of the agent; a skill the user ran is
35
- * `/skill:name` and what follows, as the title says it, not the skill's file.
36
+ * `/skill:name` and what follows, as the title says it, not the skill's file. A note of the double's tasks
37
+ * (TaTaskNote) says the task: how one ended is its title and what it said, one handed to the double its title,
38
+ * and a note of a new id, for the double only, is passed over.
36
39
  */
37
40
  function lastMessage(messages) {
38
41
  for (let i = messages.length - 1; i >= 0; i--) {
@@ -40,14 +43,17 @@ var SessionInfoUtil;
40
43
  if (message.role !== 'user' && message.role !== 'assistant') {
41
44
  continue;
42
45
  }
43
- const said = message.role === 'user' ? userWords(text(message.content)) : ta_protocol_1.TaAgentSummary.strip(text(message.content));
46
+ const said = message.role === 'user' ? noteWords(userWords(text(message.content))) : ta_protocol_1.TaAgentSummary.strip(text(message.content));
47
+ if (said === undefined) {
48
+ continue;
49
+ }
44
50
  // A list asks for it every few seconds: only the start of a long reply is read, enough for a preview.
45
51
  const read = said.slice(0, PREVIEW_READ);
46
- const line = (withoutFences(read) || read)
52
+ const line = plain(withoutFences(read) || read)
47
53
  .split('\n')
48
54
  .map(part => part
49
55
  .replace(/^\s*(?:#{1,6}\s+|>\s*|[-*+]\s+|\d+\.\s+)/, '')
50
- .replace(/[*_`]{1,3}/g, '')
56
+ .replace(/[*`]{1,3}|(?<![\p{L}\p{N}])_{1,3}|_{1,3}(?![\p{L}\p{N}])/gu, '')
51
57
  .trim())
52
58
  .filter(Boolean)
53
59
  .join(' ')
@@ -81,12 +87,32 @@ var SessionInfoUtil;
81
87
  }
82
88
  return kept.join('\n').trim();
83
89
  }
90
+ /**
91
+ * Markdown's pictures and links as a messenger says them: a link by its words, pictures left out of a message that
92
+ * says something else, and by the words that name them in one of pictures only.
93
+ */
94
+ function plain(text) {
95
+ const linked = text.replace(/(?<!!)\[([^\]\n]*)\]\([^)\n]*\)/g, '$1');
96
+ const words = linked.replace(/!\[[^\]\n]*\]\([^)\n]*\)/g, '').trim();
97
+ return words || linked.replace(/!\[([^\]\n]*)\]\([^)\n]*\)/g, '$1');
98
+ }
84
99
  /** What the user typed of a message: without its context and pi's notes of images, a skill as `/skill:name` and what follows. */
85
100
  function userWords(content) {
86
101
  const said = ta_protocol_1.TaImageNote.strip(ta_protocol_1.TaMessageContext.strip(content));
87
102
  const skill = ta_protocol_1.TaSkillUse.parse(said);
88
103
  return skill ? ta_protocol_1.TaSkillUse.command(skill) : said;
89
104
  }
105
+ /** What a message of the user says when it is a note of a task: its title and how it ended; undefined for one the double alone reads. */
106
+ function noteWords(said) {
107
+ const note = ta_protocol_1.TaTaskNote.parse(said);
108
+ if (!note) {
109
+ return said;
110
+ }
111
+ if (note.kind === 'renamed') {
112
+ return undefined;
113
+ }
114
+ return note.kind === 'update' && note.body.trim() ? `${note.title} · ${note.body}` : note.title;
115
+ }
90
116
  /** The time of the last message that has one, else `fallback`. */
91
117
  function updatedAt(messages, fallback) {
92
118
  for (let i = messages.length - 1; i >= 0; i--) {
@@ -1,5 +1,6 @@
1
1
  import { ExecEnvironmentFactory } from '@celljs/ta-exec';
2
- import { type ImageContent, type RpcExtensionUIResponse, type TaAttachOptions, type TaAttachResult, type TaClientToolResult, type TaCommandResult, type TaForkFileResult, type TaMessagePage, type TaNavigateResult, type TaOpenedSession, type TaOpenSessionOptions, type TaPromptInput, type TaPromptReceipt, type TaSavedSessionInfo, type TaSavedSessionQuery, TaServer, type TaServerInfo, type TaSessionInfo, type TaSlashCommand, type ThinkingLevel } from '@celljs/ta-protocol';
2
+ import { type ImageContent, type RpcExtensionUIResponse, type TaAttachOptions, type TaAttachResult, type TaClientToolResult, type TaCommandResult, type TaForkFileResult, type TaMessagePage, type TaNavigateResult, type TaOpenedSession, type TaOpenSessionOptions, type TaPromptInput, type TaPromptReceipt, type TaRelocateResult, type TaSavedSessionInfo, type TaSavedSessionQuery, TaServer, type TaServerInfo, type TaSessionInfo, type TaSlashCommand, type ThinkingLevel } from '@celljs/ta-protocol';
3
+ import { TaDirectoryRelocator } from './directory-relocator';
3
4
  import { TaSessionCatalog, TaSessionFactory, TaSessionRegistry } from './host-protocol';
4
5
  import { TaServeUpdates } from './serve-updates';
5
6
  import type { TaSession } from './ta-session';
@@ -21,6 +22,7 @@ export declare class TaServerImpl implements TaServer {
21
22
  protected readonly authority: TaAuthority;
22
23
  protected readonly visibility: TaVisibility;
23
24
  protected readonly updates: TaServeUpdates;
25
+ protected readonly relocator: TaDirectoryRelocator;
24
26
  getServerInfo(): Promise<TaServerInfo>;
25
27
  restartServer(): Promise<void>;
26
28
  setWorkingDirectory(cwd: string): Promise<TaServerInfo>;
@@ -73,6 +75,8 @@ export declare class TaServerImpl implements TaServer {
73
75
  switchSession(sessionId: string, sessionPath: string): Promise<TaCommandResult<'switch_session'>>;
74
76
  fork(sessionId: string, entryId: string, position?: 'before' | 'at'): Promise<TaCommandResult<'fork'>>;
75
77
  forkToFile(sessionId: string, entryId: string, position?: 'before' | 'at'): Promise<TaForkFileResult>;
78
+ forkHere(sessionId: string): Promise<TaForkFileResult>;
79
+ relocateDirectory(from: string, to: string): Promise<TaRelocateResult>;
76
80
  clone(sessionId: string): Promise<TaCommandResult<'clone'>>;
77
81
  getForkMessages(sessionId: string): Promise<TaCommandResult<'get_fork_messages'>>;
78
82
  getEntries(sessionId: string, since?: string): Promise<TaCommandResult<'get_entries'>>;
@@ -19,6 +19,7 @@ const node_1 = require("@celljs/rpc/lib/node");
19
19
  const ta_exec_1 = require("@celljs/ta-exec");
20
20
  const serve_restart_1 = require("@celljs/ta-harness/lib/node/serve-restart");
21
21
  const ta_protocol_1 = require("@celljs/ta-protocol");
22
+ const directory_relocator_1 = require("./directory-relocator");
22
23
  const host_protocol_1 = require("./host-protocol");
23
24
  const serve_updates_1 = require("./serve-updates");
24
25
  const session_info_util_1 = require("./session-info-util");
@@ -318,6 +319,23 @@ let TaServerImpl = class TaServerImpl {
318
319
  return { sessionFile, text };
319
320
  });
320
321
  }
322
+ forkHere(sessionId) {
323
+ return this.on(sessionId, async ({ pi }) => {
324
+ var _a;
325
+ var _b;
326
+ const file = pi.sessionManager.getSessionFile();
327
+ if (!file || !(0, node_fs_1.existsSync)(file)) {
328
+ return {};
329
+ }
330
+ const sdk = await ai_coding_agent_1.PiSdkUtil.load();
331
+ const sessionFile = sdk.SessionManager.forkFrom(file, pi.sessionManager.getCwd()).getSessionFile();
332
+ this.runs.created(sessionFile, (_b = (_a = this.sessions.locate(sessionId)) === null || _a === void 0 ? void 0 : _a.cwd) !== null && _b !== void 0 ? _b : '');
333
+ return { sessionFile };
334
+ });
335
+ }
336
+ relocateDirectory(from, to) {
337
+ return this.guard(() => this.relocator.relocate(from, to));
338
+ }
321
339
  clone(sessionId) {
322
340
  return this.authored(sessionId, async ({ pi, runtime }) => {
323
341
  const leafId = pi.sessionManager.getLeafId();
@@ -439,6 +457,10 @@ __decorate([
439
457
  (0, core_1.Autowired)(serve_updates_1.TaServeUpdates),
440
458
  __metadata("design:type", Object)
441
459
  ], TaServerImpl.prototype, "updates", void 0);
460
+ __decorate([
461
+ (0, core_1.Autowired)(directory_relocator_1.TaDirectoryRelocator),
462
+ __metadata("design:type", Object)
463
+ ], TaServerImpl.prototype, "relocator", void 0);
442
464
  exports.TaServerImpl = TaServerImpl = __decorate([
443
465
  (0, rpc_1.Rpc)(ta_protocol_1.TaServer)
444
466
  ], TaServerImpl);
@@ -7,6 +7,7 @@ import { type TaHostOptions, TaSessionFactory } from './host-protocol';
7
7
  import { PackageHosts } from './package-hosts';
8
8
  import { PiDirectories } from './remote/remote-protocol';
9
9
  import { TaSession } from './ta-session';
10
+ import { TaWorkingDirectory } from './working-directory';
10
11
  type AgentsFilesOverride = (base: {
11
12
  agentsFiles: ContextFile[];
12
13
  }) => {
@@ -20,6 +21,8 @@ export declare namespace SessionFileUtil {
20
21
  * not there, and pi would take the directory ta serve runs in, the home directory under the desktop app.
21
22
  */
22
23
  function cwdOverride(sessionFile: string, cwd: string): string | undefined;
24
+ /** `path` when it is a directory there now. */
25
+ function existing(path: string | undefined): string | undefined;
23
26
  }
24
27
  type ModelRuntime = import('@earendil-works/pi-coding-agent', { with: { 'resolution-mode': 'import' } }).ModelRuntime;
25
28
  type AgentSessionServices = import('@earendil-works/pi-coding-agent', { with: { 'resolution-mode': 'import' } }).AgentSessionServices;
@@ -43,6 +46,7 @@ export declare class DefaultTaSessionFactory implements TaSessionFactory {
43
46
  protected readonly tools: AgentTool[];
44
47
  protected readonly packageHosts: PackageHosts;
45
48
  protected readonly directories: PiDirectories;
49
+ protected readonly workingDirectory?: TaWorkingDirectory;
46
50
  protected readonly extensionProviders: ExtensionProviders;
47
51
  create(requested: TaOpenSessionOptions, requestClose: (session: TaSession, idle?: boolean) => void, id?: string): Promise<TaSession>;
48
52
  commands(cwd: string): Promise<TaSlashCommand[]>;
@@ -51,7 +55,15 @@ export declare class DefaultTaSessionFactory implements TaSessionFactory {
51
55
  * those of Ta. `commandsOnly`: for what a session would have, the context files of another machine not read.
52
56
  */
53
57
  protected services(sdk: PiSdk, options: ServicesOptions): Promise<AgentSessionServices>;
54
- protected openSessionManager(sdk: PiSdk, options: TaOpenSessionOptions): SessionManager;
58
+ /**
59
+ * pi's manager of the session file asked, or of a new one. A file whose directory is no longer there goes on
60
+ * in the directory of the server (TaWorkingDirectory), else the home directory, as pi's Continue: `movedFrom`, the directory as
61
+ * the file says it.
62
+ */
63
+ protected openSessionManager(sdk: PiSdk, options: TaOpenSessionOptions): {
64
+ sessionManager: SessionManager;
65
+ movedFrom?: string;
66
+ };
55
67
  /**
56
68
  * For another machine, its context files (AGENTS.md...) instead of those pi finds above the directory
57
69
  * of this machine it works in; the user's own, in the agent directory, stay.
@@ -11,12 +11,14 @@ var __metadata = (this && this.__metadata) || function (k, v) {
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.DefaultTaSessionFactory = exports.SessionFileUtil = void 0;
13
13
  const node_fs_1 = require("node:fs");
14
+ const node_os_1 = require("node:os");
14
15
  const node_path_1 = require("node:path");
15
16
  const ai_coding_agent_1 = require("@celljs/ai-coding-agent");
16
17
  const core_1 = require("@celljs/core");
17
18
  const ta_exec_1 = require("@celljs/ta-exec");
18
19
  const ta_harness_1 = require("@celljs/ta-harness");
19
20
  const client_tool_broker_1 = require("./client-tool-broker");
21
+ const delegate_extension_1 = require("./delegate-extension");
20
22
  const extension_providers_1 = require("./extension-providers");
21
23
  const host_protocol_1 = require("./host-protocol");
22
24
  const package_host_extension_1 = require("./package-host-extension");
@@ -27,6 +29,7 @@ const session_files_1 = require("./session-files");
27
29
  const slash_command_util_1 = require("./slash-command-util");
28
30
  const ta_errors_1 = require("./ta-errors");
29
31
  const ta_session_1 = require("./ta-session");
32
+ const working_directory_1 = require("./working-directory");
30
33
  var SessionFileUtil;
31
34
  (function (SessionFileUtil) {
32
35
  /**
@@ -44,6 +47,16 @@ var SessionFileUtil;
44
47
  }
45
48
  }
46
49
  SessionFileUtil.cwdOverride = cwdOverride;
50
+ /** `path` when it is a directory there now. */
51
+ function existing(path) {
52
+ try {
53
+ return path && (0, node_fs_1.statSync)(path).isDirectory() ? path : undefined;
54
+ }
55
+ catch (_a) {
56
+ return undefined;
57
+ }
58
+ }
59
+ SessionFileUtil.existing = existing;
47
60
  })(SessionFileUtil || (exports.SessionFileUtil = SessionFileUtil = {}));
48
61
  /** Sets up pi for each session the way its command does, with one model runtime for all of them. */
49
62
  let DefaultTaSessionFactory = class DefaultTaSessionFactory {
@@ -60,7 +73,7 @@ let DefaultTaSessionFactory = class DefaultTaSessionFactory {
60
73
  const modelRuntime = await this.modelRuntimeProvider.provide();
61
74
  // `options.cwd` is a location; pi works in a directory of this machine (PiDirectories). A session
62
75
  // file works where its header says, as pi's `--session` does, whatever `cwd` the caller gave.
63
- const sessionManager = this.openSessionManager(sdk, { ...requested, cwd: this.directories.toPi(requested.cwd) });
76
+ const { sessionManager, movedFrom } = this.openSessionManager(sdk, { ...requested, cwd: this.directories.toPi(requested.cwd) });
64
77
  // Opened again from its file without its role or group (a package relaying a message to it, the list of
65
78
  // conversations): those it was opened with before.
66
79
  const entries = requested.sessionFile ? sessionManager.getEntries() : [];
@@ -104,6 +117,7 @@ let DefaultTaSessionFactory = class DefaultTaSessionFactory {
104
117
  group: options.group,
105
118
  role: options.appendSystemPrompt,
106
119
  locate: cwd => this.directories.fromPi(cwd),
120
+ movedFrom,
107
121
  });
108
122
  await session.start();
109
123
  return session;
@@ -156,12 +170,27 @@ let DefaultTaSessionFactory = class DefaultTaSessionFactory {
156
170
  },
157
171
  });
158
172
  }
173
+ /**
174
+ * pi's manager of the session file asked, or of a new one. A file whose directory is no longer there goes on
175
+ * in the directory of the server (TaWorkingDirectory), else the home directory, as pi's Continue: `movedFrom`, the directory as
176
+ * the file says it.
177
+ */
159
178
  openSessionManager(sdk, options) {
179
+ var _a, _b;
180
+ var _c;
160
181
  if (!options.sessionFile) {
161
- return sdk.SessionManager.create(options.cwd);
182
+ return { sessionManager: sdk.SessionManager.create(options.cwd) };
162
183
  }
163
184
  try {
164
- return sdk.SessionManager.open(options.sessionFile, undefined, SessionFileUtil.cwdOverride(options.sessionFile, options.cwd));
185
+ const sessionManager = sdk.SessionManager.open(options.sessionFile, undefined, SessionFileUtil.cwdOverride(options.sessionFile, options.cwd));
186
+ const cwd = sessionManager.getCwd();
187
+ if ((0, node_fs_1.existsSync)(cwd)) {
188
+ return { sessionManager };
189
+ }
190
+ const here = (_c = SessionFileUtil.existing((_a = this.workingDirectory) === null || _a === void 0 ? void 0 : _a.get())) !== null && _c !== void 0 ? _c : (0, node_os_1.homedir)();
191
+ // As its file says it: pi resolves a path of another system (C:\...) against the directory of ta serve.
192
+ const movedFrom = ((_b = sessionManager.getHeader()) === null || _b === void 0 ? void 0 : _b.cwd) || cwd;
193
+ return { sessionManager: sdk.SessionManager.open(options.sessionFile, undefined, here), movedFrom };
165
194
  }
166
195
  catch (error) {
167
196
  throw ta_errors_1.TaErrors.invalidArgument(`Cannot open the session ${options.sessionFile}: ${error.message}`, 'Pass a session file that exists; listSessions shows the open ones.');
@@ -185,6 +214,7 @@ let DefaultTaSessionFactory = class DefaultTaSessionFactory {
185
214
  new ta_harness_1.SessionLockExtension(lock),
186
215
  new package_host_extension_1.PackageHostExtension(this.packageHosts, new session_files_1.ExecSessionFiles(environment, piCwd)),
187
216
  new ta_harness_1.BrandExtension(sdk),
217
+ new delegate_extension_1.DelegateExtension(),
188
218
  ...(environment.local ? [] : [new ta_harness_1.ExecExtension(environment, sdk, piCwd)]),
189
219
  ];
190
220
  return [
@@ -262,6 +292,11 @@ __decorate([
262
292
  (0, core_1.Autowired)(remote_protocol_1.PiDirectories),
263
293
  __metadata("design:type", Object)
264
294
  ], DefaultTaSessionFactory.prototype, "directories", void 0);
295
+ __decorate([
296
+ (0, core_1.Autowired)(working_directory_1.TaWorkingDirectory),
297
+ (0, core_1.Optional)(),
298
+ __metadata("design:type", Object)
299
+ ], DefaultTaSessionFactory.prototype, "workingDirectory", void 0);
265
300
  __decorate([
266
301
  (0, core_1.Autowired)(extension_providers_1.ExtensionProviders),
267
302
  __metadata("design:type", Object)
@@ -26,6 +26,8 @@ export interface TaSessionContext {
26
26
  role?: string;
27
27
  /** The location of the directory pi works in (PiDirectories.fromPi); default: that directory. */
28
28
  locate?(cwd: string): string;
29
+ /** The directory its file says, no longer there: it works in another (TaSessionInfo.movedFrom). */
30
+ movedFrom?: string;
29
31
  }
30
32
  /**
31
33
  * One open session of `ta serve`: pi's runtime, its event log, and the clients attached to it. Its id
@@ -69,6 +69,7 @@ class TaSession {
69
69
  sessionName: pi.sessionName,
70
70
  firstMessage: session_info_util_1.SessionInfoUtil.firstMessage(pi.messages),
71
71
  lastMessage: session_info_util_1.SessionInfoUtil.lastMessage(pi.messages),
72
+ movedFrom: this.context.movedFrom,
72
73
  model: model ? `${model.provider}/${model.id}` : undefined,
73
74
  isStreaming: pi.isStreaming,
74
75
  waiting: this.ui.pendingRequests.length > 0,
@@ -108,6 +108,8 @@ const RULES = {
108
108
  switchSession: session('chat.manage'),
109
109
  fork: session('chat.create'),
110
110
  forkToFile: session('chat.create'),
111
+ forkHere: session('chat.create'),
112
+ relocateDirectory: owner,
111
113
  clone: session('chat.create'),
112
114
  getForkMessages: session('chat.view'),
113
115
  getEntries: session('chat.view'),
@@ -185,6 +187,8 @@ const RULES = {
185
187
  addStore: fixed('settings.manage'),
186
188
  removeRelay: fixed('settings.manage'),
187
189
  chooseRelay: fixed('settings.manage'),
190
+ joinDeployment: fixed('settings.manage'),
191
+ leaveDeployment: fixed('settings.manage'),
188
192
  probeRelay: fixed('settings.view'),
189
193
  sharePackage: fixed('extensions.install'),
190
194
  unsharePackage: fixed('extensions.install'),
@@ -200,6 +204,7 @@ const RULES = {
200
204
  'listRooms',
201
205
  'createRoom',
202
206
  'invite',
207
+ 'configureRoom',
203
208
  'join',
204
209
  'listRequests',
205
210
  'answer',
@@ -219,10 +224,27 @@ const RULES = {
219
224
  'watch',
220
225
  'unwatch',
221
226
  ].map(method => [method, fixed('settings.manage')])),
227
+ // Calls by a voice service: talking to the models; its services and their keys are settings.
228
+ TaVoiceServer: {
229
+ listVoices: fixed('settings.view'),
230
+ addVoice: fixed('settings.manage'),
231
+ updateVoice: fixed('settings.manage'),
232
+ removeVoice: fixed('settings.manage'),
233
+ chooseVoice: fixed('settings.manage'),
234
+ openVoice: fixed('models.use'),
235
+ sendVoice: fixed('models.use'),
236
+ sayVoice: fixed('models.use'),
237
+ hushVoice: fixed('models.use'),
238
+ closeVoice: fixed('models.use'),
239
+ },
222
240
  // What a page is at: each page's own, and only of conversations it may see (TaPresenceServerImpl).
223
241
  TaPresenceServer: {
224
242
  report: anyone,
225
243
  },
244
+ // Which requests a page answers: each page's own; ta serve asks only the pages of who asked a run (TaPageBook).
245
+ TaPageServer: {
246
+ attach: anyone,
247
+ },
226
248
  TaSettingsServer: {
227
249
  getSettings: fixed('settings.view'),
228
250
  updateSettings: fixed('settings.manage'),
@@ -0,0 +1,69 @@
1
+ import { type CodingAgentOptions } from '@celljs/ai-coding-agent';
2
+ import { type RpcConnection } from '@celljs/rpc/lib/node';
3
+ import { type TaExtensionVoices, type TaVoiceEngine, TaVoiceServer, type TaVoiceSession, type TaVoices, type TaVoiceType } from '@celljs/ta-protocol';
4
+ import { VoicesFile } from './voices-file';
5
+ export declare const VOICE_BRIDGE: unique symbol;
6
+ interface OpenVoice {
7
+ id: string;
8
+ connection: RpcConnection;
9
+ engine: TaVoiceEngine;
10
+ speaks: boolean;
11
+ nextSay: number;
12
+ closed: boolean;
13
+ }
14
+ /**
15
+ * The voice services of calls (docs/design/ta-voice.md): the types packages register, voices.json, and the voices
16
+ * pages open, each of its connection and closed with it. A page never gets a key: its audio comes here.
17
+ */
18
+ export declare class VoiceBridge {
19
+ protected readonly codingAgentOptions?: CodingAgentOptions;
20
+ protected readonly types: Map<string, TaVoiceType>;
21
+ protected readonly open: Map<string, OpenVoice>;
22
+ protected nextId: number;
23
+ protected filed?: VoicesFile;
24
+ protected get file(): VoicesFile;
25
+ /** For the server side of packages (TaExtensionHost.voices). */
26
+ readonly extensionVoices: TaExtensionVoices;
27
+ list(): TaVoices;
28
+ /** Opens a service of the type once before it is kept, so that a wrong key is said now. */
29
+ add(type: string, options: Record<string, unknown>, name?: string): Promise<string>;
30
+ /** Its fields as the form gave them, a secret left empty kept as it was; tried before it is written. */
31
+ update(id: string, options: Record<string, unknown>, name?: string): Promise<void>;
32
+ /** The fields of a form of the type, needed ones checked, then opened once and closed: what is kept. */
33
+ protected tried(type: string, options: Record<string, unknown>): Promise<Record<string, unknown>>;
34
+ remove(id: string): void;
35
+ choose(id: string | null): void;
36
+ openFor(connection: RpcConnection, language: string): Promise<TaVoiceSession>;
37
+ send(connection: RpcConnection, id: string, audio: string): void;
38
+ say(connection: RpcConnection, id: string, text: string): number;
39
+ hush(connection: RpcConnection, id: string): void;
40
+ close(connection: RpcConnection, id: string): void;
41
+ protected require(connection: RpcConnection, id: string): OpenVoice;
42
+ protected static where(definition: TaVoiceType, options: Record<string, unknown>): string;
43
+ /** What trying a service hears: nothing is told. */
44
+ protected static readonly SILENT: {
45
+ speech(): void;
46
+ text(): void;
47
+ audio(): void;
48
+ said(): void;
49
+ closed(): void;
50
+ };
51
+ }
52
+ /** The voices for pages (TaVoiceServer), each of the connection that opened it. */
53
+ export declare class TaVoiceServerImpl implements TaVoiceServer {
54
+ protected readonly bridge: VoiceBridge;
55
+ listVoices(): Promise<TaVoices>;
56
+ addVoice(type: string, options: Record<string, unknown>, name?: string): Promise<string>;
57
+ updateVoice(id: string, options: Record<string, unknown>, name?: string): Promise<void>;
58
+ removeVoice(id: string): Promise<void>;
59
+ chooseVoice(id: string | null): Promise<void>;
60
+ openVoice(options: {
61
+ language: string;
62
+ }): Promise<TaVoiceSession>;
63
+ sendVoice(voiceId: string, audio: string): Promise<void>;
64
+ sayVoice(voiceId: string, text: string): Promise<number>;
65
+ hushVoice(voiceId: string): Promise<void>;
66
+ closeVoice(voiceId: string): Promise<void>;
67
+ }
68
+ export {};
69
+ //# sourceMappingURL=voice-bridge.d.ts.map