@volter/live 0.5.210 → 0.5.212
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/BUNDLED_NOTICES +13 -13
- package/README.md +7 -11
- package/dist/chunk-7SZ3C4CC.js +768 -0
- package/dist/chunk-7SZ3C4CC.js.map +7 -0
- package/dist/chunk-7WKVJGHZ.js +15 -0
- package/dist/chunk-7WKVJGHZ.js.map +7 -0
- package/dist/chunk-SDIWRX5X.js +189 -0
- package/dist/chunk-SDIWRX5X.js.map +7 -0
- package/dist/chunk-USXOIBVX.js +81 -0
- package/dist/chunk-USXOIBVX.js.map +7 -0
- package/dist/chunk-Y5W77HYT.js +123 -0
- package/dist/chunk-Y5W77HYT.js.map +7 -0
- package/dist/chunk-YPAOTPIF.js +202 -0
- package/dist/chunk-YPAOTPIF.js.map +7 -0
- package/dist/client.d.ts +370 -0
- package/dist/client.js +9 -0
- package/dist/client.js.map +7 -0
- package/dist/discovery.d.ts +32 -0
- package/dist/discovery.js +19 -0
- package/dist/discovery.js.map +7 -0
- package/dist/editor-document.d.ts +12 -47
- package/dist/editor.d.ts +34 -181
- package/dist/http-transport.d.ts +6 -0
- package/dist/index.d.ts +1 -5
- package/dist/index.js +76 -1722
- package/dist/index.js.map +4 -4
- package/dist/installed-package.d.ts +6 -0
- package/dist/installed-package.js +7 -0
- package/dist/installed-package.js.map +7 -0
- package/dist/lazy-proxy.d.ts +11 -11
- package/dist/member-hints.d.ts +6 -9
- package/dist/product-create.d.ts +29 -0
- package/dist/product-create.js +13 -0
- package/dist/product-create.js.map +7 -0
- package/dist/product-locator.d.ts +100 -0
- package/dist/product-locator.js +25 -0
- package/dist/product-locator.js.map +7 -0
- package/dist/registry-format.d.ts +44 -0
- package/dist/registry-format.js +21 -0
- package/dist/registry-format.js.map +7 -0
- package/dist/session.d.ts +10 -3
- package/dist/singleton.d.ts +1 -13
- package/dist/volter-manifest.d.ts +55 -0
- package/dist/volter-manifest.js +9 -0
- package/dist/volter-manifest.js.map +7 -0
- package/dist/workbench-locator.d.ts +84 -0
- package/dist/workbench-locator.js +416 -0
- package/dist/workbench-locator.js.map +7 -0
- package/package.json +35 -3
- package/src/client.ts +1052 -0
- package/src/discovery.ts +105 -0
- package/src/editor-document.ts +12 -49
- package/src/editor.ts +45 -212
- package/src/http-transport.ts +19 -0
- package/src/index.ts +3 -7
- package/src/installed-package.ts +15 -0
- package/src/lazy-proxy.ts +11 -11
- package/src/member-hints.ts +8 -12
- package/src/product-create.ts +38 -0
- package/src/product-locator.ts +327 -0
- package/src/registry-format.ts +185 -0
- package/src/session.ts +38 -66
- package/src/singleton.ts +1 -16
- package/src/volter-manifest.ts +97 -0
- package/src/workbench-locator.ts +625 -0
- package/dist/tools.d.ts +0 -23
- package/src/tools.ts +0 -45
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The real directory of installed package `name` as Node finds it from `fromDir`: up the `node_modules` folders, or
|
|
3
|
+
* null when none holds it. It is found by its folder rather than by resolving `<name>/package.json`, which fails for a
|
|
4
|
+
* package whose `exports` does not list that file (`@volter/sdk`).
|
|
5
|
+
*/
|
|
6
|
+
export declare function installedPackageDir(fromDir: string, name: string): string | null;
|
package/dist/lazy-proxy.d.ts
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* `lazyChainProxy` — turns an async "resolve the real object" function into
|
|
3
3
|
* a synchronously-importable stand-in that supports the SAME call shape as
|
|
4
|
-
* the real thing, including nested member access
|
|
5
|
-
* `editor.document.query(...)`), by recording the property-access PATH and only
|
|
4
|
+
* the real thing, including nested member access
|
|
5
|
+
* (`editor.document.query(...)`), by recording the property-access PATH and only
|
|
6
6
|
* resolving + walking it down at the point of an actual function CALL.
|
|
7
7
|
*
|
|
8
|
-
* This is what makes `index.ts`'s top-level `export const editor = ...`
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
8
|
+
* This is what makes `index.ts`'s top-level `export const editor = ...` work
|
|
9
|
+
* as a plain value a script can `import { editor } from '@volter/live'` and
|
|
10
|
+
* call immediately — each call transparently awaits the memoized `connect()`
|
|
11
|
+
* first.
|
|
12
12
|
*
|
|
13
13
|
* Limitation (by design, documented on `index.ts`'s exports too): only
|
|
14
|
-
* FUNCTION-shaped access resolves through this proxy — `
|
|
15
|
-
* works, but reading a plain data property
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
14
|
+
* FUNCTION-shaped access resolves through this proxy — `editor.document.query(s)`
|
|
15
|
+
* works, but reading a plain data property would return another inert proxy,
|
|
16
|
+
* not the real value, since there is no function CALL to trigger resolution.
|
|
17
|
+
* Every documented `editor` member is a method, so this never bites the
|
|
18
|
+
* documented surface.
|
|
19
19
|
*/
|
|
20
20
|
/**
|
|
21
21
|
* `resolveRoot` is called (and its result awaited) on every terminal
|
package/dist/member-hints.d.ts
CHANGED
|
@@ -2,13 +2,10 @@
|
|
|
2
2
|
* NAMES AN AGENT REACHES FOR THAT THE FAÇADE DOES NOT HAVE, and where the
|
|
3
3
|
* thing it wanted actually lives.
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* the whole time — through `editor.present`'s `viewport.camera` — but the
|
|
10
|
-
* failure said nothing about it. The refusal is the one moment the caller is
|
|
11
|
-
* certainly reading, so that is where the pointer goes.
|
|
5
|
+
* A call to `editor.setCamera(...)` would otherwise fail with the engine's bare
|
|
6
|
+
* "editor.setCamera is not a function", though the camera is reachable through
|
|
7
|
+
* `editor.present`'s `viewport.camera`. The refusal is the one moment the
|
|
8
|
+
* caller is certainly reading, so that is where the pointer goes.
|
|
12
9
|
*
|
|
13
10
|
* TARGETED, NOT A CATCH-ALL. Only the names below are intercepted, each with
|
|
14
11
|
* the door it was looking for. Every other missing member keeps JavaScript's
|
|
@@ -19,11 +16,11 @@
|
|
|
19
16
|
export declare function editorMemberHint(member: PropertyKey): string | undefined;
|
|
20
17
|
/**
|
|
21
18
|
* `editor` as `eval` binds it: the same object, except that reading one of the
|
|
22
|
-
* hinted names it does NOT have throws the hint, naming `
|
|
19
|
+
* hinted names it does NOT have throws the hint, naming `editor.member`.
|
|
23
20
|
* Thrown on READ, not on call, so `editor.camera.position` is caught as well as
|
|
24
21
|
* `editor.setCamera(...)`.
|
|
25
22
|
*
|
|
26
23
|
* Methods come back bound to the real object: `LiveEditor` keeps its client in
|
|
27
24
|
* a `#`-private field, which a call whose `this` is the proxy cannot read.
|
|
28
25
|
*/
|
|
29
|
-
export declare function withEditorMemberHints<T extends object>(target: T
|
|
26
|
+
export declare function withEditorMemberHints<T extends object>(target: T): T;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/** Project creation is executable product code, shared by its CLI and the host. */
|
|
2
|
+
export interface ProductCreateRequest {
|
|
3
|
+
name: string;
|
|
4
|
+
targetDir: string;
|
|
5
|
+
/** A starter the product offers (its `templates`), or none for its default. */
|
|
6
|
+
template?: string;
|
|
7
|
+
/** One of the product's example projects (its `examples`), in place of a template. */
|
|
8
|
+
example?: string;
|
|
9
|
+
}
|
|
10
|
+
export interface ProductCreateResult {
|
|
11
|
+
targetDir: string;
|
|
12
|
+
manifest: unknown;
|
|
13
|
+
}
|
|
14
|
+
/** A starter or an example a product creates, as a picker lists it. */
|
|
15
|
+
interface ProductCreateChoice {
|
|
16
|
+
readonly id: string;
|
|
17
|
+
readonly name: string;
|
|
18
|
+
readonly description?: string;
|
|
19
|
+
}
|
|
20
|
+
export interface ProductCreateDeclaration {
|
|
21
|
+
readonly product: string;
|
|
22
|
+
/** The starters a new project begins from. */
|
|
23
|
+
readonly templates: readonly ProductCreateChoice[];
|
|
24
|
+
/** Finished projects to learn from, each made whole (`create --example <id>`). */
|
|
25
|
+
readonly examples?: readonly ProductCreateChoice[];
|
|
26
|
+
create(request: ProductCreateRequest): Promise<ProductCreateResult>;
|
|
27
|
+
}
|
|
28
|
+
export declare function assertProductCreateDeclaration(value: unknown, source: string): ProductCreateDeclaration;
|
|
29
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// src/product-create.ts
|
|
2
|
+
function assertProductCreateDeclaration(value, source) {
|
|
3
|
+
const declaration = value;
|
|
4
|
+
const choices = (list) => Array.isArray(list) && !list.some((t) => typeof t?.id !== "string" || typeof t?.name !== "string");
|
|
5
|
+
if (!declaration || typeof declaration.product !== "string" || typeof declaration.create !== "function" || !choices(declaration.templates) || declaration.examples !== void 0 && !choices(declaration.examples)) {
|
|
6
|
+
throw new Error(`${source}: expected a product, templates (and any examples) and create(request) function`);
|
|
7
|
+
}
|
|
8
|
+
return declaration;
|
|
9
|
+
}
|
|
10
|
+
export {
|
|
11
|
+
assertProductCreateDeclaration
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=product-create.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/product-create.ts"],
|
|
4
|
+
"sourcesContent": ["/** Project creation is executable product code, shared by its CLI and the host. */\nexport interface ProductCreateRequest {\n name: string;\n targetDir: string;\n /** A starter the product offers (its `templates`), or none for its default. */\n template?: string;\n /** One of the product's example projects (its `examples`), in place of a template. */\n example?: string;\n}\nexport interface ProductCreateResult {\n targetDir: string;\n manifest: unknown;\n}\n/** A starter or an example a product creates, as a picker lists it. */\ninterface ProductCreateChoice {\n readonly id: string;\n readonly name: string;\n readonly description?: string;\n}\nexport interface ProductCreateDeclaration {\n readonly product: string;\n /** The starters a new project begins from. */\n readonly templates: readonly ProductCreateChoice[];\n /** Finished projects to learn from, each made whole (`create --example <id>`). */\n readonly examples?: readonly ProductCreateChoice[];\n create(request: ProductCreateRequest): Promise<ProductCreateResult>;\n}\nexport function assertProductCreateDeclaration(value: unknown, source: string): ProductCreateDeclaration {\n const declaration = value as Partial<ProductCreateDeclaration> | null;\n const choices = (list: unknown): boolean =>\n Array.isArray(list) && !list.some(t => typeof t?.id !== 'string' || typeof t?.name !== 'string');\n if (!declaration || typeof declaration.product !== 'string' ||\n typeof declaration.create !== 'function' || !choices(declaration.templates) ||\n (declaration.examples !== undefined && !choices(declaration.examples))) {\n throw new Error(`${source}: expected a product, templates (and any examples) and create(request) function`);\n }\n return declaration as ProductCreateDeclaration;\n}\n"],
|
|
5
|
+
"mappings": ";AA2BO,SAAS,+BAA+B,OAAgB,QAA0C;AACvG,QAAM,cAAc;AACpB,QAAM,UAAU,CAAC,SACf,MAAM,QAAQ,IAAI,KAAK,CAAC,KAAK,KAAK,OAAK,OAAO,GAAG,OAAO,YAAY,OAAO,GAAG,SAAS,QAAQ;AACjG,MAAI,CAAC,eAAe,OAAO,YAAY,YAAY,YAC/C,OAAO,YAAY,WAAW,cAAc,CAAC,QAAQ,YAAY,SAAS,KACzE,YAAY,aAAa,UAAa,CAAC,QAAQ,YAAY,QAAQ,GAAI;AAC1E,UAAM,IAAI,MAAM,GAAG,MAAM,iFAAiF;AAAA,EAC5G;AACA,SAAO;AACT;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { type ProductDeclaration } from './volter-manifest';
|
|
2
|
+
export declare const PRODUCT_DECLARATION_KEY = "contributes.volter.product";
|
|
3
|
+
/** Light or dark — the two the workbench's own `ColorScheme` has plain names
|
|
4
|
+
* for, and the only two a product needs to state (a high-contrast scheme is a
|
|
5
|
+
* person's accessibility choice, never a product's declaration). */
|
|
6
|
+
export type ProductColorTheme = 'dark' | 'light';
|
|
7
|
+
export interface ProductWorkbench {
|
|
8
|
+
/** The GitHub Release tag on `volter-ai/code-oss`. */
|
|
9
|
+
readonly release: string;
|
|
10
|
+
/** The sha256 of that release's tarball asset, hex. */
|
|
11
|
+
readonly tarballSha256: string;
|
|
12
|
+
}
|
|
13
|
+
/** A product package, as everything outside it needs to know it. */
|
|
14
|
+
export interface ProductIdentity {
|
|
15
|
+
readonly name: string;
|
|
16
|
+
/** Its version, reported beside the workbench by the editor's `status` command. */
|
|
17
|
+
readonly version: string;
|
|
18
|
+
readonly command: string;
|
|
19
|
+
/** The name a person sees — `contributes.volter.product.displayName`. */
|
|
20
|
+
readonly displayName: string;
|
|
21
|
+
/**
|
|
22
|
+
* `contributes.volter.product.upgrade: true` — its command has `upgrade [version]`
|
|
23
|
+
* (the product CLI's own), so a pinned-engine refusal
|
|
24
|
+
* may tell a person to run it. Optional: a product that says nothing has none.
|
|
25
|
+
*/
|
|
26
|
+
readonly upgrade?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* `contributes.volter.product.adapterRequired: true` — a project this product opens must have its own
|
|
29
|
+
* adapter module (`editor/volter.adapter.ts`), because the product's layout and document
|
|
30
|
+
* finders are declared there and the native default shows none of them. Such a product refuses
|
|
31
|
+
* a project without one. Optional: a product that says nothing opens it on the native default.
|
|
32
|
+
*/
|
|
33
|
+
readonly adapterRequired?: boolean;
|
|
34
|
+
/** Its package root, absolute. */
|
|
35
|
+
readonly dir: string;
|
|
36
|
+
/**
|
|
37
|
+
* Its ONE source entry, package-relative and POSIX (`./src/index.ts`). That
|
|
38
|
+
* entry IS the product's frame entry: it composes and re-exports `mountVolter`,
|
|
39
|
+
* which is the name the fork's contribution reads off the served module.
|
|
40
|
+
*/
|
|
41
|
+
readonly entry: string;
|
|
42
|
+
/**
|
|
43
|
+
* The packages this product mounts, in order — `contributes.volter.product.composes`. The ONE statement of
|
|
44
|
+
* the composition: the build serves it to the entry as `volter:composition`, and the session
|
|
45
|
+
* reads it here for the catalog and the serving doors.
|
|
46
|
+
*/
|
|
47
|
+
readonly composes: readonly string[];
|
|
48
|
+
readonly colorTheme: ProductColorTheme;
|
|
49
|
+
/** WHICH WORKBENCH THIS PRODUCT IS — see {@link ProductWorkbench}. */
|
|
50
|
+
readonly workbench: ProductWorkbench | null;
|
|
51
|
+
/**
|
|
52
|
+
* The ONE LINE that installs this product and starts a project in it —
|
|
53
|
+
* `contributes.volter.product.install` (`npx <name> create my-project`). A limited view quotes
|
|
54
|
+
* it wherever it cannot do what the local editor does (its agent answers with it, and every
|
|
55
|
+
* route it does not carry names it), so it is a declaration read without running the product.
|
|
56
|
+
* An undeclared one is `npx <name> create my-project`, which is what every product's `create`
|
|
57
|
+
* verb accepts.
|
|
58
|
+
*/
|
|
59
|
+
readonly install: string;
|
|
60
|
+
}
|
|
61
|
+
/** What a project without a product is told to add: the declaration this module reads, naming no package. */
|
|
62
|
+
export declare const PRODUCT_DECLARATION_HINT = "a product package as a dev dependency: one whose package.json declares `contributes.volter.product`";
|
|
63
|
+
/**
|
|
64
|
+
* Read one product package's declaration, or `null` when the manifest is not a
|
|
65
|
+
* product's. Throws when it declares `contributes.volter.product` and the declaration is
|
|
66
|
+
* unusable — a half-written product must be named, never skipped.
|
|
67
|
+
*/
|
|
68
|
+
export declare function readProductManifest(packageDir: string): ProductIdentity | null;
|
|
69
|
+
/** A product declaration's `composes`, checked: the packages it mounts, by name, in order. The
|
|
70
|
+
* build's composition module and the session read it through this one check. */
|
|
71
|
+
export declare function productComposes(manifestPath: string, declared: ProductDeclaration): string[];
|
|
72
|
+
/**
|
|
73
|
+
* A product's SHORT id — `@<scope>/<name>` → `<name>`.
|
|
74
|
+
*
|
|
75
|
+
* It is the product's own `product({ id })`, the directory its workbench half
|
|
76
|
+
* lives in (`packages/<id>/workbench`), the `--product` flag the overlay and the
|
|
77
|
+
* release build take, and what a release records in `BUILD.json`. One derivation
|
|
78
|
+
* rather than four literals: the package name is the only place the product is
|
|
79
|
+
* NAMED, and everything else is that name's last segment.
|
|
80
|
+
*/
|
|
81
|
+
export declare function workbenchProductId(packageName: string): string;
|
|
82
|
+
/** A product's entry as a path relative to `fromDir`, POSIX — the spelling a
|
|
83
|
+
* Vite manifest key and a dev-server URL both use. */
|
|
84
|
+
export declare function productEntryPath(product: ProductIdentity, fromDir: string): string;
|
|
85
|
+
/**
|
|
86
|
+
* The packages `product` mounts that are installed and contribute: its `contributes.volter.product.composes`,
|
|
87
|
+
* each resolved from the product's own directory and kept when its manifest declares
|
|
88
|
+
* a `contributes.volter` object (its serving half, `contributes.volter.serving`, may be all a package contributes).
|
|
89
|
+
*/
|
|
90
|
+
export declare function productComposedPackages(product: ProductIdentity): string[];
|
|
91
|
+
/** The products this project declares AND resolves, in declaration order. */
|
|
92
|
+
export declare function declaredProducts(projectRoot: string): ProductIdentity[];
|
|
93
|
+
/**
|
|
94
|
+
* THE product this project opens in, or a throw naming what is wrong.
|
|
95
|
+
*
|
|
96
|
+
* The refusals are the whole point: a project with none and a project with two
|
|
97
|
+
* are both states a person can be in, and neither has an answer this code may
|
|
98
|
+
* invent.
|
|
99
|
+
*/
|
|
100
|
+
export declare function resolveProductForProject(projectRoot: string): ProductIdentity;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import {
|
|
2
|
+
PRODUCT_DECLARATION_HINT,
|
|
3
|
+
PRODUCT_DECLARATION_KEY,
|
|
4
|
+
declaredProducts,
|
|
5
|
+
productComposedPackages,
|
|
6
|
+
productComposes,
|
|
7
|
+
productEntryPath,
|
|
8
|
+
readProductManifest,
|
|
9
|
+
resolveProductForProject,
|
|
10
|
+
workbenchProductId
|
|
11
|
+
} from "./chunk-SDIWRX5X.js";
|
|
12
|
+
import "./chunk-7WKVJGHZ.js";
|
|
13
|
+
import "./chunk-YPAOTPIF.js";
|
|
14
|
+
export {
|
|
15
|
+
PRODUCT_DECLARATION_HINT,
|
|
16
|
+
PRODUCT_DECLARATION_KEY,
|
|
17
|
+
declaredProducts,
|
|
18
|
+
productComposedPackages,
|
|
19
|
+
productComposes,
|
|
20
|
+
productEntryPath,
|
|
21
|
+
readProductManifest,
|
|
22
|
+
resolveProductForProject,
|
|
23
|
+
workbenchProductId
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=product-locator.js.map
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared editor-session registry format: entry shape, guards, path,
|
|
3
|
+
* liveness-filtered reads, served-project parsing and pending launches.
|
|
4
|
+
* The server’s session-registry module owns writes to this format.
|
|
5
|
+
*/
|
|
6
|
+
/** One registry entry, exactly as the server's write half records it. */
|
|
7
|
+
export interface EditorSessionEntry {
|
|
8
|
+
/** Canonical project root currently open, or null when none. */
|
|
9
|
+
project: string | null;
|
|
10
|
+
port: number;
|
|
11
|
+
/** PID of the dev-server process. */
|
|
12
|
+
pid: number;
|
|
13
|
+
/** ISO timestamp of server start. */
|
|
14
|
+
startedAt: string;
|
|
15
|
+
sessionId: string | null;
|
|
16
|
+
/** Private loopback control credential — never returned by an editor HTTP
|
|
17
|
+
* route; exists only in this user-private registry. */
|
|
18
|
+
controlSecret?: string | null;
|
|
19
|
+
repositoryId: string | null;
|
|
20
|
+
worktreeId: string | null;
|
|
21
|
+
worktreeRoot: string | null;
|
|
22
|
+
projectRelativePath: string | null;
|
|
23
|
+
branch: string | null;
|
|
24
|
+
headCommit: string | null;
|
|
25
|
+
baseCommit: string | null;
|
|
26
|
+
}
|
|
27
|
+
export declare const EDITOR_SESSIONS_REGISTRY_FILE: string;
|
|
28
|
+
export declare function isEditorSessionEntry(v: unknown): v is EditorSessionEntry;
|
|
29
|
+
export declare function normalizeEditorSessionEntry(session: EditorSessionEntry): EditorSessionEntry;
|
|
30
|
+
/** Whether pid exists. Signal 0's EPERM means it exists but this caller cannot signal it. */
|
|
31
|
+
export declare function pidAlive(pid: number): boolean;
|
|
32
|
+
/** The registry's live entries — shape-validated and PID-liveness-filtered. */
|
|
33
|
+
export declare function readLiveRegisteredSessions(): EditorSessionEntry[];
|
|
34
|
+
/** Announce a launch before the server can register. Each launcher owns its file. */
|
|
35
|
+
export declare function announceEditorLaunch(project: string): () => void;
|
|
36
|
+
/** Wait only for an observed live launcher, never for a missing editor. */
|
|
37
|
+
export declare function waitForPendingEditorLaunch(project: string): Promise<void>;
|
|
38
|
+
/** Read the project identity reported by /__editor/project. A serving path
|
|
39
|
+
* identifies an open project even when its manifest cannot be parsed or
|
|
40
|
+
* validated; project: null alone denotes no described project. */
|
|
41
|
+
export declare function servedProjectAnswer(body: unknown): {
|
|
42
|
+
path: string | null;
|
|
43
|
+
manifestError: string | null;
|
|
44
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import {
|
|
2
|
+
EDITOR_SESSIONS_REGISTRY_FILE,
|
|
3
|
+
announceEditorLaunch,
|
|
4
|
+
isEditorSessionEntry,
|
|
5
|
+
normalizeEditorSessionEntry,
|
|
6
|
+
pidAlive,
|
|
7
|
+
readLiveRegisteredSessions,
|
|
8
|
+
servedProjectAnswer,
|
|
9
|
+
waitForPendingEditorLaunch
|
|
10
|
+
} from "./chunk-Y5W77HYT.js";
|
|
11
|
+
export {
|
|
12
|
+
EDITOR_SESSIONS_REGISTRY_FILE,
|
|
13
|
+
announceEditorLaunch,
|
|
14
|
+
isEditorSessionEntry,
|
|
15
|
+
normalizeEditorSessionEntry,
|
|
16
|
+
pidAlive,
|
|
17
|
+
readLiveRegisteredSessions,
|
|
18
|
+
servedProjectAnswer,
|
|
19
|
+
waitForPendingEditorLaunch
|
|
20
|
+
};
|
|
21
|
+
//# sourceMappingURL=registry-format.js.map
|
package/dist/session.d.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
/** Resolve an existing session for exactly one project.
|
|
2
2
|
* Prefer the project's hint, verify it against the served canonical path,
|
|
3
|
-
* then consult the shared registry. Never fall back to another project.
|
|
4
|
-
|
|
5
|
-
import { type SessionListingTransport as SessionDiscoveryTransport } from '@volter/sdk/session/discovery';
|
|
3
|
+
* then consult the shared registry. Never fall back to another project. */
|
|
4
|
+
import { type SessionListingTransport as SessionDiscoveryTransport } from './discovery.js';
|
|
6
5
|
/** Nearest ancestor containing the project's canonical manifest. */
|
|
7
6
|
export declare function findProjectRootFrom(dir: string): string | null;
|
|
8
7
|
/** The minimal slice of `EditorTransport` `resolveSession` actually needs — narrower than the full interface so a test double only has to implement one method. */
|
|
@@ -32,4 +31,12 @@ export interface ProjectSessionHint {
|
|
|
32
31
|
/** The code a refusal carries when the registry was read and no session opens the project: the
|
|
33
32
|
* one state in which "no editor is open here" is a fact, which `close` answers as done. */
|
|
34
33
|
export declare const NO_SESSION_FOR_PROJECT = "VOLTER_NO_SESSION_FOR_PROJECT";
|
|
34
|
+
/** The `code` of the refusal for this project's session whose manifest does not load; it carries `session`. */
|
|
35
|
+
export declare const SESSION_MANIFEST_UNREADABLE = "VOLTER_SESSION_MANIFEST_UNREADABLE";
|
|
36
|
+
/**
|
|
37
|
+
* Resolve `projectDir` (default `process.cwd()`) to its already-running editor
|
|
38
|
+
* session. Verify the project hint, then consult the shared registry, with
|
|
39
|
+
* each discovery probe bounded by `EDITOR_SESSION_DISCOVERY_TIMEOUT_MS`.
|
|
40
|
+
* Throw when no project manifest or matching live session is found.
|
|
41
|
+
*/
|
|
35
42
|
export declare function resolveSession(projectDir?: string, deps?: SessionResolutionDeps): Promise<ResolvedSession>;
|
package/dist/singleton.d.ts
CHANGED
|
@@ -1,18 +1,6 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* A tiny memoized-async-factory primitive — the machinery behind
|
|
3
|
-
* `index.ts`'s lazy top-level `editor`/`tools` singletons. Pulled into
|
|
4
|
-
* its own module (rather than inlined) so it's independently unit-testable
|
|
5
|
-
* with a fake factory, with no need to exercise a real `connect()` (session
|
|
6
|
-
* discovery, network) just to prove "two accesses, one connect".
|
|
7
|
-
*
|
|
8
|
-
* Caches the in-flight PROMISE, not just the resolved value — two callers
|
|
9
|
-
* racing `ensure()` before the first resolves still share the SAME
|
|
10
|
-
* connection attempt, not two independent ones.
|
|
11
|
-
*/
|
|
1
|
+
/** Memoized async connection. Concurrent ensure calls share the same in-flight promise. */
|
|
12
2
|
export interface LazySession<T> {
|
|
13
3
|
/** Returns the memoized promise, creating it via `factory()` on first call. */
|
|
14
4
|
ensure(): Promise<T>;
|
|
15
|
-
/** Clears the memo — the NEXT `ensure()` calls `factory()` again. Exposed for tests (and for a caller that deliberately wants to reconnect); not needed in ordinary use. */
|
|
16
|
-
reset(): void;
|
|
17
5
|
}
|
|
18
6
|
export declare function createLazySession<T>(factory: () => Promise<T>): LazySession<T>;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* THE NODE READER of a package's `package.json` as Volter reads it: its name, its dependency
|
|
3
|
+
* names and its `contributes.volter` declarations, which `@volter/sdk/volter-contributions` reads as the workbench and
|
|
4
|
+
* the page read them. The build's product plugin, the session's catalog and
|
|
5
|
+
* serving doors, the shared-React scope and the pre-bundle crawl all read a package here, so a
|
|
6
|
+
* declaration means one thing everywhere it is read.
|
|
7
|
+
*
|
|
8
|
+
* It parses and does no policy. What an unusable declaration costs is the caller's to say: a
|
|
9
|
+
* product build refuses it, the catalog reports it as a load error, a scope decision treats it
|
|
10
|
+
* as no declaration. {@link declaredContributions} is the one test of "this package contributes".
|
|
11
|
+
*/
|
|
12
|
+
export interface VolterManifest {
|
|
13
|
+
/** The `package.json`, absolute. */
|
|
14
|
+
readonly path: string;
|
|
15
|
+
/** Its package's directory. */
|
|
16
|
+
readonly dir: string;
|
|
17
|
+
readonly name: string | null;
|
|
18
|
+
readonly version: string | null;
|
|
19
|
+
readonly private: boolean;
|
|
20
|
+
readonly bin: unknown;
|
|
21
|
+
/** Every name in `dependencies`, `devDependencies` and `optionalDependencies`, in that order,
|
|
22
|
+
* each once. */
|
|
23
|
+
readonly dependencyNames: readonly string[];
|
|
24
|
+
/** `package.json#contributes.volter`, unchecked: the package's contribution modules, an object
|
|
25
|
+
* keyed by kind, and its declarations (`serving`, `viewRoutes`, `product`). It is where Code-OSS's extension
|
|
26
|
+
* service reads them too, through the kit's `volter` extension point. */
|
|
27
|
+
readonly contributions: unknown;
|
|
28
|
+
/** `package.json#contributes.languageModelTools`, unchecked: the agent tools Code-OSS registers from it. */
|
|
29
|
+
readonly languageModelTools: unknown;
|
|
30
|
+
/** `package.json#contributes.volter.product`, a product's declaration, read and checked by `product-locator.ts`;
|
|
31
|
+
* `undefined` when the package declares none or it is not an object. */
|
|
32
|
+
readonly product: ProductDeclaration | undefined;
|
|
33
|
+
}
|
|
34
|
+
/** `package.json#contributes.volter.product`, as declared and unchecked. */
|
|
35
|
+
export interface ProductDeclaration {
|
|
36
|
+
readonly entry?: unknown;
|
|
37
|
+
readonly composes?: unknown;
|
|
38
|
+
readonly colorTheme?: unknown;
|
|
39
|
+
readonly workbench?: unknown;
|
|
40
|
+
readonly displayName?: unknown;
|
|
41
|
+
readonly install?: unknown;
|
|
42
|
+
readonly upgrade?: unknown;
|
|
43
|
+
readonly adapterRequired?: unknown;
|
|
44
|
+
}
|
|
45
|
+
/** `path`'s manifest, or `null` when there is no file there or it is not a JSON object. */
|
|
46
|
+
export declare function readVolterManifest(path: string): VolterManifest | null;
|
|
47
|
+
/**
|
|
48
|
+
* The package's declared modules, each contribution's and its page half's, with why any entry is refused; `null` when
|
|
49
|
+
* it declares none (an absent `contributes.volter`, or one that is not an object). A package with the object, even an
|
|
50
|
+
* empty one, is a contributing package: its modules are editor-tree code.
|
|
51
|
+
*/
|
|
52
|
+
export declare function declaredContributions(manifest: VolterManifest | null): {
|
|
53
|
+
readonly modules: readonly string[];
|
|
54
|
+
readonly errors: readonly string[];
|
|
55
|
+
} | null;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { type ProductIdentity } from './product-locator';
|
|
2
|
+
/** Where a project declares its workbench, relative to the project root. */
|
|
3
|
+
export declare const WORKBENCH_LOCATOR_PATH = ".volter/workbench.json";
|
|
4
|
+
/** What the session reports about the workbench it is running. */
|
|
5
|
+
export interface WorkbenchIdentity {
|
|
6
|
+
readonly kind: 'release' | 'sources';
|
|
7
|
+
/** The directory named by the declaration or the flag, resolved absolute. */
|
|
8
|
+
readonly dir: string;
|
|
9
|
+
/** The Code-OSS fork commit these bytes are. */
|
|
10
|
+
readonly commit: string;
|
|
11
|
+
readonly product: string;
|
|
12
|
+
}
|
|
13
|
+
/** Everything the session needs to run it, identity included. */
|
|
14
|
+
export interface ResolvedWorkbench extends WorkbenchIdentity {
|
|
15
|
+
/** The executable to spawn, already known to exist. */
|
|
16
|
+
readonly serverBin: string;
|
|
17
|
+
/** Its working directory — the package root, or the checkout. */
|
|
18
|
+
readonly cwd: string;
|
|
19
|
+
}
|
|
20
|
+
/** The exact file to write, quoted in every refusal that wants one. */
|
|
21
|
+
export declare function workbenchDeclarationExample(projectRoot: string): string;
|
|
22
|
+
/**
|
|
23
|
+
* The workbench directory this project declares, or `null` when it declares
|
|
24
|
+
* none. Throws when the file exists and is not exactly `{ "workbench": <path> }`
|
|
25
|
+
* — unrecognized keys are refused.
|
|
26
|
+
*/
|
|
27
|
+
export declare function readWorkbenchDeclaration(projectRoot: string): string | null;
|
|
28
|
+
/**
|
|
29
|
+
* WRITE THE DECLARATION — the one record of which workbench THIS machine opens
|
|
30
|
+
* this project in. Written by `<product> create --workbench <dir>`, and written
|
|
31
|
+
* by the fetch below, so the two paths cannot leave two different shapes of
|
|
32
|
+
* file behind.
|
|
33
|
+
*/
|
|
34
|
+
export declare function writeWorkbenchDeclaration(projectRoot: string, workbenchDir: string): void;
|
|
35
|
+
/**
|
|
36
|
+
* The url the workbench answers on — the ONE url a person opens under the
|
|
37
|
+
* frame. Spelled here so the CLI's launch line and the session's tab bijection
|
|
38
|
+
* cannot disagree about it.
|
|
39
|
+
*
|
|
40
|
+
* `?project=<id>` is the one boot param the Volter editor carries; the session's
|
|
41
|
+
* one-origin proxy redirects it to the workbench's own `?folder=`, and
|
|
42
|
+
* `frame-proxy.ts` says why it must be a redirect.
|
|
43
|
+
*/
|
|
44
|
+
export declare function workbenchUrl(proxyPort: number, projectRoot: string): string;
|
|
45
|
+
/** A project's stable key on this machine: its page's host, and its workbench extensions folder. */
|
|
46
|
+
export declare function projectKey(projectRoot: string): string;
|
|
47
|
+
/** The workbench at `dir`, refused where it is built for another product than `expectedProduct`; none named (a session
|
|
48
|
+
* whose project's product cannot be resolved, which `/__editor/served-modules` explains) is not judged. */
|
|
49
|
+
export declare function resolveWorkbench(dir: string, expectedProduct?: string): ResolvedWorkbench;
|
|
50
|
+
/**
|
|
51
|
+
* WHERE FETCHED BYTES LIVE — one directory per release tag, per user (`~/.volter/workbenches`).
|
|
52
|
+
*
|
|
53
|
+
* Keyed by the TAG and nothing else, because that is what makes it a cache and
|
|
54
|
+
* not a decision: two projects on the same release share one directory,
|
|
55
|
+
* a second `create` consults no network, and a release is immutable, so a tag
|
|
56
|
+
* that is here is the tag that was published. Which workbench a project opens
|
|
57
|
+
* in is still recorded in the PROJECT (`.volter/workbench.json`, written the
|
|
58
|
+
* moment this resolves) — nothing ever searches this directory.
|
|
59
|
+
*/
|
|
60
|
+
export declare const WORKBENCH_CACHE_ROOT: string;
|
|
61
|
+
/** Where the fetch talks. `log` is a line; `progress` is ONE line rewritten in
|
|
62
|
+
* place (216 MB is a wait, and a wait with no number is a hang). */
|
|
63
|
+
export interface WorkbenchFetchIO {
|
|
64
|
+
readonly log: (line: string) => void;
|
|
65
|
+
readonly progress?: (line: string) => void;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* THE WORKBENCH THIS PROJECT OPENS IN, resolved in three steps:
|
|
69
|
+
*
|
|
70
|
+
* 1. `--workbench <dir>` — one launch, writes nothing.
|
|
71
|
+
* 2. `<project>/.volter/workbench.json` — this machine's record for this project.
|
|
72
|
+
* 3. the PRODUCT's declared release — fetched once, then written into (2).
|
|
73
|
+
*
|
|
74
|
+
* Step 3 is what makes the product's `create` open something
|
|
75
|
+
* on a machine that has never built anything, and it is why the CLI resolves
|
|
76
|
+
* the product BEFORE the workbench.
|
|
77
|
+
*/
|
|
78
|
+
export declare function resolveWorkbenchForProject(options: {
|
|
79
|
+
projectRoot: string;
|
|
80
|
+
product: ProductIdentity;
|
|
81
|
+
/** `--workbench <dir>`, when the person passed one. */
|
|
82
|
+
override?: string | undefined;
|
|
83
|
+
io: WorkbenchFetchIO;
|
|
84
|
+
}): Promise<ResolvedWorkbench>;
|