specrails-core 6.0.0 → 6.1.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 (173) hide show
  1. package/README.md +1 -1
  2. package/dist/agent-runtime/capabilities.js +3 -1
  3. package/dist/agent-runtime/change-scope.d.ts +63 -0
  4. package/dist/agent-runtime/change-scope.js +297 -0
  5. package/dist/agent-runtime/cli-executor.d.ts +3 -0
  6. package/dist/agent-runtime/cli-executor.js +50 -13
  7. package/dist/agent-runtime/cli-process.js +6 -2
  8. package/dist/agent-runtime/cli.d.ts +15 -0
  9. package/dist/agent-runtime/cli.js +43 -9
  10. package/dist/agent-runtime/compact/chat-client.js +2 -1
  11. package/dist/agent-runtime/compact/environment.d.ts +12 -0
  12. package/dist/agent-runtime/compact/environment.js +31 -1
  13. package/dist/agent-runtime/compact/test-reachability.js +6 -2
  14. package/dist/agent-runtime/config.d.ts +4 -1
  15. package/dist/agent-runtime/config.js +41 -3
  16. package/dist/agent-runtime/core-host.d.ts +10 -4
  17. package/dist/agent-runtime/core-host.js +22 -19
  18. package/dist/agent-runtime/efficiency-summary.d.ts +4 -1
  19. package/dist/agent-runtime/efficiency-summary.js +30 -27
  20. package/dist/agent-runtime/efficiency-types.d.ts +4 -4
  21. package/dist/agent-runtime/efficiency.d.ts +1 -1
  22. package/dist/agent-runtime/efficiency.js +7 -6
  23. package/dist/agent-runtime/engine/__fixtures__/implementation-component.json +90 -0
  24. package/dist/agent-runtime/engine/__fixtures__/implementation-fixture.d.ts +11 -0
  25. package/dist/agent-runtime/engine/__fixtures__/implementation-fixture.js +60 -0
  26. package/dist/agent-runtime/engine/__fixtures__/implementation.json +43 -0
  27. package/dist/agent-runtime/engine/budget.d.ts +9 -0
  28. package/dist/agent-runtime/engine/budget.js +33 -0
  29. package/dist/agent-runtime/engine/canonical-json.d.ts +9 -0
  30. package/dist/agent-runtime/engine/canonical-json.js +162 -0
  31. package/dist/agent-runtime/engine/checkpoint/database.d.ts +67 -0
  32. package/dist/agent-runtime/engine/checkpoint/database.js +304 -0
  33. package/dist/agent-runtime/engine/checkpoint/lease.d.ts +17 -0
  34. package/dist/agent-runtime/engine/checkpoint/lease.js +82 -0
  35. package/dist/agent-runtime/engine/checkpoint/ledger.d.ts +133 -0
  36. package/dist/agent-runtime/engine/checkpoint/ledger.js +510 -0
  37. package/dist/agent-runtime/engine/checkpoint/saver.d.ts +25 -0
  38. package/dist/agent-runtime/engine/checkpoint/saver.js +146 -0
  39. package/dist/agent-runtime/engine/cli.d.ts +10 -0
  40. package/dist/agent-runtime/engine/cli.js +172 -0
  41. package/dist/agent-runtime/engine/compiler.d.ts +23 -0
  42. package/dist/agent-runtime/engine/compiler.js +261 -0
  43. package/dist/agent-runtime/engine/composition.d.ts +16 -0
  44. package/dist/agent-runtime/engine/composition.js +28 -0
  45. package/dist/agent-runtime/engine/concurrency.d.ts +14 -0
  46. package/dist/agent-runtime/engine/concurrency.js +55 -0
  47. package/dist/agent-runtime/engine/contracts.d.ts +273 -0
  48. package/dist/agent-runtime/engine/contracts.js +11 -0
  49. package/dist/agent-runtime/engine/definition-schema.d.ts +250 -0
  50. package/dist/agent-runtime/engine/definition-schema.js +313 -0
  51. package/dist/agent-runtime/engine/definition-types.d.ts +84 -0
  52. package/dist/agent-runtime/engine/definition-types.js +3 -0
  53. package/dist/agent-runtime/engine/definition-validator.d.ts +7 -0
  54. package/dist/agent-runtime/engine/definition-validator.js +187 -0
  55. package/dist/agent-runtime/engine/efficiency-summary.d.ts +62 -0
  56. package/dist/agent-runtime/engine/efficiency-summary.js +31 -0
  57. package/dist/agent-runtime/engine/events.d.ts +19 -0
  58. package/dist/agent-runtime/engine/events.js +88 -0
  59. package/dist/agent-runtime/engine/execution.d.ts +29 -0
  60. package/dist/agent-runtime/engine/execution.js +121 -0
  61. package/dist/agent-runtime/engine/expressions.d.ts +11 -0
  62. package/dist/agent-runtime/engine/expressions.js +172 -0
  63. package/dist/agent-runtime/engine/fork.d.ts +28 -0
  64. package/dist/agent-runtime/engine/fork.js +211 -0
  65. package/dist/agent-runtime/engine/graph-description.d.ts +48 -0
  66. package/dist/agent-runtime/engine/graph-description.js +16 -0
  67. package/dist/agent-runtime/engine/implementation-compiler.d.ts +214 -0
  68. package/dist/agent-runtime/engine/implementation-compiler.js +91 -0
  69. package/dist/agent-runtime/engine/index.d.ts +14 -0
  70. package/dist/agent-runtime/engine/index.js +14 -0
  71. package/dist/agent-runtime/engine/invocation-context.d.ts +11 -0
  72. package/dist/agent-runtime/engine/invocation-context.js +128 -0
  73. package/dist/agent-runtime/engine/otel.d.ts +15 -0
  74. package/dist/agent-runtime/engine/otel.js +132 -0
  75. package/dist/agent-runtime/engine/output.d.ts +4 -0
  76. package/dist/agent-runtime/engine/output.js +73 -0
  77. package/dist/agent-runtime/engine/piece-dependencies.d.ts +50 -0
  78. package/dist/agent-runtime/engine/piece-dependencies.js +193 -0
  79. package/dist/agent-runtime/engine/piece-registry.d.ts +19 -0
  80. package/dist/agent-runtime/engine/piece-registry.js +62 -0
  81. package/dist/agent-runtime/engine/pieces/assign.d.ts +4 -0
  82. package/dist/agent-runtime/engine/pieces/assign.js +35 -0
  83. package/dist/agent-runtime/engine/pieces/control.d.ts +5 -0
  84. package/dist/agent-runtime/engine/pieces/control.js +49 -0
  85. package/dist/agent-runtime/engine/pieces/decider.d.ts +5 -0
  86. package/dist/agent-runtime/engine/pieces/decider.js +70 -0
  87. package/dist/agent-runtime/engine/pieces/implementation-binding.d.ts +12 -0
  88. package/dist/agent-runtime/engine/pieces/implementation-binding.js +40 -0
  89. package/dist/agent-runtime/engine/pieces/implementation-journal.d.ts +25 -0
  90. package/dist/agent-runtime/engine/pieces/implementation-journal.js +192 -0
  91. package/dist/agent-runtime/engine/pieces/implementation.d.ts +23 -0
  92. package/dist/agent-runtime/engine/pieces/implementation.js +176 -0
  93. package/dist/agent-runtime/engine/pieces/index.d.ts +7 -0
  94. package/dist/agent-runtime/engine/pieces/index.js +22 -0
  95. package/dist/agent-runtime/engine/pieces/openspec.d.ts +3 -0
  96. package/dist/agent-runtime/engine/pieces/openspec.js +69 -0
  97. package/dist/agent-runtime/engine/pieces/ports.d.ts +48 -0
  98. package/dist/agent-runtime/engine/pieces/ports.js +1 -0
  99. package/dist/agent-runtime/engine/pieces/project-memory.d.ts +3 -0
  100. package/dist/agent-runtime/engine/pieces/project-memory.js +13 -0
  101. package/dist/agent-runtime/engine/pieces/prompt.d.ts +5 -0
  102. package/dist/agent-runtime/engine/pieces/prompt.js +130 -0
  103. package/dist/agent-runtime/engine/pieces/role-turn.d.ts +7 -0
  104. package/dist/agent-runtime/engine/pieces/role-turn.js +73 -0
  105. package/dist/agent-runtime/engine/pieces/shared.d.ts +67 -0
  106. package/dist/agent-runtime/engine/pieces/shared.js +40 -0
  107. package/dist/agent-runtime/engine/pieces/shell.d.ts +6 -0
  108. package/dist/agent-runtime/engine/pieces/shell.js +47 -0
  109. package/dist/agent-runtime/engine/pieces/verify.d.ts +7 -0
  110. package/dist/agent-runtime/engine/pieces/verify.js +52 -0
  111. package/dist/agent-runtime/engine/preflight.d.ts +27 -0
  112. package/dist/agent-runtime/engine/preflight.js +54 -0
  113. package/dist/agent-runtime/engine/regex.d.ts +3 -0
  114. package/dist/agent-runtime/engine/regex.js +19 -0
  115. package/dist/agent-runtime/engine/run-status.d.ts +563 -0
  116. package/dist/agent-runtime/engine/run-status.js +61 -0
  117. package/dist/agent-runtime/engine/runs.d.ts +605 -0
  118. package/dist/agent-runtime/engine/runs.js +247 -0
  119. package/dist/agent-runtime/engine/state.d.ts +64 -0
  120. package/dist/agent-runtime/engine/state.js +98 -0
  121. package/dist/agent-runtime/engine/steering/inbox.d.ts +54 -0
  122. package/dist/agent-runtime/engine/steering/inbox.js +113 -0
  123. package/dist/agent-runtime/engine/storage/fork-allocation.d.ts +21 -0
  124. package/dist/agent-runtime/engine/storage/fork-allocation.js +143 -0
  125. package/dist/agent-runtime/engine/storage/private-path.d.ts +11 -0
  126. package/dist/agent-runtime/engine/storage/private-path.js +74 -0
  127. package/dist/agent-runtime/engine/store/sqlite-store.d.ts +26 -0
  128. package/dist/agent-runtime/engine/store/sqlite-store.js +227 -0
  129. package/dist/agent-runtime/evaluation-corpus.d.ts +125 -0
  130. package/dist/agent-runtime/evaluation-corpus.js +4 -0
  131. package/dist/agent-runtime/evaluation.d.ts +9 -3
  132. package/dist/agent-runtime/evaluation.js +50 -8
  133. package/dist/agent-runtime/executor-types.d.ts +53 -3
  134. package/dist/agent-runtime/executor-types.js +35 -2
  135. package/dist/agent-runtime/executors.js +2 -2
  136. package/dist/agent-runtime/graph/artifacts.d.ts +7 -0
  137. package/dist/agent-runtime/graph/artifacts.js +86 -10
  138. package/dist/agent-runtime/graph/convergence.d.ts +26 -0
  139. package/dist/agent-runtime/graph/convergence.js +62 -0
  140. package/dist/agent-runtime/graph/nodes.d.ts +2 -0
  141. package/dist/agent-runtime/graph/nodes.js +171 -24
  142. package/dist/agent-runtime/graph/roles.d.ts +6 -0
  143. package/dist/agent-runtime/graph/roles.js +23 -17
  144. package/dist/agent-runtime/graph/state.d.ts +5 -0
  145. package/dist/agent-runtime/graph/state.js +2 -0
  146. package/dist/agent-runtime/kimi-acp.js +6 -6
  147. package/dist/agent-runtime/openai-executor.js +17 -12
  148. package/dist/agent-runtime/openspec.d.ts +17 -2
  149. package/dist/agent-runtime/openspec.js +54 -20
  150. package/dist/agent-runtime/prompts.d.ts +11 -5
  151. package/dist/agent-runtime/prompts.js +71 -20
  152. package/dist/agent-runtime/recovery.d.ts +1 -1
  153. package/dist/agent-runtime/repository-context.js +20 -1
  154. package/dist/agent-runtime/role-routing.js +4 -2
  155. package/dist/agent-runtime/role-state.d.ts +5 -0
  156. package/dist/agent-runtime/verification-plan.d.ts +2 -0
  157. package/dist/agent-runtime/verification-plan.js +18 -3
  158. package/dist/agent-runtime/workflow-types.d.ts +2 -0
  159. package/dist/agent-runtime/workflow.d.ts +3 -1
  160. package/dist/agent-runtime/workflow.js +7 -3
  161. package/dist/agent-runtime/workspace-tools.d.ts +2 -2
  162. package/dist/agent-runtime/workspace-tools.js +6 -6
  163. package/dist/installer/cli.js +5 -0
  164. package/dist/installer/phases/scaffold.d.ts +2 -2
  165. package/dist/installer/phases/scaffold.js +3 -7
  166. package/dist/pipeline/pipeline-state.d.ts +49 -4
  167. package/dist/pipeline/pipeline-state.js +150 -23
  168. package/integration-contract.json +84 -12
  169. package/package.json +12 -5
  170. package/schemas/agent-runtime.schema.json +93 -1
  171. package/schemas/workflow-definition.schema.json +312 -0
  172. package/templates/kimi/specrails/run-skill.mjs +15 -1
  173. package/templates/commands/specrails/batch-implement.md +0 -32
