opencode-swarm 7.150.0 → 7.151.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 (71) hide show
  1. package/dist/cli/{config-doctor-96qyv31a.js → config-doctor-08zmx89c.js} +2 -2
  2. package/dist/cli/{core-xx0x5tfv.js → core-w0gjhw5q.js} +1 -1
  3. package/dist/cli/{curation-policy-nck9g765.js → curation-policy-fmvccdrg.js} +6 -6
  4. package/dist/cli/{curator-llm-factory-b83jsg02.js → curator-llm-factory-jmx72zhc.js} +28 -28
  5. package/dist/cli/{curator-frrehxxe.js → curator-twqjxden.js} +28 -28
  6. package/dist/cli/{evidence-summary-service-dv4bt2bx.js → evidence-summary-service-py66zgn4.js} +12 -12
  7. package/dist/cli/{gate-evidence-dkvs7aez.js → gate-evidence-ynhyzwsw.js} +6 -6
  8. package/dist/cli/{guardrail-explain-1zbk21fq.js → guardrail-explain-j9h5r8gh.js} +29 -29
  9. package/dist/cli/{guardrail-log-d20jewtr.js → guardrail-log-7995v5q5.js} +5 -5
  10. package/dist/cli/{guardrail-reset-wb3ba243.js → guardrail-reset-seextj6h.js} +28 -28
  11. package/dist/cli/{hive-promoter-10zv1b45.js → hive-promoter-a6xtvynw.js} +28 -28
  12. package/dist/cli/{index-k2sm9677.js → index-0q2mjxp2.js} +1 -1
  13. package/dist/cli/{index-bhg6brtw.js → index-1z7kx41f.js} +745 -8
  14. package/dist/cli/index-2xfffkk0.js +149 -0
  15. package/dist/cli/{index-mef0trex.js → index-4y7n76bn.js} +2 -1
  16. package/dist/cli/{index-htqs4p52.js → index-5jwbepcr.js} +1 -1
  17. package/dist/cli/{index-1wmd5wn1.js → index-5sh0kqf5.js} +4 -4
  18. package/dist/cli/{index-exn0ztsv.js → index-6zkm4p7p.js} +1 -1
  19. package/dist/cli/{index-x3pt7d0b.js → index-7w2b1z4j.js} +2 -2
  20. package/dist/cli/{index-s0xz2520.js → index-9d9p7bv2.js} +3 -3
  21. package/dist/cli/{index-prxrmc3b.js → index-9wpr1p2g.js} +2 -2
  22. package/dist/cli/{index-t54jt9cs.js → index-a2phfdsv.js} +1 -1
  23. package/dist/cli/{index-an922xj4.js → index-akef15kb.js} +7 -7
  24. package/dist/cli/{index-xggpmtfx.js → index-aw492hpn.js} +57 -40
  25. package/dist/cli/{index-dtmgt2xn.js → index-dvycdkhj.js} +1 -0
  26. package/dist/cli/{index-4sdhbxgq.js → index-f73px21b.js} +1 -1
  27. package/dist/cli/{index-0tn1kxej.js → index-fbj6wvew.js} +7 -7
  28. package/dist/cli/{index-apwcvfjt.js → index-frp2hwdg.js} +2 -2
  29. package/dist/cli/{index-zyv56em5.js → index-gqss5zbr.js} +3 -3
  30. package/dist/cli/{index-8cn6545x.js → index-hw93dwd0.js} +30 -30
  31. package/dist/cli/{index-n99s022c.js → index-jjpppdvb.js} +1 -1
  32. package/dist/cli/{index-qqs44wcp.js → index-kzdv0g9e.js} +79 -66
  33. package/dist/cli/{index-mnhagjvn.js → index-n35866rr.js} +4 -4
  34. package/dist/cli/{index-ma1p1w05.js → index-npzmqk01.js} +6 -6
  35. package/dist/cli/{index-w9pb72vg.js → index-qmwed766.js} +2 -2
  36. package/dist/cli/{index-g75rbw3e.js → index-t9h95vjd.js} +5 -5
  37. package/dist/cli/{index-1rpjd5na.js → index-twhhwe74.js} +1 -1
  38. package/dist/cli/{index-m8dn0qnm.js → index-txbd25bc.js} +1 -1
  39. package/dist/cli/{index-jb9tb1sd.js → index-v3gshkpz.js} +1 -1
  40. package/dist/cli/{index-r5djc1cc.js → index-xtyxnxf4.js} +5 -5
  41. package/dist/cli/{index-reknv4f9.js → index-xysb3ed7.js} +2 -2
  42. package/dist/cli/{index-1rww5k9e.js → index-z09fmg67.js} +4 -4
  43. package/dist/cli/{index-vy6q9d8j.js → index-z4bg1hv8.js} +1 -1
  44. package/dist/cli/index.js +28 -28
  45. package/dist/cli/{knowledge-escalator-pc7smwrd.js → knowledge-escalator-bqnkq3k7.js} +11 -11
  46. package/dist/cli/{knowledge-events-jmb3jm84.js → knowledge-events-rz3mt7gf.js} +9 -9
  47. package/dist/cli/{knowledge-link-mzn8x0qd.js → knowledge-link-v7hj1h8m.js} +5 -5
  48. package/dist/cli/{knowledge-store-wd6zh05h.js → knowledge-store-1m74b90j.js} +6 -6
  49. package/dist/cli/{knowledge-validator-2v6ar1wk.js → knowledge-validator-hfvhpkgk.js} +8 -8
  50. package/dist/cli/{pending-delegations-qzy6rnvw.js → pending-delegations-a2nmssr1.js} +3 -3
  51. package/dist/cli/{pr-subscriptions-q862pvz1.js → pr-subscriptions-7879nq5k.js} +3 -3
  52. package/dist/cli/{runner-1aygs98c.js → runner-7znestx4.js} +6 -6
  53. package/dist/cli/{scan-cursor-hr8e3jqj.js → scan-cursor-b36bzxkt.js} +7 -7
  54. package/dist/cli/{schema-g44y7s0w.js → schema-sc332es3.js} +1 -1
  55. package/dist/cli/{scope-persistence-0n2cv4kn.js → scope-persistence-phkj8438.js} +8 -8
  56. package/dist/cli/{skill-generator-0gmpxwgk.js → skill-generator-2d005nr6.js} +13 -13
  57. package/dist/cli/{telemetry-5deacb7w.js → telemetry-52pw5xac.js} +1 -1
  58. package/dist/cli/{worktree-collision-ownership-9v8e0dz7.js → worktree-collision-ownership-p31zm5k0.js} +3 -3
  59. package/dist/cli/{worktree-isolation-pcr5zv0c.js → worktree-isolation-zpgkd71h.js} +28 -28
  60. package/dist/commands/close.d.ts +1 -0
  61. package/dist/commands/registry.d.ts +2 -2
  62. package/dist/hooks/guardrails/audit-log.d.ts +70 -19
  63. package/dist/hooks/guardrails/helpers.d.ts +16 -1
  64. package/dist/hooks/guardrails/shell-audit-store.d.ts +211 -0
  65. package/dist/hooks/guardrails/tool-before.d.ts +0 -2
  66. package/dist/index.js +339 -319
  67. package/dist/observability/catalog.d.ts +7 -5
  68. package/dist/services/guardrail-log-service.d.ts +4 -0
  69. package/dist/telemetry.d.ts +22 -1
  70. package/package.json +2 -1
  71. package/dist/cli/index-ggs716fj.js +0 -110
