@telorun/kernel 0.59.0 → 0.60.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 (83) hide show
  1. package/dist/bundle/files-integrity.d.ts +21 -12
  2. package/dist/bundle/files-integrity.d.ts.map +1 -1
  3. package/dist/bundle/files-integrity.js +27 -14
  4. package/dist/bundle/files-integrity.js.map +1 -1
  5. package/dist/bundle/module-artifact.d.ts +134 -0
  6. package/dist/bundle/module-artifact.d.ts.map +1 -0
  7. package/dist/bundle/module-artifact.js +300 -0
  8. package/dist/bundle/module-artifact.js.map +1 -0
  9. package/dist/bundle/module-manifest.d.ts +12 -4
  10. package/dist/bundle/module-manifest.d.ts.map +1 -1
  11. package/dist/bundle/module-manifest.js +8 -4
  12. package/dist/bundle/module-manifest.js.map +1 -1
  13. package/dist/controller-loader.d.ts +3 -2
  14. package/dist/controller-loader.d.ts.map +1 -1
  15. package/dist/controller-loader.js +8 -8
  16. package/dist/controller-loader.js.map +1 -1
  17. package/dist/controller-loaders/bundle-loader.d.ts +8 -6
  18. package/dist/controller-loaders/bundle-loader.d.ts.map +1 -1
  19. package/dist/controller-loaders/bundle-loader.js +52 -13
  20. package/dist/controller-loaders/bundle-loader.js.map +1 -1
  21. package/dist/controller-loaders/npm-loader.d.ts +0 -18
  22. package/dist/controller-loaders/npm-loader.d.ts.map +1 -1
  23. package/dist/controller-loaders/npm-loader.js +3 -190
  24. package/dist/controller-loaders/npm-loader.js.map +1 -1
  25. package/dist/controllers/resource-definition/resource-definition-controller.d.ts.map +1 -1
  26. package/dist/controllers/resource-definition/resource-definition-controller.js +6 -1
  27. package/dist/controllers/resource-definition/resource-definition-controller.js.map +1 -1
  28. package/dist/directory-lock.d.ts +27 -0
  29. package/dist/directory-lock.d.ts.map +1 -0
  30. package/dist/directory-lock.js +205 -0
  31. package/dist/directory-lock.js.map +1 -0
  32. package/dist/index.d.ts +4 -2
  33. package/dist/index.d.ts.map +1 -1
  34. package/dist/index.js +3 -1
  35. package/dist/index.js.map +1 -1
  36. package/dist/kernel.d.ts +32 -0
  37. package/dist/kernel.d.ts.map +1 -1
  38. package/dist/kernel.js +55 -1
  39. package/dist/kernel.js.map +1 -1
  40. package/dist/manifest-sources/local-manifest-cache-source.d.ts +1 -1
  41. package/dist/manifest-sources/local-manifest-cache-source.d.ts.map +1 -1
  42. package/dist/manifest-sources/local-manifest-cache-source.js +1 -1
  43. package/dist/manifest-sources/local-manifest-cache-source.js.map +1 -1
  44. package/dist/resource-context.d.ts +16 -0
  45. package/dist/resource-context.d.ts.map +1 -1
  46. package/dist/resource-context.js +52 -0
  47. package/dist/resource-context.js.map +1 -1
  48. package/dist/transports/oci/oci-client.d.ts +28 -1
  49. package/dist/transports/oci/oci-client.d.ts.map +1 -1
  50. package/dist/transports/oci/oci-client.js +24 -1
  51. package/dist/transports/oci/oci-client.js.map +1 -1
  52. package/dist/transports/oci/oci-transport.d.ts +20 -14
  53. package/dist/transports/oci/oci-transport.d.ts.map +1 -1
  54. package/dist/transports/oci/oci-transport.js +105 -46
  55. package/dist/transports/oci/oci-transport.js.map +1 -1
  56. package/dist/transports/registry-transport.d.ts +7 -2
  57. package/dist/transports/registry-transport.d.ts.map +1 -1
  58. package/dist/transports/registry-transport.js +8 -33
  59. package/dist/transports/registry-transport.js.map +1 -1
  60. package/dist/transports/transport-registry.d.ts +5 -4
  61. package/dist/transports/transport-registry.d.ts.map +1 -1
  62. package/dist/transports/transport-registry.js +4 -4
  63. package/dist/transports/transport-registry.js.map +1 -1
  64. package/dist/transports/transport.d.ts +27 -19
  65. package/dist/transports/transport.d.ts.map +1 -1
  66. package/package.json +3 -3
  67. package/src/bundle/files-integrity.ts +34 -14
  68. package/src/bundle/module-artifact.ts +375 -0
  69. package/src/bundle/module-manifest.ts +22 -6
  70. package/src/controller-loader.ts +9 -4
  71. package/src/controller-loaders/bundle-loader.ts +57 -11
  72. package/src/controller-loaders/npm-loader.ts +3 -209
  73. package/src/controllers/resource-definition/resource-definition-controller.ts +19 -0
  74. package/src/directory-lock.ts +225 -0
  75. package/src/index.ts +10 -2
  76. package/src/kernel.ts +66 -0
  77. package/src/manifest-sources/local-manifest-cache-source.ts +1 -1
  78. package/src/resource-context.ts +57 -0
  79. package/src/transports/oci/oci-client.ts +32 -1
  80. package/src/transports/oci/oci-transport.ts +122 -51
  81. package/src/transports/registry-transport.ts +10 -38
  82. package/src/transports/transport-registry.ts +5 -5
  83. package/src/transports/transport.ts +32 -19
