@celljs/ta-host 4.15.2 → 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.
- package/esm/node/app-commands.d.ts +111 -0
- package/esm/node/app-commands.js +629 -0
- package/esm/node/delegate-extension.d.ts +11 -0
- package/esm/node/delegate-extension.js +33 -0
- package/esm/node/directory-relocator.d.ts +49 -0
- package/esm/node/directory-relocator.js +267 -0
- package/esm/node/exec-endpoint.d.ts +14 -0
- package/esm/node/exec-endpoint.js +48 -0
- package/esm/node/extension-providers.d.ts +16 -1
- package/esm/node/extension-providers.js +23 -3
- package/esm/node/gateway-models.d.ts +38 -0
- package/esm/node/gateway-models.js +124 -0
- package/esm/node/index.d.ts +8 -0
- package/esm/node/index.js +8 -0
- package/esm/node/keep-awake.d.ts +5 -1
- package/esm/node/keep-awake.js +18 -2
- package/esm/node/message-page.d.ts +6 -1
- package/esm/node/message-page.js +50 -2
- package/esm/node/package-hosts.d.ts +6 -0
- package/esm/node/package-hosts.js +35 -0
- package/esm/node/package-webhooks.d.ts +26 -0
- package/esm/node/package-webhooks.js +101 -0
- package/esm/node/page-book.d.ts +48 -0
- package/esm/node/page-book.js +117 -0
- package/esm/node/relay-bridge.d.ts +2 -0
- package/esm/node/relay-bridge.js +35 -1
- package/esm/node/remote/cloud-hosts.d.ts +40 -0
- package/esm/node/remote/cloud-hosts.js +99 -0
- package/esm/node/remote/index.d.ts +1 -0
- package/esm/node/remote/index.js +1 -0
- package/esm/node/remote/pi-directories.d.ts +2 -1
- package/esm/node/remote/pi-directories.js +7 -2
- package/esm/node/remote/remote-hosts.d.ts +5 -0
- package/esm/node/remote/remote-hosts.js +71 -2
- package/esm/node/remote/remote-protocol.d.ts +2 -0
- package/esm/node/remote/remote-server-impl.d.ts +1 -0
- package/esm/node/remote/remote-server-impl.js +3 -0
- package/esm/node/rooms-bridge.d.ts +3 -0
- package/esm/node/rooms-bridge.js +4 -0
- package/esm/node/session-info-util.d.ts +3 -1
- package/esm/node/session-info-util.js +32 -6
- package/esm/node/ta-server-impl.d.ts +5 -1
- package/esm/node/ta-server-impl.js +22 -0
- package/esm/node/ta-session-factory.d.ts +13 -1
- package/esm/node/ta-session-factory.js +39 -4
- package/esm/node/ta-session.d.ts +2 -0
- package/esm/node/ta-session.js +1 -0
- package/esm/node/team/team-calls.js +23 -0
- package/esm/node/voice-bridge.d.ts +68 -0
- package/esm/node/voice-bridge.js +273 -0
- package/esm/node/voices-file.d.ts +33 -0
- package/esm/node/voices-file.js +89 -0
- package/lib/node/app-commands.d.ts +112 -0
- package/lib/node/app-commands.js +633 -0
- package/lib/node/delegate-extension.d.ts +12 -0
- package/lib/node/delegate-extension.js +37 -0
- package/lib/node/directory-relocator.d.ts +50 -0
- package/lib/node/directory-relocator.js +270 -0
- package/lib/node/exec-endpoint.d.ts +15 -0
- package/lib/node/exec-endpoint.js +51 -0
- package/lib/node/extension-providers.d.ts +16 -1
- package/lib/node/extension-providers.js +23 -3
- package/lib/node/gateway-models.d.ts +39 -0
- package/lib/node/gateway-models.js +127 -0
- package/lib/node/index.d.ts +8 -0
- package/lib/node/index.js +8 -0
- package/lib/node/keep-awake.d.ts +5 -1
- package/lib/node/keep-awake.js +18 -2
- package/lib/node/message-page.d.ts +6 -1
- package/lib/node/message-page.js +50 -2
- package/lib/node/package-hosts.d.ts +6 -0
- package/lib/node/package-hosts.js +35 -0
- package/lib/node/package-webhooks.d.ts +27 -0
- package/lib/node/package-webhooks.js +104 -0
- package/lib/node/page-book.d.ts +49 -0
- package/lib/node/page-book.js +120 -0
- package/lib/node/relay-bridge.d.ts +2 -0
- package/lib/node/relay-bridge.js +34 -0
- package/lib/node/remote/cloud-hosts.d.ts +41 -0
- package/lib/node/remote/cloud-hosts.js +103 -0
- package/lib/node/remote/index.d.ts +1 -0
- package/lib/node/remote/index.js +1 -0
- package/lib/node/remote/pi-directories.d.ts +2 -1
- package/lib/node/remote/pi-directories.js +7 -2
- package/lib/node/remote/remote-hosts.d.ts +5 -0
- package/lib/node/remote/remote-hosts.js +71 -2
- package/lib/node/remote/remote-protocol.d.ts +2 -0
- package/lib/node/remote/remote-server-impl.d.ts +1 -0
- package/lib/node/remote/remote-server-impl.js +3 -0
- package/lib/node/rooms-bridge.d.ts +3 -0
- package/lib/node/rooms-bridge.js +4 -0
- package/lib/node/session-info-util.d.ts +3 -1
- package/lib/node/session-info-util.js +31 -5
- package/lib/node/ta-server-impl.d.ts +5 -1
- package/lib/node/ta-server-impl.js +22 -0
- package/lib/node/ta-session-factory.d.ts +13 -1
- package/lib/node/ta-session-factory.js +38 -3
- package/lib/node/ta-session.d.ts +2 -0
- package/lib/node/ta-session.js +1 -0
- package/lib/node/team/team-calls.js +23 -0
- package/lib/node/voice-bridge.d.ts +69 -0
- package/lib/node/voice-bridge.js +274 -0
- package/lib/node/voices-file.d.ts +34 -0
- package/lib/node/voices-file.js +93 -0
- package/package.json +10 -10
package/esm/node/relay-bridge.js
CHANGED
|
@@ -15,7 +15,7 @@ import { Rpc } from '@celljs/rpc';
|
|
|
15
15
|
import { ExecEnvironmentFactory } from '@celljs/ta-exec';
|
|
16
16
|
import { PackageArchive } from '@celljs/ta-harness/lib/node/package-archive';
|
|
17
17
|
import { TaBrand } from '@celljs/ta-harness/lib/node/ta-brand';
|
|
18
|
-
import { TA_WEBSOCKET_PATH, TaRelayServer, } from '@celljs/ta-protocol';
|
|
18
|
+
import { TA_WEBSOCKET_PATH, TaDeploymentUtil, TaRelayServer, } from '@celljs/ta-protocol';
|
|
19
19
|
import { RELAY_CONTENT_MAX_BYTES, RELAY_FEATURES, RELAY_SHARE_MAX_BYTES, RelayBlobClient, RelayBytes, RelayContentError, RelayContentUtil, RelayHost, RelayHubFiles, RelayHubs, RelayInfoUtil, RelayPairingUtil, RelayServiceUtil, RelayShareUtil, RelayStore, RelaysConfigError, RelaysFile, RelayTypes, } from '@celljs/ta-relay/lib/node';
|
|
20
20
|
import { ServerAware } from '@celljs/web/lib/node';
|
|
21
21
|
import { KeepAwake, WebExtensionCatalog } from './host-protocol.js';
|
|
@@ -238,6 +238,7 @@ let RelayBridge = RelayBridge_1 = class RelayBridge {
|
|
|
238
238
|
const url = RelayServiceUtil.isRelay(service) ? service.url : undefined;
|
|
239
239
|
return [feature, service.id || ((_a = services.find(each => each.type === 'ta-relay' && each.url === url)) === null || _a === void 0 ? void 0 : _a.id) || ''];
|
|
240
240
|
}));
|
|
241
|
+
const deployment = this.relays.deployment(config);
|
|
241
242
|
const drives = RelayServiceUtil.drives().filter(drive => !services.some(service => service.type === 'folder' && service.path === drive.path));
|
|
242
243
|
const types = [...this.types].map(([type, { title, hint, icon, options }]) => ({
|
|
243
244
|
type,
|
|
@@ -253,6 +254,7 @@ let RelayBridge = RelayBridge_1 = class RelayBridge {
|
|
|
253
254
|
...(drives.length ? { drives } : {}),
|
|
254
255
|
...(types.length ? { types } : {}),
|
|
255
256
|
...(error ? { error } : {}),
|
|
257
|
+
...(deployment ? { deployment } : {}),
|
|
256
258
|
};
|
|
257
259
|
}
|
|
258
260
|
/** The store of a service of a type a package registered. */
|
|
@@ -424,6 +426,38 @@ let TaRelayServerImpl = class TaRelayServerImpl {
|
|
|
424
426
|
return this.bridge.listRelays();
|
|
425
427
|
});
|
|
426
428
|
}
|
|
429
|
+
joinDeployment(url) {
|
|
430
|
+
return TaErrors.guard(async () => {
|
|
431
|
+
var _a, _b;
|
|
432
|
+
const address = TaDeploymentUtil.url(url);
|
|
433
|
+
if (!address) {
|
|
434
|
+
throw TaErrors.invalidArgument(`${url} is not an address of http or https.`, 'Pass the address of the gateway or the relay of the deployment, https://….');
|
|
435
|
+
}
|
|
436
|
+
let deployment;
|
|
437
|
+
try {
|
|
438
|
+
deployment = await TaDeploymentUtil.discover(address);
|
|
439
|
+
}
|
|
440
|
+
catch (error) {
|
|
441
|
+
throw TaErrors.invalidArgument(error instanceof Error ? error.message : String(error), 'Check the address: a service of a deployment answers /.well-known/ta. A relay alone is added as a relay.');
|
|
442
|
+
}
|
|
443
|
+
if (deployment.relay) {
|
|
444
|
+
const probe = await RelayInfoUtil.probe(deployment.relay);
|
|
445
|
+
if (!probe.online) {
|
|
446
|
+
throw TaErrors.invalidArgument(`The relay of ${(_a = deployment.name) !== null && _a !== void 0 ? _a : address}, ${deployment.relay}, does not answer: ${(_b = probe.error) !== null && _b !== void 0 ? _b : 'no answer'}.`, 'Ask whoever runs the deployment whether its relay runs.');
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
this.relaysCall(() => this.bridge.relays.join(address, deployment));
|
|
450
|
+
this.bridge.relaysChanged();
|
|
451
|
+
return this.bridge.listRelays();
|
|
452
|
+
});
|
|
453
|
+
}
|
|
454
|
+
leaveDeployment() {
|
|
455
|
+
return TaErrors.guard(async () => {
|
|
456
|
+
this.relaysCall(() => this.bridge.relays.leave());
|
|
457
|
+
this.bridge.relaysChanged();
|
|
458
|
+
return this.bridge.listRelays();
|
|
459
|
+
});
|
|
460
|
+
}
|
|
427
461
|
async probeRelay(idOrUrl) {
|
|
428
462
|
var _a, _b, _c;
|
|
429
463
|
const text = String(idOrUrl !== null && idOrUrl !== void 0 ? idOrUrl : '');
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { ExecClient } from '@celljs/ta-exec';
|
|
2
|
+
/** The path of the exec server of ta serve (and, forwarded, of ta gateway): ExecEndpoint. */
|
|
3
|
+
export declare const TA_EXEC_PATH = "/api/exec";
|
|
4
|
+
export interface CloudHost {
|
|
5
|
+
name: string;
|
|
6
|
+
/** The http(s) address of the gateway or Ta service. */
|
|
7
|
+
url: string;
|
|
8
|
+
/** That of the account there: a sign-in of the gateway, or the access token of a Ta service. */
|
|
9
|
+
token: string;
|
|
10
|
+
addedAt: number;
|
|
11
|
+
}
|
|
12
|
+
export declare namespace CloudHostsUtil {
|
|
13
|
+
/** An address as one writes it: http(s), without a path, a query or credentials. */
|
|
14
|
+
function url(value: string): string;
|
|
15
|
+
/** The WebSocket of its exec server. */
|
|
16
|
+
function execUrl(url: string): string;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* The cloud workspaces the user added (`<agent directory>/cloud-hosts.json`, readable by this user only, as their
|
|
20
|
+
* tokens are there), and a connection to each, made on its first call. Each connection fences the ones of
|
|
21
|
+
* before (its epoch is when it was made), as with `ta.exec.url`.
|
|
22
|
+
*/
|
|
23
|
+
export declare class CloudHosts {
|
|
24
|
+
protected readonly dir: () => string;
|
|
25
|
+
protected readonly clients: Map<string, ExecClient>;
|
|
26
|
+
constructor(dir: () => string);
|
|
27
|
+
list(): CloudHost[];
|
|
28
|
+
get(name: string): CloudHost | undefined;
|
|
29
|
+
save(host: CloudHost): void;
|
|
30
|
+
remove(name: string): void;
|
|
31
|
+
/** A connection to its exec server, made once; undefined for a name not added. */
|
|
32
|
+
client(name: string): ExecClient | undefined;
|
|
33
|
+
/** What a connection to it would be, for a host not kept yet (checked before it is). */
|
|
34
|
+
static connect(host: Pick<CloudHost, 'url' | 'token'>): ExecClient;
|
|
35
|
+
connected(name: string): boolean;
|
|
36
|
+
/** Its connection ends; the next call connects again. */
|
|
37
|
+
drop(name: string): ExecClient | undefined;
|
|
38
|
+
protected file(): string;
|
|
39
|
+
protected write(hosts: CloudHost[]): void;
|
|
40
|
+
}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { chmodSync, readFileSync, renameSync, writeFileSync } from 'node:fs';
|
|
2
|
+
import { join } from 'node:path';
|
|
3
|
+
import { ExecClient } from '@celljs/ta-exec';
|
|
4
|
+
import { TaLocation } from '@celljs/ta-protocol';
|
|
5
|
+
/** The path of the exec server of ta serve (and, forwarded, of ta gateway): ExecEndpoint. */
|
|
6
|
+
export const TA_EXEC_PATH = '/api/exec';
|
|
7
|
+
export var CloudHostsUtil;
|
|
8
|
+
(function (CloudHostsUtil) {
|
|
9
|
+
/** An address as one writes it: http(s), without a path, a query or credentials. */
|
|
10
|
+
function url(value) {
|
|
11
|
+
let parsed;
|
|
12
|
+
try {
|
|
13
|
+
parsed = new URL(value.trim());
|
|
14
|
+
}
|
|
15
|
+
catch (_a) {
|
|
16
|
+
throw new Error(`${value} is not an address: write https://ta.example.com.`);
|
|
17
|
+
}
|
|
18
|
+
if ((parsed.protocol !== 'https:' && parsed.protocol !== 'http:') || parsed.username || parsed.password) {
|
|
19
|
+
throw new Error(`${value} is not an address of a Ta gateway: write https://ta.example.com.`);
|
|
20
|
+
}
|
|
21
|
+
return `${parsed.origin}${parsed.pathname.replace(/\/+$/, '')}`;
|
|
22
|
+
}
|
|
23
|
+
CloudHostsUtil.url = url;
|
|
24
|
+
/** The WebSocket of its exec server. */
|
|
25
|
+
function execUrl(url) {
|
|
26
|
+
return `${url.replace(/^http/, 'ws')}${TA_EXEC_PATH}`;
|
|
27
|
+
}
|
|
28
|
+
CloudHostsUtil.execUrl = execUrl;
|
|
29
|
+
})(CloudHostsUtil || (CloudHostsUtil = {}));
|
|
30
|
+
/**
|
|
31
|
+
* The cloud workspaces the user added (`<agent directory>/cloud-hosts.json`, readable by this user only, as their
|
|
32
|
+
* tokens are there), and a connection to each, made on its first call. Each connection fences the ones of
|
|
33
|
+
* before (its epoch is when it was made), as with `ta.exec.url`.
|
|
34
|
+
*/
|
|
35
|
+
export class CloudHosts {
|
|
36
|
+
constructor(dir) {
|
|
37
|
+
this.dir = dir;
|
|
38
|
+
this.clients = new Map();
|
|
39
|
+
}
|
|
40
|
+
list() {
|
|
41
|
+
try {
|
|
42
|
+
const value = JSON.parse(readFileSync(this.file(), 'utf8'));
|
|
43
|
+
return Array.isArray(value.hosts)
|
|
44
|
+
? value.hosts.filter(host => TaLocation.isCloudName(host === null || host === void 0 ? void 0 : host.name) && typeof host.url === 'string' && typeof host.token === 'string')
|
|
45
|
+
: [];
|
|
46
|
+
}
|
|
47
|
+
catch (_a) {
|
|
48
|
+
return [];
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
get(name) {
|
|
52
|
+
return this.list().find(host => host.name === name);
|
|
53
|
+
}
|
|
54
|
+
save(host) {
|
|
55
|
+
this.write([host, ...this.list().filter(other => other.name !== host.name)]);
|
|
56
|
+
}
|
|
57
|
+
remove(name) {
|
|
58
|
+
this.write(this.list().filter(other => other.name !== name));
|
|
59
|
+
}
|
|
60
|
+
/** A connection to its exec server, made once; undefined for a name not added. */
|
|
61
|
+
client(name) {
|
|
62
|
+
let client = this.clients.get(name);
|
|
63
|
+
if (!client) {
|
|
64
|
+
const host = this.get(name);
|
|
65
|
+
if (!host) {
|
|
66
|
+
return undefined;
|
|
67
|
+
}
|
|
68
|
+
client = CloudHosts.connect(host);
|
|
69
|
+
this.clients.set(name, client);
|
|
70
|
+
}
|
|
71
|
+
return client;
|
|
72
|
+
}
|
|
73
|
+
/** What a connection to it would be, for a host not kept yet (checked before it is). */
|
|
74
|
+
static connect(host) {
|
|
75
|
+
return new ExecClient({ connect: ExecClient.webSocket(CloudHostsUtil.execUrl(host.url), host.token), epoch: Date.now() });
|
|
76
|
+
}
|
|
77
|
+
connected(name) {
|
|
78
|
+
var _a;
|
|
79
|
+
var _b;
|
|
80
|
+
return (_b = (_a = this.clients.get(name)) === null || _a === void 0 ? void 0 : _a.connected) !== null && _b !== void 0 ? _b : false;
|
|
81
|
+
}
|
|
82
|
+
/** Its connection ends; the next call connects again. */
|
|
83
|
+
drop(name) {
|
|
84
|
+
const client = this.clients.get(name);
|
|
85
|
+
this.clients.delete(name);
|
|
86
|
+
return client;
|
|
87
|
+
}
|
|
88
|
+
file() {
|
|
89
|
+
return join(this.dir(), 'cloud-hosts.json');
|
|
90
|
+
}
|
|
91
|
+
write(hosts) {
|
|
92
|
+
const file = this.file();
|
|
93
|
+
const temporary = `${file}.${process.pid}.tmp`;
|
|
94
|
+
writeFileSync(temporary, JSON.stringify({ hosts }, undefined, 2), { mode: 0o600 });
|
|
95
|
+
chmodSync(temporary, 0o600);
|
|
96
|
+
renameSync(temporary, file);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
//# sourceMappingURL=cloud-hosts.js.map
|
package/esm/node/remote/index.js
CHANGED
|
@@ -2,7 +2,8 @@ import { type CodingAgentOptions } from '@celljs/ai-coding-agent';
|
|
|
2
2
|
import { type TaExecOptions } from '../host-protocol.js';
|
|
3
3
|
import { PiDirectories } from './remote-protocol.js';
|
|
4
4
|
/**
|
|
5
|
-
* `<agent directory>/remote/ssh/<host>/<path>` for `ssh://<host>/<path
|
|
5
|
+
* `<agent directory>/remote/ssh/<host>/<path>` for `ssh://<host>/<path>`, `remote/ta/<name>/<path>` for a cloud
|
|
6
|
+
* workspace, `ta://<name>/<path>`. With `ta.exec.url` every
|
|
6
7
|
* directory is one of the machine of the exec server: `<agent directory>/remote/exec/<path>`.
|
|
7
8
|
*/
|
|
8
9
|
export declare class DefaultPiDirectories implements PiDirectories {
|
|
@@ -16,14 +16,16 @@ import { TaLocation } from '@celljs/ta-protocol';
|
|
|
16
16
|
import { TA_EXEC_OPTIONS } from '../host-protocol.js';
|
|
17
17
|
import { PiDirectories } from './remote-protocol.js';
|
|
18
18
|
/**
|
|
19
|
-
* `<agent directory>/remote/ssh/<host>/<path>` for `ssh://<host>/<path
|
|
19
|
+
* `<agent directory>/remote/ssh/<host>/<path>` for `ssh://<host>/<path>`, `remote/ta/<name>/<path>` for a cloud
|
|
20
|
+
* workspace, `ta://<name>/<path>`. With `ta.exec.url` every
|
|
20
21
|
* directory is one of the machine of the exec server: `<agent directory>/remote/exec/<path>`.
|
|
21
22
|
*/
|
|
22
23
|
let DefaultPiDirectories = class DefaultPiDirectories {
|
|
23
24
|
toPi(location) {
|
|
24
25
|
var _a;
|
|
25
26
|
const remote = TaLocation.parse(location);
|
|
26
|
-
const
|
|
27
|
+
const cloud = remote && TaLocation.cloudName(remote.host);
|
|
28
|
+
const prefix = cloud ? join('ta', cloud) : remote ? join('ssh', remote.host) : ((_a = this.execOptions) === null || _a === void 0 ? void 0 : _a.url) ? 'exec' : undefined;
|
|
27
29
|
if (!prefix) {
|
|
28
30
|
return location;
|
|
29
31
|
}
|
|
@@ -41,6 +43,9 @@ let DefaultPiDirectories = class DefaultPiDirectories {
|
|
|
41
43
|
if (kind === 'ssh' && rest.length > 0 && TaLocation.isHost(rest[0])) {
|
|
42
44
|
return TaLocation.ssh(rest[0], `/${rest.slice(1).join('/')}`);
|
|
43
45
|
}
|
|
46
|
+
if (kind === 'ta' && rest.length > 0 && TaLocation.isCloudName(rest[0])) {
|
|
47
|
+
return TaLocation.cloud(rest[0], `/${rest.slice(1).join('/')}`);
|
|
48
|
+
}
|
|
44
49
|
return kind === 'exec' ? `/${rest.join('/')}` : cwd;
|
|
45
50
|
}
|
|
46
51
|
root() {
|
|
@@ -4,6 +4,7 @@ import type { RpcConnection } from '@celljs/rpc/lib/node';
|
|
|
4
4
|
import { type ExecClient, SshHost, type SshQuestion } from '@celljs/ta-exec';
|
|
5
5
|
import { type TaRemoteEvent, type TaRemoteHost, type TaRemotePrompt } from '@celljs/ta-protocol';
|
|
6
6
|
import { TaWorkingDirectory } from '../working-directory.js';
|
|
7
|
+
import { CloudHosts } from './cloud-hosts.js';
|
|
7
8
|
import { RemoteHosts, type TaRemoteOptions } from './remote-protocol.js';
|
|
8
9
|
interface Waiting {
|
|
9
10
|
prompt: TaRemotePrompt;
|
|
@@ -21,9 +22,13 @@ export declare class DefaultRemoteHosts implements RemoteHosts, ApplicationLifec
|
|
|
21
22
|
protected readonly waiting: Map<string, Waiting>;
|
|
22
23
|
protected readonly watchers: Set<RpcConnection>;
|
|
23
24
|
protected readonly disconnectListeners: Set<(host: string) => void>;
|
|
25
|
+
protected readonly cloud: CloudHosts;
|
|
26
|
+
protected readonly watchedCloud: Set<string>;
|
|
24
27
|
client(host: string): ExecClient;
|
|
25
28
|
list(): TaRemoteHost[];
|
|
26
29
|
add(host: string): void;
|
|
30
|
+
/** Checked by connecting and asking where its home is; kept only then. */
|
|
31
|
+
addCloud(name: string, url: string, token: string): Promise<TaRemoteHost>;
|
|
27
32
|
remove(host: string): Promise<void>;
|
|
28
33
|
disconnect(host: string): Promise<void>;
|
|
29
34
|
onDisconnect(listener: (host: string) => void): () => void;
|
|
@@ -15,6 +15,7 @@ import { TaBrand } from '@celljs/ta-harness/lib/node/ta-brand';
|
|
|
15
15
|
import { TaClient, TaLocation } from '@celljs/ta-protocol';
|
|
16
16
|
import { TaErrors } from '../ta-errors.js';
|
|
17
17
|
import { TaWorkingDirectory } from '../working-directory.js';
|
|
18
|
+
import { CloudHosts, CloudHostsUtil } from './cloud-hosts.js';
|
|
18
19
|
import { RemoteHosts, TA_REMOTE_OPTIONS } from './remote-protocol.js';
|
|
19
20
|
/** A prompt nobody answers is cancelled after this: ssh gives up. */
|
|
20
21
|
const PROMPT_TIMEOUT_MS = 5 * 60 * 1000;
|
|
@@ -28,11 +29,25 @@ let DefaultRemoteHosts = class DefaultRemoteHosts {
|
|
|
28
29
|
this.waiting = new Map();
|
|
29
30
|
this.watchers = new Set();
|
|
30
31
|
this.disconnectListeners = new Set();
|
|
32
|
+
this.cloud = new CloudHosts(() => { var _a; var _b; return (_b = (_a = this.codingAgentOptions) === null || _a === void 0 ? void 0 : _a.agentDir) !== null && _b !== void 0 ? _b : TaBrand.agentDir(); });
|
|
33
|
+
this.watchedCloud = new Set();
|
|
31
34
|
}
|
|
32
35
|
client(host) {
|
|
33
36
|
var _a, _b, _c, _d;
|
|
34
37
|
var _e;
|
|
35
38
|
this.check(host);
|
|
39
|
+
const name = TaLocation.cloudName(host);
|
|
40
|
+
if (name) {
|
|
41
|
+
const client = this.cloud.client(name);
|
|
42
|
+
if (!client) {
|
|
43
|
+
throw TaErrors.invalidArgument(`There is no cloud workspace ${name}.`, 'Add it in Settings, Remote hosts, with the address of its gateway and a token.');
|
|
44
|
+
}
|
|
45
|
+
if (!this.watchedCloud.has(name)) {
|
|
46
|
+
this.watchedCloud.add(name);
|
|
47
|
+
client.onState((connected, error) => this.broadcast(error ? { type: 'connection', host, connected, error } : { type: 'connection', host, connected }));
|
|
48
|
+
}
|
|
49
|
+
return client;
|
|
50
|
+
}
|
|
36
51
|
let ssh = this.hosts.get(host);
|
|
37
52
|
if (!ssh) {
|
|
38
53
|
ssh = new SshHost({
|
|
@@ -58,18 +73,68 @@ let DefaultRemoteHosts = class DefaultRemoteHosts {
|
|
|
58
73
|
const recent = this.workingDirectory.recentHosts();
|
|
59
74
|
const config = SshConfig.hosts().filter(host => TaLocation.isHost(host) && !recent.includes(host));
|
|
60
75
|
return [
|
|
76
|
+
...this.cloud
|
|
77
|
+
.list()
|
|
78
|
+
.map(host => ({ host: TaLocation.cloud(host.name), source: 'cloud', url: host.url, connected: this.cloud.connected(host.name) })),
|
|
61
79
|
...recent.map(host => ({ host, source: 'recent', connected: this.connected(host) })),
|
|
62
80
|
...config.map(host => ({ host, source: 'config', connected: this.connected(host) })),
|
|
63
81
|
];
|
|
64
82
|
}
|
|
65
83
|
add(host) {
|
|
84
|
+
if (TaLocation.isCloud(host)) {
|
|
85
|
+
throw TaErrors.invalidArgument('A cloud workspace is added with its address and token.', 'Call addCloudHost.');
|
|
86
|
+
}
|
|
66
87
|
this.workingDirectory.addRecentHost(this.check(host));
|
|
67
88
|
}
|
|
89
|
+
/** Checked by connecting and asking where its home is; kept only then. */
|
|
90
|
+
async addCloud(name, url, token) {
|
|
91
|
+
if (typeof name !== 'string' || !TaLocation.isCloudName(name)) {
|
|
92
|
+
throw TaErrors.invalidArgument(`${JSON.stringify(name)} cannot name a cloud workspace.`, 'Use lower-case letters, digits and -, 40 at most.');
|
|
93
|
+
}
|
|
94
|
+
let address;
|
|
95
|
+
try {
|
|
96
|
+
address = CloudHostsUtil.url(String(url !== null && url !== void 0 ? url : ''));
|
|
97
|
+
}
|
|
98
|
+
catch (error) {
|
|
99
|
+
throw TaErrors.invalidArgument(error.message, 'Write the address of the Ta gateway, as its page is opened.');
|
|
100
|
+
}
|
|
101
|
+
if (typeof token !== 'string' || !token.trim()) {
|
|
102
|
+
throw TaErrors.invalidArgument('A cloud workspace is reached with a token.', 'Make one on the gateway: Settings, Environment, Use it from another Ta.');
|
|
103
|
+
}
|
|
104
|
+
const probe = CloudHosts.connect({ url: address, token: token.trim() });
|
|
105
|
+
try {
|
|
106
|
+
await probe.info();
|
|
107
|
+
}
|
|
108
|
+
catch (error) {
|
|
109
|
+
throw TaErrors.invalidArgument(`${address} did not let Ta in: ${error.message}`, 'Check the address and the token; a token signed out on the gateway no longer works.');
|
|
110
|
+
}
|
|
111
|
+
finally {
|
|
112
|
+
probe.close();
|
|
113
|
+
}
|
|
114
|
+
await this.disconnect(TaLocation.cloud(name));
|
|
115
|
+
this.cloud.save({ name, url: address, token: token.trim(), addedAt: Date.now() });
|
|
116
|
+
return { host: TaLocation.cloud(name), source: 'cloud', url: address, connected: false };
|
|
117
|
+
}
|
|
68
118
|
async remove(host) {
|
|
69
119
|
await this.disconnect(host);
|
|
120
|
+
const name = TaLocation.cloudName(host);
|
|
121
|
+
if (name) {
|
|
122
|
+
this.cloud.remove(name);
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
70
125
|
this.workingDirectory.removeRecentHost(host);
|
|
71
126
|
}
|
|
72
127
|
async disconnect(host) {
|
|
128
|
+
const name = TaLocation.cloudName(host);
|
|
129
|
+
if (name) {
|
|
130
|
+
const client = this.cloud.drop(name);
|
|
131
|
+
this.watchedCloud.delete(name);
|
|
132
|
+
for (const listener of this.disconnectListeners) {
|
|
133
|
+
listener(host);
|
|
134
|
+
}
|
|
135
|
+
client === null || client === void 0 ? void 0 : client.close();
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
73
138
|
const ssh = this.hosts.get(host);
|
|
74
139
|
this.hosts.delete(host);
|
|
75
140
|
for (const listener of this.disconnectListeners) {
|
|
@@ -97,7 +162,7 @@ let DefaultRemoteHosts = class DefaultRemoteHosts {
|
|
|
97
162
|
for (const waiting of [...this.waiting.values()]) {
|
|
98
163
|
waiting.settle(undefined);
|
|
99
164
|
}
|
|
100
|
-
await Promise.all([...this.hosts.keys()].map(host => this.disconnect(host)));
|
|
165
|
+
await Promise.all([...this.hosts.keys(), ...[...this.watchedCloud].map(name => TaLocation.cloud(name))].map(host => this.disconnect(host)));
|
|
101
166
|
}
|
|
102
167
|
ask(host, question) {
|
|
103
168
|
const prompt = { promptId: randomUUID(), host, ...question };
|
|
@@ -126,13 +191,17 @@ let DefaultRemoteHosts = class DefaultRemoteHosts {
|
|
|
126
191
|
}
|
|
127
192
|
check(host) {
|
|
128
193
|
if (typeof host !== 'string' || !TaLocation.isHost(host)) {
|
|
129
|
-
throw TaErrors.invalidArgument(`${JSON.stringify(host)} is not a host.`, 'Name a Host of ~/.ssh/config,
|
|
194
|
+
throw TaErrors.invalidArgument(`${JSON.stringify(host)} is not a host.`, 'Name a Host of ~/.ssh/config, [user@]host[:port], or ta://<name> of a cloud workspace.');
|
|
130
195
|
}
|
|
131
196
|
return host;
|
|
132
197
|
}
|
|
133
198
|
connected(host) {
|
|
134
199
|
var _a;
|
|
135
200
|
var _b;
|
|
201
|
+
const name = TaLocation.cloudName(host);
|
|
202
|
+
if (name) {
|
|
203
|
+
return this.cloud.connected(name);
|
|
204
|
+
}
|
|
136
205
|
return (_b = (_a = this.hosts.get(host)) === null || _a === void 0 ? void 0 : _a.client.connected) !== null && _b !== void 0 ? _b : false;
|
|
137
206
|
}
|
|
138
207
|
};
|
|
@@ -21,6 +21,8 @@ export interface RemoteHosts {
|
|
|
21
21
|
list(): TaRemoteHost[];
|
|
22
22
|
/** Keeps a host in the list without connecting; throws for what is not a host. */
|
|
23
23
|
add(host: string): void;
|
|
24
|
+
/** A cloud workspace, `ta://<name>`, kept once a connection to it worked. */
|
|
25
|
+
addCloud(name: string, url: string, token: string): Promise<TaRemoteHost>;
|
|
24
26
|
/** Disconnects and drops it from the list of those opened before. */
|
|
25
27
|
remove(host: string): Promise<void>;
|
|
26
28
|
disconnect(host: string): Promise<void>;
|
|
@@ -8,6 +8,7 @@ export declare class TaRemoteServerImpl implements TaRemoteServer {
|
|
|
8
8
|
protected readonly environments: ExecEnvironmentFactory;
|
|
9
9
|
listHosts(): Promise<TaRemoteHost[]>;
|
|
10
10
|
addHost(host: string): Promise<void>;
|
|
11
|
+
addCloudHost(name: string, url: string, token: string): Promise<TaRemoteHost>;
|
|
11
12
|
removeHost(host: string): Promise<void>;
|
|
12
13
|
resolveLocation(location: string): Promise<string>;
|
|
13
14
|
forwardPort(port: number, cwd?: string): Promise<TaForwardedPort>;
|
|
@@ -22,6 +22,9 @@ let TaRemoteServerImpl = class TaRemoteServerImpl {
|
|
|
22
22
|
addHost(host) {
|
|
23
23
|
return TaErrors.guard(() => this.hosts.add(host));
|
|
24
24
|
}
|
|
25
|
+
addCloudHost(name, url, token) {
|
|
26
|
+
return TaErrors.guard(() => this.hosts.addCloud(name, url, token));
|
|
27
|
+
}
|
|
25
28
|
removeHost(host) {
|
|
26
29
|
return TaErrors.guard(() => this.hosts.remove(host));
|
|
27
30
|
}
|
|
@@ -53,6 +53,9 @@ export declare class TaRoomServerImpl implements TaRoomServer {
|
|
|
53
53
|
listRequests(): Promise<TaRoomRequest[]>;
|
|
54
54
|
answer(room: string, ask: string, accept: boolean): Promise<void>;
|
|
55
55
|
removeMember(room: string, member: string): Promise<void>;
|
|
56
|
+
configureRoom(room: string, options: {
|
|
57
|
+
members?: number;
|
|
58
|
+
}): Promise<TaRoomInfo>;
|
|
56
59
|
leave(room: string): Promise<void>;
|
|
57
60
|
send(room: string, data: unknown, to?: string): Promise<void>;
|
|
58
61
|
getState(room: string, prefix?: string): Promise<Record<string, TaRoomValue>>;
|
package/esm/node/rooms-bridge.js
CHANGED
|
@@ -32,6 +32,7 @@ let RoomsBridge = RoomsBridge_1 = class RoomsBridge {
|
|
|
32
32
|
listRooms: async () => this.hubs.list(),
|
|
33
33
|
createRoom: input => this.hubs.create(input),
|
|
34
34
|
invite: (room, options) => this.hubs.invite(room, options !== null && options !== void 0 ? options : {}),
|
|
35
|
+
configureRoom: async (room, options) => this.hubs.configure(room, options !== null && options !== void 0 ? options : {}),
|
|
35
36
|
join: link => this.hubs.join(link),
|
|
36
37
|
listRequests: () => this.hubs.requests(),
|
|
37
38
|
answer: (room, ask, accept) => this.hubs.answer(room, ask, accept),
|
|
@@ -149,6 +150,9 @@ let TaRoomServerImpl = class TaRoomServerImpl {
|
|
|
149
150
|
removeMember(room, member) {
|
|
150
151
|
return TaErrors.guard(() => this.rooms.removeMember(room, member));
|
|
151
152
|
}
|
|
153
|
+
configureRoom(room, options) {
|
|
154
|
+
return TaErrors.guard(() => this.rooms.configureRoom(room, { members: options === null || options === void 0 ? void 0 : options.members }));
|
|
155
|
+
}
|
|
152
156
|
leave(room) {
|
|
153
157
|
return TaErrors.guard(() => this.rooms.leave(room));
|
|
154
158
|
}
|
|
@@ -15,7 +15,9 @@ export declare namespace SessionInfoUtil {
|
|
|
15
15
|
* The text of the last message of the user or the agent that has some, on one line and cut to a preview's
|
|
16
16
|
* length, as a messaging app shows the last thing said under its name: without its context, the marks of
|
|
17
17
|
* markdown at the start of its lines, and the thinking and tool calls of the agent; a skill the user ran is
|
|
18
|
-
* `/skill:name` and what follows, as the title says it, not the skill's file.
|
|
18
|
+
* `/skill:name` and what follows, as the title says it, not the skill's file. A note of the double's tasks
|
|
19
|
+
* (TaTaskNote) says the task: how one ended is its title and what it said, one handed to the double its title,
|
|
20
|
+
* and a note of a new id, for the double only, is passed over.
|
|
19
21
|
*/
|
|
20
22
|
function lastMessage(messages: readonly MessageLike[]): string | undefined;
|
|
21
23
|
/** The time of the last message that has one, else `fallback`. */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TaAgentSummary, TaImageNote, TaMessageContext, TaSkillUse } from '@celljs/ta-protocol';
|
|
1
|
+
import { TaAgentSummary, TaImageNote, TaMessageContext, TaSkillUse, TaTaskNote } from '@celljs/ta-protocol';
|
|
2
2
|
/** What a list of conversations shows of one: its first message, as pi's session list does, and when it last changed. */
|
|
3
3
|
export var SessionInfoUtil;
|
|
4
4
|
(function (SessionInfoUtil) {
|
|
@@ -10,11 +10,12 @@ export var SessionInfoUtil;
|
|
|
10
10
|
* a skill the user ran is `/skill:name` and what follows, not the skill's file.
|
|
11
11
|
*/
|
|
12
12
|
function firstMessage(messages) {
|
|
13
|
+
var _a;
|
|
13
14
|
for (const message of messages) {
|
|
14
15
|
if (message.role !== 'user') {
|
|
15
16
|
continue;
|
|
16
17
|
}
|
|
17
|
-
const line = userWords(text(message.content))
|
|
18
|
+
const line = ((_a = noteWords(userWords(text(message.content)))) !== null && _a !== void 0 ? _a : '')
|
|
18
19
|
.split('\n')
|
|
19
20
|
.map(part => part.trim())
|
|
20
21
|
.find(Boolean);
|
|
@@ -29,7 +30,9 @@ export var SessionInfoUtil;
|
|
|
29
30
|
* The text of the last message of the user or the agent that has some, on one line and cut to a preview's
|
|
30
31
|
* length, as a messaging app shows the last thing said under its name: without its context, the marks of
|
|
31
32
|
* markdown at the start of its lines, and the thinking and tool calls of the agent; a skill the user ran is
|
|
32
|
-
* `/skill:name` and what follows, as the title says it, not the skill's file.
|
|
33
|
+
* `/skill:name` and what follows, as the title says it, not the skill's file. A note of the double's tasks
|
|
34
|
+
* (TaTaskNote) says the task: how one ended is its title and what it said, one handed to the double its title,
|
|
35
|
+
* and a note of a new id, for the double only, is passed over.
|
|
33
36
|
*/
|
|
34
37
|
function lastMessage(messages) {
|
|
35
38
|
for (let i = messages.length - 1; i >= 0; i--) {
|
|
@@ -37,14 +40,17 @@ export var SessionInfoUtil;
|
|
|
37
40
|
if (message.role !== 'user' && message.role !== 'assistant') {
|
|
38
41
|
continue;
|
|
39
42
|
}
|
|
40
|
-
const said = message.role === 'user' ? userWords(text(message.content)) : TaAgentSummary.strip(text(message.content));
|
|
43
|
+
const said = message.role === 'user' ? noteWords(userWords(text(message.content))) : TaAgentSummary.strip(text(message.content));
|
|
44
|
+
if (said === undefined) {
|
|
45
|
+
continue;
|
|
46
|
+
}
|
|
41
47
|
// A list asks for it every few seconds: only the start of a long reply is read, enough for a preview.
|
|
42
48
|
const read = said.slice(0, PREVIEW_READ);
|
|
43
|
-
const line = (withoutFences(read) || read)
|
|
49
|
+
const line = plain(withoutFences(read) || read)
|
|
44
50
|
.split('\n')
|
|
45
51
|
.map(part => part
|
|
46
52
|
.replace(/^\s*(?:#{1,6}\s+|>\s*|[-*+]\s+|\d+\.\s+)/, '')
|
|
47
|
-
.replace(/[
|
|
53
|
+
.replace(/[*`]{1,3}|(?<![\p{L}\p{N}])_{1,3}|_{1,3}(?![\p{L}\p{N}])/gu, '')
|
|
48
54
|
.trim())
|
|
49
55
|
.filter(Boolean)
|
|
50
56
|
.join(' ')
|
|
@@ -78,12 +84,32 @@ export var SessionInfoUtil;
|
|
|
78
84
|
}
|
|
79
85
|
return kept.join('\n').trim();
|
|
80
86
|
}
|
|
87
|
+
/**
|
|
88
|
+
* Markdown's pictures and links as a messenger says them: a link by its words, pictures left out of a message that
|
|
89
|
+
* says something else, and by the words that name them in one of pictures only.
|
|
90
|
+
*/
|
|
91
|
+
function plain(text) {
|
|
92
|
+
const linked = text.replace(/(?<!!)\[([^\]\n]*)\]\([^)\n]*\)/g, '$1');
|
|
93
|
+
const words = linked.replace(/!\[[^\]\n]*\]\([^)\n]*\)/g, '').trim();
|
|
94
|
+
return words || linked.replace(/!\[([^\]\n]*)\]\([^)\n]*\)/g, '$1');
|
|
95
|
+
}
|
|
81
96
|
/** What the user typed of a message: without its context and pi's notes of images, a skill as `/skill:name` and what follows. */
|
|
82
97
|
function userWords(content) {
|
|
83
98
|
const said = TaImageNote.strip(TaMessageContext.strip(content));
|
|
84
99
|
const skill = TaSkillUse.parse(said);
|
|
85
100
|
return skill ? TaSkillUse.command(skill) : said;
|
|
86
101
|
}
|
|
102
|
+
/** 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. */
|
|
103
|
+
function noteWords(said) {
|
|
104
|
+
const note = TaTaskNote.parse(said);
|
|
105
|
+
if (!note) {
|
|
106
|
+
return said;
|
|
107
|
+
}
|
|
108
|
+
if (note.kind === 'renamed') {
|
|
109
|
+
return undefined;
|
|
110
|
+
}
|
|
111
|
+
return note.kind === 'update' && note.body.trim() ? `${note.title} · ${note.body}` : note.title;
|
|
112
|
+
}
|
|
87
113
|
/** The time of the last message that has one, else `fallback`. */
|
|
88
114
|
function updatedAt(messages, fallback) {
|
|
89
115
|
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.js';
|
|
3
4
|
import { TaSessionCatalog, TaSessionFactory, TaSessionRegistry } from './host-protocol.js';
|
|
4
5
|
import { TaServeUpdates } from './serve-updates.js';
|
|
5
6
|
import type { TaSession } from './ta-session.js';
|
|
@@ -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'>>;
|
|
@@ -16,6 +16,7 @@ import { RpcContext } from '@celljs/rpc/lib/node';
|
|
|
16
16
|
import { ExecEnvironmentFactory } from '@celljs/ta-exec';
|
|
17
17
|
import { TaServeRestart } from '@celljs/ta-harness/lib/node/serve-restart';
|
|
18
18
|
import { TA_OWNER, TaMessageAuthor, TaServer, } from '@celljs/ta-protocol';
|
|
19
|
+
import { TaDirectoryRelocator } from './directory-relocator.js';
|
|
19
20
|
import { TaSessionCatalog, TaSessionFactory, TaSessionRegistry } from './host-protocol.js';
|
|
20
21
|
import { TaServeUpdates } from './serve-updates.js';
|
|
21
22
|
import { SessionInfoUtil } from './session-info-util.js';
|
|
@@ -315,6 +316,23 @@ let TaServerImpl = class TaServerImpl {
|
|
|
315
316
|
return { sessionFile, text };
|
|
316
317
|
});
|
|
317
318
|
}
|
|
319
|
+
forkHere(sessionId) {
|
|
320
|
+
return this.on(sessionId, async ({ pi }) => {
|
|
321
|
+
var _a;
|
|
322
|
+
var _b;
|
|
323
|
+
const file = pi.sessionManager.getSessionFile();
|
|
324
|
+
if (!file || !existsSync(file)) {
|
|
325
|
+
return {};
|
|
326
|
+
}
|
|
327
|
+
const sdk = await PiSdkUtil.load();
|
|
328
|
+
const sessionFile = sdk.SessionManager.forkFrom(file, pi.sessionManager.getCwd()).getSessionFile();
|
|
329
|
+
this.runs.created(sessionFile, (_b = (_a = this.sessions.locate(sessionId)) === null || _a === void 0 ? void 0 : _a.cwd) !== null && _b !== void 0 ? _b : '');
|
|
330
|
+
return { sessionFile };
|
|
331
|
+
});
|
|
332
|
+
}
|
|
333
|
+
relocateDirectory(from, to) {
|
|
334
|
+
return this.guard(() => this.relocator.relocate(from, to));
|
|
335
|
+
}
|
|
318
336
|
clone(sessionId) {
|
|
319
337
|
return this.authored(sessionId, async ({ pi, runtime }) => {
|
|
320
338
|
const leafId = pi.sessionManager.getLeafId();
|
|
@@ -435,6 +453,10 @@ __decorate([
|
|
|
435
453
|
Autowired(TaServeUpdates),
|
|
436
454
|
__metadata("design:type", Object)
|
|
437
455
|
], TaServerImpl.prototype, "updates", void 0);
|
|
456
|
+
__decorate([
|
|
457
|
+
Autowired(TaDirectoryRelocator),
|
|
458
|
+
__metadata("design:type", Object)
|
|
459
|
+
], TaServerImpl.prototype, "relocator", void 0);
|
|
438
460
|
TaServerImpl = __decorate([
|
|
439
461
|
Rpc(TaServer)
|
|
440
462
|
], TaServerImpl);
|