specrails-core 5.3.0 → 5.5.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 (156) hide show
  1. package/README.md +2 -0
  2. package/dist/agent-runtime/capabilities.d.ts +28 -0
  3. package/dist/agent-runtime/capabilities.js +81 -0
  4. package/dist/agent-runtime/capabilities.js.map +1 -0
  5. package/dist/agent-runtime/cli-executor.d.ts +9 -0
  6. package/dist/agent-runtime/cli-executor.js +109 -34
  7. package/dist/agent-runtime/cli-executor.js.map +1 -1
  8. package/dist/agent-runtime/cli-process.d.ts +1 -0
  9. package/dist/agent-runtime/cli-process.js +13 -2
  10. package/dist/agent-runtime/cli-process.js.map +1 -1
  11. package/dist/agent-runtime/cli.d.ts +1 -0
  12. package/dist/agent-runtime/cli.js +60 -11
  13. package/dist/agent-runtime/cli.js.map +1 -1
  14. package/dist/agent-runtime/codex-schema.d.ts +4 -0
  15. package/dist/agent-runtime/codex-schema.js +31 -0
  16. package/dist/agent-runtime/codex-schema.js.map +1 -0
  17. package/dist/agent-runtime/compact/architect.d.ts +349 -0
  18. package/dist/agent-runtime/compact/architect.js +371 -0
  19. package/dist/agent-runtime/compact/architect.js.map +1 -0
  20. package/dist/agent-runtime/compact/chat-client.d.ts +83 -0
  21. package/dist/agent-runtime/compact/chat-client.js +307 -0
  22. package/dist/agent-runtime/compact/chat-client.js.map +1 -0
  23. package/dist/agent-runtime/compact/developer.d.ts +160 -0
  24. package/dist/agent-runtime/compact/developer.js +823 -0
  25. package/dist/agent-runtime/compact/developer.js.map +1 -0
  26. package/dist/agent-runtime/compact/environment.d.ts +62 -0
  27. package/dist/agent-runtime/compact/environment.js +213 -0
  28. package/dist/agent-runtime/compact/environment.js.map +1 -0
  29. package/dist/agent-runtime/compact/exit-code-honesty.d.ts +8 -0
  30. package/dist/agent-runtime/compact/exit-code-honesty.js +28 -0
  31. package/dist/agent-runtime/compact/exit-code-honesty.js.map +1 -0
  32. package/dist/agent-runtime/compact/guarded-loop.d.ts +73 -0
  33. package/dist/agent-runtime/compact/guarded-loop.js +320 -0
  34. package/dist/agent-runtime/compact/guarded-loop.js.map +1 -0
  35. package/dist/agent-runtime/compact/prompt-inputs.d.ts +42 -0
  36. package/dist/agent-runtime/compact/prompt-inputs.js +59 -0
  37. package/dist/agent-runtime/compact/prompt-inputs.js.map +1 -0
  38. package/dist/agent-runtime/compact/reviewer.d.ts +24 -0
  39. package/dist/agent-runtime/compact/reviewer.js +178 -0
  40. package/dist/agent-runtime/compact/reviewer.js.map +1 -0
  41. package/dist/agent-runtime/compact/step.d.ts +70 -0
  42. package/dist/agent-runtime/compact/step.js +136 -0
  43. package/dist/agent-runtime/compact/step.js.map +1 -0
  44. package/dist/agent-runtime/compact/test-reachability.d.ts +30 -0
  45. package/dist/agent-runtime/compact/test-reachability.js +147 -0
  46. package/dist/agent-runtime/compact/test-reachability.js.map +1 -0
  47. package/dist/agent-runtime/config.d.ts +4 -0
  48. package/dist/agent-runtime/config.js +146 -15
  49. package/dist/agent-runtime/config.js.map +1 -1
  50. package/dist/agent-runtime/core-host.d.ts +12 -4
  51. package/dist/agent-runtime/core-host.js +61 -21
  52. package/dist/agent-runtime/core-host.js.map +1 -1
  53. package/dist/agent-runtime/efficiency-summary.d.ts +67 -0
  54. package/dist/agent-runtime/efficiency-summary.js +52 -0
  55. package/dist/agent-runtime/efficiency-summary.js.map +1 -0
  56. package/dist/agent-runtime/efficiency-types.d.ts +60 -0
  57. package/dist/agent-runtime/efficiency-types.js +8 -0
  58. package/dist/agent-runtime/efficiency-types.js.map +1 -0
  59. package/dist/agent-runtime/efficiency.d.ts +5 -0
  60. package/dist/agent-runtime/efficiency.js +35 -0
  61. package/dist/agent-runtime/efficiency.js.map +1 -0
  62. package/dist/agent-runtime/evaluation-corpus.d.ts +13 -0
  63. package/dist/agent-runtime/evaluation-corpus.js +8 -0
  64. package/dist/agent-runtime/evaluation-corpus.js.map +1 -0
  65. package/dist/agent-runtime/evaluation.d.ts +43 -0
  66. package/dist/agent-runtime/evaluation.js +171 -0
  67. package/dist/agent-runtime/evaluation.js.map +1 -0
  68. package/dist/agent-runtime/executor-types.d.ts +71 -4
  69. package/dist/agent-runtime/executor-types.js +7 -2
  70. package/dist/agent-runtime/executor-types.js.map +1 -1
  71. package/dist/agent-runtime/executors.d.ts +1 -0
  72. package/dist/agent-runtime/executors.js +4 -0
  73. package/dist/agent-runtime/executors.js.map +1 -1
  74. package/dist/agent-runtime/graph/artifacts.d.ts +8 -22
  75. package/dist/agent-runtime/graph/artifacts.js +99 -73
  76. package/dist/agent-runtime/graph/artifacts.js.map +1 -1
  77. package/dist/agent-runtime/graph/nodes.d.ts +7 -2
  78. package/dist/agent-runtime/graph/nodes.js +207 -53
  79. package/dist/agent-runtime/graph/nodes.js.map +1 -1
  80. package/dist/agent-runtime/graph/roles.d.ts +11 -3
  81. package/dist/agent-runtime/graph/roles.js +109 -37
  82. package/dist/agent-runtime/graph/roles.js.map +1 -1
  83. package/dist/agent-runtime/graph/state.d.ts +10 -1
  84. package/dist/agent-runtime/graph/state.js +2 -1
  85. package/dist/agent-runtime/graph/state.js.map +1 -1
  86. package/dist/agent-runtime/guardrails.d.ts +15 -0
  87. package/dist/agent-runtime/guardrails.js +76 -0
  88. package/dist/agent-runtime/guardrails.js.map +1 -0
  89. package/dist/agent-runtime/index.d.ts +7 -1
  90. package/dist/agent-runtime/index.js +7 -1
  91. package/dist/agent-runtime/index.js.map +1 -1
  92. package/dist/agent-runtime/kimi-acp.d.ts +4 -0
  93. package/dist/agent-runtime/kimi-acp.js +20 -9
  94. package/dist/agent-runtime/kimi-acp.js.map +1 -1
  95. package/dist/agent-runtime/openai-executor.d.ts +33 -1
  96. package/dist/agent-runtime/openai-executor.js +76 -113
  97. package/dist/agent-runtime/openai-executor.js.map +1 -1
  98. package/dist/agent-runtime/openspec-tool-server.d.ts +1 -0
  99. package/dist/agent-runtime/openspec-tool-server.js +37 -0
  100. package/dist/agent-runtime/openspec-tool-server.js.map +1 -0
  101. package/dist/agent-runtime/openspec.d.ts +198 -0
  102. package/dist/agent-runtime/openspec.js +329 -0
  103. package/dist/agent-runtime/openspec.js.map +1 -0
  104. package/dist/agent-runtime/prompts.d.ts +24 -1
  105. package/dist/agent-runtime/prompts.js +112 -43
  106. package/dist/agent-runtime/prompts.js.map +1 -1
  107. package/dist/agent-runtime/provider-diagnostic.d.ts +2 -0
  108. package/dist/agent-runtime/provider-diagnostic.js +25 -0
  109. package/dist/agent-runtime/provider-diagnostic.js.map +1 -0
  110. package/dist/agent-runtime/repository-context.d.ts +25 -0
  111. package/dist/agent-runtime/repository-context.js +127 -0
  112. package/dist/agent-runtime/repository-context.js.map +1 -0
  113. package/dist/agent-runtime/review-context.d.ts +14 -0
  114. package/dist/agent-runtime/review-context.js +41 -0
  115. package/dist/agent-runtime/review-context.js.map +1 -0
  116. package/dist/agent-runtime/role-routing.d.ts +10 -0
  117. package/dist/agent-runtime/role-routing.js +30 -0
  118. package/dist/agent-runtime/role-routing.js.map +1 -0
  119. package/dist/agent-runtime/role-state.d.ts +19 -0
  120. package/dist/agent-runtime/role-state.js +24 -0
  121. package/dist/agent-runtime/role-state.js.map +1 -0
  122. package/dist/agent-runtime/runtime-identity.d.ts +11 -0
  123. package/dist/agent-runtime/runtime-identity.js +33 -0
  124. package/dist/agent-runtime/runtime-identity.js.map +1 -0
  125. package/dist/agent-runtime/tool-event.d.ts +3 -0
  126. package/dist/agent-runtime/tool-event.js +24 -0
  127. package/dist/agent-runtime/tool-event.js.map +1 -0
  128. package/dist/agent-runtime/verification-plan.d.ts +55 -0
  129. package/dist/agent-runtime/verification-plan.js +206 -0
  130. package/dist/agent-runtime/verification-plan.js.map +1 -0
  131. package/dist/agent-runtime/workflow-types.d.ts +19 -1
  132. package/dist/agent-runtime/workflow.js +29 -2
  133. package/dist/agent-runtime/workflow.js.map +1 -1
  134. package/dist/agent-runtime/workspace-tools.d.ts +4 -0
  135. package/dist/agent-runtime/workspace-tools.js +182 -20
  136. package/dist/agent-runtime/workspace-tools.js.map +1 -1
  137. package/dist/installer/phases/scaffold.js +39 -109
  138. package/dist/installer/phases/scaffold.js.map +1 -1
  139. package/dist/installer/runtime/pipeline-state.d.ts +143 -1
  140. package/dist/installer/runtime/pipeline-state.js +510 -30
  141. package/dist/installer/runtime/pipeline-state.js.map +1 -1
  142. package/docs/agent-runtime-efficiency.md +65 -0
  143. package/docs/agent-runtime.md +86 -15
  144. package/integration-contract.json +2 -1
  145. package/package.json +5 -2
  146. package/schemas/agent-runtime.schema.json +34 -4
  147. package/schemas/fixtures/runtime-efficiency-summary.v1.json +790 -0
  148. package/templates/codex-skills/batch-implement/SKILL.md +33 -58
  149. package/templates/codex-skills/implement/SKILL.md +21 -124
  150. package/templates/codex-skills/retry/SKILL.md +8 -34
  151. package/templates/commands/specrails/batch-implement.md +21 -16
  152. package/templates/commands/specrails/implement.md +17 -276
  153. package/templates/commands/specrails/retry.md +6 -34
  154. package/templates/gemini-commands/batch-implement.toml +34 -28
  155. package/templates/gemini-commands/implement.toml +34 -55
  156. package/templates/gemini-commands/retry.toml +10 -16
