opencode-swarm 7.159.1 → 7.159.2

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 (67) hide show
  1. package/.opencode/skills/engineering-conventions/SKILL.md +20 -0
  2. package/.opencode/skills/execute/SKILL.md +2 -2
  3. package/dist/cli/{coder-settlement-d89tqam8.js → coder-settlement-hny3vh3e.js} +6 -6
  4. package/dist/cli/{config-doctor-8zawz3qh.js → config-doctor-00ex0s3k.js} +2 -2
  5. package/dist/cli/{core-pp64ys5v.js → core-03tedwzg.js} +1 -1
  6. package/dist/cli/{curation-policy-2gq8307w.js → curation-policy-z0a5akng.js} +4 -4
  7. package/dist/cli/{curator-llm-factory-m3yw6sn5.js → curator-llm-factory-24bfn7h1.js} +28 -28
  8. package/dist/cli/{curator-mpqpbr0r.js → curator-n81nzdw8.js} +28 -28
  9. package/dist/cli/{evidence-summary-service-qaq1eba9.js → evidence-summary-service-nz7y1w2a.js} +10 -10
  10. package/dist/cli/{gate-evidence-r0c71n04.js → gate-evidence-dxafmzrn.js} +4 -4
  11. package/dist/cli/{guardrail-explain-5z64w3ah.js → guardrail-explain-b3k9xrx9.js} +29 -29
  12. package/dist/cli/{guardrail-log-f9nf687y.js → guardrail-log-t8c7acxg.js} +3 -3
  13. package/dist/cli/{guardrail-reset-yjwk20rb.js → guardrail-reset-0ft2gf03.js} +28 -28
  14. package/dist/cli/{hive-promoter-zjtgbh4w.js → hive-promoter-brq9cx7c.js} +28 -28
  15. package/dist/cli/{index-v3jy0tc6.js → index-1e9rzhmr.js} +1 -1
  16. package/dist/cli/{index-wae55z9w.js → index-1xcve0gc.js} +1 -1
  17. package/dist/cli/{index-wttqayp1.js → index-200myvdx.js} +2 -2
  18. package/dist/cli/{index-1qpagg2t.js → index-6sheh3yp.js} +1 -1
  19. package/dist/cli/{index-f3yphmk6.js → index-7tjamatf.js} +5 -5
  20. package/dist/cli/{index-8819vcke.js → index-8ahjx7vt.js} +4 -4
  21. package/dist/cli/{index-ve3v09kq.js → index-8gh97gkz.js} +1 -1
  22. package/dist/cli/{index-86dvzyac.js → index-9ev0bbqh.js} +240 -90
  23. package/dist/cli/{index-gkw7kq6z.js → index-b2dh37cf.js} +5 -5
  24. package/dist/cli/{index-bz7ayg01.js → index-b5s1n149.js} +3 -3
  25. package/dist/cli/{index-bea260ta.js → index-bmst1sje.js} +6 -6
  26. package/dist/cli/{index-4k9pqbxw.js → index-caqjwnak.js} +1 -1
  27. package/dist/cli/{index-7yg4ypyg.js → index-dgt8z19x.js} +1 -1
  28. package/dist/cli/{index-60mzwj91.js → index-e1jcdpdg.js} +1 -1
  29. package/dist/cli/{index-gprxjmm7.js → index-ebz97mks.js} +3 -1
  30. package/dist/cli/{index-54pkyasv.js → index-egc8d995.js} +1 -1
  31. package/dist/cli/{index-zmc8mm7v.js → index-eh1gh043.js} +2 -2
  32. package/dist/cli/{index-tvz43tea.js → index-jd7mz4yg.js} +1 -1
  33. package/dist/cli/{index-36sgq7n9.js → index-k7kvrwbj.js} +30 -30
  34. package/dist/cli/{index-zxkv8x5n.js → index-ky2r092m.js} +1 -1
  35. package/dist/cli/{index-4nc9npx5.js → index-m0gfzxw1.js} +2 -2
  36. package/dist/cli/{index-2z00wqvb.js → index-mcan50mx.js} +4 -4
  37. package/dist/cli/{index-9fphcxes.js → index-nmp47dmm.js} +1 -1
  38. package/dist/cli/{index-3rcqxbwt.js → index-p2m1skjz.js} +1 -1
  39. package/dist/cli/{index-a5w29k1t.js → index-q8yma345.js} +1 -1
  40. package/dist/cli/{index-yw26j0q7.js → index-qypnqmcj.js} +5 -5
  41. package/dist/cli/{index-9yxyc1gb.js → index-rq461prn.js} +4 -4
  42. package/dist/cli/{index-k6y6btb6.js → index-v7wm4mw8.js} +1 -1
  43. package/dist/cli/{index-g6d8xam2.js → index-vq4d1h7t.js} +1 -1
  44. package/dist/cli/{index-6z53bew2.js → index-w1rhyqw2.js} +1 -1
  45. package/dist/cli/{index-3scbg6n2.js → index-wzc6vzq6.js} +2 -2
  46. package/dist/cli/{index-29wav1x0.js → index-y55hqgcj.js} +4 -4
  47. package/dist/cli/index.js +28 -28
  48. package/dist/cli/{knowledge-escalator-585m4927.js → knowledge-escalator-rxagfxnk.js} +10 -10
  49. package/dist/cli/{knowledge-events-ssegqfmy.js → knowledge-events-ymwdv799.js} +8 -8
  50. package/dist/cli/{knowledge-link-a9fafeb3.js → knowledge-link-n1825n09.js} +3 -3
  51. package/dist/cli/{knowledge-store-nznky6cv.js → knowledge-store-nxm4xvvq.js} +4 -4
  52. package/dist/cli/{knowledge-validator-3byea8gp.js → knowledge-validator-gtmq35k8.js} +6 -6
  53. package/dist/cli/{pending-delegations-qrjq3s29.js → pending-delegations-zdgazhdf.js} +1 -1
  54. package/dist/cli/{pr-review-reentry-authorization-w8ja0m2p.js → pr-review-reentry-authorization-jgzb0pma.js} +28 -28
  55. package/dist/cli/{pr-subscriptions-fvmey1x6.js → pr-subscriptions-pxv24d5k.js} +2 -2
  56. package/dist/cli/{runner-atbehryj.js → runner-fzgkhx6a.js} +4 -4
  57. package/dist/cli/{scan-cursor-kv9scb2v.js → scan-cursor-fasdj7kj.js} +5 -5
  58. package/dist/cli/{schema-a7f88yc3.js → schema-3x28z3rp.js} +1 -1
  59. package/dist/cli/{scope-persistence-x6de46s4.js → scope-persistence-p8dnxfhx.js} +5 -5
  60. package/dist/cli/{skill-generator-vwcrfrw3.js → skill-generator-6tjyffgd.js} +12 -12
  61. package/dist/cli/{worktree-collision-ownership-7kf9mm5z.js → worktree-collision-ownership-3bbn1n2r.js} +3 -3
  62. package/dist/cli/{worktree-isolation-6zh5bxrd.js → worktree-isolation-1470tnxc.js} +28 -28
  63. package/dist/config/evidence-schema.d.ts +51 -0
  64. package/dist/index.js +6 -6
  65. package/dist/tools/sast-baseline.d.ts +120 -3
  66. package/dist/tools/sast-scan.d.ts +25 -1
  67. package/package.json +1 -1
