@wrongstack/core 0.66.13 → 0.68.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/dist/index.d.ts CHANGED
@@ -49,7 +49,7 @@ export { D as DirectorStateCheckpoint, a as DirectorStateSnapshot, b as Director
49
49
  export { A as AutoApprovePermissionPolicy, D as DefaultPermissionPolicy, P as PermissionPolicyOptions } from './permission-policy-B2dK-T5N.js';
50
50
  export { AutoCompactionMiddleware, AutonomousRunner, AutonomousRunnerOptions, AutonomyPromptContributorOptions, DefaultSkillLoader, DoneCheckResult, DoneConditionChecker, IntelligentCompactor, IntelligentCompactorOptions, SelectiveCompactor, SelectiveCompactorOptions, SkillLoaderOptions, buildGoalPreamble, makeAutonomyPromptContributor } from './execution/index.js';
51
51
  export { DefaultProviderRunner } from './defaults/index.js';
52
- 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, n as CreateDelegateToolOptions, D as DEFAULT_DIRECTOR_PREAMBLE, q as DEFAULT_SUBAGENT_BASELINE, r as DelegateHost, s as Director, 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, O as NULL_FLEET_BUS, R as REFACTOR_PLANNER_AGENT, S as SECURITY_SCANNER_AGENT, V as SubagentPromptParts, W as applyRosterBudget, X as attachAutoExtend, Y as composeDirectorPrompt, Z as composeSubagentPrompt, _ as createDelegateTool, $ as getAgentDefinition, 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, af as rosterSummaryFromConfigs } from './null-fleet-bus-VApKRxcp.js';
52
+ 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, n as CreateDelegateToolOptions, D as DEFAULT_DIRECTOR_PREAMBLE, q as DEFAULT_SUBAGENT_BASELINE, r as DelegateHost, s as Director, 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, O as NULL_FLEET_BUS, R as REFACTOR_PLANNER_AGENT, S as SECURITY_SCANNER_AGENT, V as SubagentPromptParts, W as applyRosterBudget, X as attachAutoExtend, Y as composeDirectorPrompt, Z as composeSubagentPrompt, _ as createDelegateTool, $ as getAgentDefinition, 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, af as rosterSummaryFromConfigs } from './null-fleet-bus-CuN0ObJr.js';
53
53
  export { A as AgentBudgetTier, a as AgentCapability, b as AgentDefinition, 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, j as MultiAgentCoordinatorOptions, k as dispatchAgent, m as makeLLMClassifier, s as scoreAgents } from './multi-agent-coordinator-CWnH-CiX.js';
54
54
  export { DefaultModeStore, LLMSelector, LLMSelectorOptions, ModeLoaderOptions, loadProjectModes, loadUserModes } from './models/index.js';
55
55
  import { TaskStore } from './sdd/index.js';
