@wrongstack/core 0.66.13 → 0.73.1
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/{agent-bridge-D-j6OOBT.d.ts → agent-bridge-C0Ze7Ldm.d.ts} +1 -1
- package/dist/{agent-subagent-runner-DRZ9-NnR.d.ts → agent-subagent-runner-BmITbs1Q.d.ts} +13 -5
- package/dist/{config--86aHSln.d.ts → config-Dy0CK_o6.d.ts} +44 -1
- package/dist/coordination/index.d.ts +10 -10
- package/dist/coordination/index.js +188 -210
- package/dist/coordination/index.js.map +1 -1
- package/dist/defaults/index.d.ts +15 -15
- package/dist/defaults/index.js +121 -118
- package/dist/defaults/index.js.map +1 -1
- package/dist/{events-CIplI98R.d.ts → events-BBAlxBuw.d.ts} +8 -0
- package/dist/execution/index.d.ts +8 -8
- package/dist/execution/index.js +69 -99
- package/dist/execution/index.js.map +1 -1
- package/dist/extension/index.d.ts +5 -5
- package/dist/{index-DKUvyTvV.d.ts → index-BN6i2Nfg.d.ts} +4 -4
- package/dist/{index-b5uhfTSl.d.ts → index-yQbZ2NQx.d.ts} +6 -6
- package/dist/index.d.ts +29 -27
- package/dist/index.js +222 -129
- package/dist/index.js.map +1 -1
- package/dist/infrastructure/index.d.ts +4 -4
- package/dist/kernel/index.d.ts +7 -7
- package/dist/kernel/index.js.map +1 -1
- package/dist/{mcp-servers-DwoNBf6r.d.ts → mcp-servers-T0O6UN_w.d.ts} +1 -1
- package/dist/{mode-CV077NjV.d.ts → mode-BO4SEUIv.d.ts} +7 -0
- package/dist/models/index.d.ts +1 -1
- package/dist/models/index.js +18 -9
- package/dist/models/index.js.map +1 -1
- package/dist/{multi-agent-coordinator-CWnH-CiX.d.ts → multi-agent-coordinator-BSBbZt0e.d.ts} +1 -1
- package/dist/{null-fleet-bus-VApKRxcp.d.ts → null-fleet-bus-BCIRT_nV.d.ts} +37 -33
- package/dist/observability/index.d.ts +1 -1
- package/dist/{parallel-eternal-engine-0UwotoSx.d.ts → parallel-eternal-engine-CjAYGaCw.d.ts} +3 -3
- package/dist/{path-resolver-DVkEcIw8.d.ts → path-resolver-BnqXa9Ze.d.ts} +1 -1
- package/dist/{permission-C1A5whY5.d.ts → permission-V5BLOrY6.d.ts} +0 -4
- package/dist/{permission-policy-B2dK-T5N.d.ts → permission-policy-CBVx-d-8.d.ts} +1 -5
- package/dist/{plan-templates-Bprrzhbu.d.ts → plan-templates-DBgrTGPu.d.ts} +2 -2
- package/dist/{provider-runner-mXvXGSIw.d.ts → provider-runner-n3KkHT_w.d.ts} +1 -1
- package/dist/sdd/index.d.ts +6 -6
- package/dist/sdd/index.js +68 -98
- package/dist/sdd/index.js.map +1 -1
- package/dist/security/index.d.ts +2 -2
- package/dist/security/index.js +0 -8
- package/dist/security/index.js.map +1 -1
- package/dist/skills/index.js +1 -0
- package/dist/skills/index.js.map +1 -1
- package/dist/storage/index.d.ts +3 -3
- package/dist/storage/index.js +26 -2
- package/dist/storage/index.js.map +1 -1
- package/dist/{system-prompt-b61lOd49.d.ts → system-prompt-CA11g6Jo.d.ts} +1 -1
- package/dist/types/index.d.ts +13 -13
- package/dist/types/index.js +19 -10
- package/dist/types/index.js.map +1 -1
- package/dist/utils/index.d.ts +1 -1
- package/dist/utils/index.js +2 -1
- package/dist/utils/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { f as BridgeTransport, B as BridgeMessage, a as AgentBridge, b as AgentBridgeConfig } from './agent-subagent-runner-
|
|
1
|
+
import { f as BridgeTransport, B as BridgeMessage, a as AgentBridge, b as AgentBridgeConfig } from './agent-subagent-runner-BmITbs1Q.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* In-memory pub/sub transport for agent-to-agent messaging.
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { t as ToolRegistry, m as ProviderRegistry, f as AgentPipelines, q as ToolExecutorLike, E as ExtensionRegistry, d as AgentInit, e as AgentInput, R as RunResult, p as ToolCallPipelinePayload, u as ToolWrapper, S as SystemPromptContributor } from './index-
|
|
2
|
-
import { C as Container, e as Renderer, R as ReadonlyPipeline } from './system-prompt-
|
|
3
|
-
import { E as EventBus, k as EventName, L as Listener } from './events-
|
|
1
|
+
import { t as ToolRegistry, m as ProviderRegistry, f as AgentPipelines, q as ToolExecutorLike, E as ExtensionRegistry, d as AgentInit, e as AgentInput, R as RunResult, p as ToolCallPipelinePayload, u as ToolWrapper, S as SystemPromptContributor } from './index-BN6i2Nfg.js';
|
|
2
|
+
import { C as Container, e as Renderer, R as ReadonlyPipeline } from './system-prompt-CA11g6Jo.js';
|
|
3
|
+
import { E as EventBus, k as EventName, L as Listener } from './events-BBAlxBuw.js';
|
|
4
4
|
import { a as RetryPolicy, E as ErrorHandler } from './retry-policy-CG3qvH_e.js';
|
|
5
5
|
import { a as Logger } from './logger-DDd5C--Z.js';
|
|
6
6
|
import { T as Tracer } from './observability-BhnVLBLS.js';
|
|
7
|
-
import { a as PermissionPolicy } from './permission-
|
|
7
|
+
import { a as PermissionPolicy } from './permission-V5BLOrY6.js';
|
|
8
8
|
import { d as Context, Q as Tool, u as RunOptions, J as JSONSchema, p as Request, q as Response, c as ContentBlock, T as TextBlock, m as Provider, $ as Usage } from './context-y87Jc5ei.js';
|
|
9
|
-
import { l as HookEvent, n as HookMatcher, I as InProcessHook, a as Config } from './config
|
|
9
|
+
import { l as HookEvent, n as HookMatcher, I as InProcessHook, a as Config } from './config-Dy0CK_o6.js';
|
|
10
10
|
import { W as WireFamily } from './models-registry-BcYJDKLm.js';
|
|
11
11
|
|
|
12
12
|
declare class Agent {
|
|
@@ -623,6 +623,14 @@ interface SubagentConfig {
|
|
|
623
623
|
* read tools, never write" or "respond in JSON only".
|
|
624
624
|
*/
|
|
625
625
|
systemPromptOverride?: string;
|
|
626
|
+
/**
|
|
627
|
+
* Domain-specific knowledge injected into the subagent's system prompt
|
|
628
|
+
* between the shared scratchpad and the override. Typically populated
|
|
629
|
+
* from SKILL.md body content matching the subagent's role (e.g. the
|
|
630
|
+
* bug-hunter skill body for a bug-hunter subagent). Keeps subagents
|
|
631
|
+
* informed of same domain patterns the host agent knows.
|
|
632
|
+
*/
|
|
633
|
+
skillContent?: string;
|
|
626
634
|
/**
|
|
627
635
|
* Routing for streaming output. `'director'` (default) forwards
|
|
628
636
|
* text/tool events to the parent's FleetBus so the director can read
|
|
@@ -279,6 +279,38 @@ interface AutonomyConfig {
|
|
|
279
279
|
/** ms to wait before auto-proceeding in 'auto' mode. Default: 45000. */
|
|
280
280
|
autoProceedDelayMs?: number;
|
|
281
281
|
}
|
|
282
|
+
/**
|
|
283
|
+
* Automatic codebase symbol-index maintenance. Keeps the `codebase-search`
|
|
284
|
+
* index (SQLite, `~/.wrongstack/projects/<hash>/codebase-index/index.db`) fresh
|
|
285
|
+
* without the user having to call `codebase-index` by hand.
|
|
286
|
+
*/
|
|
287
|
+
interface IndexingConfig {
|
|
288
|
+
/** Run a blocking incremental index at session start (with a visible summary). Default: true. */
|
|
289
|
+
onSessionStart: boolean;
|
|
290
|
+
/** Reindex files the agent writes/edits via tools, in the background. Default: true. */
|
|
291
|
+
onEdit: boolean;
|
|
292
|
+
/** Watch the project root for external editor changes and reindex them. Default: true. */
|
|
293
|
+
watchExternal: boolean;
|
|
294
|
+
/** Debounce window (ms) coalescing rapid edits to the same file. Default: 400. */
|
|
295
|
+
debounceMs: number;
|
|
296
|
+
}
|
|
297
|
+
/**
|
|
298
|
+
* Saved launch preferences — restored on next boot so the pre-launch prompt
|
|
299
|
+
* can offer a one-line "Continue with last settings? [Y/n]" instead of
|
|
300
|
+
* re-asking every question from scratch.
|
|
301
|
+
*/
|
|
302
|
+
interface LaunchConfig {
|
|
303
|
+
/** Interactive mode: 'tui' (Ink TUI) or 'repl' (readline REPL). */
|
|
304
|
+
mode?: 'tui' | 'repl';
|
|
305
|
+
/** Start with Director mode on (fleet manifest + multi-agent orchestration). */
|
|
306
|
+
director?: boolean;
|
|
307
|
+
/**
|
|
308
|
+
* Launch-time autonomy mode (binary choice from pre-launch prompt).
|
|
309
|
+
* 'off' = stops after each turn; 'auto' = self-driving.
|
|
310
|
+
* Distinct from `AutonomyConfig.defaultMode` which also supports 'suggest'.
|
|
311
|
+
*/
|
|
312
|
+
autonomy?: 'off' | 'auto';
|
|
313
|
+
}
|
|
282
314
|
/**
|
|
283
315
|
* Controls how much detail is persisted to the per-session JSONL log
|
|
284
316
|
* (`~/.wrongstack/projects/<hash>/sessions/<id>.jsonl`).
|
|
@@ -343,6 +375,13 @@ interface Config {
|
|
|
343
375
|
model: string;
|
|
344
376
|
apiKey?: string;
|
|
345
377
|
baseUrl?: string;
|
|
378
|
+
/**
|
|
379
|
+
* Maximum number of subagent tasks the fleet coordinator dispatches
|
|
380
|
+
* simultaneously. Extra tasks queue until a slot frees. Default: 4.
|
|
381
|
+
* Overridden by WRONGSTACK_MAX_CONCURRENT env var and --max-concurrent
|
|
382
|
+
* CLI flag. Change at runtime with /fleet concurrency <n>.
|
|
383
|
+
*/
|
|
384
|
+
maxConcurrent?: number;
|
|
346
385
|
providers?: Record<string, ProviderConfig>;
|
|
347
386
|
/**
|
|
348
387
|
* Top-level custom models (maps modelId → definition). Merged with
|
|
@@ -385,6 +424,10 @@ interface Config {
|
|
|
385
424
|
cwd?: string;
|
|
386
425
|
/** Autonomy mode configuration (auto-proceed delay, etc.). */
|
|
387
426
|
autonomy?: AutonomyConfig;
|
|
427
|
+
/** Automatic codebase symbol-index maintenance (session-start + live updates). */
|
|
428
|
+
indexing?: IndexingConfig;
|
|
429
|
+
/** Saved launch preferences — restored on next boot for one-line confirmation. */
|
|
430
|
+
launch?: LaunchConfig;
|
|
388
431
|
/**
|
|
389
432
|
* Session logging & audit configuration.
|
|
390
433
|
* Controls what gets written to the persistent JSONL transcript.
|
|
@@ -451,4 +494,4 @@ interface ConfigStore {
|
|
|
451
494
|
watch(cb: (next: Readonly<Config>, prev: Readonly<Config>) => void): () => void;
|
|
452
495
|
}
|
|
453
496
|
|
|
454
|
-
export { type AutonomyConfig as A, CONTEXT_WINDOW_MODES as C, DEFAULT_CONTEXT_WINDOW_MODE_ID as D, type FeaturesConfig as F, type HookEntry as H, type InProcessHook as I, type
|
|
497
|
+
export { type AutonomyConfig as A, listContextWindowModes as B, CONTEXT_WINDOW_MODES as C, DEFAULT_CONTEXT_WINDOW_MODE_ID as D, resolveContextWindowPolicy as E, type FeaturesConfig as F, type HookEntry as H, type InProcessHook as I, type LaunchConfig as L, type MCPServerConfig as M, type PluginConfig as P, type SessionLoggingConfig as S, type ToolsConfig as T, type Config as a, type ConfigLoader as b, type ConfigStore as c, type ContextConfig as d, type ContextWindowAggressiveOn as e, type ContextWindowConfigLike as f, type ContextWindowMode as g, type ContextWindowModeId as h, type ContextWindowPolicy as i, type ContextWindowThresholds as j, type CustomModelDefinition as k, type HookEvent as l, type HookInput as m, type HookMatcher as n, type HookOutcome as o, type IndexingConfig as p, type LogConfig as q, type ModelMatrixEntry as r, type ProviderApiKey as s, type ProviderConfig as t, type ShellHook as u, type SyncCategory as v, type SyncConfig as w, formatContextWindowModeList as x, getContextWindowMode as y, isContextWindowModeId as z };
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
export { B as BrainArbiter, a as BrainDecision, b as BrainDecisionOption, c as BrainDecisionQueue, d as BrainDecisionRequest, e as BrainDecisionSource, f as BrainFallback, g as BrainRisk, D as DefaultBrainArbiter, h as DefaultBrainArbiterOptions, H as HumanEscalatingBrainArbiter, O as ObservableBrainArbiter, l as formatHumanPrompt } from '../events-
|
|
2
|
-
export { A as ACP_AGENTS, a as AGENTS_BY_PHASE, b as AGENT_CATALOG, c as ALL_AGENT_DEFINITIONS, d as ALL_FLEET_AGENTS, e as AUDIT_LOG_AGENT, f as AutoExtendCeiling, g as AutoExtendPolicy, B as BUG_HUNTER_AGENT, h as BugFinding, C as CollabBudgetConfig, i as CollabBudgetOverrides, j as CollabBudgetWarningPayload, k as CollabDebugReport, l as CollabSession, m as CollabSessionOptions, n as CreateDelegateToolOptions, o as CriticConcern, p as CriticEvaluation, D as DEFAULT_DIRECTOR_PREAMBLE, q as DEFAULT_SUBAGENT_BASELINE, r as DelegateHost, s as Director, t as DirectorAlert, u as DirectorAlertLevel, v as DirectorCancelCollabPayload, w as DirectorPromptParts, x as DirectorSessionFactory, y as DirectorSessionFactoryOptions, F as FLEET_ROSTER, z as FLEET_ROSTER_BUDGETS, E as FLEET_ROSTER_WITHACP, G as FleetCostCapError, H as FleetManager, I as FleetManagerOptions, J as FleetRosterBudget, K as FleetSpawnBudgetError, L as ICoordinator, M as IFleetManager, N as LargeAnswerStore, O as NULL_FLEET_BUS, R as REFACTOR_PLANNER_AGENT, P as RefactorPhase, Q as RefactorPlan, S as SECURITY_SCANNER_AGENT, T as SharedFileEntry, U as SharedFileSnapshot, V as SubagentPromptParts, W as applyRosterBudget, X as attachAutoExtend, Y as composeDirectorPrompt, Z as composeSubagentPrompt, _ as createDelegateTool, $ as getAgentDefinition, a0 as makeAskResultTool, a1 as makeAskTool, a2 as makeAssignTool, a3 as makeAwaitTasksTool, a4 as makeCollabDebugTool, a5 as makeDirectorSessionFactory, a6 as makeFleetEmitTool, a7 as makeFleetHealthTool, a8 as makeFleetSessionTool, a9 as makeFleetStatusTool, aa as makeFleetUsageTool, ab as makeRollUpTool, ac as makeSpawnTool, ad as makeTerminateTool, ae as makeWorkCompleteTool, af as rosterSummaryFromConfigs } from '../null-fleet-bus-
|
|
3
|
-
import { b as AgentDefinition } from '../multi-agent-coordinator-
|
|
4
|
-
export { T as AGENT_TOOL_PRESETS, A as AgentBudgetTier, a as AgentCapability, c as AgentPhase, D as DEFAULT_DISPATCH_ROLE, d as DefaultMultiAgentCoordinator, e as DispatchCandidate, f as DispatchClassifier, g as DispatchMethod, h as DispatchOptions, i as DispatchResult, H as HEAVY_BUDGET, L as LIGHT_BUDGET, M as MEDIUM_BUDGET, j as MultiAgentCoordinatorOptions, k as dispatchAgent, m as makeLLMClassifier, s as scoreAgents } from '../multi-agent-coordinator-
|
|
5
|
-
export { c as AgentFactory, d as AgentFactoryResult, e as AgentRunnerOptions, g as BudgetExceededError, h as BudgetKind, i as BudgetLimits, j as BudgetNegotiationMode, k as BudgetThresholdDecision, l as BudgetThresholdHandler, m as BudgetThresholdSignal, n as BudgetUsage, F as FleetBus, p as FleetEvent, q as FleetHandler, r as FleetUsage, s as FleetUsageAggregator, K as SubagentBudget, V as SubagentUsageSnapshot, _ as makeAgentSubagentRunner } from '../agent-subagent-runner-
|
|
6
|
-
export { I as InMemoryAgentBridge, a as InMemoryBridgeTransport, c as createMessage } from '../agent-bridge-
|
|
1
|
+
export { B as BrainArbiter, a as BrainDecision, b as BrainDecisionOption, c as BrainDecisionQueue, d as BrainDecisionRequest, e as BrainDecisionSource, f as BrainFallback, g as BrainRisk, D as DefaultBrainArbiter, h as DefaultBrainArbiterOptions, H as HumanEscalatingBrainArbiter, O as ObservableBrainArbiter, l as formatHumanPrompt } from '../events-BBAlxBuw.js';
|
|
2
|
+
export { A as ACP_AGENTS, a as AGENTS_BY_PHASE, b as AGENT_CATALOG, c as ALL_AGENT_DEFINITIONS, d as ALL_FLEET_AGENTS, e as AUDIT_LOG_AGENT, f as AutoExtendCeiling, g as AutoExtendPolicy, B as BUG_HUNTER_AGENT, h as BugFinding, C as CollabBudgetConfig, i as CollabBudgetOverrides, j as CollabBudgetWarningPayload, k as CollabDebugReport, l as CollabSession, m as CollabSessionOptions, n as CreateDelegateToolOptions, o as CriticConcern, p as CriticEvaluation, D as DEFAULT_DIRECTOR_PREAMBLE, q as DEFAULT_SUBAGENT_BASELINE, r as DelegateHost, s as Director, t as DirectorAlert, u as DirectorAlertLevel, v as DirectorCancelCollabPayload, w as DirectorPromptParts, x as DirectorSessionFactory, y as DirectorSessionFactoryOptions, F as FLEET_ROSTER, z as FLEET_ROSTER_BUDGETS, E as FLEET_ROSTER_WITHACP, G as FleetCostCapError, H as FleetManager, I as FleetManagerOptions, J as FleetRosterBudget, K as FleetSpawnBudgetError, L as ICoordinator, M as IFleetManager, N as LargeAnswerStore, O as NULL_FLEET_BUS, R as REFACTOR_PLANNER_AGENT, P as RefactorPhase, Q as RefactorPlan, S as SECURITY_SCANNER_AGENT, T as SharedFileEntry, U as SharedFileSnapshot, V as SubagentPromptParts, W as applyRosterBudget, X as attachAutoExtend, Y as composeDirectorPrompt, Z as composeSubagentPrompt, _ as createDelegateTool, $ as getAgentDefinition, a0 as makeAskResultTool, a1 as makeAskTool, a2 as makeAssignTool, a3 as makeAwaitTasksTool, a4 as makeCollabDebugTool, a5 as makeDirectorSessionFactory, a6 as makeFleetEmitTool, a7 as makeFleetHealthTool, a8 as makeFleetSessionTool, a9 as makeFleetStatusTool, aa as makeFleetUsageTool, ab as makeRollUpTool, ac as makeSpawnTool, ad as makeTerminateTool, ae as makeWorkCompleteTool, af as rosterSummaryFromConfigs } from '../null-fleet-bus-BCIRT_nV.js';
|
|
3
|
+
import { b as AgentDefinition } from '../multi-agent-coordinator-BSBbZt0e.js';
|
|
4
|
+
export { T as AGENT_TOOL_PRESETS, A as AgentBudgetTier, a as AgentCapability, c as AgentPhase, D as DEFAULT_DISPATCH_ROLE, d as DefaultMultiAgentCoordinator, e as DispatchCandidate, f as DispatchClassifier, g as DispatchMethod, h as DispatchOptions, i as DispatchResult, H as HEAVY_BUDGET, L as LIGHT_BUDGET, M as MEDIUM_BUDGET, j as MultiAgentCoordinatorOptions, k as dispatchAgent, m as makeLLMClassifier, s as scoreAgents } from '../multi-agent-coordinator-BSBbZt0e.js';
|
|
5
|
+
export { c as AgentFactory, d as AgentFactoryResult, e as AgentRunnerOptions, g as BudgetExceededError, h as BudgetKind, i as BudgetLimits, j as BudgetNegotiationMode, k as BudgetThresholdDecision, l as BudgetThresholdHandler, m as BudgetThresholdSignal, n as BudgetUsage, F as FleetBus, p as FleetEvent, q as FleetHandler, r as FleetUsage, s as FleetUsageAggregator, K as SubagentBudget, V as SubagentUsageSnapshot, _ as makeAgentSubagentRunner } from '../agent-subagent-runner-BmITbs1Q.js';
|
|
6
|
+
export { I as InMemoryAgentBridge, a as InMemoryBridgeTransport, c as createMessage } from '../agent-bridge-C0Ze7Ldm.js';
|
|
7
7
|
import '../context-y87Jc5ei.js';
|
|
8
8
|
import 'node:events';
|
|
9
9
|
import '../director-state-BmYi3DGA.js';
|
|
10
|
-
import '../config
|
|
10
|
+
import '../config-Dy0CK_o6.js';
|
|
11
11
|
import '../models-registry-BcYJDKLm.js';
|
|
12
|
-
import '../index-
|
|
12
|
+
import '../index-BN6i2Nfg.js';
|
|
13
13
|
import '../logger-DDd5C--Z.js';
|
|
14
|
-
import '../system-prompt-
|
|
14
|
+
import '../system-prompt-CA11g6Jo.js';
|
|
15
15
|
import '../observability-BhnVLBLS.js';
|
|
16
16
|
import '../secret-scrubber-3MHDDAtm.js';
|
|
17
|
-
import '../permission-
|
|
17
|
+
import '../permission-V5BLOrY6.js';
|
|
18
18
|
import '../retry-policy-CG3qvH_e.js';
|
|
19
19
|
|
|
20
20
|
/** Phase 1 · Discovery — map the territory before any work begins. */
|
|
@@ -538,7 +538,8 @@ function isGlob(p) {
|
|
|
538
538
|
return false;
|
|
539
539
|
}
|
|
540
540
|
function globToRegex(pat) {
|
|
541
|
-
let i = 0
|
|
541
|
+
let i = 0;
|
|
542
|
+
let re = "^";
|
|
542
543
|
while (i < pat.length) {
|
|
543
544
|
const c = pat[i];
|
|
544
545
|
if (c === "*") {
|
|
@@ -1263,6 +1264,10 @@ A scratchpad shared with the rest of the fleet is mounted at \`${parts.sharedScr
|
|
|
1263
1264
|
- Use stable filenames (one file per concern); overwrite instead of appending so the Director sees the latest state.`
|
|
1264
1265
|
);
|
|
1265
1266
|
}
|
|
1267
|
+
if (parts.skills && parts.skills.trim().length > 0) {
|
|
1268
|
+
sections.push(`Domain knowledge:
|
|
1269
|
+
${parts.skills.trim()}`);
|
|
1270
|
+
}
|
|
1266
1271
|
if (parts.override && parts.override.trim().length > 0) {
|
|
1267
1272
|
sections.push(parts.override.trim());
|
|
1268
1273
|
}
|
|
@@ -4284,116 +4289,6 @@ function resolveModelMatrix(matrix, role) {
|
|
|
4284
4289
|
return void 0;
|
|
4285
4290
|
}
|
|
4286
4291
|
|
|
4287
|
-
// src/types/errors.ts
|
|
4288
|
-
var ERROR_CODES = {
|
|
4289
|
-
// Provider
|
|
4290
|
-
PROVIDER_RATE_LIMITED: "PROVIDER_RATE_LIMITED",
|
|
4291
|
-
PROVIDER_AUTH_FAILED: "PROVIDER_AUTH_FAILED",
|
|
4292
|
-
PROVIDER_OVERLOADED: "PROVIDER_OVERLOADED",
|
|
4293
|
-
PROVIDER_INVALID_REQUEST: "PROVIDER_INVALID_REQUEST",
|
|
4294
|
-
PROVIDER_SERVER_ERROR: "PROVIDER_SERVER_ERROR",
|
|
4295
|
-
PROVIDER_NETWORK_ERROR: "PROVIDER_NETWORK_ERROR"};
|
|
4296
|
-
var WrongStackError = class extends Error {
|
|
4297
|
-
code;
|
|
4298
|
-
subsystem;
|
|
4299
|
-
severity;
|
|
4300
|
-
recoverable;
|
|
4301
|
-
context;
|
|
4302
|
-
constructor(opts) {
|
|
4303
|
-
super(opts.message, { cause: opts.cause });
|
|
4304
|
-
this.name = "WrongStackError";
|
|
4305
|
-
this.code = opts.code;
|
|
4306
|
-
this.subsystem = opts.subsystem;
|
|
4307
|
-
this.severity = opts.severity ?? "error";
|
|
4308
|
-
this.recoverable = opts.recoverable ?? false;
|
|
4309
|
-
this.context = opts.context;
|
|
4310
|
-
}
|
|
4311
|
-
/**
|
|
4312
|
-
* Render a one-line user-facing description.
|
|
4313
|
-
* Subclasses should override for domain-specific formatting.
|
|
4314
|
-
*/
|
|
4315
|
-
describe() {
|
|
4316
|
-
const ctx = this.context ? ` ${formatContext(this.context)}` : "";
|
|
4317
|
-
return `${this.code}: ${this.message}${ctx}`;
|
|
4318
|
-
}
|
|
4319
|
-
};
|
|
4320
|
-
function formatContext(ctx) {
|
|
4321
|
-
const parts = Object.entries(ctx).filter(([, v]) => v !== void 0).slice(0, 3).map(([k, v]) => `${k}=${String(v)}`);
|
|
4322
|
-
return parts.length > 0 ? `[${parts.join(" ")}]` : "";
|
|
4323
|
-
}
|
|
4324
|
-
|
|
4325
|
-
// src/types/provider.ts
|
|
4326
|
-
var ProviderError = class extends WrongStackError {
|
|
4327
|
-
status;
|
|
4328
|
-
retryable;
|
|
4329
|
-
providerId;
|
|
4330
|
-
body;
|
|
4331
|
-
constructor(message, status, retryable, providerId, opts = {}) {
|
|
4332
|
-
super({
|
|
4333
|
-
message,
|
|
4334
|
-
code: providerStatusToCode(status, opts.body?.type),
|
|
4335
|
-
subsystem: "provider",
|
|
4336
|
-
severity: status >= 500 ? "error" : "warning",
|
|
4337
|
-
recoverable: retryable,
|
|
4338
|
-
context: { providerId, status },
|
|
4339
|
-
cause: opts.cause
|
|
4340
|
-
});
|
|
4341
|
-
this.name = "ProviderError";
|
|
4342
|
-
this.status = status;
|
|
4343
|
-
this.retryable = retryable;
|
|
4344
|
-
this.providerId = providerId;
|
|
4345
|
-
this.body = opts.body;
|
|
4346
|
-
}
|
|
4347
|
-
/**
|
|
4348
|
-
* Render a one-line, user-facing description. Designed for the CLI/TUI
|
|
4349
|
-
* status line and the agent's retry warning. Avoids dumping raw JSON
|
|
4350
|
-
* (which is what users see today when a 529 lands and the log message
|
|
4351
|
-
* includes the full `{"type":"error",...}` body).
|
|
4352
|
-
*
|
|
4353
|
-
* Examples:
|
|
4354
|
-
* "minimax-coding-plan overloaded (529): High traffic detected. Upgrade for highspeed model. [req 06534785201de9c0…]"
|
|
4355
|
-
* "openai rate limited (429): Retry after 12s"
|
|
4356
|
-
* "anthropic invalid request (400): messages.0.role must be one of 'user'|'assistant'"
|
|
4357
|
-
* "groq HTTP 500 (server error)"
|
|
4358
|
-
*/
|
|
4359
|
-
describe() {
|
|
4360
|
-
const kind = describeStatus(this.status, this.body?.type);
|
|
4361
|
-
const head = `${this.providerId} ${kind}`;
|
|
4362
|
-
const detail = this.body?.message?.trim();
|
|
4363
|
-
const reqId = this.body?.requestId ? ` [req ${this.body.requestId.slice(0, 16)}${this.body.requestId.length > 16 ? "\u2026" : ""}]` : "";
|
|
4364
|
-
if (detail && detail.length > 0) {
|
|
4365
|
-
return `${head}: ${truncate(detail, 240)}${reqId}`;
|
|
4366
|
-
}
|
|
4367
|
-
return `${head}${reqId}`;
|
|
4368
|
-
}
|
|
4369
|
-
};
|
|
4370
|
-
function describeStatus(status, type) {
|
|
4371
|
-
if (status === 0) return "network error";
|
|
4372
|
-
if (type === "overloaded_error" || status === 529) return `overloaded (${status})`;
|
|
4373
|
-
if (type === "rate_limit_error" || status === 429) return `rate limited (${status})`;
|
|
4374
|
-
if (type === "authentication_error" || status === 401) return `auth failed (${status})`;
|
|
4375
|
-
if (type === "permission_error" || status === 403) return `forbidden (${status})`;
|
|
4376
|
-
if (type === "not_found_error" || status === 404) return `not found (${status})`;
|
|
4377
|
-
if (type === "invalid_request_error" || status === 400) return `invalid request (${status})`;
|
|
4378
|
-
if (status === 408) return `timeout (${status})`;
|
|
4379
|
-
if (status >= 500 && status < 600) return `HTTP ${status} (server error)`;
|
|
4380
|
-
if (type) return `${type} (${status})`;
|
|
4381
|
-
return `HTTP ${status}`;
|
|
4382
|
-
}
|
|
4383
|
-
function truncate(s, n) {
|
|
4384
|
-
return s.length <= n ? s : `${s.slice(0, n - 1)}\u2026`;
|
|
4385
|
-
}
|
|
4386
|
-
function providerStatusToCode(status, type) {
|
|
4387
|
-
if (status === 0) return ERROR_CODES.PROVIDER_NETWORK_ERROR;
|
|
4388
|
-
if (type === "rate_limit_error" || status === 429) return ERROR_CODES.PROVIDER_RATE_LIMITED;
|
|
4389
|
-
if (type === "authentication_error" || status === 401) return ERROR_CODES.PROVIDER_AUTH_FAILED;
|
|
4390
|
-
if (type === "overloaded_error" || status === 529) return ERROR_CODES.PROVIDER_OVERLOADED;
|
|
4391
|
-
if (type === "invalid_request_error" || status === 400) return ERROR_CODES.PROVIDER_INVALID_REQUEST;
|
|
4392
|
-
if (status === 408) return ERROR_CODES.PROVIDER_NETWORK_ERROR;
|
|
4393
|
-
if (status >= 500) return ERROR_CODES.PROVIDER_SERVER_ERROR;
|
|
4394
|
-
return ERROR_CODES.PROVIDER_INVALID_REQUEST;
|
|
4395
|
-
}
|
|
4396
|
-
|
|
4397
4292
|
// src/coordination/subagent-budget.ts
|
|
4398
4293
|
var BudgetExceededError = class extends Error {
|
|
4399
4294
|
kind;
|
|
@@ -4733,6 +4628,181 @@ var SubagentBudget = class _SubagentBudget {
|
|
|
4733
4628
|
}
|
|
4734
4629
|
};
|
|
4735
4630
|
|
|
4631
|
+
// src/types/errors.ts
|
|
4632
|
+
var ERROR_CODES = {
|
|
4633
|
+
// Provider
|
|
4634
|
+
PROVIDER_RATE_LIMITED: "PROVIDER_RATE_LIMITED",
|
|
4635
|
+
PROVIDER_AUTH_FAILED: "PROVIDER_AUTH_FAILED",
|
|
4636
|
+
PROVIDER_OVERLOADED: "PROVIDER_OVERLOADED",
|
|
4637
|
+
PROVIDER_INVALID_REQUEST: "PROVIDER_INVALID_REQUEST",
|
|
4638
|
+
PROVIDER_SERVER_ERROR: "PROVIDER_SERVER_ERROR",
|
|
4639
|
+
PROVIDER_NETWORK_ERROR: "PROVIDER_NETWORK_ERROR"};
|
|
4640
|
+
var WrongStackError = class extends Error {
|
|
4641
|
+
code;
|
|
4642
|
+
subsystem;
|
|
4643
|
+
severity;
|
|
4644
|
+
recoverable;
|
|
4645
|
+
context;
|
|
4646
|
+
constructor(opts) {
|
|
4647
|
+
super(opts.message, { cause: opts.cause });
|
|
4648
|
+
this.name = "WrongStackError";
|
|
4649
|
+
this.code = opts.code;
|
|
4650
|
+
this.subsystem = opts.subsystem;
|
|
4651
|
+
this.severity = opts.severity ?? "error";
|
|
4652
|
+
this.recoverable = opts.recoverable ?? false;
|
|
4653
|
+
this.context = opts.context;
|
|
4654
|
+
}
|
|
4655
|
+
/**
|
|
4656
|
+
* Render a one-line user-facing description.
|
|
4657
|
+
* Subclasses should override for domain-specific formatting.
|
|
4658
|
+
*/
|
|
4659
|
+
describe() {
|
|
4660
|
+
const ctx = this.context ? ` ${formatContext(this.context)}` : "";
|
|
4661
|
+
return `${this.code}: ${this.message}${ctx}`;
|
|
4662
|
+
}
|
|
4663
|
+
};
|
|
4664
|
+
function formatContext(ctx) {
|
|
4665
|
+
const parts = Object.entries(ctx).filter(([, v]) => v !== void 0).slice(0, 3).map(([k, v]) => `${k}=${String(v)}`);
|
|
4666
|
+
return parts.length > 0 ? `[${parts.join(" ")}]` : "";
|
|
4667
|
+
}
|
|
4668
|
+
|
|
4669
|
+
// src/types/provider.ts
|
|
4670
|
+
var ProviderError = class extends WrongStackError {
|
|
4671
|
+
status;
|
|
4672
|
+
retryable;
|
|
4673
|
+
providerId;
|
|
4674
|
+
body;
|
|
4675
|
+
constructor(message, status, retryable, providerId, opts = {}) {
|
|
4676
|
+
super({
|
|
4677
|
+
message,
|
|
4678
|
+
code: providerStatusToCode(status, opts.body?.type),
|
|
4679
|
+
subsystem: "provider",
|
|
4680
|
+
severity: status >= 500 ? "error" : "warning",
|
|
4681
|
+
recoverable: retryable,
|
|
4682
|
+
context: { providerId, status },
|
|
4683
|
+
cause: opts.cause
|
|
4684
|
+
});
|
|
4685
|
+
this.name = "ProviderError";
|
|
4686
|
+
this.status = status;
|
|
4687
|
+
this.retryable = retryable;
|
|
4688
|
+
this.providerId = providerId;
|
|
4689
|
+
this.body = opts.body;
|
|
4690
|
+
}
|
|
4691
|
+
/**
|
|
4692
|
+
* Render a one-line, user-facing description. Designed for the CLI/TUI
|
|
4693
|
+
* status line and the agent's retry warning. Avoids dumping raw JSON
|
|
4694
|
+
* (which is what users see today when a 529 lands and the log message
|
|
4695
|
+
* includes the full `{"type":"error",...}` body).
|
|
4696
|
+
*
|
|
4697
|
+
* Examples:
|
|
4698
|
+
* "minimax-coding-plan overloaded (529): High traffic detected. Upgrade for highspeed model. [req 06534785201de9c0…]"
|
|
4699
|
+
* "openai rate limited (429): Retry after 12s"
|
|
4700
|
+
* "anthropic invalid request (400): messages.0.role must be one of 'user'|'assistant'"
|
|
4701
|
+
* "groq HTTP 500 (server error)"
|
|
4702
|
+
*/
|
|
4703
|
+
describe() {
|
|
4704
|
+
const kind = describeStatus(this.status, this.body?.type);
|
|
4705
|
+
const head = `${this.providerId} ${kind}`;
|
|
4706
|
+
const detail = this.body?.message?.trim();
|
|
4707
|
+
const reqId = this.body?.requestId ? ` [req ${this.body.requestId.slice(0, 16)}${this.body.requestId.length > 16 ? "\u2026" : ""}]` : "";
|
|
4708
|
+
if (detail && detail.length > 0) {
|
|
4709
|
+
return `${head}: ${truncate(detail, 240)}${reqId}`;
|
|
4710
|
+
}
|
|
4711
|
+
return `${head}${reqId}`;
|
|
4712
|
+
}
|
|
4713
|
+
};
|
|
4714
|
+
function describeStatus(status, type) {
|
|
4715
|
+
if (status === 0) return "network error";
|
|
4716
|
+
if (type === "overloaded_error" || status === 529) return `overloaded (${status})`;
|
|
4717
|
+
if (type === "rate_limit_error" || status === 429) return `rate limited (${status})`;
|
|
4718
|
+
if (type === "authentication_error" || status === 401) return `auth failed (${status})`;
|
|
4719
|
+
if (type === "permission_error" || status === 403) return `forbidden (${status})`;
|
|
4720
|
+
if (type === "not_found_error" || status === 404) return `not found (${status})`;
|
|
4721
|
+
if (type === "invalid_request_error" || status === 400) return `invalid request (${status})`;
|
|
4722
|
+
if (status === 408) return `timeout (${status})`;
|
|
4723
|
+
if (status >= 500 && status < 600) return `HTTP ${status} (server error)`;
|
|
4724
|
+
if (type) return `${type} (${status})`;
|
|
4725
|
+
return `HTTP ${status}`;
|
|
4726
|
+
}
|
|
4727
|
+
function truncate(s, n) {
|
|
4728
|
+
return s.length <= n ? s : `${s.slice(0, n - 1)}\u2026`;
|
|
4729
|
+
}
|
|
4730
|
+
function providerStatusToCode(status, type) {
|
|
4731
|
+
if (status === 0) return ERROR_CODES.PROVIDER_NETWORK_ERROR;
|
|
4732
|
+
if (type === "rate_limit_error" || status === 429) return ERROR_CODES.PROVIDER_RATE_LIMITED;
|
|
4733
|
+
if (type === "authentication_error" || status === 401) return ERROR_CODES.PROVIDER_AUTH_FAILED;
|
|
4734
|
+
if (type === "overloaded_error" || status === 529) return ERROR_CODES.PROVIDER_OVERLOADED;
|
|
4735
|
+
if (type === "invalid_request_error" || status === 400) return ERROR_CODES.PROVIDER_INVALID_REQUEST;
|
|
4736
|
+
if (status === 408) return ERROR_CODES.PROVIDER_NETWORK_ERROR;
|
|
4737
|
+
if (status >= 500) return ERROR_CODES.PROVIDER_SERVER_ERROR;
|
|
4738
|
+
return ERROR_CODES.PROVIDER_INVALID_REQUEST;
|
|
4739
|
+
}
|
|
4740
|
+
|
|
4741
|
+
// src/coordination/coordinator/error-classifier.ts
|
|
4742
|
+
function classifySubagentError(err, hints = {}) {
|
|
4743
|
+
const cause = err instanceof Error ? { name: err.name, message: err.message, stack: err.stack } : void 0;
|
|
4744
|
+
if (err instanceof ProviderError) {
|
|
4745
|
+
const baseMessage2 = err.describe();
|
|
4746
|
+
return providerErrorToSubagentError(err, baseMessage2, cause);
|
|
4747
|
+
}
|
|
4748
|
+
const baseMessage = err instanceof Error ? err.message : String(err);
|
|
4749
|
+
if (err instanceof BudgetExceededError) {
|
|
4750
|
+
const map = {
|
|
4751
|
+
iterations: "budget_iterations",
|
|
4752
|
+
tool_calls: "budget_tool_calls",
|
|
4753
|
+
tokens: "budget_tokens",
|
|
4754
|
+
cost: "budget_cost",
|
|
4755
|
+
timeout: "budget_timeout",
|
|
4756
|
+
idle_timeout: "budget_timeout"
|
|
4757
|
+
};
|
|
4758
|
+
return {
|
|
4759
|
+
kind: map[err.kind],
|
|
4760
|
+
message: baseMessage,
|
|
4761
|
+
retryable: false,
|
|
4762
|
+
cause
|
|
4763
|
+
};
|
|
4764
|
+
}
|
|
4765
|
+
if (hints.parentAborted) {
|
|
4766
|
+
return { kind: "aborted_by_parent", message: baseMessage, retryable: false, cause };
|
|
4767
|
+
}
|
|
4768
|
+
const lower = baseMessage.toLowerCase();
|
|
4769
|
+
if (/agent aborted$/i.test(baseMessage)) {
|
|
4770
|
+
return { kind: "aborted_by_parent", message: baseMessage, retryable: false, cause };
|
|
4771
|
+
}
|
|
4772
|
+
if (/agent exhausted iteration limit$/i.test(baseMessage)) {
|
|
4773
|
+
return { kind: "budget_iterations", message: baseMessage, retryable: false, cause };
|
|
4774
|
+
}
|
|
4775
|
+
if (/empty response$/i.test(baseMessage)) {
|
|
4776
|
+
return { kind: "empty_response", message: baseMessage, retryable: false, cause };
|
|
4777
|
+
}
|
|
4778
|
+
if (/^tool failed: /i.test(baseMessage)) {
|
|
4779
|
+
return { kind: "tool_failed", message: baseMessage, retryable: false, cause };
|
|
4780
|
+
}
|
|
4781
|
+
if (lower.includes("bridge transport") || /bridge.*(closed|disconnect)/i.test(baseMessage)) {
|
|
4782
|
+
return { kind: "bridge_failed", message: baseMessage, retryable: false, cause };
|
|
4783
|
+
}
|
|
4784
|
+
if (/context length|max.*tokens?.*exceeded|prompt is too long/i.test(baseMessage)) {
|
|
4785
|
+
return { kind: "context_overflow", message: baseMessage, retryable: false, cause };
|
|
4786
|
+
}
|
|
4787
|
+
return { kind: "unknown", message: baseMessage, retryable: false, cause };
|
|
4788
|
+
}
|
|
4789
|
+
function providerErrorToSubagentError(err, message, cause) {
|
|
4790
|
+
const status = err.status;
|
|
4791
|
+
if (status === 429 || err.body?.type === "rate_limit_error") {
|
|
4792
|
+
return { kind: "provider_rate_limit", message, retryable: true, backoffMs: 5e3, cause };
|
|
4793
|
+
}
|
|
4794
|
+
if (status === 401 || status === 403 || err.body?.type === "authentication_error") {
|
|
4795
|
+
return { kind: "provider_auth", message, retryable: false, cause };
|
|
4796
|
+
}
|
|
4797
|
+
if (status === 408 || status === 0) {
|
|
4798
|
+
return { kind: "provider_timeout", message, retryable: true, cause };
|
|
4799
|
+
}
|
|
4800
|
+
if (status >= 500 && status < 600) {
|
|
4801
|
+
return { kind: "provider_5xx", message, retryable: true, backoffMs: 3e3, cause };
|
|
4802
|
+
}
|
|
4803
|
+
return { kind: "unknown", message, retryable: err.retryable, cause };
|
|
4804
|
+
}
|
|
4805
|
+
|
|
4736
4806
|
// src/coordination/fleet.ts
|
|
4737
4807
|
var AUDIT_LOG_AGENT = {
|
|
4738
4808
|
id: "audit-log",
|
|
@@ -5243,7 +5313,7 @@ var DefaultMultiAgentCoordinator = class _DefaultMultiAgentCoordinator extends E
|
|
|
5243
5313
|
}
|
|
5244
5314
|
async spawn(subagent) {
|
|
5245
5315
|
const id = subagent.id || randomUUID();
|
|
5246
|
-
|
|
5316
|
+
const cfg = this.withNickname(subagent, id);
|
|
5247
5317
|
if (this.subagents.has(id)) {
|
|
5248
5318
|
throw new Error(`Subagent id "${id}" already exists \u2014 refusing to overwrite`);
|
|
5249
5319
|
}
|
|
@@ -5258,12 +5328,12 @@ var DefaultMultiAgentCoordinator = class _DefaultMultiAgentCoordinator extends E
|
|
|
5258
5328
|
maxConcurrent: this.config.maxConcurrent ?? 16
|
|
5259
5329
|
};
|
|
5260
5330
|
this.subagents.set(id, {
|
|
5261
|
-
config: { ...
|
|
5331
|
+
config: { ...cfg, id },
|
|
5262
5332
|
context,
|
|
5263
5333
|
status: "idle",
|
|
5264
5334
|
abortController: new AbortController()
|
|
5265
5335
|
});
|
|
5266
|
-
this.emit("subagent.started", { subagent: { ...
|
|
5336
|
+
this.emit("subagent.started", { subagent: { ...cfg, id } });
|
|
5267
5337
|
this.fleetBus?.emit({
|
|
5268
5338
|
subagentId: id,
|
|
5269
5339
|
ts: Date.now(),
|
|
@@ -5800,103 +5870,8 @@ var DefaultMultiAgentCoordinator = class _DefaultMultiAgentCoordinator extends E
|
|
|
5800
5870
|
return false;
|
|
5801
5871
|
}
|
|
5802
5872
|
};
|
|
5803
|
-
function classifySubagentError(err, hints = {}) {
|
|
5804
|
-
const cause = err instanceof Error ? { name: err.name, message: err.message, stack: err.stack } : void 0;
|
|
5805
|
-
if (err instanceof ProviderError) {
|
|
5806
|
-
const baseMessage2 = err.describe();
|
|
5807
|
-
return providerErrorToSubagentError(err, baseMessage2, cause);
|
|
5808
|
-
}
|
|
5809
|
-
const baseMessage = err instanceof Error ? err.message : String(err);
|
|
5810
|
-
if (err instanceof BudgetExceededError) {
|
|
5811
|
-
const map = {
|
|
5812
|
-
iterations: "budget_iterations",
|
|
5813
|
-
tool_calls: "budget_tool_calls",
|
|
5814
|
-
tokens: "budget_tokens",
|
|
5815
|
-
cost: "budget_cost",
|
|
5816
|
-
timeout: "budget_timeout",
|
|
5817
|
-
idle_timeout: "budget_timeout"
|
|
5818
|
-
};
|
|
5819
|
-
return {
|
|
5820
|
-
kind: map[err.kind],
|
|
5821
|
-
message: baseMessage,
|
|
5822
|
-
// Budgets are user-configured ceilings, not transient failures —
|
|
5823
|
-
// retrying with the same budget will hit the same ceiling. The
|
|
5824
|
-
// orchestrator must raise the budget or narrow the task first.
|
|
5825
|
-
retryable: false,
|
|
5826
|
-
cause
|
|
5827
|
-
};
|
|
5828
|
-
}
|
|
5829
|
-
if (hints.parentAborted) {
|
|
5830
|
-
return {
|
|
5831
|
-
kind: "aborted_by_parent",
|
|
5832
|
-
message: baseMessage,
|
|
5833
|
-
retryable: false,
|
|
5834
|
-
cause
|
|
5835
|
-
};
|
|
5836
|
-
}
|
|
5837
|
-
const lower = baseMessage.toLowerCase();
|
|
5838
|
-
if (/agent aborted$/i.test(baseMessage)) {
|
|
5839
|
-
return {
|
|
5840
|
-
kind: "aborted_by_parent",
|
|
5841
|
-
message: baseMessage,
|
|
5842
|
-
retryable: false,
|
|
5843
|
-
cause
|
|
5844
|
-
};
|
|
5845
|
-
}
|
|
5846
|
-
if (/agent exhausted iteration limit$/i.test(baseMessage)) {
|
|
5847
|
-
return { kind: "budget_iterations", message: baseMessage, retryable: false, cause };
|
|
5848
|
-
}
|
|
5849
|
-
if (/empty response$/i.test(baseMessage)) {
|
|
5850
|
-
return { kind: "empty_response", message: baseMessage, retryable: false, cause };
|
|
5851
|
-
}
|
|
5852
|
-
if (/^tool failed: /i.test(baseMessage)) {
|
|
5853
|
-
return { kind: "tool_failed", message: baseMessage, retryable: false, cause };
|
|
5854
|
-
}
|
|
5855
|
-
if (lower.includes("bridge transport") || /bridge.*(closed|disconnect)/i.test(baseMessage)) {
|
|
5856
|
-
return { kind: "bridge_failed", message: baseMessage, retryable: false, cause };
|
|
5857
|
-
}
|
|
5858
|
-
if (/context length|max.*tokens?.*exceeded|prompt is too long/i.test(baseMessage)) {
|
|
5859
|
-
return { kind: "context_overflow", message: baseMessage, retryable: false, cause };
|
|
5860
|
-
}
|
|
5861
|
-
return {
|
|
5862
|
-
kind: "unknown",
|
|
5863
|
-
message: baseMessage,
|
|
5864
|
-
retryable: false,
|
|
5865
|
-
cause
|
|
5866
|
-
};
|
|
5867
|
-
}
|
|
5868
|
-
function providerErrorToSubagentError(err, message, cause) {
|
|
5869
|
-
const status = err.status;
|
|
5870
|
-
if (status === 429 || err.body?.type === "rate_limit_error") {
|
|
5871
|
-
return {
|
|
5872
|
-
kind: "provider_rate_limit",
|
|
5873
|
-
message,
|
|
5874
|
-
retryable: true,
|
|
5875
|
-
// Conservative default: 5s. Provider-specific code can override
|
|
5876
|
-
// by emitting an error whose body carries an explicit hint.
|
|
5877
|
-
backoffMs: 5e3,
|
|
5878
|
-
cause
|
|
5879
|
-
};
|
|
5880
|
-
}
|
|
5881
|
-
if (status === 401 || status === 403 || err.body?.type === "authentication_error") {
|
|
5882
|
-
return { kind: "provider_auth", message, retryable: false, cause };
|
|
5883
|
-
}
|
|
5884
|
-
if (status === 408 || status === 0) {
|
|
5885
|
-
return { kind: "provider_timeout", message, retryable: true, cause };
|
|
5886
|
-
}
|
|
5887
|
-
if (status >= 500 && status < 600) {
|
|
5888
|
-
return {
|
|
5889
|
-
kind: "provider_5xx",
|
|
5890
|
-
message,
|
|
5891
|
-
retryable: true,
|
|
5892
|
-
backoffMs: 3e3,
|
|
5893
|
-
cause
|
|
5894
|
-
};
|
|
5895
|
-
}
|
|
5896
|
-
return { kind: "unknown", message, retryable: err.retryable, cause };
|
|
5897
|
-
}
|
|
5898
5873
|
|
|
5899
|
-
// src/coordination/director.ts
|
|
5874
|
+
// src/coordination/director/director-errors.ts
|
|
5900
5875
|
var FleetSpawnBudgetError = class extends Error {
|
|
5901
5876
|
kind;
|
|
5902
5877
|
limit;
|
|
@@ -5938,6 +5913,8 @@ var FleetContextOverflowError = class extends Error {
|
|
|
5938
5913
|
this.observed = observed;
|
|
5939
5914
|
}
|
|
5940
5915
|
};
|
|
5916
|
+
|
|
5917
|
+
// src/coordination/director.ts
|
|
5941
5918
|
var Director = class _Director {
|
|
5942
5919
|
/** Alias for the ICoordinator contract. `id` is retained for backward compatibility. */
|
|
5943
5920
|
get coordinatorId() {
|
|
@@ -7004,6 +6981,7 @@ var Director = class _Director {
|
|
|
7004
6981
|
role: config.prompt,
|
|
7005
6982
|
task: taskBrief,
|
|
7006
6983
|
sharedScratchpad: this.sharedScratchpadPath ?? void 0,
|
|
6984
|
+
skills: config.skillContent,
|
|
7007
6985
|
override: config.systemPromptOverride
|
|
7008
6986
|
});
|
|
7009
6987
|
}
|