@bjoernrochel/sevro 0.1.0-rc.7 → 1.0.0

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 (230) hide show
  1. package/CONTRIBUTING.md +22 -6
  2. package/README.md +5 -1
  3. package/docs/README.md +19 -15
  4. package/docs/architecture.md +138 -17
  5. package/docs/assets/README.md +5 -4
  6. package/docs/builtin-graders-v1.md +17 -3
  7. package/docs/codex-host.md +155 -49
  8. package/docs/contracts.md +2 -1
  9. package/docs/creating-cases.md +9 -2
  10. package/docs/development-cli.md +187 -19
  11. package/docs/documentation-quality.md +12 -2
  12. package/docs/evaluation-workflow.md +110 -0
  13. package/docs/extension-protocol-v1.md +26 -3
  14. package/docs/getting-started.md +23 -2
  15. package/docs/guide-evaluation.md +33 -1
  16. package/docs/identity-v1.md +25 -2
  17. package/docs/installing.md +11 -11
  18. package/docs/native-controls.md +76 -5
  19. package/docs/native-hosts.md +196 -7
  20. package/docs/reading-results.md +102 -0
  21. package/docs/recipes.md +489 -0
  22. package/docs/releases.md +31 -12
  23. package/docs/report-v1.md +29 -1
  24. package/docs/results-v1.md +141 -4
  25. package/docs/run-settings-v1.md +147 -0
  26. package/docs/runtime-v1.md +307 -18
  27. package/docs/troubleshooting.md +12 -12
  28. package/docs/typescript-quality.md +89 -26
  29. package/examples/recipes/candidate.ts +26 -0
  30. package/examples/recipes/cases/coding-change.json +21 -0
  31. package/examples/recipes/cases/host-tools.json +21 -0
  32. package/examples/recipes/cases/mise.json +21 -0
  33. package/examples/recipes/cases/node.json +21 -0
  34. package/examples/recipes/cases/python-uv.json +21 -0
  35. package/examples/recipes/cases/semantic.json +17 -0
  36. package/examples/recipes/coding-change/check.ts +23 -0
  37. package/examples/recipes/extension-artifacts.ts +65 -0
  38. package/examples/recipes/extension-methods.ts +174 -0
  39. package/examples/recipes/extension.ts +37 -0
  40. package/examples/recipes/repository-skill/.agents/skills/startup-guide/SKILL.md +7 -0
  41. package/examples/recipes/repository-skill/.claude/skills/startup-guide/SKILL.md +7 -0
  42. package/examples/recipes/repository-skill/README.md +3 -0
  43. package/examples/recipes/run-inputs.ts +188 -0
  44. package/examples/recipes/run-options.ts +131 -0
  45. package/examples/recipes/run.ts +63 -0
  46. package/examples/recipes/runtime/empty.json +1 -0
  47. package/examples/recipes/runtime/goals.json +1 -0
  48. package/examples/recipes/runtime/mise.json +6 -0
  49. package/examples/recipes/runtime/path.json +1 -0
  50. package/examples/recipes/runtime/plugins.json +4 -0
  51. package/examples/recipes/runtime/python-uv.json +10 -0
  52. package/examples/recipes/semantic-judge.ts +29 -0
  53. package/examples/templates/coding/adapter.ts +17 -0
  54. package/examples/templates/coding/case.json +15 -0
  55. package/examples/templates/repository-skill/.agents/skills/startup-guide/SKILL.md +6 -0
  56. package/examples/templates/repository-skill/extension-data.ts +64 -0
  57. package/examples/templates/repository-skill/extension.ts +31 -0
  58. package/examples/templates/response/adapter.ts +12 -0
  59. package/examples/templates/response/case.json +13 -0
  60. package/package.json +11 -5
  61. package/schemas/report-v1.schema.json +9 -0
  62. package/schemas/run-evidence-v1.schema.json +2 -1
  63. package/schemas/runtime-v1.schema.json +63 -7
  64. package/src/advisory.ts +2 -2
  65. package/src/candidate-artifacts.ts +206 -0
  66. package/src/candidate-codex-state.ts +185 -0
  67. package/src/case-validation.ts +73 -50
  68. package/src/cli/cancellation.ts +20 -0
  69. package/src/cli/command.ts +87 -0
  70. package/src/cli/completion.ts +15 -0
  71. package/src/cli/demo.ts +60 -0
  72. package/src/cli/evaluation.ts +55 -0
  73. package/src/cli/extension.ts +79 -0
  74. package/src/cli/help.ts +198 -0
  75. package/src/cli/hosts.ts +55 -0
  76. package/src/cli/init-settings.ts +30 -0
  77. package/src/cli/init.ts +111 -0
  78. package/src/{cli-invocation.ts → cli/invocation.ts} +214 -218
  79. package/src/cli/loading.ts +151 -0
  80. package/src/cli/preparation.ts +154 -0
  81. package/src/cli/presentation.ts +93 -0
  82. package/src/cli/progress.ts +6 -0
  83. package/src/cli/run-manifest.ts +128 -0
  84. package/src/cli/run-options.ts +403 -0
  85. package/src/cli/run-overrides.ts +69 -0
  86. package/src/cli/settings.ts +154 -0
  87. package/src/cli/summary.ts +43 -0
  88. package/src/cli.ts +13 -591
  89. package/src/contract-types.ts +94 -0
  90. package/src/engine.ts +13 -5
  91. package/src/evaluation/advisory.ts +150 -0
  92. package/src/{evaluation-check-plan.ts → evaluation/check-plan.ts} +103 -67
  93. package/src/evaluation/collection.ts +88 -0
  94. package/src/evaluation/context.ts +10 -0
  95. package/src/{evaluation-grading-host.ts → evaluation/grading-host.ts} +5 -5
  96. package/src/evaluation/grading.ts +235 -0
  97. package/src/{evaluation-invocation-plan.ts → evaluation/invocation-plan.ts} +147 -58
  98. package/src/{evaluation-plan.ts → evaluation/plan.ts} +208 -141
  99. package/src/evaluation/progress.ts +19 -0
  100. package/src/evaluation/resources.ts +241 -0
  101. package/src/evaluation/run.ts +206 -0
  102. package/src/{evaluation-semantic.ts → evaluation/semantic.ts} +133 -115
  103. package/src/evaluation/trial.ts +800 -0
  104. package/src/evaluation/types.ts +207 -0
  105. package/src/evidence/host-results.ts +85 -0
  106. package/src/evidence/retained-artifacts.ts +18 -0
  107. package/src/evidence/trial-writer.ts +203 -0
  108. package/src/evidence/usage.ts +17 -0
  109. package/src/extension-client.ts +34 -96
  110. package/src/extension-session.ts +24 -48
  111. package/src/{advisory-fixture.ts → fixtures/advisory.ts} +15 -76
  112. package/src/{fixture-bin.ts → fixtures/bin.ts} +1 -1
  113. package/src/{fixture-cleanup.ts → fixtures/cleanup.ts} +13 -7
  114. package/src/fixtures/create.ts +183 -0
  115. package/src/{generated-fixture.ts → fixtures/generated.ts} +10 -53
  116. package/src/{git-hooks.ts → fixtures/git-hooks.ts} +1 -1
  117. package/src/{preparation.ts → fixtures/preparation.ts} +6 -16
  118. package/src/{repository-fixture.ts → fixtures/repository.ts} +30 -64
  119. package/src/{fixture-setup.ts → fixtures/setup.ts} +33 -51
  120. package/src/{fixture-tools.ts → fixtures/tools.ts} +1 -1
  121. package/src/fixtures/workspace-state.ts +212 -0
  122. package/src/generated/cli-result.d.cts +2 -1
  123. package/src/generated/extension.d.cts +2 -1
  124. package/src/generated/report.cjs +1 -1
  125. package/src/generated/report.d.cts +2 -1
  126. package/src/generated/run-evidence.cjs +1 -1
  127. package/src/generated/run-evidence.d.cts +2 -1
  128. package/src/generated/runtime.cjs +1 -1
  129. package/src/generated/runtime.d.cts +2 -1
  130. package/src/git.ts +93 -0
  131. package/src/graders/git-head.ts +29 -84
  132. package/src/graders/shell.ts +57 -68
  133. package/src/host-diagnostic-redaction.ts +52 -0
  134. package/src/host-diagnostics.ts +331 -0
  135. package/src/hosts/claude-continuation.ts +57 -40
  136. package/src/hosts/claude-credential.ts +160 -63
  137. package/src/hosts/claude-events.ts +34 -18
  138. package/src/hosts/claude-keychain.ts +78 -21
  139. package/src/hosts/claude-login-recovery.ts +85 -0
  140. package/src/hosts/claude-login-refresh.ts +178 -0
  141. package/src/hosts/claude-login-store.ts +162 -0
  142. package/src/hosts/claude-login.ts +107 -0
  143. package/src/hosts/claude-native-goal.ts +15 -12
  144. package/src/hosts/claude-process.ts +10 -50
  145. package/src/hosts/claude-refresh-lock.ts +81 -0
  146. package/src/hosts/claude-repository-invocation.ts +9 -34
  147. package/src/hosts/claude-settings.ts +91 -14
  148. package/src/hosts/claude-skill-activations.ts +169 -0
  149. package/src/hosts/claude-state.ts +46 -16
  150. package/src/hosts/claude-tool-calls.ts +13 -10
  151. package/src/hosts/claude.ts +122 -73
  152. package/src/hosts/codex-app-server.ts +78 -52
  153. package/src/hosts/codex-configuration.ts +5 -10
  154. package/src/hosts/codex-exec-controls.ts +516 -0
  155. package/src/hosts/codex-marketplace.ts +12 -10
  156. package/src/hosts/codex-native-calls.ts +15 -122
  157. package/src/hosts/codex-process.ts +10 -54
  158. package/src/hosts/codex-profile.ts +50 -21
  159. package/src/hosts/codex-session-files.ts +1 -9
  160. package/src/hosts/codex-state.ts +141 -19
  161. package/src/hosts/codex.ts +221 -179
  162. package/src/hosts/isolation-common.ts +15 -11
  163. package/src/hosts/isolation-roots.ts +13 -20
  164. package/src/hosts/linux-sandbox.ts +27 -3
  165. package/src/hosts/mac-sandbox.ts +111 -18
  166. package/src/hosts/native-controls.ts +72 -22
  167. package/src/hosts/native-request.ts +55 -0
  168. package/src/hosts/process-lifecycle.ts +221 -45
  169. package/src/hosts/protected-worktrees.ts +1 -1
  170. package/src/hosts/skill-hook-catalog.ts +131 -0
  171. package/src/hosts/skill-hook-handler.ts +374 -0
  172. package/src/hosts/skill-hooks.ts +577 -0
  173. package/src/instrumentation.ts +7 -8
  174. package/src/native-transcript-state.ts +22 -3
  175. package/src/native-transcript-view.ts +52 -13
  176. package/src/native-transcripts.ts +34 -15
  177. package/src/paths.ts +22 -0
  178. package/src/process-lifecycle.ts +150 -0
  179. package/src/provenance.ts +27 -7
  180. package/src/prune.ts +300 -0
  181. package/src/report.ts +63 -36
  182. package/src/resolved-case.ts +1 -1
  183. package/src/results-lock.ts +42 -0
  184. package/src/results.ts +14 -18
  185. package/src/run-owner.ts +4 -4
  186. package/src/{runtime-config.ts → runtime/config.ts} +182 -44
  187. package/src/{runtime-discovery-apple.ts → runtime/discovery-apple.ts} +3 -3
  188. package/src/{runtime-discovery-providers.ts → runtime/discovery-providers.ts} +3 -9
  189. package/src/{runtime-discovery.ts → runtime/discovery.ts} +4 -4
  190. package/src/{runtime-hook-processes.ts → runtime/hook-processes.ts} +1 -1
  191. package/src/{runtime-hooks.ts → runtime/hooks.ts} +33 -22
  192. package/src/{runtime-paths.ts → runtime/paths.ts} +6 -18
  193. package/src/{runtime-query.ts → runtime/query.ts} +5 -5
  194. package/src/{runtime-seeds.ts → runtime/seeds.ts} +3 -3
  195. package/src/runtime/shared-cache.ts +130 -0
  196. package/src/{runtime-state.ts → runtime/state.ts} +28 -11
  197. package/src/schema-types.ts +73 -161
  198. package/src/shell.ts +4 -0
  199. package/src/transcript-retention.ts +146 -0
  200. package/src/value-guards.ts +22 -0
  201. package/docs/assets/sevro-logo.png +0 -0
  202. package/docs/assets/sevro-symbol.svg +0 -1
  203. package/docs/assets/sevro-wordmark.svg +0 -1
  204. package/docs/cache-ownership-validation.md +0 -49
  205. package/docs/claude-continuation-validation.md +0 -47
  206. package/docs/concurrency-validation.md +0 -86
  207. package/docs/configuration-root-validation.md +0 -70
  208. package/docs/engine-slice.md +0 -114
  209. package/docs/evidence/runtime-startup-30/README.md +0 -185
  210. package/docs/evidence/runtime-startup-30/after.json +0 -319
  211. package/docs/evidence/runtime-startup-30/baseline-timeout.jsonl +0 -2
  212. package/docs/evidence/runtime-startup-30/before.json +0 -403
  213. package/docs/evidence/runtime-startup-30/consumer-smoke.json +0 -63
  214. package/docs/evidence/runtime-startup-30/full-policy-diagnostic.jsonl +0 -3
  215. package/docs/evidence/runtime-startup-30/minimal-policy-diagnostic.jsonl +0 -3
  216. package/docs/evidence/runtime-startup-30/plugin-template-assessment.json +0 -20
  217. package/docs/evidence/runtime-startup-30/seedless-timeout.jsonl +0 -2
  218. package/docs/evidence.md +0 -17
  219. package/docs/fixture-cleanup-validation.md +0 -70
  220. package/docs/guide-verification.json +0 -239
  221. package/src/evaluation-context.ts +0 -257
  222. package/src/evaluation-fixture.ts +0 -313
  223. package/src/evaluation-run.ts +0 -198
  224. package/src/evaluation-trial.ts +0 -946
  225. package/src/evaluation-types.ts +0 -149
  226. package/src/hosts/claude-nested-skills.ts +0 -272
  227. package/src/hosts/codex-command-output.ts +0 -510
  228. package/src/hosts/codex-executor-command.ts +0 -291
  229. package/src/hosts/codex-skill-reads.ts +0 -609
  230. /package/src/{trial-scheduler.ts → evaluation/scheduler.ts} +0 -0
