@telorun/kernel 0.83.0 → 0.85.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 +1 -1
- package/dist/bundle/module-artifact.d.ts.map +1 -1
- package/dist/bundle/module-artifact.js +3 -3
- package/dist/bundle/module-artifact.js.map +1 -1
- package/dist/controller-loaders/bundle-loader.d.ts +5 -5
- package/dist/controller-loaders/bundle-loader.js +7 -7
- package/dist/controller-loaders/bundle-loader.js.map +1 -1
- package/dist/controllers/resource-definition/resource-definition-controller.d.ts +3 -0
- package/dist/controllers/resource-definition/resource-definition-controller.d.ts.map +1 -1
- package/dist/controllers/resource-definition/resource-definition-controller.js +8 -1
- package/dist/controllers/resource-definition/resource-definition-controller.js.map +1 -1
- package/dist/evaluation-context.d.ts +22 -0
- package/dist/evaluation-context.d.ts.map +1 -1
- package/dist/evaluation-context.js +75 -3
- package/dist/evaluation-context.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/instance-sensitive-paths.d.ts +61 -0
- package/dist/instance-sensitive-paths.d.ts.map +1 -0
- package/dist/instance-sensitive-paths.js +116 -0
- package/dist/instance-sensitive-paths.js.map +1 -0
- package/dist/invocation-contract-binding.d.ts +3 -0
- package/dist/invocation-contract-binding.d.ts.map +1 -1
- package/dist/invocation-contract-binding.js +9 -1
- package/dist/invocation-contract-binding.js.map +1 -1
- package/dist/kernel.d.ts +0 -5
- package/dist/kernel.d.ts.map +1 -1
- package/dist/kernel.js +30 -7
- package/dist/kernel.js.map +1 -1
- package/dist/manifest-sources/local-manifest-cache-source.d.ts +6 -6
- package/dist/manifest-sources/local-manifest-cache-source.d.ts.map +1 -1
- package/dist/manifest-sources/local-manifest-cache-source.js +11 -12
- package/dist/manifest-sources/local-manifest-cache-source.js.map +1 -1
- package/dist/runtime-seam.d.ts.map +1 -1
- package/dist/runtime-seam.js +1 -2
- package/dist/runtime-seam.js.map +1 -1
- package/dist/transports/http-transport.d.ts +37 -0
- package/dist/transports/http-transport.d.ts.map +1 -0
- package/dist/transports/http-transport.js +168 -0
- package/dist/transports/http-transport.js.map +1 -0
- package/dist/transports/transport-registry.d.ts +13 -14
- package/dist/transports/transport-registry.d.ts.map +1 -1
- package/dist/transports/transport-registry.js +17 -24
- package/dist/transports/transport-registry.js.map +1 -1
- package/package.json +2 -2
- package/src/bundle/module-artifact.ts +2 -3
- package/src/controller-loaders/bundle-loader.ts +7 -7
- package/src/controllers/resource-definition/resource-definition-controller.ts +14 -0
- package/src/evaluation-context.ts +80 -5
- package/src/index.ts +1 -1
- package/src/instance-sensitive-paths.ts +123 -0
- package/src/invocation-contract-binding.ts +12 -0
- package/src/kernel.ts +33 -12
- package/src/manifest-sources/local-manifest-cache-source.ts +9 -16
- package/src/runtime-seam.ts +1 -2
- package/src/transports/http-transport.ts +209 -0
- package/src/transports/transport-registry.ts +17 -24
- package/dist/transports/registry-transport.d.ts +0 -41
- package/dist/transports/registry-transport.d.ts.map +0 -1
- package/dist/transports/registry-transport.js +0 -282
- package/dist/transports/registry-transport.js.map +0 -1
- package/src/transports/registry-transport.ts +0 -339
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { type ArtifactLayer, type ManifestCacheCoords, type ManifestSource } from "@telorun/analyzer";
|
|
2
|
+
import type { PayloadFile } from "../bundle/files-integrity.js";
|
|
3
|
+
import type { PayloadLayer, PublishBundle, PublishOptions, PublishResult, Transport } from "./transport.js";
|
|
4
|
+
/** The transport for direct `https://…` (and `http://`) module URLs. Its
|
|
5
|
+
* resolution `source` composes the browser-safe `HttpSource` from `analyzer`;
|
|
6
|
+
* the Node-only management methods live here. This is the fallback transport
|
|
7
|
+
* for any ref that carries no owning scheme, so `oci://` (or a future `s3://`)
|
|
8
|
+
* never falls through to it — those refs are claimed by their own transport's
|
|
9
|
+
* `supports()`.
|
|
10
|
+
*
|
|
11
|
+
* A URL addresses exactly one file, so it names no enumerable version: this
|
|
12
|
+
* transport publishes nothing, lists no versions, and has no `@version` segment
|
|
13
|
+
* to bump. What it does own is reading, hashing and caching those bytes. */
|
|
14
|
+
export declare class HttpTransport implements Transport {
|
|
15
|
+
private readonly httpSource;
|
|
16
|
+
readonly source: ManifestSource;
|
|
17
|
+
constructor();
|
|
18
|
+
supports(ref: string): boolean;
|
|
19
|
+
cacheCoords(ref: string): ManifestCacheCoords | null;
|
|
20
|
+
listVersions(): Promise<string[] | null>;
|
|
21
|
+
refVersion(): string | null;
|
|
22
|
+
withVersion(ref: string): string;
|
|
23
|
+
/** Mirrors the source's fetch-URL derivation: the URL points at (or contains)
|
|
24
|
+
* the YAML file. `null` when this transport does not own the ref's shape. */
|
|
25
|
+
private manifestUrl;
|
|
26
|
+
digest(ref: string): Promise<string | null>;
|
|
27
|
+
/** Hashes the **raw response bytes**, which is exactly what `verifiedFetch`
|
|
28
|
+
* checks an inline `#sha256-…` pin against on the read path. */
|
|
29
|
+
manifestHash(ref: string): Promise<string>;
|
|
30
|
+
/** Layered artifacts are an OCI concept — a module reached over a plain URL is
|
|
31
|
+
* manifest-only, and its controllers come from npm. */
|
|
32
|
+
fetchLayer(ref: string, blobDigest: string): Promise<PayloadFile[]>;
|
|
33
|
+
layerIndex(layers: readonly PayloadLayer[]): Promise<ArtifactLayer[]>;
|
|
34
|
+
publish(destination: string, bundle: PublishBundle, opts?: PublishOptions): Promise<PublishResult>;
|
|
35
|
+
canonicalizeSiblingRef(destination: string, relativeSource: string, version: string): string;
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=http-transport.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http-transport.d.ts","sourceRoot":"","sources":["../../src/transports/http-transport.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,aAAa,EAClB,KAAK,mBAAmB,EACxB,KAAK,cAAc,EACpB,MAAM,mBAAmB,CAAC;AAI3B,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ANIFEST_FILENAME, HttpSource, sha256Base64Url, splitIntegrity, } from "@telorun/analyzer";
|
|
2
|
+
import { fetchOrThrow } from "@telorun/sdk";
|
|
3
|
+
import { createHash } from "crypto";
|
|
4
|
+
import { assertPublicEgress } from "./egress-guard.js";
|
|
5
|
+
const QUERY_HASH_LENGTH = 12;
|
|
6
|
+
/** Mirror `HttpSource.read`'s `fetchUrl` derivation: when the URL does not
|
|
7
|
+
* already point at a YAML file, append `/telo.yaml`, so a raw import URL and
|
|
8
|
+
* the canonical source it resolves to map to the same cache path. */
|
|
9
|
+
function normalizePathname(rawUrl, parsed) {
|
|
10
|
+
let pathname = parsed.pathname;
|
|
11
|
+
if (!rawUrl.includes(".yaml")) {
|
|
12
|
+
pathname = pathname.endsWith("/")
|
|
13
|
+
? `${pathname}${DEFAULT_MANIFEST_FILENAME}`
|
|
14
|
+
: `${pathname}/${DEFAULT_MANIFEST_FILENAME}`;
|
|
15
|
+
}
|
|
16
|
+
return pathname;
|
|
17
|
+
}
|
|
18
|
+
/** Short hash of `search + hash` so two URLs that differ only in query /
|
|
19
|
+
* fragment do not collide at the same cache path. */
|
|
20
|
+
function disambiguatePath(pathname, search, hash) {
|
|
21
|
+
if (!search && !hash)
|
|
22
|
+
return pathname;
|
|
23
|
+
const digest = createHash("sha256")
|
|
24
|
+
.update(search + hash)
|
|
25
|
+
.digest("hex")
|
|
26
|
+
.slice(0, QUERY_HASH_LENGTH);
|
|
27
|
+
const dotIdx = pathname.lastIndexOf(".");
|
|
28
|
+
const slashIdx = pathname.lastIndexOf("/");
|
|
29
|
+
const ext = dotIdx > slashIdx ? pathname.slice(dotIdx) : "";
|
|
30
|
+
const base = pathname.slice(0, pathname.length - ext.length);
|
|
31
|
+
return `${base}.${digest}${ext}`;
|
|
32
|
+
}
|
|
33
|
+
/** The transport for direct `https://…` (and `http://`) module URLs. Its
|
|
34
|
+
* resolution `source` composes the browser-safe `HttpSource` from `analyzer`;
|
|
35
|
+
* the Node-only management methods live here. This is the fallback transport
|
|
36
|
+
* for any ref that carries no owning scheme, so `oci://` (or a future `s3://`)
|
|
37
|
+
* never falls through to it — those refs are claimed by their own transport's
|
|
38
|
+
* `supports()`.
|
|
39
|
+
*
|
|
40
|
+
* A URL addresses exactly one file, so it names no enumerable version: this
|
|
41
|
+
* transport publishes nothing, lists no versions, and has no `@version` segment
|
|
42
|
+
* to bump. What it does own is reading, hashing and caching those bytes. */
|
|
43
|
+
export class HttpTransport {
|
|
44
|
+
httpSource;
|
|
45
|
+
source;
|
|
46
|
+
constructor() {
|
|
47
|
+
this.httpSource = new HttpSource();
|
|
48
|
+
this.source = {
|
|
49
|
+
supports: (url) => this.supports(url),
|
|
50
|
+
read: async (url) => {
|
|
51
|
+
// The browser-safe source does the fetch; the Node-side egress policy
|
|
52
|
+
// is enforced here, on the host the read will actually hit.
|
|
53
|
+
await assertPublicEgress(url);
|
|
54
|
+
return this.httpSource.read(url);
|
|
55
|
+
},
|
|
56
|
+
resolveRelative: (base, relative) => this.httpSource.resolveRelative(base, relative),
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
supports(ref) {
|
|
60
|
+
const { base } = splitIntegrity(ref);
|
|
61
|
+
return base.startsWith("http://") || base.startsWith("https://");
|
|
62
|
+
}
|
|
63
|
+
cacheCoords(ref) {
|
|
64
|
+
const url = splitIntegrity(ref).base;
|
|
65
|
+
if (!url.startsWith("http://") && !url.startsWith("https://"))
|
|
66
|
+
return null;
|
|
67
|
+
let parsed;
|
|
68
|
+
try {
|
|
69
|
+
parsed = new URL(url);
|
|
70
|
+
}
|
|
71
|
+
catch {
|
|
72
|
+
return null;
|
|
73
|
+
}
|
|
74
|
+
const pathname = normalizePathname(url, parsed);
|
|
75
|
+
// `url` subtree, query-hash suffix on collision. No version segment: a URL
|
|
76
|
+
// addresses exactly one file, and the version it declares lives inside
|
|
77
|
+
// bytes the cache maps paths without.
|
|
78
|
+
const cleanPath = pathname.startsWith("/") ? pathname.slice(1) : pathname;
|
|
79
|
+
const segments = disambiguatePath(cleanPath, parsed.search, parsed.hash).split("/");
|
|
80
|
+
const file = segments.pop();
|
|
81
|
+
if (!file)
|
|
82
|
+
return null;
|
|
83
|
+
return { transport: "url", host: parsed.host, path: segments.join("/"), file };
|
|
84
|
+
}
|
|
85
|
+
async listVersions() {
|
|
86
|
+
// A direct `https://` URL has no version-list endpoint.
|
|
87
|
+
return null;
|
|
88
|
+
}
|
|
89
|
+
refVersion() {
|
|
90
|
+
// A direct `https://` URL has no version segment to bump.
|
|
91
|
+
return null;
|
|
92
|
+
}
|
|
93
|
+
withVersion(ref) {
|
|
94
|
+
throw new Error(`cannot set a version on '${ref}': a URL addresses one file and carries no version segment.`);
|
|
95
|
+
}
|
|
96
|
+
/** Mirrors the source's fetch-URL derivation: the URL points at (or contains)
|
|
97
|
+
* the YAML file. `null` when this transport does not own the ref's shape. */
|
|
98
|
+
manifestUrl(ref) {
|
|
99
|
+
const { base } = splitIntegrity(ref);
|
|
100
|
+
if (!base.startsWith("http://") && !base.startsWith("https://"))
|
|
101
|
+
return null;
|
|
102
|
+
return base.includes(".yaml") ? base : `${base}/${DEFAULT_MANIFEST_FILENAME}`;
|
|
103
|
+
}
|
|
104
|
+
async digest(ref) {
|
|
105
|
+
// The digest is Telo's canonical hash over the `telo.yaml` bytes — the same
|
|
106
|
+
// value `manifestHash` returns, but absent-is-null rather than a throw.
|
|
107
|
+
const fetchUrl = this.manifestUrl(ref);
|
|
108
|
+
if (!fetchUrl)
|
|
109
|
+
return null;
|
|
110
|
+
await assertPublicEgress(fetchUrl);
|
|
111
|
+
const res = await fetchOrThrow(fetchUrl, undefined, { operation: "Module manifest read" });
|
|
112
|
+
if (res.status === 404)
|
|
113
|
+
return null;
|
|
114
|
+
if (!res.ok) {
|
|
115
|
+
throw new Error(`${fetchUrl} returned ${res.status} ${res.statusText}`);
|
|
116
|
+
}
|
|
117
|
+
const bytes = new Uint8Array(await res.arrayBuffer());
|
|
118
|
+
return `sha256-${await sha256Base64Url(bytes)}`;
|
|
119
|
+
}
|
|
120
|
+
/** Hashes the **raw response bytes**, which is exactly what `verifiedFetch`
|
|
121
|
+
* checks an inline `#sha256-…` pin against on the read path. */
|
|
122
|
+
async manifestHash(ref) {
|
|
123
|
+
const fetchUrl = this.manifestUrl(ref);
|
|
124
|
+
if (!fetchUrl) {
|
|
125
|
+
throw new Error(`cannot hash non-remote import '${ref}'`);
|
|
126
|
+
}
|
|
127
|
+
await assertPublicEgress(fetchUrl);
|
|
128
|
+
const res = await fetchOrThrow(fetchUrl, undefined, { operation: "Module manifest hash" });
|
|
129
|
+
if (!res.ok) {
|
|
130
|
+
throw new Error(`fetch ${fetchUrl}: ${res.status} ${res.statusText}`);
|
|
131
|
+
}
|
|
132
|
+
const bytes = new Uint8Array(await res.arrayBuffer());
|
|
133
|
+
return `sha256-${await sha256Base64Url(bytes)}`;
|
|
134
|
+
}
|
|
135
|
+
/** Layered artifacts are an OCI concept — a module reached over a plain URL is
|
|
136
|
+
* manifest-only, and its controllers come from npm. */
|
|
137
|
+
async fetchLayer(ref, blobDigest) {
|
|
138
|
+
throw new Error(`Cannot fetch layer ${blobDigest} of ${ref}: a plain URL serves the manifest only. ` +
|
|
139
|
+
`A module with a bundled payload is published as an OCI artifact (oci://host/repo).`);
|
|
140
|
+
}
|
|
141
|
+
async layerIndex(layers) {
|
|
142
|
+
// Same boundary `fetchLayer` and `publish` draw: a plain URL serves the
|
|
143
|
+
// manifest only, so it frames no layer and can name no blob. An empty set is
|
|
144
|
+
// not a payload, so it answers rather than throws — a manifest-only module
|
|
145
|
+
// builds its payload through this transport during analysis.
|
|
146
|
+
if (layers.every((layer) => layer.files.length === 0))
|
|
147
|
+
return [];
|
|
148
|
+
throw new Error("A plain URL serves the manifest only, so it cannot index payload layers. " +
|
|
149
|
+
"A module with a bundled payload is published as an OCI artifact (oci://host/repo).");
|
|
150
|
+
}
|
|
151
|
+
async publish(destination, bundle, opts = {}) {
|
|
152
|
+
// `telo publish` rejects a non-OCI destination up front, so this is only a
|
|
153
|
+
// guard for a direct programmatic call.
|
|
154
|
+
throw new Error("Publishing over HTTP has been removed. Publish to an OCI registry " +
|
|
155
|
+
"(oci://host/repo) instead.");
|
|
156
|
+
}
|
|
157
|
+
canonicalizeSiblingRef(destination, relativeSource, version) {
|
|
158
|
+
// Canonicalizing a sibling is publish-path work, and this transport does not
|
|
159
|
+
// publish — so it refuses here for the same reason `publish` does, rather
|
|
160
|
+
// than computing a ref nothing could ever push. Silence would be worse than
|
|
161
|
+
// useless: an `https://host/` destination has no path to resolve `../lib`
|
|
162
|
+
// beside, so joining anyway yields a ref one segment short with no error.
|
|
163
|
+
throw new Error(`Cannot canonicalize the relative import '${relativeSource}' against '${destination}': ` +
|
|
164
|
+
`publishing over plain HTTP has been removed. Publish to an OCI registry ` +
|
|
165
|
+
`(oci://host/repo) instead.`);
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
//# sourceMappingURL=http-transport.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http-transport.js","sourceRoot":"","sources":["../../src/transports/http-transport.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,yBAAyB,EACzB,UAAU,EACV,eAAe,EACf,cAAc,GAIf,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAGpC,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AASvD,MAAM,iBAAiB,GAAG,EAAE,CAAC;AAE7B;;sEAEsE;AACtE,SAAS,iBAAiB,CAAC,MAAc,EAAE,MAAW;IACpD,IAAI,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC;IAC/B,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC;QAC9B,QAAQ,GAAG,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAC;YAC/B,CAAC,CAAC,GA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G,0CAA0C;YAClF,oFAAoF,CACvF,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,UAAU,CAAC,MAA+B;QAC9C,wEAAwE;QACxE,6EAA6E;QAC7E,2EAA2E;QAC3E,6DAA6D;QAC7D,IAAI,MAAM,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC,CAAC;YAAE,OAAO,EAAE,CAAC;QACjE,MAAM,IAAI,KAAK,CACb,2EAA2E;YACzE,oFAAoF,CACvF,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,OAAO,CACX,WAAmB,EACnB,MAAqB,EACrB,OAAuB,EAAE;QAEzB,2EAA2E;QAC3E,wCAAwC;QACxC,MAAM,IAAI,KAAK,CACb,oEAAoE;YAClE,4BAA4B,CAC/B,CAAC;IACJ,CAAC;IAED,sBAAsB,CAAC,WAAmB,EAAE,cAAsB,EAAE,OAAe;QACjF,6EAA6E;QAC7E,0EAA0E;QAC1E,4EAA4E;QAC5E,0EAA0E;QAC1E,0EAA0E;QAC1E,MAAM,IAAI,KAAK,CACb,4CAA4C,cAAc,cAAc,WAAW,KAAK;YACtF,0EAA0E;YAC1E,4BAA4B,CAC/B,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -3,9 +3,9 @@ import type { PayloadFile } from "../bundle/files-integrity.js";
|
|
|
3
3
|
import type { PublishBundle, PublishOptions, PublishResult, Transport } from "./transport.js";
|
|
4
4
|
/** Dispatches ref-scheme-specific operations to the transport that owns a ref.
|
|
5
5
|
* The loader, cache source, `upgrade`, and `publish` consult this instead of
|
|
6
|
-
* branching on ref shape. `
|
|
7
|
-
*
|
|
8
|
-
*
|
|
6
|
+
* branching on ref shape. `HttpTransport` is always last so it is the fallback
|
|
7
|
+
* for plain `https` refs, and a scheme-owning transport (OCI, later S3) claims
|
|
8
|
+
* its refs via `supports()` before the fallback is reached. */
|
|
9
9
|
export declare class TransportRegistry {
|
|
10
10
|
private readonly transports;
|
|
11
11
|
constructor(transports: Transport[]);
|
|
@@ -32,15 +32,14 @@ export declare class TransportRegistry {
|
|
|
32
32
|
private require;
|
|
33
33
|
}
|
|
34
34
|
/** The default transport set. Scheme-owning transports come first; the
|
|
35
|
-
* `
|
|
36
|
-
*
|
|
37
|
-
export declare function defaultTransports(
|
|
38
|
-
/** A `TransportRegistry` seeded with {@link defaultTransports}, memoized
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
|
|
45
|
-
export declare function defaultTransportRegistry(registryUrl?: string): TransportRegistry;
|
|
35
|
+
* `HttpTransport` is last, the fallback for plain `https` refs. OCI (and later
|
|
36
|
+
* S3) claim their `oci://` / `s3://` refs before the fallback is reached. */
|
|
37
|
+
export declare function defaultTransports(): Transport[];
|
|
38
|
+
/** A `TransportRegistry` seeded with {@link defaultTransports}, memoized. The
|
|
39
|
+
* default transports hold no per-call state, so one shared instance is safe —
|
|
40
|
+
* and avoids re-instantiating the whole set on hot paths like
|
|
41
|
+
* `cachePathForCanonical`. It is also what gives `OciTransport`'s per-instance
|
|
42
|
+
* read-client pool a process-wide lifetime here, so the bearer-token cache
|
|
43
|
+
* survives across operations without the pool having to be global. */
|
|
44
|
+
export declare function defaultTransportRegistry(): TransportRegistry;
|
|
46
45
|
//# sourceMappingURL=transport-registry.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transport-registry.d.ts","sourceRoot":"","sources":["../../src/transports/transport-registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAE7E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAGhE,OAAO,KAAK,EACV,aAAa,EACb,cAAc,EACd,aAAa,EACb,SAAS,EACV,MAAM,gBAAgB,CAAC;AAExB;;;;
|
|
1
|
+
{"version":3,"file":"transport-registry.d.ts","sourceRoot":"","sources":["../../src/transports/transport-registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAE7E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAGhE,OAAO,KAAK,EACV,aAAa,EACb,cAAc,EACd,aAAa,EACb,SAAS,EACV,MAAM,gBAAgB,CAAC;AAExB;;;;gEAIgE;AAChE,qBAAa,iBAAiB;IAChB,OAAO,CAAC,QAAQ,CAAC,UAAU;gBAAV,UAAU,EAAE,SAAS,EAAE;IAEpD,kEAAkE;IAClE,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS;IAI1C;0EACsE;IACtE,OAAO,IAAI,cAAc,EAAE;IAI3B;iEAC6D;IAC7D,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,mBAAmB,GAAG,IAAI;IAIpD;wEACoE;IACpE,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,GAAG,IAAI,CAAC;IAInD;gEAC4D;IAC5D,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC;IAInE;kFAC8E;IAC9E,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IAI3C;yDACqD;IACrD,OAAO,CACL,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE,aAAa,EACrB,IAAI,CAAC,EAAE,cAAc,GACpB,OAAO,CAAC,aAAa,CAAC;IAIzB,OAAO,CAAC,OAAO;CAOhB;AAED;;8EAE8E;AAC9E,wBAAgB,iBAAiB,IAAI,SAAS,EAAE,CAE/C;AAID;;;;;uEAKuE;AACvE,wBAAgB,wBAAwB,IAAI,iBAAiB,CAE5D"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
+
import { HttpTransport } from "./http-transport.js";
|
|
1
2
|
import { OciTransport } from "./oci/oci-transport.js";
|
|
2
|
-
import { RegistryTransport } from "./registry-transport.js";
|
|
3
3
|
/** Dispatches ref-scheme-specific operations to the transport that owns a ref.
|
|
4
4
|
* The loader, cache source, `upgrade`, and `publish` consult this instead of
|
|
5
|
-
* branching on ref shape. `
|
|
6
|
-
*
|
|
7
|
-
*
|
|
5
|
+
* branching on ref shape. `HttpTransport` is always last so it is the fallback
|
|
6
|
+
* for plain `https` refs, and a scheme-owning transport (OCI, later S3) claims
|
|
7
|
+
* its refs via `supports()` before the fallback is reached. */
|
|
8
8
|
export class TransportRegistry {
|
|
9
9
|
transports;
|
|
10
10
|
constructor(transports) {
|
|
@@ -53,26 +53,19 @@ export class TransportRegistry {
|
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
55
|
/** The default transport set. Scheme-owning transports come first; the
|
|
56
|
-
* `
|
|
57
|
-
*
|
|
58
|
-
export function defaultTransports(
|
|
59
|
-
return [new OciTransport(), new
|
|
56
|
+
* `HttpTransport` is last, the fallback for plain `https` refs. OCI (and later
|
|
57
|
+
* S3) claim their `oci://` / `s3://` refs before the fallback is reached. */
|
|
58
|
+
export function defaultTransports() {
|
|
59
|
+
return [new OciTransport(), new HttpTransport()];
|
|
60
60
|
}
|
|
61
|
-
|
|
62
|
-
/** A `TransportRegistry` seeded with {@link defaultTransports}, memoized
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
-
*
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
const key = registryUrl ?? "";
|
|
71
|
-
let cached = defaultRegistryCache.get(key);
|
|
72
|
-
if (!cached) {
|
|
73
|
-
cached = new TransportRegistry(defaultTransports(registryUrl));
|
|
74
|
-
defaultRegistryCache.set(key, cached);
|
|
75
|
-
}
|
|
76
|
-
return cached;
|
|
61
|
+
let defaultRegistry;
|
|
62
|
+
/** A `TransportRegistry` seeded with {@link defaultTransports}, memoized. The
|
|
63
|
+
* default transports hold no per-call state, so one shared instance is safe —
|
|
64
|
+
* and avoids re-instantiating the whole set on hot paths like
|
|
65
|
+
* `cachePathForCanonical`. It is also what gives `OciTransport`'s per-instance
|
|
66
|
+
* read-client pool a process-wide lifetime here, so the bearer-token cache
|
|
67
|
+
* survives across operations without the pool having to be global. */
|
|
68
|
+
export function defaultTransportRegistry() {
|
|
69
|
+
return (defaultRegistry ??= new TransportRegistry(defaultTransports()));
|
|
77
70
|
}
|
|
78
71
|
//# sourceMappingURL=transport-registry.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transport-registry.js","sourceRoot":"","sources":["../../src/transports/transport-registry.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"transport-registry.js","sourceRoot":"","sources":["../../src/transports/transport-registry.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAQtD;;;;gEAIgE;AAChE,MAAM,OAAO,iBAAiB;IACC;IAA7B,YAA6B,UAAuB;QAAvB,eAAU,GAAV,UAAU,CAAa;IAAG,CAAC;IAExD,kEAAkE;IAClE,MAAM,CAAC,GAAW;QAChB,OAAO,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC;IACtD,CAAC;IAED;0EACsE;IACtE,OAAO;QACL,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;IAC9C,CAAC;IAED;iEAC6D;IAC7D,WAAW,CAAC,GAAW;QACrB,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,WAAW,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC;IACpD,CAAC;IAED;wEACoE;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"version": "0.
|
|
3
|
+
"version": "0.85.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.69.0",
|
|
65
65
|
"@telorun/glob": "0.2.0",
|
|
66
66
|
"@telorun/templating": "0.18.0",
|
|
67
67
|
"ajv": "^8.17.1",
|
|
@@ -433,15 +433,14 @@ export function moduleDirectoryFor(
|
|
|
433
433
|
requestedUrl: string,
|
|
434
434
|
source: string,
|
|
435
435
|
entryDir: string,
|
|
436
|
-
registryUrl: string | undefined,
|
|
437
436
|
manifestsDir: string | undefined,
|
|
438
437
|
legacyDir?: string | null,
|
|
439
438
|
): string | null {
|
|
440
439
|
const pinned = splitIntegrity(requestedUrl).base;
|
|
441
|
-
const cacheFile = cachePathForCanonical(pinned, entryDir,
|
|
440
|
+
const cacheFile = cachePathForCanonical(pinned, entryDir, manifestsDir);
|
|
442
441
|
if (cacheFile) {
|
|
443
442
|
if (legacyDir && !existsSync(cacheFile)) {
|
|
444
|
-
const legacyFile = cachePathForCanonical(pinned, entryDir,
|
|
443
|
+
const legacyFile = cachePathForCanonical(pinned, entryDir, legacyDir);
|
|
445
444
|
if (legacyFile && existsSync(legacyFile)) return path.dirname(legacyFile);
|
|
446
445
|
}
|
|
447
446
|
return path.dirname(cacheFile);
|
|
@@ -285,17 +285,17 @@ function findPackageRoot(entryFile: string, name: string): string | null {
|
|
|
285
285
|
|
|
286
286
|
/**
|
|
287
287
|
* Loads a `pkg:telo` controller — a controller delivered inside the module's own
|
|
288
|
-
*
|
|
289
|
-
*
|
|
288
|
+
* artifact, not fetched from an external package registry. Every PURL segment
|
|
289
|
+
* carries meaning:
|
|
290
290
|
*
|
|
291
291
|
* pkg:telo / local / <format> ? path=./nodejs/x.mjs # export
|
|
292
292
|
* type ns name qualifier subpath
|
|
293
293
|
*
|
|
294
294
|
* - `type=telo` — Telo-delivered (not npm/cargo).
|
|
295
295
|
* - `namespace=local` — the delivery sub-mode: bundled in the module artifact.
|
|
296
|
-
*
|
|
297
|
-
*
|
|
298
|
-
*
|
|
296
|
+
* The namespace is what leaves room for a future sub-mode (a controller
|
|
297
|
+
* fetched as its own artifact). A non-`local` namespace → env-missing here
|
|
298
|
+
* (a different mode another branch/kernel would handle).
|
|
299
299
|
* - `name=<format>` — the artifact format the loader dispatches on (`js` /
|
|
300
300
|
* `napi` / `wasm`). Bundling is the one delivery not tied to an ecosystem's
|
|
301
301
|
* runtime (npm ⇒ JS, cargo ⇒ Rust; a bundle is just files), so the format is
|
|
@@ -497,8 +497,8 @@ export class BundleControllerLoader {
|
|
|
497
497
|
}
|
|
498
498
|
|
|
499
499
|
// Delivery sub-mode lives in the namespace; this loader handles bundled
|
|
500
|
-
// (`local`) controllers. Anything else (
|
|
501
|
-
//
|
|
500
|
+
// (`local`) controllers. Anything else (a future sub-mode) is env-missing
|
|
501
|
+
// so the candidate list falls through.
|
|
502
502
|
if (parsed.namespace !== "local") {
|
|
503
503
|
throw new ControllerEnvMissingError(
|
|
504
504
|
`pkg:telo controller "${purl}" must use the "local" namespace (pkg:telo/local/<format>); got "${parsed.namespace ?? "(none)"}"`,
|
|
@@ -9,6 +9,7 @@ import { RuntimeError } from "@telorun/sdk";
|
|
|
9
9
|
import {
|
|
10
10
|
controllerBearingAncestor,
|
|
11
11
|
effectiveAuthorSchema,
|
|
12
|
+
publishedOwnFields,
|
|
12
13
|
effectiveStatusSchema,
|
|
13
14
|
hasOwnControllerOrTemplate,
|
|
14
15
|
inheritedCapability,
|
|
@@ -30,6 +31,9 @@ type ResourceDefinitionResource = RuntimeResource & {
|
|
|
30
31
|
};
|
|
31
32
|
schema: Record<string, any>;
|
|
32
33
|
status?: Record<string, any>;
|
|
34
|
+
/** Derived stamp: the fields a merge-form inheriting child publishes over the
|
|
35
|
+
* parent instance's reading (see `publishedOwnFields`). */
|
|
36
|
+
publishedOwnFields?: string[];
|
|
33
37
|
capability?: string;
|
|
34
38
|
extends?: string;
|
|
35
39
|
base?: Record<string, any>;
|
|
@@ -77,6 +81,16 @@ class ResourceDefinition implements ResourceInstance {
|
|
|
77
81
|
`Telo.Definition '${this.resource.metadata.name}': 'extends' target '${this.resource.extends}' is not loaded yet.`,
|
|
78
82
|
);
|
|
79
83
|
}
|
|
84
|
+
// Which of the child's fields publish over the parent's reading. Stamped
|
|
85
|
+
// here for the reason `status:` is: an `extends` alias belongs to the file
|
|
86
|
+
// that declared it, so the set must be derived in the DEFINING scope — a
|
|
87
|
+
// consumer importing only the backend has no alias for the parent's
|
|
88
|
+
// library. Derived before the schema stamp only because it reads the same
|
|
89
|
+
// resolver, not because it reads the pre-stamp value.
|
|
90
|
+
this.resource.publishedOwnFields = publishedOwnFields(
|
|
91
|
+
this.resource as ResourceDefinitionManifest,
|
|
92
|
+
resolveDef,
|
|
93
|
+
);
|
|
80
94
|
this.resource.schema = effectiveAuthorSchema(
|
|
81
95
|
this.resource as ResourceDefinitionManifest,
|
|
82
96
|
resolveDef,
|
|
@@ -30,6 +30,11 @@ import {
|
|
|
30
30
|
import { RuntimeError } from "@telorun/sdk";
|
|
31
31
|
import { evalPathCovers } from "@telorun/analyzer";
|
|
32
32
|
import { effectOwnerOf, executeReturnedChain } from "./effect-scope.js";
|
|
33
|
+
import {
|
|
34
|
+
REDACTED,
|
|
35
|
+
redactSensitive,
|
|
36
|
+
sensitivePathsOfInstance,
|
|
37
|
+
} from "./instance-sensitive-paths.js";
|
|
33
38
|
import {
|
|
34
39
|
classifyInitFailures,
|
|
35
40
|
isDeferral,
|
|
@@ -142,6 +147,12 @@ function localDependencyNames(refs: ResourceRef[]): string[] {
|
|
|
142
147
|
* whole-value match is redacted. */
|
|
143
148
|
const MIN_SUBSTRING_SCRUB_LEN = 5;
|
|
144
149
|
|
|
150
|
+
/** A live resource instance, as opposed to the raw config value a slot held
|
|
151
|
+
* before Phase-5 injection — the same duck-test the reference-resolving
|
|
152
|
+
* controllers use. */
|
|
153
|
+
const hasSnapshotMethod = (value: unknown): boolean =>
|
|
154
|
+
!!value && typeof (value as { snapshot?: unknown }).snapshot === "function";
|
|
155
|
+
|
|
145
156
|
export function buildResolvedProperties(
|
|
146
157
|
resource: ResourceManifest,
|
|
147
158
|
secretValues: Set<string>,
|
|
@@ -752,6 +763,43 @@ export class EvaluationContext implements IEvaluationContext {
|
|
|
752
763
|
return def?.status;
|
|
753
764
|
}
|
|
754
765
|
|
|
766
|
+
/**
|
|
767
|
+
* The configured values a merge-form inheriting child publishes over the
|
|
768
|
+
* parent instance's reading, or undefined when the kind declares none.
|
|
769
|
+
*
|
|
770
|
+
* Such a child IS the parent instance — the inherited controller returns it
|
|
771
|
+
* verbatim — so `snapshot()` is the parent's and a field the parent never
|
|
772
|
+
* declared would be readable from nowhere. The field NAMES come from
|
|
773
|
+
* `publishedOwnFields`, stamped onto the definition at registration in the
|
|
774
|
+
* scope that declared the `extends` alias; resolving the chain here would
|
|
775
|
+
* resolve it in the READING module's scope, which may have no alias for the
|
|
776
|
+
* parent's library. Done here rather than by rebinding the instance's
|
|
777
|
+
* `snapshot()` because this is definition-derived data joined into a reading —
|
|
778
|
+
* exactly what `statusSchemaOf` already does — and a second kernel cannot
|
|
779
|
+
* rebind a trait method.
|
|
780
|
+
*
|
|
781
|
+
* Two values are withheld rather than published, both conservatively: a
|
|
782
|
+
* runtime-eval field is still a `CompiledValue` at this point (only compile
|
|
783
|
+
* paths are expanded at create), and a live instance is a collaborator rather
|
|
784
|
+
* than a reading. Publishing either would put a wrong-typed value in the CEL
|
|
785
|
+
* scope, which is the failure this overlay exists to remove.
|
|
786
|
+
*/
|
|
787
|
+
private ownFieldOverlay(
|
|
788
|
+
kind: string,
|
|
789
|
+
resource: Record<string, unknown>,
|
|
790
|
+
): Record<string, unknown> | undefined {
|
|
791
|
+
const def = this.getDefinition?.(this.resolveKindSafe(kind)) ?? this.getDefinition?.(kind);
|
|
792
|
+
const fields = (def as { publishedOwnFields?: string[] } | undefined)?.publishedOwnFields;
|
|
793
|
+
if (!fields?.length) return undefined;
|
|
794
|
+
let overlay: Record<string, unknown> | undefined;
|
|
795
|
+
for (const field of fields) {
|
|
796
|
+
const value = resource[field];
|
|
797
|
+
if (value === undefined || isCompiledValue(value) || hasSnapshotMethod(value)) continue;
|
|
798
|
+
(overlay ??= {})[field] = value;
|
|
799
|
+
}
|
|
800
|
+
return overlay;
|
|
801
|
+
}
|
|
802
|
+
|
|
755
803
|
/**
|
|
756
804
|
* Re-read a resource's `snapshot()` and republish it, joined with whatever
|
|
757
805
|
* observed state the resource has reported. The single publication path — the
|
|
@@ -760,11 +808,14 @@ export class EvaluationContext implements IEvaluationContext {
|
|
|
760
808
|
*/
|
|
761
809
|
async publishSnapshot(name: string): Promise<void> {
|
|
762
810
|
const entry = this.resourceInstances.get(name) ?? this.createdInstances.get(name);
|
|
763
|
-
if (!entry
|
|
764
|
-
const snap = (await Promise.resolve(entry.instance.snapshot())) as
|
|
765
|
-
| Record<string, unknown>
|
|
766
|
-
| undefined;
|
|
811
|
+
if (!entry) return;
|
|
767
812
|
const kind = entry.resource.kind as string;
|
|
813
|
+
const own = this.ownFieldOverlay(kind, entry.resource);
|
|
814
|
+
if (!entry.instance.snapshot && !own) return;
|
|
815
|
+
const snapshot = entry.instance.snapshot
|
|
816
|
+
? ((await Promise.resolve(entry.instance.snapshot())) as Record<string, unknown> | undefined)
|
|
817
|
+
: undefined;
|
|
818
|
+
const snap = own ? { ...(snapshot ?? {}), ...own } : snapshot;
|
|
768
819
|
const props = buildPublishedProps(snap, {
|
|
769
820
|
kind,
|
|
770
821
|
name,
|
|
@@ -1606,6 +1657,30 @@ export class EvaluationContext implements IEvaluationContext {
|
|
|
1606
1657
|
: undefined;
|
|
1607
1658
|
// Capture the root CEL scope once, on the trace's root span's terminal event.
|
|
1608
1659
|
const rootScope = tracing && parentInvocationId === undefined ? this.traceRootScope() : undefined;
|
|
1660
|
+
// What a payload may say about this call. A credential is a dispatched
|
|
1661
|
+
// invocable, so its material is an invoke OUTPUT — and inputs and outputs
|
|
1662
|
+
// ride the debug wire on every call under `--inspect`, i.e. every watch
|
|
1663
|
+
// session, which the substring scrubbing does not reach (one call site, the
|
|
1664
|
+
// resource-Created event's properties). The kind that owns the contract
|
|
1665
|
+
// marks the field; nothing here knows which kind that is.
|
|
1666
|
+
const hide = (detail: Record<string, unknown>): Record<string, unknown> => {
|
|
1667
|
+
let out = detail;
|
|
1668
|
+
for (const direction of ["inputType", "outputType"] as const) {
|
|
1669
|
+
const key = direction === "inputType" ? "inputs" : "outputs";
|
|
1670
|
+
if (!(key in out)) continue;
|
|
1671
|
+
const paths = sensitivePathsOfInstance(instance, direction);
|
|
1672
|
+
// Unknown, because the contract would not resolve — withhold the whole
|
|
1673
|
+
// value rather than guess. The dispatch is about to raise that same
|
|
1674
|
+
// failure with its own code.
|
|
1675
|
+
if (paths === undefined) {
|
|
1676
|
+
out = { ...out, [key]: REDACTED };
|
|
1677
|
+
continue;
|
|
1678
|
+
}
|
|
1679
|
+
if (paths.length === 0) continue;
|
|
1680
|
+
out = { ...out, [key]: redactSensitive(out[key], paths) };
|
|
1681
|
+
}
|
|
1682
|
+
return out;
|
|
1683
|
+
};
|
|
1609
1684
|
const span = (
|
|
1610
1685
|
phase: "start" | "end",
|
|
1611
1686
|
outcome: SpanOutcome | undefined,
|
|
@@ -1620,7 +1695,7 @@ export class EvaluationContext implements IEvaluationContext {
|
|
|
1620
1695
|
"invoke",
|
|
1621
1696
|
phase,
|
|
1622
1697
|
outcome,
|
|
1623
|
-
phase === "end" && rootScope ? { ...detail, context: rootScope } : detail,
|
|
1698
|
+
phase === "end" && rootScope ? { ...hide(detail), context: rootScope } : hide(detail),
|
|
1624
1699
|
);
|
|
1625
1700
|
// When tracing, a derived context carries the new id down the tree so nested
|
|
1626
1701
|
// invokes read it as their parent; it is never `=== ambient`, so the call
|
package/src/index.ts
CHANGED
|
@@ -12,7 +12,7 @@ export {
|
|
|
12
12
|
export { MemorySource } from "./manifest-sources/memory-source.js";
|
|
13
13
|
export { WORKSPACE_FILENAME, findWorkspaceRoot, realPath } from "./workspace-marker.js";
|
|
14
14
|
export type { Transport } from "./transports/transport.js";
|
|
15
|
-
export {
|
|
15
|
+
export { HttpTransport } from "./transports/http-transport.js";
|
|
16
16
|
export { OciTransport } from "./transports/oci/oci-transport.js";
|
|
17
17
|
export { OciClient } from "./transports/oci/oci-client.js";
|
|
18
18
|
export { isOciRef, parseOciRef, type ParsedOciRef } from "./transports/oci/oci-ref.js";
|