@celljs/ta-protocol 4.6.1 → 4.8.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 (61) hide show
  1. package/README.en.md +11 -0
  2. package/README.md +4 -3
  3. package/esm/common/index.d.ts +2 -0
  4. package/esm/common/index.js +2 -0
  5. package/esm/common/index.js.map +1 -1
  6. package/esm/common/location.d.ts +45 -0
  7. package/esm/common/location.js +175 -0
  8. package/esm/common/location.js.map +1 -0
  9. package/esm/common/remote-protocol.d.ts +85 -0
  10. package/esm/common/remote-protocol.js +3 -0
  11. package/esm/common/remote-protocol.js.map +1 -0
  12. package/esm/common/settings-protocol.d.ts +7 -0
  13. package/esm/common/ta-extension-host.d.ts +33 -3
  14. package/esm/common/ta-extension-host.js +7 -0
  15. package/esm/common/ta-extension-host.js.map +1 -1
  16. package/esm/common/ta-protocol.d.ts +14 -2
  17. package/esm/common/ta-protocol.js.map +1 -1
  18. package/esm/common/workspace-protocol.d.ts +16 -0
  19. package/esm/common/workspace-protocol.js +5 -0
  20. package/esm/common/workspace-protocol.js.map +1 -1
  21. package/lib/common/index.d.ts +2 -0
  22. package/lib/common/index.d.ts.map +1 -1
  23. package/lib/common/index.js +2 -0
  24. package/lib/common/index.js.map +1 -1
  25. package/lib/common/location.d.ts +46 -0
  26. package/lib/common/location.d.ts.map +1 -0
  27. package/lib/common/location.js +178 -0
  28. package/lib/common/location.js.map +1 -0
  29. package/lib/common/location.spec.d.ts +2 -0
  30. package/lib/common/location.spec.d.ts.map +1 -0
  31. package/lib/common/location.spec.js +58 -0
  32. package/lib/common/location.spec.js.map +1 -0
  33. package/lib/common/remote-protocol.d.ts +86 -0
  34. package/lib/common/remote-protocol.d.ts.map +1 -0
  35. package/lib/common/remote-protocol.js +6 -0
  36. package/lib/common/remote-protocol.js.map +1 -0
  37. package/lib/common/settings-protocol.d.ts +7 -0
  38. package/lib/common/settings-protocol.d.ts.map +1 -1
  39. package/lib/common/ta-extension-host.d.ts +33 -3
  40. package/lib/common/ta-extension-host.d.ts.map +1 -1
  41. package/lib/common/ta-extension-host.js +8 -1
  42. package/lib/common/ta-extension-host.js.map +1 -1
  43. package/lib/common/ta-protocol.d.ts +14 -2
  44. package/lib/common/ta-protocol.d.ts.map +1 -1
  45. package/lib/common/ta-protocol.js.map +1 -1
  46. package/lib/common/ta-protocol.spec.js +2 -0
  47. package/lib/common/ta-protocol.spec.js.map +1 -1
  48. package/lib/common/workspace-protocol.d.ts +16 -0
  49. package/lib/common/workspace-protocol.d.ts.map +1 -1
  50. package/lib/common/workspace-protocol.js +6 -1
  51. package/lib/common/workspace-protocol.js.map +1 -1
  52. package/package.json +1 -1
  53. package/src/common/index.ts +2 -0
  54. package/src/common/location.spec.ts +62 -0
  55. package/src/common/location.ts +177 -0
  56. package/src/common/remote-protocol.ts +76 -0
  57. package/src/common/settings-protocol.ts +7 -0
  58. package/src/common/ta-extension-host.ts +48 -3
  59. package/src/common/ta-protocol.spec.ts +2 -0
  60. package/src/common/ta-protocol.ts +14 -2
  61. package/src/common/workspace-protocol.ts +18 -0
@@ -1,5 +1,6 @@
1
1
  import type { TaAuthEvent } from './auth-protocol';
2
2
  import type { ImageContent, JsonAgentSessionEvent, RpcCommand, RpcExtensionUIRequest, RpcExtensionUIResponse, RpcResponse, ThinkingLevel } from './pi-types';
3
+ import type { TaRemoteEvent } from './remote-protocol';
3
4
 
4
5
  export const TaServer = Symbol('TaServer');
5
6
  export const TaClient = Symbol('TaClient');
