specrails-core 5.6.0 → 6.0.1

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 (279) hide show
  1. package/README.md +27 -145
  2. package/bin/specrails-core.mjs +12 -554
  3. package/dist/agent-runtime/capabilities.js +0 -1
  4. package/dist/agent-runtime/change-scope.d.ts +63 -0
  5. package/dist/agent-runtime/change-scope.js +297 -0
  6. package/dist/agent-runtime/cli-executor.d.ts +1 -1
  7. package/dist/agent-runtime/cli-executor.js +1 -2
  8. package/dist/agent-runtime/cli-process.js +0 -1
  9. package/dist/agent-runtime/cli.js +4 -5
  10. package/dist/agent-runtime/codex-schema.js +0 -1
  11. package/dist/agent-runtime/compact/architect.d.ts +3 -272
  12. package/dist/agent-runtime/compact/architect.js +8 -9
  13. package/dist/agent-runtime/compact/chat-client.d.ts +3 -3
  14. package/dist/agent-runtime/compact/chat-client.js +1 -2
  15. package/dist/agent-runtime/compact/developer.d.ts +3 -70
  16. package/dist/agent-runtime/compact/developer.js +13 -14
  17. package/dist/agent-runtime/compact/environment.d.ts +16 -5
  18. package/dist/agent-runtime/compact/environment.js +32 -3
  19. package/dist/agent-runtime/compact/exit-code-honesty.d.ts +2 -1
  20. package/dist/agent-runtime/compact/exit-code-honesty.js +0 -1
  21. package/dist/agent-runtime/compact/guarded-loop.d.ts +2 -18
  22. package/dist/agent-runtime/compact/guarded-loop.js +7 -8
  23. package/dist/agent-runtime/compact/prompt-inputs.d.ts +0 -2
  24. package/dist/agent-runtime/compact/prompt-inputs.js +1 -2
  25. package/dist/agent-runtime/compact/reviewer.d.ts +0 -13
  26. package/dist/agent-runtime/compact/reviewer.js +5 -6
  27. package/dist/agent-runtime/compact/step.d.ts +0 -1
  28. package/dist/agent-runtime/compact/step.js +1 -2
  29. package/dist/agent-runtime/compact/test-reachability.js +6 -3
  30. package/dist/agent-runtime/config.js +0 -1
  31. package/dist/agent-runtime/core-host.d.ts +2 -2
  32. package/dist/agent-runtime/core-host.js +2 -3
  33. package/dist/agent-runtime/durable-store.d.ts +0 -1
  34. package/dist/agent-runtime/durable-store.js +1 -2
  35. package/dist/agent-runtime/efficiency-summary.d.ts +2 -2
  36. package/dist/agent-runtime/efficiency-summary.js +1 -2
  37. package/dist/agent-runtime/efficiency-types.js +0 -1
  38. package/dist/agent-runtime/efficiency.js +0 -1
  39. package/dist/agent-runtime/evaluation-corpus.js +0 -1
  40. package/dist/agent-runtime/evaluation.d.ts +2 -1
  41. package/dist/agent-runtime/evaluation.js +1 -2
  42. package/dist/agent-runtime/executor-types.d.ts +1 -1
  43. package/dist/agent-runtime/executor-types.js +0 -1
  44. package/dist/agent-runtime/executors.js +0 -1
  45. package/dist/agent-runtime/gemini-policy.js +0 -1
  46. package/dist/agent-runtime/graph/artifacts.d.ts +1 -1
  47. package/dist/agent-runtime/graph/artifacts.js +5 -3
  48. package/dist/agent-runtime/graph/convergence.d.ts +26 -0
  49. package/dist/agent-runtime/graph/convergence.js +62 -0
  50. package/dist/agent-runtime/graph/nodes.d.ts +1 -1
  51. package/dist/agent-runtime/graph/nodes.js +170 -24
  52. package/dist/agent-runtime/graph/review-policy.js +0 -1
  53. package/dist/agent-runtime/graph/roles.d.ts +2 -5
  54. package/dist/agent-runtime/graph/roles.js +2 -8
  55. package/dist/agent-runtime/graph/state.d.ts +6 -1
  56. package/dist/agent-runtime/graph/state.js +2 -1
  57. package/dist/agent-runtime/graph-checkpointer.d.ts +2 -1
  58. package/dist/agent-runtime/graph-checkpointer.js +0 -1
  59. package/dist/agent-runtime/guardrails.d.ts +3 -3
  60. package/dist/agent-runtime/guardrails.js +1 -2
  61. package/dist/agent-runtime/index.d.ts +1 -1
  62. package/dist/agent-runtime/index.js +1 -2
  63. package/dist/agent-runtime/kimi-acp.js +1 -2
  64. package/dist/agent-runtime/kimi-model.d.ts +6 -0
  65. package/dist/agent-runtime/kimi-model.js +12 -0
  66. package/dist/agent-runtime/openai-executor.d.ts +0 -9
  67. package/dist/agent-runtime/openai-executor.js +6 -7
  68. package/dist/agent-runtime/openspec-tool-server.js +1 -2
  69. package/dist/agent-runtime/openspec.d.ts +0 -2
  70. package/dist/agent-runtime/openspec.js +1 -6
  71. package/dist/agent-runtime/prompts.d.ts +11 -5
  72. package/dist/agent-runtime/prompts.js +46 -17
  73. package/dist/agent-runtime/provider-diagnostic.js +1 -2
  74. package/dist/agent-runtime/recovery.js +1 -2
  75. package/dist/agent-runtime/repository-context.d.ts +1 -1
  76. package/dist/agent-runtime/repository-context.js +19 -1
  77. package/dist/agent-runtime/review-context.d.ts +1 -1
  78. package/dist/agent-runtime/review-context.js +0 -1
  79. package/dist/agent-runtime/role-routing.js +0 -1
  80. package/dist/agent-runtime/role-state.js +0 -1
  81. package/dist/agent-runtime/runtime-identity.js +1 -2
  82. package/dist/agent-runtime/tool-event.js +0 -1
  83. package/dist/agent-runtime/verification-plan.d.ts +5 -4
  84. package/dist/agent-runtime/verification-plan.js +9 -5
  85. package/dist/agent-runtime/workflow-types.js +0 -1
  86. package/dist/agent-runtime/workflow.js +0 -1
  87. package/dist/agent-runtime/workspace-tools.d.ts +2 -2
  88. package/dist/agent-runtime/workspace-tools.js +1 -2
  89. package/dist/installer/cli.d.ts +3 -32
  90. package/dist/installer/cli.js +26 -101
  91. package/dist/installer/commands/framework.d.ts +4 -3
  92. package/dist/installer/commands/framework.js +0 -1
  93. package/dist/installer/commands/init.d.ts +4 -25
  94. package/dist/installer/commands/init.js +5 -8
  95. package/dist/installer/phases/framework-lifecycle.d.ts +3 -17
  96. package/dist/installer/phases/framework-lifecycle.js +2 -3
  97. package/dist/installer/phases/install-config.d.ts +7 -8
  98. package/dist/installer/phases/install-config.js +2 -7
  99. package/dist/installer/phases/manifest.d.ts +6 -7
  100. package/dist/installer/phases/manifest.js +2 -7
  101. package/dist/installer/phases/prereqs.d.ts +6 -7
  102. package/dist/installer/phases/prereqs.js +4 -6
  103. package/dist/installer/phases/provider-detect.d.ts +6 -7
  104. package/dist/installer/phases/provider-detect.js +2 -4
  105. package/dist/installer/phases/scaffold.d.ts +9 -10
  106. package/dist/installer/phases/scaffold.js +82 -805
  107. package/dist/installer/util/errors.js +0 -1
  108. package/dist/installer/util/exec.d.ts +3 -2
  109. package/dist/installer/util/exec.js +0 -1
  110. package/dist/installer/util/fs.d.ts +0 -10
  111. package/dist/installer/util/fs.js +1 -2
  112. package/dist/installer/util/git.js +0 -1
  113. package/dist/installer/util/install-transaction.d.ts +2 -2
  114. package/dist/installer/util/install-transaction.js +1 -2
  115. package/dist/installer/util/logger.d.ts +1 -3
  116. package/dist/installer/util/logger.js +0 -1
  117. package/dist/installer/util/paths.js +0 -1
  118. package/dist/installer/util/registry.d.ts +4 -8
  119. package/dist/installer/util/registry.js +2 -3
  120. package/dist/{installer/runtime → pipeline}/pipeline-state.d.ts +11 -0
  121. package/dist/{installer/runtime → pipeline}/pipeline-state.js +56 -5
  122. package/dist/shared/args.d.ts +18 -0
  123. package/dist/shared/args.js +53 -0
  124. package/integration-contract.json +11 -47
  125. package/package.json +3 -10
  126. package/templates/agents/sr-architect.md +15 -310
  127. package/templates/agents/sr-developer.md +15 -269
  128. package/templates/agents/sr-reviewer.md +13 -367
  129. package/templates/codex-skills/rails/sr-architect/SKILL.md +14 -308
  130. package/templates/codex-skills/rails/sr-developer/SKILL.md +14 -201
  131. package/templates/codex-skills/rails/sr-reviewer/SKILL.md +15 -289
  132. package/templates/kimi/specrails/run-skill.mjs +91 -2173
  133. package/bin/tui-installer.mjs +0 -430
  134. package/commands/doctor.md +0 -62
  135. package/dist/agent-runtime/capabilities.js.map +0 -1
  136. package/dist/agent-runtime/cli-executor.js.map +0 -1
  137. package/dist/agent-runtime/cli-process.js.map +0 -1
  138. package/dist/agent-runtime/cli.js.map +0 -1
  139. package/dist/agent-runtime/codex-schema.js.map +0 -1
  140. package/dist/agent-runtime/compact/architect.js.map +0 -1
  141. package/dist/agent-runtime/compact/chat-client.js.map +0 -1
  142. package/dist/agent-runtime/compact/developer.js.map +0 -1
  143. package/dist/agent-runtime/compact/environment.js.map +0 -1
  144. package/dist/agent-runtime/compact/exit-code-honesty.js.map +0 -1
  145. package/dist/agent-runtime/compact/guarded-loop.js.map +0 -1
  146. package/dist/agent-runtime/compact/prompt-inputs.js.map +0 -1
  147. package/dist/agent-runtime/compact/reviewer.js.map +0 -1
  148. package/dist/agent-runtime/compact/step.js.map +0 -1
  149. package/dist/agent-runtime/compact/test-reachability.js.map +0 -1
  150. package/dist/agent-runtime/config.js.map +0 -1
  151. package/dist/agent-runtime/core-host.js.map +0 -1
  152. package/dist/agent-runtime/durable-store.js.map +0 -1
  153. package/dist/agent-runtime/efficiency-summary.js.map +0 -1
  154. package/dist/agent-runtime/efficiency-types.js.map +0 -1
  155. package/dist/agent-runtime/efficiency.js.map +0 -1
  156. package/dist/agent-runtime/evaluation-corpus.js.map +0 -1
  157. package/dist/agent-runtime/evaluation.js.map +0 -1
  158. package/dist/agent-runtime/executor-types.js.map +0 -1
  159. package/dist/agent-runtime/executors.js.map +0 -1
  160. package/dist/agent-runtime/gemini-policy.js.map +0 -1
  161. package/dist/agent-runtime/graph/artifacts.js.map +0 -1
  162. package/dist/agent-runtime/graph/nodes.js.map +0 -1
  163. package/dist/agent-runtime/graph/review-policy.js.map +0 -1
  164. package/dist/agent-runtime/graph/roles.js.map +0 -1
  165. package/dist/agent-runtime/graph/state.js.map +0 -1
  166. package/dist/agent-runtime/graph-checkpointer.js.map +0 -1
  167. package/dist/agent-runtime/guardrails.js.map +0 -1
  168. package/dist/agent-runtime/index.js.map +0 -1
  169. package/dist/agent-runtime/kimi-acp.js.map +0 -1
  170. package/dist/agent-runtime/openai-executor.js.map +0 -1
  171. package/dist/agent-runtime/openspec-tool-server.js.map +0 -1
  172. package/dist/agent-runtime/openspec.js.map +0 -1
  173. package/dist/agent-runtime/prompts.js.map +0 -1
  174. package/dist/agent-runtime/provider-diagnostic.js.map +0 -1
  175. package/dist/agent-runtime/recovery.js.map +0 -1
  176. package/dist/agent-runtime/repository-context.js.map +0 -1
  177. package/dist/agent-runtime/review-context.js.map +0 -1
  178. package/dist/agent-runtime/role-routing.js.map +0 -1
  179. package/dist/agent-runtime/role-state.js.map +0 -1
  180. package/dist/agent-runtime/runtime-identity.js.map +0 -1
  181. package/dist/agent-runtime/tool-event.js.map +0 -1
  182. package/dist/agent-runtime/verification-plan.js.map +0 -1
  183. package/dist/agent-runtime/workflow-types.js.map +0 -1
  184. package/dist/agent-runtime/workflow.js.map +0 -1
  185. package/dist/agent-runtime/workspace-tools.js.map +0 -1
  186. package/dist/installer/cli.js.map +0 -1
  187. package/dist/installer/commands/doctor.d.ts +0 -27
  188. package/dist/installer/commands/doctor.js +0 -615
  189. package/dist/installer/commands/doctor.js.map +0 -1
  190. package/dist/installer/commands/framework.js.map +0 -1
  191. package/dist/installer/commands/init.js.map +0 -1
  192. package/dist/installer/commands/update.d.ts +0 -56
  193. package/dist/installer/commands/update.js +0 -257
  194. package/dist/installer/commands/update.js.map +0 -1
  195. package/dist/installer/commands/v5-migration.d.ts +0 -32
  196. package/dist/installer/commands/v5-migration.js +0 -133
  197. package/dist/installer/commands/v5-migration.js.map +0 -1
  198. package/dist/installer/phases/framework-lifecycle.js.map +0 -1
  199. package/dist/installer/phases/install-config.js.map +0 -1
  200. package/dist/installer/phases/manifest.js.map +0 -1
  201. package/dist/installer/phases/prereqs.js.map +0 -1
  202. package/dist/installer/phases/provider-detect.js.map +0 -1
  203. package/dist/installer/phases/scaffold.js.map +0 -1
  204. package/dist/installer/runtime/kimi.d.ts +0 -84
  205. package/dist/installer/runtime/kimi.js +0 -255
  206. package/dist/installer/runtime/kimi.js.map +0 -1
  207. package/dist/installer/runtime/pipeline-state.js.map +0 -1
  208. package/dist/installer/util/errors.js.map +0 -1
  209. package/dist/installer/util/exec.js.map +0 -1
  210. package/dist/installer/util/fs.js.map +0 -1
  211. package/dist/installer/util/git.js.map +0 -1
  212. package/dist/installer/util/install-transaction.js.map +0 -1
  213. package/dist/installer/util/logger.js.map +0 -1
  214. package/dist/installer/util/paths.js.map +0 -1
  215. package/dist/installer/util/prompts.d.ts +0 -23
  216. package/dist/installer/util/prompts.js +0 -49
  217. package/dist/installer/util/prompts.js.map +0 -1
  218. package/dist/installer/util/registry.js.map +0 -1
  219. package/dist/installer/util/template.d.ts +0 -23
  220. package/dist/installer/util/template.js +0 -60
  221. package/dist/installer/util/template.js.map +0 -1
  222. package/docs/README.md +0 -40
  223. package/docs/agent-runtime-efficiency.md +0 -65
  224. package/docs/agent-runtime.md +0 -393
  225. package/docs/agents.md +0 -315
  226. package/docs/changelog.md +0 -168
  227. package/docs/ci-cd.md +0 -60
  228. package/docs/concepts.md +0 -183
  229. package/docs/customization.md +0 -363
  230. package/docs/deployment.md +0 -234
  231. package/docs/getting-started.md +0 -122
  232. package/docs/installation.md +0 -395
  233. package/docs/local-tickets.md +0 -191
  234. package/docs/migration-guide.md +0 -140
  235. package/docs/playbook-oss-maintainer.md +0 -112
  236. package/docs/playbook-parallel-dev.md +0 -124
  237. package/docs/playbook-product-discovery.md +0 -115
  238. package/docs/plugin-architecture.md +0 -144
  239. package/docs/research/codex-compatibility-analysis.md +0 -365
  240. package/docs/research/mcp-feasibility-analysis.md +0 -382
  241. package/docs/testing/test-matrix-codex.md +0 -130
  242. package/docs/updating.md +0 -89
  243. package/docs/user-docs/cli-reference.md +0 -428
  244. package/docs/user-docs/codex-vs-claude-code.md +0 -23
  245. package/docs/user-docs/core-updates.md +0 -70
  246. package/docs/user-docs/faq.md +0 -146
  247. package/docs/user-docs/getting-started-codex.md +0 -194
  248. package/docs/user-docs/getting-started-kimi.md +0 -423
  249. package/docs/user-docs/installation.md +0 -237
  250. package/docs/user-docs/provider-pipelines.md +0 -96
  251. package/docs/user-docs/quick-start.md +0 -161
  252. package/docs/windows.md +0 -78
  253. package/docs/workflows.md +0 -463
  254. package/schemas/profile.v1.json +0 -207
  255. package/templates/claude-md/CLAUDE-quickstart.md +0 -54
  256. package/templates/claude-md/root.md +0 -50
  257. package/templates/codex-skills/batch-implement/SKILL.md +0 -38
  258. package/templates/codex-skills/implement/SKILL.md +0 -38
  259. package/templates/codex-skills/retry/SKILL.md +0 -16
  260. package/templates/commands/specrails/compat-check.md +0 -271
  261. package/templates/commands/specrails/doctor.md +0 -62
  262. package/templates/commands/specrails/explore-spec.md +0 -173
  263. package/templates/commands/specrails/health-check.md +0 -527
  264. package/templates/commands/specrails/memory-inspect.md +0 -261
  265. package/templates/commands/specrails/opsx-diff.md +0 -419
  266. package/templates/commands/specrails/propose-spec.md +0 -102
  267. package/templates/commands/specrails/refactor-recommender.md +0 -169
  268. package/templates/commands/specrails/telemetry.md +0 -553
  269. package/templates/commands/specrails/why.md +0 -96
  270. package/templates/gemini-commands/batch-implement.toml +0 -37
  271. package/templates/gemini-commands/implement.toml +0 -37
  272. package/templates/gemini-commands/retry.toml +0 -15
  273. package/templates/profiles/default.json +0 -14
  274. package/templates/profiles/kimi-default.json +0 -15
  275. package/templates/rules/layer.md +0 -8
  276. package/templates/runtime/provider-pipeline.md +0 -113
  277. package/templates/security/security-exemptions.yaml +0 -20
  278. package/templates/settings/confidence-config.json +0 -17
  279. package/templates/settings/settings.json +0 -15
