orizu 0.5.26 → 0.5.28

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 (164) hide show
  1. package/README.md +19 -0
  2. package/dist/artifacts-git-runtime.d.ts +34 -0
  3. package/dist/artifacts-git-runtime.d.ts.map +1 -0
  4. package/dist/artifacts-git-runtime.js +312 -0
  5. package/dist/cloudflare-artifacts-git-remote.d.ts +5 -0
  6. package/dist/cloudflare-artifacts-git-remote.d.ts.map +1 -0
  7. package/dist/cloudflare-artifacts-git-remote.js +21 -0
  8. package/dist/dataset-transfer-download.d.ts +2 -0
  9. package/dist/dataset-transfer-download.d.ts.map +1 -0
  10. package/dist/dataset-transfer-download.js +66 -0
  11. package/dist/dataset-transfer-policy.d.ts +2 -0
  12. package/dist/dataset-transfer-policy.d.ts.map +1 -0
  13. package/dist/dataset-transfer-policy.js +8 -0
  14. package/dist/dataset-transfer-upload.d.ts +42 -0
  15. package/dist/dataset-transfer-upload.d.ts.map +1 -0
  16. package/dist/dataset-transfer-upload.js +110 -0
  17. package/dist/git-credential.d.ts.map +1 -1
  18. package/dist/git-credential.js +1 -1
  19. package/dist/git-recovery-environment.d.ts +1 -0
  20. package/dist/git-recovery-environment.d.ts.map +1 -1
  21. package/dist/git-recovery-environment.js +1 -1
  22. package/dist/help.d.ts.map +1 -1
  23. package/dist/help.js +44 -11
  24. package/dist/hosted-boot.d.ts +75 -2
  25. package/dist/hosted-boot.d.ts.map +1 -1
  26. package/dist/hosted-boot.js +585 -102
  27. package/dist/hosted-bootstrap.d.ts +2 -0
  28. package/dist/hosted-bootstrap.d.ts.map +1 -1
  29. package/dist/hosted-bootstrap.js +12 -3
  30. package/dist/hosted-harness-opencode.d.ts +8 -9
  31. package/dist/hosted-harness-opencode.d.ts.map +1 -1
  32. package/dist/hosted-harness-opencode.js +126 -24
  33. package/dist/hosted-harness.d.ts +3 -0
  34. package/dist/hosted-harness.d.ts.map +1 -1
  35. package/dist/hosted-harness.js +4 -1
  36. package/dist/hosted-harvest.d.ts +30 -9
  37. package/dist/hosted-harvest.d.ts.map +1 -1
  38. package/dist/hosted-harvest.js +222 -28
  39. package/dist/hosted-loop-lifecycle.d.ts +15 -3
  40. package/dist/hosted-loop-lifecycle.d.ts.map +1 -1
  41. package/dist/hosted-loop-lifecycle.js +6 -4
  42. package/dist/hosted-loop.d.ts +47 -7
  43. package/dist/hosted-loop.d.ts.map +1 -1
  44. package/dist/hosted-loop.js +310 -64
  45. package/dist/hosted-question-limits.d.ts +7 -0
  46. package/dist/hosted-question-limits.d.ts.map +1 -0
  47. package/dist/hosted-question-limits.js +6 -0
  48. package/dist/hosted-question.d.ts +27 -0
  49. package/dist/hosted-question.d.ts.map +1 -0
  50. package/dist/hosted-question.js +118 -0
  51. package/dist/hosted-run-event-sink.d.ts +10 -5
  52. package/dist/hosted-run-event-sink.d.ts.map +1 -1
  53. package/dist/hosted-run-event-sink.js +12 -8
  54. package/dist/hosted-runtime-assets.d.ts +16 -7
  55. package/dist/hosted-runtime-assets.d.ts.map +1 -1
  56. package/dist/hosted-runtime-assets.js +40 -12
  57. package/dist/hosted-session-cli.d.ts.map +1 -1
  58. package/dist/hosted-session-cli.js +10 -19
  59. package/dist/http.d.ts +1 -1
  60. package/dist/http.d.ts.map +1 -1
  61. package/dist/http.js +10 -4
  62. package/dist/index.d.ts.map +1 -1
  63. package/dist/index.js +113 -92
  64. package/dist/instruction-set-gepa-launch.d.ts +1 -1
  65. package/dist/instruction-set-gepa-launch.d.ts.map +1 -1
  66. package/dist/instruction-set-gepa-launch.js +5 -3
  67. package/dist/instruction-set-loader.d.ts.map +1 -1
  68. package/dist/instruction-set-loader.js +63 -2
  69. package/dist/instruction-set-lock/index.d.ts +51 -0
  70. package/dist/instruction-set-lock/index.d.ts.map +1 -0
  71. package/dist/instruction-set-lock/index.js +459 -0
  72. package/dist/instruction-set-lock/schema.v1.d.ts +136 -0
  73. package/dist/instruction-set-lock/schema.v1.d.ts.map +1 -0
  74. package/dist/instruction-set-lock/schema.v1.js +155 -0
  75. package/dist/instruction-set-provenance.d.ts +26 -0
  76. package/dist/instruction-set-provenance.d.ts.map +1 -0
  77. package/dist/instruction-set-provenance.js +68 -0
  78. package/dist/instruction-set-sync/helpers.d.ts +22 -0
  79. package/dist/instruction-set-sync/helpers.d.ts.map +1 -0
  80. package/dist/instruction-set-sync/helpers.js +677 -0
  81. package/dist/instruction-set-sync/index.d.ts +60 -0
  82. package/dist/instruction-set-sync/index.d.ts.map +1 -0
  83. package/dist/instruction-set-sync/index.js +689 -0
  84. package/dist/instruction-set-update/index.d.ts +42 -0
  85. package/dist/instruction-set-update/index.d.ts.map +1 -0
  86. package/dist/instruction-set-update/index.js +445 -0
  87. package/dist/instruction-set-verify/index.d.ts +27 -0
  88. package/dist/instruction-set-verify/index.d.ts.map +1 -0
  89. package/dist/instruction-set-verify/index.js +865 -0
  90. package/dist/instruction-sets-cli.d.ts +1 -4
  91. package/dist/instruction-sets-cli.d.ts.map +1 -1
  92. package/dist/instruction-sets-cli.js +220 -109
  93. package/dist/model-config-fields.d.ts +35 -0
  94. package/dist/model-config-fields.d.ts.map +1 -0
  95. package/dist/model-config-fields.js +28 -0
  96. package/dist/optimizations-list-cli.d.ts.map +1 -1
  97. package/dist/optimizations-list-cli.js +7 -4
  98. package/dist/score-format.d.ts +2 -0
  99. package/dist/score-format.d.ts.map +1 -0
  100. package/dist/score-format.js +18 -0
  101. package/dist/workbench-repo-contract.d.ts +65 -0
  102. package/dist/workbench-repo-contract.d.ts.map +1 -0
  103. package/dist/workbench-repo-contract.js +250 -0
  104. package/dist/workspace-bootstrap-job.d.ts +45 -0
  105. package/dist/workspace-bootstrap-job.d.ts.map +1 -0
  106. package/dist/workspace-bootstrap-job.js +431 -0
  107. package/dist/workspace-bootstrap-seed.d.ts +74 -0
  108. package/dist/workspace-bootstrap-seed.d.ts.map +1 -0
  109. package/dist/workspace-bootstrap-seed.js +209 -0
  110. package/package.json +4 -3
  111. package/src/artifacts-git-runtime.ts +360 -0
  112. package/src/cloudflare-artifacts-git-remote.ts +24 -0
  113. package/src/dataset-transfer-download.ts +61 -0
  114. package/src/dataset-transfer-policy.ts +8 -0
  115. package/src/dataset-transfer-upload.ts +145 -0
  116. package/src/git-credential.ts +1 -2
  117. package/src/git-recovery-environment.ts +1 -1
  118. package/src/help.ts +44 -11
  119. package/src/hosted-boot.ts +644 -109
  120. package/src/hosted-bootstrap.ts +14 -3
  121. package/src/hosted-harness-opencode.ts +130 -28
  122. package/src/hosted-harness.ts +4 -1
  123. package/src/hosted-harvest.ts +258 -33
  124. package/src/hosted-loop-lifecycle.ts +19 -5
  125. package/src/hosted-loop.ts +340 -68
  126. package/src/hosted-question-limits.ts +6 -0
  127. package/src/hosted-question.ts +145 -0
  128. package/src/hosted-run-event-sink.ts +24 -12
  129. package/src/hosted-runtime-assets.ts +51 -11
  130. package/src/hosted-session-cli.ts +10 -24
  131. package/src/http.ts +10 -4
  132. package/src/index.ts +108 -134
  133. package/src/instruction-set-gepa-launch.ts +4 -4
  134. package/src/instruction-set-loader.ts +53 -2
  135. package/src/instruction-set-lock/index.ts +561 -0
  136. package/src/instruction-set-lock/schema.v1.json +141 -0
  137. package/src/instruction-set-lock/schema.v1.ts +155 -0
  138. package/src/instruction-set-provenance.ts +89 -0
  139. package/src/instruction-set-sync/helpers.ts +707 -0
  140. package/src/instruction-set-sync/index.ts +791 -0
  141. package/src/instruction-set-update/index.ts +488 -0
  142. package/src/instruction-set-verify/index.ts +1067 -0
  143. package/src/instruction-sets-cli.ts +226 -114
  144. package/src/model-config-fields.ts +31 -0
  145. package/src/optimizations-list-cli.ts +7 -4
  146. package/src/score-format.ts +16 -0
  147. package/src/workbench-repo-contract.ts +314 -0
  148. package/src/workspace-bootstrap-job.ts +611 -0
  149. package/src/workspace-bootstrap-seed.ts +350 -0
  150. package/vendor/orizu-gepa/src/orizu_gepa_connector/instruction_set_loader.py +46 -2
  151. package/vendor/skills/orizu/SKILL.md +4 -2
  152. package/vendor/skills/orizu/flows/promote.md +4 -0
  153. package/vendor/skills/orizu/references/assess-and-plan.md +1 -1
  154. package/vendor/skills/orizu/references/authority-map.md +1 -1
  155. package/vendor/skills/orizu/references/cli-reference.md +151 -35
  156. package/vendor/skills/orizu/references/instructions-after-prompts.md +3 -3
  157. package/vendor/skills/orizu/references/migrate-existing-gepa-setup.md +5 -6
  158. package/vendor/skills/orizu/references/migrate-hand-rolled-instruction-layout.md +252 -0
  159. package/vendor/skills/orizu/references/optimization-reports.md +5 -4
  160. package/vendor/skills/orizu/references/optimization-with-gepa.md +1 -1
  161. package/vendor/skills/orizu/references/orizu-in-your-codebase.md +195 -0
  162. package/vendor/skills/orizu/references/primer.md +4 -2
  163. package/vendor/skills/orizu/references/prompt-control-plane.md +33 -29
  164. package/vendor/skills/orizu/references/vocabulary.md +1 -1
