opencode-swarm 7.137.0 → 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 (63) 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/background/candidate-contract.d.ts +14 -0
  4. package/dist/cli/{config-doctor-vyx82nx2.js → config-doctor-b9r9rt2c.js} +2 -2
  5. package/dist/cli/{curation-policy-8tvs4pa0.js → curation-policy-ftx2emfw.js} +2 -2
  6. package/dist/cli/{curator-43xqs75k.js → curator-1sxxtbq7.js} +13 -13
  7. package/dist/cli/{curator-llm-factory-8nywfdsh.js → curator-llm-factory-yhqbkc5w.js} +13 -13
  8. package/dist/cli/{guardrail-explain-8kkqz8tx.js → guardrail-explain-qh1y8jsz.js} +14 -14
  9. package/dist/cli/{guardrail-log-e2v9qw71.js → guardrail-log-84zffdv3.js} +3 -3
  10. package/dist/cli/{hive-promoter-jt9ky0hn.js → hive-promoter-hpe29xrz.js} +13 -13
  11. package/dist/cli/{index-mwdzkr6k.js → index-1qn2gchc.js} +1 -1
  12. package/dist/cli/{index-j2ghsdzz.js → index-7e60c7ay.js} +15 -15
  13. package/dist/cli/{index-92v63zzr.js → index-9vqxf9pd.js} +616 -192
  14. package/dist/cli/{index-mg26zd8x.js → index-a3gpeb4f.js} +1 -1
  15. package/dist/cli/{index-k3mezk96.js → index-b2s3t517.js} +4 -2
  16. package/dist/cli/{index-wg98bsxz.js → index-bxk0a1r9.js} +1 -1
  17. package/dist/cli/{index-pcwjz5de.js → index-d67810xe.js} +1 -1
  18. package/dist/cli/{index-d0nhz96c.js → index-d8rc8c9y.js} +2 -2
  19. package/dist/cli/{index-aze9n64z.js → index-e0nvge1c.js} +2 -2
  20. package/dist/cli/{index-j6ewv2pe.js → index-em10pmph.js} +1 -1
  21. package/dist/cli/{index-91kk2e9j.js → index-gd47gp2q.js} +1 -1
  22. package/dist/cli/{index-p124rnwb.js → index-k8y41t4y.js} +2 -2
  23. package/dist/cli/{index-d00q9kpq.js → index-m4s91910.js} +5 -5
  24. package/dist/cli/{index-y25nsyaq.js → index-pbe51g7h.js} +1 -1
  25. package/dist/cli/{index-fgkhpdc6.js → index-t2mv25yf.js} +4 -4
  26. package/dist/cli/{index-72wzb81c.js → index-t5099rx9.js} +1 -1
  27. package/dist/cli/{index-f24r6yqk.js → index-zxf5w0jj.js} +3 -3
  28. package/dist/cli/index.js +13 -13
  29. package/dist/cli/{knowledge-escalator-9k0kbx6b.js → knowledge-escalator-3ds615yq.js} +3 -3
  30. package/dist/cli/{knowledge-events-8nz3sa2d.js → knowledge-events-3c0g2xbm.js} +1 -1
  31. package/dist/cli/{knowledge-store-esghe3f9.js → knowledge-store-pq43990j.js} +1 -1
  32. package/dist/cli/{knowledge-validator-bjxag1jp.js → knowledge-validator-gepda374.js} +4 -4
  33. package/dist/cli/{runner-d820ws7y.js → runner-9rqc8y3m.js} +1 -1
  34. package/dist/cli/{scan-cursor-t212v00f.js → scan-cursor-5hq37qdg.js} +2 -2
  35. package/dist/cli/{schema-11gyrec3.js → schema-mrbyt7dg.js} +1 -1
  36. package/dist/cli/{skill-generator-a07hpmw6.js → skill-generator-3gt8em6v.js} +5 -5
  37. package/dist/evaluation/index.d.ts +1 -0
  38. package/dist/evaluation/model-dispatcher.d.ts +19 -1
  39. package/dist/evaluation/pr-review-recovery.d.ts +41 -0
  40. package/dist/evaluation/public-api.d.ts +2 -0
  41. package/dist/evaluation/runner.d.ts +9 -0
  42. package/dist/hooks/pr-workflow-gate.d.ts +69 -0
  43. package/dist/index.d.ts +2 -0
  44. package/dist/index.js +173 -173
  45. package/dist/tools/dispatch-lanes.d.ts +1 -0
  46. package/evaluation-fixtures/pr-review-recovery/baseline/SKILL.md +1823 -0
  47. package/evaluation-fixtures/pr-review-recovery/baseline-manifest.json +1 -0
  48. package/evaluation-fixtures/pr-review-recovery/environment/score-recovery.cjs +135 -0
  49. package/evaluation-fixtures/pr-review-recovery/instruction.md +40 -0
  50. package/evaluation-fixtures/pr-review-recovery/scorer-fixtures/blind-full-wave-retry/model-output.json +1 -0
  51. package/evaluation-fixtures/pr-review-recovery/scorer-fixtures/contradictory/model-output.json +1 -0
  52. package/evaluation-fixtures/pr-review-recovery/scorer-fixtures/copied-contract/model-output.json +1 -0
  53. package/evaluation-fixtures/pr-review-recovery/scorer-fixtures/critical-without-harm/model-output.json +1 -0
  54. package/evaluation-fixtures/pr-review-recovery/scorer-fixtures/invented-harm/model-output.json +1 -0
  55. package/evaluation-fixtures/pr-review-recovery/scorer-fixtures/malformed/model-output.json +1 -0
  56. package/evaluation-fixtures/pr-review-recovery/scorer-fixtures/missing-reproduction/model-output.json +1 -0
  57. package/evaluation-fixtures/pr-review-recovery/scorer-fixtures/parser-only/model-output.json +1 -0
  58. package/evaluation-fixtures/pr-review-recovery/scorer-fixtures/passing/model-output.json +1 -0
  59. package/evaluation-fixtures/pr-review-recovery/scorer-fixtures/premature-systemic-claim/model-output.json +1 -0
  60. package/evaluation-fixtures/pr-review-recovery/scorer-fixtures/profile-b-fallback/model-output.json +1 -0
  61. package/evaluation-fixtures/pr-review-recovery/scorer-fixtures/underclaimed-harm/model-output.json +1 -0
  62. package/evaluation-fixtures/pr-review-recovery/scorer-fixtures/unsupported-severity/model-output.json +1 -0
  63. package/package.json +1 -1
