@toolproof-core/genesis 1.0.47

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 (112) hide show
  1. package/dist/src/utils/constantsAndMappings.d.ts +20 -0
  2. package/dist/src/utils/constantsAndMappings.js +155 -0
  3. package/dist/src/utils/coreProjection.d.ts +16 -0
  4. package/dist/src/utils/coreProjection.js +29 -0
  5. package/dist/src/utils/resourceTypes.d.ts +12 -0
  6. package/dist/src/utils/resourceTypes.js +17 -0
  7. package/dist/src/utils/resources.d.ts +5 -0
  8. package/dist/src/utils/resources.js +17 -0
  9. package/dist/src/utils/schemaDependencies.d.ts +13 -0
  10. package/dist/src/utils/schemaDependencies.js +94 -0
  11. package/dist/src/utils/schemaObjectNormalization.d.ts +1 -0
  12. package/dist/src/utils/schemaObjectNormalization.js +66 -0
  13. package/dist/src/utils/schemaRefNormalization.d.ts +2 -0
  14. package/dist/src/utils/schemaRefNormalization.js +76 -0
  15. package/dist/src/utils/schemaShims.d.ts +2 -0
  16. package/dist/src/utils/schemaShims.js +13 -0
  17. package/dist/src/utils/standaloneSchemas.d.ts +16 -0
  18. package/dist/src/utils/standaloneSchemas.js +101 -0
  19. package/dist/src/utils/standaloneTypes.d.ts +8 -0
  20. package/dist/src/utils/standaloneTypes.js +22 -0
  21. package/dist/src/utils/standaloneZodSchemas.d.ts +8 -0
  22. package/dist/src/utils/standaloneZodSchemas.js +53 -0
  23. package/dist/src/utils/typeGeneration.d.ts +1 -0
  24. package/dist/src/utils/typeGeneration.js +25 -0
  25. package/dist/src/utils/typeGenerationPostProcess.d.ts +2 -0
  26. package/dist/src/utils/typeGenerationPostProcess.js +166 -0
  27. package/dist/src/utils/typeGenerationPreflight.d.ts +2 -0
  28. package/dist/src/utils/typeGenerationPreflight.js +93 -0
  29. package/dist/src/utils/zodCodegen.d.ts +10 -0
  30. package/dist/src/utils/zodCodegen.js +521 -0
  31. package/generated-src/derived/constants.ts +130 -0
  32. package/generated-src/derived/mappings.ts +12 -0
  33. package/generated-src/metadata/Core.json +1919 -0
  34. package/generated-src/metadata/dependencyMap.json +283 -0
  35. package/generated-src/metadata/terminals.json +17 -0
  36. package/generated-src/resourceTypes/resourceTypes.json +375 -0
  37. package/generated-src/resourceTypes/resourceTypes.ts +2 -0
  38. package/generated-src/resources/resourceTypes.json +456 -0
  39. package/generated-src/resources/resourceTypes.ts +2 -0
  40. package/generated-src/schemas/schemas.json +1670 -0
  41. package/generated-src/schemas/schemas.ts +2 -0
  42. package/generated-src/schemas/standalone/Boolean.json +5 -0
  43. package/generated-src/schemas/standalone/Boolean.ts +2 -0
  44. package/generated-src/schemas/standalone/Error.json +78 -0
  45. package/generated-src/schemas/standalone/Error.ts +2 -0
  46. package/generated-src/schemas/standalone/Goal.json +53 -0
  47. package/generated-src/schemas/standalone/Goal.ts +2 -0
  48. package/generated-src/schemas/standalone/Natural.json +6 -0
  49. package/generated-src/schemas/standalone/Natural.ts +2 -0
  50. package/generated-src/schemas/standalone/Resource.json +170 -0
  51. package/generated-src/schemas/standalone/Resource.ts +2 -0
  52. package/generated-src/schemas/standalone/ResourceType.json +131 -0
  53. package/generated-src/schemas/standalone/ResourceType.ts +2 -0
  54. package/generated-src/schemas/standalone/Strategy.json +641 -0
  55. package/generated-src/schemas/standalone/Strategy.ts +2 -0
  56. package/generated-src/schemas/standalone/StrategyTrace.json +820 -0
  57. package/generated-src/schemas/standalone/StrategyTrace.ts +2 -0
  58. package/generated-src/schemas/standalone/Tool.json +508 -0
  59. package/generated-src/schemas/standalone/Tool.ts +2 -0
  60. package/generated-src/schemas/zod/Boolean.ts +6 -0
  61. package/generated-src/schemas/zod/Error.ts +11 -0
  62. package/generated-src/schemas/zod/Goal.ts +8 -0
  63. package/generated-src/schemas/zod/Natural.ts +6 -0
  64. package/generated-src/schemas/zod/Resource.ts +21 -0
  65. package/generated-src/schemas/zod/ResourceType.ts +14 -0
  66. package/generated-src/schemas/zod/Strategy.ts +68 -0
  67. package/generated-src/schemas/zod/StrategyTrace.ts +75 -0
  68. package/generated-src/schemas/zod/Tool.ts +29 -0
  69. package/generated-src/schemas/zod/index.ts +10 -0
  70. package/generated-src/types/standalone/BooleanResource.d.ts +3 -0
  71. package/generated-src/types/standalone/BooleanResource.js +1 -0
  72. package/generated-src/types/standalone/ErrorResource.d.ts +3 -0
  73. package/generated-src/types/standalone/ErrorResource.js +1 -0
  74. package/generated-src/types/standalone/GoalResource.d.ts +3 -0
  75. package/generated-src/types/standalone/GoalResource.js +1 -0
  76. package/generated-src/types/standalone/NaturalResource.d.ts +3 -0
  77. package/generated-src/types/standalone/NaturalResource.js +1 -0
  78. package/generated-src/types/standalone/ResourceResource.d.ts +3 -0
  79. package/generated-src/types/standalone/ResourceResource.js +1 -0
  80. package/generated-src/types/standalone/ResourceTypeResource.d.ts +3 -0
  81. package/generated-src/types/standalone/ResourceTypeResource.js +1 -0
  82. package/generated-src/types/standalone/StrategyResource.d.ts +3 -0
  83. package/generated-src/types/standalone/StrategyResource.js +1 -0
  84. package/generated-src/types/standalone/StrategyTraceResource.d.ts +3 -0
  85. package/generated-src/types/standalone/StrategyTraceResource.js +1 -0
  86. package/generated-src/types/standalone/ToolResource.d.ts +3 -0
  87. package/generated-src/types/standalone/ToolResource.js +1 -0
  88. package/generated-src/types/types.d.ts +701 -0
  89. package/generated-src/types/types.js +1 -0
  90. package/package.json +52 -0
  91. package/src/genesis/resourceTypeShells.json +47 -0
  92. package/src/genesis/resources/booleans.json +24 -0
  93. package/src/genesis/resources/implementations/foo.ts +182 -0
  94. package/src/genesis/resources/naturals.json +112 -0
  95. package/src/genesis/resources/tools.json +840 -0
  96. package/src/genesis/schemas.json +1670 -0
  97. package/src/index.ts +27 -0
  98. package/src/utils/constantsAndMappings.ts +195 -0
  99. package/src/utils/coreProjection.ts +53 -0
  100. package/src/utils/resourceTypes.ts +39 -0
  101. package/src/utils/resources.ts +26 -0
  102. package/src/utils/schemaDependencies.ts +115 -0
  103. package/src/utils/schemaObjectNormalization.ts +71 -0
  104. package/src/utils/schemaRefNormalization.ts +83 -0
  105. package/src/utils/schemaShims.ts +17 -0
  106. package/src/utils/standaloneSchemas.ts +114 -0
  107. package/src/utils/standaloneTypes.ts +28 -0
  108. package/src/utils/standaloneZodSchemas.ts +72 -0
  109. package/src/utils/typeGeneration.ts +31 -0
  110. package/src/utils/typeGenerationPostProcess.ts +246 -0
  111. package/src/utils/typeGenerationPreflight.ts +119 -0
  112. package/src/utils/zodCodegen.ts +549 -0
