opencode-swarm 7.137.2 → 7.137.3

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 (62) hide show
  1. package/dist/cli/{config-doctor-xrbzq4r0.js → config-doctor-t560ks5q.js} +2 -2
  2. package/dist/cli/{core-6w5sd5bc.js → core-v6bte964.js} +1 -1
  3. package/dist/cli/{curation-policy-xyradeax.js → curation-policy-r1ddgn8c.js} +6 -6
  4. package/dist/cli/{curator-llm-factory-rk7pccwc.js → curator-llm-factory-ny0hcz11.js} +25 -25
  5. package/dist/cli/{curator-h1ea9skz.js → curator-zcg176y4.js} +25 -25
  6. package/dist/cli/{evidence-summary-service-85gw9p2m.js → evidence-summary-service-1azhyeft.js} +7 -7
  7. package/dist/cli/{gate-evidence-s2kytsrj.js → gate-evidence-ecx4djaw.js} +4 -4
  8. package/dist/cli/{guardrail-explain-sq1kcah3.js → guardrail-explain-wmc2c89t.js} +26 -26
  9. package/dist/cli/{guardrail-log-7anp1z1n.js → guardrail-log-m7th4yac.js} +3 -3
  10. package/dist/cli/{hive-promoter-qsymj94z.js → hive-promoter-m9fbm8hg.js} +25 -25
  11. package/dist/cli/{index-h5sbn1zr.js → index-10mz5js6.js} +75 -34
  12. package/dist/cli/{index-kakb2jm0.js → index-2xvtskcg.js} +2 -2
  13. package/dist/cli/{index-gv00q5gc.js → index-2y4jy0de.js} +1 -1
  14. package/dist/cli/{index-5r6kkhd7.js → index-39k6y018.js} +2 -2
  15. package/dist/cli/{index-gey6qegb.js → index-3zj70fr9.js} +1 -1
  16. package/dist/cli/{index-s3j9fsab.js → index-4fmztnrq.js} +2 -2
  17. package/dist/cli/{index-d735dzm7.js → index-897js8x8.js} +1409 -1112
  18. package/dist/cli/{index-jdqayy7h.js → index-9b1vtdpm.js} +4 -4
  19. package/dist/cli/{index-5k0csd2m.js → index-ab7p3gq6.js} +2 -2
  20. package/dist/cli/{index-9casmxdt.js → index-amf649jq.js} +6 -6
  21. package/dist/cli/{index-877ah4kx.js → index-c2v79596.js} +1 -1
  22. package/dist/cli/{index-4t39wzzg.js → index-cqsxdb6f.js} +3 -3
  23. package/dist/cli/{index-s9at02fn.js → index-d39q5r1s.js} +2 -2
  24. package/dist/cli/{index-rfrkt29c.js → index-dkzct23a.js} +1 -1
  25. package/dist/cli/{index-ysh3a2nb.js → index-e1xt3r6c.js} +2 -2
  26. package/dist/cli/{index-vft1pg34.js → index-en4fb04r.js} +1 -1
  27. package/dist/cli/{index-aygnzd04.js → index-es88kmrz.js} +1 -1
  28. package/dist/cli/{index-1zrb3vt2.js → index-fmh15wxb.js} +5 -5
  29. package/dist/cli/{index-1da1tvtn.js → index-hsc81cfm.js} +1 -1
  30. package/dist/cli/{index-dxatvs3f.js → index-j0xx9wpj.js} +1 -1
  31. package/dist/cli/{index-pwx989sa.js → index-j215fc3r.js} +3 -3
  32. package/dist/cli/{index-02jqxmh8.js → index-kbksjvte.js} +5 -5
  33. package/dist/cli/{index-p0kez6cn.js → index-ky1kr5my.js} +27 -27
  34. package/dist/cli/{index-5wjw05dy.js → index-ngqxzkqm.js} +2 -2
  35. package/dist/cli/{index-b2s3t517.js → index-rrxcfxrd.js} +1 -1
  36. package/dist/cli/{index-vyh2prxv.js → index-ryw98ynn.js} +1 -1
  37. package/dist/cli/{index-n3h6rmbe.js → index-tqshdzaw.js} +1 -1
  38. package/dist/cli/{index-8ehyt3rx.js → index-xybtaph7.js} +1 -1
  39. package/dist/cli/{index-qy3rgmkc.js → index-z7jgvm9b.js} +1 -1
  40. package/dist/cli/index.js +25 -25
  41. package/dist/cli/{knowledge-escalator-e9zk371p.js → knowledge-escalator-6bw0gxkh.js} +7 -7
  42. package/dist/cli/{knowledge-events-dnyc1k78.js → knowledge-events-cdwbxkr2.js} +5 -5
  43. package/dist/cli/{knowledge-link-t94b79qe.js → knowledge-link-xc6yhxmz.js} +4 -4
  44. package/dist/cli/{knowledge-store-x4vqyhbz.js → knowledge-store-5y46n3as.js} +5 -5
  45. package/dist/cli/{knowledge-validator-72jdx5ze.js → knowledge-validator-bekm8t70.js} +8 -8
  46. package/dist/cli/{pending-delegations-kshh66s2.js → pending-delegations-gee019ec.js} +3 -3
  47. package/dist/cli/{pr-subscriptions-5fpzz4f3.js → pr-subscriptions-m943zn6g.js} +3 -3
  48. package/dist/cli/{runner-9rqc8y3m.js → runner-x1hy047y.js} +5 -5
  49. package/dist/cli/{scan-cursor-z4xpes5f.js → scan-cursor-jqwzvkw9.js} +6 -6
  50. package/dist/cli/{schema-2dkw18zz.js → schema-zgrd42bf.js} +1 -1
  51. package/dist/cli/{scope-persistence-sjz200dt.js → scope-persistence-n1bryhzf.js} +4 -4
  52. package/dist/cli/{skill-generator-0q1jk6xd.js → skill-generator-q1jh5agj.js} +9 -9
  53. package/dist/cli/{telemetry-h7h7f0ez.js → telemetry-0yqed3jv.js} +3 -1
  54. package/dist/cli/{worktree-collision-ownership-xzwab4xt.js → worktree-collision-ownership-y1c7yx14.js} +3 -3
  55. package/dist/commands/archive-sqlite.d.ts +106 -0
  56. package/dist/commands/close.d.ts +33 -11
  57. package/dist/db/project-db.d.ts +3 -1
  58. package/dist/index.d.ts +1 -0
  59. package/dist/index.js +309 -310
  60. package/dist/observability/catalog.d.ts +8 -9
  61. package/dist/telemetry.d.ts +58 -3
  62. package/package.json +1 -1
