@wrongstack/core 0.107.2 → 0.119.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.
Files changed (63) hide show
  1. package/dist/{agent-bridge-mOxbpFcg.d.ts → agent-bridge-PRAbEX-9.d.ts} +1 -1
  2. package/dist/{agent-subagent-runner-DukQLUcS.d.ts → agent-subagent-runner-DXWImnNV.d.ts} +7 -8
  3. package/dist/{brain-Dfv4Y82E.d.ts → brain-NZZqL8sn.d.ts} +1 -1
  4. package/dist/{compactor-DXLxLcmU.d.ts → compactor-C3stu664.d.ts} +1 -1
  5. package/dist/{config-BSU-6vah.d.ts → config-DZV9VK9n.d.ts} +104 -3
  6. package/dist/{context-CNRYfhUv.d.ts → context-hvXINa6a.d.ts} +31 -1
  7. package/dist/coordination/index.d.ts +12 -13
  8. package/dist/coordination/index.js +198 -0
  9. package/dist/coordination/index.js.map +1 -1
  10. package/dist/defaults/index.d.ts +27 -28
  11. package/dist/defaults/index.js +346 -86
  12. package/dist/defaults/index.js.map +1 -1
  13. package/dist/execution/index.d.ts +16 -17
  14. package/dist/execution/index.js +266 -12
  15. package/dist/execution/index.js.map +1 -1
  16. package/dist/extension/index.d.ts +6 -7
  17. package/dist/{goal-preamble-CI8lxeY1.d.ts → goal-preamble-COpt55W8.d.ts} +10 -10
  18. package/dist/{goal-store-ht0VmR1A.d.ts → goal-store-CV9Yz2X_.d.ts} +11 -0
  19. package/dist/{index-DIKEcfgC.d.ts → index-4VVHuTZF.d.ts} +7 -6
  20. package/dist/{index-BWRN6wOb.d.ts → index-Cj3le7TI.d.ts} +9 -10
  21. package/dist/index.d.ts +41 -42
  22. package/dist/index.js +372 -118
  23. package/dist/index.js.map +1 -1
  24. package/dist/infrastructure/index.d.ts +6 -7
  25. package/dist/kernel/index.d.ts +10 -11
  26. package/dist/llm-selector-Bmx4PsVM.d.ts +58 -0
  27. package/dist/{mcp-servers-CXCsANdY.d.ts → mcp-servers-CofNHOqn.d.ts} +3 -3
  28. package/dist/{mode-ARA3HrkY.d.ts → mode-CZlO9iU1.d.ts} +1 -1
  29. package/dist/models/index.d.ts +157 -53
  30. package/dist/models/index.js +423 -1
  31. package/dist/models/index.js.map +1 -1
  32. package/dist/{models-registry-DU64QxQa.d.ts → models-registry-BzlsjKcy.d.ts} +1 -1
  33. package/dist/{multi-agent-coordinator-51LvnXkD.d.ts → multi-agent-coordinator-CmDmUgq2.d.ts} +1 -1
  34. package/dist/{null-fleet-bus-D09hMzFQ.d.ts → null-fleet-bus-CyH2YqP4.d.ts} +6 -6
  35. package/dist/observability/index.d.ts +2 -2
  36. package/dist/{parallel-eternal-engine-CUtmM_0V.d.ts → parallel-eternal-engine-uxVm4y4V.d.ts} +11 -10
  37. package/dist/{path-resolver-DDJiMAtX.d.ts → path-resolver-gfoGxpdd.d.ts} +3 -3
  38. package/dist/{permission-BDv7z0mk.d.ts → permission-DhLrgA30.d.ts} +1 -1
  39. package/dist/{permission-policy-dF74EpDp.d.ts → permission-policy-DGOvne7i.d.ts} +2 -2
  40. package/dist/{pipeline-BqiA_UMr.d.ts → pipeline-CqF7uju2.d.ts} +2 -2
  41. package/dist/{plan-templates-BdDxl9cI.d.ts → plan-templates-DoKhzenv.d.ts} +6 -6
  42. package/dist/{provider-runner-BUunikwY.d.ts → provider-runner-BPlI5sPZ.d.ts} +3 -3
  43. package/dist/{retry-policy-BcmuT_V0.d.ts → retry-policy-B4Q-FZgE.d.ts} +1 -1
  44. package/dist/sdd/index.d.ts +8 -9
  45. package/dist/sdd/index.js +198 -0
  46. package/dist/sdd/index.js.map +1 -1
  47. package/dist/{secret-vault-DrOhc2i5.d.ts → secret-vault-B7GnL6o9.d.ts} +1 -1
  48. package/dist/security/index.d.ts +4 -4
  49. package/dist/{selector-C7wcdqMA.d.ts → selector-BakeMnWR.d.ts} +1 -1
  50. package/dist/{session-event-bridge-BpJ5trO9.d.ts → session-event-bridge-DE5Oekwx.d.ts} +1 -1
  51. package/dist/{session-reader-DDz1Ek4V.d.ts → session-reader-DFC81-4p.d.ts} +1 -1
  52. package/dist/storage/index.d.ts +12 -13
  53. package/dist/storage/index.js +147 -88
  54. package/dist/storage/index.js.map +1 -1
  55. package/dist/types/index.d.ts +20 -21
  56. package/dist/types/index.js +35 -1
  57. package/dist/types/index.js.map +1 -1
  58. package/dist/utils/index.d.ts +3 -4
  59. package/dist/utils/index.js +2 -1
  60. package/dist/utils/index.js.map +1 -1
  61. package/dist/{wstack-paths-_lqjzErq.d.ts → wstack-paths-DD50Omgn.d.ts} +3 -0
  62. package/package.json +1 -1
  63. package/dist/models-registry-B6_KfS65.d.ts +0 -95
