opencode-swarm 5.0.6 → 5.0.8
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/dist/config/schema.d.ts +6 -0
- package/dist/index.js +22 -7
- package/dist/state.d.ts +2 -0
- package/package.json +3 -2
- package/dist/agents/auditor.d.ts +0 -2
- package/dist/agents/security-reviewer.d.ts +0 -2
- package/dist/agents/sme/active-directory.d.ts +0 -2
- package/dist/agents/sme/ai.d.ts +0 -2
- package/dist/agents/sme/api.d.ts +0 -2
- package/dist/agents/sme/azure.d.ts +0 -2
- package/dist/agents/sme/base.d.ts +0 -13
- package/dist/agents/sme/database.d.ts +0 -2
- package/dist/agents/sme/devops.d.ts +0 -2
- package/dist/agents/sme/index.d.ts +0 -20
- package/dist/agents/sme/linux.d.ts +0 -2
- package/dist/agents/sme/network.d.ts +0 -2
- package/dist/agents/sme/oracle.d.ts +0 -2
- package/dist/agents/sme/powershell.d.ts +0 -2
- package/dist/agents/sme/python.d.ts +0 -2
- package/dist/agents/sme/security.d.ts +0 -2
- package/dist/agents/sme/ui-ux.d.ts +0 -2
- package/dist/agents/sme/vmware.d.ts +0 -2
- package/dist/agents/sme/web.d.ts +0 -2
- package/dist/agents/sme/windows.d.ts +0 -2
- package/dist/agents/sme-unified.d.ts +0 -3
package/dist/config/schema.d.ts
CHANGED
|
@@ -43,6 +43,7 @@ export declare const GuardrailsProfileSchema: z.ZodObject<{
|
|
|
43
43
|
max_repetitions: z.ZodOptional<z.ZodNumber>;
|
|
44
44
|
max_consecutive_errors: z.ZodOptional<z.ZodNumber>;
|
|
45
45
|
warning_threshold: z.ZodOptional<z.ZodNumber>;
|
|
46
|
+
idle_timeout_minutes: z.ZodOptional<z.ZodNumber>;
|
|
46
47
|
}, z.core.$strip>;
|
|
47
48
|
export type GuardrailsProfile = z.infer<typeof GuardrailsProfileSchema>;
|
|
48
49
|
export declare const DEFAULT_AGENT_PROFILES: Record<string, GuardrailsProfile>;
|
|
@@ -53,6 +54,7 @@ export declare const DEFAULT_ARCHITECT_PROFILE: {
|
|
|
53
54
|
max_repetitions?: number | undefined;
|
|
54
55
|
max_consecutive_errors?: number | undefined;
|
|
55
56
|
warning_threshold?: number | undefined;
|
|
57
|
+
idle_timeout_minutes?: number | undefined;
|
|
56
58
|
};
|
|
57
59
|
export declare const GuardrailsConfigSchema: z.ZodObject<{
|
|
58
60
|
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
@@ -61,12 +63,14 @@ export declare const GuardrailsConfigSchema: z.ZodObject<{
|
|
|
61
63
|
max_repetitions: z.ZodDefault<z.ZodNumber>;
|
|
62
64
|
max_consecutive_errors: z.ZodDefault<z.ZodNumber>;
|
|
63
65
|
warning_threshold: z.ZodDefault<z.ZodNumber>;
|
|
66
|
+
idle_timeout_minutes: z.ZodDefault<z.ZodNumber>;
|
|
64
67
|
profiles: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
65
68
|
max_tool_calls: z.ZodOptional<z.ZodNumber>;
|
|
66
69
|
max_duration_minutes: z.ZodOptional<z.ZodNumber>;
|
|
67
70
|
max_repetitions: z.ZodOptional<z.ZodNumber>;
|
|
68
71
|
max_consecutive_errors: z.ZodOptional<z.ZodNumber>;
|
|
69
72
|
warning_threshold: z.ZodOptional<z.ZodNumber>;
|
|
73
|
+
idle_timeout_minutes: z.ZodOptional<z.ZodNumber>;
|
|
70
74
|
}, z.core.$strip>>>;
|
|
71
75
|
}, z.core.$strip>;
|
|
72
76
|
export type GuardrailsConfig = z.infer<typeof GuardrailsConfigSchema>;
|
|
@@ -130,12 +134,14 @@ export declare const PluginConfigSchema: z.ZodObject<{
|
|
|
130
134
|
max_repetitions: z.ZodDefault<z.ZodNumber>;
|
|
131
135
|
max_consecutive_errors: z.ZodDefault<z.ZodNumber>;
|
|
132
136
|
warning_threshold: z.ZodDefault<z.ZodNumber>;
|
|
137
|
+
idle_timeout_minutes: z.ZodDefault<z.ZodNumber>;
|
|
133
138
|
profiles: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
134
139
|
max_tool_calls: z.ZodOptional<z.ZodNumber>;
|
|
135
140
|
max_duration_minutes: z.ZodOptional<z.ZodNumber>;
|
|
136
141
|
max_repetitions: z.ZodOptional<z.ZodNumber>;
|
|
137
142
|
max_consecutive_errors: z.ZodOptional<z.ZodNumber>;
|
|
138
143
|
warning_threshold: z.ZodOptional<z.ZodNumber>;
|
|
144
|
+
idle_timeout_minutes: z.ZodOptional<z.ZodNumber>;
|
|
139
145
|
}, z.core.$strip>>>;
|
|
140
146
|
}, z.core.$strip>>;
|
|
141
147
|
evidence: z.ZodOptional<z.ZodObject<{
|
package/dist/index.js
CHANGED
|
@@ -13618,15 +13618,16 @@ var EvidenceConfigSchema = exports_external.object({
|
|
|
13618
13618
|
});
|
|
13619
13619
|
var GuardrailsProfileSchema = exports_external.object({
|
|
13620
13620
|
max_tool_calls: exports_external.number().min(10).max(1000).optional(),
|
|
13621
|
-
max_duration_minutes: exports_external.number().min(
|
|
13621
|
+
max_duration_minutes: exports_external.number().min(0).max(480).optional(),
|
|
13622
13622
|
max_repetitions: exports_external.number().min(3).max(50).optional(),
|
|
13623
13623
|
max_consecutive_errors: exports_external.number().min(2).max(20).optional(),
|
|
13624
|
-
warning_threshold: exports_external.number().min(0.1).max(0.9).optional()
|
|
13624
|
+
warning_threshold: exports_external.number().min(0.1).max(0.9).optional(),
|
|
13625
|
+
idle_timeout_minutes: exports_external.number().min(5).max(240).optional()
|
|
13625
13626
|
});
|
|
13626
13627
|
var DEFAULT_AGENT_PROFILES = {
|
|
13627
13628
|
architect: {
|
|
13628
13629
|
max_tool_calls: 800,
|
|
13629
|
-
max_duration_minutes:
|
|
13630
|
+
max_duration_minutes: 0,
|
|
13630
13631
|
max_consecutive_errors: 8,
|
|
13631
13632
|
warning_threshold: 0.75
|
|
13632
13633
|
},
|
|
@@ -13665,10 +13666,11 @@ var DEFAULT_ARCHITECT_PROFILE = DEFAULT_AGENT_PROFILES.architect;
|
|
|
13665
13666
|
var GuardrailsConfigSchema = exports_external.object({
|
|
13666
13667
|
enabled: exports_external.boolean().default(true),
|
|
13667
13668
|
max_tool_calls: exports_external.number().min(10).max(1000).default(200),
|
|
13668
|
-
max_duration_minutes: exports_external.number().min(
|
|
13669
|
+
max_duration_minutes: exports_external.number().min(0).max(480).default(30),
|
|
13669
13670
|
max_repetitions: exports_external.number().min(3).max(50).default(10),
|
|
13670
13671
|
max_consecutive_errors: exports_external.number().min(2).max(20).default(5),
|
|
13671
13672
|
warning_threshold: exports_external.number().min(0.1).max(0.9).default(0.75),
|
|
13673
|
+
idle_timeout_minutes: exports_external.number().min(5).max(240).default(60),
|
|
13672
13674
|
profiles: exports_external.record(exports_external.string(), GuardrailsProfileSchema).optional()
|
|
13673
13675
|
});
|
|
13674
13676
|
function stripKnownSwarmPrefix(name) {
|
|
@@ -16008,7 +16010,8 @@ function startAgentSession(sessionId, agentName, staleDurationMs = 7200000) {
|
|
|
16008
16010
|
recentToolCalls: [],
|
|
16009
16011
|
warningIssued: false,
|
|
16010
16012
|
warningReason: "",
|
|
16011
|
-
hardLimitHit: false
|
|
16013
|
+
hardLimitHit: false,
|
|
16014
|
+
lastSuccessTime: now
|
|
16012
16015
|
};
|
|
16013
16016
|
swarmState.agentSessions.set(sessionId, sessionState);
|
|
16014
16017
|
}
|
|
@@ -16327,7 +16330,7 @@ function createGuardrailsHooks(config2) {
|
|
|
16327
16330
|
});
|
|
16328
16331
|
throw new Error(`\uD83D\uDED1 LIMIT REACHED: Tool calls exhausted (${session.toolCallCount}/${agentConfig.max_tool_calls}). Finish the current operation and return your progress summary.`);
|
|
16329
16332
|
}
|
|
16330
|
-
if (elapsedMinutes >= agentConfig.max_duration_minutes) {
|
|
16333
|
+
if (agentConfig.max_duration_minutes > 0 && elapsedMinutes >= agentConfig.max_duration_minutes) {
|
|
16331
16334
|
session.hardLimitHit = true;
|
|
16332
16335
|
warn("Circuit breaker: duration limit hit", {
|
|
16333
16336
|
sessionID: input.sessionID,
|
|
@@ -16345,9 +16348,20 @@ function createGuardrailsHooks(config2) {
|
|
|
16345
16348
|
session.hardLimitHit = true;
|
|
16346
16349
|
throw new Error(`\uD83D\uDED1 LIMIT REACHED: ${session.consecutiveErrors} consecutive tool errors detected. Return your progress summary with details of what went wrong.`);
|
|
16347
16350
|
}
|
|
16351
|
+
const idleMinutes = (Date.now() - session.lastSuccessTime) / 60000;
|
|
16352
|
+
if (idleMinutes >= agentConfig.idle_timeout_minutes) {
|
|
16353
|
+
session.hardLimitHit = true;
|
|
16354
|
+
warn("Circuit breaker: idle timeout hit", {
|
|
16355
|
+
sessionID: input.sessionID,
|
|
16356
|
+
agentName: session.agentName,
|
|
16357
|
+
idleTimeoutMinutes: agentConfig.idle_timeout_minutes,
|
|
16358
|
+
idleMinutes: Math.floor(idleMinutes)
|
|
16359
|
+
});
|
|
16360
|
+
throw new Error(`\uD83D\uDED1 LIMIT REACHED: No successful tool call for ${Math.floor(idleMinutes)} minutes (idle timeout: ${agentConfig.idle_timeout_minutes} min). This suggests the agent may be stuck. Return your progress summary.`);
|
|
16361
|
+
}
|
|
16348
16362
|
if (!session.warningIssued) {
|
|
16349
16363
|
const toolPct = session.toolCallCount / agentConfig.max_tool_calls;
|
|
16350
|
-
const durationPct = elapsedMinutes / agentConfig.max_duration_minutes;
|
|
16364
|
+
const durationPct = agentConfig.max_duration_minutes > 0 ? elapsedMinutes / agentConfig.max_duration_minutes : 0;
|
|
16351
16365
|
const repPct = repetitionCount / agentConfig.max_repetitions;
|
|
16352
16366
|
const errorPct = session.consecutiveErrors / agentConfig.max_consecutive_errors;
|
|
16353
16367
|
const reasons = [];
|
|
@@ -16379,6 +16393,7 @@ function createGuardrailsHooks(config2) {
|
|
|
16379
16393
|
session.consecutiveErrors++;
|
|
16380
16394
|
} else {
|
|
16381
16395
|
session.consecutiveErrors = 0;
|
|
16396
|
+
session.lastSuccessTime = Date.now();
|
|
16382
16397
|
}
|
|
16383
16398
|
},
|
|
16384
16399
|
messagesTransform: async (_input, output) => {
|
package/dist/state.d.ts
CHANGED
|
@@ -59,6 +59,8 @@ export interface AgentSessionState {
|
|
|
59
59
|
warningReason: string;
|
|
60
60
|
/** Whether a hard limit has been triggered */
|
|
61
61
|
hardLimitHit: boolean;
|
|
62
|
+
/** Timestamp of most recent SUCCESSFUL tool call (for idle timeout) */
|
|
63
|
+
lastSuccessTime: number;
|
|
62
64
|
}
|
|
63
65
|
/**
|
|
64
66
|
* Singleton state object for sharing data across hooks
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencode-swarm",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.8",
|
|
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",
|
|
@@ -25,7 +25,8 @@
|
|
|
25
25
|
"LICENSE"
|
|
26
26
|
],
|
|
27
27
|
"scripts": {
|
|
28
|
-
"
|
|
28
|
+
"clean": "rm -rf dist",
|
|
29
|
+
"build": "rm -rf dist && bun build src/index.ts --outdir dist --target bun --format esm && bun build src/cli/index.ts --outdir dist/cli --target bun --format esm && tsc --emitDeclarationOnly",
|
|
29
30
|
"typecheck": "tsc --noEmit",
|
|
30
31
|
"test": "bun test",
|
|
31
32
|
"lint": "biome lint .",
|
package/dist/agents/auditor.d.ts
DELETED
package/dist/agents/sme/ai.d.ts
DELETED
package/dist/agents/sme/api.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { AgentDefinition } from '../architect';
|
|
2
|
-
/**
|
|
3
|
-
* SME domain configuration
|
|
4
|
-
*/
|
|
5
|
-
export interface SMEDomainConfig {
|
|
6
|
-
domain: string;
|
|
7
|
-
description: string;
|
|
8
|
-
guidance: string;
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* Create an SME agent definition
|
|
12
|
-
*/
|
|
13
|
-
export declare function createSMEAgent(agentName: string, domainConfig: SMEDomainConfig, model: string, customPrompt?: string, customAppendPrompt?: string): AgentDefinition;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import type { AgentDefinition } from '../architect';
|
|
2
|
-
import { type SMEDomainConfig } from './base';
|
|
3
|
-
export declare const SME_CONFIGS: Record<string, SMEDomainConfig>;
|
|
4
|
-
export declare const AGENT_TO_DOMAIN: Record<string, string>;
|
|
5
|
-
/**
|
|
6
|
-
* Create all SME agent definitions
|
|
7
|
-
*/
|
|
8
|
-
export declare function createAllSMEAgents(getModel: (agentName: string) => string, loadPrompt: (agentName: string) => {
|
|
9
|
-
prompt?: string;
|
|
10
|
-
appendPrompt?: string;
|
|
11
|
-
}): AgentDefinition[];
|
|
12
|
-
/**
|
|
13
|
-
* Get list of available SME domains
|
|
14
|
-
*/
|
|
15
|
-
export declare function listDomains(): string[];
|
|
16
|
-
/**
|
|
17
|
-
* Get SME agent name for a domain
|
|
18
|
-
*/
|
|
19
|
-
export declare function domainToAgent(domain: string): string | undefined;
|
|
20
|
-
export { createSMEAgent, type SMEDomainConfig } from './base';
|
package/dist/agents/sme/web.d.ts
DELETED