@toolproof-core/genesis 1.0.55 → 1.0.58

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 (27) hide show
  1. package/dist/generated-src/declarations/resourceTypes.json +12 -3
  2. package/dist/generated-src/lookups/constants.d.ts +12 -25
  3. package/dist/generated-src/lookups/constants.js +12 -25
  4. package/dist/generated-src/schemas/schemas.json +73 -214
  5. package/dist/generated-src/schemas/standalone/Resource.json +18 -17
  6. package/dist/generated-src/schemas/standalone/Strategy.json +129 -261
  7. package/dist/generated-src/schemas/standalone/StrategyTrace.json +91 -150
  8. package/dist/generated-src/schemas/standalone/Suite.json +1 -2
  9. package/dist/generated-src/schemas/standalone/Tool.json +1 -2
  10. package/dist/generated-src/schemas/zod/Resource.js +3 -4
  11. package/dist/generated-src/schemas/zod/Strategy.d.ts +0 -6
  12. package/dist/generated-src/schemas/zod/Strategy.js +11 -31
  13. package/dist/generated-src/schemas/zod/StrategyTrace.d.ts +0 -6
  14. package/dist/generated-src/schemas/zod/StrategyTrace.js +20 -32
  15. package/dist/generated-src/timestampedResources/booleans.json +2 -2
  16. package/dist/generated-src/timestampedResources/naturals.json +11 -11
  17. package/dist/generated-src/timestampedResources/resourceTypes.json +22 -13
  18. package/dist/generated-src/timestampedResources/tools.json +15 -15
  19. package/dist/generated-src/types/types.d.ts +48 -124
  20. package/dist/src/index.d.ts +1 -1
  21. package/dist/src/utils/standaloneZodSchemas.js +6 -6
  22. package/dist/src/utils/timestampedResources.d.ts +1 -1
  23. package/dist/src/utils/timestampedResources.js +1 -1
  24. package/dist/src/utils/typeGenerationPostProcess.js +20 -6
  25. package/dist/src/utils/zodCodegen.d.ts +1 -1
  26. package/dist/src/utils/zodCodegen.js +7 -7
  27. package/package.json +1 -1
@@ -78,7 +78,7 @@ export type ResourceId =
78
78
  * via the `definition` "Provenance".
79
79
  */
80
80
  export type Provenance =
81
- GenesisProvenance | StrategyProvenance;
81
+ GenesisProvenance | RuntimeProvenance | StrategyProvenance;
82
82
  /**
83
83
  * This interface was referenced by `Genesis`'s JSON-Schema
84
84
  * via the `definition` "StrategyTraceHandle".
@@ -90,19 +90,7 @@ export type StrategyTraceHandle =
90
90
  * via the `definition` "ToolStepPath".
91
91
  */
92
92
  export type ToolStepPath =
93
- UnthreadedToolStepPath | ThreadedToolStepPath;
94
- /**
95
- * This interface was referenced by `Genesis`'s JSON-Schema
96
- * via the `definition` "UnthreadedToolStepPath".
97
- */
98
- export type UnthreadedToolStepPath =
99
- string;
100
- /**
101
- * This interface was referenced by `Genesis`'s JSON-Schema
102
- * via the `definition` "ThreadedToolStepPath".
103
- */
104
- export type ThreadedToolStepPath =
105
- string;
93
+ string & { readonly __brand: 'ToolStepPath' };
106
94
  /**
107
95
  * This interface was referenced by `Genesis`'s JSON-Schema
108
96
  * via the `definition` "ResourceType".
@@ -219,7 +207,7 @@ export type Step =
219
207
  * via the `definition` "ProvenanceKind".
220
208
  */
221
209
  export type ProvenanceKind =
222
- "genesis" | "strategy";
210
+ "genesis" | "runtime" | "strategy";
223
211
  /**
224
212
  * This interface was referenced by `Genesis`'s JSON-Schema
225
213
  * via the `definition` "BaseResource".
@@ -279,13 +267,14 @@ export type StepArrayArray =
279
267
  * via the `definition` "ToolStepPathSlot".
280
268
  */
