@toolproof-core/schema 1.0.16 → 1.0.18

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 (40) hide show
  1. package/dist/generated/schemas/zod/Goal.d.ts +2 -0
  2. package/dist/generated/schemas/zod/Goal.js +5 -0
  3. package/dist/generated/schemas/zod/Job.d.ts +6 -0
  4. package/dist/generated/schemas/zod/Job.js +25 -0
  5. package/dist/generated/schemas/zod/RawStrategy.d.ts +12 -0
  6. package/dist/generated/schemas/zod/RawStrategy.js +66 -0
  7. package/dist/generated/schemas/zod/ResourceType.d.ts +2 -0
  8. package/dist/generated/schemas/zod/ResourceType.js +18 -0
  9. package/dist/generated/schemas/zod/RunnableStrategy.d.ts +12 -0
  10. package/dist/generated/schemas/zod/RunnableStrategy.js +74 -0
  11. package/dist/generated/schemas/zod/StrategyRun.d.ts +12 -0
  12. package/dist/generated/schemas/zod/StrategyRun.js +88 -0
  13. package/dist/generated/schemas/zod/index.d.ts +6 -0
  14. package/dist/generated/schemas/zod/index.js +7 -0
  15. package/dist/index.d.ts +11 -1
  16. package/dist/index.js +12 -0
  17. package/dist/internals/booleans.json +32 -0
  18. package/dist/internals/jobs.json +266 -0
  19. package/dist/internals/naturals.json +167 -0
  20. package/dist/scripts/_lib/config.d.ts +3 -0
  21. package/dist/scripts/_lib/config.js +9 -0
  22. package/dist/scripts/_lib/utils/jsonSchemaToZod.d.ts +18 -0
  23. package/dist/scripts/_lib/utils/jsonSchemaToZod.js +607 -0
  24. package/dist/scripts/generateStandaloneZodSchema.d.ts +1 -0
  25. package/dist/scripts/generateStandaloneZodSchema.js +116 -0
  26. package/package.json +6 -2
  27. package/src/generated/schemas/zod/Goal.ts +8 -0
  28. package/src/generated/schemas/zod/Job.ts +26 -0
  29. package/src/generated/schemas/zod/RawStrategy.ts +64 -0
  30. package/src/generated/schemas/zod/ResourceType.ts +13 -0
  31. package/src/generated/schemas/zod/RunnableStrategy.ts +69 -0
  32. package/src/generated/schemas/zod/StrategyRun.ts +83 -0
  33. package/src/generated/schemas/zod/index.ts +7 -0
  34. package/src/index.ts +15 -0
  35. package/src/internals/booleans.json +32 -0
  36. package/src/internals/jobs.json +266 -0
  37. package/src/internals/naturals.json +167 -0
  38. package/src/scripts/_lib/config.ts +12 -0
  39. package/src/scripts/_lib/utils/jsonSchemaToZod.ts +646 -0
  40. package/src/scripts/generateStandaloneZodSchema.ts +139 -0
@@ -0,0 +1,116 @@
1
+ import fs from 'fs';
2
+ import path from 'path';
3
+ import { getConfig } from './_lib/config.js';
4
+ import { jsonSchemaToZodExpressions } from './_lib/utils/jsonSchemaToZod.js';
5
+ /**
6
+ * Generate a Zod v4 validator module from a standalone schema JSON file.
7
+ *
8
+ * Usage:
9
+ * node ./dist/scripts/generateStandaloneZodSchema.js --name <DefName>
10
+ */
11
+ function stripSurroundingQuotes(value) {
12
+ if ((value.startsWith('"') && value.endsWith('"')) || (value.startsWith("'") && value.endsWith("'"))) {
13
+ return value.slice(1, -1);
14
+ }
15
+ return value;
16
+ }
17
+ function parseArgs(args) {
18
+ let name;
19
+ for (let i = 0; i < args.length; i++) {
20
+ const a = args[i];
21
+ if (a === '--name') {
22
+ name = args[i + 1];
23
+ i++;
24
+ }
25
+ else if (a.startsWith('--name=')) {
26
+ name = a.split('=')[1];
27
+ }
28
+ }
29
+ const normalized = typeof name === 'string' ? stripSurroundingQuotes(name) : undefined;
30
+ return { name: normalized?.trim() ? normalized : undefined };
31
+ }
32
+ function isValidIdentifier(name) {
33
+ return /^[A-Za-z_][A-Za-z0-9_]*$/.test(name);
34
+ }
35
+ function toIdentifier(name) {
36
+ // Standalone def names in Genesis are already identifier-friendly.
37
+ // We still sanitize minimally to avoid codegen footguns.
38
+ let out = name.replace(/[^A-Za-z0-9_]/g, '_');
39
+ if (!/^[A-Za-z_]/.test(out))
40
+ out = '_' + out;
41
+ return out;
42
+ }
43
+ function emitHeader(name) {
44
+ return (`// Auto-generated from standalone schema '${name}'. Do not edit.\n` +
45
+ `import { z } from 'zod/v4';\n\n`);
46
+ }
47
+ function emitModule(name, expressionsByName, warnings) {
48
+ const lines = [];
49
+ lines.push(emitHeader(name));
50
+ if (warnings.length > 0) {
51
+ const warningsName = `${toIdentifier(name)}ZodGenerationWarnings`;
52
+ lines.push(`export const ${warningsName} = ` + JSON.stringify(warnings, null, 2) + ' as const;\n');
53
+ }
54
+ const rootIdent = toIdentifier(name);
55
+ // Emit file-local defs first (not exported) to avoid name collisions across modules.
56
+ const defNames = Object.keys(expressionsByName)
57
+ .filter((n) => n !== name)
58
+ .sort((a, b) => a.localeCompare(b));
59
+ for (const schemaName of defNames) {
60
+ const ident = toIdentifier(schemaName);
61
+ if (!isValidIdentifier(ident)) {
62
+ throw new Error(`Invalid generated identifier for schema '${schemaName}': '${ident}'`);
63
+ }
64
+ const expr = expressionsByName[schemaName];
65
+ lines.push(`const ${ident}Schema: z.ZodTypeAny = z.lazy(() => ${expr});`);
66
+ }
67
+ lines.push('');
68
+ // Export only the root schema.
69
+ const rootExpr = expressionsByName[name];
70
+ lines.push(`export const ${rootIdent}Schema: z.ZodTypeAny = z.lazy(() => ${rootExpr});`);
71
+ return lines.join('\n') + '\n';
72
+ }
73
+ function writeBarrelFile(zodDir) {
74
+ const entries = fs
75
+ .readdirSync(zodDir)
76
+ .filter((f) => f.endsWith('.ts') && f !== 'index.ts' && !f.startsWith('.'))
77
+ .sort((a, b) => a.localeCompare(b));
78
+ const exports = entries.map((f) => {
79
+ const base = path.basename(f, '.ts');
80
+ const ident = toIdentifier(base);
81
+ // Export only the root schema to avoid name collisions across modules.
82
+ return `export { ${ident}Schema } from './${base}.js';`;
83
+ });
84
+ const content = `// Auto-generated barrel file. Do not edit.\n${exports.join('\n')}\n`;
85
+ fs.writeFileSync(path.join(zodDir, 'index.ts'), content, 'utf8');
86
+ }
87
+ async function main() {
88
+ try {
89
+ const config = getConfig();
90
+ const { name } = parseArgs(process.argv.slice(2));
91
+ if (!name)
92
+ throw new Error('Missing --name <DefName> argument');
93
+ const inPath = config.getStandaloneSchemaPath(`${name}.json`);
94
+ if (!fs.existsSync(inPath)) {
95
+ throw new Error(`Standalone schema not found at ${inPath}. Run generateStandaloneSchema -- --name ${name} first.`);
96
+ }
97
+ const raw = fs.readFileSync(inPath, 'utf8');
98
+ const parsed = JSON.parse(raw);
99
+ const { expressionsByName, warnings } = jsonSchemaToZodExpressions(parsed, name);
100
+ const zodDir = config.getZodSchemasDir();
101
+ const outPath = config.getZodSchemaPath(`${name}.ts`);
102
+ fs.mkdirSync(zodDir, { recursive: true });
103
+ const content = emitModule(name, expressionsByName, warnings);
104
+ fs.writeFileSync(outPath, content, 'utf8');
105
+ writeBarrelFile(zodDir);
106
+ if (warnings.length > 0) {
107
+ console.warn(`Generated Zod schema '${name}' with ${warnings.length} warning(s).`);
108
+ }
109
+ console.log(`Wrote ${outPath}`);
110
+ }
111
+ catch (e) {
112
+ console.error(e?.message ?? e);
113
+ process.exitCode = 1;
114
+ }
115
+ }
116
+ void main();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@toolproof-core/schema",
3
- "version": "1.0.16",
3
+ "version": "1.0.18",
4
4
  "description": "JSON schemas and TypeScript types for ToolProof",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -21,6 +21,9 @@
