@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
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AgentExtension, AgentTool, type CodingAgentOptions, ModelRuntimeProvider, type PiSdk } from '@celljs/ai-coding-agent';
|
|
2
2
|
import { type ExecEnvironment, ExecEnvironmentFactory } from '@celljs/ta-exec';
|
|
3
3
|
import { type ContextFile, type InlineExtension, SessionLock } from '@celljs/ta-harness';
|
|
4
|
-
import type { TaOpenSessionOptions } from '@celljs/ta-protocol';
|
|
4
|
+
import type { TaOpenSessionOptions, TaSlashCommand } from '@celljs/ta-protocol';
|
|
5
5
|
import { ExtensionProviders } from './extension-providers';
|
|
6
6
|
import { type TaHostOptions, TaSessionFactory } from './host-protocol';
|
|
7
7
|
import { PackageHosts } from './package-hosts';
|
|
@@ -12,7 +12,25 @@ type AgentsFilesOverride = (base: {
|
|
|
12
12
|
}) => {
|
|
13
13
|
agentsFiles: ContextFile[];
|
|
14
14
|
};
|
|
15
|
+
export declare namespace SessionFileUtil {
|
|
16
|
+
/**
|
|
17
|
+
* The directory pi is to work in for a session file it opens: none for a file that says (pi reads it from
|
|
18
|
+
* its header); `cwd`, where the caller asks, for one with no header yet. pi writes a file once the agent
|
|
19
|
+
* first answered, so the file of a session opened and never answered (an agent made but not yet asked) is
|
|
20
|
+
* not there, and pi would take the directory ta serve runs in, the home directory under the desktop app.
|
|
21
|
+
*/
|
|
22
|
+
function cwdOverride(sessionFile: string, cwd: string): string | undefined;
|
|
23
|
+
}
|
|
15
24
|
type ModelRuntime = import('@earendil-works/pi-coding-agent', { with: { 'resolution-mode': 'import' } }).ModelRuntime;
|
|
25
|
+
type AgentSessionServices = import('@earendil-works/pi-coding-agent', { with: { 'resolution-mode': 'import' } }).AgentSessionServices;
|
|
26
|
+
interface ServicesOptions {
|
|
27
|
+
cwd: string;
|
|
28
|
+
agentDir: string;
|
|
29
|
+
modelRuntime: ModelRuntime;
|
|
30
|
+
lock: SessionLock;
|
|
31
|
+
appendSystemPrompt?: string;
|
|
32
|
+
commandsOnly?: boolean;
|
|
33
|
+
}
|
|
16
34
|
type SessionManager = import('@earendil-works/pi-coding-agent', { with: { 'resolution-mode': 'import' } }).SessionManager;
|
|
17
35
|
type Model = NonNullable<import('@earendil-works/pi-coding-agent', { with: { 'resolution-mode': 'import' } }).AgentSession['model']>;
|
|
18
36
|
/** Sets up pi for each session the way its command does, with one model runtime for all of them. */
|
|
@@ -26,7 +44,13 @@ export declare class DefaultTaSessionFactory implements TaSessionFactory {
|
|
|
26
44
|
protected readonly packageHosts: PackageHosts;
|
|
27
45
|
protected readonly directories: PiDirectories;
|
|
28
46
|
protected readonly extensionProviders: ExtensionProviders;
|
|
29
|
-
create(requested: TaOpenSessionOptions, requestClose: (session: TaSession) => void): Promise<TaSession>;
|
|
47
|
+
create(requested: TaOpenSessionOptions, requestClose: (session: TaSession, idle?: boolean) => void, id?: string): Promise<TaSession>;
|
|
48
|
+
commands(cwd: string): Promise<TaSlashCommand[]>;
|
|
49
|
+
/**
|
|
50
|
+
* pi's services of a session in `cwd` (a directory of pi): its settings, its resources and extensions with
|
|
51
|
+
* those of Ta. `commandsOnly`: for what a session would have, the context files of another machine not read.
|
|
52
|
+
*/
|
|
53
|
+
protected services(sdk: PiSdk, options: ServicesOptions): Promise<AgentSessionServices>;
|
|
30
54
|
protected openSessionManager(sdk: PiSdk, options: TaOpenSessionOptions): SessionManager;
|
|
31
55
|
/**
|
|
32
56
|
* For another machine, its context files (AGENTS.md...) instead of those pi finds above the directory
|
|
@@ -9,7 +9,8 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
9
9
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.DefaultTaSessionFactory = void 0;
|
|
12
|
+
exports.DefaultTaSessionFactory = exports.SessionFileUtil = void 0;
|
|
13
|
+
const node_fs_1 = require("node:fs");
|
|
13
14
|
const node_path_1 = require("node:path");
|
|
14
15
|
const ai_coding_agent_1 = require("@celljs/ai-coding-agent");
|
|
15
16
|
const core_1 = require("@celljs/core");
|
|
@@ -23,15 +24,34 @@ const package_hosts_1 = require("./package-hosts");
|
|
|
23
24
|
const remote_protocol_1 = require("./remote/remote-protocol");
|
|
24
25
|
const session_catalog_1 = require("./session-catalog");
|
|
25
26
|
const session_files_1 = require("./session-files");
|
|
27
|
+
const slash_command_util_1 = require("./slash-command-util");
|
|
26
28
|
const ta_errors_1 = require("./ta-errors");
|
|
27
29
|
const ta_session_1 = require("./ta-session");
|
|
30
|
+
var SessionFileUtil;
|
|
31
|
+
(function (SessionFileUtil) {
|
|
32
|
+
/**
|
|
33
|
+
* The directory pi is to work in for a session file it opens: none for a file that says (pi reads it from
|
|
34
|
+
* its header); `cwd`, where the caller asks, for one with no header yet. pi writes a file once the agent
|
|
35
|
+
* first answered, so the file of a session opened and never answered (an agent made but not yet asked) is
|
|
36
|
+
* not there, and pi would take the directory ta serve runs in, the home directory under the desktop app.
|
|
37
|
+
*/
|
|
38
|
+
function cwdOverride(sessionFile, cwd) {
|
|
39
|
+
try {
|
|
40
|
+
return (0, node_fs_1.statSync)(sessionFile).size > 0 ? undefined : cwd;
|
|
41
|
+
}
|
|
42
|
+
catch (_a) {
|
|
43
|
+
return cwd;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
SessionFileUtil.cwdOverride = cwdOverride;
|
|
47
|
+
})(SessionFileUtil || (exports.SessionFileUtil = SessionFileUtil = {}));
|
|
28
48
|
/** Sets up pi for each session the way its command does, with one model runtime for all of them. */
|
|
29
49
|
let DefaultTaSessionFactory = class DefaultTaSessionFactory {
|
|
30
50
|
constructor() {
|
|
31
51
|
this.extensions = [];
|
|
32
52
|
this.tools = [];
|
|
33
53
|
}
|
|
34
|
-
async create(requested, requestClose) {
|
|
54
|
+
async create(requested, requestClose, id) {
|
|
35
55
|
var _a;
|
|
36
56
|
var _b, _c, _d;
|
|
37
57
|
const clientTools = new client_tool_broker_1.ClientToolBroker(requested.clientTools);
|
|
@@ -63,20 +83,7 @@ let DefaultTaSessionFactory = class DefaultTaSessionFactory {
|
|
|
63
83
|
const model = options.model ? this.resolveModel(modelRuntime, options.model) : undefined;
|
|
64
84
|
const runtime = await sdk.createAgentSessionRuntime(async ({ cwd, agentDir: dir, sessionManager: manager, sessionStartEvent }) => {
|
|
65
85
|
var _a;
|
|
66
|
-
const
|
|
67
|
-
const settingsManager = sdk.SettingsManager.create(cwd, dir, { projectTrusted: this.isTrusted(sdk, cwd, dir) });
|
|
68
|
-
const services = await sdk.createAgentSessionServices({
|
|
69
|
-
cwd,
|
|
70
|
-
agentDir: dir,
|
|
71
|
-
settingsManager,
|
|
72
|
-
modelRuntime,
|
|
73
|
-
resourceLoaderOptions: {
|
|
74
|
-
...ta_harness_1.TaPackages.loaderOptions(dir),
|
|
75
|
-
...(await this.contextFiles(environment, dir)),
|
|
76
|
-
extensionFactories: this.extensionFactories(sdk, environment, cwd, lock),
|
|
77
|
-
appendSystemPrompt: options.appendSystemPrompt ? [options.appendSystemPrompt] : undefined,
|
|
78
|
-
},
|
|
79
|
-
});
|
|
86
|
+
const services = await this.services(sdk, { cwd, agentDir: dir, modelRuntime, lock, appendSystemPrompt: options.appendSystemPrompt });
|
|
80
87
|
const created = await sdk.createAgentSessionFromServices({
|
|
81
88
|
services,
|
|
82
89
|
sessionManager: manager,
|
|
@@ -93,6 +100,7 @@ let DefaultTaSessionFactory = class DefaultTaSessionFactory {
|
|
|
93
100
|
clientTools,
|
|
94
101
|
options: this.options,
|
|
95
102
|
requestClose,
|
|
103
|
+
id,
|
|
96
104
|
group: options.group,
|
|
97
105
|
role: options.appendSystemPrompt,
|
|
98
106
|
locate: cwd => this.directories.fromPi(cwd),
|
|
@@ -105,12 +113,52 @@ let DefaultTaSessionFactory = class DefaultTaSessionFactory {
|
|
|
105
113
|
throw error;
|
|
106
114
|
}
|
|
107
115
|
}
|
|
116
|
+
async commands(cwd) {
|
|
117
|
+
var _a;
|
|
118
|
+
var _b;
|
|
119
|
+
const sdk = await ai_coding_agent_1.PiSdkUtil.load();
|
|
120
|
+
const agentDir = (_b = (_a = this.codingAgentOptions) === null || _a === void 0 ? void 0 : _a.agentDir) !== null && _b !== void 0 ? _b : sdk.getAgentDir();
|
|
121
|
+
const services = await this.services(sdk, {
|
|
122
|
+
cwd: this.directories.toPi(cwd),
|
|
123
|
+
agentDir,
|
|
124
|
+
modelRuntime: await this.modelRuntimeProvider.provide(),
|
|
125
|
+
lock: new ta_harness_1.SessionLock(),
|
|
126
|
+
commandsOnly: true,
|
|
127
|
+
});
|
|
128
|
+
const loader = services.resourceLoader;
|
|
129
|
+
return slash_command_util_1.SlashCommandUtil.list({
|
|
130
|
+
commands: slash_command_util_1.SlashCommandUtil.invocationNames(loader.getExtensions().extensions.flatMap(extension => [...extension.commands.values()])),
|
|
131
|
+
prompts: loader.getPrompts().prompts,
|
|
132
|
+
skills: loader.getSkills().skills,
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* pi's services of a session in `cwd` (a directory of pi): its settings, its resources and extensions with
|
|
137
|
+
* those of Ta. `commandsOnly`: for what a session would have, the context files of another machine not read.
|
|
138
|
+
*/
|
|
139
|
+
async services(sdk, options) {
|
|
140
|
+
const { cwd, agentDir, modelRuntime, lock, appendSystemPrompt, commandsOnly } = options;
|
|
141
|
+
const environment = this.environments.create(this.directories.fromPi(cwd));
|
|
142
|
+
const settingsManager = sdk.SettingsManager.create(cwd, agentDir, { projectTrusted: this.isTrusted(sdk, cwd, agentDir) });
|
|
143
|
+
return sdk.createAgentSessionServices({
|
|
144
|
+
cwd,
|
|
145
|
+
agentDir,
|
|
146
|
+
settingsManager,
|
|
147
|
+
modelRuntime,
|
|
148
|
+
resourceLoaderOptions: {
|
|
149
|
+
...ta_harness_1.TaPackages.loaderOptions(agentDir),
|
|
150
|
+
...(commandsOnly ? {} : await this.contextFiles(environment, agentDir)),
|
|
151
|
+
extensionFactories: this.extensionFactories(sdk, environment, cwd, lock),
|
|
152
|
+
appendSystemPrompt: appendSystemPrompt ? [appendSystemPrompt] : undefined,
|
|
153
|
+
},
|
|
154
|
+
});
|
|
155
|
+
}
|
|
108
156
|
openSessionManager(sdk, options) {
|
|
109
157
|
if (!options.sessionFile) {
|
|
110
158
|
return sdk.SessionManager.create(options.cwd);
|
|
111
159
|
}
|
|
112
160
|
try {
|
|
113
|
-
return sdk.SessionManager.open(options.sessionFile);
|
|
161
|
+
return sdk.SessionManager.open(options.sessionFile, undefined, SessionFileUtil.cwdOverride(options.sessionFile, options.cwd));
|
|
114
162
|
}
|
|
115
163
|
catch (error) {
|
|
116
164
|
throw ta_errors_1.TaErrors.invalidArgument(`Cannot open the session ${options.sessionFile}: ${error.message}`, 'Pass a session file that exists; listSessions shows the open ones.');
|
|
@@ -1,23 +1,37 @@
|
|
|
1
1
|
import type { RpcConnection } from '@celljs/rpc/lib/node';
|
|
2
|
-
import type { TaOpenSessionOptions } from '@celljs/ta-protocol';
|
|
2
|
+
import type { TaOpenSessionOptions, TaSessionInfo } from '@celljs/ta-protocol';
|
|
3
3
|
import { ClientChannel } from './client-channel';
|
|
4
4
|
import { type TaHostOptions, TaSessionFactory, TaSessionRegistry } from './host-protocol';
|
|
5
|
+
import { TaSessionHandles } from './session-handles';
|
|
6
|
+
import { SessionListFeed } from './session-list-feed';
|
|
5
7
|
import type { TaSession } from './ta-session';
|
|
8
|
+
/**
|
|
9
|
+
* The open sessions. A session's id outlives its memory: closed while idle or by a restart, it opens again
|
|
10
|
+
* from its file under the same id at the next call (TaSessionHandles), so clients never see it go.
|
|
11
|
+
*/
|
|
6
12
|
export declare class DefaultTaSessionRegistry implements TaSessionRegistry {
|
|
7
13
|
protected readonly options: TaHostOptions;
|
|
8
14
|
protected readonly factory: TaSessionFactory;
|
|
15
|
+
protected readonly handles: TaSessionHandles;
|
|
9
16
|
protected readonly sessions: Map<string, TaSession>;
|
|
10
17
|
protected readonly channels: WeakMap<RpcConnection, ClientChannel>;
|
|
11
18
|
/** Sessions being created count against the limit too. */
|
|
12
19
|
protected opening: number;
|
|
13
20
|
/** The closes under way, by session file: out of the list already, their files locked until they end. */
|
|
14
21
|
protected readonly closing: Map<string, Promise<void>>;
|
|
22
|
+
/** Sessions opening again under their ids: the calls that come meanwhile wait for the same. */
|
|
23
|
+
protected readonly waking: Map<string, Promise<TaSession>>;
|
|
24
|
+
protected readonly feed: SessionListFeed;
|
|
15
25
|
open(options: TaOpenSessionOptions): Promise<TaSession>;
|
|
16
26
|
require(sessionId: string): TaSession;
|
|
27
|
+
resolve(sessionId: string): Promise<TaSession>;
|
|
17
28
|
list(): TaSession[];
|
|
18
|
-
|
|
29
|
+
watch(connection: RpcConnection): TaSessionInfo[];
|
|
30
|
+
close(sessionId: string, idle?: boolean): Promise<void>;
|
|
19
31
|
closeAll(): Promise<void>;
|
|
20
32
|
/** The one channel of a connection; it leaves every session when the connection ends. */
|
|
21
33
|
channel(connection: RpcConnection): ClientChannel;
|
|
34
|
+
/** `id`: the id it had, to open it again under. */
|
|
35
|
+
protected create(options: TaOpenSessionOptions, id: string | undefined): Promise<TaSession>;
|
|
22
36
|
}
|
|
23
37
|
//# sourceMappingURL=ta-session-registry.d.ts.map
|
|
@@ -10,10 +10,17 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.DefaultTaSessionRegistry = void 0;
|
|
13
|
+
const node_fs_1 = require("node:fs");
|
|
13
14
|
const core_1 = require("@celljs/core");
|
|
14
15
|
const client_channel_1 = require("./client-channel");
|
|
15
16
|
const host_protocol_1 = require("./host-protocol");
|
|
17
|
+
const session_handles_1 = require("./session-handles");
|
|
18
|
+
const session_list_feed_1 = require("./session-list-feed");
|
|
16
19
|
const ta_errors_1 = require("./ta-errors");
|
|
20
|
+
/**
|
|
21
|
+
* The open sessions. A session's id outlives its memory: closed while idle or by a restart, it opens again
|
|
22
|
+
* from its file under the same id at the next call (TaSessionHandles), so clients never see it go.
|
|
23
|
+
*/
|
|
17
24
|
let DefaultTaSessionRegistry = class DefaultTaSessionRegistry {
|
|
18
25
|
constructor() {
|
|
19
26
|
this.sessions = new Map();
|
|
@@ -22,25 +29,18 @@ let DefaultTaSessionRegistry = class DefaultTaSessionRegistry {
|
|
|
22
29
|
this.opening = 0;
|
|
23
30
|
/** The closes under way, by session file: out of the list already, their files locked until they end. */
|
|
24
31
|
this.closing = new Map();
|
|
32
|
+
/** Sessions opening again under their ids: the calls that come meanwhile wait for the same. */
|
|
33
|
+
this.waking = new Map();
|
|
34
|
+
this.feed = new session_list_feed_1.SessionListFeed(() => this.list().map(session => session.info()));
|
|
25
35
|
}
|
|
26
|
-
|
|
27
|
-
// A
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
if (this.sessions.size + this.opening >= this.options.maxSessions) {
|
|
33
|
-
throw ta_errors_1.TaErrors.tooManySessions(this.options.maxSessions);
|
|
34
|
-
}
|
|
35
|
-
this.opening++;
|
|
36
|
-
try {
|
|
37
|
-
const session = await this.factory.create(options, ended => void this.close(ended.id));
|
|
38
|
-
this.sessions.set(session.id, session);
|
|
39
|
-
return session;
|
|
40
|
-
}
|
|
41
|
-
finally {
|
|
42
|
-
this.opening--;
|
|
36
|
+
open(options) {
|
|
37
|
+
// A file that had a session keeps its id, which pages may still have.
|
|
38
|
+
const known = options.sessionFile ? this.handles.idOf(options.sessionFile) : undefined;
|
|
39
|
+
const waking = known && this.waking.get(known);
|
|
40
|
+
if (waking) {
|
|
41
|
+
return waking;
|
|
43
42
|
}
|
|
43
|
+
return this.create(options, known && !this.sessions.has(known) ? known : undefined);
|
|
44
44
|
}
|
|
45
45
|
require(sessionId) {
|
|
46
46
|
const session = this.sessions.get(sessionId);
|
|
@@ -49,17 +49,46 @@ let DefaultTaSessionRegistry = class DefaultTaSessionRegistry {
|
|
|
49
49
|
}
|
|
50
50
|
return session;
|
|
51
51
|
}
|
|
52
|
+
resolve(sessionId) {
|
|
53
|
+
const session = this.sessions.get(sessionId);
|
|
54
|
+
if (session) {
|
|
55
|
+
return Promise.resolve(session);
|
|
56
|
+
}
|
|
57
|
+
const waking = this.waking.get(sessionId);
|
|
58
|
+
if (waking) {
|
|
59
|
+
return waking;
|
|
60
|
+
}
|
|
61
|
+
const handle = this.handles.get(sessionId);
|
|
62
|
+
if (!handle || !(0, node_fs_1.existsSync)(handle.sessionFile)) {
|
|
63
|
+
return Promise.reject(ta_errors_1.TaErrors.sessionNotFound(sessionId));
|
|
64
|
+
}
|
|
65
|
+
const options = { cwd: handle.cwd, sessionFile: handle.sessionFile, clientTools: handle.clientTools };
|
|
66
|
+
const opening = this.create(options, sessionId).finally(() => this.waking.delete(sessionId));
|
|
67
|
+
this.waking.set(sessionId, opening);
|
|
68
|
+
return opening;
|
|
69
|
+
}
|
|
52
70
|
list() {
|
|
53
71
|
return [...this.sessions.values()];
|
|
54
72
|
}
|
|
55
|
-
|
|
73
|
+
watch(connection) {
|
|
74
|
+
return this.feed.watch(connection);
|
|
75
|
+
}
|
|
76
|
+
async close(sessionId, idle = false) {
|
|
77
|
+
if (!idle) {
|
|
78
|
+
this.handles.delete(sessionId);
|
|
79
|
+
}
|
|
56
80
|
const session = this.sessions.get(sessionId);
|
|
57
81
|
if (!session) {
|
|
58
82
|
return;
|
|
59
83
|
}
|
|
60
84
|
this.sessions.delete(sessionId);
|
|
85
|
+
this.feed.changed();
|
|
61
86
|
const file = session.pi.sessionFile;
|
|
62
|
-
|
|
87
|
+
if (idle && file) {
|
|
88
|
+
// The conversation it has now: pi may have moved to another file since it opened.
|
|
89
|
+
this.handles.set(sessionId, { ...this.handles.get(sessionId), sessionFile: file, cwd: session.cwd });
|
|
90
|
+
}
|
|
91
|
+
const closing = session.close(!idle);
|
|
63
92
|
if (file) {
|
|
64
93
|
this.closing.set(file, closing);
|
|
65
94
|
}
|
|
@@ -73,7 +102,7 @@ let DefaultTaSessionRegistry = class DefaultTaSessionRegistry {
|
|
|
73
102
|
}
|
|
74
103
|
}
|
|
75
104
|
async closeAll() {
|
|
76
|
-
await Promise.all([...this.sessions.keys()].map(id => this.close(id)));
|
|
105
|
+
await Promise.all([...this.sessions.keys()].map(id => this.close(id, true)));
|
|
77
106
|
}
|
|
78
107
|
/** The one channel of a connection; it leaves every session when the connection ends. */
|
|
79
108
|
channel(connection) {
|
|
@@ -90,6 +119,32 @@ let DefaultTaSessionRegistry = class DefaultTaSessionRegistry {
|
|
|
90
119
|
}
|
|
91
120
|
return channel;
|
|
92
121
|
}
|
|
122
|
+
/** `id`: the id it had, to open it again under. */
|
|
123
|
+
async create(options, id) {
|
|
124
|
+
// A conversation closed a moment ago (idle, or by another client) opens once it is closed, not refused.
|
|
125
|
+
const closing = options.sessionFile && this.closing.get(options.sessionFile);
|
|
126
|
+
if (closing) {
|
|
127
|
+
await closing.catch(() => undefined);
|
|
128
|
+
}
|
|
129
|
+
if (this.sessions.size + this.opening >= this.options.maxSessions) {
|
|
130
|
+
throw ta_errors_1.TaErrors.tooManySessions(this.options.maxSessions);
|
|
131
|
+
}
|
|
132
|
+
this.opening++;
|
|
133
|
+
try {
|
|
134
|
+
const session = await this.factory.create(options, (ended, idle) => void this.close(ended.id, idle), id);
|
|
135
|
+
this.sessions.set(session.id, session);
|
|
136
|
+
session.onInfoChange(() => this.sessions.get(session.id) === session && this.feed.changed());
|
|
137
|
+
this.feed.changed();
|
|
138
|
+
const sessionFile = session.pi.sessionFile;
|
|
139
|
+
if (sessionFile) {
|
|
140
|
+
this.handles.set(session.id, { sessionFile, cwd: session.cwd, clientTools: options.clientTools });
|
|
141
|
+
}
|
|
142
|
+
return session;
|
|
143
|
+
}
|
|
144
|
+
finally {
|
|
145
|
+
this.opening--;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
93
148
|
};
|
|
94
149
|
exports.DefaultTaSessionRegistry = DefaultTaSessionRegistry;
|
|
95
150
|
__decorate([
|
|
@@ -100,6 +155,10 @@ __decorate([
|
|
|
100
155
|
(0, core_1.Autowired)(host_protocol_1.TaSessionFactory),
|
|
101
156
|
__metadata("design:type", Object)
|
|
102
157
|
], DefaultTaSessionRegistry.prototype, "factory", void 0);
|
|
158
|
+
__decorate([
|
|
159
|
+
(0, core_1.Autowired)(session_handles_1.TaSessionHandles),
|
|
160
|
+
__metadata("design:type", Object)
|
|
161
|
+
], DefaultTaSessionRegistry.prototype, "handles", void 0);
|
|
103
162
|
exports.DefaultTaSessionRegistry = DefaultTaSessionRegistry = __decorate([
|
|
104
163
|
(0, core_1.Component)(host_protocol_1.TaSessionRegistry)
|
|
105
164
|
], DefaultTaSessionRegistry);
|
package/lib/node/ta-session.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { SessionLock } from '@celljs/ta-harness';
|
|
2
|
-
import type { RpcExtensionUIResponse, TaAttachOptions, TaAttachResult, TaClientToolResult, TaEvent, TaMessagePage, TaNavigateResult, TaPromptInput, TaPromptReceipt, TaSessionInfo } from '@celljs/ta-protocol';
|
|
2
|
+
import type { ImageContent, RpcExtensionUIResponse, TaAttachOptions, TaAttachResult, TaClientToolResult, TaConversation, TaEvent, TaMessagePage, TaNavigateResult, TaPromptInput, TaPromptReceipt, TaSessionInfo } from '@celljs/ta-protocol';
|
|
3
3
|
import type { ClientChannel } from './client-channel';
|
|
4
4
|
import type { ClientToolBroker } from './client-tool-broker';
|
|
5
5
|
import { EventLog } from './event-log';
|
|
@@ -16,8 +16,10 @@ export interface TaSessionContext {
|
|
|
16
16
|
/** The tools of the session that its clients run. */
|
|
17
17
|
clientTools: ClientToolBroker;
|
|
18
18
|
options: TaHostOptions;
|
|
19
|
-
/** The session should end: it has been idle, or an extension asked. */
|
|
20
|
-
requestClose(session: TaSession): void;
|
|
19
|
+
/** The session should end: it has been idle (`idle`: it opens again under its id when called), or an extension asked. */
|
|
20
|
+
requestClose(session: TaSession, idle?: boolean): void;
|
|
21
|
+
/** The id it had, when it opens again (TaSessionHandles); default: a new one. */
|
|
22
|
+
id?: string;
|
|
21
23
|
/** TaOpenSessionOptions.group. */
|
|
22
24
|
group?: string;
|
|
23
25
|
/** TaOpenSessionOptions.appendSystemPrompt: kept in the session file, for when it opens again from it. */
|
|
@@ -31,7 +33,7 @@ export interface TaSessionContext {
|
|
|
31
33
|
*/
|
|
32
34
|
export declare class TaSession {
|
|
33
35
|
protected readonly context: TaSessionContext;
|
|
34
|
-
readonly id:
|
|
36
|
+
readonly id: string;
|
|
35
37
|
readonly createdAt: number;
|
|
36
38
|
readonly ui: RemoteUiContext;
|
|
37
39
|
readonly runtime: AgentSessionRuntime;
|
|
@@ -42,19 +44,27 @@ export declare class TaSession {
|
|
|
42
44
|
protected unsubscribe?: () => void;
|
|
43
45
|
protected idleTimer?: ReturnType<typeof setTimeout>;
|
|
44
46
|
protected started: boolean;
|
|
47
|
+
protected readonly infoListeners: Set<() => void>;
|
|
45
48
|
constructor(context: TaSessionContext);
|
|
46
49
|
get pi(): AgentSession;
|
|
47
50
|
/** Where the session works, as clients name it: a path, or an `ssh://` location. */
|
|
48
51
|
get cwd(): string;
|
|
49
52
|
start(): Promise<void>;
|
|
50
53
|
info(): TaSessionInfo;
|
|
54
|
+
/** What `info` gives may have changed (TaServer.watchSessions). */
|
|
55
|
+
onInfoChange(listener: () => void): () => void;
|
|
51
56
|
attach(channel: ClientChannel, afterSeq?: number, options?: TaAttachOptions): TaAttachResult;
|
|
52
57
|
earlierMessages(before: number | undefined, timestamp: number | undefined, budget: number): TaMessagePage;
|
|
58
|
+
/** The image of a message of the user that the conversation gives without its bytes (TaShownImage). */
|
|
59
|
+
messageImage(timestamp: number, index: number): ImageContent | undefined;
|
|
60
|
+
/** The conversation of the events sent, as clients get it. */
|
|
61
|
+
protected conversation(): TaConversation;
|
|
53
62
|
detach(channel: ClientChannel): void;
|
|
54
63
|
respondUi(response: RpcExtensionUIResponse): boolean;
|
|
55
64
|
/** Only a client attached runs a call: one that left would hold it for nobody. */
|
|
56
65
|
claimClientTool(channel: ClientChannel, id: string): boolean;
|
|
57
|
-
|
|
66
|
+
/** Only a client attached answers, and only the one that claimed the call when one did. */
|
|
67
|
+
respondClientTool(channel: ClientChannel, result: TaClientToolResult): boolean;
|
|
58
68
|
prompt(input: TaPromptInput): Promise<TaPromptReceipt>;
|
|
59
69
|
steer(input: TaPromptInput): Promise<TaPromptReceipt>;
|
|
60
70
|
followUp(input: TaPromptInput): Promise<TaPromptReceipt>;
|
|
@@ -73,7 +83,7 @@ export declare class TaSession {
|
|
|
73
83
|
* (a tool that ignores the abort, a stream that hangs) or an extension slow to shut down is given
|
|
74
84
|
* `closeTimeoutMs`; then pi is cut off from its agent, so that nothing more goes into the file.
|
|
75
85
|
*/
|
|
76
|
-
close(): Promise<void>;
|
|
86
|
+
close(announce?: boolean): Promise<void>;
|
|
77
87
|
/** False when `work` takes longer than closeTimeoutMs. */
|
|
78
88
|
protected within(work: Promise<void>): Promise<boolean>;
|
|
79
89
|
protected accept(input: TaPromptInput, run: () => Promise<PromptDisposition>): Promise<TaPromptReceipt>;
|
package/lib/node/ta-session.js
CHANGED
|
@@ -10,21 +10,35 @@ const remote_ui_context_1 = require("./remote-ui-context");
|
|
|
10
10
|
const session_catalog_1 = require("./session-catalog");
|
|
11
11
|
const session_info_util_1 = require("./session-info-util");
|
|
12
12
|
const ta_event_util_1 = require("./ta-event-util");
|
|
13
|
+
/** The events after which what a list shows of a session (its info) may differ. */
|
|
14
|
+
const INFO_EVENTS = new Set([
|
|
15
|
+
'agent_start',
|
|
16
|
+
'agent_settled',
|
|
17
|
+
'message_end',
|
|
18
|
+
'session_info_changed',
|
|
19
|
+
'session_replaced',
|
|
20
|
+
'extension_ui_request',
|
|
21
|
+
'ui_request_resolved',
|
|
22
|
+
]);
|
|
13
23
|
/**
|
|
14
24
|
* One open session of `ta serve`: pi's runtime, its event log, and the clients attached to it. Its id
|
|
15
25
|
* stays the same while the runtime moves between conversations.
|
|
16
26
|
*/
|
|
17
27
|
class TaSession {
|
|
18
28
|
constructor(context) {
|
|
29
|
+
var _a;
|
|
19
30
|
this.context = context;
|
|
20
|
-
this.id = (0, node_crypto_1.randomUUID)();
|
|
21
31
|
this.createdAt = Date.now();
|
|
22
32
|
this.receipts = new receipt_book_1.ReceiptBook();
|
|
23
33
|
this.channels = new Set();
|
|
24
34
|
this.live = new live_run_1.LiveRun();
|
|
25
35
|
this.started = false;
|
|
36
|
+
this.infoListeners = new Set();
|
|
26
37
|
this.runtime = context.runtime;
|
|
27
|
-
this.
|
|
38
|
+
this.id = (_a = context.id) !== null && _a !== void 0 ? _a : (0, node_crypto_1.randomUUID)();
|
|
39
|
+
// Opened again: its seqs start past any the session gave before (fewer than one per millisecond), so a
|
|
40
|
+
// client that attaches with one of those gets the conversation again rather than events of another log.
|
|
41
|
+
this.log = new event_log_1.EventLog(this.id, context.options.eventBufferBytes, context.id ? Date.now() : 0);
|
|
28
42
|
this.ui = new remote_ui_context_1.RemoteUiContext(event => this.publish(event));
|
|
29
43
|
context.clientTools.connect(event => this.publish(event));
|
|
30
44
|
}
|
|
@@ -52,8 +66,10 @@ class TaSession {
|
|
|
52
66
|
sessionFile: pi.sessionFile,
|
|
53
67
|
sessionName: pi.sessionName,
|
|
54
68
|
firstMessage: session_info_util_1.SessionInfoUtil.firstMessage(pi.messages),
|
|
69
|
+
lastMessage: session_info_util_1.SessionInfoUtil.lastMessage(pi.messages),
|
|
55
70
|
model: model ? `${model.provider}/${model.id}` : undefined,
|
|
56
71
|
isStreaming: pi.isStreaming,
|
|
72
|
+
waiting: this.ui.pendingRequests.length > 0,
|
|
57
73
|
messageCount: pi.messages.length,
|
|
58
74
|
attached: this.channels.size,
|
|
59
75
|
createdAt: this.createdAt,
|
|
@@ -61,6 +77,11 @@ class TaSession {
|
|
|
61
77
|
group: this.context.group,
|
|
62
78
|
};
|
|
63
79
|
}
|
|
80
|
+
/** What `info` gives may have changed (TaServer.watchSessions). */
|
|
81
|
+
onInfoChange(listener) {
|
|
82
|
+
this.infoListeners.add(listener);
|
|
83
|
+
return () => this.infoListeners.delete(listener);
|
|
84
|
+
}
|
|
64
85
|
attach(channel, afterSeq, options = {}) {
|
|
65
86
|
this.channels.add(channel);
|
|
66
87
|
this.watchIdle();
|
|
@@ -68,9 +89,7 @@ class TaSession {
|
|
|
68
89
|
return {
|
|
69
90
|
info: this.info(),
|
|
70
91
|
events,
|
|
71
|
-
conversation: afterSeq === undefined || gap
|
|
72
|
-
? message_page_1.MessagePage.recent(this.live.conversation(this.pi.messages, this.pi.isStreaming), options.recentBytes)
|
|
73
|
-
: undefined,
|
|
92
|
+
conversation: afterSeq === undefined || gap ? message_page_1.MessagePage.recent(this.conversation(), options.recentBytes) : undefined,
|
|
74
93
|
pendingUi: this.ui.pendingRequests,
|
|
75
94
|
shownUi: this.ui.shownRequests,
|
|
76
95
|
pendingClientTools: this.context.clientTools.pendingRequests,
|
|
@@ -79,7 +98,18 @@ class TaSession {
|
|
|
79
98
|
};
|
|
80
99
|
}
|
|
81
100
|
earlierMessages(before, timestamp, budget) {
|
|
82
|
-
return message_page_1.MessagePage.before(this.
|
|
101
|
+
return message_page_1.MessagePage.before(this.conversation().messages, before, timestamp, budget);
|
|
102
|
+
}
|
|
103
|
+
/** The image of a message of the user that the conversation gives without its bytes (TaShownImage). */
|
|
104
|
+
messageImage(timestamp, index) {
|
|
105
|
+
var _a;
|
|
106
|
+
const message = [...this.pi.messages].reverse().find(candidate => candidate.role === 'user' && candidate.timestamp === timestamp);
|
|
107
|
+
const block = Array.isArray(message === null || message === void 0 ? void 0 : message.content) ? message.content[index] : undefined;
|
|
108
|
+
return (block === null || block === void 0 ? void 0 : block.type) === 'image' && block.data ? { type: 'image', data: block.data, mimeType: (_a = block.mimeType) !== null && _a !== void 0 ? _a : '' } : undefined;
|
|
109
|
+
}
|
|
110
|
+
/** The conversation of the events sent, as clients get it. */
|
|
111
|
+
conversation() {
|
|
112
|
+
return ta_event_util_1.TaEventUtil.leanConversation(this.live.conversation(this.pi.messages, this.pi.isStreaming));
|
|
83
113
|
}
|
|
84
114
|
detach(channel) {
|
|
85
115
|
if (this.channels.delete(channel)) {
|
|
@@ -94,8 +124,9 @@ class TaSession {
|
|
|
94
124
|
claimClientTool(channel, id) {
|
|
95
125
|
return this.channels.has(channel) && this.context.clientTools.claim(id, channel);
|
|
96
126
|
}
|
|
97
|
-
|
|
98
|
-
|
|
127
|
+
/** Only a client attached answers, and only the one that claimed the call when one did. */
|
|
128
|
+
respondClientTool(channel, result) {
|
|
129
|
+
return this.channels.has(channel) && this.context.clientTools.respond(result, channel);
|
|
99
130
|
}
|
|
100
131
|
prompt(input) {
|
|
101
132
|
return this.accept(input, () => new Promise((resolve, reject) => {
|
|
@@ -159,12 +190,14 @@ class TaSession {
|
|
|
159
190
|
* (a tool that ignores the abort, a stream that hangs) or an extension slow to shut down is given
|
|
160
191
|
* `closeTimeoutMs`; then pi is cut off from its agent, so that nothing more goes into the file.
|
|
161
192
|
*/
|
|
162
|
-
async close() {
|
|
193
|
+
async close(announce = true) {
|
|
163
194
|
var _a;
|
|
164
195
|
clearTimeout(this.idleTimer);
|
|
165
196
|
this.ui.cancelAll();
|
|
166
197
|
this.context.clientTools.cancelAll();
|
|
167
|
-
|
|
198
|
+
if (announce) {
|
|
199
|
+
this.publish({ type: 'session_closed' });
|
|
200
|
+
}
|
|
168
201
|
this.channels.clear();
|
|
169
202
|
(_a = this.unsubscribe) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
170
203
|
try {
|
|
@@ -172,8 +205,15 @@ class TaSession {
|
|
|
172
205
|
// Its failure is no reason to keep the session: dispose below aborts the run as well.
|
|
173
206
|
await this.within(this.pi.abort().catch(() => undefined));
|
|
174
207
|
}
|
|
175
|
-
|
|
176
|
-
|
|
208
|
+
let disposed = false;
|
|
209
|
+
try {
|
|
210
|
+
disposed = await this.within(this.runtime.dispose());
|
|
211
|
+
}
|
|
212
|
+
finally {
|
|
213
|
+
// Late or failed: either way nothing more of pi goes into the file once it is unlocked.
|
|
214
|
+
if (!disposed) {
|
|
215
|
+
this.pi.dispose();
|
|
216
|
+
}
|
|
177
217
|
}
|
|
178
218
|
}
|
|
179
219
|
finally {
|
|
@@ -200,7 +240,7 @@ class TaSession {
|
|
|
200
240
|
}
|
|
201
241
|
try {
|
|
202
242
|
const disposition = await run();
|
|
203
|
-
return { clientMessageId: input.clientMessageId, status: disposition === '
|
|
243
|
+
return { clientMessageId: input.clientMessageId, status: disposition === 'started' ? 'accepted' : disposition };
|
|
204
244
|
}
|
|
205
245
|
catch (error) {
|
|
206
246
|
this.receipts.forget(input.clientMessageId);
|
|
@@ -249,6 +289,11 @@ class TaSession {
|
|
|
249
289
|
for (const channel of this.channels) {
|
|
250
290
|
channel.send(logged);
|
|
251
291
|
}
|
|
292
|
+
if (INFO_EVENTS.has(event.type)) {
|
|
293
|
+
for (const listener of this.infoListeners) {
|
|
294
|
+
listener();
|
|
295
|
+
}
|
|
296
|
+
}
|
|
252
297
|
}
|
|
253
298
|
isIdle() {
|
|
254
299
|
return this.channels.size === 0 && !this.pi.isStreaming && this.ui.pendingRequests.length === 0;
|
|
@@ -258,7 +303,7 @@ class TaSession {
|
|
|
258
303
|
clearTimeout(this.idleTimer);
|
|
259
304
|
this.idleTimer = undefined;
|
|
260
305
|
if (this.isIdle()) {
|
|
261
|
-
this.idleTimer = setTimeout(() => this.isIdle() && this.context.requestClose(this), this.context.options.idleTimeoutMs);
|
|
306
|
+
this.idleTimer = setTimeout(() => this.isIdle() && this.context.requestClose(this, true), this.context.options.idleTimeoutMs);
|
|
262
307
|
this.idleTimer.unref();
|
|
263
308
|
}
|
|
264
309
|
}
|
|
@@ -37,6 +37,11 @@ export declare class WebExtensionCatalogImpl implements WebExtensionCatalog {
|
|
|
37
37
|
setTemporaryRetention(days: number): void;
|
|
38
38
|
protected temporary(): TemporaryStore;
|
|
39
39
|
packageOf(cwd: string, id: string): Promise<TaPackageInfo>;
|
|
40
|
+
/**
|
|
41
|
+
* The package an id names: its id of listPackages, or the id of one of its web extensions. Every method of a
|
|
42
|
+
* package takes either, so that a client holding a web extension never looks for its package first.
|
|
43
|
+
*/
|
|
44
|
+
protected findPackage(packages: WebExtensionPackage[], id: string, kind?: string): WebExtensionPackage;
|
|
40
45
|
/** A package another computer shared by a link, put in Ta's own temporary directory (RelayShareUtil). */
|
|
41
46
|
protected fetchShare(link: string): Promise<string>;
|
|
42
47
|
protected fetch(manager: PackageManager, source: string): Promise<string>;
|
|
@@ -46,7 +51,6 @@ export declare class WebExtensionCatalogImpl implements WebExtensionCatalog {
|
|
|
46
51
|
removePackage(cwd: string, id: string): Promise<void>;
|
|
47
52
|
list(cwd: string): Promise<TaWebExtensionInfo[]>;
|
|
48
53
|
read(cwd: string, id: string): Promise<TaWebExtensionSource>;
|
|
49
|
-
remove(cwd: string, id: string): Promise<void>;
|
|
50
54
|
setEnabled(cwd: string, nameOrId: string, enabled: boolean): Promise<void>;
|
|
51
55
|
protected removeRoot(pkg: WebExtensionPackage, manager: PackageManager): Promise<void>;
|
|
52
56
|
protected agentDir(): string;
|