@@ -28,6 +29,10 @@ export interface TaServerInfo {
28
29
  * `setWorkingDirectory`, else the working directory of `ta serve`, or of its execution environment.
29
30
  */
30
31
  cwd: string;
32
+ /** The user who runs `ta serve`, as the system names them: whose Ta the client is signed in to. */
33
+ user: string;
34
+ /** The name of the machine of `ta serve`, without a `.local` suffix. */
35
+ host: string;
31
36
  }
32
37
 
33
38
  /** The stable `code` of each failure of a {@link TaServer} call. */
@@ -91,7 +96,7 @@ export interface TaClientToolDefinition {
91
96
  }
92
97
 
93
98
  export interface TaOpenSessionOptions {
94
- /** Working directory of the session, on the machine of the server. */
99
+ /** Working directory of the session: a path of the machine of the server, or an `ssh://` location of another (TaLocation). */
95
100
  cwd: string;
96
101
  /** Opens this session file; default: a new session. */
97
102
  sessionFile?: string;
@@ -234,6 +239,11 @@ export interface TaAttachResult {
234
239
  pendingUi: RpcExtensionUIRequest[];
235
240
  /** The calls of client tools still waiting for a result. */
236
241
  pendingClientTools: TaClientToolRequest[];
242
+ /**
243
+ * What the extensions show now (`setStatus`, `setWidget`), as a terminal keeps it on screen: a client
244
+ * that attaches draws it, whatever it missed. None from a server before it.
245
+ */
246
+ shownUi?: RpcExtensionUIRequest[];
237
247
  /** Seq of the last event of the session. */
238
248
  lastSeq: number;
239
249
  /** Some events after `afterSeq` are gone: read the conversation again with `getMessages`. */
@@ -253,7 +263,7 @@ export interface TaClientToolResult {
253
263
  * The sessions of `ta serve`, over JSON-RPC 2.0 on a WebSocket. Besides opening, attaching and answering,
254
264
  * each method is the command of pi's RPC mode with the same name in camelCase, on the open session
255
265
  * `sessionId` (see PiCommandMethod). The same WebSocket carries the other services of ta serve, each
256
- * under its own name: TaWorkspaceServer, TaTerminalServer, TaSettingsServer and TaPackageServer.
266
+ * under its own name: TaWorkspaceServer, TaTerminalServer, TaSettingsServer, TaPackageServer, TaRemoteServer and others.
257
267
  */
258
268
  export interface TaServer {
259
269
  getServerInfo(): Promise<TaServerInfo>;
@@ -337,4 +347,6 @@ export interface TaClient {
337
347
  onExtensionData(name: string, keys: string[], cwd?: string): Promise<void>;
338
348
  /** What happens during a sign-in this connection started (TaAuthServer.login). */
339
349
  onAuthEvent(loginId: string, event: TaAuthEvent): Promise<void>;
350
+ /** What happens with the remote machines, once this connection called TaRemoteServer.watch. */
351
+ onRemoteEvent(event: TaRemoteEvent): Promise<void>;
340
352
  }
@@ -38,6 +38,19 @@ export interface TaRunCommandOptions {
38
38
  maxBytes?: number;
39
39
  }
40
40
 
41
+ /**
42
+ * The most bytes of a part of {@link TaWorkspaceServer.uploadFile}: a larger file goes in parts of this size,
43
+ * well within what a message of the WebSocket may hold once in base64.
44
+ */
45
+ export const TA_UPLOAD_PART_BYTES = 4 * 1024 * 1024;
46
+
47
+ export interface TaUploadOptions {
48
+ /** Default: the server's directory. */
49
+ cwd?: string;
50
+ /** After what the file holds: each part of a file sent in parts but the first. */
51
+ append?: boolean;
52
+ }
53
+
41
54
  export interface TaCommandOutput {
42
55
  stdout: string;
43
56
  stderr: string;
@@ -59,6 +72,11 @@ export interface TaWorkspaceServer {
59
72
  readFile(path: string, cwd?: string): Promise<TaFileContent>;
60
73
  /** Writes the text of a file; its directory must be there. */
61
74
  writeFile(path: string, text: string, cwd?: string): Promise<void>;
75
+ /**
76
+ * Writes bytes, in base64, to a file (one uploaded): the folders on its way are made, and a file there is
77
+ * replaced. A file larger than {@link TA_UPLOAD_PART_BYTES} goes in parts, each after the first with `append`.
78
+ */
79
+ uploadFile(path: string, data: string, options?: TaUploadOptions): Promise<void>;
62
80
  /**
63
81
  * A URL of this server, under {@link TA_FILES_PATH}, that answers the bytes of a file of `cwd`, for
64
82
  * what the page shows as it is: an image, a video, a page with what it loads next to it. The URL needs