@telorun/kernel 0.24.1 → 0.25.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.
Files changed (38) hide show
  1. package/dist/application-env.d.ts +34 -0
  2. package/dist/application-env.d.ts.map +1 -1
  3. package/dist/application-env.js +77 -0
  4. package/dist/application-env.js.map +1 -1
  5. package/dist/controller-loaders/npm-loader.d.ts +41 -12
  6. package/dist/controller-loaders/npm-loader.d.ts.map +1 -1
  7. package/dist/controller-loaders/npm-loader.js +117 -51
  8. package/dist/controller-loaders/npm-loader.js.map +1 -1
  9. package/dist/controller-registry.d.ts +9 -0
  10. package/dist/controller-registry.d.ts.map +1 -1
  11. package/dist/controller-registry.js +18 -0
  12. package/dist/controller-registry.js.map +1 -1
  13. package/dist/controllers/module/import-controller.d.ts.map +1 -1
  14. package/dist/controllers/module/import-controller.js +50 -28
  15. package/dist/controllers/module/import-controller.js.map +1 -1
  16. package/dist/evaluation-context.d.ts.map +1 -1
  17. package/dist/evaluation-context.js +13 -5
  18. package/dist/evaluation-context.js.map +1 -1
  19. package/dist/kernel.d.ts +13 -2
  20. package/dist/kernel.d.ts.map +1 -1
  21. package/dist/kernel.js +41 -2
  22. package/dist/kernel.js.map +1 -1
  23. package/dist/module-context.d.ts +56 -7
  24. package/dist/module-context.d.ts.map +1 -1
  25. package/dist/module-context.js +121 -10
  26. package/dist/module-context.js.map +1 -1
  27. package/dist/schema-validator.d.ts.map +1 -1
  28. package/dist/schema-validator.js +39 -3
  29. package/dist/schema-validator.js.map +1 -1
  30. package/package.json +2 -2
  31. package/src/application-env.ts +81 -0
  32. package/src/controller-loaders/npm-loader.ts +124 -58
  33. package/src/controller-registry.ts +18 -0
  34. package/src/controllers/module/import-controller.ts +58 -28
  35. package/src/evaluation-context.ts +15 -5
  36. package/src/kernel.ts +52 -2
  37. package/src/module-context.ts +153 -11
  38. package/src/schema-validator.ts +41 -3
@@ -1,5 +1,5 @@
1
1
  import { evaluate } from "@marcbachmann/cel-js";
2
- import { RuntimeError } from "@telorun/sdk";
2
+ import { isCompiledValue, RuntimeError } from "@telorun/sdk";
3
3
  import AjvModule from "ajv";
4
4
  import standaloneCodeMod from "ajv/dist/standalone/index.js";
5
5
  import addFormats from "ajv-formats";
@@ -8,7 +8,7 @@ import * as fs from "node:fs";
8
8
  import { createRequire } from "node:module";
9
9
  import * as path from "node:path";
10
10
  import { formatAjvErrors } from "./manifest-schemas.js";
11
- import { ManifestRootSchema, normalizeRefSlots } from "@telorun/templating";
11
+ import { isTaggedSentinel, ManifestRootSchema, normalizeRefSlots } from "@telorun/templating";
12
12
  const Ajv = AjvModule.default ?? AjvModule;
13
13
  // AJV's standalone subpath is CJS — the default export shows up as either
14
14
  // the function itself or `.default` depending on how the bundler/loader
@@ -76,6 +76,39 @@ function verifyAndExtractBody(text) {
76
76
  const actual = createHash("sha256").update(body).digest("hex");
77
77
  return actual === match[1] ? body : null;
78
78
  }
