opencode-swarm 7.141.1 → 7.142.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 (64) hide show
  1. package/dist/cli/{config-doctor-xs2p0xy3.js → config-doctor-7xqerhnw.js} +2 -2
  2. package/dist/cli/{core-znrxk8gw.js → core-nwmpg9t8.js} +1 -1
  3. package/dist/cli/{curation-policy-j1fbc3ry.js → curation-policy-bzk13bj2.js} +5 -5
  4. package/dist/cli/{curator-a95x81ek.js → curator-3wsaz7ay.js} +26 -26
  5. package/dist/cli/{curator-llm-factory-ak7p0scv.js → curator-llm-factory-kbkddqk2.js} +26 -26
  6. package/dist/cli/{evidence-summary-service-2gk48s5s.js → evidence-summary-service-wwfvpvxq.js} +9 -9
  7. package/dist/cli/{gate-evidence-rt9034ft.js → gate-evidence-3mazsjrq.js} +4 -4
  8. package/dist/cli/{guardrail-explain-4st3vc3d.js → guardrail-explain-rmz1yjzw.js} +27 -27
  9. package/dist/cli/{guardrail-log-vjexgpfm.js → guardrail-log-8m4dnkgd.js} +3 -3
  10. package/dist/cli/{hive-promoter-g9ad9vad.js → hive-promoter-ss8dm52r.js} +26 -26
  11. package/dist/cli/{index-q4vaar2b.js → index-0dvx8f03.js} +2 -2
  12. package/dist/cli/{index-w9613ace.js → index-26ynh10w.js} +6 -6
  13. package/dist/cli/{index-39xs96mk.js → index-2p3h7det.js} +1 -1
  14. package/dist/cli/{index-9d4gck4e.js → index-338zfvff.js} +58 -34
  15. package/dist/cli/{index-nse60anv.js → index-520ev2d7.js} +1 -1
  16. package/dist/cli/{index-dx1mdsrj.js → index-56knmbwf.js} +2031 -1029
  17. package/dist/cli/{index-ry609ctr.js → index-67vxmh1v.js} +7 -7
  18. package/dist/cli/{index-f1hsrgw1.js → index-78p6nvcv.js} +1 -1
  19. package/dist/cli/{index-hjf8pjd4.js → index-7c5xtcfm.js} +3 -3
  20. package/dist/cli/{index-mr397tze.js → index-8g5aa1s7.js} +2 -2
  21. package/dist/cli/{index-qskz8j2z.js → index-99eftm6b.js} +1 -1
  22. package/dist/cli/{index-z8yr1yra.js → index-ad93kz8m.js} +1 -1
  23. package/dist/cli/{index-g29r600w.js → index-ae0j9qpc.js} +28 -28
  24. package/dist/cli/{index-zqshpey0.js → index-amepv9dh.js} +3 -3
  25. package/dist/cli/{index-zbj3yrrd.js → index-bd2h7r2w.js} +1 -1
  26. package/dist/cli/{index-wbf8sv70.js → index-e4y7mfp0.js} +1 -1
  27. package/dist/cli/{index-c2hczjhp.js → index-em1kfnss.js} +1 -1
  28. package/dist/cli/{index-8056f16v.js → index-eytxcbm8.js} +3 -3
  29. package/dist/cli/{index-kq5p3nm3.js → index-gcn7tsr3.js} +1 -1
  30. package/dist/cli/{index-3d13jkzq.js → index-h2vpk15y.js} +2 -2
  31. package/dist/cli/{index-5ykn39wq.js → index-hgydkvty.js} +2 -2
  32. package/dist/cli/{index-2ygp3pnx.js → index-hncahn40.js} +5 -5
  33. package/dist/cli/{index-vnr917xf.js → index-kkxt9g8d.js} +3 -3
  34. package/dist/cli/{index-44nf5s90.js → index-mbeqw4cb.js} +1 -1
  35. package/dist/cli/{index-3gfdb0t9.js → index-sh3r66tt.js} +1 -1
  36. package/dist/cli/{index-8s4vnqts.js → index-tzbd5050.js} +4 -4
  37. package/dist/cli/{index-pkxt2rg2.js → index-v8f3wa0e.js} +1 -1
  38. package/dist/cli/{index-ysapwztd.js → index-vwyamc2d.js} +2 -2
  39. package/dist/cli/{index-v250345n.js → index-ycd63sz3.js} +1 -1
  40. package/dist/cli/{index-c6m3t5n2.js → index-z7eeq0tt.js} +6 -6
  41. package/dist/cli/index.js +39 -26
  42. package/dist/cli/{knowledge-escalator-5xg6vmr4.js → knowledge-escalator-w235g6ce.js} +10 -10
  43. package/dist/cli/{knowledge-events-qvzpqt5b.js → knowledge-events-amn94djz.js} +8 -8
  44. package/dist/cli/{knowledge-link-x86ebng8.js → knowledge-link-xned4jbm.js} +4 -4
  45. package/dist/cli/{knowledge-store-k5td1vqx.js → knowledge-store-3vb855ta.js} +5 -5
  46. package/dist/cli/{knowledge-validator-zz26gk5d.js → knowledge-validator-a8c185hw.js} +7 -7
  47. package/dist/cli/{pending-delegations-7xsagjy5.js → pending-delegations-8ccjby4b.js} +3 -3
  48. package/dist/cli/{pr-subscriptions-r6cdsa3t.js → pr-subscriptions-gn7r3bg7.js} +3 -3
  49. package/dist/cli/{runner-nm3baddf.js → runner-rhgkhy5e.js} +5 -5
  50. package/dist/cli/{scan-cursor-nhcpebh5.js → scan-cursor-vjbjm140.js} +6 -6
  51. package/dist/cli/{schema-6ecb0xhn.js → schema-dd8mzm6k.js} +1 -1
  52. package/dist/cli/{scope-persistence-yet1hvmq.js → scope-persistence-8j8d4874.js} +6 -6
  53. package/dist/cli/{skill-generator-j0mbd2pp.js → skill-generator-a4apb7c2.js} +12 -12
  54. package/dist/cli/{telemetry-zex3zv3v.js → telemetry-k9nxy24s.js} +1 -1
  55. package/dist/cli/{worktree-collision-ownership-n41qw3n8.js → worktree-collision-ownership-183jk2dv.js} +3 -3
  56. package/dist/cli/{worktree-isolation-445zjngp.js → worktree-isolation-j71zz7g9.js} +26 -26
  57. package/dist/commands/hive-quarantine.d.ts +23 -0
  58. package/dist/commands/registry.d.ts +9 -0
  59. package/dist/hooks/hive-transaction.d.ts +41 -0
  60. package/dist/index.js +290 -277
  61. package/dist/knowledge/hive-quarantine.d.ts +156 -0
  62. package/dist/observability/catalog.d.ts +2 -2
  63. package/dist/telemetry.d.ts +1 -1
  64. package/package.json +1 -1
