opencode-swarm 7.136.5 → 7.137.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (103) hide show
  1. package/.opencode/skills/swarm-pr-review/SKILL.md +35 -3
  2. package/.opencode/skills/swarm-pr-review/references/prompt-templates.md +7 -3
  3. package/dist/agents/agent-output-schema.d.ts +2 -2
  4. package/dist/background/candidate-contract.d.ts +14 -0
  5. package/dist/cli/{config-doctor-n3hatm9d.js → config-doctor-b9r9rt2c.js} +2 -2
  6. package/dist/cli/{core-jpjk2qvt.js → core-6w5sd5bc.js} +1 -1
  7. package/dist/cli/{curation-policy-c4g08bg1.js → curation-policy-ftx2emfw.js} +7 -6
  8. package/dist/cli/{curator-jc5cc980.js → curator-1sxxtbq7.js} +25 -25
  9. package/dist/cli/{curator-llm-factory-atfnhbn6.js → curator-llm-factory-yhqbkc5w.js} +25 -25
  10. package/dist/cli/{evidence-summary-service-nse06dqr.js → evidence-summary-service-85gw9p2m.js} +7 -7
  11. package/dist/cli/{gate-evidence-kdygjr56.js → gate-evidence-s2kytsrj.js} +4 -4
  12. package/dist/cli/{guardrail-explain-v6f8efve.js → guardrail-explain-qh1y8jsz.js} +26 -26
  13. package/dist/cli/{guardrail-log-0mrq14g9.js → guardrail-log-84zffdv3.js} +3 -3
  14. package/dist/cli/{hive-promoter-wyejhz8b.js → hive-promoter-hpe29xrz.js} +25 -25
  15. package/dist/cli/{index-eeb35dnx.js → index-1qn2gchc.js} +3 -2
  16. package/dist/cli/{index-45y0y3xh.js → index-1zrb3vt2.js} +7 -7
  17. package/dist/cli/{index-d2sf9an1.js → index-5r6kkhd7.js} +4 -4
  18. package/dist/cli/{index-ne28wyyc.js → index-5wjw05dy.js} +2 -2
  19. package/dist/cli/{index-xvcctb2t.js → index-7e60c7ay.js} +27 -27
  20. package/dist/cli/{index-7t3vjw5e.js → index-877ah4kx.js} +1 -1
  21. package/dist/cli/{index-tncy55bp.js → index-8ehyt3rx.js} +1 -1
  22. package/dist/cli/{index-hbzh7yyz.js → index-9vqxf9pd.js} +633 -209
  23. package/dist/cli/{index-6kd0ezgd.js → index-a3gpeb4f.js} +2 -2
  24. package/dist/cli/{index-nfm9f10v.js → index-b2s3t517.js} +5 -3
  25. package/dist/cli/{index-8f4346kf.js → index-bxk0a1r9.js} +2 -2
  26. package/dist/cli/{index-pyz1p8qv.js → index-d67810xe.js} +1 -1
  27. package/dist/cli/{index-akc6rp3x.js → index-d8rc8c9y.js} +2 -2
  28. package/dist/cli/{index-hh34tyv7.js → index-dxatvs3f.js} +1 -1
  29. package/dist/cli/{index-bqan4y2y.js → index-e0nvge1c.js} +2 -2
  30. package/dist/cli/{index-f5qs217h.js → index-em10pmph.js} +1 -1
  31. package/dist/cli/{index-j7ja83v5.js → index-gd47gp2q.js} +1 -1
  32. package/dist/cli/{index-w6j1n5az.js → index-gv00q5gc.js} +1 -1
  33. package/dist/cli/index-h5sbn1zr.js +1670 -0
  34. package/dist/cli/{index-vm05set2.js → index-k8y41t4y.js} +4 -4
  35. package/dist/cli/{index-tr0ctbhq.js → index-m4s91910.js} +5 -5
  36. package/dist/cli/{index-b3jfcptk.js → index-n3h6rmbe.js} +1 -1
  37. package/dist/cli/{index-xp2pfbpq.js → index-pbe51g7h.js} +1 -1
  38. package/dist/cli/{index-kym0cctr.js → index-qy3rgmkc.js} +1 -1
  39. package/dist/cli/{index-d61h3f3h.js → index-s3j9fsab.js} +2 -2
  40. package/dist/cli/{index-qhbr4h5n.js → index-t2mv25yf.js} +6 -6
  41. package/dist/cli/{index-84se71v1.js → index-t5099rx9.js} +3 -3
  42. package/dist/cli/{index-zzhyws9g.js → index-vft1pg34.js} +1 -1
  43. package/dist/cli/{index-yj61bped.js → index-zxf5w0jj.js} +3 -3
  44. package/dist/cli/index.js +25 -25
  45. package/dist/cli/{knowledge-escalator-2xe8z24p.js → knowledge-escalator-3ds615yq.js} +8 -7
  46. package/dist/cli/{knowledge-events-wecrshsx.js → knowledge-events-3c0g2xbm.js} +6 -5
  47. package/dist/cli/{knowledge-link-zr40rnwr.js → knowledge-link-t94b79qe.js} +5 -4
  48. package/dist/cli/{knowledge-store-9f74whxw.js → knowledge-store-pq43990j.js} +6 -5
  49. package/dist/cli/{knowledge-validator-4ng7x9dr.js → knowledge-validator-gepda374.js} +9 -8
  50. package/dist/cli/{pending-delegations-0h5b18p7.js → pending-delegations-kshh66s2.js} +3 -3
  51. package/dist/cli/{pr-subscriptions-jn0h047q.js → pr-subscriptions-5fpzz4f3.js} +3 -3
  52. package/dist/cli/{runner-deeswadt.js → runner-9rqc8y3m.js} +5 -5
  53. package/dist/cli/{scan-cursor-yzj9n225.js → scan-cursor-5hq37qdg.js} +7 -6
  54. package/dist/cli/{schema-cr1nr1w0.js → schema-mrbyt7dg.js} +1 -1
  55. package/dist/cli/{scope-persistence-5xc9ntdh.js → scope-persistence-sjz200dt.js} +4 -4
  56. package/dist/cli/{skill-generator-ybncj9et.js → skill-generator-3gt8em6v.js} +10 -9
  57. package/dist/cli/{telemetry-6678gya0.js → telemetry-h7h7f0ez.js} +2 -1
  58. package/dist/cli/{worktree-collision-ownership-wt7cc850.js → worktree-collision-ownership-xzwab4xt.js} +3 -3
  59. package/dist/config/constants.d.ts +1 -1
  60. package/dist/config/evidence-schema.d.ts +103 -103
  61. package/dist/config/plan-schema.d.ts +10 -10
  62. package/dist/config/schema.d.ts +8 -8
  63. package/dist/consensus/contracts.d.ts +3 -3
  64. package/dist/evaluation/index.d.ts +1 -0
  65. package/dist/evaluation/model-dispatcher.d.ts +19 -1
  66. package/dist/evaluation/pr-review-recovery.d.ts +41 -0
  67. package/dist/evaluation/public-api.d.ts +2 -0
  68. package/dist/evaluation/runner.d.ts +9 -0
  69. package/dist/hooks/hive-promoter.d.ts +1 -1
  70. package/dist/hooks/pr-workflow-gate.d.ts +69 -0
  71. package/dist/index.d.ts +2 -0
  72. package/dist/index.js +225 -225
  73. package/dist/observability/catalog.d.ts +84 -0
  74. package/dist/observability/envelope.d.ts +401 -0
  75. package/dist/observability/ids.d.ts +97 -0
  76. package/dist/observability/index.d.ts +58 -0
  77. package/dist/observability/legacy.d.ts +68 -0
  78. package/dist/observability/observe.d.ts +112 -0
  79. package/dist/observability/otel-mapping.d.ts +48 -0
  80. package/dist/observability/relationships.d.ts +44 -0
  81. package/dist/observability/sampling.d.ts +77 -0
  82. package/dist/summaries/schema.d.ts +2 -2
  83. package/dist/telemetry.d.ts +4 -1
  84. package/dist/tools/dispatch-lanes.d.ts +1 -0
  85. package/evaluation-fixtures/pr-review-recovery/baseline/SKILL.md +1823 -0
  86. package/evaluation-fixtures/pr-review-recovery/baseline-manifest.json +1 -0
  87. package/evaluation-fixtures/pr-review-recovery/environment/score-recovery.cjs +135 -0
  88. package/evaluation-fixtures/pr-review-recovery/instruction.md +40 -0
  89. package/evaluation-fixtures/pr-review-recovery/scorer-fixtures/blind-full-wave-retry/model-output.json +1 -0
  90. package/evaluation-fixtures/pr-review-recovery/scorer-fixtures/contradictory/model-output.json +1 -0
  91. package/evaluation-fixtures/pr-review-recovery/scorer-fixtures/copied-contract/model-output.json +1 -0
  92. package/evaluation-fixtures/pr-review-recovery/scorer-fixtures/critical-without-harm/model-output.json +1 -0
  93. package/evaluation-fixtures/pr-review-recovery/scorer-fixtures/invented-harm/model-output.json +1 -0
  94. package/evaluation-fixtures/pr-review-recovery/scorer-fixtures/malformed/model-output.json +1 -0
  95. package/evaluation-fixtures/pr-review-recovery/scorer-fixtures/missing-reproduction/model-output.json +1 -0
  96. package/evaluation-fixtures/pr-review-recovery/scorer-fixtures/parser-only/model-output.json +1 -0
  97. package/evaluation-fixtures/pr-review-recovery/scorer-fixtures/passing/model-output.json +1 -0
  98. package/evaluation-fixtures/pr-review-recovery/scorer-fixtures/premature-systemic-claim/model-output.json +1 -0
  99. package/evaluation-fixtures/pr-review-recovery/scorer-fixtures/profile-b-fallback/model-output.json +1 -0
  100. package/evaluation-fixtures/pr-review-recovery/scorer-fixtures/underclaimed-harm/model-output.json +1 -0
  101. package/evaluation-fixtures/pr-review-recovery/scorer-fixtures/unsupported-severity/model-output.json +1 -0
  102. package/package.json +3 -2
  103. package/dist/cli/index-cze4bq1x.js +0 -358