@@ -1,5 +1,5 @@
1
1
  {
2
- "schemaVersion": "5.0",
2
+ "schemaVersion": "5.1",
3
3
  "providers": {
4
4
  "claude": {
5
5
  "cli": {
@@ -13,7 +13,6 @@
13
13
  "initCommand": "init",
14
14
  "workflows": {
15
15
  "implement": "/specrails:implement",
16
- "batch-implement": "/specrails:batch-implement",
17
16
  "retry": "/specrails:retry"
18
17
  }
19
18
  },
@@ -29,7 +28,6 @@
29
28
  "initCommand": "init",
30
29
  "workflows": {
31
30
  "implement": "$implement",
32
- "batch-implement": "$batch-implement",
33
31
  "retry": "$retry"
34
32
  }
35
33
  },
@@ -45,7 +43,6 @@
45
43
  "initCommand": "init",
46
44
  "workflows": {
47
45
  "implement": "/specrails:implement",
48
- "batch-implement": "/specrails:batch-implement",
49
46
  "retry": "/specrails:retry"
50
47
  }
51
48
  },
@@ -85,12 +82,21 @@
85
82
  "<model-id>",
86
83
  "--args",
87
84
  "<arguments>"
85
+ ],
86
+ "renderOnlyArgs": [
87
+ ".kimi-code/specrails/run-skill.mjs",
88
+ "--skill",
89
+ "<skill-id>",
90
+ "--model",
91
+ "<model-id>",
92
+ "--args",
93
+ "<arguments>",
94
+ "--render-only"
88
95
  ]
