@nodetool-ai/config 0.7.0-rc.23 → 0.8.2
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.md +50 -0
- package/dist/.nodetool-build-stamp +1 -0
- package/dist/__tests__/credit-policy.test.d.ts +2 -0
- package/dist/__tests__/credit-policy.test.d.ts.map +1 -0
- package/dist/__tests__/credit-policy.test.js +48 -0
- package/dist/__tests__/credit-policy.test.js.map +1 -0
- package/dist/__tests__/env-file.test.d.ts +2 -0
- package/dist/__tests__/env-file.test.d.ts.map +1 -0
- package/dist/__tests__/env-file.test.js +100 -0
- package/dist/__tests__/env-file.test.js.map +1 -0
- package/dist/__tests__/google-workspace.test.d.ts +2 -0
- package/dist/__tests__/google-workspace.test.d.ts.map +1 -0
- package/dist/__tests__/google-workspace.test.js +40 -0
- package/dist/__tests__/google-workspace.test.js.map +1 -0
- package/dist/__tests__/retention.test.d.ts +2 -0
- package/dist/__tests__/retention.test.d.ts.map +1 -0
- package/dist/__tests__/retention.test.js +21 -0
- package/dist/__tests__/retention.test.js.map +1 -0
- package/dist/byte-limits.d.ts +13 -0
- package/dist/byte-limits.d.ts.map +1 -0
- package/dist/byte-limits.js +28 -0
- package/dist/byte-limits.js.map +1 -0
- package/dist/credit-policy.d.ts +25 -0
- package/dist/credit-policy.d.ts.map +1 -0
- package/dist/credit-policy.js +63 -0
- package/dist/credit-policy.js.map +1 -0
- package/dist/deployment.d.ts +8 -0
- package/dist/deployment.d.ts.map +1 -0
- package/dist/deployment.js +19 -0
- package/dist/deployment.js.map +1 -0
- package/dist/env-file.d.ts +33 -0
- package/dist/env-file.d.ts.map +1 -0
- package/dist/env-file.js +83 -0
- package/dist/env-file.js.map +1 -0
- package/dist/environment.d.ts.map +1 -1
- package/dist/environment.js +20 -17
- package/dist/environment.js.map +1 -1
- package/dist/google-workspace.d.ts +3 -0
- package/dist/google-workspace.d.ts.map +1 -0
- package/dist/google-workspace.js +23 -0
- package/dist/google-workspace.js.map +1 -0
- package/dist/index.d.ts +14 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +14 -4
- package/dist/index.js.map +1 -1
- package/dist/logging.d.ts +12 -0
- package/dist/logging.d.ts.map +1 -1
- package/dist/logging.js +65 -28
- package/dist/logging.js.map +1 -1
- package/dist/node-import.d.ts +37 -0
- package/dist/node-import.d.ts.map +1 -0
- package/dist/node-import.js +119 -0
- package/dist/node-import.js.map +1 -0
- package/dist/optional-modules.d.ts +10 -0
- package/dist/optional-modules.d.ts.map +1 -0
- package/dist/optional-modules.js +58 -0
- package/dist/optional-modules.js.map +1 -0
- package/dist/package-asset-registry.d.ts +102 -0
- package/dist/package-asset-registry.d.ts.map +1 -0
- package/dist/package-asset-registry.js +157 -0
- package/dist/package-asset-registry.js.map +1 -0
- package/dist/package-assets.d.ts +52 -0
- package/dist/package-assets.d.ts.map +1 -0
- package/dist/package-assets.js +98 -0
- package/dist/package-assets.js.map +1 -0
- package/dist/paths.d.ts +52 -23
- package/dist/paths.d.ts.map +1 -1
- package/dist/paths.js +166 -47
- package/dist/paths.js.map +1 -1
- package/dist/retention.d.ts +3 -0
- package/dist/retention.d.ts.map +1 -0
- package/dist/retention.js +19 -0
- package/dist/retention.js.map +1 -0
- package/dist/setting-catalog.d.ts +28 -0
- package/dist/setting-catalog.d.ts.map +1 -0
- package/dist/setting-catalog.js +167 -0
- package/dist/setting-catalog.js.map +1 -0
- package/dist/storage-config.d.ts +45 -0
- package/dist/storage-config.d.ts.map +1 -0
- package/dist/storage-config.js +62 -0
- package/dist/storage-config.js.map +1 -0
- package/dist/trace-redaction.d.ts +5 -0
- package/dist/trace-redaction.d.ts.map +1 -0
- package/dist/trace-redaction.js +51 -0
- package/dist/trace-redaction.js.map +1 -0
- package/package.json +23 -8
- package/dist/diagnostics.d.ts +0 -27
- package/dist/diagnostics.d.ts.map +0 -1
- package/dist/diagnostics.js +0 -42
- package/dist/diagnostics.js.map +0 -1
- package/dist/settings.d.ts +0 -29
- package/dist/settings.d.ts.map +0 -1
- package/dist/settings.js +0 -29
- package/dist/settings.js.map +0 -1
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Import an optional dependency from the normal module graph, or — on Node —
|
|
3
|
+
* from a user-managed `node_modules` directory pointed to by
|
|
4
|
+
* NODETOOL_OPTIONAL_NODE_MODULES. The fallback path is Node-only; on
|
|
5
|
+
* browsers / Edge we just re-throw the original import failure.
|
|
6
|
+
*/
|
|
7
|
+
import { IS_NODE, importNodeBuiltin, importHidden } from "./node-import.js";
|
|
8
|
+
export async function importOptionalModule(packageName, options = {}) {
|
|
9
|
+
try {
|
|
10
|
+
// Some native wrappers ship TypeScript that ESM development loaders select
|
|
11
|
+
// instead of their published CommonJS entry point.
|
|
12
|
+
if (options.commonJs && IS_NODE) {
|
|
13
|
+
const module = await importNodeBuiltin("node:module");
|
|
14
|
+
if (!module) {
|
|
15
|
+
throw new Error("Node module loader is unavailable");
|
|
16
|
+
}
|
|
17
|
+
// SAFETY: T describes the caller's trusted package API, as with importHidden<T>.
|
|
18
|
+
return module.createRequire(import.meta.url)(packageName);
|
|
19
|
+
}
|
|
20
|
+
const mod = await importHidden(packageName);
|
|
21
|
+
if (mod === null) {
|
|
22
|
+
throw new Error(`importOptionalModule: ${packageName} unavailable on non-Node`);
|
|
23
|
+
}
|
|
24
|
+
return mod;
|
|
25
|
+
}
|
|
26
|
+
catch (error) {
|
|
27
|
+
if (!IS_NODE) {
|
|
28
|
+
throw error;
|
|
29
|
+
}
|
|
30
|
+
const optionalNodeModules = process.env["NODETOOL_OPTIONAL_NODE_MODULES"];
|
|
31
|
+
if (!optionalNodeModules) {
|
|
32
|
+
throw error;
|
|
33
|
+
}
|
|
34
|
+
try {
|
|
35
|
+
const modMod = await importNodeBuiltin("node:module");
|
|
36
|
+
const pathMod = await importNodeBuiltin("node:path");
|
|
37
|
+
const urlMod = await importNodeBuiltin("node:url");
|
|
38
|
+
if (!modMod || !pathMod || !urlMod) {
|
|
39
|
+
throw error;
|
|
40
|
+
}
|
|
41
|
+
const requireFromOptional = modMod.createRequire(pathMod.join(optionalNodeModules, "..", "package.json"));
|
|
42
|
+
if (options.commonJs) {
|
|
43
|
+
// SAFETY: The caller supplies the API type for this trusted runtime package.
|
|
44
|
+
return requireFromOptional(packageName);
|
|
45
|
+
}
|
|
46
|
+
const resolved = requireFromOptional.resolve(packageName);
|
|
47
|
+
const fileMod = await importHidden(urlMod.pathToFileURL(resolved).href);
|
|
48
|
+
if (fileMod === null) {
|
|
49
|
+
throw error;
|
|
50
|
+
}
|
|
51
|
+
return fileMod;
|
|
52
|
+
}
|
|
53
|
+
catch {
|
|
54
|
+
throw error;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=optional-modules.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"optional-modules.js","sourceRoot":"","sources":["../src/optional-modules.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,OAAO,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAE5E,MAAM,CAAC,KAAK,UAAU,oBAAoB,CACxC,WAAmB,EACnB,OAAO,GAA2B,EAAE;IAEpC,IAAI,CAAC;QACH,2EAA2E;QAC3E,mDAAmD;QACnD,IAAI,OAAO,CAAC,QAAQ,IAAI,OAAO,EAAE,CAAC;YAChC,MAAM,MAAM,GACV,MAAM,iBAAiB,CAA+B,aAAa,CAAC,CAAC;YACvE,IAAI,CAAC,MAAM,EAAE,CAAC;gBACZ,MAAM,IAAI,KAAK,CAAC,mCAAmC,CAAC,CAAC;YACvD,CAAC;YACD,iFAAiF;YACjF,OAAO,MAAM,CAAC,aAAa,CAAC,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,WAAW,CAAM,CAAC;QACjE,CAAC;QACD,MAAM,GAAG,GAAG,MAAM,YAAY,CAAI,WAAW,CAAC,CAAC;QAC/C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AAC,MAAM,CAAC;YACP,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Runtime asset registry — the single source of truth for data files that
|
|
3
|
+
* packages ship next to their compiled code and load at runtime (provider
|
|
4
|
+
* manifests today).
|
|
5
|
+
*
|
|
6
|
+
* Three layers consume it and must agree, which is exactly why it is one
|
|
7
|
+
* list instead of three conventions:
|
|
8
|
+
*
|
|
9
|
+
* 1. `package-assets.ts` — runtime resolution. Refuses to load a file that
|
|
10
|
+
* is not registered, so a forgotten registration fails loudly in dev
|
|
11
|
+
* instead of silently in the packaged app.
|
|
12
|
+
* 2. `scripts/bundle-backend.mjs` — stages every entry next to the
|
|
13
|
+
* bundled server.mjs and fails the build when a source file is missing
|
|
14
|
+
* or an on-disk manifest is not registered.
|
|
15
|
+
* 3. `scripts/verify-backend-bundle.mjs` — final artifact check
|
|
16
|
+
* that every manifest referenced by server.mjs is staged.
|
|
17
|
+
*
|
|
18
|
+
* `path` is relative to the owning package's `dist/`. Basenames must be
|
|
19
|
+
* unique across the registry: the packaged layout is flat, every file lands
|
|
20
|
+
* directly next to server.mjs.
|
|
21
|
+
*
|
|
22
|
+
* This module must stay free of imports — build scripts load it straight
|
|
23
|
+
* from `dist/` without pulling in the rest of the config package.
|
|
24
|
+
*/
|
|
25
|
+
export interface PackageAssetRef {
|
|
26
|
+
/** npm package that ships the file, e.g. "@nodetool-ai/kie-nodes". */
|
|
27
|
+
pkg: string;
|
|
28
|
+
/** File path relative to the package's dist/, e.g. "kie-manifest.json". */
|
|
29
|
+
path: string;
|
|
30
|
+
}
|
|
31
|
+
export declare const PACKAGE_RUNTIME_ASSETS: readonly PackageAssetRef[];
|
|
32
|
+
/**
|
|
33
|
+
* A directory of runtime files a package ships next to its sources rather than
|
|
34
|
+
* inside `dist/`, staged into the bundle as a directory instead of flattened
|
|
35
|
+
* by basename.
|
|
36
|
+
*
|
|
37
|
+
* Separate from {@link PACKAGE_RUNTIME_ASSETS} because the resolution rule is
|
|
38
|
+
* different in both halves: the source is the package root, not its build
|
|
39
|
+
* output (font binaries are inputs, and copying three megabytes through `tsc`
|
|
40
|
+
* would only duplicate them), and the staged copy keeps its directory, because
|
|
41
|
+
* the web serves the files by name over HTTP. The purpose is the same one C6
|
|
42
|
+
* names — the bundler stages it, the verifier checks it, so an unstaged file
|
|
43
|
+
* fails the build instead of the product.
|
|
44
|
+
*/
|
|
45
|
+
export interface PackageAssetDirRef {
|
|
46
|
+
/** npm package that ships the directory, e.g. "@nodetool-ai/timeline". */
|
|
47
|
+
pkg: string;
|
|
48
|
+
/** Directory relative to the package ROOT, e.g. "fonts". */
|
|
49
|
+
path: string;
|
|
50
|
+
/** Directory name under the bundle root the files are staged into. */
|
|
51
|
+
bundleDir: string;
|
|
52
|
+
/**
|
|
53
|
+
* Every file that must be present, in the source directory and in the
|
|
54
|
+
* artifact. Named rather than globbed: a build that silently ships nine of
|
|
55
|
+
* ten faces renders one family as a fallback, which looks like a design
|
|
56
|
+
* choice rather than a packaging bug.
|
|
57
|
+
*/
|
|
58
|
+
files: readonly string[];
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* The bundled font corpus (D8). The file list mirrors `BUNDLED_FONT_FILES` in
|
|
62
|
+
* `@nodetool-ai/timeline`; this module imports nothing, so
|
|
63
|
+
* `packages/execution/tests/timeline-font-registry.test.ts` is what holds the
|
|
64
|
+
* two lists together.
|
|
65
|
+
*/
|
|
66
|
+
export declare const PACKAGE_RUNTIME_ASSET_DIRS: readonly PackageAssetDirRef[];
|
|
67
|
+
/**
|
|
68
|
+
* Where the sandbox packs that ship with NodeTool live, in the repo and in the
|
|
69
|
+
* packaged artifact. Every host reads one of these two locations, so both names
|
|
70
|
+
* live here rather than in each script.
|
|
71
|
+
*
|
|
72
|
+
* The packs are config-only npm packages (a `nodetool.sandboxModules` manifest
|
|
73
|
+
* plus a SKILL.md) that no host code may import, so they are not workspaces and
|
|
74
|
+
* npm never links them into `node_modules`. Discovery therefore reads them from
|
|
75
|
+
* disk: `packages/sandbox-packs/` in a checkout, and `_sandbox/` next to
|
|
76
|
+
* `server.mjs` in the bundle, where `bundle-backend.mjs` stages every one of
|
|
77
|
+
* them and `verify-backend-bundle.mjs` checks the staged tree against each
|
|
78
|
+
* pack's own manifest. Both are directories of package directories, which is
|
|
79
|
+
* what {@link listPackageDirs} in `@nodetool-ai/node-sdk` enumerates — scoped
|
|
80
|
+
* names sit one level deeper, exactly as in `node_modules`.
|
|
81
|
+
*
|
|
82
|
+
* Staging is a scan, not a list: a pack added to the source directory ships
|
|
83
|
+
* without touching this file.
|
|
84
|
+
*/
|
|
85
|
+
export declare const SHIPPED_SANDBOX_PACKS_SOURCE_DIR = "packages/sandbox-packs";
|
|
86
|
+
/** The staged copy's directory name, relative to the bundled `server.mjs`. */
|
|
87
|
+
export declare const SHIPPED_SANDBOX_PACKS_BUNDLE_DIR = "_sandbox";
|
|
88
|
+
/**
|
|
89
|
+
* The system skills that ship with NodeTool.
|
|
90
|
+
*
|
|
91
|
+
* A system skill is a `SKILL.md` — frontmatter naming it, Markdown body — under
|
|
92
|
+
* a directory of its own, read-only at runtime. Same two-root shape as the
|
|
93
|
+
* sandbox packs above and for the same reason: nothing imports them, so npm
|
|
94
|
+
* links nothing, and each host reads them from where its own build put them.
|
|
95
|
+
* `NODETOOL_SYSTEM_SKILLS_DIR` overrides both.
|
|
96
|
+
*/
|
|
97
|
+
export declare const SHIPPED_SYSTEM_SKILLS_SOURCE_DIR = "packages/system-skills";
|
|
98
|
+
/** The staged copy's directory name, relative to the bundled `server.mjs`. */
|
|
99
|
+
export declare const SHIPPED_SYSTEM_SKILLS_BUNDLE_DIR = "_skills";
|
|
100
|
+
/** Registry lookup by exact pkg + path. */
|
|
101
|
+
export declare function findPackageAsset(pkg: string, path: string, registry?: readonly PackageAssetRef[]): PackageAssetRef | undefined;
|
|
102
|
+
//# sourceMappingURL=package-asset-registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"package-asset-registry.d.ts","sourceRoot":"","sources":["../src/package-asset-registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,MAAM,WAAW,eAAe;IAC9B,sEAAsE;IACtE,GAAG,EAAE,MAAM,CAAC;IACZ,2EAA2E;IAC3E,IAAI,EAAE,MAAM,CAAC;CACd;AAED,eAAO,MAAM,sBAAsB,EAAE,SAAS,eAAe,EAa5D,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,kBAAkB;IACjC,0EAA0E;IAC1E,GAAG,EAAE,MAAM,CAAC;IACZ,4DAA4D;IAC5D,IAAI,EAAE,MAAM,CAAC;IACb,sEAAsE;IACtE,SAAS,EAAE,MAAM,CAAC;IAClB;;;;;OAKG;IACH,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;CAC1B;AAED;;;;;GAKG;AACH,eAAO,MAAM,0BAA0B,EAAE,SAAS,kBAAkB,EA0EnE,CAAC;AAEF;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,gCAAgC,2BAA2B,CAAC;AAEzE,8EAA8E;AAC9E,eAAO,MAAM,gCAAgC,aAAa,CAAC;AAE3D;;;;;;;;GAQG;AACH,eAAO,MAAM,gCAAgC,2BAA2B,CAAC;AAEzE,8EAA8E;AAC9E,eAAO,MAAM,gCAAgC,YAAY,CAAC;AAE1D,2CAA2C;AAC3C,wBAAgB,gBAAgB,CAC9B,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,MAAM,EACZ,QAAQ,GAAE,SAAS,eAAe,EAA2B,GAC5D,eAAe,GAAG,SAAS,CAE7B"}
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Runtime asset registry — the single source of truth for data files that
|
|
3
|
+
* packages ship next to their compiled code and load at runtime (provider
|
|
4
|
+
* manifests today).
|
|
5
|
+
*
|
|
6
|
+
* Three layers consume it and must agree, which is exactly why it is one
|
|
7
|
+
* list instead of three conventions:
|
|
8
|
+
*
|
|
9
|
+
* 1. `package-assets.ts` — runtime resolution. Refuses to load a file that
|
|
10
|
+
* is not registered, so a forgotten registration fails loudly in dev
|
|
11
|
+
* instead of silently in the packaged app.
|
|
12
|
+
* 2. `scripts/bundle-backend.mjs` — stages every entry next to the
|
|
13
|
+
* bundled server.mjs and fails the build when a source file is missing
|
|
14
|
+
* or an on-disk manifest is not registered.
|
|
15
|
+
* 3. `scripts/verify-backend-bundle.mjs` — final artifact check
|
|
16
|
+
* that every manifest referenced by server.mjs is staged.
|
|
17
|
+
*
|
|
18
|
+
* `path` is relative to the owning package's `dist/`. Basenames must be
|
|
19
|
+
* unique across the registry: the packaged layout is flat, every file lands
|
|
20
|
+
* directly next to server.mjs.
|
|
21
|
+
*
|
|
22
|
+
* This module must stay free of imports — build scripts load it straight
|
|
23
|
+
* from `dist/` without pulling in the rest of the config package.
|
|
24
|
+
*/
|
|
25
|
+
export const PACKAGE_RUNTIME_ASSETS = [
|
|
26
|
+
{ pkg: "@nodetool-ai/atlascloud-nodes", path: "atlascloud-manifest.json" },
|
|
27
|
+
{ pkg: "@nodetool-ai/higgsfield-nodes", path: "higgsfield-manifest.json" },
|
|
28
|
+
{ pkg: "@nodetool-ai/fal-nodes", path: "fal-manifest.json" },
|
|
29
|
+
{ pkg: "@nodetool-ai/kie-nodes", path: "kie-manifest.json" },
|
|
30
|
+
{ pkg: "@nodetool-ai/replicate-nodes", path: "replicate-manifest.json" },
|
|
31
|
+
{ pkg: "@nodetool-ai/runtime", path: "providers/aki-manifest.json" },
|
|
32
|
+
{ pkg: "@nodetool-ai/together-nodes", path: "together-manifest.json" },
|
|
33
|
+
{ pkg: "@nodetool-ai/topaz-nodes", path: "topaz-manifest.json" },
|
|
34
|
+
{ pkg: "@nodetool-ai/video-nodes", path: "render3d-page.js" },
|
|
35
|
+
{ pkg: "@nodetool-ai/game-renderer", path: "player-v1.js" },
|
|
36
|
+
{ pkg: "@nodetool-ai/game-renderer", path: "game3d-capture-page.js" },
|
|
37
|
+
{ pkg: "@nodetool-ai/game-renderer", path: "game3d-player.js" }
|
|
38
|
+
];
|
|
39
|
+
/**
|
|
40
|
+
* The bundled font corpus (D8). The file list mirrors `BUNDLED_FONT_FILES` in
|
|
41
|
+
* `@nodetool-ai/timeline`; this module imports nothing, so
|
|
42
|
+
* `packages/execution/tests/timeline-font-registry.test.ts` is what holds the
|
|
43
|
+
* two lists together.
|
|
44
|
+
*/
|
|
45
|
+
export const PACKAGE_RUNTIME_ASSET_DIRS = [
|
|
46
|
+
{
|
|
47
|
+
pkg: "@nodetool-ai/timeline",
|
|
48
|
+
path: "fonts",
|
|
49
|
+
bundleDir: "fonts",
|
|
50
|
+
files: [
|
|
51
|
+
"BebasNeue-Regular.ttf",
|
|
52
|
+
"Inter-ExtraBold.ttf",
|
|
53
|
+
"Inter-Italic-Variable.ttf",
|
|
54
|
+
"Inter-SemiBold.ttf",
|
|
55
|
+
"Inter-Variable.ttf",
|
|
56
|
+
"JetBrainsMono-Italic-Variable.ttf",
|
|
57
|
+
"JetBrainsMono-Variable.ttf",
|
|
58
|
+
"Lora-Italic-Variable.ttf",
|
|
59
|
+
"Lora-Variable.ttf",
|
|
60
|
+
"OFL-BebasNeue.txt",
|
|
61
|
+
"OFL-Inter.txt",
|
|
62
|
+
"OFL-JetBrainsMono.txt",
|
|
63
|
+
"OFL-Lora.txt",
|
|
64
|
+
"OFL-PlayfairDisplay.txt",
|
|
65
|
+
"OFL-SpaceGrotesk.txt",
|
|
66
|
+
"PlayfairDisplay-Italic-Variable.ttf",
|
|
67
|
+
"PlayfairDisplay-Variable.ttf",
|
|
68
|
+
"SpaceGrotesk-Variable.ttf"
|
|
69
|
+
]
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
// The shipped timeline compositions (D11). Built by
|
|
73
|
+
// `scripts/build-example-compositions.mjs` from
|
|
74
|
+
// `scripts/example-compositions/compositions.mjs`, and read straight off
|
|
75
|
+
// disk by the `compositions` capability module — no database, no user — so
|
|
76
|
+
// an unstaged file means `list_compositions` reports only what a user has
|
|
77
|
+
// saved and the shipped half silently disappears from the packaged app.
|
|
78
|
+
pkg: "@nodetool-ai/base-nodes",
|
|
79
|
+
path: "nodetool/examples/compositions",
|
|
80
|
+
bundleDir: "examples/compositions",
|
|
81
|
+
files: [
|
|
82
|
+
"callout.composition.json",
|
|
83
|
+
"caption-bar.composition.json",
|
|
84
|
+
"cta-end-card.composition.json",
|
|
85
|
+
"logo-sting.composition.json",
|
|
86
|
+
"lower-third.composition.json",
|
|
87
|
+
"number-ticker.composition.json",
|
|
88
|
+
"title-slam.composition.json",
|
|
89
|
+
"window-frame.composition.json",
|
|
90
|
+
"word-cards.composition.json",
|
|
91
|
+
"title-card.composition.json"
|
|
92
|
+
]
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
// The Blender op scripts (D5). Staged whole next to the bundled server;
|
|
96
|
+
// every file is named so an unstaged module fails the build instead of
|
|
97
|
+
// the product.
|
|
98
|
+
pkg: "@nodetool-ai/blender-nodes",
|
|
99
|
+
path: "blender_ops",
|
|
100
|
+
bundleDir: "_blender_ops",
|
|
101
|
+
files: [
|
|
102
|
+
"run_job.py",
|
|
103
|
+
"framing.py",
|
|
104
|
+
"errors.py",
|
|
105
|
+
"depth.py",
|
|
106
|
+
"exr.py",
|
|
107
|
+
"ops/__init__.py",
|
|
108
|
+
"ops/common.py",
|
|
109
|
+
"ops/render_image.py",
|
|
110
|
+
"ops/render_passes.py",
|
|
111
|
+
"ops/render_animation.py",
|
|
112
|
+
"ops/prepare_for_engine.py",
|
|
113
|
+
"ops/export_model.py",
|
|
114
|
+
"tests/test_framing.py",
|
|
115
|
+
"tests/test_depth.py",
|
|
116
|
+
"tests/test_exr.py"
|
|
117
|
+
]
|
|
118
|
+
}
|
|
119
|
+
];
|
|
120
|
+
/**
|
|
121
|
+
* Where the sandbox packs that ship with NodeTool live, in the repo and in the
|
|
122
|
+
* packaged artifact. Every host reads one of these two locations, so both names
|
|
123
|
+
* live here rather than in each script.
|
|
124
|
+
*
|
|
125
|
+
* The packs are config-only npm packages (a `nodetool.sandboxModules` manifest
|
|
126
|
+
* plus a SKILL.md) that no host code may import, so they are not workspaces and
|
|
127
|
+
* npm never links them into `node_modules`. Discovery therefore reads them from
|
|
128
|
+
* disk: `packages/sandbox-packs/` in a checkout, and `_sandbox/` next to
|
|
129
|
+
* `server.mjs` in the bundle, where `bundle-backend.mjs` stages every one of
|
|
130
|
+
* them and `verify-backend-bundle.mjs` checks the staged tree against each
|
|
131
|
+
* pack's own manifest. Both are directories of package directories, which is
|
|
132
|
+
* what {@link listPackageDirs} in `@nodetool-ai/node-sdk` enumerates — scoped
|
|
133
|
+
* names sit one level deeper, exactly as in `node_modules`.
|
|
134
|
+
*
|
|
135
|
+
* Staging is a scan, not a list: a pack added to the source directory ships
|
|
136
|
+
* without touching this file.
|
|
137
|
+
*/
|
|
138
|
+
export const SHIPPED_SANDBOX_PACKS_SOURCE_DIR = "packages/sandbox-packs";
|
|
139
|
+
/** The staged copy's directory name, relative to the bundled `server.mjs`. */
|
|
140
|
+
export const SHIPPED_SANDBOX_PACKS_BUNDLE_DIR = "_sandbox";
|
|
141
|
+
/**
|
|
142
|
+
* The system skills that ship with NodeTool.
|
|
143
|
+
*
|
|
144
|
+
* A system skill is a `SKILL.md` — frontmatter naming it, Markdown body — under
|
|
145
|
+
* a directory of its own, read-only at runtime. Same two-root shape as the
|
|
146
|
+
* sandbox packs above and for the same reason: nothing imports them, so npm
|
|
147
|
+
* links nothing, and each host reads them from where its own build put them.
|
|
148
|
+
* `NODETOOL_SYSTEM_SKILLS_DIR` overrides both.
|
|
149
|
+
*/
|
|
150
|
+
export const SHIPPED_SYSTEM_SKILLS_SOURCE_DIR = "packages/system-skills";
|
|
151
|
+
/** The staged copy's directory name, relative to the bundled `server.mjs`. */
|
|
152
|
+
export const SHIPPED_SYSTEM_SKILLS_BUNDLE_DIR = "_skills";
|
|
153
|
+
/** Registry lookup by exact pkg + path. */
|
|
154
|
+
export function findPackageAsset(pkg, path, registry = PACKAGE_RUNTIME_ASSETS) {
|
|
155
|
+
return registry.find((a) => a.pkg === pkg && a.path === path);
|
|
156
|
+
}
|
|
157
|
+
//# sourceMappingURL=package-asset-registry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"package-asset-registry.js","sourceRoot":"","sources":["../src/package-asset-registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AASH,MAAM,CAAC,MAAM,sBAAsB,GAA+B;IAChE,EAAE,GAAG,EAAE,+BAA+B,EAAE,IAAI,EAAE,0BAA0B,EAAE;IAC1E,EAAE,GAAG,EAAE,+BAA+B,EAAE,IAAI,EAAE,0BAA0B,EAAE;IAC1E,EAAE,GAAG,EAAE,wBAAwB,EAAE,IAAI,EAAE,mBAAmB,EAAE;IAC5D,EAAE,GAAG,EAAE,wBAAwB,EAAE,IAAI,EAAE,mBAAmB,EAAE;IAC5D,EAAE,GAAG,EAAE,8BAA8B,EAAE,IAAI,EAAE,yBAAyB,EAAE;IACxE,EAAE,GAAG,EAAE,sBAAsB,EAAE,IAAI,EAAE,6BAA6B,EAAE;IACpE,EAAE,GAAG,EAAE,6BAA6B,EAAE,IAAI,EAAE,wBAAwB,EAAE;IACtE,EAAE,GAAG,EAAE,0BAA0B,EAAE,IAAI,EAAE,qBAAqB,EAAE;IAChE,EAAE,GAAG,EAAE,0BAA0B,EAAE,IAAI,EAAE,kBAAkB,EAAE;IAC7D,EAAE,GAAG,EAAE,4BAA4B,EAAE,IAAI,EAAE,cAAc,EAAE;IAC3D,EAAE,GAAG,EAAE,4BAA4B,EAAE,IAAI,EAAE,wBAAwB,EAAE;IACrE,EAAE,GAAG,EAAE,4BAA4B,EAAE,IAAI,EAAE,kBAAkB,EAAE;CAChE,CAAC;AA+BF;;;;;GAKG;AACH,MAAM,CAAC,MA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AAG,UAAU,CAAC;AAE3D;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,gCAAgC,GAAG,wBAAwB,CAAC;AAEzE,8EAA8E;AAC9E,MAAM,CAAC,MAAM,gCAAgC,GAAG,SAAS,CAAC;AAE1D,2CAA2C;AAC3C,MAAM,UAAU,gBAAgB,CAC9B,GAAW,EACX,IAAY,EACZ,QAAQ,GAA+B,sBAAsB;IAE7D,OAAO,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,KAAK,GAAG,IAAI,CAAC,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC;AAChE,CAAC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Guarded access to registered package runtime assets.
|
|
3
|
+
*
|
|
4
|
+
* Packages ship data files (provider manifests) next to their compiled code
|
|
5
|
+
* and load them at runtime. The file's location differs by deployment:
|
|
6
|
+
*
|
|
7
|
+
* - **dev / npm install**: the file resolves through package exports, e.g.
|
|
8
|
+
* `@nodetool-ai/kie-nodes/kie-manifest.json` → `<pkg>/dist/kie-manifest.json`.
|
|
9
|
+
* - **packaged Electron app**: esbuild flattens the whole backend into one
|
|
10
|
+
* `server.mjs`, so `import.meta.url`-relative paths all point at the bundle
|
|
11
|
+
* root, where `bundle-backend.mjs` stages each file by basename.
|
|
12
|
+
*
|
|
13
|
+
* This module is the single choke point for those loads. Every asset must be
|
|
14
|
+
* declared in `package-asset-registry.ts` — an unregistered ref throws
|
|
15
|
+
* immediately, in dev, with the fix in the message. Resolution outcomes are
|
|
16
|
+
* recorded and queryable via `getPackageAssetResolutions()` for diagnostics.
|
|
17
|
+
*/
|
|
18
|
+
import { type PackageAssetRef } from "./package-asset-registry.js";
|
|
19
|
+
/** How a requested asset resolved, for startup/health diagnostics. */
|
|
20
|
+
export interface PackageAssetResolution {
|
|
21
|
+
pkg: string;
|
|
22
|
+
path: string;
|
|
23
|
+
/** Absolute path the asset resolved to, or null when resolution failed. */
|
|
24
|
+
resolvedPath: string | null;
|
|
25
|
+
/** "package" = via package exports (dev/npm), "importer" = next to the importing module (packaged bundle). */
|
|
26
|
+
via: "package" | "importer" | null;
|
|
27
|
+
error?: string;
|
|
28
|
+
}
|
|
29
|
+
/** Every asset requested so far and how it resolved. */
|
|
30
|
+
export declare function getPackageAssetResolutions(): PackageAssetResolution[];
|
|
31
|
+
/**
|
|
32
|
+
* Resolve a registered asset to an absolute file path.
|
|
33
|
+
*
|
|
34
|
+
* Tries package-exports resolution first (dev / npm layout), then a file with
|
|
35
|
+
* the asset's basename next to the importing module (the flattened packaged
|
|
36
|
+
* layout — and the dev layout for same-package assets). Throws with both
|
|
37
|
+
* attempted locations when neither exists.
|
|
38
|
+
*
|
|
39
|
+
* @param ref - Registered asset (pkg + dist-relative path).
|
|
40
|
+
* @param importerUrl - The caller's `import.meta.url`. Required: in the
|
|
41
|
+
* packaged app it points at the bundle root where assets are staged.
|
|
42
|
+
* @param registry - Overridable for tests only.
|
|
43
|
+
*/
|
|
44
|
+
export declare function resolvePackageAssetPath(ref: PackageAssetRef, importerUrl: string, registry?: readonly PackageAssetRef[]): string;
|
|
45
|
+
/**
|
|
46
|
+
* Load a registered JSON asset. Loads through `require` rather than an `fs`
|
|
47
|
+
* read: the values flow into provider API requests, and a module load keeps
|
|
48
|
+
* static, trusted data from being modelled as untrusted file input
|
|
49
|
+
* (CodeQL js/file-access-to-http) — and gets caching for free.
|
|
50
|
+
*/
|
|
51
|
+
export declare function loadPackageAssetJson<T>(ref: PackageAssetRef, importerUrl: string, registry?: readonly PackageAssetRef[]): T;
|
|
52
|
+
//# sourceMappingURL=package-assets.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"package-assets.d.ts","sourceRoot":"","sources":["../src/package-assets.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAIH,OAAO,EAGL,KAAK,eAAe,EACrB,MAAM,6BAA6B,CAAC;AAcrC,sEAAsE;AACtE,MAAM,WAAW,sBAAsB;IACrC,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,2EAA2E;IAC3E,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,8GAA8G;IAC9G,GAAG,EAAE,SAAS,GAAG,UAAU,GAAG,IAAI,CAAC;IACnC,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAID,wDAAwD;AACxD,wBAAgB,0BAA0B,IAAI,sBAAsB,EAAE,CAErE;AAWD;;;;;;;;;;;;GAYG;AACH,wBAAgB,uBAAuB,CACrC,GAAG,EAAE,eAAe,EACpB,WAAW,EAAE,MAAM,EACnB,QAAQ,GAAE,SAAS,eAAe,EAA2B,GAC5D,MAAM,CA2CR;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,EACpC,GAAG,EAAE,eAAe,EACpB,WAAW,EAAE,MAAM,EACnB,QAAQ,GAAE,SAAS,eAAe,EAA2B,GAC5D,CAAC,CAOH"}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Guarded access to registered package runtime assets.
|
|
3
|
+
*
|
|
4
|
+
* Packages ship data files (provider manifests) next to their compiled code
|
|
5
|
+
* and load them at runtime. The file's location differs by deployment:
|
|
6
|
+
*
|
|
7
|
+
* - **dev / npm install**: the file resolves through package exports, e.g.
|
|
8
|
+
* `@nodetool-ai/kie-nodes/kie-manifest.json` → `<pkg>/dist/kie-manifest.json`.
|
|
9
|
+
* - **packaged Electron app**: esbuild flattens the whole backend into one
|
|
10
|
+
* `server.mjs`, so `import.meta.url`-relative paths all point at the bundle
|
|
11
|
+
* root, where `bundle-backend.mjs` stages each file by basename.
|
|
12
|
+
*
|
|
13
|
+
* This module is the single choke point for those loads. Every asset must be
|
|
14
|
+
* declared in `package-asset-registry.ts` — an unregistered ref throws
|
|
15
|
+
* immediately, in dev, with the fix in the message. Resolution outcomes are
|
|
16
|
+
* recorded and queryable via `getPackageAssetResolutions()` for diagnostics.
|
|
17
|
+
*/
|
|
18
|
+
import { IS_NODE, getNodeBuiltinSync } from "./node-import.js";
|
|
19
|
+
import { createLogger } from "./logging.js";
|
|
20
|
+
import { PACKAGE_RUNTIME_ASSETS, findPackageAsset } from "./package-asset-registry.js";
|
|
21
|
+
const log = createLogger("nodetool.config.package-assets");
|
|
22
|
+
const nodeModule = getNodeBuiltinSync("node:module");
|
|
23
|
+
const nodeFs = getNodeBuiltinSync("node:fs");
|
|
24
|
+
const nodeUrl = getNodeBuiltinSync("node:url");
|
|
25
|
+
const resolutions = new Map();
|
|
26
|
+
/** Every asset requested so far and how it resolved. */
|
|
27
|
+
export function getPackageAssetResolutions() {
|
|
28
|
+
return [...resolutions.values()];
|
|
29
|
+
}
|
|
30
|
+
function record(resolution) {
|
|
31
|
+
resolutions.set(`${resolution.pkg}/${resolution.path}`, resolution);
|
|
32
|
+
}
|
|
33
|
+
function basenameOf(assetPath) {
|
|
34
|
+
const parts = assetPath.split("/");
|
|
35
|
+
return parts[parts.length - 1];
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Resolve a registered asset to an absolute file path.
|
|
39
|
+
*
|
|
40
|
+
* Tries package-exports resolution first (dev / npm layout), then a file with
|
|
41
|
+
* the asset's basename next to the importing module (the flattened packaged
|
|
42
|
+
* layout — and the dev layout for same-package assets). Throws with both
|
|
43
|
+
* attempted locations when neither exists.
|
|
44
|
+
*
|
|
45
|
+
* @param ref - Registered asset (pkg + dist-relative path).
|
|
46
|
+
* @param importerUrl - The caller's `import.meta.url`. Required: in the
|
|
47
|
+
* packaged app it points at the bundle root where assets are staged.
|
|
48
|
+
* @param registry - Overridable for tests only.
|
|
49
|
+
*/
|
|
50
|
+
export function resolvePackageAssetPath(ref, importerUrl, registry = PACKAGE_RUNTIME_ASSETS) {
|
|
51
|
+
if (!findPackageAsset(ref.pkg, ref.path, registry)) {
|
|
52
|
+
throw new Error(`Package asset ${ref.pkg}/${ref.path} is not registered. Add it to ` +
|
|
53
|
+
`PACKAGE_RUNTIME_ASSETS in @nodetool-ai/config/src/package-asset-registry.ts ` +
|
|
54
|
+
`so the Electron packaging stages and verifies it.`);
|
|
55
|
+
}
|
|
56
|
+
if (!IS_NODE || !nodeModule || !nodeFs || !nodeUrl) {
|
|
57
|
+
throw new Error(`Package asset ${ref.pkg}/${ref.path} requested on a non-Node runtime.`);
|
|
58
|
+
}
|
|
59
|
+
const req = nodeModule.createRequire(importerUrl);
|
|
60
|
+
const specifier = `${ref.pkg}/${ref.path}`;
|
|
61
|
+
try {
|
|
62
|
+
const resolved = req.resolve(specifier);
|
|
63
|
+
record({ pkg: ref.pkg, path: ref.path, resolvedPath: resolved, via: "package" });
|
|
64
|
+
return resolved;
|
|
65
|
+
}
|
|
66
|
+
catch {
|
|
67
|
+
// Not resolvable through package exports — try the flattened layout.
|
|
68
|
+
}
|
|
69
|
+
const candidate = nodeUrl.fileURLToPath(new URL(basenameOf(ref.path), importerUrl));
|
|
70
|
+
if (nodeFs.existsSync(candidate)) {
|
|
71
|
+
record({ pkg: ref.pkg, path: ref.path, resolvedPath: candidate, via: "importer" });
|
|
72
|
+
return candidate;
|
|
73
|
+
}
|
|
74
|
+
const message = `Package asset ${ref.pkg}/${ref.path} not found. Tried package ` +
|
|
75
|
+
`resolution of "${specifier}" and "${candidate}" (relative to the ` +
|
|
76
|
+
`importer). In dev, check the owning package's build copies the file ` +
|
|
77
|
+
`into dist/ and its exports map the subpath. In the packaged app, check ` +
|
|
78
|
+
`scripts/bundle-backend.mjs staged it (verify-backend-bundle ` +
|
|
79
|
+
`should have failed the build).`;
|
|
80
|
+
record({ pkg: ref.pkg, path: ref.path, resolvedPath: null, via: null, error: message });
|
|
81
|
+
log.warn(message);
|
|
82
|
+
throw new Error(message);
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Load a registered JSON asset. Loads through `require` rather than an `fs`
|
|
86
|
+
* read: the values flow into provider API requests, and a module load keeps
|
|
87
|
+
* static, trusted data from being modelled as untrusted file input
|
|
88
|
+
* (CodeQL js/file-access-to-http) — and gets caching for free.
|
|
89
|
+
*/
|
|
90
|
+
export function loadPackageAssetJson(ref, importerUrl, registry = PACKAGE_RUNTIME_ASSETS) {
|
|
91
|
+
const resolved = resolvePackageAssetPath(ref, importerUrl, registry);
|
|
92
|
+
const req = nodeModule.createRequire(importerUrl);
|
|
93
|
+
// SAFETY: `T` is the shape the caller names for this registered asset;
|
|
94
|
+
// `resolvePackageAssetPath` has already checked the ref against the registry,
|
|
95
|
+
// so what `require` returns is that asset's JSON and nothing else.
|
|
96
|
+
return req(resolved);
|
|
97
|
+
}
|
|
98
|
+
//# sourceMappingURL=package-assets.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"package-assets.js","sourceRoot":"","sources":["../src/package-assets.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAC/D,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EACL,sBAAsB,EACtB,gBAAgB,EAEjB,MAAM,6BAA6B,CAAC;AAErC,MAAM,GAAG,GAAG,YAAY,CAAC,gCAAgC,CAAC,CAAC;AAE3D,MAAM,UAAU,GAAG,kBAAkB,CACnC,aAAa,CACd,CAAC;AACF,MAAM,MAAM,GAAG,kBAAkB,CAE9B,SAAS,CAAC,CAAC;AACd,MAAM,OAAO,GAAG,kBAAkB,CAE/B,UAAU,CAAC,CAAC;AAaf,MAAM,WAAW,GAAG,IAAI,GAAG,EAAkC,CAAC;AAE9D,wDAAwD;AACxD,MAAM,UAAU,0BAA0B;IACxC,OAAO,CAAC,GAAG,WAAW,CAAC,MAAM,EAAE,CAAC,CAAC;AACnC,CAAC;AAED,SAAS,MAAM,CAAC,UAAkC;IAChD,WAAW,CAAC,GAAG,CAAC,GAAG,UAAU,CAA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,CAAC;AAC5B,CAAC"}
|
package/dist/paths.d.ts
CHANGED
|
@@ -5,6 +5,10 @@
|
|
|
5
5
|
* re-implement OS detection or XDG logic.
|
|
6
6
|
*
|
|
7
7
|
* Priority: explicit env var > platform default.
|
|
8
|
+
*
|
|
9
|
+
* The `node:path` / `node:os` / `node:url` imports are loaded lazily via
|
|
10
|
+
* top-level dynamic import so this module loads on non-Node runtimes
|
|
11
|
+
* (browser, Edge). All exported functions throw if invoked off-Node.
|
|
8
12
|
*/
|
|
9
13
|
/**
|
|
10
14
|
* Base directory for all Nodetool user data.
|
|
@@ -16,7 +20,8 @@
|
|
|
16
20
|
* - macOS/Linux: $XDG_DATA_HOME/nodetool (fallback: ~/.local/share/nodetool)
|
|
17
21
|
*/
|
|
18
22
|
export declare function getNodetoolDataDir(): string;
|
|
19
|
-
|
|
23
|
+
export declare function getPostgresDatabaseUrl(): string | undefined;
|
|
24
|
+
/** Default path for the main SQLite database. Override with DB_PATH or DATABASE_URL. */
|
|
20
25
|
export declare function getDefaultDbPath(): string;
|
|
21
26
|
/** Default path for the vector store database. Override with VECTORSTORE_DB_PATH. */
|
|
22
27
|
export declare function getDefaultVectorstoreDbPath(): string;
|
|
@@ -32,38 +37,62 @@ export declare function getDefaultAssetsPath(): string;
|
|
|
32
37
|
*/
|
|
33
38
|
export declare function getDefaultTransformersJsCacheDir(): string;
|
|
34
39
|
/**
|
|
35
|
-
*
|
|
40
|
+
* Per-user cache root for derived artifacts NodeTool can always rebuild.
|
|
41
|
+
*
|
|
42
|
+
* Separate from {@link getNodetoolDataDir} on purpose: everything under here is
|
|
43
|
+
* safe to delete. Override with NODETOOL_CACHE_DIR.
|
|
36
44
|
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
|
|
40
|
-
|
|
45
|
+
* - Windows: %LOCALAPPDATA%\nodetool\cache
|
|
46
|
+
* - macOS/Linux: $XDG_CACHE_HOME/nodetool (fallback: ~/.cache/nodetool)
|
|
47
|
+
*/
|
|
48
|
+
export declare function getNodetoolCacheDir(): string;
|
|
49
|
+
/**
|
|
50
|
+
* Return the absolute filesystem path for a storage key.
|
|
51
|
+
* Use this on the server side for direct file reads.
|
|
52
|
+
*/
|
|
53
|
+
export declare function getAssetFilePath(key: string): string;
|
|
54
|
+
/**
|
|
55
|
+
* Build a client-facing URL for a storage key.
|
|
56
|
+
* Returns `/api/storage/<key>` — served by the local HTTP server (file
|
|
57
|
+
* backend) or proxied/redirected to cloud storage by the storage handler.
|
|
41
58
|
*/
|
|
42
|
-
export declare function
|
|
59
|
+
export declare function buildAssetUrl(key: string): string;
|
|
43
60
|
/**
|
|
44
|
-
*
|
|
61
|
+
* Root under which NodeTool keeps the workspace folders it manages itself.
|
|
45
62
|
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
63
|
+
* A managed workspace is the one every user gets without picking a folder, so
|
|
64
|
+
* a chat turn always has somewhere bounded to read and write. It lives under
|
|
65
|
+
* the data dir rather than the cache dir: an agent's outputs are user data, not
|
|
66
|
+
* a derived artifact that is safe to delete. Override with
|
|
67
|
+
* NODETOOL_WORKSPACES_DIR — a server deployment points it at a mounted volume.
|
|
49
68
|
*/
|
|
50
|
-
export declare function
|
|
69
|
+
export declare function getManagedWorkspacesDir(): string;
|
|
51
70
|
/**
|
|
52
|
-
*
|
|
71
|
+
* Storage key prefix of a user's workspace on a deployment that keeps
|
|
72
|
+
* workspaces in object storage rather than on a disk.
|
|
53
73
|
*
|
|
54
|
-
*
|
|
55
|
-
*
|
|
74
|
+
* The same sanitizing as {@link getManagedWorkspaceDir}: the user id is one
|
|
75
|
+
* key segment, and a `/` or `..` inside it would otherwise reach another
|
|
76
|
+
* user's prefix.
|
|
56
77
|
*/
|
|
57
|
-
export declare function
|
|
78
|
+
export declare function managedWorkspaceKey(userId: string): string;
|
|
58
79
|
/**
|
|
59
|
-
*
|
|
80
|
+
* Absolute path of a user's managed default workspace.
|
|
60
81
|
*
|
|
61
|
-
* The
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
|
|
82
|
+
* The user id is a path segment, so anything that is not a safe filename
|
|
83
|
+
* character is replaced — a user id from an external identity provider can
|
|
84
|
+
* carry `/`, `:` or `..`, and each of those would escape the workspaces root.
|
|
85
|
+
*/
|
|
86
|
+
export declare function getManagedWorkspaceDir(userId: string): string;
|
|
87
|
+
/**
|
|
88
|
+
* Whether this deployment backs workspaces with a local folder or with the
|
|
89
|
+
* object storage it already uses for assets.
|
|
65
90
|
*
|
|
66
|
-
*
|
|
91
|
+
* Production has no durable disk worth writing a user's files to — a Fly
|
|
92
|
+
* machine is replaced and the folder goes with it — so a cloud workspace is a
|
|
93
|
+
* key prefix in the asset bucket. `NODETOOL_WORKSPACE_STORAGE` overrides the
|
|
94
|
+
* default either way, which is how a self-hosted server with a mounted volume
|
|
95
|
+
* keeps local workspaces, and how a local install can be pointed at S3.
|
|
67
96
|
*/
|
|
68
|
-
export declare function
|
|
97
|
+
export declare function workspaceStorageKind(): "local" | "cloud";
|
|
69
98
|
//# sourceMappingURL=paths.d.ts.map
|
package/dist/paths.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"paths.d.ts","sourceRoot":"","sources":["../src/paths.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"paths.d.ts","sourceRoot":"","sources":["../src/paths.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AA0BH;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,IAAI,MAAM,CAa3C;AAqBD,wBAAgB,sBAAsB,IAAI,MAAM,GAAG,SAAS,CAO3D;AA+CD,wFAAwF;AACxF,wBAAgB,gBAAgB,IAAI,MAAM,CAOzC;AAED,qFAAqF;AACrF,wBAAgB,2BAA2B,IAAI,MAAM,CAKpD;AAED,wFAAwF;AACxF,wBAAgB,oBAAoB,IAAI,MAAM,CAM7C;AAED;;;;;;;GAOG;AACH,wBAAgB,gCAAgC,IAAI,MAAM,CAKzD;AAED;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,IAAI,MAAM,CAe5C;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAEpD;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAUjD;AAED;;;;;;;;GAQG;AACH,wBAAgB,uBAAuB,IAAI,MAAM,CAKhD;AAED;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAE1D;AAED;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAE7D;AAOD;;;;;;;;;GASG;AACH,wBAAgB,oBAAoB,IAAI,OAAO,GAAG,OAAO,CAIxD"}
|