opencode-swarm 6.19.8 → 6.20.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.
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Handle /swarm checkpoint command
3
+ * Creates, lists, restores, or deletes checkpoints with optional label
4
+ */
5
+ export declare function handleCheckpointCommand(directory: string, args: string[]): Promise<string>;
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Role-Scoped Context Injection Filter
3
+ * Filters context entries based on [FOR: ...] tags for role-based context delivery.
4
+ */
5
+ /**
6
+ * Context entry with role metadata
7
+ */
8
+ export interface ContextEntry {
9
+ role: 'user' | 'assistant' | 'system';
10
+ content: string;
11
+ name?: string;
12
+ }
13
+ /**
14
+ * Filter context entries based on target role and [FOR: ...] tags.
15
+ *
16
+ * Filtering rules:
17
+ * - Entries with [FOR: ALL] are included for all agents
18
+ * - Entries with [FOR: specific_agents] are included only for named agents
19
+ * - Entries without [FOR: ...] tag are included for all agents (backward compatibility)
20
+ * - System prompts, delegation envelopes, plan content, and knowledge entries are never filtered
21
+ *
22
+ * @param entries - Array of context entries to filter
23
+ * @param targetRole - The target agent role to filter for
24
+ * @param directory - Optional project directory for metrics logging (defaults to cwd)
25
+ * @returns Filtered array of context entries
26
+ */
27
+ export declare function filterByRole(entries: ContextEntry[], targetRole: string, directory?: string): ContextEntry[];
@@ -0,0 +1,17 @@
1
+ export type FileZone = 'production' | 'test' | 'config' | 'generated' | 'docs' | 'build';
2
+ export interface ZoneClassification {
3
+ filePath: string;
4
+ zone: FileZone;
5
+ confidence: 'high' | 'medium';
6
+ reason: string;
7
+ }
8
+ export interface ZonePolicy {
9
+ qaDepth: 'full' | 'standard' | 'light' | 'skip';
10
+ lintRequired: boolean;
11
+ testRequired: boolean;
12
+ reviewRequired: boolean;
13
+ securityReviewRequired: boolean;
14
+ }
15
+ export declare function classifyFile(filePath: string): ZoneClassification;
16
+ export declare function classifyFiles(filePaths: string[]): ZoneClassification[];
17
+ export declare function getZonePolicy(zone: FileZone): ZonePolicy;
@@ -0,0 +1,20 @@
1
+ export interface ASTChange {
2
+ type: 'added' | 'modified' | 'removed';
3
+ category: 'function' | 'class' | 'type' | 'export' | 'import' | 'variable' | 'other';
4
+ name: string;
5
+ lineStart: number;
6
+ lineEnd: number;
7
+ signature?: string;
8
+ }
9
+ export interface ASTDiffResult {
10
+ filePath: string;
11
+ language: string | null;
12
+ changes: ASTChange[];
13
+ durationMs: number;
14
+ usedAST: boolean;
15
+ error?: string;
16
+ }
17
+ /**
18
+ * Compute AST-level diff between old and new file content
19
+ */
20
+ export declare function computeASTDiff(filePath: string, oldContent: string, newContent: string): Promise<ASTDiffResult>;
@@ -0,0 +1,50 @@
1
+ /**
2
+ * Check if we're in a git repository
3
+ */
4
+ export declare function isGitRepo(cwd: string): boolean;
5
+ /**
6
+ * Get current branch name
7
+ */
8
+ export declare function getCurrentBranch(cwd: string): string;
9
+ /**
10
+ * Create a new branch
11
+ * @param cwd - Working directory
12
+ * @param branchName - Name of the branch to create
13
+ * @param remote - Remote name (default: 'origin')
14
+ */
15
+ export declare function createBranch(cwd: string, branchName: string, remote?: string): void;
16
+ /**
17
+ * Get list of changed files compared to main/master
18
+ * @param cwd - Working directory
19
+ * @param branch - Base branch to compare against (optional, auto-detected if not provided)
20
+ * @returns Array of changed file paths, or empty array if error occurs
21
+ */
22
+ export declare function getChangedFiles(cwd: string, branch?: string): string[];
23
+ /**
24
+ * Get default base branch (main or master)
25
+ */
26
+ export declare function getDefaultBaseBranch(cwd: string): string;
27
+ /**
28
+ * Stage specific files for commit
29
+ * @param cwd - Working directory
30
+ * @param files - Array of file paths to stage (must not be empty)
31
+ * @throws Error if files array is empty
32
+ */
33
+ export declare function stageFiles(cwd: string, files: string[]): void;
34
+ /**
35
+ * Stage all files in the working directory
36
+ * @param cwd - Working directory
37
+ */
38
+ export declare function stageAll(cwd: string): void;
39
+ /**
40
+ * Commit changes
41
+ */
42
+ export declare function commitChanges(cwd: string, message: string): void;
43
+ /**
44
+ * Get current commit SHA
45
+ */
46
+ export declare function getCurrentSha(cwd: string): string;
47
+ /**
48
+ * Check if there are uncommitted changes
49
+ */
50
+ export declare function hasUncommittedChanges(cwd: string): boolean;
@@ -0,0 +1,22 @@
1
+ import { createBranch, isGitRepo } from './branch.js';
2
+ import { isAuthenticated, isGhAvailable } from './pr.js';
3
+ export interface PRWorkflowOptions {
4
+ title: string;
5
+ body?: string;
6
+ branch?: string;
7
+ }
8
+ export interface PRWorkflowResult {
9
+ success: boolean;
10
+ url?: string;
11
+ number?: number;
12
+ error?: string;
13
+ }
14
+ /**
15
+ * Full PR workflow: create branch → commit → push → create PR
16
+ */
17
+ export declare function runPRWorkflow(cwd: string, options: PRWorkflowOptions): Promise<PRWorkflowResult>;
18
+ /**
19
+ * Generate evidence summary without creating PR
20
+ */
21
+ export declare function prepareEvidence(cwd: string): string;
22
+ export { isGhAvailable, isAuthenticated, isGitRepo, createBranch };
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Sanitize input string to prevent command injection
3
+ * Removes or escapes shell metacharacters
4
+ */
5
+ export declare function sanitizeInput(input: string): string;
6
+ /**
7
+ * Check if gh CLI is available
8
+ */
9
+ export declare function isGhAvailable(cwd: string): boolean;
10
+ /**
11
+ * Check if authenticated with gh
12
+ */
13
+ export declare function isAuthenticated(cwd: string): boolean;
14
+ /**
15
+ * Create evidence.md summary
16
+ */
17
+ export declare function generateEvidenceMd(cwd: string): string;
18
+ /**
19
+ * Create a pull request
20
+ */
21
+ export declare function createPullRequest(cwd: string, title: string, body?: string, baseBranch?: string): Promise<{
22
+ url: string;
23
+ number: number;
24
+ }>;
25
+ /**
26
+ * Commit and push current changes
27
+ */
28
+ export declare function commitAndPush(cwd: string, message: string): void;
@@ -5,6 +5,13 @@
5
5
  * Uses experimental.chat.messages.transform to provide non-blocking guidance.