@@ -1,8 +1,8 @@
1
1
  /**
2
2
  * The event catalog (issue #2029).
3
3
  *
4
- * Exactly 48 entries, matching the `TelemetryEvent` union at
5
- * `src/telemetry.ts:15-125`. Thirty-eight predate the #2029 contract; the 39th is
4
+ * Exactly 49 entries, matching the `TelemetryEvent` union at
5
+ * `src/telemetry.ts:15-131`. 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), the 40th is `close_archive_result` (issue #2030 — the
8
8
  * structured close/archive result event), the 41st is the bounded diagnostic
@@ -15,8 +15,10 @@
15
15
  * `.swarm/context-telemetry.jsonl` store, the 47th is the counts-only
16
16
  * `skill_usage_health` storage audit for the issue-#2038
17
17
  * `.swarm/skill-usage.jsonl` store and its authoritative pending sidecar,
18
- * and the 48th is the bounded `core_events_health` storage audit for the
19
- * issue-#2039 `.swarm/events.jsonl` store. These late additions are instances
18
+ * the 48th is the bounded `core_events_health` storage audit for the
19
+ * issue-#2039 `.swarm/events.jsonl` store, and the 49th is the bounded
20
+ * `shell_audit_health` storage audit for the issue-#2040
21
+ * `.swarm/session/shell-audit.jsonl` security-audit store. These late additions are instances
20
22
  * of the defect class this contract exists to close: an event kind entering
21
23
  * the stream with no registration.
22
24
  *
@@ -71,7 +73,7 @@ export interface CatalogEntry {
71
73
  /**
72
74
  * Whether an event of this kind must carry `trace.parentSpanId`.
73
75
  *
74
- * `false` for all 48 entries today, and that is a truthful statement about
76
+ * `false` for all 49 entries today, and that is a truthful statement about
75
77
  * the current system rather than a placeholder: no producer supplies a
76
78
  * parent span, so `createObservation` never sets one. Setting this to `true`
77
79
  * for a kind whose producer cannot supply a parent would make every
@@ -6,5 +6,9 @@ export interface GuardrailLogEntry {
6
6
  tool: string;
7
7
  command?: string;
8
8
  path?: string;
9
+ /** 16-hex sha256 fingerprint of the redacted command (typed entries only);
10
+ * rendered as a correlation suffix so duplicate/related decisions can be
11
+ * linked without repeating command content. */
12
+ commandHash?: string;
9
13
  }