89
96
  },
90
97
  "initCommand": "init",
91
98
  "workflows": {
92
99
  "implement": "/skill:specrails-implement",
93
- "batch-implement": "/skill:specrails-batch-implement",
94
100
  "retry": "/skill:specrails-retry"
95
101
  }
96
102
  }
@@ -229,9 +235,19 @@
229
235
  "validate",
230
236
  "run",
231
237
  "status",
232
- "resume"
238
+ "resume",
239
+ "prompts",
240
+ "capabilities",
241
+ "evidence",
242
+ "recovery",
243
+ "evaluate",
244
+ "workflows",
245
+ "fork",
246
+ "signal",
247
+ "cancel"
233
248
  ],
234
- "apiOperation": "runtime api emits {type: runtime-api, apiVersion, coreVersion}; does not invoke providers",
249
+ "cliPresentationOperations": ["help"],
250
+ "apiOperation": "runtime api emits {type: runtime-api, apiVersion, coreVersion, runtimeIdentity, workflowVersions, engineVersion, engines, nodeKindsVersion, nodeKinds, capabilities, guardrails}; does not invoke providers",
235
251
  "validationTransport": "runtime validate --stdin accepts UTF-8 configuration JSON up to 2 MiB, mutually exclusive with --config",
236
252
  "compactStatus": "runtime status --compact omits workflow history, events and outputs, frozen pipeline context and verification command output; retains identities (runId, traceId), phase statuses and visits, pendingApproval, pendingQuestion, usage, completion, acceptance summary and verification metadata",
