@wrongstack/core 0.9.19 → 0.10.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.
Files changed (73) hide show
  1. package/README.md +37 -33
  2. package/dist/{agent-bridge-DMVOX0cF.d.ts → agent-bridge-DBBGP5O4.d.ts} +1 -1
  3. package/dist/{agent-subagent-runner-C4qt9e5Y.d.ts → agent-subagent-runner-KwufTWwn.d.ts} +3 -4
  4. package/dist/compactor-D1RHFRmF.d.ts +41 -0
  5. package/dist/{config-CWva0qoL.d.ts → config-CJXBka2r.d.ts} +38 -2
  6. package/dist/{context-BRNbHmRM.d.ts → context-7u93AcGD.d.ts} +140 -0
  7. package/dist/coordination/index.d.ts +13 -13
  8. package/dist/coordination/index.js +786 -200
  9. package/dist/coordination/index.js.map +1 -1
  10. package/dist/{default-config-Uzla85H-.d.ts → default-config-DEXI4jsl.d.ts} +10 -1
  11. package/dist/defaults/index.d.ts +24 -24
  12. package/dist/defaults/index.js +1612 -528
  13. package/dist/defaults/index.js.map +1 -1
  14. package/dist/{events-CiG9qUM_.d.ts → events-Bw1K5E6K.d.ts} +49 -1
  15. package/dist/execution/index.d.ts +46 -32
  16. package/dist/execution/index.js +663 -169
  17. package/dist/execution/index.js.map +1 -1
  18. package/dist/extension/index.d.ts +6 -6
  19. package/dist/extension/index.js.map +1 -1
  20. package/dist/goal-store-BeRsj7YX.d.ts +188 -0
  21. package/dist/{index-p95HQ22A.d.ts → index-DIt5TIaF.d.ts} +8 -8
  22. package/dist/{index-aizK8olO.d.ts → index-DgQWnZxP.d.ts} +11 -8
  23. package/dist/index.d.ts +338 -41
  24. package/dist/index.js +2747 -787
  25. package/dist/index.js.map +1 -1
  26. package/dist/infrastructure/index.d.ts +6 -6
  27. package/dist/infrastructure/index.js +36 -0
  28. package/dist/infrastructure/index.js.map +1 -1
  29. package/dist/kernel/index.d.ts +9 -9
  30. package/dist/kernel/index.js +57 -8
  31. package/dist/kernel/index.js.map +1 -1
  32. package/dist/{mcp-servers-BkVEqkRe.d.ts → mcp-servers-BgINZzuo.d.ts} +25 -3
  33. package/dist/models/index.d.ts +3 -3
  34. package/dist/models/index.js +164 -11
  35. package/dist/models/index.js.map +1 -1
  36. package/dist/models-registry-gwMAo6E3.d.ts +86 -0
  37. package/dist/{multi-agent-3ZnTB1aT.d.ts → multi-agent-C1O8EFzb.d.ts} +77 -24
  38. package/dist/{multi-agent-coordinator-bRaI_aD1.d.ts → multi-agent-coordinator-DoVSBFNx.d.ts} +20 -2
  39. package/dist/{null-fleet-bus-DKM3Iy9d.d.ts → null-fleet-bus-T-s3JaOt.d.ts} +413 -110
  40. package/dist/observability/index.d.ts +2 -2
  41. package/dist/{path-resolver-TcJfc29Y.d.ts → path-resolver-BfyK-I7w.d.ts} +2 -2
  42. package/dist/{permission-bPuzAy4x.d.ts → permission-B6sldrSp.d.ts} +1 -1
  43. package/dist/{permission-policy-BUQSutpl.d.ts → permission-policy-CtNscWOA.d.ts} +10 -9
  44. package/dist/{plan-templates-fkQTyz3U.d.ts → plan-templates-BWs6Je7j.d.ts} +8 -8
  45. package/dist/{provider-runner-BEpikbbN.d.ts → provider-runner-BmPe2RuU.d.ts} +3 -3
  46. package/dist/{retry-policy-BYkq0ugs.d.ts → retry-policy-KF18W4dg.d.ts} +1 -1
  47. package/dist/sdd/index.d.ts +9 -10
  48. package/dist/sdd/index.js +350 -122
  49. package/dist/sdd/index.js.map +1 -1
  50. package/dist/security/index.d.ts +65 -4
  51. package/dist/security/index.js +67 -19
  52. package/dist/security/index.js.map +1 -1
  53. package/dist/{selector-pox8abg0.d.ts → selector-DmXxpFyM.d.ts} +1 -1
  54. package/dist/{session-reader-CSWcb5Ga.d.ts → session-reader-CCSBfQmd.d.ts} +2 -2
  55. package/dist/skills/index.d.ts +1 -1
  56. package/dist/skills/index.js +1 -1
  57. package/dist/skills/index.js.map +1 -1
  58. package/dist/storage/index.d.ts +392 -8
  59. package/dist/storage/index.js +796 -40
  60. package/dist/storage/index.js.map +1 -1
  61. package/dist/{system-prompt-Bs-Wliab.d.ts → system-prompt-CM6zOhd2.d.ts} +19 -1
  62. package/dist/{tool-executor-Boo3dekH.d.ts → tool-executor-D7RxLtg4.d.ts} +9 -4
  63. package/dist/types/index.d.ts +16 -16
  64. package/dist/types/index.js +404 -14
  65. package/dist/types/index.js.map +1 -1
  66. package/dist/utils/index.d.ts +40 -8
  67. package/dist/utils/index.js +127 -57
  68. package/dist/utils/index.js.map +1 -1
  69. package/dist/{wstack-paths-BCgmTNlG.d.ts → wstack-paths-eMXnY1_X.d.ts} +8 -0
  70. package/package.json +1 -1
  71. package/dist/compactor-DVTKL7XD.d.ts +0 -23
  72. package/dist/goal-store-C7jcumEh.d.ts +0 -96
  73. package/dist/models-registry-OG_30xqZ.d.ts +0 -46
