opencode-swarm 7.141.2 → 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.
- package/dist/cli/{config-doctor-weqs97sa.js → config-doctor-7xqerhnw.js} +2 -2
- package/dist/cli/{core-zg7fqfsm.js → core-nwmpg9t8.js} +1 -1
- package/dist/cli/{curation-policy-j1fbc3ry.js → curation-policy-bzk13bj2.js} +5 -5
- package/dist/cli/{curator-v1tnrt93.js → curator-3wsaz7ay.js} +26 -26
- package/dist/cli/{curator-llm-factory-8p86mgye.js → curator-llm-factory-kbkddqk2.js} +26 -26
- package/dist/cli/{evidence-summary-service-a4w0yc8h.js → evidence-summary-service-wwfvpvxq.js} +9 -9
- package/dist/cli/{gate-evidence-rt9034ft.js → gate-evidence-3mazsjrq.js} +4 -4
- package/dist/cli/{guardrail-explain-8yrznk98.js → guardrail-explain-rmz1yjzw.js} +27 -27
- package/dist/cli/{guardrail-log-7hj4x9yt.js → guardrail-log-8m4dnkgd.js} +3 -3
- package/dist/cli/{hive-promoter-6zcnyh1j.js → hive-promoter-ss8dm52r.js} +26 -26
- package/dist/cli/{index-q4vaar2b.js → index-0dvx8f03.js} +2 -2
- package/dist/cli/{index-hwxcdrv9.js → index-26ynh10w.js} +6 -6
- package/dist/cli/{index-kkn2jxda.js → index-2p3h7det.js} +1 -1
- package/dist/cli/{index-9d4gck4e.js → index-338zfvff.js} +58 -34
- package/dist/cli/{index-nse60anv.js → index-520ev2d7.js} +1 -1
- package/dist/cli/{index-73sxchez.js → index-56knmbwf.js} +2031 -1029
- package/dist/cli/{index-76651erq.js → index-67vxmh1v.js} +7 -7
- package/dist/cli/{index-f1hsrgw1.js → index-78p6nvcv.js} +1 -1
- package/dist/cli/{index-h3vk67wp.js → index-7c5xtcfm.js} +3 -3
- package/dist/cli/{index-bxjhn3t3.js → index-8g5aa1s7.js} +2 -2
- package/dist/cli/{index-qskz8j2z.js → index-99eftm6b.js} +1 -1
- package/dist/cli/{index-y6k6x197.js → index-ad93kz8m.js} +1 -1
- package/dist/cli/{index-vts5e84g.js → index-ae0j9qpc.js} +28 -28
- package/dist/cli/{index-mxtt4x8r.js → index-amepv9dh.js} +3 -3
- package/dist/cli/{index-zbj3yrrd.js → index-bd2h7r2w.js} +1 -1
- package/dist/cli/{index-qa50yyeh.js → index-e4y7mfp0.js} +1 -1
- package/dist/cli/{index-c2hczjhp.js → index-em1kfnss.js} +1 -1
- package/dist/cli/{index-szrcxvr7.js → index-eytxcbm8.js} +3 -3
- package/dist/cli/{index-kq5p3nm3.js → index-gcn7tsr3.js} +1 -1
- package/dist/cli/{index-3d13jkzq.js → index-h2vpk15y.js} +2 -2
- package/dist/cli/{index-jpt07f2k.js → index-hgydkvty.js} +2 -2
- package/dist/cli/{index-aqzvjhb7.js → index-hncahn40.js} +5 -5
- package/dist/cli/{index-p5y72gtj.js → index-kkxt9g8d.js} +3 -3
- package/dist/cli/{index-zf5nkkdd.js → index-mbeqw4cb.js} +1 -1
- package/dist/cli/{index-xx0q37xb.js → index-sh3r66tt.js} +1 -1
- package/dist/cli/{index-6bp1jecx.js → index-tzbd5050.js} +4 -4
- package/dist/cli/{index-mqqmant3.js → index-v8f3wa0e.js} +1 -1
- package/dist/cli/{index-r6pdts5c.js → index-vwyamc2d.js} +2 -2
- package/dist/cli/{index-v250345n.js → index-ycd63sz3.js} +1 -1
- package/dist/cli/{index-why8n7cr.js → index-z7eeq0tt.js} +6 -6
- package/dist/cli/index.js +39 -26
- package/dist/cli/{knowledge-escalator-xjkbek46.js → knowledge-escalator-w235g6ce.js} +10 -10
- package/dist/cli/{knowledge-events-hsdx5prn.js → knowledge-events-amn94djz.js} +8 -8
- package/dist/cli/{knowledge-link-x86ebng8.js → knowledge-link-xned4jbm.js} +4 -4
- package/dist/cli/{knowledge-store-vt059r81.js → knowledge-store-3vb855ta.js} +5 -5
- package/dist/cli/{knowledge-validator-jr5694jb.js → knowledge-validator-a8c185hw.js} +7 -7
- package/dist/cli/{pending-delegations-7xsagjy5.js → pending-delegations-8ccjby4b.js} +3 -3
- package/dist/cli/{pr-subscriptions-r6cdsa3t.js → pr-subscriptions-gn7r3bg7.js} +3 -3
- package/dist/cli/{runner-nm3baddf.js → runner-rhgkhy5e.js} +5 -5
- package/dist/cli/{scan-cursor-6nrkcfbr.js → scan-cursor-vjbjm140.js} +6 -6
- package/dist/cli/{schema-f6pt0zjy.js → schema-dd8mzm6k.js} +1 -1
- package/dist/cli/{scope-persistence-jc0mtp7g.js → scope-persistence-8j8d4874.js} +6 -6
- package/dist/cli/{skill-generator-4vp33gjb.js → skill-generator-a4apb7c2.js} +12 -12
- package/dist/cli/{telemetry-zex3zv3v.js → telemetry-k9nxy24s.js} +1 -1
- package/dist/cli/{worktree-collision-ownership-n41qw3n8.js → worktree-collision-ownership-183jk2dv.js} +3 -3
- package/dist/cli/{worktree-isolation-a3hkz665.js → worktree-isolation-j71zz7g9.js} +26 -26
- package/dist/commands/hive-quarantine.d.ts +23 -0
- package/dist/commands/registry.d.ts +9 -0
- package/dist/hooks/hive-transaction.d.ts +41 -0
- package/dist/index.js +290 -277
- package/dist/knowledge/hive-quarantine.d.ts +156 -0
- package/dist/observability/catalog.d.ts +2 -2
- package/dist/telemetry.d.ts +1 -1
- 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
|
|
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
|
|
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
|
package/dist/telemetry.d.ts
CHANGED
|
@@ -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.
|
|
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",
|