@telorun/analyzer 0.29.0 → 0.30.1
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/cel-environment.d.ts +2 -2
- package/dist/cel-environment.d.ts.map +1 -1
- package/dist/cel-environment.js +5 -6
- package/dist/definition-registry.d.ts.map +1 -1
- package/dist/definition-registry.js +11 -2
- package/dist/kernel-globals.d.ts +6 -7
- package/dist/kernel-globals.d.ts.map +1 -1
- package/dist/kernel-globals.js +6 -8
- package/dist/reconcile-module-versions.d.ts.map +1 -1
- package/dist/reconcile-module-versions.js +4 -9
- package/package.json +1 -1
- package/src/cel-environment.ts +5 -6
- package/src/definition-registry.ts +13 -2
- package/src/kernel-globals.ts +6 -8
- package/src/reconcile-module-versions.ts +4 -10
|
@@ -7,7 +7,7 @@ export type { CelHandlers } from "@telorun/templating";
|
|
|
7
7
|
*
|
|
8
8
|
* - `variables`: typed from the manifest's `variables` field if it is a schema map
|
|
9
9
|
* (only module-identity docs — `Telo.Application` / `Telo.Library` — carry this); otherwise registered as `map` (dyn).
|
|
10
|
-
* - `secrets`, `resources
|
|
10
|
+
* - `secrets`, `resources`: always `map` (dyn — output schemas unknown).
|
|
11
11
|
* - `extraContextSchema`: additional variables from an `x-telo-context` annotation.
|
|
12
12
|
*
|
|
13
13
|
* NOTE: The set of kernel globals registered here must match `KERNEL_GLOBAL_NAMES`
|
|
@@ -17,7 +17,7 @@ export declare function buildTypedCelEnvironment(baseEnv: Environment, manifest:
|
|
|
17
17
|
*
|
|
18
18
|
* Import inputs are a config-only contract: their expressions are evaluated
|
|
19
19
|
* against the IMPORTING module's `variables`/`secrets`, never the import's own
|
|
20
|
-
* values map (the bug) nor the imported child's. `resources
|
|
20
|
+
* values map (the bug) nor the imported child's. `resources` and `ports`
|
|
21
21
|
* are registered as empty typed objects, so referencing them is a "No such key"
|
|
22
22
|
* error that steers authors to a typed `variables` entry. */
|
|
23
23
|
export declare function buildImportInputCelEnvironment(baseEnv: Environment, moduleManifest: ResourceManifest | undefined): Environment;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cel-environment.d.ts","sourceRoot":"","sources":["../src/cel-environment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAUrD,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC1D,YAAY,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAEvD;;;;;;;;;uEASuE;AACvE,wBAAgB,wBAAwB,CACtC,OAAO,EAAE,WAAW,EACpB,QAAQ,EAAE,gBAAgB,EAC1B,kBAAkB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,EAI/C,kBAAkB,CAAC,EAAE,gBAAgB,GACpC,WAAW,
|
|
1
|
+
{"version":3,"file":"cel-environment.d.ts","sourceRoot":"","sources":["../src/cel-environment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAUrD,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC1D,YAAY,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAEvD;;;;;;;;;uEASuE;AACvE,wBAAgB,wBAAwB,CACtC,OAAO,EAAE,WAAW,EACpB,QAAQ,EAAE,gBAAgB,EAC1B,kBAAkB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,EAI/C,kBAAkB,CAAC,EAAE,gBAAgB,GACpC,WAAW,CAsEb;AAuBD;;;;;;8DAM8D;AAC9D,wBAAgB,8BAA8B,CAC5C,OAAO,EAAE,WAAW,EACpB,cAAc,EAAE,gBAAgB,GAAG,SAAS,GAC3C,WAAW,CAwBb"}
|
package/dist/cel-environment.js
CHANGED
|
@@ -11,7 +11,7 @@ export { buildCelEnvironment } from "@telorun/templating";
|
|
|
11
11
|
*
|
|
12
12
|
* - `variables`: typed from the manifest's `variables` field if it is a schema map
|
|
13
13
|
* (only module-identity docs — `Telo.Application` / `Telo.Library` — carry this); otherwise registered as `map` (dyn).
|
|
14
|
-
* - `secrets`, `resources
|
|
14
|
+
* - `secrets`, `resources`: always `map` (dyn — output schemas unknown).
|
|
15
15
|
* - `extraContextSchema`: additional variables from an `x-telo-context` annotation.
|
|
16
16
|
*
|
|
17
17
|
* NOTE: The set of kernel globals registered here must match `KERNEL_GLOBAL_NAMES`
|
|
@@ -71,7 +71,6 @@ rootModuleManifest) {
|
|
|
71
71
|
}
|
|
72
72
|
env.registerVariable("secrets", "map");
|
|
73
73
|
env.registerVariable("resources", "map");
|
|
74
|
-
env.registerVariable("env", "map");
|
|
75
74
|
if (extraContextSchema?.properties) {
|
|
76
75
|
for (const [name, propSchema] of Object.entries(extraContextSchema.properties)) {
|
|
77
76
|
if (!env.hasVariable(name)) {
|
|
@@ -104,7 +103,7 @@ function registerConfigNamespace(env, block, name) {
|
|
|
104
103
|
*
|
|
105
104
|
* Import inputs are a config-only contract: their expressions are evaluated
|
|
106
105
|
* against the IMPORTING module's `variables`/`secrets`, never the import's own
|
|
107
|
-
* values map (the bug) nor the imported child's. `resources
|
|
106
|
+
* values map (the bug) nor the imported child's. `resources` and `ports`
|
|
108
107
|
* are registered as empty typed objects, so referencing them is a "No such key"
|
|
109
108
|
* error that steers authors to a typed `variables` entry. */
|
|
110
109
|
export function buildImportInputCelEnvironment(baseEnv, moduleManifest) {
|
|
@@ -125,10 +124,10 @@ export function buildImportInputCelEnvironment(baseEnv, moduleManifest) {
|
|
|
125
124
|
env.registerVariable("variables", "map");
|
|
126
125
|
env.registerVariable("secrets", "map");
|
|
127
126
|
}
|
|
128
|
-
// Override the base env's dyn `resources`/`
|
|
129
|
-
// so any access (`resources.X`, `
|
|
127
|
+
// Override the base env's dyn `resources`/`ports` with empty typed objects
|
|
128
|
+
// so any access (`resources.X`, `ports.X`) is a "No such key" error — these
|
|
130
129
|
// surfaces are not part of the config-only import contract.
|
|
131
|
-
for (const name of ["resources", "
|
|
130
|
+
for (const name of ["resources", "ports"]) {
|
|
132
131
|
env.registerVariable({ name, schema: {} });
|
|
133
132
|
}
|
|
134
133
|
return env;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"definition-registry.d.ts","sourceRoot":"","sources":["../src/definition-registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AACzE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEzD,OAAO,EAIL,KAAK,iBAAiB,EACvB,MAAM,0BAA0B,CAAC;AAGlC,+EAA+E;AAC/E,qBAAa,kBAAkB;;IAK7B;;sFAEkF;IAClF,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAe;IACnC,OAAO,CAAC,QAAQ,CAAC,mBAAmB,CAAqB;IAEzD,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAyC;IAC9D,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAwC;IAClE,mEAAmE;IACnE,OAAO,CAAC,QAAQ,CAAC,UAAU,CAA+B;IAC1D;6DACyD;IACzD,OAAO,CAAC,QAAQ,CAAC,WAAW,CAA6B;IACzD;;0EAEsE;IACtE,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAA6B;IAEhE,QAAQ,CAAC,UAAU,EAAE,kBAAkB,GAAG,IAAI;IAiC9C,OAAO,CAAC,aAAa;IASrB;;;yFAGqF;IACrF,sBAAsB,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,EAAE,UAAU,EAAE,MAAM,GAAG,IAAI;IA+B1E;;;;iFAI6E;IAC7E,uBAAuB,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,MA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CAAC,iBAAiB;IAczB;;;;;;;;4FAQwF;IACxF,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IAUhD,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,kBAAkB,GAAG,SAAS;IAIrD,+FAA+F;IAC/F,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,iBAAiB,GAAG,SAAS;IAIxD,gGAAgG;IAChG,kBAAkB,CAChB,IAAI,EAAE,MAAM,EACZ,OAAO,CAAC,EAAE;QAAE,WAAW,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAA;KAAE,GACvD,iBAAiB,GAAG,SAAS;IAOhC;;;;;;;;qFAQiF;IACjF,2BAA2B,CACzB,QAAQ,EAAE,gBAAgB,EAC1B,OAAO,EAAE,aAAa,EACtB,eAAe,EAAE,GAAG,CAAC,MAAM,EAAE,aAAa,CAAC,GAC1C,iBAAiB,GAAG,SAAS;IAkChC,OAAO,CAAC,uBAAuB;IA+B/B;;qEAEiE;IACjE,YAAY,CAAC,YAAY,EAAE,MAAM,GAAG,kBAAkB,EAAE;IAgBxD,KAAK,IAAI,MAAM,EAAE;CAGlB"}
|
|
@@ -208,11 +208,20 @@ export class DefinitionRegistry {
|
|
|
208
208
|
* anchors depend on a sibling property at runtime and stay unexpanded; the
|
|
209
209
|
* analyzer's reference validation phase already flags the cases that matter. */
|
|
210
210
|
expandedFieldMapForResource(resource, aliases, aliasesByModule) {
|
|
211
|
-
|
|
211
|
+
// Resolve the resource's OWN kind through its module's alias scope, not the global
|
|
212
|
+
// aliases. A library-internal resource's kind uses a library-local alias
|
|
213
|
+
// (e.g. `Ai.AgentStream` in a library that imports `Ai`), which the root/global
|
|
214
|
+
// resolver doesn't know — using the global scope here left the base field map
|
|
215
|
+
// unresolved, so Phase-5 injection saw no ref fields and skipped injection.
|
|
216
|
+
const ownModule = resource.metadata?.module;
|
|
217
|
+
const moduleScope = (ownModule ? aliasesByModule.get(ownModule) : undefined) ?? aliases;
|
|
218
|
+
const baseMap = this.getFieldMapForKind(resource.kind, moduleScope);
|
|
212
219
|
if (!baseMap)
|
|
213
220
|
return undefined;
|
|
214
|
-
const resolvedKind =
|
|
221
|
+
const resolvedKind = moduleScope.resolveKind(resource.kind) ?? resource.kind;
|
|
215
222
|
const def = this.resolve(resource.kind) ?? this.resolve(resolvedKind);
|
|
223
|
+
// schema-from anchors resolve in the DEFINITION's module scope (where the anchor
|
|
224
|
+
// kind is declared), which may differ from the resource's own module.
|
|
216
225
|
const ownerModule = def?.metadata?.module;
|
|
217
226
|
const ownerScope = (ownerModule ? aliasesByModule.get(ownerModule) : undefined) ?? aliases;
|
|
218
227
|
const expanded = new Map();
|
package/dist/kernel-globals.d.ts
CHANGED
|
@@ -5,12 +5,12 @@ import type { ResourceManifest } from "@telorun/sdk";
|
|
|
5
5
|
* `buildTypedCelEnvironment` in cel-environment.ts (CEL type-checking)
|
|
6
6
|
* must stay in sync with this list.
|
|
7
7
|
*
|
|
8
|
-
* Note:
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
8
|
+
* Note: there is no `imports` namespace at runtime — import snapshots are
|
|
9
|
+
* stored under `resources.<alias>`. Host environment variables are reached
|
|
10
|
+
* by declaring a typed `variables:`/`secrets:` entry with an `env:` binding
|
|
11
|
+
* and referencing `variables.X` / `secrets.X`.
|
|
12
12
|
*/
|
|
13
|
-
export declare const KERNEL_GLOBAL_NAMES: readonly ["variables", "secrets", "resources", "ports"
|
|
13
|
+
export declare const KERNEL_GLOBAL_NAMES: readonly ["variables", "secrets", "resources", "ports"];
|
|
14
14
|
/**
|
|
15
15
|
* Build a typed JSON Schema describing the kernel globals available in the
|
|
16
16
|
* given manifest set. Used to merge into `x-telo-context` schemas so that
|
|
@@ -23,12 +23,11 @@ export declare const KERNEL_GLOBAL_NAMES: readonly ["variables", "secrets", "res
|
|
|
23
23
|
* in the outer module; Libraries are only relevant when the caller scoped
|
|
24
24
|
* the manifest list to a single library's file.
|
|
25
25
|
* - `resources`: enumerates all non-system resource names
|
|
26
|
-
* - `env`: dynamic (runtime env vars, root module only)
|
|
27
26
|
*/
|
|
28
27
|
export declare function buildKernelGlobalsSchema(manifests: ResourceManifest[]): Record<string, any>;
|
|
29
28
|
/**
|
|
30
29
|
* Merge kernel globals into an `x-telo-context` schema so chain-access
|
|
31
|
-
* validation recognises `variables`, `secrets`, `resources`, `
|
|
30
|
+
* validation recognises `variables`, `secrets`, `resources`, `ports`
|
|
32
31
|
* without module authors having to re-declare them.
|
|
33
32
|
*
|
|
34
33
|
* Context-specific properties take precedence over globals (spread order).
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kernel-globals.d.ts","sourceRoot":"","sources":["../src/kernel-globals.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAGrD;;;;;;;;;;GAUG;AACH,eAAO,MAAM,mBAAmB,
|
|
1
|
+
{"version":3,"file":"kernel-globals.d.ts","sourceRoot":"","sources":["../src/kernel-globals.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAGrD;;;;;;;;;;GAUG;AACH,eAAO,MAAM,mBAAmB,yDAA0D,CAAC;AAS3F;;;;;;;;;;;;GAYG;AACH,wBAAgB,wBAAwB,CACtC,SAAS,EAAE,gBAAgB,EAAE,GAC5B,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAiCrB;AA4CD;;;;;;;GAOG;AACH,wBAAgB,6BAA6B,CAC3C,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAClC,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GACjC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CASrB"}
|
package/dist/kernel-globals.js
CHANGED
|
@@ -5,12 +5,12 @@ import { residualEntrySchemaMap } from "./residual-schema.js";
|
|
|
5
5
|
* `buildTypedCelEnvironment` in cel-environment.ts (CEL type-checking)
|
|
6
6
|
* must stay in sync with this list.
|
|
7
7
|
*
|
|
8
|
-
* Note:
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
8
|
+
* Note: there is no `imports` namespace at runtime — import snapshots are
|
|
9
|
+
* stored under `resources.<alias>`. Host environment variables are reached
|
|
10
|
+
* by declaring a typed `variables:`/`secrets:` entry with an `env:` binding
|
|
11
|
+
* and referencing `variables.X` / `secrets.X`.
|
|
12
12
|
*/
|
|
13
|
-
export const KERNEL_GLOBAL_NAMES = ["variables", "secrets", "resources", "ports"
|
|
13
|
+
export const KERNEL_GLOBAL_NAMES = ["variables", "secrets", "resources", "ports"];
|
|
14
14
|
const SYSTEM_KINDS = new Set([
|
|
15
15
|
"Telo.Definition",
|
|
16
16
|
"Telo.Application",
|
|
@@ -29,7 +29,6 @@ const SYSTEM_KINDS = new Set([
|
|
|
29
29
|
* in the outer module; Libraries are only relevant when the caller scoped
|
|
30
30
|
* the manifest list to a single library's file.
|
|
31
31
|
* - `resources`: enumerates all non-system resource names
|
|
32
|
-
* - `env`: dynamic (runtime env vars, root module only)
|
|
33
32
|
*/
|
|
34
33
|
export function buildKernelGlobalsSchema(manifests) {
|
|
35
34
|
const moduleManifest = manifests.find((m) => m.kind === "Telo.Application") ??
|
|
@@ -56,7 +55,6 @@ export function buildKernelGlobalsSchema(manifests) {
|
|
|
56
55
|
additionalProperties: false,
|
|
57
56
|
},
|
|
58
57
|
ports: buildPortsSchema(moduleManifest?.ports),
|
|
59
|
-
env: { type: "object", additionalProperties: true },
|
|
60
58
|
},
|
|
61
59
|
};
|
|
62
60
|
}
|
|
@@ -98,7 +96,7 @@ function buildSchemaMapSchema(schemaMap) {
|
|
|
98
96
|
}
|
|
99
97
|
/**
|
|
100
98
|
* Merge kernel globals into an `x-telo-context` schema so chain-access
|
|
101
|
-
* validation recognises `variables`, `secrets`, `resources`, `
|
|
99
|
+
* validation recognises `variables`, `secrets`, `resources`, `ports`
|
|
102
100
|
* without module authors having to re-declare them.
|
|
103
101
|
*
|
|
104
102
|
* Context-specific properties take precedence over globals (spread order).
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reconcile-module-versions.d.ts","sourceRoot":"","sources":["../src/reconcile-module-versions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAElE,OAAO,EAAsB,KAAK,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAIzE;;;;0CAI0C;AAC1C,MAAM,WAAW,qBAAqB;IACpC,gEAAgE;IAChE,SAAS,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC/B;2EACuE;IACvE,WAAW,EAAE,kBAAkB,EAAE,CAAC;CACnC;
|
|
1
|
+
{"version":3,"file":"reconcile-module-versions.d.ts","sourceRoot":"","sources":["../src/reconcile-module-versions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAElE,OAAO,EAAsB,KAAK,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAIzE;;;;0CAI0C;AAC1C,MAAM,WAAW,qBAAqB;IACpC,gEAAgE;IAChE,SAAS,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC/B;2EACuE;IACvE,WAAW,EAAE,kBAAkB,EAAE,CAAC;CACnC;AAwKD;;;;;;;;GAQG;AACH,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,YAAY,CAAC,EAClC,WAAW,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC,GAChD,qBAAqB,CAiDvB"}
|
|
@@ -148,15 +148,10 @@ function hoistDiagnostic(identity, importerSource, alias, loser, winner, conflic
|
|
|
148
148
|
data,
|
|
149
149
|
};
|
|
150
150
|
}
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
message: `Module '${identity}@${loser.version || "<unknown>"}' was hoisted to '${winner.version}' ` +
|
|
156
|
-
`because the same module is imported at the higher version elsewhere in the graph. ` +
|
|
157
|
-
`Pre-1.0 versions are additive, so the higher version is used for every importer.`,
|
|
158
|
-
data,
|
|
159
|
-
};
|
|
151
|
+
// Same-major hoist to a higher version: additive pre-1.0, so the redirect is
|
|
152
|
+
// non-lossy and by design — resolve to the winner silently, like a package
|
|
153
|
+
// manager picking the highest compatible version of a transitive dep.
|
|
154
|
+
return null;
|
|
160
155
|
}
|
|
161
156
|
/**
|
|
162
157
|
* Reconcile a loaded import graph so each module identity (`namespace/name`)
|
package/package.json
CHANGED
package/src/cel-environment.ts
CHANGED
|
@@ -17,7 +17,7 @@ export type { CelHandlers } from "@telorun/templating";
|
|
|
17
17
|
*
|
|
18
18
|
* - `variables`: typed from the manifest's `variables` field if it is a schema map
|
|
19
19
|
* (only module-identity docs — `Telo.Application` / `Telo.Library` — carry this); otherwise registered as `map` (dyn).
|
|
20
|
-
* - `secrets`, `resources
|
|
20
|
+
* - `secrets`, `resources`: always `map` (dyn — output schemas unknown).
|
|
21
21
|
* - `extraContextSchema`: additional variables from an `x-telo-context` annotation.
|
|
22
22
|
*
|
|
23
23
|
* NOTE: The set of kernel globals registered here must match `KERNEL_GLOBAL_NAMES`
|
|
@@ -85,7 +85,6 @@ export function buildTypedCelEnvironment(
|
|
|
85
85
|
|
|
86
86
|
env.registerVariable("secrets", "map");
|
|
87
87
|
env.registerVariable("resources", "map");
|
|
88
|
-
env.registerVariable("env", "map");
|
|
89
88
|
|
|
90
89
|
if (extraContextSchema?.properties) {
|
|
91
90
|
for (const [name, propSchema] of Object.entries(
|
|
@@ -128,7 +127,7 @@ function registerConfigNamespace(
|
|
|
128
127
|
*
|
|
129
128
|
* Import inputs are a config-only contract: their expressions are evaluated
|
|
130
129
|
* against the IMPORTING module's `variables`/`secrets`, never the import's own
|
|
131
|
-
* values map (the bug) nor the imported child's. `resources
|
|
130
|
+
* values map (the bug) nor the imported child's. `resources` and `ports`
|
|
132
131
|
* are registered as empty typed objects, so referencing them is a "No such key"
|
|
133
132
|
* error that steers authors to a typed `variables` entry. */
|
|
134
133
|
export function buildImportInputCelEnvironment(
|
|
@@ -151,10 +150,10 @@ export function buildImportInputCelEnvironment(
|
|
|
151
150
|
env.registerVariable("variables", "map");
|
|
152
151
|
env.registerVariable("secrets", "map");
|
|
153
152
|
}
|
|
154
|
-
// Override the base env's dyn `resources`/`
|
|
155
|
-
// so any access (`resources.X`, `
|
|
153
|
+
// Override the base env's dyn `resources`/`ports` with empty typed objects
|
|
154
|
+
// so any access (`resources.X`, `ports.X`) is a "No such key" error — these
|
|
156
155
|
// surfaces are not part of the config-only import contract.
|
|
157
|
-
for (const name of ["resources", "
|
|
156
|
+
for (const name of ["resources", "ports"]) {
|
|
158
157
|
(env as any).registerVariable({ name, schema: {} });
|
|
159
158
|
}
|
|
160
159
|
return env;
|
|
@@ -234,11 +234,22 @@ export class DefinitionRegistry {
|
|
|
234
234
|
aliases: AliasResolver,
|
|
235
235
|
aliasesByModule: Map<string, AliasResolver>,
|
|
236
236
|
): ReferenceFieldMap | undefined {
|
|
237
|
-
|
|
237
|
+
// Resolve the resource's OWN kind through its module's alias scope, not the global
|
|
238
|
+
// aliases. A library-internal resource's kind uses a library-local alias
|
|
239
|
+
// (e.g. `Ai.AgentStream` in a library that imports `Ai`), which the root/global
|
|
240
|
+
// resolver doesn't know — using the global scope here left the base field map
|
|
241
|
+
// unresolved, so Phase-5 injection saw no ref fields and skipped injection.
|
|
242
|
+
const ownModule = (resource.metadata as { module?: string } | undefined)?.module;
|
|
243
|
+
const moduleScope =
|
|
244
|
+
(ownModule ? aliasesByModule.get(ownModule) : undefined) ?? aliases;
|
|
245
|
+
|
|
246
|
+
const baseMap = this.getFieldMapForKind(resource.kind, moduleScope);
|
|
238
247
|
if (!baseMap) return undefined;
|
|
239
248
|
|
|
240
|
-
const resolvedKind =
|
|
249
|
+
const resolvedKind = moduleScope.resolveKind(resource.kind) ?? resource.kind;
|
|
241
250
|
const def = this.resolve(resource.kind) ?? this.resolve(resolvedKind);
|
|
251
|
+
// schema-from anchors resolve in the DEFINITION's module scope (where the anchor
|
|
252
|
+
// kind is declared), which may differ from the resource's own module.
|
|
242
253
|
const ownerModule = (def?.metadata as { module?: string } | undefined)?.module;
|
|
243
254
|
const ownerScope =
|
|
244
255
|
(ownerModule ? aliasesByModule.get(ownerModule) : undefined) ?? aliases;
|
package/src/kernel-globals.ts
CHANGED
|
@@ -7,12 +7,12 @@ import { residualEntrySchemaMap } from "./residual-schema.js";
|
|
|
7
7
|
* `buildTypedCelEnvironment` in cel-environment.ts (CEL type-checking)
|
|
8
8
|
* must stay in sync with this list.
|
|
9
9
|
*
|
|
10
|
-
* Note:
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
10
|
+
* Note: there is no `imports` namespace at runtime — import snapshots are
|
|
11
|
+
* stored under `resources.<alias>`. Host environment variables are reached
|
|
12
|
+
* by declaring a typed `variables:`/`secrets:` entry with an `env:` binding
|
|
13
|
+
* and referencing `variables.X` / `secrets.X`.
|
|
14
14
|
*/
|
|
15
|
-
export const KERNEL_GLOBAL_NAMES = ["variables", "secrets", "resources", "ports"
|
|
15
|
+
export const KERNEL_GLOBAL_NAMES = ["variables", "secrets", "resources", "ports"] as const;
|
|
16
16
|
|
|
17
17
|
const SYSTEM_KINDS = new Set([
|
|
18
18
|
"Telo.Definition",
|
|
@@ -33,7 +33,6 @@ const SYSTEM_KINDS = new Set([
|
|
|
33
33
|
* in the outer module; Libraries are only relevant when the caller scoped
|
|
34
34
|
* the manifest list to a single library's file.
|
|
35
35
|
* - `resources`: enumerates all non-system resource names
|
|
36
|
-
* - `env`: dynamic (runtime env vars, root module only)
|
|
37
36
|
*/
|
|
38
37
|
export function buildKernelGlobalsSchema(
|
|
39
38
|
manifests: ResourceManifest[],
|
|
@@ -68,7 +67,6 @@ export function buildKernelGlobalsSchema(
|
|
|
68
67
|
additionalProperties: false,
|
|
69
68
|
},
|
|
70
69
|
ports: buildPortsSchema(moduleManifest?.ports),
|
|
71
|
-
env: { type: "object", additionalProperties: true },
|
|
72
70
|
},
|
|
73
71
|
};
|
|
74
72
|
}
|
|
@@ -117,7 +115,7 @@ function buildSchemaMapSchema(
|
|
|
117
115
|
|
|
118
116
|
/**
|
|
119
117
|
* Merge kernel globals into an `x-telo-context` schema so chain-access
|
|
120
|
-
* validation recognises `variables`, `secrets`, `resources`, `
|
|
118
|
+
* validation recognises `variables`, `secrets`, `resources`, `ports`
|
|
121
119
|
* without module authors having to re-declare them.
|
|
122
120
|
*
|
|
123
121
|
* Context-specific properties take precedence over globals (spread order).
|
|
@@ -177,16 +177,10 @@ function hoistDiagnostic(
|
|
|
177
177
|
data,
|
|
178
178
|
};
|
|
179
179
|
}
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
message:
|
|
185
|
-
`Module '${identity}@${loser.version || "<unknown>"}' was hoisted to '${winner.version}' ` +
|
|
186
|
-
`because the same module is imported at the higher version elsewhere in the graph. ` +
|
|
187
|
-
`Pre-1.0 versions are additive, so the higher version is used for every importer.`,
|
|
188
|
-
data,
|
|
189
|
-
};
|
|
180
|
+
// Same-major hoist to a higher version: additive pre-1.0, so the redirect is
|
|
181
|
+
// non-lossy and by design — resolve to the winner silently, like a package
|
|
182
|
+
// manager picking the highest compatible version of a transitive dep.
|
|
183
|
+
return null;
|
|
190
184
|
}
|
|
191
185
|
|
|
192
186
|
/**
|