@@ -9,9 +9,9 @@ export declare const ExecutionProfileSchema: z.ZodObject<{
9
9
  export type ExecutionProfile = z.infer<typeof ExecutionProfileSchema>;
10
10
  export declare const TaskStatusSchema: z.ZodEnum<{
11
11
  blocked: "blocked";
12
+ completed: "completed";
12
13
  pending: "pending";
13
14
  in_progress: "in_progress";
14
- completed: "completed";
15
15
  closed: "closed";
16
16
  }>;
17
17
  export type TaskStatus = z.infer<typeof TaskStatusSchema>;
@@ -23,11 +23,11 @@ export declare const TaskSizeSchema: z.ZodEnum<{
23
23
  export type TaskSize = z.infer<typeof TaskSizeSchema>;
24
24
  export declare const PhaseStatusSchema: z.ZodEnum<{
25
25
  blocked: "blocked";
26
+ complete: "complete";
27
+ completed: "completed";
26
28
  pending: "pending";
27
29
  in_progress: "in_progress";
28
- completed: "completed";
29
30
  closed: "closed";
30
- complete: "complete";
31
31
  }>;
32
32
  export type PhaseStatus = z.infer<typeof PhaseStatusSchema>;
33
33
  /**
@@ -53,9 +53,9 @@ export declare const TaskSchema: z.ZodObject<{
53
53
  phase: z.ZodNumber;
54
54
  status: z.ZodDefault<z.ZodEnum<{
55
55
  blocked: "blocked";
56
+ completed: "completed";
56
57
  pending: "pending";
57
58
  in_progress: "in_progress";
58
- completed: "completed";
59
59
  closed: "closed";
60
60
  }>>;
61
61
  size: z.ZodDefault<z.ZodEnum<{
@@ -77,20 +77,20 @@ export declare const PhaseSchema: z.ZodObject<{
77
77
  name: z.ZodString;
78
78
  status: z.ZodDefault<z.ZodEnum<{
79
79
  blocked: "blocked";
80
+ complete: "complete";
81
+ completed: "completed";
80
82
  pending: "pending";
81
83
  in_progress: "in_progress";
82
- completed: "completed";
83
84
  closed: "closed";
84
- complete: "complete";
85
85
  }>>;
86
86
  tasks: z.ZodDefault<z.ZodArray<z.ZodObject<{
87
87
  id: z.ZodString;
88
88
  phase: z.ZodNumber;
89
89
  status: z.ZodDefault<z.ZodEnum<{
90
90
  blocked: "blocked";
91
+ completed: "completed";
91
92
  pending: "pending";
92
93
  in_progress: "in_progress";
93
- completed: "completed";
94
94
  closed: "closed";
95
95
  }>>;
96
96
  size: z.ZodDefault<z.ZodEnum<{
@@ -123,20 +123,20 @@ export declare const PlanSchema: z.ZodObject<{
123
123
  name: z.ZodString;
124
124
  status: z.ZodDefault<z.ZodEnum<{
125
125
  blocked: "blocked";
126
+ complete: "complete";
127
+ completed: "completed";
126
128
  pending: "pending";
127
129
  in_progress: "in_progress";
128
- completed: "completed";
129
130
  closed: "closed";
130
- complete: "complete";
131
131
  }>>;
132
132
  tasks: z.ZodDefault<z.ZodArray<z.ZodObject<{
133
133
  id: z.ZodString;
134
134
  phase: z.ZodNumber;
135
135
  status: z.ZodDefault<z.ZodEnum<{
136
136
  blocked: "blocked";
137
+ completed: "completed";
137
138
  pending: "pending";
138
139
  in_progress: "in_progress";
139
- completed: "completed";
140
140
  closed: "closed";
141
141
  }>>;
142
142
  size: z.ZodDefault<z.ZodEnum<{
@@ -670,9 +670,9 @@ export declare const KnowledgeConfigSchema: z.ZodObject<{
670
670
  todo_max_phases: z.ZodDefault<z.ZodNumber>;
671
671
  sweep_enabled: z.ZodDefault<z.ZodBoolean>;
672
672
  confidence_floor_action: z.ZodDefault<z.ZodEnum<{
673
+ none: "none";
673
674
  quarantine: "quarantine";
674
675
  demote: "demote";
675
- none: "none";
676
676
  }>>;
677
677
  confidence_floor_min_outcomes: z.ZodDefault<z.ZodNumber>;
678
678
  confidence_floor_signal_threshold: z.ZodDefault<z.ZodNumber>;
@@ -962,10 +962,10 @@ export declare const SkillImproverConfigSchema: z.ZodObject<{
962
962
  consolidation_interval_hours: z.ZodDefault<z.ZodNumber>;
963
963
  consolidation_max_calls_per_run: z.ZodDefault<z.ZodNumber>;
964
964
  targets: z.ZodDefault<z.ZodArray<z.ZodEnum<{
965
+ knowledge: "knowledge";
965
966
  skills: "skills";
966
967
  spec: "spec";
967
968
  architect_prompt: "architect_prompt";
968
- knowledge: "knowledge";
969
969
  }>>>;
970
970
  write_mode: z.ZodDefault<z.ZodEnum<{
971
971
  proposal: "proposal";
@@ -1543,11 +1543,11 @@ export declare const ExternalSkillCandidateSourceTypeSchema: z.ZodEnum<{
1543
1543
  export type ExternalSkillCandidateSourceType = z.infer<typeof ExternalSkillCandidateSourceTypeSchema>;
1544
1544
  /** Evaluation verdict for an external skill candidate. */
1545
1545
  export declare const ExternalSkillCandidateEvaluationVerdictSchema: z.ZodEnum<{
1546
+ passed: "passed";
1546
1547
  pending: "pending";
1547
1548
  promoted: "promoted";
1548
1549
  quarantined: "quarantined";
1549
1550
  in_review: "in_review";
1550
- passed: "passed";
1551
1551
  rejected: "rejected";
1552
1552
  revoked: "revoked";
1553
1553
  }>;
@@ -1590,21 +1590,21 @@ export declare const ExternalSkillCandidateSchema: z.ZodObject<{
1590
1590
  skill_body: z.ZodString;
1591
1591
  risk_flags: z.ZodDefault<z.ZodArray<z.ZodString>>;
1592
1592
  evaluation_verdict: z.ZodDefault<z.ZodEnum<{
1593
+ passed: "passed";
1593
1594
  pending: "pending";
1594
1595
  promoted: "promoted";
1595
1596
  quarantined: "quarantined";
1596
1597
  in_review: "in_review";
1597
- passed: "passed";
1598
1598
  rejected: "rejected";
1599
1599
  revoked: "revoked";
1600
1600
  }>>;
1601
1601
  evaluation_history: z.ZodDefault<z.ZodArray<z.ZodObject<{
1602
1602
  verdict: z.ZodEnum<{
1603
+ passed: "passed";
1603
1604
  pending: "pending";
1604
1605
  promoted: "promoted";
1605
1606
  quarantined: "quarantined";
1606
1607
  in_review: "in_review";
1607
- passed: "passed";
1608
1608
  rejected: "rejected";
1609
1609
  revoked: "revoked";
1610
1610
  }>;
@@ -1613,11 +1613,11 @@ export declare const ExternalSkillCandidateSchema: z.ZodObject<{
1613
1613
  reason: z.ZodOptional<z.ZodString>;
1614
1614
  candidate_id: z.ZodOptional<z.ZodString>;
1615
1615
  original_verdict: z.ZodOptional<z.ZodEnum<{
1616
+ passed: "passed";
1616
1617
  pending: "pending";
1617
1618
  promoted: "promoted";
1618
1619
  quarantined: "quarantined";
1619
1620
  in_review: "in_review";
1620
- passed: "passed";
1621
1621
  rejected: "rejected";
1622
1622
  revoked: "revoked";
1623
1623
  }>>;
@@ -2115,9 +2115,9 @@ export declare const PluginConfigSchema: z.ZodObject<{
2115
2115
  todo_max_phases: z.ZodDefault<z.ZodNumber>;
2116
2116
  sweep_enabled: z.ZodDefault<z.ZodBoolean>;
2117
2117
  confidence_floor_action: z.ZodDefault<z.ZodEnum<{
2118
+ none: "none";
2118
2119
  quarantine: "quarantine";
2119
2120
  demote: "demote";
2120
- none: "none";
2121
2121
  }>>;
2122
2122
  confidence_floor_min_outcomes: z.ZodDefault<z.ZodNumber>;
2123
2123
  confidence_floor_signal_threshold: z.ZodDefault<z.ZodNumber>;
@@ -2368,10 +2368,10 @@ export declare const PluginConfigSchema: z.ZodObject<{
2368
2368
  consolidation_interval_hours: z.ZodDefault<z.ZodNumber>;
2369
2369
  consolidation_max_calls_per_run: z.ZodDefault<z.ZodNumber>;
2370
2370
  targets: z.ZodDefault<z.ZodArray<z.ZodEnum<{
2371
+ knowledge: "knowledge";
2371
2372
  skills: "skills";
2372
2373
  spec: "spec";
2373
2374
  architect_prompt: "architect_prompt";
2374
- knowledge: "knowledge";
2375
2375
  }>>>;
2376
2376
  write_mode: z.ZodDefault<z.ZodEnum<{
2377
2377
  proposal: "proposal";
@@ -66,8 +66,8 @@ export declare const ConsensusMineRequestSchema: z.ZodObject<{
66
66
  }, z.core.$strict>;
67
67
  /** Where a mined attribute would be actioned, if it qualifies as a proposal. */
68
68
  declare const ConsensusProposedTargetSchema: z.ZodEnum<{
69
- tooling: "tooling";
70
69
  none: "none";
70
+ tooling: "tooling";
71
71
  orchestration: "orchestration";
72
72
  prompt: "prompt";
73
73
  skill: "skill";
@@ -149,8 +149,8 @@ export declare const ConsensusAttributeV1Schema: z.ZodObject<{
149
149
  counterexampleRefs: z.ZodArray<z.ZodString>;
150
150
  confidence: z.ZodNumber;
151
151
  proposedTarget: z.ZodEnum<{
152
- tooling: "tooling";
153
152
  none: "none";
153
+ tooling: "tooling";
154
154
  orchestration: "orchestration";
155
155
  prompt: "prompt";
156
156
  skill: "skill";
@@ -388,8 +388,8 @@ export declare const ConsensusReportV1Schema: z.ZodObject<{
388
388
  counterexampleRefs: z.ZodArray<z.ZodString>;
389
389
  confidence: z.ZodNumber;
390
390
  proposedTarget: z.ZodEnum<{
391
- tooling: "tooling";
392
391
  none: "none";
392
+ tooling: "tooling";
393
393
  orchestration: "orchestration";
394
394
  prompt: "prompt";
395
395
  skill: "skill";
@@ -9,6 +9,7 @@ export type { TaskInputHashLimits } from './hashing.js';
9
9
  export { canonicalHash, canonicalJson, computeCandidateInputContentHash, computeManifestContentHash, computeRunIntegrityHash, computeTaskContentHash, computeTaskInputContentHash, computeTaskLineageInputHash, computeTaskSetContentHash, contentHashWithout, resolveContainedExistingPath, sha256, } from './hashing.js';
10
10
  export type { EvaluationModelDispatcher, EvaluationModelDispatchRequest, EvaluationModelDispatchResult, } from './model-dispatcher.js';
11
11
  export { createEvaluationModelDispatcher, resolveEvaluationAgentName, } from './model-dispatcher.js';
12
+ export * from './pr-review-recovery.js';
12
13
  export * from './public-api.js';
13
14
  export * from './retention.js';
14
15
  export type { EvaluationExecutor, EvaluationExecutorResult, RunEvaluationOptions, } from './runner.js';
@@ -2,7 +2,25 @@ import type { Agent, OpencodeClient } from '@opencode-ai/sdk';
2
2
  import type { DelegationCostFields } from '../services/cost-accounting.js';
3
3
  import { _internals as ephemeralDispatcherInternals } from './ephemeral-agent-dispatcher.js';
4
4
  export type EvaluationModelDispatchRequest = {
5
- directory: string;
5
+ /**
6
+ * The directory the ephemeral session is created against.
7
+ *
8
+ * This is the directory OpenCode uses to key permission state
9
+ * (`Permission.state`, `Agent.state`, `ToolRegistry.state` are all built
10
+ * through the directory-keyed `InstanceState` cache) AND to resolve
11
+ * registered agents. It MUST be the invoking instance's directory (the
12
+ * project root) so the session lands in the SAME permission partition as
13
+ * the user's session — a foreign directory gets a fresh, empty `approved`
14
+ * list and a private pending map that the user's TUI cannot reach, so an
15
+ * `external_directory` prompt raised there hangs forever.
16
+ *
17
+ * The SDK's `session.create` has no separate working-directory field, so
18
+ * this is also the agent's CWD. When the fixture the agent must inspect is
19
+ * NOT under this directory, the caller conveys the fixture path via the
20
+ * prompt (see gate-audit.ts `modelPrompt` and runner.ts
21
+ * `createModelEvaluationExecutor`).
22
+ */
23
+ sessionDirectory: string;
6
24
  agentName: string;
7
25
  modelId: string;
8
26
  prompt: string;
@@ -0,0 +1,41 @@
1
+ import type { EvaluationRunV1 } from './contracts.js';
2
+ import type { EvaluationModelDispatcher } from './model-dispatcher.js';
3
+ export declare const PR_REVIEW_RECOVERY_BASE_SHA: "3811fe5981072c7fa541523e9f08430f18594590";
4
+ type RecoveryBudgets = {
5
+ maxTasks: number;
6
+ maxRepetitions: number;
7
+ maxConcurrency: number;
8
+ maxTaskTimeMs: number;
9
+ maxRetries: number;
10
+ maxOutputBytes: number;
11
+ maxSpendUsd?: number;
12
+ };
13
+ export type EvaluatePrReviewRecoveryV1Options = {
14
+ projectRoot: string;
15
+ packageRoot?: string;
16
+ dispatcher: EvaluationModelDispatcher;
17
+ parentSessionId?: string;
18
+ model?: string;
19
+ seed?: string;
20
+ baselineSourceSha?: string;
21
+ budgets?: Partial<RecoveryBudgets>;
22
+ abortSignal?: AbortSignal;
23
+ };
24
+ type BaselineManifest = {
25
+ v: 1;
26
+ sourceSha: string;
27
+ payloadPath: string;
28
+ sha256: string;
29
+ };
30
+ declare function parseBaselineManifest(value: unknown): BaselineManifest;
31
+ declare function verifyBaseline(packageRoot: string, requestedSourceSha: string): Promise<void>;
32
+ /**
33
+ * Runs the packaged issue-2075 recovery scenario against the exact canonical
34
+ * PR-review skill and its content-addressed pre-hardening baseline.
35
+ */
36
+ export declare function evaluatePrReviewRecoveryV1(options: EvaluatePrReviewRecoveryV1Options): Promise<EvaluationRunV1>;
37
+ export declare const _internals: {
38
+ parseBaselineManifest: typeof parseBaselineManifest;
39
+ verifyBaseline: typeof verifyBaseline;
40
+ };
41
+ export {};
@@ -1,6 +1,7 @@
1
1
  import type { EvaluationRunV1, PromotionDecisionV1, PromotionPolicyV1 } from './contracts.js';
2
2
  import { recordTestImpactGateGroundTruth } from './gate-ground-truth.js';
3
3
  import { computeCandidateInputContentHash, computeTaskInputContentHash } from './hashing.js';
4
+ import { evaluatePrReviewRecoveryV1 } from './pr-review-recovery.js';
4
5
  import { type RunEvaluationOptions, runEvaluation } from './runner.js';
5
6
  import { type DecidePromotionInput } from './statistics.js';
6
7
  export type EvaluateCandidateV1Options = RunEvaluationOptions & {
@@ -25,6 +26,7 @@ export declare function evaluateCandidateV1(options: EvaluateCandidateV1Options)
25
26
  */
26
27
  export declare const evaluationV1: ((options: EvaluateCandidateV1Options) => Promise<EvaluateCandidateV1Result>) & {
27
28
  evaluateCandidate: typeof evaluateCandidateV1;
29
+ evaluatePrReviewRecovery: typeof evaluatePrReviewRecoveryV1;
28
30
  runEvaluation: typeof runEvaluation;
29
31
  decidePromotion: (input: DecidePromotionInput) => {
30
32
  v: 1;
@@ -19,6 +19,15 @@ export type EvaluationExecutor = (args: {
19
19
  payload: string;
20
20
  seed: string;
21
21
  abortSignal: AbortSignal;
22
+ /**
23
+ * The invoking instance's directory (the project root). An executor that
24
+ * creates an OpenCode session MUST bind it here — NOT to `isolatedRoot` —
25
+ * so the session lands in the same permission partition as the user's
26
+ * session (#2009). OpenCode keys permission state per directory; a foreign
27
+ * directory gets an empty approved list and a private pending map the TUI
28
+ * cannot reach, so a prompt raised there hangs forever.
29
+ */
30
+ projectRoot: string;
22
31
  }) => Promise<EvaluationExecutorResult>;
23
32
  export type RunEvaluationOptions = {
24
33
  projectRoot: string;
@@ -116,7 +116,7 @@ export declare const _internals: {
116
116
  default_max_phases: number;
117
117
  todo_max_phases: number;
118
118
  sweep_enabled: boolean;
119
- confidence_floor_action: "quarantine" | "demote" | "none";
119
+ confidence_floor_action: "none" | "quarantine" | "demote";
120
120
  confidence_floor_min_outcomes: number;
121
121
  confidence_floor_signal_threshold: number;
122
122
  contradiction_threshold_action: "quarantine" | "tag_only";
@@ -1,4 +1,6 @@
1
1
  import * as fsp from 'node:fs/promises';
2
+ import { type LaneOutputArtifact } from '../background/lane-output-store.js';
3
+ import { type BackgroundDelegationRecord, type BackgroundDelegationResult, findByBatchId } from '../background/pending-delegations.js';
2
4
  import { type PrReviewInlineTriggerRow } from '../background/pr-review-trigger-contract.js';
3
5
  import { type RevisionDigestResult, resolveCommitCountSince, resolveCommitCountSinceAsync, resolveCurrentGitHead, resolveCurrentGitHeadAsync, resolveCurrentUpstreamPushTarget, resolveCurrentUpstreamPushTargetAsync, resolveCurrentUpstreamRemoteRef, resolveExactRemoteBranchHead, resolveExactRemoteBranchHeadAsync, resolveIsExactSingleChildCommit, resolveIsExactSingleChildCommitAsync, resolveIsWorkingTreeClean, resolveIsWorkingTreeCleanAsync, resolvePrReviewDiffStats, resolvePrReviewDiffStatsAsync, resolvePrWorkflowRevisionDigest, resolvePrWorkflowRevisionDigestDetailed, resolveRemoteRefsContainingHead, resolveRemoteRefsContainingHeadAsync } from '../background/workspace-snapshot.js';
4
6
  import { type PrWorkflowGitState } from '../git/pr-workflow-state.js';
@@ -6,6 +8,33 @@ export declare const PR_REVIEW_BASE_DIMENSION_IDS: readonly ["intent-architectur
6
8
  export declare const PR_REVIEW_REQUIRED_MICRO_LANE_IDS: ("auth-identity-secrets" | "untrusted-input-boundaries" | "subprocess-platform" | "concurrency-state" | "dependencies-build-release" | "api-schema-migrations" | "test-infrastructure" | "ui-accessibility-i18n" | "privacy-observability" | "generated-provenance" | "unclassified-risk")[];
7
9
  export type PrReviewBaseDimensionId = (typeof PR_REVIEW_BASE_DIMENSION_IDS)[number];
8
10
  export type PrWorkflowMode = 'PR_REVIEW' | 'PR_FEEDBACK';
11
+ export type PrReviewLaneValidationPredicate = 'batch.validated_at' | 'batch.expected_lane_unique' | 'record.missing' | 'record.duplicate_lane' | 'record.subagent_session_id' | 'record.duplicate_subagent_session_id' | 'record.forbidden_subagent_session_id' | 'record.created_at' | 'record.workflow_lane' | 'record.owned_workflow_lanes' | 'record.mode' | 'record.pr_head_sha' | 'record.git_head' | 'record.status' | 'result.output_degraded' | 'result.transcript_incomplete' | 'result.truncated' | 'result.chars' | 'result.digest' | 'result.output_ref' | 'artifact.readable' | 'artifact.ref' | 'artifact.batch_id' | 'artifact.lane_id' | 'artifact.mode' | 'artifact.session_id' | 'artifact.parent_session_id' | 'artifact.agent' | 'artifact.role' | 'artifact.source' | 'artifact.workflow_lane_record' | 'artifact.workflow_lane_expected' | 'artifact.pr_head_sha' | 'artifact.git_head' | 'artifact.revision_digest' | 'record.scope' | 'artifact.scope' | 'artifact.digest' | 'artifact.chars' | 'discovery.header' | 'discovery.row' | 'discovery.coverage' | 'discovery.duplicate_evidence';
12
+ export interface PrReviewLaneValidationFailure {
13
+ predicate: PrReviewLaneValidationPredicate;
14
+ expected: string;
15
+ actual: string;
16
+ }
17
+ export type PrReviewLaneValidationResult = {
18
+ ok: true;
19
+ } | {
20
+ ok: false;
21
+ failure: PrReviewLaneValidationFailure;
22
+ };
23
+ export interface PrReviewDiscoveryLaneValidationInput {
24
+ record: BackgroundDelegationRecord;
25
+ result: BackgroundDelegationResult;
26
+ artifact: LaneOutputArtifact | null;
27
+ expected: {
28
+ mode: 'swarm-pr-review:base' | 'swarm-pr-review:micro';
29
+ workflowLane: string;
30
+ ownedWorkflowLanes?: readonly string[];
31
+ prHeadSha: string;
32
+ gitHead: string;
33
+ revisionDigest: string;
34
+ reviewScope?: string;
35
+ checkWorkflowLane?: boolean;
36
+ };
37
+ }
9
38
  export interface PrWorkflowCheckoutRecoveryRecord {
10
39
  code: 'UNMERGED_INDEX' | 'GIT_OPERATION_IN_PROGRESS' | 'DIRTY_SUBMODULE' | 'SWARM_STATE_TRACKING_ERROR' | 'GIT_STATE_INDETERMINATE';
11
40
  retryable: false;
@@ -460,6 +489,7 @@ export declare function enforcePrWorkflowToolBefore(directory: string, sessionID
460
489
  export declare function completePrWorkflow(directory: string, sessionID: string, expectedMode: PrWorkflowMode, prHeadSha: string): Promise<PrWorkflowCompletionStatus>;
461
490
  export declare const _test_exports: {
462
491
  minimumConsolidatedLaneCover: typeof minimumConsolidatedLaneCover;
492
+ analyzePrReviewBatchRecordIntegrity: typeof analyzePrReviewBatchRecordIntegrity;
463
493
  MAX_COVER_UNIVERSE_BITS: number;
464
494
  workflowGateStateRelativePath: typeof workflowGateStateRelativePath;
465
495
  workflowGateStateLockRelativePath: typeof workflowGateStateLockRelativePath;
@@ -678,6 +708,45 @@ interface PrReviewPhaseComposition {
678
708
  * already computed: no digest resolution, no artifact reads, no subprocess work.
679
709
  */
680
710
  declare function assertSettledPhaseHasAuthoritativeVerdicts(phase: PrReviewComposablePhase, composed: Pick<PrReviewPhaseComposition, 'requiredInventory' | 'unclaimed'>, authoritative: ReadonlyMap<string, unknown>, origin: string): void;
711
+ interface ExpectedWorkflowLane {
712
+ laneId: string;
713
+ workflowLane: string;
714
+ reviewItemIds?: string[];
715
+ ownedWorkflowLanes?: string[];
716
+ }
717
+ interface QualifiedBatchRecord {
718
+ record: ReturnType<typeof findByBatchId>[number];
719
+ expectedLane: ExpectedWorkflowLane;
720
+ expectedWorkflowLane: string;
721
+ expectedOwnedLanes: string[];
722
+ }
723
+ type BatchRecordIntegrityAnalysis = ({
724
+ ok: true;
725
+ } & QualifiedBatchRecord) | {
726
+ ok: false;
727
+ expectedLane: ExpectedWorkflowLane;
728
+ expectedWorkflowLane: string;
729
+ expectedOwnedLanes: string[];
730
+ failure: PrReviewLaneValidationFailure;
731
+ };
732
+ export declare function formatPrReviewLaneValidationFailure(failure: PrReviewLaneValidationFailure): string;
733
+ declare function analyzePrReviewBatchRecordIntegrity(args: {
734
+ batchId: string;
735
+ expectedLanes: ReadonlyArray<ExpectedWorkflowLane>;
736
+ expectedMode: string;
737
+ validatedAt: string;
738
+ checkWorkflowLane: boolean;
739
+ forbiddenSubagentSessionIds: ReadonlySet<string>;
740
+ records: readonly BackgroundDelegationRecord[];
741
+ expectedPrHeadSha?: string;
742
+ }): BatchRecordIntegrityAnalysis[];
743
+ /**
744
+ * Validate a just-collected base/micro discovery result before the delegation
745
+ * ledger publishes it as completed. The caller supplies the prospective result
746
+ * and the exact stored artifact, so this pure validator cannot accidentally
747
+ * accept stale terminal state or a different output reference.
748
+ */
749
+ export declare function validatePrReviewDiscoveryLaneCompletion(input: PrReviewDiscoveryLaneValidationInput): PrReviewLaneValidationResult;
681
750
  /** Require at least one semantically valid discovery row or CLEAN attestation. */
682
751
  export declare function prReviewDiscoveryArtifactCoversLane(text: string, expectedWorkflowLane: string, ownedWorkflowLanes?: readonly string[]): boolean;
683
752
  declare function parseCriticVerdict(text: string, itemId: string, reviewerSeverity?: string): {
package/dist/index.d.ts CHANGED
@@ -50,5 +50,7 @@ export type { AgentDefinition } from './agents';
50
50
  export type { AgentName, AutomationCapabilities, AutomationConfig, AutomationMode, PipelineAgentName, PluginConfig, QAAgentName, } from './config';
51
51
  export { loadTier1EvaluationTasks } from './evaluation/fixtures.js';
52
52
  export { recordTestImpactGateGroundTruth } from './evaluation/gate-ground-truth.js';
53
+ export type { EvaluatePrReviewRecoveryV1Options } from './evaluation/pr-review-recovery.js';
54
+ export { evaluatePrReviewRecoveryV1 } from './evaluation/pr-review-recovery.js';
53
55
  export type { EvaluateCandidateV1Options, EvaluateCandidateV1Result, } from './evaluation/public-api.js';
54
56
  export { evaluateCandidateV1, evaluationV1, } from './evaluation/public-api.js';