@@ -1,4 +1,4 @@
1
- import { B as BridgeTransport, a as BridgeMessage, A as AgentBridge, b as AgentBridgeConfig } from './agent-subagent-runner-DukQLUcS.js';
1
+ import { B as BridgeTransport, a as BridgeMessage, A as AgentBridge, b as AgentBridgeConfig } from './agent-subagent-runner-DXWImnNV.js';
2
2
 
3
3
  /**
4
4
  * In-memory pub/sub transport for agent-to-agent messaging.
@@ -1,13 +1,12 @@
1
- import { c as ToolCallPipelinePayload, d as ToolWrapper, E as ExtensionRegistry, S as SystemPromptContributor, e as ToolRegistry, P as ProviderRegistry, A as AgentPipelines, f as ToolExecutorLike, g as AgentInit, h as AgentInput, R as RunResult } from './index-DIKEcfgC.js';
2
- import { C as Container, R as ReadonlyPipeline, a as Renderer } from './pipeline-BqiA_UMr.js';
3
- import { E as EventBus, c as EventName, L as Listener } from './brain-Dfv4Y82E.js';
4
- import { R as RetryPolicy, E as ErrorHandler } from './retry-policy-BcmuT_V0.js';
1
+ import { c as ToolCallPipelinePayload, d as ToolWrapper, E as ExtensionRegistry, S as SystemPromptContributor, e as ToolRegistry, P as ProviderRegistry, A as AgentPipelines, f as ToolExecutorLike, g as AgentInit, h as AgentInput, R as RunResult } from './index-4VVHuTZF.js';
2
+ import { C as Container, R as ReadonlyPipeline, a as Renderer } from './pipeline-CqF7uju2.js';
3
+ import { E as EventBus, c as EventName, L as Listener } from './brain-NZZqL8sn.js';
4
+ import { R as RetryPolicy, E as ErrorHandler } from './retry-policy-B4Q-FZgE.js';
5
5
  import { L as Logger } from './logger-B63L5bTg.js';
6
6
  import { T as Tracer } from './observability-D-HZN_mF.js';
7
- import { P as PermissionPolicy } from './permission-BDv7z0mk.js';
8
- import { U as Usage, C as Context, J as JSONSchema, R as Request, b as Response, g as ContentBlock, l as TextBlock, T as Tool, P as Provider, o as RunOptions } from './context-CNRYfhUv.js';
9
- import { H as HookEvent, a as HookMatcher, I as InProcessHook, d as Config } from './config-BSU-6vah.js';
10
- import { W as WireFamily } from './models-registry-B6_KfS65.js';
7
+ import { P as PermissionPolicy } from './permission-DhLrgA30.js';
8
+ import { U as Usage, C as Context, J as JSONSchema, R as Request, b as Response, g as ContentBlock, l as TextBlock, T as Tool, P as Provider, o as RunOptions } from './context-hvXINa6a.js';
9
+ import { W as WireFamily, H as HookEvent, e as HookMatcher, I as InProcessHook, h as Config } from './config-DZV9VK9n.js';
11
10
 
12
11
  /**
13
12
  * Single fleet-wide event with subagent attribution. Whatever a child
@@ -1,4 +1,4 @@
1
- import { U as Usage, C as Context, j as ToolProgressEvent, T as Tool } from './context-CNRYfhUv.js';
1
+ import { U as Usage, C as Context, j as ToolProgressEvent, T as Tool } from './context-hvXINa6a.js';
2
2
 
3
3
  type MemoryScope = 'project-agents' | 'project-memory' | 'user-memory';
4
4
  type MemoryType = 'fact' | 'decision' | 'convention' | 'preference' | 'reference' | 'anti_pattern';
@@ -1,4 +1,4 @@
1
- import { C as Context } from './context-CNRYfhUv.js';
1
+ import { C as Context } from './context-hvXINa6a.js';
2
2
 
3
3
  interface CompactRepairReport {
4
4
  removedToolUses: string[];
@@ -1,5 +1,4 @@
1
- import { W as WireFamily } from './models-registry-B6_KfS65.js';
2
- import { k as Capabilities, f as Permission } from './context-CNRYfhUv.js';
1
+ import { k as Capabilities, f as Permission } from './context-hvXINa6a.js';
3
2
 
4
3
  type ContextWindowModeId = 'balanced' | 'frugal' | 'deep' | 'archival';
5
4
  type ContextWindowAggressiveOn = 'hard' | 'soft' | 'warn';
@@ -131,6 +130,100 @@ type HookEntry = {
131
130
  timeoutMs?: number | undefined;
132
131
  };
133
132
 
133
+ /**
134
+ * Mirror of the models.dev/api.json schema. Top-level is keyed by provider id.
135
+ * We keep `unknown` for fields we don't read so the cached payload stays faithful.
136
+ */
137
+ interface ModelsDevModel {
138
+ id: string;
139
+ name: string;
140
+ family?: string | undefined;
141
+ attachment?: boolean | undefined;
142
+ reasoning?: boolean | undefined;
143
+ tool_call?: boolean | undefined;
144
+ temperature?: boolean | undefined;
145
+ knowledge?: string | undefined;
146
+ release_date?: string | undefined;
147
+ last_updated?: string | undefined;
148
+ open_weights?: boolean | undefined;
149
+ modalities?: {
150
+ input?: string[] | undefined;
151
+ output?: string[] | undefined;
152
+ };
153
+ cost?: {
154
+ input?: number | undefined;
155
+ output?: number | undefined;
156
+ cache_read?: number | undefined;
157
+ cache_write?: number | undefined;
158
+ [k: string]: number | undefined;
159
+ };
160
+ limit?: {
161
+ context?: number | undefined;
162
+ output?: number | undefined;
163
+ };
164
+ [k: string]: unknown;
165
+ }
166
+ interface ModelsDevProvider {
167
+ id: string;
168
+ name: string;
169
+ /** Env vars that hold the API key, in priority order. */
170
+ env?: string[] | undefined;
171
+ /** Identifies the wire format family (e.g. @ai-sdk/anthropic). */
172
+ npm?: string | undefined;
173
+ /** Default base URL when not provided by SDK defaults. */
174
+ api?: string | undefined;
175
+ /** Documentation URL. */
176
+ doc?: string | undefined;
177
+ models: Record<string, ModelsDevModel>;
178
+ }
179
+ type ModelsDevPayload = Record<string, ModelsDevProvider>;
180
+ /**
181
+ * Canonical wire-format families WrongStack knows how to speak natively.
182
+ * Used by the provider registry to pick a transport.
183
+ */
184
+ type WireFamily = 'anthropic' | 'openai' | 'openai-compatible' | 'google' | 'unsupported';
185
+ interface ResolvedProvider {
186
+ id: string;
187
+ name: string;
188
+ family: WireFamily;
189
+ apiBase?: string | undefined;
190
+ envVars: string[];
191
+ doc?: string | undefined;
192
+ models: ModelsDevModel[];
193
+ npm?: string | undefined;
194
+ }
195
+ interface ResolvedModel {
196
+ providerId: string;
197
+ modelId: string;
198
+ capabilities: {
199
+ tools: boolean;
200
+ vision: boolean;
201
+ reasoning: boolean;
202
+ maxContext: number;
203
+ maxOutput?: number | undefined;
204
+ knowledge?: string | undefined;
205
+ };
206
+ cost?: ModelsDevModel['cost'] | undefined;
207
+ }
208
+ interface ModelsRegistry {
209
+ /** Load (from cache or network). Idempotent; second call returns cached value. */
210
+ load(opts?: {
211
+ force?: boolean | undefined;
212
+ }): Promise<ModelsDevPayload>;
213
+ /** Force-refresh from network and overwrite cache. */
214
+ refresh(): Promise<ModelsDevPayload>;
215
+ /** All providers, classified by wire family. */
216
+ listProviders(): Promise<ResolvedProvider[]>;
217
+ /** A single provider by id, or undefined. */
218
+ getProvider(id: string): Promise<ResolvedProvider | undefined>;
219
+ /** A model lookup with capabilities + cost. */
220
+ getModel(providerId: string, modelId: string): Promise<ResolvedModel | undefined>;
221
+ /** Suggest a default model for the given provider (latest by release_date). */
222
+ suggestModel(providerId: string): Promise<string | undefined>;
223
+ /** Cache freshness in seconds since last successful network fetch (Infinity if never). */
224
+ ageSeconds(): Promise<number>;
225
+ }
226
+
134
227
  interface ContextConfig {
135
228
  /** Context-window policy mode. Controls compaction thresholds and preservation depth. */
136
229
  mode?: ContextWindowModeId | undefined;
@@ -433,6 +526,14 @@ interface Config {
433
526
  autonomy?: AutonomyConfig | undefined;
434
527
  /** Show rotating launch hints on startup. Default: true. Set to false to suppress. */
435
528
  hints?: boolean | undefined;
529
+ /** Raw SSE stream debugging — hex-dump every byte received from providers to stderr. */
530
+ debugStream?: boolean | undefined;
531
+ /**
532
+ * Where settings are persisted. 'global' → ~/.wrongstack/config.json
533
+ * (default). 'project' → ~/.wrongstack/projects/<slug>/config.local.json.
534
+ * When 'project', provider/model/autonomy/ux settings are saved per-project.
535
+ */
536
+ configScope?: 'global' | 'project' | undefined;
436
537
  /** Automatic codebase symbol-index maintenance (session-start + live updates). */
437
538
  indexing?: IndexingConfig | undefined;
438
539
  /** Saved launch preferences — restored on next boot for one-line confirmation. */
@@ -503,4 +604,4 @@ interface ConfigStore {
503
604
  watch(cb: (next: Readonly<Config>, prev: Readonly<Config>) => void): () => void;
504
605
  }
505
606
 
506
- export { type AutonomyConfig as A, listContextWindowModes as B, type ContextWindowAggressiveOn as C, DEFAULT_CONTEXT_WINDOW_MODE_ID as D, resolveContextWindowPolicy as E, type FeaturesConfig as F, type HookEvent as H, type InProcessHook as I, type LaunchConfig as L, type MCPServerConfig as M, type PluginConfig as P, type ShellHook as S, type ToolsConfig as T, type HookMatcher as a, type HookEntry as b, type ContextWindowPolicy as c, type Config as d, type ConfigStore as e, type ConfigLoader as f, type SyncConfig as g, type ModelMatrixEntry as h, type HookInput as i, type HookOutcome as j, CONTEXT_WINDOW_MODES as k, type ContextConfig as l, type ContextWindowConfigLike as m, type ContextWindowMode as n, type ContextWindowModeId as o, type ContextWindowThresholds as p, type CustomModelDefinition as q, type IndexingConfig as r, type LogConfig as s, type ProviderApiKey as t, type ProviderConfig as u, type SessionLoggingConfig as v, type SyncCategory as w, formatContextWindowModeList as x, getContextWindowMode as y, isContextWindowModeId as z };
607
+ export { type AutonomyConfig as A, type SyncCategory as B, type ContextWindowAggressiveOn as C, DEFAULT_CONTEXT_WINDOW_MODE_ID as D, formatContextWindowModeList as E, type FeaturesConfig as F, getContextWindowMode as G, type HookEvent as H, type InProcessHook as I, isContextWindowModeId as J, listContextWindowModes as K, type LaunchConfig as L, type ModelsRegistry as M, resolveContextWindowPolicy as N, type ProviderConfig as P, type ResolvedProvider as R, type ShellHook as S, type ToolsConfig as T, type WireFamily as W, type ModelsDevPayload as a, type ResolvedModel as b, type MCPServerConfig as c, type ModelMatrixEntry as d, type HookMatcher as e, type HookEntry as f, type ContextWindowPolicy as g, type Config as h, type ConfigStore as i, type ConfigLoader as j, type SyncConfig as k, type HookInput as l, type HookOutcome as m, CONTEXT_WINDOW_MODES as n, type ContextConfig as o, type ContextWindowConfigLike as p, type ContextWindowMode as q, type ContextWindowModeId as r, type ContextWindowThresholds as s, type CustomModelDefinition as t, type IndexingConfig as u, type LogConfig as v, type ModelsDevProvider as w, type PluginConfig as x, type ProviderApiKey as y, type SessionLoggingConfig as z };
@@ -589,6 +589,36 @@ declare class ProviderError extends WrongStackError {
589
589
  */
590
590
  describe(): string;
591
591
  }
592
+ /**
593
+ * Thrown when the provider stream stops delivering data mid-response.
594
+ * This is distinct from a network error (TCP reset, DNS failure) — the
595
+ * connection is established and the response started, but chunks stopped
596
+ * arriving before the stream completed.
597
+ *
598
+ * Status 599 is used as a sentinel to distinguish stream hangs from
599
+ * regular HTTP errors while still flowing through ProviderError-based
600
+ * retry and fallback infrastructure.
601
+ */
602
+ declare class StreamHangError extends ProviderError {
603
+ /** Name of the provider that hung, e.g. "zai", "anthropic". */
604
+ readonly hungProviderId: string;
605
+ /** Model that was being called when the hang occurred. */
606
+ readonly hungModel: string;
607
+ /** How long (ms) we waited for the next chunk before declaring a hang. */
608
+ readonly hangTimeoutMs: number;
609
+ /** How many bytes were received before the hang. */
610
+ readonly bytesReceived: number;
611
+ /** Elapsed time (ms) from the start of the stream until the hang. */
612
+ readonly elapsedMs: number;
613
+ constructor(opts: {
614
+ providerId: string;
615
+ model: string;
616
+ hangTimeoutMs: number;
617
+ bytesReceived: number;
618
+ elapsedMs: number;
619
+ cause?: unknown | undefined;
620
+ });
621
+ }
592
622
 
593
623
  interface SessionMetadata {
594
624
  id: string;
@@ -1218,4 +1248,4 @@ declare class Context implements RunEnv {
1218
1248
  usage(): Usage;
1219
1249
  }
1220
1250
 
1221
- export { type ToolStreamEvent as $, AgentError as A, type MessageRole as B, Context as C, PluginError as D, ERROR_CODES as E, type FileSnapshot as F, type ProviderErrorBody as G, type ReadonlyConversationState as H, type ImageBlock as I, type JSONSchema as J, type RiskTier as K, type RunEnv as L, type Message as M, SessionError as N, type StateChange as O, type Provider as P, type StateChangeHandler as Q, type Request as R, type SessionEvent as S, type Tool as T, type Usage as U, type StopReason as V, type StreamEvent as W, type ThinkingBlock as X, type ToolCallContext as Y, ToolError as Z, type ToolFinalEvent as _, type SessionWriter as a, WrongStackError as a0, asBlocks as a1, asText as a2, extractRunEnv as a3, isAgentError as a4, isConfigError as a5, isFsError as a6, isImageBlock as a7, isPluginError as a8, isSessionError as a9, isTextBlock as aa, isThinkingBlock as ab, isToolError as ac, isToolResultBlock as ad, isToolUseBlock as ae, isWrongStackError as af, toWrongStackError as ag, wrapAsState as ah, type Response as b, type TokenCounter as c, type CacheStats as d, ProviderError as e, type Permission as f, type ContentBlock as g, type SessionMetadata as h, type SessionStore as i, type ToolProgressEvent as j, type Capabilities as k, type TextBlock as l, type ToolUseBlock as m, type ToolResultBlock as n, type RunOptions as o, type ResumedSession as p, type SessionData as q, type SessionSummary as r, type TodoItem as s, ConversationState as t, ConfigError as u, type ContextInit as v, type ErrorCode as w, type ErrorSeverity as x, type ErrorSubsystem as y, FsError as z };
1251
+ export { type ToolFinalEvent as $, AgentError as A, type MessageRole as B, Context as C, PluginError as D, ERROR_CODES as E, type FileSnapshot as F, type ProviderErrorBody as G, type ReadonlyConversationState as H, type ImageBlock as I, type JSONSchema as J, type RiskTier as K, type RunEnv as L, type Message as M, SessionError as N, type StateChange as O, type Provider as P, type StateChangeHandler as Q, type Request as R, type SessionEvent as S, type Tool as T, type Usage as U, type StopReason as V, type StreamEvent as W, StreamHangError as X, type ThinkingBlock as Y, type ToolCallContext as Z, ToolError as _, type SessionWriter as a, type ToolStreamEvent as a0, WrongStackError as a1, asBlocks as a2, asText as a3, extractRunEnv as a4, isAgentError as a5, isConfigError as a6, isFsError as a7, isImageBlock as a8, isPluginError as a9, isSessionError as aa, isTextBlock as ab, isThinkingBlock as ac, isToolError as ad, isToolResultBlock as ae, isToolUseBlock as af, isWrongStackError as ag, toWrongStackError as ah, wrapAsState as ai, type Response as b, type TokenCounter as c, type CacheStats as d, ProviderError as e, type Permission as f, type ContentBlock as g, type SessionMetadata as h, type SessionStore as i, type ToolProgressEvent as j, type Capabilities as k, type TextBlock as l, type ToolUseBlock as m, type ToolResultBlock as n, type RunOptions as o, type ResumedSession as p, type SessionData as q, type SessionSummary as r, type TodoItem as s, ConversationState as t, ConfigError as u, type ContextInit as v, type ErrorCode as w, type ErrorSeverity as x, type ErrorSubsystem as y, FsError as z };
@@ -1,20 +1,19 @@
1
- export { b as BrainArbiter, B as BrainDecision, d as BrainDecisionOption, e as BrainDecisionQueue, a as BrainDecisionRequest, f as BrainDecisionSource, g as BrainFallback, h as BrainRisk, D as DefaultBrainArbiter, i as DefaultBrainArbiterOptions, H as HumanEscalatingBrainArbiter, O as ObservableBrainArbiter, j as formatHumanPrompt } from '../brain-Dfv4Y82E.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-D09hMzFQ.js';
3
- import { A as AgentDefinition } from '../multi-agent-coordinator-51LvnXkD.js';
4
- export { T as AGENT_TOOL_PRESETS, b as AgentBudgetTier, c as AgentCapability, d as AgentPhase, e as DEFAULT_DISPATCH_ROLE, a as DefaultMultiAgentCoordinator, f as DispatchCandidate, D 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-51LvnXkD.js';
5
- export { h as AgentFactory, i as AgentFactoryResult, j as AgentRunnerOptions, k as BudgetExceededError, l as BudgetKind, m as BudgetLimits, n as BudgetNegotiationMode, o as BudgetThresholdDecision, p as BudgetThresholdHandler, q as BudgetThresholdSignal, r as BudgetUsage, F as FleetBus, s as FleetEvent, t as FleetHandler, u as FleetUsage, v as FleetUsageAggregator, w as SubagentBudget, x as SubagentUsageSnapshot, y as makeAgentSubagentRunner } from '../agent-subagent-runner-DukQLUcS.js';
6
- export { I as InMemoryAgentBridge, a as InMemoryBridgeTransport, c as createMessage } from '../agent-bridge-mOxbpFcg.js';
7
- import '../context-CNRYfhUv.js';
1
+ export { b as BrainArbiter, B as BrainDecision, d as BrainDecisionOption, e as BrainDecisionQueue, a as BrainDecisionRequest, f as BrainDecisionSource, g as BrainFallback, h as BrainRisk, D as DefaultBrainArbiter, i as DefaultBrainArbiterOptions, H as HumanEscalatingBrainArbiter, O as ObservableBrainArbiter, j as formatHumanPrompt } from '../brain-NZZqL8sn.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-CyH2YqP4.js';
3
+ import { A as AgentDefinition } from '../multi-agent-coordinator-CmDmUgq2.js';
4
+ export { T as AGENT_TOOL_PRESETS, b as AgentBudgetTier, c as AgentCapability, d as AgentPhase, e as DEFAULT_DISPATCH_ROLE, a as DefaultMultiAgentCoordinator, f as DispatchCandidate, D 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-CmDmUgq2.js';
5
+ export { h as AgentFactory, i as AgentFactoryResult, j as AgentRunnerOptions, k as BudgetExceededError, l as BudgetKind, m as BudgetLimits, n as BudgetNegotiationMode, o as BudgetThresholdDecision, p as BudgetThresholdHandler, q as BudgetThresholdSignal, r as BudgetUsage, F as FleetBus, s as FleetEvent, t as FleetHandler, u as FleetUsage, v as FleetUsageAggregator, w as SubagentBudget, x as SubagentUsageSnapshot, y as makeAgentSubagentRunner } from '../agent-subagent-runner-DXWImnNV.js';
6
+ export { I as InMemoryAgentBridge, a as InMemoryBridgeTransport, c as createMessage } from '../agent-bridge-PRAbEX-9.js';
7
+ import '../context-hvXINa6a.js';
8
8
  import 'node:events';
9
9
  import '../director-state-BfeCUbmk.js';
10
- import '../config-BSU-6vah.js';
11
- import '../models-registry-B6_KfS65.js';
12
- import '../index-DIKEcfgC.js';
10
+ import '../config-DZV9VK9n.js';
11
+ import '../index-4VVHuTZF.js';
13
12
  import '../logger-B63L5bTg.js';
14
- import '../pipeline-BqiA_UMr.js';
13
+ import '../pipeline-CqF7uju2.js';
15
14
  import '../observability-D-HZN_mF.js';
16
- import '../permission-BDv7z0mk.js';
17
- import '../retry-policy-BcmuT_V0.js';
15
+ import '../permission-DhLrgA30.js';
16
+ import '../retry-policy-B4Q-FZgE.js';
18
17
 
19
18
  /** Phase 1 · Discovery — map the territory before any work begins. */
20
19
  declare const DISCOVERY_AGENTS: AgentDefinition[];
@@ -1758,6 +1758,53 @@ Working rules:
1758
1758
  "flaws"
1759
1759
  ]
1760
1760
  }
1761
+ },
1762
+ {
1763
+ config: {
1764
+ id: "refactor-planner",
1765
+ name: "Refactor Planner",
1766
+ role: "refactor-planner",
1767
+ tools: [...PLAN_TOOLS, "diff"],
1768
+ prompt: `You are the Refactor Planner agent. Your job is to analyze code
1769
+ structure and produce a concrete, phased refactoring plan with risk
1770
+ assessment, dependency ordering, and rollback strategy.
1771
+
1772
+ Scope:
1773
+ - Map module-level dependencies (import graph)
1774
+ - Identify coupling hotspots (high fan-in/out modules)
1775
+ - Assess refactoring risk by complexity and test coverage
1776
+ - Generate phased plans with checkpoint milestones
1777
+ - Produce diff-friendly task lists (one task = one concern)
1778
+
1779
+ Input format you accept:
1780
+ { "task": "plan | assess | roadmap", "target": "src/core", "constraint": "no-breaking-changes | minimal-downtime | full-rewrite", "focus": "architecture | performance | maintainability" }
1781
+
1782
+ Output: Markdown refactor plan with phases (Low Risk / Medium Risk / High Risk),
1783
+ dependency graph, rollback strategy, and exit criteria.
1784
+
1785
+ Working rules:
1786
+ - Always include rollback strategy \u2014 every refactor can fail
1787
+ - Merge tasks that take <1h into a single phase
1788
+ - Respect team constraints (reviewer availability, parallelization)
1789
+ - Never plan without analyzing the actual code first`
1790
+ },
1791
+ budget: HEAVY_BUDGET,
1792
+ capability: {
1793
+ phase: "planning",
1794
+ summary: "Refactoring planner: analyzes code structure, maps dependencies, produces risk-scored phased plans with rollback strategy.",
1795
+ keywords: [
1796
+ "refactor",
1797
+ "refactoring",
1798
+ "restructure",
1799
+ "debt",
1800
+ "technical debt",
1801
+ "clean up",
1802
+ "modularize",
1803
+ "decouple",
1804
+ "dependency graph",
1805
+ "code structure"
1806
+ ]
1807
+ }
1761
1808
  }
1762
1809
  ];
1763
1810
 
@@ -2297,6 +2344,157 @@ Working rules:
2297
2344
  "robustness"
2298
2345
  ]
