opencode-swarm 6.19.7 → 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.
- package/README.md +113 -0
- package/dist/cli/index.js +707 -3377
- package/dist/commands/checkpoint.d.ts +5 -0
- package/dist/commands/handoff.d.ts +1 -0
- package/dist/commands/index.d.ts +1 -0
- package/dist/context/role-filter.d.ts +27 -0
- package/dist/context/zone-classifier.d.ts +17 -0
- package/dist/diff/ast-diff.d.ts +20 -0
- package/dist/git/branch.d.ts +50 -0
- package/dist/git/index.d.ts +22 -0
- package/dist/git/pr.d.ts +28 -0
- package/dist/hooks/delegation-gate.d.ts +7 -0
- package/dist/hooks/knowledge-store.d.ts +1 -0
- package/dist/index.js +1068 -348
- package/dist/knowledge/identity.d.ts +25 -0
- package/dist/knowledge/index.d.ts +2 -0
- package/dist/output/agent-writer.d.ts +27 -0
- package/dist/output/index.d.ts +1 -0
- package/dist/parallel/dependency-graph.d.ts +34 -0
- package/dist/parallel/file-locks.d.ts +33 -0
- package/dist/parallel/index.d.ts +4 -0
- package/dist/parallel/meta-indexer.d.ts +32 -0
- package/dist/parallel/review-router.d.ts +29 -0
- package/dist/services/context-budget-service.d.ts +101 -0
- package/dist/services/handoff-service.d.ts +61 -0
- package/dist/services/index.d.ts +2 -0
- package/dist/services/run-memory.d.ts +66 -0
- package/dist/skills/index.d.ts +30 -0
- package/dist/types/delegation.d.ts +24 -0
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function handleHandoffCommand(directory: string, _args: string[]): Promise<string>;
|
package/dist/commands/index.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ export { handleDiagnoseCommand } from './diagnose';
|
|
|
10
10
|
export { handleDoctorCommand } from './doctor';
|
|
11
11
|
export { handleEvidenceCommand, handleEvidenceSummaryCommand, } from './evidence';
|
|
12
12
|
export { handleExportCommand } from './export';
|
|
13
|
+
export { handleHandoffCommand } from './handoff';
|
|
13
14
|
export { handleHistoryCommand } from './history';
|
|
14
15
|
export { handleKnowledgeListCommand, handleKnowledgeMigrateCommand, handleKnowledgeQuarantineCommand, handleKnowledgeRestoreCommand, } from './knowledge';
|
|
15
16
|
export { handlePlanCommand } from './plan';
|
|
@@ -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 };
|
package/dist/git/pr.d.ts
ADDED
|
@@ -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;
|