@@ -26,7 +26,6 @@ export interface CompactEnv {
26
26
  }
27
27
  /** Shorthand for the guards: `on(env, 'empty-write')`. */
28
28
  export declare function on(env: Pick<CompactEnv, 'guardrails'>, id: GuardrailId): boolean;
29
- export declare const COMPACT_STANCE = "You are one step of a Specrails pipeline driven by a host program. Keep replies short and concrete. Never invent files, paths or commands: everything you state must come from the inputs or from tool results. When asked for JSON, reply with exactly one JSON object and nothing else.";
30
29
  /** One host-driven `openspec_workflow` call, visible in the host log like a model tool call. */
31
30
  export declare function openspecCall(env: CompactEnv, input: Parameters<OpenSpecTools['execute']>[0]): Promise<unknown>;
32
31
  /** A tool-less structured call with one tolerant retry; the object is validated by the caller. */
@@ -6,7 +6,7 @@ import { record } from './chat-client.js';
6
6
  import { runToolLoop } from './guarded-loop.js';
7
7
  /** Shorthand for the guards: `on(env, 'empty-write')`. */
8
8
  export function on(env, id) { return guardrailEnabled(env.guardrails, id); }
9
- export const COMPACT_STANCE = 'You are one step of a Specrails pipeline driven by a host program. Keep replies short and concrete. Never invent files, paths or commands: everything you state must come from the inputs or from tool results. When asked for JSON, reply with exactly one JSON object and nothing else.';
9
+ const COMPACT_STANCE = 'You are one step of a Specrails pipeline driven by a host program. Keep replies short and concrete. Never invent files, paths or commands: everything you state must come from the inputs or from tool results. When asked for JSON, reply with exactly one JSON object and nothing else.';
10
10
  /** One host-driven `openspec_workflow` call, visible in the host log like a model tool call. */
