audit-tools 0.28.2 → 0.28.3

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 (110) hide show
  1. package/dist/audit/cli/auditStep.d.ts +12 -1
  2. package/dist/audit/cli/auditStep.d.ts.map +1 -1
  3. package/dist/audit/cli/auditStep.js +1 -0
  4. package/dist/audit/cli/auditStep.js.map +1 -1
  5. package/dist/audit/cli/confirmIntentStep.d.ts.map +1 -1
  6. package/dist/audit/cli/confirmIntentStep.js +46 -35
  7. package/dist/audit/cli/confirmIntentStep.js.map +1 -1
  8. package/dist/audit/cli/dispatch/packetFilter.d.ts +1 -1
  9. package/dist/audit/cli/nextStepHelpers.d.ts.map +1 -1
  10. package/dist/audit/cli/nextStepHelpers.js +5 -1
  11. package/dist/audit/cli/nextStepHelpers.js.map +1 -1
  12. package/dist/audit/cli/steps.d.ts +2 -2
  13. package/dist/audit/contracts/workerSchemas.d.ts +14 -14
  14. package/dist/audit/contracts/wrapperResponse.d.ts +4 -4
  15. package/dist/audit/extractors/analyzers/types.d.ts +3 -1
  16. package/dist/audit/extractors/analyzers/types.d.ts.map +1 -1
  17. package/dist/audit/extractors/analyzers/types.js +10 -1
  18. package/dist/audit/extractors/analyzers/types.js.map +1 -1
  19. package/dist/audit/orchestrator/advanceTypes.d.ts +8 -0
  20. package/dist/audit/orchestrator/advanceTypes.d.ts.map +1 -1
  21. package/dist/audit/orchestrator/executorRunners.d.ts.map +1 -1
  22. package/dist/audit/orchestrator/executorRunners.js +1 -1
  23. package/dist/audit/orchestrator/executorRunners.js.map +1 -1
  24. package/dist/audit/orchestrator/intentCheckpointExecutor.d.ts +19 -8
  25. package/dist/audit/orchestrator/intentCheckpointExecutor.d.ts.map +1 -1
  26. package/dist/audit/orchestrator/intentCheckpointExecutor.js +64 -40
  27. package/dist/audit/orchestrator/intentCheckpointExecutor.js.map +1 -1
  28. package/dist/audit/orchestrator/requeueCommand.d.ts +1 -1
  29. package/dist/audit/reporting/synthesis.d.ts.map +1 -1
  30. package/dist/audit/reporting/synthesis.js +91 -26
  31. package/dist/audit/reporting/synthesis.js.map +1 -1
  32. package/dist/audit/types/analyzerCapability.d.ts +69 -12
  33. package/dist/audit/types/analyzerCapability.d.ts.map +1 -1
  34. package/dist/audit/types/analyzerCapability.js +25 -1
  35. package/dist/audit/types/analyzerCapability.js.map +1 -1
  36. package/dist/audit/types/auditScope.d.ts +51 -12
  37. package/dist/audit/types/auditScope.d.ts.map +1 -1
  38. package/dist/audit/types/auditScope.js +49 -1
  39. package/dist/audit/types/auditScope.js.map +1 -1
  40. package/dist/audit/types/auditState.d.ts +60 -11
  41. package/dist/audit/types/auditState.d.ts.map +1 -1
  42. package/dist/audit/types/auditState.js +24 -1
  43. package/dist/audit/types/auditState.js.map +1 -1
  44. package/dist/audit/types/flowCoverage.d.ts +65 -8
  45. package/dist/audit/types/flowCoverage.d.ts.map +1 -1
  46. package/dist/audit/types/flowCoverage.js +21 -0
  47. package/dist/audit/types/flowCoverage.js.map +1 -1
  48. package/dist/audit/types/reviewPlanning.d.ts +2 -2
  49. package/dist/audit/types.d.ts +12 -12
  50. package/dist/remediate/contractPipeline/semanticProjection.d.ts.map +1 -1
  51. package/dist/remediate/contractPipeline/semanticProjection.js +36 -14
  52. package/dist/remediate/contractPipeline/semanticProjection.js.map +1 -1
  53. package/dist/remediate/phases/close.d.ts.map +1 -1
  54. package/dist/remediate/phases/close.js +27 -8
  55. package/dist/remediate/phases/close.js.map +1 -1
  56. package/dist/remediate/state/itemStatus.d.ts +5 -3
  57. package/dist/remediate/state/itemStatus.d.ts.map +1 -1
  58. package/dist/remediate/state/itemStatus.js +7 -3
  59. package/dist/remediate/state/itemStatus.js.map +1 -1
  60. package/dist/remediate/state/types.d.ts +7 -2
  61. package/dist/remediate/state/types.d.ts.map +1 -1
  62. package/dist/remediate/state/types.js +7 -0
  63. package/dist/remediate/state/types.js.map +1 -1
  64. package/dist/remediate/steps/dispatch.d.ts +109 -0
  65. package/dist/remediate/steps/dispatch.d.ts.map +1 -1
  66. package/dist/remediate/steps/dispatch.js +342 -53
  67. package/dist/remediate/steps/dispatch.js.map +1 -1
  68. package/dist/remediate/steps/nextStep.d.ts.map +1 -1
  69. package/dist/remediate/steps/nextStep.js +215 -21
  70. package/dist/remediate/steps/nextStep.js.map +1 -1
  71. package/dist/remediate/steps/prompts.d.ts +12 -0
  72. package/dist/remediate/steps/prompts.d.ts.map +1 -1
  73. package/dist/remediate/steps/prompts.js +61 -1
  74. package/dist/remediate/steps/prompts.js.map +1 -1
  75. package/dist/remediate/steps/rollingSession.d.ts.map +1 -1
  76. package/dist/remediate/steps/rollingSession.js +52 -5
  77. package/dist/remediate/steps/rollingSession.js.map +1 -1
  78. package/dist/remediate/steps/types.d.ts +10 -1
  79. package/dist/remediate/steps/types.d.ts.map +1 -1
  80. package/dist/remediate/steps/types.js.map +1 -1
  81. package/dist/remediate/validation/artifacts.d.ts.map +1 -1
  82. package/dist/remediate/validation/artifacts.js +5 -2
  83. package/dist/remediate/validation/artifacts.js.map +1 -1
  84. package/dist/remediate/validation/contractPipelineGates.d.ts.map +1 -1
  85. package/dist/remediate/validation/contractPipelineGates.js +25 -7
  86. package/dist/remediate/validation/contractPipelineGates.js.map +1 -1
  87. package/dist/shared/engine/obligationEngine.d.ts +16 -5
  88. package/dist/shared/engine/obligationEngine.d.ts.map +1 -1
  89. package/dist/shared/engine/obligationEngine.js +21 -0
  90. package/dist/shared/engine/obligationEngine.js.map +1 -1
  91. package/dist/shared/index.d.ts +4 -2
  92. package/dist/shared/index.d.ts.map +1 -1
  93. package/dist/shared/index.js +4 -2
  94. package/dist/shared/index.js.map +1 -1
  95. package/dist/shared/intent/freeFormIntentInterpreter.d.ts.map +1 -1
  96. package/dist/shared/intent/freeFormIntentInterpreter.js +5 -1
  97. package/dist/shared/intent/freeFormIntentInterpreter.js.map +1 -1
  98. package/dist/shared/types/intentCheckpoint.d.ts +151 -34
  99. package/dist/shared/types/intentCheckpoint.d.ts.map +1 -1
  100. package/dist/shared/types/intentCheckpoint.js +113 -1
  101. package/dist/shared/types/intentCheckpoint.js.map +1 -1
  102. package/dist/shared/types/remediationOutcome.d.ts +203 -24
  103. package/dist/shared/types/remediationOutcome.d.ts.map +1 -1
  104. package/dist/shared/types/remediationOutcome.js +65 -1
  105. package/dist/shared/types/remediationOutcome.js.map +1 -1
  106. package/dist/shared/types/sessionConfig.d.ts +3 -1
  107. package/dist/shared/types/sessionConfig.d.ts.map +1 -1
  108. package/dist/shared/types/sessionConfig.js +2 -0
  109. package/dist/shared/types/sessionConfig.js.map +1 -1
  110. package/package.json +1 -1
