@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
@@ -0,0 +1,46 @@
1
+ /**
2
+ * Where a conversation works: a directory of the machine of ta serve, as a path, or a directory of another
3
+ * machine that ta serve reaches with ssh, as `ssh://<host>/<absolute path>`. `<host>` is what ssh takes:
4
+ * a Host of ~/.ssh/config, or `[user@]host[:port]`. Without a path (`ssh://<host>`) it is the home
5
+ * directory there, which TaRemoteServer.resolveLocation turns into a path.
6
+ */
7
+ export declare namespace TaLocation {
8
+ const SSH = "ssh://";
9
+ /** A directory of another machine. */
10
+ interface Remote {
11
+ host: string;
12
+ /** Absolute, with `/`; empty for the home directory. */
13
+ path: string;
14
+ }
15
+ function isRemote(location: string): boolean;
16
+ /** undefined for a path of the machine of ta serve; throws for an `ssh://` location that is not one. */
17
+ function parse(location: string): Remote | undefined;
18
+ function isHost(host: string): boolean;
19
+ /** What {@link readHost} makes of what the user typed. */
20
+ type HostInput = {
21
+ host: string;
22
+ } | {
23
+ error: 'empty' | 'invalid';
24
+ } | {
25
+ error: 'options';
26
+ options: string[];
27
+ };
28
+ /**
29
+ * A host as the user may write it: `dev`, `me@dev`, `me@dev:2222`, `ssh://me@dev:2222/path`, or the
30
+ * command line they use (`ssh -p 2222 me@dev`, `ssh me@dev -p 2222 -l root`). Options that a host
31
+ * cannot hold (`-i`, `-J`, `-o ProxyCommand=…`) belong in ~/.ssh/config: they come back as `options`.
32
+ */
33
+ function readHost(input: string): HostInput;
34
+ /** `ssh://<host><path>`; `path` absolute, or empty for the home directory. */
35
+ function ssh(host: string, path?: string): string;
36
+ /** The host of a remote location; undefined for this machine. */
37
+ function host(location: string): string | undefined;
38
+ /** The path inside its machine. */
39
+ function path(location: string): string;
40
+ /** The directory above; undefined at a root (`/`, `C:\\`, the root of a host). */
41
+ function parent(location: string): string | undefined;
42
+ function child(location: string, name: string): string;
43
+ /** The last name of the path; the host for its home directory. */
44
+ function basename(location: string): string;
45
+ }
46
+ //# sourceMappingURL=location.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"location.d.ts","sourceRoot":"","sources":["../../src/common/location.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,yBAAiB,UAAU,CAAC;IACjB,MAAM,GAAG,WAAW,CAAC;IAE5B,sCAAsC;IACtC,UAAiB,MAAM;QACnB,IAAI,EAAE,MAAM,CAAC;QACb,wDAAwD;QACxD,IAAI,EAAE,MAAM,CAAC;KAChB;IAKD,SAAgB,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAElD;IAED,wGAAwG;IACxG,SAAgB,KAAK,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAY1D;IAED,SAAgB,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAE5C;IAED,0DAA0D;IAC1D,KAAY,SAAS,GAAG;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,GAAG;QAAE,KAAK,EAAE,OAAO,GAAG,SAAS,CAAA;KAAE,GAAG;QAAE,KAAK,EAAE,SAAS,CAAC;QAAC,OAAO,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC;IAKpH;;;;OAIG;IACH,SAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,CA4DjD;IAED,8EAA8E;IAC9E,SAAgB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,SAAK,GAAG,MAAM,CAEnD;IAED,iEAAiE;IACjE,SAAgB,IAAI,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAEzD;IAED,mCAAmC;IACnC,SAAgB,IAAI,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAE7C;IAED,kFAAkF;IAClF,SAAgB,MAAM,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAO3D;IAED,SAAgB,KAAK,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAM5D;IAED,kEAAkE;IAClE,SAAgB,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAKjD;CAsBJ"}
@@ -0,0 +1,178 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TaLocation = void 0;
4
+ /**
5
+ * Where a conversation works: a directory of the machine of ta serve, as a path, or a directory of another
6
+ * machine that ta serve reaches with ssh, as `ssh://<host>/<absolute path>`. `<host>` is what ssh takes:
7
+ * a Host of ~/.ssh/config, or `[user@]host[:port]`. Without a path (`ssh://<host>`) it is the home
8
+ * directory there, which TaRemoteServer.resolveLocation turns into a path.
9
+ */
10
+ var TaLocation;
11
+ (function (TaLocation) {
12
+ TaLocation.SSH = 'ssh://';
13
+ /** Letters, digits and `_ . @ : % + - [ ]`, not first a `-`: ssh must not read a host as an option. */
14
+ const HOST = /^(?!-)[\w.@:%+[\]-]+$/;
15
+ function isRemote(location) {
16
+ return location.startsWith(TaLocation.SSH);
17
+ }
18
+ TaLocation.isRemote = isRemote;
19
+ /** undefined for a path of the machine of ta serve; throws for an `ssh://` location that is not one. */
20
+ function parse(location) {
21
+ if (!isRemote(location)) {
22
+ return undefined;
23
+ }
24
+ const rest = location.slice(TaLocation.SSH.length);
25
+ const slash = rest.indexOf('/');
26
+ const host = slash < 0 ? rest : rest.slice(0, slash);
27
+ const path = slash < 0 ? '' : normalize(rest.slice(slash));
28
+ if (!isHost(host)) {
29
+ throw new Error(`${JSON.stringify(location)} names no host: write ssh://<host>/<path>, the host as ssh takes it.`);
30
+ }
31
+ return { host, path };
32
+ }
33
+ TaLocation.parse = parse;
34
+ function isHost(host) {
35
+ return HOST.test(host);
36
+ }
37
+ TaLocation.isHost = isHost;
38
+ /** Options of ssh without a value, which change nothing for Ta. */
39
+ const FLAGS = /^-[46AaCfGgKkMNnqsTtVvXxYy]+$/;
40
+ /**
41
+ * A host as the user may write it: `dev`, `me@dev`, `me@dev:2222`, `ssh://me@dev:2222/path`, or the
42
+ * command line they use (`ssh -p 2222 me@dev`, `ssh me@dev -p 2222 -l root`). Options that a host
43
+ * cannot hold (`-i`, `-J`, `-o ProxyCommand=…`) belong in ~/.ssh/config: they come back as `options`.
44
+ */
45
+ function readHost(input) {
46
+ const words = input.trim().split(/\s+/).filter(Boolean);
47
+ if (words[0] === 'ssh') {
48
+ words.shift();
49
+ }
50
+ let destination;
51
+ let port;
52
+ let user;
53
+ const options = [];
54
+ for (let i = 0; i < words.length; i++) {
55
+ const word = words[i];
56
+ const glued = /^-([pl])(.+)$/.exec(word);
57
+ if (word === '-p' || word === '-l' || glued) {
58
+ const value = glued ? glued[2] : words[++i];
59
+ if (value === undefined) {
60
+ return { error: 'invalid' };
61
+ }
62
+ if ((glued ? glued[1] : word[1]) === 'p') {
63
+ port = value;
64
+ }
65
+ else {
66
+ user = value;
67
+ }
68
+ }
69
+ else if (word === '-o' || word.startsWith('-o')) {
70
+ const value = word === '-o' ? words[++i] : word.slice(2);
71
+ const option = /^(port|user)\s*=?\s*(.+)$/i.exec(value !== null && value !== void 0 ? value : '');
72
+ if (!option) {
73
+ options.push(`-o ${value !== null && value !== void 0 ? value : ''}`.trim());
74
+ }
75
+ else if (option[1].toLowerCase() === 'port') {
76
+ port = option[2];
77
+ }
78
+ else {
79
+ user = option[2];
80
+ }
81
+ }
82
+ else if (FLAGS.test(word)) {
83
+ // No value, nothing for Ta.
84
+ }
85
+ else if (word.startsWith('-')) {
86
+ options.push(/^-[bBcDeEFiIJLmOQRSwW]$/.test(word) && words[i + 1] !== undefined ? `${word} ${words[++i]}` : word);
87
+ }
88
+ else if (destination === undefined) {
89
+ destination = word;
90
+ }
91
+ else {
92
+ // A command to run there: not a host.
93
+ return { error: 'invalid' };
94
+ }
95
+ }
96
+ if (options.length > 0) {
97
+ return { error: 'options', options };
98
+ }
99
+ if (!destination) {
100
+ return { error: 'empty' };
101
+ }
102
+ let host = destination.replace(/^ssh:\/\//, '').replace(/\/.*$/, '');
103
+ if (user && !host.includes('@')) {
104
+ host = `${user}@${host}`;
105
+ }
106
+ if (port) {
107
+ if (!/^\d{1,5}$/.test(port) || /:\d+$/.test(host)) {
108
+ return { error: 'invalid' };
109
+ }
110
+ host = port === '22' ? host : `${host}:${port}`;
111
+ }
112
+ return isHost(host) ? { host } : { error: 'invalid' };
113
+ }
114
+ TaLocation.readHost = readHost;
115
+ /** `ssh://<host><path>`; `path` absolute, or empty for the home directory. */
116
+ function ssh(host, path = '') {
117
+ return `${TaLocation.SSH}${host}${path ? normalize(path) : ''}`;
118
+ }
119
+ TaLocation.ssh = ssh;
120
+ /** The host of a remote location; undefined for this machine. */
121
+ function host(location) {
122
+ var _a;
123
+ return isRemote(location) ? (_a = parse(location)) === null || _a === void 0 ? void 0 : _a.host : undefined;
124
+ }
125
+ TaLocation.host = host;
126
+ /** The path inside its machine. */
127
+ function path(location) {
128
+ var _a;
129
+ var _b;
130
+ return (_b = (_a = parse(location)) === null || _a === void 0 ? void 0 : _a.path) !== null && _b !== void 0 ? _b : location;
131
+ }
132
+ TaLocation.path = path;
133
+ /** The directory above; undefined at a root (`/`, `C:\\`, the root of a host). */
134
+ function parent(location) {
135
+ const remote = parse(location);
136
+ if (remote) {
137
+ const above = remote.path ? parentPath(remote.path) : undefined;
138
+ return above === undefined ? undefined : ssh(remote.host, above);
139
+ }
140
+ return parentPath(location);
141
+ }
142
+ TaLocation.parent = parent;
143
+ function child(location, name) {
144
+ const remote = parse(location);
145
+ if (remote) {
146
+ return ssh(remote.host, childPath(remote.path || '/', name));
147
+ }
148
+ return childPath(location, name);
149
+ }
150
+ TaLocation.child = child;
151
+ /** The last name of the path; the host for its home directory. */
152
+ function basename(location) {
153
+ const remote = parse(location);
154
+ const path = (remote ? remote.path : location).replace(/[\\/]+$/, '');
155
+ const name = path.slice(Math.max(path.lastIndexOf('/'), path.lastIndexOf('\\')) + 1);
156
+ return name || (remote === null || remote === void 0 ? void 0 : remote.host) || location;
157
+ }
158
+ TaLocation.basename = basename;
159
+ function parentPath(path) {
160
+ const trimmed = path.replace(/[\\/]+$/, '');
161
+ const at = Math.max(trimmed.lastIndexOf('/'), trimmed.lastIndexOf('\\'));
162
+ if (at < 0) {
163
+ return undefined;
164
+ }
165
+ const head = trimmed.slice(0, at);
166
+ return head === '' || /^[A-Za-z]:$/.test(head) ? head + trimmed[at] : head;
167
+ }
168
+ function childPath(path, name) {
169
+ const separator = path.includes('/') || !path.includes('\\') ? '/' : '\\';
170
+ return path.endsWith(separator) ? path + name : path + separator + name;
171
+ }
172
+ /** One `/` between names, none at the end but for the root. */
173
+ function normalize(path) {
174
+ const squeezed = `/${path}`.replace(/\/+/g, '/');
175
+ return squeezed.length > 1 ? squeezed.replace(/\/$/, '') : squeezed;
176
+ }
177
+ })(TaLocation || (exports.TaLocation = TaLocation = {}));
178
+ //# sourceMappingURL=location.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"location.js","sourceRoot":"","sources":["../../src/common/location.ts"],"names":[],"mappings":";;;AAAA;;;;;GAKG;AACH,IA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zC,MAAM,SAAS,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC;QAC1E,OAAO,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC,IAAI,GAAG,SAAS,GAAG,IAAI,CAAC;IAC5E,CAAC;IAED,+DAA+D;IAC/D,SAAS,SAAS,CAAC,IAAY;QAC3B,MAAM,QAAQ,GAAG,IAAI,IAAI,EAAE,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;QACjD,OAAO,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC;IACxE,CAAC;AACL,CAAC,EA1KgB,UAAU,aAAV,UAAU,GAAV,UAAU,QA0K1B"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=location.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"location.spec.d.ts","sourceRoot":"","sources":["../../src/common/location.spec.ts"],"names":[],"mappings":""}
@@ -0,0 +1,58 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const bun_test_1 = require("bun:test");
4
+ const location_1 = require("./location");
5
+ (0, bun_test_1.describe)('TaLocation', () => {
6
+ (0, bun_test_1.it)('reads a path of this machine as no remote location', () => {
7
+ (0, bun_test_1.expect)(location_1.TaLocation.parse('/home/me/app')).toBeUndefined();
8
+ (0, bun_test_1.expect)(location_1.TaLocation.path('/home/me/app')).toBe('/home/me/app');
9
+ (0, bun_test_1.expect)(location_1.TaLocation.host('C:\\work')).toBeUndefined();
10
+ });
11
+ (0, bun_test_1.it)('reads the host and the path of an ssh location', () => {
12
+ (0, bun_test_1.expect)(location_1.TaLocation.parse('ssh://dev/home/me/app')).toEqual({ host: 'dev', path: '/home/me/app' });
13
+ (0, bun_test_1.expect)(location_1.TaLocation.parse('ssh://me@10.0.0.2:2222//srv//app/')).toEqual({ host: 'me@10.0.0.2:2222', path: '/srv/app' });
14
+ (0, bun_test_1.expect)(location_1.TaLocation.parse('ssh://dev')).toEqual({ host: 'dev', path: '' });
15
+ (0, bun_test_1.expect)(location_1.TaLocation.parse('ssh://dev/')).toEqual({ host: 'dev', path: '/' });
16
+ });
17
+ (0, bun_test_1.it)('refuses a host that ssh would read as an option, or none', () => {
18
+ (0, bun_test_1.expect)(() => location_1.TaLocation.parse('ssh://-oProxyCommand=x/tmp')).toThrow();
19
+ (0, bun_test_1.expect)(() => location_1.TaLocation.parse('ssh:///tmp')).toThrow();
20
+ (0, bun_test_1.expect)(() => location_1.TaLocation.parse('ssh://a b/tmp')).toThrow();
21
+ (0, bun_test_1.expect)(location_1.TaLocation.isHost('dev.example.com')).toBe(true);
22
+ (0, bun_test_1.expect)(location_1.TaLocation.isHost('-p')).toBe(false);
23
+ });
24
+ (0, bun_test_1.it)('walks up and down remote directories as it does local ones', () => {
25
+ (0, bun_test_1.expect)(location_1.TaLocation.parent('ssh://dev/home/me')).toBe('ssh://dev/home');
26
+ (0, bun_test_1.expect)(location_1.TaLocation.parent('ssh://dev/home')).toBe('ssh://dev/');
27
+ (0, bun_test_1.expect)(location_1.TaLocation.parent('ssh://dev/')).toBeUndefined();
28
+ (0, bun_test_1.expect)(location_1.TaLocation.parent('ssh://dev')).toBeUndefined();
29
+ (0, bun_test_1.expect)(location_1.TaLocation.child('ssh://dev/', 'srv')).toBe('ssh://dev/srv');
30
+ (0, bun_test_1.expect)(location_1.TaLocation.child('ssh://dev/srv', 'app')).toBe('ssh://dev/srv/app');
31
+ (0, bun_test_1.expect)(location_1.TaLocation.parent('/home/me')).toBe('/home');
32
+ (0, bun_test_1.expect)(location_1.TaLocation.parent('/')).toBeUndefined();
33
+ (0, bun_test_1.expect)(location_1.TaLocation.parent('C:\\work')).toBe('C:\\');
34
+ (0, bun_test_1.expect)(location_1.TaLocation.child('C:\\work', 'app')).toBe('C:\\work\\app');
35
+ });
36
+ (0, bun_test_1.it)('names a directory by its last name, the home of a host by the host', () => {
37
+ (0, bun_test_1.expect)(location_1.TaLocation.basename('ssh://dev/home/me/app/')).toBe('app');
38
+ (0, bun_test_1.expect)(location_1.TaLocation.basename('ssh://dev')).toBe('dev');
39
+ (0, bun_test_1.expect)(location_1.TaLocation.basename('/work/app')).toBe('app');
40
+ (0, bun_test_1.expect)(location_1.TaLocation.ssh('dev', 'srv/app')).toBe('ssh://dev/srv/app');
41
+ });
42
+ (0, bun_test_1.it)('reads a host as the user writes it, the command line of ssh too', () => {
43
+ (0, bun_test_1.expect)(location_1.TaLocation.readHost('dev')).toEqual({ host: 'dev' });
44
+ (0, bun_test_1.expect)(location_1.TaLocation.readHost(' ssh://me@dev:2222/srv ')).toEqual({ host: 'me@dev:2222' });
45
+ (0, bun_test_1.expect)(location_1.TaLocation.readHost('ssh root@suboyang.devcloud.woa.com -p 36000')).toEqual({ host: 'root@suboyang.devcloud.woa.com:36000' });
46
+ (0, bun_test_1.expect)(location_1.TaLocation.readHost('ssh -p36000 -A -l root box')).toEqual({ host: 'root@box:36000' });
47
+ (0, bun_test_1.expect)(location_1.TaLocation.readHost('ssh -o Port=2200 -o User=me box')).toEqual({ host: 'me@box:2200' });
48
+ (0, bun_test_1.expect)(location_1.TaLocation.readHost('me@box -p 22')).toEqual({ host: 'me@box' });
49
+ });
50
+ (0, bun_test_1.it)('says which options of ssh belong in ~/.ssh/config, and refuses what is no host', () => {
51
+ (0, bun_test_1.expect)(location_1.TaLocation.readHost('ssh -i ~/.ssh/key -J jump me@box')).toEqual({ error: 'options', options: ['-i ~/.ssh/key', '-J jump'] });
52
+ (0, bun_test_1.expect)(location_1.TaLocation.readHost('ssh -o ProxyCommand=nc box')).toEqual({ error: 'options', options: ['-o ProxyCommand=nc'] });
53
+ (0, bun_test_1.expect)(location_1.TaLocation.readHost('ssh')).toEqual({ error: 'empty' });
54
+ (0, bun_test_1.expect)(location_1.TaLocation.readHost('ssh box ls -la')).toEqual({ error: 'invalid' });
55
+ (0, bun_test_1.expect)(location_1.TaLocation.readHost('box -p abc')).toEqual({ error: 'invalid' });
56
+ });
57
+ });
58
+ //# sourceMappingURL=location.spec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"location.spec.js","sourceRoot":"","sources":["../../src/common/location.spec.ts"],"names":[],"mappings":";;AAAA,uCAAgD;AAChD,yCAAwC;AAExC,IAAA,mBAAQ,EAAC,YAAY,EAAE,GAAG,EAAE;IACxB,IAAA,aAAE,EAAC,oDAAoD,EAAE,GAAG,EAAE;QAC1D,IAAA,iBAAM,EAAC,qBAAU,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC,CAAC,aAAa,EAAE,CAAC;QACzD,IAAA,iBAAM,EAAC,qBAAU,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;QAC7D,IAAA,iBAAM,EAAC,qBAAU,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,aAAa,EAAE,CAAC;IACxD,CAAC,CAAC,CAAC;IAEH,IAAA,aAAE,EAAC,gDAAgD,EAAE,GAAG,EAAE;QACtD,IAAA,iBAAM,EAAC,qBAAU,CAAC,KAAK,CAAC,uBAAuB,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,cAAc,EAAE,CAAC,CAAC;QACjG,IAAA,iBAAM,EAAC,qBAAU,CAAC,KAAK,CAAC,mCAAmC,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,kBAAkB,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC,CAAC;QACtH,IAAA,iBAAM,EAAC,qBAAU,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,C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,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC,oBAAoB,CAAC,EAAE,CAAC,CAAC;QACzH,IAAA,iBAAM,EAAC,qBAAU,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,CAAC;QAC/D,IAAA,iBAAM,EAAC,qBAAU,CAAC,QAAQ,CAAC,gBAAgB,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC;QAC5E,IAAA,iBAAM,EAAC,qBAAU,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC;IAC5E,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
@@ -0,0 +1,86 @@
1
+ export declare const TaRemoteServer: unique symbol;
2
+ export declare const TA_REMOTE_SERVICE = "TaRemoteServer";
3
+ /** A machine ta serve can reach with ssh. */
4
+ export interface TaRemoteHost {
5
+ /** What follows `ssh://` in a location (TaLocation). */
6
+ host: string;
7
+ /** A Host of ~/.ssh/config, or one opened before. */
8
+ source: 'config' | 'recent';
9
+ /** ta serve is connected to it now. */
10
+ connected: boolean;
11
+ }
12
+ /**
13
+ * What ssh asks while it connects (a password, a passphrase, whether to trust a new host key), for
14
+ * whoever is there to answer: `confirm` takes `yes` or `no`, `secret` is not shown as typed.
15
+ */
16
+ export interface TaRemotePrompt {
17
+ promptId: string;
18
+ host: string;
19
+ kind: 'secret' | 'confirm' | 'text';
20
+ message: string;
21
+ }
22
+ /** What happens with the remote machines, to the connections that called TaRemoteServer.watch. */
23
+ export type TaRemoteEvent = {
24
+ type: 'prompt';
25
+ prompt: TaRemotePrompt;
26
+ }
27
+ /** Answered, by this client or another, or ssh no longer waits. */
28
+ | {
29
+ type: 'prompt_closed';
30
+ promptId: string;
31
+ }
32
+ /** A step of connecting that takes a while: the first connection installs things there. */
33
+ | {
34
+ type: 'progress';
35
+ host: string;
36
+ step: TaRemoteStep;
37
+ detail?: string;
38
+ }
39
+ /** Connected to the host, or no longer. */
40
+ | {
41
+ type: 'connection';
42
+ host: string;
43
+ connected: boolean;
44
+ error?: string;
45
+ };
46
+ /**
47
+ * The steps of connecting to a host: ssh signs in, then Ta looks at what the host has, installs Node.js
48
+ * there when it has none (`detail`: the version), copies its small server, and starts it.
49
+ */
50
+ export type TaRemoteStep = 'connecting' | 'checking' | 'installing-node' | 'copying-server' | 'starting';
51
+ /** A port of another machine, reachable on the machine of ta serve. */
52
+ export interface TaForwardedPort {
53
+ host: string;
54
+ /** On the other machine. */
55
+ remotePort: number;
56
+ /** On the machine of ta serve, at 127.0.0.1. */
57
+ localPort: number;
58
+ }
59
+ /**
60
+ * Other machines that conversations work on, as VS Code's Remote SSH: the agent runs with ta serve, and
61
+ * its commands and files are there, through the `ssh` of the machine of ta serve with its configuration.
62
+ */
63
+ export interface TaRemoteServer {
64
+ /** The Hosts of ~/.ssh/config without wildcards, and those added or opened before, the latest first. */
65
+ listHosts(): Promise<TaRemoteHost[]>;
66
+ /** Keeps a host in the list (`recent`), without connecting to it. */
67
+ addHost(host: string): Promise<void>;
68
+ /** Disconnects from a host and drops it from the list; one of ~/.ssh/config stays there. */
69
+ removeHost(host: string): Promise<void>;
70
+ /** The location with the path of the home directory when it has none; connects to the host. */
71
+ resolveLocation(location: string): Promise<string>;
72
+ /**
73
+ * A port of the machine of `cwd` on the machine of ta serve, for a page served there: the same port
74
+ * when `cwd` is a directory of this machine. It stays open while ta serve runs.
75
+ */
76
+ forwardPort(port: number, cwd?: string): Promise<TaForwardedPort>;
77
+ listForwardedPorts(): Promise<TaForwardedPort[]>;
78
+ closeForwardedPort(host: string, remotePort: number): Promise<void>;
79
+ /** This connection hears TaClient.onRemoteEvent from now; resolves to the prompts that wait. */
80
+ watch(): Promise<TaRemotePrompt[]>;
81
+ /** The answer to a prompt; `null` cancels it. False when it no longer waits. */
82
+ answer(promptId: string, value: string | null): Promise<boolean>;
83
+ /** Ends the connection to the host, its processes and forwarded ports there. */
84
+ disconnect(host: string): Promise<void>;
85
+ }
86
+ //# sourceMappingURL=remote-protocol.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"remote-protocol.d.ts","sourceRoot":"","sources":["../../src/common/remote-protocol.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,cAAc,eAA2B,CAAC;AACvD,eAAO,MAAM,iBAAiB,mBAAmB,CAAC;AAElD,6CAA6C;AAC7C,MAAM,WAAW,YAAY;IACzB,wDAAwD;IACxD,IAAI,EAAE,MAAM,CAAC;IACb,qDAAqD;IACrD,MAAM,EAAE,QAAQ,GAAG,QAAQ,CAAC;IAC5B,uCAAuC;IACvC,SAAS,EAAE,OAAO,CAAC;CACtB;AAED;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,QAAQ,GAAG,SAAS,GAAG,MAAM,CAAC;IACpC,OAAO,EAAE,MAAM,CAAC;CACnB;AAED,kGAAkG;AAClG,MAAM,MAAM,aAAa,GACnB;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,MAAM,EAAE,cAAc,CAAA;CAAE;AAC5C,mEAAmE;GACjE;IAAE,IAAI,EAAE,eAAe,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE;AAC7C,2FAA2F;GACzF;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,YAAY,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE;AACzE,2CAA2C;GACzC;IAAE,IAAI,EAAE,YAAY,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,OAAO,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CA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
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TA_REMOTE_SERVICE = exports.TaRemoteServer = void 0;
4
+ exports.TaRemoteServer = Symbol('TaRemoteServer');
5
+ exports.TA_REMOTE_SERVICE = 'TaRemoteServer';
6
+ //# sourceMappingURL=remote-protocol.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"remote-protocol.js","sourceRoot":"","sources":["../../src/common/remote-protocol.ts"],"names":[],"mappings":";;;AAAa,QAAA,cAAc,GAAG,MAAM,CAAC,gBAAgB,CAAC,CAAC;AAC1C,QAAA,iBAAiB,GAAG,gBAAgB,CAAC"}
@@ -28,6 +28,8 @@ export interface TaSettingsSnapshot {
28
28
  projectTrusted: boolean;
29
29
  /** `<provider>/<model id>` of the models with credentials, for the model setting. */
30
30
  models: string[];
31
+ /** The names of those of `models` that have one other than their id. */
32
+ modelNames?: Record<string, string>;
31
33
  }
32
34
  /** The settings of ta in pi's `settings.json` files, on the same WebSocket as {@link TaServer}. */
33
35
  export interface TaSettingsServer {
@@ -39,5 +41,10 @@ export interface TaSettingsServer {
39
41
  * level are for new sessions.
40
42
  */
41
43
  updateSettings(scope: TaSettingsScope, changes: Record<string, unknown>, cwd?: string): Promise<TaSettingsSnapshot>;
44
+ /**
45
+ * The language the user reads (`zh-CN`, `en-US`), for what the server and the pi packages it runs say:
46
+ * it is `TA_LANGUAGE` of the process of ta serve, which they read. The client that set it last wins.
47
+ */
48
+ setLanguage(language: string): Promise<void>;
42
49
  }
43
50
  //# sourceMappingURL=settings-protocol.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"settings-protocol.d.ts","sourceRoot":"","sources":["../../src/common/settings-protocol.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,gBAAgB,eAA6B,CAAC;AAC3D,eAAO,MAAM,mBAAmB,qBAAqB,CAAC;AAEtD,oJAAoJ;AACpJ,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,SAAS,CAAC;AAEjD,iGAA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AO,CAAC,IAAI,CAAC,CAAC;CAChD"}
@@ -2,12 +2,14 @@ import type { TaPackageServer } from './package-protocol';
2
2
  import type { TaServer } from './ta-protocol';
3
3
  /**
4
4
  * What `ta serve` gives the server side of a package: the sessions and the data of packages, in its own
5
- * process, without a token. A subset of TaServer and TaPackageServer: it can open and drive sessions, not
6
- * close or remove anything.
5
+ * process, without a token. A subset of TaServer and TaPackageServer: it can open, drive, stop and close
6
+ * sessions (best those it opened: closing one takes it from every client), not remove anything.
7
7
  */
8
- export interface TaExtensionHost extends Pick<TaServer, 'getServerInfo' | 'listSessions' | 'openSession' | 'setSessionName' | 'prompt' | 'followUp' | 'getState' | 'getLastAssistantText'>, Pick<TaPackageServer, 'getExtensionData' | 'setExtensionData' | 'listPackages'> {
8
+ export interface TaExtensionHost extends Pick<TaServer, 'getServerInfo' | 'listSessions' | 'openSession' | 'closeSession' | 'setSessionName' | 'prompt' | 'followUp' | 'abort' | 'getState' | 'getLastAssistantText'>, Pick<TaPackageServer, 'getExtensionData' | 'setExtensionData' | 'listPackages'> {
9
9
  /** The agent directory of Ta (`~/.ta/agent`): its `extensions/` holds the packages of the user. */
10
10
  readonly agentDir: string;
11
+ /** 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. */
12
+ sessionCwd(sessionFile: string): Promise<string | undefined>;
11
13
  /** Keys of the data of a package that changed, by a page or by the server, as they change; `cwd` for a key of a directory. */
12
14
  onExtensionData(listener: (name: string, key: string, cwd?: string) => void): () => void;
13
15
  }
@@ -32,6 +34,19 @@ export type TaPackageHostFactory = (host: TaExtensionHost) => TaPackageService |
32
34
  * and the extension should say its tools need `ta serve`.
33
35
  */
34
36
  export declare const TA_HOST_EVENT = "ta:host";
37
+ /**
38
+ * The event of pi's `pi.events` by which an extension whose tools change files without pi's `edit` and
39
+ * `write` (another coding agent's own tools, ta-agents) says which, as soon as it knows and before the
40
+ * write if it can: `pi.events.emit(TA_FILE_WRITE_EVENT, file)`. The list of changed files (ta-changes)
41
+ * keeps what the file holds then.
42
+ */
43
+ export declare const TA_FILE_WRITE_EVENT = "ta:file-write";
44
+ export interface TaFileWrite {
45
+ /** Absolute, on the machine where the session's tools work. */
46
+ path: string;
47
+ /** Its text before the change, when known (a diff of the agent); null: there was no file. */
48
+ before?: string | null;
49
+ }
35
50
  export interface TaHostRequest {
36
51
  /** The `name` of the package.json. */
37
52
  name: string;
@@ -41,5 +56,20 @@ export interface TaHostAnswer {
41
56
  host: TaExtensionHost;
42
57
  /** What the module of `pi.host` of the package returned; undefined when it has none or failed. */
43
58
  service?: TaPackageService;
59
+ /** The files of the session that asked, where its tools read and write. */
60
+ files: TaSessionFiles;
61
+ }
62
+ /**
63
+ * The files of a session where its tools work: on the machine of `ta serve`, or on the one of an
64
+ * `ssh://` directory (ExecEnvironment). Paths are those {@link resolve} gives.
65
+ */
66
+ export interface TaSessionFiles {
67
+ /** The path a tool of the session (read, edit, write) works on for a path of its arguments. */
68
+ resolve(path: string): string;
69
+ /** The bytes of a file; undefined when there is no file there. */
70
+ read(path: string): Promise<Uint8Array | undefined>;
71
+ /** Writes a file, and the directories it needs. */
72
+ write(path: string, data: Uint8Array): Promise<void>;
73
+ remove(path: string): Promise<void>;
44
74
  }
45
75
  //# sourceMappingURL=ta-extension-host.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ta-extension-host.d.ts","sourceRoot":"","sources":["../../src/common/ta-extension-host.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAE9C;;;;GAIG;AACH,MAAM,WAAW,eACb,SAAQ,IAAI,CAAC,QAAQ,EAAE,eAAe,GAAG,cAAc,GAAG,aAAa,GAAG,gBAAgB,GAAG,QAAQ,GAAG,UAAU,GAAG,UAAU,GAAG,sBAAsB,CAAC,EACrJ,IAAI,CAAC,eAAe,EAAE,kBAAkB,GA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B,+FAA+F;IAC/F,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC;IAC9B,kEAAkE;IAClE,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,GAAG,SAAS,CAAC,CAAC;IACpD,mDAAmD;IACnD,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACrD,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACvC"}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TA_HOST_EVENT = void 0;
3
+ exports.TA_FILE_WRITE_EVENT = exports.TA_HOST_EVENT = void 0;
4
4
  /**
5
5
  * The event of pi's `pi.events` by which a pi extension asks for the host of its package:
6
6
  * `pi.events.emit(TA_HOST_EVENT, { name, resolve })`. Under `ta serve` `resolve` is called at once, if
@@ -8,4 +8,11 @@ exports.TA_HOST_EVENT = void 0;
8
8
  * and the extension should say its tools need `ta serve`.
9
9
  */
10
10
  exports.TA_HOST_EVENT = 'ta:host';
11
+ /**
12
+ * The event of pi's `pi.events` by which an extension whose tools change files without pi's `edit` and
13
+ * `write` (another coding agent's own tools, ta-agents) says which, as soon as it knows and before the
14
+ * write if it can: `pi.events.emit(TA_FILE_WRITE_EVENT, file)`. The list of changed files (ta-changes)
15
+ * keeps what the file holds then.
16
+ */
17
+ exports.TA_FILE_WRITE_EVENT = 'ta:file-write';
11
18
  //# sourceMappingURL=ta-extension-host.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ta-extension-host.js","sourceRoot":"","sources":["../../src/common/ta-extension-host.ts"],"names":[],"mappings":";;;AAiCA;;;;;GAKG;AACU,QAAA,aAAa,GAAG,SAAS,CAAC"}
1
+ {"version":3,"file":"ta-extension-host.js","sourceRoot":"","sources":["../../src/common/ta-extension-host.ts"],"names":[],"mappings":";;;AA+CA;;;;;GAKG;AACU,QAAA,aAAa,GAAG,SAAS,CAAC;AAEvC;;;;;GAKG;AACU,QAAA,mBAAmB,GAAG,eAAe,CAAC"}
@@ -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
  export declare const TaServer: unique symbol;
4
5
  export declare const TaClient: unique symbol;
5
6
  /** Path of the WebSocket endpoint of `ta serve`, and the JSON-RPC method prefixes of both sides. */
@@ -23,6 +24,10 @@ export interface TaServerInfo {
23
24
  * `setWorkingDirectory`, else the working directory of `ta serve`, or of its execution environment.
24
25
  */
25
26
  cwd: string;
27
+ /** The user who runs `ta serve`, as the system names them: whose Ta the client is signed in to. */
28
+ user: string;
29
+ /** The name of the machine of `ta serve`, without a `.local` suffix. */
30
+ host: string;
26
31
  }
27
32
  /** The stable `code` of each failure of a {@link TaServer} call. */
28
33
  export declare const TaErrorCode: {
@@ -82,7 +87,7 @@ export interface TaClientToolDefinition {
82
87
  parameters: Record<string, unknown>;
83
88
  }
84
89
  export interface TaOpenSessionOptions {
85
- /** Working directory of the session, on the machine of the server. */
90
+ /** Working directory of the session: a path of the machine of the server, or an `ssh://` location of another (TaLocation). */
86
91
  cwd: string;
87
92
  /** Opens this session file; default: a new session. */
88
93
  sessionFile?: string;
@@ -197,6 +202,11 @@ export interface TaAttachResult {
197
202
  pendingUi: RpcExtensionUIRequest[];
198
203
  /** The calls of client tools still waiting for a result. */
199
204
  pendingClientTools: TaClientToolRequest[];
205
+ /**
206
+ * What the extensions show now (`setStatus`, `setWidget`), as a terminal keeps it on screen: a client
207
+ * that attaches draws it, whatever it missed. None from a server before it.
208
+ */
209
+ shownUi?: RpcExtensionUIRequest[];
200
210
  /** Seq of the last event of the session. */
201
211
  lastSeq: number;
202
212
  /** Some events after `afterSeq` are gone: read the conversation again with `getMessages`. */
@@ -214,7 +224,7 @@ export interface TaClientToolResult {
214
224
  * The sessions of `ta serve`, over JSON-RPC 2.0 on a WebSocket. Besides opening, attaching and answering,
215
225
  * each method is the command of pi's RPC mode with the same name in camelCase, on the open session
216
226
  * `sessionId` (see PiCommandMethod). The same WebSocket carries the other services of ta serve, each
217
- * under its own name: TaWorkspaceServer, TaTerminalServer, TaSettingsServer and TaPackageServer.
227
+ * under its own name: TaWorkspaceServer, TaTerminalServer, TaSettingsServer, TaPackageServer, TaRemoteServer and others.
218
228
  */
219
229
  export interface TaServer {
220
230
  getServerInfo(): Promise<TaServerInfo>;
@@ -296,6 +306,8 @@ export interface TaClient {
296
306
  onExtensionData(name: string, keys: string[], cwd?: string): Promise<void>;
297
307
  /** What happens during a sign-in this connection started (TaAuthServer.login). */
298
308
  onAuthEvent(loginId: string, event: TaAuthEvent): Promise<void>;
309
+ /** What happens with the remote machines, once this connection called TaRemoteServer.watch. */
310
+ onRemoteEvent(event: TaRemoteEvent): Promise<void>;
299
311
  }
300
312
  export {};
301
313
  //# sourceMappingURL=ta-protocol.d.ts.map