@wrongstack/core 0.32.0 → 0.51.3

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 (45) hide show
  1. package/dist/{agent-bridge-D_XcS2HL.d.ts → agent-bridge-CjbD-i7-.d.ts} +1 -1
  2. package/dist/{agent-subagent-runner-DpZTLdBe.d.ts → agent-subagent-runner-DfvlBx5N.d.ts} +3 -3
  3. package/dist/{config-BUEGM4JP.d.ts → config-ZRCf7sTu.d.ts} +21 -1
  4. package/dist/coordination/index.d.ts +10 -10
  5. package/dist/coordination/index.js +3310 -3056
  6. package/dist/coordination/index.js.map +1 -1
  7. package/dist/defaults/index.d.ts +13 -13
  8. package/dist/defaults/index.js +1544 -1390
  9. package/dist/defaults/index.js.map +1 -1
  10. package/dist/{events-BrQiweXN.d.ts → events-Bt44ikPN.d.ts} +135 -1
  11. package/dist/execution/index.d.ts +35 -9
  12. package/dist/execution/index.js +61 -28
  13. package/dist/execution/index.js.map +1 -1
  14. package/dist/extension/index.d.ts +3 -3
  15. package/dist/{index-pXJdVLe0.d.ts → index-OzA1XjHL.d.ts} +35 -3
  16. package/dist/{index-ysfO_DlX.d.ts → index-mAWBdLyJ.d.ts} +2 -2
  17. package/dist/index.d.ts +221 -25
  18. package/dist/index.js +1670 -1017
  19. package/dist/index.js.map +1 -1
  20. package/dist/infrastructure/index.d.ts +4 -4
  21. package/dist/infrastructure/index.js +17 -3
  22. package/dist/infrastructure/index.js.map +1 -1
  23. package/dist/kernel/index.d.ts +4 -4
  24. package/dist/kernel/index.js +3 -1
  25. package/dist/kernel/index.js.map +1 -1
  26. package/dist/{mcp-servers-BzB3r7_c.d.ts → mcp-servers-DONdo-XM.d.ts} +1 -1
  27. package/dist/models/index.js +5 -2
  28. package/dist/models/index.js.map +1 -1
  29. package/dist/{multi-agent-C8Z1i__e.d.ts → multi-agent-Ba9Ni2hC.d.ts} +1 -1
  30. package/dist/{multi-agent-coordinator-DOXSgtom.d.ts → multi-agent-coordinator-BuKq0q89.d.ts} +2 -2
  31. package/dist/{null-fleet-bus-DLsUjOyB.d.ts → null-fleet-bus-C0xd73YP.d.ts} +169 -138
  32. package/dist/observability/index.d.ts +1 -1
  33. package/dist/{path-resolver-DumKAi0n.d.ts → path-resolver-nkmdiFgi.d.ts} +1 -1
  34. package/dist/{plan-templates-BZMi-VpU.d.ts → plan-templates-BmDdJ7UL.d.ts} +2 -2
  35. package/dist/{provider-runner-Dlv8Fvw9.d.ts → provider-runner-BGro2qQB.d.ts} +1 -1
  36. package/dist/sdd/index.d.ts +5 -5
  37. package/dist/storage/index.d.ts +3 -3
  38. package/dist/{tool-executor-BAi4WI2d.d.ts → tool-executor-p4tP9tGF.d.ts} +1 -1
  39. package/dist/types/index.d.ts +8 -8
  40. package/dist/types/index.js +22 -5
  41. package/dist/types/index.js.map +1 -1
  42. package/dist/utils/index.d.ts +107 -1
  43. package/dist/utils/index.js +53 -2
  44. package/dist/utils/index.js.map +1 -1
  45. package/package.json +1 -1
@@ -1,10 +1,10 @@
1
- export { A as AfterIterationHook, a as AfterRunHook, b as AfterToolExecutionHook, d as AgentExtension, B as BeforeIterationHook, h as BeforeRunHook, i as BeforeToolExecutionHook, E as ExtensionRegistry, O as OnErrorHook, s as ProviderRunnerFn, t as ProviderRunnerWrapper } from '../index-ysfO_DlX.js';
1
+ export { A as AfterIterationHook, a as AfterRunHook, b as AfterToolExecutionHook, d as AgentExtension, B as BeforeIterationHook, h as BeforeRunHook, i as BeforeToolExecutionHook, E as ExtensionRegistry, O as OnErrorHook, s as ProviderRunnerFn, t as ProviderRunnerWrapper } from '../index-mAWBdLyJ.js';
2
2
  import '../context-7u93AcGD.js';