21
21
  "publishConfig": {
22
22
  "access": "public"
23
23
  },
24
+ "dependencies": {
25
+ "zod": "^4.3.6"
26
+ },
24
27
  "devDependencies": {
25
28
  "@types/node": "^20.8.1",
26
29
  "json-schema-to-typescript": "^15.0.4",
@@ -34,6 +37,7 @@
34
37
  "normalizeAnchorsToPointers": "node ./dist/scripts/normalizeAnchorsToPointers.js",
35
38
  "extractSchemasFromResourceTypeShells": "node ./dist/scripts/extractSchemasFromResourceTypeShells.js",
36
39
  "generateStandaloneSchema": "node ./dist/scripts/generateStandaloneSchema.js",
40
+ "generateStandaloneZodSchema": "node ./dist/scripts/generateStandaloneZodSchema.js",
37
41
  "generateTypes": "node ./dist/scripts/generateTypes.js",
38
42
  "generateStandaloneType": "node ./dist/scripts/generateStandaloneType.js",
39
43
  "wrapResourceTypesWithResourceShells": "node ./dist/scripts/wrapResourceTypesWithResourceShells.js",
@@ -42,6 +46,6 @@
42
46
  "generateConstantsAndMappings": "node ./dist/scripts/generateConstantsAndMappings.js",
43
47
  "generateTerminals": "node ./dist/scripts/generateTerminals.js",
44
48
  "generateResourceTypeGenesisType": "node ./dist/scripts/generateStandaloneType.js --name Genesis",
45
- "update": "rimraf /s /q dist && pnpm run build:scripts && pnpm run normalizeAnchorsToPointers && pnpm run extractSchemasFromResourceTypeShells && pnpm run generateConstantsAndMappings && pnpm run generateStandaloneSchema -- --name Job && pnpm run generateStandaloneSchema -- --name ResourceType && pnpm run generateStandaloneSchema -- --name RawStrategy && pnpm run generateStandaloneSchema -- --name RunnableStrategy && pnpm run generateStandaloneSchema -- --name StrategyRun && pnpm run generateStandaloneSchema -- --name Goal && pnpm run wrapResourceTypesWithResourceShells && pnpm run generateSchemaShims && pnpm run generateTypes && pnpm run generateStandaloneType -- --name Job && pnpm run generateStandaloneType -- --name ResourceType && pnpm run generateStandaloneType -- --name RawStrategy && pnpm run generateStandaloneType -- --name RunnableStrategy && pnpm run generateResourceTypeGenesisType && pnpm run generateDependencies && pnpm run generateTerminals && pnpm run build"
49
+ "update": "rimraf /s /q dist && pnpm run build:scripts && pnpm run normalizeAnchorsToPointers && pnpm run extractSchemasFromResourceTypeShells && pnpm run generateConstantsAndMappings && pnpm run generateStandaloneSchema -- --name Job && pnpm run generateStandaloneSchema -- --name ResourceType && pnpm run generateStandaloneSchema -- --name RawStrategy && pnpm run generateStandaloneSchema -- --name RunnableStrategy && pnpm run generateStandaloneSchema -- --name StrategyRun && pnpm run generateStandaloneSchema -- --name Goal && pnpm run generateStandaloneZodSchema -- --name Job && pnpm run generateStandaloneZodSchema -- --name ResourceType && pnpm run generateStandaloneZodSchema -- --name RawStrategy && pnpm run generateStandaloneZodSchema -- --name RunnableStrategy && pnpm run generateStandaloneZodSchema -- --name StrategyRun && pnpm run generateStandaloneZodSchema -- --name Goal && pnpm run wrapResourceTypesWithResourceShells && pnpm run generateSchemaShims && pnpm run generateTypes && pnpm run generateStandaloneType -- --name Job && pnpm run generateStandaloneType -- --name ResourceType && pnpm run generateStandaloneType -- --name RawStrategy && pnpm run generateStandaloneType -- --name RunnableStrategy && pnpm run generateResourceTypeGenesisType && pnpm run generateDependencies && pnpm run generateTerminals && pnpm run build"
46
50
  }
47
51
  }