@@ -0,0 +1,349 @@
1
+ import type { AgentResult } from '../executor-types.js';
2
+ import { type CompactEnv } from './step.js';
3
+ /** The load-bearing tokens of a criterion: identifiers (`createGame`, `applyInput`, `tick`), numbers and hyphenated terms — never prose words. */
4
+ export declare function criterionTokens(text: string): string[];
5
+ export interface Inventory {
6
+ greenfield: boolean;
7
+ languages: string[];
8
+ frameworks: string[];
9
+ keyFiles: string[];
10
+ tests: string[];
11
+ notes: string;
12
+ }
13
+ export interface Proposal {
14
+ why: string;
15
+ whatChanges: string[];
16
+ capabilities: {
17
+ new: string[];
18
+ modified: string[];
19
+ };
20
+ impact: string[];
21
+ }
22
+ export interface Design {
23
+ context: string;
24
+ goals: string[];
25
+ nonGoals: string[];
26
+ decisions: {
27
+ title: string;
28
+ choice: string;
29
+ why: string;
30
+ }[];
31
+ risks: {
32
+ risk: string;
33
+ mitigation: string;
34
+ }[];
35
+ }
36
+ export interface Spec {
37
+ name: string;
38
+ requirements: {
39
+ name: string;
40
+ text: string;
41
+ scenarios: {
42
+ name: string;
43
+ when: string;
44
+ then: string;
45
+ }[];
46
+ }[];
47
+ }
48
+ export interface Tasks {
49
+ groups: {
50
+ title: string;
51
+ tasks: string[];
52
+ }[];
53
+ verification: {
54
+ repositoryId: string;
55
+ command: string;
56
+ args: string[];
57
+ }[];
58
+ blockingQuestion?: string;
59
+ }
60
+ export declare const INVENTORY_SCHEMA: {
61
+ type: string;
62
+ additionalProperties: boolean;
63
+ required: string[];
64
+ properties: {
65
+ greenfield: {
66
+ type: string;
67
+ };
68
+ languages: {
69
+ type: string;
70
+ items: {
71
+ type: string;
72
+ };
73
+ };
74
+ frameworks: {
75
+ type: string;
76
+ items: {
77
+ type: string;
78
+ };
79
+ };
80
+ keyFiles: {
81
+ type: string;
82
+ items: {
83
+ type: string;
84
+ };
85
+ };
86
+ tests: {
87
+ type: string;
88
+ items: {
89
+ type: string;
90
+ };
91
+ };
92
+ notes: {
93
+ type: string;
94
+ };
95
+ };
96
+ };
97
+ export declare const PROPOSAL_SCHEMA: {
98
+ type: string;
99
+ additionalProperties: boolean;
100
+ required: string[];
101
+ properties: {
102
+ why: {
103
+ type: string;
104
+ };
105
+ whatChanges: {
106
+ type: string;
107
+ items: {
108
+ type: string;
109
+ };
110
+ };
111
+ capabilities: {
112
+ type: string;
113
+ additionalProperties: boolean;
114
+ required: string[];
115
+ properties: {
116
+ new: {
117
+ type: string;
118
+ items: {
119
+ type: string;
120
+ };
121
+ };
122
+ modified: {
123
+ type: string;
124
+ items: {
125
+ type: string;
126
+ };
127
+ };
128
+ };
129
+ };
130
+ impact: {
131
+ type: string;
132
+ items: {
133
+ type: string;
134
+ };
135
+ };
136
+ };
137
+ };
138
+ export declare const DESIGN_SCHEMA: {
139
+ type: string;
140
+ additionalProperties: boolean;
141
+ required: string[];
142
+ properties: {
143
+ context: {
144
+ type: string;
145
+ };
146
+ goals: {
147
+ type: string;
148
+ items: {
149
+ type: string;
150
+ };
151
+ };
152
+ nonGoals: {
153
+ type: string;
154
+ items: {
155
+ type: string;
156
+ };
157
+ };
158
+ decisions: {
159
+ type: string;
160
+ items: {
161
+ type: string;
162
+ additionalProperties: boolean;
163
+ required: string[];
164
+ properties: {
165
+ title: {
166
+ type: string;
167
+ };
168
+ choice: {
169
+ type: string;
170
+ };
171
+ why: {
172
+ type: string;
173
+ };
174
+ };
175
+ };
176
+ };
177
+ risks: {
178
+ type: string;
179
+ items: {
180
+ type: string;
181
+ additionalProperties: boolean;
182
+ required: string[];
183
+ properties: {
184
+ risk: {
185
+ type: string;
186
+ };
187
+ mitigation: {
188
+ type: string;
189
+ };
190
+ };
191
+ };
192
+ };
193
+ };
194
+ };
195
+ export declare const SPEC_SCHEMA: {
196
+ type: string;
197
+ additionalProperties: boolean;
198
+ required: string[];
199
+ properties: {
200
+ name: {
201
+ type: string;
202
+ };
203
+ requirements: {
204
+ type: string;
205
+ items: {
206
+ type: string;
207
+ additionalProperties: boolean;
208
+ required: string[];
209
+ properties: {
210
+ name: {
211
+ type: string;
212
+ };
213
+ text: {
214
+ type: string;
215
+ };
216
+ scenarios: {
217
+ type: string;
218
+ items: {
219
+ type: string;
220
+ additionalProperties: boolean;
221
+ required: string[];
222
+ properties: {
223
+ name: {
224
+ type: string;
225
+ };
226
+ when: {
227
+ type: string;
228
+ };
229
+ then: {
230
+ type: string;
231
+ };
232
+ };
233
+ };
234
+ };
235
+ };
236
+ };
237
+ };
238
+ };
239
+ };
240
+ export declare const TASKS_SCHEMA: {
241
+ type: string;
242
+ additionalProperties: boolean;
243
+ required: string[];
244
+ properties: {
245
+ groups: {
246
+ type: string;
247
+ items: {
248
+ type: string;
249
+ additionalProperties: boolean;
250
+ required: string[];
251
+ properties: {
252
+ title: {
253
+ type: string;
254
+ };
255
+ tasks: {
256
+ type: string;
257
+ items: {
258
+ type: string;
259
+ };
260
+ };
261
+ };
262
+ };
263
+ };
264
+ verification: {
265
+ type: string;
266
+ items: {
267
+ type: string;
268
+ additionalProperties: boolean;
269
+ required: string[];
270
+ properties: {
271
+ repositoryId: {
272
+ type: string;
273
+ };
274
+ command: {
275
+ type: string;
276
+ };
277
+ args: {
278
+ type: string;
279
+ items: {
280
+ type: string;
281
+ };
282
+ };
283
+ };
284
+ };
285
+ };
286
+ blockingQuestion: {
287
+ type: string;
288
+ };
289
+ };
290
+ };
291
+ /** True when no repository holds anything but OpenSpec artifacts and repository boilerplate. */
292
+ export declare function hostGreenfield(roots: string[]): boolean;
293
+ /** Rendered with the exact headings `openspec instructions proposal` returns. */
294
+ export declare function renderProposal(proposal: Proposal, capabilityNames: {
295
+ new: string[];
296
+ modified: string[];
297
+ }): string;
298
+ export declare function renderDesign(design: Design, greenfield: boolean): string;
299
+ /** True when any media/font file exists under the roots (bounded walk, dot/dependency dirs skipped). */
300
+ export declare function hasBinaryAssets(roots: readonly string[], limit?: number): boolean;
301
+ /**
302
+ * One requirement lives in exactly one capability. A small model given
303
+ * "write the requirements of capability X" restates the WHOLE ticket under
304
+ * every capability (observed: 20 requirements for 8 obligations across
305
+ * sound-effects / audio-controls / gameplay-events, three near-identical
306
+ * lists). Later capabilities lose the requirements an earlier one already
307
+ * holds (same normalized name, or ≥ 0.6 token overlap of the SHALL text);
308
+ * a capability left empty is dropped. Returns the kept specs and the drops.
309
+ */
310
+ export declare function dedupeSpecRequirements(specs: readonly Spec[]): {
311
+ specs: Spec[];
312
+ dropped: Array<{
313
+ capability: string;
314
+ requirement: string;
315
+ keptIn: string;
316
+ }>;
317
+ };
318
+ /**
319
+ * Every acceptance criterion of the ticket must reach a spec, or the plan
320
+ * (which is validated against the specs) can legitimately skip it (observed:
321
+ * the ticket listed soft-drop among the SFX actions; no spec mentioned it,
322
+ * no task implemented it). Criteria with no identifier/number token in any
323
+ * requirement text are appended verbatim to the best-matching capability,
324
+ * as the requester's own words.
325
+ */
326
+ export declare function coverCriteria(specs: Spec[], criteria: readonly string[]): {
327
+ specs: Spec[];
328
+ added: string[];
329
+ };
330
+ export declare function renderSpec(spec: Spec): string;
331
+ export declare function renderTasks(groups: {
332
+ title: string;
333
+ tasks: string[];
334
+ }[]): string;
335
+ /**
336
+ * Rejects plans a small model tends to produce: tasks that "implement" by
337
+ * writing next to the frozen OpenSpec plan (verify then fails with
338
+ * "Architecture artifacts changed after design approval") and plans made only
339
+ * of documents/specs. Returned text is fed back to the model for ONE retry.
340
+ */
341
+ export declare function validateTaskPlan(value: Record<string, unknown>, repositories: string[], requirements?: readonly string[]): string | undefined;
342
+ /** Test seam for the task normaliser. */
343
+ export declare function normalizeTasksForTest(raw: Record<string, unknown>, repositories?: string[]): Tasks;
344
+ /**
345
+ * The compact architect: a bounded inventory, four tool-less structured steps
346
+ * and host-rendered OpenSpec artifacts written through the official workflow, so
347
+ * the graph's participation and completeness checks pass unchanged.
348
+ */
349
+ export declare function runCompactArchitect(env: CompactEnv): Promise<AgentResult>;