opencode-swarm 7.139.3 → 7.139.4

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 (79) hide show
  1. package/README.md +2 -2
  2. package/dist/cli/{config-doctor-75qky762.js → config-doctor-whxr386t.js} +6 -6
  3. package/dist/cli/{core-nn8ffy5h.js → core-aj5g7an6.js} +4 -4
  4. package/dist/cli/{curation-policy-f46tf3dw.js → curation-policy-anym2y3v.js} +7 -7
  5. package/dist/cli/{curator-drift-r52hjskk.js → curator-drift-49p3jnte.js} +6 -6
  6. package/dist/cli/{curator-m6mk2v1n.js → curator-e8cvb55d.js} +39 -39
  7. package/dist/cli/curator-llm-factory-h9xbpgmw.js +61 -0
  8. package/dist/cli/{dispatch-nbv0hezh.js → dispatch-2s23fbcs.js} +3 -3
  9. package/dist/cli/{evidence-summary-service-sxcq5nrt.js → evidence-summary-service-g82bsjqa.js} +16 -16
  10. package/dist/cli/{gate-evidence-1982qswy.js → gate-evidence-72cgrvs2.js} +6 -5
  11. package/dist/cli/guardrail-explain-0be7msvq.js +62 -0
  12. package/dist/cli/{guardrail-log-320grggj.js → guardrail-log-9mm5443g.js} +8 -8
  13. package/dist/cli/{hive-promoter-v4w7cjvk.js → hive-promoter-nnzs5x1r.js} +39 -39
  14. package/dist/cli/{index-xeyr62x0.js → index-0e95eck5.js} +5 -5
  15. package/dist/cli/{index-5syvwd8g.js → index-0xkjhgrf.js} +5 -5
  16. package/dist/cli/{index-yh0q21nj.js → index-1kyex7z2.js} +1 -1
  17. package/dist/cli/{index-6mvbjqbt.js → index-33skgk1a.js} +1 -1
  18. package/dist/cli/{index-xsxrhakg.js → index-41hkt36g.js} +1 -1
  19. package/dist/cli/{index-jqn332jx.js → index-5azdnaty.js} +2 -2
  20. package/dist/cli/{index-kyz7259r.js → index-5s23pfsy.js} +7 -7
  21. package/dist/cli/{index-xzzcfwwm.js → index-5z2xps64.js} +2 -2
  22. package/dist/cli/{index-4fr94329.js → index-6nzmp937.js} +53 -108
  23. package/dist/cli/{index-2eet124q.js → index-6r522srn.js} +1 -1
  24. package/dist/cli/{index-4xbyy6aw.js → index-6rxgb5r9.js} +10 -6
  25. package/dist/cli/{index-z6qe8wft.js → index-6vh6vrnk.js} +10 -10
  26. package/dist/cli/{index-gen82t10.js → index-6z0a940s.js} +7 -7
  27. package/dist/cli/{index-ba5e5e3n.js → index-9cdj4020.js} +6 -6
  28. package/dist/cli/{index-1yd38ajy.js → index-e1k9vpqn.js} +4 -4
  29. package/dist/cli/{index-0mzz46we.js → index-ejbcpbzp.js} +7 -7
  30. package/dist/cli/{index-mzck763x.js → index-gfmrw2f5.js} +2 -2
  31. package/dist/cli/{index-mv0czd9c.js → index-j77frjq8.js} +6 -6
  32. package/dist/cli/{index-1jbj7vzv.js → index-jnfyxeap.js} +4 -4
  33. package/dist/cli/{index-hwnpd4tw.js → index-k41dn8me.js} +3 -3
  34. package/dist/cli/{index-k87hs2ff.js → index-k46me75h.js} +3 -3
  35. package/dist/cli/{index-hckq2r5m.js → index-nrx08gcr.js} +6 -2
  36. package/dist/cli/{index-6axm8q3s.js → index-pg84msyc.js} +7 -7
  37. package/dist/cli/{index-a5eba0t8.js → index-rsrx77fg.js} +6 -6
  38. package/dist/cli/index-s0qc4gj6.js +298 -0
  39. package/dist/cli/{index-yawwwhmc.js → index-s58vghgj.js} +6 -6
  40. package/dist/cli/{index-5hyq2mw6.js → index-sa15nfgg.js} +43 -43
  41. package/dist/cli/{index-ajwmn8gp.js → index-sd657fkp.js} +4 -4
  42. package/dist/cli/{index-v7g8dnyh.js → index-vfsqpcz6.js} +15 -15
  43. package/dist/cli/{index-tkg6rapy.js → index-vyqd1hzm.js} +19404 -19355
  44. package/dist/cli/{index-bcwx1335.js → index-xb1zq933.js} +1 -1
  45. package/dist/cli/{index-05mms0va.js → index-xmhhhjjw.js} +38 -3
  46. package/dist/cli/index.js +41 -41
  47. package/dist/cli/{knowledge-escalator-kkjsjtza.js → knowledge-escalator-a6z30y9p.js} +9 -9
  48. package/dist/cli/{knowledge-events-jbw9j94n.js → knowledge-events-deq0ds8e.js} +6 -6
  49. package/dist/cli/{knowledge-link-f6akgbdn.js → knowledge-link-bmbatt8s.js} +5 -5
  50. package/dist/cli/{knowledge-store-m7vnz62z.js → knowledge-store-vdr19mnq.js} +7 -7
  51. package/dist/cli/{knowledge-validator-rqj7kech.js → knowledge-validator-5hgacnrf.js} +10 -10
  52. package/dist/cli/{pending-delegations-14544jpr.js → pending-delegations-7ayryxbg.js} +7 -7
  53. package/dist/cli/{pr-subscriptions-qdwfm1a8.js → pr-subscriptions-w5y08ebc.js} +7 -7
  54. package/dist/cli/{runner-mzb3e2s6.js → runner-h7vmgkth.js} +7 -6
  55. package/dist/cli/{scan-cursor-8e6ryhjq.js → scan-cursor-d6qcg9hr.js} +8 -8
  56. package/dist/cli/{schema-g7rs20c6.js → schema-y1zekrag.js} +3 -3
  57. package/dist/cli/{scope-persistence-wy65zyha.js → scope-persistence-tj6qway9.js} +6 -6
  58. package/dist/cli/{skill-generator-2rv6ftre.js → skill-generator-bw8xhzzn.js} +12 -12
  59. package/dist/cli/{telemetry-4tgrfhaz.js → telemetry-62cn5t24.js} +1 -1
  60. package/dist/cli/{worktree-collision-ownership-24s0t62z.js → worktree-collision-ownership-hs5c2qzp.js} +8 -8
  61. package/dist/evidence/manager.d.ts +4 -1
  62. package/dist/index.js +590 -588
  63. package/dist/prm/escalation.d.ts +34 -0
  64. package/dist/prm/index.d.ts +6 -2
  65. package/dist/prm/pattern-detector.d.ts +22 -1
  66. package/dist/prm/types.d.ts +12 -2
  67. package/dist/state.d.ts +49 -0
  68. package/dist/summaries/schema.d.ts +2 -2
  69. package/dist/tools/convene-council.d.ts +1 -1
  70. package/dist/tools/pre-check-batch.d.ts +4 -0
  71. package/dist/tools/resolve-working-directory.d.ts +4 -4
  72. package/dist/tools/submit-phase-council-verdicts.d.ts +1 -1
  73. package/dist/tools/write-final-council-evidence.d.ts +1 -1
  74. package/dist/utils/project-boundary.d.ts +34 -0
  75. package/package.json +1 -1
  76. package/dist/cli/curator-llm-factory-1r9vz0g2.js +0 -61
  77. package/dist/cli/guardrail-explain-y2wg00dp.js +0 -62
  78. package/dist/cli/index-5j6chvj8.js +0 -159
  79. package/dist/cli/{index-z6xqpmqg.js → index-ee3x66a5.js} +3 -3