package/dist/index.js CHANGED
@@ -12324,6 +12324,71 @@ Do not add prose, markdown, or code fences.`;
12324
12324
  };
12325
12325
  }
12326
12326
 
12327
+ // src/coordination/coordinator/error-classifier.ts
12328
+ function classifySubagentError(err, hints = {}) {
12329
+ const cause = err instanceof Error ? { name: err.name, message: err.message, stack: err.stack } : void 0;
12330
+ if (err instanceof ProviderError) {
12331
+ const baseMessage2 = err.describe();
12332
+ return providerErrorToSubagentError(err, baseMessage2, cause);
12333
+ }
12334
+ const baseMessage = err instanceof Error ? err.message : String(err);
12335
+ if (err instanceof BudgetExceededError) {
12336
+ const map = {
12337
+ iterations: "budget_iterations",
12338
+ tool_calls: "budget_tool_calls",
12339
+ tokens: "budget_tokens",
12340
+ cost: "budget_cost",
12341
+ timeout: "budget_timeout",
12342
+ idle_timeout: "budget_timeout"
12343
+ };
12344
+ return {
12345
+ kind: map[err.kind],
12346
+ message: baseMessage,
12347
+ retryable: false,
12348
+ cause
12349
+ };
12350
+ }
12351
+ if (hints.parentAborted) {
12352
+ return { kind: "aborted_by_parent", message: baseMessage, retryable: false, cause };
12353
+ }
12354
+ const lower = baseMessage.toLowerCase();
12355
+ if (/agent aborted$/i.test(baseMessage)) {
12356
+ return { kind: "aborted_by_parent", message: baseMessage, retryable: false, cause };
12357
+ }
12358
+ if (/agent exhausted iteration limit$/i.test(baseMessage)) {
12359
+ return { kind: "budget_iterations", message: baseMessage, retryable: false, cause };
12360
+ }
12361
+ if (/empty response$/i.test(baseMessage)) {
12362
+ return { kind: "empty_response", message: baseMessage, retryable: false, cause };
12363
+ }
12364
+ if (/^tool failed: /i.test(baseMessage)) {
12365
+ return { kind: "tool_failed", message: baseMessage, retryable: false, cause };
12366
+ }
12367
+ if (lower.includes("bridge transport") || /bridge.*(closed|disconnect)/i.test(baseMessage)) {
12368
+ return { kind: "bridge_failed", message: baseMessage, retryable: false, cause };
12369
+ }
12370
+ if (/context length|max.*tokens?.*exceeded|prompt is too long/i.test(baseMessage)) {
12371
+ return { kind: "context_overflow", message: baseMessage, retryable: false, cause };
12372
+ }
12373
+ return { kind: "unknown", message: baseMessage, retryable: false, cause };
12374
+ }
12375
+ function providerErrorToSubagentError(err, message, cause) {
12376
+ const status = err.status;
12377
+ if (status === 429 || err.body?.type === "rate_limit_error") {
12378
+ return { kind: "provider_rate_limit", message, retryable: true, backoffMs: 5e3, cause };
12379
+ }
12380
+ if (status === 401 || status === 403 || err.body?.type === "authentication_error") {
12381
+ return { kind: "provider_auth", message, retryable: false, cause };
12382
+ }
12383
+ if (status === 408 || status === 0) {
12384
+ return { kind: "provider_timeout", message, retryable: true, cause };
12385
+ }
12386
+ if (status >= 500 && status < 600) {
12387
+ return { kind: "provider_5xx", message, retryable: true, backoffMs: 3e3, cause };
12388
+ }
12389
+ return { kind: "unknown", message, retryable: err.retryable, cause };
12390
+ }
12391
+
12327
12392
  // src/coordination/fleet.ts
12328
12393
  var AUDIT_LOG_AGENT = {
12329
12394
  id: "audit-log",
@@ -13391,101 +13456,6 @@ var DefaultMultiAgentCoordinator = class _DefaultMultiAgentCoordinator extends E
13391
13456
  return false;
13392
13457
  }
13393
13458
  };
13394
- function classifySubagentError(err, hints = {}) {
13395
- const cause = err instanceof Error ? { name: err.name, message: err.message, stack: err.stack } : void 0;
13396
- if (err instanceof ProviderError) {
13397
- const baseMessage2 = err.describe();
13398
- return providerErrorToSubagentError(err, baseMessage2, cause);
13399
- }
13400
- const baseMessage = err instanceof Error ? err.message : String(err);
13401
- if (err instanceof BudgetExceededError) {
13402
- const map = {
13403
- iterations: "budget_iterations",
13404
- tool_calls: "budget_tool_calls",
13405
- tokens: "budget_tokens",
13406
- cost: "budget_cost",
13407
- timeout: "budget_timeout",
13408
- idle_timeout: "budget_timeout"
13409
- };
13410
- return {
13411
- kind: map[err.kind],
13412
- message: baseMessage,
13413
- // Budgets are user-configured ceilings, not transient failures —
13414
- // retrying with the same budget will hit the same ceiling. The
13415
- // orchestrator must raise the budget or narrow the task first.
13416
- retryable: false,
13417
- cause
13418
- };
13419
- }
13420
- if (hints.parentAborted) {
13421
- return {
13422
- kind: "aborted_by_parent",
13423
- message: baseMessage,
13424
- retryable: false,
13425
- cause
13426
- };
13427
- }
13428
- const lower = baseMessage.toLowerCase();
13429
- if (/agent aborted$/i.test(baseMessage)) {
13430
- return {
13431
- kind: "aborted_by_parent",
13432
- message: baseMessage,
13433
- retryable: false,
13434
- cause
13435
- };
13436
- }
13437
- if (/agent exhausted iteration limit$/i.test(baseMessage)) {
13438
- return { kind: "budget_iterations", message: baseMessage, retryable: false, cause };
13439
- }
13440
- if (/empty response$/i.test(baseMessage)) {
13441
- return { kind: "empty_response", message: baseMessage, retryable: false, cause };
13442
- }
13443
- if (/^tool failed: /i.test(baseMessage)) {
13444
- return { kind: "tool_failed", message: baseMessage, retryable: false, cause };
13445
- }
13446
- if (lower.includes("bridge transport") || /bridge.*(closed|disconnect)/i.test(baseMessage)) {
13447
- return { kind: "bridge_failed", message: baseMessage, retryable: false, cause };
13448
- }
13449
- if (/context length|max.*tokens?.*exceeded|prompt is too long/i.test(baseMessage)) {
13450
- return { kind: "context_overflow", message: baseMessage, retryable: false, cause };
13451
- }
13452
- return {
13453
- kind: "unknown",
13454
- message: baseMessage,
13455
- retryable: false,
13456
- cause
13457
- };
13458
- }
13459
- function providerErrorToSubagentError(err, message, cause) {
13460
- const status = err.status;
13461
- if (status === 429 || err.body?.type === "rate_limit_error") {
13462
- return {
13463
- kind: "provider_rate_limit",
13464
- message,
13465
- retryable: true,
13466
- // Conservative default: 5s. Provider-specific code can override
13467
- // by emitting an error whose body carries an explicit hint.
13468
- backoffMs: 5e3,
13469
- cause
13470
- };
13471
- }
13472
- if (status === 401 || status === 403 || err.body?.type === "authentication_error") {
13473
- return { kind: "provider_auth", message, retryable: false, cause };
13474
- }
13475
- if (status === 408 || status === 0) {
13476
- return { kind: "provider_timeout", message, retryable: true, cause };
13477
- }
13478
- if (status >= 500 && status < 600) {
13479
- return {
13480
- kind: "provider_5xx",
13481
- message,
13482
- retryable: true,
13483
- backoffMs: 3e3,
13484
- cause
13485
- };
13486
- }
13487
- return { kind: "unknown", message, retryable: err.retryable, cause };
13488
- }
13489
13459
 
13490
13460
  // src/execution/parallel-eternal-engine.ts
13491
13461
  function sleep2(ms) {
@@ -15368,7 +15338,7 @@ function isValidMatrixKey(key) {
15368
15338
  return matrixKeyKind(key) !== "unknown";
15369
15339
  }
15370
15340
 
15371
- // src/coordination/director.ts
15341
+ // src/coordination/director/director-errors.ts
15372
15342
  var FleetSpawnBudgetError = class extends Error {
15373
15343
  kind;
15374
15344
  limit;
@@ -15410,6 +15380,8 @@ var FleetContextOverflowError = class extends Error {
15410
15380
  this.observed = observed;
15411
15381
  }
15412
15382
  };
15383
+
15384
+ // src/coordination/director.ts
15413
15385
  var Director = class _Director {
15414
15386
  /** Alias for the ICoordinator contract. `id` is retained for backward compatibility. */
15415
15387
  get coordinatorId() {