@@ -1,14 +1,13 @@
1
1
  /**
2
2
  * The event catalog (issue #2029).
3
3
  *
4
- * Exactly 39 entries, matching the `TelemetryEvent` union at
5
- * `src/telemetry.ts:15-86`. Thirty-eight of them predate this change; the 39th is
6
- * `agent_conflict_detected`, which before this change was emitted in
7
- * production through a force-cast past the type system before this change
8
- * (at `src/hooks/conflict-resolution.ts:67-70` in the BASE tree; the replacement typed call is
9
- * `:73` here) and was absent from the union. That
10
- * 39th entry is the already-found instance of the defect class this contract
11
- * exists to close: an event kind can enter the stream with no registration.
4
+ * Exactly 40 entries, matching the `TelemetryEvent` union at
5
+ * `src/telemetry.ts:15-91`. Thirty-eight predate the #2029 contract; the 39th is
6
+ * `agent_conflict_detected` (previously emitted through a force-cast past the
7
+ * type system), and the 40th is `close_archive_result` (issue #2030 the
8
+ * structured close/archive result event). Both late additions are instances of
9
+ * the defect class this contract exists to close: an event kind entering the
10
+ * stream with no registration.
12
11
  *
13
12
  * Every entry names a real producer `file:line`, a retention owner issue at or
14
13
  * above #2030 — every entry today cites the #2030-#2051 programme, but only the
@@ -61,7 +60,7 @@ export interface CatalogEntry {
61
60
  /**
62
61
  * Whether an event of this kind must carry `trace.parentSpanId`.
63
62
  *
64
- * `false` for all 39 entries today, and that is a truthful statement about
63
+ * `false` for all 40 entries today, and that is a truthful statement about
65
64
  * the current system rather than a placeholder: no producer supplies a
66
65
  * parent span, so `createObservation` never sets one. Setting this to `true`
67
66
  * for a kind whose producer cannot supply a parent would make every
@@ -17,8 +17,8 @@ export type TelemetryEvent = 'session_started' | 'session_ended' | 'agent_activa
17
17
  | 'execution_stall_denied'
18
18
  /**
19
19
  * Issue #2063 B4 — a read/glob/grep/bash call resolved to a path inside the
20
- * INSTALLED opencode-swarm package and was denied. `target` is relative to
21
- * the package root so no user home path is written to the ledger.
20
+ * INSTALLED opencode-swarm package and was denied. `target` is relative to the
21
+ * package root so no user home path is written to the ledger.
22
22
  */
23
23
  | 'swarm_internals_read_denied' | 'prm_pattern_detected' | 'prm_course_correction_injected' | 'prm_escalation_triggered' | 'prm_hard_stop'
