@toolproof-core/schema 1.0.15 → 1.0.17

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 (47) hide show
  1. package/dist/generated/artifacts/constants.d.ts +0 -1
  2. package/dist/generated/artifacts/constants.js +0 -1
  3. package/dist/generated/normalized/Genesis.json +2 -37
  4. package/dist/generated/resources/Genesis.json +2 -49
  5. package/dist/generated/schemas/Genesis.json +2 -32
  6. package/dist/generated/schemas/zod/Goal.d.ts +2 -0
  7. package/dist/generated/schemas/zod/Goal.js +5 -0
  8. package/dist/generated/schemas/zod/Job.d.ts +6 -0
  9. package/dist/generated/schemas/zod/Job.js +25 -0
  10. package/dist/generated/schemas/zod/RawStrategy.d.ts +12 -0
  11. package/dist/generated/schemas/zod/RawStrategy.js +66 -0
  12. package/dist/generated/schemas/zod/ResourceType.d.ts +2 -0
  13. package/dist/generated/schemas/zod/ResourceType.js +18 -0
  14. package/dist/generated/schemas/zod/RunnableStrategy.d.ts +12 -0
  15. package/dist/generated/schemas/zod/RunnableStrategy.js +74 -0
  16. package/dist/generated/schemas/zod/StrategyRun.d.ts +12 -0
  17. package/dist/generated/schemas/zod/StrategyRun.js +88 -0
  18. package/dist/generated/schemas/zod/index.d.ts +6 -0
  19. package/dist/generated/schemas/zod/index.js +7 -0
  20. package/dist/generated/types/types.d.ts +0 -14
  21. package/dist/index.d.ts +8 -1
  22. package/dist/index.js +8 -0
  23. package/dist/scripts/_lib/config.d.ts +3 -0
  24. package/dist/scripts/_lib/config.js +9 -0
  25. package/dist/scripts/_lib/utils/jsonSchemaToZod.d.ts +18 -0
  26. package/dist/scripts/_lib/utils/jsonSchemaToZod.js +607 -0
  27. package/dist/scripts/generateStandaloneZodSchema.d.ts +1 -0
  28. package/dist/scripts/generateStandaloneZodSchema.js +116 -0
  29. package/package.json +6 -2
  30. package/src/Genesis.json +2 -38
  31. package/src/generated/artifacts/constants.ts +0 -1
  32. package/src/generated/artifacts/dependencyMap.json +1 -4
  33. package/src/generated/normalized/Genesis.json +2 -37
  34. package/src/generated/resources/Genesis.json +2 -49
  35. package/src/generated/schemas/Genesis.json +2 -32
  36. package/src/generated/schemas/zod/Goal.ts +8 -0
  37. package/src/generated/schemas/zod/Job.ts +26 -0
  38. package/src/generated/schemas/zod/RawStrategy.ts +64 -0
  39. package/src/generated/schemas/zod/ResourceType.ts +13 -0
  40. package/src/generated/schemas/zod/RunnableStrategy.ts +69 -0
  41. package/src/generated/schemas/zod/StrategyRun.ts +83 -0
  42. package/src/generated/schemas/zod/index.ts +7 -0
  43. package/src/generated/types/types.d.ts +0 -14
  44. package/src/index.ts +10 -1
  45. package/src/scripts/_lib/config.ts +12 -0
  46. package/src/scripts/_lib/utils/jsonSchemaToZod.ts +646 -0
  47. 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.15",
3
+ "version": "1.0.17",
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
  }
package/src/Genesis.json CHANGED
@@ -1087,41 +1087,6 @@
1087
1087
  "unevaluatedProperties": false
1088
1088
  }
1089
1089
  },
1090
- "JsonData": {
1091
- "identity": "TYPE-JsonData",
1092
- "name": "JsonData",
1093
- "description": "dummy-description",
1094
- "nucleusSchema": {
1095
- "$anchor": "JsonData",
1096
- "$schema": "https://json-schema.org/draft/2020-12/schema",
1097
- "oneOf": [
1098
- {
1099
- "type": "null"
1100
- },
1101
- {
1102
- "type": "boolean"
1103
- },
1104
- {
1105
- "type": "number"
1106
- },
1107
- {
1108
- "type": "string"
1109
- },
1110
- {
1111
- "type": "array",
1112
- "items": {
1113
- "$ref": "#JsonData"
1114
- }
1115
- },
1116
- {
1117
- "type": "object",
1118
- "additionalProperties": {
1119
- "$ref": "#JsonData"
1120
- }
1121
- }
1122
- ]
1123
- }
1124
- },
1125
1090
  "Nucleus": {
1126
1091
  "identity": "TYPE-Nucleus",
1127
1092
  "name": "Nucleus",
@@ -1130,9 +1095,8 @@
1130
1095
  "$anchor": "Nucleus",
1131
1096
  "$schema": "https://json-schema.org/draft/2020-12/schema",
1132
1097
  "type": "object",
1133
- "additionalProperties": {
1134
- "$ref": "#JsonData"
1135
- }
1098
+ "additionalProperties": true,
1099
+ "$comment": "Currently not used."
1136
1100
  }
1137
1101
  },