281
269
  export type ToolStepPathSlot =
282
- "self" | "case.when" | "case.what" | "cases.when" | "cases.what";
270
+ "self" | "case/when" | "case/what" | "cases/when" | "cases/what";
283
271
  /**
284
272
  * This interface was referenced by `Genesis`'s JSON-Schema
285
- * via the `definition` "BaseToolStepPathSpec".
273
+ * via the `definition` "ToolStepPathSpec".
286
274
  */
287
- export type BaseToolStepPathSpec =
275
+ export type ToolStepPathSpec =
288
276
  {
277
+ threadIndex: Natural;
289
278
  stepIndex: Natural;
290
279
  toolStepPathSlot: ToolStepPathSlot;
291
280
  caseIndex?: Natural;
@@ -297,74 +286,35 @@ export type BaseToolStepPathSpec =
297
286
  */
298
287
  export type Natural =
299
288
  number;
300
- /**
301
- * This interface was referenced by `Genesis`'s JSON-Schema
302
- * via the `definition` "UnthreadedToolStepPathSpec".
303
- */
304
- export type UnthreadedToolStepPathSpec =
305
- {
306
- } & BaseToolStepPathSpec;
307
- /**
308
- * This interface was referenced by `Genesis`'s JSON-Schema
309
- * via the `definition` "ThreadedToolStepPathSpec".
310
- */
311
- export type ThreadedToolStepPathSpec =
312
- {
313
- } & BaseToolStepPathSpec & {
314
- threadIndex: Natural;
315
- };
316
- /**
317
- * This interface was referenced by `Genesis`'s JSON-Schema
318
- * via the `definition` "StrategyKind".
319
- */
320
- export type StrategyKind =
321
- "unthreaded" | "threaded";
322
289
  /**
323
290
  * This interface was referenced by `Genesis`'s JSON-Schema
324
291
  * via the `definition` "StrategyHandle".
325
292
  */
326
293
  export type StrategyHandle =
327
294
  `STRATEGY-${string}`;
328
- /**
329
- * This interface was referenced by `Genesis`'s JSON-Schema
330
- * via the `definition` "UnthreadedStrategy".
331
- */
332
- export type UnthreadedStrategy =
333
- {
334
- } & BaseStrategy & {
335
- strategyKind?: "unthreaded";
336
- } & StepsFacet &
337
- UnthreadedStrategyStateFacet;
338
- /**
339
- * This interface was referenced by `Genesis`'s JSON-Schema
340
- * via the `definition` "ThreadedStrategy".
341
- */
342
- export type ThreadedStrategy =
343
- {
344
- } & BaseStrategy & {
345
- strategyKind?: "threaded";
346
- } & StepsByThreadIndexFacet &
347
- ThreadedStrategyStateFacet;
348
295
  /**
349
296
  * This interface was referenced by `Genesis`'s JSON-Schema
350
297
  * via the `definition` "Strategy".
351
298
  */
352
299
  export type Strategy =
353
- UnthreadedStrategy | ThreadedStrategy;
300
+ {
301
+ handle: StrategyHandle;
302
+ } & StepsByThreadIndexFacet &
303
+ StrategyStateFacet;
354
304
  /**
355
305
  * This interface was referenced by `Genesis`'s JSON-Schema
356
306
  * via the `definition` "TracePointKind".
357
307
  */
358
308
  export type TracePointKind =
359
- "graph_start" | "tick" | "interrupt" | "graph_end";
309
+ "strategy_start" | "tick" | "suspended" | "strategy_end";
360
310
  /**
361
311
  * This interface was referenced by `Genesis`'s JSON-Schema
362
- * via the `definition` "GraphStartTracePoint".
312
+ * via the `definition` "StrategyStartTracePoint".
363
313
  */
364
- export type GraphStartTracePoint =
314
+ export type StrategyStartTracePoint =
365
315
  BaseTracePoint & {
366
- tracePointKind?: "graph_start";
367
- } & ThreadedStrategyFacet;
316
+ tracePointKind?: "strategy_start";
317
+ } & StrategyFacet;
368
318
  /**
369
319
  * This interface was referenced by `Genesis`'s JSON-Schema
370
320
  * via the `definition` "TickTracePoint".
@@ -373,37 +323,39 @@ export type TickTracePoint =
373
323
  BaseTracePoint & {
374
324
  tracePointKind?: "tick";
375
325
  counterSnapshot: TracePointCounterSnapshot;
376
- toolStepPath: ThreadedToolStepPath;
326
+ threadIndex: Natural;
327
+ toolStepPath: ToolStepPath;
377
328
  delta: TracePointDelta;
378
329
  };
379
330
  /**
380
331
  * This interface was referenced by `Genesis`'s JSON-Schema
381
- * via the `definition` "InterruptTracePoint".
332
+ * via the `definition` "SuspendedTracePoint".
382
333
  */
