opencode-swarm 6.54.0 → 6.56.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.
@@ -17,4 +17,10 @@ export type ToolDoctorResult = ConfigDoctorResult;
17
17
  * Verifies that every entry in TOOL_NAMES has a corresponding key
18
18
  * in the plugin's tool: {} block in src/index.ts.
19
19
  */
20
+ /**
21
+ * Returns a structured advisory string for any missing Class 3 binaries.
22
+ * Intended for injection into the architect's first system prompt.
23
+ * Returns null if all binaries are available.
24
+ */
25
+ export declare function getBinaryReadinessAdvisory(): string | null;
20
26
  export declare function runToolDoctor(_directory: string, pluginRoot?: string): ToolDoctorResult;
package/dist/state.d.ts CHANGED
@@ -7,6 +7,7 @@
7
7
  * and delegation chains.
8
8
  */
9
9
  import type { OpencodeClient } from '@opencode-ai/sdk';
10
+ import { type EnvironmentProfile } from './environment/profile.js';
10
11
  /**
11
12
  * Represents a single tool call entry for tracking purposes
12
13
  */
@@ -34,6 +35,11 @@ export interface DelegationEntry {
34
35
  to: string;
35
36
  timestamp: number;
36
37
  }
38
+ /**
39
+ * Reason a non-architect agent was activated during delegation tracking.
40
+ * Used by delegation-tracker.ts to record why a delegation occurred.
41
+ */
42
+ export type DelegationReason = 'normal_delegation' | 'review_rejected' | 'critic_consultation' | 'retry_circuit_breaker' | 'conflict_escalation' | 'stale_recovery';
37
43
  /**
38
44
  * Per-task workflow state for gate progression tracking.
39
45
  * Transitions must be forward-only: idle → coder_delegated → pre_check_passed → reviewer_run → tests_run → complete
@@ -53,6 +59,8 @@ export interface AgentSessionState {
53
59
  lastAgentEventTime: number;
54
60
  /** Whether active delegation is in progress for this session */
55
61
  delegationActive: boolean;
62
+ /** Reason the most recent non-architect agent was activated */
63
+ lastDelegationReason?: DelegationReason;
56
64
  /** Current active invocation ID for this agent */
57
65
  activeInvocationId: number;
58
66
  /** Last invocation ID by agent name (e.g., { "coder": 3, "reviewer": 1 }) */
@@ -213,6 +221,8 @@ export declare const swarmState: {
213
221
  pendingRehydrations: Set<Promise<void>>;
214
222
  /** Whether full-auto mode is enabled in config */
215
223
  fullAutoEnabledInConfig: boolean;
224
+ /** Per-session environment profiles — keyed by sessionID */
225
+ environmentProfiles: Map<string, EnvironmentProfile>;
216
226
  };
217
227
  /**
218
228
  * Reset all state to initial values - useful for testing
@@ -366,3 +376,6 @@ export declare function hasActiveTurboMode(sessionID?: string): boolean;
366
376
  * @returns true if the specified session has fullAutoMode: true (model validation is advisory-only).
367
377
  */
368
378
  export declare function hasActiveFullAuto(sessionID?: string): boolean;
379
+ export declare function setSessionEnvironment(sessionId: string, profile: EnvironmentProfile): void;
380
+ export declare function getSessionEnvironment(sessionId: string): EnvironmentProfile | undefined;
381
+ export declare function ensureSessionEnvironment(sessionId: string): EnvironmentProfile;
@@ -1,4 +1,4 @@
1
- export type TelemetryEvent = 'session_started' | 'session_ended' | 'agent_activated' | 'delegation_begin' | 'delegation_end' | 'task_state_changed' | 'gate_passed' | 'gate_failed' | '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';
1
+ export type TelemetryEvent = 'session_started' | 'session_ended' | 'agent_activated' | 'delegation_begin' | 'delegation_end' | 'task_state_changed' | 'gate_passed' | 'gate_failed' | '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';
2
2
  export type TelemetryListener = (event: TelemetryEvent, data: Record<string, unknown>) => void;
3
3
  /** @internal - For testing only */
4
4
  export declare function resetTelemetryForTesting(): void;
@@ -51,4 +51,5 @@ export declare const telemetry: {
51
51
  heartbeat(sessionId: string): void;
52
52
  turboModeChanged(sessionId: string, enabled: boolean, agentName: string): void;
53
53
  autoOversightEscalation(sessionId: string, reason: string, interactionCount: number, deadlockCount: number, phase?: number): void;
54
+ environmentDetected(sessionId: string, hostOS: string, shellFamily: string, executionMode: string): void;
54
55
  };
@@ -2,6 +2,10 @@ import { type ToolContext, tool } from '@opencode-ai/plugin';
2
2
  /**
3
3
  * Options for creating a swarm tool.
4
4
  * The args type is inferred from what you pass to the tool() call.
5
+ *
6
+ * Note: The session-level EnvironmentProfile is available to any tool that has
7
+ * a sessionID via `getSessionEnvironment(ctx?.sessionID)` from '../state.js'.
8
+ * ToolContext is defined externally in @opencode-ai/plugin and is not modified here.
5
9
  */