237
253
  "interrupts": "A paused run (exit 2) carries pendingApproval (resume --approve <step>) or pendingQuestion (resume --answer <text>, nonempty, at most 20000 characters); the architect asks only after one autonomous investigation pass unless architect.onLowConfidence is proceed",
@@ -241,7 +257,7 @@
241
257
  "configSchemaPath": "schemas/agent-runtime.schema.json",
242
258
  "configSchemaExport": "specrails-core/schemas/agent-runtime.schema.json",
243
259
  "projectConfigPath": ".specrails/agent-runtime.json",
244
- "minimumNode": "20.19.0",
260
+ "minimumNode": "22.22.3",
245
261
  "platforms": [
246
262
  "darwin",
247
263
  "win32"
@@ -260,6 +276,7 @@
260
276
  "phases": [
261
277
  "architect",
262
278
  "developer",
279
+ "fixer",
263
280
  "verify",
264
281
  "reviewer",
265
282
  "archive"
@@ -277,19 +294,74 @@
277
294
  "specificationFormat": "Architect specs contain complete main-spec replacements, including unchanged requirements; archive does not merge partial delta snippets.",
278
295
  "compatibility": "Additive to integration schema 4 and execution context schema 1. Legacy workflows and profile v1 remain supported. Hosts must check RUNTIME_API_VERSION, not infer runtime support from Core major version.",
279
296
  "documentation": "docs/agent-runtime.md",
280
- "instructionsVersion": "3",
281
- "workflowVersion": "3",
297
+ "instructionsVersion": "10",
298
+ "workflowVersion": "7",
299
+ "engines": [1, 2],
300
+ "engine": {
301
+ "version": 2,
302
+ "definitionSchema": "schemas/workflow-definition.schema.json",
303
+ "nodeKindsVersion": 5
304
+ },
305
+ "nodeKinds": [
306
+ "prompt",
307
+ "role-turn",
308
+ "decider",
309
+ "verify",
310
+ "shell",
311
+ "openspec-validate",
312
+ "openspec-archive",
313
+ "condition",
314
+ "end",
315
+ "approval",
316
+ "question",
317
+ "gate",
318
+ "assign",
319
+ "component",
320
+ "map",
321
+ "implementation",
322
+ "join"
323
+ ],
324
+ "engineStatePath": "<backlogRoot>/.specrails/pipeline/<runId>/agent-workflow/run.sqlite",
325
+ "frozenRequest": "agent-runtime-request.json carries workflow {id, version, source: builtin|definition, definitionHash, engine: 1|2}; resume and status select the engine from workflow.engine and a request without the block is a legacy (engine 1) run",
326
+ "builtins": [
327
+ { "id": "specrails-implementation", "version": "7", "deprecated": false }
328
+ ],
282
329
  "developerTools": "The developer role runs with each CLI's autonomous edit+shell mode (claude --tools default --dangerously-skip-permissions with Agent/Task/Skill disallowed; codex workspace-write; gemini --yolo; kimi print mode). Architect and reviewer stay read-only. Claude roles load project settings only (--setting-sources project,local).",
283
330
  "verificationPolicy": "Configured commands are optional. The architect proposes commands for repositories without one; repositories with no automated check are admitted and recorded in the receipt as unverifiedRepositories. Unchecked tasks return to the developer as feedback instead of failing the run.",
284
331
  "sessionReuse": "Developer correction passes resume the previous provider session (claude --resume, codex exec resume, gemini --resume, kimi --session) with a short correction prompt; an unavailable session falls back to a fresh full turn. Structured roles get one repair turn in-session when their JSON is unusable.",
285
332
  "structuredOutput": "Claude receives --json-schema and Codex --output-schema for architect/reviewer replies; other providers are parsed leniently.",
286
333
  "resumeBudget": "An explicit resume resets the transition ceiling and grants the developer a fresh maxAttempts budget.",
287
- "defaultImplementationEngine": true
334
+ "defaultImplementationEngine": true,
335
+ "openRoles": {
336
+ "version": 1,
337
+ "builtinRoles": [
338
+ "architect",
339
+ "developer",
340
+ "reviewer"
341
+ ],
342
+ "configField": "roles",
343
+ "roleIdPattern": "^[a-z][a-z0-9-]{0,63}$",
344
+ "access": [
345
+ "read",
346
+ "write"
347
+ ],
348
+ "artifacts": [
349
+ "none",
350
+ "tasks-checkboxes",
351
+ "all"
352
+ ],
353
+ "instructions": [
354
+ "role",
355
+ "none"
356
+ ],
357
+ "customAgentLoop": "free",
358
+ "nativeCommandUnsupported": "native_command_unsupported"
359
+ }
288
360
  },
289
361
  "execution": {
290
362
  "schemaVersion": 1,
291
363
  "contextEnv": "SPECRAILS_EXECUTION_CONTEXT",
292
- "context": "Absolute JSON file: runId, backlogRoot, backlogPath?, artifactRoot, artifactRepositoryId, repositories[{id,name,path,baseSha?}], ownership{git,backlog,worktrees:host|core}, specs[{id,title,description,repositoryIds?,acceptanceCriteria?}]",
364
+ "context": "Absolute JSON file: runId, backlogRoot, backlogPath?, artifactRoot, artifactRepositoryId, repositories[{id,name,path,baseSha?,scope?}], ownership{git,backlog,worktrees:host|core}, specs[{id,title,description,repositoryIds?,acceptanceCriteria?}]. scope (runtime capability repositoryScope) lists the checkout-relative directories a repository is confined to — a package registered inside a larger checkout: commands without cwd run in the first one, model-proposed checks stay inside it, edits outside it are undone after each developer/fixer turn and reviews judge the git change set against the run base.",
293
365
  "runtime": ".specrails/runtime/pipeline.mjs",
294
366
  "operations": [
295
367
  "init",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "specrails-core",
3
- "version": "6.0.0",
3
+ "version": "6.1.0",
4
4
  "description": "Agent workflow engine for specrails-desktop: provider-independent installer and programmatic agent runtime for Claude Code, Codex, Gemini CLI and Kimi Code",
5
5
  "type": "module",
6
6
  "exports": {
@@ -9,9 +9,15 @@
9
9
  "import": "./dist/agent-runtime/index.js",
10
10
  "default": "./dist/agent-runtime/index.js"
11
11
  },
12
+ "./agent-runtime/engine": {
13
+ "types": "./dist/agent-runtime/engine/index.d.ts",
14
+ "import": "./dist/agent-runtime/engine/index.js",
15
+ "default": "./dist/agent-runtime/engine/index.js"
16
+ },
12
17
  "./package.json": "./package.json",
13
18
  "./integration-contract.json": "./integration-contract.json",
14
- "./schemas/agent-runtime.schema.json": "./schemas/agent-runtime.schema.json"
19
+ "./schemas/agent-runtime.schema.json": "./schemas/agent-runtime.schema.json",
20
+ "./schemas/workflow-definition.schema.json": "./schemas/workflow-definition.schema.json"
15
21
  },
16
22
  "bin": {
17
23
  "specrails-core": "bin/specrails-core.mjs"
@@ -25,7 +31,7 @@
25
31
  "pinned-versions.json"
26
32
  ],
27
33
  "engines": {
28
- "node": ">=20.19.0"
34
+ "node": ">=22.22.3"
29
35
  },
30
36
  "repository": {
31
37
  "type": "git",
@@ -66,7 +72,8 @@
66
72
  "test:coverage": "npm run build && vitest run --coverage",
67
73
  "dogfood": "npm run build && node bin/specrails-core.mjs init --yes",
68
74
  "prepack": "npm run build",
69
- "test:scripts": "node --test scripts/release-utils.test.mjs scripts/ci-tests.test.mjs",
75
+ "test:scripts": "node --test scripts/release-utils.test.mjs scripts/ci-tests.test.mjs scripts/evaluate-definition-corpus.test.mjs",
76
+ "test:engine-spikes": "npm run build && node scripts/run-engine-spikes.mjs",
70
77
  "check:package": "npm run build && node scripts/verify-package.mjs",
71
78
  "ci": "npm run typecheck && npm run test:scripts && npm run test:coverage && npm run check:package"
72
79
  },
@@ -76,6 +83,7 @@
76
83
  "@langchain/langgraph": "1.4.14",
77
84
  "@langchain/langgraph-checkpoint": "1.1.5",
78
85
  "@modelcontextprotocol/sdk": "1.29.0",
86
+ "ajv": "^8.20.0",
79
87
  "cross-spawn": "7.0.6",
80
88
  "js-yaml": "^4.1.0",
81
89
  "picocolors": "^1.1.1",
@@ -86,7 +94,6 @@
86
94
  "@types/js-yaml": "^4.0.9",
87
95
  "@types/node": "^22.10.2",
88
96
  "@vitest/coverage-v8": "^4.1.5",
89
- "ajv": "^8.20.0",
90
97
  "typescript": "^5.7.2",
91
98
  "vitest": "^4.1.5"
92
99
  },
@@ -13,7 +13,7 @@
13
13
  "verification": { "type": "object", "additionalProperties": false, "properties": { "maxConcurrency": { "type": "integer", "minimum": 1, "maximum": 4 } } }
14
14
  } },
