@celljs/ta-host 4.12.0 → 4.13.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/README.en.md +3 -2
- package/README.md +3 -2
- package/esm/node/extension-data-notifier.d.ts +3 -0
- package/esm/node/extension-data-notifier.js +8 -2
- package/esm/node/extension-providers.js +1 -1
- package/esm/node/host-protocol.d.ts +20 -1
- package/esm/node/host-protocol.js +1 -0
- package/esm/node/index.d.ts +3 -0
- package/esm/node/index.js +3 -0
- package/esm/node/keep-awake.d.ts +44 -0
- package/esm/node/keep-awake.js +112 -0
- package/esm/node/package-host-extension.js +2 -0
- package/esm/node/package-hosts.d.ts +23 -1
- package/esm/node/package-hosts.js +61 -3
- package/esm/node/relay-bridge.d.ts +37 -3
- package/esm/node/relay-bridge.js +271 -10
- package/esm/node/rooms-bridge.d.ts +13 -2
- package/esm/node/rooms-bridge.js +34 -4
- package/esm/node/session-catalog.d.ts +1 -1
- package/esm/node/session-catalog.js +5 -0
- package/esm/node/session-list-feed.d.ts +11 -1
- package/esm/node/session-list-feed.js +17 -3
- package/esm/node/session-resume.d.ts +52 -0
- package/esm/node/session-resume.js +174 -0
- package/esm/node/settings-store.d.ts +3 -0
- package/esm/node/settings-store.js +22 -0
- package/esm/node/ta-errors.d.ts +1 -0
- package/esm/node/ta-errors.js +4 -0
- package/esm/node/ta-server-impl.d.ts +9 -0
- package/esm/node/ta-server-impl.js +52 -7
- package/esm/node/ta-session-factory.js +5 -2
- package/esm/node/ta-session-registry.d.ts +12 -1
- package/esm/node/ta-session-registry.js +30 -1
- package/esm/node/ta-session.d.ts +3 -0
- package/esm/node/ta-session.js +16 -0
- package/esm/node/team/authority.d.ts +19 -0
- package/esm/node/team/authority.js +79 -0
- package/esm/node/team/call-util.d.ts +23 -0
- package/esm/node/team/call-util.js +88 -0
- package/esm/node/team/connections.d.ts +15 -0
- package/esm/node/team/connections.js +81 -0
- package/esm/node/team/host-team.d.ts +13 -0
- package/esm/node/team/host-team.js +69 -0
- package/esm/node/team/index.d.ts +13 -0
- package/esm/node/team/index.js +14 -0
- package/esm/node/team/member-devices.d.ts +11 -0
- package/esm/node/team/member-devices.js +56 -0
- package/esm/node/team/package-permissions.d.ts +23 -0
- package/esm/node/team/package-permissions.js +75 -0
- package/esm/node/team/principals.d.ts +22 -0
- package/esm/node/team/principals.js +72 -0
- package/esm/node/team/run-actors.d.ts +21 -0
- package/esm/node/team/run-actors.js +100 -0
- package/esm/node/team/shared-data.d.ts +18 -0
- package/esm/node/team/shared-data.js +55 -0
- package/esm/node/team/team-calls.d.ts +33 -0
- package/esm/node/team/team-calls.js +266 -0
- package/esm/node/team/team-gate.d.ts +31 -0
- package/esm/node/team/team-gate.js +177 -0
- package/esm/node/team/team-protocol.d.ts +89 -0
- package/esm/node/team/team-protocol.js +27 -0
- package/esm/node/team/visibility.d.ts +13 -0
- package/esm/node/team/visibility.js +50 -0
- package/esm/node/terminal-service.d.ts +5 -0
- package/esm/node/terminal-service.js +11 -2
- package/lib/node/extension-data-notifier.d.ts +3 -0
- package/lib/node/extension-data-notifier.js +8 -2
- package/lib/node/extension-providers.js +1 -1
- package/lib/node/host-protocol.d.ts +20 -1
- package/lib/node/host-protocol.js +2 -1
- package/lib/node/index.d.ts +3 -0
- package/lib/node/index.js +3 -0
- package/lib/node/keep-awake.d.ts +45 -0
- package/lib/node/keep-awake.js +115 -0
- package/lib/node/package-host-extension.js +2 -0
- package/lib/node/package-hosts.d.ts +23 -1
- package/lib/node/package-hosts.js +60 -2
- package/lib/node/relay-bridge.d.ts +37 -3
- package/lib/node/relay-bridge.js +269 -8
- package/lib/node/rooms-bridge.d.ts +13 -2
- package/lib/node/rooms-bridge.js +34 -4
- package/lib/node/session-catalog.d.ts +1 -1
- package/lib/node/session-catalog.js +5 -0
- package/lib/node/session-list-feed.d.ts +11 -1
- package/lib/node/session-list-feed.js +17 -3
- package/lib/node/session-resume.d.ts +53 -0
- package/lib/node/session-resume.js +177 -0
- package/lib/node/settings-store.d.ts +3 -0
- package/lib/node/settings-store.js +22 -0
- package/lib/node/ta-errors.d.ts +1 -0
- package/lib/node/ta-errors.js +4 -0
- package/lib/node/ta-server-impl.d.ts +9 -0
- package/lib/node/ta-server-impl.js +52 -7
- package/lib/node/ta-session-factory.js +4 -1
- package/lib/node/ta-session-registry.d.ts +12 -1
- package/lib/node/ta-session-registry.js +30 -1
- package/lib/node/ta-session.d.ts +3 -0
- package/lib/node/ta-session.js +16 -0
- package/lib/node/team/authority.d.ts +20 -0
- package/lib/node/team/authority.js +82 -0
- package/lib/node/team/call-util.d.ts +24 -0
- package/lib/node/team/call-util.js +91 -0
- package/lib/node/team/connections.d.ts +16 -0
- package/lib/node/team/connections.js +84 -0
- package/lib/node/team/host-team.d.ts +14 -0
- package/lib/node/team/host-team.js +72 -0
- package/lib/node/team/index.d.ts +14 -0
- package/lib/node/team/index.js +30 -0
- package/lib/node/team/member-devices.d.ts +12 -0
- package/lib/node/team/member-devices.js +59 -0
- package/lib/node/team/package-permissions.d.ts +24 -0
- package/lib/node/team/package-permissions.js +78 -0
- package/lib/node/team/principals.d.ts +23 -0
- package/lib/node/team/principals.js +75 -0
- package/lib/node/team/run-actors.d.ts +22 -0
- package/lib/node/team/run-actors.js +103 -0
- package/lib/node/team/shared-data.d.ts +19 -0
- package/lib/node/team/shared-data.js +58 -0
- package/lib/node/team/team-calls.d.ts +34 -0
- package/lib/node/team/team-calls.js +270 -0
- package/lib/node/team/team-gate.d.ts +32 -0
- package/lib/node/team/team-gate.js +180 -0
- package/lib/node/team/team-protocol.d.ts +90 -0
- package/lib/node/team/team-protocol.js +30 -0
- package/lib/node/team/visibility.d.ts +14 -0
- package/lib/node/team/visibility.js +53 -0
- package/lib/node/terminal-service.d.ts +5 -0
- package/lib/node/terminal-service.js +11 -2
- package/package.json +14 -10
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.DefaultTaVisibility = void 0;
|
|
13
|
+
const core_1 = require("@celljs/core");
|
|
14
|
+
const ta_protocol_1 = require("@celljs/ta-protocol");
|
|
15
|
+
const shared_data_1 = require("./shared-data");
|
|
16
|
+
const team_protocol_1 = require("./team-protocol");
|
|
17
|
+
/** What each connection sees of what is pushed: conversations it may view; data of its own, or of the Ta's it may read. */
|
|
18
|
+
let DefaultTaVisibility = class DefaultTaVisibility {
|
|
19
|
+
sessions(connection, list) {
|
|
20
|
+
const principal = connection ? this.principals.of(connection) : ta_protocol_1.TA_OWNER;
|
|
21
|
+
return principal === ta_protocol_1.TA_OWNER
|
|
22
|
+
? list
|
|
23
|
+
: list.filter(item => { var _a; return this.authority.check(principal, 'chat.view', { kind: 'session', id: (_a = item.sessionFile) !== null && _a !== void 0 ? _a : '', cwd: item.cwd }) === true; });
|
|
24
|
+
}
|
|
25
|
+
dataName(connection, name, key) {
|
|
26
|
+
const principal = this.principals.of(connection);
|
|
27
|
+
const theirs = shared_data_1.MemberDataUtil.of(name);
|
|
28
|
+
if (principal === ta_protocol_1.TA_OWNER) {
|
|
29
|
+
return theirs ? undefined : name;
|
|
30
|
+
}
|
|
31
|
+
if (theirs) {
|
|
32
|
+
return theirs.principal === principal ? theirs.name : undefined;
|
|
33
|
+
}
|
|
34
|
+
return this.shared.of(name, key) ? name : undefined;
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
exports.DefaultTaVisibility = DefaultTaVisibility;
|
|
38
|
+
__decorate([
|
|
39
|
+
(0, core_1.Autowired)(team_protocol_1.TaPrincipals),
|
|
40
|
+
__metadata("design:type", Object)
|
|
41
|
+
], DefaultTaVisibility.prototype, "principals", void 0);
|
|
42
|
+
__decorate([
|
|
43
|
+
(0, core_1.Autowired)(team_protocol_1.TaAuthority),
|
|
44
|
+
__metadata("design:type", Object)
|
|
45
|
+
], DefaultTaVisibility.prototype, "authority", void 0);
|
|
46
|
+
__decorate([
|
|
47
|
+
(0, core_1.Autowired)(team_protocol_1.TaSharedDataRegistry),
|
|
48
|
+
__metadata("design:type", Object)
|
|
49
|
+
], DefaultTaVisibility.prototype, "shared", void 0);
|
|
50
|
+
exports.DefaultTaVisibility = DefaultTaVisibility = __decorate([
|
|
51
|
+
(0, core_1.Component)(team_protocol_1.TaVisibility)
|
|
52
|
+
], DefaultTaVisibility);
|
|
53
|
+
//# sourceMappingURL=visibility.js.map
|
|
@@ -2,6 +2,7 @@ import { type Application, ApplicationLifecycle } from '@celljs/core';
|
|
|
2
2
|
import type { RpcConnection } from '@celljs/rpc/lib/node';
|
|
3
3
|
import { type ExecEnvironment, ExecEnvironmentFactory, type ExecProcess } from '@celljs/ta-exec';
|
|
4
4
|
import { type TaOpenTerminalOptions, type TaTerminalInfo } from '@celljs/ta-protocol';
|
|
5
|
+
import { TaPrincipals } from './team/team-protocol';
|
|
5
6
|
import { TaTerminals } from './terminal-protocol';
|
|
6
7
|
import { PipeDiscipline, type TerminalPlatform, TtyMarker } from './terminal-util';
|
|
7
8
|
/** How long a shell waits for a connection after its own dropped. */
|
|
@@ -12,6 +13,8 @@ declare class Terminal {
|
|
|
12
13
|
readonly platform: TerminalPlatform;
|
|
13
14
|
readonly process: ExecProcess;
|
|
14
15
|
owner?: RpcConnection;
|
|
16
|
+
/** Who opened it (TaTerminals.whoOf): only a connection of the same takes it once its own dropped. */
|
|
17
|
+
principal: string;
|
|
15
18
|
orphanTimer?: ReturnType<typeof setTimeout>;
|
|
16
19
|
pending: string;
|
|
17
20
|
/** The last output, for a page that takes the shell again after its own went (a reload). */
|
|
@@ -41,6 +44,8 @@ export declare class DefaultTaTerminals implements TaTerminals, ApplicationLifec
|
|
|
41
44
|
/** By machine: `''` for this one (or the exec server), else the host of `ssh://`. */
|
|
42
45
|
protected readonly platforms: Map<string, Promise<TerminalPlatform>>;
|
|
43
46
|
protected nextId: number;
|
|
47
|
+
/** Who makes the calls of a connection: one let in takes no shell of the user's (docs/design/ta-team.md). */
|
|
48
|
+
protected readonly principals: TaPrincipals;
|
|
44
49
|
open(connection: RpcConnection, options: TaOpenTerminalOptions & {
|
|
45
50
|
cwd: string;
|
|
46
51
|
}): Promise<TaTerminalInfo>;
|
|
@@ -14,6 +14,7 @@ const core_1 = require("@celljs/core");
|
|
|
14
14
|
const ta_exec_1 = require("@celljs/ta-exec");
|
|
15
15
|
const ta_protocol_1 = require("@celljs/ta-protocol");
|
|
16
16
|
const ta_errors_1 = require("./ta-errors");
|
|
17
|
+
const team_protocol_1 = require("./team/team-protocol");
|
|
17
18
|
const terminal_protocol_1 = require("./terminal-protocol");
|
|
18
19
|
const terminal_util_1 = require("./terminal-util");
|
|
19
20
|
/** How long a shell waits for a connection after its own dropped. */
|
|
@@ -30,6 +31,8 @@ class Terminal {
|
|
|
30
31
|
this.env = env;
|
|
31
32
|
this.platform = platform;
|
|
32
33
|
this.process = process;
|
|
34
|
+
/** Who opened it (TaTerminals.whoOf): only a connection of the same takes it once its own dropped. */
|
|
35
|
+
this.principal = 'owner';
|
|
33
36
|
this.pending = '';
|
|
34
37
|
/** The last output, for a page that takes the shell again after its own went (a reload). */
|
|
35
38
|
this.history = '';
|
|
@@ -63,6 +66,7 @@ let DefaultTaTerminals = class DefaultTaTerminals {
|
|
|
63
66
|
// `pty`: false when the shell runs on pipes, so that the view can say why some programs behave otherwise.
|
|
64
67
|
const info = { terminalId: `t${++this.nextId}`, cwd: options.cwd, shell: platform.shell, pty: launch.pty };
|
|
65
68
|
const terminal = new Terminal(info, env, platform, env.spawn(launch.command, launch.args), launch.pty, connection);
|
|
69
|
+
terminal.principal = this.principals.of(connection);
|
|
66
70
|
this.terminals.set(info.terminalId, terminal);
|
|
67
71
|
this.watch(connection);
|
|
68
72
|
const receive = (data) => this.output(terminal, terminal.decoder.decode(data, { stream: true }));
|
|
@@ -100,8 +104,9 @@ let DefaultTaTerminals = class DefaultTaTerminals {
|
|
|
100
104
|
}
|
|
101
105
|
list(connection) {
|
|
102
106
|
const own = [];
|
|
107
|
+
const who = this.principals.of(connection);
|
|
103
108
|
for (const terminal of this.terminals.values()) {
|
|
104
|
-
if (!terminal.owner) {
|
|
109
|
+
if (!terminal.owner && terminal.principal === who) {
|
|
105
110
|
this.adopt(terminal, connection);
|
|
106
111
|
}
|
|
107
112
|
if (terminal.owner === connection) {
|
|
@@ -119,7 +124,7 @@ let DefaultTaTerminals = class DefaultTaTerminals {
|
|
|
119
124
|
/** The shell of this connection, or one nobody has: it becomes this connection's. */
|
|
120
125
|
require(connection, terminalId) {
|
|
121
126
|
const terminal = this.terminals.get(terminalId);
|
|
122
|
-
if (!terminal || (terminal.owner && terminal.owner !== connection)) {
|
|
127
|
+
if (!terminal || (terminal.owner && terminal.owner !== connection) || (!terminal.owner && terminal.principal !== this.principals.of(connection))) {
|
|
123
128
|
throw ta_errors_1.TaErrors.invalidArgument(`No terminal of this connection has the id ${terminalId}.`, 'Open one with openTerminal; listTerminals has those still open.');
|
|
124
129
|
}
|
|
125
130
|
if (!terminal.owner) {
|
|
@@ -271,6 +276,10 @@ __decorate([
|
|
|
271
276
|
(0, core_1.Autowired)(ta_exec_1.ExecEnvironmentFactory),
|
|
272
277
|
__metadata("design:type", Object)
|
|
273
278
|
], DefaultTaTerminals.prototype, "environments", void 0);
|
|
279
|
+
__decorate([
|
|
280
|
+
(0, core_1.Autowired)({ id: team_protocol_1.TaPrincipals, detached: true }),
|
|
281
|
+
__metadata("design:type", Object)
|
|
282
|
+
], DefaultTaTerminals.prototype, "principals", void 0);
|
|
274
283
|
exports.DefaultTaTerminals = DefaultTaTerminals = __decorate([
|
|
275
284
|
(0, core_1.Component)([terminal_protocol_1.TaTerminals, core_1.ApplicationLifecycle])
|
|
276
285
|
], DefaultTaTerminals);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@celljs/ta-host",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.13.0",
|
|
4
4
|
"description": "ta serve: pi sessions for many clients over WebSocket",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cell-component"
|
|
@@ -34,15 +34,15 @@
|
|
|
34
34
|
"watch": "tsc -b -w --preserveWatchOutput"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@celljs/ai-agent": "4.
|
|
38
|
-
"@celljs/ai-coding-agent": "4.
|
|
39
|
-
"@celljs/core": "4.
|
|
40
|
-
"@celljs/rpc": "4.
|
|
41
|
-
"@celljs/ta-exec": "4.
|
|
42
|
-
"@celljs/ta-harness": "4.
|
|
43
|
-
"@celljs/ta-protocol": "4.
|
|
44
|
-
"@celljs/ta-relay": "4.
|
|
45
|
-
"@celljs/web": "4.
|
|
37
|
+
"@celljs/ai-agent": "4.13.0",
|
|
38
|
+
"@celljs/ai-coding-agent": "4.13.0",
|
|
39
|
+
"@celljs/core": "4.13.0",
|
|
40
|
+
"@celljs/rpc": "4.13.0",
|
|
41
|
+
"@celljs/ta-exec": "4.13.0",
|
|
42
|
+
"@celljs/ta-harness": "4.13.0",
|
|
43
|
+
"@celljs/ta-protocol": "4.13.0",
|
|
44
|
+
"@celljs/ta-relay": "4.13.0",
|
|
45
|
+
"@celljs/web": "4.13.0",
|
|
46
46
|
"@earendil-works/pi-coding-agent": "^1.5.2"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
@@ -83,6 +83,10 @@
|
|
|
83
83
|
"import": "./esm/node/sign-in/index.js",
|
|
84
84
|
"default": "./lib/node/sign-in/index.js"
|
|
85
85
|
},
|
|
86
|
+
"./lib/node/team": {
|
|
87
|
+
"import": "./esm/node/team/index.js",
|
|
88
|
+
"default": "./lib/node/team/index.js"
|
|
89
|
+
},
|
|
86
90
|
"./lib/*.js": {
|
|
87
91
|
"import": "./esm/*.js",
|
|
88
92
|
"default": "./lib/*.js"
|