opencode-swarm 7.182.0 → 7.183.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 (83) hide show
  1. package/binaries/win32-arm64/swarm-sandbox-runner.exe +0 -0
  2. package/binaries/win32-x64/swarm-sandbox-runner.exe +0 -0
  3. package/dist/cli/{coder-settlement-vwwxs7t1.js → coder-settlement-6m5stw7s.js} +7 -7
  4. package/dist/cli/{config-doctor-7wyqt1ke.js → config-doctor-g6r21wdz.js} +2 -2
  5. package/dist/cli/{core-739y5zsf.js → core-6dzx3z8q.js} +1 -1
  6. package/dist/cli/{curation-policy-bwj3wanw.js → curation-policy-fm7mtvbk.js} +4 -4
  7. package/dist/cli/{curator-qrcydww2.js → curator-0xqj2rxm.js} +31 -31
  8. package/dist/cli/{curator-drift-mbpc200k.js → curator-drift-art0x91j.js} +5 -5
  9. package/dist/cli/{curator-llm-factory-m039mxt9.js → curator-llm-factory-grnfsaa2.js} +31 -31
  10. package/dist/cli/{evidence-summary-service-w6hw58bc.js → evidence-summary-service-h1vb58rd.js} +13 -13
  11. package/dist/cli/{gate-evidence-2dqabzxy.js → gate-evidence-ps3rg5fh.js} +4 -4
  12. package/dist/cli/{guardrail-explain-kaebxfq3.js → guardrail-explain-2sb06877.js} +32 -32
  13. package/dist/cli/{guardrail-log-h3vxqte8.js → guardrail-log-x2gdf8ys.js} +6 -6
  14. package/dist/cli/{guardrail-reset-n1ameem0.js → guardrail-reset-mwkys4ff.js} +31 -31
  15. package/dist/cli/{hive-promoter-ev201390.js → hive-promoter-gndjyg7e.js} +31 -31
  16. package/dist/cli/{index-e2cdym66.js → index-0n24h4zb.js} +6 -6
  17. package/dist/cli/{index-zryhqf6h.js → index-1ex9ecf5.js} +3 -3
  18. package/dist/cli/{index-q0k4zdfg.js → index-29f69hzd.js} +2 -2
  19. package/dist/cli/{index-d4wj3jyg.js → index-30pz2xvj.js} +3 -3
  20. package/dist/cli/{index-wbqvjdne.js → index-3bcmw8pc.js} +1 -1
  21. package/dist/cli/{index-kbxeq0r2.js → index-4aggsva0.js} +1 -1
  22. package/dist/cli/{index-z2m4n1sm.js → index-6f7tfq3m.js} +7 -7
  23. package/dist/cli/{index-hd3kacp0.js → index-6nhzekvt.js} +2 -2
  24. package/dist/cli/{index-fae4qp3c.js → index-7p6s4yfb.js} +1 -1
  25. package/dist/cli/{index-x7z5fbs3.js → index-94pwd45k.js} +4 -4
  26. package/dist/cli/{index-34k5sg2a.js → index-9gehw4xb.js} +1 -1
  27. package/dist/cli/{index-td54jp0w.js → index-a6np52p4.js} +1 -1
  28. package/dist/cli/{index-fyzakptj.js → index-brfs5jqw.js} +3 -3
  29. package/dist/cli/{index-yqc672pn.js → index-c6zrffwn.js} +2273 -2030
  30. package/dist/cli/{index-6qntafey.js → index-fb0v3e71.js} +1 -1
  31. package/dist/cli/{index-wyvzrp4x.js → index-fqc1a1vj.js} +3 -3
  32. package/dist/cli/{index-k38nw0xx.js → index-ht88g5mc.js} +1 -1
  33. package/dist/cli/{index-8qkc4xdx.js → index-jf9cvkzr.js} +3 -3
  34. package/dist/cli/{index-y41v2h6s.js → index-jsdnhdzg.js} +31 -31
  35. package/dist/cli/{index-db8tzj7b.js → index-k88thqa0.js} +3 -3
  36. package/dist/cli/{index-extyzd5c.js → index-kv0k3b60.js} +4 -4
  37. package/dist/cli/{index-0vvnwq2f.js → index-mewsqwbq.js} +1 -1
  38. package/dist/cli/{index-q3qqyp4d.js → index-nmfnggaa.js} +9 -9
  39. package/dist/cli/{index-cxxpkw6v.js → index-pvtf7cjg.js} +4 -4
  40. package/dist/cli/{index-qgewm1x8.js → index-qws72zbs.js} +2 -2
  41. package/dist/cli/{index-6q23tysf.js → index-r65yxdv7.js} +1 -1
  42. package/dist/cli/{index-9h1n6s76.js → index-r7dqevkc.js} +1 -1
  43. package/dist/cli/{index-hg4gx6wa.js → index-rfggc332.js} +2 -2
  44. package/dist/cli/{index-mkpdcbye.js → index-tt705bap.js} +86 -48
  45. package/dist/cli/{index-4a9kyt9z.js → index-v2rbpcqy.js} +1 -1
  46. package/dist/cli/{index-2qw3rxcq.js → index-w670pfv4.js} +5 -5
  47. package/dist/cli/{index-awwqf5v7.js → index-w6hrms7j.js} +1 -1
  48. package/dist/cli/{index-0yj2ebtj.js → index-wjqc2mnc.js} +1 -1
  49. package/dist/cli/{index-zqd0tnwj.js → index-wqg2j647.js} +4 -4
  50. package/dist/cli/{index-ysch2gg6.js → index-ybrwvrd4.js} +33 -33
  51. package/dist/cli/{index-vj5da9w4.js → index-yv5fmjcf.js} +1 -1
  52. package/dist/cli/index.js +32 -32
  53. package/dist/cli/{knowledge-escalator-1shry4k7.js → knowledge-escalator-gjp71cn2.js} +10 -10
  54. package/dist/cli/{knowledge-events-e2hdj3kq.js → knowledge-events-d8k9fmkg.js} +8 -8
  55. package/dist/cli/{knowledge-link-akjk6gby.js → knowledge-link-anzhs41w.js} +3 -3
  56. package/dist/cli/{knowledge-store-t2c8spdv.js → knowledge-store-sqmwvcjd.js} +4 -4
  57. package/dist/cli/{knowledge-validator-d7amfzsx.js → knowledge-validator-gjqm2zby.js} +6 -6
  58. package/dist/cli/{mcp-174sj68r.js → mcp-phvvtsmt.js} +1 -1
  59. package/dist/cli/{model-preflight-6x39q1pq.js → model-preflight-ehqa8h7x.js} +31 -31
  60. package/dist/cli/{pending-delegations-n9hp95ad.js → pending-delegations-mxs88d0x.js} +6 -6
  61. package/dist/cli/{pr-subscriptions-b0pbkkpr.js → pr-subscriptions-n3ymnt5w.js} +6 -6
  62. package/dist/cli/{pr-workflow-gate-5374j5nm.js → pr-workflow-gate-t8axhfzw.js} +31 -31
  63. package/dist/cli/{runner-xfagxzkx.js → runner-9kd080km.js} +4 -4
  64. package/dist/cli/{scan-cursor-qqt0v8e4.js → scan-cursor-qg4eg6ah.js} +5 -5
  65. package/dist/cli/{schema-6mh6et27.js → schema-73z5xbmd.js} +1 -1
  66. package/dist/cli/{scope-persistence-astxnj1c.js → scope-persistence-b9924hz1.js} +10 -10
  67. package/dist/cli/{server-dqq8v0bs.js → server-jn6xd5bh.js} +31 -31
  68. package/dist/cli/{skill-generator-s9y7098d.js → skill-generator-k344y5m2.js} +12 -12
  69. package/dist/cli/{snapshot-coordination-init-gs4258xn.js → snapshot-coordination-init-a8992336.js} +31 -31
  70. package/dist/cli/{speckit-checkoff-y5ynwxhq.js → speckit-checkoff-0tctprtz.js} +3 -3
  71. package/dist/cli/{telemetry-6k8t2mrw.js → telemetry-vqyy5nha.js} +1 -1
  72. package/dist/cli/{worktree-collision-ownership-hrv6e3ps.js → worktree-collision-ownership-6r6jekr9.js} +6 -6
  73. package/dist/cli/{worktree-isolation-wksm23tp.js → worktree-isolation-5kw6jnej.js} +31 -31
  74. package/dist/commands/registry.d.ts +1 -1
  75. package/dist/commands/report.d.ts +20 -4
  76. package/dist/hooks/guardrails/stage-a-route.d.ts +16 -0
  77. package/dist/index.js +409 -408
  78. package/dist/observability/catalog.d.ts +2 -2
  79. package/dist/observability/envelope.d.ts +4 -0
  80. package/dist/services/execution-attempt.d.ts +80 -0
  81. package/dist/services/task-cohort.d.ts +123 -0
  82. package/dist/telemetry.d.ts +1 -1
  83. package/package.json +1 -1
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * The event catalog (issue #2029).
3
3
  *
4
- * Exactly 64 entries, matching the `TelemetryEvent` union at
4
+ * Exactly 65 entries, matching the `TelemetryEvent` union at
5
5
  * `src/telemetry.ts:20-172`. 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
@@ -89,7 +89,7 @@ export interface CatalogEntry {
89
89
  /**
90
90
  * Whether an event of this kind must carry `trace.parentSpanId`.
91
91
  *
92
- * `false` for all 64 entries today, and that is a truthful statement about
92
+ * `false` for all 65 entries today, and that is a truthful statement about
93
93
  * the current system rather than a placeholder: no producer supplies a
94
94
  * parent span, so `createObservation` never sets one. Setting this to `true`
95
95
  * for a kind whose producer cannot supply a parent would make every
@@ -136,6 +136,8 @@ export declare const WorkflowIdsSchema: z.ZodObject<{
136
136
  hostSessionId: z.ZodOptional<z.ZodString>;
137
137
  swarmSessionId: z.ZodOptional<z.ZodString>;
138
138
  taskId: z.ZodOptional<z.ZodString>;
139
+ callId: z.ZodOptional<z.ZodString>;
140
+ invocationId: z.ZodOptional<z.ZodString>;
139
141
  phaseId: z.ZodOptional<z.ZodString>;
140
142
  laneId: z.ZodOptional<z.ZodString>;
141
143
  batchId: z.ZodOptional<z.ZodString>;
@@ -329,6 +331,8 @@ export declare const ObservabilityEventSchema: z.ZodObject<{
329
331
  hostSessionId: z.ZodOptional<z.ZodString>;
330
332
  swarmSessionId: z.ZodOptional<z.ZodString>;
331
333
  taskId: z.ZodOptional<z.ZodString>;
334
+ callId: z.ZodOptional<z.ZodString>;
335
+ invocationId: z.ZodOptional<z.ZodString>;
332
336
  phaseId: z.ZodOptional<z.ZodString>;
333
337
  laneId: z.ZodOptional<z.ZodString>;
334
338
  batchId: z.ZodOptional<z.ZodString>;
@@ -0,0 +1,80 @@
1
+ /** Closed attempt/outcome record-class vocabulary (issue #2676 AC1). */
2
+ export type ExecutionAttemptClass = 'denial' | 'attempt' | 'result' | 'duplicate' | 'late' | 'cancelled' | 'provider_failed';
3
+ export declare const EXECUTION_ATTEMPT_CLASSES: readonly ExecutionAttemptClass[];
4
+ /** Terminal disposition of the attempt, when the producer reported one. */
5
+ export type ExecutionAttemptOutcomeStatus = 'success' | 'failure' | 'partial' | 'unknown';
6
+ /** The frozen per-attempt cost axes (issue #2676 AC2). */
7
+ export declare const TASK_ATTEMPT_COST_AXES: readonly ["latencyMs", "inputTokens", "outputTokens", "cacheReadTokens", "estimatedCostUsd", "billedCostUsd"];
8
+ export type TaskAttemptCostAxis = (typeof TASK_ATTEMPT_COST_AXES)[number];
9
+ /** Caller-held cost facts. An absent key means the producer did not hold it. */
10
+ export interface TaskAttemptCostInput {
11
+ taskId?: string;
12
+ attemptId?: string;
13
+ latencyMs?: number;
14
+ inputTokens?: number;
15
+ outputTokens?: number;
16
+ cacheReadTokens?: number;
17
+ estimatedCostUsd?: number;
18
+ billedCostUsd?: number;
19
+ }
20
+ /**
21
+ * The built cost record: every axis is `number | null`, `null` meaning the
22
+ * producer did not hold the value, with `unavailable` listing exactly the
23
+ * axes that are null. Zero is a legal KNOWN value (zero tokens used) and is
24
+ * never produced as a fallback for a missing input.
25
+ */
26
+ export interface TaskAttemptCost extends Record<TaskAttemptCostAxis, number | null> {
27
+ taskId?: string;
28
+ attemptId?: string;
29
+ unavailable: readonly string[];
30
+ }
31
+ /** A known axis value must be finite and non-negative to count as held. */
32
+ declare function knownCostValue(value: number | undefined): number | null;
33
+ /**
34
+ * Build the per-attempt cost record. Caller-omitted (or invalid) axes are
35
+ * strictly `null` AND listed in `unavailable`; known axes pass through
36
+ * verbatim and never appear in `unavailable`.
37
+ */
38
+ export declare function buildTaskAttemptCost(partial: TaskAttemptCostInput): TaskAttemptCost;
39
+ /** Recorder input. `sessionID`/`callID` are the Stage A casing aliases. */
40
+ export interface ExecutionAttemptInput {
41
+ sessionId?: string;
42
+ /** Stage A casing alias for {@link sessionId}; normalized before emit. */
43
+ sessionID?: string;
44
+ taskId?: string;
45
+ callId?: string;
46
+ /** Stage A casing alias for {@link callId}; normalized before emit. */
47
+ callID?: string;
48
+ invocationId?: string;
49
+ /**
50
+ * Monotonic generation cursor for the (task, call) pair. REQUIRED for
51
+ * class `late` — it is the cursor the record was late against. A `late`
52
+ * caller that cannot supply it is refused fail-open with a warn, never
53
+ * silently downgraded.
54
+ */
55
+ generation?: number;
56
+ retryIndex?: number;
57
+ laneId?: string;
58
+ knowledgeTraceId?: string;
59
+ attemptClass: ExecutionAttemptClass;
60
+ outcomeStatus?: ExecutionAttemptOutcomeStatus;
61
+ /**
62
+ * Identity (record_id / event id) of the already-committed record this
63
+ * one duplicates. REQUIRED for class `duplicate`; never synthesized — a
64
+ * duplicate caller holding no original identity is refused fail-open.
65
+ */
66
+ duplicateOf?: string;
67
+ cost?: TaskAttemptCostInput;
68
+ }
69
+ /** Sanitize an identifier for emission: printable, bounded (Stage A pattern). */
70
+ declare function boundedId(value: string | undefined): string | undefined;
71
+ /**
72
+ * Record ONE execution attempt as an `execution_attempt_recorded` telemetry
73
+ * event. Fail-open: invalid input logs a warn and returns without emitting.
74
+ */
75
+ export declare function recordExecutionAttempt(input: ExecutionAttemptInput): void;
76
+ export declare const _internals: {
77
+ boundedId: typeof boundedId;
78
+ knownCostValue: typeof knownCostValue;
79
+ };
80
+ export {};
@@ -0,0 +1,123 @@
1
+ /**
2
+ * Task-attempt cohort snapshot and qualification (issue #2676 / Workstream D16).
3
+ *
4
+ * A causal-rate claim over task attempts requires a stable cohort: a snapshot
5
+ * of the live population taken at a recorded instant (so later mutation cannot
6
+ * change a reported denominator), captured provenance manifests for the
7
+ * trigger / WAL / event / host-status sources (stats + bounded digests, never
8
+ * content parsing), configuration/version strata, and an uncertainty channel
9
+ * that is present whenever sample size or cost fields are incomplete. Reports
10
+ * that cannot meet the contract stay explicitly unqualified and render as
11
+ * descriptive operational counts (the boundary documented in
12
+ * docs/execution-attempt-tracing.md).
13
+ *
14
+ * The mutable-population rule: `snapshotTaskAttemptCohort` deep-copies the
15
+ * population it is handed; every later mutation of the caller's array (or of
16
+ * a nested field of a captured record) is invisible to the snapshot and to
17
+ * every report built from it.
18
+ *
19
+ * Durability: when `directory` is provided, the snapshot persists ONE frozen
20
+ * manifest JSON under `.swarm/observability/cohorts/` (FIFO-bounded to the
21
+ * latest 20 files; write failures are warn-logged and never propagate). This
22
+ * is the only filesystem side effect, and it is registered in the retention
23
+ * registry (row `observability-cohorts`).
24
+ */
25
+ /** Number of frozen cohort manifests retained on disk (FIFO). */
26
+ export declare const COHORT_MANIFEST_RETENTION = 20;
27
+ /** Sample size below which a cohort always reports a sample-size uncertainty. */
28
+ export declare const COHORT_SAMPLE_SIZE_THRESHOLD = 30;
29
+ /** The provenance manifest sources captured before a cohort is reported. */
30
+ export type CohortManifestSource = 'trigger' | 'wal' | 'event' | 'host_status';
31
+ export interface CohortManifestEntry {
32
+ source: CohortManifestSource;
33
+ status: 'captured' | 'unavailable';
34
+ capturedAt: string;
35
+ sizeBytes?: number;
36
+ digest?: string;
37
+ }
38
+ /** One population record (a folded execution-attempt row or equivalent). */
39
+ export interface TaskAttemptPopulationRecord {
40
+ taskId?: string;
41
+ attemptClass?: string;
42
+ outcomeStatus?: string;
43
+ cost?: unknown;
44
+ [key: string]: unknown;
45
+ }
46
+ export interface TaskAttemptCohortStrata {
47
+ pluginVersion?: string;
48
+ runtime?: string;
49
+ configHash?: string;
50
+ }
51
+ export interface TaskAttemptCohortSnapshot {
52
+ tasks: readonly TaskAttemptPopulationRecord[];
53
+ capturedAt: string;
54
+ count: number;
55
+ strata: TaskAttemptCohortStrata;
56
+ manifests: readonly CohortManifestEntry[];
57
+ }
58
+ export interface TaskCohortReport {
59
+ denominator: number;
60
+ capturedAt: string;
61
+ perClassCounts: Record<string, number>;
62
+ /** Sum over records that HELD the axis (unknown axes contribute nothing). */
63
+ costTotalsKnown: Record<string, number>;
64
+ /** Per axis: how many captured records did not hold the value. */
65
+ costUnavailableCounts: Record<string, number>;
66
+ strata: TaskAttemptCohortStrata;
67
+ /** Non-empty whenever sample size or cost fields are incomplete. */
68
+ uncertainty: string[];
69
+ qualification: {
70
+ qualified: boolean;
71
+ reasons: string[];
72
+ };
73
+ }
74
+ declare function deepCopyRecord(record: TaskAttemptPopulationRecord): TaskAttemptPopulationRecord;
75
+ declare function captureFileManifest(source: CohortManifestSource, filePath: string, capturedAt: string): CohortManifestEntry;
76
+ /** Minimal shape of `process.versions` this module derives a label from. */
77
+ export type RuntimeVersions = {
78
+ bun?: string;
79
+ node?: string;
80
+ };
81
+ /**
82
+ * Derive the honest runtime label from the host's version table. Bun also
83
+ * defines `process.versions.node`, so the branch must test bun PRESENCE —
84
+ * never string truthiness (a `.trim()`-based `||` fallback yields the bare,
85
+ * version-less "bun" under Node, which sha256-hashes into a poisoned
86
+ * host-status digest).
87
+ */
88
+ export declare function deriveRuntimeLabel(versions: RuntimeVersions): string;
89
+ declare function captureHostStatusManifest(capturedAt: string, strata: TaskAttemptCohortStrata): CohortManifestEntry;
90
+ declare function manifestFileName(capturedAt: string, manifests: readonly CohortManifestEntry[]): string;
91
+ declare function persistSnapshotManifest(directory: string, snapshot: TaskAttemptCohortSnapshot): void;
92
+ /**
93
+ * Snapshot the live task-attempt population. The population is DEEP-copied:
94
+ * later mutation of the caller's array or of nested record fields cannot
95
+ * change this snapshot or any report built from it. Provenance manifests for
96
+ * the trigger / WAL / event stores are captured BEFORE the population copy is
97
+ * returned, so the reported cohort metric is bound to the population state
98
+ * the manifests describe. When `directory` is provided the snapshot is
99
+ * persisted as a frozen manifest under `.swarm/observability/cohorts/`.
100
+ */
101
+ export declare function snapshotTaskAttemptCohort(input: {
102
+ tasks: TaskAttemptPopulationRecord[];
103
+ directory?: string;
104
+ strata?: TaskAttemptCohortStrata;
105
+ now?: Date;
106
+ }): TaskAttemptCohortSnapshot;
107
+ /**
108
+ * Build the cohort report from a snapshot. The denominator is the SNAPSHOT's
109
+ * captured count — never a live recount. Uncertainty entries are present
110
+ * whenever the sample is below threshold, any cost axis is unavailable on any
111
+ * record, or any record lacks an outcome; qualification is false with
112
+ * enumerated reasons when the cohort cannot support a causal-rate claim.
113
+ */
114
+ export declare function buildTaskCohortReport(snapshot: TaskAttemptCohortSnapshot): TaskCohortReport;
115
+ export declare const _internals: {
116
+ captureFileManifest: typeof captureFileManifest;
117
+ captureHostStatusManifest: typeof captureHostStatusManifest;
118
+ deriveRuntimeLabel: typeof deriveRuntimeLabel;
119
+ manifestFileName: typeof manifestFileName;
120
+ persistSnapshotManifest: typeof persistSnapshotManifest;
121
+ deepCopyRecord: typeof deepCopyRecord;
122
+ };
123
+ export {};
@@ -41,7 +41,7 @@ export type TelemetryEvent = 'session_started' | 'session_ended' | 'agent_activa
41
41
  * `prm_hard_stop` TRIGGER emitted by `src/prm/escalation.ts`. A trigger with
42
42
  * no matching delivery means the containment never reached the agent.
43
43
  */
44
- | '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' | 'trajectory_health' | 'learning_health_alarm' | 'pr_subscription_health' | 'council_attempt' | 'council_round_transition' | 'council_attempt_unscoped' | 'context_source_attribution' | 'verdict_row_pipe_recovery' | 'training_vault_health';
44
+ | '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' | 'trajectory_health' | 'learning_health_alarm' | 'pr_subscription_health' | 'execution_attempt_recorded' | 'council_attempt' | 'council_round_transition' | 'council_attempt_unscoped' | 'context_source_attribution' | 'verdict_row_pipe_recovery' | 'training_vault_health';
45
45
  /** Stable classification for how a reviewer-gate decision was established. */
46
46
  export type ReviewerGateEvidenceKind = 'genuine' | 'fallback' | 'data_quality' | 'block';
47
47
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-swarm",
3
- "version": "7.182.0",
3
+ "version": "7.183.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",