15
15
  "guardrails": { "type": "object", "additionalProperties": false, "properties": { "plan-validation": { "type": "boolean" }, "genuine-blocking-question": { "type": "boolean" }, "plan-language-hint": { "type": "boolean" }, "frozen-plan-writes": { "type": "boolean" }, "primary-language": { "type": "boolean" }, "duplicate-sibling": { "type": "boolean" }, "one-test-per-module": { "type": "boolean" }, "empty-write": { "type": "boolean" }, "evidence-gated-ticking": { "type": "boolean" }, "inventory-retry": { "type": "boolean" }, "synthetic-corrections": { "type": "boolean" }, "silent-group-closure": { "type": "boolean" }, "verify-per-group": { "type": "boolean" }, "test-reachability": { "type": "boolean" }, "exit-code-honesty": { "type": "boolean" }, "environment-repair": { "type": "boolean" }, "lockfile-repair": { "type": "boolean" }, "verify-idle-timeout": { "type": "boolean" } } },
16
- "rolePrompts": { "type": "object", "additionalProperties": false, "properties": {
16
+ "rolePrompts": { "type": "object", "propertyNames": { "pattern": "^[a-z][a-z0-9-]{0,63}$" }, "additionalProperties": { "type": "string", "minLength": 1, "maxLength": 20000, "pattern": "\\S" }, "properties": {
17
17
  "architect": { "type": "string", "minLength": 1, "maxLength": 20000, "pattern": "\\S" },
18
18
  "developer": { "type": "string", "minLength": 1, "maxLength": 20000, "pattern": "\\S" },
19
19
  "reviewer": { "type": "string", "minLength": 1, "maxLength": 20000, "pattern": "\\S" },
@@ -35,6 +35,98 @@
35
35
  } }
36
36
  ] } },
