@celljs/ta-host 4.10.0 → 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 +4 -4
- package/README.md +4 -4
- package/esm/node/client-tool-broker.d.ts +6 -2
- package/esm/node/client-tool-broker.js +11 -4
- package/esm/node/host-protocol.d.ts +12 -7
- package/esm/node/index.d.ts +1 -0
- package/esm/node/index.js +1 -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/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 +12 -4
- package/esm/node/session-info-util.d.ts +2 -1
- package/esm/node/session-info-util.js +34 -7
- 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-event-util.d.ts +9 -2
- package/esm/node/ta-event-util.js +31 -5
- package/esm/node/ta-server-impl.d.ts +13 -5
- package/esm/node/ta-server-impl.js +34 -16
- package/esm/node/ta-session-factory.d.ts +16 -1
- package/esm/node/ta-session-factory.js +42 -14
- package/esm/node/ta-session-registry.d.ts +4 -1
- package/esm/node/ta-session-registry.js +8 -0
- package/esm/node/ta-session.d.ts +8 -2
- package/esm/node/ta-session.js +41 -4
- 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 +16 -12
- package/esm/node/workspace-files.js +14 -10
- package/esm/node/workspace-protocol.d.ts +1 -1
- package/lib/node/client-tool-broker.d.ts +6 -2
- package/lib/node/client-tool-broker.js +11 -4
- package/lib/node/host-protocol.d.ts +12 -7
- package/lib/node/index.d.ts +1 -0
- package/lib/node/index.js +1 -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/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 +12 -4
- package/lib/node/session-info-util.d.ts +2 -1
- package/lib/node/session-info-util.js +34 -7
- 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-event-util.d.ts +9 -2
- package/lib/node/ta-event-util.js +31 -5
- package/lib/node/ta-server-impl.d.ts +13 -5
- package/lib/node/ta-server-impl.js +32 -14
- package/lib/node/ta-session-factory.d.ts +16 -1
- package/lib/node/ta-session-factory.js +42 -14
- package/lib/node/ta-session-registry.d.ts +4 -1
- package/lib/node/ta-session-registry.js +8 -0
- package/lib/node/ta-session.d.ts +8 -2
- package/lib/node/ta-session.js +41 -4
- 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 +16 -12
- package/lib/node/workspace-files.js +13 -9
- package/lib/node/workspace-protocol.d.ts +1 -1
- package/package.json +10 -10
|
@@ -13,21 +13,25 @@ const PI_RESOURCES = ['extensions', 'skills', 'prompts', 'themes'];
|
|
|
13
13
|
var WebExtensionUtil;
|
|
14
14
|
(function (WebExtensionUtil) {
|
|
15
15
|
function describe(pkg) {
|
|
16
|
+
var _a;
|
|
16
17
|
const manifest = readManifest(pkg.root);
|
|
17
|
-
|
|
18
|
+
const lists = Array.isArray((_a = manifest === null || manifest === void 0 ? void 0 : manifest.pi) === null || _a === void 0 ? void 0 : _a.lists) ? manifest.pi.lists.filter((kind) => typeof kind === 'string' && kind !== '') : [];
|
|
19
|
+
return entries(pkg.root, manifest).map(entry => { var _a, _b, _c; var _d, _e; return ({
|
|
18
20
|
id: id(pkg, entry),
|
|
19
|
-
name: (
|
|
21
|
+
name: (_d = manifest === null || manifest === void 0 ? void 0 : manifest.name) !== null && _d !== void 0 ? _d : (0, node_path_1.basename)(pkg.root),
|
|
20
22
|
description: manifest === null || manifest === void 0 ? void 0 : manifest.description,
|
|
21
23
|
version: manifest === null || manifest === void 0 ? void 0 : manifest.version,
|
|
22
24
|
scope: pkg.scope,
|
|
23
25
|
origin: pkg.origin,
|
|
24
|
-
enabled: (
|
|
26
|
+
enabled: (_e = pkg.enabled) !== null && _e !== void 0 ? _e : true,
|
|
25
27
|
source: pkg.source,
|
|
26
28
|
entry,
|
|
27
29
|
hash: hash((0, node_fs_1.readFileSync)((0, node_path_1.join)(pkg.root, entry), 'utf8')),
|
|
28
30
|
title: text((_a = manifest === null || manifest === void 0 ? void 0 : manifest.pi) === null || _a === void 0 ? void 0 : _a.title),
|
|
29
31
|
icon: icon(manifest),
|
|
30
32
|
activation: pkg.temporary || ((_b = manifest === null || manifest === void 0 ? void 0 : manifest.pi) === null || _b === void 0 ? void 0 : _b.webActivation) === 'open' ? 'open' : 'startup',
|
|
33
|
+
...(typeof ((_c = manifest === null || manifest === void 0 ? void 0 : manifest.pi) === null || _c === void 0 ? void 0 : _c.category) === 'string' && manifest.pi.category ? { category: manifest.pi.category } : {}),
|
|
34
|
+
...(lists.length > 0 ? { lists } : {}),
|
|
31
35
|
...(pkg.temporary ? { temporary: pkg.temporary } : {}),
|
|
32
36
|
}); });
|
|
33
37
|
}
|
|
@@ -2,6 +2,12 @@ import type { IncomingMessage, ServerResponse } from 'node:http';
|
|
|
2
2
|
import { type ExecEnvironment, ExecEnvironmentFactory, type FileStat } from '@celljs/ta-exec';
|
|
3
3
|
import { type Context, Middleware } from '@celljs/web/lib/node';
|
|
4
4
|
import { WorkspaceFiles } from './workspace-protocol';
|
|
5
|
+
interface ServedDirectory {
|
|
6
|
+
root: string;
|
|
7
|
+
cwd: string;
|
|
8
|
+
/** The name of the one file of `root` served: a file outside the directory of the conversation. */
|
|
9
|
+
only?: string;
|
|
10
|
+
}
|
|
5
11
|
export declare namespace WorkspaceFilesUtil {
|
|
6
12
|
function contentType(path: string): string;
|
|
7
13
|
/** `/api/files/<id>/<path>`; undefined for other URLs or a path that does not decode. */
|
|
@@ -24,27 +30,24 @@ export declare namespace WorkspaceFilesUtil {
|
|
|
24
30
|
* Answers `GET /api/files/<id>/<path>` with the bytes of a file, without the token of ta serve: `<id>`
|
|
25
31
|
* stands for one directory, and only who has the token learns it (TaWorkspaceServer.fileUrl). Paths stay inside
|
|
26
32
|
* that directory; a directory answers its `index.html`. One range is served, so that videos seek. A file
|
|
27
|
-
* outside the directory of the conversation (a picture an agent left in `/tmp`) has
|
|
28
|
-
*
|
|
29
|
-
* reach it.
|
|
33
|
+
* outside the directory of the conversation (a picture an agent left in `/tmp`) has an id of its own that
|
|
34
|
+
* stands for that file alone: the URL needs no token, so it must not open the directory the file is in
|
|
35
|
+
* (the home directory for `~/a.png`, with its keys) nor the pages of the workspace reach it.
|
|
30
36
|
*/
|
|
31
37
|
export declare class DefaultWorkspaceFiles implements WorkspaceFiles, Middleware {
|
|
32
38
|
/** Before TaAccess, which turns away `/api` requests without the token. */
|
|
33
39
|
readonly priority: number;
|
|
34
40
|
protected readonly environments: ExecEnvironmentFactory;
|
|
35
41
|
protected readonly host?: string;
|
|
36
|
-
/**
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
42
|
+
/**
|
|
43
|
+
* By id, the directory paths stay in, the one whose execution environment reads them, and for a file
|
|
44
|
+
* outside the conversation's directory, the one path of `root` served.
|
|
45
|
+
*/
|
|
46
|
+
protected readonly directories: Map<string, ServedDirectory>;
|
|
41
47
|
protected readonly ids: Map<string, string>;
|
|
42
48
|
url(cwd: string, path: string): string;
|
|
43
49
|
handle(ctx: Context, next: () => Promise<void>): Promise<void>;
|
|
44
|
-
protected send(request: IncomingMessage, response: ServerResponse, directory:
|
|
45
|
-
root: string;
|
|
46
|
-
cwd: string;
|
|
47
|
-
}, path: string): Promise<void>;
|
|
50
|
+
protected send(request: IncomingMessage, response: ServerResponse, directory: ServedDirectory, path: string): Promise<void>;
|
|
48
51
|
/** The file at `path` of `root`, or the `index.html` of the directory there. */
|
|
49
52
|
protected find(env: ExecEnvironment, root: string, path: string): Promise<{
|
|
50
53
|
absolute: string;
|
|
@@ -55,4 +58,5 @@ export declare class DefaultWorkspaceFiles implements WorkspaceFiles, Middleware
|
|
|
55
58
|
protected acceptsHost(request: IncomingMessage): boolean;
|
|
56
59
|
protected fail(response: ServerResponse, status: number): void;
|
|
57
60
|
}
|
|
61
|
+
export {};
|
|
58
62
|
//# sourceMappingURL=workspace-files.d.ts.map
|
|
@@ -122,29 +122,33 @@ var WorkspaceFilesUtil;
|
|
|
122
122
|
* Answers `GET /api/files/<id>/<path>` with the bytes of a file, without the token of ta serve: `<id>`
|
|
123
123
|
* stands for one directory, and only who has the token learns it (TaWorkspaceServer.fileUrl). Paths stay inside
|
|
124
124
|
* that directory; a directory answers its `index.html`. One range is served, so that videos seek. A file
|
|
125
|
-
* outside the directory of the conversation (a picture an agent left in `/tmp`) has
|
|
126
|
-
*
|
|
127
|
-
* reach it.
|
|
125
|
+
* outside the directory of the conversation (a picture an agent left in `/tmp`) has an id of its own that
|
|
126
|
+
* stands for that file alone: the URL needs no token, so it must not open the directory the file is in
|
|
127
|
+
* (the home directory for `~/a.png`, with its keys) nor the pages of the workspace reach it.
|
|
128
128
|
*/
|
|
129
129
|
let DefaultWorkspaceFiles = class DefaultWorkspaceFiles {
|
|
130
130
|
constructor() {
|
|
131
131
|
/** Before TaAccess, which turns away `/api` requests without the token. */
|
|
132
132
|
this.priority = ta_access_1.ACCESS_MIDDLEWARE_PRIORITY + 1;
|
|
133
|
-
/**
|
|
133
|
+
/**
|
|
134
|
+
* By id, the directory paths stay in, the one whose execution environment reads them, and for a file
|
|
135
|
+
* outside the conversation's directory, the one path of `root` served.
|
|
136
|
+
*/
|
|
134
137
|
this.directories = new Map();
|
|
135
138
|
this.ids = new Map();
|
|
136
139
|
}
|
|
137
140
|
url(cwd, path) {
|
|
138
141
|
const absolute = (0, node_path_1.resolve)(cwd, path || '.');
|
|
139
|
-
const
|
|
140
|
-
const
|
|
142
|
+
const inside = workspace_util_1.WorkspaceUtil.contains(cwd, absolute);
|
|
143
|
+
const served = inside ? { root: cwd, cwd } : { root: (0, node_path_1.dirname)(absolute), cwd, only: (0, node_path_1.basename)(absolute) };
|
|
144
|
+
const key = `${cwd}\0${inside ? '' : absolute}`;
|
|
141
145
|
let id = this.ids.get(key);
|
|
142
146
|
if (!id) {
|
|
143
147
|
id = (0, node_crypto_1.randomBytes)(ID_BYTES).toString('base64url');
|
|
144
148
|
this.ids.set(key, id);
|
|
145
|
-
this.directories.set(id,
|
|
149
|
+
this.directories.set(id, served);
|
|
146
150
|
}
|
|
147
|
-
return WorkspaceFilesUtil.url(id, workspace_util_1.WorkspaceUtil.inside(root, absolute).relative);
|
|
151
|
+
return WorkspaceFilesUtil.url(id, workspace_util_1.WorkspaceUtil.inside(served.root, absolute).relative);
|
|
148
152
|
}
|
|
149
153
|
async handle(ctx, next) {
|
|
150
154
|
const request = ctx.request;
|
|
@@ -168,7 +172,7 @@ let DefaultWorkspaceFiles = class DefaultWorkspaceFiles {
|
|
|
168
172
|
}
|
|
169
173
|
async send(request, response, directory, path) {
|
|
170
174
|
const env = this.environments.create(directory.cwd);
|
|
171
|
-
const file = await this.find(env, directory.root, path);
|
|
175
|
+
const file = directory.only === undefined || path === directory.only ? await this.find(env, directory.root, path) : undefined;
|
|
172
176
|
if (!file) {
|
|
173
177
|
this.fail(response, 404);
|
|
174
178
|
return;
|
|
@@ -17,7 +17,7 @@ export interface TaWorkspace {
|
|
|
17
17
|
}
|
|
18
18
|
/** The bytes of workspace files over plain HTTP, for the page to show them as they are (TaWorkspaceServer.fileUrl). */
|
|
19
19
|
export interface WorkspaceFiles {
|
|
20
|
-
/** The URL of `path` of `cwd`; a file outside `cwd`
|
|
20
|
+
/** The URL of `path` of `cwd`; a file outside `cwd` has a URL that serves it alone. */
|
|
21
21
|
url(cwd: string, path: string): string;
|
|
22
22
|
}
|
|
23
23
|
//# sourceMappingURL=workspace-protocol.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@celljs/ta-host",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.11.0",
|
|
4
4
|
"description": "ta serve: pi sessions for many clients over WebSocket",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cell-component"
|
|
@@ -34,15 +34,15 @@
|
|
|
34
34
|
"watch": "tsc -b -w --preserveWatchOutput"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@celljs/ai-agent": "4.
|
|
38
|
-
"@celljs/ai-coding-agent": "4.
|
|
39
|
-
"@celljs/core": "4.
|
|
40
|
-
"@celljs/rpc": "4.
|
|
41
|
-
"@celljs/ta-exec": "4.
|
|
42
|
-
"@celljs/ta-harness": "4.
|
|
43
|
-
"@celljs/ta-protocol": "4.
|
|
44
|
-
"@celljs/ta-relay": "4.
|
|
45
|
-
"@celljs/web": "4.
|
|
37
|
+
"@celljs/ai-agent": "4.11.0",
|
|
38
|
+
"@celljs/ai-coding-agent": "4.11.0",
|
|
39
|
+
"@celljs/core": "4.11.0",
|
|
40
|
+
"@celljs/rpc": "4.11.0",
|
|
41
|
+
"@celljs/ta-exec": "4.11.0",
|
|
42
|
+
"@celljs/ta-harness": "4.11.0",
|
|
43
|
+
"@celljs/ta-protocol": "4.11.0",
|
|
44
|
+
"@celljs/ta-relay": "4.11.0",
|
|
45
|
+
"@celljs/web": "4.11.0",
|
|
46
46
|
"@earendil-works/pi-coding-agent": "^1.5.2"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|