@@ -4,7 +4,7 @@ import {
4
4
  } from "./index-rtry5xyf.js";
5
5
  import {
6
6
  readKnowledgeEvents
7
- } from "./index-72wzb81c.js";
7
+ } from "./index-t5099rx9.js";
8
8
  import {
9
9
  isLinked,
10
10
  readLinkPointer,
@@ -737,7 +737,8 @@ async function runExecutorWithinBudget(args) {
737
737
  instruction: args.instruction,
738
738
  payload: args.payload,
739
739
  seed: args.seed,
740
- abortSignal: controller.signal
740
+ abortSignal: controller.signal,
741
+ projectRoot: args.options.projectRoot
741
742
  }),
742
743
  aborted
743
744
  ]);
@@ -1072,7 +1073,7 @@ var _internals3 = {
1072
1073
  function createModelEvaluationExecutor(dispatcher, parentSessionId) {
1073
1074
  return async (args) => {
1074
1075
  const result = await dispatcher({
1075
- directory: args.isolatedRoot,
1076
+ sessionDirectory: args.projectRoot,
1076
1077
  agentName: args.candidate.agent ?? "reviewer",
1077
1078
  modelId: args.candidate.model,
1078
1079
  system: args.payload,
@@ -1080,6 +1081,7 @@ function createModelEvaluationExecutor(dispatcher, parentSessionId) {
1080
1081
  "EVALUATION TASK:",
1081
1082
  args.instruction,
1082
1083
  "",
1084
+ `Work ONLY in this directory: ${args.isolatedRoot}`,
1083
1085
  "Return the task-required scorer payload exactly."
1084
1086
  ].join(`
1085
1087
  `),
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  readKnowledge,
4
4
  transactKnowledge
5
- } from "./index-fgkhpdc6.js";
5
+ } from "./index-t2mv25yf.js";
6
6
  import {
7
7
  resolveKnowledgeStoreDir
8
8
  } from "./index-vft1pg34.js";
@@ -6,7 +6,7 @@ import {
6
6
  PluginConfigSchema,
7
7
  init_schema,
8
8
  resolveExternalSkillsConfig
9
- } from "./index-mwdzkr6k.js";
9
+ } from "./index-1qn2gchc.js";
10
10
  import {
11
11
  advisoryWarn,
12
12
  init_warning_buffer
@@ -12,14 +12,14 @@ import {
12
12
  detectPosixWrites,
13
13
  detectWindowsWrites,
14
14
  resolveWriteTargets
15
- } from "./index-92v63zzr.js";
15
+ } from "./index-9vqxf9pd.js";
16
16
  import {
17
17
  checkFileAuthority,
18
18
  classifyFile,
19
19
  isInDeclaredScope,
20
20
  redactPath,
21
21
  redactShellCommand
22
- } from "./index-j6ewv2pe.js";
22
+ } from "./index-em10pmph.js";
23
23
 
24
24
  // src/services/guardrail-explain-service.ts
25
25
  import path from "path";
@@ -7,7 +7,7 @@ import {
7
7
  loadPluginConfigWithMeta,
8
8
  loadPluginConfigWithMetaAsync,
9
9
  resolveWorktreeIsolationConfig
10
- } from "./index-pcwjz5de.js";
10
+ } from "./index-d67810xe.js";
11
11
  import {
12
12
  ApprovalEvidenceSchema,
13
13
  BaseEvidenceSchema,
@@ -54,7 +54,7 @@ import {
54
54
  TurboConfigSchema,
55
55
  WorktreeIsolationConfigSchema,
56
56
  resolveAutoReviewConfig
57
- } from "./index-mwdzkr6k.js";
57
+ } from "./index-1qn2gchc.js";
58
58
  import"./index-bk5tah7q.js";
