@telorun/kernel 0.77.0 → 0.79.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 +2 -1
- package/dist/bundle/module-artifact.d.ts.map +1 -1
- package/dist/bundle/module-artifact.js +14 -10
- package/dist/bundle/module-artifact.js.map +1 -1
- package/dist/bundle/tar.d.ts +3 -0
- package/dist/bundle/tar.d.ts.map +1 -1
- package/dist/bundle/tar.js +27 -1
- package/dist/bundle/tar.js.map +1 -1
- package/dist/controller-loader.d.ts +62 -9
- package/dist/controller-loader.d.ts.map +1 -1
- package/dist/controller-loader.js +71 -63
- package/dist/controller-loader.js.map +1 -1
- package/dist/controller-loaders/bundle-loader.d.ts +2 -2
- package/dist/controller-loaders/bundle-loader.d.ts.map +1 -1
- package/dist/controller-loaders/bundle-loader.js +9 -3
- package/dist/controller-loaders/bundle-loader.js.map +1 -1
- package/dist/controller-loaders/napi-loader.d.ts +2 -1
- package/dist/controller-loaders/napi-loader.d.ts.map +1 -1
- package/dist/controller-loaders/napi-loader.js +4 -1
- package/dist/controller-loaders/napi-loader.js.map +1 -1
- package/dist/controller-loaders/npm-loader.d.ts +2 -1
- package/dist/controller-loaders/npm-loader.d.ts.map +1 -1
- package/dist/controller-loaders/npm-loader.js +13 -7
- package/dist/controller-loaders/npm-loader.js.map +1 -1
- package/dist/controller-loaders/source-bundle-builder.d.ts +2 -1
- package/dist/controller-loaders/source-bundle-builder.d.ts.map +1 -1
- package/dist/controller-loaders/source-bundle-builder.js +4 -1
- package/dist/controller-loaders/source-bundle-builder.js.map +1 -1
- package/dist/controllers/resource-definition/resource-definition-controller.d.ts.map +1 -1
- package/dist/controllers/resource-definition/resource-definition-controller.js +7 -3
- package/dist/controllers/resource-definition/resource-definition-controller.js.map +1 -1
- package/dist/controllers/resource-definition/resource-template-controller.d.ts.map +1 -1
- package/dist/controllers/resource-definition/resource-template-controller.js +12 -5
- package/dist/controllers/resource-definition/resource-template-controller.js.map +1 -1
- package/dist/dependency-injection.d.ts.map +1 -1
- package/dist/dependency-injection.js +7 -7
- package/dist/dependency-injection.js.map +1 -1
- package/dist/evaluation-context.d.ts +33 -13
- package/dist/evaluation-context.d.ts.map +1 -1
- package/dist/evaluation-context.js +145 -4
- package/dist/evaluation-context.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/instance-declaration.d.ts +8 -0
- package/dist/instance-declaration.d.ts.map +1 -0
- package/dist/instance-declaration.js +34 -0
- package/dist/instance-declaration.js.map +1 -0
- package/dist/invocation-contract-binding.d.ts +15 -2
- package/dist/invocation-contract-binding.d.ts.map +1 -1
- package/dist/invocation-contract-binding.js +39 -4
- package/dist/invocation-contract-binding.js.map +1 -1
- package/dist/kernel.d.ts.map +1 -1
- package/dist/kernel.js +60 -3
- package/dist/kernel.js.map +1 -1
- package/dist/manifest-schemas.d.ts +1 -1
- package/dist/manifest-schemas.d.ts.map +1 -1
- package/dist/manifest-schemas.js +1 -1
- package/dist/manifest-schemas.js.map +1 -1
- package/dist/module-context.d.ts +5 -1
- package/dist/module-context.d.ts.map +1 -1
- package/dist/module-context.js +13 -1
- package/dist/module-context.js.map +1 -1
- package/dist/resource-context.d.ts +12 -1
- package/dist/resource-context.d.ts.map +1 -1
- package/dist/resource-context.js +15 -0
- package/dist/resource-context.js.map +1 -1
- package/dist/transports/oci/oci-client.d.ts +4 -0
- package/dist/transports/oci/oci-client.d.ts.map +1 -1
- package/dist/transports/oci/oci-client.js +7 -1
- package/dist/transports/oci/oci-client.js.map +1 -1
- package/dist/transports/oci/oci-transport.d.ts +8 -3
- package/dist/transports/oci/oci-transport.d.ts.map +1 -1
- package/dist/transports/oci/oci-transport.js +67 -21
- package/dist/transports/oci/oci-transport.js.map +1 -1
- package/dist/transports/registry-transport.d.ts +3 -2
- package/dist/transports/registry-transport.d.ts.map +1 -1
- package/dist/transports/registry-transport.js +10 -0
- package/dist/transports/registry-transport.js.map +1 -1
- package/dist/transports/transport.d.ts +25 -6
- package/dist/transports/transport.d.ts.map +1 -1
- package/dist/zone-context.d.ts +16 -1
- package/dist/zone-context.d.ts.map +1 -1
- package/dist/zone-context.js +61 -1
- package/dist/zone-context.js.map +1 -1
- package/package.json +3 -3
- package/src/bundle/module-artifact.ts +25 -8
- package/src/bundle/tar.ts +28 -1
- package/src/controller-loader.ts +114 -80
- package/src/controller-loaders/bundle-loader.ts +10 -2
- package/src/controller-loaders/napi-loader.ts +6 -0
- package/src/controller-loaders/npm-loader.ts +14 -4
- package/src/controller-loaders/source-bundle-builder.ts +6 -0
- package/src/controllers/resource-definition/resource-definition-controller.ts +7 -3
- package/src/controllers/resource-definition/resource-template-controller.ts +12 -5
- package/src/dependency-injection.ts +7 -7
- package/src/evaluation-context.ts +195 -15
- package/src/index.ts +6 -0
- package/src/instance-declaration.ts +36 -0
- package/src/invocation-contract-binding.ts +49 -1
- package/src/kernel.ts +77 -2
- package/src/manifest-schemas.ts +1 -0
- package/src/module-context.ts +24 -3
- package/src/resource-context.ts +18 -0
- package/src/transports/oci/oci-client.ts +8 -1
- package/src/transports/oci/oci-transport.ts +76 -22
- package/src/transports/registry-transport.ts +14 -0
- package/src/transports/transport.ts +26 -5
- package/src/zone-context.ts +70 -1
package/dist/zone-context.js
CHANGED
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
* otherwise, and this sits on the SQL hot path.
|
|
19
19
|
*/
|
|
20
20
|
import { InvokeError, RuntimeError, UNCANCELLABLE_CONTEXT, deriveContext, getRefIdentity, sameResource, } from "@telorun/sdk";
|
|
21
|
-
import { readProvidesZone, readRequiresZone } from "@telorun/analyzer";
|
|
21
|
+
import { effectiveAuthorSchema, readProvidesZone, readRequiresZone, } from "@telorun/analyzer";
|
|
22
22
|
import { isRefSentinel } from "@telorun/templating";
|
|
23
23
|
import { ambientInvokeContext, runWithAmbientContext } from "./evaluation-context.js";
|
|
24
24
|
import { handleOfInstance } from "./resource-handle.js";
|
|
@@ -28,6 +28,10 @@ export class ZoneContext {
|
|
|
28
28
|
#requirements = new Map();
|
|
29
29
|
/** Slot → resolved correlation handle for a providing slot. */
|
|
30
30
|
#providers = new Map();
|
|
31
|
+
/** Providing kind → what the zone it provides declares about its contents.
|
|
32
|
+
* Keyed by kind rather than by slot because the question a caller asks is
|
|
33
|
+
* about an OPEN zone, which is reached by its entry's kind. */
|
|
34
|
+
#attributes = new Map();
|
|
31
35
|
constructor(host) {
|
|
32
36
|
this.#host = host;
|
|
33
37
|
}
|
|
@@ -74,6 +78,62 @@ export class ZoneContext {
|
|
|
74
78
|
}
|
|
75
79
|
return out;
|
|
76
80
|
}
|
|
81
|
+
zoneAttributes(ctx) {
|
|
82
|
+
const zones = (ctx ?? ambientInvokeContext())?.zones;
|
|
83
|
+
if (!zones || zones.length === 0)
|
|
84
|
+
return [];
|
|
85
|
+
const out = [];
|
|
86
|
+
// Innermost first, matching `match` and `zonesFor` — a nested zone's
|
|
87
|
+
// constraint is the one a controller meets first.
|
|
88
|
+
for (let i = zones.length - 1; i >= 0; i--) {
|
|
89
|
+
const entry = zones[i];
|
|
90
|
+
out.push({ kind: entry.kind, attributes: this.attributesOfKind(entry.kind), entry });
|
|
91
|
+
}
|
|
92
|
+
return out;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* What the zone a kind provides declares, read off that kind's own schema.
|
|
96
|
+
*
|
|
97
|
+
* NOT off the entry: a `ZoneEntry` is three identities precisely so it stays
|
|
98
|
+
* ABI-serializable and no module can read another's private state off the
|
|
99
|
+
* stack, and an attributes field on it would trade that away for every zone.
|
|
100
|
+
* The kernel is the one place the declaring kind's schema is already
|
|
101
|
+
* reachable, so it resolves and hands the values over — branching on no name,
|
|
102
|
+
* exactly as `readRefSlot` returns `use` without acting on it.
|
|
103
|
+
*
|
|
104
|
+
* Memoized per kind: this sits behind every dispatch a durable step engine
|
|
105
|
+
* makes, and the answer is fixed once definitions are registered.
|
|
106
|
+
*/
|
|
107
|
+
attributesOfKind(kind) {
|
|
108
|
+
const cached = this.#attributes.get(kind);
|
|
109
|
+
if (cached)
|
|
110
|
+
return cached;
|
|
111
|
+
const def = this.#host.resolveDefinition(kind);
|
|
112
|
+
// A kind that does not resolve is NOT cached: definitions are registered
|
|
113
|
+
// during init and this is called at dispatch, so an unresolved lookup is a
|
|
114
|
+
// transient state — caching the empty answer would make it permanent, and a
|
|
115
|
+
// zone would silently declare nothing for the life of the process.
|
|
116
|
+
if (!def)
|
|
117
|
+
return {};
|
|
118
|
+
// Resolved along `extends`, so a child that inherits its parent's
|
|
119
|
+
// zone-providing slot reports the attributes that slot declares. Reading the
|
|
120
|
+
// own schema alone would have a child's zone silently constrain nothing.
|
|
121
|
+
const properties = effectiveAuthorSchema(def, (k) => this.#host.resolveDefinition(k))?.properties;
|
|
122
|
+
const merged = {};
|
|
123
|
+
for (const slotSchema of Object.values(properties ?? {})) {
|
|
124
|
+
// Every providing slot of one kind provides that same kind's zone — the
|
|
125
|
+
// annotation never names a zone — so their attributes describe one region
|
|
126
|
+
// and merge. First declaration wins, so the reading is stable rather than
|
|
127
|
+
// dependent on property order.
|
|
128
|
+
for (const [name, reason] of Object.entries(readProvidesZone(slotSchema)?.attributes ?? {})) {
|
|
129
|
+
if (!(name in merged) && typeof reason === "string")
|
|
130
|
+
merged[name] = reason;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
const attributes = merged;
|
|
134
|
+
this.#attributes.set(kind, attributes);
|
|
135
|
+
return attributes;
|
|
136
|
+
}
|
|
77
137
|
// ── resolution ────────────────────────────────────────────────────────────
|
|
78
138
|
resolveProvider(slot) {
|
|
79
139
|
const cached = this.#providers.get(slot);
|
package/dist/zone-context.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"zone-context.js","sourceRoot":"","sources":["../src/zone-context.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;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AQ,GAAG,IAAI,CAAC,KAAK,CAAC,oBAAoB,CAAC,IAAI,CAAC,CAAC;QACvD,OAAO,QAAQ,CAAC,CAAC,CAAC,gBAAgB,CAAC,QAAkB,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IACrE,CAAC;CACF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@telorun/kernel",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.79.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.63.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.79.0"
|
|
79
79
|
},
|
|
80
80
|
"optionalDependencies": {
|
|
81
81
|
"esbuild": "^0.25.12"
|
|
@@ -14,6 +14,9 @@ import * as fs from "fs/promises";
|
|
|
14
14
|
import * as path from "path";
|
|
15
15
|
import { fileURLToPath } from "url";
|
|
16
16
|
|
|
17
|
+
// Type-only: the loader that supplies this reporter imports the artifact, so
|
|
18
|
+
// the cycle is erased at compile time.
|
|
19
|
+
import type { ControllerWorkReporter } from "../controller-loader.js";
|
|
17
20
|
import { withDirectoryLock } from "../directory-lock.js";
|
|
18
21
|
import { cachePathForCanonical } from "../manifest-sources/local-manifest-cache-source.js";
|
|
19
22
|
import type { TransportRegistry } from "../transports/transport-registry.js";
|
|
@@ -189,8 +192,9 @@ export class ModuleArtifact {
|
|
|
189
192
|
*/
|
|
190
193
|
async materializeController(
|
|
191
194
|
selector: ArtifactSelector,
|
|
195
|
+
report?: ControllerWorkReporter,
|
|
192
196
|
): Promise<ResolvedControllerLayer | undefined> {
|
|
193
|
-
return this.materializeCode(selector, ["controller", "library"]);
|
|
197
|
+
return this.materializeCode(selector, ["controller", "library"], report);
|
|
194
198
|
}
|
|
195
199
|
|
|
196
200
|
/**
|
|
@@ -209,19 +213,20 @@ export class ModuleArtifact {
|
|
|
209
213
|
private async materializeCode(
|
|
210
214
|
selector: ArtifactSelector,
|
|
211
215
|
roles: ReadonlyArray<"controller" | "library">,
|
|
216
|
+
report?: ControllerWorkReporter,
|
|
212
217
|
): Promise<ResolvedControllerLayer | undefined> {
|
|
213
218
|
const wanted = roles
|
|
214
219
|
.map((role) => codeLayerFor(this.layers, role, selector))
|
|
215
220
|
.filter((l): l is ArtifactLayer => l !== undefined);
|
|
216
221
|
if (wanted.length === 0) return undefined;
|
|
217
|
-
const common = await this.materializeCommonTracked();
|
|
222
|
+
const common = await this.materializeCommonTracked(report);
|
|
218
223
|
let transferred = common?.transferred ?? false;
|
|
219
224
|
const files: string[] = [];
|
|
220
225
|
for (const layer of wanted) {
|
|
221
226
|
// Every half is a transfer the caller waited on: the common layer's bytes
|
|
222
227
|
// come down on this call too, so they are as much of a wait as the code
|
|
223
228
|
// layer's.
|
|
224
|
-
const resolved = await this.materializeTracked(layer);
|
|
229
|
+
const resolved = await this.materializeTracked(layer, report);
|
|
225
230
|
transferred = resolved.transferred || transferred;
|
|
226
231
|
files.push(...resolved.layer.files);
|
|
227
232
|
}
|
|
@@ -256,9 +261,11 @@ export class ModuleArtifact {
|
|
|
256
261
|
/** As `materializeCommon`, reporting whether this call transferred it — the
|
|
257
262
|
* controller path rides the common layer along and has to count its bytes as
|
|
258
263
|
* part of the wait. One lookup, so "common comes too" is encoded once. */
|
|
259
|
-
private async materializeCommonTracked(
|
|
264
|
+
private async materializeCommonTracked(
|
|
265
|
+
report?: ControllerWorkReporter,
|
|
266
|
+
): Promise<ResolvedControllerLayer | undefined> {
|
|
260
267
|
const layer = singletonLayer(this.layers, "common");
|
|
261
|
-
return layer ? this.materializeTracked(layer) : undefined;
|
|
268
|
+
return layer ? this.materializeTracked(layer, report) : undefined;
|
|
262
269
|
}
|
|
263
270
|
|
|
264
271
|
/**
|
|
@@ -298,10 +305,13 @@ export class ModuleArtifact {
|
|
|
298
305
|
* transfer to all of them would print one progress line per candidate for a
|
|
299
306
|
* single download. The call that started the work owns the report.
|
|
300
307
|
*/
|
|
301
|
-
private materializeTracked(
|
|
308
|
+
private materializeTracked(
|
|
309
|
+
layer: ArtifactLayer,
|
|
310
|
+
report?: ControllerWorkReporter,
|
|
311
|
+
): Promise<ResolvedControllerLayer> {
|
|
302
312
|
const pending = this.inFlight.get(layer.blob);
|
|
303
313
|
if (pending) return pending.then((r) => ({ layer: r.layer, transferred: false }));
|
|
304
|
-
const work = this.materializeUncached(layer).catch((err) => {
|
|
314
|
+
const work = this.materializeUncached(layer, report).catch((err) => {
|
|
305
315
|
// Drop the rejection so a transient fetch failure is retried rather than
|
|
306
316
|
// cached for the lifetime of the module.
|
|
307
317
|
this.inFlight.delete(layer.blob);
|
|
@@ -319,7 +329,10 @@ export class ModuleArtifact {
|
|
|
319
329
|
return path.join(this.dir, `.telo-layer-${layer.role}-${short}`);
|
|
320
330
|
}
|
|
321
331
|
|
|
322
|
-
private async materializeUncached(
|
|
332
|
+
private async materializeUncached(
|
|
333
|
+
layer: ArtifactLayer,
|
|
334
|
+
report?: ControllerWorkReporter,
|
|
335
|
+
): Promise<ResolvedControllerLayer> {
|
|
323
336
|
const marker = this.markerPath(layer);
|
|
324
337
|
if (existsSync(marker)) {
|
|
325
338
|
return { layer: { dir: this.dir, files: await readMarker(marker) }, transferred: false };
|
|
@@ -335,6 +348,10 @@ export class ModuleArtifact {
|
|
|
335
348
|
return { layer: { dir: this.dir, files: await readMarker(marker) }, transferred: false };
|
|
336
349
|
}
|
|
337
350
|
|
|
351
|
+
// Both re-checks are behind us, so this call really does go to the
|
|
352
|
+
// network — the one point at which a transfer is a fact rather than a
|
|
353
|
+
// possibility, and the same place `transferred: true` is decided.
|
|
354
|
+
await report?.("layer-fetch");
|
|
338
355
|
const files = await this.transports.fetchLayer(this.pinnedRef, layer.blob);
|
|
339
356
|
const actual = await computeFilesIntegrity(files);
|
|
340
357
|
if (actual !== layer.integrity) {
|
package/src/bundle/tar.ts
CHANGED
|
@@ -19,12 +19,39 @@ export function toPayloadFiles(entries: BundleEntry[]): PayloadFile[] {
|
|
|
19
19
|
}));
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
+
/**
|
|
23
|
+
* Every tar header field that is not the file's own name or contents, pinned.
|
|
24
|
+
*
|
|
25
|
+
* **The archive has to be a pure function of the files in it**, because a
|
|
26
|
+
* layer's `blob` digest covers these bytes and that digest is written into the
|
|
27
|
+
* published `telo.yaml` — which a dependent hashes to derive its import pin,
|
|
28
|
+
* before anything is pushed. A header carrying the wall clock (tar-stream
|
|
29
|
+
* defaults `mtime` to `new Date()`) makes the same file set frame to different
|
|
30
|
+
* bytes on every run, so the predicted digest and the pushed one would agree
|
|
31
|
+
* only by accident.
|
|
32
|
+
*
|
|
33
|
+
* Reproducibility is the same property seen from outside: re-running publish on
|
|
34
|
+
* one commit produces byte-identical layers. Node's gzip already writes no
|
|
35
|
+
* timestamp, so the tar header is the whole of it.
|
|
36
|
+
*/
|
|
37
|
+
const FIXED_HEADER = {
|
|
38
|
+
mtime: new Date(0),
|
|
39
|
+
mode: 0o644,
|
|
40
|
+
uid: 0,
|
|
41
|
+
gid: 0,
|
|
42
|
+
uname: "",
|
|
43
|
+
gname: "",
|
|
44
|
+
} as const;
|
|
45
|
+
|
|
22
46
|
/**
|
|
23
47
|
* Pack `entries` into a gzipped tar (`module.tar.gz`) — the module-artifact
|
|
24
48
|
* writer shared by `telo publish` and the transports. Artifacts are small (a
|
|
25
49
|
* manifest plus a built frontend), so buffering the whole archive before gzip
|
|
26
50
|
* is fine. (Distinct from `apps/k8s-runner/src/tar.ts`, which is coupled to
|
|
27
51
|
* `@telorun/runner-core`'s `RunBundle`.)
|
|
52
|
+
*
|
|
53
|
+
* Deterministic: identical entries in identical order produce identical bytes
|
|
54
|
+
* (see {@link FIXED_HEADER}).
|
|
28
55
|
*/
|
|
29
56
|
export async function makeTarGz(entries: BundleEntry[]): Promise<Buffer> {
|
|
30
57
|
const pack = tarPack();
|
|
@@ -39,7 +66,7 @@ export async function makeTarGz(entries: BundleEntry[]): Promise<Buffer> {
|
|
|
39
66
|
for (const entry of entries) {
|
|
40
67
|
const buf = typeof entry.content === "string" ? Buffer.from(entry.content, "utf-8") : entry.content;
|
|
41
68
|
await new Promise<void>((resolve, reject) => {
|
|
42
|
-
pack.entry({ name: entry.name }, buf, (err) => (err ? reject(err) : resolve()));
|
|
69
|
+
pack.entry({ name: entry.name, ...FIXED_HEADER }, buf, (err) => (err ? reject(err) : resolve()));
|
|
43
70
|
});
|
|
44
71
|
}
|
|
45
72
|
pack.finalize();
|
package/src/controller-loader.ts
CHANGED
|
@@ -39,10 +39,44 @@ export interface ResolvedController {
|
|
|
39
39
|
purl: string;
|
|
40
40
|
source: ControllerResolveSource;
|
|
41
41
|
importInstance: () => Promise<ControllerInstance>;
|
|
42
|
+
/**
|
|
43
|
+
* How long the caller has waited for this controller, measured from the
|
|
44
|
+
* first {@link ControllerWorkKind} branch it entered — or, when it entered
|
|
45
|
+
* none, from the `importInstance()` call. Resolution is what installs,
|
|
46
|
+
* compiles and fetches, so timing only the import reports a 40-second
|
|
47
|
+
* install as a few milliseconds.
|
|
48
|
+
*/
|
|
49
|
+
waitedMs: () => number;
|
|
42
50
|
}
|
|
43
51
|
|
|
52
|
+
/**
|
|
53
|
+
* A branch that makes the caller wait: a registry install, a compile, or a
|
|
54
|
+
* layer transfer. Reported by the sub-loader that is about to enter it, which
|
|
55
|
+
* is the only place that knows — a resolve's `source` is a verdict available
|
|
56
|
+
* only afterwards, and a warm start enters no branch at all, so nothing is
|
|
57
|
+
* announced for it. Reported for work in the resolve *and* the import phase:
|
|
58
|
+
* a dev-mode `pkg:telo` build and a `cargo build` are both paid inside
|
|
59
|
+
* `importInstance`.
|
|
60
|
+
*/
|
|
61
|
+
export type ControllerWorkKind = "npm-install" | "cargo-build" | "source-build" | "layer-fetch";
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Sub-loader hook, invoked immediately before entering a {@link
|
|
65
|
+
* ControllerWorkKind} branch. Awaited, so a consumer that renders progress has
|
|
66
|
+
* its line on screen before the wait starts rather than after it.
|
|
67
|
+
*/
|
|
68
|
+
export type ControllerWorkReporter = (work: ControllerWorkKind) => void | Promise<void>;
|
|
69
|
+
|
|
44
70
|
export type ControllerLoaderEvent =
|
|
45
|
-
|
|
71
|
+
/**
|
|
72
|
+
* A resolved controller is about to be imported. `source` names the branch
|
|
73
|
+
* the resolve took, so a consumer can tell a warm start (`cache` / `local`)
|
|
74
|
+
* from work someone waited for (`npm-install`, `cargo-build`, `bundle`)
|
|
75
|
+
* *before* rendering anything. The event is emitted after resolution
|
|
76
|
+
* precisely so this is known: resolution is what fetches, installs and
|
|
77
|
+
* builds, and an event emitted ahead of it could only speculate.
|
|
78
|
+
*/
|
|
79
|
+
| { name: "ControllerLoading"; payload: { purl: string; source: ControllerResolveSource } }
|
|
46
80
|
| {
|
|
47
81
|
name: "ControllerLoaded";
|
|
48
82
|
payload: { purl: string; source: ControllerResolveSource; durationMs: number };
|
|
@@ -55,7 +89,15 @@ export type ControllerLoaderEvent =
|
|
|
55
89
|
* which is non-recoverable. Consumers that opened a UI element on the
|
|
56
90
|
* matching `ControllerLoading` should close it out here.
|
|
57
91
|
*/
|
|
58
|
-
| { name: "ControllerLoadSkipped"; payload: { purl: string; reason: string } }
|
|
92
|
+
| { name: "ControllerLoadSkipped"; payload: { purl: string; reason: string } }
|
|
93
|
+
/**
|
|
94
|
+
* Real work has started for `purl` — an install, a compile or a transfer is
|
|
95
|
+
* about to run. This is the *only* in-progress signal, and it fires solely
|
|
96
|
+
* on the branch that does the work, so a warm start emits nothing rather
|
|
97
|
+
* than something a consumer has to take back. Closed by the matching
|
|
98
|
+
* `ControllerLoaded` / `ControllerLoadFailed`.
|
|
99
|
+
*/
|
|
100
|
+
| { name: "ControllerWorkStarted"; payload: { purl: string; work: ControllerWorkKind } };
|
|
59
101
|
|
|
60
102
|
/**
|
|
61
103
|
* The dispatcher awaits each emission, so the callback may be async without
|
|
@@ -104,9 +146,13 @@ export interface ControllerLoaderOptions {
|
|
|
104
146
|
* next candidate. User-code failures (`RuntimeError("ERR_CONTROLLER_BUILD_FAILED" | "ERR_CONTROLLER_INVALID")`)
|
|
105
147
|
* fail hard regardless of remaining candidates.
|
|
106
148
|
*
|
|
107
|
-
* Lifecycle events
|
|
108
|
-
* `
|
|
109
|
-
* `
|
|
149
|
+
* Lifecycle events follow resolution: a candidate this environment cannot host
|
|
150
|
+
* produces a `ControllerLoadSkipped` and nothing else, and only the candidate
|
|
151
|
+
* that resolved gets a `ControllerLoading` (carrying its resolve `source`)
|
|
152
|
+
* followed by `ControllerLoaded` / `ControllerLoadFailed`. In between, the
|
|
153
|
+
* sub-loader announces each branch that makes the caller wait as
|
|
154
|
+
* `ControllerWorkStarted` — the only in-progress signal, and the only one that
|
|
155
|
+
* cannot be emitted for a warm start.
|
|
110
156
|
*/
|
|
111
157
|
export class ControllerLoader {
|
|
112
158
|
private readonly emit: ControllerLoaderEmit | undefined;
|
|
@@ -132,56 +178,28 @@ export class ControllerLoader {
|
|
|
132
178
|
artifact?: ModuleArtifact,
|
|
133
179
|
libraries: SiblingLibraryMap = NO_SIBLING_LIBRARIES,
|
|
134
180
|
): Promise<ControllerInstance> {
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
const
|
|
139
|
-
const ordered = orderCandidates(purlCandidates, effectivePolicy);
|
|
140
|
-
if (ordered.length === 0) {
|
|
141
|
-
throw new RuntimeError(
|
|
142
|
-
"ERR_CONTROLLER_NOT_FOUND",
|
|
143
|
-
`No controllers match runtime selection [${effectivePolicy.load.join(", ")}]; declared: ${purlCandidates.join(", ")}`,
|
|
144
|
-
);
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
const errors: string[] = [];
|
|
148
|
-
for (const purl of ordered) {
|
|
149
|
-
await this.emit?.({ name: "ControllerLoading", payload: { purl } });
|
|
150
|
-
const startedAt = Date.now();
|
|
151
|
-
try {
|
|
152
|
-
const { instance, source } = await this.dispatchOne(purl, baseUri, artifact, libraries);
|
|
153
|
-
await this.emit?.({
|
|
154
|
-
name: "ControllerLoaded",
|
|
155
|
-
payload: { purl, source, durationMs: Date.now() - startedAt },
|
|
156
|
-
});
|
|
157
|
-
return instance;
|
|
158
|
-
} catch (err) {
|
|
159
|
-
if (err instanceof ControllerEnvMissingError) {
|
|
160
|
-
errors.push(`${purl}: ${err.message}`);
|
|
161
|
-
// Env-missing isn't a hard failure — the dispatcher will try the
|
|
162
|
-
// next candidate. We still emit a terminal event for *this* attempt
|
|
163
|
-
// so consumers (notably the CLI progress renderer) can close out
|
|
164
|
-
// the UI state opened by the matching ControllerLoading. Without
|
|
165
|
-
// this, every fallback attempt would leak a pending `⬇` line.
|
|
166
|
-
await this.emit?.({
|
|
167
|
-
name: "ControllerLoadSkipped",
|
|
168
|
-
payload: { purl, reason: err.message },
|
|
169
|
-
});
|
|
170
|
-
continue;
|
|
171
|
-
}
|
|
172
|
-
await this.emit?.({
|
|
173
|
-
name: "ControllerLoadFailed",
|
|
174
|
-
payload: { purl, error: err instanceof Error ? err.message : String(err) },
|
|
175
|
-
});
|
|
176
|
-
throw err;
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
const aggregated = `No controller resolved. Tried ${ordered.length} candidate(s):\n${errors.join("\n")}`;
|
|
181
|
+
// Resolution — which is what installs, compiles and fetches — reports its
|
|
182
|
+
// own work and its own candidate fallthrough, so this is the import half
|
|
183
|
+
// and the announcement of what resolution decided.
|
|
184
|
+
const resolved = await this.resolve(purlCandidates, baseUri, policy, artifact, libraries);
|
|
180
185
|
await this.emit?.({
|
|
181
|
-
name: "
|
|
182
|
-
payload: { purl:
|
|
186
|
+
name: "ControllerLoading",
|
|
187
|
+
payload: { purl: resolved.purl, source: resolved.source },
|
|
183
188
|
});
|
|
184
|
-
|
|
189
|
+
try {
|
|
190
|
+
const instance = await resolved.importInstance();
|
|
191
|
+
await this.emit?.({
|
|
192
|
+
name: "ControllerLoaded",
|
|
193
|
+
payload: { purl: resolved.purl, source: resolved.source, durationMs: resolved.waitedMs() },
|
|
194
|
+
});
|
|
195
|
+
return instance;
|
|
196
|
+
} catch (err) {
|
|
197
|
+
await this.emit?.({
|
|
198
|
+
name: "ControllerLoadFailed",
|
|
199
|
+
payload: { purl: resolved.purl, error: err instanceof Error ? err.message : String(err) },
|
|
200
|
+
});
|
|
201
|
+
throw err;
|
|
202
|
+
}
|
|
185
203
|
}
|
|
186
204
|
|
|
187
205
|
/**
|
|
@@ -194,10 +212,12 @@ export class ControllerLoader {
|
|
|
194
212
|
* registers fine and errors only when a resource of it is declared (matching
|
|
195
213
|
* the Rust kernel's deferral).
|
|
196
214
|
*
|
|
197
|
-
*
|
|
198
|
-
*
|
|
199
|
-
*
|
|
200
|
-
*
|
|
215
|
+
* Emits `ControllerWorkStarted` whenever a sub-loader enters a branch that
|
|
216
|
+
* makes the caller wait, and `ControllerLoadSkipped` per candidate this
|
|
217
|
+
* environment cannot host. It does NOT announce the load itself: the caller
|
|
218
|
+
* emits ControllerLoading/Loaded around `importInstance`, so those fire when
|
|
219
|
+
* the load actually happens, with the resolved `source` already in hand. A
|
|
220
|
+
* total resolution failure throws, mirroring {@link load}'s aggregated error.
|
|
201
221
|
*/
|
|
202
222
|
async resolve(
|
|
203
223
|
purlCandidates: string[],
|
|
@@ -219,41 +239,54 @@ export class ControllerLoader {
|
|
|
219
239
|
}
|
|
220
240
|
const errors: string[] = [];
|
|
221
241
|
for (const purl of ordered) {
|
|
242
|
+
// First work only: an install followed by a compile is one wait, and the
|
|
243
|
+
// clock the caller reads has to start where that wait did. The reporter
|
|
244
|
+
// outlives resolution because the import phase does work too.
|
|
245
|
+
let workStartedAt: number | undefined;
|
|
246
|
+
const report: ControllerWorkReporter = async (work) => {
|
|
247
|
+
workStartedAt ??= Date.now();
|
|
248
|
+
await this.emit?.({ name: "ControllerWorkStarted", payload: { purl, work } });
|
|
249
|
+
};
|
|
222
250
|
try {
|
|
223
251
|
const { source, importInstance } = await this.dispatchResolveOne(
|
|
224
252
|
purl,
|
|
225
253
|
baseUri,
|
|
226
254
|
artifact,
|
|
227
255
|
libraries,
|
|
256
|
+
report,
|
|
228
257
|
);
|
|
229
|
-
|
|
258
|
+
let importStartedAt: number | undefined;
|
|
259
|
+
return {
|
|
260
|
+
purl,
|
|
261
|
+
source,
|
|
262
|
+
importInstance: () => {
|
|
263
|
+
importStartedAt ??= Date.now();
|
|
264
|
+
return importInstance();
|
|
265
|
+
},
|
|
266
|
+
waitedMs: () => Date.now() - (workStartedAt ?? importStartedAt ?? Date.now()),
|
|
267
|
+
};
|
|
230
268
|
} catch (err) {
|
|
231
269
|
if (err instanceof ControllerEnvMissingError) {
|
|
232
270
|
errors.push(`${purl}: ${err.message}`);
|
|
271
|
+
await this.emit?.({
|
|
272
|
+
name: "ControllerLoadSkipped",
|
|
273
|
+
payload: { purl, reason: err.message },
|
|
274
|
+
});
|
|
233
275
|
continue;
|
|
234
276
|
}
|
|
277
|
+
await this.emit?.({
|
|
278
|
+
name: "ControllerLoadFailed",
|
|
279
|
+
payload: { purl, error: err instanceof Error ? err.message : String(err) },
|
|
280
|
+
});
|
|
235
281
|
throw err;
|
|
236
282
|
}
|
|
237
283
|
}
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
private async dispatchOne(
|
|
245
|
-
purl: string,
|
|
246
|
-
baseUri: string,
|
|
247
|
-
artifact: ModuleArtifact | undefined,
|
|
248
|
-
libraries: SiblingLibraryMap,
|
|
249
|
-
): Promise<{ instance: ControllerInstance; source: ControllerResolveSource }> {
|
|
250
|
-
const { source, importInstance } = await this.dispatchResolveOne(
|
|
251
|
-
purl,
|
|
252
|
-
baseUri,
|
|
253
|
-
artifact,
|
|
254
|
-
libraries,
|
|
255
|
-
);
|
|
256
|
-
return { instance: await importInstance(), source };
|
|
284
|
+
const aggregated = `No controller resolved. Tried ${ordered.length} candidate(s):\n${errors.join("\n")}`;
|
|
285
|
+
await this.emit?.({
|
|
286
|
+
name: "ControllerLoadFailed",
|
|
287
|
+
payload: { purl: ordered[ordered.length - 1], error: aggregated },
|
|
288
|
+
});
|
|
289
|
+
throw new RuntimeError("ERR_CONTROLLER_NOT_FOUND", aggregated);
|
|
257
290
|
}
|
|
258
291
|
|
|
259
292
|
private async dispatchResolveOne(
|
|
@@ -261,15 +294,16 @@ export class ControllerLoader {
|
|
|
261
294
|
baseUri: string,
|
|
262
295
|
artifact: ModuleArtifact | undefined,
|
|
263
296
|
libraries: SiblingLibraryMap,
|
|
297
|
+
report: ControllerWorkReporter,
|
|
264
298
|
): Promise<{ source: ControllerResolveSource; importInstance: () => Promise<ControllerInstance> }> {
|
|
265
299
|
if (purl.startsWith("pkg:npm")) {
|
|
266
|
-
return this.npmLoader.resolve(purl, baseUri);
|
|
300
|
+
return this.npmLoader.resolve(purl, baseUri, report);
|
|
267
301
|
}
|
|
268
302
|
if (purl.startsWith("pkg:cargo")) {
|
|
269
|
-
return this.napiLoader.resolve(purl, baseUri);
|
|
303
|
+
return this.napiLoader.resolve(purl, baseUri, report);
|
|
270
304
|
}
|
|
271
305
|
if (purl.startsWith("pkg:telo")) {
|
|
272
|
-
return this.bundleLoader.resolve(purl, baseUri, artifact, libraries);
|
|
306
|
+
return this.bundleLoader.resolve(purl, baseUri, artifact, libraries, report);
|
|
273
307
|
}
|
|
274
308
|
throw new ControllerEnvMissingError(`Unsupported PURL scheme: ${purl}`);
|
|
275
309
|
}
|
|
@@ -7,7 +7,7 @@ import { PackageURL } from "packageurl-js";
|
|
|
7
7
|
import * as path from "path";
|
|
8
8
|
import { fileURLToPath, pathToFileURL } from "url";
|
|
9
9
|
import { hostPlatformTarget, type ModuleArtifact } from "../bundle/module-artifact.js";
|
|
10
|
-
import type { ControllerResolveSource } from "../controller-loader.js";
|
|
10
|
+
import type { ControllerResolveSource, ControllerWorkReporter } from "../controller-loader.js";
|
|
11
11
|
import { ControllerEnvMissingError } from "./napi-loader.js";
|
|
12
12
|
import { REALM_COLLAPSE_NAMES } from "./realm.js";
|
|
13
13
|
import {
|
|
@@ -485,6 +485,7 @@ export class BundleControllerLoader {
|
|
|
485
485
|
baseUri: string,
|
|
486
486
|
artifact?: ModuleArtifact,
|
|
487
487
|
libraries: SiblingLibraryMap = NO_SIBLING_LIBRARIES,
|
|
488
|
+
report?: ControllerWorkReporter,
|
|
488
489
|
): Promise<{ source: ControllerResolveSource; importInstance: () => Promise<ControllerInstance> }> {
|
|
489
490
|
let parsed: PackageURL;
|
|
490
491
|
try {
|
|
@@ -578,10 +579,17 @@ export class BundleControllerLoader {
|
|
|
578
579
|
importInstance: async () => {
|
|
579
580
|
let built: string;
|
|
580
581
|
try {
|
|
582
|
+
// A dev build is a compile the caller waits on, and it is paid here
|
|
583
|
+
// rather than at resolve — which is why the work signal is not tied
|
|
584
|
+
// to the resolve phase. The reporter goes INTO the builder rather
|
|
585
|
+
// than wrapping the call: only the builder knows whether its
|
|
586
|
+
// content-addressed cache answered, and reporting a cache hit would
|
|
587
|
+
// put a line on screen for work nobody waited for.
|
|
581
588
|
built = await buildControllerFromSource(
|
|
582
589
|
sourceFile!,
|
|
583
590
|
cacheRoot!,
|
|
584
591
|
buildExternals(libraries, format),
|
|
592
|
+
report,
|
|
585
593
|
);
|
|
586
594
|
} catch (err) {
|
|
587
595
|
if (!(err instanceof ControllerEnvMissingError)) throw err;
|
|
@@ -607,7 +615,7 @@ export class BundleControllerLoader {
|
|
|
607
615
|
if (artifact) {
|
|
608
616
|
// By its own selector, not by re-matching the host: this candidate IS one
|
|
609
617
|
// selector, and it is exactly the key of the layer that carries it.
|
|
610
|
-
const resolved = await artifact.materializeController(selector);
|
|
618
|
+
const resolved = await artifact.materializeController(selector, report);
|
|
611
619
|
if (!resolved) {
|
|
612
620
|
throw new ControllerEnvMissingError(
|
|
613
621
|
`pkg:telo controller "${purl}": the module artifact ships no layer for ` +
|
|
@@ -8,6 +8,8 @@ import { fileURLToPath } from "url";
|
|
|
8
8
|
import { promisify } from "util";
|
|
9
9
|
|
|
10
10
|
import { hostEnv } from "../host-env.js";
|
|
11
|
+
// Type-only, so the cycle with the dispatcher that imports this loader is erased.
|
|
12
|
+
import type { ControllerWorkReporter } from "../controller-loader.js";
|
|
11
13
|
|
|
12
14
|
const execFileAsync = promisify(execFile);
|
|
13
15
|
const requireFromHere = createRequire(import.meta.url);
|
|
@@ -140,6 +142,7 @@ export class NapiControllerLoader {
|
|
|
140
142
|
async resolve(
|
|
141
143
|
purl: string,
|
|
142
144
|
baseUri: string,
|
|
145
|
+
report?: ControllerWorkReporter,
|
|
143
146
|
): Promise<{ source: NapiResolveSource; importInstance: () => Promise<ControllerInstance> }> {
|
|
144
147
|
const [, , name, , qualifiers, entry] = PackageURL.parseString(purl);
|
|
145
148
|
const localPath = (qualifiers as any)?.get("local_path");
|
|
@@ -199,6 +202,9 @@ export class NapiControllerLoader {
|
|
|
199
202
|
const { rawModule } = await existingInFlight;
|
|
200
203
|
return project(rawModule, entry, cratePath);
|
|
201
204
|
}
|
|
205
|
+
// Nothing above this line compiles — the cache and the in-flight gate
|
|
206
|
+
// both return without cargo running.
|
|
207
|
+
await report?.("cargo-build");
|
|
202
208
|
const buildPromise = build(cratePath, crateName, cacheKey);
|
|
203
209
|
_napiInFlight.set(cacheKey, buildPromise);
|
|
204
210
|
let rawModule: any;
|