@telorun/analyzer 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 (80) hide show
  1. package/dist/analyzer.d.ts +9 -2
  2. package/dist/analyzer.d.ts.map +1 -1
  3. package/dist/analyzer.js +38 -10
  4. package/dist/builtins.d.ts.map +1 -1
  5. package/dist/builtins.js +16 -42
  6. package/dist/cel-environment.d.ts.map +1 -1
  7. package/dist/cel-environment.js +35 -0
  8. package/dist/flatten-for-analyzer.d.ts +4 -0
  9. package/dist/flatten-for-analyzer.d.ts.map +1 -1
  10. package/dist/flatten-for-analyzer.js +8 -0
  11. package/dist/index.d.ts +3 -0
  12. package/dist/index.d.ts.map +1 -1
  13. package/dist/index.js +6 -0
  14. package/dist/kernel-globals.d.ts +1 -1
  15. package/dist/kernel-globals.d.ts.map +1 -1
  16. package/dist/kernel-globals.js +15 -1
  17. package/dist/manifest-schemas.d.ts +407 -0
  18. package/dist/manifest-schemas.d.ts.map +1 -0
  19. package/dist/manifest-schemas.js +396 -0
  20. package/dist/module-file-claims.d.ts +6 -0
  21. package/dist/module-file-claims.d.ts.map +1 -1
  22. package/dist/module-file-claims.js +4 -0
  23. package/dist/module-metadata-scope.d.ts +44 -0
  24. package/dist/module-metadata-scope.d.ts.map +1 -0
  25. package/dist/module-metadata-scope.js +82 -0
  26. package/dist/parse-loaded-file.d.ts.map +1 -1
  27. package/dist/parse-loaded-file.js +16 -0
  28. package/dist/release/bump-level.d.ts +46 -0
  29. package/dist/release/bump-level.d.ts.map +1 -0
  30. package/dist/release/bump-level.js +80 -0
  31. package/dist/release/changelog.d.ts +36 -0
  32. package/dist/release/changelog.d.ts.map +1 -0
  33. package/dist/release/changelog.js +53 -0
  34. package/dist/release/fragment.d.ts +48 -0
  35. package/dist/release/fragment.d.ts.map +1 -0
  36. package/dist/release/fragment.js +84 -0
  37. package/dist/release/index.d.ts +26 -0
  38. package/dist/release/index.d.ts.map +1 -0
  39. package/dist/release/index.js +18 -0
  40. package/dist/release/ledger.d.ts +53 -0
  41. package/dist/release/ledger.d.ts.map +1 -0
  42. package/dist/release/ledger.js +109 -0
  43. package/dist/release/payload-digest.d.ts +63 -0
  44. package/dist/release/payload-digest.d.ts.map +1 -0
  45. package/dist/release/payload-digest.js +65 -0
  46. package/dist/release/release-plan.d.ts +128 -0
  47. package/dist/release/release-plan.d.ts.map +1 -0
  48. package/dist/release/release-plan.js +277 -0
  49. package/dist/release/version-stamp.d.ts +50 -0
  50. package/dist/release/version-stamp.d.ts.map +1 -0
  51. package/dist/release/version-stamp.js +119 -0
  52. package/dist/release/workspace-config.d.ts +41 -0
  53. package/dist/release/workspace-config.d.ts.map +1 -0
  54. package/dist/release/workspace-config.js +60 -0
  55. package/dist/schema-compat.js +2 -1
  56. package/dist/validate-step-inputs.d.ts +1 -1
  57. package/dist/validate-step-inputs.d.ts.map +1 -1
  58. package/dist/validate-step-inputs.js +99 -8
  59. package/package.json +3 -3
  60. package/src/analyzer.ts +41 -10
  61. package/src/builtins.ts +16 -42
  62. package/src/cel-environment.ts +37 -0
  63. package/src/flatten-for-analyzer.ts +12 -0
  64. package/src/index.ts +9 -1
  65. package/src/kernel-globals.ts +23 -1
  66. package/src/manifest-schemas.ts +408 -0
  67. package/src/module-file-claims.ts +10 -0
  68. package/src/module-metadata-scope.ts +88 -0
  69. package/src/parse-loaded-file.ts +16 -0
  70. package/src/release/bump-level.ts +95 -0
  71. package/src/release/changelog.ts +62 -0
  72. package/src/release/fragment.ts +130 -0
  73. package/src/release/index.ts +66 -0
  74. package/src/release/ledger.ts +142 -0
  75. package/src/release/payload-digest.ts +83 -0
  76. package/src/release/release-plan.ts +392 -0
  77. package/src/release/version-stamp.ts +142 -0
  78. package/src/release/workspace-config.ts +81 -0
  79. package/src/schema-compat.ts +1 -1
  80. package/src/validate-step-inputs.ts +109 -9