59
59
  import {
60
60
  MigrationStatusSchema,
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  init_schema,
4
4
  stripKnownSwarmPrefix
5
- } from "./index-mwdzkr6k.js";
5
+ } from "./index-1qn2gchc.js";
6
6
  import {
7
7
  init_constants
8
8
  } from "./index-3jcyn8g6.js";
@@ -6,7 +6,7 @@ import {
6
6
  PluginConfigSchema,
7
7
  init_schema,
8
8
  stripKnownSwarmPrefix
9
- } from "./index-mwdzkr6k.js";
9
+ } from "./index-1qn2gchc.js";
10
10
  import {
11
11
  ALL_AGENT_NAMES,
12
12
  init_constants
@@ -1,7 +1,7 @@
1
1
  // @bun
2
2
  import {
3
3
  authorizeCuration
4
- } from "./index-mg26zd8x.js";
4
+ } from "./index-a3gpeb4f.js";
5
5
  import {
6
6
  findNearDuplicate,
7
7
  inferTags,
@@ -9,7 +9,7 @@ import {
9
9
  resolveSwarmKnowledgePath,
10
10
  resolveSwarmRejectedPath,
11
11
  transactKnowledge
12
- } from "./index-fgkhpdc6.js";
12
+ } from "./index-t2mv25yf.js";
13
13
  import {
14
14
  resolveKnowledgeStoreDir
15
15
  } from "./index-vft1pg34.js";