37
37
  "fixer": { "$ref": "#/definitions/agent" },
38
+ "roles": {
39
+ "type": "object",
40
+ "propertyNames": {
41
+ "pattern": "^[a-z][a-z0-9-]{0,63}$",
42
+ "not": {
43
+ "const": "fixer"
44
+ }
45
+ },
46
+ "additionalProperties": {
47
+ "type": "object",
48
+ "additionalProperties": false,
49
+ "required": [
50
+ "provider",
51
+ "access",
52
+ "artifacts"
53
+ ],
54
+ "dependencies": {
55
+ "escalation": [
56
+ "model"
57
+ ]
58
+ },
59
+ "properties": {
60
+ "effort": {
61
+ "$ref": "#/definitions/effort"
62
+ },
63
+ "thinking": {
64
+ "type": "string",
65
+ "enum": [
66
+ "on",
67
+ "off"
68
+ ],
69
+ "description": "OpenAI-compatible engines only: private thinking (chat_template_kwargs.enable_thinking). Default off."
70
+ },
71
+ "escalation": {
72
+ "type": "object",
73
+ "additionalProperties": false,
74
+ "required": [
75
+ "model"
76
+ ],
77
+ "properties": {
78
+ "model": {
79
+ "type": "string",
80
+ "minLength": 1,
81
+ "maxLength": 256,
82
+ "pattern": "^[^-\\r\\n\\u0000][^\\r\\n\\u0000]*$"
83
+ },
84
+ "effort": {
85
+ "$ref": "#/definitions/effort"
86
+ }
87
+ }
88
+ },
89
+ "provider": {
90
+ "$ref": "#/definitions/id"
91
+ },
92
+ "model": {
93
+ "type": "string",
94
+ "minLength": 1,
95
+ "maxLength": 256,
96
+ "pattern": "^[^-\\r\\n\\u0000][^\\r\\n\\u0000]*$"
97
+ },
98
+ "maxTurns": {
99
+ "$ref": "#/definitions/positiveInteger"
100
+ },
101
+ "access": {
102
+ "enum": [
103
+ "read",
104
+ "write"
105
+ ]
106
+ },
107
+ "artifacts": {
108
+ "enum": [
109
+ "none",
110
+ "tasks-checkboxes",
111
+ "all"
112
+ ]
113
+ },
114
+ "prompt": {
115
+ "type": "string",
116
+ "minLength": 1,
117
+ "maxLength": 20000,
118
+ "pattern": "\\S"
119
+ },
120
+ "openspecSkill": {
121
+ "enum": [
122
+ "openspec-ff-change",
123
+ "openspec-apply-change",
124
+ "openspec-verify-change"
125
+ ]
126
+ }
127
+ }
128
+ }
129
+ },
38
130
  "agents": { "type": "object", "additionalProperties": false, "required": ["architect", "developer", "reviewer"], "properties": {
39
131
  "architect": { "$ref": "#/definitions/agent" }, "developer": { "$ref": "#/definitions/agent" }, "reviewer": { "$ref": "#/definitions/agent" }
40
132
  } },
