@celljs/ta-protocol 4.16.0 → 4.18.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 (81) hide show
  1. package/esm/common/access-protocol.d.ts +41 -0
  2. package/esm/common/access-protocol.js +7 -0
  3. package/esm/common/app-protocol.d.ts +120 -0
  4. package/esm/common/app-protocol.js +213 -0
  5. package/esm/common/delegate-protocol.d.ts +30 -0
  6. package/esm/common/delegate-protocol.js +52 -0
  7. package/esm/common/deployment-protocol.d.ts +72 -0
  8. package/esm/common/deployment-protocol.js +171 -0
  9. package/esm/common/error-protocol.d.ts +42 -0
  10. package/esm/common/error-protocol.js +45 -0
  11. package/esm/common/event-protocol.d.ts +63 -0
  12. package/esm/common/event-protocol.js +2 -0
  13. package/esm/common/gateway-protocol.d.ts +29 -0
  14. package/esm/common/index.d.ts +11 -0
  15. package/esm/common/index.js +11 -0
  16. package/esm/common/message-protocol.d.ts +134 -0
  17. package/esm/common/message-protocol.js +322 -0
  18. package/esm/common/page-protocol.d.ts +56 -0
  19. package/esm/common/page-protocol.js +12 -0
  20. package/esm/common/path-map.d.ts +24 -0
  21. package/esm/common/path-map.js +127 -0
  22. package/esm/common/presence-protocol.js +1 -1
  23. package/esm/common/redactor.d.ts +12 -0
  24. package/esm/common/redactor.js +49 -11
  25. package/esm/common/relay-protocol.d.ts +20 -0
  26. package/esm/common/room-protocol.d.ts +52 -1
  27. package/esm/common/said-protocol.d.ts +76 -0
  28. package/esm/common/said-protocol.js +239 -0
  29. package/esm/common/screen-share-protocol.d.ts +304 -0
  30. package/esm/common/screen-share-protocol.js +88 -0
  31. package/esm/common/settings-protocol.d.ts +8 -0
  32. package/esm/common/settings-protocol.js +2 -0
  33. package/esm/common/ta-extension-host.d.ts +64 -1
  34. package/esm/common/ta-extension-host.js +8 -0
  35. package/esm/common/ta-protocol.d.ts +53 -175
  36. package/esm/common/ta-protocol.js +0 -234
  37. package/esm/common/team-protocol.d.ts +13 -2
  38. package/esm/common/team-protocol.js +27 -2
  39. package/esm/common/voice-protocol.d.ts +184 -0
  40. package/esm/common/voice-protocol.js +57 -0
  41. package/lib/common/access-protocol.d.ts +41 -0
  42. package/lib/common/access-protocol.js +8 -1
  43. package/lib/common/app-protocol.d.ts +121 -0
  44. package/lib/common/app-protocol.js +216 -0
  45. package/lib/common/delegate-protocol.d.ts +31 -0
  46. package/lib/common/delegate-protocol.js +55 -0
  47. package/lib/common/deployment-protocol.d.ts +73 -0
  48. package/lib/common/deployment-protocol.js +175 -0
  49. package/lib/common/error-protocol.d.ts +43 -0
  50. package/lib/common/error-protocol.js +48 -0
  51. package/lib/common/event-protocol.d.ts +64 -0
  52. package/lib/common/event-protocol.js +3 -0
  53. package/lib/common/gateway-protocol.d.ts +29 -0
  54. package/lib/common/index.d.ts +11 -0
  55. package/lib/common/index.js +11 -0
  56. package/lib/common/message-protocol.d.ts +135 -0
  57. package/lib/common/message-protocol.js +325 -0
  58. package/lib/common/page-protocol.d.ts +57 -0
  59. package/lib/common/page-protocol.js +15 -0
  60. package/lib/common/path-map.d.ts +25 -0
  61. package/lib/common/path-map.js +130 -0
  62. package/lib/common/presence-protocol.js +7 -7
  63. package/lib/common/redactor.d.ts +12 -0
  64. package/lib/common/redactor.js +49 -11
  65. package/lib/common/relay-protocol.d.ts +20 -0
  66. package/lib/common/room-protocol.d.ts +52 -1
  67. package/lib/common/said-protocol.d.ts +77 -0
  68. package/lib/common/said-protocol.js +242 -0
  69. package/lib/common/screen-share-protocol.d.ts +305 -0
  70. package/lib/common/screen-share-protocol.js +91 -0
  71. package/lib/common/settings-protocol.d.ts +8 -0
  72. package/lib/common/settings-protocol.js +3 -1
  73. package/lib/common/ta-extension-host.d.ts +64 -1
  74. package/lib/common/ta-extension-host.js +9 -1
  75. package/lib/common/ta-protocol.d.ts +53 -175
  76. package/lib/common/ta-protocol.js +1 -235
  77. package/lib/common/team-protocol.d.ts +13 -2
  78. package/lib/common/team-protocol.js +28 -3
  79. package/lib/common/voice-protocol.d.ts +185 -0
  80. package/lib/common/voice-protocol.js +60 -0
  81. package/package.json +1 -1