24
24
  /**
@@ -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';
29
+ | 'prm_hard_stop_delivered' | 'agent_conflict_detected' | 'close_archive_result';
30
30
  /** Stable classification for how a reviewer-gate decision was established. */
31
31
  export type ReviewerGateEvidenceKind = 'genuine' | 'fallback' | 'data_quality' | 'block';
32
32
  /**
@@ -78,6 +78,31 @@ export declare function addTelemetryListener(callback: TelemetryListener): void;
78
78
  * @param maxBytes - Size threshold in bytes (default: 10MB)
79
79
  */
80
80
  export declare function rotateTelemetryIfNeeded(maxBytes?: number): void;
81
+ /**
82
+ * Flush any buffered telemetry records to disk and reopen the append stream.
83
+ *
84
+ * Why this exists (issue #2030 item 8): `/swarm close` archives
85
+ * `telemetry.jsonl` via `fs.copyFile`, but the writer holds an open buffered
86
+ * `WriteStream` whose in-memory buffer is not reflected in the on-disk file
87
+ * until the OS accepts the bytes. Archiving without flushing silently loses the
88
+ * tail records of the session.
89
+ *
90
+ * Ordering (race fix, swarm-pr-review F-003): the replacement stream is created
91
+ * and assigned to `_writeStream` BEFORE `end()` is called on the old handle, so
92
+ * a concurrent `emit()` that races across the await lands on the live stream.
93
+ * The old handle's write callback would otherwise fire
94
+ * `ERR_STREAM_WRITE_AFTER_END`, latch `_disabled = true`, and kill telemetry for
95
+ * every subsequent session until restart (server-scoped plugin process). This
96
+ * mirrors the already-safe `rotateTelemetryIfNeeded` ordering.
97
+ *
98
+ * `WriteStream.end(cb)` invokes `cb` on the `'finish'` event — AFTER the buffer
99
+ * has been drained to the OS — so awaiting that callback is the documented way
100
+ * to guarantee the on-disk file contains every emitted record up to this point.
101
+ *
102
+ * Fail-open: any error during reopen disables telemetry rather than throwing —
103
+ * a flush failure must never block the close pipeline.
104
+ */
105
+ export declare function flushAndDrainTelemetry(): Promise<void>;
81
106
  export declare const telemetry: {
82
107
  sessionStarted(sessionId: string, agentName: string): void;
83
108
  sessionEnded(sessionId: string, reason: string): void;
@@ -136,6 +161,35 @@ export declare const telemetry: {
136
161
  prmCourseCorrectionInjected(sessionId: string, pattern: string, level: number): void;
137
162
  prmEscalationTriggered(sessionId: string, pattern: string, level: number, occurrenceCount: number): void;
138
163
  prmHardStop(sessionId: string, pattern: string, level: number, occurrenceCount: number): void;
164
+ /**
165
+ * Close/archive structured result (issue #2030). This single event is the
166
+ * shared source of truth for both the user-facing close summary prose and
167
+ * the telemetry stream, so the two cannot disagree. Carries per-artifact
168
+ * structured fields plus aggregate `archive_valid`/`archive_empty` health
169
+ * facts. Row counts are counts ONLY — no row content is ever emitted (issue
170
+ * item 4/9), enabling PR 16 to alarm and PR 20 to report without leaking
171
+ * data.
172
+ */
173
+ closeArchiveResult(data: {
174
+ archive_valid: boolean;
175
+ archive_empty: boolean;
176
+ file_count: number;
177
+ bundle: string;
178
+ artifacts: Array<{
179
+ artifact: string;
180
+ requiredness: string;
181
+ attempt: string;
182
+ validation: string;
183
+ source_disposition: string;
184
+ method: string;
185
+ reason_code: string;
186
+ row_counts?: {
187
+ schema_migrations_max_version: number | null;
188
+ project_constraints: number;
189
+ qa_gate_profile: number;
190
+ };
191
+ }>;
192
+ }): void;
139
193
  /**
140
194
  * Issue #2063 C2 — the PRM hard-stop DENIAL was actually delivered to the
141
195
  * agent (thrown by the guardrails `toolBefore` consumer). `prm_hard_stop`
@@ -157,6 +211,7 @@ export declare const _internals: {
157
211
  telemetry: typeof telemetry;
158
212
  emit: typeof emit;
159
213
  rotateTelemetryIfNeeded: typeof rotateTelemetryIfNeeded;
214
+ flushAndDrainTelemetry: typeof flushAndDrainTelemetry;
160
215
  heartbeatListenerCount: () => number;
161
216
  createObservation: typeof createObservation;
162
217
  toLegacyTelemetryLine: typeof toLegacyTelemetryLine;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-swarm",
3
- "version": "7.137.2",
3
+ "version": "7.137.3",
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",