@telorun/sdk 0.59.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.
- package/dist/contract-errors.d.ts +31 -0
- package/dist/contract-errors.d.ts.map +1 -0
- package/dist/contract-errors.js +36 -0
- package/dist/evaluation-context.d.ts +7 -1
- package/dist/evaluation-context.d.ts.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/resource-context.d.ts +22 -0
- package/dist/resource-context.d.ts.map +1 -1
- package/dist/runtime-error.d.ts +12 -1
- package/dist/runtime-error.d.ts.map +1 -1
- package/dist/type-schema-ref.d.ts +16 -1
- package/dist/type-schema-ref.d.ts.map +1 -1
- package/dist/type-schema-ref.js +17 -2
- package/package.json +1 -1
- package/src/contract-errors.ts +44 -0
- package/src/evaluation-context.ts +8 -1
- package/src/index.ts +1 -0
- package/src/resource-context.ts +22 -0
- package/src/runtime-error.ts +13 -0
- package/src/type-schema-ref.ts +17 -2
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The ambient kernel error union: codes any dispatch can raise because the
|
|
3
|
+
* kernel — not the kind's controller — enforces the invocation contract.
|
|
4
|
+
*
|
|
5
|
+
* They are **catchable**: a `catches:` entry may name one and its `when:` is
|
|
6
|
+
* validated against this set, so a typo is caught statically like any declared
|
|
7
|
+
* code. They are **excluded from coverage counting**: the completeness rule
|
|
8
|
+
* keeps counting only a kind's own `throws:` codes. Folding them into every
|
|
9
|
+
* union instead would make every bounded `catches:` block in the standard
|
|
10
|
+
* library incomplete overnight; making them uncatchable would leave an author no
|
|
11
|
+
* way to handle a contract violation they can legitimately recover from.
|
|
12
|
+
*
|
|
13
|
+
* Shared by the kernel (which raises them), the analyzer (which type-checks
|
|
14
|
+
* `catches:` against them) and module authors (who name them in a catch).
|
|
15
|
+
*/
|
|
16
|
+
/** Inputs did not satisfy the target's declared `inputType`. */
|
|
17
|
+
export declare const ERR_INPUT_INVALID = "ERR_INPUT_INVALID";
|
|
18
|
+
/** A result did not satisfy the target's declared `outputType`. */
|
|
19
|
+
export declare const ERR_OUTPUT_INVALID = "ERR_OUTPUT_INVALID";
|
|
20
|
+
/** A declared contract could not be resolved to a schema — a named type that
|
|
21
|
+
* never registered. Distinct from a value violation: nothing is wrong with the
|
|
22
|
+
* data, the contract itself is unusable, and enforcement must fail rather than
|
|
23
|
+
* quietly switch itself off. */
|
|
24
|
+
export declare const ERR_CONTRACT_UNRESOLVABLE = "ERR_CONTRACT_UNRESOLVABLE";
|
|
25
|
+
export declare const AMBIENT_CONTRACT_ERROR_CODES: readonly ["ERR_INPUT_INVALID", "ERR_OUTPUT_INVALID", "ERR_CONTRACT_UNRESOLVABLE"];
|
|
26
|
+
export type AmbientContractErrorCode = (typeof AMBIENT_CONTRACT_ERROR_CODES)[number];
|
|
27
|
+
/** True when a code is raised by the kernel's contract enforcement rather than
|
|
28
|
+
* declared by a kind. Callers use it to accept the code in a `catches:` entry
|
|
29
|
+
* without counting it toward that kind's declared union. */
|
|
30
|
+
export declare function isAmbientContractErrorCode(code: string): boolean;
|
|
31
|
+
//# sourceMappingURL=contract-errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contract-errors.d.ts","sourceRoot":"","sources":["../src/contract-errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,gEAAgE;AAChE,eAAO,MAAM,iBAAiB,sBAAsB,CAAC;AAErD,mEAAmE;AACnE,eAAO,MAAM,kBAAkB,uBAAuB,CAAC;AAEvD;;;iCAGiC;AACjC,eAAO,MAAM,yBAAyB,8BAA8B,CAAC;AAErE,eAAO,MAAM,4BAA4B,mFAI/B,CAAC;AAEX,MAAM,MAAM,wBAAwB,GAAG,CAAC,OAAO,4BAA4B,CAAC,CAAC,MAAM,CAAC,CAAC;AAIrF;;6DAE6D;AAC7D,wBAAgB,0BAA0B,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEhE"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The ambient kernel error union: codes any dispatch can raise because the
|
|
3
|
+
* kernel — not the kind's controller — enforces the invocation contract.
|
|
4
|
+
*
|
|
5
|
+
* They are **catchable**: a `catches:` entry may name one and its `when:` is
|
|
6
|
+
* validated against this set, so a typo is caught statically like any declared
|
|
7
|
+
* code. They are **excluded from coverage counting**: the completeness rule
|
|
8
|
+
* keeps counting only a kind's own `throws:` codes. Folding them into every
|
|
9
|
+
* union instead would make every bounded `catches:` block in the standard
|
|
10
|
+
* library incomplete overnight; making them uncatchable would leave an author no
|
|
11
|
+
* way to handle a contract violation they can legitimately recover from.
|
|
12
|
+
*
|
|
13
|
+
* Shared by the kernel (which raises them), the analyzer (which type-checks
|
|
14
|
+
* `catches:` against them) and module authors (who name them in a catch).
|
|
15
|
+
*/
|
|
16
|
+
/** Inputs did not satisfy the target's declared `inputType`. */
|
|
17
|
+
export const ERR_INPUT_INVALID = "ERR_INPUT_INVALID";
|
|
18
|
+
/** A result did not satisfy the target's declared `outputType`. */
|
|
19
|
+
export const ERR_OUTPUT_INVALID = "ERR_OUTPUT_INVALID";
|
|
20
|
+
/** A declared contract could not be resolved to a schema — a named type that
|
|
21
|
+
* never registered. Distinct from a value violation: nothing is wrong with the
|
|
22
|
+
* data, the contract itself is unusable, and enforcement must fail rather than
|
|
23
|
+
* quietly switch itself off. */
|
|
24
|
+
export const ERR_CONTRACT_UNRESOLVABLE = "ERR_CONTRACT_UNRESOLVABLE";
|
|
25
|
+
export const AMBIENT_CONTRACT_ERROR_CODES = [
|
|
26
|
+
ERR_INPUT_INVALID,
|
|
27
|
+
ERR_OUTPUT_INVALID,
|
|
28
|
+
ERR_CONTRACT_UNRESOLVABLE,
|
|
29
|
+
];
|
|
30
|
+
const AMBIENT = new Set(AMBIENT_CONTRACT_ERROR_CODES);
|
|
31
|
+
/** True when a code is raised by the kernel's contract enforcement rather than
|
|
32
|
+
* declared by a kind. Callers use it to accept the code in a `catches:` entry
|
|
33
|
+
* without counting it toward that kind's declared union. */
|
|
34
|
+
export function isAmbientContractErrorCode(code) {
|
|
35
|
+
return AMBIENT.has(code);
|
|
36
|
+
}
|
|
@@ -50,8 +50,14 @@ export type InstanceFactory = (context: EvaluationContext, resource: ResourceMan
|
|
|
50
50
|
* registered in this context but not yet initialized. Injection uses it
|
|
51
51
|
* to defer a resource whose dependency exists but hasn't inited yet —
|
|
52
52
|
* rather than leaving the slot unresolved — so the init loop retries it.
|
|
53
|
+
* @param owner The context that OWNS this resource — the module context for a top-level
|
|
54
|
+
* resource, the per-run scope child for a `with:`-scoped one. Anything the
|
|
55
|
+
* hook builds on the resource's behalf (notably a scope handle for an
|
|
56
|
+
* `x-telo-scope` field) must hang off this, not off the root: the inline
|
|
57
|
+
* declarations inside a scope name kinds through the import aliases of the
|
|
58
|
+
* module that DECLARED them, which the root context has never heard of.
|
|
53
59
|
*/
|
|
54
|
-
export type PreInitHook = (resource: ResourceManifest, getInstance: (name: string, alias?: string) => ResourceInstance | undefined, isPending
|
|
60
|
+
export type PreInitHook = (resource: ResourceManifest, getInstance: (name: string, alias?: string) => ResourceInstance | undefined, isPending: ((name: string) => boolean) | undefined, owner: EvaluationContext) => void;
|
|
55
61
|
/** Canonical key for a resource instance: "<module>.<kind>.<name>" */
|
|
56
62
|
export declare function resourceKey(r: ResourceManifest): string;
|
|
57
63
|
/** The resource that owns a spawned child context — the parent in the resource
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"evaluation-context.d.ts","sourceRoot":"","sources":["../src/evaluation-context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAClF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAC5C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,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AC;IACtD,QAAQ,CAAC,IAAI,EAAE,aAAa,GAAG,SAAS,EAAE,IAAI,EAAE,eAAe,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;IACpF;;6DAEyD;IACzD,WAAW,CAAC,CAAC,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;IACjD,MAAM,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAAC;IAChC,UAAU,CAAC,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC;IAC3E,WAAW,CACT,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC9B,KAAK,EAAE,MAAM,EAAE,EACf,YAAY,CAAC,EAAE,MAAM,EAAE,GACtB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC5B"}
|
package/dist/index.d.ts
CHANGED
|
@@ -18,6 +18,7 @@ export * from "./module-context.js";
|
|
|
18
18
|
export * from "./resource-context.js";
|
|
19
19
|
export * from "./resource-instance.js";
|
|
20
20
|
export * from "./resource-manifest.js";
|
|
21
|
+
export * from "./contract-errors.js";
|
|
21
22
|
export * from "./invoke-error.js";
|
|
22
23
|
export * from "./log-record.js";
|
|
23
24
|
export * from "./log-sink.js";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,UAAU,CAAC;AACzB,cAAc,sBAAsB,CAAC;AACrC,cAAc,kBAAkB,CAAC;AACjC,cAAc,0BAA0B,CAAC;AACzC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,uBAAuB,CA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CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC;AACtC,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -18,6 +18,7 @@ export * from "./module-context.js";
|
|
|
18
18
|
export * from "./resource-context.js";
|
|
19
19
|
export * from "./resource-instance.js";
|
|
20
20
|
export * from "./resource-manifest.js";
|
|
21
|
+
export * from "./contract-errors.js";
|
|
21
22
|
export * from "./invoke-error.js";
|
|
22
23
|
export * from "./log-record.js";
|
|
23
24
|
export * from "./log-sink.js";
|
|
@@ -158,6 +158,28 @@ export interface ResourceContext extends ControllerContext {
|
|
|
158
158
|
* loader re-deriving the root from the entry URL. `undefined` mirrors
|
|
159
159
|
* `getEntryUrl()` (callers that bypass `Kernel.load()`). */
|
|
160
160
|
getInstallRoot(): string | undefined;
|
|
161
|
+
/**
|
|
162
|
+
* Resolve a module-relative reference — an `Http.Static` root, a template
|
|
163
|
+
* directory, a seed-data file — against the directory of the module that
|
|
164
|
+
* declared this resource, and return it as a **URI**.
|
|
165
|
+
*
|
|
166
|
+
* This is the sanctioned way to reach a file that ships with a module. Never
|
|
167
|
+
* derive one from `moduleContext.source` by hand: for a published module the
|
|
168
|
+
* manifest's own URL is not where its payload lives, and a `dirname` of it
|
|
169
|
+
* silently resolves against the process working directory instead — serving
|
|
170
|
+
* the wrong files rather than failing.
|
|
171
|
+
*
|
|
172
|
+
* A URI rather than a filesystem path because the SDK is cross-runtime: a path
|
|
173
|
+
* is only what a Node kernel happens to return for a module whose files are
|
|
174
|
+
* local. Callers that need a path convert with `fileURLToPath` after checking
|
|
175
|
+
* the scheme. A reference that already names its own location is not rebased: a
|
|
176
|
+
* URI with a scheme is returned unchanged, and a bare absolute filesystem path
|
|
177
|
+
* comes back as a `file://` URI.
|
|
178
|
+
*
|
|
179
|
+
* Asynchronous because a published module's assets are fetched on first
|
|
180
|
+
* access — a module whose files are never read never downloads them.
|
|
181
|
+
*/
|
|
182
|
+
resolveModuleFile(relative: string): Promise<string>;
|
|
161
183
|
/** Load a single module (its own file + `include`d partials). Use this when
|
|
162
184
|
* you need just the declaring file's manifests. */
|
|
163
185
|
loadModule(url: string, options?: LoadOptions): Promise<ResourceManifest[]>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resource-context.d.ts","sourceRoot":"","sources":["../src/resource-context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,aAAa,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACtG,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAExD,MAAM,WAAW,WAAW;IAC1B;gFAC4E;IAC5E,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;4EAGwE;IACxE,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B;AAED,MAAM,WA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AAM,GAAG,SAAS,CAAC;IAClC;;;;iEAI6D;IAC7D,cAAc,IAAI,MAAM,GAAG,SAAS,CAAC;IACrC;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,iBAAiB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IACrD;wDACoD;IACpD,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,gBAAgB,EAAE,CAAC,CAAC;IAC5E;;;sBAGkB;IAClB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,EAAE,CAAC,CAAC;IACxD;;;;;;;;;;;;OAYG;IACH,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB;;;;;;OAMG;IACH,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAC;IAC9B,QAAQ,CAAC,aAAa,EAAE,aAAa,CAAC;IACtC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC;IACjD,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,cAAc,CAAC;IACtC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC,cAAc,CAAC;IACvC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC,cAAc,CAAC;CACxC"}
|
package/dist/runtime-error.d.ts
CHANGED
|
@@ -5,7 +5,18 @@ export interface RuntimeDiagnostic {
|
|
|
5
5
|
kind?: string;
|
|
6
6
|
details?: string;
|
|
7
7
|
code?: string;
|
|
8
|
+
/** Set when this entry failed ONLY because another resource in the same
|
|
9
|
+
* failure set did — it carries no independent cause. Renderers collapse
|
|
10
|
+
* these into one line rather than repeating one failure per dependent. */
|
|
11
|
+
derived?: boolean;
|
|
12
|
+
/** When `derived`, the ROOT of the dependency chain — the resource a reader
|
|
13
|
+
* has to fix. Absent when the blocker could not be named. */
|
|
14
|
+
blockedBy?: string;
|
|
15
|
+
/** Diagnostics from a nested context (an import's own resource init), kept
|
|
16
|
+
* structured instead of flattened into `message` so the classification and
|
|
17
|
+
* the error count see the real leaves. */
|
|
18
|
+
children?: RuntimeDiagnostic[];
|
|
8
19
|
}
|
|
9
20
|
/** Well-known kernel error codes. User-defined codes (e.g. from Type.JsonSchema rules) are also valid. */
|
|
10
|
-
export type RuntimeErrorCode = "ERR_RESOURCE_NOT_FOUND" | "ERR_RESOURCE_NOT_RUNNABLE" | "ERR_CONTROLLER_NOT_FOUND" | "ERR_CONTROLLER_INVALID" | "ERR_RESOURCE_INITIALIZATION_FAILED" | "ERR_RESOURCE_NOT_INVOKABLE" | "ERR_RESOURCE_SCHEMA_VALIDATION_FAILED" | "ERR_DUPLICATE_RESOURCE" | "ERR_EXECUTION_FAILED" | "ERR_INVALID_VALUE" | "ERR_VISIBILITY_DENIED" | "ERR_MANIFEST_VALIDATION_FAILED" | "ERR_CIRCULAR_DEPENDENCY" | "ERR_SCOPE_RESOURCE_NOT_FOUND" | "ERR_TYPE_NOT_FOUND" | "ERR_TYPE_VALIDATION_FAILED" | "ERR_KERNEL_STATE_INVALID" | (string & {});
|
|
21
|
+
export type RuntimeErrorCode = "ERR_RESOURCE_NOT_FOUND" | "ERR_RESOURCE_NOT_RUNNABLE" | "ERR_CONTROLLER_NOT_FOUND" | "ERR_CONTROLLER_INVALID" | "ERR_RESOURCE_INITIALIZATION_FAILED" | "ERR_RESOURCE_NOT_INVOKABLE" | "ERR_RESOURCE_SCHEMA_VALIDATION_FAILED" | "ERR_DUPLICATE_RESOURCE" | "ERR_EXECUTION_FAILED" | "ERR_INVALID_VALUE" | "ERR_VISIBILITY_DENIED" | "ERR_MANIFEST_VALIDATION_FAILED" | "ERR_CIRCULAR_DEPENDENCY" | "ERR_SCOPE_RESOURCE_NOT_FOUND" | "ERR_TYPE_NOT_FOUND" | "ERR_TYPE_VALIDATION_FAILED" | "ERR_KERNEL_STATE_INVALID" | "ERR_LOCAL_REF_PENDING" | "ERR_CROSS_MODULE_REF_PENDING" | (string & {});
|
|
11
22
|
//# sourceMappingURL=runtime-error.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime-error.d.ts","sourceRoot":"","sources":["../src/runtime-error.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAC/B,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"runtime-error.d.ts","sourceRoot":"","sources":["../src/runtime-error.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAC/B,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;+EAE2E;IAC3E,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;kEAC8D;IAC9D,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;+CAE2C;IAC3C,QAAQ,CAAC,EAAE,iBAAiB,EAAE,CAAC;CAChC;AAED,0GAA0G;AAC1G,MAAM,MAAM,gBAAgB,GACxB,wBAAwB,GACxB,2BAA2B,GAC3B,0BAA0B,GAC1B,wBAAwB,GACxB,oCAAoC,GACpC,4BAA4B,GAC5B,uCAAuC,GACvC,wBAAwB,GACxB,sBAAsB,GACtB,mBAAmB,GACnB,uBAAuB,GACvB,gCAAgC,GAChC,yBAAyB,GACzB,8BAA8B,GAC9B,oBAAoB,GACpB,4BAA4B,GAC5B,0BAA0B,GAC1B,uBAAuB,GACvB,8BAA8B,GAC9B,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC"}
|
|
@@ -11,7 +11,22 @@
|
|
|
11
11
|
* pinned version is ever loaded, so the canonical id stays version-free.
|
|
12
12
|
*/
|
|
13
13
|
export declare const TELO_TYPE_SCHEME = "telo://";
|
|
14
|
-
/**
|
|
14
|
+
/**
|
|
15
|
+
* The canonical, alias-resolved id a named type schema is registered under.
|
|
16
|
+
*
|
|
17
|
+
* Authority-free (`telo:<module>/<type>`, not `telo://<module>/<type>`) because
|
|
18
|
+
* a JSON Schema validator has to RESOLVE it: AJV parses a `$ref` as a
|
|
19
|
+
* URI-reference against the document base, and a non-standard scheme carrying an
|
|
20
|
+
* authority resolves to nothing — a schema registered under `telo://M/T` cannot
|
|
21
|
+
* be referenced by `$ref: "telo://M/T"` no matter how it is registered, while the
|
|
22
|
+
* authority-free form resolves natively. Nothing enforced this before because no
|
|
23
|
+
* runtime path ever compiled a `$ref`-bearing contract; the invocation contract
|
|
24
|
+
* does, on every declaring kind.
|
|
25
|
+
*
|
|
26
|
+
* This is the INTERNAL id only. Authors keep writing the readable authority form
|
|
27
|
+
* (`telo://Self/<type>`, `telo://<Alias>/<type>`) — see {@link parseTeloTypeRef} —
|
|
28
|
+
* and the loader rewrites it to this. Published manifests are unaffected.
|
|
29
|
+
*/
|
|
15
30
|
export declare function canonicalTypeSchemaId(moduleName: string, typeName: string): string;
|
|
16
31
|
/**
|
|
17
32
|
* Resolve `extends` into a single self-contained object schema by deep-merging an
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"type-schema-ref.d.ts","sourceRoot":"","sources":["../src/type-schema-ref.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,eAAO,MAAM,gBAAgB,YAAY,CAAC;AAE1C
|
|
1
|
+
{"version":3,"file":"type-schema-ref.d.ts","sourceRoot":"","sources":["../src/type-schema-ref.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,eAAO,MAAM,gBAAgB,YAAY,CAAC;AAE1C;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,qBAAqB,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAElF;AAiBD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,GACjC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAqCzB;AAED,0EAA0E;AAC1E,MAAM,WAAW,WAAW;IAC1B,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,OAAO,GAAG,WAAW,GAAG,IAAI,CAKjE"}
|
package/dist/type-schema-ref.js
CHANGED
|
@@ -11,9 +11,24 @@
|
|
|
11
11
|
* pinned version is ever loaded, so the canonical id stays version-free.
|
|
12
12
|
*/
|
|
13
13
|
export const TELO_TYPE_SCHEME = "telo://";
|
|
14
|
-
/**
|
|
14
|
+
/**
|
|
15
|
+
* The canonical, alias-resolved id a named type schema is registered under.
|
|
16
|
+
*
|
|
17
|
+
* Authority-free (`telo:<module>/<type>`, not `telo://<module>/<type>`) because
|
|
18
|
+
* a JSON Schema validator has to RESOLVE it: AJV parses a `$ref` as a
|
|
19
|
+
* URI-reference against the document base, and a non-standard scheme carrying an
|
|
20
|
+
* authority resolves to nothing — a schema registered under `telo://M/T` cannot
|
|
21
|
+
* be referenced by `$ref: "telo://M/T"` no matter how it is registered, while the
|
|
22
|
+
* authority-free form resolves natively. Nothing enforced this before because no
|
|
23
|
+
* runtime path ever compiled a `$ref`-bearing contract; the invocation contract
|
|
24
|
+
* does, on every declaring kind.
|
|
25
|
+
*
|
|
26
|
+
* This is the INTERNAL id only. Authors keep writing the readable authority form
|
|
27
|
+
* (`telo://Self/<type>`, `telo://<Alias>/<type>`) — see {@link parseTeloTypeRef} —
|
|
28
|
+
* and the loader rewrites it to this. Published manifests are unaffected.
|
|
29
|
+
*/
|
|
15
30
|
export function canonicalTypeSchemaId(moduleName, typeName) {
|
|
16
|
-
return
|
|
31
|
+
return `telo:${moduleName}/${typeName}`;
|
|
17
32
|
}
|
|
18
33
|
/** Top-level keywords merged structurally rather than copied wholesale when
|
|
19
34
|
* resolving `extends`: object shape (`properties` / `required` /
|
package/package.json
CHANGED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The ambient kernel error union: codes any dispatch can raise because the
|
|
3
|
+
* kernel — not the kind's controller — enforces the invocation contract.
|
|
4
|
+
*
|
|
5
|
+
* They are **catchable**: a `catches:` entry may name one and its `when:` is
|
|
6
|
+
* validated against this set, so a typo is caught statically like any declared
|
|
7
|
+
* code. They are **excluded from coverage counting**: the completeness rule
|
|
8
|
+
* keeps counting only a kind's own `throws:` codes. Folding them into every
|
|
9
|
+
* union instead would make every bounded `catches:` block in the standard
|
|
10
|
+
* library incomplete overnight; making them uncatchable would leave an author no
|
|
11
|
+
* way to handle a contract violation they can legitimately recover from.
|
|
12
|
+
*
|
|
13
|
+
* Shared by the kernel (which raises them), the analyzer (which type-checks
|
|
14
|
+
* `catches:` against them) and module authors (who name them in a catch).
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
/** Inputs did not satisfy the target's declared `inputType`. */
|
|
18
|
+
export const ERR_INPUT_INVALID = "ERR_INPUT_INVALID";
|
|
19
|
+
|
|
20
|
+
/** A result did not satisfy the target's declared `outputType`. */
|
|
21
|
+
export const ERR_OUTPUT_INVALID = "ERR_OUTPUT_INVALID";
|
|
22
|
+
|
|
23
|
+
/** A declared contract could not be resolved to a schema — a named type that
|
|
24
|
+
* never registered. Distinct from a value violation: nothing is wrong with the
|
|
25
|
+
* data, the contract itself is unusable, and enforcement must fail rather than
|
|
26
|
+
* quietly switch itself off. */
|
|
27
|
+
export const ERR_CONTRACT_UNRESOLVABLE = "ERR_CONTRACT_UNRESOLVABLE";
|
|
28
|
+
|
|
29
|
+
export const AMBIENT_CONTRACT_ERROR_CODES = [
|
|
30
|
+
ERR_INPUT_INVALID,
|
|
31
|
+
ERR_OUTPUT_INVALID,
|
|
32
|
+
ERR_CONTRACT_UNRESOLVABLE,
|
|
33
|
+
] as const;
|
|
34
|
+
|
|
35
|
+
export type AmbientContractErrorCode = (typeof AMBIENT_CONTRACT_ERROR_CODES)[number];
|
|
36
|
+
|
|
37
|
+
const AMBIENT = new Set<string>(AMBIENT_CONTRACT_ERROR_CODES);
|
|
38
|
+
|
|
39
|
+
/** True when a code is raised by the kernel's contract enforcement rather than
|
|
40
|
+
* declared by a kind. Callers use it to accept the code in a `catches:` entry
|
|
41
|
+
* without counting it toward that kind's declared union. */
|
|
42
|
+
export function isAmbientContractErrorCode(code: string): boolean {
|
|
43
|
+
return AMBIENT.has(code);
|
|
44
|
+
}
|
|
@@ -67,11 +67,18 @@ export type InstanceFactory = (
|
|
|
67
67
|
* registered in this context but not yet initialized. Injection uses it
|
|
68
68
|
* to defer a resource whose dependency exists but hasn't inited yet —
|
|
69
69
|
* rather than leaving the slot unresolved — so the init loop retries it.
|
|
70
|
+
* @param owner The context that OWNS this resource — the module context for a top-level
|
|
71
|
+
* resource, the per-run scope child for a `with:`-scoped one. Anything the
|
|
72
|
+
* hook builds on the resource's behalf (notably a scope handle for an
|
|
73
|
+
* `x-telo-scope` field) must hang off this, not off the root: the inline
|
|
74
|
+
* declarations inside a scope name kinds through the import aliases of the
|
|
75
|
+
* module that DECLARED them, which the root context has never heard of.
|
|
70
76
|
*/
|
|
71
77
|
export type PreInitHook = (
|
|
72
78
|
resource: ResourceManifest,
|
|
73
79
|
getInstance: (name: string, alias?: string) => ResourceInstance | undefined,
|
|
74
|
-
isPending
|
|
80
|
+
isPending: ((name: string) => boolean) | undefined,
|
|
81
|
+
owner: EvaluationContext,
|
|
75
82
|
) => void;
|
|
76
83
|
|
|
77
84
|
/** Canonical key for a resource instance: "<module>.<kind>.<name>" */
|
package/src/index.ts
CHANGED
|
@@ -18,6 +18,7 @@ export * from "./module-context.js";
|
|
|
18
18
|
export * from "./resource-context.js";
|
|
19
19
|
export * from "./resource-instance.js";
|
|
20
20
|
export * from "./resource-manifest.js";
|
|
21
|
+
export * from "./contract-errors.js";
|
|
21
22
|
export * from "./invoke-error.js";
|
|
22
23
|
export * from "./log-record.js";
|
|
23
24
|
export * from "./log-sink.js";
|
package/src/resource-context.ts
CHANGED
|
@@ -175,6 +175,28 @@ export interface ResourceContext extends ControllerContext {
|
|
|
175
175
|
* loader re-deriving the root from the entry URL. `undefined` mirrors
|
|
176
176
|
* `getEntryUrl()` (callers that bypass `Kernel.load()`). */
|
|
177
177
|
getInstallRoot(): string | undefined;
|
|
178
|
+
/**
|
|
179
|
+
* Resolve a module-relative reference — an `Http.Static` root, a template
|
|
180
|
+
* directory, a seed-data file — against the directory of the module that
|
|
181
|
+
* declared this resource, and return it as a **URI**.
|
|
182
|
+
*
|
|
183
|
+
* This is the sanctioned way to reach a file that ships with a module. Never
|
|
184
|
+
* derive one from `moduleContext.source` by hand: for a published module the
|
|
185
|
+
* manifest's own URL is not where its payload lives, and a `dirname` of it
|
|
186
|
+
* silently resolves against the process working directory instead — serving
|
|
187
|
+
* the wrong files rather than failing.
|
|
188
|
+
*
|
|
189
|
+
* A URI rather than a filesystem path because the SDK is cross-runtime: a path
|
|
190
|
+
* is only what a Node kernel happens to return for a module whose files are
|
|
191
|
+
* local. Callers that need a path convert with `fileURLToPath` after checking
|
|
192
|
+
* the scheme. A reference that already names its own location is not rebased: a
|
|
193
|
+
* URI with a scheme is returned unchanged, and a bare absolute filesystem path
|
|
194
|
+
* comes back as a `file://` URI.
|
|
195
|
+
*
|
|
196
|
+
* Asynchronous because a published module's assets are fetched on first
|
|
197
|
+
* access — a module whose files are never read never downloads them.
|
|
198
|
+
*/
|
|
199
|
+
resolveModuleFile(relative: string): Promise<string>;
|
|
178
200
|
/** Load a single module (its own file + `include`d partials). Use this when
|
|
179
201
|
* you need just the declaring file's manifests. */
|
|
180
202
|
loadModule(url: string, options?: LoadOptions): Promise<ResourceManifest[]>;
|
package/src/runtime-error.ts
CHANGED
|
@@ -5,6 +5,17 @@ export interface RuntimeDiagnostic {
|
|
|
5
5
|
kind?: string;
|
|
6
6
|
details?: string;
|
|
7
7
|
code?: string;
|
|
8
|
+
/** Set when this entry failed ONLY because another resource in the same
|
|
9
|
+
* failure set did — it carries no independent cause. Renderers collapse
|
|
10
|
+
* these into one line rather than repeating one failure per dependent. */
|
|
11
|
+
derived?: boolean;
|
|
12
|
+
/** When `derived`, the ROOT of the dependency chain — the resource a reader
|
|
13
|
+
* has to fix. Absent when the blocker could not be named. */
|
|
14
|
+
blockedBy?: string;
|
|
15
|
+
/** Diagnostics from a nested context (an import's own resource init), kept
|
|
16
|
+
* structured instead of flattened into `message` so the classification and
|
|
17
|
+
* the error count see the real leaves. */
|
|
18
|
+
children?: RuntimeDiagnostic[];
|
|
8
19
|
}
|
|
9
20
|
|
|
10
21
|
/** Well-known kernel error codes. User-defined codes (e.g. from Type.JsonSchema rules) are also valid. */
|
|
@@ -26,4 +37,6 @@ export type RuntimeErrorCode =
|
|
|
26
37
|
| "ERR_TYPE_NOT_FOUND"
|
|
27
38
|
| "ERR_TYPE_VALIDATION_FAILED"
|
|
28
39
|
| "ERR_KERNEL_STATE_INVALID"
|
|
40
|
+
| "ERR_LOCAL_REF_PENDING"
|
|
41
|
+
| "ERR_CROSS_MODULE_REF_PENDING"
|
|
29
42
|
| (string & {});
|
package/src/type-schema-ref.ts
CHANGED
|
@@ -13,9 +13,24 @@
|
|
|
13
13
|
|
|
14
14
|
export const TELO_TYPE_SCHEME = "telo://";
|
|
15
15
|
|
|
16
|
-
/**
|
|
16
|
+
/**
|
|
17
|
+
* The canonical, alias-resolved id a named type schema is registered under.
|
|
18
|
+
*
|
|
19
|
+
* Authority-free (`telo:<module>/<type>`, not `telo://<module>/<type>`) because
|
|
20
|
+
* a JSON Schema validator has to RESOLVE it: AJV parses a `$ref` as a
|
|
21
|
+
* URI-reference against the document base, and a non-standard scheme carrying an
|
|
22
|
+
* authority resolves to nothing — a schema registered under `telo://M/T` cannot
|
|
23
|
+
* be referenced by `$ref: "telo://M/T"` no matter how it is registered, while the
|
|
24
|
+
* authority-free form resolves natively. Nothing enforced this before because no
|
|
25
|
+
* runtime path ever compiled a `$ref`-bearing contract; the invocation contract
|
|
26
|
+
* does, on every declaring kind.
|
|
27
|
+
*
|
|
28
|
+
* This is the INTERNAL id only. Authors keep writing the readable authority form
|
|
29
|
+
* (`telo://Self/<type>`, `telo://<Alias>/<type>`) — see {@link parseTeloTypeRef} —
|
|
30
|
+
* and the loader rewrites it to this. Published manifests are unaffected.
|
|
31
|
+
*/
|
|
17
32
|
export function canonicalTypeSchemaId(moduleName: string, typeName: string): string {
|
|
18
|
-
return
|
|
33
|
+
return `telo:${moduleName}/${typeName}`;
|
|
19
34
|
}
|
|
20
35
|
|
|
21
36
|
/** Top-level keywords merged structurally rather than copied wholesale when
|