@telorun/kernel 0.79.0 → 0.80.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/dist/bundle/module-artifact.d.ts +13 -1
- package/dist/bundle/module-artifact.d.ts.map +1 -1
- package/dist/bundle/module-artifact.js +22 -3
- package/dist/bundle/module-artifact.js.map +1 -1
- package/dist/controller-loader.js +1 -1
- package/dist/controller-loader.js.map +1 -1
- package/dist/controller-loaders/napi-loader.d.ts +20 -0
- package/dist/controller-loaders/napi-loader.d.ts.map +1 -1
- package/dist/controller-loaders/napi-loader.js +31 -4
- package/dist/controller-loaders/napi-loader.js.map +1 -1
- package/dist/controller-loaders/npm-loader.d.ts.map +1 -1
- package/dist/controller-loaders/npm-loader.js +68 -4
- package/dist/controller-loaders/npm-loader.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/kernel.d.ts.map +1 -1
- package/dist/kernel.js +18 -11
- package/dist/kernel.js.map +1 -1
- package/dist/manifest-sources/analysis-stamp.d.ts +12 -8
- package/dist/manifest-sources/analysis-stamp.d.ts.map +1 -1
- package/dist/manifest-sources/analysis-stamp.js +50 -23
- package/dist/manifest-sources/analysis-stamp.js.map +1 -1
- package/dist/manifest-sources/local-manifest-cache-source.d.ts +45 -9
- package/dist/manifest-sources/local-manifest-cache-source.d.ts.map +1 -1
- package/dist/manifest-sources/local-manifest-cache-source.js +65 -12
- package/dist/manifest-sources/local-manifest-cache-source.js.map +1 -1
- package/dist/runtime-seam.d.ts.map +1 -1
- package/dist/runtime-seam.js +9 -1
- package/dist/runtime-seam.js.map +1 -1
- package/dist/workspace-marker.d.ts +37 -0
- package/dist/workspace-marker.d.ts.map +1 -0
- package/dist/workspace-marker.js +68 -0
- package/dist/workspace-marker.js.map +1 -0
- package/package.json +3 -3
- package/src/bundle/module-artifact.ts +22 -7
- package/src/controller-loader.ts +1 -1
- package/src/controller-loaders/napi-loader.ts +36 -3
- package/src/controller-loaders/npm-loader.ts +72 -4
- package/src/index.ts +1 -0
- package/src/kernel.ts +18 -12
- package/src/manifest-sources/analysis-stamp.ts +53 -25
- package/src/manifest-sources/local-manifest-cache-source.ts +68 -13
- package/src/runtime-seam.ts +9 -1
- package/src/workspace-marker.ts +68 -0
|
@@ -5,6 +5,7 @@ import * as path from "path";
|
|
|
5
5
|
import { fileURLToPath, pathToFileURL } from "url";
|
|
6
6
|
import { hostEnv } from "../host-env.js";
|
|
7
7
|
import { defaultTransportRegistry } from "../transports/transport-registry.js";
|
|
8
|
+
import { findWorkspaceRoot } from "../workspace-marker.js";
|
|
8
9
|
const CACHE_SUBDIR = ".telo/manifests";
|
|
9
10
|
const DEFAULT_REGISTRY_URL = "https://registry.telo.run";
|
|
10
11
|
/** Verify that `candidate` resolves to a path under `root`. Returns the
|
|
@@ -39,21 +40,55 @@ function cachePathForUrl(rawUrl, cacheRoot, transports) {
|
|
|
39
40
|
return null;
|
|
40
41
|
return joinUnder(cacheRoot, ...key.split("/"));
|
|
41
42
|
}
|
|
43
|
+
/** The PRE-WORKSPACE-ANCHOR manifest cache for an entry: always
|
|
44
|
+
* `<entry-dir>/.telo/manifests`, regardless of marker or env override. `null`
|
|
45
|
+
* for an entry with no local anchor.
|
|
46
|
+
*
|
|
47
|
+
* A single definition because two things read the old location and they must
|
|
48
|
+
* agree: the manifest source serves `telo.yaml` from it, and `moduleDirectoryFor`
|
|
49
|
+
* places that module's LAYERS beside it. Deriving the path twice is how the two
|
|
50
|
+
* halves end up disagreeing — the manifest resolving from the old root while its
|
|
51
|
+
* controller layers are looked for under the new one, which is exactly the
|
|
52
|
+
* offline boot the fallback exists to keep working. */
|
|
53
|
+
export function legacyManifestsDir(entryDir) {
|
|
54
|
+
return entryDir ? path.join(entryDir, CACHE_SUBDIR) : null;
|
|
55
|
+
}
|
|
56
|
+
/** `legacyManifestsDir`, or `null` when it would coincide with `current` — so the
|
|
57
|
+
* fallback is never a second lookup at the same place. */
|
|
58
|
+
export function legacyManifestsDirFallback(entryDir, current) {
|
|
59
|
+
const legacy = legacyManifestsDir(entryDir);
|
|
60
|
+
if (legacy === null)
|
|
61
|
+
return null;
|
|
62
|
+
if (current !== null && path.resolve(legacy) === path.resolve(current))
|
|
63
|
+
return null;
|
|
64
|
+
return legacy;
|
|
65
|
+
}
|
|
42
66
|
/**
|
|
43
|
-
* Reads previously-cached manifest YAMLs from
|
|
44
|
-
*
|
|
45
|
-
*
|
|
67
|
+
* Reads previously-cached manifest YAMLs from the resolved manifest cache. Sits
|
|
68
|
+
* ahead of `RegistrySource` / `HttpSource` in the source chain — a hit makes boot
|
|
69
|
+
* hermetic, a miss falls through to the network source unchanged.
|
|
46
70
|
*
|
|
47
71
|
* Populated by `writeManifestCache` at install time.
|
|
72
|
+
*
|
|
73
|
+
* On a miss it consults the PRE-WORKSPACE-ANCHOR location
|
|
74
|
+
* (`<entry-dir>/.telo/manifests/`) before giving up. Every other cache in `.telo`
|
|
75
|
+
* costs only CPU when it goes cold; this one costs network, so without the
|
|
76
|
+
* fallback the move to a workspace-anchored root would stop a hermetic setup from
|
|
77
|
+
* booting — its `telo install` output stranded at the old path, with the failure
|
|
78
|
+
* surfacing as a registry fetch on a machine that has no route to one. Read-only
|
|
79
|
+
* and one directory deep: writes always go to the current root, so the old copy
|
|
80
|
+
* ages out rather than being maintained.
|
|
48
81
|
*/
|
|
49
82
|
export class LocalManifestCacheSource {
|
|
50
83
|
cacheRoot;
|
|
84
|
+
legacyRoot;
|
|
51
85
|
transports;
|
|
52
86
|
constructor(entryDir, registryUrl = DEFAULT_REGISTRY_URL, manifestsDir) {
|
|
53
87
|
// `manifestsDir` is the resolved manifest-cache directory threaded from a
|
|
54
88
|
// single `resolveCacheRoot` (honours `TELO_CACHE_DIR`); when absent we fall
|
|
55
89
|
// back to the entry-anchored default so library/test callers are unchanged.
|
|
56
|
-
this.cacheRoot = manifestsDir ??
|
|
90
|
+
this.cacheRoot = manifestsDir ?? legacyManifestsDir(entryDir);
|
|
91
|
+
this.legacyRoot = legacyManifestsDirFallback(entryDir, this.cacheRoot);
|
|
57
92
|
this.transports = defaultTransportRegistry(registryUrl);
|
|
58
93
|
}
|
|
59
94
|
supports(url) {
|
|
@@ -85,7 +120,12 @@ export class LocalManifestCacheSource {
|
|
|
85
120
|
return new URL(relative, baseDir).href;
|
|
86
121
|
}
|
|
87
122
|
tryMap(url) {
|
|
88
|
-
|
|
123
|
+
return this.tryMapIn(url, this.cacheRoot) ?? this.tryMapIn(url, this.legacyRoot);
|
|
124
|
+
}
|
|
125
|
+
tryMapIn(url, root) {
|
|
126
|
+
if (root === null)
|
|
127
|
+
return null;
|
|
128
|
+
const candidate = cachePathForUrl(url, root, this.transports);
|
|
89
129
|
if (!candidate)
|
|
90
130
|
return null;
|
|
91
131
|
// Require a regular file. A directory, dangling symlink, or stat failure
|
|
@@ -184,20 +224,33 @@ export function resolveEntryDir(entryPath) {
|
|
|
184
224
|
}
|
|
185
225
|
}
|
|
186
226
|
/** The single `.telo` cache root for an entry, resolved once and threaded to
|
|
187
|
-
* every consumer (manifest cache, compiled validators, analysis
|
|
188
|
-
* install root) so none of them re-derive it or read the env
|
|
227
|
+
* every consumer (manifest cache, compiled validators, analysis stamps, npm
|
|
228
|
+
* install root, cargo target dirs) so none of them re-derive it or read the env
|
|
229
|
+
* independently.
|
|
230
|
+
*
|
|
231
|
+
* Precedence: `TELO_CACHE_DIR` (the relocated root a prebuilt image bakes its
|
|
232
|
+
* deps into) wins; then the directory holding `telo-workspace.yaml`, so every
|
|
233
|
+
* app in one repo shares a cache instead of each carrying its own copy of the
|
|
234
|
+
* same manifests, validators, bundles and npm tree; then `<entry-dir>/.telo`.
|
|
235
|
+
*
|
|
236
|
+
* Anchoring on the marker's LOCATION only — never its `modules:` list, which is
|
|
237
|
+
* release scope — so a manifest in no release subtree (an example, a test
|
|
238
|
+
* fixture) shares the cache exactly as an app does. With no marker anywhere
|
|
239
|
+
* above, this collapses to what it did before the anchor existed, so the file
|
|
240
|
+
* enables the shared cache rather than gating one and deleting it cannot break
|
|
241
|
+
* a build.
|
|
189
242
|
*
|
|
190
|
-
* `TELO_CACHE_DIR` (the relocated root a prebuilt image bakes its deps into)
|
|
191
|
-
* wins; otherwise the root sits beside the entry at `<entry-dir>/.telo`.
|
|
192
243
|
* Returns `null` for an entry with no local anchor — an http(s), `memory://`
|
|
193
244
|
* or any other non-`file:` scheme — in which case the disk cache is skipped.
|
|
194
|
-
* Consumers append the conventional subdirs: `manifests/`, `
|
|
195
|
-
* `npm/`. */
|
|
245
|
+
* Consumers append the conventional subdirs: `manifests/`, `analysis/`,
|
|
246
|
+
* `validators/`, `controller-src/`, `npm/`. */
|
|
196
247
|
export function resolveCacheRoot(entryPath) {
|
|
197
248
|
const override = hostEnv().TELO_CACHE_DIR;
|
|
198
249
|
if (override && override.trim())
|
|
199
250
|
return path.resolve(override.trim());
|
|
200
251
|
const entryDir = resolveEntryDir(entryPath);
|
|
201
|
-
|
|
252
|
+
if (!entryDir)
|
|
253
|
+
return null;
|
|
254
|
+
return path.join(findWorkspaceRoot(entryDir) ?? entryDir, ".telo");
|
|
202
255
|
}
|
|
203
256
|
//# sourceMappingURL=local-manifest-cache-source.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"local-manifest-cache-source.js","sourceRoot":"","sources":["../../src/manifest-sources/local-manifest-cache-source.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,cAAc,EACd,eAAe,GAGhB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,QAAQ,EAAE,MAAM,IAAI,CAAC;AAC9B,OAAO,KAAK,EAAE,MAAM,aAAa,CAAC;AAClC,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AAEnD,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC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1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime-seam.d.ts","sourceRoot":"","sources":["../src/runtime-seam.ts"],"names":[],"mappings":"AAaA,OAAO,EAEL,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EAGvB,KAAK,UAAU,EACf,KAAK,iBAAiB,EACtB,KAAK,WAAW,EACjB,MAAM,cAAc,CAAC;AAItB,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAoH1C;;;;;;;;;GASG;AACH,qBAAa,iBAAkB,YAAW,WAAW;IACvC,OAAO,CAAC,QAAQ,CAAC,MAAM;gBAAN,MAAM,EAAE,MAAM;IAErC,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAAC,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"runtime-seam.d.ts","sourceRoot":"","sources":["../src/runtime-seam.ts"],"names":[],"mappings":"AAaA,OAAO,EAEL,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EAGvB,KAAK,UAAU,EACf,KAAK,iBAAiB,EACtB,KAAK,WAAW,EACjB,MAAM,cAAc,CAAC;AAItB,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAoH1C;;;;;;;;;GASG;AACH,qBAAa,iBAAkB,YAAW,WAAW;IACvC,OAAO,CAAC,QAAQ,CAAC,MAAM;gBAAN,MAAM,EAAE,MAAM;IAErC,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAAC,UAAU,CAAC;IA+DrE,KAAK,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,mBAAmB,GAAG,OAAO,CAAC,kBAAkB,CAAC;CAuFxF"}
|
package/dist/runtime-seam.js
CHANGED
|
@@ -138,7 +138,15 @@ export class KernelRuntimeSeam {
|
|
|
138
138
|
// child down in its own `finally`, so this only has to close the channels.
|
|
139
139
|
const exitCode = (async () => {
|
|
140
140
|
try {
|
|
141
|
-
|
|
141
|
+
// The child runs a manifest in the SAME workspace as its parent, so it
|
|
142
|
+
// shares the root the parent already resolved instead of deriving one
|
|
143
|
+
// beside the child manifest. Deriving put a `.telo` in every directory
|
|
144
|
+
// holding a test manifest and rebuilt every controller bundle once per
|
|
145
|
+
// test, since `Test.Suite` runs each test through here.
|
|
146
|
+
//
|
|
147
|
+
// `undefined` means "resolve one yourself" and `null` means "no cache" —
|
|
148
|
+
// a parent with no local anchor must yield the first, not the second.
|
|
149
|
+
await child.load(source, { cacheDir: this.kernel.getCacheRoot() ?? undefined });
|
|
142
150
|
await child.start();
|
|
143
151
|
return child.exitCode;
|
|
144
152
|
}
|
package/dist/runtime-seam.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime-seam.js","sourceRoot":"","sources":["../src/runtime-seam.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,MAAM,EACN,cAAc,EACd,0BAA0B,EAC1B,aAAa,EACb,kBAAkB,EAClB,kBAAkB,GAMnB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,MAAM,GAQP,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAClC,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD,OAAO,EAAE,wBAAwB,EAAE,MAAM,oCAAoC,CAAC;AAE9E;;;;;;;;;;;;GAYG;AACH,MAAM,uBAAuB,GAAG,GAAG,CAAC;AASpC;;;;;GAKG;AACH,MAAM,aAAa;IACjB,MAAM,GAAmB,EAAE,CAAC;IAC5B,QAAQ,GAAoD,EAAE,CAAC;IAC/D,MAAM,GAAG,KAAK,CAAC;IAEN,QAAQ,GAAa,IAAI,QAAQ,CAAC;QACzC,KAAK,EAAE,CAAC,KAAsB,EAAE,SAAS,EAAE,QAAQ,EAA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|
+
* Its LOCATION is a general anchor — the directory workspace-relative paths are
|
|
5
|
+
* measured from, the outer bound on how far a walk-up may look, and the root the
|
|
6
|
+
* `.telo` cache is anchored at — while its `modules:` list is release scope. So
|
|
7
|
+
* the finder is deliberately separate from `release/`: `telo run` bounds its
|
|
8
|
+
* `.env` collection with the marker and `resolveCacheRoot` anchors on it, and
|
|
9
|
+
* neither may reach into the release namespace to do so, where `loadWorkspace`
|
|
10
|
+
* (which parses `modules:` and throws when the file is absent) sits one import
|
|
11
|
+
* away.
|
|
12
|
+
*
|
|
13
|
+
* It lives in the KERNEL rather than the CLI because the cache root is resolved
|
|
14
|
+
* here, on a path a CLI-less embedder also takes (a child kernel started through
|
|
15
|
+
* the runtime seam, a test harness). The CLI re-exports it; nothing is duplicated.
|
|
16
|
+
*
|
|
17
|
+
* Parsing the file is the analyzer's (`release/workspace-config.ts`); finding it
|
|
18
|
+
* is the Node half, and this is all of it.
|
|
19
|
+
*/
|
|
20
|
+
import { WORKSPACE_FILENAME } from "@telorun/analyzer";
|
|
21
|
+
export { WORKSPACE_FILENAME };
|
|
22
|
+
/**
|
|
23
|
+
* Walk up from `from` looking for the marker. Returns the directory holding it,
|
|
24
|
+
* or `undefined` — the file is optional. `telo release` requires one and reports
|
|
25
|
+
* its absence; `telo run` and `resolveCacheRoot` read `undefined` as "no parent
|
|
26
|
+
* lookup", falling back to what they did before the marker existed.
|
|
27
|
+
*
|
|
28
|
+
* `from` is resolved through symlinks first: a manifest reached through a linked
|
|
29
|
+
* directory would otherwise walk the LINK's parents, miss a marker that is right
|
|
30
|
+
* there in the real tree, and silently fall back to a narrower answer.
|
|
31
|
+
*/
|
|
32
|
+
export declare function findWorkspaceRoot(from: string): string | undefined;
|
|
33
|
+
/** `fs.realpathSync`, falling back to the input when the path does not exist —
|
|
34
|
+
* a manifest path that is wrong is the caller's error to report, not this
|
|
35
|
+
* helper's to convert into a different one. */
|
|
36
|
+
export declare function realPath(target: string): string;
|
|
37
|
+
//# sourceMappingURL=workspace-marker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workspace-marker.d.ts","sourceRoot":"","sources":["../src/workspace-marker.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAIvD,OAAO,EAAE,kBAAkB,EAAE,CAAC;AAE9B;;;;;;;;;GASG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAQlE;AAcD;;gDAEgD;AAChD,wBAAgB,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAM/C"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Finding `telo-workspace.yaml` on disk.
|
|
3
|
+
*
|
|
4
|
+
* Its LOCATION is a general anchor — the directory workspace-relative paths are
|
|
5
|
+
* measured from, the outer bound on how far a walk-up may look, and the root the
|
|
6
|
+
* `.telo` cache is anchored at — while its `modules:` list is release scope. So
|
|
7
|
+
* the finder is deliberately separate from `release/`: `telo run` bounds its
|
|
8
|
+
* `.env` collection with the marker and `resolveCacheRoot` anchors on it, and
|
|
9
|
+
* neither may reach into the release namespace to do so, where `loadWorkspace`
|
|
10
|
+
* (which parses `modules:` and throws when the file is absent) sits one import
|
|
11
|
+
* away.
|
|
12
|
+
*
|
|
13
|
+
* It lives in the KERNEL rather than the CLI because the cache root is resolved
|
|
14
|
+
* here, on a path a CLI-less embedder also takes (a child kernel started through
|
|
15
|
+
* the runtime seam, a test harness). The CLI re-exports it; nothing is duplicated.
|
|
16
|
+
*
|
|
17
|
+
* Parsing the file is the analyzer's (`release/workspace-config.ts`); finding it
|
|
18
|
+
* is the Node half, and this is all of it.
|
|
19
|
+
*/
|
|
20
|
+
import { WORKSPACE_FILENAME } from "@telorun/analyzer";
|
|
21
|
+
import * as fs from "node:fs";
|
|
22
|
+
import * as path from "node:path";
|
|
23
|
+
export { WORKSPACE_FILENAME };
|
|
24
|
+
/**
|
|
25
|
+
* Walk up from `from` looking for the marker. Returns the directory holding it,
|
|
26
|
+
* or `undefined` — the file is optional. `telo release` requires one and reports
|
|
27
|
+
* its absence; `telo run` and `resolveCacheRoot` read `undefined` as "no parent
|
|
28
|
+
* lookup", falling back to what they did before the marker existed.
|
|
29
|
+
*
|
|
30
|
+
* `from` is resolved through symlinks first: a manifest reached through a linked
|
|
31
|
+
* directory would otherwise walk the LINK's parents, miss a marker that is right
|
|
32
|
+
* there in the real tree, and silently fall back to a narrower answer.
|
|
33
|
+
*/
|
|
34
|
+
export function findWorkspaceRoot(from) {
|
|
35
|
+
let dir = realPath(path.resolve(from));
|
|
36
|
+
for (;;) {
|
|
37
|
+
if (isFile(path.join(dir, WORKSPACE_FILENAME)))
|
|
38
|
+
return dir;
|
|
39
|
+
const parent = path.dirname(dir);
|
|
40
|
+
if (parent === dir)
|
|
41
|
+
return undefined;
|
|
42
|
+
dir = parent;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
/** The marker must be a FILE. `existsSync` would accept a directory of that name
|
|
46
|
+
* and anchor the whole cache on it, and the Rust half tests `is_file()` — a
|
|
47
|
+
* workspace visible to one kernel and not the other is precisely the divergence
|
|
48
|
+
* a shared marker exists to prevent. */
|
|
49
|
+
function isFile(target) {
|
|
50
|
+
try {
|
|
51
|
+
return fs.statSync(target).isFile();
|
|
52
|
+
}
|
|
53
|
+
catch {
|
|
54
|
+
return false;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
/** `fs.realpathSync`, falling back to the input when the path does not exist —
|
|
58
|
+
* a manifest path that is wrong is the caller's error to report, not this
|
|
59
|
+
* helper's to convert into a different one. */
|
|
60
|
+
export function realPath(target) {
|
|
61
|
+
try {
|
|
62
|
+
return fs.realpathSync(target);
|
|
63
|
+
}
|
|
64
|
+
catch {
|
|
65
|
+
return target;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
//# sourceMappingURL=workspace-marker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workspace-marker.js","sourceRoot":"","sources":["../src/workspace-marker.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAElC,OAAO,EAAE,kBAAkB,EAAE,CAAC;AAE9B;;;;;;;;;GASG;AACH,MAAM,UAAU,iBAAiB,CAAC,IAAY;IAC5C,IAAI,GAAG,GAAG,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;IACvC,SAAS,CAAC;QACR,IAAI,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,kBAAkB,CAAC,CAAC;YAAE,OAAO,GAAG,CAAC;QAC3D,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QACjC,IAAI,MAAM,KAAK,GAAG;YAAE,OAAO,SAAS,CAAC;QACrC,GAAG,GAAG,MAAM,CAAC;IACf,CAAC;AACH,CAAC;AAED;;;yCAGyC;AACzC,SAAS,MAAM,CAAC,MAAc;IAC5B,IAAI,CAAC;QACH,OAAO,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,CAAC;IACtC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC;AAED;;gDAEgD;AAChD,MAAM,UAAU,QAAQ,CAAC,MAAc;IACrC,IAAI,CAAC;QACH,OAAO,EAAE,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;IACjC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,MAAM,CAAC;IAChB,CAAC;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@telorun/kernel",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.80.0",
|
|
4
4
|
"description": "Telo Runtime - A lightweight, polyglot execution host.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"telo",
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"dependencies": {
|
|
62
62
|
"@marcbachmann/cel-js": "^7.6.1",
|
|
63
63
|
"@sinclair/typebox": "^0.34.48",
|
|
64
|
-
"@telorun/analyzer": "0.
|
|
64
|
+
"@telorun/analyzer": "0.64.0",
|
|
65
65
|
"@telorun/glob": "0.2.0",
|
|
66
66
|
"@telorun/templating": "0.16.0",
|
|
67
67
|
"ajv": "^8.17.1",
|
|
@@ -75,7 +75,7 @@
|
|
|
75
75
|
"@types/tar-stream": "^3.1.3",
|
|
76
76
|
"typescript": "^5.0.0",
|
|
77
77
|
"vitest": "^2.1.8",
|
|
78
|
-
"@telorun/sdk": "0.
|
|
78
|
+
"@telorun/sdk": "0.80.0"
|
|
79
79
|
},
|
|
80
80
|
"optionalDependencies": {
|
|
81
81
|
"esbuild": "^0.25.12"
|
|
@@ -414,6 +414,18 @@ async function readMarker(marker: string): Promise<string[]> {
|
|
|
414
414
|
* identically cold and warm. A genuinely local `source` (development, or a module
|
|
415
415
|
* loaded straight off disk) resolves to its own directory.
|
|
416
416
|
*
|
|
417
|
+
* A module's LAYERS extract beside its cached `telo.yaml`, so this has to follow
|
|
418
|
+
* the manifest cache's own fallback to the pre-workspace-anchor root: when the
|
|
419
|
+
* manifest resolved from `<entry-dir>/.telo/manifests/` because the workspace root
|
|
420
|
+
* is cold, its already-materialized controller layers are there too. Deriving the
|
|
421
|
+
* directory from the new root alone left an offline hermetic upgrade resolving
|
|
422
|
+
* `telo.yaml` from disk and then going to the network for every bundled
|
|
423
|
+
* controller — the fallback covering half a module.
|
|
424
|
+
*
|
|
425
|
+
* The legacy root is chosen only when it HOLDS the manifest and the current root
|
|
426
|
+
* does not; a cold cache still places the module under the current root, so a
|
|
427
|
+
* fresh materialization is never diverted to the old location.
|
|
428
|
+
*
|
|
417
429
|
* Returns `null` when neither route yields a directory — a `memory://` module, or
|
|
418
430
|
* a ref this cache has no coordinates for.
|
|
419
431
|
*/
|
|
@@ -423,14 +435,17 @@ export function moduleDirectoryFor(
|
|
|
423
435
|
entryDir: string,
|
|
424
436
|
registryUrl: string | undefined,
|
|
425
437
|
manifestsDir: string | undefined,
|
|
438
|
+
legacyDir?: string | null,
|
|
426
439
|
): string | null {
|
|
427
|
-
const
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
440
|
+
const pinned = splitIntegrity(requestedUrl).base;
|
|
441
|
+
const cacheFile = cachePathForCanonical(pinned, entryDir, registryUrl, manifestsDir);
|
|
442
|
+
if (cacheFile) {
|
|
443
|
+
if (legacyDir && !existsSync(cacheFile)) {
|
|
444
|
+
const legacyFile = cachePathForCanonical(pinned, entryDir, registryUrl, legacyDir);
|
|
445
|
+
if (legacyFile && existsSync(legacyFile)) return path.dirname(legacyFile);
|
|
446
|
+
}
|
|
447
|
+
return path.dirname(cacheFile);
|
|
448
|
+
}
|
|
434
449
|
if (source.startsWith("file://")) return path.dirname(fileURLToPath(source));
|
|
435
450
|
if (path.isAbsolute(source)) return path.dirname(source);
|
|
436
451
|
return null;
|
package/src/controller-loader.ts
CHANGED
|
@@ -167,7 +167,7 @@ export class ControllerLoader {
|
|
|
167
167
|
installRoot: options.installRoot,
|
|
168
168
|
});
|
|
169
169
|
if (options.log) this.npmLoader.setLogger(options.log);
|
|
170
|
-
this.napiLoader = new NapiControllerLoader();
|
|
170
|
+
this.napiLoader = new NapiControllerLoader(options.cacheRoot);
|
|
171
171
|
this.bundleLoader = new BundleControllerLoader(options.cacheRoot, options.log);
|
|
172
172
|
}
|
|
173
173
|
|
|
@@ -106,6 +106,34 @@ export interface NapiLoadResult {
|
|
|
106
106
|
}
|
|
107
107
|
|
|
108
108
|
export class NapiControllerLoader {
|
|
109
|
+
/**
|
|
110
|
+
* The `.telo` cache root this kernel resolved, or `undefined` when it resolved
|
|
111
|
+
* none (a memory-rooted entry), in which case cargo's own default is used.
|
|
112
|
+
*
|
|
113
|
+
* The build is anchored here for the same reason the Rust kernel's is: one
|
|
114
|
+
* shared dependency build per workspace instead of one per crate, and — the
|
|
115
|
+
* load-bearing half — a directory KEYED BY SDK BACKEND. This loader builds a
|
|
116
|
+
* controller crate with `telorun-sdk/napi` while `telo-rs` builds the very same
|
|
117
|
+
* crate with `native`, and a plain `cargo build --workspace` builds it with
|
|
118
|
+
* neither. All three sharing one target directory means each alternation
|
|
119
|
+
* rebuilds the crate and its dependency tree; before this they were kept apart
|
|
120
|
+
* only by the accident that this loader took cargo's default.
|
|
121
|
+
*/
|
|
122
|
+
private readonly cacheRoot?: string;
|
|
123
|
+
|
|
124
|
+
constructor(cacheRoot?: string) {
|
|
125
|
+
this.cacheRoot = cacheRoot;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/** `CARGO_TARGET_DIR` for this loader's builds, or `undefined` to leave cargo's
|
|
129
|
+
* own resolution alone. Applied to `cargo metadata` as well as `cargo build`,
|
|
130
|
+
* since `target_directory` is where the dylib is then looked for — setting it
|
|
131
|
+
* on only one of the two would build in one place and search in another. */
|
|
132
|
+
private targetDirEnv(): Record<string, string | undefined> {
|
|
133
|
+
const env = hostEnv();
|
|
134
|
+
if (!this.cacheRoot) return env;
|
|
135
|
+
return { ...env, CARGO_TARGET_DIR: path.join(this.cacheRoot, "cargo", "napi", "target") };
|
|
136
|
+
}
|
|
109
137
|
/**
|
|
110
138
|
* Resolve a `pkg:cargo/...` PURL to a controller module instance by building
|
|
111
139
|
* the crate and loading the resulting native addon.
|
|
@@ -234,7 +262,11 @@ export class NapiControllerLoader {
|
|
|
234
262
|
// Read before building: the metadata answers both "where did the dylib
|
|
235
263
|
// land" and "does this crate use the SDK", and the second decides the build
|
|
236
264
|
// flags.
|
|
237
|
-
const { targetDir, libName, usesSdk } = await resolveCrateMetadata(
|
|
265
|
+
const { targetDir, libName, usesSdk } = await resolveCrateMetadata(
|
|
266
|
+
cratePath,
|
|
267
|
+
fallbackName,
|
|
268
|
+
this.targetDirEnv(),
|
|
269
|
+
);
|
|
238
270
|
|
|
239
271
|
try {
|
|
240
272
|
// The backend is selected as a *dependency* feature of the SDK. A crate
|
|
@@ -253,7 +285,7 @@ export class NapiControllerLoader {
|
|
|
253
285
|
await execFileAsync("cargo", ["build", "--release", ...featureArgs], {
|
|
254
286
|
cwd: cratePath,
|
|
255
287
|
maxBuffer: 32 * 1024 * 1024,
|
|
256
|
-
env:
|
|
288
|
+
env: this.targetDirEnv(),
|
|
257
289
|
});
|
|
258
290
|
} catch (err: any) {
|
|
259
291
|
const stderr = err?.stderr ? `\n${err.stderr}` : "";
|
|
@@ -331,6 +363,7 @@ const SDK_CRATE_NAME = "telorun-sdk";
|
|
|
331
363
|
async function resolveCrateMetadata(
|
|
332
364
|
cratePath: string,
|
|
333
365
|
fallbackName: string,
|
|
366
|
+
env: Record<string, string | undefined>,
|
|
334
367
|
): Promise<{ targetDir: string; libName: string; usesSdk: boolean }> {
|
|
335
368
|
const result = await execFileAsync("cargo", [
|
|
336
369
|
"metadata",
|
|
@@ -339,7 +372,7 @@ async function resolveCrateMetadata(
|
|
|
339
372
|
"--manifest-path",
|
|
340
373
|
path.join(cratePath, "Cargo.toml"),
|
|
341
374
|
"--no-deps",
|
|
342
|
-
], { maxBuffer: 32 * 1024 * 1024, env
|
|
375
|
+
], { maxBuffer: 32 * 1024 * 1024, env });
|
|
343
376
|
const metadata = JSON.parse(result.stdout);
|
|
344
377
|
const cratePackage = metadata.packages?.find(
|
|
345
378
|
(p: any) => p.manifest_path === path.join(cratePath, "Cargo.toml"),
|
|
@@ -45,6 +45,21 @@ const PEER_INSTALL_FLAGS: ReadonlyArray<string> =
|
|
|
45
45
|
? ["--no-strict-peer-dependencies"]
|
|
46
46
|
: [];
|
|
47
47
|
|
|
48
|
+
/**
|
|
49
|
+
* Quiet the installer WITHOUT quieting its failures. `--silent` does both: on
|
|
50
|
+
* npm 11 a failed install writes nothing at all — not the `ERESOLVE`/`ETARGET`
|
|
51
|
+
* code, not the offending spec — so the wrapper below could only report that
|
|
52
|
+
* some install failed, with no cause, for every failure class. `--loglevel`
|
|
53
|
+
* error keeps the diagnosis and drops the progress chatter, which is the half
|
|
54
|
+
* that was actually worth suppressing.
|
|
55
|
+
*/
|
|
56
|
+
const QUIET_INSTALL_FLAGS: ReadonlyArray<string> =
|
|
57
|
+
PACKAGE_MANAGER === "npm"
|
|
58
|
+
? ["--loglevel=error", "--no-progress"]
|
|
59
|
+
: PACKAGE_MANAGER === "pnpm"
|
|
60
|
+
? ["--loglevel=error"]
|
|
61
|
+
: [];
|
|
62
|
+
|
|
48
63
|
|
|
49
64
|
/**
|
|
50
65
|
* Tells the dispatcher (and any UI consumer downstream) which branch the
|
|
@@ -335,7 +350,7 @@ export class NpmControllerLoader {
|
|
|
335
350
|
"install",
|
|
336
351
|
"--no-audit",
|
|
337
352
|
"--no-fund",
|
|
338
|
-
|
|
353
|
+
...QUIET_INSTALL_FLAGS,
|
|
339
354
|
...PEER_INSTALL_FLAGS,
|
|
340
355
|
]);
|
|
341
356
|
await fs.writeFile(stateFile, JSON.stringify({ rootHash: newHash }, null, 2) + "\n");
|
|
@@ -476,11 +491,21 @@ export class NpmControllerLoader {
|
|
|
476
491
|
// Past every re-check: the package manager is about to run for real,
|
|
477
492
|
// which is the wait a caller wants reported.
|
|
478
493
|
await report?.("npm-install");
|
|
494
|
+
// The installer re-resolves the ROOT's whole dependency set, not just
|
|
495
|
+
// the alias being added, so one dead record left by another app fails
|
|
496
|
+
// an install that has nothing to do with it — and the root is shared
|
|
497
|
+
// workspace-wide, so that blast radius is every app. Prune here rather
|
|
498
|
+
// than only on a realm change (`materializeInstallRoot`), which a root
|
|
499
|
+
// that goes stale afterwards never reaches. Placed past every re-check
|
|
500
|
+
// so it costs 2 stats per recorded dep only on the branch that was
|
|
501
|
+
// already going to spawn the package manager, never on a cache hit.
|
|
502
|
+
const pruned = await pruneDeadControllerDeps(installRoot);
|
|
503
|
+
if (pruned) this.rootDeps = pruned;
|
|
479
504
|
await runPackageManager(installRoot, [
|
|
480
505
|
"install",
|
|
481
506
|
"--no-audit",
|
|
482
507
|
"--no-fund",
|
|
483
|
-
|
|
508
|
+
...QUIET_INSTALL_FLAGS,
|
|
484
509
|
...PEER_INSTALL_FLAGS,
|
|
485
510
|
"--save",
|
|
486
511
|
// `<alias>@<source-spec>` installs the package under the alias folder
|
|
@@ -650,9 +675,15 @@ async function runPackageManager(cwd: string, args: string[]): Promise<void> {
|
|
|
650
675
|
`TELO_PKG_MANAGER to a different binary name.`,
|
|
651
676
|
);
|
|
652
677
|
}
|
|
653
|
-
|
|
678
|
+
// Both streams: npm writes its diagnosis to stderr, pnpm and bun put parts
|
|
679
|
+
// of theirs on stdout. Reporting one of them is how a real cause becomes a
|
|
680
|
+
// failure with no message.
|
|
681
|
+
const output = [err?.stderr, err?.stdout]
|
|
682
|
+
.map((s) => (typeof s === "string" ? s.trim() : ""))
|
|
683
|
+
.filter(Boolean)
|
|
684
|
+
.join("\n");
|
|
654
685
|
throw new Error(
|
|
655
|
-
`[telo] '${PACKAGE_MANAGER} ${args.join(" ")}' failed in ${cwd}:${
|
|
686
|
+
`[telo] '${PACKAGE_MANAGER} ${args.join(" ")}' failed in ${cwd}:${output ? `\n${output}` : ""}`,
|
|
656
687
|
);
|
|
657
688
|
}
|
|
658
689
|
}
|
|
@@ -835,6 +866,43 @@ async function liveControllerDeps(
|
|
|
835
866
|
return live;
|
|
836
867
|
}
|
|
837
868
|
|
|
869
|
+
/**
|
|
870
|
+
* Rewrite the install root's `package.json` with its dead controller records
|
|
871
|
+
* dropped, returning the surviving map — or null when nothing had to change,
|
|
872
|
+
* so the common case writes no file.
|
|
873
|
+
*
|
|
874
|
+
* Realm-collapse names are never candidates: they are wired in by
|
|
875
|
+
* `materializeInstallRoot` from the kernel's own resolved paths and are the one
|
|
876
|
+
* thing whose absence must be reported rather than repaired away.
|
|
877
|
+
*
|
|
878
|
+
* Must be called under the install root's lock — it is a read-modify-write of a
|
|
879
|
+
* file every kernel sharing the root writes to.
|
|
880
|
+
*/
|
|
881
|
+
async function pruneDeadControllerDeps(
|
|
882
|
+
installRoot: string,
|
|
883
|
+
): Promise<Record<string, string> | null> {
|
|
884
|
+
const deps = await readPackageDeps(installRoot);
|
|
885
|
+
if (!deps) return null;
|
|
886
|
+
const realm = new Set<string>(REALM_COLLAPSE_NAMES);
|
|
887
|
+
const controllers: Record<string, string> = {};
|
|
888
|
+
const preserved: Record<string, string> = {};
|
|
889
|
+
for (const [name, spec] of Object.entries(deps)) {
|
|
890
|
+
if (realm.has(name)) preserved[name] = spec;
|
|
891
|
+
else controllers[name] = spec;
|
|
892
|
+
}
|
|
893
|
+
const live = await liveControllerDeps(controllers, installRoot);
|
|
894
|
+
if (Object.keys(live).length === Object.keys(controllers).length) return null;
|
|
895
|
+
|
|
896
|
+
const packageJsonPath = path.join(installRoot, "package.json");
|
|
897
|
+
const pkg = JSON.parse(await fs.readFile(packageJsonPath, "utf8"));
|
|
898
|
+
const merged = { ...live, ...preserved };
|
|
899
|
+
await fs.writeFile(
|
|
900
|
+
packageJsonPath,
|
|
901
|
+
JSON.stringify({ ...pkg, dependencies: merged }, null, 2) + "\n",
|
|
902
|
+
);
|
|
903
|
+
return merged;
|
|
904
|
+
}
|
|
905
|
+
|
|
838
906
|
async function readPackageDeps(installRoot: string): Promise<Record<string, string> | null> {
|
|
839
907
|
try {
|
|
840
908
|
const text = await fs.readFile(path.join(installRoot, "package.json"), "utf8");
|
package/src/index.ts
CHANGED
|
@@ -10,6 +10,7 @@ export {
|
|
|
10
10
|
writeManifestCache,
|
|
11
11
|
} from "./manifest-sources/local-manifest-cache-source.js";
|
|
12
12
|
export { MemorySource } from "./manifest-sources/memory-source.js";
|
|
13
|
+
export { WORKSPACE_FILENAME, findWorkspaceRoot, realPath } from "./workspace-marker.js";
|
|
13
14
|
export type { Transport } from "./transports/transport.js";
|
|
14
15
|
export { RegistryTransport } from "./transports/registry-transport.js";
|
|
15
16
|
export { OciTransport } from "./transports/oci/oci-transport.js";
|