11
11
  export async function openspecCall(env, input) {
12
12
  env.onEvent?.(toolEvent('openspec_workflow', input));
@@ -133,4 +133,3 @@ export function strings(value, limit, each = 1000) {
133
133
  return Array.isArray(value) ? value.filter((item) => typeof item === 'string' && item.trim().length > 0).map(item => item.trim().slice(0, each)).slice(0, limit) : [];
134
134
  }
135
135
  export function text(value, fallback = '') { return typeof value === 'string' && value.trim() ? value.trim() : fallback; }
136
- //# sourceMappingURL=step.js.map
@@ -98,7 +98,11 @@ function tokenReaches(token, file, root, discovery) {
98
98
  * file. Unknown ⇒ true: only an enumerating command can prove absence.
99
99
  */
100
100
  export function commandReachesTest(root, command, file) {
101
- const target = posix(file);
101
+ // Path arguments are relative to the directory the command runs in (a
102
+ // package inside a larger checkout), while reported files are relative to
103
+ // the checkout: compare both from the command's directory.
104
+ const base = path.resolve(root, command.cwd ?? '.');
105
+ const target = posix(path.relative(base, path.resolve(root, file)));
102
106
  let judged = false;
103
107
  for (const tokens of segments(expandCommandText(root, command))) {
104
108
  if (!tokens.length)
@@ -117,7 +121,7 @@ export function commandReachesTest(root, command, file) {
117
121
  if (!paths.some(token => TEST_FILE_PATTERN.test(posix(token)) || token.includes('*') || token.endsWith('...')))
118
122
  continue;
119
123
  judged = true;
120
- if (paths.some(token => tokenReaches(token, target, root, discovery)))
124
+ if (paths.some(token => tokenReaches(token, target, base, discovery)))
121
125
  return true;
122
126
  }
123
127
  return !judged;
@@ -144,4 +148,3 @@ export function unreachedTestFiles(root, commands, reported) {
144
148
  export function unreachedTestsReason(files) {
145
149
  return `Test file${files.length === 1 ? '' : 's'} written by the developer ${files.length === 1 ? 'is' : 'are'} not executed by any verification command: ${files.join(', ')}. A test nobody runs proves nothing. Wire ${files.length === 1 ? 'it' : 'them'} into the repository's test command (for example the package.json "test" script) or propose a verificationCheck that runs ${files.length === 1 ? 'it' : 'them'}, then make ${files.length === 1 ? 'it' : 'them'} pass.`;
146
150
  }
147
- //# sourceMappingURL=test-reachability.js.map
@@ -290,4 +290,3 @@ export function normalizeRuntimeConfig(input, options) {
290
290
  };
291
291
  return config;
292
292
  }
293
- //# sourceMappingURL=config.js.map
@@ -1,11 +1,11 @@
1
- import { type PipelineContext } from '../installer/runtime/pipeline-state.js';
1
+ import { type PipelineContext } from '../pipeline/pipeline-state.js';
2
2
  import { type ExecutorRegistry } from './executors.js';
3
3
  import type { AgentEvent, RuntimeConfig, AgentEventRole } from './executor-types.js';
4
4
  import { parseAgentObject } from './graph/artifacts.js';
5
5
  import { type RuntimeIdentity } from './runtime-identity.js';
6
6
  import type { WorkflowEvent, WorkflowSpan, WorkflowState } from './workflow-types.js';
7
7
  export declare const RUNTIME_API_VERSION = 1;
8
- export declare const CORE_WORKFLOW_VERSION = "6";
8
+ export declare const CORE_WORKFLOW_VERSION = "7";
9
9
  export declare const CORE_PACKAGE_VERSION: string;
10
10
  export declare function coreRuntimeIdentity(): RuntimeIdentity;
11
11
  export { parseAgentObject };
@@ -2,7 +2,7 @@ import { fingerprint } from './durable-store.js';
2
2
  import { prepareOpenSpec, roleOpenSpecContext } from './openspec.js';
3
3
  import { existsSync, readFileSync } from 'node:fs';
4
4
  import path from 'node:path';
5
- import { fingerprintCandidate, initializePipeline, inspectPipeline, pipelineStateDirectory, validatePipelineContext, validateVerificationRequest, } from '../installer/runtime/pipeline-state.js';
5
+ import { fingerprintCandidate, initializePipeline, inspectPipeline, pipelineStateDirectory, validatePipelineContext, validateVerificationRequest, } from '../pipeline/pipeline-state.js';
6
6
  import { normalizeRuntimeConfig } from './config.js';
7
7
  import { createExecutorRegistry } from './executors.js';
8
8
  import { archive, child, journal, parseAgentObject, SLUG } from './graph/artifacts.js';
@@ -15,7 +15,7 @@ import { assertEffortSupported } from './capabilities.js';
15
15
  import { runtimePackageIntegrity } from './runtime-identity.js';
16
16
  import { readWorkflowState, runWorkflow } from './workflow.js';
17
17
  export const RUNTIME_API_VERSION = 1;
18
- export const CORE_WORKFLOW_VERSION = '6';
18
+ export const CORE_WORKFLOW_VERSION = '7';
19
19
  export const CORE_PACKAGE_VERSION = JSON.parse(readFileSync(new URL('../../package.json', import.meta.url), 'utf8')).version;
20
20
  export function coreRuntimeIdentity() {
21
21
  return { packageVersion: CORE_PACKAGE_VERSION, workflowVersion: CORE_WORKFLOW_VERSION, instructionsVersion: String(ROLE_INSTRUCTIONS_VERSION), packageIntegrity: runtimePackageIntegrity(), apiVersion: 1 };
@@ -137,4 +137,3 @@ export async function runCoreWorkflow(options) {
137
137
  },
138
138
  });
139
139
  }
140
- //# sourceMappingURL=core-host.js.map
@@ -9,7 +9,6 @@ export interface WorkflowEnvelope {
9
9
  state: WorkflowState;
10
10
  graph?: SerializedGraphStore;
11
11
  }
12
- export declare const ENVELOPE_FORMAT = 2;
13
12
  /** Reject non-JSON data instead of silently changing the fingerprint on serialization. */
14
13
  export declare function fingerprint(value: unknown): string;
15
14
  export declare function readWorkflowEnvelope(directory: string, runId: string): Promise<WorkflowEnvelope | null>;
@@ -10,7 +10,7 @@ export class WorkflowStoreError extends Error {
10
10
  this.name = 'WorkflowStoreError';
11
11
  }
12
12
  }
13
- export const ENVELOPE_FORMAT = 2;
13
+ const ENVELOPE_FORMAT = 2;
14
14
  function errorCode(error) {
15
15
  return typeof error === 'object' && error !== null && 'code' in error ? String(error.code) : undefined;
16
16
  }
@@ -202,4 +202,3 @@ export async function acquireWorkflowLease(directory, runId) {
202
202
  await rm(lease, { recursive: true, force: true });
203
203
  };
204
204
  }