@@ -0,0 +1,2 @@
1
+ import schema from './schemas.json' with { type: 'json' };
2
+ export default schema;
@@ -0,0 +1,5 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "type": "boolean",
4
+ "$defs": {}
5
+ }
@@ -0,0 +1,2 @@
1
+ import schema from './Boolean.json' with { type: 'json' };
2
+ export default schema;
@@ -0,0 +1,78 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "type": "object",
4
+ "allOf": [
5
+ {
6
+ "$ref": "#/$defs/DocumentationSpec"
7
+ },
8
+ {
9
+ "properties": {
10
+ "details": {
11
+ "type": "object"
12
+ }
13
+ }
14
+ }
15
+ ],
16
+ "unevaluatedProperties": false,
17
+ "$defs": {
18
+ "DocumentationSpec": {
19
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
20
+ "type": "object",
21
+ "allOf": [
22
+ {
23
+ "$ref": "#/$defs/NameFacet"
24
+ },
25
+ {
26
+ "type": "object",
27
+ "properties": {
28
+ "symbol": {
29
+ "type": "string"
30
+ }
31
+ }
32
+ },
33
+ {
34
+ "$ref": "#/$defs/DescriptionFacet"
35
+ }
36
+ ]
37
+ },
38
+ "NameFacet": {
39
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
40
+ "type": "object",
41
+ "required": [
42
+ "name"
43
+ ],
44
+ "properties": {
45
+ "name": {
46
+ "$ref": "#/$defs/Name"
47
+ }
48
+ }
49
+ },
50
+ "DescriptionFacet": {
51
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
52
+ "type": "object",
53
+ "required": [
54
+ "description"
55
+ ],
56
+ "properties": {
57
+ "description": {
58
+ "$ref": "#/$defs/Description"
59
+ }
60
+ }
61
+ },
62
+ "Name": {
63
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
64
+ "type": "string",
65
+ "minLength": 1,
66
+ "pattern": "^[A-Z][a-zA-Z0-9]*$",
67
+ "$comment": "Validation is intercepted by an AI Agent that verifies the name against Toolproof's naming conventions.",
68
+ "semanticValidation": "Ajv custom keyword to verify name."
69
+ },
70
+ "Description": {
71
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
72
+ "type": "string",
73
+ "minLength": 1,
74
+ "$comment": "Validation is intercepted by an AI Agent that verifies the description against Toolproof's documentation standards.",
75
+ "semanticValidation": "Ajv custom keyword to verify description."
76
+ }
77
+ }
78
+ }
@@ -0,0 +1,2 @@
1
+ import schema from './Error.json' with { type: 'json' };
2
+ export default schema;
@@ -0,0 +1,53 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "type": "object",
4
+ "required": [
5
+ "handle",
6
+ "target"
7
+ ],
8
+ "properties": {
9
+ "handle": {
10
+ "$ref": "#/$defs/GoalHandle"
11
+ },
12
+ "target": {
13
+ "type": "integer",
14
+ "minimum": 0
15
+ },
16
+ "disallowedTools": {
17
+ "type": "array",
18
+ "items": {
19
+ "$ref": "#/$defs/ToolHandle"
20
+ }
21
+ },
22
+ "disallowedSequences": {
23
+ "type": "array",
24
+ "items": {
25
+ "type": "array",
26
+ "items": {
27
+ "$ref": "#/$defs/ToolHandle"
28
+ }
29
+ }
30
+ },
31
+ "minSteps": {
32
+ "type": "integer",
33
+ "minimum": 1
34
+ },
35
+ "maxSteps": {
36
+ "type": "integer",
37
+ "minimum": 1
38
+ }
39
+ },
40
+ "unevaluatedProperties": false,
41
+ "$defs": {
42
+ "GoalHandle": {
43
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
44
+ "type": "string",
45
+ "pattern": "^GOAL-.+$"
46
+ },
47
+ "ToolHandle": {
48
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
49
+ "type": "string",
50
+ "pattern": "^TOOL-.+$"
51
+ }
52
+ }
53
+ }
@@ -0,0 +1,2 @@
1
+ import schema from './Goal.json' with { type: 'json' };
2
+ export default schema;
@@ -0,0 +1,6 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "type": "integer",
4
+ "minimum": 0,
5
+ "$defs": {}
6
+ }
@@ -0,0 +1,2 @@
1
+ import schema from './Natural.json' with { type: 'json' };
2
+ export default schema;
@@ -0,0 +1,170 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "type": "object",
4
+ "$ref": "#/$defs/BaseResource",
5
+ "unevaluatedProperties": false,
6
+ "$defs": {
7
+ "BaseResource": {
8
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
9
+ "type": "object",
10
+ "required": [
11
+ "value"
12
+ ],
13
+ "properties": {
14
+ "value": true
15
+ },
16
+ "$comment": "This will be overlaid dynamically to match the data structure of the underlying ResourceType's valueSchema.",
17
+ "allOf": [
18
+ {
19
+ "$ref": "#/$defs/ResourcePointer"
20
+ }
21
+ ]
22
+ },
23
+ "ResourcePointer": {
24
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
25
+ "type": "object",
26
+ "required": [
27
+ "id",
28
+ "resourceTypeHandle",
29
+ "version"
30
+ ],
31
+ "properties": {
32
+ "id": {
33
+ "$ref": "#/$defs/ResourceId"
34
+ },
35
+ "resourceTypeHandle": {
36
+ "$ref": "#/$defs/ResourceTypeHandle"
37
+ },
38
+ "version": {
39
+ "const": 1
40
+ }
41
+ },
42
+ "allOf": [
43
+ {
44
+ "$ref": "#/$defs/ProvenanceFacet"
45
+ }
46
+ ],
47
+ "unevaluatedProperties": false
48
+ },
49
+ "ResourceId": {
50
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
51
+ "type": "string",
52
+ "pattern": "^RESOURCE-.+$"
53
+ },
54
+ "ResourceTypeHandle": {
55
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
56
+ "type": "string",
57
+ "pattern": "^TYPE-.+$"
58
+ },
59
+ "ProvenanceFacet": {
60
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
61
+ "type": "object",
62
+ "required": [
63
+ "provenance"
64
+ ],
65
+ "properties": {
66
+ "provenance": {
67
+ "$ref": "#/$defs/Provenance"
68
+ }
69
+ }
70
+ },
71
+ "Provenance": {
72
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
73
+ "oneOf": [
74
+ {
75
+ "$ref": "#/$defs/GenesisProvenance"
76
+ },
77
+ {
78
+ "$ref": "#/$defs/StrategyProvenance"
79
+ }
80
+ ]
81
+ },
82
+ "GenesisProvenance": {
83
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
84
+ "type": "object",
85
+ "required": [
86
+ "provenanceKind"
87
+ ],
88
+ "properties": {
89
+ "provenanceKind": {
90
+ "const": "genesis"
91
+ }
92
+ },
93
+ "unevaluatedProperties": false
94
+ },
95
+ "StrategyProvenance": {
96
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
97
+ "type": "object",
98
+ "required": [
99
+ "provenanceKind",
100
+ "strategyTraceHandle",
101
+ "outputAddress"
102
+ ],
103
+ "properties": {
104
+ "provenanceKind": {
105
+ "const": "strategy"
106
+ },
107
+ "strategyTraceHandle": {
108
+ "$ref": "#/$defs/StrategyTraceHandle"
109
+ },
110
+ "outputAddress": {
111
+ "$ref": "#/$defs/OutputAddress"
112
+ }
113
+ },
114
+ "unevaluatedProperties": false
115
+ },
116
+ "StrategyTraceHandle": {
117
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
118
+ "type": "string",
119
+ "pattern": "^STRATEGY_TRACE-.+$"
120
+ },
121
+ "OutputAddress": {
122
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
123
+ "type": "object",
124
+ "required": [
125
+ "roleName",
126
+ "toolStepPath"
127
+ ],
128
+ "properties": {
129
+ "roleName": {
130
+ "$ref": "#/$defs/RoleName"
131
+ },
132
+ "toolStepPath": {
133
+ "$ref": "#/$defs/ToolStepPath"
134
+ }
135
+ },
136
+ "unevaluatedProperties": false
137
+ },
138
+ "RoleName": {
139
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
140
+ "$ref": "#/$defs/Name"
141
+ },
142
+ "ToolStepPath": {
143
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
144
+ "oneOf": [
145
+ {
146
+ "$ref": "#/$defs/UnthreadedToolStepPath"
147
+ },
148
+ {
149
+ "$ref": "#/$defs/ThreadedToolStepPath"
150
+ }
151
+ ]
152
+ },
153
+ "Name": {
154
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
155
+ "type": "string",
156
+ "minLength": 1,
157
+ "pattern": "^[A-Z][a-zA-Z0-9]*$",
158
+ "$comment": "Validation is intercepted by an AI Agent that verifies the name against Toolproof's naming conventions.",
159
+ "semanticValidation": "Ajv custom keyword to verify name."
160
+ },
161
+ "UnthreadedToolStepPath": {
162
+ "type": "string",
163
+ "pattern": "^/steps/[0-9]+/(self|case/when|case/what|cases/[0-9]+/when|cases/[0-9]+/what)$"
164
+ },
165
+ "ThreadedToolStepPath": {
166
+ "type": "string",
167
+ "pattern": "^/threads/[0-9]+/steps/[0-9]+/(self|case/when|case/what|cases/[0-9]+/when|cases/[0-9]+/what)$"
168
+ }
169
+ }
170
+ }
@@ -0,0 +1,2 @@
1
+ import schema from './Resource.json' with { type: 'json' };
2
+ export default schema;
@@ -0,0 +1,131 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "type": "object",
4
+ "required": [
5
+ "handle"
6
+ ],
7
+ "properties": {
8
+ "handle": {
9
+ "$ref": "#/$defs/ResourceTypeHandle"
10
+ },
11
+ "valueSchema": {
12
+ "$ref": "#/$defs/JsonSchemaObject"
13
+ },
14
+ "parserToolHandle": {
15
+ "$ref": "#/$defs/ToolHandle"
16
+ },
17
+ "embeddingModelTools": {
18
+ "type": "array",
19
+ "items": {
20
+ "$ref": "#/$defs/ToolHandle"
21
+ },
22
+ "minItems": 1,
23
+ "$comment": "A ResourceType may specify a set of embeddingModelTools that convert the raw data (or one of its alternative representations) into vector embeddings. The build process enforces that the entries are members of a set of predefined embeddingModelTools."
24
+ }
25
+ },
26
+ "allOf": [
27
+ {
28
+ "$ref": "#/$defs/DocumentationSpec"
29
+ },
30
+ {
31
+ "$comment": "A ResourceType must specify either a valueSchema or a parserToolHandle, or both. If only a valueSchema is specified, the author assumes no burden of implementing a parser for the ResourceType. They can rely on the valueSchema for validation. If only a parserToolHandle is specified, the author assumes the burden of implementing a parser that can validate instances of the ResourceType. If both are specified, the author assumes the burden of implementing an augmented parser that also serves as a generator between the raw data and an instance of the valueSchema.",
32
+ "anyOf": [
33
+ {
34
+ "required": [
35
+ "valueSchema"
36
+ ]
37
+ },
38
+ {
39
+ "required": [
40
+ "parserToolHandle"
41
+ ]
42
+ }
43
+ ]
44
+ }
45
+ ],
46
+ "unevaluatedProperties": false,
47
+ "$defs": {
48
+ "ResourceTypeHandle": {
49
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
50
+ "type": "string",
51
+ "pattern": "^TYPE-.+$"
52
+ },
53
+ "JsonSchemaObject": {
54
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
55
+ "type": "object",
56
+ "required": [
57
+ "$schema"
58
+ ],
59
+ "properties": {
60
+ "$schema": {
61
+ "const": "https://json-schema.org/draft/2020-12/schema"
62
+ }
63
+ },
64
+ "additionalProperties": true
65
+ },
66
+ "ToolHandle": {
67
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
68
+ "type": "string",
69
+ "pattern": "^TOOL-.+$"
70
+ },
71
+ "DocumentationSpec": {
72
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
73
+ "type": "object",
74
+ "allOf": [
75
+ {
76
+ "$ref": "#/$defs/NameFacet"
77
+ },
78
+ {
79
+ "type": "object",
80
+ "properties": {
81
+ "symbol": {
82
+ "type": "string"
83
+ }
84
+ }
85
+ },
86
+ {
87
+ "$ref": "#/$defs/DescriptionFacet"
88
+ }
89
+ ]
90
+ },
91
+ "NameFacet": {
92
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
93
+ "type": "object",
94
+ "required": [
95
+ "name"
96
+ ],
97
+ "properties": {
98
+ "name": {
99
+ "$ref": "#/$defs/Name"
100
+ }
101
+ }
102
+ },
103
+ "DescriptionFacet": {
104
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
105
+ "type": "object",
106
+ "required": [
107
+ "description"
108
+ ],
109
+ "properties": {
110
+ "description": {
111
+ "$ref": "#/$defs/Description"
112
+ }
113
+ }
114
+ },
115
+ "Name": {
116
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
117
+ "type": "string",
118
+ "minLength": 1,
119
+ "pattern": "^[A-Z][a-zA-Z0-9]*$",
120
+ "$comment": "Validation is intercepted by an AI Agent that verifies the name against Toolproof's naming conventions.",
121
+ "semanticValidation": "Ajv custom keyword to verify name."
122
+ },
123
+ "Description": {
124
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
125
+ "type": "string",
126
+ "minLength": 1,
127
+ "$comment": "Validation is intercepted by an AI Agent that verifies the description against Toolproof's documentation standards.",
128
+ "semanticValidation": "Ajv custom keyword to verify description."
129
+ }
130
+ }
131
+ }
@@ -0,0 +1,2 @@
1
+ import schema from './ResourceType.json' with { type: 'json' };
2
+ export default schema;