@telorun/analyzer 0.60.0 → 0.61.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.
@@ -30,7 +30,7 @@
30
30
  import { type ArtifactSelector, type LayerRole, type PlatformTarget } from "./artifact-selector.js";
31
31
  export interface ArtifactLayer {
32
32
  role: LayerRole;
33
- /** Present on `controller` layers only. */
33
+ /** Present on the code-bearing roles (`controller`, `library`) only. */
34
34
  selector?: ArtifactSelector;
35
35
  /** OCI blob digest — addresses the layer and verifies the transfer. */
36
36
  blob: string;
@@ -48,8 +48,16 @@ export declare class LayerIndexError extends Error {
48
48
  */
49
49
  export declare function parseLayerIndex(value: unknown, describe?: string): ArtifactLayer[];
50
50
  /** The singleton layer for a role, or undefined when the artifact has none. */
51
- export declare function singletonLayer(layers: readonly ArtifactLayer[], role: Exclude<LayerRole, "controller">): ArtifactLayer | undefined;
52
- /** Every controller layer matching `target`, in declaration order. Used by
53
- * `telo install` to warm a cache for one platform. */
54
- export declare function matchControllerLayers(layers: readonly ArtifactLayer[], target: PlatformTarget): ArtifactLayer[];
51
+ export declare function singletonLayer(layers: readonly ArtifactLayer[], role: Exclude<LayerRole, "controller" | "library">): ArtifactLayer | undefined;
52
+ /** The layer of one code role carrying exactly `selector`, or undefined.
53
+ *
54
+ * By exact key rather than by re-matching a host: the candidate being resolved
55
+ * already *is* one selector, and it is by construction the key of the layer
56
+ * that carries it. */
57
+ export declare function codeLayerFor(layers: readonly ArtifactLayer[], role: Extract<LayerRole, "controller" | "library">, selector: ArtifactSelector): ArtifactLayer | undefined;
58
+ /** Every code layer — controller and library alike — matching `target`, in
59
+ * declaration order. Used by `telo install` to warm a cache for one platform:
60
+ * a library layer is as much a prerequisite of an offline run as the controller
61
+ * layer that imports it. */
62
+ export declare function matchCodeLayers(layers: readonly ArtifactLayer[], target: PlatformTarget): ArtifactLayer[];
55
63
  //# sourceMappingURL=artifact-layer-index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"artifact-layer-index.d.ts","sourceRoot":"","sources":["../src/artifact-layer-index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,EAKL,KAAK,gBAAgB,EACrB,KAAK,SAAS,EACd,KAAK,cAAc,EACpB,MAAM,wBAAwB,CAAC;AAQhC,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,SAAS,CAAC;IAChB,2CAA2C;IAC3C,QAAQ,CAAC,EAAE,gBAAgB,CAAC;IAC5B,uEAAuE;IACvE,IAAI,EAAE,MAAM,CAAC;IACb,wEAAwE;IACxE,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,qBAAa,eAAgB,SAAQ,KAAK;IACxC,QAAQ,CAAC,IAAI,yBAAyB;gBAE1B,MAAM,EAAE,MAAM;CAI3B;AAiBD;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,SAAW,GAAG,aAAa,EAAE,CAyDpF;AAED,+EAA+E;AAC/E,wBAAgB,cAAc,CAC5B,MAAM,EAAE,SAAS,aAAa,EAAE,EAChC,IAAI,EAAE,OAAO,CAAC,SAAS,EAAE,YAAY,CAAC,GACrC,aAAa,GAAG,SAAS,CAE3B;AAED;uDACuD;AACvD,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,SAAS,aAAa,EAAE,EAChC,MAAM,EAAE,cAAc,GACrB,aAAa,EAAE,CAIjB"}
1
+ {"version":3,"file":"artifact-layer-index.d.ts","sourceRoot":"","sources":["../src/artifact-layer-index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,EAOL,KAAK,gBAAgB,EACrB,KAAK,SAAS,EACd,KAAK,cAAc,EACpB,MAAM,wBAAwB,CAAC;AAQhC,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,SAAS,CAAC;IAChB,wEAAwE;IACxE,QAAQ,CAAC,EAAE,gBAAgB,CAAC;IAC5B,uEAAuE;IACvE,IAAI,EAAE,MAAM,CAAC;IACb,wEAAwE;IACxE,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,qBAAa,eAAgB,SAAQ,KAAK;IACxC,QAAQ,CAAC,IAAI,yBAAyB;gBAE1B,MAAM,EAAE,MAAM;CAI3B;AAiBD;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,SAAW,GAAG,aAAa,EAAE,CAmEpF;AAED,+EAA+E;AAC/E,wBAAgB,cAAc,CAC5B,MAAM,EAAE,SAAS,aAAa,EAAE,EAChC,IAAI,EAAE,OAAO,CAAC,SAAS,EAAE,YAAY,GAAG,SAAS,CAAC,GACjD,aAAa,GAAG,SAAS,CAE3B;AAED;;;;uBAIuB;AACvB,wBAAgB,YAAY,CAC1B,MAAM,EAAE,SAAS,aAAa,EAAE,EAChC,IAAI,EAAE,OAAO,CAAC,SAAS,EAAE,YAAY,GAAG,SAAS,CAAC,EAClD,QAAQ,EAAE,gBAAgB,GACzB,aAAa,GAAG,SAAS,CAK3B;AAED;;;6BAG6B;AAC7B,wBAAgB,eAAe,CAC7B,MAAM,EAAE,SAAS,aAAa,EAAE,EAChC,MAAM,EAAE,cAAc,GACrB,aAAa,EAAE,CAOjB"}
@@ -27,7 +27,7 @@
27
27
  * Browser-safe: `telo check`, the editor and the hub validate an index through
28
28
  * this module; only the kernel fetches and extracts.
29
29
  */
30
- import { isLayerRole, normalizeSelector, selectorKey, selectorMatches, } from "./artifact-selector.js";
30
+ import { LAYER_ROLES, isLayerRole, normalizeSelector, roleCarriesSelector, selectorKey, selectorMatches, } from "./artifact-selector.js";
31
31
  /** OCI content digest: `sha256:` + 64 lowercase hex. */
32
32
  const BLOB_DIGEST = /^sha256:[0-9a-f]{64}$/;
33
33
  /** Telo content digest: `sha256-` + unpadded base64url of 32 bytes. */
@@ -69,21 +69,32 @@ export function parseLayerIndex(value, describe = "layers") {
69
69
  throw new LayerIndexError(`${where}: expected an object.`);
70
70
  }
71
71
  const entry = raw;
72
- if (!isLayerRole(entry.role)) {
73
- throw new LayerIndexError(`${where}: role must be one of 'controller', 'assets', 'common'; got ` +
74
- `${entry.role === undefined ? "nothing" : `'${String(entry.role)}'`}.`);
72
+ if (typeof entry.role !== "string" || entry.role === "") {
73
+ throw new LayerIndexError(`${where}: role is required and must be one of ${LAYER_ROLES.map((r) => `'${r}'`).join(", ")}; ` +
74
+ `got ${entry.role === undefined ? "nothing" : `'${String(entry.role)}'`}.`);
75
75
  }
76
+ // A role this runtime does not know is SKIPPED, never rejected. Roles are
77
+ // added over time, and a runtime that cannot name one cannot need it — while
78
+ // throwing would make the whole manifest unreadable, so a module gaining a
79
+ // layer for a newer runtime would stop loading on an older one entirely
80
+ // rather than merely lacking that layer. The error stays for a structurally
81
+ // invalid entry, which is a malformed index rather than a newer one.
82
+ if (!isLayerRole(entry.role))
83
+ return;
76
84
  const role = entry.role;
77
85
  let selector;
78
- if (role === "controller") {
86
+ if (roleCarriesSelector(role)) {
79
87
  if (entry.selector === undefined) {
80
- throw new LayerIndexError(`${where}: a controller layer must declare a selector.`);
88
+ throw new LayerIndexError(`${where}: a ${role} layer must declare a selector.`);
81
89
  }
82
90
  selector = normalizeSelector(entry.selector, where);
83
- const key = selectorKey(selector);
91
+ // Scoped by role: a module's `js` controller layer and its `js` library
92
+ // layer are different layers with the same selector, and only a collision
93
+ // *within* one role means two layers claim one address.
94
+ const key = `${role}\0${selectorKey(selector)}`;
84
95
  if (seenSelectors.has(key)) {
85
- throw new LayerIndexError(`${where}: a second controller layer claims the selector ${key}. ` +
86
- `Each selector addresses exactly one layer.`);
96
+ throw new LayerIndexError(`${where}: a second ${role} layer claims the selector ${selectorKey(selector)}. ` +
97
+ `Each selector addresses exactly one layer of a role.`);
87
98
  }
88
99
  seenSelectors.add(key);
89
100
  }
@@ -109,8 +120,21 @@ export function parseLayerIndex(value, describe = "layers") {
109
120
  export function singletonLayer(layers, role) {
110
121
  return layers.find((l) => l.role === role);
111
122
  }
112
- /** Every controller layer matching `target`, in declaration order. Used by
113
- * `telo install` to warm a cache for one platform. */
114
- export function matchControllerLayers(layers, target) {
115
- return layers.filter((l) => l.role === "controller" && l.selector !== undefined && selectorMatches(l.selector, target));
123
+ /** The layer of one code role carrying exactly `selector`, or undefined.
124
+ *
125
+ * By exact key rather than by re-matching a host: the candidate being resolved
126
+ * already *is* one selector, and it is by construction the key of the layer
127
+ * that carries it. */
128
+ export function codeLayerFor(layers, role, selector) {
129
+ const key = selectorKey(selector);
130
+ return layers.find((l) => l.role === role && l.selector !== undefined && selectorKey(l.selector) === key);
131
+ }
132
+ /** Every code layer — controller and library alike — matching `target`, in
133
+ * declaration order. Used by `telo install` to warm a cache for one platform:
134
+ * a library layer is as much a prerequisite of an offline run as the controller
135
+ * layer that imports it. */
136
+ export function matchCodeLayers(layers, target) {
137
+ return layers.filter((l) => (l.role === "controller" || l.role === "library") &&
138
+ l.selector !== undefined &&
139
+ selectorMatches(l.selector, target));
116
140
  }
@@ -24,11 +24,18 @@
24
24
  * canonical OCI/GOOS names at the kernel boundary, since these values are
25
25
  * published into OCI descriptors.
26
26
  */
27
- /** The role a layer plays in a module artifact. `controller` layers carry a
28
- * selector; `assets` and `common` are singletons and carry none. */
29
- export type LayerRole = "controller" | "assets" | "common";
27
+ /** The role a layer plays in a module artifact. `controller` and `library` layers
28
+ * carry a selector; `assets` and `common` are singletons and carry none. */
29
+ export type LayerRole = "controller" | "library" | "assets" | "common";
30
30
  export declare const LAYER_ROLES: readonly LayerRole[];
31
31
  export declare function isLayerRole(value: unknown): value is LayerRole;
32
+ /** The roles that hold executable code, and are therefore per format rather than
33
+ * singletons. A `library` layer is per selector for the same reason a
34
+ * `controller` layer is: a module's JS entry point and its future Rust one are
35
+ * different files, and a consumer resolves the one its own runtime can import.
36
+ * A singleton would be wrong the moment a second runtime ships. */
37
+ export declare const CODE_LAYER_ROLES: readonly LayerRole[];
38
+ export declare function roleCarriesSelector(role: LayerRole): boolean;
32
39
  /** The platform axes, in canonical order. Not a closed vocabulary of *values* —
33
40
  * new architectures appear without a Telo release — only of axis names. */
34
41
  export declare const PLATFORM_AXES: readonly ["os", "arch", "libc"];
@@ -1 +1 @@
1
- {"version":3,"file":"artifact-selector.d.ts","sourceRoot":"","sources":["../src/artifact-selector.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH;qEACqE;AACrE,MAAM,MAAM,SAAS,GAAG,YAAY,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAE3D,eAAO,MAAM,WAAW,EAAE,SAAS,SAAS,EAAuC,CAAC;AAEpF,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,SAAS,CAE9D;AAED;4EAC4E;AAC5E,eAAO,MAAM,aAAa,iCAAkC,CAAC;AAE7D,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,CAAC,CAAC;AAE1D,MAAM,WAAW,gBAAgB;IAC/B,kFAAkF;IAClF,MAAM,EAAE,MAAM,CAAC;IACf,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;;kFAGkF;AAClF,MAAM,WAAW,cAAc;IAC7B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,qBAAa,qBAAsB,SAAQ,KAAK;IAC9C,QAAQ,CAAC,IAAI,+BAA+B;gBAEhC,MAAM,EAAE,MAAM;CAI3B;AAsBD;;;;GAIG;AACH,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,OAAO,EACf,UAAU,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAAG,SAAS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ED;;;kFAGkF;AAClF,MAAM,WAAW,cAAc;IAC7B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,qBAAa,qBAAsB,SAAQ,KAAK;IAC9C,QAAQ,CAAC,IAAI,+BAA+B;gBAEhC,MAAM,EAAE,MAAM;CAI3B;AAsBD;;;;GAIG;AACH,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,OAAO,EACf,UAAU,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAAG,SAAS,EACzD,QAAQ,SAAwB,GAC/B,gBAAgB,CAUlB;AAED,0EAA0E;AAC1E,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,OAAO,EACd,QAAQ,SAAmB,GAC1B,gBAAgB,CAelB;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,QAAQ,EAAE,gBAAgB,GAAG,MAAM,CAO9D;AAED,iFAAiF;AACjF,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,gBAAgB,GAAG,MAAM,CAKnE;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,gBAAgB,EAAE,MAAM,EAAE,cAAc,GAAG,OAAO,CAQ3F"}
@@ -24,10 +24,19 @@
24
24
  * canonical OCI/GOOS names at the kernel boundary, since these values are
25
25
  * published into OCI descriptors.
26
26
  */
27
- export const LAYER_ROLES = ["controller", "assets", "common"];
27
+ export const LAYER_ROLES = ["controller", "library", "assets", "common"];
28
28
  export function isLayerRole(value) {
29
29
  return typeof value === "string" && LAYER_ROLES.includes(value);
30
30
  }
31
+ /** The roles that hold executable code, and are therefore per format rather than
32
+ * singletons. A `library` layer is per selector for the same reason a
33
+ * `controller` layer is: a module's JS entry point and its future Rust one are
34
+ * different files, and a consumer resolves the one its own runtime can import.
35
+ * A singleton would be wrong the moment a second runtime ships. */
36
+ export const CODE_LAYER_ROLES = ["controller", "library"];
37
+ export function roleCarriesSelector(role) {
38
+ return CODE_LAYER_ROLES.includes(role);
39
+ }
31
40
  /** The platform axes, in canonical order. Not a closed vocabulary of *values* —
32
41
  * new architectures appear without a Telo release — only of axis names. */
33
42
  export const PLATFORM_AXES = ["os", "arch", "libc"];
@@ -1 +1 @@
1
- {"version":3,"file":"builtins.d.ts","sourceRoot":"","sources":["../src/builtins.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AA6JvD,eAAO,MAAM,eAAe,EAAE,kBAAkB,EA0rB/C,CAAC"}
1
+ {"version":3,"file":"builtins.d.ts","sourceRoot":"","sources":["../src/builtins.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAwLvD,eAAO,MAAM,eAAe,EAAE,kBAAkB,EA2rB/C,CAAC"}
package/dist/builtins.js CHANGED
@@ -29,6 +29,32 @@ const ASSETS_FILES_SCHEMA = {
29
29
  type: "array",
30
30
  items: { type: "string" },
31
31
  };
32
+ /** `exports.code` — the entry point a sibling module's controller bundle resolves
33
+ * this library's bare specifier to, one per format.
34
+ *
35
+ * Data rather than a package URL: `controllers:` needs a PURL because it can name
36
+ * an ecosystem fetch (`pkg:npm`, `pkg:cargo`), while this always names a file the
37
+ * module already ships, so the type/namespace segments would be constant noise —
38
+ * and a query string is one opaque box to the visual editor. `format` plus the
39
+ * platform axes build the same `ArtifactSelector` a controller candidate does.
40
+ * Semantics and diagnostics live in `analyzer/nodejs/src/module-library.ts`. */
41
+ const LIBRARY_CANDIDATES_SCHEMA = {
42
+ type: "array",
43
+ items: {
44
+ type: "object",
45
+ required: ["specifier", "format", "path"],
46
+ properties: {
47
+ specifier: { type: "string" },
48
+ format: { type: "string" },
49
+ path: { type: "string" },
50
+ source: { type: "string" },
51
+ os: { type: "string" },
52
+ arch: { type: "string" },
53
+ libc: { type: "string" },
54
+ },
55
+ additionalProperties: false,
56
+ },
57
+ };
32
58
  /** The published layer index, written by `telo publish` (never hand-authored).
33
59
  * One entry per layer except the manifest layer, which cannot list its own hash
34
60
  * inside itself and is pinned by the importer's `#sha256-...` instead. Shape and
@@ -40,7 +66,7 @@ const LAYER_INDEX_SCHEMA = {
40
66
  type: "object",
41
67
  required: ["role", "blob", "integrity"],
42
68
  properties: {
43
- role: { type: "string", enum: ["controller", "assets", "common"] },
69
+ role: { type: "string", enum: ["controller", "library", "assets", "common"] },
44
70
  selector: {
45
71
  type: "object",
46
72
  required: ["format"],
@@ -832,6 +858,7 @@ export const KERNEL_BUILTINS = [
832
858
  type: "array",
833
859
  items: { type: "string", not: { enum: ["variables", "secrets"] } },
834
860
  },
861
+ code: LIBRARY_CANDIDATES_SCHEMA,
835
862
  },
836
863
  additionalProperties: true,
837
864
  },
package/dist/index.d.ts CHANGED
@@ -70,11 +70,13 @@ export type { ParsedVersionedRef } from "./sources/versioned-ref.js";
70
70
  export { isLocalPathSource } from "./sources/local-path-ref.js";
71
71
  export { MANIFEST_CACHE_BASE_URL, ManifestCacheSource, isHttpsModuleRef, manifestCacheKey, manifestCacheUrl, ociManifestCacheCoords, urlManifestCacheCoords, } from "./sources/manifest-cache.js";
72
72
  export type { ManifestCacheCoords } from "./sources/manifest-cache.js";
73
- export { LAYER_ROLES, PLATFORM_AXES, ArtifactSelectorError, describeSelector, isLayerRole, normalizeSelector, selectorFromQualifiers, selectorKey, selectorMatches, } from "./artifact-selector.js";
73
+ export { CODE_LAYER_ROLES, LAYER_ROLES, PLATFORM_AXES, ArtifactSelectorError, describeSelector, isLayerRole, normalizeSelector, roleCarriesSelector, selectorFromQualifiers, selectorKey, selectorMatches, } from "./artifact-selector.js";
74
74
  export type { ArtifactSelector, LayerRole, PlatformAxis, PlatformTarget, } from "./artifact-selector.js";
75
75
  export { collectModuleFileClaims } from "./module-file-claims.js";
76
76
  export type { ModuleFileClaim } from "./module-file-claims.js";
77
- export { LayerIndexError, matchControllerLayers, parseLayerIndex, singletonLayer, } from "./artifact-layer-index.js";
77
+ export { readLibraryCandidates } from "./module-library.js";
78
+ export type { LibraryCandidate, LibraryCandidateProblem, LibraryCandidates, } from "./module-library.js";
79
+ export { LayerIndexError, codeLayerFor, matchCodeLayers, parseLayerIndex, singletonLayer, } from "./artifact-layer-index.js";
78
80
  export type { ArtifactLayer } from "./artifact-layer-index.js";
79
81
  export { validateModuleArtifact } from "./validate-module-artifact.js";
80
82
  export { PUBLISH_BLOCKING_CODES } from "./validate-module-metadata.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,YAAY,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,2BAA2B,EAAE,MAAM,oCAAoC,CAAC;AACjF,YAAY,EACR,cAAc,EACd,UAAU,EACV,UAAU,EACV,WAAW,EACX,YAAY,EACZ,UAAU,GACb,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACH,0BAA0B,EAC1B,kBAAkB,EAClB,mBAAmB,EACnB,wBAAwB,EACxB,gBAAgB,EAChB,wBAAwB,EACxB,oBAAoB,EACpB,gCAAgC,EAChC,kBAAkB,EAClB,oBAAoB,EACpB,KAAK,iBAAiB,EACtB,KAAK,YAAY,GACpB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjE,OAAO,EACL,mBAAmB,EACnB,wBAAwB,EACxB,mBAAmB,EACnB,gBAAgB,EAChB,mBAAmB,GACpB,MAAM,mBAAmB,CAAC;AAC3B,YAAY,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EACL,sBAAsB,EACtB,uBA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AAM,+BAA+B,CAAC;AACvE,OAAO,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AACvE,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC1D,YAAY,EAAE,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAC9F,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC3E,YAAY,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AACxD,OAAO,EAAE,yBAAyB,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC1F,YAAY,EACR,kBAAkB,EAClB,eAAe,EACf,cAAc,EACd,aAAa,EACb,iBAAiB,EACjB,WAAW,EACX,cAAc,EACd,QAAQ,EACR,aAAa,EACb,KAAK,EACR,MAAM,YAAY,CAAC;AACpB,cAAc,uBAAuB,CAAC;AAItC,OAAO,EACL,uBAAuB,EACvB,sBAAsB,GACvB,MAAM,4BAA4B,CAAC;AACpC,cAAc,oBAAoB,CAAC"}
package/dist/index.js CHANGED
@@ -39,9 +39,10 @@ export { OCI_SCHEME, isOciRef, parseOciRef } from "./sources/oci-ref.js";
39
39
  export { parseVersionedRef, withRefVersion } from "./sources/versioned-ref.js";
40
40
  export { isLocalPathSource } from "./sources/local-path-ref.js";
41
41
  export { MANIFEST_CACHE_BASE_URL, ManifestCacheSource, isHttpsModuleRef, manifestCacheKey, manifestCacheUrl, ociManifestCacheCoords, urlManifestCacheCoords, } from "./sources/manifest-cache.js";
42
- export { LAYER_ROLES, PLATFORM_AXES, ArtifactSelectorError, describeSelector, isLayerRole, normalizeSelector, selectorFromQualifiers, selectorKey, selectorMatches, } from "./artifact-selector.js";
42
+ export { CODE_LAYER_ROLES, LAYER_ROLES, PLATFORM_AXES, ArtifactSelectorError, describeSelector, isLayerRole, normalizeSelector, roleCarriesSelector, selectorFromQualifiers, selectorKey, selectorMatches, } from "./artifact-selector.js";
43
43
  export { collectModuleFileClaims } from "./module-file-claims.js";
44
- export { LayerIndexError, matchControllerLayers, parseLayerIndex, singletonLayer, } from "./artifact-layer-index.js";
44
+ export { readLibraryCandidates } from "./module-library.js";
45
+ export { LayerIndexError, codeLayerFor, matchCodeLayers, parseLayerIndex, singletonLayer, } from "./artifact-layer-index.js";
45
46
  export { validateModuleArtifact } from "./validate-module-artifact.js";
46
47
  // Warnings everywhere, fatal at `telo publish` — descriptive metadata has no
47
48
  // runtime failure mode, so it must not stop a manifest running, but it is the
@@ -42,6 +42,13 @@ interface ClaimBase {
42
42
  * controller claim with no selector that nothing would reject.
43
43
  */
44
44
  export type ModuleFileClaim = (ClaimBase & {
45
+ readonly role: "library";
46
+ readonly selector: ArtifactSelector;
47
+ /** The bare specifier a consumer's bundle imports this entry point by. */
48
+ readonly specifier: string;
49
+ /** The source `path` was built from, as on a controller claim. */
50
+ readonly localPath?: string;
51
+ }) | (ClaimBase & {
45
52
  readonly role: "controller";
46
53
  readonly selector: ArtifactSelector;
47
54
  /** Extra payload patterns that belong in the same layer as this claim —
@@ -1 +1 @@
1
- {"version":3,"file":"module-file-claims.d.ts","sourceRoot":"","sources":["../src/module-file-claims.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,wBAAwB,EAC9B,MAAM,qBAAqB,CAAC;AAG7B,OAAO,EAAuC,KAAK,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAEpG;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,UAAU,SAAS;IACjB;;;uEAGmE;IACnE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB;6CACyC;IACzC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED;;;;;;GAMG;AACH,MAAM,MAAM,eAAe,GACvB,CAAC,SAAS,GAAG;IACX,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAC;IAC5B,Q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E,SAAS,MAAM,EAAE,CAAC;IACrC;;;;mDAI+C;IAC/C,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;CAC7B,CAAC,GACF,CAAC,SAAS,GAAG;IAAE,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAA;CAAE,CAAC,CAAC;AAsG9C;;;;;;;;GAQG;AACH,wBAAgB,uBAAuB,CACrC,YAAY,EAAE,MAAM,EACpB,QAAQ,GAAE,wBAA4C,GACrD,eAAe,EAAE,CAiBnB"}
@@ -2,6 +2,7 @@ import { defaultCustomTags, defaultRegistry, walkCelExpressions, } from "@teloru
2
2
  import { PackageURL } from "packageurl-js";
3
3
  import { parseAllDocuments } from "yaml";
4
4
  import { selectorFromQualifiers, selectorKey } from "./artifact-selector.js";
5
+ import { readLibraryCandidates } from "./module-library.js";
5
6
  /** `pkg:telo/local/<format>?path=…` — the bundled-controller delivery mode.
6
7
  * Anything else (`pkg:npm`, `pkg:cargo`) fetches from its own ecosystem and
7
8
  * contributes no layer. */
@@ -57,6 +58,21 @@ function controllerClaims(json) {
57
58
  }
58
59
  return claims;
59
60
  }
61
+ /** The library entry points one document's `library:` block names. Unlike a
62
+ * controller entry — reached only when this module's own kinds instantiate —
63
+ * this one is what a *sibling* resolves a bare specifier to, which is why it
64
+ * gets its own layer rather than riding in the controller layer: a consumer
65
+ * must reach it without loading this module's controllers. */
66
+ function libraryClaims(json) {
67
+ return readLibraryCandidates(json).candidates.map((candidate) => ({
68
+ role: "library",
69
+ path: candidate.path,
70
+ selector: candidate.selector,
71
+ specifier: candidate.specifier,
72
+ ...(candidate.localPath ? { localPath: candidate.localPath } : {}),
73
+ origin: candidate.origin,
74
+ }));
75
+ }
60
76
  /** Claims contributed by tagged values, asked of the engine that owns each tag.
61
77
  * The walk reaches every tagged scalar in the document, so an engine that
62
78
  * embeds files is discovered wherever its tag was written.
@@ -81,7 +97,7 @@ function taggedClaims(json, registry) {
81
97
  * their layers — dropping one would leave a platform's layer short a file it
82
98
  * declared it needs. */
83
99
  function claimKey(claim) {
84
- const selector = claim.role === "controller" ? selectorKey(claim.selector) : "";
100
+ const selector = claim.role === "controller" || claim.role === "library" ? selectorKey(claim.selector) : "";
85
101
  return `${claim.role}\0${selector}\0${claim.path}`;
86
102
  }
87
103
  /**
@@ -98,7 +114,11 @@ export function collectModuleFileClaims(manifestText, registry = defaultRegistry
98
114
  const claims = [];
99
115
  for (const doc of parseAllDocuments(manifestText, { customTags: defaultCustomTags() })) {
100
116
  const json = doc.toJSON();
101
- for (const claim of [...controllerClaims(json), ...taggedClaims(json, registry)]) {
117
+ for (const claim of [
118
+ ...libraryClaims(json),
119
+ ...controllerClaims(json),
120
+ ...taggedClaims(json, registry),
121
+ ]) {
102
122
  const key = claimKey(claim);
103
123
  if (seen.has(key))
104
124
  continue;
@@ -0,0 +1,97 @@
1
+ /**
2
+ * A module's **exported code** — the `exports.code:` block on a `Telo.Library`
3
+ * doc, which names the entry point a *sibling module's* controller bundle
4
+ * resolves this module's bare specifier to.
5
+ *
6
+ * ```yaml
7
+ * exports:
8
+ * kinds:
9
+ * - Store
10
+ * code:
11
+ * - specifier: "@telorun/kv-store"
12
+ * format: js
13
+ * path: ./nodejs/kv-store.mjs
14
+ * source: ./nodejs/src/index.ts
15
+ * ```
16
+ *
17
+ * ## Why it sits under `exports:`
18
+ *
19
+ * A library already declares what crosses its boundary — the kinds importers may
20
+ * name, the resource instances they may `!ref`. This is the same statement about
21
+ * its *code*, and it gates the same way: a specifier nobody declares resolves to
22
+ * nothing. Putting it beside them keeps one block for "reachable from outside"
23
+ * rather than a second top-level key whose name (`library:` on a `Telo.Library`)
24
+ * meant a different thing from the kind one line above it.
25
+ *
26
+ * ## Why it is not a package URL
27
+ *
28
+ * `controllers:` names a PURL because it must be able to say `pkg:npm/…` or
29
+ * `pkg:cargo/…` — an ecosystem fetch. This entry never fetches: it names a file
30
+ * the module already ships, so `pkg:telo/local/` would be three constant segments
31
+ * before the first real datum. What is left after removing them is exactly these
32
+ * fields, and as data they are visually editable, where a query string is one
33
+ * opaque text box.
34
+ *
35
+ * The **model** is unchanged: `format` plus the optional platform axes build the
36
+ * same `ArtifactSelector` a controller candidate does, so layer matching, platform
37
+ * fallthrough and lazy materialization are inherited whole.
38
+ *
39
+ * ## Why the specifier is declared here
40
+ *
41
+ * A bundle imports the bare specifier `@telorun/sql`; the consumer's manifest
42
+ * declares the dependency as `Sql: ../sql`. Something has to connect the two, and
43
+ * it is the *library* that says so, once, rather than each of its consumers:
44
+ *
45
+ * - the specifier is a property of the library — its name in a host language's
46
+ * ecosystem — not of the relationship, so N consumers cannot disagree about it
47
+ * and adding a consumer restates nothing;
48
+ * - it sits beside the format, which keeps runtime **derived, never declared**:
49
+ * the entry says `format: js`, and a Rust entry carries `specifier:
50
+ * telorun-sql` with no runtime-keyed map anywhere.
51
+ *
52
+ * **One specifier, one entry point.** Subpaths are deliberately not
53
+ * representable: reproducing npm's `exports` map inside the artifact would pull a
54
+ * package manager's resolution semantics into Telo, which is what the "only
55
+ * workspace modules are de-inlined" rule refuses on `kysely`'s behalf.
56
+ *
57
+ * `Telo.Application` has no `exports:` block at all — an application is a root
58
+ * with no importer, so nothing could resolve a specifier to it.
59
+ *
60
+ * Browser-safe: string work only. Whether the named file EXISTS is a separate
61
+ * question, asked by the Node-side caller that has a directory.
62
+ */
63
+ import { type ArtifactSelector } from "./artifact-selector.js";
64
+ export interface LibraryCandidate {
65
+ /** The bare specifier a sibling's controller bundle imports this library by. */
66
+ readonly specifier: string;
67
+ /** Module-root-relative path of the built entry point. */
68
+ readonly path: string;
69
+ /** Module-root-relative TypeScript source it is built from (`source:`), when
70
+ * the entry names one. Present only while the module is a working copy; a
71
+ * published artifact ships no `src/`. */
72
+ readonly localPath?: string;
73
+ readonly selector: ArtifactSelector;
74
+ /** Where the entry was written, for diagnostics. */
75
+ readonly origin: string;
76
+ }
77
+ /** Why an `exports.code` entry could not be read. Returned rather than thrown so
78
+ * the analyzer can report every entry of a block, and so a reader on the load
79
+ * path can carry on with the entries that are well-formed. */
80
+ export interface LibraryCandidateProblem {
81
+ readonly origin: string;
82
+ readonly detail: string;
83
+ }
84
+ export interface LibraryCandidates {
85
+ readonly candidates: LibraryCandidate[];
86
+ readonly problems: LibraryCandidateProblem[];
87
+ }
88
+ /**
89
+ * Read the `exports.code:` block off an owner document's JSON projection.
90
+ *
91
+ * Everything malformed is a problem rather than a silent skip: an entry that
92
+ * cannot be read names no entry point, so a consumer's bundle falls back to
93
+ * *inlining* the library — the duplicated module scope this whole mechanism
94
+ * exists to remove — and it does so on someone else's machine.
95
+ */
96
+ export declare function readLibraryCandidates(ownerJson: unknown): LibraryCandidates;
97
+ //# sourceMappingURL=module-library.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"module-library.d.ts","sourceRoot":"","sources":["../src/module-library.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6DG;AAEH,OAAO,EAIL,KAAK,gBAAgB,EACtB,MAAM,wBAAwB,CAAC;AAKhC,MAAM,WAAW,gBAAgB;IAC/B,gFAAgF;IAChF,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,0DAA0D;IAC1D,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB;;8CAE0C;IAC1C,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,QAAQ,EAAE,gBAAgB,CAAC;IACpC,oDAAoD;IACpD,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED;;+DAE+D;AAC/D,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,UAAU,EAAE,gBAAgB,EAAE,CAAC;IACxC,QAAQ,CAAC,QAAQ,EAAE,uBAAuB,EAAE,CAAC;CAC9C;AAmBD;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CAAC,SAAS,EAAE,OAAO,GAAG,iBAAiB,CAkF3E"}
@@ -0,0 +1,162 @@
1
+ /**
2
+ * A module's **exported code** — the `exports.code:` block on a `Telo.Library`
3
+ * doc, which names the entry point a *sibling module's* controller bundle
4
+ * resolves this module's bare specifier to.
5
+ *
6
+ * ```yaml
7
+ * exports:
8
+ * kinds:
9
+ * - Store
10
+ * code:
11
+ * - specifier: "@telorun/kv-store"
12
+ * format: js
13
+ * path: ./nodejs/kv-store.mjs
14
+ * source: ./nodejs/src/index.ts
15
+ * ```
16
+ *
17
+ * ## Why it sits under `exports:`
18
+ *
19
+ * A library already declares what crosses its boundary — the kinds importers may
20
+ * name, the resource instances they may `!ref`. This is the same statement about
21
+ * its *code*, and it gates the same way: a specifier nobody declares resolves to
22
+ * nothing. Putting it beside them keeps one block for "reachable from outside"
23
+ * rather than a second top-level key whose name (`library:` on a `Telo.Library`)
24
+ * meant a different thing from the kind one line above it.
25
+ *
26
+ * ## Why it is not a package URL
27
+ *
28
+ * `controllers:` names a PURL because it must be able to say `pkg:npm/…` or
29
+ * `pkg:cargo/…` — an ecosystem fetch. This entry never fetches: it names a file
30
+ * the module already ships, so `pkg:telo/local/` would be three constant segments
31
+ * before the first real datum. What is left after removing them is exactly these
32
+ * fields, and as data they are visually editable, where a query string is one
33
+ * opaque text box.
34
+ *
35
+ * The **model** is unchanged: `format` plus the optional platform axes build the
36
+ * same `ArtifactSelector` a controller candidate does, so layer matching, platform
37
+ * fallthrough and lazy materialization are inherited whole.
38
+ *
39
+ * ## Why the specifier is declared here
40
+ *
41
+ * A bundle imports the bare specifier `@telorun/sql`; the consumer's manifest
42
+ * declares the dependency as `Sql: ../sql`. Something has to connect the two, and
43
+ * it is the *library* that says so, once, rather than each of its consumers:
44
+ *
45
+ * - the specifier is a property of the library — its name in a host language's
46
+ * ecosystem — not of the relationship, so N consumers cannot disagree about it
47
+ * and adding a consumer restates nothing;
48
+ * - it sits beside the format, which keeps runtime **derived, never declared**:
49
+ * the entry says `format: js`, and a Rust entry carries `specifier:
50
+ * telorun-sql` with no runtime-keyed map anywhere.
51
+ *
52
+ * **One specifier, one entry point.** Subpaths are deliberately not
53
+ * representable: reproducing npm's `exports` map inside the artifact would pull a
54
+ * package manager's resolution semantics into Telo, which is what the "only
55
+ * workspace modules are de-inlined" rule refuses on `kysely`'s behalf.
56
+ *
57
+ * `Telo.Application` has no `exports:` block at all — an application is a root
58
+ * with no importer, so nothing could resolve a specifier to it.
59
+ *
60
+ * Browser-safe: string work only. Whether the named file EXISTS is a separate
61
+ * question, asked by the Node-side caller that has a directory.
62
+ */
63
+ import { ArtifactSelectorError, PLATFORM_AXES, selectorFromQualifiers, } from "./artifact-selector.js";
64
+ /** Every key an entry may carry: the two locators, plus the selector axes. */
65
+ const KNOWN_KEYS = new Set(["specifier", "path", "source", "format", ...PLATFORM_AXES]);
66
+ /** Normalize a `path` / `source` value to the manifest-relative POSIX form the
67
+ * file selector returns, so membership is a string comparison. */
68
+ function normalizeRelative(value) {
69
+ return value.replace(/^\.\//, "").replace(/\\/g, "/");
70
+ }
71
+ function requiredString(entry, key) {
72
+ const raw = entry[key];
73
+ if (typeof raw !== "string" || raw.trim() === "") {
74
+ return { detail: `'${key}' is required and must be a non-empty string.` };
75
+ }
76
+ return { value: raw.trim() };
77
+ }
78
+ /**
79
+ * Read the `exports.code:` block off an owner document's JSON projection.
80
+ *
81
+ * Everything malformed is a problem rather than a silent skip: an entry that
82
+ * cannot be read names no entry point, so a consumer's bundle falls back to
83
+ * *inlining* the library — the duplicated module scope this whole mechanism
84
+ * exists to remove — and it does so on someone else's machine.
85
+ */
86
+ export function readLibraryCandidates(ownerJson) {
87
+ const declared = ownerJson?.exports?.code;
88
+ const candidates = [];
89
+ const problems = [];
90
+ if (declared === undefined)
91
+ return { candidates, problems };
92
+ if (!Array.isArray(declared)) {
93
+ return {
94
+ candidates,
95
+ problems: [{ origin: "exports.code", detail: "expected a list of entries." }],
96
+ };
97
+ }
98
+ declared.forEach((raw, index) => {
99
+ const origin = `exports.code[${index}]`;
100
+ if (typeof raw !== "object" || raw === null || Array.isArray(raw)) {
101
+ problems.push({ origin, detail: "expected an object." });
102
+ return;
103
+ }
104
+ const entry = raw;
105
+ const unknown = Object.keys(entry).filter((key) => !KNOWN_KEYS.has(key));
106
+ if (unknown.length > 0) {
107
+ // Reported, never ignored: an unrecognized platform axis would leave the
108
+ // entry platform-neutral and offer a single-platform file to every host.
109
+ problems.push({
110
+ origin,
111
+ detail: `unknown ${unknown.length === 1 ? "key" : "keys"} ${unknown.map((k) => `'${k}'`).join(", ")}. ` +
112
+ `Known: ${[...KNOWN_KEYS].join(", ")}.`,
113
+ });
114
+ return;
115
+ }
116
+ const specifier = requiredString(entry, "specifier");
117
+ if ("detail" in specifier) {
118
+ problems.push({ origin, detail: specifier.detail });
119
+ return;
120
+ }
121
+ const file = requiredString(entry, "path");
122
+ if ("detail" in file) {
123
+ problems.push({ origin: `${origin} ('${specifier.value}')`, detail: file.detail });
124
+ return;
125
+ }
126
+ // Explicit rather than inferred from the file extension: a `.mjs` can be
127
+ // wasm glue, and an inference rule is something every other runtime's reader
128
+ // would have to copy exactly.
129
+ const format = requiredString(entry, "format");
130
+ if ("detail" in format) {
131
+ problems.push({ origin: `${origin} ('${specifier.value}')`, detail: format.detail });
132
+ return;
133
+ }
134
+ let selector;
135
+ try {
136
+ selector = selectorFromQualifiers(format.value, entry, `${origin} ('${specifier.value}')`);
137
+ }
138
+ catch (err) {
139
+ problems.push({
140
+ origin: `${origin} ('${specifier.value}')`,
141
+ detail: err instanceof ArtifactSelectorError ? err.message : String(err),
142
+ });
143
+ return;
144
+ }
145
+ const source = entry.source;
146
+ if (source !== undefined && (typeof source !== "string" || source.trim() === "")) {
147
+ problems.push({
148
+ origin: `${origin} ('${specifier.value}')`,
149
+ detail: "'source' must be a non-empty string when present.",
150
+ });
151
+ return;
152
+ }
153
+ candidates.push({
154
+ specifier: specifier.value,
155
+ path: normalizeRelative(file.value),
156
+ ...(typeof source === "string" ? { localPath: normalizeRelative(source.trim()) } : {}),
157
+ selector,
158
+ origin: `${origin} ('${specifier.value}')`,
159
+ });
160
+ });
161
+ return { candidates, problems };
162
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"validate-module-artifact.d.ts","sourceRoot":"","sources":["../src/validate-module-artifact.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAQrD,OAAO,EAAsB,KAAK,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAIzE;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,sBAAsB,CAAC,SAAS,EAAE,gBAAgB,EAAE,GAAG,kBAAkB,EAAE,CAO1F"}
1
+ {"version":3,"file":"validate-module-artifact.d.ts","sourceRoot":"","sources":["../src/validate-module-artifact.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAUrD,OAAO,EAAsB,KAAK,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAIzE;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,sBAAsB,CAAC,SAAS,EAAE,gBAAgB,EAAE,GAAG,kBAAkB,EAAE,CAQ1F"}