3
3
  import '../logger-DDd5C--Z.js';
4
4
  import '../system-prompt-CM6zOhd2.js';
5
5
  import '../observability-BhnVLBLS.js';
6
- import '../events-BrQiweXN.js';
6
+ import '../events-Bt44ikPN.js';
7
7
  import '../secret-scrubber-3MHDDAtm.js';
8
8
  import '../permission-B6sldrSp.js';
9
- import '../config-BUEGM4JP.js';
9
+ import '../config-ZRCf7sTu.js';
10
10
  import '../models-registry-BcYJDKLm.js';
@@ -1,7 +1,7 @@
1
1
  import { T as Token, e as Renderer, S as SystemPromptBuilder } from './system-prompt-CM6zOhd2.js';
2
- import { E as EventBus } from './events-BrQiweXN.js';
2
+ import { E as EventBus, B as BrainArbiter } from './events-Bt44ikPN.js';
3
3
  import { a as Compactor } from './compactor-D1RHFRmF.js';
4
- import { b as ConfigLoader, c as ConfigStore } from './config-BUEGM4JP.js';
4
+ import { b as ConfigLoader, c as ConfigStore } from './config-ZRCf7sTu.js';
5
5
  import { E as ErrorHandler, a as RetryPolicy } from './retry-policy-KF18W4dg.js';
6
6
  import { I as InputReader } from './input-reader-E-ffP2ee.js';
7
7
  import { a as Logger } from './logger-DDd5C--Z.js';
@@ -10,7 +10,7 @@ import { c as ModeStore } from './mode-CV077NjV.js';
10
10
  import { b as ModelsRegistry } from './models-registry-BcYJDKLm.js';
11
11
  import { P as PathResolver } from './path-resolver-CPRj4bFY.js';
12
12
  import { a as PermissionPolicy } from './permission-B6sldrSp.js';
13
- import { P as ProviderRunner } from './provider-runner-Dlv8Fvw9.js';
13
+ import { P as ProviderRunner } from './provider-runner-BGro2qQB.js';
14
14
  import { S as SecretScrubber } from './secret-scrubber-3MHDDAtm.js';
15
15
  import { O as TokenCounter, y as SessionStore } from './context-7u93AcGD.js';
16
16
  import { a as SkillLoader } from './skill-CxuWrsKK.js';