package/dist/index.d.ts CHANGED
@@ -1,68 +1,68 @@
1
- import { S as SystemPromptBuilder, c as ModelCapabilities, a as BuildContext, C as Container } from './system-prompt-Bs-Wliab.js';
2
- export { B as BindOptions, D as Decorator, F as Factory, M as Middleware, b as MiddlewareHandler, N as NextFn, P as Pipeline, d as PipelineOptions, e as Renderer, T as Token } from './system-prompt-Bs-Wliab.js';
3
- import { E as EventBus, c as EventName, L as Listener } from './events-CiG9qUM_.js';
4
- export { a as EventLogger, b as EventMap, S as ScopedEventBus } from './events-CiG9qUM_.js';
5
- import { d as WorktreeManager } from './index-p95HQ22A.js';
6
- export { A as AllocateOpts, M as MergeOpts, a as MergeResult, R as RunController, b as RunControllerOptions, T as TOKENS, W as WorktreeHandle, e as WorktreeManagerOptions, c as WorktreeRunResult, f as WorktreeStatus, g as assertSafePath } from './index-p95HQ22A.js';
7
- import { d as Context, m as Provider, Q as Tool, c as ContentBlock, T as TextBlock } from './context-BRNbHmRM.js';
8
- export { A as AgentError, a as Capabilities, b as ConfigError, e as ContextInit, f as ConversationState, E as ERROR_CODES, g as ErrorCode, h as ErrorSeverity, i as ErrorSubsystem, F as FileSnapshot, j as FsError, I as ImageBlock, J as JSONSchema, M as Message, k as MessageRole, P as Permission, l as PluginError, n as ProviderError, o as ProviderErrorBody, R as ReadonlyConversationState, p as Request, q as Response, r as ResumedSession, s as RiskTier, t as RunEnv, u as RunOptions, S as SessionData, v as SessionError, w as SessionEvent, x as SessionMetadata, y as SessionStore, z as SessionSummary, B as SessionWriter, D as StateChange, G as StateChangeHandler, H as StopReason, K as StreamEvent, L as ThinkingBlock, N as TodoItem, O as TokenCounter, U as ToolCallContext, V as ToolError, W as ToolFinalEvent, X as ToolProgressEvent, Y as ToolResultBlock, Z as ToolStreamEvent, _ as ToolUseBlock, $ as Usage, a0 as WrongStackError, a1 as asBlocks, a2 as asText, a3 as extractRunEnv, a4 as isAgentError, a5 as isConfigError, a6 as isFsError, a7 as isImageBlock, a8 as isPluginError, a9 as isSessionError, aa as isTextBlock, ab as isThinkingBlock, ac as isToolError, ad as isToolResultBlock, ae as isToolUseBlock, af as isWrongStackError, ag as toWrongStackError, ah as wrapAsState } from './context-BRNbHmRM.js';
9
- export { P as ProviderRunner, R as RunProviderOptions } from './provider-runner-BEpikbbN.js';
10
- import { M as MCPServerConfig, a as Config, c as ConfigStore } from './config-CWva0qoL.js';
11
- export { A as AutonomyConfig, C as CONTEXT_WINDOW_MODES, b as ConfigLoader, d as ContextConfig, e as ContextWindowAggressiveOn, f as ContextWindowConfigLike, g as ContextWindowMode, h as ContextWindowModeId, i as ContextWindowPolicy, j as ContextWindowThresholds, D as DEFAULT_CONTEXT_WINDOW_MODE_ID, F as FeaturesConfig, L as LogConfig, P as PluginConfig, k as ProviderApiKey, l as ProviderConfig, S as SyncCategory, m as SyncConfig, T as ToolsConfig, n as formatContextWindowModeList, o as getContextWindowMode, p as isContextWindowModeId, q as listContextWindowModes, r as resolveContextWindowPolicy } from './config-CWva0qoL.js';
12
- export { C as CompactReport, a as Compactor } from './compactor-DVTKL7XD.js';
13
- export { P as PermissionDecision, a as PermissionPolicy, T as TrustPolicy } from './permission-bPuzAy4x.js';
1
+ import { S as SystemPromptBuilder, c as ModelCapabilities, a as BuildContext, C as Container } from './system-prompt-CM6zOhd2.js';
2
+ export { B as BindOptions, D as Decorator, F as Factory, M as Middleware, b as MiddlewareHandler, N as NextFn, P as Pipeline, d as PipelineOptions, e as Renderer, T as Token } from './system-prompt-CM6zOhd2.js';
3
+ import { E as EventBus, c as EventName, L as Listener } from './events-Bw1K5E6K.js';
4
+ export { a as EventLogger, b as EventMap, S as ScopedEventBus } from './events-Bw1K5E6K.js';
5
+ import { d as WorktreeManager } from './index-DIt5TIaF.js';
6
+ export { A as AllocateOpts, M as MergeOpts, a as MergeResult, R as RunController, b as RunControllerOptions, T as TOKENS, W as WorktreeHandle, e as WorktreeManagerOptions, c as WorktreeRunResult, f as WorktreeStatus, g as assertSafePath } from './index-DIt5TIaF.js';
7
+ import { d as Context, m as Provider, Q as Tool, p as Request, q as Response, c as ContentBlock, T as TextBlock } from './context-7u93AcGD.js';
8
+ export { A as AgentError, a as Capabilities, b as ConfigError, e as ContextInit, f as ConversationState, E as ERROR_CODES, g as ErrorCode, h as ErrorSeverity, i as ErrorSubsystem, F as FileSnapshot, j as FsError, I as ImageBlock, J as JSONSchema, M as Message, k as MessageRole, P as Permission, l as PluginError, n as ProviderError, o as ProviderErrorBody, R as ReadonlyConversationState, r as ResumedSession, s as RiskTier, t as RunEnv, u as RunOptions, S as SessionData, v as SessionError, w as SessionEvent, x as SessionMetadata, y as SessionStore, z as SessionSummary, B as SessionWriter, D as StateChange, G as StateChangeHandler, H as StopReason, K as StreamEvent, L as ThinkingBlock, N as TodoItem, O as TokenCounter, U as ToolCallContext, V as ToolError, W as ToolFinalEvent, X as ToolProgressEvent, Y as ToolResultBlock, Z as ToolStreamEvent, _ as ToolUseBlock, $ as Usage, a0 as WrongStackError, a1 as asBlocks, a2 as asText, a3 as extractRunEnv, a4 as isAgentError, a5 as isConfigError, a6 as isFsError, a7 as isImageBlock, a8 as isPluginError, a9 as isSessionError, aa as isTextBlock, ab as isThinkingBlock, ac as isToolError, ad as isToolResultBlock, ae as isToolUseBlock, af as isWrongStackError, ag as toWrongStackError, ah as wrapAsState } from './context-7u93AcGD.js';
9
+ import { P as ProviderRunner, R as RunProviderOptions$1 } from './provider-runner-BmPe2RuU.js';
10
+ import { M as MCPServerConfig, a as Config, c as ConfigStore } from './config-CJXBka2r.js';
11
+ export { A as AutonomyConfig, C as CONTEXT_WINDOW_MODES, b as ConfigLoader, d as ContextConfig, e as ContextWindowAggressiveOn, f as ContextWindowConfigLike, g as ContextWindowMode, h as ContextWindowModeId, i as ContextWindowPolicy, j as ContextWindowThresholds, D as DEFAULT_CONTEXT_WINDOW_MODE_ID, F as FeaturesConfig, L as LogConfig, P as PluginConfig, k as ProviderApiKey, l as ProviderConfig, S as SessionLoggingConfig, m as SyncCategory, n as SyncConfig, T as ToolsConfig, o as formatContextWindowModeList, p as getContextWindowMode, q as isContextWindowModeId, r as listContextWindowModes, s as resolveContextWindowPolicy } from './config-CJXBka2r.js';
12
+ export { C as CompactReport, a as Compactor } from './compactor-D1RHFRmF.js';
13
+ export { P as PermissionDecision, a as PermissionPolicy, T as TrustPolicy } from './permission-B6sldrSp.js';
14
14
  export { C as CheckpointInfo, R as RewindResult, a as RewindResultExtended, S as SessionRewinder } from './session-rewinder-C9HnMkhP.js';
15
- import { e as AttachmentStore, d as AttachmentRef, A as AddAttachmentInput } from './session-reader-CSWcb5Ga.js';
16
- export { a as Attachment, b as AttachmentKind, c as AttachmentMeta, D as DefaultSessionReader } from './session-reader-CSWcb5Ga.js';
17
- export { D as DEFAULT_AUTONOMY_CONFIG, a as DEFAULT_CONTEXT_CONFIG, b as DEFAULT_TOOLS_CONFIG } from './default-config-Uzla85H-.js';
15
+ import { e as AttachmentStore, d as AttachmentRef, A as AddAttachmentInput } from './session-reader-CCSBfQmd.js';
16
+ export { a as Attachment, b as AttachmentKind, c as AttachmentMeta, D as DefaultSessionReader, f as DefaultSessionReaderOptions, S as SessionReader } from './session-reader-CCSBfQmd.js';
17
+ export { D as DEFAULT_AUTONOMY_CONFIG, a as DEFAULT_CONTEXT_CONFIG, b as DEFAULT_SESSION_LOGGING_CONFIG, c as DEFAULT_TOOLS_CONFIG } from './default-config-DEXI4jsl.js';
18
18
  export { D as DefaultSecretScrubber, a as DefaultSecretVault, S as SecretVaultOptions, d as decryptConfigSecrets, e as encryptConfigSecrets, m as migratePlaintextSecrets, r as rewriteConfigEncrypted } from './secret-scrubber-7rSC_emZ.js';