@@ -6,13 +6,13 @@ import {
6
6
  resolveSwarmKnowledgePath,
7
7
  transactKnowledge,
8
8
  wordBigrams
9
- } from "./index-fgkhpdc6.js";
9
+ } from "./index-t2mv25yf.js";
10
10
  import {
11
11
  countEntryContradictionsInWindow,
12
12
  countEntryViolationsInWindow,
13
13
  readKnowledgeEvents,
14
14
  recordKnowledgeEvent
15
- } from "./index-72wzb81c.js";
15
+ } from "./index-t5099rx9.js";
16
16
  import {
17
17
  init_knowledge_types,
18
18
  isActiveStatus
@@ -190,11 +190,11 @@ async function maybeQuarantineOnContradiction(directory, entryId, threshold, win
190
190
  alreadyInactive: true
191
191
  };
192
192
  }
193
- const { quarantineEntry } = await import("./knowledge-validator-bjxag1jp.js");
193
+ const { quarantineEntry } = await import("./knowledge-validator-gepda374.js");
194
194
  let policyConfig;
195
195
  try {
196
- const { KnowledgeConfigSchema } = await import("./schema-11gyrec3.js");
197
- const { loadPluginConfigWithMeta } = await import("./index-aze9n64z.js");
196
+ const { KnowledgeConfigSchema } = await import("./schema-mrbyt7dg.js");
197
+ const { loadPluginConfigWithMeta } = await import("./index-e0nvge1c.js");
198
198
  const { config: loadedConfig } = loadPluginConfigWithMeta(directory);
199
199
  policyConfig = KnowledgeConfigSchema.parse(loadedConfig.knowledge ?? {});
200
200
  } catch {
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  redactPath,
4
4
  redactShellCommand
5
- } from "./index-j6ewv2pe.js";
5
+ } from "./index-em10pmph.js";
6
6
 
7
7
  // src/services/guardrail-log-service.ts
8
8
  import * as fs from "fs/promises";
@@ -702,7 +702,7 @@ async function applyConfidenceFloorAction(directory, touched, options) {
702
702
  const recovered = touched.filter((e) => e.confidence > CONFIDENCE_FLOOR + FLOOR_EPSILON && e.confidence_floor_demoted);
703
703
  if (atFloor.length === 0 && recovered.length === 0)
704
704
  return;
705
- const { readKnowledgeCounterRollups, effectiveRetrievalOutcomes } = await import("./knowledge-events-8nz3sa2d.js");
705
+ const { readKnowledgeCounterRollups, effectiveRetrievalOutcomes } = await import("./knowledge-events-3c0g2xbm.js");
706
706
  const rollups = await readKnowledgeCounterRollups(directory);
707
707
  const flagIds = new Set;
708
708
  for (const e of atFloor) {
@@ -769,11 +769,11 @@ async function applyConfidenceFloorAction(directory, touched, options) {
769
769
  });
770
770
  }
771
771
  if (action === "quarantine" && toQuarantine.length > 0) {
772
- const { quarantineEntry } = await import("./knowledge-validator-bjxag1jp.js");
773
- const { KnowledgeConfigSchema } = await import("./schema-11gyrec3.js");
772
+ const { quarantineEntry } = await import("./knowledge-validator-gepda374.js");
773
+ const { KnowledgeConfigSchema } = await import("./schema-mrbyt7dg.js");
774
774
  let config;
775
775
  try {
776
- const { loadPluginConfigWithMeta } = await import("./index-aze9n64z.js");
776
+ const { loadPluginConfigWithMeta } = await import("./index-e0nvge1c.js");
777
777
  const { config: loadedConfig } = loadPluginConfigWithMeta(directory);
778
778
  config = KnowledgeConfigSchema.parse(loadedConfig.knowledge ?? {});
779
779
  } catch {
@@ -625,7 +625,7 @@ async function applyKnowledgeVerdictFeedback(directory, options) {
625
625
  deltas.push({ id, delta });
626
626
  }
627
627
  if (deltas.length > 0) {
628
- const { bumpKnowledgeConfidenceBatch } = await import("./knowledge-store-esghe3f9.js");
628
+ const { bumpKnowledgeConfidenceBatch } = await import("./knowledge-store-pq43990j.js");
629
629
  await bumpKnowledgeConfidenceBatch(directory, deltas, options?.floorOptions);
630
630
  }
631
631
  return {
@@ -2,18 +2,18 @@
2
2
  import {
3
3
  ALLOWED_SKILL_PATH_PREFIXES,
4
4
  validateSkillPath
5
- } from "./index-p124rnwb.js";
5
+ } from "./index-k8y41t4y.js";
6
6
  import {
7
7
  computeOutcomeSignal,
8
8
  readKnowledge,
9
9
  resolveHiveKnowledgePath,
10
10
  resolveSwarmKnowledgePath,
11
11
  transactKnowledge
12
- } from "./index-fgkhpdc6.js";
12
+ } from "./index-t2mv25yf.js";
13
13
  import {
14
14
  effectiveRetrievalOutcomes,
15
15
  readKnowledgeCounterRollups
16
- } from "./index-72wzb81c.js";
16
+ } from "./index-t5099rx9.js";
17
17
  import {
18
18
  init_knowledge_types,
19
19
  isActiveStatus
package/dist/cli/index.js CHANGED
@@ -6,39 +6,39 @@ import {
6
6
  getPluginConfigDir,
7
7
  getPluginLockFilePaths,
8
8
  resolveCommand
9
- } from "./index-92v63zzr.js";
9
+ } from "./index-9vqxf9pd.js";
10
10
  import"./index-vm4xw9z3.js";
