@agentic-sdlc-kit/contracts 0.9.1 → 1.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 (186) hide show
  1. package/dist/agent/events.d.ts +18 -18
  2. package/dist/agent/execution.d.ts +22 -22
  3. package/dist/agent-tools/index.d.ts +85 -0
  4. package/dist/agent-tools/index.d.ts.map +1 -0
  5. package/dist/agent-tools/index.js +60 -0
  6. package/dist/agent-tools/index.js.map +1 -0
  7. package/dist/application/application-context.d.ts +194 -60
  8. package/dist/application/application-context.d.ts.map +1 -1
  9. package/dist/application/application-persistence.d.ts +276 -114
  10. package/dist/application/application-persistence.d.ts.map +1 -1
  11. package/dist/application/application-state.d.ts +18 -18
  12. package/dist/architecture/api-contract.d.ts +18 -18
  13. package/dist/architecture/architecture-options.d.ts +6 -6
  14. package/dist/architecture/component-map.d.ts +6 -6
  15. package/dist/architecture/data-model.d.ts +6 -6
  16. package/dist/architecture/operational-design.d.ts +6 -6
  17. package/dist/benchmark/bench.d.ts +330 -0
  18. package/dist/benchmark/bench.d.ts.map +1 -0
  19. package/dist/benchmark/bench.js +69 -0
  20. package/dist/benchmark/bench.js.map +1 -0
  21. package/dist/benchmark/index.d.ts +2 -0
  22. package/dist/benchmark/index.d.ts.map +1 -0
  23. package/dist/benchmark/index.js +2 -0
  24. package/dist/benchmark/index.js.map +1 -0
  25. package/dist/constitution/cli-output.d.ts +706 -0
  26. package/dist/constitution/cli-output.d.ts.map +1 -0
  27. package/dist/constitution/cli-output.js +37 -0
  28. package/dist/constitution/cli-output.js.map +1 -0
  29. package/dist/constitution/index.d.ts +4 -0
  30. package/dist/constitution/index.d.ts.map +1 -0
  31. package/dist/constitution/index.js +4 -0
  32. package/dist/constitution/index.js.map +1 -0
  33. package/dist/constitution/result.d.ts +112 -0
  34. package/dist/constitution/result.d.ts.map +1 -0
  35. package/dist/constitution/result.js +67 -0
  36. package/dist/constitution/result.js.map +1 -0
  37. package/dist/constitution/rule.d.ts +488 -0
  38. package/dist/constitution/rule.d.ts.map +1 -0
  39. package/dist/constitution/rule.js +164 -0
  40. package/dist/constitution/rule.js.map +1 -0
  41. package/dist/context/index.d.ts +2 -0
  42. package/dist/context/index.d.ts.map +1 -0
  43. package/dist/context/index.js +2 -0
  44. package/dist/context/index.js.map +1 -0
  45. package/dist/context/project-context.d.ts +275 -0
  46. package/dist/context/project-context.d.ts.map +1 -0
  47. package/dist/context/project-context.js +56 -0
  48. package/dist/context/project-context.js.map +1 -0
  49. package/dist/evaluation/benchmark.d.ts +12 -12
  50. package/dist/evaluation/metrics.d.ts +4 -4
  51. package/dist/evolution/improvement-hypothesis.d.ts +10 -10
  52. package/dist/execution/execution-profile.d.ts +130 -0
  53. package/dist/execution/execution-profile.d.ts.map +1 -0
  54. package/dist/execution/execution-profile.js +44 -0
  55. package/dist/execution/execution-profile.js.map +1 -0
  56. package/dist/execution/index.d.ts +2 -0
  57. package/dist/execution/index.d.ts.map +1 -0
  58. package/dist/execution/index.js +2 -0
  59. package/dist/execution/index.js.map +1 -0
  60. package/dist/index.d.ts +6 -0
  61. package/dist/index.d.ts.map +1 -1
  62. package/dist/index.js +11 -0
  63. package/dist/index.js.map +1 -1
  64. package/dist/installer/install-plan.d.ts +16 -16
  65. package/dist/installer/ownership-manifest.d.ts +2 -2
  66. package/dist/installer/package-manifest.d.ts +6 -6
  67. package/dist/learning/engineering-lesson.d.ts +14 -14
  68. package/dist/learning/engineering-memory.d.ts +20 -2
  69. package/dist/learning/engineering-memory.d.ts.map +1 -1
  70. package/dist/learning/engineering-memory.js +2 -0
  71. package/dist/learning/engineering-memory.js.map +1 -1
  72. package/dist/learning/experience-episode.d.ts +14 -14
  73. package/dist/learning/experience.d.ts +8 -8
  74. package/dist/learning/index.d.ts +1 -0
  75. package/dist/learning/index.d.ts.map +1 -1
  76. package/dist/learning/index.js +1 -0
  77. package/dist/learning/index.js.map +1 -1
  78. package/dist/learning/learning-event.d.ts +78 -0
  79. package/dist/learning/learning-event.d.ts.map +1 -0
  80. package/dist/learning/learning-event.js +37 -0
  81. package/dist/learning/learning-event.js.map +1 -0
  82. package/dist/learning/memory.d.ts +2 -2
  83. package/dist/maintenance/bug-fix-workflow.d.ts +4 -4
  84. package/dist/maintenance/bug-report.d.ts +6 -6
  85. package/dist/maintenance/refactor-contract.d.ts +8 -8
  86. package/dist/maintenance/refactor-workflow.d.ts +4 -4
  87. package/dist/observer/event-schema.d.ts +6 -6
  88. package/dist/observer/journal.d.ts +10 -10
  89. package/dist/observer/journal.d.ts.map +1 -1
  90. package/dist/observer/journal.js +7 -0
  91. package/dist/observer/journal.js.map +1 -1
  92. package/dist/observer/run-summary.d.ts +12 -12
  93. package/dist/onboard/index.d.ts +2 -0
  94. package/dist/onboard/index.d.ts.map +1 -0
  95. package/dist/onboard/index.js +2 -0
  96. package/dist/onboard/index.js.map +1 -0
  97. package/dist/onboard/onboard-report.d.ts +349 -0
  98. package/dist/onboard/onboard-report.d.ts.map +1 -0
  99. package/dist/onboard/onboard-report.js +96 -0
  100. package/dist/onboard/onboard-report.js.map +1 -0
  101. package/dist/patterns/pattern.d.ts +2 -2
  102. package/dist/planning/task.d.ts +36 -36
  103. package/dist/policy/policy.d.ts +8 -8
  104. package/dist/product/product-brief.d.ts +6 -6
  105. package/dist/product/requirements.d.ts +48 -48
  106. package/dist/project/project-profile.d.ts +113 -2
  107. package/dist/project/project-profile.d.ts.map +1 -1
  108. package/dist/project/project-profile.js +17 -2
  109. package/dist/project/project-profile.js.map +1 -1
  110. package/dist/routing/index.d.ts +1 -0
  111. package/dist/routing/index.d.ts.map +1 -1
  112. package/dist/routing/index.js +1 -0
  113. package/dist/routing/index.js.map +1 -1
  114. package/dist/routing/measured-routing.d.ts +41 -0
  115. package/dist/routing/measured-routing.d.ts.map +1 -0
  116. package/dist/routing/measured-routing.js +24 -0
  117. package/dist/routing/measured-routing.js.map +1 -0
  118. package/dist/routing/routing-policy.d.ts +20 -20
  119. package/dist/routing/routing-request.d.ts +2 -2
  120. package/dist/runtime-guard/action-classification.d.ts +2 -2
  121. package/dist/runtime-guard/audit-event.d.ts +8 -8
  122. package/dist/runtime-guard/policy-schema.d.ts +4 -4
  123. package/dist/scaffolding/scaffold-contract.d.ts +59 -59
  124. package/dist/scaffolding/template-manifest.d.ts +15 -15
  125. package/dist/secret-guard/detection-rule.d.ts +4 -4
  126. package/dist/secret-guard/finding.d.ts +10 -10
  127. package/dist/secret-guard/scanner-failure.d.ts +4 -4
  128. package/dist/specification/specification.d.ts +8 -8
  129. package/dist/stack-pack/manifest.d.ts +33 -4
  130. package/dist/stack-pack/manifest.d.ts.map +1 -1
  131. package/dist/stack-pack/manifest.js +22 -2
  132. package/dist/stack-pack/manifest.js.map +1 -1
  133. package/dist/verification/index.d.ts +1 -0
  134. package/dist/verification/index.d.ts.map +1 -1
  135. package/dist/verification/index.js +1 -0
  136. package/dist/verification/index.js.map +1 -1
  137. package/dist/verification/report.d.ts +118 -12
  138. package/dist/verification/report.d.ts.map +1 -1
  139. package/dist/verification/report.js +4 -0
  140. package/dist/verification/report.js.map +1 -1
  141. package/dist/verification/strength.d.ts +270 -0
  142. package/dist/verification/strength.d.ts.map +1 -0
  143. package/dist/verification/strength.js +168 -0
  144. package/dist/verification/strength.js.map +1 -0
  145. package/dist/workflow/next-action.d.ts +67 -6
  146. package/dist/workflow/next-action.d.ts.map +1 -1
  147. package/dist/workflow/next-action.js +23 -0
  148. package/dist/workflow/next-action.js.map +1 -1
  149. package/dist/workflow/workflow.d.ts +9 -8
  150. package/dist/workflow/workflow.d.ts.map +1 -1
  151. package/package.json +6 -1
  152. package/src/agent-tools/index.ts +81 -0
  153. package/src/benchmark/bench.ts +83 -0
  154. package/src/benchmark/index.ts +1 -0
  155. package/src/constitution/cli-output.ts +44 -0
  156. package/src/constitution/index.ts +3 -0
  157. package/src/constitution/result.test.ts +69 -0
  158. package/src/constitution/result.ts +74 -0
  159. package/src/constitution/rule-origin.test.ts +36 -0
  160. package/src/constitution/rule-path.test.ts +15 -0
  161. package/src/constitution/rule.test.ts +209 -0
  162. package/src/constitution/rule.ts +192 -0
  163. package/src/context/index.ts +1 -0
  164. package/src/context/project-context.ts +63 -0
  165. package/src/execution/execution-profile.ts +50 -0
  166. package/src/execution/index.ts +1 -0
  167. package/src/index.ts +16 -0
  168. package/src/learning/engineering-memory.ts +2 -0
  169. package/src/learning/index.ts +1 -0
  170. package/src/learning/learning-event.ts +42 -0
  171. package/src/observer/journal.ts +7 -0
  172. package/src/onboard/index.ts +1 -0
  173. package/src/onboard/onboard-report.test.ts +92 -0
  174. package/src/onboard/onboard-report.ts +115 -0
  175. package/src/project/project-profile.ts +19 -2
  176. package/src/routing/index.ts +1 -0
  177. package/src/routing/measured-routing.ts +27 -0
  178. package/src/stack-pack/manifest.test.ts +45 -0
  179. package/src/stack-pack/manifest.ts +24 -2
  180. package/src/verification/index.ts +1 -0
  181. package/src/verification/report.ts +4 -0
  182. package/src/verification/strength.test.ts +160 -0
  183. package/src/verification/strength.ts +189 -0
  184. package/src/workflow/next-action.test.ts +25 -0
  185. package/src/workflow/next-action.ts +25 -0
  186. package/src/workflow/workflow.ts +1 -0
