opencode-swarm 7.18.3 → 7.19.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 +22 -35
- package/dist/cli/index.js +546 -452
- package/dist/commands/command-dispatch.d.ts +33 -0
- package/dist/commands/council.d.ts +1 -1
- package/dist/commands/doctor.d.ts +2 -7
- package/dist/commands/index.d.ts +11 -2
- package/dist/commands/registry.d.ts +0 -1
- package/dist/commands/tool-policy.d.ts +6 -0
- package/dist/evidence/lock.d.ts +1 -1
- package/dist/gate-evidence.d.ts +2 -2
- package/dist/index.js +2375 -2792
- package/dist/services/config-doctor.d.ts +2 -15
- package/dist/services/evidence-service.d.ts +8 -0
- package/dist/services/plan-service.d.ts +16 -0
- package/dist/state/agent-run-context.d.ts +4 -4
- package/dist/state.d.ts +13 -8
- package/dist/tools/index.d.ts +1 -0
- package/dist/tools/swarm-command.d.ts +3 -0
- package/dist/tools/tool-names.d.ts +1 -1
- package/dist/tools/update-task-status.d.ts +1 -1
- package/dist/tools/write-final-council-evidence.d.ts +0 -12
- package/package.json +1 -1
- package/dist/parallel/runtime-config.d.ts +0 -11
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { AgentDefinition } from '../agents/index.js';
|
|
2
|
+
import { type CommandEntry, resolveCommand } from './registry.js';
|
|
3
|
+
export type ResolvedSwarmCommand = NonNullable<ReturnType<typeof resolveCommand>>;
|
|
4
|
+
export type SwarmCommandPolicyResult = {
|
|
5
|
+
allowed: true;
|
|
6
|
+
} | {
|
|
7
|
+
allowed: false;
|
|
8
|
+
message: string;
|
|
9
|
+
};
|
|
10
|
+
export type SwarmCommandPolicy = (resolved: ResolvedSwarmCommand) => SwarmCommandPolicyResult;
|
|
11
|
+
export type SwarmCommandExecutionResult = {
|
|
12
|
+
text: string;
|
|
13
|
+
resolved?: ResolvedSwarmCommand;
|
|
14
|
+
canonicalKey?: string;
|
|
15
|
+
};
|
|
16
|
+
export declare function normalizeSwarmCommandInput(command: string, argumentText: string): {
|
|
17
|
+
isSwarmCommand: boolean;
|
|
18
|
+
tokens: string[];
|
|
19
|
+
};
|
|
20
|
+
export declare function canonicalCommandKey(resolved: ResolvedSwarmCommand): string;
|
|
21
|
+
export declare function formatCommandNotFound(tokens: string[]): string;
|
|
22
|
+
export declare function maybeMarkFirstRun(directory: string): boolean;
|
|
23
|
+
export declare function prependWelcome(text: string): string;
|
|
24
|
+
export declare function executeSwarmCommand(args: {
|
|
25
|
+
directory: string;
|
|
26
|
+
agents: Record<string, AgentDefinition>;
|
|
27
|
+
sessionID: string;
|
|
28
|
+
tokens: string[];
|
|
29
|
+
includeWelcome?: boolean;
|
|
30
|
+
buildHelpText?: () => string;
|
|
31
|
+
policy?: SwarmCommandPolicy;
|
|
32
|
+
}): Promise<SwarmCommandExecutionResult>;
|
|
33
|
+
export type { CommandEntry };
|
|
@@ -14,4 +14,4 @@
|
|
|
14
14
|
* Sanitizes the question to prevent prompt injection of rival MODE: headers
|
|
15
15
|
* or control sequences (mirrors brainstorm.ts).
|
|
16
16
|
*/
|
|
17
|
-
export declare function handleCouncilCommand(
|
|
17
|
+
export declare function handleCouncilCommand(_directory: string, args: string[]): Promise<string>;
|
|
@@ -1,20 +1,15 @@
|
|
|
1
|
-
import { type ConfigDoctorResult
|
|
1
|
+
import { type ConfigDoctorResult } from '../services/config-doctor';
|
|
2
2
|
/**
|
|
3
3
|
* Format tool doctor result as markdown for command output.
|
|
4
4
|
*
|
|
5
5
|
* Exported for unit testing of the BLOCKING footer enforcement path.
|
|
6
6
|
*/
|
|
7
7
|
export declare function formatToolDoctorMarkdown(result: ConfigDoctorResult): string;
|
|
8
|
-
export declare function loadModelAvailability(directory: string, client: unknown, options?: {
|
|
9
|
-
timeoutMs?: number;
|
|
10
|
-
}): Promise<ModelAvailability | undefined>;
|
|
11
8
|
/**
|
|
12
9
|
* Handle /swarm config doctor command.
|
|
13
10
|
* Maps to: config doctor service (runConfigDoctor)
|
|
14
11
|
*/
|
|
15
|
-
export declare function handleDoctorCommand(directory: string, args: string[]
|
|
16
|
-
client?: unknown;
|
|
17
|
-
}): Promise<string>;
|
|
12
|
+
export declare function handleDoctorCommand(directory: string, args: string[]): Promise<string>;
|
|
18
13
|
/**
|
|
19
14
|
* Handle /swarm doctor tools command.
|
|
20
15
|
* Maps to: tool doctor service (runToolDoctor)
|
package/dist/commands/index.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ export { handleBrainstormCommand } from './brainstorm';
|
|
|
8
8
|
export { handleCheckpointCommand } from './checkpoint';
|
|
9
9
|
export { handleClarifyCommand } from './clarify';
|
|
10
10
|
export { handleCloseCommand } from './close';
|
|
11
|
+
export { executeSwarmCommand, formatCommandNotFound, normalizeSwarmCommandInput, } from './command-dispatch.js';
|
|
11
12
|
export type { CommandName } from './command-names.js';
|
|
12
13
|
export { COMMAND_NAME_SET, COMMAND_NAMES } from './command-names.js';
|
|
13
14
|
export { handleConfigCommand } from './config';
|
|
@@ -38,18 +39,26 @@ export { handleSimulateCommand } from './simulate';
|
|
|
38
39
|
export { handleSpecifyCommand } from './specify';
|
|
39
40
|
export { handleStatusCommand } from './status';
|
|
40
41
|
export { handleSyncPlanCommand } from './sync-plan';
|
|
42
|
+
export { classifySwarmCommandChatFallbackUse, classifySwarmCommandToolUse, SWARM_COMMAND_TOOL_ALLOWLIST, SWARM_COMMAND_TOOL_COMMANDS, } from './tool-policy.js';
|
|
41
43
|
export { handleTurboCommand } from './turbo';
|
|
42
44
|
export { handleWriteRetroCommand } from './write-retro';
|
|
43
|
-
export declare const LLM_MEDIATION_WARNING: string;
|
|
44
45
|
export declare function buildHelpText(): string;
|
|
45
46
|
/**
|
|
46
47
|
* Creates a command.execute.before handler for /swarm commands.
|
|
47
48
|
* Uses factory pattern to close over directory and agents.
|
|
48
49
|
*/
|
|
49
|
-
export declare function createSwarmCommandHandler(directory: string, agents: Record<string, AgentDefinition>,
|
|
50
|
+
export declare function createSwarmCommandHandler(directory: string, agents: Record<string, AgentDefinition>, options?: {
|
|
51
|
+
getActiveAgentName?: (sessionID: string) => string | undefined;
|
|
52
|
+
registeredAgents?: Record<string, {
|
|
53
|
+
tools?: Record<string, boolean>;
|
|
54
|
+
}>;
|
|
55
|
+
}): (input: {
|
|
50
56
|
command: string;
|
|
51
57
|
sessionID: string;
|
|
52
58
|
arguments: string;
|
|
53
59
|
}, output: {
|
|
54
60
|
parts: unknown[];
|
|
55
61
|
}) => Promise<void>;
|
|
62
|
+
export declare function agentHasSwarmCommandTool(activeAgentName: string | undefined, agents: Record<string, AgentDefinition>, registeredAgents?: Record<string, {
|
|
63
|
+
tools?: Record<string, boolean>;
|
|
64
|
+
}>): boolean;
|
|
@@ -8,7 +8,6 @@ export type CommandContext = {
|
|
|
8
8
|
args: string[];
|
|
9
9
|
sessionID: string;
|
|
10
10
|
agents: Record<string, AgentDefinition>;
|
|
11
|
-
client?: unknown;
|
|
12
11
|
};
|
|
13
12
|
export type CommandResult = Promise<string>;
|
|
14
13
|
export type CommandCategory = 'core' | 'agent' | 'config' | 'diagnostics' | 'utility';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { ResolvedSwarmCommand, SwarmCommandPolicyResult } from './command-dispatch.js';
|
|
2
|
+
export declare const SWARM_COMMAND_TOOL_COMMANDS: readonly ["agents", "config", "config doctor", "config-doctor", "doctor", "doctor tools", "status", "show-plan", "plan", "help", "history", "evidence", "evidence summary", "evidence-summary", "retrieve", "diagnose", "preflight", "benchmark", "knowledge", "sync-plan", "export", "list-agents"];
|
|
3
|
+
export type SwarmCommandToolInputCommand = (typeof SWARM_COMMAND_TOOL_COMMANDS)[number];
|
|
4
|
+
export declare const SWARM_COMMAND_TOOL_ALLOWLIST: Set<string>;
|
|
5
|
+
export declare function classifySwarmCommandToolUse(resolved: ResolvedSwarmCommand): SwarmCommandPolicyResult;
|
|
6
|
+
export declare function classifySwarmCommandChatFallbackUse(resolved: ResolvedSwarmCommand): SwarmCommandPolicyResult;
|
package/dist/evidence/lock.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Evidence write-lock helper
|
|
2
|
+
* Evidence write-lock helper (PR 1 — dark foundation).
|
|
3
3
|
*
|
|
4
4
|
* Wraps every evidence read-modify-write path with a proper-lockfile-backed
|
|
5
5
|
* exclusive lock so that concurrent writers cannot interleave their
|
package/dist/gate-evidence.d.ts
CHANGED
|
@@ -44,13 +44,13 @@ export declare function expandRequiredGates(existingGates: string[], newAgentTyp
|
|
|
44
44
|
* If file exists: merges gate entry, expands required_gates via expandRequiredGates.
|
|
45
45
|
* Atomic write: temp file + rename.
|
|
46
46
|
*/
|
|
47
|
-
export declare function recordGateEvidence(directory: string, taskId: string, gate: string, sessionId: string, turbo?: boolean
|
|
47
|
+
export declare function recordGateEvidence(directory: string, taskId: string, gate: string, sessionId: string, turbo?: boolean): Promise<void>;
|
|
48
48
|
/**
|
|
49
49
|
* Sets or expands required_gates WITHOUT recording a gate pass.
|
|
50
50
|
* Used when non-gate agents are dispatched (coder, explorer, sme, etc.).
|
|
51
51
|
* Creates evidence file if it doesn't exist yet.
|
|
52
52
|
*/
|
|
53
|
-
export declare function recordAgentDispatch(directory: string, taskId: string, agentType: string, turbo?: boolean
|
|
53
|
+
export declare function recordAgentDispatch(directory: string, taskId: string, agentType: string, turbo?: boolean): Promise<void>;
|
|
54
54
|
/**
|
|
55
55
|
* Returns the TaskEvidence for a task, or null if file missing or parse error.
|
|
56
56
|
* Never throws.
|