11
- import"./index-k3mezk96.js";
12
- import"./index-j6ewv2pe.js";
13
- import"./index-91kk2e9j.js";
11
+ import"./index-b2s3t517.js";
12
+ import"./index-em10pmph.js";
13
+ import"./index-gd47gp2q.js";
14
14
  import"./index-1zrb3vt2.js";
15
15
  import"./index-5wjw05dy.js";
16
16
  import"./index-y8552snf.js";
17
17
  import"./index-4905hd2m.js";
18
18
  import"./index-134d35c1.js";
19
- import"./index-f24r6yqk.js";
20
- import"./index-d00q9kpq.js";
21
- import"./index-wg98bsxz.js";
19
+ import"./index-zxf5w0jj.js";
20
+ import"./index-m4s91910.js";
21
+ import"./index-bxk0a1r9.js";
22
22
  import"./index-6mjf4vr1.js";
23
23
  import"./index-c8s9a3zh.js";
24
24
  import"./index-9ss2m4rs.js";
25
25
  import"./index-wsdnttf4.js";
26
26
  import"./index-5r6kkhd7.js";
27
- import"./index-p124rnwb.js";
28
- import"./index-mg26zd8x.js";
27
+ import"./index-k8y41t4y.js";
28
+ import"./index-a3gpeb4f.js";
29
29
  import"./index-rtry5xyf.js";
30
- import"./index-fgkhpdc6.js";
31
- import"./index-72wzb81c.js";
30
+ import"./index-t2mv25yf.js";
31
+ import"./index-t5099rx9.js";
32
32
  import"./index-ae75rja9.js";
33
33
  import"./index-vft1pg34.js";
34
34
  import"./index-n3h6rmbe.js";
35
- import"./index-pcwjz5de.js";
35
+ import"./index-d67810xe.js";
36
36
  import"./index-k5jrywpr.js";
37
37
  import"./index-n832052r.js";
38
38
  import {
39
39
  init_package,
40
40
  package_default
41
- } from "./index-mwdzkr6k.js";
41
+ } from "./index-1qn2gchc.js";
42
42
  import"./index-bk5tah7q.js";
43
43
  import"./index-8fwhhayc.js";
44
44
  import"./index-q1exe2b3.js";
@@ -8,9 +8,9 @@ import {
8
8
  maybeEscalateOnViolation,
9
9
  maybeQuarantineOnContradiction,
10
10
  readRecentEscalations
11
- } from "./index-d00q9kpq.js";
12
- import"./index-fgkhpdc6.js";
13
- import"./index-72wzb81c.js";
11
+ } from "./index-m4s91910.js";
12
+ import"./index-t2mv25yf.js";
13
+ import"./index-t5099rx9.js";
14
14
  import"./index-ae75rja9.js";