19
19
  export { D as DefaultLogger, a as DefaultLoggerOptions } from './logger-bOzkF5LL.js';
20
- export { D as DefaultPathResolver, a as DefaultTokenCounter } from './path-resolver-TcJfc29Y.js';
20
+ export { D as DefaultPathResolver, a as DefaultTokenCounter } from './path-resolver-BfyK-I7w.js';
21
21
  import { b as MemoryStore } from './memory-CEXuo7sz.js';
22
22
  export { M as MemoryEntry, a as MemoryScope } from './memory-CEXuo7sz.js';
23
- export { C as CompactorOptions, D as DEFAULT_RECOVERY_STRATEGIES, a as DefaultErrorHandler, b as DefaultRetryPolicy, H as HybridCompactor, R as RecoveryStrategy, T as ToolExecutor, c as buildRecoveryStrategies } from './tool-executor-Boo3dekH.js';
23
+ export { C as CompactorOptions, D as DEFAULT_RECOVERY_STRATEGIES, a as DefaultErrorHandler, b as DefaultRetryPolicy, H as HybridCompactor, R as RecoveryStrategy, T as ToolExecutor, c as buildRecoveryStrategies } from './tool-executor-D7RxLtg4.js';
24
24
  import { a as SkillLoader } from './skill-CxuWrsKK.js';
25
25
  export { S as SkillEntry, b as SkillManifest } from './skill-CxuWrsKK.js';
26
26
  export { I as InputReader, P as PromptOption } from './input-reader-E-ffP2ee.js';
27
- import { u as SlashCommand, w as SystemPromptContributor, k as PluginAPI, n as PluginPipelines, C as ToolRegistryView, r as ProviderRegistryView, M as MCPRegistryView, v as SlashCommandRegistryView, E as ExtensionRegistry, S as SessionWriterView, j as MetricsSinkView, z as ToolRegistry, q as ProviderRegistry, P as Plugin } from './index-aizK8olO.js';
28
- export { A as AfterIterationHook, a as AfterRunHook, b as AfterToolExecutionHook, c as Agent, d as AgentExtension, e as AgentInit, f as AgentInput, g as AgentPipelines, B as BeforeIterationHook, h as BeforeRunHook, i as BeforeToolExecutionHook, D as DEFAULT_MAX_ITERATIONS, O as OnErrorHook, l as PluginCapabilities, m as PluginDependency, p as ProviderFactory, t as ProviderRunnerWrapper, R as RunResult, F as ToolWrapper, U as UserInputPayload, G as createDefaultPipelines } from './index-aizK8olO.js';
29
- export { D as DefaultModelsRegistry, a as DefaultModelsRegistryOptions, c as classifyFamily } from './models-registry-OG_30xqZ.js';
27
+ import { u as SlashCommand, w as SystemPromptContributor, k as PluginAPI, n as PluginPipelines, F as ToolRegistryView, r as ProviderRegistryView, M as MCPRegistryView, v as SlashCommandRegistryView, E as ExtensionRegistry, S as SessionWriterView, j as MetricsSinkView, C as ToolRegistry, q as ProviderRegistry, P as Plugin, x as ToolCallPipelinePayload } from './index-DgQWnZxP.js';
28
+ export { A as AfterIterationHook, a as AfterRunHook, b as AfterToolExecutionHook, c as Agent, d as AgentExtension, e as AgentInit, f as AgentInput, g as AgentPipelines, B as BeforeIterationHook, h as BeforeRunHook, i as BeforeToolExecutionHook, D as DEFAULT_MAX_ITERATIONS, O as OnErrorHook, l as PluginCapabilities, m as PluginDependency, p as ProviderFactory, t as ProviderRunnerWrapper, R as RunResult, G as ToolWrapper, U as UserInputPayload, H as createDefaultPipelines } from './index-DgQWnZxP.js';
29
+ export { D as DefaultModelsRegistry, a as DefaultModelsRegistryOptions, c as classifyFamily } from './models-registry-gwMAo6E3.js';
30
30
  import { c as ModeStore } from './mode-CV077NjV.js';
31
31
  export { D as DEFAULT_MODES, M as Mode, a as ModeConfig, b as ModeManifest } from './mode-CV077NjV.js';
32
- export { I as InMemoryAgentBridge, a as InMemoryBridgeTransport, c as createMessage } from './agent-bridge-DMVOX0cF.js';
33
- export { c as BudgetExceededError, d as BudgetKind, e as BudgetLimits, j as BudgetUsage, C as CoordinatorEvents, k as CoordinatorStatus, D as DoneCondition, M as MultiAgentConfig, l as MultiAgentCoordinator, S as SpawnResult, m as SubagentBudget, n as SubagentConfig, o as SubagentContext, p as SubagentError, q as SubagentErrorKind, r as SubagentRunContext, s as SubagentRunOutcome, t as SubagentRunner, T as TaskDelegation, u as TaskResult, v as TaskSpec } from './multi-agent-3ZnTB1aT.js';
32
+ export { I as InMemoryAgentBridge, a as InMemoryBridgeTransport, c as createMessage } from './agent-bridge-DBBGP5O4.js';
33
+ export { c as BudgetExceededError, d as BudgetKind, e as BudgetLimits, j as BudgetUsage, C as CoordinatorEvents, k as CoordinatorStatus, D as DoneCondition, M as MultiAgentConfig, l as MultiAgentCoordinator, S as SpawnResult, m as SubagentBudget, n as SubagentConfig, o as SubagentContext, p as SubagentError, q as SubagentErrorKind, r as SubagentRunContext, s as SubagentRunOutcome, t as SubagentRunner, T as TaskDelegation, u as TaskResult, v as TaskSpec } from './multi-agent-C1O8EFzb.js';
34
34
  import { l as TaskGraph, r as TaskType, n as TaskPriority, m as TaskNode } from './task-graph-D1YQbpxF.js';
35
35
  export { C as CriticalPathResult, D as DEFAULT_SPEC_TEMPLATE, S as SpecAnalysis, a as SpecApiEndpoint, b as SpecRequirement, c as SpecSection, d as SpecSectionType, e as SpecStatus, f as SpecTemplate, g as SpecValidationResult, h as Specification, T as TaskAssignment, i as TaskDependency, j as TaskEdge, k as TaskFilter, o as TaskProgress, p as TaskSort, q as TaskStatus, s as computeTaskProgress, t as findCriticalPath, u as topologicalSort } from './task-graph-D1YQbpxF.js';