205
- //# sourceMappingURL=durable-store.js.map
@@ -1,4 +1,4 @@
1
- import { type PipelineContext, type PipelineCompletion } from '../installer/runtime/pipeline-state.js';
1
+ import { type PipelineContext, type PipelineCompletion } from '../pipeline/pipeline-state.js';
2
2
  import type { RuntimeConfig } from './executor-types.js';
3
3
  import type { WorkflowState } from './workflow-types.js';
4
4
  /** Compact derived view. Durable invocation/evidence IDs remain the accounting authority. */
@@ -21,7 +21,7 @@ export declare function efficiencySummary(state: WorkflowState, context: Pipelin
21
21
  runId: string;
22
22
  workflowVersion: string;
23
23
  technicalAcceptance: string;
24
- archive: import("../installer/runtime/pipeline-state.js").PhaseStatus;
24
+ archive: import("../pipeline/pipeline-state.js").PhaseStatus;
25
25
  delivery: "pending" | "complete" | "pending-host";
26
26
  roles: {
27
27
  role: "architect" | "developer" | "reviewer";
@@ -1,4 +1,4 @@
1
- import { readVerificationEvidence } from '../installer/runtime/pipeline-state.js';
1
+ import { readVerificationEvidence } from '../pipeline/pipeline-state.js';
2
2
  import { runtimeEfficiency } from './efficiency.js';
3
3
  /** Compact derived view. Durable invocation/evidence IDs remain the accounting authority. */
4
4
  export function efficiencySummary(state, context, config, completion, identity) {
@@ -49,4 +49,3 @@ export function efficiencySummary(state, context, config, completion, identity)
49
49
  metrics: runtimeEfficiency(state),
50
50
  };
51
51
  }
52
- //# sourceMappingURL=efficiency-summary.js.map
@@ -5,4 +5,3 @@ export function sumCacheUsage(values) {
5
5
  return Object.fromEntries(CACHE_TOKEN_KEYS.map(key => [key, values.some(value => value[key] == null)
6
6
  ? null : values.reduce((sum, value) => sum + (value[key] ?? 0), 0)]));
7
7
  }
8
- //# sourceMappingURL=efficiency-types.js.map
@@ -32,4 +32,3 @@ export function runtimeEfficiency(state) {
32
32
  const pending = state.history.some(attempt => attempt.pendingInvocations?.length);
33
33
  return { schemaVersion: 1, total: { ...totals(state.history), durationMs: state.usage.durationMs, inputTokens: pending ? null : state.usage.inputTokens, outputTokens: pending ? null : state.usage.outputTokens, costUsd: pending ? null : state.usage.costUsd }, phases };
34
34
  }
35
- //# sourceMappingURL=efficiency.js.map
@@ -5,4 +5,3 @@ export const EVALUATION_CORPUS = [
5
5
  { id: 'verification-correction', verification: 'assert.strictEqual(api.clamp(11, 0, 10), 10)', description: 'Clamp values to both boundaries, including an already valid value.', repositories: ['math'], source: 'exports.clamp = value => value', solution: 'exports.clamp = (value, min, max) => Math.min(max, Math.max(min, value))', defects: ['exports.clamp = (value, min, max) => Math.max(min, value)', 'exports.clamp = (value, min, max) => Math.min(max, value)'], oracle: 'assert.strictEqual(api.clamp(-1, 0, 10), 0); assert.strictEqual(api.clamp(11, 0, 10), 10); assert.strictEqual(api.clamp(5, 0, 10), 5);', correction: 'verification' },
6
6
  { id: 'review-correction', verification: 'assert.strictEqual(typeof api.unique, "function")', description: 'Deduplicate stable values while preserving the first occurrence order.', repositories: ['collections'], source: 'exports.unique = values => values', solution: 'exports.unique = values => [...new Set(values)]', defects: ['exports.unique = values => [...new Set(values)].sort()', 'exports.unique = values => values'], oracle: 'assert.deepStrictEqual(api.unique([3, 1, 3, 2, 1]), [3, 1, 2]); assert.deepStrictEqual(api.unique([]), []);', correction: 'review' },
7
7
  ];
8
- //# sourceMappingURL=evaluation-corpus.js.map
@@ -1,5 +1,5 @@
1
1
  import type { RuntimeConfig } from './executor-types.js';
2
- export interface EvaluationOptions {
2
+ interface EvaluationOptions {
3
3
  output: string;
4
4
  config?: RuntimeConfig;
5
5
  maxCostUsd?: number;
@@ -41,3 +41,4 @@ export declare function runEvaluation(options: EvaluationOptions): Promise<{
41
41
  reportedSpendUsd: number;
42
42
  observations: Record<string, unknown>[];
43
43
  }>;
44
+ export {};
@@ -8,7 +8,7 @@ import { fingerprint } from './durable-store.js';
8
8
  import { runCoreWorkflow, coreRuntimeIdentity } from './core-host.js';
9
9
  import { ExecutorRegistry } from './executors.js';
10
10
  import { OpenSpecTools } from './openspec.js';
11
- import { validatePipelineContext } from '../installer/runtime/pipeline-state.js';
11
+ import { validatePipelineContext } from '../pipeline/pipeline-state.js';
12
12
  import { runtimeEfficiency } from './efficiency.js';
13
13
  function oracle(test, file) {
14
14
  return spawnSync(process.execPath, ['-e', 'const assert = require("node:assert/strict"); const api = require(process.argv[1]);' + test.oracle, file], { encoding: 'utf8', timeout: 10000 }).status === 0;
@@ -168,4 +168,3 @@ export async function runEvaluation(options) {
168
168
  rmSync(root, { recursive: true, force: true });
169
169
  }
170
170
  }
171
- //# sourceMappingURL=evaluation.js.map
@@ -1,4 +1,4 @@
1
- import type { VerificationCommand } from '../installer/runtime/pipeline-state.js';
1
+ import type { VerificationCommand } from '../pipeline/pipeline-state.js';
2
2
  import type { CacheTokenUsage } from './efficiency-types.js';
3
3
  import type { GuardrailSettings } from './guardrails.js';
4
4
  export declare const DEFAULT_AGENT_TIMEOUT_MS: number;
@@ -31,4 +31,3 @@ export function validateAgentRequest(request) {
31
31
  if (request.signal?.aborted)
32
32
  throw new AgentExecutionError('Agent cancelled', 'aborted');
33
33
  }
34
- //# sourceMappingURL=executor-types.js.map
@@ -45,4 +45,3 @@ export function createExecutorRegistry(input, options = {}) {
45
45
  registry.register(id, executor);
46
46
  return registry;
47
47
  }
48
- //# sourceMappingURL=executors.js.map
@@ -33,4 +33,3 @@ export function assertGeminiAdminPolicyAvailable(options = {}) {
33
33
  if (entries.some(file => file.endsWith('.toml')))
34
34
  throw new AgentExecutionError('Gemini system policies disable per-run admin policy enforcement. Select another provider for architect/reviewer, or ask the system administrator to configure a compatible environment: ' + directory, 'provider_capability_unsupported');
35
35
  }
36
- //# sourceMappingURL=gemini-policy.js.map
@@ -1,4 +1,4 @@
1
- import { type PipelineContext, type PipelineState, type VerificationCommand } from '../../installer/runtime/pipeline-state.js';
1
+ import { type PipelineContext, type PipelineState, type VerificationCommand } from '../../pipeline/pipeline-state.js';
2
2
  import type { DesignConfidence } from './state.js';
3
3
  export declare const SLUG: RegExp;
4
4
  export declare function object(value: unknown): Record<string, unknown>;
@@ -2,7 +2,8 @@ import { artifactPath, hash, resolveOpenSpecCli, runOpenSpec } from '../openspec
2
2
  import { randomUUID } from 'node:crypto';
3
3
  import { cpSync, existsSync, lstatSync, mkdirSync, mkdtempSync, readFileSync, readdirSync, renameSync, rmSync, writeFileSync } from 'node:fs';
4
4
  import path from 'node:path';
5
- import { checkArchive, pipelineStateDirectory, transitionPipeline, validateVerificationRequest, } from '../../installer/runtime/pipeline-state.js';
5
+ import { checkArchive, pipelineStateDirectory, transitionPipeline, validateVerificationRequest, } from '../../pipeline/pipeline-state.js';
6
+ import { assertProposalInScope, withScopeDefault } from '../change-scope.js';
6
7
  export const SLUG = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
7
8
  export function object(value) {
8
9
  if (!value || typeof value !== 'object' || Array.isArray(value))
@@ -105,8 +106,10 @@ export function proposedVerification(context, configured, verification) {
105
106
  throw new Error('Invalid proposed verification command');
106
107
  return { repositoryId: command.repositoryId, command: command.command, args: command.args, ...(typeof command.cwd === 'string' && command.cwd ? { cwd: command.cwd } : {}) };
107
108
  }).filter(command => !covered.has(command.repositoryId) && context.repositories.some(repository => repository.id === command.repositoryId));
109
+ for (const command of proposed)
110
+ assertProposalInScope(context, command, 'proposed verification command');
108
111
  if (proposed.length)
109
- validateVerificationRequest(context, { kind: 'scoped', commands: proposed });
112
+ validateVerificationRequest(context, { kind: 'scoped', commands: proposed.map(command => withScopeDefault(context, command)) });
110
113
  return proposed;
111
114
  }
112
115
  /** Publish an archive prepared by the real CLI. The durable write set makes a
@@ -209,4 +212,3 @@ export async function archive(context, change, signal) {
209
212
  transitionPipeline(context, 'ci', 'skipped');
210
213
  }
211
214
  }
212
- //# sourceMappingURL=artifacts.js.map
@@ -0,0 +1,26 @@
1
+ import type { VerificationReceipt } from '../../pipeline/pipeline-state.js';
2
+ import type { WorkflowState } from '../workflow-types.js';
3
+ /** One verify visit, as the convergence guard remembers it. */
4
+ export interface VerifyOutcome {
5
+ at: string;
6
+ candidateHash: string;
7
+ planHash: string;
8
+ passed: boolean;
9
+ /** Normalized identity of the first failure: the command plus its output with volatile details removed. */
10
+ signature?: string;
11
+ summary?: string;
12
+ }
13
+ /** Verify visits since the latest explicit resume: a human continuing a blocked run grants a fresh budget, as for attempts. */
14
+ export declare function outcomesSinceResume(history: readonly VerifyOutcome[], checkpoint: WorkflowState): VerifyOutcome[];
15
+ /** Identity and one-line description of a failed receipt (or of a host finding that failed a green receipt). */
16
+ export declare function describeFailure(receipt: Pick<VerificationReceipt, 'commands' | 'reason'>, roots: readonly string[], finding?: string): {
17
+ signature: string;
18
+ summary: string;
19
+ };
20
+ /**
21
+ * Why the failure just recorded (`current`, not yet in `history`) proves the
22
+ * correction loop is not converging, or undefined when another round can help.
23
+ */
24
+ export declare function divergence(history: readonly VerifyOutcome[], current: VerifyOutcome): string | undefined;
25
+ /** The same test for a candidate that has not been verified again yet: an unchanged failed candidate is not worth a new run. */
26
+ export declare function unchangedFailure(history: readonly VerifyOutcome[], candidateHash: string, planHash: string): VerifyOutcome | undefined;
@@ -0,0 +1,62 @@
1
+ import { fingerprint } from '../durable-store.js';
2
+ /** Verify visits since the latest explicit resume: a human continuing a blocked run grants a fresh budget, as for attempts. */
3
+ export function outcomesSinceResume(history, checkpoint) {
4
+ const resumed = [...checkpoint.events].reverse().find(event => event.type === 'workflow_resumed');
5
+ return history.filter(entry => !resumed || entry.at >= resumed.timestamp);
6
+ }
7
+ function normalized(output, roots) {
8
+ let text = output.replace(/\u001b\[[0-9;?]*[A-Za-z]/g, '');
9
+ for (const root of [...roots].sort((a, b) => b.length - a.length))
10
+ text = text.split(root).join('<repo>');
11
+ return text.split(/\r?\n/)
12
+ .map(line => line.replace(/\b[0-9a-f]{7,64}\b/gi, '#').replace(/\d+(?:[.,]\d+)*/g, '0').replace(/\s+/g, ' ').trim())
13
+ .filter(Boolean).slice(-40).join('\n');
14
+ }
15
+ /** The last line that says what went wrong, bounded. */
16
+ function headline(output) {
17
+ const lines = output.replace(/\u001b\[[0-9;?]*[A-Za-z]/g, '').split(/\r?\n/).map(line => line.trim()).filter(Boolean);
18
+ const telling = [...lines].reverse().find(line => /error|fail|✕|×|not found|cannot|denied|refused|forbidden|unauthori[sz]ed/i.test(line));
19
+ return (telling ?? lines.at(-1) ?? '').slice(0, 300);
20
+ }
21
+ /** Identity and one-line description of a failed receipt (or of a host finding that failed a green receipt). */
22
+ export function describeFailure(receipt, roots, finding) {
23
+ if (finding)
24
+ return { signature: fingerprint({ finding: normalized(finding, roots) }), summary: finding.slice(0, 300) };
25
+ const failed = receipt.commands.find(command => command.exitCode !== 0);
26
+ if (!failed)
27
+ return { signature: fingerprint({ reason: receipt.reason ?? 'verification failed' }), summary: receipt.reason ?? 'verification failed' };
28
+ const name = failed.label ?? [failed.command, ...failed.args].join(' ');
29
+ const detail = headline(failed.output);
30
+ return {
31
+ signature: fingerprint({ check: failed.key ?? [failed.command, ...failed.args, failed.cwd], exitCode: failed.exitCode, output: normalized(failed.output, roots) }),
32
+ summary: `${name} exited ${failed.exitCode}${detail ? `: ${detail}` : ''}`.slice(0, 400),
33
+ };
34
+ }
35
+ /**
36
+ * Why the failure just recorded (`current`, not yet in `history`) proves the
37
+ * correction loop is not converging, or undefined when another round can help.
38
+ */
39
+ export function divergence(history, current) {
40
+ if (current.passed || !current.signature)
41
+ return undefined;
42
+ const cycle = history.find(entry => !entry.passed && entry.candidateHash === current.candidateHash && entry.planHash === current.planHash);
43
+ if (cycle)
44
+ return `The correction round returned the change to a state that already failed verification (${current.summary}). Running the same checks again cannot pass.`;
45
+ let repeats = 0;
46
+ for (const entry of [...history].reverse()) {
47
+ if (entry.passed || entry.signature !== current.signature)
48
+ break;
49
+ repeats++;
50
+ }
51
+ if (repeats >= 2)
52
+ return `The same verification failure survived ${repeats} correction rounds unchanged (${current.summary}). It is most likely outside what this change can fix: a pre-existing failure, another package, or the environment.`;
53
+ const previous = history.at(-1);
54
+ if (previous?.passed && history.some(entry => !entry.passed && entry.signature === current.signature)) {
55
+ return `A review correction brought back a verification failure that an earlier correction had fixed (${current.summary}). The review request and the checks pull in opposite directions; decide which one applies before resuming.`;
56
+ }
57
+ return undefined;
58
+ }
59
+ /** The same test for a candidate that has not been verified again yet: an unchanged failed candidate is not worth a new run. */
60
+ export function unchangedFailure(history, candidateHash, planHash) {
61
+ return [...history].reverse().find(entry => !entry.passed && entry.candidateHash === candidateHash && entry.planHash === planHash);
62
+ }
@@ -1,5 +1,5 @@
1
1
  import { type OpenSpecRoleContext } from '../openspec.js';
2
- import { type AcceptanceReport, type PipelineContext } from '../../installer/runtime/pipeline-state.js';
2
+ import { type AcceptanceReport, type PipelineContext } from '../../pipeline/pipeline-state.js';
3
3
  import type { AgentEventRole, AgentResult, AgentRole, RuntimeConfig } from '../executor-types.js';
4
4
  import { type FrozenCriterion } from '../prompts.js';
5
5
  import type { WorkflowNode, WorkflowState } from '../workflow-types.js';