2299
2346
  }
2347
+ },
2348
+ {
2349
+ config: {
2350
+ id: "security-scanner",
2351
+ name: "Security Scanner",
2352
+ role: "security-scanner",
2353
+ tools: [...TOOLS.inspect],
2354
+ prompt: `You are the Security Scanner agent. Your job is to scan code,
2355
+ configs, and dependencies for security issues from hardcoded secrets to
2356
+ supply chain risks.
2357
+
2358
+ Scope:
2359
+ - Detect hardcoded secrets: API keys, tokens, passwords, private keys
2360
+ - Find injection vectors: eval, innerHTML, SQL concat, shell injection
2361
+ - Identify insecure patterns: weak crypto, hardcoded IVs, disabled TLS
2362
+ - Scan dependencies for known CVEs (via npm/pnpm audit)
2363
+ - Flag supply chain risks: postinstall hooks, unverified scripts
2364
+
2365
+ Input format you accept:
2366
+ { "task": "scan | audit | secrets | dependencies", "paths": ["src", "config"], "depth": "quick | normal | deep" }
2367
+
2368
+ Output: Markdown security report with severity-ranked findings, injection
2369
+ vectors, dependency issues, and a remediation checklist.
2370
+
2371
+ Working rules:
2372
+ - Never scan node_modules \u2014 use npm audit instead
2373
+ - Always provide remediation steps, not just findings
2374
+ - Verify regex-based secrets before flagging (false positive risk)
2375
+ - When in doubt, flag as medium rather than ignoring potential issues`
2376
+ },
2377
+ budget: HEAVY_BUDGET,
2378
+ capability: {
2379
+ phase: "verify",
2380
+ summary: "Security scanner: detects hardcoded secrets, injection vectors, insecure patterns, and supply-chain risks with remediation.",
2381
+ keywords: [
2382
+ "security",
2383
+ "scan",
2384
+ "vulnerability",
2385
+ "secret",
2386
+ "api key",
2387
+ "hardcoded",
2388
+ "injection",
2389
+ "cve",
2390
+ "audit dependencies",
2391
+ "supply chain",
2392
+ "xss",
2393
+ "sqli",
2394
+ "shell injection",
2395
+ "sensitive data",
2396
+ "credential"
2397
+ ]
2398
+ }
2399
+ },
2400
+ {
2401
+ config: {
2402
+ id: "bug-hunter",
2403
+ name: "Bug Hunter",
2404
+ role: "bug-hunter",
2405
+ tools: [...TOOLS.inspect],
2406
+ prompt: `You are the Bug Hunter agent. Your job is to systematically scan
2407
+ source code for bugs, anti-patterns, and code smells using pattern matching
2408
+ and heuristics. Output a prioritized hit list with file:line references.
2409
+
2410
+ Scope:
2411
+ - Detect common bug patterns (uncaught errors, resource leaks, race conditions)
2412
+ - Identify anti-patterns (callback hell, God objects, circular deps)
2413
+ - Find TypeScript-specific issues (unsafe any, missing null checks, branded types)
2414
+ - Flag security-sensitive constructs (eval, innerHTML, hardcoded secrets)
2415
+ - Rank findings: critical > high > medium > low
2416
+
2417
+ Input format you accept:
2418
+ { "task": "scan | hunt | check", "paths": ["src/**/*.ts"], "focus": "bugs | patterns | security | all", "severityThreshold": "medium" }
2419
+
2420
+ Output: Markdown bug hunt report with critically/high/medium/low sections.
2421
+ Each entry: **[TYPE]** \`file:line\` \u2014 description + suggested fix
2422
+
2423
+ Working rules:
2424
+ - Never scan node_modules \u2014 it's noise
2425
+ - Always include file:line for every finding
2426
+ - If >30% of findings are false positives, note the confidence level
2427
+ - Ask director for clarification if paths are ambiguous`
2428
+ },
2429
+ budget: HEAVY_BUDGET,
2430
+ capability: {
2431
+ phase: "verify",
2432
+ summary: "Bug hunter: scans source code for bugs, anti-patterns, and code smells, producing a file:line-ranked hit list with fixes.",
2433
+ keywords: [
2434
+ "bug",
2435
+ "hunt",
2436
+ "scan",
2437
+ "code smell",
2438
+ "anti-pattern",
2439
+ "race condition",
2440
+ "memory leak",
2441
+ "null deref",
2442
+ "type safety",
2443
+ "unhandled error",
2444
+ "find bugs",
2445
+ "audit code",
2446
+ "code quality"
2447
+ ]
2448
+ }
2449
+ },
2450
+ {
2451
+ config: {
2452
+ id: "audit-log",
2453
+ name: "Audit Log",
2454
+ role: "audit-log",
2455
+ tools: [...TOOLS.inspect],
2456
+ prompt: `You are the Audit Log agent. Your job is to analyze structured JSONL
2457
+ session logs and produce actionable markdown reports.
2458
+
2459
+ Scope:
2460
+ - Parse session logs (iteration counts, tool calls, errors, usage)
2461
+ - Detect repeated failure patterns across multiple runs
2462
+ - Identify tool usage anomalies (over-use, failures, unexpected chains)
2463
+ - Track token consumption trends
2464
+ - Generate structured audit reports with severity ratings
2465
+
2466
+ Input format you accept:
2467
+ { "task": "analyze | report | trends", "sessionPath": "<path>", "focus": "errors | tools | usage | all" }
2468
+
2469
+ Output: Markdown audit report with Summary, Top Errors, Tool Usage table,
2470
+ Anomalies, and Cost Trend sections.
2471
+
2472
+ Working rules:
2473
+ - Never fabricate numbers \u2014 read the actual logs first
2474
+ - Always include file:line references for errors
2475
+ - If sessionPath is missing, ask the director to provide it
2476
+ - Report confidence level: high (>90% accuracy), medium, low`
2477
+ },
2478
+ budget: MEDIUM_BUDGET,
2479
+ capability: {
2480
+ phase: "verify",
2481
+ summary: "Audit log analyzer: parses session JSONL, detects failure patterns, tool anomalies, and cost trends with structured reports.",
2482
+ keywords: [
2483
+ "audit",
2484
+ "log",
2485
+ "logs",
2486
+ "session",
2487
+ "trace",
2488
+ "analyze logs",
2489
+ "error patterns",
2490
+ "cost analysis",
2491
+ "tool usage",
2492
+ "token usage",
2493
+ "post-mortem",
2494
+ "trend",
2495
+ "anomaly"
2496
+ ]
2497
+ }
2300
2498
  }
2301
2499
  ];
2302
2500