@@ -0,0 +1,156 @@
1
+ /**
2
+ * Human-only exact-ID quarantine for the machine-global hive knowledge store (issue #2033).
3
+ *
4
+ * Problem: the hive store (`shared-learnings.jsonl`, resolved by
5
+ * `src/knowledge/hive-paths.ts`) has been polluted by leaked test fixtures, and no safe
6
+ * remediation existed: `quarantineEntry` is swarm-tier only, `knowledge_archive` refuses
7
+ * hive-tier quarantine, and bulk text scrubbing would destroy legitimate lessons (a real
8
+ * store may legitimately contain test-like text). Parent #1823: never bulk delete.
9
+ *
10
+ * This module implements the adjudicated exact-ID flow:
11
+ * preview — read-only snapshot of exact candidate IDs, per-entry hashes/provenance, a
12
+ * store fingerprint, and a confirmation token bound to preview + store +
13
+ * plugin version (TTL-bounded) AND HMAC-signed with a per-install secret
14
+ * (not derivable from store contents — PR #2200 review CC-1).
15
+ * commit — a validated backup + manifest written and hash-verified BEFORE any
16
+ * mutation (outside the hive lock, keeping the locked closure fast per
17
+ * hive-transaction's contract), then ONE `transactHiveStore` transaction
18
+ * that re-verifies the live file hash against the backup under lock (any
19
+ * drift — including duplicate-id ambiguity — aborts with no mutation;
20
+ * clean aborts clean up the orphaned backup dir), quarantines EXACTLY the
21
+ * selected IDs with audit + sidecar records staged under the lock, and
22
+ * verifies counts afterwards with an HONEST auto-restore report (a failed
23
+ * restore is never claimed as success).
24
+ * rollback — idempotent restore of the EXACT original line bytes from the manifest's
25
+ * backup, aborting on collision (an id re-promoted with different content).
26
+ * Backup lookup resolves symlinks/reparse points on BOTH sides — a lexical
27
+ * prefix compare alone is dead code against a planted link (review CC-4).
28
+ *
29
+ * Selection is EXACT-ID only: no text, substring, "test-looking phrase", cohort, age, or
30
+ * blacklist matching exists anywhere in this module, and there is no bulk operation.
31
+ *
32
+ * Byte-fidelity note: restored ids are written through the transaction's
33
+ * `rawLineOverrides` channel as the EXACT original line bytes, and every restore is
34
+ * verified against the manifest's `raw_line_sha256` (hex sha256 of the line bytes
35
+ * INCLUDING the trailing newline) before success is reported. Two standing-transaction
36
+ * disclosures apply to everything EXCEPT the selected ids: unselected entries may be
37
+ * re-serialized by the normalize-on-read pipeline, and unparseable (corrupt) lines are
38
+ * DROPPED by any commit rewrite — they survive only in the hash-verified backup copy,
39
+ * from which they can be recovered manually.
40
+ *
41
+ * The module holds no module-level mutable state (invariant 8) and performs no work on
42
+ * the plugin-init path (invariant 1) — it is loaded only by the human-only
43
+ * `knowledge hive-quarantine` command dispatch.
44
+ */
45
+ import { chmod, copyFile, mkdir, readdir, readFile, realpath, rm, stat, writeFile } from 'node:fs/promises';
46
+ import { transactHiveStore } from '../hooks/hive-transaction.js';
47
+ import { emit } from '../telemetry.js';
48
+ import { resolveHiveDataDir, resolveHiveKnowledgePath } from './hive-paths.js';
49
+ /** Confirmation token TTL (freshness window). */
50
+ export declare const HIVE_QUARANTINE_TOKEN_TTL_MS: number;
51
+ /** Upper bound of exact IDs per operation (tokens embed per-id hashes). */
52
+ export declare const MAX_IDS_PER_OPERATION = 200;
53
+ /** Quarantine sidecar living beside the store in the hive data dir. */
54
+ export declare const HIVE_QUARANTINE_SIDECAR = "shared-learnings-quarantined.jsonl";
55
+ /** Backup directory root inside the hive data dir. */
56
+ export declare const HIVE_QUARANTINE_BACKUP_DIR = "quarantine-backups";
57
+ export type HiveQuarantineAbortCode = 'invalid_ids' | 'id_not_found' | 'duplicate_id' | 'duplicate_id_in_store' | 'too_many_ids' | 'invalid_token' | 'token_expired' | 'store_drift' | 'id_changed' | 'id_missing' | 'version_changed' | 'backup_failed' | 'backup_corrupt' | 'backup_not_found' | 'rollback_collision' | 'ambiguous_backup' | 'transaction_failed';
58
+ export interface HiveQuarantinePreviewRecord {
59
+ id: string;
60
+ tier: string;
61
+ status: string;
62
+ confidence: number;
63
+ category: string;
64
+ source_project?: string;
65
+ lineage_actor?: string;
66
+ created_at: string;
67
+ updated_at: string;
68
+ content_hash?: string;
69
+ raw_line_sha256: string;
70
+ }
71
+ export interface HiveQuarantinePreview {
72
+ records: HiveQuarantinePreviewRecord[];
73
+ store_entry_count: number;
74
+ store_file_sha256: string;
75
+ plugin_version: string;
76
+ issued_at: string;
77
+ expires_at: string;
78
+ token: string;
79
+ }
80
+ export interface HiveQuarantineCommitResult {
81
+ quarantinedIds: string[];
82
+ storeEntriesBefore: number;
83
+ storeEntriesAfter: number;
84
+ backupDir: string;
85
+ backupBytes: number;
86
+ verified: boolean;
87
+ }
88
+ export interface HiveQuarantineRollbackResult {
89
+ restoredIds: string[];
90
+ alreadyPresentIds: string[];
91
+ storeEntriesAfter: number;
92
+ verified: boolean;
93
+ }
94
+ type Abort = {
95
+ ok: false;
96
+ code: HiveQuarantineAbortCode;
97
+ error: string;
98
+ };
99
+ /**
100
+ * Canonical JSON: `JSON.stringify` with recursively sorted object keys. Used for BOTH the
101
+ * preview token construction and the under-lock reconstruction so key order can never
102
+ * produce a false drift signal.
103
+ */
104
+ export declare function canonicalJson(value: unknown): string;
105
+ declare function readQuarantineSecret(): Promise<string>;
106
+ /**
107
+ * Read-only preview of exact candidate IDs. Errors list missing ids; selection never
108
+ * falls back to prefix or text matching.
109
+ */
110
+ export declare function previewHiveQuarantine(ids: string[]): Promise<{
111
+ ok: true;
112
+ preview: HiveQuarantinePreview;
113
+ } | Abort>;
114
+ export declare function commitHiveQuarantine(input: {
115
+ token: string;
116
+ reason?: string;
117
+ }): Promise<{
118
+ ok: true;
119
+ result: HiveQuarantineCommitResult;
120
+ } | Abort>;
121
+ /**
122
+ * Idempotent rollback: restores the EXACT original line bytes for the manifest's ids.
123
+ * Ids already present with identical bytes are skipped (safe replay); an id present with
124
+ * DIFFERENT bytes aborts the whole operation with no mutation (collision).
125
+ */
126
+ export declare function rollbackHiveQuarantine(input: {
127
+ ref: string;
128
+ }): Promise<{
129
+ ok: true;
130
+ result: HiveQuarantineRollbackResult;
131
+ } | Abort>;
132
+ /** Read-only listing of quarantine backups (for the `status` subcommand). */
133
+ export declare function listHiveQuarantineBackups(): Promise<{
134
+ token12: string;
135
+ committed_at: string;
136
+ idCount: number;
137
+ reason: string;
138
+ }[]>;
139
+ /** Test-only DI seam (AGENTS.md invariant 7). */
140
+ export declare const _internals: {
141
+ emit: typeof emit;
142
+ readFile: typeof readFile;
143
+ writeFile: typeof writeFile;
144
+ copyFile: typeof copyFile;
145
+ mkdir: typeof mkdir;
146
+ stat: typeof stat;
147
+ readdir: typeof readdir;
148
+ resolveHiveDataDir: typeof resolveHiveDataDir;
149
+ resolveHiveKnowledgePath: typeof resolveHiveKnowledgePath;
150
+ transactHiveStore: typeof transactHiveStore;
151
+ realpath: typeof realpath;
152
+ rm: typeof rm;
153
+ chmod: typeof chmod;
154
+ readQuarantineSecret: typeof readQuarantineSecret;
155
+ };
156
+ export {};
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * The event catalog (issue #2029).
3
3
  *
4
- * Exactly 41 entries, matching the `TelemetryEvent` union at
4
+ * Exactly 42 entries, matching the `TelemetryEvent` union at
5
5
  * `src/telemetry.ts:15-91`. Thirty-eight predate the #2029 contract; the 39th is
6
6
  * `agent_conflict_detected` (previously emitted through a force-cast past the
7
7
  * type system), and the 40th is `close_archive_result` (issue #2030 — the
@@ -62,7 +62,7 @@ export interface CatalogEntry {
62
62
  /**
63
63
  * Whether an event of this kind must carry `trace.parentSpanId`.
64
64
  *
65
- * `false` for all 41 entries today, and that is a truthful statement about
65
+ * `false` for all 42 entries today, and that is a truthful statement about
66
66
  * the current system rather than a placeholder: no producer supplies a
67
67
  * parent span, so `createObservation` never sets one. Setting this to `true`
68
68
  * for a kind whose producer cannot supply a parent would make every
@@ -26,7 +26,7 @@ export type TelemetryEvent = 'session_started' | 'session_ended' | 'agent_activa
26
26
  * `prm_hard_stop` TRIGGER emitted by `src/prm/escalation.ts`. A trigger with
27
27
  * no matching delivery means the containment never reached the agent.
28
28
  */
29
- | 'prm_hard_stop_delivered' | 'agent_conflict_detected' | 'close_archive_result' | 'knowledge_receipt_transition';
29
+ | 'prm_hard_stop_delivered' | 'agent_conflict_detected' | 'close_archive_result' | 'knowledge_receipt_transition' | 'knowledge_maintenance';
30
30
  /** Stable classification for how a reviewer-gate decision was established. */
31
31
  export type ReviewerGateEvidenceKind = 'genuine' | 'fallback' | 'data_quality' | 'block';
32
32
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-swarm",
3
- "version": "7.141.1",
3
+ "version": "7.142.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",