6
6
  */
7
7
  import type { PluginConfig } from '../config';
8
+ import type { DelegationEnvelope } from '../types/delegation.js';
9
+ /**
10
+ * Parses a string to extract a DelegationEnvelope.
11
+ * Returns null if no valid envelope is found.
12
+ * Never throws - all errors are caught and result in null.
13
+ */
14
+ export declare function parseDelegationEnvelope(content: string): DelegationEnvelope | null;
8
15
  interface MessageInfo {
9
16
  role: string;
10
17
  agent?: string;
@@ -1,5 +1,6 @@
1
1
  /** Core storage layer for the opencode-swarm v6.17 two-tier knowledge system. */
2
2
  import type { RejectedLesson } from './knowledge-types.js';
3
+ export declare function getPlatformConfigDir(): string;
3
4
  export declare function resolveSwarmKnowledgePath(directory: string): string;
4
5
  export declare function resolveSwarmRejectedPath(directory: string): string;
5
6
  export declare function resolveHiveKnowledgePath(): string;
@@ -0,0 +1,25 @@
1
+ /** Project Identity Management for opencode-swarm.
2
+ * Handles creation and retrieval of project identity files.
3
+ */
4
+ export interface ProjectIdentity {
5
+ projectHash: string;
6
+ projectName: string;
7
+ repoUrl?: string;
8
+ absolutePath: string;
9
+ createdAt: string;
10
+ swarmVersion: string;
11
+ }
12
+ /**
13
+ * Get identity file path for a project hash.
14
+ * Path: {platform-config-dir}/projects/{projectHash}/identity.json
15
+ */
16
+ export declare function resolveIdentityPath(projectHash: string): string;
17
+ /**
18
+ * Read existing identity.json or return null if it doesn't exist.
19
+ */
20
+ export declare function readProjectIdentity(projectHash: string): Promise<ProjectIdentity | null>;
21
+ /**
22
+ * Create or update identity.json for a project.
23
+ * Uses atomic write pattern (write to temp file, then rename).
24
+ */
25
+ export declare function writeProjectIdentity(directory: string, projectHash: string, projectName: string): Promise<ProjectIdentity>;
@@ -0,0 +1,2 @@
1
+ /** Knowledge system exports for opencode-swarm. */
2
+ export * from './identity.js';
@@ -0,0 +1,27 @@
1
+ export type AgentType = 'architect' | 'coder' | 'reviewer' | 'test_engineer' | 'explorer' | 'sme' | 'critic' | 'docs' | 'designer';
2
+ export type OutputType = 'review' | 'test' | 'research' | 'analysis' | 'summary';
3
+ export interface AgentOutputMetadata {
4
+ agent: AgentType;
5
+ type: OutputType;
6
+ taskId: string;
7
+ phase: number;
8
+ timestamp: string;
9
+ durationMs?: number;
10
+ success?: boolean;
11
+ }
12
+ /**
13
+ * Write agent output to persistent storage
14
+ * Output: .swarm/outputs/phase-N/task-N.M/{agent}-{type}-{timestamp}.md
15
+ */
16
+ export declare function writeAgentOutput(directory: string, metadata: AgentOutputMetadata, content: string): Promise<string>;
17
+ /**
18
+ * Read agent output from persistent storage
19
+ */
20
+ export declare function readAgentOutput(directory: string, phase: number, taskId: string): Promise<{
21
+ metadata: AgentOutputMetadata;
22
+ content: string;
23
+ }[]>;
24
+ /**
25
+ * List all agent outputs for a phase
26
+ */
27
+ export declare function listAgentOutputs(directory: string, phase?: number): Promise<AgentOutputMetadata[]>;
@@ -0,0 +1 @@
1
+ export { type AgentOutputMetadata, type AgentType, listAgentOutputs, type OutputType, readAgentOutput, writeAgentOutput, } from './agent-writer';
@@ -0,0 +1,34 @@
1
+ export interface TaskNode {
2
+ id: string;
3
+ phase: number;
4
+ description: string;
5
+ depends: string[];
6
+ dependents: string[];
7
+ status: 'pending' | 'in_progress' | 'complete' | 'blocked';
8
+ }
9
+ export interface DependencyGraph {
10
+ tasks: Map<string, TaskNode>;
11
+ phases: Map<number, string[]>;
12
+ roots: string[];
13
+ leaves: string[];
14
+ }
15
+ /**
16
+ * Parse plan.json and build dependency graph
17
+ */
18
+ export declare function parseDependencyGraph(planPath: string): DependencyGraph;
19
+ /**
20
+ * Get tasks that can run in parallel (no unresolved dependencies)
21
+ */
22
+ export declare function getRunnableTasks(graph: DependencyGraph): string[];
23
+ /**
24
+ * Check if a task is blocked (has incomplete dependencies)
25
+ */
26
+ export declare function isTaskBlocked(graph: DependencyGraph, taskId: string): boolean;
27
+ /**
28
+ * Get execution order (topological sort)
29
+ */
30
+ export declare function getExecutionOrder(graph: DependencyGraph): string[];
31
+ /**
32
+ * Find all paths from root to a task
33
+ */
34
+ export declare function getDependencyChain(graph: DependencyGraph, taskId: string): string[];
@@ -0,0 +1,33 @@
1
+ export interface FileLock {
2
+ filePath: string;
3
+ agent: string;
4
+ taskId: string;
5
+ timestamp: string;
6
+ expiresAt: number;
7
+ }
8
+ /**
9
+ * Try to acquire a lock on a file
10
+ */
11
+ export declare function tryAcquireLock(directory: string, filePath: string, agent: string, taskId: string): {
12
+ acquired: true;
13
+ lock: FileLock;
14
+ } | {
15
+ acquired: false;
16
+ existing?: FileLock;
17
+ };
18
+ /**
19
+ * Release a lock on a file
20
+ */
21
+ export declare function releaseLock(directory: string, filePath: string, taskId: string): boolean;
22
+ /**
23
+ * Check if a file is locked
24
+ */
25
+ export declare function isLocked(directory: string, filePath: string): FileLock | null;
26
+ /**
27
+ * Clean up expired locks
28
+ */
29
+ export declare function cleanupExpiredLocks(directory: string): number;
30
+ /**
31
+ * List all active locks
32
+ */
33
+ export declare function listActiveLocks(directory: string): FileLock[];
@@ -0,0 +1,4 @@
1
+ export { type DependencyGraph, getDependencyChain, getExecutionOrder, getRunnableTasks, isTaskBlocked, parseDependencyGraph, type TaskNode, } from './dependency-graph.js';
2
+ export { cleanupExpiredLocks, type FileLock, isLocked, listActiveLocks, releaseLock, tryAcquireLock, } from './file-locks.js';
3
+ export { extractMetaSummaries, getLatestTaskSummary, indexMetaSummaries, type MetaSummaryEntry, querySummaries, } from './meta-indexer.js';
4
+ export { type ComplexityMetrics, computeComplexity, type ReviewDepth, type ReviewRouting, routeReview, routeReviewForChanges, shouldParallelizeReview, } from './review-router.js';
@@ -0,0 +1,32 @@
1
+ export interface MetaSummaryEntry {
2
+ timestamp: string;
3
+ phase?: number;
4
+ taskId?: string;
5
+ agent?: string;
6
+ summary: string;
7
+ source?: string;
8
+ }
9
+ /**
10
+ * Extract meta.summary from event JSONL files
11
+ */
12
+ export declare function extractMetaSummaries(eventsPath: string): MetaSummaryEntry[];
13
+ /**
14
+ * Index meta summaries to external knowledge store
15
+ */
16
+ export declare function indexMetaSummaries(directory: string, externalKnowledgeDir?: string): Promise<{
17
+ indexed: number;
18
+ path: string;
19
+ }>;
20
+ /**
21
+ * Query indexed summaries
22
+ */
23
+ export declare function querySummaries(directory: string, options?: {
24
+ phase?: number;
25
+ taskId?: string;
26
+ agent?: string;
27
+ since?: string;
28
+ }): MetaSummaryEntry[];
29
+ /**
30
+ * Get latest summary for a task
31
+ */
32
+ export declare function getLatestTaskSummary(directory: string, taskId: string): MetaSummaryEntry | undefined;
@@ -0,0 +1,29 @@
1
+ export type ReviewDepth = 'single' | 'double';
2
+ export interface ReviewRouting {
3
+ reviewerCount: number;
4
+ testEngineerCount: number;
5
+ depth: ReviewDepth;
6
+ reason: string;
7
+ }
8
+ export interface ComplexityMetrics {
9
+ fileCount: number;
10
+ functionCount: number;
11
+ astChangeCount: number;
12
+ maxFileComplexity: number;
13
+ }
14
+ /**
15
+ * Compute complexity metrics for a set of files
16
+ */
17
+ export declare function computeComplexity(directory: string, changedFiles: string[]): Promise<ComplexityMetrics>;
18
+ /**
19
+ * Determine review routing based on complexity
20
+ */
21
+ export declare function routeReview(metrics: ComplexityMetrics): ReviewRouting;
22
+ /**
23
+ * Route review with full analysis
24
+ */
25
+ export declare function routeReviewForChanges(directory: string, changedFiles: string[]): Promise<ReviewRouting>;
26
+ /**
27
+ * Check if review should be parallelized
28
+ */
29
+ export declare function shouldParallelizeReview(routing: ReviewRouting): boolean;
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Skill definition with versioning and per-agent overlays
3
+ */
4
+ export interface AgentOverlay {
5
+ agent: string;
6
+ prompt?: string;
7
+ model?: string;
8
+ }
9
+ export interface SkillDefinition {
10
+ id: string;
11
+ name: string;
12
+ description: string;
13
+ SKILL_VERSION: number;
14
+ basePrompt?: string;
15
+ agents?: AgentOverlay[];
16
+ }
17
+ export declare const skills: SkillDefinition[];
18
+ export declare const AGENT_OVERLAYS: Record<string, AgentOverlay[]>;
19
+ /**
20
+ * Get skill by ID
21
+ */
22
+ export declare function getSkill(id: string): SkillDefinition | undefined;
23
+ /**
24
+ * Get agent overlay for a skill
25
+ */
26
+ export declare function getAgentOverlay(skillId: string, agent: string): AgentOverlay | undefined;
27
+ /**
28
+ * Resolve effective prompt for an agent on a skill
29
+ */
30
+ export declare function resolveAgentPrompt(skillId: string, agent: string, defaultPrompt: string): string;
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Delegation Envelope Types
3
+ * Interface for passing delegated tasks between agents
4
+ */
5
+ export interface DelegationEnvelope {
6
+ taskId: string;
7
+ targetAgent: string;
8
+ action: string;
9
+ commandType: 'task' | 'slash_command';
10
+ files: string[];
11
+ acceptanceCriteria: string[];
12
+ technicalContext: string;
13
+ errorStrategy?: 'FAIL_FAST' | 'BEST_EFFORT';
14
+ platformNotes?: string;
15
+ }
16
+ /**
17
+ * Validation result types
18
+ */
19
+ export type EnvelopeValidationResult = {
20
+ valid: true;
21
+ } | {
22
+ valid: false;
23
+ reason: string;
24
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-swarm",
3
- "version": "6.19.8",
3
+ "version": "6.20.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",