36
- import { e as MetricsSink, b as HealthRegistry } from './observability-BhnVLBLS.js';
37
- export { A as AggregateHealth, H as HealthCheck, a as HealthCheckResult, c as HealthStatus, M as MetricLabels, d as MetricSeries, f as MetricsSnapshot, S as Span, T as Tracer } from './observability-BhnVLBLS.js';
38
- export { AtomicWriteOptions, BuildChildEnvOptions, CompileFail, CompileResult, MessageRepairReport, MessageRepairResult, NewlineStyle, RequestTokenBreakdown, SafeParseResult, ToolOutputSerializerOptions, UnifiedDiffOptions, ValidationError, ValidationResult, atomicWrite, buildChildEnv, color, compileGlob, compileUserRegex, completePartialObject, createToolOutputSerializer, detectNewlineStyle, ensureDir, estimateRequestTokens, estimateTextTokens, estimateToolDefTokens, estimateToolInputTokens, estimateToolResultTokens, formatTodosList, matchAny, matchGlob, normalizeToLf, repairToolUseAdjacency, safeParse, safeStringify, sanitizeJsonString, stripAnsi, toStyle, unifiedDiff, validateAgainstSchema } from './utils/index.js';
39
- import { a as WstackPaths } from './wstack-paths-BCgmTNlG.js';
40
- export { W as WstackPathOptions, p as projectHash, r as resolveWstackPaths } from './wstack-paths-BCgmTNlG.js';
41
- export { A as AbandonedSession, a as AttachmentStoreOptions, C as ConfigLoaderOptions, b as ConfigMigration, c as ConfigMigrationError, d as ConfigSource, D as DEFAULT_CONFIG_MIGRATIONS, e as DefaultAttachmentStore, f as DefaultConfigLoader, g as DefaultConfigStore, h as DefaultMemoryStore, i as DefaultSessionStore, M as MemoryStoreOptions, j as MigrationContext, k as MigrationResult, P as PersistedQueueItem, l as PlanFile, m as PlanItem, n as PlanTemplate, Q as QueueStore, R as RecoveryLock, o as RecoveryLockOptions, S as SessionAnalyzer, p as SessionStoreOptions, T as TodosCheckpointFile, q as addPlanItem, r as attachPlanCheckpoint, s as attachTodosCheckpoint, t as clearPlan, u as deriveTodosFromPlanItem, v as emptyPlan, w as formatPlan, x as formatPlanTemplates, y as getPlanTemplate, z as listPlanTemplates, B as loadPlan, E as loadTodosCheckpoint, F as removePlanItem, G as runConfigMigrations, H as savePlan, I as saveTodosCheckpoint, J as setPlanItemStatus } from './plan-templates-fkQTyz3U.js';
36
+ import { T as Tracer, e as MetricsSink, b as HealthRegistry } from './observability-BhnVLBLS.js';
37
+ export { A as AggregateHealth, H as HealthCheck, a as HealthCheckResult, c as HealthStatus, M as MetricLabels, d as MetricSeries, f as MetricsSnapshot, S as Span } from './observability-BhnVLBLS.js';
38
+ export { AtomicWriteOptions, BuildChildEnvOptions, CompileFail, CompileResult, MessageRepairReport, MessageRepairResult, NewlineStyle, RequestTokenBreakdown, SafeParseResult, ToolOutputSerializerOptions, UnifiedDiffOptions, ValidationError, ValidationResult, atomicWrite, buildChildEnv, color, compileGlob, compileUserRegex, completePartialObject, createToolOutputSerializer, detectNewlineStyle, ensureDir, estimateRequestTokens, estimateTextTokens, estimateToolDefTokens, estimateToolInputTokens, estimateToolResultTokens, formatTodosList, matchAny, matchGlob, mergeModelsPayload, normalizeToLf, repairToolUseAdjacency, safeParse, safeStringify, sanitizeJsonString, stripAnsi, toStyle, unifiedDiff, validateAgainstSchema } from './utils/index.js';
39
+ import { a as WstackPaths } from './wstack-paths-eMXnY1_X.js';
40
+ export { W as WstackPathOptions, p as projectHash, r as resolveWstackPaths } from './wstack-paths-eMXnY1_X.js';
41
+ export { A as AbandonedSession, a as AttachmentStoreOptions, C as ConfigLoaderOptions, b as ConfigMigration, c as ConfigMigrationError, d as ConfigSource, D as DEFAULT_CONFIG_MIGRATIONS, e as DefaultAttachmentStore, f as DefaultConfigLoader, g as DefaultConfigStore, h as DefaultMemoryStore, i as DefaultSessionStore, M as MemoryStoreOptions, j as MigrationContext, k as MigrationResult, P as PersistedQueueItem, l as PlanFile, m as PlanItem, n as PlanTemplate, Q as QueueStore, R as RecoveryLock, o as RecoveryLockOptions, S as SessionAnalyzer, p as SessionStoreOptions, T as TodosCheckpointFile, q as addPlanItem, r as attachPlanCheckpoint, s as attachTodosCheckpoint, t as clearPlan, u as deriveTodosFromPlanItem, v as emptyPlan, w as formatPlan, x as formatPlanTemplates, y as getPlanTemplate, z as listPlanTemplates, B as loadPlan, E as loadTodosCheckpoint, F as removePlanItem, G as runConfigMigrations, H as savePlan, I as saveTodosCheckpoint, J as setPlanItemStatus } from './plan-templates-BWs6Je7j.js';
42
+ export { A as AuditLevel, C as CORE_RECONSTRUCT_EVENTS, G as GoalFile, J as JournalEntry, M as MAX_JOURNAL_ENTRIES, S as STANDARD_AUDIT_EVENTS, a as SessionEventBridge, b as SessionEventBridgeOptions, c as SessionSamplingOptions, T as ToolProgressSamplingOptions, d as appendJournal, e as createSessionEventBridge, f as emptyGoal, g as formatGoal, h as goalFilePath, l as loadGoal, r as resolveAuditLevel, i as resolveSessionLoggingConfig, s as saveGoal, j as summarizeUsage } from './goal-store-BeRsj7YX.js';
42
43
  export { D as DirectorStateCheckpoint, a as DirectorStateSnapshot, b as DirectorSubagentState, c as DirectorTaskState, l as loadDirectorState } from './director-state-BmYi3DGA.js';
43
- export { A as AutoApprovePermissionPolicy, D as DefaultPermissionPolicy, P as PermissionPolicyOptions } from './permission-policy-BUQSutpl.js';
44
+ export { A as AutoApprovePermissionPolicy, D as DefaultPermissionPolicy, P as PermissionPolicyOptions } from './permission-policy-CtNscWOA.js';
44
45
  export { AutoCompactionMiddleware, AutonomousRunner, AutonomousRunnerOptions, AutonomyPromptContributorOptions, DefaultSkillLoader, DoneCheckResult, DoneConditionChecker, EternalAutonomyEngine, EternalAutonomyOptions, EternalEngineState, IntelligentCompactor, IntelligentCompactorOptions, ParallelEngineState, ParallelEternalEngine, ParallelEternalOptions, SelectiveCompactor, SelectiveCompactorOptions, SkillLoaderOptions, buildGoalPreamble, makeAutonomyPromptContributor } from './execution/index.js';
45
46
  export { DefaultProviderRunner } from './defaults/index.js';