@@ -0,0 +1,270 @@
1
+ import { z } from 'zod';
2
+ export declare const STRENGTH_EVIDENCE_SCHEMA_VERSION: 1;
3
+ /**
4
+ * The mutation tool that produced the evidence. Stack adapters map
5
+ * stacks onto tools (core/tdd/strength.ts); the contract only records
6
+ * which tool ran so the score is interpretable later.
7
+ */
8
+ export declare const MutationToolSchema: z.ZodEnum<["stryker", "mutmut", "mutant", "go-mutesting", "gremlins", "cargo-mutants", "stryker-net"]>;
9
+ export type MutationTool = z.infer<typeof MutationToolSchema>;
10
+ /**
11
+ * Status of a strength run. Exhaustive by construction:
12
+ * - passed: tool ran to completion and score >= threshold.
13
+ * - failed: tool ran to completion and score < threshold.
14
+ * - incomplete: the run did NOT complete (budget exceeded, tool
15
+ * missing, tool crashed). The score is unknown —
16
+ * an incomplete run NEVER counts as passed and never
17
+ * fabricates a score.
18
+ */
19
+ export declare const StrengthStatusSchema: z.ZodEnum<["passed", "failed", "incomplete"]>;
20
+ export type StrengthStatus = z.infer<typeof StrengthStatusSchema>;
21
+ /** How the score reacts to the threshold: warn logs, enforce blocks. */
22
+ export declare const StrengthGateModeSchema: z.ZodEnum<["warn", "enforce"]>;
23
+ export type StrengthGateMode = z.infer<typeof StrengthGateModeSchema>;
24
+ /** `diff` = only the scoped files; `suite` = the full target set. */
25
+ export declare const StrengthScopeSchema: z.ZodEnum<["diff", "suite"]>;
26
+ export type StrengthScope = z.infer<typeof StrengthScopeSchema>;
27
+ /**
28
+ * Configuration surface on the project profile (`.ai-kit/project.yml`):
29
+ *
30
+ * verification:
31
+ * strength:
32
+ * enabled: true # default false in v1 (opt-in)
33
+ * threshold: 60 # mutation score percentage
34
+ * budgetMs: 300000 # hard cap on the mutation run
35
+ * scope: diff # 'diff' | 'suite'
36
+ * gateMode: warn # 'warn' | 'enforce'
37
+ */
38
+ export declare const StrengthSettingsSchema: z.ZodObject<{
39
+ enabled: z.ZodBoolean;
40
+ threshold: z.ZodNumber;
41
+ budgetMs: z.ZodNumber;
42
+ scope: z.ZodEnum<["diff", "suite"]>;
43
+ gateMode: z.ZodEnum<["warn", "enforce"]>;
44
+ }, "strict", z.ZodTypeAny, {
45
+ enabled: boolean;
46
+ threshold: number;
47
+ budgetMs: number;
48
+ scope: "diff" | "suite";
49
+ gateMode: "warn" | "enforce";
50
+ }, {
51
+ enabled: boolean;
52
+ threshold: number;
53
+ budgetMs: number;
54
+ scope: "diff" | "suite";
55
+ gateMode: "warn" | "enforce";
56
+ }>;
57
+ export type StrengthSettings = z.infer<typeof StrengthSettingsSchema>;
58
+ export declare const DEFAULT_STRENGTH_SETTINGS: StrengthSettings;
59
+ export declare const VerificationSettingsSchema: z.ZodObject<{
60
+ strength: z.ZodOptional<z.ZodObject<{
61
+ enabled: z.ZodBoolean;
62
+ threshold: z.ZodNumber;
63
+ budgetMs: z.ZodNumber;
64
+ scope: z.ZodEnum<["diff", "suite"]>;
65
+ gateMode: z.ZodEnum<["warn", "enforce"]>;
66
+ }, "strict", z.ZodTypeAny, {
67
+ enabled: boolean;
68
+ threshold: number;
69
+ budgetMs: number;
70
+ scope: "diff" | "suite";
71
+ gateMode: "warn" | "enforce";
72
+ }, {
73
+ enabled: boolean;
74
+ threshold: number;
75
+ budgetMs: number;
76
+ scope: "diff" | "suite";
77
+ gateMode: "warn" | "enforce";
78
+ }>>;
79
+ }, "strict", z.ZodTypeAny, {
80
+ strength?: {
81
+ enabled: boolean;
82
+ threshold: number;
83
+ budgetMs: number;
84
+ scope: "diff" | "suite";
85
+ gateMode: "warn" | "enforce";
86
+ } | undefined;
87
+ }, {
88
+ strength?: {
89
+ enabled: boolean;
90
+ threshold: number;
91
+ budgetMs: number;
92
+ scope: "diff" | "suite";
93
+ gateMode: "warn" | "enforce";
94
+ } | undefined;
95
+ }>;
96
+ export type VerificationSettings = z.infer<typeof VerificationSettingsSchema>;
97
+ export declare const StrengthEvidenceSchema: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodObject<{
98
+ schemaVersion: z.ZodLiteral<1>;
99
+ taskId: z.ZodOptional<z.ZodString>;
100
+ tool: z.ZodEnum<["stryker", "mutmut", "mutant", "go-mutesting", "gremlins", "cargo-mutants", "stryker-net"]>;
101
+ toolVersion: z.ZodOptional<z.ZodString>;
102
+ status: z.ZodEnum<["passed", "failed", "incomplete"]>;
103
+ /** Mutation score percentage 0–100. Undefined iff status is `incomplete`. */
104
+ score: z.ZodOptional<z.ZodNumber>;
105
+ mutantsGenerated: z.ZodNumber;
106
+ mutantsKilled: z.ZodNumber;
107
+ mutantsSurvived: z.ZodNumber;
108
+ threshold: z.ZodNumber;
109
+ scope: z.ZodEnum<["diff", "suite"]>;
110
+ /** Files mutated; empty when the tool did not report a file list. */
111
+ scopeFiles: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
112
+ durationMs: z.ZodNumber;
113
+ budgetMs: z.ZodNumber;
114
+ /** Bounded, redacted human-readable derivation (never full output). */
115
+ summary: z.ZodString;
116
+ }, "strict", z.ZodTypeAny, {
117
+ status: "passed" | "failed" | "incomplete";
118
+ threshold: number;
119
+ budgetMs: number;
120
+ scope: "diff" | "suite";
121
+ schemaVersion: 1;
122
+ tool: "stryker" | "mutmut" | "mutant" | "go-mutesting" | "gremlins" | "cargo-mutants" | "stryker-net";
123
+ mutantsGenerated: number;
124
+ mutantsKilled: number;
125
+ mutantsSurvived: number;
126
+ scopeFiles: string[];
127
+ durationMs: number;
128
+ summary: string;
129
+ taskId?: string | undefined;
130
+ toolVersion?: string | undefined;
131
+ score?: number | undefined;
132
+ }, {
133
+ status: "passed" | "failed" | "incomplete";
134
+ threshold: number;
135
+ budgetMs: number;
136
+ scope: "diff" | "suite";
137
+ schemaVersion: 1;
138
+ tool: "stryker" | "mutmut" | "mutant" | "go-mutesting" | "gremlins" | "cargo-mutants" | "stryker-net";
139
+ mutantsGenerated: number;
140
+ mutantsKilled: number;
141
+ mutantsSurvived: number;
142
+ durationMs: number;
143
+ summary: string;
144
+ taskId?: string | undefined;
145
+ toolVersion?: string | undefined;
146
+ score?: number | undefined;
147
+ scopeFiles?: string[] | undefined;
148
+ }>, {
149
+ status: "passed" | "failed" | "incomplete";
150
+ threshold: number;
151
+ budgetMs: number;
152
+ scope: "diff" | "suite";
153
+ schemaVersion: 1;
154
+ tool: "stryker" | "mutmut" | "mutant" | "go-mutesting" | "gremlins" | "cargo-mutants" | "stryker-net";
155
+ mutantsGenerated: number;
156
+ mutantsKilled: number;
157
+ mutantsSurvived: number;
158
+ scopeFiles: string[];
159
+ durationMs: number;
160
+ summary: string;
161
+ taskId?: string | undefined;
162
+ toolVersion?: string | undefined;
163
+ score?: number | undefined;
164
+ }, {
165
+ status: "passed" | "failed" | "incomplete";
166
+ threshold: number;
167
+ budgetMs: number;
168
+ scope: "diff" | "suite";
169
+ schemaVersion: 1;
170
+ tool: "stryker" | "mutmut" | "mutant" | "go-mutesting" | "gremlins" | "cargo-mutants" | "stryker-net";
171
+ mutantsGenerated: number;
172
+ mutantsKilled: number;
173
+ mutantsSurvived: number;
174
+ durationMs: number;
175
+ summary: string;
176
+ taskId?: string | undefined;
177
+ toolVersion?: string | undefined;
178
+ score?: number | undefined;
179
+ scopeFiles?: string[] | undefined;
180
+ }>, {
181
+ status: "passed" | "failed" | "incomplete";
182
+ threshold: number;
183
+ budgetMs: number;
184
+ scope: "diff" | "suite";
185
+ schemaVersion: 1;
186
+ tool: "stryker" | "mutmut" | "mutant" | "go-mutesting" | "gremlins" | "cargo-mutants" | "stryker-net";
187
+ mutantsGenerated: number;
188
+ mutantsKilled: number;
189
+ mutantsSurvived: number;
190
+ scopeFiles: string[];
191
+ durationMs: number;
192
+ summary: string;
193
+ taskId?: string | undefined;
194
+ toolVersion?: string | undefined;
195
+ score?: number | undefined;
196
+ }, {
197
+ status: "passed" | "failed" | "incomplete";
198
+ threshold: number;
199
+ budgetMs: number;
200
+ scope: "diff" | "suite";
201
+ schemaVersion: 1;
202
+ tool: "stryker" | "mutmut" | "mutant" | "go-mutesting" | "gremlins" | "cargo-mutants" | "stryker-net";
203
+ mutantsGenerated: number;
204
+ mutantsKilled: number;
205
+ mutantsSurvived: number;
206
+ durationMs: number;
207
+ summary: string;
208
+ taskId?: string | undefined;
209
+ toolVersion?: string | undefined;
210
+ score?: number | undefined;
211
+ scopeFiles?: string[] | undefined;
212
+ }>, {
213
+ status: "passed" | "failed" | "incomplete";
214
+ threshold: number;
215
+ budgetMs: number;
216
+ scope: "diff" | "suite";
217
+ schemaVersion: 1;
218
+ tool: "stryker" | "mutmut" | "mutant" | "go-mutesting" | "gremlins" | "cargo-mutants" | "stryker-net";
219
+ mutantsGenerated: number;
220
+ mutantsKilled: number;
221
+ mutantsSurvived: number;
222
+ scopeFiles: string[];
223
+ durationMs: number;
224
+ summary: string;
225
+ taskId?: string | undefined;
226
+ toolVersion?: string | undefined;
227
+ score?: number | undefined;
228
+ }, {
229
+ status: "passed" | "failed" | "incomplete";
230
+ threshold: number;
231
+ budgetMs: number;
232
+ scope: "diff" | "suite";
233
+ schemaVersion: 1;
234
+ tool: "stryker" | "mutmut" | "mutant" | "go-mutesting" | "gremlins" | "cargo-mutants" | "stryker-net";
235
+ mutantsGenerated: number;
236
+ mutantsKilled: number;
237
+ mutantsSurvived: number;
238
+ durationMs: number;
239
+ summary: string;
240
+ taskId?: string | undefined;
241
+ toolVersion?: string | undefined;
242
+ score?: number | undefined;
243
+ scopeFiles?: string[] | undefined;
244
+ }>;
245
+ export type StrengthEvidence = z.infer<typeof StrengthEvidenceSchema>;
246
+ /**
247
+ * Deterministic mutation score: round(100 * killed / generated).
248
+ * Returns null when no mutants were generated — a suite with nothing
249
+ * to kill has no measurable strength, and reporting 0 would claim a
250
+ * measurement that was not made.
251
+ */
252
+ export declare function computeMutationScore(killed: number, generated: number): number | null;
253
+ /**
254
+ * Resolve the status of a completed strength run against the threshold.
255
+ * An unknown score (no mutants generated) is `incomplete`: the run
256
+ * measured nothing and must not pass a gate by default.
257
+ */
258
+ export declare function resolveStrengthStatus(score: number | null, threshold: number): StrengthStatus;
259
+ /**
260
+ * Gate decision. `enforce` refuses completion below threshold (the
261
+ * caller turns a `block` decision into a failed verify); `warn` never
262
+ * blocks — it is observability only. An `incomplete` run in `enforce`
263
+ * mode blocks: an unknown score must not certify strength (fail
264
+ * closed).
265
+ */
266
+ export declare function evaluateStrengthGate(evidence: Pick<StrengthEvidence, 'status' | 'score'>, gateMode: StrengthGateMode): {
267
+ block: boolean;
268
+ reason: string;
269
+ };
270
+ //# sourceMappingURL=strength.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"strength.d.ts","sourceRoot":"","sources":["../../src/verification/strength.ts"],"names":[],"mappings":"AAqBA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,gCAAgC,EAAG,CAAU,CAAC;AAE3D;;;;GAIG;AACH,eAAO,MAAM,kBAAk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AAC;AAEtE;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAGrF;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,EAAE,SAAS,EAAE,MAAM,GAAG,cAAc,CAG7F;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAClC,QAAQ,EAAE,IAAI,CAAC,gBAAgB,EAAE,QAAQ,GAAG,OAAO,CAAC,EACpD,QAAQ,EAAE,gBAAgB,GACzB;IAAE,KAAK,EAAE,OAAO,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAuBpC"}
@@ -0,0 +1,168 @@
1
+ // packages/contracts/src/verification/strength.ts
2
+ //
3
+ // Test-strength evidence contract (ADR-0022). Passing evidence proves
4
+ // the agent wrote a test that failed and then passed; it does NOT prove
5
+ // the test would catch a regression. Strength evidence measures the
6
+ // suite's ability to detect regressions via mutation testing and records
7
+ // the score as a versioned, auditable artifact.
8
+ //
9
+ // Honest limits (documented in ADR-0022, repeated here because a
10
+ // contract must not overclaim):
11
+ // - The mutation score is a PROXY, not proof. It measures how many
12
+ // generated mutants the suite killed on THIS run with THIS tool.
13
+ // - `incomplete` status means the run exceeded its budget (or the
14
+ // tool was unavailable): the score is UNKNOWN, never silently 0
15
+ // and never silently passed.
16
+ // - `scope: diff` mutates only the files named in the scope: a
17
+ // cross-file escape (a mutant in file A caught only by a test of
18
+ // file B) can be missed when B is outside the diff.
19
+ //
20
+ // See docs/contracts/CONTRACTS.md §6.3.
21
+ import { z } from 'zod';
22
+ export const STRENGTH_EVIDENCE_SCHEMA_VERSION = 1;
23
+ /**
24
+ * The mutation tool that produced the evidence. Stack adapters map
25
+ * stacks onto tools (core/tdd/strength.ts); the contract only records
26
+ * which tool ran so the score is interpretable later.
27
+ */
28
+ export const MutationToolSchema = z.enum([
29
+ 'stryker', // node-typescript, react-typescript (StrykerJS)
30
+ 'mutmut', // python
31
+ 'mutant', // ruby, ruby-rails
32
+ 'go-mutesting', // go (gremlins shares the runner, recorded distinctly)
33
+ 'gremlins', // go
34
+ 'cargo-mutants', // rust
35
+ 'stryker-net', // dotnet (Stryker.NET)
36
+ ]);
37
+ /**
38
+ * Status of a strength run. Exhaustive by construction:
39
+ * - passed: tool ran to completion and score >= threshold.
40
+ * - failed: tool ran to completion and score < threshold.
41
+ * - incomplete: the run did NOT complete (budget exceeded, tool
42
+ * missing, tool crashed). The score is unknown —
43
+ * an incomplete run NEVER counts as passed and never
44
+ * fabricates a score.
45
+ */
46
+ export const StrengthStatusSchema = z.enum(['passed', 'failed', 'incomplete']);
47
+ /** How the score reacts to the threshold: warn logs, enforce blocks. */
48
+ export const StrengthGateModeSchema = z.enum(['warn', 'enforce']);
49
+ /** `diff` = only the scoped files; `suite` = the full target set. */
50
+ export const StrengthScopeSchema = z.enum(['diff', 'suite']);
51
+ /**
52
+ * Configuration surface on the project profile (`.ai-kit/project.yml`):
53
+ *
54
+ * verification:
55
+ * strength:
56
+ * enabled: true # default false in v1 (opt-in)
57
+ * threshold: 60 # mutation score percentage
58
+ * budgetMs: 300000 # hard cap on the mutation run
59
+ * scope: diff # 'diff' | 'suite'
60
+ * gateMode: warn # 'warn' | 'enforce'
61
+ */
62
+ export const StrengthSettingsSchema = z
63
+ .object({
64
+ enabled: z.boolean(),
65
+ threshold: z.number().int().min(0).max(100),
66
+ budgetMs: z.number().int().positive(),
67
+ scope: StrengthScopeSchema,
68
+ gateMode: StrengthGateModeSchema,
69
+ })
70
+ .strict();
71
+ export const DEFAULT_STRENGTH_SETTINGS = {
72
+ enabled: false,
73
+ threshold: 60,
74
+ budgetMs: 300_000,
75
+ scope: 'diff',
76
+ gateMode: 'warn',
77
+ };
78
+ export const VerificationSettingsSchema = z
79
+ .object({
80
+ strength: StrengthSettingsSchema.optional(),
81
+ })
82
+ .strict();
83
+ export const StrengthEvidenceSchema = z
84
+ .object({
85
+ schemaVersion: z.literal(STRENGTH_EVIDENCE_SCHEMA_VERSION),
86
+ taskId: z.string().min(1).optional(),
87
+ tool: MutationToolSchema,
88
+ toolVersion: z.string().min(1).optional(),
89
+ status: StrengthStatusSchema,
90
+ /** Mutation score percentage 0–100. Undefined iff status is `incomplete`. */
91
+ score: z.number().min(0).max(100).optional(),
92
+ mutantsGenerated: z.number().int().nonnegative(),
93
+ mutantsKilled: z.number().int().nonnegative(),
94
+ mutantsSurvived: z.number().int().nonnegative(),
95
+ threshold: z.number().int().min(0).max(100),
96
+ scope: StrengthScopeSchema,
97
+ /** Files mutated; empty when the tool did not report a file list. */
98
+ scopeFiles: z.array(z.string()).default([]),
99
+ durationMs: z.number().int().nonnegative(),
100
+ budgetMs: z.number().int().positive(),
101
+ /** Bounded, redacted human-readable derivation (never full output). */
102
+ summary: z.string().max(300),
103
+ })
104
+ .strict()
105
+ .refine((e) => e.status === 'incomplete' || e.score !== undefined, {
106
+ message: 'score is required unless status is incomplete',
107
+ path: ['score'],
108
+ })
109
+ .refine((e) => e.status !== 'incomplete' || e.score === undefined, {
110
+ message: 'an incomplete run must not carry a score',
111
+ path: ['score'],
112
+ })
113
+ .refine((e) => e.mutantsKilled + e.mutantsSurvived <= e.mutantsGenerated, {
114
+ message: 'killed + survived cannot exceed generated mutants',
115
+ path: ['mutantsKilled'],
116
+ });
117
+ /**
118
+ * Deterministic mutation score: round(100 * killed / generated).
119
+ * Returns null when no mutants were generated — a suite with nothing
120
+ * to kill has no measurable strength, and reporting 0 would claim a
121
+ * measurement that was not made.
122
+ */
123
+ export function computeMutationScore(killed, generated) {
124
+ if (generated <= 0)
125
+ return null;
126
+ return Math.round((100 * killed) / generated);
127
+ }
128
+ /**
129
+ * Resolve the status of a completed strength run against the threshold.
130
+ * An unknown score (no mutants generated) is `incomplete`: the run
131
+ * measured nothing and must not pass a gate by default.
132
+ */
133
+ export function resolveStrengthStatus(score, threshold) {
134
+ if (score === null)
135
+ return 'incomplete';
136
+ return score >= threshold ? 'passed' : 'failed';
137
+ }
138
+ /**
139
+ * Gate decision. `enforce` refuses completion below threshold (the
140
+ * caller turns a `block` decision into a failed verify); `warn` never
141
+ * blocks — it is observability only. An `incomplete` run in `enforce`
142
+ * mode blocks: an unknown score must not certify strength (fail
143
+ * closed).
144
+ */
145
+ export function evaluateStrengthGate(evidence, gateMode) {
146
+ if (gateMode === 'warn') {
147
+ return {
148
+ block: false,
149
+ reason: evidence.status === 'incomplete'
150
+ ? 'strength run incomplete (warn mode: logged, not blocked)'
151
+ : `mutation score ${evidence.score ?? 'n/a'}% (warn mode: logged, not blocked)`,
152
+ };
153
+ }
154
+ if (evidence.status === 'incomplete') {
155
+ return {
156
+ block: true,
157
+ reason: 'strength run incomplete: score unknown, refusing to certify (enforce mode)',
158
+ };
159
+ }
160
+ if (evidence.status === 'failed') {
161
+ return {
162
+ block: true,
163
+ reason: `mutation score ${evidence.score}% is below the threshold (enforce mode)`,
164
+ };
165
+ }
166
+ return { block: false, reason: `mutation score ${evidence.score}% meets the threshold` };
167
+ }
168
+ //# sourceMappingURL=strength.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"strength.js","sourceRoot":"","sources":["../../src/verification/strength.ts"],"names":[],"mappings":"AAAA,kDAAkD;AAClD,EAAE;AACF,sEAAsE;AACtE,wEAAwE;AACxE,oEAAoE;AACpE,yEAAyE;AACzE,gDAAgD;AAChD,EAAE;AACF,iEAAiE;AACjE,gCAAgC;AAChC,qEAAqE;AACrE,qEAAqE;AACrE,oEAAoE;AACpE,oEAAoE;AACpE,iCAAiC;AACjC,iEAAiE;AACjE,qEAAqE;AACrE,wDAAwD;AACxD,EAAE;AACF,wCAAwC;AAExC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,CAAC,MAAM,gCAAgC,GAAG,CAAU,CAAC;AAE3D;;;;GAIG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC,IAAI,CAAC;IACvC,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B,IAAI,QAAQ,KAAK,MAAM,EAAE,CAAC;QACxB,OAAO;YACL,KAAK,EAAE,KAAK;YACZ,MAAM,EACJ,QAAQ,CAAC,MAAM,KAAK,YAAY;gBAC9B,CAAC,CAAC,0DAA0D;gBAC5D,CAAC,CAAC,kBAAkB,QAAQ,CAAC,KAAK,IAAI,KAAK,oCAAoC;SACpF,CAAC;IACJ,CAAC;IACD,IAAI,QAAQ,CAAC,MAAM,KAAK,YAAY,EAAE,CAAC;QACrC,OAAO;YACL,KAAK,EAAE,IAAI;YACX,MAAM,EAAE,4EAA4E;SACrF,CAAC;IACJ,CAAC;IACD,IAAI,QAAQ,CAAC,MAAM,KAAK,QAAQ,EAAE,CAAC;QACjC,OAAO;YACL,KAAK,EAAE,IAAI;YACX,MAAM,EAAE,kBAAkB,QAAQ,CAAC,KAAK,yCAAyC;SAClF,CAAC;IACJ,CAAC;IACD,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,kBAAkB,QAAQ,CAAC,KAAK,uBAAuB,EAAE,CAAC;AAC3F,CAAC"}
@@ -13,13 +13,13 @@ export declare const LessonRefSchema: z.ZodObject<{
13
13
  summary: z.ZodString;
14
14
  advisory: z.ZodLiteral<true>;
15
15
  }, "strip", z.ZodTypeAny, {
16
- lessonId: string;
17
16
  summary: string;
18
17
  advisory: true;
19
- }, {
20
18
  lessonId: string;
19
+ }, {
21
20
  summary: string;
22
21
  advisory: true;
22
+ lessonId: string;
23
23
  }>;