@@ -0,0 +1,8 @@
1
+ // Auto-generated from standalone schema 'Goal'. Do not edit.
2
+ import { z } from 'zod/v4';
3
+
4
+
5
+ const GoalIdentitySchema: z.ZodTypeAny = z.lazy(() => z.string().regex(new RegExp("^GOAL-.+$")));
6
+ const JobIdentitySchema: z.ZodTypeAny = z.lazy(() => z.string().regex(new RegExp("^JOB-.+$")));
7
+
8
+ export const GoalSchema: z.ZodTypeAny = z.lazy(() => z.object({ "identity": GoalIdentitySchema, "target": z.number().int().min(0), "disallowedJobs": z.array(JobIdentitySchema).optional(), "disallowedSequences": z.array(z.array(JobIdentitySchema)).optional(), "minSteps": z.number().int().min(1).optional(), "maxSteps": z.number().int().min(1).optional() }).strict());
@@ -0,0 +1,26 @@
1
+ // Auto-generated from standalone schema 'Job'. Do not edit.
2
+ import { z } from 'zod/v4';
3
+
4
+
5
+ export const JobZodGenerationWarnings = [
6
+ {
7
+ "path": "$defs.Roles.properties.outputDict.allOfMerged.propertyNames",
8
+ "message": "propertyNames on fixed-shape object not enforced by generated Zod."
9
+ }
10
+ ] as const;
11
+
12
+ const DescriptionSchema: z.ZodTypeAny = z.lazy(() => z.string().min(1));
13
+ const DescriptionFacetSchema: z.ZodTypeAny = z.lazy(() => z.object({ "description": DescriptionSchema }));
14
+ const DocumentationFacetSchema: z.ZodTypeAny = z.lazy(() => z.object({ "name": NameSchema, "description": DescriptionSchema }));
15
+ const JobIdentitySchema: z.ZodTypeAny = z.lazy(() => z.string().regex(new RegExp("^JOB-.+$")));
16
+ const NameSchema: z.ZodTypeAny = z.lazy(() => z.string().min(1).regex(new RegExp("^(?:[A-Z][^0-9]*|[a-z]+/[a-z.+&-]+)$")));
17
+ const NameFacetSchema: z.ZodTypeAny = z.lazy(() => z.object({ "name": NameSchema }));
18
+ const ResourceRoleIdentitySchema: z.ZodTypeAny = z.lazy(() => z.string().regex(new RegExp("^ROLE-.+$")));
19
+ const ResourceRoleValueSchema: z.ZodTypeAny = z.lazy(() => z.object({ "resourceTypeHandle": ResourceTypeIdentitySchema, "name": NameSchema, "description": DescriptionSchema }));
20
+ const ResourceTypeIdentitySchema: z.ZodTypeAny = z.lazy(() => z.string().regex(new RegExp("^TYPE-.+$")));
21
+ const RoleDictSchema: z.ZodTypeAny = z.lazy(() => z.record(z.string(), ResourceRoleValueSchema).superRefine((obj, ctx) => { for (const k of Object.keys(obj)) { if (!new RegExp("^ROLE-.+$").test(k)) ctx.addIssue({ code: 'custom', message: 'Invalid key: ' + k }); } }));
22
+ const RolesSchema: z.ZodTypeAny = z.lazy(() => z.object({ "inputDict": RoleDictSchema, "outputDict": z.object({ "ROLE-ErrorOutput": z.object({ "resourceTypeHandle": z.intersection(ResourceTypeIdentitySchema, z.literal("TYPE-Error")), "name": z.intersection(NameSchema, z.literal("ErrorOutput")), "description": z.intersection(DescriptionSchema, z.literal("Represents error outputs from job runs.")) }) }).catchall(ResourceRoleValueSchema) }).strict());
23
+ const RolesFacetSchema: z.ZodTypeAny = z.lazy(() => z.object({ "roles": RolesSchema }));
24
+ const UriSchema: z.ZodTypeAny = z.lazy(() => z.string().url());
25
+
26
+ export const JobSchema: z.ZodTypeAny = z.lazy(() => z.object({ "identity": JobIdentitySchema, "implementationUri": UriSchema, "name": NameSchema, "description": DescriptionSchema, "roles": RolesSchema }).strict());
@@ -0,0 +1,64 @@
1
+ // Auto-generated from standalone schema 'RawStrategy'. Do not edit.
2
+ import { z } from 'zod/v4';
3
+
4
+
5
+ export const RawStrategyZodGenerationWarnings = [
6
+ {
7
+ "path": "$defs.StepArray.uniqueItems",
8
+ "message": "uniqueItems not enforced by generated Zod."
9
+ },
10
+ {
11
+ "path": "$defs.BranchStep.allOfMerged.properties.cases.uniqueItems",
12
+ "message": "uniqueItems not enforced by generated Zod."
13
+ },
14
+ {
15
+ "path": "$defs.Path.format",
16
+ "message": "Ignoring format 'uri-reference' (not enforced by generated Zod)."
17
+ }
18
+ ] as const;
19
+
20
+ const BranchStepSchema: z.ZodTypeAny = z.lazy(() => z.object({ "identity": BranchStepIdentitySchema, "stepKind": z.intersection(z.literal("branch"), StepKindSchema), "cases": z.array(CaseSchema).min(1) }));
21
+ const BranchStepIdentitySchema: z.ZodTypeAny = z.lazy(() => z.string().regex(new RegExp("^BRANCH_STEP-.+$")));
22
+ const CaseSchema: z.ZodTypeAny = z.lazy(() => z.object({ "when": JobStepSchema, "what": JobStepSchema }).strict());
23
+ const CreationContextSchema: z.ZodTypeAny = z.lazy(() => z.object({ "resourceRoleHandle": ResourceRoleIdentitySchema, "jobStepHandle": JobStepIdentitySchema }));
24
+ const CreationContextFacetSchema: z.ZodTypeAny = z.lazy(() => z.object({ "creationContext": CreationContextSchema }));
25
+ const ForStepSchema: z.ZodTypeAny = z.lazy(() => z.object({ "identity": ForStepIdentitySchema, "stepKind": z.intersection(z.literal("for"), StepKindSchema), "case": CaseSchema }));
26
+ const ForStepIdentitySchema: z.ZodTypeAny = z.lazy(() => z.string().regex(new RegExp("^FOR_STEP-.+$")));
27
+ const JobIdentitySchema: z.ZodTypeAny = z.lazy(() => z.string().regex(new RegExp("^JOB-.+$")));
28
+ const JobStepSchema: z.ZodTypeAny = z.lazy(() => z.object({ "identity": JobStepIdentitySchema, "stepKind": z.intersection(z.literal("job"), StepKindSchema), "jobHandle": JobIdentitySchema, "roleBindings": RoleBindingsSchema }));
29
+ const JobStepIdentitySchema: z.ZodTypeAny = z.lazy(() => z.string().regex(new RegExp("^JOB_STEP-.+$")));
30
+ const JobStepSocketSchema: z.ZodTypeAny = z.lazy(() => z.record(z.string(), z.union([ResourcePotentialSchema, ResourceSchema])).superRefine((obj, ctx) => { for (const k of Object.keys(obj)) { if (!new RegExp("^ROLE-.+$").test(k)) ctx.addIssue({ code: 'custom', message: 'Invalid key: ' + k }); } }));
31
+ const NucleusFacetSchema: z.ZodTypeAny = z.lazy(() => z.object({ "nucleus": z.any() }));
32
+ const PathSchema: z.ZodTypeAny = z.lazy(() => z.string());
33
+ const PathFacetSchema: z.ZodTypeAny = z.lazy(() => z.object({ "path": PathSchema }));
34
+ const ResourceSchema: z.ZodTypeAny = z.lazy(() => z.object({ "version": z.literal(1), "resourceShellKind": z.intersection(z.intersection(z.literal("materialized"), ResourceShellKindSchema), ResourceShellKindSchema), "identity": ResourceIdentitySchema, "resourceTypeHandle": ResourceTypeIdentitySchema, "creationContext": CreationContextSchema, "timestamp": TimestampSchema, "path": PathSchema, "nucleus": z.any() }).strict());
35
+ const ResourceIdentitySchema: z.ZodTypeAny = z.lazy(() => z.string().regex(new RegExp("^RESOURCE-.+$")));
36
+ const ResourceInputPotentialSchema: z.ZodTypeAny = z.lazy(() => ShellInputPotentialSchema);
37
+ const ResourceMissingSchema: z.ZodTypeAny = z.lazy(() => ShellMissingSchema);
38
+ const ResourceOutputPotentialSchema: z.ZodTypeAny = z.lazy(() => ShellOutputPotentialSchema);
39
+ const ResourcePotentialSchema: z.ZodTypeAny = z.lazy(() => z.union([ResourceMissingSchema, ResourceInputPotentialSchema, ResourceOutputPotentialSchema]));
40
+ const ResourceRoleIdentitySchema: z.ZodTypeAny = z.lazy(() => z.string().regex(new RegExp("^ROLE-.+$")));
41
+ const ResourceShellBaseSchema: z.ZodTypeAny = z.lazy(() => z.object({ "identity": ResourceIdentitySchema, "resourceTypeHandle": ResourceTypeIdentitySchema, "resourceShellKind": ResourceShellKindSchema }));
42
+ const ResourceShellKindSchema: z.ZodTypeAny = z.lazy(() => z.union([z.literal("missing"), z.literal("inputPotential"), z.literal("outputPotential"), z.literal("materialized")]));
43
+ const ResourceShellKindFacetSchema: z.ZodTypeAny = z.lazy(() => z.object({ "resourceShellKind": ResourceShellKindSchema }));
44
+ const ResourceTypeIdentitySchema: z.ZodTypeAny = z.lazy(() => z.string().regex(new RegExp("^TYPE-.+$")));
45
+ const RoleBindingArraySchema: z.ZodTypeAny = z.lazy(() => z.array(ResourceRoleIdentitySchema));
46
+ const RoleBindingsSchema: z.ZodTypeAny = z.lazy(() => z.object({ "inputBindings": RoleBindingArraySchema, "outputBindings": RoleBindingArraySchema }));
47
+ const RoleBindingsFacetSchema: z.ZodTypeAny = z.lazy(() => z.object({ "roleBindings": RoleBindingsSchema }));
48
+ const ShellInputPotentialSchema: z.ZodTypeAny = z.lazy(() => z.object({ "resourceShellKind": z.intersection(z.intersection(z.literal("inputPotential"), ResourceShellKindSchema), ResourceShellKindSchema), "identity": ResourceIdentitySchema, "resourceTypeHandle": ResourceTypeIdentitySchema, "creationContext": CreationContextSchema }).strict());
49
+ const ShellMaterializedBaseSchema: z.ZodTypeAny = z.lazy(() => z.object({ "version": z.literal(1), "resourceShellKind": z.intersection(z.intersection(z.literal("materialized"), ResourceShellKindSchema), ResourceShellKindSchema), "identity": ResourceIdentitySchema, "resourceTypeHandle": ResourceTypeIdentitySchema, "creationContext": CreationContextSchema, "timestamp": TimestampSchema, "path": PathSchema }));
50
+ const ShellMissingSchema: z.ZodTypeAny = z.lazy(() => z.object({ "resourceShellKind": z.intersection(z.intersection(z.literal("missing"), ResourceShellKindSchema), ResourceShellKindSchema), "identity": ResourceIdentitySchema, "resourceTypeHandle": ResourceTypeIdentitySchema }).strict());
51
+ const ShellOutputPotentialSchema: z.ZodTypeAny = z.lazy(() => z.object({ "resourceShellKind": z.intersection(z.intersection(z.literal("outputPotential"), ResourceShellKindSchema), ResourceShellKindSchema), "identity": ResourceIdentitySchema, "resourceTypeHandle": ResourceTypeIdentitySchema, "creationContext": CreationContextSchema }).strict());
52
+ const StepSchema: z.ZodTypeAny = z.lazy(() => z.union([JobStepSchema, BranchStepSchema, WhileStepSchema, ForStepSchema]));
53
+ const StepArraySchema: z.ZodTypeAny = z.lazy(() => z.array(StepSchema));
54
+ const StepKindSchema: z.ZodTypeAny = z.lazy(() => z.union([z.literal("job"), z.literal("branch"), z.literal("while"), z.literal("for")]));
55
+ const StepKindFacetSchema: z.ZodTypeAny = z.lazy(() => z.object({ "stepKind": StepKindSchema }));
56
+ const StepsFacetSchema: z.ZodTypeAny = z.lazy(() => z.object({ "steps": StepArraySchema }));
57
+ const StrategyStateSchema: z.ZodTypeAny = z.lazy(() => z.record(z.string(), JobStepSocketSchema).superRefine((obj, ctx) => { for (const k of Object.keys(obj)) { if (!new RegExp("^JOB_STEP-.+$").test(k)) ctx.addIssue({ code: 'custom', message: 'Invalid key: ' + k }); } }));
58
+ const StrategyStateFacetSchema: z.ZodTypeAny = z.lazy(() => z.object({ "strategyState": StrategyStateSchema }));
59
+ const TimestampSchema: z.ZodTypeAny = z.lazy(() => z.string().datetime());
60
+ const TimestampFacetSchema: z.ZodTypeAny = z.lazy(() => z.object({ "timestamp": TimestampSchema }));
61
+ const WhileStepSchema: z.ZodTypeAny = z.lazy(() => z.object({ "identity": WhileStepIdentitySchema, "stepKind": z.intersection(z.literal("while"), StepKindSchema), "case": CaseSchema }));
62
+ const WhileStepIdentitySchema: z.ZodTypeAny = z.lazy(() => z.string().regex(new RegExp("^WHILE_STEP-.+$")));
63
+
64
+ export const RawStrategySchema: z.ZodTypeAny = z.lazy(() => z.object({ "steps": StepArraySchema, "strategyState": StrategyStateSchema }).strict());
@@ -0,0 +1,13 @@
1
+ // Auto-generated from standalone schema 'ResourceType'. Do not edit.
2
+ import { z } from 'zod/v4';
3
+
4
+
5
+ const DescriptionSchema: z.ZodTypeAny = z.lazy(() => z.string().min(1));
6
+ const DescriptionFacetSchema: z.ZodTypeAny = z.lazy(() => z.object({ "description": DescriptionSchema }));
7
+ const DocumentationFacetSchema: z.ZodTypeAny = z.lazy(() => z.object({ "name": NameSchema, "description": DescriptionSchema }));
8
+ const NameSchema: z.ZodTypeAny = z.lazy(() => z.string().min(1).regex(new RegExp("^(?:[A-Z][^0-9]*|[a-z]+/[a-z.+&-]+)$")));
9
+ const NameFacetSchema: z.ZodTypeAny = z.lazy(() => z.object({ "name": NameSchema }));
10
+ const ResourceTypeIdentitySchema: z.ZodTypeAny = z.lazy(() => z.string().regex(new RegExp("^TYPE-.+$")));
11
+ const UriSchema: z.ZodTypeAny = z.lazy(() => z.string().url());
12
+
13
+ export const ResourceTypeSchema: z.ZodTypeAny = z.lazy(() => z.object({ "identity": ResourceTypeIdentitySchema, "nucleusSchema": z.any(), "embeddingUriDict": z.record(z.string(), UriSchema).superRefine((obj, ctx) => { for (const k of Object.keys(obj)) { if (!new RegExp("^EMBEDDING-.+$").test(k)) ctx.addIssue({ code: 'custom', message: 'Invalid key: ' + k }); } if (Object.keys(obj).length < 1) ctx.addIssue({ code: 'custom', message: 'Expected at least 1 properties' }); }).optional(), "generatorUriDict": z.record(z.string(), UriSchema).superRefine((obj, ctx) => { for (const k of Object.keys(obj)) { if (!new RegExp("^GENERATOR-.+$").test(k)) ctx.addIssue({ code: 'custom', message: 'Invalid key: ' + k }); } if (Object.keys(obj).length < 1) ctx.addIssue({ code: 'custom', message: 'Expected at least 1 properties' }); }).optional(), "name": NameSchema, "description": DescriptionSchema }));
@@ -0,0 +1,69 @@
1
+ // Auto-generated from standalone schema 'RunnableStrategy'. Do not edit.
2
+ import { z } from 'zod/v4';
3
+
4
+
5
+ export const RunnableStrategyZodGenerationWarnings = [
6
+ {
7
+ "path": "$defs.StepArray.uniqueItems",
8
+ "message": "uniqueItems not enforced by generated Zod."
9
+ },
10
+ {
11
+ "path": "$defs.BranchStep.allOfMerged.properties.cases.uniqueItems",
12
+ "message": "uniqueItems not enforced by generated Zod."
13
+ },
14
+ {
15
+ "path": "$defs.Path.format",
16
+ "message": "Ignoring format 'uri-reference' (not enforced by generated Zod)."
17
+ }
18
+ ] as const;
19
+
20
+ const BranchStepSchema: z.ZodTypeAny = z.lazy(() => z.object({ "identity": BranchStepIdentitySchema, "stepKind": z.intersection(z.literal("branch"), StepKindSchema), "cases": z.array(CaseSchema).min(1) }));
21
+ const BranchStepIdentitySchema: z.ZodTypeAny = z.lazy(() => z.string().regex(new RegExp("^BRANCH_STEP-.+$")));
22
+ const CaseSchema: z.ZodTypeAny = z.lazy(() => z.object({ "when": JobStepSchema, "what": JobStepSchema }).strict());
23
+ const CreationContextSchema: z.ZodTypeAny = z.lazy(() => z.object({ "resourceRoleHandle": ResourceRoleIdentitySchema, "jobStepHandle": JobStepIdentitySchema }));
24
+ const CreationContextFacetSchema: z.ZodTypeAny = z.lazy(() => z.object({ "creationContext": CreationContextSchema }));
25
+ const ForStepSchema: z.ZodTypeAny = z.lazy(() => z.object({ "identity": ForStepIdentitySchema, "stepKind": z.intersection(z.literal("for"), StepKindSchema), "case": CaseSchema }));
26
+ const ForStepIdentitySchema: z.ZodTypeAny = z.lazy(() => z.string().regex(new RegExp("^FOR_STEP-.+$")));
27
+ const JobIdentitySchema: z.ZodTypeAny = z.lazy(() => z.string().regex(new RegExp("^JOB-.+$")));
28
+ const JobStepSchema: z.ZodTypeAny = z.lazy(() => z.object({ "identity": JobStepIdentitySchema, "stepKind": z.intersection(z.literal("job"), StepKindSchema), "jobHandle": JobIdentitySchema, "roleBindings": RoleBindingsSchema }));
29
+ const JobStepIdentitySchema: z.ZodTypeAny = z.lazy(() => z.string().regex(new RegExp("^JOB_STEP-.+$")));
30
+ const JobStepSocketSchema: z.ZodTypeAny = z.lazy(() => z.record(z.string(), z.union([ResourcePotentialSchema, ResourceSchema])).superRefine((obj, ctx) => { for (const k of Object.keys(obj)) { if (!new RegExp("^ROLE-.+$").test(k)) ctx.addIssue({ code: 'custom', message: 'Invalid key: ' + k }); } }));
31
+ const NucleusFacetSchema: z.ZodTypeAny = z.lazy(() => z.object({ "nucleus": z.any() }));
32
+ const PathSchema: z.ZodTypeAny = z.lazy(() => z.string());
33
+ const PathFacetSchema: z.ZodTypeAny = z.lazy(() => z.object({ "path": PathSchema }));
34
+ const ResourceSchema: z.ZodTypeAny = z.lazy(() => z.object({ "version": z.literal(1), "resourceShellKind": z.intersection(z.intersection(z.literal("materialized"), ResourceShellKindSchema), ResourceShellKindSchema), "identity": ResourceIdentitySchema, "resourceTypeHandle": ResourceTypeIdentitySchema, "creationContext": CreationContextSchema, "timestamp": TimestampSchema, "path": PathSchema, "nucleus": z.any() }).strict());
35
+ const ResourceIdentitySchema: z.ZodTypeAny = z.lazy(() => z.string().regex(new RegExp("^RESOURCE-.+$")));
36
+ const ResourceInputPotentialSchema: z.ZodTypeAny = z.lazy(() => ShellInputPotentialSchema);
37
+ const ResourceMissingSchema: z.ZodTypeAny = z.lazy(() => ShellMissingSchema);
38
+ const ResourceOutputPotentialSchema: z.ZodTypeAny = z.lazy(() => ShellOutputPotentialSchema);
39
+ const ResourcePotentialSchema: z.ZodTypeAny = z.lazy(() => z.union([ResourceMissingSchema, ResourceInputPotentialSchema, ResourceOutputPotentialSchema]));
40
+ const ResourceRoleIdentitySchema: z.ZodTypeAny = z.lazy(() => z.string().regex(new RegExp("^ROLE-.+$")));
41
+ const ResourceShellBaseSchema: z.ZodTypeAny = z.lazy(() => z.object({ "identity": ResourceIdentitySchema, "resourceTypeHandle": ResourceTypeIdentitySchema, "resourceShellKind": ResourceShellKindSchema }));
42
+ const ResourceShellKindSchema: z.ZodTypeAny = z.lazy(() => z.union([z.literal("missing"), z.literal("inputPotential"), z.literal("outputPotential"), z.literal("materialized")]));
43
+ const ResourceShellKindFacetSchema: z.ZodTypeAny = z.lazy(() => z.object({ "resourceShellKind": ResourceShellKindSchema }));
44
+ const ResourceTypeIdentitySchema: z.ZodTypeAny = z.lazy(() => z.string().regex(new RegExp("^TYPE-.+$")));
45
+ const RoleBindingArraySchema: z.ZodTypeAny = z.lazy(() => z.array(ResourceRoleIdentitySchema));
46
+ const RoleBindingsSchema: z.ZodTypeAny = z.lazy(() => z.object({ "inputBindings": RoleBindingArraySchema, "outputBindings": RoleBindingArraySchema }));
47
+ const RoleBindingsFacetSchema: z.ZodTypeAny = z.lazy(() => z.object({ "roleBindings": RoleBindingsSchema }));
48
+ const RunnableStrategyContextSchema: z.ZodTypeAny = z.lazy(() => z.object({ "status": RunnableStrategyStatusSchema, "startedAt": TimestampSchema.optional(), "completedAt": TimestampSchema.optional() }).strict());
49
+ const RunnableStrategyIdentitySchema: z.ZodTypeAny = z.lazy(() => z.string().regex(new RegExp("^RUNNABLE_STRATEGY-.+$")));
50
+ const RunnableStrategyStatusSchema: z.ZodTypeAny = z.lazy(() => z.union([z.literal("pending"), z.literal("running"), z.literal("completed"), z.literal("failed"), z.literal("cancelled")]));
51
+ const ShellInputPotentialSchema: z.ZodTypeAny = z.lazy(() => z.object({ "resourceShellKind": z.intersection(z.intersection(z.literal("inputPotential"), ResourceShellKindSchema), ResourceShellKindSchema), "identity": ResourceIdentitySchema, "resourceTypeHandle": ResourceTypeIdentitySchema, "creationContext": CreationContextSchema }).strict());
52
+ const ShellMaterializedBaseSchema: z.ZodTypeAny = z.lazy(() => z.object({ "version": z.literal(1), "resourceShellKind": z.intersection(z.intersection(z.literal("materialized"), ResourceShellKindSchema), ResourceShellKindSchema), "identity": ResourceIdentitySchema, "resourceTypeHandle": ResourceTypeIdentitySchema, "creationContext": CreationContextSchema, "timestamp": TimestampSchema, "path": PathSchema }));
53
+ const ShellMissingSchema: z.ZodTypeAny = z.lazy(() => z.object({ "resourceShellKind": z.intersection(z.intersection(z.literal("missing"), ResourceShellKindSchema), ResourceShellKindSchema), "identity": ResourceIdentitySchema, "resourceTypeHandle": ResourceTypeIdentitySchema }).strict());
54
+ const ShellOutputPotentialSchema: z.ZodTypeAny = z.lazy(() => z.object({ "resourceShellKind": z.intersection(z.intersection(z.literal("outputPotential"), ResourceShellKindSchema), ResourceShellKindSchema), "identity": ResourceIdentitySchema, "resourceTypeHandle": ResourceTypeIdentitySchema, "creationContext": CreationContextSchema }).strict());
55
+ const StepSchema: z.ZodTypeAny = z.lazy(() => z.union([JobStepSchema, BranchStepSchema, WhileStepSchema, ForStepSchema]));
56
+ const StepArraySchema: z.ZodTypeAny = z.lazy(() => z.array(StepSchema));
57
+ const StepKindSchema: z.ZodTypeAny = z.lazy(() => z.union([z.literal("job"), z.literal("branch"), z.literal("while"), z.literal("for")]));
58
+ const StepKindFacetSchema: z.ZodTypeAny = z.lazy(() => z.object({ "stepKind": StepKindSchema }));
59
+ const StrategyStateSchema: z.ZodTypeAny = z.lazy(() => z.record(z.string(), JobStepSocketSchema).superRefine((obj, ctx) => { for (const k of Object.keys(obj)) { if (!new RegExp("^JOB_STEP-.+$").test(k)) ctx.addIssue({ code: 'custom', message: 'Invalid key: ' + k }); } }));
60
+ const StrategyStateFacetSchema: z.ZodTypeAny = z.lazy(() => z.object({ "strategyState": StrategyStateSchema }));
61
+ const StrategyThreadDictSchema: z.ZodTypeAny = z.lazy(() => z.record(z.string(), StepArraySchema).superRefine((obj, ctx) => { for (const k of Object.keys(obj)) { if (!new RegExp("^STRATEGY_THREAD-.+$").test(k)) ctx.addIssue({ code: 'custom', message: 'Invalid key: ' + k }); } }));
62
+ const StrategyThreadDictFacetSchema: z.ZodTypeAny = z.lazy(() => z.object({ "strategyThreadDict": StrategyThreadDictSchema }));
63
+ const StrategyThreadIdentitySchema: z.ZodTypeAny = z.lazy(() => z.string().regex(new RegExp("^STRATEGY_THREAD-.+$")));
64
+ const TimestampSchema: z.ZodTypeAny = z.lazy(() => z.string().datetime());
65
+ const TimestampFacetSchema: z.ZodTypeAny = z.lazy(() => z.object({ "timestamp": TimestampSchema }));
66
+ const WhileStepSchema: z.ZodTypeAny = z.lazy(() => z.object({ "identity": WhileStepIdentitySchema, "stepKind": z.intersection(z.literal("while"), StepKindSchema), "case": CaseSchema }));
67
+ const WhileStepIdentitySchema: z.ZodTypeAny = z.lazy(() => z.string().regex(new RegExp("^WHILE_STEP-.+$")));
68
+
69
+ export const RunnableStrategySchema: z.ZodTypeAny = z.lazy(() => z.object({ "identity": RunnableStrategyIdentitySchema, "runnableStrategyContext": RunnableStrategyContextSchema, "strategyThreadDict": StrategyThreadDictSchema, "strategyState": StrategyStateSchema }).strict());
@@ -0,0 +1,83 @@
1
+ // Auto-generated from standalone schema 'StrategyRun'. Do not edit.
2
+ import { z } from 'zod/v4';
3
+
4
+
5
+ export const StrategyRunZodGenerationWarnings = [
6
+ {
7
+ "path": "$defs.StepArray.uniqueItems",
8
+ "message": "uniqueItems not enforced by generated Zod."
9
+ },
10
+ {
11
+ "path": "$defs.BranchStep.allOfMerged.properties.cases.uniqueItems",
12
+ "message": "uniqueItems not enforced by generated Zod."
13
+ },
14
+ {
15
+ "path": "$defs.Path.format",
16
+ "message": "Ignoring format 'uri-reference' (not enforced by generated Zod)."
17
+ }
18
+ ] as const;
19
+
20
+ const BranchStepSchema: z.ZodTypeAny = z.lazy(() => z.object({ "identity": BranchStepIdentitySchema, "stepKind": z.intersection(z.literal("branch"), StepKindSchema), "cases": z.array(CaseSchema).min(1) }));
21
+ const BranchStepIdentitySchema: z.ZodTypeAny = z.lazy(() => z.string().regex(new RegExp("^BRANCH_STEP-.+$")));
22
+ const CaseSchema: z.ZodTypeAny = z.lazy(() => z.object({ "when": JobStepSchema, "what": JobStepSchema }).strict());
23
+ const CreationContextSchema: z.ZodTypeAny = z.lazy(() => z.object({ "resourceRoleHandle": ResourceRoleIdentitySchema, "jobStepHandle": JobStepIdentitySchema }));
24
+ const CreationContextFacetSchema: z.ZodTypeAny = z.lazy(() => z.object({ "creationContext": CreationContextSchema }));
25
+ const ForStepSchema: z.ZodTypeAny = z.lazy(() => z.object({ "identity": ForStepIdentitySchema, "stepKind": z.intersection(z.literal("for"), StepKindSchema), "case": CaseSchema }));
26
+ const ForStepIdentitySchema: z.ZodTypeAny = z.lazy(() => z.string().regex(new RegExp("^FOR_STEP-.+$")));
27
+ const GraphEndRunEventSchema: z.ZodTypeAny = z.lazy(() => z.object({ "runEventKind": z.intersection(RunEventKindSchema, z.literal("graph_end")), "runnableStrategyHandle": RunnableStrategyIdentitySchema, "strategyThreadHandle": StrategyThreadIdentitySchema, "createdAt": TimestampSchema, "nodeName": z.string(), "eventSeq": z.number().int(), "counters": RunEventCountersSchema.optional(), "stepMetadata": RunEventStepMetadataSchema.optional(), "updates": RunEventUpdatesSchema.optional() }));
28
+ const GraphStartRunEventSchema: z.ZodTypeAny = z.lazy(() => z.object({ "runEventKind": z.intersection(RunEventKindSchema, z.literal("graph_start")), "runnableStrategyHandle": RunnableStrategyIdentitySchema, "strategyThreadHandle": StrategyThreadIdentitySchema, "createdAt": TimestampSchema, "nodeName": z.string(), "eventSeq": z.number().int(), "counters": RunEventCountersSchema.optional(), "stepMetadata": RunEventStepMetadataSchema.optional(), "updates": RunEventUpdatesSchema.optional(), "runnableStrategySeed": RunnableStrategySchema }));
29
+ const InterruptRunEventSchema: z.ZodTypeAny = z.lazy(() => z.object({ "runEventKind": z.intersection(RunEventKindSchema, z.literal("interrupt")), "runnableStrategyHandle": RunnableStrategyIdentitySchema, "strategyThreadHandle": StrategyThreadIdentitySchema, "createdAt": TimestampSchema, "nodeName": z.string(), "eventSeq": z.number().int(), "counters": RunEventCountersSchema.optional(), "stepMetadata": RunEventStepMetadataSchema.optional(), "updates": RunEventUpdatesSchema.optional() }));
30
+ const JobIdentitySchema: z.ZodTypeAny = z.lazy(() => z.string().regex(new RegExp("^JOB-.+$")));
31
+ const JobStepSchema: z.ZodTypeAny = z.lazy(() => z.object({ "identity": JobStepIdentitySchema, "stepKind": z.intersection(z.literal("job"), StepKindSchema), "jobHandle": JobIdentitySchema, "roleBindings": RoleBindingsSchema }));
32
+ const JobStepIdentitySchema: z.ZodTypeAny = z.lazy(() => z.string().regex(new RegExp("^JOB_STEP-.+$")));
33
+ const JobStepSocketSchema: z.ZodTypeAny = z.lazy(() => z.record(z.string(), z.union([ResourcePotentialSchema, ResourceSchema])).superRefine((obj, ctx) => { for (const k of Object.keys(obj)) { if (!new RegExp("^ROLE-.+$").test(k)) ctx.addIssue({ code: 'custom', message: 'Invalid key: ' + k }); } }));
34
+ const NucleusFacetSchema: z.ZodTypeAny = z.lazy(() => z.object({ "nucleus": z.any() }));
35
+ const PathSchema: z.ZodTypeAny = z.lazy(() => z.string());
36
+ const PathFacetSchema: z.ZodTypeAny = z.lazy(() => z.object({ "path": PathSchema }));
37
+ const ResourceSchema: z.ZodTypeAny = z.lazy(() => z.object({ "version": z.literal(1), "resourceShellKind": z.intersection(z.intersection(z.literal("materialized"), ResourceShellKindSchema), ResourceShellKindSchema), "identity": ResourceIdentitySchema, "resourceTypeHandle": ResourceTypeIdentitySchema, "creationContext": CreationContextSchema, "timestamp": TimestampSchema, "path": PathSchema, "nucleus": z.any() }).strict());
38
+ const ResourceIdentitySchema: z.ZodTypeAny = z.lazy(() => z.string().regex(new RegExp("^RESOURCE-.+$")));
39
+ const ResourceInputPotentialSchema: z.ZodTypeAny = z.lazy(() => ShellInputPotentialSchema);
40
+ const ResourceMissingSchema: z.ZodTypeAny = z.lazy(() => ShellMissingSchema);
41
+ const ResourceOutputPotentialSchema: z.ZodTypeAny = z.lazy(() => ShellOutputPotentialSchema);
42
+ const ResourcePotentialSchema: z.ZodTypeAny = z.lazy(() => z.union([ResourceMissingSchema, ResourceInputPotentialSchema, ResourceOutputPotentialSchema]));
43
+ const ResourceRoleIdentitySchema: z.ZodTypeAny = z.lazy(() => z.string().regex(new RegExp("^ROLE-.+$")));
44
+ const ResourceShellBaseSchema: z.ZodTypeAny = z.lazy(() => z.object({ "identity": ResourceIdentitySchema, "resourceTypeHandle": ResourceTypeIdentitySchema, "resourceShellKind": ResourceShellKindSchema }));
45
+ const ResourceShellKindSchema: z.ZodTypeAny = z.lazy(() => z.union([z.literal("missing"), z.literal("inputPotential"), z.literal("outputPotential"), z.literal("materialized")]));
46
+ const ResourceShellKindFacetSchema: z.ZodTypeAny = z.lazy(() => z.object({ "resourceShellKind": ResourceShellKindSchema }));
47
+ const ResourceTypeIdentitySchema: z.ZodTypeAny = z.lazy(() => z.string().regex(new RegExp("^TYPE-.+$")));
48
+ const RoleBindingArraySchema: z.ZodTypeAny = z.lazy(() => z.array(ResourceRoleIdentitySchema));
49
+ const RoleBindingsSchema: z.ZodTypeAny = z.lazy(() => z.object({ "inputBindings": RoleBindingArraySchema, "outputBindings": RoleBindingArraySchema }));
50
+ const RoleBindingsFacetSchema: z.ZodTypeAny = z.lazy(() => z.object({ "roleBindings": RoleBindingsSchema }));
51
+ const RunEventSchema: z.ZodTypeAny = z.lazy(() => z.union([GraphStartRunEventSchema, TickRunEventSchema, InterruptRunEventSchema, GraphEndRunEventSchema]));
52
+ const RunEventBaseSchema: z.ZodTypeAny = z.lazy(() => z.object({ "runEventKind": RunEventKindSchema, "runnableStrategyHandle": RunnableStrategyIdentitySchema, "strategyThreadHandle": StrategyThreadIdentitySchema, "createdAt": TimestampSchema, "nodeName": z.string(), "eventSeq": z.number().int(), "counters": RunEventCountersSchema.optional(), "stepMetadata": RunEventStepMetadataSchema.optional(), "updates": RunEventUpdatesSchema.optional() }));
53
+ const RunEventCountersSchema: z.ZodTypeAny = z.lazy(() => z.object({ "stepCounterAfter": z.number().int().optional(), "iterationCounterAfter": z.number().int().optional() }));
54
+ const RunEventKindSchema: z.ZodTypeAny = z.lazy(() => z.union([z.literal("graph_start"), z.literal("tick"), z.literal("interrupt"), z.literal("graph_end")]));
55
+ const RunEventStepMetadataSchema: z.ZodTypeAny = z.lazy(() => z.object({ "stepHandle": StepIdentitySchema, "stepKind": StepKindSchema, "threadStepIndex": z.number().int() }));
56
+ const RunEventUpdatesSchema: z.ZodTypeAny = z.lazy(() => z.object({ "stepsMutation": z.object({ "insertAt": z.number().int(), "inserted": StepArraySchema }).optional(), "interruptData": z.union([z.object({ }), z.null()]).optional(), "strategyStateUpdate": StrategyStateSchema }));
57
+ const RunnableStrategySchema: z.ZodTypeAny = z.lazy(() => z.object({ "identity": RunnableStrategyIdentitySchema, "runnableStrategyContext": RunnableStrategyContextSchema, "strategyThreadDict": StrategyThreadDictSchema, "strategyState": StrategyStateSchema }).strict());
58
+ const RunnableStrategyContextSchema: z.ZodTypeAny = z.lazy(() => z.object({ "status": RunnableStrategyStatusSchema, "startedAt": TimestampSchema.optional(), "completedAt": TimestampSchema.optional() }).strict());
59
+ const RunnableStrategyIdentitySchema: z.ZodTypeAny = z.lazy(() => z.string().regex(new RegExp("^RUNNABLE_STRATEGY-.+$")));
60
+ const RunnableStrategyStatusSchema: z.ZodTypeAny = z.lazy(() => z.union([z.literal("pending"), z.literal("running"), z.literal("completed"), z.literal("failed"), z.literal("cancelled")]));
61
+ const ShellInputPotentialSchema: z.ZodTypeAny = z.lazy(() => z.object({ "resourceShellKind": z.intersection(z.intersection(z.literal("inputPotential"), ResourceShellKindSchema), ResourceShellKindSchema), "identity": ResourceIdentitySchema, "resourceTypeHandle": ResourceTypeIdentitySchema, "creationContext": CreationContextSchema }).strict());
62
+ const ShellMaterializedBaseSchema: z.ZodTypeAny = z.lazy(() => z.object({ "version": z.literal(1), "resourceShellKind": z.intersection(z.intersection(z.literal("materialized"), ResourceShellKindSchema), ResourceShellKindSchema), "identity": ResourceIdentitySchema, "resourceTypeHandle": ResourceTypeIdentitySchema, "creationContext": CreationContextSchema, "timestamp": TimestampSchema, "path": PathSchema }));
63
+ const ShellMissingSchema: z.ZodTypeAny = z.lazy(() => z.object({ "resourceShellKind": z.intersection(z.intersection(z.literal("missing"), ResourceShellKindSchema), ResourceShellKindSchema), "identity": ResourceIdentitySchema, "resourceTypeHandle": ResourceTypeIdentitySchema }).strict());
64
+ const ShellOutputPotentialSchema: z.ZodTypeAny = z.lazy(() => z.object({ "resourceShellKind": z.intersection(z.intersection(z.literal("outputPotential"), ResourceShellKindSchema), ResourceShellKindSchema), "identity": ResourceIdentitySchema, "resourceTypeHandle": ResourceTypeIdentitySchema, "creationContext": CreationContextSchema }).strict());
65
+ const StepSchema: z.ZodTypeAny = z.lazy(() => z.union([JobStepSchema, BranchStepSchema, WhileStepSchema, ForStepSchema]));
66
+ const StepArraySchema: z.ZodTypeAny = z.lazy(() => z.array(StepSchema));
67
+ const StepIdentitySchema: z.ZodTypeAny = z.lazy(() => z.union([JobStepIdentitySchema, BranchStepIdentitySchema, WhileStepIdentitySchema, ForStepIdentitySchema]));
68
+ const StepKindSchema: z.ZodTypeAny = z.lazy(() => z.union([z.literal("job"), z.literal("branch"), z.literal("while"), z.literal("for")]));
69
+ const StepKindFacetSchema: z.ZodTypeAny = z.lazy(() => z.object({ "stepKind": StepKindSchema }));
70
+ const StrategyRunIdentitySchema: z.ZodTypeAny = z.lazy(() => z.string().regex(new RegExp("^STRATEGY_RUN-.+$")));
71
+ const StrategyStateSchema: z.ZodTypeAny = z.lazy(() => z.record(z.string(), JobStepSocketSchema).superRefine((obj, ctx) => { for (const k of Object.keys(obj)) { if (!new RegExp("^JOB_STEP-.+$").test(k)) ctx.addIssue({ code: 'custom', message: 'Invalid key: ' + k }); } }));
72
+ const StrategyStateDeltaSchema: z.ZodTypeAny = z.lazy(() => z.object({ "strategyStateUpdate": StrategyStateSchema }));
73
+ const StrategyStateFacetSchema: z.ZodTypeAny = z.lazy(() => z.object({ "strategyState": StrategyStateSchema }));
74
+ const StrategyThreadDictSchema: z.ZodTypeAny = z.lazy(() => z.record(z.string(), StepArraySchema).superRefine((obj, ctx) => { for (const k of Object.keys(obj)) { if (!new RegExp("^STRATEGY_THREAD-.+$").test(k)) ctx.addIssue({ code: 'custom', message: 'Invalid key: ' + k }); } }));
75
+ const StrategyThreadDictFacetSchema: z.ZodTypeAny = z.lazy(() => z.object({ "strategyThreadDict": StrategyThreadDictSchema }));
76
+ const StrategyThreadIdentitySchema: z.ZodTypeAny = z.lazy(() => z.string().regex(new RegExp("^STRATEGY_THREAD-.+$")));
77
+ const TickRunEventSchema: z.ZodTypeAny = z.lazy(() => z.object({ "runEventKind": z.intersection(RunEventKindSchema, z.literal("tick")), "runnableStrategyHandle": RunnableStrategyIdentitySchema, "strategyThreadHandle": StrategyThreadIdentitySchema, "createdAt": TimestampSchema, "nodeName": z.string(), "eventSeq": z.number().int(), "counters": RunEventCountersSchema.optional(), "stepMetadata": RunEventStepMetadataSchema.optional(), "updates": RunEventUpdatesSchema.optional() }));
78
+ const TimestampSchema: z.ZodTypeAny = z.lazy(() => z.string().datetime());
79
+ const TimestampFacetSchema: z.ZodTypeAny = z.lazy(() => z.object({ "timestamp": TimestampSchema }));
80
+ const WhileStepSchema: z.ZodTypeAny = z.lazy(() => z.object({ "identity": WhileStepIdentitySchema, "stepKind": z.intersection(z.literal("while"), StepKindSchema), "case": CaseSchema }));
81
+ const WhileStepIdentitySchema: z.ZodTypeAny = z.lazy(() => z.string().regex(new RegExp("^WHILE_STEP-.+$")));
82
+
83
+ export const StrategyRunSchema: z.ZodTypeAny = z.lazy(() => z.object({ "identity": StrategyRunIdentitySchema, "runnableStrategyHandle": RunnableStrategyIdentitySchema, "recordedAt": TimestampSchema, "runEvents": z.array(RunEventSchema) }).strict());
@@ -0,0 +1,7 @@
1
+ // Auto-generated barrel file. Do not edit.
2
+ export { GoalSchema } from './Goal.js';
3
+ export { JobSchema } from './Job.js';
4
+ export { RawStrategySchema } from './RawStrategy.js';
5
+ export { ResourceTypeSchema } from './ResourceType.js';
6
+ export { RunnableStrategySchema } from './RunnableStrategy.js';
7
+ export { StrategyRunSchema } from './StrategyRun.js';
package/src/index.ts CHANGED
@@ -8,6 +8,20 @@ export { default as ResourceGenesis } from './generated/resources/Genesis.js';
8
8
  export { default as CONSTANTS } from './generated/artifacts/constants.js';