1138
1102
  "NucleusFacet": {
@@ -23,7 +23,6 @@ const CONSTANTS = {
23
23
  JobStep: 'JobStep',
24
24
  JobStepIdentity: 'JobStepIdentity',
25
25
  JobStepSocket: 'JobStepSocket',
26
- JsonData: 'JsonData',
27
26
  Name: 'Name',
28
27
  NameFacet: 'NameFacet',
29
28
  Natural: 'Natural',
@@ -164,10 +164,7 @@
164
164
  "ResourceInputPotential",
165
165
  "ResourceOutputPotential"
166
166
  ],
167
- "JsonData": [],
168
- "Nucleus": [
169
- "JsonData"
170
- ],
167
+ "Nucleus": [],
171
168
  "NucleusFacet": [],
172
169
  "Resource": [
173
170
  "ShellMaterializedBase",
@@ -1034,40 +1034,6 @@
1034
1034
  "unevaluatedProperties": false
1035
1035
  }
1036
1036
  },
1037
- "JsonData": {
1038
- "identity": "TYPE-JsonData",
1039
- "name": "JsonData",
1040
- "description": "dummy-description",
1041
- "nucleusSchema": {
1042
- "$schema": "https://json-schema.org/draft/2020-12/schema",
1043
- "oneOf": [
1044
- {
1045
- "type": "null"
1046
- },
1047
- {
1048
- "type": "boolean"
1049
- },
1050
- {
1051
- "type": "number"
1052
- },
1053
- {
1054
- "type": "string"
1055
- },
1056
- {
1057
- "type": "array",
1058
- "items": {
1059
- "$ref": "#/$defs/JsonData"
1060
- }
1061
- },
1062
- {
1063
- "type": "object",
1064
- "additionalProperties": {
1065
- "$ref": "#/$defs/JsonData"
1066
- }
1067
- }
1068
- ]
1069
- }
1070
- },
1071
1037
  "Nucleus": {
1072
1038
  "identity": "TYPE-Nucleus",
1073
1039
  "name": "Nucleus",
@@ -1075,9 +1041,8 @@
1075
1041
  "nucleusSchema": {
1076
1042
  "$schema": "https://json-schema.org/draft/2020-12/schema",
1077
1043
  "type": "object",
1078
- "additionalProperties": {
1079
- "$ref": "#/$defs/JsonData"
1080
- }
1044
+ "additionalProperties": true,
1045
+ "$comment": "Currently not used."
1081
1046
  }
1082
1047
  },
1083
1048
  "NucleusFacet": {
@@ -1663,52 +1663,6 @@
1663
1663
  }
1664
1664
  }
1665
1665
  },
1666
- "JsonData": {
1667
- "identity": "RESOURCE-JsonData",
1668
- "resourceTypeHandle": "TYPE-ResourceType",
1669
- "creationContext": {
1670
- "resourceRoleHandle": "ROLE-Genesis",
1671
- "jobStepHandle": "JOB_STEP-Genesis"
1672
- },
1673
- "resourceShellKind": "materialized",
1674
- "version": 1,
1675
- "timestamp": "2025-11-30T00:00:00.000Z",
1676
- "path": "https://schemas.toolproof.com/v1/Genesis.json#/$defs/JsonData",
1677
- "nucleus": {
1678
- "identity": "TYPE-JsonData",
1679
- "name": "JsonData",
1680
- "description": "dummy-description",
1681
- "nucleusSchema": {
1682
- "$schema": "https://json-schema.org/draft/2020-12/schema",
1683
- "oneOf": [
1684
- {
1685
- "type": "null"
1686
- },
1687
- {
1688
- "type": "boolean"
1689
- },
1690
- {
1691
- "type": "number"
1692
- },
1693
- {
1694
- "type": "string"
1695
- },
1696
- {
1697
- "type": "array",
1698
- "items": {
1699
- "$ref": "#/$defs/JsonData"
1700
- }
1701
- },
1702
- {
1703
- "type": "object",
1704
- "additionalProperties": {
1705
- "$ref": "#/$defs/JsonData"
1706
- }
1707
- }
1708
- ]
1709
- }
1710
- }
1711
- },
1712
1666
  "Nucleus": {
1713
1667
  "identity": "RESOURCE-Nucleus",
1714
1668
  "resourceTypeHandle": "TYPE-ResourceType",
@@ -1727,9 +1681,8 @@
1727
1681
  "nucleusSchema": {
1728
1682
  "$schema": "https://json-schema.org/draft/2020-12/schema",
1729
1683
  "type": "object",
1730
- "additionalProperties": {
1731
- "$ref": "#/$defs/JsonData"
1732
- }
1684
+ "additionalProperties": true,
1685
+ "$comment": "Currently not used."
1733
1686
  }
1734
1687
  }
1735
1688
  },
@@ -767,41 +767,11 @@
767
767
  ],
768
768
  "unevaluatedProperties": false
769
769
  },
770
- "JsonData": {
771
- "$schema": "https://json-schema.org/draft/2020-12/schema",
772
- "oneOf": [
773
- {
774
- "type": "null"
775
- },
776
- {
777
- "type": "boolean"
778
- },
779
- {
780
- "type": "number"
781
- },
782
- {
783
- "type": "string"
784
- },
785
- {
786
- "type": "array",
787
- "items": {
788
- "$ref": "#/$defs/JsonData"
789
- }
790
- },
791
- {
792
- "type": "object",
793
- "additionalProperties": {
794
- "$ref": "#/$defs/JsonData"
795
- }
796
- }
797
- ]
798
- },
799
770
  "Nucleus": {
800
771
  "$schema": "https://json-schema.org/draft/2020-12/schema",
801
772
  "type": "object",
802
- "additionalProperties": {
803
- "$ref": "#/$defs/JsonData"
804
- }
773
+ "additionalProperties": true,
774
+ "$comment": "Currently not used."
805
775
  },
806
776
  "NucleusFacet": {
807
777
  "$schema": "https://json-schema.org/draft/2020-12/schema",
@@ -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());