24
24
  export type LessonRef = z.infer<typeof LessonRefSchema>;
25
25
  /**
@@ -41,6 +41,32 @@ export declare const NextActionConstraintsSchema: z.ZodObject<{
41
41
  maxOutputBytes: number;
42
42
  }>;
43
43
  export type NextActionConstraints = z.infer<typeof NextActionConstraintsSchema>;
44
+ /**
45
+ * Feedback for an attempt the evidence gate rejected. Its text is fixed
46
+ * guidance chosen by the kit, never stored or captured output, so it is
47
+ * safe to place in an agent's instructions.
48
+ */
49
+ export declare const RecoveryHintSchema: z.ZodObject<{
50
+ classification: z.ZodEnum<["assertion", "compilation", "dependency", "discovery", "environment", "timeout", "unclassified"]>;
51
+ action: z.ZodLiteral<"feedback">;
52
+ reason: z.ZodString;
53
+ /** The failed attempt this hint reports, counted within the current phase (1-based). */
54
+ attempt: z.ZodNumber;
55
+ maxAttempts: z.ZodNumber;
56
+ }, "strip", z.ZodTypeAny, {
57
+ classification: "assertion" | "compilation" | "dependency" | "discovery" | "environment" | "timeout" | "unclassified";
58
+ action: "feedback";
59
+ reason: string;
60
+ attempt: number;
61
+ maxAttempts: number;
62
+ }, {
63
+ classification: "assertion" | "compilation" | "dependency" | "discovery" | "environment" | "timeout" | "unclassified";
64
+ action: "feedback";
65
+ reason: string;
66
+ attempt: number;
67
+ maxAttempts: number;
68
+ }>;
69
+ export type RecoveryHint = z.infer<typeof RecoveryHintSchema>;
44
70
  export declare const NextActionSchema: z.ZodObject<{
45
71
  schemaVersion: z.ZodLiteral<1>;
46
72
  /** The feature run this action belongs to (one run per feature id). */
@@ -67,14 +93,35 @@ export declare const NextActionSchema: z.ZodObject<{
67
93
  summary: z.ZodString;
68
94
  advisory: z.ZodLiteral<true>;
69
95
  }, "strip", z.ZodTypeAny, {
70
- lessonId: string;
71
96
  summary: string;
72
97
  advisory: true;
73
- }, {
74
98
  lessonId: string;
99
+ }, {
75
100
  summary: string;
76
101
  advisory: true;
102
+ lessonId: string;
77
103
  }>, "many">;
104
+ /** Present only when the last attempt was rejected and feedback is still offered. */
105
+ recoveryHint: z.ZodOptional<z.ZodObject<{
106
+ classification: z.ZodEnum<["assertion", "compilation", "dependency", "discovery", "environment", "timeout", "unclassified"]>;
107
+ action: z.ZodLiteral<"feedback">;
108
+ reason: z.ZodString;
109
+ /** The failed attempt this hint reports, counted within the current phase (1-based). */
110
+ attempt: z.ZodNumber;
111
+ maxAttempts: z.ZodNumber;
112
+ }, "strip", z.ZodTypeAny, {
113
+ classification: "assertion" | "compilation" | "dependency" | "discovery" | "environment" | "timeout" | "unclassified";
114
+ action: "feedback";
115
+ reason: string;
116
+ attempt: number;
117
+ maxAttempts: number;
118
+ }, {
119
+ classification: "assertion" | "compilation" | "dependency" | "discovery" | "environment" | "timeout" | "unclassified";
120
+ action: "feedback";
121
+ reason: string;
122
+ attempt: number;
123
+ maxAttempts: number;
124
+ }>>;
78
125
  constraints: z.ZodObject<{
79
126
  /** Phase verification timeout (default 60_000 ms, runTddPhase). */
80
127
  timeoutMs: z.ZodNumber;
@@ -96,9 +143,9 @@ export declare const NextActionSchema: z.ZodObject<{
96
143
  nextInvocation: string;
97
144
  blockingQuestions: string[];
98
145
  advisoryLessons: {
99
- lessonId: string;
100
146
  summary: string;
101
147
  advisory: true;
148
+ lessonId: string;
102
149
  }[];
103
150
  constraints: {
104
151
  timeoutMs: number;
@@ -106,6 +153,13 @@ export declare const NextActionSchema: z.ZodObject<{
106
153
  };
107
154
  taskId?: string | undefined;
108
155
  phase?: "refactor" | "red" | "green" | undefined;
156
+ recoveryHint?: {
157
+ classification: "assertion" | "compilation" | "dependency" | "discovery" | "environment" | "timeout" | "unclassified";
158
+ action: "feedback";
159
+ reason: string;
160
+ attempt: number;
161
+ maxAttempts: number;
162
+ } | undefined;
109
163
  }, {
110
164
  status: "failed" | "blocked" | "pending" | "in_progress" | "completed";
111
165
  schemaVersion: 1;
@@ -115,9 +169,9 @@ export declare const NextActionSchema: z.ZodObject<{
115
169
  nextInvocation: string;
116
170
  blockingQuestions: string[];
117
171
  advisoryLessons: {
118
- lessonId: string;
119
172
  summary: string;
120
173
  advisory: true;
174
+ lessonId: string;
121
175
  }[];
122
176
  constraints: {
123
177
  timeoutMs: number;
@@ -125,6 +179,13 @@ export declare const NextActionSchema: z.ZodObject<{
125
179
  };
126
180
  taskId?: string | undefined;
127
181
  phase?: "refactor" | "red" | "green" | undefined;
182
+ recoveryHint?: {
183
+ classification: "assertion" | "compilation" | "dependency" | "discovery" | "environment" | "timeout" | "unclassified";
184
+ action: "feedback";
185
+ reason: string;
186
+ attempt: number;
187
+ maxAttempts: number;
188
+ } | undefined;
128
189
  }>;
129
190
  export type NextAction = z.infer<typeof NextActionSchema>;
130
191
  //# sourceMappingURL=next-action.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"next-action.d.ts","sourceRoot":"","sources":["../../src/workflow/next-action.ts"],"names":[],"mappings":"AA4BA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,eAAO,MAAM,0BAA0B,EAAG,CAAU,CAAC;AAErD,iEAAiE;AACjE,eAAO,MAAM,wBAAwB,4GAanC,CAAC;AACH,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAE1E;;;;GAIG;AACH,eAAO,MAAM,eAAe;;;;;;;;;;;;EAI1B,CAAC;AACH,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAExD;;;;;GAKG;AACH,eAAO,MAAM,2BAA2B;IACtC,mEAAmE;;IAEnE,wEAAwE;;;;;;;;EAExE,CAAC;AACH,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC;AAEhF,eAAO,MAAM,gBAAgB;;IAE3B,uEAAuE;;;IAGvE,oEAAoE;;IAEpE,sEAAsE;;;IAGtE;;;;OAIG;;IAEH,oEAAoE;;IAEpE,iFAAiF;;IAEjF,uEAAuE;;;;;;;;;;;;;;;QA3BvE,mEAAmE;;QAEnE,wEAAwE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA4BxE,CAAC;AACH,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC"}
1
+ {"version":3,"file":"next-action.d.ts","sourceRoot":"","sources":["../../src/workflow/next-action.ts"],"names":[],"mappings":"AA4BA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,eAAO,MAAM,0BAA0B,EAAG,CAAU,CAAC;AAErD,iEAAiE;AACjE,eAAO,MAAM,wBAAwB,4GAanC,CAAC;AACH,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAE1E;;;;GAIG;AACH,eAAO,MAAM,eAAe;;;;;;;;;;;;EAI1B,CAAC;AACH,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAExD;;;;;GAKG;AACH,eAAO,MAAM,2BAA2B;IACtC,mEAAmE;;IAEnE,wEAAwE;;;;;;;;EAExE,CAAC;AACH,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC;AAEhF;;;;GAIG;AACH,eAAO,MAAM,kBAAkB;;;;IAY7B,wFAAwF;;;;;;;;;;;;;;;EAGxF,CAAC;AACH,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAE9D,eAAO,MAAM,gBAAgB;;IAE3B,uEAAuE;;;IAGvE,oEAAoE;;IAEpE,sEAAsE;;;IAGtE;;;;OAIG;;IAEH,oEAAoE;;IAEpE,iFAAiF;;IAEjF,uEAAuE;;;;;;;;;;;;;;IAEvE,qFAAqF;;;;;QA5BrF,wFAAwF;;;;;;;;;;;;;;;;;QAxBxF,mEAAmE;;QAEnE,wEAAwE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAqDxE,CAAC;AACH,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC"}
@@ -65,6 +65,27 @@ export const NextActionConstraintsSchema = z.object({
65
65
  /** Output capture bound (default 10 MiB, ProcessVerificationRunner). */
66
66
  maxOutputBytes: z.number().int().positive(),
67
67
  });
68
+ /**
69
+ * Feedback for an attempt the evidence gate rejected. Its text is fixed
70
+ * guidance chosen by the kit, never stored or captured output, so it is
71
+ * safe to place in an agent's instructions.
72
+ */
73
+ export const RecoveryHintSchema = z.object({
74
+ classification: z.enum([
75
+ 'assertion',
76
+ 'compilation',
77
+ 'dependency',
78
+ 'discovery',
79
+ 'environment',
80
+ 'timeout',
81
+ 'unclassified',
82
+ ]),
83
+ action: z.literal('feedback'),
84
+ reason: z.string().min(1),
85
+ /** The failed attempt this hint reports, counted within the current phase (1-based). */
86
+ attempt: z.number().int().positive(),
87
+ maxAttempts: z.number().int().positive(),
88
+ });
68
89
  export const NextActionSchema = z.object({
69
90
  schemaVersion: z.literal(NEXT_ACTION_SCHEMA_VERSION),
70
91
  /** The feature run this action belongs to (one run per feature id). */
@@ -87,6 +108,8 @@ export const NextActionSchema = z.object({
87
108
  blockingQuestions: z.array(z.string()),
88
109
  /** Advisory lessons (ADVISORY ONLY — never authority; ADR-0021 §4). */
89
110
  advisoryLessons: z.array(LessonRefSchema),
111
+ /** Present only when the last attempt was rejected and feedback is still offered. */
112
+ recoveryHint: RecoveryHintSchema.optional(),
90
113
  constraints: NextActionConstraintsSchema,
91
114
  });
92
115
  //# sourceMappingURL=next-action.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"next-action.js","sourceRoot":"","sources":["../../src/workflow/next-action.ts"],"names":[],"mappings":"AAAA,iDAAiD;AACjD,EAAE;AACF,mEAAmE;AACnE,EAAE;AACF,uEAAuE;AACvE,kEAAkE;AAClE,yEAAyE;AACzE,uEAAuE;AACvE,0DAA0D;AAC1D,EAAE;AACF,gCAAgC;AAChC,yEAAyE;AACzE,6DAA6D;AAC7D,oEAAoE;AACpE,qEAAqE;AACrE,wEAAwE;AACxE,yEAAyE;AACzE,yEAAyE;AACzE,qEAAqE;AACrE,iBAAiB;AACjB,sEAAsE;AACtE,oEAAoE;AACpE,yEAAyE;AACzE,wEAAwE;AACxE,EAAE;AACF,kEAAkE;AAClE,yDAAyD;AAEzD,OAAO,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AAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC7B,sEAAsE;IACtE,KAAK,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC,CAAC,QAAQ,EAAE;IACtD,cAAc,EAAE,wBAAwB;IACxC;;;;OAIG;IACH,mBAAmB,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;IACxC,oEAAoE;IACpE,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACjC,iFAAiF;IACjF,iBAAiB,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;IACtC,uEAAuE;IACvE,eAAe,EAAE,CAAC,CAAC,KAAK,CAAC,eAAe,CAAC;IACzC,WAAW,EAAE,2BAA2B;CACzC,CAAC,CAAC"}
1
+ {"version":3,"file":"next-action.js","sourceRoot":"","sources":["../../src/workflow/next-action.ts"],"names":[],"mappings":"AAAA,iDAAiD;AACjD,EAAE;AACF,mEAAmE;AACnE,EAAE;AACF,uEAAuE;AACvE,kEAAkE;AAClE,yEAAyE;AACzE,uEAAuE;AACvE,0DAA0D;AAC1D,EAAE;AACF,gCAAgC;AAChC,yEAAyE;AACzE,6DAA6D;AAC7D,oEAAoE;AACpE,qEAAqE;AACrE,wEAAwE;AACxE,yEAAyE;AACzE,yEAAyE;AACzE,qEAAqE;AACrE,iBAAiB;AACjB,sEAAsE;AACtE,oEAAoE;AACpE,yEAAyE;AACzE,wEAAwE;AACxE,EAAE;AACF,kEAAkE;AAClE,yDAAyD;AAEzD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAErD,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAU,CAAC;AAErD,iEAAiE;AACjE,MAAM,CAAC,MAAM,wBAAwB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