@@ -0,0 +1,155 @@
1
+ export const instructionSetLockSchemaV1 = {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://orizu.ai/schemas/instruction-set-lock/v1",
4
+ "title": "Orizu instruction set Lock v1",
5
+ "type": "object",
6
+ "required": [
7
+ "lockfileVersion",
8
+ "project",
9
+ "instructionSets"
10
+ ],
11
+ "additionalProperties": false,
12
+ "properties": {
13
+ "lockfileVersion": {
14
+ "const": 1
15
+ },
16
+ "project": {
17
+ "type": "string",
18
+ "pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*/[a-z0-9]+(?:-[a-z0-9]+)*$"
19
+ },
20
+ "instructionSets": {
21
+ "type": "object",
22
+ "additionalProperties": false,
23
+ "patternProperties": {
24
+ "^[a-z0-9]+(?:-[a-z0-9]+)*$": {
25
+ "$ref": "#/$defs/instructionSet"
26
+ }
27
+ }
28
+ },
29
+ "helpers": {
30
+ "type": "object",
31
+ "propertyNames": {
32
+ "pattern": "^helpers\\/(?!\\.{1,2}(?:\\/|$))(?!.*\\/\\.{1,2}(?:\\/|$))[A-Za-z0-9._-]+(?:\\/[A-Za-z0-9._-]+)*$"
33
+ },
34
+ "additionalProperties": {
35
+ "$ref": "#/$defs/sha256"
36
+ }
37
+ },
38
+ "pins": {
39
+ "type": "array",
40
+ "uniqueItems": true,
41
+ "items": {
42
+ "type": "string",
43
+ "pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*/[^\\s]+@v[1-9][0-9]*$"
44
+ }
45
+ }
46
+ },
47
+ "$defs": {
48
+ "sha256": {
49
+ "type": "string",
50
+ "pattern": "^sha256:[0-9a-f]{64}$"
51
+ },
52
+ "instructionSet": {
53
+ "type": "object",
54
+ "required": [
55
+ "instructionSetId",
56
+ "default",
57
+ "profiles"
58
+ ],
59
+ "additionalProperties": false,
60
+ "properties": {
61
+ "instructionSetId": {
62
+ "type": "string",
63
+ "format": "uuid",
64
+ "pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89aAbB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$"
65
+ },
66
+ "default": {
67
+ "type": "string",
68
+ "pattern": "^[a-z0-9][a-z0-9._-]*__[a-z0-9][a-z0-9._-]*$"
69
+ },
70
+ "profiles": {
71
+ "type": "object",
72
+ "minProperties": 1,
73
+ "additionalProperties": false,
74
+ "patternProperties": {
75
+ "^[a-z0-9][a-z0-9._-]*__[a-z0-9][a-z0-9._-]*$": {
76
+ "$ref": "#/$defs/profile"
77
+ }
78
+ }
79
+ }
80
+ }
81
+ },
82
+ "profile": {
83
+ "type": "object",
84
+ "required": [
85
+ "production",
86
+ "versions"
87
+ ],
88
+ "additionalProperties": false,
89
+ "properties": {
90
+ "modelConfigIdentity": {
91
+ "type": "string",
92
+ "minLength": 1
93
+ },
94
+ "production": {
95
+ "type": [
96
+ "string",
97
+ "null"
98
+ ],
99
+ "pattern": "^v[1-9][0-9]*$"
100
+ },
101
+ "versions": {
102
+ "type": "object",
103
+ "minProperties": 1,
104
+ "additionalProperties": false,
105
+ "patternProperties": {
106
+ "^v[1-9][0-9]*$": {
107
+ "$ref": "#/$defs/version"
108
+ }
109
+ }
110
+ }
111
+ }
112
+ },
113
+ "version": {
114
+ "type": "object",
115
+ "required": [
116
+ "profileVersionId",
117
+ "versionNumber",
118
+ "digest",
119
+ "components",
120
+ "syncedAt"
121
+ ],
122
+ "additionalProperties": false,
123
+ "properties": {
124
+ "profileVersionId": {
125
+ "type": "string",
126
+ "format": "uuid",
127
+ "pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89aAbB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$"
128
+ },
129
+ "versionNumber": {
130
+ "type": "integer",
131
+ "minimum": 1,
132
+ "maximum": 2147483647
133
+ },
134
+ "digest": {
135
+ "$ref": "#/$defs/sha256"
136
+ },
137
+ "components": {
138
+ "type": "object",
139
+ "minProperties": 1,
140
+ "propertyNames": {
141
+ "pattern": "^(?!\\.)[A-Za-z0-9._-]+$"
142
+ },
143
+ "additionalProperties": {
144
+ "$ref": "#/$defs/sha256"
145
+ }
146
+ },
147
+ "syncedAt": {
148
+ "type": "string",
149
+ "format": "date-time",
150
+ "pattern": "^(?:(?:[0-9]{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12][0-9]|3[01])|(?:0[469]|11)-(?:0[1-9]|[12][0-9]|30)|02-(?:0[1-9]|1[0-9]|2[0-8])))|(?:(?:[0-9]{2}(?:0[48]|[2468][048]|[13579][26])|(?:00|0[48]|[2468][048]|[13579][26])00)-02-29))T(?:[01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]\\.[0-9]{3}Z$"
151
+ }
152
+ }
153
+ }
154
+ }
155
+ } as const
@@ -0,0 +1,89 @@
1
+ import { existsSync, readFileSync } from 'node:fs'
2
+ import { join } from 'node:path'
3
+
4
+ import { parseLock, parseSpecifier } from './instruction-set-lock/index.js'
5
+ import { profileSlug } from './instruction-set-sync/index.js'
6
+
7
+ export const PROVENANCE_ATTRIBUTE_NAMES = {
8
+ instructionSetId: 'orizu.instruction_set.id',
9
+ profileVersionId: 'orizu.profile_version.id',
10
+ digest: 'orizu.instruction_set.digest',
11
+ } as const
12
+
13
+ export interface InstructionSetProvenanceTriple {
14
+ instructionSetId: string
15
+ profileVersionId: string
16
+ digest: string
17
+ }
18
+
19
+ export function resolveInstructionSetProvenance({
20
+ specifier,
21
+ root = '.',
22
+ project,
23
+ }: {
24
+ specifier: string
25
+ root?: string
26
+ project: string
27
+ }): InstructionSetProvenanceTriple {
28
+ const lockPath = join(root, 'orizu', 'orizu.lock.json')
29
+ if (!existsSync(lockPath)) throw new Error(`instruction_set_lock_missing:${lockPath}`)
30
+ const lock = parseLock(readFileSync(lockPath, 'utf8'))
31
+ const projectSegments = project.split('/').map(segment => segment.trim().toLowerCase())
32
+ if (projectSegments.length !== 2 || projectSegments.some(segment => segment.length === 0)) {
33
+ throw new Error(`instruction_set_project_invalid:${projectSegments.join('/')}`)
34
+ }
35
+ const normalizedProject = projectSegments.join('/')
36
+ if (lock.project !== normalizedProject) {
37
+ throw new Error(`instruction_set_lock_project_mismatch:${lock.project}!=${normalizedProject}`)
38
+ }
39
+
40
+ const parsed = parseSpecifier(specifier)
41
+ const instructionSet = lock.instructionSets[parsed.set]
42
+ if (!instructionSet) throw new Error('instruction_set_specifier_unknown')
43
+ const selectedProfile = parsed.profile === undefined
44
+ ? instructionSet.default
45
+ : profileSlug(parsed.profile)
46
+ const profile = instructionSet.profiles[selectedProfile]
47
+ if (!profile) throw new Error('instruction_set_specifier_unknown')
48
+ const selectedVersion = parsed.versionNumber === undefined
49
+ ? profile.production
50
+ : `v${parsed.versionNumber}`
51
+ if (profile.modelConfigIdentity === undefined) {
52
+ const repairVersion = selectedVersion ?? Object.keys(profile.versions).sort()[0]!
53
+ const legacyIdentity = selectedProfile.replace('__', '/')
54
+ throw new Error(
55
+ `instruction_set_lock_profile_identity_missing:${parsed.set}/${selectedProfile}; repair with orizu instructions sync ${parsed.set}/${legacyIdentity}@${repairVersion}`
56
+ )
57
+ }
58
+ if (parsed.profile !== undefined && profile.modelConfigIdentity !== parsed.profile) {
59
+ throw new Error(`instruction_set_specifier_profile_mismatch:${profile.modelConfigIdentity}`)
60
+ }
61
+ if (selectedVersion === null) {
62
+ throw new Error('instruction_set_pointer_unresolved:production')
63
+ }
64
+ const version = profile.versions[selectedVersion]
65
+ if (!version) throw new Error('instruction_set_specifier_unknown')
66
+
67
+ return {
68
+ instructionSetId: instructionSet.instructionSetId,
69
+ profileVersionId: version.profileVersionId,
70
+ digest: version.digest,
71
+ }
72
+ }
73
+
74
+ export function provenanceRequestFields(triple: InstructionSetProvenanceTriple | null) {
75
+ return triple ? {
76
+ [PROVENANCE_ATTRIBUTE_NAMES.instructionSetId]: triple.instructionSetId,
77
+ [PROVENANCE_ATTRIBUTE_NAMES.profileVersionId]: triple.profileVersionId,
78
+ [PROVENANCE_ATTRIBUTE_NAMES.digest]: triple.digest,
79
+ } : {}
80
+ }
81
+
82
+ export function noSubmitScorerOutput(
83
+ data: Record<string, unknown>,
84
+ instructionSetProvenance: Record<string, unknown>
85
+ ): Record<string, unknown> {
86
+ const scoreResult = data.scoreResult
87
+ if (typeof scoreResult !== 'object' || scoreResult === null || Array.isArray(scoreResult)) return data
88
+ return { ...scoreResult, provenance: data.provenance, ...instructionSetProvenance }
89
+ }