@@ -16,17 +16,44 @@
16
16
  * `${relFile}|${rule_id}|L${line}|UNSTABLE|#${occurrenceIndex}`
17
17
  * Unstable fingerprints are ALWAYS treated as NEW findings (fail-closed).
18
18
  *
19
+ * Reflow identity (schema 1.1.0, issue #2302):
20
+ * The 3-line window hash is sensitive to adjacent-line edits and the
21
+ * occurrence index shifts when an identical same-rule line is inserted
22
+ * above a baselined one — both reclassify an unchanged pre-existing
23
+ * finding as NEW. Every stable entry therefore also records a
24
+ * position-independent reflow key
25
+ * `${relFile}|${rule_id}|${sha256(trimmed flagged line).slice(0,16)}`
26
+ * (aligned 1:1 with fingerprints[] in reflow_keys[]). Diff scans match
27
+ * current findings against the baseline as a multiset of reflow keys
28
+ * BEFORE classifying NEW; matches are reported as `moved` (never gating).
29
+ * A 1.0.0 baseline has no reflow keys (they cannot be reconstructed after
30
+ * the fact — findings_snapshot stores no line content) and degrades to
31
+ * exact matching only until its next capture rewrites it as 1.1.0.
32
+ *
33
+ * Absorption triage (schema 1.1.0, issue #2302):
34
+ * Merging a finding that matches neither the exact fingerprints nor the
35
+ * reflow multiset of the prior baseline is a NOVEL ABSORPTION. EVERY novel
36
+ * absorption — in already-indexed OR first-time-indexed files — requires an
37
+ * explicit refreshRationale; without it the capture is BLOCKED and the
38
+ * baseline is left untouched (fail-closed: a bare failure-response
39
+ * recapture can never silently accept a coder-introduced vulnerability).
40
+ * With a rationale, every absorbed finding records who/when/rationale in
41
+ * triage_log[]. First writes (`status:'written'`) are snapshots, not
42
+ * absorptions, and stay free.
43
+ *
19
44
  * Merge semantics:
20
45
  * On every capture for a set of files, ALL prior fingerprints for those files
21
46
  * are removed (full prune, engine-agnostic) before inserting current findings.
22
47
  * This prevents stale cross-engine fingerprints from causing false-pass verdicts.
23
48
  */
24
49
  import type { SastScanFinding } from './sast-scan';
25
- export declare const BASELINE_SCHEMA_VERSION: "1.0.0";
50
+ export declare const BASELINE_SCHEMA_VERSION: "1.1.0";
51
+ /** Baselines written before issue #2302 — loaded read-only, exact matching only. */
52
+ export declare const LEGACY_BASELINE_SCHEMA_VERSION: "1.0.0";
26
53
  /** Maximum findings to store in baseline (heuristic — open for tuning). */
27
54
  export declare const MAX_BASELINE_FINDINGS = 2000;
28
55
  export interface SastBaselineFile {
29
- schema_version: '1.0.0';
56
+ schema_version: '1.0.0' | '1.1.0';
30
57
  phase: number;
31
58
  created_at: string;
32
59
  updated_at: string;
@@ -35,14 +62,42 @@ export interface SastBaselineFile {
35
62
  files_indexed: string[];
36
63
  /** Fingerprint strings for all indexed findings. */
37
64
  fingerprints: string[];
65
+ /**
66
+ * Position-independent reflow identities aligned 1:1 with fingerprints[]
67
+ * (`${relFile}|${rule_id}|${sha256(trimmed flagged line).slice(0,16)}`,
68
+ * '' for unstable entries). Absent in 1.0.0 files — exact matching only.
69
+ */
70
+ reflow_keys?: string[];
38
71
  /** Full findings snapshot (for auditing / debugging). */
39
72
  findings_snapshot: SastScanFinding[];
73
+ /**
74
+ * Audit trail for every novel absorption into an existing baseline
75
+ * (issue #2302). First writes record no entries — a snapshot is not an
76
+ * acceptance. Entries are dropped when their fingerprint no longer
77
+ * survives in fingerprints[].
78
+ */
79
+ triage_log?: BaselineTriageEntry[];
40
80
  /** True if the snapshot was truncated at MAX_BASELINE_FINDINGS. */
41
81
  truncated: boolean;
42
82
  }
83
+ export interface BaselineTriageEntry {
84
+ /** Fingerprint of the absorbed finding (post-capture form). */
85
+ fingerprint: string;
86
+ /** Canonical relative path of the file containing the absorbed finding. */
87
+ rel_file: string;
88
+ rule_id: string;
89
+ /** Caller-supplied refresh rationale, or the first-time-index auto-rationale. */
90
+ rationale: string;
91
+ /** Session id of the capturing caller, or 'unknown-session'. */
92
+ actor: string;
93
+ /** ISO timestamp of the absorption. */
94
+ absorbed_at: string;
95
+ }
43
96
  export type LoadBaselineResult = {
44
97
  status: 'found';
45
98
  fingerprints: Set<string>;
99
+ /** Reflow keys aligned with the loaded fingerprints (empty for 1.0.0 files). */
100
+ reflowKeys: string[];
46
101
  bundle: SastBaselineFile;
47
102
  } | {
48
103
  status: 'not_found';
@@ -60,6 +115,18 @@ export interface IndexedFinding {
60
115
  index: number;
61
116
  stable: boolean;
62
117
  fingerprint: string;
118
+ /** Position-independent reflow identity ('' when unstable — never reflow-matched). */
119
+ reflowKey: string;
120
+ }
121
+ export interface BaselinePartition {
122
+ preExisting: SastScanFinding[];
123
+ moved: SastScanFinding[];
124
+ newFindings: SastScanFinding[];
125
+ }
126
+ export interface BlockedAbsorptionFinding {
127
+ fingerprint: string;
128
+ rel_file: string;
129
+ rule_id: string;
63
130
  }
64
131
  export type CaptureResult = {
65
132
  status: 'written';
@@ -69,6 +136,14 @@ export type CaptureResult = {
69
136
  status: 'merged';
70
137
  path: string;
71
138
  fingerprint_count: number;
139
+ /** Novel absorptions recorded in triage_log by this capture. */
140
+ absorbed_finding_count: number;
141
+ } | {
142
+ status: 'absorption_blocked';
143
+ path: string;
144
+ /** Novel findings in already-indexed files (bounded to MAX_BLOCKED_LIST). */
145
+ blocked: BlockedAbsorptionFinding[];
146
+ message: string;
72
147
  } | {
73
148
  status: 'error';
74
149
  message: string;
@@ -89,13 +164,34 @@ export declare function normalizeFindingPath(directory: string, file: string): s
89
164
  */
90
165
  export declare function fingerprintFinding(finding: SastScanFinding, directory: string, occurrenceIndex: number): FingerprintResult;
91
166
  /**
92
- * Assign occurrence indices to a batch of findings.
167
+ * Assign occurrence indices and reflow identities to a batch of findings.
93
168
  *
94
169
  * Two findings that produce the same (relFile, rule_id, contentHash) tuple
95
170
  * — e.g., copy-pasted vulnerable lines — receive different indices so they
96
171
  * get distinct fingerprints and can be individually classified.
172
+ *
173
+ * The reflow key hashes only the flagged line's own (trimmed) content, so it
174
+ * survives adjacent-line edits, pure line moves, and occurrence-index shifts
175
+ * — the three fingerprint instabilities fixed by issue #2302. It is '' when
176
+ * the fingerprint is unstable; unstable findings never reflow-match.
97
177
  */
98
178
  export declare function assignOccurrenceIndices(findings: SastScanFinding[], directory: string): IndexedFinding[];
179
+ /**
180
+ * Partition current findings against a loaded baseline (issue #2302).
181
+ *
182
+ * 1. Exact: stable fingerprint present in baselineFingerprints → pre-existing.
183
+ * Each exact match consumes one count of its reflow key — an exact
184
+ * fingerprint match implies the same flagged-line content, so a baseline
185
+ * entry can never absorb both an exact and a reflow match.
186
+ * 2. Reflow: stable finding whose reflow key still has unconsumed baseline
187
+ * counts → moved (same finding, new position/window; never gating).
188
+ * 3. Anything else — including every unstable finding — is NEW (fail-closed).
189
+ *
190
+ * Multiset counting keeps duplicate content honest: a baseline with one
191
+ * `exec(cmd)` line absorbs exactly one current `exec(cmd)` line; a second
192
+ * identical line stays NEW.
193
+ */
194
+ export declare function partitionAgainstBaseline(indexed: IndexedFinding[], baselineFingerprints: Set<string>, baselineReflowKeys: readonly string[]): BaselinePartition;
99
195
  /**
100
196
  * Capture or merge SAST findings into the phase-scoped baseline.
101
197
  *
@@ -105,6 +201,15 @@ export declare function assignOccurrenceIndices(findings: SastScanFinding[], dir
105
201
  * This full-prune (engine-agnostic) prevents stale cross-engine entries from
106
202
  * causing false-pass verdicts on later full-engine diff scans.
107
203
  *
204
+ * Absorption triage (issue #2302):
205
+ * Current findings that match the prior baseline (exact fingerprint or
206
+ * reflow key) are re-fingerprinted mechanically. A finding that matches
207
+ * neither is a NOVEL ABSORPTION: the capture is BLOCKED unless
208
+ * `refreshRationale` is supplied (the baseline is left untouched —
209
+ * fail-closed), for already-indexed AND first-time-indexed files alike.
210
+ * With a rationale, every absorbed finding records who (`actor`)/when/
211
+ * rationale in `triage_log`.
212
+ *
108
213
  * Severity threshold:
109
214
  * Callers MUST pass ALL findings regardless of severity threshold so the
110
215
  * baseline captures the full pre-existing surface. Threshold filtering is
@@ -117,12 +222,23 @@ export declare function assignOccurrenceIndices(findings: SastScanFinding[], dir
117
222
  export declare function captureOrMergeBaseline(directory: string, phase: number, findings: SastScanFinding[], engine: 'tier_a' | 'tier_a+tier_b', scannedFiles: string[], opts?: {
118
223
  force?: boolean;
119
224
  abortSignal?: AbortSignal;
225
+ /** Audited rationale required to absorb novel findings in already-indexed files. */
226
+ refreshRationale?: string;
227
+ /** Identity recorded in triage_log entries (session id of the caller). */
228
+ actor?: string;
120
229
  }): Promise<CaptureResult>;
121
230
  /**
122
231
  * Load the SAST baseline for a given phase.
123
232
  *
124
233
  * Returns 'not_found' when no baseline file exists (first run for phase).
125
234
  * Returns 'invalid_schema' when the file is present but unparseable.
235
+ *
236
+ * Schema versions: 1.1.0 files carry reflow_keys (reflow matching active);
237
+ * legacy 1.0.0 files load read-only with an empty reflowKeys array — exact
238
+ * matching only until the next capture rewrites them as 1.1.0 (reflow keys
239
+ * cannot be reconstructed retroactively; findings_snapshot stores no line
240
+ * content). A present-but-misaligned reflow_keys array is corruption and
241
+ * fails closed to invalid_schema (legacy gating; recoverable by recapture).
126
242
  */
127
243
  export declare function loadBaseline(directory: string, phase: number): LoadBaselineResult;
128
244
  /**
@@ -132,6 +248,7 @@ export declare function loadBaseline(directory: string, phase: number): LoadBase
132
248
  export declare const _internals: {
133
249
  fingerprintFinding: typeof fingerprintFinding;
134
250
  assignOccurrenceIndices: typeof assignOccurrenceIndices;
251
+ partitionAgainstBaseline: typeof partitionAgainstBaseline;
135
252
  captureOrMergeBaseline: typeof captureOrMergeBaseline;
136
253
  loadBaseline: typeof loadBaseline;
137
254
  };
@@ -32,6 +32,16 @@ export interface SastScanInput {
32
32
  * baseline diff mode: only findings absent from the phase baseline fail.
33
33
  */
34
34
  phase?: number;
35
+ /**
36
+ * Audited refresh rationale (issue #2302). Required when a capture would
37
+ * absorb findings that match neither the exact fingerprints nor the
38
+ * reflow identities of the prior baseline for already-indexed files —
39
+ * without it that capture is BLOCKED and the baseline is left untouched.
40
+ * Only meaningful together with capture_baseline: true.
41
+ */
42
+ baseline_refresh_rationale?: string;
43
+ /** Session id of the calling agent, recorded as the triage actor. */
44
+ session_id?: string;
35
45
  /** Host/tool cancellation propagated to optional external scanners. */
36
46
  abort_signal?: AbortSignal;
37
47
  }
@@ -67,17 +77,31 @@ export interface SastScanResult {
67
77
  files_skipped_non_code?: number;
68
78
  };
69
79
  /** 'baseline_captured' when capture_baseline:true succeeded */
70
- status?: 'baseline_captured' | 'baseline_merged';
80
+ status?: 'baseline_captured' | 'baseline_merged' | 'baseline_absorption_blocked';
71
81
  /** Number of findings recorded in the baseline (capture mode only) */
72
82
  finding_count?: number;
83
+ /** Novel findings absorbed into the baseline under a refresh rationale (capture mode only) */
84
+ absorbed_finding_count?: number;
73
85
  /** Findings NOT present in the baseline (diff mode only) */
74
86
  new_findings?: SastScanFinding[];
75
87
  /** Findings that match the baseline (diff mode only) */
76
88
  pre_existing_findings?: SastScanFinding[];
89
+ /**
90
+ * Findings that match the baseline via reflow identity — same finding,
91
+ * new position/window (diff mode only, issue #2302). Reported separately;
92
+ * never gate the verdict.
93
+ */
94
+ moved_findings?: SastScanFinding[];
77
95
  /** True when a baseline was loaded and diff mode was active */
78
96
  baseline_used?: boolean;
79
97
  /** True when pre_existing_findings were truncated to fit result limits */
80
98
  truncated_pre_existing?: boolean;
99
+ /**
100
+ * True when moved_findings were truncated to fit result limits. Advisory
101
+ * telemetry only (no in-tree consumer) — kept for parity with
102
+ * truncated_pre_existing and for future audit consumers.
103
+ */
104
+ truncated_moved_findings?: boolean;
81
105
  }
82
106
  export type SastFailureKind = 'semgrep_process_exit' | 'semgrep_timeout' | 'semgrep_cancelled' | 'semgrep_output_limit' | 'semgrep_spawn_error' | 'semgrep_invalid_output' | 'semgrep_scan_error' | 'semgrep_unexpected' | 'semgrep_unclassified' | 'coverage' | 'cancelled' | 'invalid_input';
83
107
  export interface SastScanFinding {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-swarm",
3
- "version": "7.159.1",
3
+ "version": "7.159.2",
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",