opencode-swarm 7.144.8 → 7.145.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 (87) hide show
  1. package/dist/background/workspace-snapshot.d.ts +29 -0
  2. package/dist/cli/{config-doctor-zbqfp0v6.js → config-doctor-96jmxr7s.js} +3 -3
  3. package/dist/cli/{core-pz9gwatq.js → core-w78pc1hh.js} +3 -3
  4. package/dist/cli/{curation-policy-a511r0qz.js → curation-policy-smyc2mrm.js} +7 -7
  5. package/dist/cli/{curator-sk0dyvke.js → curator-59hzdxrv.js} +33 -32
  6. package/dist/cli/{curator-drift-ckjm272w.js → curator-drift-r50x1rac.js} +4 -4
  7. package/dist/cli/{curator-llm-factory-3nq3p02z.js → curator-llm-factory-g794pv51.js} +33 -32
  8. package/dist/cli/dispatch-ndxbsk98.js +1 -1
  9. package/dist/cli/{evidence-summary-service-abwrjqd0.js → evidence-summary-service-41m0cna6.js} +15 -14
  10. package/dist/cli/{gate-evidence-aa7vvtcd.js → gate-evidence-7aywx7qa.js} +10 -9
  11. package/dist/cli/guardrail-explain-j88dhm6w.js +65 -0
  12. package/dist/cli/{guardrail-log-jw5mzs0d.js → guardrail-log-xcb3ke8s.js} +5 -5
  13. package/dist/cli/{hive-promoter-m20j63yg.js → hive-promoter-nnnx5692.js} +33 -32
  14. package/dist/cli/{index-7qb0hn8n.js → index-17e73wac.js} +1 -1
  15. package/dist/cli/{index-r2rkwvzq.js → index-19v4tccw.js} +2 -2
  16. package/dist/cli/{index-vdha477y.js → index-2qrd8mfa.js} +1 -1
  17. package/dist/cli/{index-6z5jtf7d.js → index-34tawmyx.js} +4 -4
  18. package/dist/cli/{index-jdxnzbah.js → index-41t3hgaa.js} +10 -10
  19. package/dist/cli/index-4evasm2b.js +514 -0
  20. package/dist/cli/{index-gfvkttvd.js → index-7axx11dt.js} +1 -1
  21. package/dist/cli/{index-8dbzaf0m.js → index-8ef23wex.js} +4 -4
  22. package/dist/cli/{index-k7fk9fjs.js → index-90w06fqr.js} +107 -29
  23. package/dist/cli/{index-t2ntgzts.js → index-b7ntt9cw.js} +3 -3
  24. package/dist/cli/{index-c2rpht77.js → index-bst6epnr.js} +2703 -2054
  25. package/dist/cli/{index-tffg4mwr.js → index-cqfp05jb.js} +3 -3
  26. package/dist/cli/{index-1jsmmx7y.js → index-dppzthm9.js} +92 -35
  27. package/dist/cli/{index-h1p08s3n.js → index-dzan8czb.js} +1 -1
  28. package/dist/cli/{index-cwtpqm5f.js → index-e1pxav9g.js} +1 -1
  29. package/dist/cli/{index-d1dbpxxk.js → index-evpgszmp.js} +2 -2
  30. package/dist/cli/{index-cx51wy0c.js → index-ff66fbjt.js} +10 -10
  31. package/dist/cli/{index-wknz5c8q.js → index-fwnhh6s7.js} +2 -2
  32. package/dist/cli/{index-hkdgkkhb.js → index-gey2257h.js} +2 -2
  33. package/dist/cli/{index-f9vvg5xb.js → index-gf03198s.js} +67 -2
  34. package/dist/cli/{index-z4fssj97.js → index-kxzgnz2h.js} +20 -20
  35. package/dist/cli/{index-9s8drsf9.js → index-mpf01swm.js} +4 -21
  36. package/dist/cli/{index-sxe5nyq4.js → index-mrkgxfeh.js} +13 -15
  37. package/dist/cli/{index-0v1f2sdb.js → index-neh8azwc.js} +2 -2
  38. package/dist/cli/{index-3k3nbs52.js → index-qpke2x5h.js} +9 -9
  39. package/dist/cli/{index-n4hwcsbd.js → index-rtkttser.js} +5 -5
  40. package/dist/cli/{index-xx8tm58n.js → index-sfemjcb8.js} +5 -5
  41. package/dist/cli/{index-bv44950t.js → index-tm0bezd9.js} +1 -1
  42. package/dist/cli/{index-r14qx363.js → index-tw8ck794.js} +1 -1
  43. package/dist/cli/{index-t72g4a7y.js → index-xz4x17z0.js} +35 -34
  44. package/dist/cli/{index-nmy6rss1.js → index-ymyke19q.js} +1 -1
  45. package/dist/cli/{index-f36ybbsv.js → index-z9yhhk6q.js} +93 -5
  46. package/dist/cli/{index-xp5g9eps.js → index-zpp507z0.js} +15 -1
  47. package/dist/cli/index.js +33 -32
  48. package/dist/cli/{knowledge-escalator-mg8qb7tm.js → knowledge-escalator-s6acdpwj.js} +15 -14
  49. package/dist/cli/{knowledge-events-3zxf8xpb.js → knowledge-events-jprkz49t.js} +13 -12
  50. package/dist/cli/{knowledge-link-4cg4776a.js → knowledge-link-zvtmj756.js} +6 -6
  51. package/dist/cli/{knowledge-store-awnm8s6c.js → knowledge-store-mc4awds4.js} +7 -7
  52. package/dist/cli/{knowledge-validator-3ke5scx3.js → knowledge-validator-pe4ncrvj.js} +9 -9
  53. package/dist/cli/model-preflight-77dwxfv5.js +170 -0
  54. package/dist/cli/{pending-delegations-9h1jmtw1.js → pending-delegations-epzht3d7.js} +6 -6
  55. package/dist/cli/{pr-subscriptions-8pg34pev.js → pr-subscriptions-2ahy8g87.js} +6 -6
  56. package/dist/cli/{runner-cqecp1na.js → runner-ra9pjhp2.js} +8 -7
  57. package/dist/cli/{scan-cursor-00rbxkb4.js → scan-cursor-hdzhqwzj.js} +8 -8
  58. package/dist/cli/{schema-5nmkp1pc.js → schema-pg85z06v.js} +1 -1
  59. package/dist/cli/{scope-persistence-6m79atw9.js → scope-persistence-v8we8ja7.js} +11 -7
  60. package/dist/cli/{skill-generator-gv70s796.js → skill-generator-ctskfct2.js} +17 -16
  61. package/dist/cli/{telemetry-cybx6cfz.js → telemetry-c21dgffc.js} +1 -1
  62. package/dist/cli/{workspace-snapshot-d89zm6wm.js → workspace-snapshot-kznz5e13.js} +3 -1
  63. package/dist/cli/{worktree-collision-ownership-vy0kxa98.js → worktree-collision-ownership-f7se4wbf.js} +10 -10
  64. package/dist/cli/{worktree-isolation-bne0p54w.js → worktree-isolation-j4qb7mgb.js} +35 -32
  65. package/dist/cli/{worktree-provisioning-owner-zzkjycp1.js → worktree-provisioning-owner-72cyddz5.js} +3 -3
  66. package/dist/commands/close.d.ts +8 -1
  67. package/dist/config/evidence-schema.d.ts +6 -6
  68. package/dist/config/plan-schema.d.ts +2 -2
  69. package/dist/config/schema.d.ts +7 -7
  70. package/dist/evidence/task-file.d.ts +16 -16
  71. package/dist/hooks/delegation-gate/worktree-isolation.d.ts +4 -0
  72. package/dist/index.js +603 -559
  73. package/dist/memory/schema.d.ts +3 -3
  74. package/dist/observability/catalog.d.ts +5 -4
  75. package/dist/observability/envelope.d.ts +2 -2
  76. package/dist/scope/scope-binding.d.ts +16 -0
  77. package/dist/services/model-preflight.d.ts +151 -0
  78. package/dist/services/session-reflection.d.ts +24 -0
  79. package/dist/services/swarm-residue.d.ts +151 -0
  80. package/dist/telemetry.d.ts +32 -2
  81. package/dist/tools/knowledge-receipt.d.ts +1 -1
  82. package/dist/tools/placeholder-scan.d.ts +64 -0
  83. package/dist/tools/sast-scan.d.ts +6 -0
  84. package/dist/utils/atomic-write.d.ts +185 -0
  85. package/package.json +1 -1
  86. package/dist/cli/guardrail-explain-hvtyr2fz.js +0 -64
  87. package/dist/cli/{index-fv0s19g9.js → index-w8pgjr75.js} +3 -3