6
10
  export interface SwarmToolOptions<Args extends Record<string, unknown>> {
7
11
  description: string;
@@ -14,10 +14,10 @@ export { evidence_check } from './evidence-check';
14
14
  export { extract_code_blocks } from './file-extractor';
15
15
  export { fetchGitingest, type GitingestArgs, gitingest } from './gitingest';
16
16
  export { imports } from './imports';
17
- export { knowledgeAdd } from './knowledge-add';
17
+ export { knowledge_add } from './knowledge-add';
18
18
  export { knowledge_query } from './knowledge-query';
19
- export { knowledgeRecall } from './knowledge-recall';
20
- export { knowledgeRemove } from './knowledge-remove';
19
+ export { knowledge_recall } from './knowledge-recall';
20
+ export { knowledge_remove } from './knowledge-remove';
21
21
  export { lint } from './lint';
22
22
  export { phase_complete } from './phase-complete';
23
23
  export { pkg_audit } from './pkg-audit';
@@ -1,2 +1,2 @@
1
1
  import { createSwarmTool } from './create-tool.js';
2
- export declare const knowledgeAdd: ReturnType<typeof createSwarmTool>;
2
+ export declare const knowledge_add: ReturnType<typeof createSwarmTool>;
@@ -1,2 +1,2 @@
1
1
  import { createSwarmTool } from './create-tool.js';
2
- export declare const knowledgeRecall: ReturnType<typeof createSwarmTool>;
2
+ export declare const knowledge_recall: ReturnType<typeof createSwarmTool>;
@@ -1,2 +1,2 @@
1
1
  import { createSwarmTool } from './create-tool.js';
2
- export declare const knowledgeRemove: ReturnType<typeof createSwarmTool>;
2
+ export declare const knowledge_remove: ReturnType<typeof createSwarmTool>;
@@ -3,7 +3,7 @@
3
3
  * Used for constants and agent setup references.
4
4
  */
5
5
  /** Union type of all valid tool names */
6
- export type ToolName = 'diff' | 'syntax_check' | 'placeholder_scan' | 'imports' | 'lint' | 'secretscan' | 'sast_scan' | 'build_check' | 'pre_check_batch' | 'quality_budget' | 'symbols' | 'complexity_hotspots' | 'schema_drift' | 'todo_extract' | 'evidence_check' | 'check_gate_status' | 'completion_verify' | 'sbom_generate' | 'checkpoint' | 'pkg_audit' | 'test_runner' | 'detect_domains' | 'gitingest' | 'retrieve_summary' | 'extract_code_blocks' | 'phase_complete' | 'save_plan' | 'update_task_status' | 'write_retro' | 'write_drift_evidence' | 'declare_scope' | 'knowledge_query' | 'doc_scan' | 'doc_extract' | 'curator_analyze' | 'knowledgeAdd' | 'knowledgeRecall' | 'knowledgeRemove' | 'co_change_analyzer' | 'search' | 'batch_symbols' | 'suggest_patch';
6
+ export type ToolName = 'diff' | 'syntax_check' | 'placeholder_scan' | 'imports' | 'lint' | 'secretscan' | 'sast_scan' | 'build_check' | 'pre_check_batch' | 'quality_budget' | 'symbols' | 'complexity_hotspots' | 'schema_drift' | 'todo_extract' | 'evidence_check' | 'check_gate_status' | 'completion_verify' | 'sbom_generate' | 'checkpoint' | 'pkg_audit' | 'test_runner' | 'detect_domains' | 'gitingest' | 'retrieve_summary' | 'extract_code_blocks' | 'phase_complete' | 'save_plan' | 'update_task_status' | 'write_retro' | 'write_drift_evidence' | 'declare_scope' | 'knowledge_query' | 'doc_scan' | 'doc_extract' | 'curator_analyze' | 'knowledge_add' | 'knowledge_recall' | 'knowledge_remove' | 'co_change_analyzer' | 'search' | 'batch_symbols' | 'suggest_patch';
7
7
  /** Readonly array of all tool names */
8
8
  export declare const TOOL_NAMES: readonly ToolName[];
9
9
  /** Set for O(1) tool name validation */
@@ -52,4 +52,24 @@ export interface CoderRetryCircuitBreakerEvent {
52
52
  phase: number;
53
53
  action: 'sounding_board_consultation' | 'simplification' | 'user_escalation';
54
54
  }
55
- export type V619Event = SoundingBoardConsultedEvent | ArchitectLoopDetectedEvent | PrecedentManipulationDetectedEvent | CoderSelfAuditEvent | CoderRetryCircuitBreakerEvent;
55
+ export interface AgentConflictDetectedEvent {
56
+ type: 'agent_conflict_detected';
57
+ timestamp: string;
58
+ sessionId: string;
59
+ phase: number;
60
+ taskId?: string;
61
+ sourceAgent: 'architect' | 'coder' | 'reviewer' | 'critic' | 'test_engineer';
62
+ targetAgent: 'architect' | 'coder' | 'reviewer' | 'critic' | 'test_engineer';
63
+ conflictType: 'feedback_rejection' | 'authority_collision' | 'retry_spiral' | 'scope_disagreement' | 'quality_gate_dispute';
64
+ resolutionPath: 'self_resolve' | 'soundingboard' | 'simplification' | 'sme_consult' | 'user_escalation';
65
+ summary: string;
66
+ }
67
+ export interface AuthorityHandoffResolvedEvent {
68
+ type: 'authority_handoff_resolved';
69
+ timestamp: string;
70
+ sessionId: string;
71
+ previousAgent: string;
72
+ newAgent: string;
73
+ reason: 'task_complete' | 'stale_delegation' | 'conflict_escalation' | 'manual_reset';
74
+ }
75
+ export type V619Event = SoundingBoardConsultedEvent | ArchitectLoopDetectedEvent | PrecedentManipulationDetectedEvent | CoderSelfAuditEvent | CoderRetryCircuitBreakerEvent | AgentConflictDetectedEvent | AuthorityHandoffResolvedEvent;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-swarm",
3
- "version": "6.54.0",
3
+ "version": "6.56.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",