15
15
  import"./index-vft1pg34.js";
16
16
  import"./index-n3h6rmbe.js";
@@ -28,7 +28,7 @@ import {
28
28
  resolveKnowledgeCounterBaselinePath,
29
29
  resolveKnowledgeEventsPath,
30
30
  resolveLegacyApplicationLogPath
31
- } from "./index-72wzb81c.js";
31
+ } from "./index-t5099rx9.js";
32
32
  import"./index-ae75rja9.js";
33
33
  import"./index-vft1pg34.js";
34
34
  import"./index-n3h6rmbe.js";
@@ -41,7 +41,7 @@ import {
41
41
  transactKnowledge,
42
42
  transactKnowledgeWithCas,
43
43
  wordBigrams
44
- } from "./index-fgkhpdc6.js";
44
+ } from "./index-t2mv25yf.js";
45
45
  import {
46
46
  resolveHiveDataDir
47
47
  } from "./index-ae75rja9.js";
@@ -23,11 +23,11 @@ import {
23
23
  validateLesson,
24
24
  validateSkillCandidatePath,
25
25
  validateSkillPath
26
- } from "./index-p124rnwb.js";
27
- import"./index-mg26zd8x.js";
26
+ } from "./index-k8y41t4y.js";
27
+ import"./index-a3gpeb4f.js";
28
28
  import"./index-rtry5xyf.js";
29
- import"./index-fgkhpdc6.js";
30
- import"./index-72wzb81c.js";
29
+ import"./index-t2mv25yf.js";
30
+ import"./index-t5099rx9.js";
31
31
  import"./index-ae75rja9.js";
32
32
  import"./index-vft1pg34.js";
33
33
  import"./index-n3h6rmbe.js";
@@ -3,7 +3,7 @@ import {
3
3
  _internals,
4
4
  createModelEvaluationExecutor,
5
5
  runEvaluation
6
- } from "./index-k3mezk96.js";
6
+ } from "./index-b2s3t517.js";
7
7
  import"./index-5wjw05dy.js";
8
8
  import"./index-y8552snf.js";
9
9
  import"./index-n3h6rmbe.js";
@@ -4,8 +4,8 @@ import {
4
4
  alreadyCuratedThisGeneration,
5
5
  claimNextScanBatch,
6
6
  getScanStatus
7
- } from "./index-wg98bsxz.js";
8
- import"./index-fgkhpdc6.js";
7
+ } from "./index-bxk0a1r9.js";
8
+ import"./index-t2mv25yf.js";
9
9
  import"./index-ae75rja9.js";
10
10
  import"./index-vft1pg34.js";
11
11
  import"./index-n3h6rmbe.js";
@@ -95,7 +95,7 @@ import {
95
95
  resolveGeneratedAgentRole,
96
96
  resolveGuardrailsConfig,
97
97
  stripKnownSwarmPrefix
98
- } from "./index-mwdzkr6k.js";
98
+ } from "./index-1qn2gchc.js";
99
99
  import"./index-bk5tah7q.js";
100
100
  import"./index-3jcyn8g6.js";
101
101
  import"./index-bpmtbmy9.js";
@@ -33,12 +33,12 @@ import {
33
33
  sanitizeSlug,
34
34
  selectCandidateEntries,
35
35
  writeEvalStub
36
- } from "./index-f24r6yqk.js";
37
- import"./index-p124rnwb.js";
38
- import"./index-mg26zd8x.js";
36
+ } from "./index-zxf5w0jj.js";
37
+ import"./index-k8y41t4y.js";
38
+ import"./index-a3gpeb4f.js";
39
39
  import"./index-rtry5xyf.js";
40
- import"./index-fgkhpdc6.js";
41
- import"./index-72wzb81c.js";
40
+ import"./index-t2mv25yf.js";
41
+ import"./index-t5099rx9.js";
42
42
  import"./index-ae75rja9.js";
43
43
  import"./index-vft1pg34.js";
44
44
  import"./index-n3h6rmbe.js";
@@ -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;
@@ -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';