opencode-swarm 7.98.1 → 7.99.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 (45) hide show
  1. package/README.md +1 -0
  2. package/dist/cli/{config-doctor-7yrxfa6b.js → config-doctor-9fhfy6p7.js} +2 -2
  3. package/dist/cli/{evidence-summary-service-g4x5e3e3.js → evidence-summary-service-4hs44n2c.js} +6 -6
  4. package/dist/cli/{gate-evidence-nphg8hay.js → gate-evidence-ywys9vfs.js} +4 -4
  5. package/dist/cli/guardrail-explain-ktm6szbm.js +30 -0
  6. package/dist/cli/{guardrail-log-53z1cf46.js → guardrail-log-ya49kpwn.js} +3 -3
  7. package/dist/cli/{index-91qtsbce.js → index-3naa2ajc.js} +1 -1
  8. package/dist/cli/{index-attgb1ma.js → index-4pt2py5p.js} +17 -15
  9. package/dist/cli/{index-sf08zj91.js → index-5fxjagjt.js} +2 -2
  10. package/dist/cli/{index-471qxz9g.js → index-7hnwnw5g.js} +11 -1
  11. package/dist/cli/{index-kv4dd5c5.js → index-9b7qp18e.js} +1 -1
  12. package/dist/cli/{index-hb10a2g8.js → index-f7nma02k.js} +2 -2
  13. package/dist/cli/{index-0rgde8qc.js → index-ft4gehk1.js} +2 -2
  14. package/dist/cli/{index-gnd1280x.js → index-h9ptj4b1.js} +1 -1
  15. package/dist/cli/{index-zgba613y.js → index-hw8r3e5p.js} +1108 -792
  16. package/dist/cli/{index-mh1ej70w.js → index-r8f89sm9.js} +2 -2
  17. package/dist/cli/{index-zy22fg5h.js → index-svf2zjxs.js} +5 -1
  18. package/dist/cli/{index-xchgryg4.js → index-vn263hqt.js} +16 -2
  19. package/dist/cli/{index-fjxjb66n.js → index-vwyjkzgs.js} +3 -3
  20. package/dist/cli/{index-gn8n22th.js → index-we94wkty.js} +19 -3
  21. package/dist/cli/{index-4c5jpmn9.js → index-wwnjw0fb.js} +11 -11
  22. package/dist/cli/{index-5z2e78tv.js → index-xsswhy6k.js} +1 -1
  23. package/dist/cli/index.js +13 -13
  24. package/dist/cli/{knowledge-store-pa58msy5.js → knowledge-store-tsa8ezka.js} +4 -4
  25. package/dist/cli/{pending-delegations-shqbvfjc.js → pending-delegations-c785p5n2.js} +3 -3
  26. package/dist/cli/{pr-subscriptions-2565fpsc.js → pr-subscriptions-fqrzm0tv.js} +4 -4
  27. package/dist/cli/{schema-mygkbbe9.js → schema-nz638xc3.js} +5 -1
  28. package/dist/cli/{skill-generator-3tkwcg4x.js → skill-generator-99rrfwae.js} +5 -5
  29. package/dist/cli/{telemetry-aa1ma1dr.js → telemetry-jm7t8031.js} +1 -1
  30. package/dist/commands/close.d.ts +2 -1
  31. package/dist/commands/costs.d.ts +4 -0
  32. package/dist/commands/index.d.ts +1 -0
  33. package/dist/commands/registry.d.ts +9 -2
  34. package/dist/config/evidence-schema.d.ts +44 -44
  35. package/dist/config/index.d.ts +2 -2
  36. package/dist/config/schema.d.ts +24 -0
  37. package/dist/hooks/system-enhancer.d.ts +1 -1
  38. package/dist/hooks/utils.d.ts +3 -1
  39. package/dist/index.js +2978 -2337
  40. package/dist/plan/manager.d.ts +1 -1
  41. package/dist/services/cost-accounting.d.ts +65 -0
  42. package/dist/state.d.ts +3 -3
  43. package/dist/telemetry.d.ts +2 -1
  44. package/package.json +1 -1
  45. package/dist/cli/guardrail-explain-cm08h4mt.js +0 -30