10
14
  export declare function handleGuardrailLog(directory: string, args: string[]): Promise<string>;
@@ -32,7 +32,7 @@ export type TelemetryEvent = 'session_started' | 'session_ended' | 'agent_activa
32
32
  * `prm_hard_stop` TRIGGER emitted by `src/prm/escalation.ts`. A trigger with
33
33
  * no matching delivery means the containment never reached the agent.
34
34
  */
35
- | 'prm_hard_stop_delivered' | 'agent_conflict_detected' | 'close_archive_result' | 'knowledge_receipt_transition' | 'knowledge_maintenance' | 'residue_health' | 'context_telemetry_health' | 'skill_usage_health' | 'core_events_health';
35
+ | 'prm_hard_stop_delivered' | 'agent_conflict_detected' | 'close_archive_result' | 'knowledge_receipt_transition' | 'knowledge_maintenance' | 'residue_health' | 'context_telemetry_health' | 'skill_usage_health' | 'core_events_health' | 'shell_audit_health';
36
36
  /** Stable classification for how a reviewer-gate decision was established. */
37
37
  export type ReviewerGateEvidenceKind = 'genuine' | 'fallback' | 'data_quality' | 'block';
38
38
  /**
@@ -314,6 +314,27 @@ export declare const telemetry: {
314
314
  bytes: number;
315
315
  limit_bytes: number;
316
316
  }): void;
317
+ /**
318
+ * Shell-audit store health (issue #2040): emitted on compaction and close
319
+ * for the bounded `.swarm/session/shell-audit.jsonl` security-audit
320
+ * store. Counts ONLY — no command content, no filesystem paths, no agent
321
+ * or session identifiers, matching the observability contract's
322
+ * no-content-in-metrics rule (issue #2040 requirement 5). `dropped_count`
323
+ * discloses allowed-class decisions folded by the age ceiling;
324
+ * `compacted_count` budget folds (byte/count caps).
325
+ */
326
+ shellAuditHealth(data: {
327
+ trigger: "compaction" | "close";
328
+ accepted_count: number;
329
+ compacted_count: number;
330
+ retained_count: number;
331
+ dropped_count: number;
332
+ corrupt_count: number;
333
+ oldest_timestamp: string | null;
334
+ newest_timestamp: string | null;
335
+ bytes: number;
336
+ limit_bytes: number;
337
+ }): void;
317
338
  /**
318
339
  * Issue #2063 C2 — the PRM hard-stop DENIAL was actually delivered to the
319
340
  * agent (thrown by the guardrails `toolBefore` consumer). `prm_hard_stop`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-swarm",
3
- "version": "7.150.0",
3
+ "version": "7.151.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",
@@ -110,6 +110,7 @@
110
110
  "check:events": "bun run scripts/check-event-contract.ts",
111
111
  "check:retention": "bun run scripts/check-retention-registry.ts",
112
112
  "check:core-events": "bun run scripts/check-core-events-usage.ts",
113
+ "check:shell-audit": "bun run scripts/check-shell-audit-usage.ts",
113
114
  "check:test-file-cap": "bun run scripts/check-test-file-cap.ts",
114
115
  "check:pending-fragment": "bun run scripts/check-pending-fragment.ts",
115
116
  "check:gate-portability": "bun run scripts/check-gate-portability.ts",
@@ -1,110 +0,0 @@
1
- // @bun
2
- import {
3
- redactPath,
4
- redactShellCommand
5
- } from "./index-bhg6brtw.js";
6
-
7
- // src/services/guardrail-log-service.ts
8
- import * as fs from "fs/promises";
9
- import * as path from "path";
10
- var BLOCK_TYPES = new Set([
11
- "file_write",
12
- "scope_violation",
13
- "destructive_block"
14
- ]);
15
- function isBlockEntry(entry) {
16
- if (entry.type === null || entry.type === undefined)
17
- return false;
18
- return BLOCK_TYPES.has(entry.type);
19
- }
20
- function redactSummary(entry) {
21
- if (entry.type === "file_write" || entry.type === "scope_violation") {
22
- const raw = entry.path ?? "";
23
- return redactPath(raw);
24
- }
25
- if (entry.type === "destructive_block" || entry.type === "sandbox_wrap" || entry.type === "sandbox_skip" || entry.type === "shell" || entry.type === null || entry.type === undefined) {
26
- const raw = entry.command ?? "";
27
- return redactShellCommand(raw);
28
- }
29
- return "";
30
- }
31
- function formatEntry(entry) {
32
- const decisionType = entry.type ?? "shell";
33
- const summary = redactSummary(entry);
34
- return `- [${entry.ts}] ${decisionType} | agent: ${entry.agent} | ${summary}`;
35
- }
36
- async function handleGuardrailLog(directory, args) {
37
- const auditPath = path.join(directory, ".swarm", "session", "shell-audit.jsonl");
38
- let raw;
39
- try {
40
- raw = await fs.readFile(auditPath, "utf-8");
41
- } catch (error) {
42
- if (typeof error === "object" && error !== null && "code" in error && error.code === "ENOENT") {
43
- return "No guardrail decisions recorded yet.";
44
- }
45
- throw error;
46
- }
47
- const lines = raw.split(/\r?\n/);
48
- const entries = [];
49
- for (const line of lines) {
50
- if (line.trim().length === 0)
51
- continue;
52
- let parsed;
53
- try {
54
- parsed = JSON.parse(line);
55
- } catch {
56
- continue;
57
- }
58
- if (!isPlainObject(parsed))
59
- continue;
60
- if (typeof parsed.ts !== "string")
61
- continue;
62
- if (typeof parsed.sessionID !== "string")
63
- continue;
64
- if (typeof parsed.agent !== "string")
65
- continue;
66
- if (typeof parsed.tool !== "string")
67
- continue;
68
- const entry = {
69
- ts: parsed.ts,
70
- sessionID: parsed.sessionID,
71
- agent: parsed.agent,
72
- tool: parsed.tool
73
- };
74
- if (typeof parsed.type === "string") {
75
- entry.type = parsed.type;
76
- }
77
- if (typeof parsed.command === "string") {
78
- entry.command = parsed.command;
79
- }
80
- if (typeof parsed.path === "string") {
81
- entry.path = parsed.path;
82
- }
83
- entries.push(entry);
84
- }
85
- if (entries.length === 0) {
86
- return "No guardrail decisions recorded yet.";
87
- }
88
- const blocksOnly = args.includes("--blocks-only");
89
- const filtered = blocksOnly ? entries.filter(isBlockEntry) : entries;
90
- if (filtered.length === 0) {
91
- if (blocksOnly) {
92
- return "No guardrail block decisions recorded yet.";
93
- }
94
- return "No guardrail decisions recorded yet.";
95
- }
96
- filtered.sort((a, b) => {
97
- const diff = b.ts.localeCompare(a.ts);
98
- return diff === 0 ? 0 : diff;
99
- });
100
- const header = blocksOnly ? "# Guardrail Block Log (most-recent-first)" : "# Guardrail Decision Log (most-recent-first)";
101
- const body = filtered.map(formatEntry).join(`
102
- `);
103
- return `${header}
104
-
105
- ${body}`;
106
- }
107
- function isPlainObject(value) {
108
- return typeof value === "object" && value !== null && (value.constructor === Object || Object.getPrototypeOf(value) === null);
109
- }
110
- export { handleGuardrailLog };