@celljs/ta-host 4.11.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 +10 -0
- package/esm/node/ta-server-impl.js +57 -9
- 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 +10 -0
- package/lib/node/ta-server-impl.js +57 -9
- 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
|
@@ -16,6 +16,7 @@ import { TA_HOST_OPTIONS, TaSessionFactory, TaSessionRegistry } from './host-pro
|
|
|
16
16
|
import { TaSessionHandles } from './session-handles.js';
|
|
17
17
|
import { SessionListFeed } from './session-list-feed.js';
|
|
18
18
|
import { TaErrors } from './ta-errors.js';
|
|
19
|
+
import { TaVisibility } from './team/team-protocol.js';
|
|
19
20
|
/**
|
|
20
21
|
* The open sessions. A session's id outlives its memory: closed while idle or by a restart, it opens again
|
|
21
22
|
* from its file under the same id at the next call (TaSessionHandles), so clients never see it go.
|
|
@@ -24,13 +25,22 @@ let DefaultTaSessionRegistry = class DefaultTaSessionRegistry {
|
|
|
24
25
|
constructor() {
|
|
25
26
|
this.sessions = new Map();
|
|
26
27
|
this.channels = new WeakMap();
|
|
28
|
+
this.eventListeners = new Set();
|
|
27
29
|
/** Sessions being created count against the limit too. */
|
|
28
30
|
this.opening = 0;
|
|
29
31
|
/** The closes under way, by session file: out of the list already, their files locked until they end. */
|
|
30
32
|
this.closing = new Map();
|
|
31
33
|
/** Sessions opening again under their ids: the calls that come meanwhile wait for the same. */
|
|
32
34
|
this.waking = new Map();
|
|
33
|
-
this.feed = new SessionListFeed(() => this.list().map(session => session.info()));
|
|
35
|
+
this.feed = new SessionListFeed(() => this.list().map(session => session.info()), undefined, (connection, list) => this.visibility.sessions(connection, list));
|
|
36
|
+
}
|
|
37
|
+
locate(sessionId) {
|
|
38
|
+
const session = this.sessions.get(sessionId);
|
|
39
|
+
if (session) {
|
|
40
|
+
return { sessionFile: session.pi.sessionFile, cwd: session.cwd };
|
|
41
|
+
}
|
|
42
|
+
const handle = this.handles.get(sessionId);
|
|
43
|
+
return handle && { sessionFile: handle.sessionFile, cwd: handle.cwd };
|
|
34
44
|
}
|
|
35
45
|
open(options) {
|
|
36
46
|
// A file that had a session keeps its id, which pages may still have.
|
|
@@ -72,6 +82,16 @@ let DefaultTaSessionRegistry = class DefaultTaSessionRegistry {
|
|
|
72
82
|
watch(connection) {
|
|
73
83
|
return this.feed.watch(connection);
|
|
74
84
|
}
|
|
85
|
+
get watching() {
|
|
86
|
+
return this.feed.watching;
|
|
87
|
+
}
|
|
88
|
+
get watchedAt() {
|
|
89
|
+
return this.feed.watchedAt;
|
|
90
|
+
}
|
|
91
|
+
onSessionEvent(listener) {
|
|
92
|
+
this.eventListeners.add(listener);
|
|
93
|
+
return () => this.eventListeners.delete(listener);
|
|
94
|
+
}
|
|
75
95
|
async close(sessionId, idle = false) {
|
|
76
96
|
if (!idle) {
|
|
77
97
|
this.handles.delete(sessionId);
|
|
@@ -133,6 +153,11 @@ let DefaultTaSessionRegistry = class DefaultTaSessionRegistry {
|
|
|
133
153
|
const session = await this.factory.create(options, (ended, idle) => void this.close(ended.id, idle), id);
|
|
134
154
|
this.sessions.set(session.id, session);
|
|
135
155
|
session.onInfoChange(() => this.sessions.get(session.id) === session && this.feed.changed());
|
|
156
|
+
session.onEvent(event => {
|
|
157
|
+
for (const listener of this.eventListeners) {
|
|
158
|
+
listener(session, event);
|
|
159
|
+
}
|
|
160
|
+
});
|
|
136
161
|
this.feed.changed();
|
|
137
162
|
const sessionFile = session.pi.sessionFile;
|
|
138
163
|
if (sessionFile) {
|
|
@@ -157,6 +182,10 @@ __decorate([
|
|
|
157
182
|
Autowired(TaSessionHandles),
|
|
158
183
|
__metadata("design:type", Object)
|
|
159
184
|
], DefaultTaSessionRegistry.prototype, "handles", void 0);
|
|
185
|
+
__decorate([
|
|
186
|
+
Autowired({ id: TaVisibility, detached: true }),
|
|
187
|
+
__metadata("design:type", Object)
|
|
188
|
+
], DefaultTaSessionRegistry.prototype, "visibility", void 0);
|
|
160
189
|
DefaultTaSessionRegistry = __decorate([
|
|
161
190
|
Component(TaSessionRegistry)
|
|
162
191
|
], DefaultTaSessionRegistry);
|
package/esm/node/ta-session.d.ts
CHANGED
|
@@ -45,6 +45,7 @@ export declare class TaSession {
|
|
|
45
45
|
protected idleTimer?: ReturnType<typeof setTimeout>;
|
|
46
46
|
protected started: boolean;
|
|
47
47
|
protected readonly infoListeners: Set<() => void>;
|
|
48
|
+
protected readonly eventListeners: Set<(event: TaEvent) => void>;
|
|
48
49
|
constructor(context: TaSessionContext);
|
|
49
50
|
get pi(): AgentSession;
|
|
50
51
|
/** Where the session works, as clients name it: a path, or an `ssh://` location. */
|
|
@@ -52,6 +53,8 @@ export declare class TaSession {
|
|
|
52
53
|
start(): Promise<void>;
|
|
53
54
|
info(): TaSessionInfo;
|
|
54
55
|
/** What `info` gives may have changed (TaServer.watchSessions). */
|
|
56
|
+
/** Every event of the session, as its clients get it. */
|
|
57
|
+
onEvent(listener: (event: TaEvent) => void): () => void;
|
|
55
58
|
onInfoChange(listener: () => void): () => void;
|
|
56
59
|
attach(channel: ClientChannel, afterSeq?: number, options?: TaAttachOptions): TaAttachResult;
|
|
57
60
|
earlierMessages(before: number | undefined, timestamp: number | undefined, budget: number): TaMessagePage;
|
package/esm/node/ta-session.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { randomUUID } from 'node:crypto';
|
|
2
|
+
import { TaAskUtil } from '@celljs/ta-protocol';
|
|
2
3
|
import { EventLog } from './event-log.js';
|
|
3
4
|
import { LiveRun } from './live-run.js';
|
|
4
5
|
import { MessagePage } from './message-page.js';
|
|
@@ -31,6 +32,7 @@ export class TaSession {
|
|
|
31
32
|
this.live = new LiveRun();
|
|
32
33
|
this.started = false;
|
|
33
34
|
this.infoListeners = new Set();
|
|
35
|
+
this.eventListeners = new Set();
|
|
34
36
|
this.runtime = context.runtime;
|
|
35
37
|
this.id = (_a = context.id) !== null && _a !== void 0 ? _a : randomUUID();
|
|
36
38
|
// Opened again: its seqs start past any the session gave before (fewer than one per millisecond), so a
|
|
@@ -67,6 +69,7 @@ export class TaSession {
|
|
|
67
69
|
model: model ? `${model.provider}/${model.id}` : undefined,
|
|
68
70
|
isStreaming: pi.isStreaming,
|
|
69
71
|
waiting: this.ui.pendingRequests.length > 0,
|
|
72
|
+
asking: TaAskUtil.asking(pi.sessionManager.getBranch()),
|
|
70
73
|
messageCount: pi.messages.length,
|
|
71
74
|
attached: this.channels.size,
|
|
72
75
|
createdAt: this.createdAt,
|
|
@@ -75,6 +78,11 @@ export class TaSession {
|
|
|
75
78
|
};
|
|
76
79
|
}
|
|
77
80
|
/** What `info` gives may have changed (TaServer.watchSessions). */
|
|
81
|
+
/** Every event of the session, as its clients get it. */
|
|
82
|
+
onEvent(listener) {
|
|
83
|
+
this.eventListeners.add(listener);
|
|
84
|
+
return () => this.eventListeners.delete(listener);
|
|
85
|
+
}
|
|
78
86
|
onInfoChange(listener) {
|
|
79
87
|
this.infoListeners.add(listener);
|
|
80
88
|
return () => this.infoListeners.delete(listener);
|
|
@@ -286,6 +294,14 @@ export class TaSession {
|
|
|
286
294
|
for (const channel of this.channels) {
|
|
287
295
|
channel.send(logged);
|
|
288
296
|
}
|
|
297
|
+
for (const listener of this.eventListeners) {
|
|
298
|
+
try {
|
|
299
|
+
listener(event);
|
|
300
|
+
}
|
|
301
|
+
catch (error) {
|
|
302
|
+
console.error('A listener of the events of a session failed:', error);
|
|
303
|
+
}
|
|
304
|
+
}
|
|
289
305
|
if (INFO_EVENTS.has(event.type)) {
|
|
290
306
|
for (const listener of this.infoListeners) {
|
|
291
307
|
listener();
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type TaAuditEvent, type TaAuthorizer, type TaDenial, type TaMemberInfo, type TaResource, type TaSharedRef } from '@celljs/ta-protocol';
|
|
2
|
+
import { TaAuthority } from './team-protocol.js';
|
|
3
|
+
/**
|
|
4
|
+
* The authorizer a package gave, and the conversations of agents and channels (a conversation of an agent is checked as
|
|
5
|
+
* the agent): every question about one let in comes here. A failure of the authorizer refuses, never lets.
|
|
6
|
+
*/
|
|
7
|
+
export declare class DefaultTaAuthority implements TaAuthority {
|
|
8
|
+
protected authorizer?: TaAuthorizer;
|
|
9
|
+
protected readonly links: Map<string, TaSharedRef>;
|
|
10
|
+
authorize(authorizer: TaAuthorizer): () => void;
|
|
11
|
+
check(principal: string, action: string, given?: TaResource): true | TaDenial;
|
|
12
|
+
describe(principal: string): TaMemberInfo | undefined;
|
|
13
|
+
record(event: TaAuditEvent): void;
|
|
14
|
+
created(principal: string, resource: TaResource): void;
|
|
15
|
+
admit(principal: string, theirs: number, everyone: number): boolean;
|
|
16
|
+
mayRun(principal: string, running: number): boolean;
|
|
17
|
+
link(sessionFile: string, ref: TaSharedRef | undefined): void;
|
|
18
|
+
protected ask<T>(what: string, answer: () => T, failed: T): T;
|
|
19
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
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;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { Component } from '@celljs/core';
|
|
8
|
+
import { TA_OWNER } from '@celljs/ta-protocol';
|
|
9
|
+
import { TaAuthority } from './team-protocol.js';
|
|
10
|
+
/**
|
|
11
|
+
* The authorizer a package gave, and the conversations of agents and channels (a conversation of an agent is checked as
|
|
12
|
+
* the agent): every question about one let in comes here. A failure of the authorizer refuses, never lets.
|
|
13
|
+
*/
|
|
14
|
+
let DefaultTaAuthority = class DefaultTaAuthority {
|
|
15
|
+
constructor() {
|
|
16
|
+
this.links = new Map();
|
|
17
|
+
}
|
|
18
|
+
authorize(authorizer) {
|
|
19
|
+
this.authorizer = authorizer;
|
|
20
|
+
return () => {
|
|
21
|
+
if (this.authorizer === authorizer) {
|
|
22
|
+
this.authorizer = undefined;
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
check(principal, action, given) {
|
|
27
|
+
if (principal === TA_OWNER) {
|
|
28
|
+
return true;
|
|
29
|
+
}
|
|
30
|
+
const of = (given === null || given === void 0 ? void 0 : given.kind) === 'session' ? this.links.get(given.id) : undefined;
|
|
31
|
+
const resource = of && given ? { ...given, of } : given;
|
|
32
|
+
const refused = { action, ...(resource ? { resource } : {}) };
|
|
33
|
+
if (!this.authorizer) {
|
|
34
|
+
return refused;
|
|
35
|
+
}
|
|
36
|
+
return this.ask(`check ${action}`, () => { var _a; var _b; return (_b = (_a = this.authorizer) === null || _a === void 0 ? void 0 : _a.check(principal, action, resource)) !== null && _b !== void 0 ? _b : refused; }, refused);
|
|
37
|
+
}
|
|
38
|
+
describe(principal) {
|
|
39
|
+
return principal === TA_OWNER ? undefined : this.ask('describe', () => { var _a, _b; return (_b = (_a = this.authorizer) === null || _a === void 0 ? void 0 : _a.describe) === null || _b === void 0 ? void 0 : _b.call(_a, principal); }, undefined);
|
|
40
|
+
}
|
|
41
|
+
record(event) {
|
|
42
|
+
if (event.principal !== TA_OWNER) {
|
|
43
|
+
this.ask('record', () => { var _a, _b; return (_b = (_a = this.authorizer) === null || _a === void 0 ? void 0 : _a.record) === null || _b === void 0 ? void 0 : _b.call(_a, event); }, undefined);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
created(principal, resource) {
|
|
47
|
+
if (principal !== TA_OWNER) {
|
|
48
|
+
this.ask('created', () => { var _a, _b; return (_b = (_a = this.authorizer) === null || _a === void 0 ? void 0 : _a.created) === null || _b === void 0 ? void 0 : _b.call(_a, principal, resource); }, undefined);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
admit(principal, theirs, everyone) {
|
|
52
|
+
return this.ask('admit', () => { var _a, _b; var _c; return (_c = (_b = (_a = this.authorizer) === null || _a === void 0 ? void 0 : _a.admit) === null || _b === void 0 ? void 0 : _b.call(_a, principal, theirs, everyone)) !== null && _c !== void 0 ? _c : true; }, false);
|
|
53
|
+
}
|
|
54
|
+
mayRun(principal, running) {
|
|
55
|
+
return principal === TA_OWNER || this.ask('mayRun', () => { var _a, _b; var _c; return (_c = (_b = (_a = this.authorizer) === null || _a === void 0 ? void 0 : _a.mayRun) === null || _b === void 0 ? void 0 : _b.call(_a, principal, running)) !== null && _c !== void 0 ? _c : true; }, false);
|
|
56
|
+
}
|
|
57
|
+
link(sessionFile, ref) {
|
|
58
|
+
if (ref) {
|
|
59
|
+
this.links.set(sessionFile, ref);
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
this.links.delete(sessionFile);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
ask(what, answer, failed) {
|
|
66
|
+
try {
|
|
67
|
+
return answer();
|
|
68
|
+
}
|
|
69
|
+
catch (error) {
|
|
70
|
+
console.error(`The authorizer failed (${what}): ${error instanceof Error ? error.message : error}`);
|
|
71
|
+
return failed;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
DefaultTaAuthority = __decorate([
|
|
76
|
+
Component(TaAuthority)
|
|
77
|
+
], DefaultTaAuthority);
|
|
78
|
+
export { DefaultTaAuthority };
|
|
79
|
+
//# sourceMappingURL=authority.js.map
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { JsonRpc } from '@celljs/rpc';
|
|
2
|
+
import { type TaDenial } from '@celljs/ta-protocol';
|
|
3
|
+
/** A call over the WebSocket, as the gate reads it. */
|
|
4
|
+
export interface TaCall {
|
|
5
|
+
service: string;
|
|
6
|
+
method: string;
|
|
7
|
+
id: JsonRpc.Id | undefined;
|
|
8
|
+
params: unknown[];
|
|
9
|
+
}
|
|
10
|
+
/** Reading a call, what the record keeps of it, and the answer of a refusal: pure, for the gate (TaTeamGate). */
|
|
11
|
+
export declare namespace TaCallUtil {
|
|
12
|
+
/** The service and the method of a call over the WebSocket: `/api/<service>`, `{ method }`. */
|
|
13
|
+
function of(url: string | undefined, body: unknown): TaCall | undefined;
|
|
14
|
+
/** Calls that only read what a page shows, made all the time: not each a line of the record. */
|
|
15
|
+
const QUIET: ReadonlySet<string>;
|
|
16
|
+
/** Calls that answer a question of a run (a dialog, a tool of the client): only who asked the run answers them. */
|
|
17
|
+
const ANSWERS: ReadonlySet<string>;
|
|
18
|
+
/** What a call was given, cut short for the record: a message, a command, a path; never more than 200 characters. */
|
|
19
|
+
function summary(method: string, params: unknown[]): string | undefined;
|
|
20
|
+
/** What is said to the one refused, in English for the model and the log; pages word it from `data`. */
|
|
21
|
+
function message(denial: TaDenial): string;
|
|
22
|
+
function forbidden(id: JsonRpc.Id | undefined, denial: TaDenial): JsonRpc.Response;
|
|
23
|
+
}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { JsonRpc } from '@celljs/rpc';
|
|
2
|
+
import { TA_RPC_ERROR_CODE, TaActionUtil, TaErrorCode } from '@celljs/ta-protocol';
|
|
3
|
+
/** Reading a call, what the record keeps of it, and the answer of a refusal: pure, for the gate (TaTeamGate). */
|
|
4
|
+
export var TaCallUtil;
|
|
5
|
+
(function (TaCallUtil) {
|
|
6
|
+
/** The service and the method of a call over the WebSocket: `/api/<service>`, `{ method }`. */
|
|
7
|
+
function of(url, body) {
|
|
8
|
+
const request = body;
|
|
9
|
+
const path = (url !== null && url !== void 0 ? url : '').split('?')[0];
|
|
10
|
+
const at = path.lastIndexOf('/');
|
|
11
|
+
if (!request || typeof request.method !== 'string' || at < 0) {
|
|
12
|
+
return undefined;
|
|
13
|
+
}
|
|
14
|
+
let service;
|
|
15
|
+
try {
|
|
16
|
+
service = decodeURIComponent(path.slice(at + 1));
|
|
17
|
+
}
|
|
18
|
+
catch (_a) {
|
|
19
|
+
return undefined;
|
|
20
|
+
}
|
|
21
|
+
return { service, method: request.method, id: request.id, params: Array.isArray(request.params) ? request.params : [] };
|
|
22
|
+
}
|
|
23
|
+
TaCallUtil.of = of;
|
|
24
|
+
/** Calls that only read what a page shows, made all the time: not each a line of the record. */
|
|
25
|
+
TaCallUtil.QUIET = new Set([
|
|
26
|
+
'TaServer.getServerInfo',
|
|
27
|
+
'TaServer.listSessions',
|
|
28
|
+
'TaServer.watchSessions',
|
|
29
|
+
'TaServer.listSavedSessions',
|
|
30
|
+
'TaServer.attach',
|
|
31
|
+
'TaServer.detach',
|
|
32
|
+
'TaServer.getState',
|
|
33
|
+
'TaServer.getEarlierMessages',
|
|
34
|
+
'TaServer.getMessageImage',
|
|
35
|
+
'TaServer.getCommands',
|
|
36
|
+
'TaServer.getDirectoryCommands',
|
|
37
|
+
'TaServer.getAvailableModels',
|
|
38
|
+
'TaServer.getAvailableThinkingLevels',
|
|
39
|
+
'TaServer.getSessionStats',
|
|
40
|
+
'TaPackageServer.getExtensionData',
|
|
41
|
+
'TaPackageServer.listWebExtensions',
|
|
42
|
+
'TaPackageServer.readWebExtension',
|
|
43
|
+
'TaPackageServer.listPackages',
|
|
44
|
+
'TaPackageServer.getTemporaryRetention',
|
|
45
|
+
'TaTerminalServer.writeTerminal',
|
|
46
|
+
'TaTerminalServer.resizeTerminal',
|
|
47
|
+
'TaWorkspaceServer.writeTerminal',
|
|
48
|
+
'TaWorkspaceServer.resizeTerminal',
|
|
49
|
+
]);
|
|
50
|
+
/** Calls that answer a question of a run (a dialog, a tool of the client): only who asked the run answers them. */
|
|
51
|
+
TaCallUtil.ANSWERS = new Set(['TaServer.respondUi', 'TaServer.claimClientTool', 'TaServer.respondClientTool']);
|
|
52
|
+
/** What a call was given, cut short for the record: a message, a command, a path; never more than 200 characters. */
|
|
53
|
+
function summary(method, params) {
|
|
54
|
+
const cut = (text) => (typeof text === 'string' && text ? text.replace(/\s+/g, ' ').slice(0, 200) : undefined);
|
|
55
|
+
const second = params[1];
|
|
56
|
+
switch (method) {
|
|
57
|
+
case 'prompt':
|
|
58
|
+
case 'steer':
|
|
59
|
+
case 'followUp':
|
|
60
|
+
return cut(second === null || second === void 0 ? void 0 : second.message);
|
|
61
|
+
case 'bash':
|
|
62
|
+
return cut(params[1]);
|
|
63
|
+
case 'runCommand':
|
|
64
|
+
return cut([params[0], ...(Array.isArray(params[1]) ? params[1] : [])].join(' '));
|
|
65
|
+
case 'callPackageHost': {
|
|
66
|
+
const request = Array.isArray(params[2]) ? params[2][0] : undefined;
|
|
67
|
+
return cut([params[0], params[1], typeof (request === null || request === void 0 ? void 0 : request.kind) === 'string' ? request.kind : ''].filter(Boolean).join(' '));
|
|
68
|
+
}
|
|
69
|
+
default:
|
|
70
|
+
return typeof params[0] === 'string' && params[0].length < 300 ? cut(params[0]) : undefined;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
TaCallUtil.summary = summary;
|
|
74
|
+
/** What is said to the one refused, in English for the model and the log; pages word it from `data`. */
|
|
75
|
+
function message(denial) {
|
|
76
|
+
var _a;
|
|
77
|
+
const what = TaActionUtil.title(denial.action, 'en');
|
|
78
|
+
const where = ((_a = denial.resource) === null || _a === void 0 ? void 0 : _a.kind) === 'dir' ? ` in ${denial.resource.id}` : '';
|
|
79
|
+
return `You may not do this here: it needs "${what}"${where}. Ask the owner of this Ta for it.`;
|
|
80
|
+
}
|
|
81
|
+
TaCallUtil.message = message;
|
|
82
|
+
function forbidden(id, denial) {
|
|
83
|
+
const data = { code: TaErrorCode.FORBIDDEN, hint: 'Ask for it: the owner or an admin answers.', ...denial };
|
|
84
|
+
return JsonRpc.error(id !== null && id !== void 0 ? id : null, TA_RPC_ERROR_CODE, message(denial), { kind: 'application', data });
|
|
85
|
+
}
|
|
86
|
+
TaCallUtil.forbidden = forbidden;
|
|
87
|
+
})(TaCallUtil || (TaCallUtil = {}));
|
|
88
|
+
//# sourceMappingURL=call-util.js.map
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type RpcConnection, RpcConnectionManager } from '@celljs/rpc/lib/node';
|
|
2
|
+
import { TaAuthority, TaConnections, TaPrincipals } from './team-protocol.js';
|
|
3
|
+
/**
|
|
4
|
+
* The connections of those let in: counted for the page of members, closed at once when what they were let do is taken
|
|
5
|
+
* back, and, as each opens, let in only within the owner's limits (people online, devices of one).
|
|
6
|
+
*/
|
|
7
|
+
export declare class DefaultTaConnections implements TaConnections {
|
|
8
|
+
protected readonly connections: RpcConnectionManager;
|
|
9
|
+
protected readonly principals: TaPrincipals;
|
|
10
|
+
protected readonly authority: TaAuthority;
|
|
11
|
+
protected init(): void;
|
|
12
|
+
counted(): Record<string, number>;
|
|
13
|
+
close(principal: string): number;
|
|
14
|
+
protected admit(connection: RpcConnection): void;
|
|
15
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
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;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
10
|
+
import { Autowired, Component, PostConstruct } from '@celljs/core';
|
|
11
|
+
import { RpcConnectionManager } from '@celljs/rpc/lib/node';
|
|
12
|
+
import { TA_INVITE_PREFIX, TA_OWNER } from '@celljs/ta-protocol';
|
|
13
|
+
import { TaAuthority, TaConnections, TaPrincipals } from './team-protocol.js';
|
|
14
|
+
/**
|
|
15
|
+
* The connections of those let in: counted for the page of members, closed at once when what they were let do is taken
|
|
16
|
+
* back, and, as each opens, let in only within the owner's limits (people online, devices of one).
|
|
17
|
+
*/
|
|
18
|
+
let DefaultTaConnections = class DefaultTaConnections {
|
|
19
|
+
init() {
|
|
20
|
+
this.connections.onConnect(connection => this.admit(connection));
|
|
21
|
+
}
|
|
22
|
+
counted() {
|
|
23
|
+
var _a;
|
|
24
|
+
const counts = {};
|
|
25
|
+
for (const connection of this.connections.connections) {
|
|
26
|
+
const principal = this.principals.of(connection);
|
|
27
|
+
if (principal !== TA_OWNER && !connection.closed) {
|
|
28
|
+
counts[principal] = ((_a = counts[principal]) !== null && _a !== void 0 ? _a : 0) + 1;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return counts;
|
|
32
|
+
}
|
|
33
|
+
close(principal) {
|
|
34
|
+
let closed = 0;
|
|
35
|
+
for (const connection of [...this.connections.connections]) {
|
|
36
|
+
if (this.principals.of(connection) === principal && !connection.closed) {
|
|
37
|
+
connection.close(4403, 'What this was let do was taken back.');
|
|
38
|
+
closed++;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
return closed;
|
|
42
|
+
}
|
|
43
|
+
admit(connection) {
|
|
44
|
+
const principal = this.principals.of(connection);
|
|
45
|
+
if (principal === TA_OWNER || principal.startsWith(TA_INVITE_PREFIX)) {
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
const open = this.connections.connections.filter(one => !one.closed && one !== connection);
|
|
49
|
+
const theirs = open.filter(one => this.principals.of(one) === principal).length;
|
|
50
|
+
const everyone = new Set(open.map(one => this.principals.of(one)).filter(one => one !== TA_OWNER && !one.startsWith(TA_INVITE_PREFIX)));
|
|
51
|
+
everyone.add(principal);
|
|
52
|
+
const admitted = this.authority.admit(principal, theirs, everyone.size);
|
|
53
|
+
this.authority.record({ principal, kind: 'connect', name: 'connect', allowed: admitted });
|
|
54
|
+
if (!admitted) {
|
|
55
|
+
connection.close(4429, 'Too many people are in this Ta now; try again later.');
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
__decorate([
|
|
60
|
+
Autowired(RpcConnectionManager),
|
|
61
|
+
__metadata("design:type", Object)
|
|
62
|
+
], DefaultTaConnections.prototype, "connections", void 0);
|
|
63
|
+
__decorate([
|
|
64
|
+
Autowired(TaPrincipals),
|
|
65
|
+
__metadata("design:type", Object)
|
|
66
|
+
], DefaultTaConnections.prototype, "principals", void 0);
|
|
67
|
+
__decorate([
|
|
68
|
+
Autowired(TaAuthority),
|
|
69
|
+
__metadata("design:type", Object)
|
|
70
|
+
], DefaultTaConnections.prototype, "authority", void 0);
|
|
71
|
+
__decorate([
|
|
72
|
+
PostConstruct(),
|
|
73
|
+
__metadata("design:type", Function),
|
|
74
|
+
__metadata("design:paramtypes", []),
|
|
75
|
+
__metadata("design:returntype", void 0)
|
|
76
|
+
], DefaultTaConnections.prototype, "init", null);
|
|
77
|
+
DefaultTaConnections = __decorate([
|
|
78
|
+
Component(TaConnections)
|
|
79
|
+
], DefaultTaConnections);
|
|
80
|
+
export { DefaultTaConnections };
|
|
81
|
+
//# sourceMappingURL=connections.js.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { TaHostTeam } from '@celljs/ta-protocol';
|
|
2
|
+
import { TaAuthority, TaConnections, TaHostTeamProvider, TaMemberDevices, TaPackagePermissions, TaPrincipals, TaRunActors, TaSharedDataRegistry } from './team-protocol.js';
|
|
3
|
+
/** The face of the parts of ta serve that let people in, as the server side of packages gets it (TaExtensionHost.team). */
|
|
4
|
+
export declare class DefaultTaHostTeamProvider implements TaHostTeamProvider {
|
|
5
|
+
protected readonly principals: TaPrincipals;
|
|
6
|
+
protected readonly authority: TaAuthority;
|
|
7
|
+
protected readonly runs: TaRunActors;
|
|
8
|
+
protected readonly shared: TaSharedDataRegistry;
|
|
9
|
+
protected readonly permissions: TaPackagePermissions;
|
|
10
|
+
protected readonly devices: TaMemberDevices;
|
|
11
|
+
protected readonly connections: TaConnections;
|
|
12
|
+
readonly team: TaHostTeam;
|
|
13
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
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;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
10
|
+
import { Autowired, Component } from '@celljs/core';
|
|
11
|
+
import { TaAuthority, TaConnections, TaHostTeamProvider, TaMemberDevices, TaPackagePermissions, TaPrincipals, TaRunActors, TaSharedDataRegistry, } from './team-protocol.js';
|
|
12
|
+
/** The face of the parts of ta serve that let people in, as the server side of packages gets it (TaExtensionHost.team). */
|
|
13
|
+
let DefaultTaHostTeamProvider = class DefaultTaHostTeamProvider {
|
|
14
|
+
constructor() {
|
|
15
|
+
this.team = {
|
|
16
|
+
authorize: authorizer => this.authority.authorize(authorizer),
|
|
17
|
+
current: () => this.principals.current(),
|
|
18
|
+
actAs: (principal, run) => this.principals.actAs(principal, run),
|
|
19
|
+
can: (principal, action, resource) => this.authority.check(principal, action, resource) === true,
|
|
20
|
+
describe: principal => this.authority.describe(principal),
|
|
21
|
+
toolAction: tool => this.permissions.tool(tool),
|
|
22
|
+
shareData: (name, data) => this.shared.add(name, data),
|
|
23
|
+
link: (sessionFile, ref) => this.authority.link(sessionFile, ref),
|
|
24
|
+
actorsOf: sessionFile => this.runs.actorsOf(sessionFile),
|
|
25
|
+
connected: () => this.connections.counted(),
|
|
26
|
+
disconnect: principal => {
|
|
27
|
+
const closed = this.connections.close(principal);
|
|
28
|
+
this.runs.stopRunsOf(principal);
|
|
29
|
+
return closed;
|
|
30
|
+
},
|
|
31
|
+
pair: (principal, name, expiresAt) => this.devices.pair(principal, name, expiresAt),
|
|
32
|
+
unpair: deviceId => this.devices.unpair(deviceId),
|
|
33
|
+
devices: () => this.devices.list(),
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
__decorate([
|
|
38
|
+
Autowired(TaPrincipals),
|
|
39
|
+
__metadata("design:type", Object)
|
|
40
|
+
], DefaultTaHostTeamProvider.prototype, "principals", void 0);
|
|
41
|
+
__decorate([
|
|
42
|
+
Autowired(TaAuthority),
|
|
43
|
+
__metadata("design:type", Object)
|
|
44
|
+
], DefaultTaHostTeamProvider.prototype, "authority", void 0);
|
|
45
|
+
__decorate([
|
|
46
|
+
Autowired(TaRunActors),
|
|
47
|
+
__metadata("design:type", Object)
|
|
48
|
+
], DefaultTaHostTeamProvider.prototype, "runs", void 0);
|
|
49
|
+
__decorate([
|
|
50
|
+
Autowired(TaSharedDataRegistry),
|
|
51
|
+
__metadata("design:type", Object)
|
|
52
|
+
], DefaultTaHostTeamProvider.prototype, "shared", void 0);
|
|
53
|
+
__decorate([
|
|
54
|
+
Autowired(TaPackagePermissions),
|
|
55
|
+
__metadata("design:type", Object)
|
|
56
|
+
], DefaultTaHostTeamProvider.prototype, "permissions", void 0);
|
|
57
|
+
__decorate([
|
|
58
|
+
Autowired(TaMemberDevices),
|
|
59
|
+
__metadata("design:type", Object)
|
|
60
|
+
], DefaultTaHostTeamProvider.prototype, "devices", void 0);
|
|
61
|
+
__decorate([
|
|
62
|
+
Autowired(TaConnections),
|
|
63
|
+
__metadata("design:type", Object)
|
|
64
|
+
], DefaultTaHostTeamProvider.prototype, "connections", void 0);
|
|
65
|
+
DefaultTaHostTeamProvider = __decorate([
|
|
66
|
+
Component(TaHostTeamProvider)
|
|
67
|
+
], DefaultTaHostTeamProvider);
|
|
68
|
+
export { DefaultTaHostTeamProvider };
|
|
69
|
+
//# sourceMappingURL=host-team.js.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export * from './authority.js';
|
|
2
|
+
export * from './call-util.js';
|
|
3
|
+
export * from './connections.js';
|
|
4
|
+
export * from './host-team.js';
|
|
5
|
+
export * from './member-devices.js';
|
|
6
|
+
export * from './package-permissions.js';
|
|
7
|
+
export * from './principals.js';
|
|
8
|
+
export * from './run-actors.js';
|
|
9
|
+
export * from './shared-data.js';
|
|
10
|
+
export * from './team-calls.js';
|
|
11
|
+
export * from './team-gate.js';
|
|
12
|
+
export * from './team-protocol.js';
|
|
13
|
+
export * from './visibility.js';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export * from './authority.js';
|
|
2
|
+
export * from './call-util.js';
|
|
3
|
+
export * from './connections.js';
|
|
4
|
+
export * from './host-team.js';
|
|
5
|
+
export * from './member-devices.js';
|
|
6
|
+
export * from './package-permissions.js';
|
|
7
|
+
export * from './principals.js';
|
|
8
|
+
export * from './run-actors.js';
|
|
9
|
+
export * from './shared-data.js';
|
|
10
|
+
export * from './team-calls.js';
|
|
11
|
+
export * from './team-gate.js';
|
|
12
|
+
export * from './team-protocol.js';
|
|
13
|
+
export * from './visibility.js';
|
|
14
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type TaTeamDevice, type TaTeamPairing } from '@celljs/ta-protocol';
|
|
2
|
+
import { type RelayBridge } from '../relay-bridge.js';
|
|
3
|
+
import { TaMemberDevices } from './team-protocol.js';
|
|
4
|
+
/** The devices of those let in, kept with the owner's in relay.json (RelayDevice.member), each reaching ta serve end to end. */
|
|
5
|
+
export declare class DefaultTaMemberDevices implements TaMemberDevices {
|
|
6
|
+
protected readonly relay: RelayBridge;
|
|
7
|
+
pair(principal: string, name: string, expiresAt?: number): Promise<TaTeamPairing>;
|
|
8
|
+
/** Only one of those let in: the owner's own devices are taken out in Settings. */
|
|
9
|
+
unpair(deviceId: string): void;
|
|
10
|
+
list(): TaTeamDevice[];
|
|
11
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
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;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
10
|
+
import { Autowired, Component } from '@celljs/core';
|
|
11
|
+
import { TA_OWNER } from '@celljs/ta-protocol';
|
|
12
|
+
import { RelayPairingUtil } from '@celljs/ta-relay/lib/node';
|
|
13
|
+
import { RELAY_BRIDGE } from '../relay-bridge.js';
|
|
14
|
+
import { TaMemberDevices } from './team-protocol.js';
|
|
15
|
+
/** The devices of those let in, kept with the owner's in relay.json (RelayDevice.member), each reaching ta serve end to end. */
|
|
16
|
+
let DefaultTaMemberDevices = class DefaultTaMemberDevices {
|
|
17
|
+
async pair(principal, name, expiresAt) {
|
|
18
|
+
if (!principal || principal === TA_OWNER) {
|
|
19
|
+
throw new Error('A device of the owner is paired in Settings, not by a package.');
|
|
20
|
+
}
|
|
21
|
+
const relay = this.relay.relayFor('devices');
|
|
22
|
+
const pairing = this.relay.store.pair(relay, name || 'device', { member: principal, ...(expiresAt !== undefined ? { expiresAt } : {}) });
|
|
23
|
+
this.relay.refresh();
|
|
24
|
+
return { ...pairing, link: RelayPairingUtil.link(pairing) };
|
|
25
|
+
}
|
|
26
|
+
/** Only one of those let in: the owner's own devices are taken out in Settings. */
|
|
27
|
+
unpair(deviceId) {
|
|
28
|
+
var _a;
|
|
29
|
+
if ((_a = this.relay.store.device(deviceId, 0)) === null || _a === void 0 ? void 0 : _a.member) {
|
|
30
|
+
this.relay.store.remove(deviceId);
|
|
31
|
+
this.relay.refresh();
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
list() {
|
|
35
|
+
return this.relay.store.read().devices.flatMap((device) => device.member
|
|
36
|
+
? [
|
|
37
|
+
{
|
|
38
|
+
id: device.id,
|
|
39
|
+
name: device.name,
|
|
40
|
+
member: device.member,
|
|
41
|
+
createdAt: device.createdAt,
|
|
42
|
+
...(device.expiresAt ? { expiresAt: device.expiresAt } : {}),
|
|
43
|
+
},
|
|
44
|
+
]
|
|
45
|
+
: []);
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
__decorate([
|
|
49
|
+
Autowired({ id: RELAY_BRIDGE, detached: true }),
|
|
50
|
+
__metadata("design:type", Function)
|
|
51
|
+
], DefaultTaMemberDevices.prototype, "relay", void 0);
|
|
52
|
+
DefaultTaMemberDevices = __decorate([
|
|
53
|
+
Component(TaMemberDevices)
|
|
54
|
+
], DefaultTaMemberDevices);
|
|
55
|
+
export { DefaultTaMemberDevices };
|
|
56
|
+
//# sourceMappingURL=member-devices.js.map
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { type CodingAgentOptions } from '@celljs/ai-coding-agent';
|
|
2
|
+
import { type TaPermissionManifest } from '@celljs/ta-protocol';
|
|
3
|
+
import { TaPackagePermissions } from './team-protocol.js';
|
|
4
|
+
/**
|
|
5
|
+
* What the built-in packages that are on declare of their hosts and tools (`pi.permissions` of their package.json): the
|
|
6
|
+
* knowledge stays with each package, ta serve only reads it. A package of the user's declares nothing that counts: its
|
|
7
|
+
* host and tools need as much as installing one (TA_UNDECLARED), which only who may install extensions has.
|
|
8
|
+
*/
|
|
9
|
+
export declare class DefaultTaPackagePermissions implements TaPackagePermissions {
|
|
10
|
+
protected readonly codingAgentOptions?: CodingAgentOptions;
|
|
11
|
+
/** By the root of each package: read once, a package that comes with Ta does not change while it runs. */
|
|
12
|
+
protected readonly manifests: Map<string, TaPermissionManifest>;
|
|
13
|
+
/** Which are on, read again at most this often: only calls of those let in ask, and a package turned on is soon known. */
|
|
14
|
+
protected on?: {
|
|
15
|
+
at: number;
|
|
16
|
+
byName: Map<string, TaPermissionManifest>;
|
|
17
|
+
};
|
|
18
|
+
host(name: string, method: string, kind?: string): string;
|
|
19
|
+
tool(name: string): string | undefined;
|
|
20
|
+
/** The manifests of the built-in packages on now, by name. */
|
|
21
|
+
protected all(now?: number): Map<string, TaPermissionManifest>;
|
|
22
|
+
protected read(root: string): TaPermissionManifest;
|
|
23
|
+
}
|