opencode-swarm 7.168.1 → 7.170.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (146) hide show
  1. package/.opencode/skills/swarm-pr-feedback/SKILL.md +11 -11
  2. package/README.md +1 -0
  3. package/binaries/win32-arm64/swarm-sandbox-runner.exe +0 -0
  4. package/binaries/win32-x64/swarm-sandbox-runner.exe +0 -0
  5. package/dist/ci/evaluate.d.ts +100 -0
  6. package/dist/ci/index.d.ts +13 -0
  7. package/dist/ci/quality-checks.d.ts +58 -0
  8. package/dist/ci/report.d.ts +21 -0
  9. package/dist/ci/runtime.d.ts +81 -0
  10. package/dist/cli/{capability-probe-faqefhah.js → capability-probe-pdwwz8gs.js} +1 -1
  11. package/dist/cli/{coder-settlement-54a3d97g.js → coder-settlement-65zx1bet.js} +12 -12
  12. package/dist/cli/{config-doctor-vzp6b3ng.js → config-doctor-c30rss1c.js} +2 -2
  13. package/dist/cli/{core-yynse50x.js → core-8wkbr1tr.js} +5 -2
  14. package/dist/cli/{curation-policy-mgwv8h2k.js → curation-policy-k74qz9ms.js} +5 -5
  15. package/dist/cli/{curator-drift-k0zrnm09.js → curator-drift-3ssjr0nx.js} +5 -5
  16. package/dist/cli/curator-llm-factory-jkjqasfs.js +72 -0
  17. package/dist/cli/{curator-agdhhzqt.js → curator-pckzk1q4.js} +40 -39
  18. package/dist/cli/{dispatch-8ks9dyk5.js → dispatch-hwwj3qrb.js} +2 -2
  19. package/dist/cli/{evidence-summary-service-6mmcekr7.js → evidence-summary-service-4ydcapke.js} +17 -17
  20. package/dist/cli/{gate-evidence-xqvkqhrk.js → gate-evidence-xwqfky3m.js} +7 -7
  21. package/dist/cli/guardrail-explain-fe2veh2s.js +73 -0
  22. package/dist/cli/{guardrail-log-5wa5c77w.js → guardrail-log-z38j69bx.js} +8 -8
  23. package/dist/cli/{guardrail-reset-dh78tbcf.js → guardrail-reset-mmnzt4mz.js} +40 -39
  24. package/dist/cli/hive-promoter-68hrw1y1.js +87 -0
  25. package/dist/cli/{index-gmpmgtzn.js → index-06rbdzqn.js} +5 -5
  26. package/dist/cli/index-0hgmsyfp.js +92 -0
  27. package/dist/cli/{index-f1fps3w9.js → index-0xprxg95.js} +7 -7
  28. package/dist/cli/{index-p612v1mv.js → index-2s7dvzff.js} +200 -51
  29. package/dist/cli/{index-qthc56c4.js → index-31sqcdsd.js} +4 -4
  30. package/dist/cli/{index-y85aptep.js → index-3axdtaf0.js} +7 -7
  31. package/dist/cli/{index-9b2105n0.js → index-3eh2n3dx.js} +2 -2
  32. package/dist/cli/{index-w1dfkp1q.js → index-3p3y55xg.js} +15 -15
  33. package/dist/cli/{index-apy1qfj0.js → index-4wc5gfgm.js} +26 -4
  34. package/dist/cli/{index-d5qf7hvh.js → index-5400m33a.js} +1 -1
  35. package/dist/cli/{index-qkwtth00.js → index-59fcfpkh.js} +197 -35
  36. package/dist/cli/{index-j0bxxz9d.js → index-5bbem0ey.js} +8 -8
  37. package/dist/cli/{index-qwsh0h2g.js → index-5qt9yf5w.js} +4 -4
  38. package/dist/cli/{index-q1r1cfww.js → index-76qm2c2y.js} +37 -26
  39. package/dist/cli/{index-qhey6vc3.js → index-7h01bkm6.js} +2 -2
  40. package/dist/cli/{index-6df6wbvj.js → index-8w1mrvbd.js} +8 -8
  41. package/dist/cli/{index-8ybjqg51.js → index-9ttqbhvw.js} +1 -1
  42. package/dist/cli/{index-xhb4gryr.js → index-9xk97bcf.js} +4 -4
  43. package/dist/cli/{index-kear8gb7.js → index-b3pmzbh1.js} +2 -2
  44. package/dist/cli/{index-h439y187.js → index-bernkwgf.js} +1 -1
  45. package/dist/cli/{index-m35hybf0.js → index-bm5xrfnx.js} +1 -1
  46. package/dist/cli/{index-pyf517sz.js → index-br3mvbsa.js} +2 -2
  47. package/dist/cli/{index-4r5pmtvk.js → index-bx1wgn3a.js} +4 -4
  48. package/dist/cli/{index-nwwk3dej.js → index-cgpwjctj.js} +1 -1
  49. package/dist/cli/{index-wst6n478.js → index-dvbf6fpn.js} +1 -1
  50. package/dist/cli/{index-a8xbvsse.js → index-fgp96k3r.js} +2 -2
  51. package/dist/cli/{index-5zqakgp4.js → index-fhh02gwx.js} +3 -3
  52. package/dist/cli/{index-dfyv3xkd.js → index-gfbggp8k.js} +9 -9
  53. package/dist/cli/{index-kkmezerc.js → index-j144fgk8.js} +4831 -2776
  54. package/dist/cli/{index-xkf3672y.js → index-mjn6aqqk.js} +2 -2
  55. package/dist/cli/{index-3jmb4ppa.js → index-n0d5hrs4.js} +2 -2
  56. package/dist/cli/{index-v3xc4sde.js → index-nbdmdyke.js} +2 -1
  57. package/dist/cli/{index-z6qreakh.js → index-nprdr0sm.js} +6 -4
  58. package/dist/cli/{index-bvqqwx84.js → index-nyn01yrz.js} +2 -2
  59. package/dist/cli/{index-q8091q8b.js → index-p6fj7qz7.js} +3 -3
  60. package/dist/cli/{index-gh9ybrrs.js → index-pw00xcj0.js} +7 -7
  61. package/dist/cli/{index-bw9x8d8n.js → index-r1z8nrb6.js} +5 -5
  62. package/dist/cli/{index-2xbww1x0.js → index-ssx8087p.js} +7 -7
  63. package/dist/cli/{index-4kv1ew3q.js → index-t73888m0.js} +1 -1
  64. package/dist/cli/{index-91ww9hyr.js → index-td6xrw55.js} +1 -1
  65. package/dist/cli/{index-gp9yzr1v.js → index-xnpjwc4h.js} +1 -1
  66. package/dist/cli/{index-yt9n9zt3.js → index-xztkjj3c.js} +48 -41
  67. package/dist/cli/{index-5g6rhkn7.js → index-ye43mdfm.js} +36 -1
  68. package/dist/cli/{index-w3x1dmrf.js → index-z5vas8c3.js} +40 -39
  69. package/dist/cli/{index-chebm5h5.js → index-zw3hkzch.js} +3 -3
  70. package/dist/cli/index.js +45 -39
  71. package/dist/cli/{knowledge-escalator-135dz4eh.js → knowledge-escalator-pz2faktx.js} +13 -13
  72. package/dist/cli/{knowledge-events-27gwv47q.js → knowledge-events-s6s8qedx.js} +11 -11
  73. package/dist/cli/{knowledge-link-dr3xnwyd.js → knowledge-link-rkxfrmhm.js} +4 -4
  74. package/dist/cli/{knowledge-store-80m44bfw.js → knowledge-store-dgv3xw3h.js} +5 -5
  75. package/dist/cli/{knowledge-validator-crsfb2cc.js → knowledge-validator-22qppdyv.js} +7 -7
  76. package/dist/cli/{pending-delegations-gwgjzzkz.js → pending-delegations-4r21nf9d.js} +12 -12
  77. package/dist/cli/{pr-subscriptions-g633nhz4.js → pr-subscriptions-d52xy3zd.js} +12 -12
  78. package/dist/cli/{pr-workflow-gate-4dc5nt2e.js → pr-workflow-gate-0de81kzw.js} +40 -39
  79. package/dist/cli/{runner-k0ycgv8x.js → runner-1dwrgyyr.js} +6 -6
  80. package/dist/cli/{scan-cursor-avxjsm4w.js → scan-cursor-ahbbejab.js} +6 -6
  81. package/dist/cli/{schema-3ja77k4y.js → schema-17h2hcw9.js} +5 -1
  82. package/dist/cli/{scope-persistence-f540tc50.js → scope-persistence-gcn3zm5e.js} +14 -14
  83. package/dist/cli/{skill-generator-kcqqpg1g.js → skill-generator-hkqr5qs7.js} +15 -15
  84. package/dist/cli/{snapshot-coordination-init-e4s8bn4p.js → snapshot-coordination-init-ms36zxv6.js} +40 -39
  85. package/dist/cli/{telemetry-2wzapf11.js → telemetry-fdtaemnv.js} +1 -1
  86. package/dist/cli/{workspace-snapshot-rkgxhj9b.js → workspace-snapshot-hkz2wt1c.js} +4 -4
  87. package/dist/cli/{worktree-collision-ownership-rk9gz638.js → worktree-collision-ownership-7v7gg511.js} +18 -104
  88. package/dist/cli/{worktree-isolation-1bdzfgky.js → worktree-isolation-nanamt25.js} +40 -39
  89. package/dist/commands/ci.d.ts +40 -0
  90. package/dist/commands/destructive-purge.d.ts +85 -0
  91. package/dist/commands/index.d.ts +1 -0
  92. package/dist/commands/registry.d.ts +10 -2
  93. package/dist/commands/reset-session.d.ts +5 -1
  94. package/dist/config/constants.d.ts +4 -1
  95. package/dist/config/lane-context.d.ts +19 -0
  96. package/dist/config/schema.d.ts +77 -0
  97. package/dist/evaluation/index.d.ts +1 -0
  98. package/dist/evaluation/retrieval-quality.d.ts +116 -0
  99. package/dist/failures/invocation-failure.d.ts +23 -4
  100. package/dist/hooks/gate-denial-tracker.d.ts +18 -14
  101. package/dist/hooks/init-orphan-recovery.d.ts +7 -0
  102. package/dist/hooks/pr-workflow-gate.d.ts +8 -2
  103. package/dist/index.js +616 -608
  104. package/dist/memory/embeddings/reranker.d.ts +13 -2
  105. package/dist/memory/evaluation.d.ts +99 -0
  106. package/dist/memory/heldout-evaluation-corpus.d.ts +51 -0
  107. package/dist/memory/index.d.ts +5 -2
  108. package/dist/memory/sqlite-provider.d.ts +35 -1
  109. package/dist/memory/types.d.ts +14 -0
  110. package/dist/observability/otel-mapping.d.ts +5 -5
  111. package/dist/observability/otlp-exporter.d.ts +80 -0
  112. package/dist/parallel/lane-owners.d.ts +76 -0
  113. package/dist/sandbox/macos/sandbox-exec-executor.d.ts +48 -11
  114. package/dist/tools/repo-graph/query.d.ts +6 -1
  115. package/dist/tools/repo-graph/types.d.ts +13 -4
  116. package/dist/utils/bun-compat.d.ts +20 -0
  117. package/dist/utils/gitignore-warning.d.ts +5 -2
  118. package/dist/worktree/base-migration.d.ts +55 -0
  119. package/dist/worktree/core.d.ts +15 -6
  120. package/dist/worktree/ownership.d.ts +66 -0
  121. package/opencode-swarm.schema.json +97 -0
  122. package/package.json +4 -2
  123. package/tests/fixtures/memory-recall-heldout/manifest.json +311 -0
  124. package/tests/fixtures/memory-recall-heldout/sources/bash.sh +1 -0
  125. package/tests/fixtures/memory-recall-heldout/sources/c.c +1 -0
  126. package/tests/fixtures/memory-recall-heldout/sources/cpp.cpp +1 -0
  127. package/tests/fixtures/memory-recall-heldout/sources/csharp.cs +1 -0
  128. package/tests/fixtures/memory-recall-heldout/sources/css.css +3 -0
  129. package/tests/fixtures/memory-recall-heldout/sources/dart.dart +1 -0
  130. package/tests/fixtures/memory-recall-heldout/sources/go.go +3 -0
  131. package/tests/fixtures/memory-recall-heldout/sources/ini.ini +2 -0
  132. package/tests/fixtures/memory-recall-heldout/sources/java.java +1 -0
  133. package/tests/fixtures/memory-recall-heldout/sources/javascript.js +3 -0
  134. package/tests/fixtures/memory-recall-heldout/sources/kotlin.kt +1 -0
  135. package/tests/fixtures/memory-recall-heldout/sources/php.php +1 -0
  136. package/tests/fixtures/memory-recall-heldout/sources/powershell.ps1 +1 -0
  137. package/tests/fixtures/memory-recall-heldout/sources/python.py +2 -0
  138. package/tests/fixtures/memory-recall-heldout/sources/regex.regex +1 -0
  139. package/tests/fixtures/memory-recall-heldout/sources/ruby.rb +3 -0
  140. package/tests/fixtures/memory-recall-heldout/sources/rust.rs +1 -0
  141. package/tests/fixtures/memory-recall-heldout/sources/swift.swift +1 -0
  142. package/tests/fixtures/memory-recall-heldout/sources/tsx.tsx +3 -0
  143. package/tests/fixtures/memory-recall-heldout/sources/typescript.ts +3 -0
  144. package/dist/cli/curator-llm-factory-ygxd6hfx.js +0 -71
  145. package/dist/cli/guardrail-explain-vjtjhgzs.js +0 -72
  146. package/dist/cli/hive-promoter-3czsx7c6.js +0 -86