@@ -1,24 +1,31 @@
1
- import type { ManifestCacheCoords, ManifestSource } from "@telorun/analyzer";
1
+ import type {
2
+ ArtifactSelector,
3
+ LayerRole,
4
+ ManifestCacheCoords,
5
+ ManifestSource,
6
+ } from "@telorun/analyzer";
2
7
 
3
8
  import type { PayloadFile } from "../bundle/files-integrity.js";
4
9
 
5
- /** The full module artifact a transport delivers: the `telo.yaml` bytes plus
6
- * the decompressed `files:` payload (empty for a manifest-only module). The
7
- * manifest is already verified against the import's inline hash; the payload
8
- * against the manifest-embedded `filesIntegrity`. */
9
- export interface FetchedArtifact {
10
- manifest: string;
10
+ /** One layer of a module artifact as the CLI partitioned it, before publish
11
+ * assigns digests. `role` / `selector` become the layer's entry in the
12
+ * published `layers:` index. */
13
+ export interface PayloadLayer {
14
+ role: LayerRole;
15
+ /** Present on `controller` layers only. */
16
+ selector?: ArtifactSelector;
11
17
  files: PayloadFile[];
12
18
  }
13
19
 
14
20
  /** The module bundle handed to a transport for publishing: the final,
15
- * already-analyzed / pinned / canonicalized `telo.yaml` bytes plus the `files:`
16
- * payload (empty for a manifest-only module). The transport is responsible for
17
- * pinning the payload (`filesIntegrity`) and for the artifact shape it writes
18
- * (HTTP: `telo.yaml` + `module.tar.gz`; OCI: a single blob). */
21
+ * already-analyzed / pinned / canonicalized `telo.yaml` bytes plus the payload
22
+ * partitioned into layers (empty for a manifest-only module). The transport
23
+ * pushes each layer as its own blob, injects the resulting `layers:` index into
24
+ * the manifest, and only then pushes the manifest layer — the order that keeps
25
+ * the index non-circular. */
19
26
  export interface PublishBundle {
20
27
  manifest: string;
21
- files: PayloadFile[];
28
+ layers: PayloadLayer[];
22
29
  }
23
30
 
24
31
  export interface PublishResult {
@@ -52,8 +59,8 @@ export interface PublishOptions {
52
59
  * `ManifestSource` is the browser-safe resolution primitive (also implemented
53
60
  * by the cache / local / memory sources, which have no versions and nothing to
54
61
  * publish), so it stays in `analyzer`, while the Node-only management methods
55
- * (`cacheCoords` and, in later phases, `listVersions` / `fetchArtifact` /
56
- * `publish`) live on the Transport here in `kernel`. */
62
+ * (`cacheCoords`, `listVersions`, `fetchLayer`, `publish`) live on the Transport
63
+ * here in `kernel`. */
57
64
  export interface Transport {
58
65
  /** True when this transport owns the given ref (or publish destination). */
59
66
  supports(ref: string): boolean;
@@ -102,11 +109,17 @@ export interface Transport {
102
109
  * ref. Used by `telo upgrade`. */
103
110
  withVersion(ref: string, version: string): string;
104
111
 
105
- /** Retrieve the full artifact for `ref` the `telo.yaml` and its `files:`
106
- * payload verifying the manifest against the inline hash and the payload
107
- * against the manifest's `filesIntegrity`. Used by `telo install`; subsumes
108
- * the out-of-band bundle fetch that used to sit outside the source chain. */
109
- fetchArtifact(ref: string): Promise<FetchedArtifact>;
112
+ /** Pull **one** layer of `ref`'s artifact, addressed by the `blob` digest its
113
+ * entry in the pinned `layers:` index carries, and return its decompressed
114
+ * files. Addressing by digest is what keeps the untrusted OCI manifest out of
115
+ * the path: only the *manifest* layer is located through it, and those bytes
116
+ * are then checked against the import pin, so tampering is caught before any
117
+ * index is read. Content verification against the entry's `integrity` is the
118
+ * caller's (the artifact handle's), since only it knows the expected value.
119
+ *
120
+ * Throws when the transport cannot deliver payload layers at all — a module
121
+ * with a payload is an OCI artifact, and no other transport publishes one. */
122
+ fetchLayer(ref: string, blobDigest: string): Promise<PayloadFile[]>;
110
123
 
111
124
  /** Cheap content-identity digest of what `ref` currently resolves to — no
112
125
  * payload download. Opaque and transport-specific (OCI: the image manifest's