46
- 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, C as CreateDelegateToolOptions, D as DEFAULT_DIRECTOR_PREAMBLE, h as DEFAULT_SUBAGENT_BASELINE, i as DelegateHost, j as Director, k as DirectorPromptParts, l as DirectorSessionFactory, m as DirectorSessionFactoryOptions, F as FLEET_ROSTER, n as FLEET_ROSTER_BUDGETS, o as FLEET_ROSTER_WITHACP, p as FleetCostCapError, q as FleetManager, r as FleetManagerOptions, s as FleetRosterBudget, t as FleetSpawnBudgetError, I as ICoordinator, u as IFleetManager, N 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, E as createDelegateTool, G as getAgentDefinition, H as makeAskTool, J as makeAssignTool, K as makeAwaitTasksTool, L as makeCollabDebugTool, M as makeDirectorSessionFactory, O as makeFleetEmitTool, P as makeFleetHealthTool, Q as makeFleetSessionTool, T as makeFleetStatusTool, U as makeFleetUsageTool, V as makeRollUpTool, W as makeSpawnTool, X as makeTerminateTool, Y as rosterSummaryFromConfigs } from './null-fleet-bus-DKM3Iy9d.js';
47
- 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-bRaI_aD1.js';
48
- export { A as AgentFactory, a as AgentFactoryResult, b as AgentRunnerOptions, F as FleetBus, c as FleetEvent, d as FleetHandler, e as FleetUsage, f as FleetUsageAggregator, S as SubagentUsageSnapshot, m as makeAgentSubagentRunner } from './agent-subagent-runner-C4qt9e5Y.js';
47
+ 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, N as NULL_FLEET_BUS, R as REFACTOR_PLANNER_AGENT, S as SECURITY_SCANNER_AGENT, U as SubagentPromptParts, V as applyRosterBudget, W as attachAutoExtend, X as composeDirectorPrompt, Y as composeSubagentPrompt, Z as createDelegateTool, _ as getAgentDefinition, $ as makeAskTool, a0 as makeAssignTool, a1 as makeAwaitTasksTool, a2 as makeCollabDebugTool, a3 as makeDirectorSessionFactory, a4 as makeFleetEmitTool, a5 as makeFleetHealthTool, a6 as makeFleetSessionTool, a7 as makeFleetStatusTool, a8 as makeFleetUsageTool, a9 as makeRollUpTool, aa as makeSpawnTool, ab as makeTerminateTool, ad as rosterSummaryFromConfigs } from './null-fleet-bus-T-s3JaOt.js';
48
+ 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-DoVSBFNx.js';
49
+ export { A as AgentFactory, a as AgentFactoryResult, b as AgentRunnerOptions, F as FleetBus, c as FleetEvent, d as FleetHandler, e as FleetUsage, f as FleetUsageAggregator, S as SubagentUsageSnapshot, m as makeAgentSubagentRunner } from './agent-subagent-runner-KwufTWwn.js';
49
50
  export { DefaultModeStore, LLMSelector, LLMSelectorOptions, ModeLoaderOptions, loadProjectModes, loadUserModes } from './models/index.js';
50
51
  import { TaskStore } from './sdd/index.js';
51
52
  export { AISpecBuilder, AISpecBuilderOptions, AISpecPhase, AISpecSession, AutoExecutor, AutoExecutorOptions, BottleneckTask, CollectedAnswer, CriticalPathAnalysis, DefaultTaskStore, ExecutionSummary, GeneratedTask, SPEC_TEMPLATES, SddParallelRun, SddParallelRunOptions, SddProgress, SddTaskDecomposer, SddTaskDecomposerOptions, SpecDiff, SpecDrivenDev, SpecDrivenDevOptions, SpecIndexEntry, SpecParser, SpecStore, SpecStoreOptions, SpecVersion, SpecVersioning, TaskBatch, TaskExecutionContext, TaskExecutionResult, TaskFlow, TaskFlowEventMap, TaskFlowEventName, TaskFlowExecutionContext, TaskFlowOptions, TaskFlowPhase, TaskGenerator, TaskGeneratorOptions, TaskGraphIndexEntry, TaskGraphStore, TaskGraphStoreOptions, TaskTracker, TaskTrackerOptions, TaskTransition, WaveResult, analyzeCriticalPath, createAutoExecutor, getTemplate, listTemplates, renderProgress, renderSpecAnalysis, renderTaskGraph, renderTaskList, templateToMarkdown } from './sdd/index.js';
52
53
  export { DefaultHealthRegistry, InMemoryMetricsSink, MetricsServerHandle, MetricsServerOptions, NoopMetricsSink, NoopTracer, OTelTracer, OtlpMetricsExporterHandle, OtlpMetricsExporterOptions, OtlpTraceExporterHandle, OtlpTraceExporterOptions, PROMETHEUS_CONTENT_TYPE, buildOtlpMetricsRequest, buildOtlpTracesRequest, renderPrometheus, startMetricsServer, startOtlpMetricsExporter, startOtlpTraceExporter, wireMetricsToEvents } from './observability/index.js';
53
- export { C as ContextManagerAction, a as ContextManagerInput, b as ContextManagerResult, c as ContextManagerToolOptions, d as allServers, e as awsServer, f as blockServer, g as braveSearchServer, h as context7Server, i as contextManagerTool, j as createContextManagerTool, k as everArtServer, l as filesystemServer, m as githubServer, n as googleMapsServer, o as miniMaxVisionServer, s as sentinelServer, p as slackServer, z as zaiVisionServer } from './mcp-servers-BkVEqkRe.js';
54
+ export { C as ContextManagerAction, a as ContextManagerInput, b as ContextManagerResult, c as ContextManagerToolOptions, d as allServers, e as awsServer, f as blockServer, g as braveSearchServer, h as context7Server, i as contextManagerTool, j as createContextManagerTool, k as everArtServer, l as filesystemServer, m as githubServer, n as googleMapsServer, o as miniMaxVisionServer, s as sentinelServer, p as slackServer, z as zaiVisionServer } from './mcp-servers-BgINZzuo.js';
54
55
  export { DownloadResult, InstallResult, InstalledSkillEntry, ManifestData, ParsedRef, SkillInstaller, SkillInstallerOptions, SkillManifestStore, UpdateResult, downloadGitHubTarball, parseSkillRef } from './skills/index.js';
55
- import { DefaultPromptStore } from './storage/index.js';
56
- export { ALL_SYNC_CATEGORIES, CloudSync, DefaultSessionRewinder, PromptEntry, PromptStore, SessionRewinderOptions, SyncResult } from './storage/index.js';
57
- export { G as GoalFile, J as JournalEntry, M as MAX_JOURNAL_ENTRIES, a as appendJournal, e as emptyGoal, f as formatGoal, g as goalFilePath, l as loadGoal, s as saveGoal, b as summarizeUsage } from './goal-store-C7jcumEh.js';
58
- import { a as RetryPolicy, E as ErrorHandler } from './retry-policy-BYkq0ugs.js';
56
+ import { ReplayLogStore, DefaultPromptStore } from './storage/index.js';
57
+ export { ALL_SYNC_CATEGORIES, Annotation, AnnotationsStore, AnnotationsStoreOptions, AuditEntry, CloudSync, DefaultSessionRewinder, PromptEntry, PromptStore, RecoveryPlan, ReplayEntry, ReplayLogStoreOptions, SessionRecovery, SessionRewinderOptions, StaleSession, SyncResult, ToolAuditLog, ToolAuditLogOptions, VerifyResult } from './storage/index.js';
58
+ import { a as RetryPolicy, E as ErrorHandler } from './retry-policy-KF18W4dg.js';
59
59
  import { a as Logger } from './logger-DDd5C--Z.js';
60
60
  export { L as LogLevel } from './logger-DDd5C--Z.js';
61
61
  export { M as ModelsDevPayload, a as ModelsDevProvider, b as ModelsRegistry, R as ResolvedModel, c as ResolvedProvider, W as WireFamily } from './models-registry-BcYJDKLm.js';
62
62
  export { S as SecretVault } from './secret-vault-DoISxaKO.js';
63
63
  export { S as SecretScrubber } from './secret-scrubber-3MHDDAtm.js';
64
64
  import './path-resolver-CPRj4bFY.js';
65
- import './selector-pox8abg0.js';
65
+ import './selector-DmXxpFyM.js';
66
66
  import 'node:events';
67
67
 