@@ -0,0 +1,185 @@
1
+ /**
2
+ * Canonical atomic-write helper + temp-grammar registry (issue #2035).
3
+ *
4
+ * Single source of truth for:
5
+ * - HOW production code atomically writes files under the project `.swarm/`
6
+ * root: one same-directory write-temp→fsync→rename helper with exact
7
+ * `finally` cleanup of its OWN temp only.
8
+ * - WHAT temporary-file name grammars exist: a frozen registry derived from
9
+ * the writer census so residue scanners classify candidates by exact
10
+ * registered grammars instead of substring guesses.
11
+ *
12
+ * Why the registry lives here: every residue consumer (close clean stage,
13
+ * close dry-run, config doctor, diagnose, quarantine/rollback in
14
+ * `src/services/swarm-residue.ts`) must derive candidates from the SAME
15
+ * registered grammars, and every atomic writer must be classifiable against
16
+ * the same table (see `WRITER_CLASSIFICATION` and its ratchet test).
17
+ *
18
+ * Containment contract (issue #2035 req 1): the canonical target must live
19
+ * under a `.swarm/` root, determined by SPELLING — the nearest `.swarm` path
20
+ * segment between the filesystem root and the target. A pre-existing root
21
+ * must be a real directory (no symlinks), and no path segment between it and
22
+ * the target may be a symlink. Semantics are validateSwarmPath-INSPIRED but
23
+ * NOT identical — see the junction limitation on
24
+ * `assertSwarmContainedTarget`.
25
+ */
26
+ import * as fs from 'node:fs';
27
+ /**
28
+ * A registered temporary-file naming grammar.
29
+ *
30
+ * `match` is applied to the temp file's BASENAME only, case-sensitively —
31
+ * near-misses (unicode/case variants, trailing dots, ADS suffixes) must NOT
32
+ * match, so they are preserved untouched by every scanner.
33
+ */
34
+ export interface SwarmTempGrammar {
35
+ /** Stable id used in reports, manifests, and telemetry (never renamed). */
36
+ readonly id: string;
37
+ readonly era: 'canonical' | 'current' | 'legacy';
38
+ /** Matches the temp basename. Capture group 1 = derivable target basename when `parsesTarget`. */
39
+ readonly match: RegExp;
40
+ /** The grammar embeds a per-invocation uniqueness token (ts/pid/uuid/random). */
41
+ readonly token: 'instance' | 'constant';
42
+ /** Trusted for quarantine when all eligibility gates pass (issue #2035 req 5). */
43
+ readonly quarantineEligible: boolean;
44
+ /** Whether a target basename can be parsed back out of the temp name. */
45
+ readonly parsesTarget: boolean;
46
+ /** Producing writer sites (file:line) — every known producer is listed. */
47
+ readonly producers: readonly string[];
48
+ /** Invariant reason the producer is NOT migrated to the canonical helper. */
49
+ readonly note?: string;
50
+ }
51
+ /**
52
+ * Every temp grammar a swarm writer has ever produced. Grammars marked
53
+ * `quarantineEligible: false` are constant-name temps: with no per-invocation
54
+ * token they are indistinguishable from an in-flight writer of ANY process or
55
+ * from an unrelated file, so scanners report them but never mutate them.
56
+ * ORDER MATTERS: `matchTempGrammar`/`parseTargetBasename` take the FIRST
57
+ * match, so more-specific grammars (uuid, two-token, .json-terminated) must
58
+ * be declared before the generic single-token family.
59
+ */
60
+ export declare const SWARM_TEMP_GRAMMARS: readonly SwarmTempGrammar[];
61
+ /** First registered grammar whose regex matches `basename`, or undefined. */
62
+ export declare function matchTempGrammar(basename: string): SwarmTempGrammar | undefined;
63
+ /**
64
+ * Parse the target basename a temp name was derived from (capture group 1).
65
+ * Returns null for prefix/leading-dot grammars with no derivable target.
66
+ */
67
+ export declare function parseTargetBasename(basename: string): string | null;
68
+ /**
69
+ * Structural classification of every file that constructs temp-file names
70
+ * (ratchet source for tests/unit/utils/atomic-write.test.ts — a new temp
71
+ * constructor must be classified here or the build fails):
72
+ * - migrated: writes through the canonical helper (registry lists its
73
+ * grammar only for historical residue discovery)
74
+ * - registered-bespoke: keeps a dedicated writer with a documented invariant
75
+ * reason in the grammar `note` (issue #2035 req 2)
76
+ * - external: writes outside the `.swarm` containment boundary
77
+ * - reader-only: references temp names without constructing them
78
+ */
79
+ export declare const WRITER_CLASSIFICATION: Readonly<Record<string, 'migrated' | 'registered-bespoke' | 'external' | 'reader-only'>>;
80
+ /**
81
+ * Max depth considered when reasoning about `.swarm` path segments (advisory
82
+ * constant kept for diagnostics; containment itself is spelling-based).
83
+ */
84
+ export declare const MAX_SWARM_ANCESTOR_DEPTH = 8;
85
+ export interface SwarmContainment {
86
+ /** Project root that owns the `.swarm/` directory. */
87
+ projectRoot: string;
88
+ /** Canonical `.swarm/` directory containing the target. */
89
+ swarmRoot: string;
90
+ }
91
+ /**
92
+ * Reject obviously-invalid target spellings before any filesystem access:
93
+ * glob metacharacters, control chars/NUL, and unresolved environment-variable
94
+ * forms (`$VAR`, `%VAR%`, leading `~`). Quarantine/inventory paths and writer
95
+ * paths share this gate (issue #2035 req 7).
96
+ */
97
+ export declare function assertWellFormedTargetPath(targetPath: string): void;
98
+ /**
99
+ * Assert `targetPath` lives beneath a `.swarm/` root.
100
+ *
101
+ * The root is determined by SPELLING: the nearest `.swarm` path segment
102
+ * between the filesystem root and the target. Existence-based ancestor
103
+ * walking is deliberately avoided — a stray `.swarm` in an ancestor (e.g. the
104
+ * OS temp dir) would hijack the walk and reject legitimate first-writes whose
105
+ * own `.swarm` parent does not exist yet (invariant 4: ambiguous ancestor
106
+ * `.swarm` state fails closed). If the `.swarm` root exists it must be a real
107
+ * directory (no symlink), and no existing path segment between it and the
108
+ * target may be a symlink.
109
+ *
110
+ * KNOWN LIMITATION vs `validateSwarmPath` (src/hooks/utils.ts:157, PR review
111
+ * PRR-007): this check detects SYMLINKS via lstatSync().isSymbolicLink(),
112
+ * which returns FALSE for Windows directory JUNCTIONS (a distinct reparse
113
+ * class). validateSwarmPath resolves all reparse points via realpathSync. A
114
+ * junctioned `.swarm/` therefore passes this spelling-based gate. Mitigations
115
+ * in scope: junctions require same-user filesystem write access to create
116
+ * (outside the adversarial-local-process threat model invariant 4 excludes),
117
+ * targets are still spelling-bounded to the `.swarm` subtree, and the
118
+ * spell-time `.swarm` position must already exist in the user's path. Full
119
+ * junction parity would require realpath-resolution of every existing
120
+ * ancestor — deliberately out of budget for the write hot path.
121
+ *
122
+ * Project-boundary enforcement (`.git`/`.opencode` markers, invariant 4) is
123
+ * deliberately NOT re-checked here: that belongs to the tool-layer
124
+ * resolvers (`resolveWorkingDirectory`/`assertProjectRoot`), which have
125
+ * already validated the directory before any writer derived a target from
126
+ * it — validateSwarmPath applies the same split.
127
+ */
128
+ export declare function assertSwarmContainedTarget(targetPath: string): SwarmContainment;
129
+ /** Hard bound on a single atomic write (bounded-write requirement). */
130
+ export declare const MAX_ATOMIC_WRITE_BYTES: number;
131
+ export interface AtomicWriteOptions {
132
+ /** Skip the pre-rename fsync (tests / truly ephemeral data). */
133
+ readonly skipFsync?: boolean;
134
+ /**
135
+ * Override the bounded-write cap (default MAX_ATOMIC_WRITE_BYTES). Exposed
136
+ * so the bound itself is testable without allocating 256 MiB.
137
+ */
138
+ readonly maxBytes?: number;
139
+ }
140
+ /**
141
+ * Dependency-injection seam for failure-injection tests (repo convention;
142
+ * never mock.module — it leaks across bun:test files). Restore in afterEach.
143
+ *
144
+ * The defaults DELEGATE to the live `fs` namespace on every call (instead of
145
+ * capturing the function at module load) so sibling tests that patch
146
+ * `node:fs` via `mock.module` — while still calling through to the real
147
+ * implementation — observe these calls, matching the recording patterns in
148
+ * tests/unit/commands/atomic-writes.test.ts.
149
+ */
150
+ export declare const _internals: {
151
+ randomSuffix: () => string;
152
+ writeSync: (fd: number, buffer: Uint8Array, offset: number, length: number) => number;
153
+ renameSync: (from: string, to: string) => ReturnType<typeof fs.renameSync>;
154
+ unlinkSync: (p: string) => ReturnType<typeof fs.unlinkSync>;
155
+ fsyncSync: (fd: number) => ReturnType<typeof fs.fsyncSync>;
156
+ };
157
+ /**
158
+ * Canonical atomic write under the project `.swarm/` root (issue #2035 req 1):
159
+ * contained target, unique non-predictable same-directory temp, bounded write,
160
+ * fsync+close where supported, platform-safe replace (bounded rename retry on
161
+ * Windows transient locks — never unlink-then-rename, which would break
162
+ * atomicity), and exact finally cleanup of this invocation's temp only.
163
+ *
164
+ * The payload is bounded (≤ MAX_ATOMIC_WRITE_BYTES), so the synchronous
165
+ * temp-write core is the same latency class as the previous per-caller
166
+ * write-temp implementations; the async signature preserves caller shapes.
167
+ */
168
+ export declare function atomicWriteSwarmFile(targetPath: string, content: string | Uint8Array, options?: AtomicWriteOptions): Promise<void>;
169
+ /** Synchronous variant of {@link atomicWriteSwarmFile} (same core). */
170
+ export declare function atomicWriteSwarmFileSync(targetPath: string, content: string | Uint8Array, options?: AtomicWriteOptions): void;
171
+ /**
172
+ * Canonical atomic write WITHOUT the `.swarm` containment requirement.
173
+ *
174
+ * Documented invariant reason this variant exists (issue #2035 req 2): the
175
+ * legacy shared writer `atomicWriteFile` (src/evidence/task-file.ts) serves
176
+ * DUAL destinations — `.swarm/evidence/**` files AND the linked/hive
177
+ * knowledge stores whose platform-data/link directories live OUTSIDE any
178
+ * `.swarm` root (src/hooks/knowledge-store.ts, knowledge-link.ts,
179
+ * memory-link.ts, family migrations). Those callers migrate to this variant
180
+ * so they still gain the canonical grammar, fsync, bounded retry, exact
181
+ * own-temp cleanup, and cache invalidation — everything except root
182
+ * containment, which their destinations make inapplicable. New `.swarm`
183
+ * callers MUST use {@link atomicWriteSwarmFile}.
184
+ */
185
+ export declare function atomicWriteFileAnyRoot(targetPath: string, content: string | Uint8Array, options?: AtomicWriteOptions): Promise<void>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-swarm",
3
- "version": "7.144.8",
3
+ "version": "7.145.1",
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",
@@ -1,64 +0,0 @@
1
- // @bun
2
- import {
3
- handleGuardrailExplain
4
- } from "./index-r2rkwvzq.js";
5
- import"./index-c2rpht77.js";
6
- import"./index-nmy6rss1.js";
7
- import"./index-r14qx363.js";
8
- import"./index-z4fssj97.js";
9
- import"./index-134d35c1.js";
10
- import"./index-abtrcs16.js";
11
- import"./index-6z5jtf7d.js";
12
- import"./index-wknz5c8q.js";
13
- import"./index-y8552snf.js";
14
- import"./index-d1dbpxxk.js";
15
- import"./index-70ha9e09.js";
16
- import"./index-c8s9a3zh.js";
17
- import"./index-9ss2m4rs.js";
18
- import"./index-f36ybbsv.js";
19
- import"./index-hkdgkkhb.js";
20
- import"./index-sxe5nyq4.js";
21
- import"./index-xx8tm58n.js";
22
- import"./index-8dbzaf0m.js";
23
- import"./index-vdha477y.js";
24
- import"./index-rtry5xyf.js";
25
- import"./index-zsrtt42s.js";
26
- import"./index-n4hwcsbd.js";
27
- import"./index-cwtpqm5f.js";
28
- import"./index-jdxnzbah.js";
29
- import"./index-xp5g9eps.js";
30
- import"./index-k7fk9fjs.js";
31
- import"./index-tffg4mwr.js";
32
- import"./index-556ja8an.js";
33
- import"./index-7sy3aa9m.js";
34
- import"./index-wx8zdh4a.js";
35
- import"./index-3g0xk6tk.js";
36
- import"./index-85gkedsf.js";
37
- import"./index-3k3nbs52.js";
38
- import"./index-cx51wy0c.js";
39
- import"./index-0v1f2sdb.js";
40
- import"./index-gprxjmm7.js";
41
- import"./index-n832052r.js";
42
- import"./index-fv0s19g9.js";
43
- import"./index-z6xqpmqg.js";
44
- import"./index-7qb0hn8n.js";
45
- import"./index-gfvkttvd.js";
46
- import"./index-v3y3qg48.js";
47
- import"./index-9e6fdz2h.js";
48
- import"./index-4rhhvd1a.js";
49
- import"./index-zjygnfay.js";
50
- import"./index-ae75rja9.js";
51
- import"./index-h1p08s3n.js";
52
- import"./index-9s8drsf9.js";
53
- import"./index-ed5ykebp.js";
54
- import"./index-bk5tah7q.js";
55
- import"./index-f9vvg5xb.js";
56
- import"./index-1jsmmx7y.js";
57
- import"./index-7g4c7s5r.js";
58
- import"./index-bpmtbmy9.js";
59
- import"./index-zj6t9zgx.js";
60
- import"./index-zgwm4ryv.js";
61
- import"./index-a76rekgs.js";
62
- export {
63
- handleGuardrailExplain
64
- };
@@ -2,12 +2,12 @@
2
2
  import {
3
3
  SwarmError
4
4
  } from "./index-z6xqpmqg.js";
5
- import {
6
- readCachedTextFile
7
- } from "./index-ed5ykebp.js";
8
5
  import {
9
6
  bunFile
10
7
  } from "./index-zj6t9zgx.js";
8
+ import {
9
+ readCachedTextFile
10
+ } from "./index-ed5ykebp.js";
11
11
  import {
12
12
  warn
13
13
  } from "./index-zgwm4ryv.js";