383
- export type InterruptTracePoint =
334
+ export type SuspendedTracePoint =
384
335
  BaseTracePoint & {
385
- tracePointKind?: "interrupt";
336
+ tracePointKind?: "suspended";
386
337
  counterSnapshot: TracePointCounterSnapshot;
387
- toolStepPath: ThreadedToolStepPath;
338
+ threadIndex: Natural;
339
+ toolStepPath: ToolStepPath;
388
340
  delta: TracePointDelta & {
389
- interruptData: {
341
+ suspendedData: {
390
342
  };
391
343
  };
392
344
  };
393
345
  /**
394
346
  * This interface was referenced by `Genesis`'s JSON-Schema
395
- * via the `definition` "GraphEndTracePoint".
347
+ * via the `definition` "StrategyEndTracePoint".
396
348
  */
397
- export type GraphEndTracePoint =
349
+ export type StrategyEndTracePoint =
398
350
  BaseTracePoint & {
399
- tracePointKind?: "graph_end";
351
+ tracePointKind?: "strategy_end";
400
352
  };
401
353
  /**
402
354
  * This interface was referenced by `Genesis`'s JSON-Schema
403
355
  * via the `definition` "TracePoint".
404
356
  */
405
357
  export type TracePoint =
406
- GraphStartTracePoint | TickTracePoint | InterruptTracePoint | GraphEndTracePoint;
358
+ StrategyStartTracePoint | TickTracePoint | SuspendedTracePoint | StrategyEndTracePoint;
407
359
  /**
408
360
  * This interface was referenced by `Genesis`'s JSON-Schema
409
361
  * via the `definition` "GoalHandle".
@@ -507,6 +459,13 @@ export interface ProvenanceFacet {
507
459
  export interface GenesisProvenance {
508
460
  provenanceKind: "genesis";
509
461
  }
462
+ /**
463
+ * This interface was referenced by `Genesis`'s JSON-Schema
464
+ * via the `definition` "RuntimeProvenance".
465
+ */
466
+ export interface RuntimeProvenance {
467
+ provenanceKind: "runtime";
468
+ }
510
469
  /**
511
470
  * This interface was referenced by `Genesis`'s JSON-Schema
512
471
  * via the `definition` "StrategyProvenance".
@@ -521,8 +480,8 @@ export interface StrategyProvenance {
521
480
  * via the `definition` "ToolStepRoleAddress".
522
481
  */
523
482
  export interface ToolStepRoleAddress {
524
- roleName: string;
525
- toolStepPath: ToolStepPath;
483
+ roleName: RoleName;
484
+ toolStepPath: ToolStepPath;
526
485
  }
527
486
  export interface JsonSchemaObject1 {
528
487
  $schema: "https://json-schema.org/draft/2020-12/schema";
@@ -584,22 +543,12 @@ export interface Case {
584
543
  when: ToolStep;
585
544
  what: ToolStep;
586
545
  }
587
- /**
588
- * This interface was referenced by `Genesis`'s JSON-Schema
589
- * via the `definition` "DeferredStrategyProvenance".
590
- */
591
- export interface DeferredStrategyProvenance {
592
- provenanceKind: "strategy";
593
- toolStepRoleAddress: ToolStepRoleAddress;
594
- }
595
546
  /**
596
547
  * This interface was referenced by `Genesis`'s JSON-Schema
597
548
  * via the `definition` "ExternalInputPotential".
598
549
  */
599
550
  export interface ExternalInputPotential {
600
551
  strategyStateInputKind: "externalInputPotential";
601
- id: ResourceId;
602
- resourceTypeHandle: ResourceTypeHandle;
603
552
  }
604
553
  /**
605
554
  * This interface was referenced by `Genesis`'s JSON-Schema
@@ -607,9 +556,7 @@ export interface ExternalInputPotential {
607
556
  */
608
557
  export interface InternalInputPotential {
609
558
  strategyStateInputKind: "internalInputPotential";
610
- id: ResourceId;
611
- resourceTypeHandle: ResourceTypeHandle;
612
- provenance: DeferredStrategyProvenance;
559
+ toolStepRoleAddress: ToolStepRoleAddress;
613
560
  }
614
561
  /**
615
562
  * This interface was referenced by `Genesis`'s JSON-Schema
@@ -632,39 +579,17 @@ export interface ToolStepPathSlotFacet {
632
579
  }
633
580
  /**
634
581
  * This interface was referenced by `Genesis`'s JSON-Schema
635
- * via the `definition` "UnthreadedStrategyState".
582
+ * via the `definition` "StrategyState".
636
583
  */
637
- export interface UnthreadedStrategyState {
584
+ export interface StrategyState {
638
585
  [k: string]: StrategyStateInputEntryByRoleName;
639
586
  }
640
587
  /**
641
588
  * This interface was referenced by `Genesis`'s JSON-Schema
642
- * via the `definition` "ThreadedStrategyState".
589
+ * via the `definition` "StrategyStateFacet".
643
590
  */
644
- export interface ThreadedStrategyState {
645
- [k: string]: StrategyStateInputEntryByRoleName;
646
- }
647
- /**
648
- * This interface was referenced by `Genesis`'s JSON-Schema
649
- * via the `definition` "UnthreadedStrategyStateFacet".
650
- */
651
- export interface UnthreadedStrategyStateFacet {
652
- strategyState: UnthreadedStrategyState;
653
- }
654
- /**
655
- * This interface was referenced by `Genesis`'s JSON-Schema
656
- * via the `definition` "ThreadedStrategyStateFacet".
657
- */
658
- export interface ThreadedStrategyStateFacet {
659
- strategyState: ThreadedStrategyState;
660
- }
661
- /**
662
- * This interface was referenced by `Genesis`'s JSON-Schema
663
- * via the `definition` "BaseStrategy".
664
- */
665
- export interface BaseStrategy {
666
- handle: StrategyHandle;
667
- strategyKind: StrategyKind;
591
+ export interface StrategyStateFacet {
592
+ strategyState: StrategyState;
668
593
  }
669
594
  /**
670
595
  * This interface was referenced by `Genesis`'s JSON-Schema
@@ -690,8 +615,8 @@ export interface TracePointDelta {
690
615
  insertAt: Natural;
691
616
  insertedSteps: StepArray;
692
617
  };
693
- strategyStateDelta?: ThreadedStrategyState;
694
- interruptData?: {
618
+ strategyStateDelta?: StrategyState;
619
+ suspendedData?: {
695
620
  } | null;
696
621
  }
697
622
  /**
@@ -701,15 +626,14 @@ export interface TracePointDelta {
701
626
  export interface BaseTracePoint {
702
627
  tracePointKind: TracePointKind;
703
628
  strategyHandle: StrategyHandle;
704
- threadIndex: Natural;
705
629
  tracePointIndex: Natural;
706
630
  }
707
631
  /**
708
632
  * This interface was referenced by `Genesis`'s JSON-Schema
709
- * via the `definition` "ThreadedStrategyFacet".
633
+ * via the `definition` "StrategyFacet".
710
634
  */
711
- export interface ThreadedStrategyFacet {
712
- threadedStrategy: ThreadedStrategy;
635
+ export interface StrategyFacet {
636
+ strategy: Strategy;
713
637
  }
714
638
  /**
715
639
  * This interface was referenced by `Genesis`'s JSON-Schema
@@ -17,4 +17,4 @@ export type { ResourceTypeResource, } from '../generated-src/types/standalone/Re
17
17
  export type { ToolResource, } from '../generated-src/types/standalone/ToolResource.js';
18
18
  export type { StrategyResource, } from '../generated-src/types/standalone/StrategyResource.js';
19
19
  export type { StrategyTraceResource, } from '../generated-src/types/standalone/StrategyTraceResource.js';
20
- export type { BaseResource, BaseStrategy, BaseToolStepPathSpec, Boolean, BranchStep, Case, ContainerKind, DeferredStrategyProvenance, Description, DescriptionFacet, DocumentationSpec, ExternalInputPotential, GenesisProvenance, Goal, InputPotential, InputResource, InternalInputPotential, JsonSchemaObject, JsonSchemaObject1, JsonSchemaObject2, Name, NameFacet, Natural, ToolStepRoleAddress, Provenance, ProvenanceFacet, ProvenanceKind, Resource, ResourceId, ResourcePointer, ResourceType, ResourceTypeHandle, RoleBindingSpec, RoleBindingSpecFacet, RoleBindingSpecFacet1, RoleName, RoleNameArray, RoleSpec, RoleSpecFacet, RoleValue, RoleValueByName, Step, StepArray, StepArrayArray, StepKind, StepKindFacet, Strategy, StrategyHandle, StrategyKind, StrategyProvenance, StrategyStateInputEntry, StrategyStateInputEntryByRoleName, StrategyStateInputKind, StrategyTrace, StrategyTraceHandle, ThreadedStrategy, ThreadedStrategyState, ThreadedStrategyStateFacet, ThreadedToolStepPath, ThreadedToolStepPathSpec, Tool, ToolHandle, ToolStep, ToolStepPath, ToolStepPathSlot, ToolStepPathSlotFacet, TypeRef, UnthreadedStrategy, UnthreadedStrategyState, UnthreadedStrategyStateFacet, UnthreadedToolStepPath, UnthreadedToolStepPathSpec, WhileStep, ForStep, } from '../generated-src/types/types.js';
20
+ export type { BaseResource, Boolean, BranchStep, Case, ContainerKind, Description, DescriptionFacet, DocumentationSpec, ExternalInputPotential, StrategyEndTracePoint, StrategyStartTracePoint, GenesisProvenance, Goal, InputPotential, InputResource, InternalInputPotential, SuspendedTracePoint, JsonSchemaObject, Name, NameFacet, Natural, ToolStepRoleAddress, Provenance, ProvenanceFacet, ProvenanceKind, Resource, ResourceId, ResourcePointer, ResourceType, ResourceTypeHandle, RoleBindingSpec, RoleBindingSpecFacet, RoleName, RoleNameArray, RoleSpec, RoleSpecFacet, RoleValue, RoleValueByName, RuntimeProvenance, Step, StepArray, StepArrayArray, StepKind, StepKindFacet, StrategyHandle, StrategyProvenance, StrategyStateInputEntry, StrategyStateInputEntryByRoleName, StrategyStateInputKind, StrategyTrace, StrategyTraceHandle, TickTracePoint, TimestampedResource, TracePoint, Strategy, StrategyState, StrategyStateFacet, ToolStepPath, ToolStepPathSpec, Tool, ToolHandle, ToolStep, ToolStepPathSlot, ToolStepPathSlotFacet, TypeRef, WhileStep, ForStep, } from '../generated-src/types/types.js';
@@ -12,7 +12,7 @@ function emitHeader(name) {
12
12
  return (`// Auto-generated from standalone schema '${name}'. Do not edit.\n` +
13
13
  `import { z } from 'zod/v4';\n\n`);
14
14
  }
15
- function emitModule(name, expressionsByName, warnings) {
15
+ function emitModule(name, expressionByName, warnings) {
16
16
  const lines = [];
17
17
  lines.push(emitHeader(name));
18
18
  if (warnings.length > 0) {
@@ -20,7 +20,7 @@ function emitModule(name, expressionsByName, warnings) {
20
20
  lines.push(`export const ${warningsName} = ${JSON.stringify(warnings, null, 2)} as const;\n`);
21
21
  }
22
22
  const rootIdent = toIdentifier(name);
23
- const defNames = Object.keys(expressionsByName)
23
+ const defNames = Object.keys(expressionByName)
24
24
  .filter((schemaName) => schemaName !== name)
25
25
  .sort((a, b) => a.localeCompare(b));
26
26
  for (const schemaName of defNames) {
@@ -28,19 +28,19 @@ function emitModule(name, expressionsByName, warnings) {
28
28
  if (!isValidIdentifier(ident)) {
29
29
  throw new Error(`Invalid generated identifier for schema '${schemaName}': '${ident}'`);
30
30
  }
31
- const expr = expressionsByName[schemaName];
31
+ const expr = expressionByName[schemaName];
32
32
  lines.push(`const ${ident}Schema: z.ZodTypeAny = z.lazy(() => ${expr});`);
33
33
  }
34
34
  lines.push('');
35
- const rootExpr = expressionsByName[name];
35
+ const rootExpr = expressionByName[name];
36
36
  lines.push(`export const ${rootIdent}Schema: z.ZodTypeAny = z.lazy(() => ${rootExpr});`);
37
37
  return lines.join('\n') + '\n';
38
38
  }
39
39
  export function generateStandaloneZodModule(name, standaloneSchema) {
40
- const { expressionsByName, warnings } = jsonSchemaToZodExpressions(standaloneSchema, name);
40
+ const { expressionByName, warnings } = jsonSchemaToZodExpressions(standaloneSchema, name);
41
41
  return {
42
42
  fileName: `${name}.ts`,
43
- content: emitModule(name, expressionsByName, warnings),
43
+ content: emitModule(name, expressionByName, warnings),
44
44
  warnings,
45
45
  };
46
46
  }
@@ -3,7 +3,7 @@ type TimestampedResource = JsonObject & {
3
3
  id: string;
4
4
  resourceTypeHandle: string;
5
5
  provenance: {
6
- resourceProvenanceKind: 'genesis';
6
+ provenanceKind: 'genesis';
7
7
  };
8
8
  timestamp: string;
9
9
  projection: unknown;
@@ -9,7 +9,7 @@ function createTimestampedResource(projection, options) {
9
9
  id: options.getResourceId(projection),
10
10
  resourceTypeHandle: options.resourceTypeHandle,
11
11
  provenance: {
12
- resourceProvenanceKind: 'genesis',
12
+ provenanceKind: 'genesis',
13
13
  },
14
14
  timestamp: GENESIS_TIMESTAMP,
15
15
  projection,
@@ -108,6 +108,24 @@ function fixRecursiveArrayAliasSelfReference(ts, typeName) {
108
108
  }
109
109
  return lines.join('\n');
110
110
  }
111
+ function brandToolStepPathAlias(ts) {
112
+ return ts.replace(/\/\*\*\r?\n \* This interface was referenced by `Genesis`'s JSON-Schema\r?\n \* via the `definition` "ToolStepPath"\.\r?\n \*\/\r?\nexport type ToolStepPath =\r?\n[\s\S]*?;/, `/**
113
+ * This interface was referenced by \`Genesis\`'s JSON-Schema
114
+ * via the \`definition\` "ToolStepPath".
115
+ */
116
+ export type ToolStepPath =
117
+ string & { readonly __brand: 'ToolStepPath' };`);
118
+ }
119
+ function addTypedToolStepRoleAddressAlias(ts) {
120
+ return ts.replace(/\/\*\*\r?\n \* This interface was referenced by `Genesis`'s JSON-Schema\r?\n \* via the `definition` "ToolStepRoleAddress"\.\r?\n \*\/\r?\nexport interface ToolStepRoleAddress \{\r?\n roleName: (?:string|RoleName);\r?\n toolStepPath: ToolStepPath;\r?\n\}/, `/**
121
+ * This interface was referenced by \`Genesis\`'s JSON-Schema
122
+ * via the \`definition\` "ToolStepRoleAddress".
123
+ */
124
+ export interface ToolStepRoleAddress {
125
+ roleName: RoleName;
126
+ toolStepPath: ToolStepPath;
127
+ }`);
128
+ }
111
129
  export function postProcessEmittedTypes(ts, parsedSchema) {
112
130
  ts = ts.replace(/^\s*\[k:\s*string\]:\s*unknown;\s*(?:\r?\n)?/gm, '');
113
131
  ts = ts.replace(/^(\s*)(\$defs\??:\s*)\{\s*\r?\n\s*\};/gm, (_m, indent, head) => `${indent}${head}Record<string, unknown>;`);
@@ -133,18 +151,14 @@ export function postProcessEmittedTypes(ts, parsedSchema) {
133
151
  const tmpl = patternTemplates[typeName];
134
152
  return `${p1}${typeName}${p3}${tmpl ?? 'string'};`;
135
153
  });
154
+ ts = brandToolStepPathAlias(ts);
155
+ ts = addTypedToolStepRoleAddressAlias(ts);
136
156
  const roleNameKeyType = 'RoleName';
137
- const unthreadedToolStepPathKeyType = 'UnthreadedToolStepPath';
138
- const threadedToolStepPathKeyType = 'ThreadedToolStepPath';
139
157
  const toolStepPathKeyType = 'ToolStepPath';
140
158
  ts = ts.replace(/export interface RoleValueByName\s*\{\s*\[k:\s*string\]:\s*RoleValue;\s*\}/g, `export type RoleValueByName = Record<${roleNameKeyType}, RoleValue>;`);
141
159
  const strategyStateInputEntryByRoleNameValueType = deriveStrategyStateInputEntryByRoleNameValueType(parsedSchema);
142
160
  ts = ts.replace(/export interface StrategyStateInputEntryByRoleName\s*\{\s*\[k:\s*string\]:\s*[^;]+;\s*\}/g, `export type StrategyStateInputEntryByRoleName = Record<${roleNameKeyType}, ${strategyStateInputEntryByRoleNameValueType}>;`);
143
161
  ts = ts.replace(/export\s+type\s+StrategyStateInputEntryByRoleName\s*=\s*Record<\s*RoleName\s*,\s*[^>]+>\s*;/g, `export type StrategyStateInputEntryByRoleName = Record<${roleNameKeyType}, ${strategyStateInputEntryByRoleNameValueType}>;`);
144
- ts = ts.replace(/export interface StrategyStateInputEntryByRoleNameByUnthreadedToolStepPath\s*\{\s*\[k:\s*string\]:\s*StrategyStateInputEntryByRoleName;\s*\}/g, `export type StrategyStateInputEntryByRoleNameByUnthreadedToolStepPath = Record<${unthreadedToolStepPathKeyType}, StrategyStateInputEntryByRoleName>;`);
145
- ts = ts.replace(/export interface StrategyStateInputEntryByRoleNameByThreadedToolStepPath\s*\{\s*\[k:\s*string\]:\s*StrategyStateInputEntryByRoleName;\s*\}/g, `export type StrategyStateInputEntryByRoleNameByThreadedToolStepPath = Record<${threadedToolStepPathKeyType}, StrategyStateInputEntryByRoleName>;`);
146
- ts = ts.replace(/export\s+type\s+UnthreadedStrategyState\s*=\s*StrategyStateInputEntryByRoleNameByUnthreadedToolStepPath\s*;/g, `export type UnthreadedStrategyState = Record<${unthreadedToolStepPathKeyType}, StrategyStateInputEntryByRoleName>;`);
147
- ts = ts.replace(/export\s+type\s+ThreadedStrategyState\s*=\s*StrategyStateInputEntryByRoleNameByThreadedToolStepPath\s*;/g, `export type ThreadedStrategyState = Record<${threadedToolStepPathKeyType}, StrategyStateInputEntryByRoleName>;`);
148
162
  ts = ts.replace(/(strategyState\??:\s*)\{\s*\[k:\s*string\]:\s*StrategyStateInputEntryByRoleName;\s*\};/g, `$1Record<${toolStepPathKeyType}, StrategyStateInputEntryByRoleName>;`);
149
163
  ts = ts.replace(/(strategyStateUpdate\??:\s*)\{\s*\[k:\s*string\]:\s*StrategyStateInputEntryByRoleName;\s*\};/g, `$1Record<${toolStepPathKeyType}, StrategyStateInputEntryByRoleName>;`);
150
164
  ts = ts.replace(/export interface StepsByThreadIndexFacet\s*\{\s*stepsByThreadIndex:\s*StepArrayArray;\s*\}/g, 'export interface StepsByThreadIndexFacet {\n stepsByThreadIndex: StepArrayArray;\n}');
@@ -4,7 +4,7 @@ export type JsonSchemaToZodWarning = {
4
4
  message: string;
5
5
  };
6
6
  export type JsonSchemaToZodResult = {
7
- expressionsByName: Record<string, string>;
7
+ expressionByName: Record<string, string>;
8
8
  warnings: JsonSchemaToZodWarning[];
9
9
  };
10
10
  export declare function jsonSchemaToZodExpressions(standaloneSchema: JsonSchema, rootName: string): JsonSchemaToZodResult;
@@ -76,7 +76,7 @@ function emitRecordLikeObjectSchema(node, ctx, path) {
76
76
  }
77
77
  else if (typeof pn.$ref === 'string') {
78
78
  const defName = resolveLocalRef(pn.$ref, ctx);
79
- const resolved = defName ? ctx.defsByName[defName] : undefined;
79
+ const resolved = defName ? ctx.defByName[defName] : undefined;
80
80
  if (isObject(resolved) && typeof resolved.pattern === 'string') {
81
81
  keyPattern = resolved.pattern;
82
82
  }
@@ -112,7 +112,7 @@ function resolveSchemaIfRef(node, ctx) {
112
112
  if (isObject(node) && typeof node.$ref === 'string') {
113
113
  const defName = resolveLocalRef(node.$ref, ctx);
114
114
  if (defName)
115
- return ctx.defsByName[defName];
115
+ return ctx.defByName[defName];
116
116
  }
117
117
  return node;
118
118
  }
@@ -508,14 +508,14 @@ export function jsonSchemaToZodExpressions(standaloneSchema, rootName) {
508
508
  const defNames = new Set(Object.keys(defs));
509
509
  const ctx = {
510
510
  defNames,
511
- defsByName: defs,
511
+ defByName: defs,
512
512
  anchorToDefName: buildAnchorMap(defs),
513
513
  warnings: []
514
514
  };
515
- const expressionsByName = {};
515
+ const expressionByName = {};
516
516
  for (const defName of Object.keys(defs)) {
517
- expressionsByName[defName] = emitSchema(defs[defName], ctx, `$defs.${defName}`);
517
+ expressionByName[defName] = emitSchema(defs[defName], ctx, `$defs.${defName}`);
518
518
  }
519
- expressionsByName[rootName] = emitSchema(normalized, ctx, rootName);
520
- return { expressionsByName, warnings: ctx.warnings };
519
+ expressionByName[rootName] = emitSchema(normalized, ctx, rootName);
520
+ return { expressionByName, warnings: ctx.warnings };
521
521
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@toolproof-core/genesis",
3
- "version": "1.0.55",
3
+ "version": "1.0.58",
4
4
  "description": "Core ToolProof ontology, schemas, declarations, implementations, and generated type artifacts.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",