@@ -0,0 +1,407 @@
1
+ /**
2
+ * Shared JSON-Schema fragments every module's `telo.yaml` may point at with
3
+ * `$ref: "telo://manifest#/$defs/<Name>"`.
4
+ *
5
+ * WHY THE ANALYZER OWNS THEM. These describe manifest structure, which is what
6
+ * this package exists to read — and the layering forces the choice anyway: the
7
+ * editor validates in a browser through `@telorun/analyzer`, and the analyzer
8
+ * must not depend on the kernel. A fragment in the kernel would exist only at
9
+ * runtime, so `telo check` and the editor could not see a step's shape at all.
10
+ * The kernel re-exports these from its own `manifest-schemas` surface, and both
11
+ * halves register the same root document with AJV, so a `$ref` resolves
12
+ * identically in the editor, in `telo check` and at dispatch.
13
+ *
14
+ * A fragment here is STRUCTURE, not a named user type. The two are different
15
+ * mechanisms and both exist:
16
+ *
17
+ * - `#/$defs/<Name>` is private to the declaring kind's own schema — Run's
18
+ * `WhileStep` is Run's business and nothing outside it can name one.
19
+ * - `telo://manifest#/$defs/<Name>` is this set: shapes the kernel defines, so
20
+ * several unrelated documents can agree on one. `builtins.ts` is not a module
21
+ * document and has no `$defs` any module could reach, which is why a shared
22
+ * shape cannot live in one of the modules that use it.
23
+ * - `telo:<module>/<Type>` names a `Telo.JsonSchema` resource a MODULE
24
+ * declared, resolved through the type registry and carrying its owner so two
25
+ * libraries may both declare a `Filter`.
26
+ *
27
+ * Adding a fragment means putting it under `$defs` in {@link ManifestRootSchema}
28
+ * and `$ref`-ing it from module schemas. Browser-safe: no Node built-ins.
29
+ */
30
+ export declare const MANIFEST_SCHEMA_URI = "telo://manifest";
31
+ /** `$ref` to a fragment in this set, as a module schema writes it. */
32
+ export declare function manifestFragmentRef(name: string): string;
33
+ /** Schema fragment for a resource-reference slot. The only form a manifest
34
+ * author writes is the `!ref <name>` (or `!ref <Alias>.<name>`) YAML tag,
35
+ * which parses to a `TaggedSentinel` (engine "ref") whose `source` is the
36
+ * bare resource name. In practice module schemas mark a ref slot with a bare
37
+ * `x-telo-ref` annotation (plus, where the slot only ever holds a reference,
38
+ * `type: object` to reject a stray scalar); the analyzer's reference walker
39
+ * reads `x-telo-ref` to look the name up against that constraint, independent
40
+ * of this fragment. A slot opts into this fragment only when it wants this
41
+ * exact two-branch shape enforced at the AJV layer too — it is not required,
42
+ * and slots that also accept an inline value (e.g. `inputType` / `outputType`)
43
+ * deliberately do not use it (an inline JSON Schema has no `kind`).
44
+ *
45
+ * Two `anyOf` branches because the value's shape depends on the phase at
46
+ * which it is validated:
47
+ *
48
+ * 1. The raw `!ref` sentinel — what survives to AJV when a cross-module
49
+ * reference can't be resolved in standalone single-file analysis (the
50
+ * imported module isn't loaded). `substituteCelFields` deliberately
51
+ * keeps the sentinel so this branch matches.
52
+ * 2. A resolved reference object — `{kind, name, alias?}` substituted in
53
+ * place of a sentinel (or an inline definition `{kind, ...config}`
54
+ * reached through a local `$ref` that escapes extraction). Both the
55
+ * kernel and the analyzer validate ref slots *after* sentinel
56
+ * resolution, so this is the shape AJV usually sees.
57
+ *
58
+ * The object-form `{kind, name}` reference a user could once type directly
59
+ * is gone: a plain object at a ref slot is only ever an inline definition
60
+ * or the resolver's own substitution, never an author-written reference.
61
+ * That removal is enforced by the analyzer (it rejects an author-written
62
+ * `{kind, name}` before normalization), not by this schema — branch 2
63
+ * cannot distinguish an author's `{kind, name}` from the resolver's. */
64
+ export declare const ResourceRefSchema: {
65
+ title: string;
66
+ anyOf: ({
67
+ type: string;
68
+ required: string[];
69
+ properties: {
70
+ __tagged: {
71
+ const: boolean;
72
+ };
73
+ engine: {
74
+ const: string;
75
+ };
76
+ source: {
77
+ type: string;
78
+ minLength: number;
79
+ };
80
+ kind?: undefined;
81
+ };
82
+ additionalProperties: boolean;
83
+ } | {
84
+ type: string;
85
+ required: string[];
86
+ properties: {
87
+ kind: {
88
+ type: string;
89
+ };
90
+ __tagged?: undefined;
91
+ engine?: undefined;
92
+ source?: undefined;
93
+ };
94
+ additionalProperties: boolean;
95
+ })[];
96
+ };
97
+ /**
98
+ * How a dispatch is re-attempted.
99
+ *
100
+ * ONE shape, because a retry policy is a cross-cutting primitive rather than
101
+ * each composer's own idea: it was written out six times across `run` and
102
+ * `http-client` and had already drifted — one copy declared no defaults, another
103
+ * carried a field the others lacked. Defaults live here, so the Node step leaf
104
+ * and a second-language one read the same numbers instead of each re-deriving
105
+ * them from the other's source.
106
+ *
107
+ * `delay` survives as the older duration-string spelling because published
108
+ * manifests carry it, and it cannot be migrated away: a migration entry writes a
109
+ * SCALAR, and `"250ms"` → `250` is a computation the vocabulary deliberately
110
+ * cannot express.
111
+ */
112
+ export declare const RetryPolicySchema: {
113
+ title: string;
114
+ description: string;
115
+ type: string;
116
+ additionalProperties: boolean;
117
+ properties: {
118
+ attempts: {
119
+ title: string;
120
+ description: string;
121
+ type: string;
122
+ minimum: number;
123
+ default: number;
124
+ };
125
+ initialDelay: {
126
+ title: string;
127
+ description: string;
128
+ type: string;
129
+ minimum: number;
130
+ default: number;
131
+ };
132
+ factor: {
133
+ title: string;
134
+ description: string;
135
+ type: string;
136
+ minimum: number;
137
+ default: number;
138
+ };
139
+ maxDelay: {
140
+ title: string;
141
+ description: string;
142
+ type: string;
143
+ minimum: number;
144
+ default: number;
145
+ };
146
+ jitter: {
147
+ title: string;
148
+ description: string;
149
+ type: string;
150
+ enum: string[];
151
+ default: string;
152
+ };
153
+ delay: {
154
+ title: string;
155
+ description: string;
156
+ type: string;
157
+ pattern: string;
158
+ };
159
+ };
160
+ };
161
+ /**
162
+ * The bare-count spelling of a re-attempt — `Http.Request.retries`, deprecated
163
+ * but carried by every manifest published before `retry:` existed.
164
+ *
165
+ * Its own fragment rather than a special case in the reader: what a consumer
166
+ * needs to know is WHERE the budget is, and pointing at this shape says "the
167
+ * value itself" as precisely as pointing at a policy says "its `attempts`". It
168
+ * cannot be migrated to the policy form — a migration entry writes a scalar, and
169
+ * wrapping one in an object is not something the vocabulary can express.
170
+ */
171
+ export declare const RetryAttemptsSchema: {
172
+ title: string;
173
+ description: string;
174
+ type: string;
175
+ minimum: number;
176
+ default: number;
177
+ };
178
+ /**
179
+ * A DISPATCH SITE: name a target, pass it arguments, optionally guard it,
180
+ * optionally re-attempt it.
181
+ *
182
+ * The runtime has always had exactly one of these — `InvokeStep` in the SDK, run
183
+ * by `executeInvokeStep`, which every dispatch passes through. What did not exist
184
+ * was the schema half: the shape was hand-restated by each composer (four times
185
+ * in `run`, once in `builtins.ts`) and they drifted, which is why `retry:` worked
186
+ * in a sequence step and was a schema error one line away in `targets:` — not a
187
+ * decision anyone made about boot, just a copy that never grew the field.
188
+ *
189
+ * Owning it here is also what retired `x-telo-retry` for a step: the analyzer
190
+ * reads `step.retry.attempts` because that is what a step IS, rather than
191
+ * discovering a retry-bearing field through a marker the kind had to remember to
192
+ * write.
193
+ *
194
+ * `name` is optional: a boot target only needs one to publish
195
+ * `steps.<name>.result`, and a composer that requires one says so in its own
196
+ * schema. Closed, so a misspelled key is rejected wherever a dispatch is written.
197
+ */
198
+ export declare const InvokeStepSchema: {
199
+ title: string;
200
+ description: string;
201
+ type: string;
202
+ required: string[];
203
+ additionalProperties: boolean;
204
+ properties: {
205
+ name: {
206
+ title: string;
207
+ description: string;
208
+ type: string;
209
+ };
210
+ invoke: {
211
+ title: string;
212
+ description: string;
213
+ "x-telo-topology-role": string;
214
+ type: string;
215
+ "x-telo-ref": {
216
+ kind: string;
217
+ use: string;
218
+ inputs: string;
219
+ };
220
+ };
221
+ inputs: {
222
+ title: string;
223
+ description: string;
224
+ "x-telo-topology-role": string;
225
+ type: string;
226
+ additionalProperties: boolean;
227
+ };
228
+ when: {
229
+ title: string;
230
+ description: string;
231
+ type: string;
232
+ };
233
+ retry: {
234
+ title: string;
235
+ $ref: string;
236
+ };
237
+ };
238
+ };
239
+ /** Root schema registered with AJV under {@link MANIFEST_SCHEMA_URI}. Carries
240
+ * `$defs` only — it isn't validated against directly. */
241
+ export declare const ManifestRootSchema: {
242
+ $id: string;
243
+ $defs: {
244
+ ResourceRef: {
245
+ title: string;
246
+ anyOf: ({
247
+ type: string;
248
+ required: string[];
249
+ properties: {
250
+ __tagged: {
251
+ const: boolean;
252
+ };
253
+ engine: {
254
+ const: string;
255
+ };
256
+ source: {
257
+ type: string;
258
+ minLength: number;
259
+ };
260
+ kind?: undefined;
261
+ };
262
+ additionalProperties: boolean;
263
+ } | {
264
+ type: string;
265
+ required: string[];
266
+ properties: {
267
+ kind: {
268
+ type: string;
269
+ };
270
+ __tagged?: undefined;
271
+ engine?: undefined;
272
+ source?: undefined;
273
+ };
274
+ additionalProperties: boolean;
275
+ })[];
276
+ };
277
+ RetryPolicy: {
278
+ title: string;
279
+ description: string;
280
+ type: string;
281
+ additionalProperties: boolean;
282
+ properties: {
283
+ attempts: {
284
+ title: string;
285
+ description: string;
286
+ type: string;
287
+ minimum: number;
288
+ default: number;
289
+ };
290
+ initialDelay: {
291
+ title: string;
292
+ description: string;
293
+ type: string;
294
+ minimum: number;
295
+ default: number;
296
+ };
297
+ factor: {
298
+ title: string;
299
+ description: string;
300
+ type: string;
301
+ minimum: number;
302
+ default: number;
303
+ };
304
+ maxDelay: {
305
+ title: string;
306
+ description: string;
307
+ type: string;
308
+ minimum: number;
309
+ default: number;
310
+ };
311
+ jitter: {
312
+ title: string;
313
+ description: string;
314
+ type: string;
315
+ enum: string[];
316
+ default: string;
317
+ };
318
+ delay: {
319
+ title: string;
320
+ description: string;
321
+ type: string;
322
+ pattern: string;
323
+ };
324
+ };
325
+ };
326
+ RetryAttempts: {
327
+ title: string;
328
+ description: string;
329
+ type: string;
330
+ minimum: number;
331
+ default: number;
332
+ };
333
+ InvokeStep: {
334
+ title: string;
335
+ description: string;
336
+ type: string;
337
+ required: string[];
338
+ additionalProperties: boolean;
339
+ properties: {
340
+ name: {
341
+ title: string;
342
+ description: string;
343
+ type: string;
344
+ };
345
+ invoke: {
346
+ title: string;
347
+ description: string;
348
+ "x-telo-topology-role": string;
349
+ type: string;
350
+ "x-telo-ref": {
351
+ kind: string;
352
+ use: string;
353
+ inputs: string;
354
+ };
355
+ };
356
+ inputs: {
357
+ title: string;
358
+ description: string;
359
+ "x-telo-topology-role": string;
360
+ type: string;
361
+ additionalProperties: boolean;
362
+ };
363
+ when: {
364
+ title: string;
365
+ description: string;
366
+ type: string;
367
+ };
368
+ retry: {
369
+ title: string;
370
+ $ref: string;
371
+ };
372
+ };
373
+ };
374
+ };
375
+ };
376
+ /** A private, expanded copy of a fragment, for a consumer that must EMBED one
377
+ * rather than `$ref` it — `builtins.ts` is not a manifest and never passes
378
+ * through the loader, so its dispatch site has to arrive already resolved and
379
+ * already stamped. Cloned for the reason {@link deepFreeze} explains. */
380
+ export declare function manifestFragment(name: string): Record<string, unknown>;
381
+ /**
382
+ * Replace every `telo://manifest#/$defs/<Name>` reference with the fragment
383
+ * itself, in place, throughout a parsed manifest.
384
+ *
385
+ * EXPANDED rather than left as a reference, which is the opposite of what
386
+ * `resolveSchemaTypeRefs` does for a named user type — and for the opposite
387
+ * reasons. A user type must stay a reference because it can recurse and because
388
+ * the compiled-validator cache is keyed on schema identity. These fragments are a
389
+ * closed, non-recursive set the analyzer itself owns, and expanding them is what
390
+ * keeps a composer that points at a shared shape legible to walks that never
391
+ * resolved anything: the CEL-placeholder substitution, the eval-path collector,
392
+ * the editor's field walk. Teaching each of those to follow a reference is the
393
+ * same fix applied N times, and the failure mode when one is missed is silent —
394
+ * a role-driven lookup finds nothing and the check it feeds simply stops
395
+ * reporting.
396
+ *
397
+ * Runs in the shared loader, so both kernels' Node halves and every consumer of a
398
+ * loaded manifest see the same expanded shape.
399
+ */
400
+ export declare function expandManifestFragments(node: unknown, seen?: Set<object>): void;
401
+ /** Stamped by {@link expandManifestFragments} with the name of the shared
402
+ * fragment a slot pointed at. Derived, never author-written. */
403
+ export declare const X_TELO_FRAGMENT = "x-telo-fragment";
404
+ /** The shared fragment a schema node was expanded from, or undefined. The one
405
+ * accessor every consumer reads the stamp through. */
406
+ export declare function manifestFragmentOf(schema: unknown): string | undefined;
407
+ //# sourceMappingURL=manifest-schemas.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"manifest-schemas.d.ts","sourceRoot":"","sources":["../src/manifest-schemas.ts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