68
68
  /**
@@ -304,7 +304,6 @@ declare class SecurityScannerOrchestrator {
304
304
  private readonly retryPolicy?;
305
305
  private readonly errorHandler?;
306
306
  private detector;
307
- private reportGenerator;
308
307
  private gitignoreUpdater;
309
308
  constructor(retryPolicy?: RetryPolicy | undefined, errorHandler?: ErrorHandler | undefined);
310
309
  /**
@@ -400,6 +399,24 @@ interface CreateMcpControlToolOptions {
400
399
  }
401
400
  declare function createMcpControlTool(opts: CreateMcpControlToolOptions): Tool;
402
401
 
402
+ interface RunProviderOptions {
403
+ provider: Provider;
404
+ request: Request;
405
+ signal: AbortSignal;
406
+ ctx: Context;
407
+ events: EventBus;
408
+ retry: RetryPolicy;
409
+ logger: Logger;
410
+ tracer?: Tracer;
411
+ }
412
+ /**
413
+ * Call a provider with the retry policy applied. Emits `provider.retry`
414
+ * before each retry and `provider.error` once when the retries are
415
+ * exhausted. Streaming providers route through the streaming-response
416
+ * builder so deltas reach the renderer.
417
+ */
418
+ declare function runProviderWithRetry(opts: RunProviderOptions): Promise<Response>;
419
+
403
420
  /**
404
421
  * L1-E: Autonomous continue — model-driven self-iteration continuation.
405
422
  *
@@ -574,6 +591,27 @@ declare class InputBuilder {
574
591
  */
575
592
  appendImage(dataBase64: string, mediaType: string): Promise<string>;
576
593
  appendFile(input: AddAttachmentInput): Promise<string>;