@@ -1,13 +1,13 @@
1
1
  // @bun
2
- import {
3
- OUTCOME_BLOCK_THRESHOLD,
4
- init_knowledge_types
5
- } from "./index-bk5tah7q.js";
6
2
  import {
7
3
  ALL_AGENT_NAMES,
8
4
  SUMMARIZER_EXEMPT_TOOL_NAMES,
9
5
  init_constants
10
6
  } from "./index-4wjk296r.js";
7
+ import {
8
+ OUTCOME_BLOCK_THRESHOLD,
9
+ init_knowledge_types
10
+ } from "./index-bk5tah7q.js";
11
11
  import {
12
12
  exports_external,
13
13
  init_zod
@@ -21,7 +21,7 @@ var package_default;
21
21
  var init_package = __esm(() => {
22
22
  package_default = {
23
23
  name: "opencode-swarm",
24
- version: "7.139.3",
24
+ version: "7.139.4",
25
25
  description: "Architect-centric agentic swarm plugin for OpenCode - hub-and-spoke orchestration with SME consultation, code generation, and QA review",
26
26
  main: "dist/index.js",
27
27
  types: "dist/index.d.ts",
@@ -1297,13 +1297,13 @@ var init_schema = __esm(() => {
1297
1297
  ping_pong: exports_external.number().min(1).default(2),
1298
1298
  expansion_drift: exports_external.number().min(1).default(3),
1299
1299
  stuck_on_test: exports_external.number().min(1).default(3),
1300
- context_thrash: exports_external.number().min(1).default(3)
1300
+ context_thrash: exports_external.number().min(1).default(10)
1301
1301
  }).default(() => ({
1302
1302
  repetition_loop: 2,
1303
1303
  ping_pong: 2,
1304
1304
  expansion_drift: 3,
1305
1305
  stuck_on_test: 3,
1306
- context_thrash: 3
1306
+ context_thrash: 10
1307
1307
  })),
1308
1308
  max_trajectory_lines: exports_external.number().min(10).default(1000),
1309
1309
  escalation_enabled: exports_external.boolean().default(true),
@@ -3,10 +3,10 @@ import {
3
3
  atomicWriteFile,
4
4
  taskEvidencePath,
5
5
  withTaskEvidenceLock
6
- } from "./index-2eet124q.js";
6
+ } from "./index-6r522srn.js";
7
7
  import {
8
8
  telemetry
9
- } from "./index-a5eba0t8.js";
9
+ } from "./index-rsrx77fg.js";
10
10
  import {
11
11
  exports_external,
12
12
  init_zod
@@ -3,28 +3,10 @@ import {
3
3
  EvaluationRunV1Schema,
4
4
  GateAuditResultV1Schema,
5
5
  getProtectedEvaluationRunIds
6
- } from "./index-hckq2r5m.js";
6
+ } from "./index-nrx08gcr.js";
7
7
  import {
8
8
  readEffectiveSpecSync
9
9
  } from "./index-9ss2m4rs.js";
10
- import {
11
- isValidTaskId,
12
- readTaskEvidence,
13
- readTaskEvidenceRaw,
14
- sanitizeTaskId
15
- } from "./index-xzzcfwwm.js";
16
- import {
17
- EVIDENCE_MAX_JSON_BYTES,
18
- EvidenceBundleSchema,
19
- EvidenceSchema
20
- } from "./index-gprxjmm7.js";
21
- import {
22
- _internals,
23
- buildDefaultPolicy,
24
- execute,
25
- init_runner_client,
26
- probe
27
- } from "./index-q1exe2b3.js";
28
10
  import {
29
11
  LedgerStaleWriterError,
30
12
  appendLedgerEvent,
@@ -40,42 +22,61 @@ import {
40
22
  replayFromLedgerWithStatus,
41
23
  takeSnapshotEvent,
42
24
  takeSnapshotWithRetry
43
- } from "./index-4xbyy6aw.js";
44
- import {
45
- PlanSchema
46
- } from "./index-1kz6da87.js";
25
+ } from "./index-6rxgb5r9.js";
47
26
  import {
48
27
  getWorktreeMergeFailure
49
28
  } from "./index-b8zgtz81.js";
50
29
  import {
51
30
  readSwarmFileAsync,
52
31
  validateSwarmPath
53
- } from "./index-k87hs2ff.js";
32
+ } from "./index-k46me75h.js";
33
+ import {
34
+ isValidTaskId,
35
+ readTaskEvidence,
36
+ readTaskEvidenceRaw,
37
+ sanitizeTaskId
38
+ } from "./index-5z2xps64.js";
39
+ import {
40
+ _internals,
41
+ buildDefaultPolicy,
42
+ execute,
43
+ init_runner_client,
44
+ probe
45
+ } from "./index-q1exe2b3.js";
54
46
  import {
55
47
  invalidateCachedArtifact,
56
48
  readCachedParsedFile
57
49
  } from "./index-ed5ykebp.js";
58
50
  import {
51
+ assertProjectRoot,
59
52
  withEvidenceLock
60
- } from "./index-5j6chvj8.js";
61
- import {
62
- emit
63
- } from "./index-a5eba0t8.js";
64
- import {
65
- ZodError,
66
- init_zod
67
- } from "./index-bpmtbmy9.js";
53
+ } from "./index-s0qc4gj6.js";
68
54
  import {
69
55
  bunHash,
70
56
  bunWrite,
71
57
  mergeEnvForChild
72
58
  } from "./index-4nt52yr9.js";
