opencode-swarm 5.0.8 → 5.0.9
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/index.js +14 -7
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -13617,7 +13617,7 @@ var EvidenceConfigSchema = exports_external.object({
|
|
|
13617
13617
|
auto_archive: exports_external.boolean().default(false)
|
|
13618
13618
|
});
|
|
13619
13619
|
var GuardrailsProfileSchema = exports_external.object({
|
|
13620
|
-
max_tool_calls: exports_external.number().min(
|
|
13620
|
+
max_tool_calls: exports_external.number().min(0).max(1000).optional(),
|
|
13621
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(),
|
|
@@ -13626,7 +13626,7 @@ var GuardrailsProfileSchema = exports_external.object({
|
|
|
13626
13626
|
});
|
|
13627
13627
|
var DEFAULT_AGENT_PROFILES = {
|
|
13628
13628
|
architect: {
|
|
13629
|
-
max_tool_calls:
|
|
13629
|
+
max_tool_calls: 0,
|
|
13630
13630
|
max_duration_minutes: 0,
|
|
13631
13631
|
max_consecutive_errors: 8,
|
|
13632
13632
|
warning_threshold: 0.75
|
|
@@ -13665,7 +13665,7 @@ var DEFAULT_AGENT_PROFILES = {
|
|
|
13665
13665
|
var DEFAULT_ARCHITECT_PROFILE = DEFAULT_AGENT_PROFILES.architect;
|
|
13666
13666
|
var GuardrailsConfigSchema = exports_external.object({
|
|
13667
13667
|
enabled: exports_external.boolean().default(true),
|
|
13668
|
-
max_tool_calls: exports_external.number().min(
|
|
13668
|
+
max_tool_calls: exports_external.number().min(0).max(1000).default(200),
|
|
13669
13669
|
max_duration_minutes: exports_external.number().min(0).max(480).default(30),
|
|
13670
13670
|
max_repetitions: exports_external.number().min(3).max(50).default(10),
|
|
13671
13671
|
max_consecutive_errors: exports_external.number().min(2).max(20).default(5),
|
|
@@ -16022,9 +16022,16 @@ function ensureAgentSession(sessionId, agentName) {
|
|
|
16022
16022
|
const now = Date.now();
|
|
16023
16023
|
let session = swarmState.agentSessions.get(sessionId);
|
|
16024
16024
|
if (session) {
|
|
16025
|
-
if (agentName && session.agentName
|
|
16025
|
+
if (agentName && agentName !== session.agentName) {
|
|
16026
16026
|
session.agentName = agentName;
|
|
16027
16027
|
session.startTime = now;
|
|
16028
|
+
session.toolCallCount = 0;
|
|
16029
|
+
session.consecutiveErrors = 0;
|
|
16030
|
+
session.recentToolCalls = [];
|
|
16031
|
+
session.warningIssued = false;
|
|
16032
|
+
session.warningReason = "";
|
|
16033
|
+
session.hardLimitHit = false;
|
|
16034
|
+
session.lastSuccessTime = now;
|
|
16028
16035
|
}
|
|
16029
16036
|
session.lastToolCallTime = now;
|
|
16030
16037
|
return session;
|
|
@@ -16320,7 +16327,7 @@ function createGuardrailsHooks(config2) {
|
|
|
16320
16327
|
}
|
|
16321
16328
|
}
|
|
16322
16329
|
const elapsedMinutes = (Date.now() - session.startTime) / 60000;
|
|
16323
|
-
if (session.toolCallCount >= agentConfig.max_tool_calls) {
|
|
16330
|
+
if (agentConfig.max_tool_calls > 0 && session.toolCallCount >= agentConfig.max_tool_calls) {
|
|
16324
16331
|
session.hardLimitHit = true;
|
|
16325
16332
|
warn("Circuit breaker: tool call limit hit", {
|
|
16326
16333
|
sessionID: input.sessionID,
|
|
@@ -16360,12 +16367,12 @@ function createGuardrailsHooks(config2) {
|
|
|
16360
16367
|
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
16368
|
}
|
|
16362
16369
|
if (!session.warningIssued) {
|
|
16363
|
-
const toolPct = session.toolCallCount / agentConfig.max_tool_calls;
|
|
16370
|
+
const toolPct = agentConfig.max_tool_calls > 0 ? session.toolCallCount / agentConfig.max_tool_calls : 0;
|
|
16364
16371
|
const durationPct = agentConfig.max_duration_minutes > 0 ? elapsedMinutes / agentConfig.max_duration_minutes : 0;
|
|
16365
16372
|
const repPct = repetitionCount / agentConfig.max_repetitions;
|
|
16366
16373
|
const errorPct = session.consecutiveErrors / agentConfig.max_consecutive_errors;
|
|
16367
16374
|
const reasons = [];
|
|
16368
|
-
if (toolPct >= agentConfig.warning_threshold) {
|
|
16375
|
+
if (agentConfig.max_tool_calls > 0 && toolPct >= agentConfig.warning_threshold) {
|
|
16369
16376
|
reasons.push(`tool calls ${session.toolCallCount}/${agentConfig.max_tool_calls}`);
|
|
16370
16377
|
}
|
|
16371
16378
|
if (durationPct >= agentConfig.warning_threshold) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencode-swarm",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.9",
|
|
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",
|