594
+ /**
595
+ * Register-only variant of `appendPaste`. Always stores the paste and
596
+ * returns the inline `[pasted #N, L lines]` token WITHOUT mutating
597
+ * `display` — the caller (TUI) owns its own editable buffer as the single
598
+ * source of truth, inserts the token there, and expands the buffer at
599
+ * submit. The collapse decision is the caller's (it gates this call); use
600
+ * `wouldCollapse()` for that.
601
+ */
602
+ registerPaste(text: string): Promise<string>;
603
+ /**
604
+ * Register-only variant of `appendImage` — see `registerPaste`. Returns a
605
+ * seq-keyed `[image #N, LABEL]` token; does not touch `display`.
606
+ */
607
+ registerImage(dataBase64: string, mediaType: string): Promise<string>;
608
+ /**
609
+ * Register-only variant of `appendFile` — see `registerPaste`. Returns a
610
+ * path-keyed `[file:<path>]` token (resolved by path at expand time); does
611
+ * not touch `display`. The path is read from `meta.filename` (falling back
612
+ * to `meta.label`).
613
+ */
614
+ registerFile(input: AddAttachmentInput): Promise<string>;
577
615
  /**
578
616
  * Whether `appendPaste(text)` would collapse the text to a placeholder
579
617
  * (rather than inlining it). Lets a frontend decide where to route a paste
@@ -1361,6 +1399,265 @@ declare class CheckpointManager {
1361
1399
  private pruneCheckpoints;
1362
1400
  }
1363
1401
 
1402
+ /**
1403
+ * CollaborationBus — kernel-level pause/resume signal for the
1404
+ * collaboration `controller` role (Phase 3 of idea #13 from IDEAS.md).
1405
+ *
1406
+ * The bus is a single-process singleton. The webui server (which hosts
1407
+ * the agent loop) creates one at boot, passes it to both the agent's
1408
+ * `toolCall` pipeline (as a middleware) and the `CollaborationWsHandler`
1409
+ * (which toggles it on client requests).
1410
+ *
1411
+ * Semantics:
1412
+ * - `requestPause(by)` flips the bus into the "paused" state. The
1413
+ * state has no timeout of its own — the *middleware* decides how
1414
+ * long to wait before auto-resuming (default 60s).
1415
+ * - `resume()` returns the bus to the running state. Idempotent:
1416
+ * calling resume() when not paused is a no-op returning `false`.
1417
+ * - `waitForResume(timeoutMs)` is what the middleware calls. It
1418
+ * returns `true` if the bus was resumed in time, `false` if the
1419
+ * timeout fired (in which case it also auto-resumes, so the agent
1420
+ * loop is never permanently stuck).
1421
+ * - `getState()` returns a snapshot for observability surfaces
1422
+ * (UI badges, CLI `/collab status`).
1423
+ *
1424
+ * Why a separate bus object rather than putting state on RunController?
1425
+ *
1426
+ * - The RunController is per-run; the bus is per-process. A single
1427
+ * pause signal across the whole webui process is the right
1428
+ * granularity (the webui hosts exactly one Agent.run at a time).
1429
+ * - The bus can be unit-tested without spinning up an Agent. The
1430
+ * middleware can be tested by injecting a fake bus.
1431
+ * - Future multi-session webui (when the bus is upgraded to filter
1432
+ * by sessionId) does not require touching the agent loop — the
1433
+ * middleware already receives the sessionId in its payload.
1434
+ */
1435
+ type CollabBusState = {
1436
+ paused: boolean;
1437
+ pausedAt: string | null;
1438
+ pausedBy: string | null;
1439
+ };
1440
+ declare class CollaborationBus {
1441
+ private pausePromise;
1442
+ private pauseResolve;
1443
+ private pausedAtMs;
1444
+ private pausedBy;
1445
+ isPaused(): boolean;
1446
+ getState(): CollabBusState;
1447
+ /**
1448
+ * Pause the agent loop. Idempotent: a second `requestPause` while
1449
+ * already paused is a no-op (the original pause wins; we do not
1450
+ * overwrite `pausedBy`). Returns true when the state actually
1451
+ * transitioned, false when it was already paused.
1452
+ */
1453
+ requestPause(byParticipant: string): boolean;
1454
+ /**
1455
+ * Resume the agent loop. Returns true when the state actually
1456
+ * transitioned from paused → running, false when it was already
1457
+ * running (no-op).
1458
+ */
1459
+ resume(): boolean;
1460
+ /**
1461
+ * Block until the bus is resumed or the timeout fires. Returns:
1462
+ * - `true` → bus was resumed in time
1463
+ * - `false` → timeout fired; bus was auto-resumed as a side effect
1464
+ *
1465
+ * When `timeoutMs` is `0` the wait is unbounded (the middleware must
1466
+ * be paired with an external AbortSignal in that case — we don't
1467
+ * expose one here to keep the API simple).
1468
+ */
1469
+ waitForResume(timeoutMs: number): Promise<boolean>;
1470
+ private readonly injectionQueue;
1471
+ /**
1472
+ * Queue a manual tool result. The next time the agent's toolCall
1473
+ * pipeline sees a matching `toolUse.id`, the
1474
+ * `collabInjectMiddleware` consumes this entry and replaces the
1475
+ * real tool execution. Returns `false` if an injection for the
1476
+ * same id is already queued (idempotent — first write wins).
1477
+ */
1478
+ injectToolResult(input: InjectedToolResult): boolean;
1479
+ /**
1480
+ * Pop an injection from the queue. Returns the payload (and
1481
+ * removes it) if one is pending, or `null` when nothing matches.
1482
+ * Called by the middleware on every tool call.
1483
+ */
1484
+ takeInjection(toolUseId: string): InjectedToolResult | null;
1485
+ /** Inspect the queue size (for observability / tests). */
1486
+ pendingInjectionCount(): number;
1487
+ }
1488
+ /**
1489
+ * Payload for a queued manual tool-call injection. The middleware
1490
+ * splices this into the toolCall pipeline as a synthetic result.
1491
+ */
1492
+ interface InjectedToolResult {
1493
+ toolUseId: string;
1494
+ /** Serialized content the model will see (string, JSON, etc.). */
1495
+ content: unknown;
1496
+ /** When true, the result is rendered as a tool error. */
1497
+ isError: boolean;
1498
+ /**
1499
+ * Free-form context surfaced in the broadcast and the audit log,
1500
+ * e.g. "controller: read returned the right file but with these
1501
+ * contents" or "controller: skipped the destructive bash call".
1502
+ */
1503
+ reason: string;
1504
+ /** Participant id of the controller who issued the injection. */
1505
+ authorId: string;
1506
+ }
1507
+
1508
+ /**
1509
+ * collabPauseMiddleware — gates the agent's `toolCall` pipeline on
1510
+ * the collaboration pause signal.
1511
+ *
1512
+ * Position: must be installed as the *first* middleware in the
1513
+ * `toolCall` pipeline so it runs before permission checks, retries,
1514
+ * and the tool itself. That way the controller can halt an agent
1515
+ * regardless of what the model is about to do.
1516
+ *
1517
+ * Semantics:
1518
+ * - When the bus is not paused: pass through (`next()`).
1519
+ * - When the bus is paused: await `bus.waitForResume(timeoutMs)`.
1520
+ * The default timeout is 60s — long enough for a human to think,
1521
+ * short enough that a forgotten controller doesn't pin the agent
1522
+ * forever. The auto-resume on timeout is logged below.
1523
+ *
1524
+ * Phase 3 of idea #13. Manual tool-call injection (a controller
1525
+ * "writing" a tool result) is *not* in scope for this middleware —
1526
+ * that requires splicing the injected result into the agent's
1527
+ * message stream and is a follow-up.
1528
+ */
1529
+ interface CollabPauseMiddlewareOptions {
1530
+ /**
1531
+ * How long to wait for a resume before auto-resuming the bus.
1532
+ * Defaults to 60_000 ms. Set to 0 for an unbounded wait (the
1533
+ * caller is then responsible for cancellation via the bus itself).
1534
+ */
1535
+ defaultTimeoutMs?: number;
1536
+ /**
1537
+ * Optional logger — receives a debug line on pause entry and on
1538
+ * timeout-driven auto-resume. Matches the `Logger` token surface
1539
+ * so the runtime can pass its existing logger.
1540
+ */
1541
+ logger?: {
1542
+ debug?: (msg: string) => void;
1543
+ warn?: (msg: string) => void;
1544
+ };
1545
+ }
1546
+ declare function collabPauseMiddleware(bus: CollaborationBus, opts?: CollabPauseMiddlewareOptions): (payload: ToolCallPipelinePayload, next: () => Promise<void>) => Promise<void>;
1547
+ /**
1548
+ * collabInjectMiddleware — Phase 4 of idea #13. Splices
1549
+ * controller-injected tool results into the toolCall pipeline.
1550
+ *
1551
+ * Position: should run AFTER `collabPauseMiddleware` so the
1552
+ * controller has a chance to pause + inject before the next tool
1553
+ * executes. Install order:
1554
+ * - `pipeline.toolCall.prepend(collabPause)`
1555
+ * - `pipeline.toolCall.prepend(collabInject)` // runs second
1556
+ *
1557
+ * Semantics:
1558
+ * - On every tool call, the middleware asks the bus for an
1559
+ * injection matching `payload.toolUse.id`.
1560
+ * - If one is queued, the payload's `result` is replaced with
1561
+ * a synthetic ToolResultBlock carrying the injected content +
1562
+ * `is_error` flag. The real `next()` is NOT called — the
1563
+ * downstream tool executor sees a payload that's already
1564
+ * "complete" and skips the actual tool.
1565
+ * - The injection is consumed once and removed from the bus.
1566
+ *
1567
+ * Why this shape: by replacing the result *before* the executor
1568
+ * runs, we keep the kernel's `ToolExecutor` untouched. The agent
1569
+ * loop's existing `tool.executed` event still fires (carrying
1570
+ * the injected content), so the session log + observers see a
1571
+ * normal-looking call — just with the controller's intent in
1572
+ * the result instead of the real tool's output.
1573
+ */
1574
+ declare function collabInjectMiddleware(bus: CollaborationBus, opts?: {
1575
+ logger?: {
1576
+ debug?: (msg: string) => void;
1577
+ warn?: (msg: string) => void;
1578
+ };
1579
+ }): (payload: ToolCallPipelinePayload, next: () => Promise<void>) => Promise<void>;
1580
+
1581
+ /**
1582
+ * Idea #2 from IDEAS.md — Deterministic Replay.
1583
+ *
1584
+ * The hash function is the foundation of replay: given a `Request`,
1585
+ * produce a stable identifier so a recorded `Response` can be looked
1586
+ * up later when we want to "re-run" the same agent loop without
1587
+ * burning API credits.
1588
+ *
1589
+ * Stability rules:
1590
+ *
1591
+ * - All object keys are sorted recursively before stringification.
1592
+ * Without this, two semantically identical requests that differ
1593
+ * only in key insertion order would produce different hashes.
1594
+ * - We hash ONLY the fields that affect the response: `model`,
1595
+ * `system`, `messages`, `tools`, `maxTokens`, and the four
1596
+ * sampling knobs (`temperature`, `topP`, `stopSequences`,
1597
+ * `toolChoice`). Anything else on the `Request` (metadata,
1598
+ * future extensions) is ignored so replay stays forward-compat.
1599
+ * - We serialize to JSON. The `ContentBlock` and `Message` shapes
1600
+ * are pure data; this works as long as no `undefined` values
1601
+ * sneak in (those get dropped by `JSON.stringify`, which is
1602
+ * fine — the structural diff is what matters).
1603
+ *
1604
+ * The SHA-256 output is hex-encoded and prefixed with the algorithm
1605
+ * tag so a future migration to a different hash (e.g. blake3) is
1606
+ * trivial to detect.
1607
+ */
1608
+ declare function stableStringify(value: unknown): string;
1609
+ declare function hashRequest(request: Request): string;
1610
+
1611
+ /**
1612
+ * ReplayProviderRunner — idea #2 from IDEAS.md.
1613
+ *
1614
+ * A drop-in `ProviderRunner` that wraps an inner runner and either
1615
+ * - records every (request, response) pair it observes (mode: 'record'),
1616
+ * - serves a recorded response when the request hash matches (mode: 'replay'),
1617
+ * - or does both: serve when present, record when not (mode: 'auto').
1618
+ *
1619
+ * Bind to `TOKENS.ProviderRunner` to completely replace the default
1620
+ * runner. Or use `AgentExtension.wrapProviderRunner` to chain in
1621
+ * alongside other extensions.
1622
+ *
1623
+ * Mode semantics:
1624
+ * - 'record' is the production mode. Every real API call is
1625
+ * persisted; the user can later `wstack replay <sessionId>` to
1626
+ * re-run with frozen responses.
1627
+ * - 'replay' is the debugging mode. The agent loop runs normally
1628
+ * (same permissions, same tool dispatch) but every LLM call
1629
+ * comes from the recorded log. If a request hash is not in the
1630
+ * log, we throw — the user is expected to either rebuild the
1631
+ * session or fall back to record mode.
1632
+ * - 'auto' is the warm-start mode for development. The first time
1633
+ * a particular request is seen, it's recorded; the next time
1634
+ * the same request is made, the recorded response is served.
1635
+ * This is the cheapest path to a deterministic test harness.
1636
+ */
1637
+ type ReplayMode = 'record' | 'replay' | 'auto';
1638
+ interface ReplayProviderRunnerOptions {
1639
+ log: ReplayLogStore;
1640
+ sessionId: string;
1641
+ mode: ReplayMode;
1642
+ /**
1643
+ * Optional logger — receives a debug line on every replay hit
1644
+ * ("served cached response for hash sha256:…") and a warn on
1645
+ * every miss in 'replay' mode (the throw that follows is the
1646
+ * real signal, but the warn helps when the throw is caught
1647
+ * upstream).
1648
+ */
1649
+ logger?: {
1650
+ debug?: (msg: string) => void;
1651
+ warn?: (msg: string) => void;
1652
+ };
1653
+ }
1654
+ declare class ReplayProviderRunner implements ProviderRunner {
1655
+ private readonly inner;
1656
+ private readonly opts;
1657
+ constructor(inner: ProviderRunner, opts: ReplayProviderRunnerOptions);
1658
+ run(runOpts: RunProviderOptions$1): Promise<Response>;
1659
+ }
1660
+
1364
1661
  interface PromptsPluginOptions {
1365
1662
  store?: DefaultPromptStore;
1366
1663
  paths?: WstackPaths;
@@ -1448,4 +1745,4 @@ interface PlanPluginOptions {
1448
1745
  */
1449
1746
  declare function createPlanPlugin(opts?: PlanPluginOptions): Plugin;
1450
1747
 
1451
- export { AddAttachmentInput, AttachmentRef, AttachmentStore, type AutoPhaseOptions, type AutoPhasePlanResult, AutoPhasePlanner, type AutoPhasePlannerOptions, AutoPhaseRunner, type AutoPhaseRunnerOptions, BuildContext, type Checkpoint, CheckpointManager, type CheckpointManagerOptions, Config, ConfigStore, Container, ContentBlock, Context, type ContinueDirective, DefaultPluginAPI, DefaultPromptStore, DefaultSystemPromptBuilder, type DefaultSystemPromptBuilderOptions, type DetectedDependency, type DetectionResult, EventBus, EventName, ExtensionRegistry, type Finding, type FullScanResult, type GeneratedSecuritySkill, type GeneratedSkill, type GeneratedSkillContent, GitignoreUpdater, HealthRegistry, InputBuilder, type InputBuilderEvent, type InputBuilderOptions, KERNEL_API_VERSION, LAYER_1_IDENTITY, Listener, type LoadPluginsOptions, Logger, type MCPRegistryHandle, MCPRegistryView, MCPServerConfig, MemoryStore, MetricsSink, MetricsSinkView, ModeStore, ModelCapabilities, type PackageManager, type PhaseEventMap, type PhaseEventName, type PhaseExecutionContext, type PhaseFilter, type PhaseGraph, PhaseGraphBuilder, type PhaseGraphBuilderOptions, type PhaseNode, PhaseOrchestrator, type PhaseOrchestratorOptions, type PhaseProgress, type PhaseSort, type PhaseStatus, PhaseStore, type PhaseStoreOptions, type PhaseTemplate, Plugin, PluginAPI, type PluginAPIInit, PluginPipelines, Provider, ProviderRegistry, ProviderRegistryView, ReportGenerator, type ReportOptions, type ScanOptions, type ScanResult, type ScanScope, type SecurityPattern, SecurityScanner, type SecurityScannerContext, type SecurityScannerOptions, SecurityScannerOrchestrator, SessionWriterView, type SeverityLevel, type SkillGenerationContext, SkillGenerator, type SkillGeneratorOptions, SkillLoader, SlashCommand, SlashCommandRegistry, SlashCommandRegistryView, SystemPromptBuilder, SystemPromptContributor, TaskGraph, TaskNode, TaskPriority, TaskStore, TaskType, type TechStack, TechStackDetector, type TechStackInfo, TextBlock, Tool, ToolRegistry, ToolRegistryView, WorktreeManager, WstackPaths, buildBtwBlock, consumeBtwNotes, createAutoPhaseFromTaskGraph, createGitPlugin, createMcpControlTool, createObservabilityPlugin, createPlanPlugin, createPromptsPlugin, createSecurityPlugin, createSecuritySlashCommand, createSkillsPlugin, createSyncPlugin, defaultGitignoreUpdater, defaultOrchestrator, defaultReportGenerator, defaultSecurityScanner, defaultSkillGenerator, defaultTechStackDetector, loadPlugins, makeContinueToNextIterationTool, parseContinueDirective, pendingBtwCount, securitySlashCommand, setBtwNote, unloadPlugins };
1748
+ export { AddAttachmentInput, AttachmentRef, AttachmentStore, type AutoPhaseOptions, type AutoPhasePlanResult, AutoPhasePlanner, type AutoPhasePlannerOptions, AutoPhaseRunner, type AutoPhaseRunnerOptions, BuildContext, type Checkpoint, CheckpointManager, type CheckpointManagerOptions, type CollabBusState, type InjectedToolResult as CollabInjectedToolResult, type CollabPauseMiddlewareOptions, CollaborationBus, Config, ConfigStore, Container, ContentBlock, Context, type ContinueDirective, DefaultPluginAPI, DefaultPromptStore, DefaultSystemPromptBuilder, type DefaultSystemPromptBuilderOptions, type DetectedDependency, type DetectionResult, EventBus, EventName, ExtensionRegistry, type Finding, type FullScanResult, type GeneratedSecuritySkill, type GeneratedSkill, type GeneratedSkillContent, GitignoreUpdater, HealthRegistry, InputBuilder, type InputBuilderEvent, type InputBuilderOptions, KERNEL_API_VERSION, LAYER_1_IDENTITY, Listener, type LoadPluginsOptions, Logger, type MCPRegistryHandle, MCPRegistryView, MCPServerConfig, MemoryStore, MetricsSink, MetricsSinkView, ModeStore, ModelCapabilities, type PackageManager, type PhaseEventMap, type PhaseEventName, type PhaseExecutionContext, type PhaseFilter, type PhaseGraph, PhaseGraphBuilder, type PhaseGraphBuilderOptions, type PhaseNode, PhaseOrchestrator, type PhaseOrchestratorOptions, type PhaseProgress, type PhaseSort, type PhaseStatus, PhaseStore, type PhaseStoreOptions, type PhaseTemplate, Plugin, PluginAPI, type PluginAPIInit, PluginPipelines, Provider, ProviderRegistry, ProviderRegistryView, ProviderRunner, ReplayLogStore, type ReplayMode, ReplayProviderRunner, type ReplayProviderRunnerOptions, ReportGenerator, type ReportOptions, Request, Response, RunProviderOptions$1 as RunProviderOptions, type ScanOptions, type ScanResult, type ScanScope, type SecurityPattern, SecurityScanner, type SecurityScannerContext, type SecurityScannerOptions, SecurityScannerOrchestrator, SessionWriterView, type SeverityLevel, type SkillGenerationContext, SkillGenerator, type SkillGeneratorOptions, SkillLoader, SlashCommand, SlashCommandRegistry, SlashCommandRegistryView, SystemPromptBuilder, SystemPromptContributor, TaskGraph, TaskNode, TaskPriority, TaskStore, TaskType, type TechStack, TechStackDetector, type TechStackInfo, TextBlock, Tool, ToolRegistry, ToolRegistryView, Tracer, WorktreeManager, WstackPaths, buildBtwBlock, collabInjectMiddleware, collabPauseMiddleware, consumeBtwNotes, createAutoPhaseFromTaskGraph, createGitPlugin, createMcpControlTool, createObservabilityPlugin, createPlanPlugin, createPromptsPlugin, createSecurityPlugin, createSecuritySlashCommand, createSkillsPlugin, createSyncPlugin, defaultGitignoreUpdater, defaultOrchestrator, defaultReportGenerator, defaultSecurityScanner, defaultSkillGenerator, defaultTechStackDetector, hashRequest, loadPlugins, makeContinueToNextIterationTool, parseContinueDirective, pendingBtwCount, runProviderWithRetry, securitySlashCommand, setBtwNote, stableStringify, unloadPlugins };