59
+ import {
60
+ EVIDENCE_MAX_JSON_BYTES,
61
+ EvidenceBundleSchema,
62
+ EvidenceSchema
63
+ } from "./index-gprxjmm7.js";
64
+ import {
65
+ PlanSchema
66
+ } from "./index-1kz6da87.js";
73
67
  import {
74
68
  criticalWarn,
75
69
  error,
76
70
  init_logger,
77
71
  warn
78
72
  } from "./index-zgwm4ryv.js";
73
+ import {
74
+ emit
75
+ } from "./index-rsrx77fg.js";
76
+ import {
77
+ ZodError,
78
+ init_zod
79
+ } from "./index-bpmtbmy9.js";
79
80
  import {
80
81
  __esm,
81
82
  __export,
@@ -2659,6 +2660,7 @@ async function isPlanMdInSync(directory, plan, cache) {
2659
2660
  return false;
2660
2661
  }
2661
2662
  async function regeneratePlanMarkdown(directory, plan) {
2663
+ assertProjectRoot(directory);
2662
2664
  const swarmDir = path8.resolve(directory, ".swarm");
2663
2665
  const contentHash = computePlanContentHash(plan);
2664
2666
  const markdown = derivePlanMarkdown(plan);
@@ -2771,6 +2773,7 @@ async function loadPlan(directory, cache) {
2771
2773
  const preserving = await isObligationPreserving(directory);
2772
2774
  if (!preserving) {
2773
2775
  try {
2776
+ assertProjectRoot(directory);
2774
2777
  const diffInfo = computeSpecDiff(directory);
2775
2778
  const specStalenessPath = path8.join(directory, ".swarm", "spec-staleness.json");
2776
2779
  await fsPromises.writeFile(specStalenessPath, JSON.stringify({
@@ -2787,6 +2790,7 @@ async function loadPlan(directory, cache) {
2787
2790
  invalidateCachedArtifact(specStalenessPath);
2788
2791
  } catch {}
2789
2792
  try {
2793
+ assertProjectRoot(directory);
2790
2794
  const eventsPath = path8.join(directory, ".swarm", "events.jsonl");
2791
2795
  const event = {
2792
2796
  type: "spec_stale_detected",
@@ -2942,6 +2946,7 @@ async function savePlan(directory, plan, options) {
2942
2946
  if (directory === null || directory === undefined || typeof directory !== "string" || directory.trim().length === 0) {
2943
2947
  throw new Error(`Invalid directory: directory must be a non-empty string`);
2944
2948
  }
2949
+ assertProjectRoot(directory);
2945
2950
  const validated = PlanSchema.parse(plan);
2946
2951
  if (options?.preserveCompletedStatuses !== false) {
2947
2952
  try {
@@ -3254,6 +3259,7 @@ ${markdown}`;
3254
3259
  } catch {}
3255
3260
  }
3256
3261
  async function rebuildPlan(directory, plan, options) {
3262
+ assertProjectRoot(directory);
3257
3263
  const targetPlan = plan ?? await replayFromLedger(directory);
3258
3264
  if (!targetPlan)
3259
3265
  return null;
@@ -3324,6 +3330,7 @@ ${markdown}`;
3324
3330
  return targetPlan;
3325
3331
  }
3326
3332
  async function closePlanTerminalState(directory, plan, options) {
3333
+ assertProjectRoot(directory);
3327
3334
  const planId = derivePlanId(plan);
3328
3335
  const validated = PlanSchema.parse(plan);
3329
3336
  const hashAfter = computePlanHash(validated);
@@ -3684,7 +3691,6 @@ import {
3684
3691
  statSync as statSync2
3685
3692
  } from "fs";
3686
3693
  import * as fs7 from "fs/promises";
3687
- import * as os4 from "os";
3688
3694
  import * as path10 from "path";
3689
3695
 
3690
3696
  // src/evaluation/retention.ts
@@ -3793,6 +3799,7 @@ var _retentionInternals = {
3793
3799
  removeCandidate
3794
3800
  };
3795
3801
  async function archiveEvaluationArtifacts(args) {
3802
+ assertProjectRoot(args.directory);
3796
3803
  return withEvidenceLock(args.directory, path9.join("evolution", "retention-index"), "evaluation-retention", "archive", async () => {
3797
3804
  const inventory = await retentionCandidates(args.directory);
3798
3805
  let protectedKeys = await _retentionInternals.protectedArtifacts(args.directory);
@@ -3993,6 +4000,7 @@ async function rewriteAtomic(filePath, survivors) {
3993
4000
  return Buffer.byteLength(payload, "utf8");
3994
4001
  }
3995
4002
  async function pruneEvidenceDocuments(args) {
4003
+ assertProjectRoot(args.directory);
3996
4004
  const dryRun = args.dryRun === true;
3997
4005
  const capsUnset = (typeof args.maxBytes !== "number" || args.maxBytes <= 0) && (typeof args.maxRecords !== "number" || args.maxRecords <= 0);
3998
4006
  const filePath = validateSwarmPath(args.directory, EVIDENCE_CACHE_FILE);
@@ -4097,82 +4105,11 @@ function isValidEvidenceType(type) {
4097
4105
  return VALID_EVIDENCE_TYPES.includes(type);
4098
4106
  }
4099
4107
  var sanitizeTaskId2 = sanitizeTaskId;
4100
- var MAX_DEPTH = 20;
4101
- var PROJECT_INDICATORS = [
4102
- "package.json",
4103
- ".git",
4104
- ".opencode",
4105
- "Cargo.toml",
4106
- "go.mod",
4107
- "pyproject.toml",
4108
- "Gemfile",
4109
- "composer.json",
4110
- "pom.xml",
4111
- "build.gradle",
4112
- "CMakeLists.txt"
4113
- ];
4114
- function isWeakConfigContainerRoot(directory) {
4115
- try {
4116
- const resolved = realpathSync(directory);
4117
- return resolved === realpathSync(os4.tmpdir()) || resolved === realpathSync(os4.homedir());
4118
- } catch {
4119
- const resolved = path10.resolve(directory);
4120
- return resolved === path10.resolve(os4.tmpdir()) || resolved === path10.resolve(os4.homedir());
4121
- }
4122
- }
4123
- function hasAccessibleProjectIndicator(directory, options = {}) {
4124
- const allowConfigOnly = options.allowConfigOnly ?? true;
4125
- for (const indicator of PROJECT_INDICATORS) {
4126
- if (!allowConfigOnly && indicator === ".opencode") {
4127
- continue;
4128
- }
4129
- try {
4130
- const indicatorStat = statSync2(path10.join(directory, indicator));
4131
- if (indicatorStat.isFile() || indicatorStat.isDirectory()) {
4132
- return true;
4133
- }
4134
- } catch {}
4135
- }
4136
- return false;
4137
- }
4138
4108
  function validateProjectRoot(directory) {
4139
- let resolved;
4140
- try {
4141
- resolved = realpathSync(directory);
4142
- } catch {
4143
- warn(`[evidence] Cannot canonicalize directory "${directory}" \u2014 failing closed`);
4144
- throw new Error(`Cannot verify project root for "${directory}" \u2014 directory may not exist or is inaccessible`);
4145
- }
4146
- let current = resolved;
4147
- let depth = 0;
4148
- while (true) {
4149
- if (depth >= MAX_DEPTH)
4150
- break;
4151
- depth++;
4152
- const parent = path10.dirname(current);
4153
- if (parent === current)
4154
- break;
4155
- if (path10.dirname(parent) === parent) {
4156
- current = parent;
4157
- continue;
4158
- }
4159
- const parentSwarm = path10.join(parent, ".swarm");
4160
- try {
4161
- if (statSync2(parentSwarm).isDirectory()) {
4162
- if (hasAccessibleProjectIndicator(parent, {
4163
- allowConfigOnly: !isWeakConfigContainerRoot(parent)
4164
- })) {
4165
- warn(`[evidence] Rejecting write to subdirectory "${resolved}" \u2014 parent "${parent}" already contains .swarm/`);
4166
- throw new Error(`Cannot write evidence in "${resolved}" \u2014 parent directory "${parent}" already contains a .swarm/ folder. Evidence must be written to the project root.`);
4167
- }
4168
- }
4169
- } catch (error2) {
4170
- if (error2 instanceof Error && error2.message.startsWith("Cannot write evidence")) {
4171
- throw error2;
4172
- }
4173
- }
4174
- current = parent;
4175
- }
4109
+ assertProjectRoot(directory, {
4110
+ realpathSync: _internals11.realpathSync,
4111
+ statSync: _internals11.statSync
4112
+ }, "evidence");
4176
4113
  }
4177
4114
  async function saveEvidence(directory, taskId, evidence, abortSignal) {
4178
4115
  abortSignal?.throwIfAborted();
@@ -4297,6 +4234,7 @@ async function loadEvidence(directory, taskId, options) {
4297
4234
  return { status: "found", bundle: validated };
4298
4235
  }
4299
4236
  try {
4237
+ validateProjectRoot(directory);
4300
4238
  await withEvidenceLock(directory, relativePath, "evidence-loader", sanitizedTaskId, async () => {
4301
4239
  const evidenceDir = path10.dirname(evidencePath);
4302
4240
  const bundleJson = JSON.stringify(validated);
@@ -4364,6 +4302,11 @@ async function listEvidenceTaskIds(directory) {
4364
4302
  }
4365
4303
  async function deleteEvidence(directory, taskId) {
4366
4304
  const sanitizedTaskId = sanitizeTaskId2(taskId);
4305
+ try {
4306
+ validateProjectRoot(directory);
4307
+ } catch {
4308
+ return false;
4309
+ }
4367
4310
  const relativePath = path10.join("evidence", sanitizedTaskId);
4368
4311
  const evidenceDir = validateSwarmPath(directory, relativePath);
4369
4312
  try {
@@ -4494,6 +4437,8 @@ var _internals11 = {
4494
4437
  saveEvidence,
4495
4438
  deleteEvidence,
4496
4439
  pruneEvidenceDocuments,
4440
+ realpathSync,
4441
+ statSync: statSync2,
4497
4442
  now: () => new Date
4498
4443
  };
4499
4444
 
@@ -4,7 +4,7 @@ import {
4
4
  } from "./index-ed5ykebp.js";
5
5
  import {
6
6
  withEvidenceLock
7
- } from "./index-5j6chvj8.js";
7
+ } from "./index-s0qc4gj6.js";
8
8
  import {
9
9
  bunWrite
10
10
  } from "./index-4nt52yr9.js";
@@ -1,20 +1,21 @@
1
1
  // @bun
2
+ import {
3
+ assertProjectRoot,
4
+ withEvidenceLock
5
+ } from "./index-s0qc4gj6.js";
2
6
  import {
3
7
  ExecutionProfileSchema,
4
8
  PlanSchema,
5
9
  TaskStatusSchema
6
10
  } from "./index-1kz6da87.js";
7
- import {
8
- withEvidenceLock
9
- } from "./index-5j6chvj8.js";
10
- import {
11
- emit
12
- } from "./index-a5eba0t8.js";
13
11
  import {
14
12
  criticalWarn,
15
13
  init_logger,
16
14
  log
17
15
  } from "./index-zgwm4ryv.js";
16
+ import {
17
+ emit
18
+ } from "./index-rsrx77fg.js";
18
19
 
19
20
  // src/plan/utils.ts
20
21
  function derivePlanId(plan) {
@@ -180,6 +181,7 @@ async function readLedgerEvents(directory) {
180
181
  }
181
182
  }
182
183
  async function initLedger(directory, planId, initialPlanHash, initialPlan) {
184
+ assertProjectRoot(directory);
183
185
  const ledgerPath = getLedgerPath(directory);
184
186
  const planJsonPath = getPlanJsonPath(directory);
185
187
  if (fs.existsSync(ledgerPath)) {
@@ -217,6 +219,7 @@ async function initLedger(directory, planId, initialPlanHash, initialPlan) {
217
219
  writeFileFsyncedThenRename(tempPath, ledgerPath, line);
218
220
  }
219
221
  async function appendLedgerEvent(directory, eventInput, options) {
222
+ assertProjectRoot(directory);
220
223
  return withEvidenceLock(directory, LEDGER_LOCK_PATH, "plan-ledger", "append-ledger-event", async () => {
221
224
  const ledgerPath = getLedgerPath(directory);
222
225
  const latestSeq = await getLatestLedgerSeq(directory);
@@ -484,6 +487,7 @@ async function quarantineLedgerSuffix(directory, badSuffix) {
484
487
  } catch {}
485
488
  }
486
489
  try {
490
+ assertProjectRoot(directory);
487
491
  const hash = crypto.createHash("sha256").update(badSuffix, "utf8").digest("hex").slice(0, 12);
488
492
  const swarmDir = path.join(directory, ".swarm");
489
493
  try {
@@ -6,14 +6,10 @@ import {
6
6
  } from "./index-ae75rja9.js";
7
7
  import {
8
8
  resolveKnowledgeStoreDir
9
- } from "./index-6mvbjqbt.js";
9
+ } from "./index-33skgk1a.js";
10
10
  import {
11
11
  atomicWriteFile
12
- } from "./index-2eet124q.js";
13
- import {
14
- init_knowledge_types,
15
- isActiveStatus
16
- } from "./index-bk5tah7q.js";
12
+ } from "./index-6r522srn.js";
17
13
  import {
18
14
  readCachedParsedFile
19
15
  } from "./index-ed5ykebp.js";
@@ -24,6 +20,10 @@ import {
24
20
  init_logger,
25
21
  log
26
22
  } from "./index-zgwm4ryv.js";
23
+ import {
24
+ init_knowledge_types,
25
+ isActiveStatus
26
+ } from "./index-bk5tah7q.js";
27
27
  import {
28
28
  __require,
29
29
  __toESM
@@ -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-jbw9j94n.js");
705
+ const { readKnowledgeCounterRollups, effectiveRetrievalOutcomes } = await import("./knowledge-events-deq0ds8e.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-rqj7kech.js");
773
- const { KnowledgeConfigSchema } = await import("./schema-g7rs20c6.js");
772
+ const { quarantineEntry } = await import("./knowledge-validator-5hgacnrf.js");
773
+ const { KnowledgeConfigSchema } = await import("./schema-y1zekrag.js");
774
774
  let config;
775
775
  try {
776
- const { loadPluginConfigWithMeta } = await import("./index-v7g8dnyh.js");
776
+ const { loadPluginConfigWithMeta } = await import("./index-vfsqpcz6.js");
777
777
  const { config: loadedConfig } = loadPluginConfigWithMeta(directory);
778
778
  config = KnowledgeConfigSchema.parse(loadedConfig.knowledge ?? {});
779
779
  } catch {
@@ -1,18 +1,18 @@
1
1
  // @bun
2
+ import {
3
+ bunSpawn
4
+ } from "./index-4nt52yr9.js";
2
5
  import {
3
6
  advisoryWarn,
4
7
  init_warning_buffer
5
8
  } from "./index-4rhhvd1a.js";
9
+ import {
10
+ log
11
+ } from "./index-zgwm4ryv.js";
6
12
  import {
7
13
  SWARM_WORKTREE_DIR_NAME,
8
14
  init_constants
9
15
  } from "./index-4wjk296r.js";
10
- import {
11
- bunSpawn
12
- } from "./index-4nt52yr9.js";
13
- import {
14
- log
15
- } from "./index-zgwm4ryv.js";
16
16
  import {
17
17
  __require
18
18
  } from "./index-a76rekgs.js";
@@ -86,7 +86,7 @@ var _internals = {
86
86
  symlinkSync: fs.symlinkSync
87
87
  },
88
88
  writeScopeToDisk: async (directory, taskId, files) => {
89
- const { writeScopeToDisk: realWrite } = await import("./scope-persistence-wy65zyha.js");
89
+ const { writeScopeToDisk: realWrite } = await import("./scope-persistence-tj6qway9.js");
90
90
  return realWrite(directory, taskId, files);
91
91
  },
92
92
  writeLaneProfileToDisk: async (_worktreePath, _laneIndex, _envOverrides) => {
@@ -2,18 +2,18 @@
2
2
  import {
3
3
  readKnowledge,
4
4
  transactKnowledge
5
- } from "./index-z6qe8wft.js";
5
+ } from "./index-6vh6vrnk.js";
6
6
  import {
7
7
  resolveKnowledgeStoreDir
8
- } from "./index-6mvbjqbt.js";
9
- import {
10
- init_knowledge_types,
11
- isActiveStatus
12
- } from "./index-bk5tah7q.js";
8
+ } from "./index-33skgk1a.js";
13
9
  import {
14
10
  init_logger,
15
11
  log
16
12
  } from "./index-zgwm4ryv.js";
13
+ import {
14
+ init_knowledge_types,
15
+ isActiveStatus
16
+ } from "./index-bk5tah7q.js";
17
17
  import {
18
18
  __require,
19
19
  __toESM
@@ -1,4 +1,7 @@
1
1
  // @bun
2
+ import {
3
+ log
4
+ } from "./index-zgwm4ryv.js";
2
5
  import {
3
6
  FALLBACK_MODELS_MAX,
4
7
  GATE_CONFIG_KNOWN_SECTION_KEYS,
@@ -6,14 +9,11 @@ import {
6
9
  PluginConfigSchema,
7
10
  init_schema,
8
11
  stripKnownSwarmPrefix
9
- } from "./index-kyz7259r.js";
12
+ } from "./index-5s23pfsy.js";
10
13
  import {
11
14
  ALL_AGENT_NAMES,
12
15
  init_constants
13
16
  } from "./index-4wjk296r.js";
14
- import {
15
- log
16
- } from "./index-zgwm4ryv.js";
17
17
 
18
18
  // src/services/config-doctor.ts
19
19
  init_constants();
@@ -1,8 +1,4 @@
1
1
  // @bun
2
- import {
3
- init_schema,
4
- stripKnownSwarmPrefix
5
- } from "./index-kyz7259r.js";
6
2
  import {
7
3
  getPathFlavor,
8
4
  isOnDifferentPathRoot,
@@ -12,13 +8,17 @@ import {
12
8
  sanitizeDiagnosticText,
13
9
  unsafePathTextReason
14
10
  } from "./index-556ja8an.js";
15
- import {
16
- init_constants
17
- } from "./index-4wjk296r.js";
18
11
  import {
19
12
  init_logger,
20
13
  warn
21
14
  } from "./index-zgwm4ryv.js";
15
+ import {
16
+ init_schema,
17
+ stripKnownSwarmPrefix
18
+ } from "./index-5s23pfsy.js";
19
+ import {
20
+ init_constants
21
+ } from "./index-4wjk296r.js";
22
22
  import {
23
23
  __commonJS,
24
24
  __toESM
@@ -12,14 +12,14 @@ import {
12
12
  detectPosixWrites,
13
13
  detectWindowsWrites,
14
14
  resolveWriteTargets
15
- } from "./index-tkg6rapy.js";
15
+ } from "./index-vyqd1hzm.js";
16
16
  import {
17
17
  checkFileAuthority,
18
18
  classifyFile,
19
19
  isInDeclaredScope,
20
20
  redactPath,
21
21
  redactShellCommand
22
- } from "./index-0mzz46we.js";
22
+ } from "./index-ejbcpbzp.js";
23
23
 
24
24
  // src/services/guardrail-explain-service.ts
25
25
  import path from "path";
@@ -1,14 +1,10 @@
1
1
  // @bun
2
2
  import {
3
3
  validateSwarmPath
4
- } from "./index-k87hs2ff.js";
4
+ } from "./index-k46me75h.js";
5
5
  import {
6
6
  withEvidenceLock
7
- } from "./index-5j6chvj8.js";
8
- import {
9
- exports_external,
10
- init_zod
11
- } from "./index-bpmtbmy9.js";
7
+ } from "./index-s0qc4gj6.js";
12
8
  import {
13
9
  bunWrite
14
10
  } from "./index-4nt52yr9.js";
@@ -16,6 +12,10 @@ import {
16
12
  init_logger,
17
13
  warn
18
14
  } from "./index-zgwm4ryv.js";
15
+ import {
16
+ exports_external,
17
+ init_zod
18
+ } from "./index-bpmtbmy9.js";
19
19
 
20
20
  // src/background/pending-delegations.ts
21
21
  init_zod();
@@ -1,7 +1,7 @@
1
1
  // @bun
2
2
  import {
3
3
  authorizeCuration
4
- } from "./index-jqn332jx.js";
4
+ } from "./index-5azdnaty.js";
5
5
  import {
6
6
  findNearDuplicate,
7
7
  inferTags,
@@ -9,13 +9,13 @@ import {
9
9
  resolveSwarmKnowledgePath,
10
10
  resolveSwarmRejectedPath,
11
11
  transactKnowledge
12
- } from "./index-z6qe8wft.js";
12
+ } from "./index-6vh6vrnk.js";
13
13
  import {
14
14
  resolveKnowledgeStoreDir
15
- } from "./index-6mvbjqbt.js";
15
+ } from "./index-33skgk1a.js";
16
16
  import {
17
17
  atomicWriteFile
18
- } from "./index-2eet124q.js";
18
+ } from "./index-6r522srn.js";
19
19
  import {
20
20
  require_proper_lockfile
21
21
  } from "./index-7g4c7s5r.js";
@@ -4,10 +4,10 @@ import {
4
4
  } from "./index-ae75rja9.js";
5
5
  import {
6
6
  resolveKnowledgeStoreDir
7
- } from "./index-6mvbjqbt.js";
7
+ } from "./index-33skgk1a.js";
8
8
  import {
9
9
  atomicWriteFile
10
- } from "./index-2eet124q.js";
10
+ } from "./index-6r522srn.js";
11
11
  import {
12
12
  require_proper_lockfile
13
13
  } from "./index-7g4c7s5r.js";
@@ -628,7 +628,7 @@ async function applyKnowledgeVerdictFeedback(directory, options) {
628
628
  deltas.push({ id, delta });
629
629
  }
630
630
  if (deltas.length > 0) {
631
- const { bumpKnowledgeConfidenceBatch } = await import("./knowledge-store-m7vnz62z.js");
631
+ const { bumpKnowledgeConfidenceBatch } = await import("./knowledge-store-vdr19mnq.js");
632
632
  await bumpKnowledgeConfidenceBatch(directory, deltas, options?.floorOptions);
633
633
  }
634
634
  return {
@@ -1,10 +1,10 @@
1
1
  // @bun
2
+ import {
3
+ SwarmError
4
+ } from "./index-ee3x66a5.js";
2
5
  import {
3
6
  readCachedTextFile
4
7
  } from "./index-ed5ykebp.js";
5
- import {
6
- SwarmError
7
- } from "./index-z6xqpmqg.js";
8
8
  import {
9
9
  bunFile
10
10
  } from "./index-4nt52yr9.js";