@@ -1,2 +1,25 @@
1
- export {};
1
+ import { z } from "zod";
2
+ import { ObligationSchema } from "audit-tools/shared";
3
+ export const AuditTopLevelStatusSchema = z.enum([
4
+ "not_started",
5
+ "active",
6
+ "blocked",
7
+ "complete",
8
+ ]);
9
+ export const AuditObligationSchema = ObligationSchema;
10
+ export const AuditStateSchema = z
11
+ .object({
12
+ status: AuditTopLevelStatusSchema,
13
+ last_executor: z.string().optional(),
14
+ last_obligation: z.string().optional(),
15
+ blockers: z.array(z.string()).optional(),
16
+ obligations: z.array(AuditObligationSchema),
17
+ /**
18
+ * Set when the rolling dispatch engine fires a partial-completion terminal
19
+ * (empty pool or livelock). Allows synthesis to proceed on partial coverage
20
+ * without hard-gating on `audit_tasks_completed`.
21
+ */
22
+ partial_coverage_terminal: z.boolean().optional(),
23
+ })
24
+ .strict();
2
25
  //# sourceMappingURL=auditState.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"auditState.js","sourceRoot":"","sources":["../../../src/audit/types/auditState.ts"],"names":[],"mappings":""}
1
+ {"version":3,"file":"auditState.js","sourceRoot":"","sources":["../../../src/audit/types/auditState.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,CAAC,IAAI,CAAC;IAC9C,aAAa;IACb,QAAQ;IACR,SAAS;IACT,UAAU;CACX,CAAC,CAAC;AAQH,MAAM,CAAC,MAAM,qBAAqB,GAAG,gBAAgB,CAAC;AAGtD,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC;KAC9B,MAAM,CAAC;IACN,MAAM,EAAE,yBAAyB;IACjC,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACpC,eAAe,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACtC,QAAQ,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE;IACxC,WAAW,EAAE,CAAC,CAAC,KAAK,CAAC,qBAAqB,CAAC;IAC3C;;;;OAIG;IACH,yBAAyB,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;CAClD,CAAC;KACD,MAAM,EAAE,CAAC"}
@@ -1,16 +1,73 @@
1
+ import { z } from "zod";
1
2
  export declare const FLOW_COVERAGE_STATUSES: readonly ["pending", "partial", "complete"];
2
- export type FlowCoverageStatus = (typeof FLOW_COVERAGE_STATUSES)[number];
3
+ export declare const FlowCoverageStatusSchema: z.ZodEnum<["pending", "partial", "complete"]>;
4
+ export type FlowCoverageStatus = z.infer<typeof FlowCoverageStatusSchema>;
3
5
  /** Coverage for one critical flow across the lenses the audit expects to see. */
4
- export interface FlowCoverageRecord {
6
+ export declare const FlowCoverageRecordSchema: z.ZodObject<{
7
+ flow_id: z.ZodString;
8
+ paths: z.ZodArray<z.ZodString, "many">;
9
+ required_lenses: z.ZodArray<z.ZodString, "many">;
10
+ completed_lenses: z.ZodArray<z.ZodString, "many">;
11
+ status: z.ZodEnum<["pending", "partial", "complete"]>;
12
+ notes: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
13
+ }, "strict", z.ZodTypeAny, {
14
+ status: "partial" | "complete" | "pending";
15
+ paths: string[];
16
+ required_lenses: string[];
17
+ completed_lenses: string[];
5
18
  flow_id: string;
19
+ notes?: string[] | undefined;
20
+ }, {
21
+ status: "partial" | "complete" | "pending";
6
22
  paths: string[];
7
23
  required_lenses: string[];
8
24
  completed_lenses: string[];
9
- status: FlowCoverageStatus;
10
- notes?: string[];
11
- }
25
+ flow_id: string;
26
+ notes?: string[] | undefined;
27
+ }>;
28
+ export type FlowCoverageRecord = z.infer<typeof FlowCoverageRecordSchema>;
12
29
  /** Aggregated flow coverage written beside the critical flow manifest. */
13
- export interface FlowCoverageManifest {
14
- flows: FlowCoverageRecord[];
15
- }
30
+ export declare const FlowCoverageManifestSchema: z.ZodObject<{
31
+ flows: z.ZodArray<z.ZodObject<{
32
+ flow_id: z.ZodString;
33
+ paths: z.ZodArray<z.ZodString, "many">;
34
+ required_lenses: z.ZodArray<z.ZodString, "many">;
35
+ completed_lenses: z.ZodArray<z.ZodString, "many">;
36
+ status: z.ZodEnum<["pending", "partial", "complete"]>;
37
+ notes: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
38
+ }, "strict", z.ZodTypeAny, {
39
+ status: "partial" | "complete" | "pending";
40
+ paths: string[];
41
+ required_lenses: string[];
42
+ completed_lenses: string[];
43
+ flow_id: string;
44
+ notes?: string[] | undefined;
45
+ }, {
46
+ status: "partial" | "complete" | "pending";
47
+ paths: string[];
48
+ required_lenses: string[];
49
+ completed_lenses: string[];
50
+ flow_id: string;
51
+ notes?: string[] | undefined;
52
+ }>, "many">;
53
+ }, "strict", z.ZodTypeAny, {
54
+ flows: {
55
+ status: "partial" | "complete" | "pending";
56
+ paths: string[];
57
+ required_lenses: string[];
58
+ completed_lenses: string[];
59
+ flow_id: string;
60
+ notes?: string[] | undefined;
61
+ }[];
62
+ }, {
63
+ flows: {
64
+ status: "partial" | "complete" | "pending";
65
+ paths: string[];
66
+ required_lenses: string[];
67
+ completed_lenses: string[];
68
+ flow_id: string;
69
+ notes?: string[] | undefined;
70
+ }[];
71
+ }>;
72
+ export type FlowCoverageManifest = z.infer<typeof FlowCoverageManifestSchema>;
16
73
  //# sourceMappingURL=flowCoverage.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"flowCoverage.d.ts","sourceRoot":"","sources":["../../../src/audit/types/flowCoverage.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,sBAAsB,6CAIzB,CAAC;AACX,MAAM,MAAM,kBAAkB,GAAG,CAAC,OAAO,sBAAsB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEzE,iFAAiF;AACjF,MAAM,WAAW,kBAAkB;IACjC,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,eAAe,EAAE,MAAM,EAAE,CAAC;IAC1B,gBAAgB,EAAE,MAAM,EAAE,CAAC;IAC3B,MAAM,EAAE,kBAAkB,CAAC;IAC3B,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;CAClB;AAED,0EAA0E;AAC1E,MAAM,WAAW,oBAAoB;IACnC,KAAK,EAAE,kBAAkB,EAAE,CAAC;CAC7B"}
1
+ {"version":3,"file":"flowCoverage.d.ts","sourceRoot":"","sources":["../../../src/audit/types/flowCoverage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,sBAAsB,6CAIzB,CAAC;AACX,eAAO,MAAM,wBAAwB,+CAAiC,CAAC;AACvE,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAE1E,iFAAiF;AACjF,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;EAW1B,CAAC;AACZ,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAE1E,0EAA0E;AAC1E,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAI5B,CAAC;AACZ,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC"}
@@ -1,6 +1,27 @@
1
+ import { z } from "zod";
1
2
  export const FLOW_COVERAGE_STATUSES = [
2
3
  "pending",
3
4
  "partial",
4
5
  "complete",
5
6
  ];
7
+ export const FlowCoverageStatusSchema = z.enum(FLOW_COVERAGE_STATUSES);
8
+ /** Coverage for one critical flow across the lenses the audit expects to see. */
9
+ export const FlowCoverageRecordSchema = z
10
+ .object({
11
+ flow_id: z.string(),
12
+ paths: z.array(z.string()),
13
+ // Producer emits custom lens names too, so these stay free strings (the old
14
+ // JSON schema's canonical-lens $ref was over-strict).
15
+ required_lenses: z.array(z.string()),
16
+ completed_lenses: z.array(z.string()),
17
+ status: FlowCoverageStatusSchema,
18
+ notes: z.array(z.string()).optional(),
19
+ })
20
+ .strict();
21
+ /** Aggregated flow coverage written beside the critical flow manifest. */
22
+ export const FlowCoverageManifestSchema = z
23
+ .object({
24
+ flows: z.array(FlowCoverageRecordSchema),
25
+ })
26
+ .strict();
6
27
  //# sourceMappingURL=flowCoverage.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"flowCoverage.js","sourceRoot":"","sources":["../../../src/audit/types/flowCoverage.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,sBAAsB,GAAG;IACpC,SAAS;IACT,SAAS;IACT,UAAU;CACF,CAAC"}
1
+ {"version":3,"file":"flowCoverage.js","sourceRoot":"","sources":["../../../src/audit/types/flowCoverage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,CAAC,MAAM,sBAAsB,GAAG;IACpC,SAAS;IACT,SAAS;IACT,UAAU;CACF,CAAC;AACX,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC;AAGvE,iFAAiF;AACjF,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC;KACtC,MAAM,CAAC;IACN,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;IACnB,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;IAC1B,4EAA4E;IAC5E,sDAAsD;IACtD,eAAe,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;IACpC,gBAAgB,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;IACrC,MAAM,EAAE,wBAAwB;IAChC,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE;CACtC,CAAC;KACD,MAAM,EAAE,CAAC;AAGZ,0EAA0E;AAC1E,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC;KACxC,MAAM,CAAC;IACN,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,wBAAwB,CAAC;CACzC,CAAC;KACD,MAAM,EAAE,CAAC"}
@@ -127,6 +127,7 @@ export declare const ReviewPacketSchema: z.ZodObject<{
127
127
  }, "strip", z.ZodTypeAny, {
128
128
  unit_ids: string[];
129
129
  rationale: string;
130
+ lenses: string[];
130
131
  file_paths: string[];
131
132
  file_line_counts: Record<string, number>;
132
133
  priority: "high" | "low" | "medium";
@@ -134,7 +135,6 @@ export declare const ReviewPacketSchema: z.ZodObject<{
134
135
  packet_id: string;
135
136
  task_ids: string[];
136
137
  pass_ids: string[];
137
- lenses: string[];
138
138
  quality: {
139
139
  cohesion_score: number;
140
140
  internal_edge_count: number;
@@ -156,6 +156,7 @@ export declare const ReviewPacketSchema: z.ZodObject<{
156
156
  }, {
157
157
  unit_ids: string[];
158
158
  rationale: string;
159
+ lenses: string[];
159
160
  file_paths: string[];
160
161
  file_line_counts: Record<string, number>;
161
162
  priority: "high" | "low" | "medium";
@@ -163,7 +164,6 @@ export declare const ReviewPacketSchema: z.ZodObject<{
163
164
  packet_id: string;
164
165
  task_ids: string[];
165
166
  pass_ids: string[];
166
- lenses: string[];
167
167
  quality: {
168
168
  cohesion_score: number;
169
169
  internal_edge_count: number;
@@ -323,6 +323,7 @@ export declare const AuditTaskSchema: z.ZodObject<{
323
323
  pass_id: string;
324
324
  file_paths: string[];
325
325
  status?: "complete" | "pending" | undefined;
326
+ completed_at?: string | undefined;
326
327
  file_line_counts?: Record<string, number> | undefined;
327
328
  line_ranges?: {
328
329
  path: string;
@@ -334,7 +335,6 @@ export declare const AuditTaskSchema: z.ZodObject<{
334
335
  token_estimate?: number | undefined;
335
336
  risk_estimate?: number | undefined;
336
337
  tags?: string[] | undefined;
337
- completed_at?: string | undefined;
338
338
  completion_reason?: string | undefined;
339
339
  }, {
340
340
  unit_id: string;
@@ -344,6 +344,7 @@ export declare const AuditTaskSchema: z.ZodObject<{
344
344
  pass_id: string;
345
345
  file_paths: string[];
346
346
  status?: "complete" | "pending" | undefined;
347
+ completed_at?: string | undefined;
347
348
  file_line_counts?: Record<string, number> | undefined;
348
349
  line_ranges?: {
349
350
  path: string;
@@ -355,7 +356,6 @@ export declare const AuditTaskSchema: z.ZodObject<{
355
356
  token_estimate?: number | undefined;
356
357
  risk_estimate?: number | undefined;
357
358
  tags?: string[] | undefined;
358
- completed_at?: string | undefined;
359
359
  completion_reason?: string | undefined;
360
360
  }>;
361
361
  export type AuditTask = z.infer<typeof AuditTaskSchema>;
@@ -416,6 +416,7 @@ export declare const AuditVerificationSchema: z.ZodObject<{
416
416
  pass_id: string;
417
417
  file_paths: string[];
418
418
  status?: "complete" | "pending" | undefined;
419
+ completed_at?: string | undefined;
419
420
  file_line_counts?: Record<string, number> | undefined;
420
421
  line_ranges?: {
421
422
  path: string;
@@ -427,7 +428,6 @@ export declare const AuditVerificationSchema: z.ZodObject<{
427
428
  token_estimate?: number | undefined;
428
429
  risk_estimate?: number | undefined;
429
430
  tags?: string[] | undefined;
430
- completed_at?: string | undefined;
431
431
  completion_reason?: string | undefined;
432
432
  }, {
433
433
  unit_id: string;
@@ -437,6 +437,7 @@ export declare const AuditVerificationSchema: z.ZodObject<{
437
437
  pass_id: string;
438
438
  file_paths: string[];
439
439
  status?: "complete" | "pending" | undefined;
440
+ completed_at?: string | undefined;
440
441
  file_line_counts?: Record<string, number> | undefined;
441
442
  line_ranges?: {
442
443
  path: string;
@@ -448,7 +449,6 @@ export declare const AuditVerificationSchema: z.ZodObject<{
448
449
  token_estimate?: number | undefined;
449
450
  risk_estimate?: number | undefined;
450
451
  tags?: string[] | undefined;
451
- completed_at?: string | undefined;
452
452
  completion_reason?: string | undefined;
453
453
  }>, "many">>;
454
454
  }, "strip", z.ZodTypeAny, {
@@ -465,6 +465,7 @@ export declare const AuditVerificationSchema: z.ZodObject<{
465
465
  pass_id: string;
466
466
  file_paths: string[];
467
467
  status?: "complete" | "pending" | undefined;
468
+ completed_at?: string | undefined;
468
469
  file_line_counts?: Record<string, number> | undefined;
469
470
  line_ranges?: {
470
471
  path: string;
@@ -476,7 +477,6 @@ export declare const AuditVerificationSchema: z.ZodObject<{
476
477
  token_estimate?: number | undefined;
477
478
  risk_estimate?: number | undefined;
478
479
  tags?: string[] | undefined;
479
- completed_at?: string | undefined;
480
480
  completion_reason?: string | undefined;
481
481
  }[] | undefined;
482
482
  }, {
@@ -493,6 +493,7 @@ export declare const AuditVerificationSchema: z.ZodObject<{
493
493
  pass_id: string;
494
494
  file_paths: string[];
495
495
  status?: "complete" | "pending" | undefined;
496
+ completed_at?: string | undefined;
496
497
  file_line_counts?: Record<string, number> | undefined;
497
498
  line_ranges?: {
498
499
  path: string;
@@ -504,7 +505,6 @@ export declare const AuditVerificationSchema: z.ZodObject<{
504
505
  token_estimate?: number | undefined;
505
506
  risk_estimate?: number | undefined;
506
507
  tags?: string[] | undefined;
507
- completed_at?: string | undefined;
508
508
  completion_reason?: string | undefined;
509
509
  }[] | undefined;
510
510
  }>;
@@ -794,6 +794,7 @@ export declare const AuditResultSchema: z.ZodObject<{
794
794
  pass_id: string;
795
795
  file_paths: string[];
796
796
  status?: "complete" | "pending" | undefined;
797
+ completed_at?: string | undefined;
797
798
  file_line_counts?: Record<string, number> | undefined;
798
799
  line_ranges?: {
799
800
  path: string;
@@ -805,7 +806,6 @@ export declare const AuditResultSchema: z.ZodObject<{
805
806
  token_estimate?: number | undefined;
806
807
  risk_estimate?: number | undefined;
807
808
  tags?: string[] | undefined;
808
- completed_at?: string | undefined;
809
809
  completion_reason?: string | undefined;
810
810
  }, {
811
811
  unit_id: string;
@@ -815,6 +815,7 @@ export declare const AuditResultSchema: z.ZodObject<{
815
815
  pass_id: string;
816
816
  file_paths: string[];
817
817
  status?: "complete" | "pending" | undefined;
818
+ completed_at?: string | undefined;
818
819
  file_line_counts?: Record<string, number> | undefined;
819
820
  line_ranges?: {
820
821
  path: string;
@@ -826,7 +827,6 @@ export declare const AuditResultSchema: z.ZodObject<{
826
827
  token_estimate?: number | undefined;
827
828
  risk_estimate?: number | undefined;
828
829
  tags?: string[] | undefined;
829
- completed_at?: string | undefined;
830
830
  completion_reason?: string | undefined;
831
831
  }>, "many">>;
832
832
  }, "strip", z.ZodTypeAny, {
@@ -843,6 +843,7 @@ export declare const AuditResultSchema: z.ZodObject<{
843
843
  pass_id: string;
844
844
  file_paths: string[];
845
845
  status?: "complete" | "pending" | undefined;
846
+ completed_at?: string | undefined;
846
847
  file_line_counts?: Record<string, number> | undefined;
847
848
  line_ranges?: {
848
849
  path: string;
@@ -854,7 +855,6 @@ export declare const AuditResultSchema: z.ZodObject<{
854
855
  token_estimate?: number | undefined;
855
856
  risk_estimate?: number | undefined;
856
857
  tags?: string[] | undefined;
857
- completed_at?: string | undefined;
858
858
  completion_reason?: string | undefined;
859
859
  }[] | undefined;
860
860
  }, {
@@ -871,6 +871,7 @@ export declare const AuditResultSchema: z.ZodObject<{
871
871
  pass_id: string;
872
872
  file_paths: string[];
873
873
  status?: "complete" | "pending" | undefined;
874
+ completed_at?: string | undefined;
874
875
  file_line_counts?: Record<string, number> | undefined;
875
876
  line_ranges?: {
876
877
  path: string;
@@ -882,7 +883,6 @@ export declare const AuditResultSchema: z.ZodObject<{
882
883
  token_estimate?: number | undefined;
883
884
  risk_estimate?: number | undefined;
884
885
  tags?: string[] | undefined;
885
- completed_at?: string | undefined;
886
886
  completion_reason?: string | undefined;
887
887
  }[] | undefined;
888
888
  }>>;
@@ -960,6 +960,7 @@ export declare const AuditResultSchema: z.ZodObject<{
960
960
  pass_id: string;
961
961
  file_paths: string[];
962
962
  status?: "complete" | "pending" | undefined;
963
+ completed_at?: string | undefined;
963
964
  file_line_counts?: Record<string, number> | undefined;
964
965
  line_ranges?: {
965
966
  path: string;
@@ -971,7 +972,6 @@ export declare const AuditResultSchema: z.ZodObject<{
971
972
  token_estimate?: number | undefined;
972
973
  risk_estimate?: number | undefined;
973
974
  tags?: string[] | undefined;
974
- completed_at?: string | undefined;
975
975
  completion_reason?: string | undefined;
976
976
  }[] | undefined;
977
977
  } | undefined;
@@ -1052,6 +1052,7 @@ export declare const AuditResultSchema: z.ZodObject<{
1052
1052
  pass_id: string;
1053
1053
  file_paths: string[];
1054
1054
  status?: "complete" | "pending" | undefined;
1055
+ completed_at?: string | undefined;
1055
1056
  file_line_counts?: Record<string, number> | undefined;
1056
1057
  line_ranges?: {
1057
1058
  path: string;
@@ -1063,7 +1064,6 @@ export declare const AuditResultSchema: z.ZodObject<{
1063
1064
  token_estimate?: number | undefined;
1064
1065
  risk_estimate?: number | undefined;
1065
1066
  tags?: string[] | undefined;
1066
- completed_at?: string | undefined;
1067
1067
  completion_reason?: string | undefined;
1068
1068
  }[] | undefined;
1069
1069
  } | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"semanticProjection.d.ts","sourceRoot":"","sources":["../../../src/remediate/contractPipeline/semanticProjection.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,OAAO,EAAY,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AACzE,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,oBAAoB,CAAC;AAEvE,OAAO,EAAE,yBAAyB,EAAE,CAAC;AAiDrC;;;;;;;;;GASG;AACH,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,4BAA4B,EAClC,OAAO,EAAE,OAAO,GACf,OAAO,CAmBT;AAED;;;;;GAKG"}
1
+ {"version":3,"file":"semanticProjection.d.ts","sourceRoot":"","sources":["../../../src/remediate/contractPipeline/semanticProjection.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,OAAO,EAAY,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AACzE,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,oBAAoB,CAAC;AAEvE,OAAO,EAAE,yBAAyB,EAAE,CAAC;AAmErC;;;;;;;;;GASG;AACH,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,4BAA4B,EAClC,OAAO,EAAE,OAAO,GACf,OAAO,CAsBT;AAED;;;;;GAKG"}
@@ -63,6 +63,26 @@ function projectModuleContract(value) {
63
63
  }
64
64
  return out;
65
65
  }
66
+ /**
67
+ * Collapse cosmetic whitespace in every projected string (trim + runs → single
68
+ * space), recursively. A reflow / trailing-space / indentation edit to a contract
69
+ * field is not a semantic change, but without this it churns the projection hash
70
+ * and re-stales the downstream chain. Safe: the downstream gates/derivers match on
71
+ * word boundaries and substrings, which whitespace normalization never alters.
72
+ */
73
+ function normalizeWhitespaceDeep(value) {
74
+ if (typeof value === "string")
75
+ return value.replace(/\s+/g, " ").trim();
76
+ if (Array.isArray(value))
77
+ return value.map(normalizeWhitespaceDeep);
78
+ if (isRecord(value)) {
79
+ const out = {};
80
+ for (const [key, v] of Object.entries(value))
81
+ out[key] = normalizeWhitespaceDeep(v);
82
+ return out;
83
+ }
84
+ return value;
85
+ }
66
86
  /**
67
87
  * Project a contract-pipeline artifact payload to only its load-bearing
68
88
  * structure for downstream-staleness purposes. The universal provenance strip
@@ -77,21 +97,23 @@ export function semanticProjection(name, payload) {
77
97
  if (!isRecord(payload))
78
98
  return payload;
79
99
  const stripped = stripFields(payload, UNIVERSAL_NON_SEMANTIC_FIELDS);
80
- if (name === "finalized_module_contracts") {
81
- // Keep every top-level field (contract_version, goal_id, …) but narrow each
82
- // module entry to its derivable fields, so a reworded per-module rationale /
83
- // seam-prose edit projects identically while a changed interface / new
84
- // invariant does not. Narrowing entries (not the whole artifact) keeps the
85
- // projection conservative: any top-level field a downstream might read still
86
- // participates in staleness.
87
- if (!Array.isArray(stripped.module_contracts))
88
- return stripped;
89
- return {
90
- ...stripped,
91
- module_contracts: stripped.module_contracts.map(projectModuleContract),
92
- };
100
+ // Both the intermediate `module_contracts` and the `finalized_module_contracts`
101
+ // carry the same module-entry shape; narrow each entry to its derivable fields for
102
+ // BOTH so a reworded per-module rationale / a tweaked non-derivable array
103
+ // (side_effects / seam_adjustments / neighbor_needs) projects identically while a
104
+ // changed interface / new invariant does not. Keep every top-level field
105
+ // (contract_version, goal_id, …): the narrowing is per-entry, so any top-level
106
+ // field a downstream might read still participates in staleness.
107
+ if (name === "finalized_module_contracts" || name === "module_contracts") {
108
+ if (Array.isArray(stripped.module_contracts)) {
109
+ return normalizeWhitespaceDeep({
110
+ ...stripped,
111
+ module_contracts: stripped.module_contracts.map(projectModuleContract),
112
+ });
113
+ }
114
+ return normalizeWhitespaceDeep(stripped);
93
115
  }
94
- return stripped;
116
+ return normalizeWhitespaceDeep(stripped);
95
117
  }
96
118
  /**
97
119
  * The order-independent stable serialization used to hash a projection is the
@@ -1 +1 @@
1
- {"version":3,"file":"semanticProjection.js","sourceRoot":"","sources":["../../../src/remediate/contractPipeline/semanticProjection.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,OAAO,EAAE,QAAQ,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAGzE,OAAO,EAAE,yBAAyB,EAAE,CAAC;AAErC;;;;;;GAMG;AACH,MAAM,6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AC,gBAAgB,CAAC;YAAE,OAAO,QAAQ,CAAC;QAC/D,OAAO;YACL,GAAG,QAAQ;YACX,gBAAgB,EAAE,QAAQ,CAAC,gBAAgB,CAAC,GAAG,CAAC,qBAAqB,CAAC;SACvE,CAAC;IACJ,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED;;;;;GAKG"}
1
+ {"version":3,"file":"semanticProjection.js","sourceRoot":"","sources":["../../../src/remediate/contractPipeline/semanticProjection.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,OAAO,EAAE,QAAQ,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAGzE,OAAO,EAAE,yBAAyB,EAAE,CAAC;AAErC;;;;;;GAMG;AACH,MAAM,6BAA6B,GAAsB,CAAC,YAAY,EAAE,cAAc,CAAC,CAAC;AAExF;;;;;;;;;GASG;AACH,MAAM,gCAAgC,GAAsB;IAC1D,MAAM;IACN,QAAQ;IACR,SAAS;IACT,YAAY;IACZ,eAAe;IACf,qBAAqB;CACtB,CAAC;AAEF,SAAS,WAAW,CAClB,MAA+B,EAC/B,MAAyB;IAEzB,MAAM,IAAI,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,CAAC;IAC7B,OAAO,MAAM,CAAC,WAAW,CACvB,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CACzD,CAAC;AACJ,CAAC;AAED,SAAS,qBAAqB,CAAC,KAAc;IAC3C,MAAM,MAAM,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;IAC5C,MAAM,GAAG,GAA4B,EAAE,CAAC;IACxC,KAAK,MAAM,KAAK,IAAI,gCAAgC,EAAE,CAAC;QACrD,GAAG,CAAC,KAA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AAS,CAAC;IACzC,QAAQ,EAAE,oBAAoB,EAAE,CAAC;CAClC;AAyCD,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAI1D;AAkDD,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,gBAAgB,EACvB,OAAO,EAAE,mBAAmB,GAC3B,aAAa,CAuDf;AAwoBD,wBAAsB,aAAa,CACjC,KAAK,EAAE,gBAAgB,EACvB,OAAO,EAAE,mBAAmB,EAC5B,SAAS,CAAC,EAAE,SAAS,GACpB,OAAO,CAAC,gBAAgB,CAAC,CA6K3B"}
@@ -1,18 +1,17 @@
1
+ import { remediationBranchName, listQuarantinedCommits } from "../steps/dispatch.js";
1
2
  import { dirname, extname, isAbsolute, join } from "node:path";
2
3
  import { readFileSync, existsSync } from "node:fs";
3
- import { AGENT_FEEDBACK_FILENAME, parseReflectionsNdjson, readOptionalJsonFile, readOptionalTextFile, renderProcessFeedbackSection, stagedAndUntracked, writeJsonFile, writeTextFile, } from "audit-tools/shared";
4
+ import { AGENT_FEEDBACK_FILENAME, parseReflectionsNdjson, readOptionalJsonFile, readOptionalTextFile, renderProcessFeedbackSection, stagedAndUntracked, writeJsonFile, writeTextFile, RemediationOutcomeStatusSchema, } from "audit-tools/shared";
4
5
  import { CONTRACT_PIPELINE_VERIFICATION_REPORT_VERSION } from "audit-tools/shared";
5
6
  import { runCommand, runShellCommand } from "../utils/commands.js";
6
7
  import { FAILURE_OUTPUT_TAIL_CHARS } from "./constants.js";
7
8
  import { intakePaths } from "../intake.js";
8
9
  import { isAuditFindingsReport } from "./plan.js";
9
10
  import { dispositionToOutcomeStatus, isInProgressStatus, isSkipStatus, isVerifiedCompleteStatus, statusToDisposition, } from "../state/itemStatus.js";
11
+ // Derived from the single source so the key list can never drift from the
12
+ // RemediationOutcomeStatus contract (A6).
10
13
  const OUTCOME_KEYS = [
11
- "resolved",
12
- "verified_no_change",
13
- "inappropriate",
14
- "ignored",
15
- "blocked",
14
+ ...RemediationOutcomeStatusSchema.options,
16
15
  ];
17
16
  /** Retry-oriented final status per outcome (see RemediationOutcomeFinalStatus). */
18
17
  const FINAL_STATUS_BY_OUTCOME = {
@@ -554,8 +553,15 @@ function collectReportEntries(state, options) {
554
553
  * Render `remediation-report.md` from the partitioned entries, closing action,
555
554
  * e2e result, and per-finding outcomes. Pure string builder (no I/O).
556
555
  */
557
- function buildRemediationReportMarkdown(state, entries, closingResult, e2ePassed, outcomesReport, combinedTest, reflections = []) {
556
+ function buildRemediationReportMarkdown(state, entries, closingResult, e2ePassed, outcomesReport, combinedTest, reflections = [], quarantined = []) {
558
557
  let reportContent = `# Remediation Report\n\n`;
558
+ // Code changes land on a dedicated remediation branch (the base branch is never
559
+ // modified); surface it so the user can review and merge. Only meaningful when a
560
+ // node actually committed a change — a no-change/skip-only run leaves no commits.
561
+ if (entries.resolved.length > 0) {
562
+ const branch = remediationBranchName(state.plan?.plan_id ?? "");
563
+ reportContent += `## Review\n\nAll code changes were applied on the dedicated branch \`${branch}\` — your base branch was left untouched. Review the diff and merge \`${branch}\` into your base branch.\n\n`;
564
+ }
559
565
  reportContent += `## Resolved — Changed Files\n\n`;
560
566
  if (entries.resolved.length === 0) {
561
567
  reportContent += `None.\n`;
@@ -640,6 +646,13 @@ function buildRemediationReportMarkdown(state, entries, closingResult, e2ePassed
640
646
  if (combinedTest.output)
641
647
  reportContent += `\`\`\`\n${combinedTest.output}\n\`\`\`\n`;
642
648
  }
649
+ if (quarantined.length > 0) {
650
+ reportContent += `\n## Preserved for Recovery\n\n`;
651
+ reportContent += `${quarantined.length} node(s) committed real edits but failed the tool's verify/scope/merge and were NOT landed. Their work is preserved under durable git refs (it survives worktree cleanup) — review and recover manually if a fix was correct:\n\n`;
652
+ for (const q of quarantined) {
653
+ reportContent += `- **${q.block}**: \`git cherry-pick ${q.commit}\` (ref: \`${q.ref}\`)\n`;
654
+ }
655
+ }
643
656
  // Opt-in worker reflections, aggregated into the same "Process Feedback"
644
657
  // section audit-code renders (parity). Empty → no section.
645
658
  const feedbackLines = renderProcessFeedbackSection(reflections);
@@ -928,7 +941,13 @@ export async function runClosePhase(state, options, runLogger) {
928
941
  // dispatch; parse leniently (malformed lines skipped) and surface them in the
929
942
  // report. Workers own the file — it is read-only here.
930
943
  const feedbackText = await readOptionalTextFile(join(options.artifactsDir, AGENT_FEEDBACK_FILENAME));
931
- const reportContent = buildRemediationReportMarkdown(state, entries, closingResult, e2eResult.ran ? e2eResult.passed : undefined, outcomesReport, combinedTest, feedbackText ? parseReflectionsNdjson(feedbackText) : []);
944
+ // Failed-but-committed nodes whose work was preserved under a durable quarantine
945
+ // ref (a tool-verify false-negative must never destroy a good fix) — surface them
946
+ // so the user can recover the work manually.
947
+ const quarantined = options.root
948
+ ? listQuarantinedCommits(options.root, state.plan?.plan_id ?? "")
949
+ : [];
950
+ const reportContent = buildRemediationReportMarkdown(state, entries, closingResult, e2eResult.ran ? e2eResult.passed : undefined, outcomesReport, combinedTest, feedbackText ? parseReflectionsNdjson(feedbackText) : [], quarantined);
932
951
  // Enrich the coverage ledger with never-planned payloads NOW, from the live
933
952
  // state and intake artifacts — both are deleted at the end of close, so this
934
953
  // must happen strictly before cleanup.