@@ -108,7 +108,7 @@ export declare function regeneratePlanMarkdown(directory: string, plan: Plan): P
108
108
  * 3. .swarm/plan.md exists only -> migrate from plan.md, save both files, return Plan
109
109
  * 4. Neither exists -> return null
110
110
  */
111
- export declare function loadPlan(directory: string): Promise<RuntimePlan | null>;
111
+ export declare function loadPlan(directory: string, cache?: Map<string, Promise<string | null>>): Promise<RuntimePlan | null>;
112
112
  /**
113
113
  * Recovery-path helper for callers that legitimately need to replace the
114
114
  * plan task set without explicit per-id acknowledgement (e.g. rebuilding
@@ -0,0 +1,65 @@
1
+ export type CostSource = 'reported' | 'estimated' | 'unavailable';
2
+ export type ModelPricing = {
3
+ input_per_million: number;
4
+ output_per_million: number;
5
+ reasoning_per_million?: number;
6
+ cache_per_million?: number;
7
+ };
8
+ export type PricingConfig = {
9
+ models?: Record<string, ModelPricing>;
10
+ };
11
+ export type TokenUsage = {
12
+ tokens_input: number;
13
+ tokens_output: number;
14
+ tokens_reasoning: number;
15
+ tokens_cache: number;
16
+ };
17
+ export type DelegationCostFields = TokenUsage & {
18
+ cost_usd: number | null;
19
+ cost_source: CostSource;
20
+ model?: string;
21
+ gate?: string;
22
+ retry_index?: number;
23
+ };
24
+ export type DelegationCostInput = {
25
+ raw?: unknown;
26
+ model?: string;
27
+ gate?: string;
28
+ retry_index?: number;
29
+ pricing?: PricingConfig;
30
+ };
31
+ export type CostSummary = {
32
+ total_cost_usd: number;
33
+ total_reported_usd: number;
34
+ total_estimated_usd: number;
35
+ total_input_tokens: number;
36
+ total_output_tokens: number;
37
+ total_reasoning_tokens: number;
38
+ total_cache_tokens: number;
39
+ delegations: number;
40
+ unavailable_delegations: number;
41
+ by_agent: CostSummaryRow[];
42
+ by_task: CostSummaryRow[];
43
+ by_gate: CostSummaryRow[];
44
+ by_retry: CostSummaryRow[];
45
+ by_source: Record<CostSource, {
46
+ delegations: number;
47
+ cost_usd: number;
48
+ }>;
49
+ };
50
+ export type CostSummaryRow = {
51
+ name: string;
52
+ delegations: number;
53
+ cost_usd: number;
54
+ input_tokens: number;
55
+ output_tokens: number;
56
+ reasoning_tokens: number;
57
+ cache_tokens: number;
58
+ unavailable_delegations: number;
59
+ };
60
+ export declare const BUNDLED_MODEL_PRICING: Record<string, ModelPricing>;
61
+ export declare function buildDelegationCostFields(input?: DelegationCostInput): DelegationCostFields;
62
+ export declare function summarizeTelemetryCosts(directory: string): CostSummary;
63
+ export declare function readTelemetryEvents(directory: string): Record<string, unknown>[];
64
+ export declare function estimateCostUsd(usage: TokenUsage, model?: string, pricing?: PricingConfig): number | null;
65
+ export declare function roundUsd(value: number): number;
package/dist/state.d.ts CHANGED
@@ -391,9 +391,9 @@ export declare function resetSwarmStatePreservingSingletons(): void;
391
391
  export declare function startAgentSession(sessionId: string, agentName: string, staleDurationMs?: number, directory?: string): void;
392
392
  /**
393
393
  * End an agent session by removing it from the state.
394
- * NOTE: Currently unused in production no session lifecycle teardown is wired up.
395
- * Sessions accumulate for the process lifetime. Callers should integrate this into
396
- * a session TTL or idle-timeout mechanism to prevent unbounded Map growth.
394
+ * Called at session terminal state transitions (task completion, error, or session
395
+ * teardown) to prevent unbounded Map growth. Double-calls are safe: Map.delete is
396
+ * a no-op for missing keys (FR-010).
397
397
  * @param sessionId - The session identifier to remove
398
398
  */