79
+ /** Deep-clone `value` collapsing every CEL/template sentinel to its original
80
+ * `source` string, for use as the validator cache *key* only.
81
+ *
82
+ * The same `Telo.Definition` schema reaches `compile()` in two forms: the
83
+ * build-time validator warm feeds the raw analysis graph (parse-time
84
+ * `{__tagged, engine, source}` sentinels, or plain `${{ }}` strings for inline
85
+ * templates), while the runtime feeds the compile-loader output (`{__compiled,
86
+ * source, parts}`). A `!cel` / `!sql` tag embedded anywhere in a schema — most
87
+ * commonly inside `examples` / `description`, but the loader rewrites them at
88
+ * any position — therefore serialises differently between the two, so without
89
+ * normalisation the same kind hashes differently and the runtime misses the
90
+ * warmed cache (and fails to persist it read-only). Both sentinel shapes carry
91
+ * the same original `source`, so collapsing each to that string converges them.
92
+ *
93
+ * This rewrites only the hash key — AJV still compiles the full `injected`
94
+ * schema. Unlike dropping keys by name, it never removes a structural node, so
95
+ * a property literally named `description` / `examples` keeps its schema in the
96
+ * key and two genuinely different shapes never collide. */
97
+ function normalizeSentinelsForHash(value) {
98
+ if (isCompiledValue(value) || isTaggedSentinel(value)) {
99
+ return typeof value.source === "string" ? value.source : { __teloSentinel: true };
100
+ }
101
+ if (Array.isArray(value))
102
+ return value.map(normalizeSentinelsForHash);
103
+ if (value && typeof value === "object") {
104
+ const out = {};
105
+ for (const [k, v] of Object.entries(value)) {
106
+ out[k] = normalizeSentinelsForHash(v);
107
+ }
108
+ return out;
109
+ }
110
+ return value;
111
+ }
79
112
  export class SchemaValidator {
80
113
  constructor() {
81
114
  this.typeRules = new Map();
@@ -179,7 +212,10 @@ export class SchemaValidator {
179
212
  // would otherwise reject.
180
213
  const injected = normalizeRefSlots(withImplicit);
181
214
  const hash = createHash("sha256")
182
- .update(JSON.stringify({ runtime: VALIDATOR_RUNTIME_TAG, schema: injected }))
215
+ .update(JSON.stringify({
216
+ runtime: VALIDATOR_RUNTIME_TAG,
217
+ schema: normalizeSentinelsForHash(injected),
218
+ }))
183
219
  .digest("hex")
184
220
  .slice(0, 32);
185
221
  const cachedByHash = this.hashCache.get(hash);
@@ -1 +1 @@
1
- {"version":3,"file":"schema-validator.js","sourceRoot":"","sources":["../src/schema-validator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAiB,YAAY,EAAY,MAAM,cAAc,CAAC;AACrE,OAAO,SAAoC,MAAM,KAAK,CAAC;AACvD,OAAO,iBAAiB,MAAM,8BAA8B,CAAC;AAC7D,OAAO,UAAU,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAE5E,MAAM,GAAG,G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AAQ,CAAC,IAAI,CAAC,SAAS,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;oBACpD,CAAC;oBAAC,OAAO,GAAG,EAAE,CAAC;wBACb,MAAM,IAAI,YAAY,CACpB,4BAA4B,EAC5B,SAAS,QAAQ,6BAA6B,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CACjG,CAAC;oBACJ,CAAC;oBACD,IAAI,MAAM,KAAK,IAAI,EAAE,CAAC;wBACpB,MAAM,IAAI,YAAY,CACpB,IAAI,CAAC,IAAI,IAAI,4BAA4B,EACzC,IAAI,CAAC,OAAO,IAAI,SAAS,QAAQ,8BAA8B,IAAI,CAAC,IAAI,iBAAiB,CAC1F,CAAC;oBACJ,CAAC;gBACH,CAAC;YACH,CAAC;YACD,OAAO,EAAE,CAAC,IAAS,EAAE,EAAE;gBACrB,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC;oBAAE,OAAO,KAAK,CAAC;gBACtC,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;oBACzB,IAAI,CAAC;wBACH,IAAI,QAAQ,CAAC,IAAI,CAAC,SAAS,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,KAAK,IAAI;4BAAE,OAAO,KAAK,CAAC;oBACtE,CAAC;oBAAC,MAAM,CAAC;wBACP,OAAO,KAAK,CAAC;oBACf,CAAC;gBACH,CAAC;gBACD,OAAO,IAAI,CAAC;YACd,CAAC;SACF,CAAC;IACJ,CAAC;CACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@telorun/kernel",
3
- "version": "0.24.1",
3
+ "version": "0.25.0",
4
4
  "description": "Telo Runtime - A lightweight, polyglot execution host.",
5
5
  "keywords": [
6
6
  "telo",
@@ -47,7 +47,7 @@
47
47
  "dependencies": {
48
48
  "@marcbachmann/cel-js": "^7.6.1",
49
49
  "@sinclair/typebox": "^0.34.48",
50
- "@telorun/analyzer": "0.22.0",
50
+ "@telorun/analyzer": "0.23.0",
51
51
  "@telorun/templating": "0.8.0",
52
52
  "ajv": "^8.17.1",
53
53
  "ajv-formats": "^3.0.1",
@@ -80,6 +80,87 @@ export function resolveApplicationEnv(
80
80
  return { variables, secrets, ports };
81
81
  }
82
82
 
83
+ /**
84
+ * Build-time cache warm: compile — but do NOT validate — the residual schema
85
+ * for every `variables` / `secrets` / `ports` entry the runtime
86
+ * `resolveApplicationEnv` would, so each standalone validator lands in the
87
+ * on-disk `__validators` cache. Schema *compilation* is value-independent, so
88
+ * this needs none of the host env vars / secrets `resolveApplicationEnv`
89
+ * requires — it can run during `telo install`. At run time on a read-only
90
+ * session rootfs `resolveApplicationEnv` then hits the cache instead of
91
+ * recompiling and failing to persist (ENOENT / EROFS).
92
+ *
93
+ * Mirrors `resolveApplicationEnv` exactly: same `residualEntrySchema` per
94
+ * variable/secret and the same `PORT_RESIDUAL_SCHEMA`, so the cache keys
95
+ * match byte-for-byte. Compile failures are swallowed — a genuinely broken
96
+ * schema surfaces through the normal analysis/runtime path, not here.
97
+ */
98
+ export function precompileApplicationEnvSchemas(
99
+ manifest: Record<string, any>,
100
+ validator: SchemaValidator,
101
+ ): void {
102
+ const compile = (schema: Record<string, unknown>): void => {
103
+ try {
104
+ validator.compile(schema as any);
105
+ } catch {
106
+ // Broken schemas are reported by analysis / runtime, not the warm pass.
107
+ }
108
+ };
109
+ for (const block of [manifest.variables, manifest.secrets]) {
110
+ if (!block || typeof block !== "object" || Array.isArray(block)) continue;
111
+ for (const entry of Object.values(block as Record<string, EnvEntry>)) {
112
+ if (!entry || typeof entry !== "object") continue;
113
+ compile(residualEntrySchema(entry as Record<string, unknown>));
114
+ }
115
+ }
116
+ const ports = manifest.ports;
117
+ if (
118
+ ports &&
119
+ typeof ports === "object" &&
120
+ !Array.isArray(ports) &&
121
+ Object.keys(ports).length > 0
122
+ ) {
123
+ compile(PORT_RESIDUAL_SCHEMA);
124
+ }
125
+ }
126
+
127
+ /**
128
+ * Build-time cache warm for resource-config validators. The runtime
129
+ * `_createInstance` compiles `controller.schema` — which falls back to the
130
+ * declaring `Telo.Definition`'s own `schema` — to validate every resource's
131
+ * config, then validates inputs/outputs against `inputType` / `outputType`.
132
+ * The analyze-only warm pass stops before instantiation, so without this those
133
+ * validators are absent from the `__validators` cache and the runtime
134
+ * recompiles (and, on a read-only image, fails to persist) them on every boot.
135
+ *
136
+ * Compiling each definition's `schema` (plus any inline `inputType` /
137
+ * `outputType` object schemas) here writes them into the same content-addressed
138
+ * cache the runtime reads, keyed identically because the same schema object is
139
+ * fed to the same `validator.compile`. Definitions whose controller exports its
140
+ * own `schema` (rare) still recompile at runtime — that needs the controller
141
+ * loaded, which the warm pass does not do. Compile failures are swallowed; a
142
+ * genuinely broken schema surfaces through analysis / runtime, not here.
143
+ */
144
+ export function precompileDefinitionSchemas(
145
+ manifests: Array<Record<string, any>>,
146
+ validator: SchemaValidator,
147
+ ): void {
148
+ const compile = (schema: unknown): void => {
149
+ if (!schema || typeof schema !== "object") return;
150
+ try {
151
+ validator.compile(schema as any);
152
+ } catch {
153
+ // Broken schemas are reported by analysis / runtime, not the warm pass.
154
+ }
155
+ };
156
+ for (const m of manifests) {
157
+ if (m?.kind !== "Telo.Definition") continue;
158
+ compile(m.schema);
159
+ compile(m.inputType);
160
+ compile(m.outputType);
161
+ }
162
+ }
163
+
83
164
  /**
84
165
  * Populate the root Application's `ports` namespace from host environment
85
166
  * variables. Mirrors `resolveBlock` but fixes the value type to a port integer
@@ -104,14 +104,17 @@ export interface NpmControllerLoaderOptions {
104
104
  * local entry manifest (`file://` URL or bare path) the root lives at
105
105
  * `<entry-manifest-dir>/.telo/npm/`; for an HTTP(S) entry URL it lives in a
106
106
  * user-level cache keyed by `sha256(entryUrl)` (see `computeInstallRoot`).
107
- * Every controller — registry tag or `local_path` — is installed via
108
- * `npm install <spec>` into this root, then imported from
109
- * `<root>/node_modules/<pkg>`. This collapses two parallel
110
- * module realms (kernel-side @telorun/sdk vs. controller-side @telorun/sdk)
111
- * into one: the kernel's own SDK is wired in as a `file:` dep, npm/pnpm
112
- * symlink it, and Node's ESM resolver follows the symlink to the same
113
- * realpath as the kernel so `Stream` (and any other class-identity-sensitive
114
- * type) has a single constructor across the process.
107
+ * Every controller — registry tag or `local_path` — is installed under a
108
+ * version-scoped npm alias (`npm install <alias>@<spec>`, see `installAlias`)
109
+ * into this root, then imported from `<root>/node_modules/<alias>`. The alias
110
+ * encodes `name@version`, so a graph that references one package at two
111
+ * versions keeps both in the single flat `node_modules` instead of the last
112
+ * `--save` clobbering the first. This still collapses two parallel module
113
+ * realms (kernel-side @telorun/sdk vs. controller-side @telorun/sdk) into one:
114
+ * `@telorun/sdk` is exempt from aliasing and wired in as a `file:` dep under
115
+ * its real name, npm/pnpm hoist a single copy, and Node's ESM resolver follows
116
+ * it to the same realpath as the kernel — so `Stream` (and any other
117
+ * class-identity-sensitive type) has a single constructor across the process.
115
118
  *
116
119
  * Per-kernel state lives on each `NpmControllerLoader` instance (one is
117
120
  * constructed per `ControllerLoader`, which is itself constructed per
@@ -169,17 +172,21 @@ export class NpmControllerLoader {
169
172
  throw new Error(`Invalid PURL '${purl}': missing package name`);
170
173
  }
171
174
  const packageName = parsed.namespace ? `${parsed.namespace}/${parsed.name}` : parsed.name;
175
+ const version = parsed.version ?? null;
176
+ // Version-scope the install under an alias so the same package at two
177
+ // versions can coexist in one flat node_modules (see installAlias).
178
+ const alias = installAlias(packageName, version);
172
179
 
173
180
  const installRoot = await this.ensureInstallRoot();
174
181
  const resolved = await resolveInstallSpec(parsed, packageName, baseUri);
175
182
  const source = await this.installPackage(
176
183
  installRoot,
177
- packageName,
184
+ alias,
178
185
  resolved.spec,
179
186
  resolved.kind,
180
- parsed.version ?? null,
187
+ version,
181
188
  );
182
- const instance = await loadFromInstall(installRoot, packageName, parsed.subpath ?? null, purl);
189
+ const instance = await loadFromInstall(installRoot, alias, parsed.subpath ?? null, purl);
183
190
  return { instance, source };
184
191
  }
185
192
 
@@ -296,6 +303,11 @@ export class NpmControllerLoader {
296
303
  installRoot: string,
297
304
  dependencies: Record<string, string>,
298
305
  ): Promise<void> {
306
+ // `dependencies` is only the realm-collapse deps (`@telorun/sdk`), keyed by
307
+ // real `name@spec`. Controllers, by contrast, key `installedSpecs` by their
308
+ // version-scoped alias in `installPackage`. The two key spaces are
309
+ // intentionally disjoint — realm-collapse names are wired in here and never
310
+ // flow through `installPackage`, so an alias and a `name@spec` never clash.
299
311
  for (const [name, spec] of Object.entries(dependencies)) {
300
312
  this.installedSpecs.add(`${name}@${spec}`);
301
313
  }
@@ -303,11 +315,14 @@ export class NpmControllerLoader {
303
315
  }
304
316
 
305
317
  /**
306
- * Install one controller spec into the existing root. Single-flight per
307
- * spec within the process; cross-process safety is the fs-lock around the
308
- * `npm install` call. If the spec is already present in the manifest's
309
- * package.json (under `dependencies`), skip reusing the previous install.
318
+ * Install one controller into the existing root under its version-scoped
319
+ * `alias` folder. Single-flight per alias within the process; cross-process
320
+ * safety is the fs-lock around the `npm install` call. If the alias is
321
+ * already installed (right version on disk, or a matching `file:` record),
322
+ * skip — reusing the previous install.
310
323
  *
324
+ * `spec` is the source half of the install (`npm:<name>@<version>` or
325
+ * `file:<abs>`); the package manager is invoked with `<alias>@<spec>`.
311
326
  * `kind` distinguishes a `local_path` source (loader synthesized `file:`
312
327
  * spec) from a registry tag. The CLI silences progress for both `cache`
313
328
  * and `local`; `npm-install` is the only event surfaced. Folding this
@@ -316,12 +331,12 @@ export class NpmControllerLoader {
316
331
  */
317
332
  private async installPackage(
318
333
  installRoot: string,
319
- packageName: string,
334
+ alias: string,
320
335
  spec: string,
321
336
  kind: SpecKind,
322
337
  requestedVersion: string | null,
323
338
  ): Promise<NpmResolveSource> {
324
- const cacheKey = `${packageName}@${spec}`;
339
+ const cacheKey = alias;
325
340
  if (this.installedSpecs.has(cacheKey)) return "cache";
326
341
 
327
342
  const inFlight = this.inFlight.get(cacheKey);
@@ -330,17 +345,20 @@ export class NpmControllerLoader {
330
345
  return "cache";
331
346
  }
332
347
 
333
- const targetPath = path.join(installRoot, "node_modules", ...packageName.split("/"));
348
+ // The package is installed under its version-scoped alias, so its folder
349
+ // name in node_modules is the alias, not the bare package name.
350
+ const targetPath = path.join(installRoot, "node_modules", alias);
334
351
 
335
352
  // Registry fast path: compare against the installed package's own
336
- // `package.json` version field. `rootDeps[packageName]` can't be used
337
- // here because npm rewrites registry specs on `--save` — we pass
338
- // `@scope/pkg@0.3.4`, npm writes `^0.3.4` — so a string comparison
339
- // never matches and every fresh `NpmControllerLoader` (one per
340
- // `Telo.Definition.init`) would fall through to a no-op but ~200ms
353
+ // `package.json` version field. The recorded dep spec can't be used here
354
+ // because npm rewrites registry specs on `--save` — we pass
355
+ // `<alias>@npm:@scope/pkg@0.3.4`, npm writes `npm:@scope/pkg@^0.3.4` — so a
356
+ // string comparison never matches and every fresh `NpmControllerLoader`
357
+ // (one per `Telo.Definition.init`) would fall through to a no-op but ~200ms
341
358
  // `npm install`. Reading the installed package.json sidesteps that
342
- // entirely: if the requested PURL version equals what's on disk, we
343
- // already have the right thing.
359
+ // entirely: if the requested PURL version equals what's on disk under this
360
+ // alias, we already have the right thing. Because the alias encodes the
361
+ // version, a present alias folder is always the requested version.
344
362
  //
345
363
  // Ranges (`^1.0.0`, `~2.3.0`) fall through to a real `npm install` —
346
364
  // they're rare in PURLs (which typically pin) and a proper range check
@@ -354,37 +372,47 @@ export class NpmControllerLoader {
354
372
  this.installedSpecs.add(cacheKey);
355
373
  return "cache";
356
374
  }
357
- }
358
-
359
- // Local (`file:`) spec fast path: consult the in-process snapshot of the
360
- // install root's `dependencies` map (seeded by `materializeInstallRoot`).
361
- // Normalize because npm rewrites absolute `file:` deps to relative paths
362
- // inside the install root's `package.json` — the loader passes the
363
- // absolute path, the on-disk record is `file:../../foo`.
364
- const cachedSpec = this.rootDeps[packageName];
365
- if (
366
- cachedSpec !== undefined &&
367
- normalizeFileSpec(cachedSpec, installRoot) === normalizeFileSpec(spec, installRoot) &&
368
- (await pathExists(targetPath))
369
- ) {
370
- this.installedSpecs.add(cacheKey);
371
- return "cache";
375
+ } else {
376
+ // Local (`file:`) spec fast path: consult the in-process snapshot of the
377
+ // install root's `dependencies` map (seeded by `materializeInstallRoot`).
378
+ // Normalize because npm rewrites absolute `file:` deps to relative paths
379
+ // inside the install root's `package.json` the loader passes the
380
+ // absolute path, the on-disk record is `file:../../foo`.
381
+ const cachedSpec = this.rootDeps[alias];
382
+ if (
383
+ cachedSpec !== undefined &&
384
+ normalizeFileSpec(cachedSpec, installRoot) === normalizeFileSpec(spec, installRoot) &&
385
+ (await pathExists(targetPath))
386
+ ) {
387
+ this.installedSpecs.add(cacheKey);
388
+ return "cache";
389
+ }
372
390
  }
373
391
 
374
392
  const work = (async () => {
375
393
  await withInstallLock(installRoot, async () => {
376
394
  // Re-check inside the lock: a peer process may have installed the
377
- // spec between the fast-path miss and our acquisition. Normalize
378
- // the on-disk record to absolute form before comparing — npm
379
- // rewrites `file:` deps to be relative to the install root.
380
- const lockedSpec = await readDepSpec(installRoot, packageName);
381
- if (
382
- lockedSpec !== undefined &&
383
- normalizeFileSpec(lockedSpec, installRoot) === normalizeFileSpec(spec, installRoot) &&
384
- (await pathExists(targetPath))
385
- ) {
386
- this.rootDeps[packageName] = lockedSpec;
387
- return;
395
+ // spec between the fast-path miss and our acquisition.
396
+ if (kind === "registry") {
397
+ const installedVersion = await readInstalledVersion(targetPath);
398
+ if (
399
+ installedVersion !== null &&
400
+ (requestedVersion === null || requestedVersion === installedVersion)
401
+ ) {
402
+ return;
403
+ }
404
+ } else {
405
+ // Normalize the on-disk record to absolute form before comparing —
406
+ // npm rewrites `file:` deps to be relative to the install root.
407
+ const lockedSpec = await readDepSpec(installRoot, alias);
408
+ if (
409
+ lockedSpec !== undefined &&
410
+ normalizeFileSpec(lockedSpec, installRoot) === normalizeFileSpec(spec, installRoot) &&
411
+ (await pathExists(targetPath))
412
+ ) {
413
+ this.rootDeps[alias] = lockedSpec;
414
+ return;
415
+ }
388
416
  }
389
417
 
390
418
  await runPackageManager(installRoot, [
@@ -394,14 +422,17 @@ export class NpmControllerLoader {
394
422
  "--silent",
395
423
  ...PEER_INSTALL_FLAGS,
396
424
  "--save",
397
- spec,
425
+ // `<alias>@<source-spec>` installs the package under the alias folder
426
+ // (`npm:` for registry, `file:` for local) so multiple versions of
427
+ // one package name coexist in the single install root.
428
+ `${alias}@${spec}`,
398
429
  ]);
399
430
  // Re-read what npm actually wrote (it normalizes `file:` paths to
400
431
  // be relative to the install root). Caching the spec in its on-disk
401
432
  // form keeps subsequent fast-path comparisons stable.
402
- const written = await readDepSpec(installRoot, packageName);
403
- if (written !== undefined) this.rootDeps[packageName] = written;
404
- else this.rootDeps[packageName] = spec;
433
+ const written = await readDepSpec(installRoot, alias);
434
+ if (written !== undefined) this.rootDeps[alias] = written;
435
+ else this.rootDeps[alias] = spec;
405
436
  });
406
437
  })();
407
438
 
@@ -693,6 +724,35 @@ function computeInstallRoot(entryUrl: string): string {
693
724
  );
694
725
  }
695
726
 
727
+ /**
728
+ * Version-qualified install alias for a controller package. The kernel's single
729
+ * flat install root can hold only one folder per package name, but a manifest
730
+ * graph may legitimately reference the same package at multiple versions (e.g.
731
+ * a library pins `@telorun/mcp-client@0.3.1` while the app uses `0.4.0`).
732
+ * Installing each `name@version` under a distinct npm alias
733
+ * (`npm install <alias>@npm:<name>@<version>`) lets every version coexist in
734
+ * one `node_modules`, mirroring the per-(name, version) identity of a Telo
735
+ * module singleton. `@telorun/sdk` is intentionally NOT routed through here —
736
+ * it stays under its real name so realm-collapse hoists a single copy across
737
+ * the kernel/controller boundary (see REALM_COLLAPSE_NAMES).
738
+ *
739
+ * The result is a valid unscoped npm package name: the scope `@` is dropped,
740
+ * `/` becomes `__`, and any character outside npm's name grammar is replaced
741
+ * with `-`. Because that sanitization is lossy (e.g. build metadata `1.0.0+x`
742
+ * and prerelease `1.0.0-x` both fold to `1.0.0-x`, and a `__` already in a
743
+ * package name overlaps the scope separator), the alias ends with a short hash
744
+ * of the *exact* `name@version` — so two distinct pairs can never collide onto
745
+ * one folder regardless of how their readable prefixes sanitize. The readable
746
+ * prefix is kept purely so the install tree is greppable.
747
+ */
748
+ function installAlias(packageName: string, version: string | null): string {
749
+ const prefix = `${packageName.replace(/^@/, "").replace(/\//g, "__")}__${version ?? "latest"}`
750
+ .replace(/[^a-zA-Z0-9._-]/g, "-")
751
+ .toLowerCase();
752
+ const digest = sha256(`${packageName}@${version ?? ""}`).slice(0, 8);
753
+ return `${prefix}__${digest}`;
754
+ }
755
+
696
756
  /**
697
757
  * Normalize a `file:` spec to an absolute path so two specs that point at the
698
758
  * same source — one absolute (what the loader synthesizes from `local_path`)
@@ -770,7 +830,10 @@ async function resolveInstallSpec(
770
830
  return { kind: "local", spec: `file:${absolutePath}`, absolutePath };
771
831
  }
772
832
  }
773
- const spec = parsed.version ? `${packageName}@${parsed.version}` : packageName;
833
+ // `npm:` source spec so the caller can install it under a version-scoped
834
+ // alias (`<alias>@npm:<name>@<version>`); both versions of one package name
835
+ // then coexist in the single flat install root.
836
+ const spec = parsed.version ? `npm:${packageName}@${parsed.version}` : `npm:${packageName}`;
774
837
  return { kind: "registry", spec };
775
838
  }
776
839
 
@@ -782,11 +845,13 @@ async function resolveInstallSpec(
782
845
  */
783
846
  async function loadFromInstall(
784
847
  installRoot: string,
785
- packageName: string,
848
+ alias: string,
786
849
  subpath: string | null,
787
850
  purl: string,
788
851
  ): Promise<ControllerInstance> {
789
- const packageRoot = path.join(installRoot, "node_modules", ...packageName.split("/"));
852
+ // The package lives under its version-scoped alias folder (see installAlias),
853
+ // not its bare scoped name.
854
+ const packageRoot = path.join(installRoot, "node_modules", alias);
790
855
  const entry = subpath ? `./${subpath}` : ".";
791
856
  const entryFile = await resolvePackageEntry(packageRoot, entry);
792
857
  // ESM dynamic `import()` accepts either a relative specifier or a `file://`
@@ -937,6 +1002,7 @@ function resolveExportTargetValue(
937
1002
  * Not part of the kernel's public API — consumers should not import these.
938
1003
  */
939
1004
  export const __testing__ = {
1005
+ installAlias,
940
1006
  normalizeFileSpec,
941
1007
  resolvePackageExportTarget,
942
1008
  resolveExportTargetValue,
@@ -98,6 +98,24 @@ export class ControllerRegistry {
98
98
  return Array.from(this.controllersByKind.keys());
99
99
  }
100
100
 
101
+ /**
102
+ * Distinct controller `schema` objects across all registered kinds (one per
103
+ * kind, default fingerprint preferred). Used by the build-time validator warm
104
+ * to pre-compile the framework/builtin controller schemas (`Telo.Import`,
105
+ * `Telo.Definition`, the module controller, …) the runtime validates
106
+ * resources against — module-defined kinds aren't registered here until
107
+ * instantiation, so those are warmed from the static manifests instead.
108
+ */
109
+ getControllerSchemas(): object[] {
110
+ const schemas: object[] = [];
111
+ for (const byFp of this.controllersByKind.values()) {
112
+ const controller = byFp.get(DEFAULT_FINGERPRINT) ?? byFp.values().next().value;
113
+ const schema = controller?.schema;
114
+ if (schema && typeof schema === "object") schemas.push(schema);
115
+ }
116
+ return schemas;
117
+ }
118
+
101
119
  /**
102
120
  * Register a controller for a (kind, fingerprint). Multiple registrations
103
121
  * for the same kind with different fingerprints coexist; same fingerprint