@@ -1,3 +1,4 @@
1
1
  // Generated by bun run schemas:generate; do not edit.
2
- declare function validate(value: unknown): boolean;
2
+ import type { ValidateFunction } from "ajv";
3
+ declare const validate: ValidateFunction;
3
4
  export = validate;
@@ -1,2 +1,2 @@
1
1
  // Generated by bun run schemas:generate; do not edit.
2
- "use strict";module.exports = validate104;module.exports.default = validate104;const schema164 = {"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"urn:sevro:schema:runtime:v1","title":"Sevro runtime policy v1","type":"object","additionalProperties":false,"required":["format"],"properties":{"nativeTranscripts":{"type":"boolean"},"hooks":{"type":"object","additionalProperties":false,"properties":{"nativeGoal":{"type":"boolean"},"plugins":{"type":"array","maxItems":64,"uniqueItems":true,"items":{"type":"string","pattern":"^[a-z][a-z0-9-]*$","maxLength":128}}}},"runtime":{"type":"object","additionalProperties":false,"properties":{"seedDirectories":{"type":"array","maxItems":16,"items":{"type":"object","additionalProperties":false,"required":["source","target"],"properties":{"source":{"type":"string","minLength":1,"maxLength":4096},"target":{"type":"string","pattern":"^[a-z][a-z0-9-]{0,63}$","not":{"enum":["home","tmp"]}},"roles":{"type":"array","minItems":1,"maxItems":5,"uniqueItems":true,"items":{"enum":["candidate","checks","hooks","semantic","advisory"]}}}}}}},"format":{"const":"sevro.runtime.v1"},"filesystem":{"type":"object","additionalProperties":false,"properties":{"optionalReadOnlyRoots":{"type":"array","maxItems":64,"uniqueItems":true,"items":{"type":"string","minLength":1,"maxLength":4096}},"readOnlyRoots":{"type":"array","maxItems":64,"uniqueItems":true,"items":{"type":"string","minLength":1,"maxLength":4096}}}},"environment":{"type":"object","additionalProperties":false,"properties":{"inherit":{"type":"array","maxItems":64,"uniqueItems":true,"items":{"type":"string","pattern":"^[A-Za-z_][A-Za-z0-9_]{0,127}$"}},"set":{"type":"object","maxProperties":64,"propertyNames":{"pattern":"^[A-Za-z_][A-Za-z0-9_]{0,127}$"},"additionalProperties":{"type":"string","maxLength":8192}}}}}};const func2 = require("ajv/dist/runtime/ucs2length").default;const func0 = require("ajv/dist/runtime/equal").default;const pattern55 = new RegExp("^[a-z][a-z0-9-]*$", "u");const pattern56 = new RegExp("^[a-z][a-z0-9-]{0,63}$", "u");const pattern57 = new RegExp("^[A-Za-z_][A-Za-z0-9_]{0,127}$", "u");function validate104(data, {instancePath="", parentData, parentDataProperty, rootData=data, dynamicAnchors={}}={}){/*# sourceURL="urn:sevro:schema:runtime:v1" */;let vErrors = null;let errors = 0;const evaluated0 = validate104.evaluated;if(evaluated0.dynamicProps){evaluated0.props = undefined;}if(evaluated0.dynamicItems){evaluated0.items = undefined;}if(errors === 0){if(data && typeof data == "object" && !Array.isArray(data)){let missing0;if((data.format === undefined) && (missing0 = "format")){validate104.errors = [{instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: missing0},message:"must have required property '"+missing0+"'"}];return false;}else {const _errs1 = errors;for(const key0 in data){if(!((((((key0 === "nativeTranscripts") || (key0 === "hooks")) || (key0 === "runtime")) || (key0 === "format")) || (key0 === "filesystem")) || (key0 === "environment"))){validate104.errors = [{instancePath,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key0},message:"must NOT have additional properties"}];return false;break;}}if(_errs1 === errors){if(data.nativeTranscripts !== undefined){const _errs2 = errors;if(typeof data.nativeTranscripts !== "boolean"){validate104.errors = [{instancePath:instancePath+"/nativeTranscripts",schemaPath:"#/properties/nativeTranscripts/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"}];return false;}var valid0 = _errs2 === errors;}else {var valid0 = true;}if(valid0){if(data.hooks !== undefined){let data1 = data.hooks;const _errs4 = errors;if(errors === _errs4){if(data1 && typeof data1 == "object" && !Array.isArray(data1)){const _errs6 = errors;for(const key1 in data1){if(!((key1 === "nativeGoal") || (key1 === "plugins"))){validate104.errors = [{instancePath:instancePath+"/hooks",schemaPath:"#/properties/hooks/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key1},message:"must NOT have additional properties"}];return false;break;}}if(_errs6 === errors){if(data1.nativeGoal !== undefined){const _errs7 = errors;if(typeof data1.nativeGoal !== "boolean"){validate104.errors = [{instancePath:instancePath+"/hooks/nativeGoal",schemaPath:"#/properties/hooks/properties/nativeGoal/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"}];return false;}var valid1 = _errs7 === errors;}else {var valid1 = true;}if(valid1){if(data1.plugins !== undefined){let data3 = data1.plugins;const _errs9 = errors;if(errors === _errs9){if(Array.isArray(data3)){if(data3.length > 64){validate104.errors = [{instancePath:instancePath+"/hooks/plugins",schemaPath:"#/properties/hooks/properties/plugins/maxItems",keyword:"maxItems",params:{limit: 64},message:"must NOT have more than 64 items"}];return false;}else {var valid2 = true;const len0 = data3.length;for(let i0=0; i0<len0; i0++){let data4 = data3[i0];const _errs11 = errors;if(errors === _errs11){if(typeof data4 === "string"){if(func2(data4) > 128){validate104.errors = [{instancePath:instancePath+"/hooks/plugins/" + i0,schemaPath:"#/properties/hooks/properties/plugins/items/maxLength",keyword:"maxLength",params:{limit: 128},message:"must NOT have more than 128 characters"}];return false;}else {if(!pattern55.test(data4)){validate104.errors = [{instancePath:instancePath+"/hooks/plugins/" + i0,schemaPath:"#/properties/hooks/properties/plugins/items/pattern",keyword:"pattern",params:{pattern: "^[a-z][a-z0-9-]*$"},message:"must match pattern \""+"^[a-z][a-z0-9-]*$"+"\""}];return false;}}}else {validate104.errors = [{instancePath:instancePath+"/hooks/plugins/" + i0,schemaPath:"#/properties/hooks/properties/plugins/items/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}}var valid2 = _errs11 === errors;if(!valid2){break;}}if(valid2){let i1 = data3.length;let j0;if(i1 > 1){const indices0 = {};for(;i1--;){let item0 = data3[i1];if(typeof item0 !== "string"){continue;}if(typeof indices0[item0] == "number"){j0 = indices0[item0];validate104.errors = [{instancePath:instancePath+"/hooks/plugins",schemaPath:"#/properties/hooks/properties/plugins/uniqueItems",keyword:"uniqueItems",params:{i: i1, j: j0},message:"must NOT have duplicate items (items ## "+j0+" and "+i1+" are identical)"}];return false;break;}indices0[item0] = i1;}}}}}else {validate104.errors = [{instancePath:instancePath+"/hooks/plugins",schemaPath:"#/properties/hooks/properties/plugins/type",keyword:"type",params:{type: "array"},message:"must be array"}];return false;}}var valid1 = _errs9 === errors;}else {var valid1 = true;}}}}else {validate104.errors = [{instancePath:instancePath+"/hooks",schemaPath:"#/properties/hooks/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs4 === errors;}else {var valid0 = true;}if(valid0){if(data.runtime !== undefined){let data5 = data.runtime;const _errs13 = errors;if(errors === _errs13){if(data5 && typeof data5 == "object" && !Array.isArray(data5)){const _errs15 = errors;for(const key2 in data5){if(!(key2 === "seedDirectories")){validate104.errors = [{instancePath:instancePath+"/runtime",schemaPath:"#/properties/runtime/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key2},message:"must NOT have additional properties"}];return false;break;}}if(_errs15 === errors){if(data5.seedDirectories !== undefined){let data6 = data5.seedDirectories;const _errs16 = errors;if(errors === _errs16){if(Array.isArray(data6)){if(data6.length > 16){validate104.errors = [{instancePath:instancePath+"/runtime/seedDirectories",schemaPath:"#/properties/runtime/properties/seedDirectories/maxItems",keyword:"maxItems",params:{limit: 16},message:"must NOT have more than 16 items"}];return false;}else {var valid5 = true;const len1 = data6.length;for(let i2=0; i2<len1; i2++){let data7 = data6[i2];const _errs18 = errors;if(errors === _errs18){if(data7 && typeof data7 == "object" && !Array.isArray(data7)){let missing1;if(((data7.source === undefined) && (missing1 = "source")) || ((data7.target === undefined) && (missing1 = "target"))){validate104.errors = [{instancePath:instancePath+"/runtime/seedDirectories/" + i2,schemaPath:"#/properties/runtime/properties/seedDirectories/items/required",keyword:"required",params:{missingProperty: missing1},message:"must have required property '"+missing1+"'"}];return false;}else {const _errs20 = errors;for(const key3 in data7){if(!(((key3 === "source") || (key3 === "target")) || (key3 === "roles"))){validate104.errors = [{instancePath:instancePath+"/runtime/seedDirectories/" + i2,schemaPath:"#/properties/runtime/properties/seedDirectories/items/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key3},message:"must NOT have additional properties"}];return false;break;}}if(_errs20 === errors){if(data7.source !== undefined){let data8 = data7.source;const _errs21 = errors;if(errors === _errs21){if(typeof data8 === "string"){if(func2(data8) > 4096){validate104.errors = [{instancePath:instancePath+"/runtime/seedDirectories/" + i2+"/source",schemaPath:"#/properties/runtime/properties/seedDirectories/items/properties/source/maxLength",keyword:"maxLength",params:{limit: 4096},message:"must NOT have more than 4096 characters"}];return false;}else {if(func2(data8) < 1){validate104.errors = [{instancePath:instancePath+"/runtime/seedDirectories/" + i2+"/source",schemaPath:"#/properties/runtime/properties/seedDirectories/items/properties/source/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"}];return false;}}}else {validate104.errors = [{instancePath:instancePath+"/runtime/seedDirectories/" + i2+"/source",schemaPath:"#/properties/runtime/properties/seedDirectories/items/properties/source/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}}var valid6 = _errs21 === errors;}else {var valid6 = true;}if(valid6){if(data7.target !== undefined){let data9 = data7.target;const _errs23 = errors;const _errs25 = errors;const _errs26 = errors;if(!((data9 === "home") || (data9 === "tmp"))){const err0 = {};if(vErrors === null){vErrors = [err0];}else {vErrors.push(err0);}errors++;}var valid7 = _errs26 === errors;if(valid7){validate104.errors = [{instancePath:instancePath+"/runtime/seedDirectories/" + i2+"/target",schemaPath:"#/properties/runtime/properties/seedDirectories/items/properties/target/not",keyword:"not",params:{},message:"must NOT be valid"}];return false;}else {errors = _errs25;if(vErrors !== null){if(_errs25){vErrors.length = _errs25;}else {vErrors = null;}}}if(errors === _errs23){if(typeof data9 === "string"){if(!pattern56.test(data9)){validate104.errors = [{instancePath:instancePath+"/runtime/seedDirectories/" + i2+"/target",schemaPath:"#/properties/runtime/properties/seedDirectories/items/properties/target/pattern",keyword:"pattern",params:{pattern: "^[a-z][a-z0-9-]{0,63}$"},message:"must match pattern \""+"^[a-z][a-z0-9-]{0,63}$"+"\""}];return false;}}else {validate104.errors = [{instancePath:instancePath+"/runtime/seedDirectories/" + i2+"/target",schemaPath:"#/properties/runtime/properties/seedDirectories/items/properties/target/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}}var valid6 = _errs23 === errors;}else {var valid6 = true;}if(valid6){if(data7.roles !== undefined){let data10 = data7.roles;const _errs27 = errors;if(errors === _errs27){if(Array.isArray(data10)){if(data10.length > 5){validate104.errors = [{instancePath:instancePath+"/runtime/seedDirectories/" + i2+"/roles",schemaPath:"#/properties/runtime/properties/seedDirectories/items/properties/roles/maxItems",keyword:"maxItems",params:{limit: 5},message:"must NOT have more than 5 items"}];return false;}else {if(data10.length < 1){validate104.errors = [{instancePath:instancePath+"/runtime/seedDirectories/" + i2+"/roles",schemaPath:"#/properties/runtime/properties/seedDirectories/items/properties/roles/minItems",keyword:"minItems",params:{limit: 1},message:"must NOT have fewer than 1 items"}];return false;}else {var valid8 = true;const len2 = data10.length;for(let i3=0; i3<len2; i3++){let data11 = data10[i3];const _errs29 = errors;if(!(((((data11 === "candidate") || (data11 === "checks")) || (data11 === "hooks")) || (data11 === "semantic")) || (data11 === "advisory"))){validate104.errors = [{instancePath:instancePath+"/runtime/seedDirectories/" + i2+"/roles/" + i3,schemaPath:"#/properties/runtime/properties/seedDirectories/items/properties/roles/items/enum",keyword:"enum",params:{allowedValues: schema164.properties.runtime.properties.seedDirectories.items.properties.roles.items.enum},message:"must be equal to one of the allowed values"}];return false;}var valid8 = _errs29 === errors;if(!valid8){break;}}if(valid8){let i4 = data10.length;let j1;if(i4 > 1){outer0:for(;i4--;){for(j1 = i4; j1--;){if(func0(data10[i4], data10[j1])){validate104.errors = [{instancePath:instancePath+"/runtime/seedDirectories/" + i2+"/roles",schemaPath:"#/properties/runtime/properties/seedDirectories/items/properties/roles/uniqueItems",keyword:"uniqueItems",params:{i: i4, j: j1},message:"must NOT have duplicate items (items ## "+j1+" and "+i4+" are identical)"}];return false;break outer0;}}}}}}}}else {validate104.errors = [{instancePath:instancePath+"/runtime/seedDirectories/" + i2+"/roles",schemaPath:"#/properties/runtime/properties/seedDirectories/items/properties/roles/type",keyword:"type",params:{type: "array"},message:"must be array"}];return false;}}var valid6 = _errs27 === errors;}else {var valid6 = true;}}}}}}else {validate104.errors = [{instancePath:instancePath+"/runtime/seedDirectories/" + i2,schemaPath:"#/properties/runtime/properties/seedDirectories/items/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid5 = _errs18 === errors;if(!valid5){break;}}}}else {validate104.errors = [{instancePath:instancePath+"/runtime/seedDirectories",schemaPath:"#/properties/runtime/properties/seedDirectories/type",keyword:"type",params:{type: "array"},message:"must be array"}];return false;}}}}}else {validate104.errors = [{instancePath:instancePath+"/runtime",schemaPath:"#/properties/runtime/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs13 === errors;}else {var valid0 = true;}if(valid0){if(data.format !== undefined){const _errs30 = errors;if("sevro.runtime.v1" !== data.format){validate104.errors = [{instancePath:instancePath+"/format",schemaPath:"#/properties/format/const",keyword:"const",params:{allowedValue: "sevro.runtime.v1"},message:"must be equal to constant"}];return false;}var valid0 = _errs30 === errors;}else {var valid0 = true;}if(valid0){if(data.filesystem !== undefined){let data13 = data.filesystem;const _errs31 = errors;if(errors === _errs31){if(data13 && typeof data13 == "object" && !Array.isArray(data13)){const _errs33 = errors;for(const key4 in data13){if(!((key4 === "optionalReadOnlyRoots") || (key4 === "readOnlyRoots"))){validate104.errors = [{instancePath:instancePath+"/filesystem",schemaPath:"#/properties/filesystem/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key4},message:"must NOT have additional properties"}];return false;break;}}if(_errs33 === errors){if(data13.optionalReadOnlyRoots !== undefined){let data14 = data13.optionalReadOnlyRoots;const _errs34 = errors;if(errors === _errs34){if(Array.isArray(data14)){if(data14.length > 64){validate104.errors = [{instancePath:instancePath+"/filesystem/optionalReadOnlyRoots",schemaPath:"#/properties/filesystem/properties/optionalReadOnlyRoots/maxItems",keyword:"maxItems",params:{limit: 64},message:"must NOT have more than 64 items"}];return false;}else {var valid11 = true;const len3 = data14.length;for(let i5=0; i5<len3; i5++){let data15 = data14[i5];const _errs36 = errors;if(errors === _errs36){if(typeof data15 === "string"){if(func2(data15) > 4096){validate104.errors = [{instancePath:instancePath+"/filesystem/optionalReadOnlyRoots/" + i5,schemaPath:"#/properties/filesystem/properties/optionalReadOnlyRoots/items/maxLength",keyword:"maxLength",params:{limit: 4096},message:"must NOT have more than 4096 characters"}];return false;}else {if(func2(data15) < 1){validate104.errors = [{instancePath:instancePath+"/filesystem/optionalReadOnlyRoots/" + i5,schemaPath:"#/properties/filesystem/properties/optionalReadOnlyRoots/items/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"}];return false;}}}else {validate104.errors = [{instancePath:instancePath+"/filesystem/optionalReadOnlyRoots/" + i5,schemaPath:"#/properties/filesystem/properties/optionalReadOnlyRoots/items/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}}var valid11 = _errs36 === errors;if(!valid11){break;}}if(valid11){let i6 = data14.length;let j2;if(i6 > 1){const indices1 = {};for(;i6--;){let item1 = data14[i6];if(typeof item1 !== "string"){continue;}if(typeof indices1[item1] == "number"){j2 = indices1[item1];validate104.errors = [{instancePath:instancePath+"/filesystem/optionalReadOnlyRoots",schemaPath:"#/properties/filesystem/properties/optionalReadOnlyRoots/uniqueItems",keyword:"uniqueItems",params:{i: i6, j: j2},message:"must NOT have duplicate items (items ## "+j2+" and "+i6+" are identical)"}];return false;break;}indices1[item1] = i6;}}}}}else {validate104.errors = [{instancePath:instancePath+"/filesystem/optionalReadOnlyRoots",schemaPath:"#/properties/filesystem/properties/optionalReadOnlyRoots/type",keyword:"type",params:{type: "array"},message:"must be array"}];return false;}}var valid10 = _errs34 === errors;}else {var valid10 = true;}if(valid10){if(data13.readOnlyRoots !== undefined){let data16 = data13.readOnlyRoots;const _errs38 = errors;if(errors === _errs38){if(Array.isArray(data16)){if(data16.length > 64){validate104.errors = [{instancePath:instancePath+"/filesystem/readOnlyRoots",schemaPath:"#/properties/filesystem/properties/readOnlyRoots/maxItems",keyword:"maxItems",params:{limit: 64},message:"must NOT have more than 64 items"}];return false;}else {var valid13 = true;const len4 = data16.length;for(let i7=0; i7<len4; i7++){let data17 = data16[i7];const _errs40 = errors;if(errors === _errs40){if(typeof data17 === "string"){if(func2(data17) > 4096){validate104.errors = [{instancePath:instancePath+"/filesystem/readOnlyRoots/" + i7,schemaPath:"#/properties/filesystem/properties/readOnlyRoots/items/maxLength",keyword:"maxLength",params:{limit: 4096},message:"must NOT have more than 4096 characters"}];return false;}else {if(func2(data17) < 1){validate104.errors = [{instancePath:instancePath+"/filesystem/readOnlyRoots/" + i7,schemaPath:"#/properties/filesystem/properties/readOnlyRoots/items/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"}];return false;}}}else {validate104.errors = [{instancePath:instancePath+"/filesystem/readOnlyRoots/" + i7,schemaPath:"#/properties/filesystem/properties/readOnlyRoots/items/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}}var valid13 = _errs40 === errors;if(!valid13){break;}}if(valid13){let i8 = data16.length;let j3;if(i8 > 1){const indices2 = {};for(;i8--;){let item2 = data16[i8];if(typeof item2 !== "string"){continue;}if(typeof indices2[item2] == "number"){j3 = indices2[item2];validate104.errors = [{instancePath:instancePath+"/filesystem/readOnlyRoots",schemaPath:"#/properties/filesystem/properties/readOnlyRoots/uniqueItems",keyword:"uniqueItems",params:{i: i8, j: j3},message:"must NOT have duplicate items (items ## "+j3+" and "+i8+" are identical)"}];return false;break;}indices2[item2] = i8;}}}}}else {validate104.errors = [{instancePath:instancePath+"/filesystem/readOnlyRoots",schemaPath:"#/properties/filesystem/properties/readOnlyRoots/type",keyword:"type",params:{type: "array"},message:"must be array"}];return false;}}var valid10 = _errs38 === errors;}else {var valid10 = true;}}}}else {validate104.errors = [{instancePath:instancePath+"/filesystem",schemaPath:"#/properties/filesystem/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs31 === errors;}else {var valid0 = true;}if(valid0){if(data.environment !== undefined){let data18 = data.environment;const _errs42 = errors;if(errors === _errs42){if(data18 && typeof data18 == "object" && !Array.isArray(data18)){const _errs44 = errors;for(const key5 in data18){if(!((key5 === "inherit") || (key5 === "set"))){validate104.errors = [{instancePath:instancePath+"/environment",schemaPath:"#/properties/environment/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key5},message:"must NOT have additional properties"}];return false;break;}}if(_errs44 === errors){if(data18.inherit !== undefined){let data19 = data18.inherit;const _errs45 = errors;if(errors === _errs45){if(Array.isArray(data19)){if(data19.length > 64){validate104.errors = [{instancePath:instancePath+"/environment/inherit",schemaPath:"#/properties/environment/properties/inherit/maxItems",keyword:"maxItems",params:{limit: 64},message:"must NOT have more than 64 items"}];return false;}else {var valid16 = true;const len5 = data19.length;for(let i9=0; i9<len5; i9++){let data20 = data19[i9];const _errs47 = errors;if(errors === _errs47){if(typeof data20 === "string"){if(!pattern57.test(data20)){validate104.errors = [{instancePath:instancePath+"/environment/inherit/" + i9,schemaPath:"#/properties/environment/properties/inherit/items/pattern",keyword:"pattern",params:{pattern: "^[A-Za-z_][A-Za-z0-9_]{0,127}$"},message:"must match pattern \""+"^[A-Za-z_][A-Za-z0-9_]{0,127}$"+"\""}];return false;}}else {validate104.errors = [{instancePath:instancePath+"/environment/inherit/" + i9,schemaPath:"#/properties/environment/properties/inherit/items/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}}var valid16 = _errs47 === errors;if(!valid16){break;}}if(valid16){let i10 = data19.length;let j4;if(i10 > 1){const indices3 = {};for(;i10--;){let item3 = data19[i10];if(typeof item3 !== "string"){continue;}if(typeof indices3[item3] == "number"){j4 = indices3[item3];validate104.errors = [{instancePath:instancePath+"/environment/inherit",schemaPath:"#/properties/environment/properties/inherit/uniqueItems",keyword:"uniqueItems",params:{i: i10, j: j4},message:"must NOT have duplicate items (items ## "+j4+" and "+i10+" are identical)"}];return false;break;}indices3[item3] = i10;}}}}}else {validate104.errors = [{instancePath:instancePath+"/environment/inherit",schemaPath:"#/properties/environment/properties/inherit/type",keyword:"type",params:{type: "array"},message:"must be array"}];return false;}}var valid15 = _errs45 === errors;}else {var valid15 = true;}if(valid15){if(data18.set !== undefined){let data21 = data18.set;const _errs49 = errors;if(errors === _errs49){if(data21 && typeof data21 == "object" && !Array.isArray(data21)){if(Object.keys(data21).length > 64){validate104.errors = [{instancePath:instancePath+"/environment/set",schemaPath:"#/properties/environment/properties/set/maxProperties",keyword:"maxProperties",params:{limit: 64},message:"must NOT have more than 64 properties"}];return false;}else {for(const key6 in data21){const _errs51 = errors;if(typeof key6 === "string"){if(!pattern57.test(key6)){const err1 = {instancePath:instancePath+"/environment/set",schemaPath:"#/properties/environment/properties/set/propertyNames/pattern",keyword:"pattern",params:{pattern: "^[A-Za-z_][A-Za-z0-9_]{0,127}$"},message:"must match pattern \""+"^[A-Za-z_][A-Za-z0-9_]{0,127}$"+"\"",propertyName:key6};if(vErrors === null){vErrors = [err1];}else {vErrors.push(err1);}errors++;}}var valid18 = _errs51 === errors;if(!valid18){const err2 = {instancePath:instancePath+"/environment/set",schemaPath:"#/properties/environment/properties/set/propertyNames",keyword:"propertyNames",params:{propertyName: key6},message:"property name must be valid"};if(vErrors === null){vErrors = [err2];}else {vErrors.push(err2);}errors++;validate104.errors = vErrors;return false;break;}}if(valid18){for(const key7 in data21){let data22 = data21[key7];const _errs53 = errors;if(errors === _errs53){if(typeof data22 === "string"){if(func2(data22) > 8192){validate104.errors = [{instancePath:instancePath+"/environment/set/" + key7.replace(/~/g, "~0").replace(/\//g, "~1"),schemaPath:"#/properties/environment/properties/set/additionalProperties/maxLength",keyword:"maxLength",params:{limit: 8192},message:"must NOT have more than 8192 characters"}];return false;}}else {validate104.errors = [{instancePath:instancePath+"/environment/set/" + key7.replace(/~/g, "~0").replace(/\//g, "~1"),schemaPath:"#/properties/environment/properties/set/additionalProperties/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}}var valid19 = _errs53 === errors;if(!valid19){break;}}}}}else {validate104.errors = [{instancePath:instancePath+"/environment/set",schemaPath:"#/properties/environment/properties/set/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid15 = _errs49 === errors;}else {var valid15 = true;}}}}else {validate104.errors = [{instancePath:instancePath+"/environment",schemaPath:"#/properties/environment/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs42 === errors;}else {var valid0 = true;}}}}}}}}}else {validate104.errors = [{instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}validate104.errors = vErrors;return errors === 0;}validate104.evaluated = {"props":true,"dynamicProps":false,"dynamicItems":false};
2
+ "use strict";module.exports = validate104;module.exports.default = validate104;const schema164 = {"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"urn:sevro:schema:runtime:v1","title":"Sevro runtime policy v1","type":"object","additionalProperties":false,"required":["format"],"$defs":{"runtimeRole":{"$comment":"Generated from RUNTIME_ROLES by bun run schemas:generate.","enum":["candidate","checks","hooks","semantic","advisory"]}},"properties":{"codexState":{"type":"boolean"},"network":{"type":"object","additionalProperties":false,"properties":{"localHttp":{"type":"boolean"}}},"nativeTranscripts":{"type":"boolean"},"hooks":{"type":"object","additionalProperties":false,"properties":{"nativeGoal":{"type":"boolean"},"plugins":{"type":"array","maxItems":64,"uniqueItems":true,"items":{"type":"string","pattern":"^[a-z][a-z0-9-]*$","maxLength":128}}}},"runtime":{"type":"object","additionalProperties":false,"properties":{"artifactDirectories":{"type":"array","maxItems":16,"items":{"type":"object","additionalProperties":false,"required":["name","path"],"properties":{"name":{"type":"string","pattern":"^[a-z][a-z0-9_]{0,63}$"},"path":{"type":"string","minLength":1,"maxLength":4096}}}},"sharedCacheDirectories":{"type":"array","maxItems":16,"items":{"type":"object","additionalProperties":false,"required":["source","target","roles"],"properties":{"source":{"type":"string","minLength":1,"maxLength":4096},"target":{"type":"string","pattern":"^[a-z][a-z0-9-]{0,63}$","not":{"enum":["home","tmp"]}},"roles":{"type":"array","minItems":1,"maxItems":5,"uniqueItems":true,"items":{"$ref":"#/$defs/runtimeRole"}}}}},"seedDirectories":{"type":"array","maxItems":16,"items":{"type":"object","additionalProperties":false,"required":["source","target"],"properties":{"source":{"type":"string","minLength":1,"maxLength":4096},"target":{"type":"string","pattern":"^[a-z][a-z0-9-]{0,63}$","not":{"enum":["home","tmp"]}},"roles":{"type":"array","minItems":1,"maxItems":5,"uniqueItems":true,"items":{"$ref":"#/$defs/runtimeRole"}}}}}}},"format":{"const":"sevro.runtime.v1"},"filesystem":{"type":"object","additionalProperties":false,"properties":{"optionalReadOnlyRoots":{"type":"array","maxItems":64,"uniqueItems":true,"items":{"type":"string","minLength":1,"maxLength":4096}},"readOnlyRoots":{"type":"array","maxItems":64,"uniqueItems":true,"items":{"type":"string","minLength":1,"maxLength":4096}}}},"environment":{"type":"object","additionalProperties":false,"properties":{"inherit":{"type":"array","maxItems":64,"uniqueItems":true,"items":{"type":"string","pattern":"^[A-Za-z_][A-Za-z0-9_]{0,127}$"}},"set":{"type":"object","maxProperties":64,"propertyNames":{"pattern":"^[A-Za-z_][A-Za-z0-9_]{0,127}$"},"additionalProperties":{"type":"string","maxLength":8192}}}}}};const schema165 = {"$comment":"Generated from RUNTIME_ROLES by bun run schemas:generate.","enum":["candidate","checks","hooks","semantic","advisory"]};const func2 = require("ajv/dist/runtime/ucs2length").default;const func0 = require("ajv/dist/runtime/equal").default;const pattern55 = new RegExp("^[a-z][a-z0-9-]*$", "u");const pattern56 = new RegExp("^[a-z][a-z0-9_]{0,63}$", "u");const pattern57 = new RegExp("^[a-z][a-z0-9-]{0,63}$", "u");const pattern59 = new RegExp("^[A-Za-z_][A-Za-z0-9_]{0,127}$", "u");function validate104(data, {instancePath="", parentData, parentDataProperty, rootData=data, dynamicAnchors={}}={}){/*# sourceURL="urn:sevro:schema:runtime:v1" */;let vErrors = null;let errors = 0;const evaluated0 = validate104.evaluated;if(evaluated0.dynamicProps){evaluated0.props = undefined;}if(evaluated0.dynamicItems){evaluated0.items = undefined;}if(errors === 0){if(data && typeof data == "object" && !Array.isArray(data)){let missing0;if((data.format === undefined) && (missing0 = "format")){validate104.errors = [{instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: missing0},message:"must have required property '"+missing0+"'"}];return false;}else {const _errs1 = errors;for(const key0 in data){if(!((((((((key0 === "codexState") || (key0 === "network")) || (key0 === "nativeTranscripts")) || (key0 === "hooks")) || (key0 === "runtime")) || (key0 === "format")) || (key0 === "filesystem")) || (key0 === "environment"))){validate104.errors = [{instancePath,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key0},message:"must NOT have additional properties"}];return false;break;}}if(_errs1 === errors){if(data.codexState !== undefined){const _errs2 = errors;if(typeof data.codexState !== "boolean"){validate104.errors = [{instancePath:instancePath+"/codexState",schemaPath:"#/properties/codexState/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"}];return false;}var valid0 = _errs2 === errors;}else {var valid0 = true;}if(valid0){if(data.network !== undefined){let data1 = data.network;const _errs4 = errors;if(errors === _errs4){if(data1 && typeof data1 == "object" && !Array.isArray(data1)){const _errs6 = errors;for(const key1 in data1){if(!(key1 === "localHttp")){validate104.errors = [{instancePath:instancePath+"/network",schemaPath:"#/properties/network/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key1},message:"must NOT have additional properties"}];return false;break;}}if(_errs6 === errors){if(data1.localHttp !== undefined){if(typeof data1.localHttp !== "boolean"){validate104.errors = [{instancePath:instancePath+"/network/localHttp",schemaPath:"#/properties/network/properties/localHttp/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"}];return false;}}}}else {validate104.errors = [{instancePath:instancePath+"/network",schemaPath:"#/properties/network/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs4 === errors;}else {var valid0 = true;}if(valid0){if(data.nativeTranscripts !== undefined){const _errs9 = errors;if(typeof data.nativeTranscripts !== "boolean"){validate104.errors = [{instancePath:instancePath+"/nativeTranscripts",schemaPath:"#/properties/nativeTranscripts/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"}];return false;}var valid0 = _errs9 === errors;}else {var valid0 = true;}if(valid0){if(data.hooks !== undefined){let data4 = data.hooks;const _errs11 = errors;if(errors === _errs11){if(data4 && typeof data4 == "object" && !Array.isArray(data4)){const _errs13 = errors;for(const key2 in data4){if(!((key2 === "nativeGoal") || (key2 === "plugins"))){validate104.errors = [{instancePath:instancePath+"/hooks",schemaPath:"#/properties/hooks/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key2},message:"must NOT have additional properties"}];return false;break;}}if(_errs13 === errors){if(data4.nativeGoal !== undefined){const _errs14 = errors;if(typeof data4.nativeGoal !== "boolean"){validate104.errors = [{instancePath:instancePath+"/hooks/nativeGoal",schemaPath:"#/properties/hooks/properties/nativeGoal/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"}];return false;}var valid2 = _errs14 === errors;}else {var valid2 = true;}if(valid2){if(data4.plugins !== undefined){let data6 = data4.plugins;const _errs16 = errors;if(errors === _errs16){if(Array.isArray(data6)){if(data6.length > 64){validate104.errors = [{instancePath:instancePath+"/hooks/plugins",schemaPath:"#/properties/hooks/properties/plugins/maxItems",keyword:"maxItems",params:{limit: 64},message:"must NOT have more than 64 items"}];return false;}else {var valid3 = true;const len0 = data6.length;for(let i0=0; i0<len0; i0++){let data7 = data6[i0];const _errs18 = errors;if(errors === _errs18){if(typeof data7 === "string"){if(func2(data7) > 128){validate104.errors = [{instancePath:instancePath+"/hooks/plugins/" + i0,schemaPath:"#/properties/hooks/properties/plugins/items/maxLength",keyword:"maxLength",params:{limit: 128},message:"must NOT have more than 128 characters"}];return false;}else {if(!pattern55.test(data7)){validate104.errors = [{instancePath:instancePath+"/hooks/plugins/" + i0,schemaPath:"#/properties/hooks/properties/plugins/items/pattern",keyword:"pattern",params:{pattern: "^[a-z][a-z0-9-]*$"},message:"must match pattern \""+"^[a-z][a-z0-9-]*$"+"\""}];return false;}}}else {validate104.errors = [{instancePath:instancePath+"/hooks/plugins/" + i0,schemaPath:"#/properties/hooks/properties/plugins/items/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}}var valid3 = _errs18 === errors;if(!valid3){break;}}if(valid3){let i1 = data6.length;let j0;if(i1 > 1){const indices0 = {};for(;i1--;){let item0 = data6[i1];if(typeof item0 !== "string"){continue;}if(typeof indices0[item0] == "number"){j0 = indices0[item0];validate104.errors = [{instancePath:instancePath+"/hooks/plugins",schemaPath:"#/properties/hooks/properties/plugins/uniqueItems",keyword:"uniqueItems",params:{i: i1, j: j0},message:"must NOT have duplicate items (items ## "+j0+" and "+i1+" are identical)"}];return false;break;}indices0[item0] = i1;}}}}}else {validate104.errors = [{instancePath:instancePath+"/hooks/plugins",schemaPath:"#/properties/hooks/properties/plugins/type",keyword:"type",params:{type: "array"},message:"must be array"}];return false;}}var valid2 = _errs16 === errors;}else {var valid2 = true;}}}}else {validate104.errors = [{instancePath:instancePath+"/hooks",schemaPath:"#/properties/hooks/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs11 === errors;}else {var valid0 = true;}if(valid0){if(data.runtime !== undefined){let data8 = data.runtime;const _errs20 = errors;if(errors === _errs20){if(data8 && typeof data8 == "object" && !Array.isArray(data8)){const _errs22 = errors;for(const key3 in data8){if(!(((key3 === "artifactDirectories") || (key3 === "sharedCacheDirectories")) || (key3 === "seedDirectories"))){validate104.errors = [{instancePath:instancePath+"/runtime",schemaPath:"#/properties/runtime/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key3},message:"must NOT have additional properties"}];return false;break;}}if(_errs22 === errors){if(data8.artifactDirectories !== undefined){let data9 = data8.artifactDirectories;const _errs23 = errors;if(errors === _errs23){if(Array.isArray(data9)){if(data9.length > 16){validate104.errors = [{instancePath:instancePath+"/runtime/artifactDirectories",schemaPath:"#/properties/runtime/properties/artifactDirectories/maxItems",keyword:"maxItems",params:{limit: 16},message:"must NOT have more than 16 items"}];return false;}else {var valid6 = true;const len1 = data9.length;for(let i2=0; i2<len1; i2++){let data10 = data9[i2];const _errs25 = errors;if(errors === _errs25){if(data10 && typeof data10 == "object" && !Array.isArray(data10)){let missing1;if(((data10.name === undefined) && (missing1 = "name")) || ((data10.path === undefined) && (missing1 = "path"))){validate104.errors = [{instancePath:instancePath+"/runtime/artifactDirectories/" + i2,schemaPath:"#/properties/runtime/properties/artifactDirectories/items/required",keyword:"required",params:{missingProperty: missing1},message:"must have required property '"+missing1+"'"}];return false;}else {const _errs27 = errors;for(const key4 in data10){if(!((key4 === "name") || (key4 === "path"))){validate104.errors = [{instancePath:instancePath+"/runtime/artifactDirectories/" + i2,schemaPath:"#/properties/runtime/properties/artifactDirectories/items/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key4},message:"must NOT have additional properties"}];return false;break;}}if(_errs27 === errors){if(data10.name !== undefined){let data11 = data10.name;const _errs28 = errors;if(errors === _errs28){if(typeof data11 === "string"){if(!pattern56.test(data11)){validate104.errors = [{instancePath:instancePath+"/runtime/artifactDirectories/" + i2+"/name",schemaPath:"#/properties/runtime/properties/artifactDirectories/items/properties/name/pattern",keyword:"pattern",params:{pattern: "^[a-z][a-z0-9_]{0,63}$"},message:"must match pattern \""+"^[a-z][a-z0-9_]{0,63}$"+"\""}];return false;}}else {validate104.errors = [{instancePath:instancePath+"/runtime/artifactDirectories/" + i2+"/name",schemaPath:"#/properties/runtime/properties/artifactDirectories/items/properties/name/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}}var valid7 = _errs28 === errors;}else {var valid7 = true;}if(valid7){if(data10.path !== undefined){let data12 = data10.path;const _errs30 = errors;if(errors === _errs30){if(typeof data12 === "string"){if(func2(data12) > 4096){validate104.errors = [{instancePath:instancePath+"/runtime/artifactDirectories/" + i2+"/path",schemaPath:"#/properties/runtime/properties/artifactDirectories/items/properties/path/maxLength",keyword:"maxLength",params:{limit: 4096},message:"must NOT have more than 4096 characters"}];return false;}else {if(func2(data12) < 1){validate104.errors = [{instancePath:instancePath+"/runtime/artifactDirectories/" + i2+"/path",schemaPath:"#/properties/runtime/properties/artifactDirectories/items/properties/path/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"}];return false;}}}else {validate104.errors = [{instancePath:instancePath+"/runtime/artifactDirectories/" + i2+"/path",schemaPath:"#/properties/runtime/properties/artifactDirectories/items/properties/path/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}}var valid7 = _errs30 === errors;}else {var valid7 = true;}}}}}else {validate104.errors = [{instancePath:instancePath+"/runtime/artifactDirectories/" + i2,schemaPath:"#/properties/runtime/properties/artifactDirectories/items/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid6 = _errs25 === errors;if(!valid6){break;}}}}else {validate104.errors = [{instancePath:instancePath+"/runtime/artifactDirectories",schemaPath:"#/properties/runtime/properties/artifactDirectories/type",keyword:"type",params:{type: "array"},message:"must be array"}];return false;}}var valid5 = _errs23 === errors;}else {var valid5 = true;}if(valid5){if(data8.sharedCacheDirectories !== undefined){let data13 = data8.sharedCacheDirectories;const _errs32 = errors;if(errors === _errs32){if(Array.isArray(data13)){if(data13.length > 16){validate104.errors = [{instancePath:instancePath+"/runtime/sharedCacheDirectories",schemaPath:"#/properties/runtime/properties/sharedCacheDirectories/maxItems",keyword:"maxItems",params:{limit: 16},message:"must NOT have more than 16 items"}];return false;}else {var valid8 = true;const len2 = data13.length;for(let i3=0; i3<len2; i3++){let data14 = data13[i3];const _errs34 = errors;if(errors === _errs34){if(data14 && typeof data14 == "object" && !Array.isArray(data14)){let missing2;if((((data14.source === undefined) && (missing2 = "source")) || ((data14.target === undefined) && (missing2 = "target"))) || ((data14.roles === undefined) && (missing2 = "roles"))){validate104.errors = [{instancePath:instancePath+"/runtime/sharedCacheDirectories/" + i3,schemaPath:"#/properties/runtime/properties/sharedCacheDirectories/items/required",keyword:"required",params:{missingProperty: missing2},message:"must have required property '"+missing2+"'"}];return false;}else {const _errs36 = errors;for(const key5 in data14){if(!(((key5 === "source") || (key5 === "target")) || (key5 === "roles"))){validate104.errors = [{instancePath:instancePath+"/runtime/sharedCacheDirectories/" + i3,schemaPath:"#/properties/runtime/properties/sharedCacheDirectories/items/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key5},message:"must NOT have additional properties"}];return false;break;}}if(_errs36 === errors){if(data14.source !== undefined){let data15 = data14.source;const _errs37 = errors;if(errors === _errs37){if(typeof data15 === "string"){if(func2(data15) > 4096){validate104.errors = [{instancePath:instancePath+"/runtime/sharedCacheDirectories/" + i3+"/source",schemaPath:"#/properties/runtime/properties/sharedCacheDirectories/items/properties/source/maxLength",keyword:"maxLength",params:{limit: 4096},message:"must NOT have more than 4096 characters"}];return false;}else {if(func2(data15) < 1){validate104.errors = [{instancePath:instancePath+"/runtime/sharedCacheDirectories/" + i3+"/source",schemaPath:"#/properties/runtime/properties/sharedCacheDirectories/items/properties/source/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"}];return false;}}}else {validate104.errors = [{instancePath:instancePath+"/runtime/sharedCacheDirectories/" + i3+"/source",schemaPath:"#/properties/runtime/properties/sharedCacheDirectories/items/properties/source/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}}var valid9 = _errs37 === errors;}else {var valid9 = true;}if(valid9){if(data14.target !== undefined){let data16 = data14.target;const _errs39 = errors;const _errs41 = errors;const _errs42 = errors;if(!((data16 === "home") || (data16 === "tmp"))){const err0 = {};if(vErrors === null){vErrors = [err0];}else {vErrors.push(err0);}errors++;}var valid10 = _errs42 === errors;if(valid10){validate104.errors = [{instancePath:instancePath+"/runtime/sharedCacheDirectories/" + i3+"/target",schemaPath:"#/properties/runtime/properties/sharedCacheDirectories/items/properties/target/not",keyword:"not",params:{},message:"must NOT be valid"}];return false;}else {errors = _errs41;if(vErrors !== null){if(_errs41){vErrors.length = _errs41;}else {vErrors = null;}}}if(errors === _errs39){if(typeof data16 === "string"){if(!pattern57.test(data16)){validate104.errors = [{instancePath:instancePath+"/runtime/sharedCacheDirectories/" + i3+"/target",schemaPath:"#/properties/runtime/properties/sharedCacheDirectories/items/properties/target/pattern",keyword:"pattern",params:{pattern: "^[a-z][a-z0-9-]{0,63}$"},message:"must match pattern \""+"^[a-z][a-z0-9-]{0,63}$"+"\""}];return false;}}else {validate104.errors = [{instancePath:instancePath+"/runtime/sharedCacheDirectories/" + i3+"/target",schemaPath:"#/properties/runtime/properties/sharedCacheDirectories/items/properties/target/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}}var valid9 = _errs39 === errors;}else {var valid9 = true;}if(valid9){if(data14.roles !== undefined){let data17 = data14.roles;const _errs43 = errors;if(errors === _errs43){if(Array.isArray(data17)){if(data17.length > 5){validate104.errors = [{instancePath:instancePath+"/runtime/sharedCacheDirectories/" + i3+"/roles",schemaPath:"#/properties/runtime/properties/sharedCacheDirectories/items/properties/roles/maxItems",keyword:"maxItems",params:{limit: 5},message:"must NOT have more than 5 items"}];return false;}else {if(data17.length < 1){validate104.errors = [{instancePath:instancePath+"/runtime/sharedCacheDirectories/" + i3+"/roles",schemaPath:"#/properties/runtime/properties/sharedCacheDirectories/items/properties/roles/minItems",keyword:"minItems",params:{limit: 1},message:"must NOT have fewer than 1 items"}];return false;}else {var valid11 = true;const len3 = data17.length;for(let i4=0; i4<len3; i4++){let data18 = data17[i4];const _errs45 = errors;if(!(((((data18 === "candidate") || (data18 === "checks")) || (data18 === "hooks")) || (data18 === "semantic")) || (data18 === "advisory"))){validate104.errors = [{instancePath:instancePath+"/runtime/sharedCacheDirectories/" + i3+"/roles/" + i4,schemaPath:"#/$defs/runtimeRole/enum",keyword:"enum",params:{allowedValues: schema165.enum},message:"must be equal to one of the allowed values"}];return false;}var valid11 = _errs45 === errors;if(!valid11){break;}}if(valid11){let i5 = data17.length;let j1;if(i5 > 1){outer0:for(;i5--;){for(j1 = i5; j1--;){if(func0(data17[i5], data17[j1])){validate104.errors = [{instancePath:instancePath+"/runtime/sharedCacheDirectories/" + i3+"/roles",schemaPath:"#/properties/runtime/properties/sharedCacheDirectories/items/properties/roles/uniqueItems",keyword:"uniqueItems",params:{i: i5, j: j1},message:"must NOT have duplicate items (items ## "+j1+" and "+i5+" are identical)"}];return false;break outer0;}}}}}}}}else {validate104.errors = [{instancePath:instancePath+"/runtime/sharedCacheDirectories/" + i3+"/roles",schemaPath:"#/properties/runtime/properties/sharedCacheDirectories/items/properties/roles/type",keyword:"type",params:{type: "array"},message:"must be array"}];return false;}}var valid9 = _errs43 === errors;}else {var valid9 = true;}}}}}}else {validate104.errors = [{instancePath:instancePath+"/runtime/sharedCacheDirectories/" + i3,schemaPath:"#/properties/runtime/properties/sharedCacheDirectories/items/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid8 = _errs34 === errors;if(!valid8){break;}}}}else {validate104.errors = [{instancePath:instancePath+"/runtime/sharedCacheDirectories",schemaPath:"#/properties/runtime/properties/sharedCacheDirectories/type",keyword:"type",params:{type: "array"},message:"must be array"}];return false;}}var valid5 = _errs32 === errors;}else {var valid5 = true;}if(valid5){if(data8.seedDirectories !== undefined){let data19 = data8.seedDirectories;const _errs48 = errors;if(errors === _errs48){if(Array.isArray(data19)){if(data19.length > 16){validate104.errors = [{instancePath:instancePath+"/runtime/seedDirectories",schemaPath:"#/properties/runtime/properties/seedDirectories/maxItems",keyword:"maxItems",params:{limit: 16},message:"must NOT have more than 16 items"}];return false;}else {var valid14 = true;const len4 = data19.length;for(let i6=0; i6<len4; i6++){let data20 = data19[i6];const _errs50 = errors;if(errors === _errs50){if(data20 && typeof data20 == "object" && !Array.isArray(data20)){let missing3;if(((data20.source === undefined) && (missing3 = "source")) || ((data20.target === undefined) && (missing3 = "target"))){validate104.errors = [{instancePath:instancePath+"/runtime/seedDirectories/" + i6,schemaPath:"#/properties/runtime/properties/seedDirectories/items/required",keyword:"required",params:{missingProperty: missing3},message:"must have required property '"+missing3+"'"}];return false;}else {const _errs52 = errors;for(const key6 in data20){if(!(((key6 === "source") || (key6 === "target")) || (key6 === "roles"))){validate104.errors = [{instancePath:instancePath+"/runtime/seedDirectories/" + i6,schemaPath:"#/properties/runtime/properties/seedDirectories/items/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key6},message:"must NOT have additional properties"}];return false;break;}}if(_errs52 === errors){if(data20.source !== undefined){let data21 = data20.source;const _errs53 = errors;if(errors === _errs53){if(typeof data21 === "string"){if(func2(data21) > 4096){validate104.errors = [{instancePath:instancePath+"/runtime/seedDirectories/" + i6+"/source",schemaPath:"#/properties/runtime/properties/seedDirectories/items/properties/source/maxLength",keyword:"maxLength",params:{limit: 4096},message:"must NOT have more than 4096 characters"}];return false;}else {if(func2(data21) < 1){validate104.errors = [{instancePath:instancePath+"/runtime/seedDirectories/" + i6+"/source",schemaPath:"#/properties/runtime/properties/seedDirectories/items/properties/source/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"}];return false;}}}else {validate104.errors = [{instancePath:instancePath+"/runtime/seedDirectories/" + i6+"/source",schemaPath:"#/properties/runtime/properties/seedDirectories/items/properties/source/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}}var valid15 = _errs53 === errors;}else {var valid15 = true;}if(valid15){if(data20.target !== undefined){let data22 = data20.target;const _errs55 = errors;const _errs57 = errors;const _errs58 = errors;if(!((data22 === "home") || (data22 === "tmp"))){const err1 = {};if(vErrors === null){vErrors = [err1];}else {vErrors.push(err1);}errors++;}var valid16 = _errs58 === errors;if(valid16){validate104.errors = [{instancePath:instancePath+"/runtime/seedDirectories/" + i6+"/target",schemaPath:"#/properties/runtime/properties/seedDirectories/items/properties/target/not",keyword:"not",params:{},message:"must NOT be valid"}];return false;}else {errors = _errs57;if(vErrors !== null){if(_errs57){vErrors.length = _errs57;}else {vErrors = null;}}}if(errors === _errs55){if(typeof data22 === "string"){if(!pattern57.test(data22)){validate104.errors = [{instancePath:instancePath+"/runtime/seedDirectories/" + i6+"/target",schemaPath:"#/properties/runtime/properties/seedDirectories/items/properties/target/pattern",keyword:"pattern",params:{pattern: "^[a-z][a-z0-9-]{0,63}$"},message:"must match pattern \""+"^[a-z][a-z0-9-]{0,63}$"+"\""}];return false;}}else {validate104.errors = [{instancePath:instancePath+"/runtime/seedDirectories/" + i6+"/target",schemaPath:"#/properties/runtime/properties/seedDirectories/items/properties/target/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}}var valid15 = _errs55 === errors;}else {var valid15 = true;}if(valid15){if(data20.roles !== undefined){let data23 = data20.roles;const _errs59 = errors;if(errors === _errs59){if(Array.isArray(data23)){if(data23.length > 5){validate104.errors = [{instancePath:instancePath+"/runtime/seedDirectories/" + i6+"/roles",schemaPath:"#/properties/runtime/properties/seedDirectories/items/properties/roles/maxItems",keyword:"maxItems",params:{limit: 5},message:"must NOT have more than 5 items"}];return false;}else {if(data23.length < 1){validate104.errors = [{instancePath:instancePath+"/runtime/seedDirectories/" + i6+"/roles",schemaPath:"#/properties/runtime/properties/seedDirectories/items/properties/roles/minItems",keyword:"minItems",params:{limit: 1},message:"must NOT have fewer than 1 items"}];return false;}else {var valid17 = true;const len5 = data23.length;for(let i7=0; i7<len5; i7++){let data24 = data23[i7];const _errs61 = errors;if(!(((((data24 === "candidate") || (data24 === "checks")) || (data24 === "hooks")) || (data24 === "semantic")) || (data24 === "advisory"))){validate104.errors = [{instancePath:instancePath+"/runtime/seedDirectories/" + i6+"/roles/" + i7,schemaPath:"#/$defs/runtimeRole/enum",keyword:"enum",params:{allowedValues: schema165.enum},message:"must be equal to one of the allowed values"}];return false;}var valid17 = _errs61 === errors;if(!valid17){break;}}if(valid17){let i8 = data23.length;let j2;if(i8 > 1){outer1:for(;i8--;){for(j2 = i8; j2--;){if(func0(data23[i8], data23[j2])){validate104.errors = [{instancePath:instancePath+"/runtime/seedDirectories/" + i6+"/roles",schemaPath:"#/properties/runtime/properties/seedDirectories/items/properties/roles/uniqueItems",keyword:"uniqueItems",params:{i: i8, j: j2},message:"must NOT have duplicate items (items ## "+j2+" and "+i8+" are identical)"}];return false;break outer1;}}}}}}}}else {validate104.errors = [{instancePath:instancePath+"/runtime/seedDirectories/" + i6+"/roles",schemaPath:"#/properties/runtime/properties/seedDirectories/items/properties/roles/type",keyword:"type",params:{type: "array"},message:"must be array"}];return false;}}var valid15 = _errs59 === errors;}else {var valid15 = true;}}}}}}else {validate104.errors = [{instancePath:instancePath+"/runtime/seedDirectories/" + i6,schemaPath:"#/properties/runtime/properties/seedDirectories/items/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid14 = _errs50 === errors;if(!valid14){break;}}}}else {validate104.errors = [{instancePath:instancePath+"/runtime/seedDirectories",schemaPath:"#/properties/runtime/properties/seedDirectories/type",keyword:"type",params:{type: "array"},message:"must be array"}];return false;}}var valid5 = _errs48 === errors;}else {var valid5 = true;}}}}}else {validate104.errors = [{instancePath:instancePath+"/runtime",schemaPath:"#/properties/runtime/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs20 === errors;}else {var valid0 = true;}if(valid0){if(data.format !== undefined){const _errs64 = errors;if("sevro.runtime.v1" !== data.format){validate104.errors = [{instancePath:instancePath+"/format",schemaPath:"#/properties/format/const",keyword:"const",params:{allowedValue: "sevro.runtime.v1"},message:"must be equal to constant"}];return false;}var valid0 = _errs64 === errors;}else {var valid0 = true;}if(valid0){if(data.filesystem !== undefined){let data26 = data.filesystem;const _errs65 = errors;if(errors === _errs65){if(data26 && typeof data26 == "object" && !Array.isArray(data26)){const _errs67 = errors;for(const key7 in data26){if(!((key7 === "optionalReadOnlyRoots") || (key7 === "readOnlyRoots"))){validate104.errors = [{instancePath:instancePath+"/filesystem",schemaPath:"#/properties/filesystem/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key7},message:"must NOT have additional properties"}];return false;break;}}if(_errs67 === errors){if(data26.optionalReadOnlyRoots !== undefined){let data27 = data26.optionalReadOnlyRoots;const _errs68 = errors;if(errors === _errs68){if(Array.isArray(data27)){if(data27.length > 64){validate104.errors = [{instancePath:instancePath+"/filesystem/optionalReadOnlyRoots",schemaPath:"#/properties/filesystem/properties/optionalReadOnlyRoots/maxItems",keyword:"maxItems",params:{limit: 64},message:"must NOT have more than 64 items"}];return false;}else {var valid21 = true;const len6 = data27.length;for(let i9=0; i9<len6; i9++){let data28 = data27[i9];const _errs70 = errors;if(errors === _errs70){if(typeof data28 === "string"){if(func2(data28) > 4096){validate104.errors = [{instancePath:instancePath+"/filesystem/optionalReadOnlyRoots/" + i9,schemaPath:"#/properties/filesystem/properties/optionalReadOnlyRoots/items/maxLength",keyword:"maxLength",params:{limit: 4096},message:"must NOT have more than 4096 characters"}];return false;}else {if(func2(data28) < 1){validate104.errors = [{instancePath:instancePath+"/filesystem/optionalReadOnlyRoots/" + i9,schemaPath:"#/properties/filesystem/properties/optionalReadOnlyRoots/items/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"}];return false;}}}else {validate104.errors = [{instancePath:instancePath+"/filesystem/optionalReadOnlyRoots/" + i9,schemaPath:"#/properties/filesystem/properties/optionalReadOnlyRoots/items/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}}var valid21 = _errs70 === errors;if(!valid21){break;}}if(valid21){let i10 = data27.length;let j3;if(i10 > 1){const indices1 = {};for(;i10--;){let item1 = data27[i10];if(typeof item1 !== "string"){continue;}if(typeof indices1[item1] == "number"){j3 = indices1[item1];validate104.errors = [{instancePath:instancePath+"/filesystem/optionalReadOnlyRoots",schemaPath:"#/properties/filesystem/properties/optionalReadOnlyRoots/uniqueItems",keyword:"uniqueItems",params:{i: i10, j: j3},message:"must NOT have duplicate items (items ## "+j3+" and "+i10+" are identical)"}];return false;break;}indices1[item1] = i10;}}}}}else {validate104.errors = [{instancePath:instancePath+"/filesystem/optionalReadOnlyRoots",schemaPath:"#/properties/filesystem/properties/optionalReadOnlyRoots/type",keyword:"type",params:{type: "array"},message:"must be array"}];return false;}}var valid20 = _errs68 === errors;}else {var valid20 = true;}if(valid20){if(data26.readOnlyRoots !== undefined){let data29 = data26.readOnlyRoots;const _errs72 = errors;if(errors === _errs72){if(Array.isArray(data29)){if(data29.length > 64){validate104.errors = [{instancePath:instancePath+"/filesystem/readOnlyRoots",schemaPath:"#/properties/filesystem/properties/readOnlyRoots/maxItems",keyword:"maxItems",params:{limit: 64},message:"must NOT have more than 64 items"}];return false;}else {var valid23 = true;const len7 = data29.length;for(let i11=0; i11<len7; i11++){let data30 = data29[i11];const _errs74 = errors;if(errors === _errs74){if(typeof data30 === "string"){if(func2(data30) > 4096){validate104.errors = [{instancePath:instancePath+"/filesystem/readOnlyRoots/" + i11,schemaPath:"#/properties/filesystem/properties/readOnlyRoots/items/maxLength",keyword:"maxLength",params:{limit: 4096},message:"must NOT have more than 4096 characters"}];return false;}else {if(func2(data30) < 1){validate104.errors = [{instancePath:instancePath+"/filesystem/readOnlyRoots/" + i11,schemaPath:"#/properties/filesystem/properties/readOnlyRoots/items/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"}];return false;}}}else {validate104.errors = [{instancePath:instancePath+"/filesystem/readOnlyRoots/" + i11,schemaPath:"#/properties/filesystem/properties/readOnlyRoots/items/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}}var valid23 = _errs74 === errors;if(!valid23){break;}}if(valid23){let i12 = data29.length;let j4;if(i12 > 1){const indices2 = {};for(;i12--;){let item2 = data29[i12];if(typeof item2 !== "string"){continue;}if(typeof indices2[item2] == "number"){j4 = indices2[item2];validate104.errors = [{instancePath:instancePath+"/filesystem/readOnlyRoots",schemaPath:"#/properties/filesystem/properties/readOnlyRoots/uniqueItems",keyword:"uniqueItems",params:{i: i12, j: j4},message:"must NOT have duplicate items (items ## "+j4+" and "+i12+" are identical)"}];return false;break;}indices2[item2] = i12;}}}}}else {validate104.errors = [{instancePath:instancePath+"/filesystem/readOnlyRoots",schemaPath:"#/properties/filesystem/properties/readOnlyRoots/type",keyword:"type",params:{type: "array"},message:"must be array"}];return false;}}var valid20 = _errs72 === errors;}else {var valid20 = true;}}}}else {validate104.errors = [{instancePath:instancePath+"/filesystem",schemaPath:"#/properties/filesystem/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs65 === errors;}else {var valid0 = true;}if(valid0){if(data.environment !== undefined){let data31 = data.environment;const _errs76 = errors;if(errors === _errs76){if(data31 && typeof data31 == "object" && !Array.isArray(data31)){const _errs78 = errors;for(const key8 in data31){if(!((key8 === "inherit") || (key8 === "set"))){validate104.errors = [{instancePath:instancePath+"/environment",schemaPath:"#/properties/environment/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key8},message:"must NOT have additional properties"}];return false;break;}}if(_errs78 === errors){if(data31.inherit !== undefined){let data32 = data31.inherit;const _errs79 = errors;if(errors === _errs79){if(Array.isArray(data32)){if(data32.length > 64){validate104.errors = [{instancePath:instancePath+"/environment/inherit",schemaPath:"#/properties/environment/properties/inherit/maxItems",keyword:"maxItems",params:{limit: 64},message:"must NOT have more than 64 items"}];return false;}else {var valid26 = true;const len8 = data32.length;for(let i13=0; i13<len8; i13++){let data33 = data32[i13];const _errs81 = errors;if(errors === _errs81){if(typeof data33 === "string"){if(!pattern59.test(data33)){validate104.errors = [{instancePath:instancePath+"/environment/inherit/" + i13,schemaPath:"#/properties/environment/properties/inherit/items/pattern",keyword:"pattern",params:{pattern: "^[A-Za-z_][A-Za-z0-9_]{0,127}$"},message:"must match pattern \""+"^[A-Za-z_][A-Za-z0-9_]{0,127}$"+"\""}];return false;}}else {validate104.errors = [{instancePath:instancePath+"/environment/inherit/" + i13,schemaPath:"#/properties/environment/properties/inherit/items/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}}var valid26 = _errs81 === errors;if(!valid26){break;}}if(valid26){let i14 = data32.length;let j5;if(i14 > 1){const indices3 = {};for(;i14--;){let item3 = data32[i14];if(typeof item3 !== "string"){continue;}if(typeof indices3[item3] == "number"){j5 = indices3[item3];validate104.errors = [{instancePath:instancePath+"/environment/inherit",schemaPath:"#/properties/environment/properties/inherit/uniqueItems",keyword:"uniqueItems",params:{i: i14, j: j5},message:"must NOT have duplicate items (items ## "+j5+" and "+i14+" are identical)"}];return false;break;}indices3[item3] = i14;}}}}}else {validate104.errors = [{instancePath:instancePath+"/environment/inherit",schemaPath:"#/properties/environment/properties/inherit/type",keyword:"type",params:{type: "array"},message:"must be array"}];return false;}}var valid25 = _errs79 === errors;}else {var valid25 = true;}if(valid25){if(data31.set !== undefined){let data34 = data31.set;const _errs83 = errors;if(errors === _errs83){if(data34 && typeof data34 == "object" && !Array.isArray(data34)){if(Object.keys(data34).length > 64){validate104.errors = [{instancePath:instancePath+"/environment/set",schemaPath:"#/properties/environment/properties/set/maxProperties",keyword:"maxProperties",params:{limit: 64},message:"must NOT have more than 64 properties"}];return false;}else {for(const key9 in data34){const _errs85 = errors;if(typeof key9 === "string"){if(!pattern59.test(key9)){const err2 = {instancePath:instancePath+"/environment/set",schemaPath:"#/properties/environment/properties/set/propertyNames/pattern",keyword:"pattern",params:{pattern: "^[A-Za-z_][A-Za-z0-9_]{0,127}$"},message:"must match pattern \""+"^[A-Za-z_][A-Za-z0-9_]{0,127}$"+"\"",propertyName:key9};if(vErrors === null){vErrors = [err2];}else {vErrors.push(err2);}errors++;}}var valid28 = _errs85 === errors;if(!valid28){const err3 = {instancePath:instancePath+"/environment/set",schemaPath:"#/properties/environment/properties/set/propertyNames",keyword:"propertyNames",params:{propertyName: key9},message:"property name must be valid"};if(vErrors === null){vErrors = [err3];}else {vErrors.push(err3);}errors++;validate104.errors = vErrors;return false;break;}}if(valid28){for(const key10 in data34){let data35 = data34[key10];const _errs87 = errors;if(errors === _errs87){if(typeof data35 === "string"){if(func2(data35) > 8192){validate104.errors = [{instancePath:instancePath+"/environment/set/" + key10.replace(/~/g, "~0").replace(/\//g, "~1"),schemaPath:"#/properties/environment/properties/set/additionalProperties/maxLength",keyword:"maxLength",params:{limit: 8192},message:"must NOT have more than 8192 characters"}];return false;}}else {validate104.errors = [{instancePath:instancePath+"/environment/set/" + key10.replace(/~/g, "~0").replace(/\//g, "~1"),schemaPath:"#/properties/environment/properties/set/additionalProperties/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}}var valid29 = _errs87 === errors;if(!valid29){break;}}}}}else {validate104.errors = [{instancePath:instancePath+"/environment/set",schemaPath:"#/properties/environment/properties/set/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid25 = _errs83 === errors;}else {var valid25 = true;}}}}else {validate104.errors = [{instancePath:instancePath+"/environment",schemaPath:"#/properties/environment/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs76 === errors;}else {var valid0 = true;}}}}}}}}}}}else {validate104.errors = [{instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}validate104.errors = vErrors;return errors === 0;}validate104.evaluated = {"props":true,"dynamicProps":false,"dynamicItems":false};
@@ -1,3 +1,4 @@
1
1
  // Generated by bun run schemas:generate; do not edit.
2
- declare function validate(value: unknown): boolean;
2
+ import type { ValidateFunction } from "ajv";
3
+ declare const validate: ValidateFunction;
3
4
  export = validate;
package/src/git.ts ADDED
@@ -0,0 +1,93 @@
1
+ import {
2
+ captureBoundedBytes,
3
+ terminateOwnedProcessGroup,
4
+ } from "./process-lifecycle";
5
+
6
+ type GitIdentity = "fixture" | "advisory";
7
+
8
+ function nullDevice(): string {
9
+ return process.platform === "win32" ? "NUL" : "/dev/null";
10
+ }
11
+
12
+ /** Do not inherit repository selectors, credentials, injection flags or config. */
13
+ export function gitEnvironment(identity?: GitIdentity): Record<string, string> {
14
+ return {
15
+ PATH: process.env.PATH ?? "/usr/bin:/bin",
16
+ ...(process.env.SystemRoot ? { SystemRoot: process.env.SystemRoot } : {}),
17
+ GIT_CONFIG_NOSYSTEM: "1",
18
+ GIT_CONFIG_GLOBAL: nullDevice(),
19
+ GIT_NO_REPLACE_OBJECTS: "1",
20
+ GIT_TERMINAL_PROMPT: "0",
21
+ ...gitIdentity(identity),
22
+ };
23
+ }
24
+
25
+ function gitIdentity(
26
+ identity: GitIdentity | undefined,
27
+ ): Record<string, string> {
28
+ if (!identity) return {};
29
+ const name = identity === "fixture" ? "Sevro Fixture" : "Sevro Advisory";
30
+ const email = `${identity}@sevro.invalid`;
31
+ return {
32
+ GIT_AUTHOR_NAME: name,
33
+ GIT_AUTHOR_EMAIL: email,
34
+ GIT_COMMITTER_NAME: name,
35
+ GIT_COMMITTER_EMAIL: email,
36
+ GIT_AUTHOR_DATE: "2000-01-01T00:00:00+00:00",
37
+ GIT_COMMITTER_DATE: "2000-01-01T00:00:00+00:00",
38
+ };
39
+ }
40
+
41
+ /** Shared by fixture execution and the independently deadline-bound HEAD grader. */
42
+ export function gitArguments(args: string[]): string[] {
43
+ return ["git", "-c", `core.hooksPath=${nullDevice()}`, ...args];
44
+ }
45
+
46
+ interface GitOptions {
47
+ cwd: string;
48
+ args: string[];
49
+ identity: GitIdentity;
50
+ label: string;
51
+ maxOutputBytes: number;
52
+ input?: Uint8Array;
53
+ validateUtf8?: boolean;
54
+ }
55
+
56
+ async function gitOutput(
57
+ stream: ReadableStream<Uint8Array>,
58
+ options: GitOptions,
59
+ ): Promise<Buffer> {
60
+ const { bytes } = await captureBoundedBytes(stream, {
61
+ limit: options.maxOutputBytes,
62
+ overflow: "reject",
63
+ exceeded: () => new Error(`${options.label} Git output is too large`),
64
+ });
65
+ if (options.validateUtf8)
66
+ new TextDecoder("utf-8", { fatal: true }).decode(bytes);
67
+ return Buffer.from(bytes);
68
+ }
69
+
70
+ /** Capture both bounded streams; binary patches remain bytes through stdin. */
71
+ export async function runGit(options: GitOptions): Promise<Buffer> {
72
+ const proc = Bun.spawn(gitArguments(options.args), {
73
+ cwd: options.cwd,
74
+ stdin: options.input ?? "ignore",
75
+ stdout: "pipe",
76
+ stderr: "pipe",
77
+ detached: process.platform !== "win32",
78
+ env: gitEnvironment(options.identity),
79
+ });
80
+ try {
81
+ const [stdout, , code] = await Promise.all([
82
+ gitOutput(proc.stdout, options),
83
+ gitOutput(proc.stderr, options),
84
+ proc.exited,
85
+ ]);
86
+ if (code !== 0) throw new Error(`${options.label} Git operation failed`);
87
+ return stdout;
88
+ } catch (error) {
89
+ terminateOwnedProcessGroup(proc);
90
+ await proc.exited;
91
+ throw error;
92
+ }
93
+ }
@@ -1,6 +1,12 @@
1
1
  import { isRecord } from "../value-guards";
2
2
  import { lstat } from "node:fs/promises";
3
3
  import { join } from "node:path";
4
+ import { gitArguments, gitEnvironment } from "../git";
5
+ import {
6
+ captureBoundedText,
7
+ ProcessDeadline,
8
+ terminateOwnedProcessGroup,
9
+ } from "../process-lifecycle";
4
10
 
5
11
  const MAX_OUTPUT_BYTES = 128;
6
12
  const TIMEOUT_MS = 10_000;
@@ -45,52 +51,6 @@ function validGitHeadConfiguration(
45
51
  );
46
52
  }
47
53
 
48
- async function boundedOutput(
49
- stream: ReadableStream<Uint8Array>,
50
- ): Promise<string> {
51
- const reader = stream.getReader();
52
- const chunks: Uint8Array[] = [];
53
- let size = 0;
54
- for (;;) {
55
- const { value, done } = await reader.read();
56
- if (done) break;
57
- size += value.byteLength;
58
- if (size > MAX_OUTPUT_BYTES)
59
- throw new Error("Git HEAD output is oversized");
60
- chunks.push(value);
61
- }
62
- return new TextDecoder("utf-8", { fatal: true }).decode(
63
- Buffer.concat(chunks),
64
- );
65
- }
66
-
67
- function stopProcess(proc: Bun.Subprocess): void {
68
- if (process.platform !== "win32") {
69
- try {
70
- process.kill(-proc.pid, "SIGKILL");
71
- return;
72
- } catch {
73
- // The process group may already have exited.
74
- }
75
- }
76
- try {
77
- proc.kill("SIGKILL");
78
- } catch {
79
- // The process already exited.
80
- }
81
- }
82
-
83
- function gitEnvironment() {
84
- return {
85
- PATH: process.env.PATH ?? "/usr/bin:/bin",
86
- ...(process.env.SystemRoot ? { SystemRoot: process.env.SystemRoot } : {}),
87
- GIT_CONFIG_NOSYSTEM: "1",
88
- GIT_CONFIG_GLOBAL: process.platform === "win32" ? "NUL" : "/dev/null",
89
- GIT_NO_REPLACE_OBJECTS: "1",
90
- GIT_TERMINAL_PROMPT: "0",
91
- };
92
- }
93
-
94
54
  async function validateGitMetadata(workspace: string): Promise<void> {
95
55
  const directory = await lstat(join(workspace, ".git"));
96
56
  if (!directory.isDirectory() || directory.isSymbolicLink())
@@ -98,58 +58,43 @@ async function validateGitMetadata(workspace: string): Promise<void> {
98
58
  }
99
59
 
100
60
  class GitHeadExecution {
101
- private timer: ReturnType<typeof setTimeout> | undefined;
102
- private cancel: (() => void) | undefined;
61
+ private readonly deadline: ProcessDeadline;
103
62
  constructor(
104
63
  private readonly proc: Bun.Subprocess<"ignore", "pipe", "ignore">,
105
- private readonly signal: AbortSignal | undefined,
106
- ) {}
64
+ signal: AbortSignal | undefined,
65
+ ) {
66
+ this.deadline = new ProcessDeadline({
67
+ timeoutMs: TIMEOUT_MS,
68
+ signal,
69
+ interruption: (reason) =>
70
+ new Error(
71
+ reason === "timeout"
72
+ ? "Git HEAD check timed out"
73
+ : "Git HEAD check cancelled",
74
+ ),
75
+ });
76
+ }
107
77
 
108
78
  private complete() {
109
79
  return Promise.all([
110
- boundedOutput(this.proc.stdout),
80
+ captureBoundedText(this.proc.stdout, {
81
+ limit: MAX_OUTPUT_BYTES,
82
+ overflow: "reject",
83
+ exceeded: () => new Error("Git HEAD output is oversized"),
84
+ }),
111
85
  this.proc.exited,
112
86
  ]).then(([output, code]) => ({ output: output.trim(), code }));
113
87
  }
114
88
 
115
- private timeout(): Promise<never> {
116
- return new Promise((_resolve, reject) => {
117
- this.timer = setTimeout(() => {
118
- reject(new Error("Git HEAD check timed out"));
119
- }, TIMEOUT_MS);
120
- });
121
- }
122
-
123
- private aborted(): Promise<never> {
124
- return new Promise((_resolve, reject) => {
125
- const signal = this.signal;
126
- if (!signal) return;
127
- this.cancel = () => {
128
- reject(new Error("Git HEAD check cancelled"));
129
- };
130
- signal.addEventListener("abort", this.cancel, { once: true });
131
- if (signal.aborted) this.cancel();
132
- });
133
- }
134
-
135
- private dispose(): void {
136
- if (this.timer) clearTimeout(this.timer);
137
- if (this.cancel) this.signal?.removeEventListener("abort", this.cancel);
138
- }
139
-
140
89
  async run(): Promise<{ output: string; code: number }> {
141
90
  try {
142
- return await Promise.race([
143
- this.complete(),
144
- this.timeout(),
145
- this.aborted(),
146
- ]);
91
+ return await this.deadline.wait(this.complete());
147
92
  } catch (error) {
148
- stopProcess(this.proc);
93
+ terminateOwnedProcessGroup(this.proc);
149
94
  await this.proc.exited;
150
95
  throw error;
151
96
  } finally {
152
- this.dispose();
97
+ this.deadline.dispose();
153
98
  }
154
99
  }
155
100
  }
@@ -161,7 +106,7 @@ async function git(
161
106
  ): Promise<{ code: number; output: string }> {
162
107
  if (signal?.aborted) throw new Error("Git HEAD check cancelled");
163
108
  await validateGitMetadata(workspace);
164
- const proc = Bun.spawn(["git", ...args], {
109
+ const proc = Bun.spawn(gitArguments(args), {
165
110
  cwd: workspace,
166
111
  stdin: "ignore",
167
112
  stdout: "pipe",