@@ -1,16 +1,19 @@
1
1
  import type { TaSignInProvider } from './access-protocol';
2
+ import type { TaHostCommands } from './app-protocol';
2
3
  import type { TaPackageServer } from './package-protocol';
4
+ import type { TaHostPages } from './page-protocol';
3
5
  import type { TaPresencePerson } from './presence-protocol';
4
6
  import type { TaRelayFeature, TaRelayService, TaRelayStore, TaRelayType, TaShares } from './relay-protocol';
5
7
  import type { TaRooms } from './room-protocol';
6
8
  import type { TaServer } from './ta-protocol';
7
9
  import type { TaAuthorizer, TaMemberInfo, TaResource, TaSharedData, TaSharedRef } from './team-protocol';
10
+ import type { TaExtensionVoices } from './voice-protocol';
8
11
  /**
9
12
  * What `ta serve` gives the server side of a package: the sessions and the data of packages, in its own
10
13
  * process, without a token. A subset of TaServer and TaPackageServer: it can open, drive, stop and close
11
14
  * sessions (best those it opened: closing one takes it from every client), not remove anything.
12
15
  */
13
- export interface TaExtensionHost extends Pick<TaServer, 'getServerInfo' | 'listSessions' | 'openSession' | 'closeSession' | 'setSessionName' | 'prompt' | 'followUp' | 'abort' | 'getState' | 'getLastAssistantText'>, Pick<TaPackageServer, 'getExtensionData' | 'setExtensionData' | 'listPackages' | 'callPackageHost' | 'installPackage' | 'removePackage'> {
16
+ export interface TaExtensionHost extends Pick<TaServer, 'getServerInfo' | 'listSessions' | 'openSession' | 'closeSession' | 'setSessionName' | 'prompt' | 'followUp' | 'abort' | 'getState' | 'getLastAssistantText' | 'relocateDirectory'>, Pick<TaPackageServer, 'getExtensionData' | 'setExtensionData' | 'listPackages' | 'callPackageHost' | 'installPackage' | 'removePackage'> {
14
17
  /** The agent directory of Ta (`~/.ta/agent`): its `extensions/` holds the packages of the user. */
15
18
  readonly agentDir: string;
16
19
  /** Where the conversation of a session file works, as clients name it (a path or an `ssh://` location), without opening it; undefined when it cannot be read. */
@@ -21,8 +24,14 @@ export interface TaExtensionHost extends Pick<TaServer, 'getServerInfo' | 'listS
21
24
  readonly rooms: TaRooms;
22
25
  /** The services of relays.json, as the user chose them for each feature (docs/design/ta-relays.md). */
23
26
  readonly relays: TaExtensionRelays;
27
+ /** The voice services of calls, as packages add types of them (docs/design/ta-voice.md). */
28
+ readonly voices: TaExtensionVoices;
29
+ /** Where sign-ins Ta itself uses are kept, as a package keeps them (the vault): the password of a remote desktop. */
30
+ readonly credentials: TaExtensionCredentials;
24
31
  /** pi's messages of a session file, of the branch it is on (its first message first), without opening it. */
25
32
  sessionMessages(sessionFile: string): Promise<unknown[]>;
33
+ /** The role a session file was opened with last (TaOpenSessionOptions.appendSystemPrompt), without opening it; undefined without one. */
34
+ sessionRole(sessionFile: string): Promise<string | undefined>;
26
35
  /**
27
36
  * A new conversation of `cwd` holding these messages of pi (an assistant's among them), named `name`: its session
28
37
  * file, to open with `openSession`. As a conversation brought from elsewhere (a link of another Ta).
@@ -39,6 +48,13 @@ export interface TaExtensionHost extends Pick<TaServer, 'getServerInfo' | 'listS
39
48
  presence(): TaPresence;
40
49
  /** The people let into this Ta besides its user, and what they may do (docs/design/ta-team.md). */
41
50
  readonly team: TaHostTeam;
51
+ /**
52
+ * The catalog of what can be done to Ta without its pages (docs/design/ta-app-use.md 2): an action a package
53
+ * registers goes when the package stops.
54
+ */
55
+ readonly commands: TaHostCommands;
56
+ /** The pages of Ta open now, to ask one of them what its web extension answers (docs/design/ta-app-use.md 4.1). */
57
+ readonly pages: TaHostPages;
42
58
  /**
43
59
  * Rewrites pi's `settings.json` of the user as pi does, under its lock: `update` gets the settings read under the
44
60
  * lock and returns them whole; the open sessions read them again. For what changes settings of the user that are no
@@ -46,6 +62,31 @@ export interface TaExtensionHost extends Pick<TaServer, 'getServerInfo' | 'listS
46
62
  */
47
63
  updateSettings(update: (settings: Record<string, unknown>) => Record<string, unknown>): Promise<void>;
48
64
  }
65
+ /** A sign-in Ta gives on the user's behalf: the account of the Screen Sharing of macOS, or the password of VNC. */
66
+ export interface TaCredential {
67
+ username?: string;
68
+ password: string;
69
+ }
70
+ /** What a sign-in is for, for the page that lists what is kept. */
71
+ export interface TaCredentialAbout {
72
+ /** `desktop`: a remote desktop. */
73
+ feature: 'desktop';
74
+ /** The name of what it signs in to: the computer. */
75
+ name: string;
76
+ }
77
+ /**
78
+ * Where Ta keeps sign-ins it gives by itself, by an id of its own (`desktop:<id of the desktop>`). Never for the
79
+ * model, nor a command, nor a page: ta serve alone reads them.
80
+ */
81
+ export interface TaCredentialStore {
82
+ get(id: string): Promise<TaCredential | undefined>;
83
+ set(id: string, credential: TaCredential, about: TaCredentialAbout): Promise<void>;
84
+ remove(id: string): Promise<void>;
85
+ }
86
+ /** Sign-ins for the server side of packages: one package keeps them (the vault), gone again with what register returns. */
87
+ export interface TaExtensionCredentials {
88
+ register(store: TaCredentialStore): () => void;
89
+ }
49
90
  /** relays.json for the server side of packages: which service a feature uses, and choosing one for it. */
50
91
  export interface TaExtensionRelays {
51
92
  /** The service a feature uses now: a relay of Ta, or a folder (only `sync` goes to one). */
@@ -79,7 +120,23 @@ export interface TaExtensionRelays {
79
120
  export interface TaPackageService {
80
121
  /** `ta serve` stops, or the package is turned off. */
81
122
  dispose?(): void | Promise<void>;
123
+ /**
124
+ * A POST to `/api/hooks/<directory name of the package>/<path>` of ta serve, from a script or a service of this
125
+ * machine: reached WITHOUT the token of ta serve, so the package checks a secret of its own in `path` and throws
126
+ * for one it does not know (the caller gets a 404). Its answer is sent back as JSON.
127
+ */
128
+ webhook?(request: TaWebhookRequest): unknown | Promise<unknown>;
82
129
  }
130
+ /** What a webhook of a package was sent (TaPackageService.webhook). */
131
+ export interface TaWebhookRequest {
132
+ /** After the name of the package, without a leading slash, without the query. */
133
+ path: string;
134
+ /** The body, as text, at most TA_WEBHOOK_MAX_BYTES. */
135
+ body: string;
136
+ contentType?: string;
137
+ }
138
+ /** The largest body a webhook takes; a larger one is refused (413). */
139
+ export declare const TA_WEBHOOK_MAX_BYTES: number;
83
140
  /**
84
141
  * The default export of a module that a package names in `pi.host` of its package.json. `ta serve` runs it
85
142
  * once when it starts (or when the package is turned on), for built-in packages; `ta` without `serve`
@@ -299,6 +356,12 @@ export interface TaNotice {
299
356
  * conversations, what they asked before) leaves such a session out: what it says goes to others.
300
357
  */
301
358
  export declare const TA_WITH_OTHERS_MARK = "[ta:speaks-with-others]";
359
+ /**
360
+ * In the role of a session a package opened that tells the user of its turns itself (the conversation of a goal,
361
+ * ta-goals): ta-notify tells of its turns only when they fail or ask, as of a session of a `group`, which this one is
362
+ * not, so that it stays a conversation of the lists.
363
+ */
364
+ export declare const TA_TELLS_OF_ITS_TURNS_MARK = "[ta:tells-of-its-turns]";
302
365
  /**
303
366
  * Starts the `<context>` of a message of the user that asks Ta to keep how a conversation got its work done, so that it
304
367
  * need not be told again (Keep of ta-recall, in the + of the message box): Ta picks the form that fits. A package that
@@ -1,6 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TaAskUtil = exports.TA_ASK_ENTRY = exports.TA_BRIEF_SOURCE = exports.TA_KEEP_MARK = exports.TA_WITH_OTHERS_MARK = exports.TA_NOTICES = exports.TA_DOUBLE_TASKS = exports.TA_DOUBLE_LOOK = exports.TA_DOUBLE_FILE = exports.TA_FILE_WRITE_EVENT = exports.TaHostUtil = exports.TA_HOST_EVENT = void 0;
3
+ exports.TaAskUtil = exports.TA_ASK_ENTRY = exports.TA_BRIEF_SOURCE = exports.TA_KEEP_MARK = exports.TA_TELLS_OF_ITS_TURNS_MARK = exports.TA_WITH_OTHERS_MARK = exports.TA_NOTICES = exports.TA_DOUBLE_TASKS = exports.TA_DOUBLE_LOOK = exports.TA_DOUBLE_FILE = exports.TA_FILE_WRITE_EVENT = exports.TaHostUtil = exports.TA_HOST_EVENT = exports.TA_WEBHOOK_MAX_BYTES = void 0;
4
+ /** The largest body a webhook takes; a larger one is refused (413). */
5
+ exports.TA_WEBHOOK_MAX_BYTES = 256 * 1024;
4
6
  /**
5
7
  * The event of pi's `pi.events` by which a pi extension asks for the host of its package:
6
8
  * `pi.events.emit(TA_HOST_EVENT, { name, resolve, heard })`. Under `ta serve` `heard` is called as the event
@@ -106,6 +108,12 @@ exports.TA_NOTICES = { name: '@celljs/ta-notify', key: 'notices' };
106
108
  * conversations, what they asked before) leaves such a session out: what it says goes to others.
107
109
  */
108
110
  exports.TA_WITH_OTHERS_MARK = '[ta:speaks-with-others]';
111
+ /**
112
+ * In the role of a session a package opened that tells the user of its turns itself (the conversation of a goal,
113
+ * ta-goals): ta-notify tells of its turns only when they fail or ask, as of a session of a `group`, which this one is
114
+ * not, so that it stays a conversation of the lists.
115
+ */
116
+ exports.TA_TELLS_OF_ITS_TURNS_MARK = '[ta:tells-of-its-turns]';
109
117
  /**
110
118
  * Starts the `<context>` of a message of the user that asks Ta to keep how a conversation got its work done, so that it
111
119
  * need not be told again (Keep of ta-recall, in the + of the message box): Ta picks the form that fits. A package that
@@ -1,10 +1,13 @@
1
1
  import type { TaAuthEvent } from './auth-protocol';
2
- import type { ImageContent, JsonAgentSessionEvent, RpcCommand, RpcExtensionUIRequest, RpcExtensionUIResponse, RpcResponse, ThinkingLevel } from './pi-types';
2
+ import type { TaClientToolRequest, TaEventEnvelope } from './event-protocol';
3
+ import type { ImageContent, RpcCommand, RpcExtensionUIRequest, RpcExtensionUIResponse, RpcResponse, ThinkingLevel } from './pi-types';
3
4
  import type { TaSessionPerson } from './presence-protocol';
4
5
  import type { TaRemoteEvent } from './remote-protocol';
5
6
  import type { TaRoomEvent } from './room-protocol';
7
+ import type { TaDesktopEvent } from './screen-share-protocol';
6
8
  import type { TaAsking } from './ta-extension-host';
7
9
  import type { TaMemberInfo } from './team-protocol';
10
+ import type { TaVoiceEvent } from './voice-protocol';
8
11
  export declare const TaServer: unique symbol;
9
12
  export declare const TaClient: unique symbol;
10
13
  /** Path of the WebSocket endpoint of `ta serve`, and the JSON-RPC method prefixes of both sides. */
@@ -59,52 +62,21 @@ export interface TaServerUpdate {
59
62
  /** As TaServerInfo.build. */
60
63
  build?: string;
61
64
  }
62
- /** The stable `code` of each failure of a {@link TaServer} call. */
63
- export declare const TaErrorCode: {
64
- readonly SESSION_NOT_FOUND: 'CELL_TA_SESSION_NOT_FOUND';
65
- readonly SESSION_LOCKED: 'CELL_TA_SESSION_LOCKED';
66
- readonly TOO_MANY_SESSIONS: 'CELL_TA_TOO_MANY_SESSIONS';
67
- readonly MESSAGE_CONFLICT: 'CELL_TA_MESSAGE_CONFLICT';
68
- readonly MODEL_NOT_FOUND: 'CELL_TA_MODEL_NOT_FOUND';
69
- readonly INVALID_ARGUMENT: 'CELL_TA_INVALID_ARGUMENT';
70
- readonly COMMAND_FAILED: 'CELL_TA_COMMAND_FAILED';
71
- /** Compacting found nothing to compact: the conversation is still short. */
72
- readonly NOTHING_TO_COMPACT: 'CELL_TA_NOTHING_TO_COMPACT';
73
- /** Compacting found nothing to compact: nothing came after the last compaction. */
74
- readonly ALREADY_COMPACTED: 'CELL_TA_ALREADY_COMPACTED';
75
- /** The session is answering or compacting, which has to end first. */
76
- readonly SESSION_BUSY: 'CELL_TA_SESSION_BUSY';
77
- /** Stopped before it ended, by the user (abort) or an extension: nothing to report. */
78
- readonly CANCELLED: 'CELL_TA_CANCELLED';
79
- /** No provider of models is signed in for the model, or there is no model: sign in (TaAuthServer) first. */
80
- readonly NOT_SIGNED_IN: 'CELL_TA_NOT_SIGNED_IN';
81
- /** Behind a gateway (`ta gateway`): the environment of the tenant did not start; TaGatewayServer changes or restarts it. */
82
- readonly ENVIRONMENT_FAILED: 'CELL_TA_ENVIRONMENT_FAILED';
83
- /** Behind a gateway: more messages a minute than one may send; try again in a moment. */
84
- readonly RATE_LIMITED: 'CELL_TA_RATE_LIMITED';
85
- /** One let in by the user (docs/design/ta-team.md) may not do this: `data` says the action it needs (TaForbiddenData). */
86
- readonly FORBIDDEN: 'CELL_TA_FORBIDDEN';
87
- /** As many runs of people let in go as the owner lets at once (docs/design/ta-team.md 9): try again once one ended. */
88
- readonly LIMIT: 'CELL_TA_LIMIT';
89
- /** Raised by the client, not the server: the call could not reach ta serve, or its answer was lost with the connection. */
90
- readonly CONNECTION_LOST: 'CELL_TA_CONNECTION_LOST';
91
- };
92
- export type TaErrorCode = (typeof TaErrorCode)[keyof typeof TaErrorCode];
93
- export declare namespace TaErrorUtil {
94
- /** The {@link TaErrorCode} of a failure: `code` of the client's error, `data.code` of the server's own, called in its process. */
95
- function code(error: unknown): string | undefined;
96
- }
97
- /** The JSON-RPC error code of every failure of a {@link TaServer} call; `data.code` tells them apart. */
98
- export declare const TA_RPC_ERROR_CODE = -32050;
99
- export interface TaErrorData {
100
- code: TaErrorCode;
101
- /** One sentence on what to do about it. */
102
- hint: string;
103
- }
104
65
  /** A command name of pi's RPC mode (`get_state`, `follow_up`, ...). */
105
66
  export type TaCommand = Extract<RpcResponse, {
106
67
  success: true;
107
68
  }>['command'];
69
+ /** The answer to `relocateDirectory`. */
70
+ export interface TaRelocateResult {
71
+ /** Conversations that work in the new directory now. */
72
+ conversations: number;
73
+ /** Conversations left where they were: running a turn now; move them again once they end. */
74
+ busy: number;
75
+ /** Packages whose data named the old directory. */
76
+ data: number;
77
+ /** The session files that moved, by their old paths: a page goes on with the new one. */
78
+ files: Record<string, string>;
79
+ }
108
80
  /** The answer to `forkToFile`. */
109
81
  export interface TaForkFileResult {
110
82
  /** The new conversation; none when nothing comes before the message: then a new conversation starts. */
@@ -184,6 +156,11 @@ export interface TaSessionInfo {
184
156
  firstMessage?: string;
185
157
  /** The last thing said in it, by the user or the agent, on one line: what a list shows under its title. */
186
158
  lastMessage?: string;
159
+ /**
160
+ * The directory it was in, which is no longer there (moved, renamed, deleted): it goes on in `cwd` instead,
161
+ * as pi's Continue; `forkHere` copies it there for good, as its Fork. None from a Ta service of before.
162
+ */
163
+ movedFrom?: string;
187
164
  /** `<provider>/<model id>`. */
188
165
  model?: string;
189
166
  isStreaming: boolean;
@@ -252,77 +229,6 @@ export interface TaPromptInput {
252
229
  /** What to do when the agent is running; only for `prompt`. Default: `followUp`. */
253
230
  streamingBehavior?: 'steer' | 'followUp';
254
231
  }
255
- /**
256
- * A message of the user may start with a `<context>` block: what the model reads besides the message
257
- * (where it is said, who is there, what was said before), which a client leaves out when it shows it.
258
- */
259
- export declare namespace TaMessageContext {
260
- function wrap(context: string, message: string): string;
261
- /** The message without its context: what the user sees of it. */
262
- function strip(message: string): string;
263
- /** The context of the message, without its tags; undefined without one. */
264
- function read(message: string): string | undefined;
265
- }
266
- /** Where a message of the user came from, when not from what they typed: see {@link TaMessageSource}. */
267
- export interface TaMessageFrom {
268
- /** The name of the package that sent it, or TaMessageSource.DOUBLE. */
269
- from: string;
270
- /** What the package says of it besides, in a few words (the channel and who spoke in it). */
271
- detail?: string;
272
- }
273
- /**
274
- * A message a package sends as the user (a choice in a card, a scheduled task, a channel) says so in the last line
275
- * of its `<context>` block, `[ta:from <name> <detail>]`: a page shows where it came from, the model reads it too,
276
- * and a page older than it leaves it out with the rest of the context. A command (`/compact`, `!ls`) is not marked.
277
- */
278
- export declare namespace TaMessageSource {
279
- /** The double of the web page: the tasks it hands out, what it tells them on the way. */
280
- const DOUBLE = "ta:double";
281
- /** `message` as sent by `from`; as it was when it is a command or says where it came from already. */
282
- function mark(message: string, from: string, detail?: string): string;
283
- function of(message: string): TaMessageFrom | undefined;
284
- }
285
- /**
286
- * pi adds a line to the text of a message of the user for each image it took, for the model's sake: how big
287
- * the image was before it made it smaller, and what it was converted from. Clients leave them out.
288
- */
289
- export declare namespace TaImageNote {
290
- /** The text without the notes of its images: what the user sees of it. */
291
- function strip(text: string): string;
292
- }
293
- /** The width and height of an image, read from the start of its bytes (PNG, JPEG, GIF, WebP); undefined for another kind. */
294
- export declare namespace TaImageSize {
295
- function of(base64: string): {
296
- width: number;
297
- height: number;
298
- } | undefined;
299
- }
300
- /**
301
- * An external agent that compacts its own context says the summary it goes on from as text, in tags
302
- * (`<conversation_history_summary><summary>…`). Clients show it folded, not as what the agent said.
303
- */
304
- export declare namespace TaAgentSummary {
305
- /** The summary `text` is, without its tags (and the start of a closing tag while it streams); else undefined. */
306
- function read(text: string): string | undefined;
307
- /** The text without the summary it starts with. */
308
- function strip(text: string): string;
309
- }
310
- /** A skill the user ran with `/skill:name`, as pi puts it in the message: the skill's file, then what the user wrote. */
311
- export interface TaSkillUse {
312
- name: string;
313
- /** The path of its SKILL.md. */
314
- location: string;
315
- /** What pi read of it, for the model. */
316
- content: string;
317
- /** What the user wrote after `/skill:name`. */
318
- message?: string;
319
- }
320
- /** The `<skill>` block pi expands `/skill:name` into (its `parseSkillBlock`), which a client shows as the skill it is. */
321
- export declare namespace TaSkillUse {
322
- function parse(message: string): TaSkillUse | undefined;
323
- /** What the user typed: `/skill:name` and what follows. */
324
- function command(use: TaSkillUse): string;
325
- }
326
232
  /**
327
233
  * The server has taken the message; it says nothing about the run. A run is finished at the
328
234
  * `agent_settled` event, when its history is on disk.
@@ -335,67 +241,6 @@ export interface TaPromptReceipt {
335
241
  */
336
242
  status: 'accepted' | 'queued' | 'duplicate' | 'handled';
337
243
  }
338
- /** An extension's dialog was answered by another client, or expired. */
339
- export interface TaUiRequestResolved {
340
- type: 'ui_request_resolved';
341
- id: string;
342
- }
343
- /** An extension threw while handling an event. */
344
- export interface TaExtensionError {
345
- type: 'extension_error';
346
- extensionPath: string;
347
- event: string;
348
- error: string;
349
- }
350
- /** The open session now shows another conversation (`newSession`, `switchSession`, `fork`, `clone`, `navigateTree`): read it again. */
351
- export interface TaSessionReplaced {
352
- type: 'session_replaced';
353
- info: TaSessionInfo;
354
- }
355
- /**
356
- * The session loaded its extensions, skills, prompts and themes again (`reload`, or an extension's
357
- * `ctx.reload()`): its commands may have changed, read them again (`getCommands`).
358
- */
359
- export interface TaSessionReloaded {
360
- type: 'session_reloaded';
361
- }
362
- /** The session was closed; no more events come. */
363
- export interface TaSessionClosed {
364
- type: 'session_closed';
365
- }
366
- /**
367
- * What the agent is doing while it works, from an extension (pi's `setWorkingMessage`), as starting the
368
- * program of an external agent; none: the client's own words again.
369
- */
370
- export interface TaWorkingMessage {
371
- type: 'working_message';
372
- message?: string;
373
- }
374
- /**
375
- * The model called a tool of `clientTools`: a client that runs it takes it with `claimClientTool`, so
376
- * that one client runs it, however many are attached, and answers with `respondClientTool`. When that
377
- * client leaves the session before it answers, the request comes again with the same id, for another.
378
- * `client_tool_resolved` tells the others it was answered.
379
- */
380
- export interface TaClientToolRequest {
381
- type: 'client_tool_request';
382
- /** The id of the tool call. */
383
- id: string;
384
- toolName: string;
385
- input: unknown;
386
- }
387
- /** A call of a client tool was answered, or ended because the run was aborted or the session closed. */
388
- export interface TaClientToolResolved {
389
- type: 'client_tool_resolved';
390
- id: string;
391
- }
392
- export type TaEvent = JsonAgentSessionEvent | RpcExtensionUIRequest | TaUiRequestResolved | TaExtensionError | TaClientToolRequest | TaClientToolResolved | TaSessionReplaced | TaSessionReloaded | TaSessionClosed | TaWorkingMessage;
393
- export interface TaEventEnvelope {
394
- sessionId: string;
395
- /** Increases by one per event of the session. */
396
- seq: number;
397
- event: TaEvent;
398
- }
399
244
  /** A message of the conversation, as `getMessages` gives it. */
400
245
  export type TaMessage = TaCommandResult<'get_messages'>['messages'][number];
401
246
  /** A call of a tool in the run of now, as its events left it. */
@@ -419,6 +264,17 @@ export interface TaConversation {
419
264
  * `attach`): those before come with `getEarlierMessages`. None or 0: all of it.
420
265
  */
421
266
  start?: number;
267
+ /** When `messages` start in the middle of a turn: the message of the user that asked for it (TaTurnHead). */
268
+ head?: TaTurnHead;
269
+ }
270
+ /**
271
+ * The message of the user that asked for a turn, when only its latest steps came (a turn too long for a page):
272
+ * the conversation shows who asked, above the steps, before the rest of the turn is loaded.
273
+ */
274
+ export interface TaTurnHead {
275
+ /** Where it is in the whole conversation. */
276
+ index: number;
277
+ message: TaMessage;
422
278
  }
423
279
  export interface TaAttachOptions {
424
280
  /**
@@ -446,6 +302,8 @@ export interface TaMessagePage {
446
302
  start: number;
447
303
  /** False when the message given is no longer there (the conversation was compacted or moved): read it again. */
448
304
  found: boolean;
305
+ /** When they start in the middle of a turn: the message of the user that asked for it. */
306
+ head?: TaTurnHead;
449
307
  }
450
308
  export interface TaAttachResult {
451
309
  info: TaSessionInfo;
@@ -569,6 +427,17 @@ export interface TaServer {
569
427
  * stays where it is. Open the file with `openSession` to go on with it.
570
428
  */
571
429
  forkToFile(sessionId: string, entryId: string, position?: 'before' | 'at'): Promise<TaForkFileResult>;
430
+ /**
431
+ * The whole conversation copied into the directory it works in now, a new conversation of its own (pi's
432
+ * `SessionManager.forkFrom`): for one whose directory is gone (TaSessionInfo.movedFrom), to go on there.
433
+ */
434
+ forkHere(sessionId: string): Promise<TaForkFileResult>;
435
+ /**
436
+ * What of Ta names a directory, as it was (moved, renamed, or the path of another computer after a move) and its
437
+ * directories under it: their conversations (pi's session files go to the folder of the new directory), the data
438
+ * packages keep of it and the working directory, all made the directory `to`, which must exist.
439
+ */
440
+ relocateDirectory(from: string, to: string): Promise<TaRelocateResult>;
572
441
  clone(sessionId: string): Promise<TaCommandResult<'clone'>>;
573
442
  getForkMessages(sessionId: string): Promise<TaCommandResult<'get_fork_messages'>>;
574
443
  getEntries(sessionId: string, since?: string): Promise<TaCommandResult<'get_entries'>>;
@@ -613,6 +482,15 @@ export interface TaClient {
613
482
  onRemoteEvent(event: TaRemoteEvent): Promise<void>;
614
483
  /** What happens in the rooms, once this connection called TaRoomServer.watch. */
615
484
  onRoomEvent(event: TaRoomEvent): Promise<void>;
485
+ /** What a voice this connection opened for a call tells (TaVoiceServer.openVoice). */
486
+ onVoiceEvent(event: TaVoiceEvent): Promise<void>;
487
+ /** What the desktops ask (a password), once this connection called TaScreenShareServer.watchDesktops. */
488
+ onScreenShareEvent(event: TaDesktopEvent): Promise<void>;
489
+ /**
490
+ * ta serve asks this page something (TaPageServer.attach said it answers `kind`): what it answers, or an error. Only
491
+ * a page of the person whose run asks is asked (docs/design/ta-app-use.md 4.1).
492
+ */
493
+ onPageAsk(kind: string, payload: unknown): Promise<unknown>;
616
494
  }
617
495
  export {};
618
496
  //# sourceMappingURL=ta-protocol.d.ts.map