@@ -14,8 +14,7 @@ export declare const REPO_GRAPH_FILENAME = "repo-graph.json";
14
14
  * the importing file) and per-node `exportLines`, enabling the `callers` and
15
15
  * `dead_exports` queries. Both fields are optional, so graphs written by older
16
16
  * versions (1.0.0) still load — but `dead_exports` requires >= 1.1.0 data and
17
- * self-gates via {@link isSchemaVersionAtLeast} rather than relying on the
18
- * loader (which only checks that a version string is present, not its value).
17
+ * self-gates via {@link isSchemaVersionAtLeast}.
19
18
  *
20
19
  * 1.2.0 adds per-node `exportRanges` (1-based inclusive line spans keyed by
21
20
  * symbol name — exported symbols for every grammar, plus non-exported member
@@ -29,8 +28,8 @@ export declare const REPO_GRAPH_FILENAME = "repo-graph.json";
29
28
  * that distinguishes edges whose resolved target is a scannable source file
30
29
  * (a graph node) from edges whose target is an asset (JSON/CSS/etc. — a real
31
30
  * file that never becomes a node). The field is optional, so 1.0.0–1.2.0
32
- * graphs still load; `storage.ts` only checks that a version string is
33
- * present, and feature gating is per-query via {@link isSchemaVersionAtLeast}.
31
+ * graphs still load; feature gating is per-query via
32
+ * {@link isSchemaVersionAtLeast}.
34
33
  * For pre-1.3.0 graphs the loader/queries fall back to an extension check
35
34
  * (`isScannableSourcePath`) to classify an untagged edge's target kind.
36
35
  *
@@ -65,6 +64,8 @@ export declare const REPO_GRAPH_FILENAME = "repo-graph.json";
65
64
  * notes instead of failing (issue #1536).
66
65
  */
67
66
  export declare const GRAPH_SCHEMA_VERSION = "1.7.0";
67
+ /** The oldest graph schema whose persisted shape this build can interpret. */
68
+ export declare const MIN_SUPPORTED_GRAPH_SCHEMA_VERSION = "1.0.0";
68
69
  /**
69
70
  * Default per-file source-size ceiling shared by graph construction and
70
71
  * query-time source reads. The builder treats this as the default value of
@@ -80,6 +81,14 @@ export declare const DEFAULT_MAX_SOURCE_BYTES: number;
80
81
  * is greater than or equal to `minimum`.
81
82
  */
82
83
  export declare function isSchemaVersionAtLeast(version: string | undefined, minimum: string): boolean;
84
+ /**
85
+ * Return whether a persisted graph schema is a canonical numeric semver in
86
+ * the supported compatibility window. This is deliberately stricter than
87
+ * {@link isSchemaVersionAtLeast}: feature gates may tolerate malformed input
88
+ * by treating missing components as zero, but a persistence boundary must
89
+ * never trust an unknown or future graph shape.
90
+ */
91
+ export declare function isGraphSchemaVersionCompatible(version: unknown): version is string;
83
92
  export declare const FILE_ROLE_VALUES: readonly ["api_route", "middleware", "service_module", "data_module", "swarm_tool", "agent", "hook", "config", "schema", "test_file", "cli_command", "documentation", "source_module"];
84
93
  export type FileRole = (typeof FILE_ROLE_VALUES)[number];
85
94
  export declare const ROUTE_METHOD_VALUES: readonly ["GET", "POST", "PUT", "PATCH", "DELETE", "OPTIONS", "HEAD", "ALL"];
@@ -98,6 +98,14 @@ export interface BunCompatSpawnOptions {
98
98
  stdout?: 'inherit' | 'ignore' | 'pipe';
99
99
  stderr?: 'inherit' | 'ignore' | 'pipe';
100
100
  timeout?: number;
101
+ /**
102
+ * Maximum bytes retained for each buffered stdout/stderr stream. Invalid
103
+ * values fall back to `DEFAULT_BUN_SPAWN_MAX_BUFFER_BYTES` so asynchronous
104
+ * `bunSpawn` keeps its no-throw compatibility contract. Synchronous
105
+ * `bunSpawnSync` delegates to the host synchronous API and does not apply
106
+ * this asynchronous stream-capture option.
107
+ */
108
+ maxBuffer?: number;
101
109
  /** Preserve the caller's exact Windows argv quoting (required for cmd.exe /c). */
102
110
  windowsVerbatimArguments?: boolean;
103
111
  /**
@@ -111,6 +119,18 @@ export interface BunCompatSpawnOptions {
111
119
  */
112
120
  killProcessTree?: boolean;
113
121
  }
122
+ /**
123
+ * Default bounded capture for unclaimed subprocess pipes. Five MiB matches
124
+ * the established Git subprocess limit while remaining finite by default.
125
+ */
126
+ export declare const DEFAULT_BUN_SPAWN_MAX_BUFFER_BYTES: number;
127
+ /** Raised when either buffered pipe exceeds its configured output limit. */
128
+ export declare class BunCompatOutputLimitError extends Error {
129
+ readonly limit: number;
130
+ readonly captured: number;
131
+ readonly total: number;
132
+ constructor(limit: number, captured: number, total: number);
133
+ }
114
134
  export interface BunCompatStream {
115
135
  text(): Promise<string>;
116
136
  bytes(): Promise<Uint8Array>;
@@ -87,8 +87,11 @@ export declare const ENSURE_SWARM_GIT_EXCLUDED_PER_CALL_TIMEOUT_MS = 1500;
87
87
  * Steps:
88
88
  * 1. Resolve git root via `git rev-parse --show-toplevel`
89
89
  * 2. Resolve local exclude path via `git rev-parse --git-path info/exclude`
90
- * 3. Check if `.swarm/` is already ignored via `git check-ignore -q`
91
- * 4. If not ignored: append `.swarm/` to the local exclude file (idempotent)
90
+ * 3. Check if `.swarm/` AND `.swarm-worktrees/` are already ignored via two
91
+ * independent `git check-ignore -q` probes (they are distinct patterns
92
+ * `.swarm/` does not cover `.swarm-worktrees/`, #2527)
93
+ * 4. For whichever pattern is not ignored: append it to the local exclude
94
+ * file (idempotent, per-pattern)
92
95
  * 5. Detect tracked `.swarm/` files via `git ls-files -- .swarm`
93
96
  * 6. If tracked: emit an unsuppressed remediation warning
94
97
  *
@@ -0,0 +1,55 @@
1
+ /**
2
+ * Issue #2527 (F4): one-time migration of the LEGACY parent-level shared
3
+ * worktree base (`<project-parent>/.swarm-worktrees`, shared by every
4
+ * sibling checkout — the root of the cross-project destruction class) into
5
+ * the project-internal default base (`<project>/.swarm-worktrees`).
6
+ *
7
+ * Ordering contract (plan-critic round 2, item 3): migration runs AFTER the
8
+ * recovery lock, AFTER the live-lane-owner scan (it needs the liveness
9
+ * answer), and AFTER the existing fail-closed uncertainty guards — mutating
10
+ * gitdir pointers under uncertain project state is not acceptable — and
11
+ * BEFORE enumeration-for-deletion.
12
+ *
13
+ * Safety contract: migration NEVER deletes anything. Owned + not-live
14
+ * registered worktrees are MOVED with `git worktree move` (the primitive
15
+ * that rewrites both gitdir pointers atomically; same-volume moves are an
16
+ * internal rename — empirically verified on Windows with a git-excluded
17
+ * target and dirty content). Foreign-owned lanes, live-owned lanes, and
18
+ * ownership-unprovable `.git`-less remnants are LEFT AT THEIR LEGACY PATHS
19
+ * (their owning checkouts migrate them; a bounded advisory line surfaces
20
+ * them). The legacy base directory itself is removed only when EMPTY (plain
21
+ * rmdir, never rm -rf). Timeout or per-lane failure ⇒ leave in place,
22
+ * retry next start; N bounded by the lane-owner store caps and the pass's
23
+ * withTimeout budget.
24
+ */
25
+ import * as fs from 'node:fs';
26
+ import { resolveWorktreeRepoOwnership } from '../config/lane-context';
27
+ import type { LiveLaneOwnerEntry } from '../parallel/lane-owners';
28
+ import { bunSpawn } from '../utils/bun-compat';
29
+ import { resolveGitExecutable } from '../utils/git-executable.js';
30
+ export interface BaseMigrationResult {
31
+ attempted: boolean;
32
+ legacyBaseExists: boolean;
33
+ moved: string[];
34
+ retained: Array<{
35
+ lanePath: string;
36
+ reason: string;
37
+ }>;
38
+ legacyBaseRemoved: boolean;
39
+ }
40
+ export declare const _internals: {
41
+ resolveWorktreeRepoOwnership: typeof resolveWorktreeRepoOwnership;
42
+ bunSpawn: typeof bunSpawn;
43
+ resolveGitExecutable: typeof resolveGitExecutable;
44
+ readdirSync: typeof fs.readdirSync;
45
+ existsSync: typeof fs.existsSync;
46
+ mkdirSync: typeof fs.mkdirSync;
47
+ rmdirSync: typeof fs.rmdirSync;
48
+ realpathSync: typeof fs.realpathSync;
49
+ };
50
+ /**
51
+ * Migrate owned, non-live lanes from the legacy parent-level base into the
52
+ * project-internal default base. Fail-open and non-throwing by contract
53
+ * (runs inside the bounded init-orphan-recovery pass).
54
+ */
55
+ export declare function migrateLegacyWorktreeBase(directory: string, liveOwners: LiveLaneOwnerEntry[]): Promise<BaseMigrationResult>;
@@ -10,6 +10,7 @@
10
10
  */
11
11
  import * as fs from 'node:fs';
12
12
  import * as fsPromises from 'node:fs/promises';
13
+ import { clearLiveLaneOwner } from '../parallel/lane-owners';
13
14
  import { bunSpawn } from '../utils/bun-compat';
14
15
  import { resolveGitExecutable } from '../utils/git-executable.js';
15
16
  import type { WorktreeHandle, WorktreeOptions, WorktreeProvisionResult } from './types';
@@ -23,6 +24,11 @@ import type { WorktreeHandle, WorktreeOptions, WorktreeProvisionResult } from '.
23
24
  */
24
25
  export declare const _internals: {
25
26
  bunSpawn: typeof bunSpawn;
27
+ /**
28
+ * Issue #2527 F3: clear the durable live-lane-owner record when this
29
+ * module removes a worktree (seam so tests can observe the clear).
30
+ */
31
+ clearLiveLaneOwner: typeof clearLiveLaneOwner;
26
32
  /** Test seam for process.platform — allows non-Windows CIs to exercise Windows paths. */
27
33
  platform: string;
28
34
  /** Test seam for sleep — allows tests to skip real delays. */
@@ -190,15 +196,18 @@ export declare function makeWorktreeBranchName(sessionId: string, id: string, op
190
196
  */
191
197
  /**
192
198
  * Resolves the swarm-managed worktree base directory: `directory/worktreeDir`
193
- * when an override is configured, otherwise the DD-6 default
194
- * `<project-parent>/.swarm-worktrees`. Shared by `provisionWorktree` (path
195
- * construction) and the destructive-command guard / removeWorktree force
196
- * fallback (containment checks) so both sides agree on what counts as
197
- * "swarm-managed".
199
+ * when an override is configured, otherwise the project-INTERNAL default
200
+ * `<project>/.swarm-worktrees` (issue #2527 root fix — the pre-#2527 default
201
+ * was the project's PARENT, so every sibling checkout shared one base and
202
+ * reclamation in one project could destroy another project's lanes).
203
+ * Shared by `provisionWorktree` (path construction) and the
204
+ * destructive-command guard / removeWorktree force fallback (containment
205
+ * checks) so both sides agree on what counts as "swarm-managed". The legacy
206
+ * parent-level base is migrated by `base-migration.ts`, never deleted.
198
207
  *
199
208
  * @param directory - Project root (an absolute path to the git working tree).
200
209
  * @param worktreeDir - Optional worktree-dir override (relative to `directory`
201
- * or absolute). When absent, the DD-6 default base is used.
210
+ * or absolute). When absent, the default base is used.
202
211
  * @returns The absolute worktree base directory.
203
212
  */
204
213
  export declare function resolveWorktreeBaseDir(directory: string, worktreeDir?: string): string;
@@ -0,0 +1,66 @@
1
+ /**
2
+ * Issue #2527: the single ownership-gated worktree-directory reclamation
3
+ * path.
4
+ *
5
+ * Every deletion of a worktree-base directory reachable from plugin init
6
+ * (init orphan recovery) or `/swarm reset-session` routes through
7
+ * `removeOwnedWorktreeDir`. The contract, frozen by the #2527 acceptance
8
+ * checks (C1/C2/C5/C7/C10) and pinned by the C7 leg-B source-scan ratchet:
9
+ *
10
+ * 1. A `.git`-bearing candidate is deletable ONLY when the existing
11
+ * commondir-based primitive (`resolveWorktreeRepoOwnership` on
12
+ * `readLinkedWorktreeGitDir` + `resolveMainWorktree`) proves this
13
+ * repository owns it.
14
+ * 2. A `git worktree remove` refusal is a STOP — never an escalation to
15
+ * `rmSync`. The refusal text ("is not a working tree", "contains
16
+ * modified or untracked files") is itself the safety signal: the first
17
+ * is git saying this repo does not own the path; the second is git
18
+ * refusing to destroy uncommitted work. Both must preserve the
19
+ * candidate.
20
+ * 3. A `.git`-less directory is deletable ONLY when it sits inside this
21
+ * project's own default worktree base (ours by construction, per F1).
22
+ * Anywhere else — the legacy parent-level shared base, or a configured
23
+ * `worktree_dir` override that may point anywhere — the ownership of a
24
+ * bare directory cannot be proven and it is skipped and reported.
25
+ * Review-round hardening: the marker probe is errno-discriminating —
26
+ * an unreadable-but-present `.git` classifies as `uncertain`, never as
27
+ * "gitless".
28
+ *
29
+ * The entry files (`src/hooks/init-orphan-recovery.ts`,
30
+ * `src/commands/reset-session.ts`) must not call `rmSync` on base-derived
31
+ * paths themselves — the C7 ratchet enforces it.
32
+ */
33
+ import * as fs from 'node:fs';
34
+ import { resolveWorktreeRepoOwnership } from '../config/lane-context';
35
+ import { isPathUnderSwarmWorktreeBase, removeWorktree } from './core';
36
+ export type OwnedRemovalOutcome = {
37
+ status: 'removed';
38
+ } | {
39
+ status: 'skipped';
40
+ reason: string;
41
+ } | {
42
+ status: 'refused';
43
+ reason: string;
44
+ };
45
+ export type GitMarkerProbe = 'gitless' | 'present' | 'uncertain';
46
+ export declare const _internals: {
47
+ resolveWorktreeRepoOwnership: typeof resolveWorktreeRepoOwnership;
48
+ isPathUnderSwarmWorktreeBase: typeof isPathUnderSwarmWorktreeBase;
49
+ removeWorktree: typeof removeWorktree;
50
+ rmSync: typeof fs.rmSync;
51
+ statSync: any;
52
+ };
53
+ /**
54
+ * Errno-discriminating `.git` marker probe. A bare `existsSync` collapses
55
+ * every I/O error (EPERM/EBUSY/EMFILE on a transiently-unreadable marker)
56
+ * into "gitless", which would route an ownership-unprovable path into
57
+ * removal. Only a proven-absent marker is "gitless"; any other error is
58
+ * "uncertain" and the caller must retain the candidate.
59
+ */
60
+ export declare function probeGitMarker(dotGitPath: string): GitMarkerProbe;
61
+ /**
62
+ * Attempt to reclaim one worktree-base directory, gated by repo ownership.
63
+ * NEVER throws: every failure is a returned outcome so callers can report
64
+ * and continue with the next candidate.
65
+ */
66
+ export declare function removeOwnedWorktreeDir(worktreePath: string, projectRoot: string): Promise<OwnedRemovalOutcome>;
@@ -3082,6 +3082,103 @@
3082
3082
  }
3083
3083
  }
3084
3084
  },
3085
+ "observability": {
3086
+ "description": "Observability options — remote OTLP/OpenInference export is opt-in and disabled by default (issue #2485).",
3087
+ "type": "object",
3088
+ "properties": {
3089
+ "export": {
3090
+ "type": "object",
3091
+ "properties": {
3092
+ "enabled": {
3093
+ "default": false,
3094
+ "type": "boolean"
3095
+ },
3096
+ "endpoint": {
3097
+ "default": "",
3098
+ "type": "string",
3099
+ "minLength": 1
3100
+ },
3101
+ "convention": {
3102
+ "default": "genai",
3103
+ "type": "string",
3104
+ "enum": [
3105
+ "genai",
3106
+ "openinference"
3107
+ ]
3108
+ },
3109
+ "headers": {
3110
+ "type": "object",
3111
+ "propertyNames": {
3112
+ "type": "string"
3113
+ },
3114
+ "additionalProperties": {
3115
+ "type": "string"
3116
+ }
3117
+ },
3118
+ "batchSize": {
3119
+ "default": 64,
3120
+ "type": "integer",
3121
+ "minimum": 1,
3122
+ "maximum": 512
3123
+ },
3124
+ "flushIntervalMs": {
3125
+ "default": 5000,
3126
+ "type": "integer",
3127
+ "minimum": 250,
3128
+ "maximum": 300000
3129
+ },
3130
+ "requestTimeoutMs": {
3131
+ "default": 5000,
3132
+ "type": "integer",
3133
+ "minimum": 250,
3134
+ "maximum": 60000
3135
+ },
3136
+ "spoolMaxBytes": {
3137
+ "default": 1048576,
3138
+ "type": "integer",
3139
+ "minimum": 16384,
3140
+ "maximum": 16777216
3141
+ },
3142
+ "spoolMaxAgeMs": {
3143
+ "default": 86400000,
3144
+ "type": "integer",
3145
+ "minimum": 60000,
3146
+ "maximum": 2592000000
3147
+ },
3148
+ "maxRetries": {
3149
+ "default": 3,
3150
+ "type": "integer",
3151
+ "minimum": 0,
3152
+ "maximum": 10
3153
+ },
3154
+ "backoffBaseMs": {
3155
+ "default": 200,
3156
+ "type": "integer",
3157
+ "minimum": 10,
3158
+ "maximum": 10000
3159
+ },
3160
+ "backoffMaxMs": {
3161
+ "default": 30000,
3162
+ "type": "integer",
3163
+ "minimum": 100,
3164
+ "maximum": 300000
3165
+ },
3166
+ "circuitThreshold": {
3167
+ "default": 5,
3168
+ "type": "integer",
3169
+ "minimum": 1,
3170
+ "maximum": 50
3171
+ },
3172
+ "circuitCooldownMs": {
3173
+ "default": 60000,
3174
+ "type": "integer",
3175
+ "minimum": 1000,
3176
+ "maximum": 600000
3177
+ }
3178
+ }
3179
+ }
3180
+ }
3181
+ },
3085
3182
  "learning": {
3086
3183
  "description": "Learning subsystem: real-time admission, PRM persistence, dedup sweep (issue #1821).",
3087
3184
  "type": "object",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-swarm",
3
- "version": "7.168.1",
3
+ "version": "7.170.0",
4
4
  "description": "Architect-centric agentic swarm plugin for OpenCode - hub-and-spoke orchestration with SME consultation, code generation, and QA review",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -85,6 +85,7 @@
85
85
  ".opencode/skills/orchestrating-subagents",
86
86
  ".opencode/skills/durable-session-state",
87
87
  "tests/fixtures/memory-recall",
88
+ "tests/fixtures/memory-recall-heldout",
88
89
  "opencode-swarm.schema.json",
89
90
  "README.md",
90
91
  "LICENSE"
@@ -131,7 +132,8 @@
131
132
  "check:error-channel-discard": "bun run scripts/check-error-channel-discard.ts",
132
133
  "check:path-identity": "bun run scripts/check-path-identity.ts",
133
134
  "check:registry-citations": "bun run scripts/check-registry-citations.ts",
134
- "check:memory-recall": "bun run scripts/memory-recall-regression.ts"
135
+ "check:memory-recall": "bun run scripts/memory-recall-regression.ts",
136
+ "check:retrieval-quality": "bun run scripts/retrieval-quality-regression.ts"
135
137
  },
136
138
  "dependencies": {
137
139
  "@opencode-ai/plugin": "^1.18.3",