9
9
  export { default as MAPPINGS } from './generated/artifacts/mappings.js';
10
10
 
11
+ // Re-export internals // ATTENTION: does this work?
12
+ export { default as NATURALS } from './internals/naturals.json';
13
+ export { default as BOOLEANS } from './internals/booleans.json';
14
+ export { default as JOBS } from './internals/jobs.json';
15
+
16
+ // Re-export generated Zod validators
17
+ export { JobSchema as ZodJobSchema } from './generated/schemas/zod/Job.js';
18
+ export { ResourceTypeSchema as ZodResourceTypeSchema } from './generated/schemas/zod/ResourceType.js';
19
+ export { RawStrategySchema as ZodRawStrategySchema } from './generated/schemas/zod/RawStrategy.js';
20
+ export { RunnableStrategySchema as ZodRunnableStrategySchema } from './generated/schemas/zod/RunnableStrategy.js';
21
+ export { StrategyRunSchema as ZodStrategyRunSchema } from './generated/schemas/zod/StrategyRun.js';
22
+ export { GoalSchema as ZodGoalSchema } from './generated/schemas/zod/Goal.js';
23
+ export * as ZodSchemas from './generated/schemas/zod/index.js';
24
+
11
25
 
12
26
  export type {
13
27
  Resource_Genesis as Resource_GenesisJson
@@ -54,6 +68,7 @@ export type {
54
68
  ResourceMissingJson,
55
69
  ResourceInputPotentialJson,
56
70
  ResourceOutputPotentialJson,
71
+ ResourcePotentialJson,
57
72
  ShellMaterializedBaseJson,
58
73
  ResourceJson,
59
74
  StrategyStateJson,
@@ -0,0 +1,32 @@
1
+ [
2
+ {
3
+ "identity": "RESOURCE-False",
4
+ "resourceTypeHandle": "TYPE-Boolean",
5
+ "creationContext": {
6
+ "resourceRoleHandle": "ROLE-Manual",
7
+ "jobStepHandle": "JOB_STEP-Genesis"
8
+ },
9
+ "resourceShellKind": "materialized",
10
+ "version": 1,
11
+ "path": "internals://boolean/false",
12
+ "timestamp": "2025-11-30T00:00:00.000Z",
13
+ "nucleus": {
14
+ "identity": false
15
+ }
16
+ },
17
+ {
18
+ "identity": "RESOURCE-True",
19
+ "resourceTypeHandle": "TYPE-Boolean",
20
+ "creationContext": {
21
+ "resourceRoleHandle": "ROLE-Manual",
22
+ "jobStepHandle": "JOB_STEP-Genesis"
23
+ },
24
+ "resourceShellKind": "materialized",
25
+ "version": 1,
26
+ "path": "internals://boolean/true",
27
+ "timestamp": "2025-11-30T00:00:00.000Z",
28
+ "nucleus": {
29
+ "identity": true
30
+ }
31
+ }
32
+ ]