@@ -0,0 +1,312 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://specrails.dev/schemas/workflow-definition/1",
4
+ "type": "object",
5
+ "additionalProperties": false,
6
+ "required": [
7
+ "schemaVersion",
8
+ "id",
9
+ "version",
10
+ "title",
11
+ "journal",
12
+ "change",
13
+ "entry",
14
+ "maxTransitions",
15
+ "roles",
16
+ "nodes"
17
+ ],
18
+ "properties": {
19
+ "schemaVersion": {
20
+ "const": 1
21
+ },
22
+ "id": {
23
+ "type": "string",
24
+ "pattern": "^[a-z0-9][a-z0-9-]{0,63}$"
25
+ },
26
+ "version": {
27
+ "type": "string",
28
+ "pattern": "^[0-9a-f]{64}$"
29
+ },
30
+ "title": {
31
+ "type": "string",
32
+ "minLength": 1,
33
+ "maxLength": 120
34
+ },
35
+ "journal": {
36
+ "enum": [
37
+ "ledger-only",
38
+ "implementation"
39
+ ]
40
+ },
41
+ "change": {
42
+ "enum": [
43
+ "new",
44
+ "existing",
45
+ "none"
46
+ ]
47
+ },
48
+ "entry": {
49
+ "$ref": "#/$defs/nodeId"
50
+ },
51
+ "maxTransitions": {
52
+ "type": "integer",
53
+ "minimum": 1,
54
+ "maximum": 10000
55
+ },
56
+ "budget": {
57
+ "type": "object",
58
+ "additionalProperties": false,
59
+ "properties": {
60
+ "maxCostUsd": {
61
+ "type": "number",
62
+ "exclusiveMinimum": 0
63
+ },
64
+ "maxTokens": {
65
+ "type": "integer",
66
+ "minimum": 1
67
+ },
68
+ "maxDurationMs": {
69
+ "type": "integer",
70
+ "minimum": 1000
71
+ }
72
+ }
73
+ },
74
+ "policies": {
75
+ "type": "object",
76
+ "additionalProperties": false,
77
+ "properties": {
78
+ "failFast": {
79
+ "type": "integer",
80
+ "minimum": 1,
81
+ "maximum": 10,
82
+ "default": 2
83
+ },
84
+ "noProgress": {
85
+ "type": "integer",
86
+ "minimum": 1,
87
+ "maximum": 10,
88
+ "default": 2
89
+ },
90
+ "historyMaxChars": {
91
+ "type": "integer",
92
+ "minimum": 200,
93
+ "maximum": 20000,
94
+ "default": 1500
95
+ },
96
+ "concurrency": {
97
+ "type": "integer",
98
+ "minimum": 1,
99
+ "maximum": 8,
100
+ "default": 1
101
+ }
102
+ }
103
+ },
104
+ "roles": {
105
+ "type": "array",
106
+ "items": {
107
+ "$ref": "#/$defs/roleId"
108
+ },
109
+ "uniqueItems": true
110
+ },
111
+ "nodes": {
112
+ "type": "object",
113
+ "minProperties": 1,
114
+ "propertyNames": {
115
+ "$ref": "#/$defs/nodeId"
116
+ },
117
+ "additionalProperties": {
118
+ "$ref": "#/$defs/node"
119
+ }
120
+ },
121
+ "components": {
122
+ "type": "object",
123
+ "propertyNames": {
124
+ "pattern": "^[a-z0-9][a-z0-9-]{0,63}$"
125
+ },
126
+ "additionalProperties": {
127
+ "$ref": "#/$defs/componentBody"
128
+ }
129
+ },
130
+ "delivery": {
131
+ "type": "object",
132
+ "additionalProperties": false,
133
+ "properties": {
134
+ "requiresVerified": {
135
+ "type": "boolean"
136
+ }
137
+ }
138
+ }
139
+ },
140
+ "$defs": {
141
+ "nodeId": {
142
+ "type": "string",
143
+ "pattern": "^[A-Za-z0-9][A-Za-z0-9_-]{0,119}$",
144
+ "not": {
145
+ "enum": [
146
+ "START",
147
+ "END",
148
+ "__start__",
149
+ "__end__",
150
+ "next"
151
+ ]
152
+ }
153
+ },
154
+ "roleId": {
155
+ "type": "string",
156
+ "pattern": "^[a-z][a-z0-9-]{0,63}$"
157
+ },
158
+ "engine": {
159
+ "type": "object",
160
+ "additionalProperties": false,
161
+ "required": [
162
+ "provider"
163
+ ],
164
+ "properties": {
165
+ "provider": {
166
+ "type": "string"
167
+ },
168
+ "model": {
169
+ "type": "string"
170
+ },
171
+ "effort": {
172
+ "type": "string"
173
+ },
174
+ "thinking": {
175
+ "enum": [
176
+ "on",
177
+ "off"
178
+ ]
179
+ }
180
+ }
181
+ },
182
+ "retry": {
183
+ "type": "object",
184
+ "additionalProperties": false,
185
+ "properties": {
186
+ "maxAttempts": {
187
+ "type": "integer",
188
+ "minimum": 1,
189
+ "maximum": 10
190
+ },
191
+ "backoffMs": {
192
+ "type": "integer",
193
+ "minimum": 0,
194
+ "maximum": 600000
195
+ },
196
+ "retryOn": {
197
+ "type": "array",
198
+ "items": {
199
+ "enum": [
200
+ "idle_timeout",
201
+ "timeout",
202
+ "provider_request_error",
203
+ "session_not_found",
204
+ "invalid_structured_output"
205
+ ]
206
+ }
207
+ }
208
+ }
209
+ },
210
+ "ends": {
211
+ "type": "object",
212
+ "propertyNames": {
213
+ "pattern": "^[a-z][a-z0-9-]{0,31}$"
214
+ },
215
+ "additionalProperties": {
216
+ "oneOf": [
217
+ {
218
+ "$ref": "#/$defs/nodeId"
219
+ },
220
+ {
221
+ "type": "null"
222
+ }
223
+ ]
224
+ }
225
+ },
226
+ "node": {
227
+ "type": "object",
228
+ "additionalProperties": false,
229
+ "required": [
230
+ "kind",
231
+ "params",
232
+ "ends"
233
+ ],
234
+ "properties": {
235
+ "kind": {
236
+ "enum": [
237
+ "prompt",
238
+ "role-turn",
239
+ "decider",
240
+ "condition",
241
+ "assign",
242
+ "verify",
243
+ "shell",
244
+ "openspec-validate",
245
+ "openspec-archive",
246
+ "approval",
247
+ "question",
248
+ "gate",
249
+ "map",
250
+ "join",
251
+ "component",
252
+ "implementation",
253
+ "end"
254
+ ]
255
+ },
256
+ "params": {
257
+ "type": "object"
258
+ },
259
+ "ends": {
260
+ "$ref": "#/$defs/ends"
261
+ },
262
+ "retry": {
263
+ "$ref": "#/$defs/retry"
264
+ },
265
+ "label": {
266
+ "type": "string",
267
+ "maxLength": 80
268
+ }
269
+ }
270
+ },
271
+ "componentBody": {
272
+ "type": "object",
273
+ "additionalProperties": false,
274
+ "required": [
275
+ "entry",
276
+ "nodes"
277
+ ],
278
+ "properties": {
279
+ "entry": {
280
+ "$ref": "#/$defs/nodeId"
281
+ },
282
+ "maxTransitions": {
283
+ "type": "integer",
284
+ "minimum": 1,
285
+ "maximum": 10000
286
+ },
287
+ "inputs": {
288
+ "type": "array",
289
+ "items": {
290
+ "type": "string"
291
+ }
292
+ },
293
+ "outputs": {
294
+ "type": "array",
295
+ "items": {
296
+ "type": "string"
297
+ }
298
+ },
299
+ "nodes": {
300
+ "type": "object",
301
+ "minProperties": 1,
302
+ "propertyNames": {
303
+ "$ref": "#/$defs/nodeId"
304
+ },
305
+ "additionalProperties": {
306
+ "$ref": "#/$defs/node"
307
+ }
308
+ }
309
+ }
310
+ }
311
+ }
312
+ }