@@ -58,12 +58,27 @@ interface AllocateOpts {
58
58
  interface MergeOpts {
59
59
  squash?: boolean;
60
60
  message?: string;
61
+ /**
62
+ * Optional conflict resolver. Invoked when the squash-merge conflicts, with
63
+ * the conflicted paths and the base working tree (`cwd`). It must resolve the
64
+ * conflict markers in place and return `true` when done. If it returns `true`
65
+ * and no conflict markers remain, the merge is committed and `merge()` returns
66
+ * `{ ok: true, resolved: true }`. Otherwise the merge is aborted (hard reset)
67
+ * and the handle is parked `needs-review` — exactly as if no resolver were
68
+ * provided, so the base tree is never left dirty.
69
+ */
70
+ resolve?: (info: {
71
+ conflictFiles: string[];
72
+ cwd: string;
73
+ }) => Promise<boolean>;
61
74
  }
62
75
  interface MergeResult {
63
76
  ok: boolean;
64
77
  conflict?: boolean;
65
78
  conflictFiles?: string[];
66
79
  stderr?: string;
80
+ /** True when an initial conflict was successfully resolved by `opts.resolve`. */
81
+ resolved?: boolean;
67
82
  }
68
83
  interface RunResult {
69
84
  code: number;
@@ -103,6 +118,21 @@ declare class WorktreeManager {
103
118
  }>;
104
119
  /** Merge the worktree branch back into the base branch (squash by default). */
105
120
  merge(handle: WorktreeHandle, opts?: MergeOpts): Promise<MergeResult>;
121
+ /**
122
+ * Run the caller-supplied resolver against a conflicted squash-merge, then
123
+ * commit if it cleared every marker. Returns a successful `MergeResult` on a
124
+ * clean resolution, or `null` to signal the caller should fall back to the
125
+ * abort path. Never leaves the base tree committed-but-dirty: a partial or
126
+ * failed resolution returns `null` and the caller hard-resets.
127
+ */
128
+ private tryResolveConflict;
129
+ /**
130
+ * True when staged content still carries conflict markers. `git diff --cached
131
+ * --check` exits nonzero and prints a "leftover conflict marker" line for each
132
+ * survivor; whitespace-only errors (also flagged by --check) are ignored so a
133
+ * clean resolution with unrelated whitespace is not rejected.
134
+ */
135
+ private hasConflictMarkers;
106
136
  /**
107
137
  * Remove the worktree + branch. Conflicted/failed handles (or `keep:true`)
108
138
  * are left on disk for inspection.
@@ -158,6 +188,8 @@ declare const TOKENS: {
158
188
  readonly ProviderRunner: Token<ProviderRunner>;
159
189
  /** Optional git-worktree lifecycle manager (per-phase isolation in AutoPhase). */
160
190
  readonly WorktreeManager: Token<WorktreeManager>;
191
+ /** Optional global Brain arbiter for policy/decision escalation. */
192
+ readonly BrainArbiter: Token<BrainArbiter>;
161
193
  };
162
194
 
163
195
  /**
@@ -2,10 +2,10 @@ import { Q as Tool, Y as ToolResultBlock, _ as ToolUseBlock, d as Context, T as
2
2
  import { a as Logger } from './logger-DDd5C--Z.js';
3
3
  import { e as Renderer, a as BuildContext, C as Container, P as Pipeline, R as ReadonlyPipeline } from './system-prompt-CM6zOhd2.js';
4
4
  import { T as Tracer } from './observability-BhnVLBLS.js';
5
- import { E as EventBus, c as EventName, L as Listener } from './events-BrQiweXN.js';
5
+ import { E as EventBus, k as EventName, L as Listener } from './events-Bt44ikPN.js';
6
6
  import { S as SecretScrubber } from './secret-scrubber-3MHDDAtm.js';
7
7
  import { a as PermissionPolicy } from './permission-B6sldrSp.js';
8
- import { l as ProviderConfig, a as Config } from './config-BUEGM4JP.js';
8
+ import { m as ProviderConfig, a as Config } from './config-ZRCf7sTu.js';
9
9
  import { W as WireFamily } from './models-registry-BcYJDKLm.js';
10
10
 
11
11
  /**
package/dist/index.d.ts CHANGED
@@ -1,57 +1,60 @@
1
1
  import { S as SystemPromptBuilder, c as ModelCapabilities, a as BuildContext, C as Container } from './system-prompt-CM6zOhd2.js';
2
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-BrQiweXN.js';
4
- export { a as EventLogger, b as EventMap, S as ScopedEventBus } from './events-BrQiweXN.js';
5
- import { d as WorktreeManager } from './index-pXJdVLe0.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-pXJdVLe0.js';
3
+ import { E as EventBus, k as EventName, L as Listener, B as BrainArbiter } from './events-Bt44ikPN.js';
4
+ export { a as BrainDecision, b as BrainDecisionOption, c as BrainDecisionQueue, d as BrainDecisionRequest, e as BrainDecisionSource, f as BrainFallback, g as BrainRisk, D as DefaultBrainArbiter, h as DefaultBrainArbiterOptions, i as EventLogger, j as EventMap, H as HumanEscalatingBrainArbiter, O as ObservableBrainArbiter, S as ScopedEventBus, l as formatHumanPrompt } from './events-Bt44ikPN.js';
5
+ import { d as WorktreeManager } from './index-OzA1XjHL.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-OzA1XjHL.js';
7
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
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-Dlv8Fvw9.js';
10
- import { M as MCPServerConfig, a as Config, c as ConfigStore } from './config-BUEGM4JP.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-BUEGM4JP.js';
9
+ import { P as ProviderRunner, R as RunProviderOptions$1 } from './provider-runner-BGro2qQB.js';
10
+ import { M as MCPServerConfig, a as Config, k as ModelMatrixEntry, c as ConfigStore } from './config-ZRCf7sTu.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, l as ProviderApiKey, m as ProviderConfig, S as SessionLoggingConfig, n as SyncCategory, o as SyncConfig, T as ToolsConfig, p as formatContextWindowModeList, q as getContextWindowMode, r as isContextWindowModeId, s as listContextWindowModes, t as resolveContextWindowPolicy } from './config-ZRCf7sTu.js';
12
12
  export { C as CompactReport, a as Compactor } from './compactor-D1RHFRmF.js';
13
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
15
  import { e as AttachmentStore, d as AttachmentRef, A as AddAttachmentInput } from './session-reader-bfgsy2a0.js';
16
16
  export { a as Attachment, b as AttachmentKind, c as AttachmentMeta, D as DefaultSessionReader, f as DefaultSessionReaderOptions, S as SessionReader } from './session-reader-bfgsy2a0.js';
17
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
- 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
- export { D as DefaultLogger, a as DefaultLoggerOptions } from './logger-bOzkF5LL.js';
20
- export { D as DefaultPathResolver, a as DefaultTokenCounter } from './path-resolver-DumKAi0n.js';
18
+ import { a as DefaultSecretVault } from './secret-scrubber-7rSC_emZ.js';
19
+ export { D as DefaultSecretScrubber, S as SecretVaultOptions, d as decryptConfigSecrets, e as encryptConfigSecrets, m as migratePlaintextSecrets, r as rewriteConfigEncrypted } from './secret-scrubber-7rSC_emZ.js';
20
+ import { D as DefaultLogger } from './logger-bOzkF5LL.js';
21
+ export { a as DefaultLoggerOptions } from './logger-bOzkF5LL.js';
22
+ import { D as DefaultPathResolver } from './path-resolver-nkmdiFgi.js';
23
+ export { a as DefaultTokenCounter } from './path-resolver-nkmdiFgi.js';
21
24
  import { b as MemoryStore } from './memory-CEXuo7sz.js';
22
25
  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-BAi4WI2d.js';
26
+ 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-p4tP9tGF.js';
24
27
  import { a as SkillLoader } from './skill-CxuWrsKK.js';
25
28
  export { S as SkillEntry, b as SkillManifest } from './skill-CxuWrsKK.js';
26
29
  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, 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-ysfO_DlX.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-ysfO_DlX.js';
30
+ 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-mAWBdLyJ.js';
31
+ 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-mAWBdLyJ.js';
29
32
  export { D as DefaultModelsRegistry, a as DefaultModelsRegistryOptions, c as classifyFamily } from './models-registry-gwMAo6E3.js';
30
33
  import { c as ModeStore } from './mode-CV077NjV.js';
31
34
  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-D_XcS2HL.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-C8Z1i__e.js';
35
+ export { I as InMemoryAgentBridge, a as InMemoryBridgeTransport, c as createMessage } from './agent-bridge-CjbD-i7-.js';
36
+ 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-Ba9Ni2hC.js';
34
37
  import { l as TaskGraph, r as TaskType, n as TaskPriority, m as TaskNode } from './task-graph-D1YQbpxF.js';
35
38
  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
39
  import { T as Tracer, e as MetricsSink, b as HealthRegistry } from './observability-BhnVLBLS.js';
37
40
  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, estimateRequestTokensCalibrated, estimateTextTokens, estimateToolDefTokens, estimateToolInputTokens, estimateToolResultTokens, expandGlob, formatTodosList, getCalibrationState, matchAny, matchGlob, mergeModelsPayload, normalizeToLf, recordActualUsage, repairToolUseAdjacency, resetCalibration, safeParse, safeStringify, sanitizeJsonString, stripAnsi, toStyle, unifiedDiff, validateAgainstSchema } from './utils/index.js';
41
+ export { AtomicWriteOptions, BuildChildEnvOptions, CompileFail, CompileResult, MessageRepairReport, MessageRepairResult, NewlineStyle, RequestTokenBreakdown, SafeParseResult, ToolOutputSerializerOptions, UnifiedDiffOptions, ValidationError, ValidationResult, atomicWrite, buildChildEnv, color, compileGlob, compileUserRegex, completePartialObject, createToolOutputSerializer, detectNewlineStyle, ensureDir, estimateRequestTokens, estimateRequestTokensCalibrated, estimateTextTokens, estimateToolDefTokens, estimateToolInputTokens, estimateToolResultTokens, expandGlob, formatTodosList, getCalibrationState, getTermSize, isInteractive, isStdinTTY, isStdoutTTY, matchAny, matchGlob, mergeModelsPayload, normalizeToLf, onResize, recordActualUsage, repairToolUseAdjacency, resetCalibration, safeParse, safeStringify, sanitizeJsonString, setRawMode, stripAnsi, toStyle, unifiedDiff, validateAgainstSchema, writeErr, writeOut } from './utils/index.js';
39
42
  import { a as WstackPaths } from './wstack-paths-eMXnY1_X.js';
40
43
  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-BZMi-VpU.js';
44
+ 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-BmDdJ7UL.js';
42
45
  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';
43
46
  export { D as DirectorStateCheckpoint, a as DirectorStateSnapshot, b as DirectorSubagentState, c as DirectorTaskState, l as loadDirectorState } from './director-state-BmYi3DGA.js';
44
47
  export { A as AutoApprovePermissionPolicy, D as DefaultPermissionPolicy, P as PermissionPolicyOptions } from './permission-policy-CtNscWOA.js';
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';
48
+ export { AutoCompactionMiddleware, AutonomousRunner, AutonomousRunnerOptions, AutonomyPromptContributorOptions, DefaultSkillLoader, DoneCheckResult, DoneConditionChecker, EternalAutonomyEngine, EternalAutonomyOptions, EternalEngineState, IntelligentCompactor, IntelligentCompactorOptions, IterationStage, ParallelEngineState, ParallelEternalEngine, ParallelEternalOptions, ParallelIterationStage, SelectiveCompactor, SelectiveCompactorOptions, SkillLoaderOptions, buildGoalPreamble, makeAutonomyPromptContributor } from './execution/index.js';
46
49
  export { DefaultProviderRunner } from './defaults/index.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, 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-DLsUjOyB.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-DOXSgtom.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-DpZTLdBe.js';
50
+ 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-C0xd73YP.js';
51
+ 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-BuKq0q89.js';
52
+ 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-DfvlBx5N.js';
50
53
  export { DefaultModeStore, LLMSelector, LLMSelectorOptions, ModeLoaderOptions, loadProjectModes, loadUserModes } from './models/index.js';
51
54
  import { TaskStore } from './sdd/index.js';
52
55
  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';
53
56
  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';
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-BzB3r7_c.js';
57
+ 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-DONdo-XM.js';
55
58
  export { DownloadResult, InstallResult, InstalledSkillEntry, ManifestData, ParsedRef, SkillInstaller, SkillInstallerOptions, SkillManifestStore, UpdateResult, downloadGitHubTarball, parseSkillRef } from './skills/index.js';
56
59
  import { ReplayLogStore, DefaultPromptStore } from './storage/index.js';
57
60
  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';
@@ -417,6 +420,66 @@ interface RunProviderOptions {
417
420
  */
418
421
  declare function runProviderWithRetry(opts: RunProviderOptions): Promise<Response>;
419
422
 
423
+ /**
424
+ * Options for {@link bootConfig}. Both the CLI and the WebUI server boot the
425
+ * same way; the only intentional differences are the label used in the
426
+ * plaintext-secret migration notice and whether CLI flags are supplied.
427
+ */
428
+ interface BootConfigOptions {
429
+ /**
430
+ * Parsed CLI flags. `cwd` relocates path resolution; `provider`/`model`/
431
+ * `log-level`/`verbose`/`trace`/`yolo`/`no-features` are patched into the
432
+ * loaded config (see {@link flagsToConfigPatch}). Defaults to `{}` (the
433
+ * WebUI server passes no flags).
434
+ */
435
+ flags?: Record<string, string | boolean>;
436
+ /**
437
+ * Label shown in the `[<label>] Encrypted N plaintext secret(s) in FILE`
438
+ * stderr notice emitted when legacy plaintext secrets get auto-encrypted.
439
+ * The CLI passes `wstack`; the WebUI server passes `WebUI`. Default
440
+ * `wstack`.
441
+ */
442
+ appLabel?: string;
443
+ /**
444
+ * Load `~/.wrongstack/sync.json` and merge it into `config.sync` so the
445
+ * ConfigStore starts with the correct CloudSync state. Default `true`.
446
+ */
447
+ loadSyncConfig?: boolean;
448
+ }
449
+ /**
450
+ * Everything the boot phase resolves before DI-container wiring. Superset of
451
+ * what the CLI and WebUI server each consumed previously, so both can pick the
452
+ * fields they need from a single canonical result.
453
+ */
454
+ interface BootConfigResult {
455
+ cwd: string;
456
+ projectRoot: string;
457
+ userHome: string;
458
+ wpaths: WstackPaths;
459
+ pathResolver: DefaultPathResolver;
460
+ config: Config;
461
+ vault: DefaultSecretVault;
462
+ logger: DefaultLogger;
463
+ /** Convenience alias for `wpaths.globalConfig`. */
464
+ globalConfigPath: string;
465
+ }
466
+ /**
467
+ * Canonical boot routine shared by `@wrongstack/cli` and `@wrongstack/webui`.
468
+ * Resolves paths, creates the real AES-GCM secret vault, migrates any
469
+ * plaintext secrets, loads + merges config (with CLI-flag overrides and an
470
+ * optional sync overlay), and builds a logger.
471
+ *
472
+ * The per-package `bootConfig()` wrappers re-shape this result into their own
473
+ * legacy return types for backward compatibility — keep this the single source
474
+ * of boot behavior so the two consumers can't drift.
475
+ */
476
+ declare function bootConfig(options?: BootConfigOptions): Promise<BootConfigResult>;
477
+ /**
478
+ * Translate parsed CLI flags into a partial Config patch applied on top of the
479
+ * file-loaded config. Explicit `--log-level` wins over `--verbose`/`--trace`.
480
+ */
481
+ declare function flagsToConfigPatch(flags: Record<string, string | boolean>): Partial<Config>;
482
+
420
483
  /**
421
484
  * L1-E: Autonomous continue — model-driven self-iteration continuation.
422
485
  *
@@ -991,6 +1054,31 @@ interface PhaseEventMap {
991
1054
  completed: number;
992
1055
  failed: number;
993
1056
  };
1057
+ 'phase.verifying': {
1058
+ phaseId: string;
1059
+ name: string;
1060
+ attempt: number;
1061
+ };
1062
+ 'phase.verifyFailed': {
1063
+ phaseId: string;
1064
+ name: string;
1065
+ attempt: number;
1066
+ error?: string;
1067
+ };
1068
+ 'phase.repairing': {
1069
+ phaseId: string;
1070
+ name: string;
1071
+ attempt: number;
1072
+ };
1073
+ 'phase.conflictResolving': {
1074
+ phaseId: string;
1075
+ name: string;
1076
+ files: string[];
1077
+ };
1078
+ 'phase.conflictResolved': {
1079
+ phaseId: string;
1080
+ name: string;
1081
+ };
994
1082
  'graph.completed': {
995
1083
  graphId: string;
996
1084
  durationMs: number;
@@ -1023,6 +1111,46 @@ interface PhaseExecutionContext {
1023
1111
  cwd?: string;
1024
1112
  branch?: string;
1025
1113
  }) => Promise<unknown>;
1114
+ /**
1115
+ * Opsiyonel doğrulama kapısı. Bir fazın tüm görevleri bittikten *sonra*,
1116
+ * faz "completed" işaretlenmeden ve worktree'si ana branch'e merge edilmeden
1117
+ * *önce* çağrılır. `env`, fazın worktree'sine (varsa) işaret eder; doğrulama
1118
+ * o izole dizinde koşmalıdır (örn. typecheck/test). `ok:false` dönerse merge
1119
+ * bloklanır ve (varsa) `repairPhase` ile onarım denenir.
1120
+ *
1121
+ * Tanımlanmazsa kapı atlanır (geriye dönük uyumlu — eski davranış).
1122
+ */
1123
+ verifyPhase?: (phase: PhaseNode, env?: {
1124
+ cwd?: string;
1125
+ branch?: string;
1126
+ }) => Promise<{
1127
+ ok: boolean;
1128
+ output?: string;
1129
+ }>;
1130
+ /**
1131
+ * Opsiyonel onarım geçişi. `verifyPhase` başarısız olduğunda, yakalanan hata
1132
+ * çıktısı ile çağrılır. Worktree'deki kodu düzeltmeye çalışmalıdır (örn. bir
1133
+ * onarım subagent'ı). Dönüş beklenmez; orchestrator ardından `verifyPhase`'i
1134
+ * yeniden koşar. `verifyPhase` tanımlı değilse hiç çağrılmaz.
1135
+ */
1136
+ repairPhase?: (phase: PhaseNode, failure: string, attempt: number, env?: {
1137
+ cwd?: string;
1138
+ branch?: string;
1139
+ }) => Promise<void>;
1140
+ /**
1141
+ * Opsiyonel birleştirme-çakışması çözücü. Bir fazın worktree'si ana branch'e
1142
+ * squash-merge edilirken çakışma çıkarsa çağrılır. `info.cwd` ana çalışma
1143
+ * ağacına (çakışma işaretçilerinin bulunduğu yer) işaret eder; çözücü oradaki
1144
+ * işaretçileri temizlemeli ve `true` döndürmelidir. Başarılı olursa merge
1145
+ * commit'lenir; aksi halde merge iptal edilir ve worktree `needs-review`'da
1146
+ * saklanır. Tanımlanmazsa çakışma eski davranışla parked-for-review olur.
1147
+ */
1148
+ resolveConflict?: (phase: PhaseNode, info: {
1149
+ conflictFiles: string[];
1150
+ cwd: string;
1151
+ }) => Promise<boolean>;
1152
+ /** Opsiyonel global Brain arbiter: policy/karar/escalation katmanı. */
1153
+ brain?: BrainArbiter;
1026
1154
  /** Bir faz tamamlandığında çağrılır */
1027
1155
  onPhaseComplete?: (phase: PhaseNode) => void;
1028
1156
  /** Bir faz başarısız olduğunda çağrılır */
@@ -1040,6 +1168,12 @@ interface AutoPhaseOptions {
1040
1168
  maxConcurrentTasks?: number;
1041
1169
  /** Başarısız görev retry sayısı */
1042
1170
  maxRetries?: number;
1171
+ /**
1172
+ * Doğrulama kapısı başarısız olduğunda yapılacak maksimum onarım denemesi.
1173
+ * Toplam doğrulama koşusu = maxVerifyAttempts + 1 (ilk koşu + her onarım
1174
+ * sonrası yeniden koşu). Varsayılan 2. `verifyPhase` verilmezse etkisizdir.
1175
+ */
1176
+ maxVerifyAttempts?: number;
1043
1177
  /** Otonom mod: faz tamamlandıkça otomatik sonrakine geç */
1044
1178
  autonomous?: boolean;
1045
1179
  /** Fazlar arası bekleme süresi (ms) */
@@ -1087,7 +1221,15 @@ interface AutoPhaseRunnerOptions extends AutoPhaseOptions {
1087
1221
  /** Faz şablonları */
1088
1222
  phases: PhaseTemplate[];
1089
1223
  /** Task çalıştırma fonksiyonu */
1090
- executeTask: (task: TaskNode, phaseId: string) => Promise<unknown>;
1224
+ executeTask: PhaseExecutionContext['executeTask'];
1225
+ /** Opsiyonel doğrulama kapısı */
1226
+ verifyPhase?: PhaseExecutionContext['verifyPhase'];
1227
+ /** Doğrulama başarısız olduğunda opsiyonel onarım geçişi */
1228
+ repairPhase?: PhaseExecutionContext['repairPhase'];
1229
+ /** Worktree merge çakışmaları için opsiyonel çözücü */
1230
+ resolveConflict?: PhaseExecutionContext['resolveConflict'];
1231
+ /** Opsiyonel Brain arbiter */
1232
+ brain?: PhaseExecutionContext['brain'];
1091
1233
  /** Faz tamamlandığında */
1092
1234
  onPhaseComplete?: (phase: PhaseNode) => void;
1093
1235
  /** Faz başarısız olduğunda */
@@ -1195,6 +1337,19 @@ declare class PhaseOrchestrator {
1195
1337
  stop(): void;
1196
1338
  private tick;
1197
1339
  private startPhase;
1340
+ /**
1341
+ * Run the verification gate for a phase whose tasks all succeeded. Verifies in
1342
+ * the phase's worktree; on failure, runs the repair pass and re-verifies, up to
1343
+ * `maxVerifyAttempts` repairs. Returns the final verdict. When no `verifyPhase`
1344
+ * callback is wired the gate is a no-op and always passes.
1345
+ */
1346
+ private runVerifyGate;
1347
+ /** Worktree env (cwd/branch) for a phase, or undefined if it runs on the shared tree. */
1348
+ private worktreeEnv;
1349
+ /** Shared failure bookkeeping for a phase whose tasks ran but the phase failed. */
1350
+ private failPhaseAfterTasks;
1351
+ /** Trim long verifier output so it fits cleanly in an event/error message. */
1352
+ private truncate;
1198
1353
  /**
1199
1354
  * Commit the phase's worktree changes, then enqueue the merge back into the
1200
1355
  * base branch. Merges run dependency-ordered (a phase merges only after its
@@ -1202,8 +1357,14 @@ declare class PhaseOrchestrator {
1202
1357
  * concurrent writes to the base tree.
1203
1358
  */
1204
1359
  private commitAndEnqueueMerge;
1205
- /** Squash-merge one phase. Conflicts mark the worktree needs-review (run continues). */
1360
+ /**
1361
+ * Squash-merge one phase. When a `resolveConflict` callback is wired, a merge
1362
+ * conflict is handed to it (a resolver subagent) before giving up; only if
1363
+ * that fails does the worktree fall to needs-review and the run continues.
1364
+ */
1206
1365
  private mergeOne;
1366
+ private shouldAttemptConflictResolution;
1367
+ private setIntegrationMetadata;
1207
1368
  /** A failed phase keeps its worktree on disk for inspection (no merge). */
1208
1369
  private keepWorktreeForReview;
1209
1370
  private executePhaseTasks;
@@ -1228,6 +1389,7 @@ declare class PhaseOrchestrator {
1228
1389
  releaseAgent(phaseId: string, agentId: string): void;
1229
1390
  private emit;
1230
1391
  private createNoopEventBus;
1392
+ private waitWhilePaused;
1231
1393
  private delay;
1232
1394
  }
1233
1395
 
@@ -1399,6 +1561,40 @@ declare class CheckpointManager {
1399
1561
  private pruneCheckpoints;
1400
1562
  }
1401
1563
 
1564
+ /**
1565
+ * Per-task model matrix resolution.
1566
+ *
1567
+ * The matrix (Config.modelMatrix) maps a catalog **role**, a **phase** name, or
1568
+ * the `*` default to a {@link ModelMatrixEntry} (model + optional provider).
1569
+ * At subagent spawn time we resolve the most specific match so different task
1570
+ * types can run on different models — e.g. `security-scanner` on one model,
1571
+ * `documentation` on another — while the leader keeps its own model.
1572
+ *
1573
+ * Resolution precedence (most → least specific):
1574
+ * 1. exact role (matrix["security-scanner"])
1575
+ * 2. the role's phase (matrix["review"])
1576
+ * 3. the `*` default (matrix["*"])
1577
+ * 4. undefined (caller falls back to the leader model)
1578
+ *
1579
+ * Set via the `/setmodel` slash command; this module is the single source of
1580
+ * truth both that command and the spawn path use to validate + resolve keys.
1581
+ */
1582
+
1583
+ /** All valid phase keys, in catalog order. */
1584
+ declare const MATRIX_PHASE_KEYS: readonly string[];
1585
+ /** The phase a catalog role belongs to, or undefined for unknown roles. */
1586
+ declare function phaseForRole(role: string | undefined): string | undefined;
1587
+ /**
1588
+ * Resolve the matrix entry for a subagent role. Returns the most specific
1589
+ * match (role → phase → `*`), or undefined when nothing matches.
1590
+ */
1591
+ declare function resolveModelMatrix(matrix: Record<string, ModelMatrixEntry> | undefined, role: string | undefined): ModelMatrixEntry | undefined;
1592
+ type MatrixKeyKind = 'role' | 'phase' | 'default' | 'unknown';
1593
+ /** Classify a matrix key so `/setmodel` can reject typos before persisting. */
1594
+ declare function matrixKeyKind(key: string): MatrixKeyKind;
1595
+ /** True when `key` is a usable matrix key (role, phase, or `*`). */
1596
+ declare function isValidMatrixKey(key: string): boolean;
1597
+
1402
1598
  /**
1403
1599
  * CollaborationBus — kernel-level pause/resume signal for the
1404
1600
  * collaboration `controller` role (Phase 3 of idea #13 from IDEAS.md).
@@ -1745,4 +1941,4 @@ interface PlanPluginOptions {
1745
1941
  */
1746
1942
  declare function createPlanPlugin(opts?: PlanPluginOptions): Plugin;
1747
1943
 
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 };
1944
+ export { AddAttachmentInput, AttachmentRef, AttachmentStore, type AutoPhaseOptions, type AutoPhasePlanResult, AutoPhasePlanner, type AutoPhasePlannerOptions, AutoPhaseRunner, type AutoPhaseRunnerOptions, type BootConfigOptions, type BootConfigResult, BrainArbiter, BuildContext, type Checkpoint, CheckpointManager, type CheckpointManagerOptions, type CollabBusState, type InjectedToolResult as CollabInjectedToolResult, type CollabPauseMiddlewareOptions, CollaborationBus, Config, ConfigStore, Container, ContentBlock, Context, type ContinueDirective, DefaultLogger, DefaultPathResolver, DefaultPluginAPI, DefaultPromptStore, DefaultSecretVault, 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, MATRIX_PHASE_KEYS, type MCPRegistryHandle, MCPRegistryView, MCPServerConfig, type MatrixKeyKind, MemoryStore, MetricsSink, MetricsSinkView, ModeStore, ModelCapabilities, ModelMatrixEntry, 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, bootConfig, buildBtwBlock, collabInjectMiddleware, collabPauseMiddleware, consumeBtwNotes, createAutoPhaseFromTaskGraph, createGitPlugin, createMcpControlTool, createObservabilityPlugin, createPlanPlugin, createPromptsPlugin, createSecurityPlugin, createSecuritySlashCommand, createSkillsPlugin, createSyncPlugin, defaultGitignoreUpdater, defaultOrchestrator, defaultReportGenerator, defaultSecurityScanner, defaultSkillGenerator, defaultTechStackDetector, flagsToConfigPatch, hashRequest, isValidMatrixKey, loadPlugins, makeContinueToNextIterationTool, matrixKeyKind, parseContinueDirective, pendingBtwCount, phaseForRole, resolveModelMatrix, runProviderWithRetry, securitySlashCommand, setBtwNote, stableStringify, unloadPlugins };