399
399
  export declare function endAgentSession(sessionId: string): void;
@@ -1,3 +1,4 @@
1
+ import type { DelegationCostFields } from './services/cost-accounting.js';
1
2
  export type TelemetryEvent = 'session_started' | 'session_ended' | 'agent_activated' | 'delegation_begin' | 'delegation_end' | 'task_state_changed' | 'gate_passed' | 'gate_failed' | 'gate_parse_error' | 'phase_changed' | 'budget_updated' | 'model_fallback' | 'hard_limit_hit' | 'revision_limit_hit' | 'loop_detected' | 'scope_violation' | 'qa_skip_violation' | 'heartbeat' | 'turbo_mode_changed' | 'auto_oversight_escalation' | 'environment_detected' | 'evidence_lock_acquired' | 'evidence_lock_contended' | 'evidence_lock_stale_recovered' | 'plan_ledger_cas_retry' | 'plan_md_write_failed' | 'snapshot_failed' | 'prm_pattern_detected' | 'prm_course_correction_injected' | 'prm_escalation_triggered' | 'prm_hard_stop';
2
3
  export type TelemetryListener = (event: TelemetryEvent, data: Record<string, unknown>) => void;
3
4
  /**
@@ -42,7 +43,7 @@ export declare const telemetry: {
42
43
  sessionEnded(sessionId: string, reason: string): void;
43
44
  agentActivated(sessionId: string, agentName: string, oldName?: string): void;
44
45
  delegationBegin(sessionId: string, agentName: string, taskId: string): void;
45
- delegationEnd(sessionId: string, agentName: string, taskId: string, result: string): void;
46
+ delegationEnd(sessionId: string, agentName: string, taskId: string, result: string, costFields?: Partial<DelegationCostFields>): void;
46
47
  taskStateChanged(sessionId: string, taskId: string, newState: string, oldState?: string): void;
47
48
  gatePassed(sessionId: string, gate: string, taskId: string): void;
48
49
  gateParseError(taskId: string, error: Error): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-swarm",
3
- "version": "7.98.1",
3
+ "version": "7.99.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",
@@ -1,30 +0,0 @@
1
- // @bun
2
- import {
3
- handleGuardrailExplain
4
- } from "./index-0rgde8qc.js";
5
- import"./index-zgba613y.js";
6
- import"./index-5z2e78tv.js";
7
- import"./index-2a6ppa65.js";
8
- import"./index-fjxjb66n.js";
9
- import"./index-hb10a2g8.js";
10
- import"./index-zy22fg5h.js";
11
- import"./index-471qxz9g.js";
12
- import"./index-4c5jpmn9.js";
13
- import"./index-adz3nk9b.js";
14
- import"./index-v4fcn4tr.js";
15
- import"./index-mh1ej70w.js";
16
- import"./index-kv4dd5c5.js";
17
- import"./index-sf08zj91.js";
18
- import"./index-gn8n22th.js";
19
- import"./index-jtqkh8jf.js";
20
- import"./index-5e4e2hvv.js";
21
- import"./index-p0arc26j.js";
22
- import"./index-zgwm4ryv.js";
23
- import"./index-91qtsbce.js";
24
- import"./index-293f68mj.js";
25
- import"./index-b9v501fr.js";
26
- import"./index-xchgryg4.js";
27
- import"./index-a76rekgs.js";
28
- export {
29
- handleGuardrailExplain
30
- };