@celljs/ta-host 4.9.1 → 4.11.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 +5 -5
- package/README.md +5 -5
- package/esm/node/client-tool-broker.d.ts +6 -2
- package/esm/node/client-tool-broker.js +11 -4
- package/esm/node/event-log.d.ts +2 -1
- package/esm/node/event-log.js +3 -2
- package/esm/node/exec-environment-factory.d.ts +7 -0
- package/esm/node/exec-environment-factory.js +30 -7
- package/esm/node/host-protocol.d.ts +24 -10
- package/esm/node/index.d.ts +2 -0
- package/esm/node/index.js +2 -0
- package/esm/node/package-hosts.d.ts +6 -0
- package/esm/node/package-hosts.js +36 -1
- package/esm/node/package-server-impl.d.ts +0 -1
- package/esm/node/package-server-impl.js +0 -3
- package/esm/node/relay-bridge.d.ts +12 -2
- package/esm/node/relay-bridge.js +93 -3
- package/esm/node/remote/remote-hosts.d.ts +1 -3
- package/esm/node/remote/remote-hosts.js +0 -15
- package/esm/node/remote/remote-protocol.d.ts +0 -2
- package/esm/node/remote/remote-server-impl.js +1 -1
- package/esm/node/remote-ui-context.d.ts +1 -1
- package/esm/node/remote-ui-context.js +3 -1
- package/esm/node/rooms-bridge.d.ts +60 -0
- package/esm/node/rooms-bridge.js +155 -0
- package/esm/node/session-catalog.d.ts +7 -3
- package/esm/node/session-catalog.js +15 -4
- package/esm/node/session-handles.d.ts +32 -0
- package/esm/node/session-handles.js +86 -0
- package/esm/node/session-info-util.d.ts +7 -0
- package/esm/node/session-info-util.js +63 -4
- package/esm/node/session-list-feed.d.ts +28 -0
- package/esm/node/session-list-feed.js +62 -0
- package/esm/node/sign-in/sign-in-flow.d.ts +2 -0
- package/esm/node/sign-in/sign-in-flow.js +9 -0
- package/esm/node/sign-in/sign-in-provider.js +3 -2
- package/esm/node/slash-command-util.d.ts +43 -0
- package/esm/node/slash-command-util.js +105 -0
- package/esm/node/ta-access.d.ts +11 -0
- package/esm/node/ta-access.js +29 -3
- package/esm/node/ta-errors.js +17 -2
- package/esm/node/ta-event-util.d.ts +19 -2
- package/esm/node/ta-event-util.js +97 -3
- package/esm/node/ta-server-impl.d.ts +13 -7
- package/esm/node/ta-server-impl.js +43 -24
- package/esm/node/ta-session-factory.d.ts +26 -2
- package/esm/node/ta-session-factory.js +64 -16
- package/esm/node/ta-session-registry.d.ts +16 -2
- package/esm/node/ta-session-registry.js +79 -20
- package/esm/node/ta-session.d.ts +16 -6
- package/esm/node/ta-session.js +59 -14
- package/esm/node/web-extension-catalog.d.ts +5 -1
- package/esm/node/web-extension-catalog.js +15 -19
- package/esm/node/web-extension-util.js +7 -3
- package/esm/node/workspace-files.d.ts +19 -5
- package/esm/node/workspace-files.js +26 -15
- package/esm/node/workspace-protocol.d.ts +1 -1
- package/esm/node/workspace-util.d.ts +2 -0
- package/esm/node/workspace-util.js +8 -3
- package/lib/node/client-tool-broker.d.ts +6 -2
- package/lib/node/client-tool-broker.js +11 -4
- package/lib/node/event-log.d.ts +2 -1
- package/lib/node/event-log.js +3 -2
- package/lib/node/exec-environment-factory.d.ts +7 -0
- package/lib/node/exec-environment-factory.js +30 -7
- package/lib/node/host-protocol.d.ts +24 -10
- package/lib/node/index.d.ts +2 -0
- package/lib/node/index.js +2 -0
- package/lib/node/package-hosts.d.ts +6 -0
- package/lib/node/package-hosts.js +35 -0
- package/lib/node/package-server-impl.d.ts +0 -1
- package/lib/node/package-server-impl.js +0 -3
- package/lib/node/relay-bridge.d.ts +12 -2
- package/lib/node/relay-bridge.js +91 -1
- package/lib/node/remote/remote-hosts.d.ts +1 -3
- package/lib/node/remote/remote-hosts.js +0 -15
- package/lib/node/remote/remote-protocol.d.ts +0 -2
- package/lib/node/remote/remote-server-impl.js +1 -1
- package/lib/node/remote-ui-context.d.ts +1 -1
- package/lib/node/remote-ui-context.js +3 -1
- package/lib/node/rooms-bridge.d.ts +61 -0
- package/lib/node/rooms-bridge.js +158 -0
- package/lib/node/session-catalog.d.ts +7 -3
- package/lib/node/session-catalog.js +15 -4
- package/lib/node/session-handles.d.ts +33 -0
- package/lib/node/session-handles.js +89 -0
- package/lib/node/session-info-util.d.ts +7 -0
- package/lib/node/session-info-util.js +62 -3
- package/lib/node/session-list-feed.d.ts +29 -0
- package/lib/node/session-list-feed.js +66 -0
- package/lib/node/sign-in/sign-in-flow.d.ts +2 -0
- package/lib/node/sign-in/sign-in-flow.js +10 -1
- package/lib/node/sign-in/sign-in-provider.js +3 -2
- package/lib/node/slash-command-util.d.ts +44 -0
- package/lib/node/slash-command-util.js +108 -0
- package/lib/node/ta-access.d.ts +11 -0
- package/lib/node/ta-access.js +29 -3
- package/lib/node/ta-errors.js +17 -2
- package/lib/node/ta-event-util.d.ts +19 -2
- package/lib/node/ta-event-util.js +97 -3
- package/lib/node/ta-server-impl.d.ts +13 -7
- package/lib/node/ta-server-impl.js +41 -22
- package/lib/node/ta-session-factory.d.ts +26 -2
- package/lib/node/ta-session-factory.js +65 -17
- package/lib/node/ta-session-registry.d.ts +16 -2
- package/lib/node/ta-session-registry.js +79 -20
- package/lib/node/ta-session.d.ts +16 -6
- package/lib/node/ta-session.js +59 -14
- package/lib/node/web-extension-catalog.d.ts +5 -1
- package/lib/node/web-extension-catalog.js +15 -19
- package/lib/node/web-extension-util.js +7 -3
- package/lib/node/workspace-files.d.ts +19 -5
- package/lib/node/workspace-files.js +26 -15
- package/lib/node/workspace-protocol.d.ts +1 -1
- package/lib/node/workspace-util.d.ts +2 -0
- package/lib/node/workspace-util.js +8 -3
- package/package.json +12 -12
|
@@ -2,7 +2,7 @@ import { type CodingAgentOptions } from '@celljs/ai-coding-agent';
|
|
|
2
2
|
import { type Application, ApplicationLifecycle } from '@celljs/core';
|
|
3
3
|
import type { RpcConnection } from '@celljs/rpc/lib/node';
|
|
4
4
|
import { type ExecClient, SshHost, type SshQuestion } from '@celljs/ta-exec';
|
|
5
|
-
import {
|
|
5
|
+
import { type TaRemoteEvent, type TaRemoteHost, type TaRemotePrompt } from '@celljs/ta-protocol';
|
|
6
6
|
import { TaWorkingDirectory } from '../working-directory.js';
|
|
7
7
|
import { RemoteHosts, type TaRemoteOptions } from './remote-protocol.js';
|
|
8
8
|
interface Waiting {
|
|
@@ -25,7 +25,6 @@ export declare class DefaultRemoteHosts implements RemoteHosts, ApplicationLifec
|
|
|
25
25
|
list(): TaRemoteHost[];
|
|
26
26
|
add(host: string): void;
|
|
27
27
|
remove(host: string): Promise<void>;
|
|
28
|
-
resolve(location: string): Promise<string>;
|
|
29
28
|
disconnect(host: string): Promise<void>;
|
|
30
29
|
onDisconnect(listener: (host: string) => void): () => void;
|
|
31
30
|
watch(connection: RpcConnection): TaRemotePrompt[];
|
|
@@ -35,6 +34,5 @@ export declare class DefaultRemoteHosts implements RemoteHosts, ApplicationLifec
|
|
|
35
34
|
protected broadcast(event: TaRemoteEvent): void;
|
|
36
35
|
protected check(host: string): string;
|
|
37
36
|
protected connected(host: string): boolean;
|
|
38
|
-
protected parse(location: string): TaLocation.Remote | undefined;
|
|
39
37
|
}
|
|
40
38
|
export {};
|
|
@@ -69,13 +69,6 @@ let DefaultRemoteHosts = class DefaultRemoteHosts {
|
|
|
69
69
|
await this.disconnect(host);
|
|
70
70
|
this.workingDirectory.removeRecentHost(host);
|
|
71
71
|
}
|
|
72
|
-
async resolve(location) {
|
|
73
|
-
const remote = this.parse(location);
|
|
74
|
-
if (!remote || remote.path) {
|
|
75
|
-
return location;
|
|
76
|
-
}
|
|
77
|
-
return TaLocation.ssh(remote.host, (await this.client(remote.host).info()).cwd);
|
|
78
|
-
}
|
|
79
72
|
async disconnect(host) {
|
|
80
73
|
const ssh = this.hosts.get(host);
|
|
81
74
|
this.hosts.delete(host);
|
|
@@ -142,14 +135,6 @@ let DefaultRemoteHosts = class DefaultRemoteHosts {
|
|
|
142
135
|
var _b;
|
|
143
136
|
return (_b = (_a = this.hosts.get(host)) === null || _a === void 0 ? void 0 : _a.client.connected) !== null && _b !== void 0 ? _b : false;
|
|
144
137
|
}
|
|
145
|
-
parse(location) {
|
|
146
|
-
try {
|
|
147
|
-
return TaLocation.parse(location);
|
|
148
|
-
}
|
|
149
|
-
catch (error) {
|
|
150
|
-
throw TaErrors.invalidArgument(error.message, 'Write ssh://<host>/<absolute path>.');
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
138
|
};
|
|
154
139
|
__decorate([
|
|
155
140
|
Value(TA_REMOTE_OPTIONS),
|
|
@@ -23,8 +23,6 @@ export interface RemoteHosts {
|
|
|
23
23
|
add(host: string): void;
|
|
24
24
|
/** Disconnects and drops it from the list of those opened before. */
|
|
25
25
|
remove(host: string): Promise<void>;
|
|
26
|
-
/** The location with the home directory as its path when it has none. */
|
|
27
|
-
resolve(location: string): Promise<string>;
|
|
28
26
|
disconnect(host: string): Promise<void>;
|
|
29
27
|
/** Runs once a host is disconnected on purpose. */
|
|
30
28
|
onDisconnect(listener: (host: string) => void): () => void;
|
|
@@ -26,7 +26,7 @@ let TaRemoteServerImpl = class TaRemoteServerImpl {
|
|
|
26
26
|
return TaErrors.guard(() => this.hosts.remove(host));
|
|
27
27
|
}
|
|
28
28
|
resolveLocation(location) {
|
|
29
|
-
return TaErrors.guard(() => this.
|
|
29
|
+
return TaErrors.guard(() => this.environments.resolve(location));
|
|
30
30
|
}
|
|
31
31
|
forwardPort(port, cwd) {
|
|
32
32
|
return TaErrors.guard(async () => this.ports.forward(cwd || (await this.environments.defaultCwd()), port));
|
|
@@ -36,12 +36,12 @@ export declare class RemoteUiContext implements ExtensionUIContext {
|
|
|
36
36
|
setWidget(key: string, content: unknown, options?: {
|
|
37
37
|
placement?: 'aboveEditor' | 'belowEditor';
|
|
38
38
|
}): void;
|
|
39
|
+
setWorkingMessage(message?: string): void;
|
|
39
40
|
setTitle(title: string): void;
|
|
40
41
|
setEditorText(text: string): void;
|
|
41
42
|
pasteToEditor(text: string): void;
|
|
42
43
|
getEditorText(): string;
|
|
43
44
|
onTerminalInput(): () => void;
|
|
44
|
-
setWorkingMessage(): void;
|
|
45
45
|
setWorkingVisible(): void;
|
|
46
46
|
setWorkingIndicator(): void;
|
|
47
47
|
setHiddenThinkingLabel(): void;
|
|
@@ -72,6 +72,9 @@ export class RemoteUiContext {
|
|
|
72
72
|
this.keep(`widget:${key}`, (content === null || content === void 0 ? void 0 : content.length) ? request : undefined);
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
|
+
setWorkingMessage(message) {
|
|
76
|
+
this.publish({ type: 'working_message', message: message || undefined });
|
|
77
|
+
}
|
|
75
78
|
setTitle(title) {
|
|
76
79
|
this.tell({ method: 'setTitle', title });
|
|
77
80
|
}
|
|
@@ -88,7 +91,6 @@ export class RemoteUiContext {
|
|
|
88
91
|
onTerminalInput() {
|
|
89
92
|
return () => undefined;
|
|
90
93
|
}
|
|
91
|
-
setWorkingMessage() { }
|
|
92
94
|
setWorkingVisible() { }
|
|
93
95
|
setWorkingIndicator() { }
|
|
94
96
|
setHiddenThinkingLabel() { }
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { type Application, ApplicationLifecycle } from '@celljs/core';
|
|
2
|
+
import { type RpcConnection } from '@celljs/rpc/lib/node';
|
|
3
|
+
import { type TaFriend, type TaIdentity, type TaRoomEvent, type TaRoomInfo, type TaRoomRequest, TaRoomServer, type TaRooms, type TaRoomValue, type TaRoomWatch } from '@celljs/ta-protocol';
|
|
4
|
+
import type { RelayHubs } from '@celljs/ta-relay/lib/node';
|
|
5
|
+
import { type RelayBridge } from './relay-bridge.js';
|
|
6
|
+
/** The id of {@link RoomsBridge}. */
|
|
7
|
+
export declare const ROOMS_BRIDGE: unique symbol;
|
|
8
|
+
/**
|
|
9
|
+
* The rooms of this Ta (docs/design/ta-link.md 3): RelayHubs, connected to its rooms while ta serve runs, so that
|
|
10
|
+
* the owner hears who asks to join without a page open; the clients that watch hear what happens in them, and
|
|
11
|
+
* the server side of packages has them as TaExtensionHost.rooms.
|
|
12
|
+
*/
|
|
13
|
+
export declare class RoomsBridge implements ApplicationLifecycle<Application> {
|
|
14
|
+
protected readonly relay: RelayBridge;
|
|
15
|
+
/** The connections that watch, and what they hear: messages and the state too, or the state of some keys. */
|
|
16
|
+
protected readonly watchers: Map<RpcConnection, TaRoomWatch>;
|
|
17
|
+
get hubs(): RelayHubs;
|
|
18
|
+
readonly rooms: TaRooms;
|
|
19
|
+
onStart(): void;
|
|
20
|
+
onStop(): void;
|
|
21
|
+
/** `watch` undefined: no more. */
|
|
22
|
+
watch(connection: RpcConnection, watch: TaRoomWatch | undefined): void;
|
|
23
|
+
protected broadcast(event: TaRoomEvent): void;
|
|
24
|
+
protected static identity({ id, name }: TaIdentity): TaIdentity;
|
|
25
|
+
}
|
|
26
|
+
/** The rooms for clients (TaRoomServer): those of RoomsBridge, what goes wrong said as the errors of Ta. */
|
|
27
|
+
export declare class TaRoomServerImpl implements TaRoomServer {
|
|
28
|
+
protected readonly bridge: RoomsBridge;
|
|
29
|
+
protected get rooms(): TaRooms;
|
|
30
|
+
getIdentity(): Promise<TaIdentity>;
|
|
31
|
+
setName(name: string): Promise<TaIdentity>;
|
|
32
|
+
listRooms(): Promise<TaRoomInfo[]>;
|
|
33
|
+
createRoom(input: {
|
|
34
|
+
kind: string;
|
|
35
|
+
title: string;
|
|
36
|
+
view?: string;
|
|
37
|
+
}): Promise<TaRoomInfo>;
|
|
38
|
+
invite(room: string, options?: {
|
|
39
|
+
days?: number;
|
|
40
|
+
renew?: boolean;
|
|
41
|
+
}): Promise<{
|
|
42
|
+
link: string;
|
|
43
|
+
expiresAt: number;
|
|
44
|
+
}>;
|
|
45
|
+
join(link: string): Promise<TaRoomInfo>;
|
|
46
|
+
listRequests(): Promise<TaRoomRequest[]>;
|
|
47
|
+
answer(room: string, ask: string, accept: boolean): Promise<void>;
|
|
48
|
+
removeMember(room: string, member: string): Promise<void>;
|
|
49
|
+
leave(room: string): Promise<void>;
|
|
50
|
+
send(room: string, data: unknown, to?: string): Promise<void>;
|
|
51
|
+
getState(room: string, prefix?: string): Promise<Record<string, TaRoomValue>>;
|
|
52
|
+
setState(room: string, key: string, value: unknown, version?: number): Promise<{
|
|
53
|
+
ok: boolean;
|
|
54
|
+
version: number;
|
|
55
|
+
}>;
|
|
56
|
+
listFriends(): Promise<TaFriend[]>;
|
|
57
|
+
removeFriend(id: string): Promise<boolean>;
|
|
58
|
+
watch(messages?: boolean, state?: string[]): Promise<void>;
|
|
59
|
+
unwatch(): Promise<void>;
|
|
60
|
+
}
|
|
@@ -0,0 +1,155 @@
|
|
|
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
|
+
var RoomsBridge_1;
|
|
11
|
+
import { ApplicationLifecycle, Autowired, Component } from '@celljs/core';
|
|
12
|
+
import { Rpc } from '@celljs/rpc';
|
|
13
|
+
import { RpcContext } from '@celljs/rpc/lib/node';
|
|
14
|
+
import { TaClient, TaRoomServer, TaRoomWatchUtil, } from '@celljs/ta-protocol';
|
|
15
|
+
import { RELAY_BRIDGE } from './relay-bridge.js';
|
|
16
|
+
import { TaErrors } from './ta-errors.js';
|
|
17
|
+
/** The id of {@link RoomsBridge}. */
|
|
18
|
+
export const ROOMS_BRIDGE = Symbol('RoomsBridge');
|
|
19
|
+
/**
|
|
20
|
+
* The rooms of this Ta (docs/design/ta-link.md 3): RelayHubs, connected to its rooms while ta serve runs, so that
|
|
21
|
+
* the owner hears who asks to join without a page open; the clients that watch hear what happens in them, and
|
|
22
|
+
* the server side of packages has them as TaExtensionHost.rooms.
|
|
23
|
+
*/
|
|
24
|
+
let RoomsBridge = RoomsBridge_1 = class RoomsBridge {
|
|
25
|
+
constructor() {
|
|
26
|
+
/** The connections that watch, and what they hear: messages and the state too, or the state of some keys. */
|
|
27
|
+
this.watchers = new Map();
|
|
28
|
+
this.rooms = {
|
|
29
|
+
getIdentity: async () => RoomsBridge_1.identity(await this.hubs.identity()),
|
|
30
|
+
setName: async (name) => RoomsBridge_1.identity(await this.hubs.setName(name)),
|
|
31
|
+
listRooms: async () => this.hubs.list(),
|
|
32
|
+
createRoom: input => this.hubs.create(input),
|
|
33
|
+
invite: (room, options) => this.hubs.invite(room, options !== null && options !== void 0 ? options : {}),
|
|
34
|
+
join: link => this.hubs.join(link),
|
|
35
|
+
listRequests: () => this.hubs.requests(),
|
|
36
|
+
answer: (room, ask, accept) => this.hubs.answer(room, ask, accept),
|
|
37
|
+
removeMember: (room, member) => this.hubs.remove(room, member),
|
|
38
|
+
leave: room => this.hubs.leave(room),
|
|
39
|
+
send: (room, data, to) => this.hubs.send(room, data, to),
|
|
40
|
+
getState: (room, prefix) => this.hubs.getState(room, prefix),
|
|
41
|
+
setState: (room, key, value, version) => this.hubs.setState(room, key, value, version),
|
|
42
|
+
listFriends: async () => this.hubs.friends().map(({ id, name, rooms, metAt, seenAt }) => ({ id, name, rooms, metAt, seenAt })),
|
|
43
|
+
removeFriend: async (id) => this.hubs.removeFriend(id),
|
|
44
|
+
onEvent: listener => this.hubs.onEvent(listener),
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
get hubs() {
|
|
48
|
+
return this.relay.hubs;
|
|
49
|
+
}
|
|
50
|
+
onStart() {
|
|
51
|
+
this.hubs.onEvent(event => this.broadcast(event));
|
|
52
|
+
this.hubs.start();
|
|
53
|
+
}
|
|
54
|
+
onStop() {
|
|
55
|
+
this.hubs.stop();
|
|
56
|
+
}
|
|
57
|
+
/** `watch` undefined: no more. */
|
|
58
|
+
watch(connection, watch) {
|
|
59
|
+
if (watch === undefined) {
|
|
60
|
+
this.watchers.delete(connection);
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
if (!this.watchers.has(connection)) {
|
|
64
|
+
connection.onClose(() => this.watchers.delete(connection));
|
|
65
|
+
}
|
|
66
|
+
this.watchers.set(connection, watch);
|
|
67
|
+
}
|
|
68
|
+
broadcast(event) {
|
|
69
|
+
for (const [connection, watch] of this.watchers) {
|
|
70
|
+
if (!connection.closed && TaRoomWatchUtil.hears(watch, event)) {
|
|
71
|
+
connection
|
|
72
|
+
.client(TaClient)
|
|
73
|
+
.onRoomEvent(event)
|
|
74
|
+
.catch(() => undefined);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
static identity({ id, name }) {
|
|
79
|
+
return { id, name };
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
__decorate([
|
|
83
|
+
Autowired({ id: RELAY_BRIDGE, detached: true }),
|
|
84
|
+
__metadata("design:type", Function)
|
|
85
|
+
], RoomsBridge.prototype, "relay", void 0);
|
|
86
|
+
RoomsBridge = RoomsBridge_1 = __decorate([
|
|
87
|
+
Component([ROOMS_BRIDGE, ApplicationLifecycle])
|
|
88
|
+
], RoomsBridge);
|
|
89
|
+
export { RoomsBridge };
|
|
90
|
+
/** The rooms for clients (TaRoomServer): those of RoomsBridge, what goes wrong said as the errors of Ta. */
|
|
91
|
+
let TaRoomServerImpl = class TaRoomServerImpl {
|
|
92
|
+
get rooms() {
|
|
93
|
+
return this.bridge.rooms;
|
|
94
|
+
}
|
|
95
|
+
getIdentity() {
|
|
96
|
+
return TaErrors.guard(() => this.rooms.getIdentity());
|
|
97
|
+
}
|
|
98
|
+
setName(name) {
|
|
99
|
+
return TaErrors.guard(() => this.rooms.setName(name));
|
|
100
|
+
}
|
|
101
|
+
listRooms() {
|
|
102
|
+
return TaErrors.guard(() => this.rooms.listRooms());
|
|
103
|
+
}
|
|
104
|
+
createRoom(input) {
|
|
105
|
+
return TaErrors.guard(() => this.rooms.createRoom(input));
|
|
106
|
+
}
|
|
107
|
+
invite(room, options) {
|
|
108
|
+
return TaErrors.guard(() => this.rooms.invite(room, options !== null && options !== void 0 ? options : undefined));
|
|
109
|
+
}
|
|
110
|
+
join(link) {
|
|
111
|
+
return TaErrors.guard(() => this.rooms.join(link));
|
|
112
|
+
}
|
|
113
|
+
listRequests() {
|
|
114
|
+
return TaErrors.guard(() => this.rooms.listRequests());
|
|
115
|
+
}
|
|
116
|
+
answer(room, ask, accept) {
|
|
117
|
+
return TaErrors.guard(() => this.rooms.answer(room, ask, accept === true));
|
|
118
|
+
}
|
|
119
|
+
removeMember(room, member) {
|
|
120
|
+
return TaErrors.guard(() => this.rooms.removeMember(room, member));
|
|
121
|
+
}
|
|
122
|
+
leave(room) {
|
|
123
|
+
return TaErrors.guard(() => this.rooms.leave(room));
|
|
124
|
+
}
|
|
125
|
+
send(room, data, to) {
|
|
126
|
+
return TaErrors.guard(() => this.rooms.send(room, data, to !== null && to !== void 0 ? to : undefined));
|
|
127
|
+
}
|
|
128
|
+
getState(room, prefix) {
|
|
129
|
+
return TaErrors.guard(() => this.rooms.getState(room, prefix !== null && prefix !== void 0 ? prefix : undefined));
|
|
130
|
+
}
|
|
131
|
+
setState(room, key, value, version) {
|
|
132
|
+
return TaErrors.guard(() => this.rooms.setState(room, key, value, version !== null && version !== void 0 ? version : undefined));
|
|
133
|
+
}
|
|
134
|
+
listFriends() {
|
|
135
|
+
return TaErrors.guard(() => this.rooms.listFriends());
|
|
136
|
+
}
|
|
137
|
+
removeFriend(id) {
|
|
138
|
+
return TaErrors.guard(() => this.rooms.removeFriend(id));
|
|
139
|
+
}
|
|
140
|
+
async watch(messages, state) {
|
|
141
|
+
this.bridge.watch(RpcContext.requireConnection(), TaRoomWatchUtil.of(messages !== null && messages !== void 0 ? messages : undefined, state));
|
|
142
|
+
}
|
|
143
|
+
async unwatch() {
|
|
144
|
+
this.bridge.watch(RpcContext.requireConnection(), undefined);
|
|
145
|
+
}
|
|
146
|
+
};
|
|
147
|
+
__decorate([
|
|
148
|
+
Autowired(ROOMS_BRIDGE),
|
|
149
|
+
__metadata("design:type", RoomsBridge)
|
|
150
|
+
], TaRoomServerImpl.prototype, "bridge", void 0);
|
|
151
|
+
TaRoomServerImpl = __decorate([
|
|
152
|
+
Rpc(TaRoomServer)
|
|
153
|
+
], TaRoomServerImpl);
|
|
154
|
+
export { TaRoomServerImpl };
|
|
155
|
+
//# sourceMappingURL=rooms-bridge.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type CodingAgentOptions } from '@celljs/ai-coding-agent';
|
|
2
|
-
import type { TaSavedSessionInfo } from '@celljs/ta-protocol';
|
|
2
|
+
import type { TaSavedSessionInfo, TaSavedSessionQuery } from '@celljs/ta-protocol';
|
|
3
3
|
import { TaSessionCatalog } from './host-protocol.js';
|
|
4
4
|
import { PiDirectories } from './remote/remote-protocol.js';
|
|
5
5
|
/** What a list shows of a session file, with the directory pi worked in, before it is a location. */
|
|
@@ -60,10 +60,14 @@ export declare class DefaultTaSessionCatalog implements TaSessionCatalog {
|
|
|
60
60
|
version: string;
|
|
61
61
|
summary?: SessionSummary;
|
|
62
62
|
}>;
|
|
63
|
-
list(open?: ReadonlySet<string
|
|
63
|
+
list(open?: ReadonlySet<string>, query?: TaSavedSessionQuery): Promise<TaSavedSessionInfo[]>;
|
|
64
64
|
/** Where pi keeps the sessions it creates (SessionManager.create without a directory). */
|
|
65
65
|
protected sessionsDir(): Promise<string>;
|
|
66
66
|
protected files(root: string): Promise<string[]>;
|
|
67
|
-
|
|
67
|
+
/**
|
|
68
|
+
* What the file holds; undefined, without reading it, when it was last written before `since`: its last
|
|
69
|
+
* message came before then too, and a list of a window leaves it out (an archive of thousands is not read).
|
|
70
|
+
*/
|
|
71
|
+
protected summary(file: string, since?: number): Promise<SessionSummary | undefined>;
|
|
68
72
|
}
|
|
69
73
|
export {};
|
|
@@ -74,6 +74,7 @@ export var SessionCatalogUtil;
|
|
|
74
74
|
let header;
|
|
75
75
|
let sessionName;
|
|
76
76
|
let firstMessage;
|
|
77
|
+
const messages = [];
|
|
77
78
|
let messageCount = 0;
|
|
78
79
|
let updatedAt;
|
|
79
80
|
const marks = [];
|
|
@@ -99,6 +100,7 @@ export var SessionCatalogUtil;
|
|
|
99
100
|
const message = entry.message;
|
|
100
101
|
messageCount++;
|
|
101
102
|
firstMessage !== null && firstMessage !== void 0 ? firstMessage : (firstMessage = SessionInfoUtil.firstMessage([message]));
|
|
103
|
+
messages.push(message);
|
|
102
104
|
if (typeof message.timestamp === 'number') {
|
|
103
105
|
updatedAt = Math.max(updatedAt !== null && updatedAt !== void 0 ? updatedAt : 0, message.timestamp);
|
|
104
106
|
}
|
|
@@ -114,6 +116,7 @@ export var SessionCatalogUtil;
|
|
|
114
116
|
piCwd: typeof header.cwd === 'string' ? header.cwd : '',
|
|
115
117
|
sessionName,
|
|
116
118
|
firstMessage,
|
|
119
|
+
lastMessage: SessionInfoUtil.lastMessage(messages),
|
|
117
120
|
messageCount,
|
|
118
121
|
createdAt,
|
|
119
122
|
updatedAt: updatedAt !== null && updatedAt !== void 0 ? updatedAt : createdAt,
|
|
@@ -143,15 +146,16 @@ let DefaultTaSessionCatalog = class DefaultTaSessionCatalog {
|
|
|
143
146
|
/** By file: its size and time when read, and what it held. */
|
|
144
147
|
this.cache = new Map();
|
|
145
148
|
}
|
|
146
|
-
async list(open = new Set()) {
|
|
149
|
+
async list(open = new Set(), query = {}) {
|
|
147
150
|
const files = await this.files(await this.sessionsDir());
|
|
148
151
|
// An open session's file grows with every message: it is not read again for a list that leaves it out.
|
|
149
152
|
const closed = files.filter(file => !open.has(file));
|
|
153
|
+
const { since, before } = query;
|
|
150
154
|
const sessions = [];
|
|
151
155
|
for (let i = 0; i < closed.length; i += BATCH) {
|
|
152
156
|
await Promise.all(closed.slice(i, i + BATCH).map(async (file) => {
|
|
153
|
-
const summary = await this.summary(file);
|
|
154
|
-
if (summary) {
|
|
157
|
+
const summary = await this.summary(file, since);
|
|
158
|
+
if (summary && (since === undefined || summary.updatedAt >= since) && (before === undefined || summary.updatedAt < before)) {
|
|
155
159
|
const { piCwd, ...info } = summary;
|
|
156
160
|
sessions.push({ ...info, sessionFile: file, cwd: piCwd && this.directories.fromPi(piCwd) });
|
|
157
161
|
}
|
|
@@ -182,7 +186,11 @@ let DefaultTaSessionCatalog = class DefaultTaSessionCatalog {
|
|
|
182
186
|
}));
|
|
183
187
|
return files.flat();
|
|
184
188
|
}
|
|
185
|
-
|
|
189
|
+
/**
|
|
190
|
+
* What the file holds; undefined, without reading it, when it was last written before `since`: its last
|
|
191
|
+
* message came before then too, and a list of a window leaves it out (an archive of thousands is not read).
|
|
192
|
+
*/
|
|
193
|
+
async summary(file, since) {
|
|
186
194
|
const stats = await stat(file).catch(() => undefined);
|
|
187
195
|
if (!(stats === null || stats === void 0 ? void 0 : stats.isFile())) {
|
|
188
196
|
return undefined;
|
|
@@ -192,6 +200,9 @@ let DefaultTaSessionCatalog = class DefaultTaSessionCatalog {
|
|
|
192
200
|
if ((cached === null || cached === void 0 ? void 0 : cached.version) === version) {
|
|
193
201
|
return cached.summary;
|
|
194
202
|
}
|
|
203
|
+
if (since !== undefined && stats.mtimeMs < since) {
|
|
204
|
+
return undefined;
|
|
205
|
+
}
|
|
195
206
|
const text = await readFile(file, 'utf8').catch(() => undefined);
|
|
196
207
|
const summary = text === undefined ? undefined : SessionCatalogUtil.summarize(text, stats.mtimeMs);
|
|
197
208
|
this.cache.set(file, { version, summary });
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { TaClientToolDefinition } from '@celljs/ta-protocol';
|
|
2
|
+
export declare const TaSessionHandles: unique symbol;
|
|
3
|
+
/** What opens a session again under the id clients have: its file, where it works, the tools its clients run. */
|
|
4
|
+
export interface TaSessionHandle {
|
|
5
|
+
sessionFile: string;
|
|
6
|
+
cwd: string;
|
|
7
|
+
clientTools?: TaClientToolDefinition[];
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* The ids of the sessions ta serve gave, with what opens each again. A session closed while idle, or by a
|
|
11
|
+
* restart, keeps its id: the next call with it opens it again (TaSessionRegistry.resolve), so that a page
|
|
12
|
+
* that slept through it carries on rather than failing with CELL_TA_SESSION_NOT_FOUND. Only a session
|
|
13
|
+
* closed for good (closeSession, an extension that ends it) loses its id.
|
|
14
|
+
*/
|
|
15
|
+
export interface TaSessionHandles {
|
|
16
|
+
get(sessionId: string): TaSessionHandle | undefined;
|
|
17
|
+
/** The id kept for a session file. */
|
|
18
|
+
idOf(sessionFile: string): string | undefined;
|
|
19
|
+
set(sessionId: string, handle: TaSessionHandle): void;
|
|
20
|
+
delete(sessionId: string): void;
|
|
21
|
+
}
|
|
22
|
+
/** In ta-sessions.json of the agent directory, the latest last; kept across restarts. */
|
|
23
|
+
export declare class TaSessionHandlesImpl implements TaSessionHandles {
|
|
24
|
+
protected readonly file: string;
|
|
25
|
+
protected cache?: Map<string, TaSessionHandle>;
|
|
26
|
+
get(sessionId: string): TaSessionHandle | undefined;
|
|
27
|
+
idOf(sessionFile: string): string | undefined;
|
|
28
|
+
set(sessionId: string, handle: TaSessionHandle): void;
|
|
29
|
+
delete(sessionId: string): void;
|
|
30
|
+
protected read(): Map<string, TaSessionHandle>;
|
|
31
|
+
protected write(handles: Map<string, TaSessionHandle>): void;
|
|
32
|
+
}
|
|
@@ -0,0 +1,86 @@
|
|
|
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 { readFileSync, renameSync, writeFileSync } from 'node:fs';
|
|
8
|
+
import { join } from 'node:path';
|
|
9
|
+
import { Component } from '@celljs/core';
|
|
10
|
+
import { TaBrand } from '@celljs/ta-harness/lib/node/ta-brand';
|
|
11
|
+
export const TaSessionHandles = Symbol('TaSessionHandles');
|
|
12
|
+
/** Handles kept: the latest ones, as a client that slept longer has the conversation in its list again. */
|
|
13
|
+
const MAX_HANDLES = 200;
|
|
14
|
+
/** In ta-sessions.json of the agent directory, the latest last; kept across restarts. */
|
|
15
|
+
let TaSessionHandlesImpl = class TaSessionHandlesImpl {
|
|
16
|
+
constructor() {
|
|
17
|
+
this.file = join(TaBrand.agentDir(), 'ta-sessions.json');
|
|
18
|
+
}
|
|
19
|
+
get(sessionId) {
|
|
20
|
+
return this.read().get(sessionId);
|
|
21
|
+
}
|
|
22
|
+
idOf(sessionFile) {
|
|
23
|
+
for (const [id, handle] of this.read()) {
|
|
24
|
+
if (handle.sessionFile === sessionFile) {
|
|
25
|
+
return id;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
return undefined;
|
|
29
|
+
}
|
|
30
|
+
set(sessionId, handle) {
|
|
31
|
+
const handles = this.read();
|
|
32
|
+
// One id per file: the file opened under another is reached by that one.
|
|
33
|
+
for (const [id, other] of handles) {
|
|
34
|
+
if (id !== sessionId && other.sessionFile === handle.sessionFile) {
|
|
35
|
+
handles.delete(id);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
handles.delete(sessionId);
|
|
39
|
+
handles.set(sessionId, handle);
|
|
40
|
+
for (const id of handles.keys()) {
|
|
41
|
+
if (handles.size <= MAX_HANDLES) {
|
|
42
|
+
break;
|
|
43
|
+
}
|
|
44
|
+
handles.delete(id);
|
|
45
|
+
}
|
|
46
|
+
this.write(handles);
|
|
47
|
+
}
|
|
48
|
+
delete(sessionId) {
|
|
49
|
+
const handles = this.read();
|
|
50
|
+
if (handles.delete(sessionId)) {
|
|
51
|
+
this.write(handles);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
read() {
|
|
55
|
+
if (!this.cache) {
|
|
56
|
+
this.cache = new Map();
|
|
57
|
+
try {
|
|
58
|
+
const data = JSON.parse(readFileSync(this.file, 'utf8'));
|
|
59
|
+
for (const [id, handle] of Object.entries(data && typeof data === 'object' && !Array.isArray(data) ? data : {})) {
|
|
60
|
+
const { sessionFile, cwd } = (handle !== null && handle !== void 0 ? handle : {});
|
|
61
|
+
if (typeof sessionFile === 'string' && typeof cwd === 'string') {
|
|
62
|
+
this.cache.set(id, handle);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
catch (_a) {
|
|
67
|
+
// None yet, or not readable: no handles.
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
return this.cache;
|
|
71
|
+
}
|
|
72
|
+
write(handles) {
|
|
73
|
+
try {
|
|
74
|
+
writeFileSync(`${this.file}.tmp`, `${JSON.stringify(Object.fromEntries(handles))}\n`, { mode: 0o600 });
|
|
75
|
+
renameSync(`${this.file}.tmp`, this.file);
|
|
76
|
+
}
|
|
77
|
+
catch (_a) {
|
|
78
|
+
// Kept in memory: only a restart forgets them.
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
TaSessionHandlesImpl = __decorate([
|
|
83
|
+
Component(TaSessionHandles)
|
|
84
|
+
], TaSessionHandlesImpl);
|
|
85
|
+
export { TaSessionHandlesImpl };
|
|
86
|
+
//# sourceMappingURL=session-handles.js.map
|
|
@@ -11,6 +11,13 @@ export declare namespace SessionInfoUtil {
|
|
|
11
11
|
* a skill the user ran is `/skill:name` and what follows, not the skill's file.
|
|
12
12
|
*/
|
|
13
13
|
function firstMessage(messages: readonly MessageLike[]): string | undefined;
|
|
14
|
+
/**
|
|
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
|
+
* length, as a messaging app shows the last thing said under its name: without its context, the marks of
|
|
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.
|
|
19
|
+
*/
|
|
20
|
+
function lastMessage(messages: readonly MessageLike[]): string | undefined;
|
|
14
21
|
/** The time of the last message that has one, else `fallback`. */
|
|
15
22
|
function updatedAt(messages: readonly MessageLike[], fallback: number): number;
|
|
16
23
|
/** The text of the content of a message. */
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import { TaMessageContext, TaSkillUse } from '@celljs/ta-protocol';
|
|
1
|
+
import { TaAgentSummary, TaImageNote, TaMessageContext, TaSkillUse } 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) {
|
|
5
5
|
const LENGTH = 120;
|
|
6
|
+
/** Of the text of the last message, what lastMessage reads: its lines are joined, many of them empty or marks only. */
|
|
7
|
+
const PREVIEW_READ = 2000;
|
|
6
8
|
/**
|
|
7
9
|
* The first line of the first message of the user that has text, without its context, cut to a title's length;
|
|
8
10
|
* a skill the user ran is `/skill:name` and what follows, not the skill's file.
|
|
@@ -12,9 +14,7 @@ export var SessionInfoUtil;
|
|
|
12
14
|
if (message.role !== 'user') {
|
|
13
15
|
continue;
|
|
14
16
|
}
|
|
15
|
-
const
|
|
16
|
-
const skill = TaSkillUse.parse(said);
|
|
17
|
-
const line = (skill ? TaSkillUse.command(skill) : said)
|
|
17
|
+
const line = userWords(text(message.content))
|
|
18
18
|
.split('\n')
|
|
19
19
|
.map(part => part.trim())
|
|
20
20
|
.find(Boolean);
|
|
@@ -25,6 +25,65 @@ export var SessionInfoUtil;
|
|
|
25
25
|
return undefined;
|
|
26
26
|
}
|
|
27
27
|
SessionInfoUtil.firstMessage = firstMessage;
|
|
28
|
+
/**
|
|
29
|
+
* 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
|
+
* length, as a messaging app shows the last thing said under its name: without its context, the marks of
|
|
31
|
+
* 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
|
+
*/
|
|
34
|
+
function lastMessage(messages) {
|
|
35
|
+
for (let i = messages.length - 1; i >= 0; i--) {
|
|
36
|
+
const message = messages[i];
|
|
37
|
+
if (message.role !== 'user' && message.role !== 'assistant') {
|
|
38
|
+
continue;
|
|
39
|
+
}
|
|
40
|
+
const said = message.role === 'user' ? userWords(text(message.content)) : TaAgentSummary.strip(text(message.content));
|
|
41
|
+
// A list asks for it every few seconds: only the start of a long reply is read, enough for a preview.
|
|
42
|
+
const read = said.slice(0, PREVIEW_READ);
|
|
43
|
+
const line = (withoutFences(read) || read)
|
|
44
|
+
.split('\n')
|
|
45
|
+
.map(part => part
|
|
46
|
+
.replace(/^\s*(?:#{1,6}\s+|>\s*|[-*+]\s+|\d+\.\s+)/, '')
|
|
47
|
+
.replace(/[*_`]{1,3}/g, '')
|
|
48
|
+
.trim())
|
|
49
|
+
.filter(Boolean)
|
|
50
|
+
.join(' ')
|
|
51
|
+
.replace(/\s+/g, ' ');
|
|
52
|
+
if (line) {
|
|
53
|
+
return line.length > LENGTH ? `${line.slice(0, LENGTH - 1)}…` : line;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
return undefined;
|
|
57
|
+
}
|
|
58
|
+
SessionInfoUtil.lastMessage = lastMessage;
|
|
59
|
+
/**
|
|
60
|
+
* The text without its fenced blocks, as a messenger says no more than [code] of them: code, and the cards a
|
|
61
|
+
* reply draws (a card's language, as `ta-glance`), are not what was said.
|
|
62
|
+
*/
|
|
63
|
+
function withoutFences(text) {
|
|
64
|
+
var _a;
|
|
65
|
+
const kept = [];
|
|
66
|
+
let fence;
|
|
67
|
+
for (const line of text.split('\n')) {
|
|
68
|
+
const mark = (_a = /^\s*(`{3,}|~{3,})/.exec(line)) === null || _a === void 0 ? void 0 : _a[1];
|
|
69
|
+
if (!fence && mark) {
|
|
70
|
+
fence = mark;
|
|
71
|
+
}
|
|
72
|
+
else if (fence && mark && mark[0] === fence[0] && mark.length >= fence.length && !line.trim().slice(mark.length)) {
|
|
73
|
+
fence = undefined;
|
|
74
|
+
}
|
|
75
|
+
else if (!fence) {
|
|
76
|
+
kept.push(line);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
return kept.join('\n').trim();
|
|
80
|
+
}
|
|
81
|
+
/** 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
|
+
function userWords(content) {
|
|
83
|
+
const said = TaImageNote.strip(TaMessageContext.strip(content));
|
|
84
|
+
const skill = TaSkillUse.parse(said);
|
|
85
|
+
return skill ? TaSkillUse.command(skill) : said;
|
|
86
|
+
}
|
|
28
87
|
/** The time of the last message that has one, else `fallback`. */
|
|
29
88
|
function updatedAt(messages, fallback) {
|
|
30
89
|
for (let i = messages.length - 1; i >= 0; i--) {
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { RpcConnection } from '@celljs/rpc/lib/node';
|
|
2
|
+
import { type TaSessionInfo } from '@celljs/ta-protocol';
|
|
3
|
+
/** At most one list per connection in this time, the latest; the first change leaves at once. */
|
|
4
|
+
export declare const SESSION_LIST_MS = 250;
|
|
5
|
+
interface Watcher {
|
|
6
|
+
timer?: ReturnType<typeof setTimeout>;
|
|
7
|
+
lastAt: number;
|
|
8
|
+
/** The list it was sent last, as JSON: the same again is not sent. */
|
|
9
|
+
sent?: string;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* The open sessions told to the connections that watch them (TaServer.watchSessions): the whole list each time
|
|
13
|
+
* what a list shows of it changes, so that every page shows the same at once, rather than what it read a few
|
|
14
|
+
* seconds before. A session streams hundreds of events a second, of which few change the list: those come
|
|
15
|
+
* here (`changed`), and a moment of them leaves as one list, only when it differs from the one sent.
|
|
16
|
+
*/
|
|
17
|
+
export declare class SessionListFeed {
|
|
18
|
+
protected readonly list: () => TaSessionInfo[];
|
|
19
|
+
protected readonly intervalMs: number;
|
|
20
|
+
protected readonly watchers: Map<RpcConnection, Watcher>;
|
|
21
|
+
constructor(list: () => TaSessionInfo[], intervalMs?: number);
|
|
22
|
+
/** The list now; the connection is told of each change from now on, until it closes. */
|
|
23
|
+
watch(connection: RpcConnection): TaSessionInfo[];
|
|
24
|
+
/** What a list shows changed: a session opened or closed, or one of them changed. */
|
|
25
|
+
changed(): void;
|
|
26
|
+
protected schedule(connection: RpcConnection, watcher: Watcher): void;
|
|
27
|
+
}
|
|
28
|
+
export {};
|