@wrongstack/core 0.267.0 → 0.269.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 (78) hide show
  1. package/dist/{agent-bridge-STJ3JwwK.d.ts → agent-bridge-PcHQl_UQ.d.ts} +1 -1
  2. package/dist/{agent-subagent-runner-CzPGP3jA.d.ts → agent-subagent-runner-SHJW7t8q.d.ts} +8 -8
  3. package/dist/{brain-Cdg77tVN.d.ts → brain-BYcK__Ym.d.ts} +1 -1
  4. package/dist/{compactor-iMZ84CXq.d.ts → compactor-C2RKEBtC.d.ts} +1 -1
  5. package/dist/{config-Du3pYYln.d.ts → config-C_ae2k86.d.ts} +79 -2
  6. package/dist/{context-dT5Ueund.d.ts → context-Dp87Bcaq.d.ts} +47 -1
  7. package/dist/coordination/index.d.ts +62 -160
  8. package/dist/coordination/index.js +566 -149
  9. package/dist/coordination/index.js.map +1 -1
  10. package/dist/defaults/index.d.ts +26 -25
  11. package/dist/defaults/index.js +366 -137
  12. package/dist/defaults/index.js.map +1 -1
  13. package/dist/execution/index.d.ts +72 -16
  14. package/dist/execution/index.js +267 -55
  15. package/dist/execution/index.js.map +1 -1
  16. package/dist/execution/prompt-enhancer.d.ts +1 -1
  17. package/dist/extension/index.d.ts +7 -6
  18. package/dist/global-mailbox-Bvrz1P3f.d.ts +664 -0
  19. package/dist/{goal-preamble-SulMTowG.d.ts → goal-preamble-CA_4yiGQ.d.ts} +9 -9
  20. package/dist/{goal-store-CABDwdFE.d.ts → goal-store-DhuJoUNG.d.ts} +1 -1
  21. package/dist/hq/index.d.ts +204 -0
  22. package/dist/hq/index.js +1931 -0
  23. package/dist/hq/index.js.map +1 -0
  24. package/dist/{index-DtCVWel4.d.ts → index-CZQ6Pwbs.d.ts} +8 -8
  25. package/dist/{index-Bms0m4oy.d.ts → index-W4VJCzHa.d.ts} +5 -5
  26. package/dist/{index-IEuxQd-E.d.ts → index-whDfTANu.d.ts} +2 -2
  27. package/dist/index.d.ts +46 -42
  28. package/dist/index.js +3472 -1651
  29. package/dist/index.js.map +1 -1
  30. package/dist/infrastructure/index.d.ts +6 -6
  31. package/dist/infrastructure/index.js +48 -21
  32. package/dist/infrastructure/index.js.map +1 -1
  33. package/dist/kernel/index.d.ts +10 -9
  34. package/dist/{pipeline-BfD2k1rT.d.ts → mailbox-types-Ct2hJq0P.d.ts} +1 -244
  35. package/dist/{mcp-servers-C2cBTxUR.d.ts → mcp-servers-DJdZiRcv.d.ts} +10 -4
  36. package/dist/models/index.d.ts +5 -5
  37. package/dist/models/index.js +4 -3
  38. package/dist/models/index.js.map +1 -1
  39. package/dist/{models-registry-BqGZNJQ-.d.ts → models-registry-C3a-2-Yd.d.ts} +1 -1
  40. package/dist/{multi-agent-coordinator-B8R43uPz.d.ts → multi-agent-coordinator-CJSpTe5O.d.ts} +1 -1
  41. package/dist/{null-fleet-bus-CnXa5oTH.d.ts → null-fleet-bus-QVshIsDx.d.ts} +6 -6
  42. package/dist/observability/index.d.ts +2 -2
  43. package/dist/{parallel-eternal-engine-DdNnw9BQ.d.ts → parallel-eternal-engine-D9y5Pkcc.d.ts} +9 -15
  44. package/dist/{path-resolver-COIMLCQL.d.ts → path-resolver-CnQ8SIfh.d.ts} +4 -3
  45. package/dist/{permission-B75JAi3-.d.ts → permission-CvYQNUqZ.d.ts} +1 -1
  46. package/dist/{permission-policy-DlR9eJAM.d.ts → permission-policy-D5Ss8j4B.d.ts} +2 -3
  47. package/dist/pipeline-l_zzFRh3.d.ts +245 -0
  48. package/dist/{plan-templates-DSIKCXZN.d.ts → plan-templates-NtPgyeJA.d.ts} +6 -5
  49. package/dist/{provider-model-resolve-BNRsNuJx.d.ts → provider-model-resolve-d5poT5y0.d.ts} +3 -3
  50. package/dist/{provider-runner-CX7iIvox.d.ts → provider-runner-gkctlQV_.d.ts} +3 -3
  51. package/dist/{retry-policy-BilV1ujH.d.ts → retry-policy-CtFhfwa8.d.ts} +1 -1
  52. package/dist/sdd/index.d.ts +9 -8
  53. package/dist/sdd/index.js +33 -3
  54. package/dist/sdd/index.js.map +1 -1
  55. package/dist/{secret-vault-gkvEZZfE.d.ts → secret-vault-BLsVmTIK.d.ts} +1 -1
  56. package/dist/security/index.d.ts +5 -5
  57. package/dist/security/index.js +39 -29
  58. package/dist/security/index.js.map +1 -1
  59. package/dist/{selector-Bc7eWtT3.d.ts → selector-CXl2_y9W.d.ts} +1 -1
  60. package/dist/{session-event-bridge-D-araDEz.d.ts → session-event-bridge-Ccud20CC.d.ts} +1 -1
  61. package/dist/{session-reader-D7Dapswh.d.ts → session-reader-ZeXQmsmE.d.ts} +1 -1
  62. package/dist/skills/index.js.map +1 -1
  63. package/dist/storage/index.d.ts +16 -12
  64. package/dist/storage/index.js +273 -100
  65. package/dist/storage/index.js.map +1 -1
  66. package/dist/tools/index.d.ts +2 -2
  67. package/dist/tools/index.js +166 -31
  68. package/dist/tools/index.js.map +1 -1
  69. package/dist/types/index.d.ts +22 -21
  70. package/dist/types/index.js +178 -70
  71. package/dist/types/index.js.map +1 -1
  72. package/dist/utils/index.d.ts +22 -3
  73. package/dist/utils/index.js +197 -25
  74. package/dist/utils/index.js.map +1 -1
  75. package/package.json +5 -1
  76. package/skills/chimera/SKILL.md +1 -1
  77. package/skills/typescript-strict/SKILL.md +3 -3
  78. package/skills/typescript-strict/SKILL.save.md +1 -1
@@ -1,4 +1,4 @@
1
- import { B as BridgeTransport, a as BridgeMessage, A as AgentBridge, b as AgentBridgeConfig } from './agent-subagent-runner-CzPGP3jA.js';
1
+ import { B as BridgeTransport, a as BridgeMessage, A as AgentBridge, b as AgentBridgeConfig } from './agent-subagent-runner-SHJW7t8q.js';
2
2
 
3
3
  /**
4
4
  * In-memory pub/sub transport for agent-to-agent messaging.
@@ -1,12 +1,12 @@
1
- import { c as ToolCallPipelinePayload, d as ToolWrapper, E as ExtensionRegistry, S as SystemPromptContributor, e as ToolRegistry, P as ProviderRegistry, A as AgentPipelines, f as ToolExecutorLike, g as AgentInit, h as AgentInput, R as RunResult } from './index-Bms0m4oy.js';
2
- import { C as Container, R as ReadonlyPipeline, a as Renderer } from './pipeline-BfD2k1rT.js';
3
- import { E as EventBus, a as EventName, L as Listener } from './brain-Cdg77tVN.js';
4
- import { R as RetryPolicy, E as ErrorHandler } from './retry-policy-BilV1ujH.js';
1
+ import { c as ToolCallPipelinePayload, d as ToolWrapper, E as ExtensionRegistry, S as SystemPromptContributor, e as ToolRegistry, P as ProviderRegistry, A as AgentPipelines, f as ToolExecutorLike, g as AgentInit, h as AgentInput, R as RunResult } from './index-W4VJCzHa.js';
2
+ import { C as Container, R as ReadonlyPipeline, a as Renderer } from './pipeline-l_zzFRh3.js';
3
+ import { E as EventBus, a as EventName, L as Listener } from './brain-BYcK__Ym.js';
4
+ import { R as RetryPolicy, E as ErrorHandler } from './retry-policy-CtFhfwa8.js';
5
5
  import { L as Logger } from './logger-B63L5bTg.js';
6
6
  import { T as Tracer } from './observability-D-HZN_mF.js';
7
- import { P as PermissionPolicy } from './permission-B75JAi3-.js';
8
- import { U as Usage, C as Context, J as JSONSchema, R as Request, b as Response, g as ContentBlock, o as TextBlock, T as Tool, P as Provider, p as RunOptions } from './context-dT5Ueund.js';
9
- import { W as WireFamily, H as HookEvent, f as HookMatcher, I as InProcessHook, i as Config } from './config-Du3pYYln.js';
7
+ import { P as PermissionPolicy } from './permission-CvYQNUqZ.js';
8
+ import { U as Usage, C as Context, J as JSONSchema, R as Request, b as Response, g as ContentBlock, p as TextBlock, T as Tool, P as Provider, s as RunOptions } from './context-Dp87Bcaq.js';
9
+ import { W as WireFamily, H as HookEvent, f as HookMatcher, I as InProcessHook, i as Config } from './config-C_ae2k86.js';
10
10
 
11
11
  /**
12
12
  * Single fleet-wide event with subagent attribution. Whatever a child
@@ -791,7 +791,7 @@ interface SubagentContext {
791
791
  * Two-phase initialization: `spawn()` creates the subagent before the
792
792
  * bridge is wired (`setSubagentBridge()`), so `parentBridge` is nullable
793
793
  * by design. Readers must `hasParentBridge()`-guard or null-check before
794
- * use; the prior `null as unknown as AgentBridge` cast was a type lie
794
+ * use; the prior `null as never as AgentBridge` cast was a type lie
795
795
  * that hid this from the compiler.
796
796
  */
797
797
  parentBridge: AgentBridge | null;
@@ -1,4 +1,4 @@
1
- import { U as Usage, C as Context, j as ToolProgressEvent, T as Tool, k as ToolOutputMetadata } from './context-dT5Ueund.js';
1
+ import { U as Usage, C as Context, j as ToolProgressEvent, T as Tool, k as ToolOutputMetadata } from './context-Dp87Bcaq.js';
2
2
 
3
3
  type MemoryScope = 'project-agents' | 'project-memory' | 'user-memory';
4
4
  type MemoryType = 'fact' | 'decision' | 'convention' | 'preference' | 'reference' | 'anti_pattern';
@@ -1,4 +1,4 @@
1
- import { C as Context } from './context-dT5Ueund.js';
1
+ import { C as Context } from './context-Dp87Bcaq.js';
2
2
 
3
3
  interface CompactRepairReport {
4
4
  removedToolUses: string[];
@@ -1,4 +1,4 @@
1
- import { l as Capabilities, f as Permission } from './context-dT5Ueund.js';
1
+ import { l as ReasoningConfig, m as Capabilities, f as Permission, n as ReasoningEffort, o as CacheTtl } from './context-Dp87Bcaq.js';
2
2
 
3
3
  type ContextWindowModeId = 'balanced' | 'frugal' | 'deep' | 'archival';
4
4
  type ContextWindowAggressiveOn = 'hard' | 'soft' | 'warn';
@@ -134,12 +134,14 @@ type HookEntry = {
134
134
  * Mirror of the models.dev/api.json schema. Top-level is keyed by provider id.
135
135
  * We keep `unknown` for fields we don't read so the cached payload stays faithful.
136
136
  */
137
+
137
138
  interface ModelsDevModel {
138
139
  id: string;
139
140
  name: string;
140
141
  family?: string | undefined;
141
142
  attachment?: boolean | undefined;
142
143
  reasoning?: boolean | undefined;
144
+ reasoningConfig?: ReasoningConfig | undefined;
143
145
  tool_call?: boolean | undefined;
144
146
  temperature?: boolean | undefined;
145
147
  knowledge?: string | undefined;
@@ -155,6 +157,8 @@ interface ModelsDevModel {
155
157
  output?: number | undefined;
156
158
  cache_read?: number | undefined;
157
159
  cache_write?: number | undefined;
160
+ cache_write_5m?: number | undefined;
161
+ cache_write_1h?: number | undefined;
158
162
  [k: string]: number | undefined;
159
163
  };
160
164
  limit?: {
@@ -202,6 +206,7 @@ interface ResolvedModel {
202
206
  maxContext: number;
203
207
  maxOutput?: number | undefined;
204
208
  knowledge?: string | undefined;
209
+ reasoningConfig?: ReasoningConfig | undefined;
205
210
  };
206
211
  cost?: ModelsDevModel['cost'] | undefined;
207
212
  }
@@ -224,6 +229,60 @@ interface ModelsRegistry {
224
229
  ageSeconds(): Promise<number>;
225
230
  }
226
231
 
232
+ /**
233
+ * Runtime reasoning controls the user can set per-session/project. Mapped into
234
+ * the provider `Request.reasoning` field by the model-runtime request
235
+ * middleware, gated by the active model's `reasoningConfig` capabilities so
236
+ * unsupported values are omitted (and warned) instead of triggering provider
237
+ * 400s. See `resolveReasoningForRequest()` in packages/core.
238
+ */
239
+ interface ModelRuntimeReasoningConfig {
240
+ /**
241
+ * Whether to send explicit reasoning enable/disable.
242
+ * - 'auto' → do not send explicit fields; provider/model default wins
243
+ * - 'on' → send `reasoning.enabled = true`
244
+ * - 'off' → send `reasoning.enabled = false` only when the model supports disable
245
+ */
246
+ mode?: 'auto' | 'on' | 'off' | undefined;
247
+ /** Reasoning effort. Only sent when the model advertises `effortSupported`. */
248
+ effort?: ReasoningEffort | undefined;
249
+ /** Preserve thinking across turns. Only sent when `preserveThinking !== 'unsupported'`. */
250
+ preserve?: boolean | undefined;
251
+ }
252
+ /**
253
+ * Runtime prompt-cache controls mapped into `Request.cache`. Currently only the
254
+ * Anthropic TTL toggle (5m vs 1h) is exposed; other providers ignore it.
255
+ */
256
+ interface ModelRuntimeCacheConfig {
257
+ ttl?: CacheTtl | undefined;
258
+ }
259
+ /**
260
+ * Shared runtime controls applied to every provider request, regardless of host
261
+ * (REPL / TUI / WebUI). The CLI installs a single request-pipeline middleware
262
+ * that reads these and mutates the outgoing `Request`.
263
+ */
264
+ interface ModelRuntimeConfig {
265
+ reasoning?: ModelRuntimeReasoningConfig | undefined;
266
+ cache?: ModelRuntimeCacheConfig | undefined;
267
+ }
268
+ /**
269
+ * HQ client connection settings. Same-machine clients can auto-discover the
270
+ * local HQ auth file; remote clients use this config-backed URL/token pair.
271
+ */
272
+ interface HqClientConfig {
273
+ /** Enable HQ publishing. Env WRONGSTACK_HQ_ENABLED still overrides at runtime. */
274
+ enabled?: boolean | undefined;
275
+ /** HQ HTTP base URL, e.g. http://host:3499. */
276
+ url?: string | undefined;
277
+ /** Client token for /ws/client. Stored encrypted by SecretVault when persisted. */
278
+ token?: string | undefined;
279
+ /** Optional HQ data dir for same-machine auth.json discovery. */
280
+ dataDir?: string | undefined;
281
+ /** Send raw content previews to HQ instead of redacted previews. */
282
+ rawContent?: boolean | undefined;
283
+ /** Override project display name in HQ. */
284
+ projectAlias?: string | undefined;
285
+ }
227
286
  /**
228
287
  * Token-saving mode tier levels. Controls how aggressively the system prompt
229
288
  * is compacted to reduce per-request token consumption.
@@ -243,6 +302,13 @@ type TokenSavingTier = 'off' | 'minimal' | 'light' | 'medium' | 'aggressive';
243
302
  * - `undefined` → 'off'
244
303
  */
245
304
  declare function normalizeTokenSavingTier(val?: TokenSavingTier | boolean): TokenSavingTier;
305
+ declare const DEFAULT_TUI_THINKING_WORD = "thinking";
306
+ declare const MAX_TUI_THINKING_WORD_LENGTH = 16;
307
+ /**
308
+ * Normalize the configurable statusline word shown while the TUI is working.
309
+ * The value must be a single short word; invalid values fall back to the default.
310
+ */
311
+ declare function normalizeTuiThinkingWord(value: unknown): string;
246
312
  interface ContextConfig {
247
313
  /** Context-window policy mode. Controls compaction thresholds and preservation depth. */
248
314
  mode?: ContextWindowModeId | undefined;
@@ -506,6 +572,8 @@ interface FeaturesConfig {
506
572
  interface AutonomyConfig {
507
573
  /** ms to wait before auto-proceeding in 'auto' mode. Default: 45000. */
508
574
  autoProceedDelayMs?: number | undefined;
575
+ /** Single short word shown in the TUI rainbow working-state chip. Default: "thinking". */
576
+ thinkingWord?: string | undefined;
509
577
  }
510
578
  /**
511
579
  * Automatic codebase symbol-index maintenance. Keeps the `codebase-search`
@@ -689,6 +757,15 @@ interface Config {
689
757
  * Controls what gets written to the persistent JSONL transcript.
690
758
  */
691
759
  session?: SessionLoggingConfig | undefined;
760
+ /**
761
+ * Runtime reasoning / cache controls applied to every provider request
762
+ * (REPL/TUI/WebUI). Mapped into `Request.reasoning` and `Request.cache` by a
763
+ * single request-pipeline middleware, gated by the active model's
764
+ * capabilities. See `ModelRuntimeConfig`.
765
+ */
766
+ modelRuntime?: ModelRuntimeConfig | undefined;
767
+ /** HQ client publishing settings, used by CLI/REPL/TUI/WebUI consistently. */
768
+ hq?: HqClientConfig | undefined;
692
769
  /**
693
770
  * Cloud sync configuration. Stored separately in sync.json to avoid
694
771
  * accidentally committing the GitHub token to project configs.
@@ -750,4 +827,4 @@ interface ConfigStore {
750
827
  watch(cb: (next: Readonly<Config>, prev: Readonly<Config>) => void): () => void;
751
828
  }
752
829
 
753
- export { type AutonomyConfig as A, type ProviderApiKey as B, type ContextWindowAggressiveOn as C, DEFAULT_CONTEXT_WINDOW_MODE_ID as D, type SessionLoggingConfig as E, type FeaturesConfig as F, type SyncCategory as G, type HookEvent as H, type InProcessHook as I, type ToolsConfig as J, formatContextWindowModeList as K, type LaunchConfig as L, type ModelsRegistry as M, getContextWindowMode as N, isContextWindowModeId as O, type ProviderConfig as P, listContextWindowModes as Q, type ResolvedProvider as R, type ShellHook as S, type TokenSavingTier as T, normalizeTokenSavingTier as U, resolveContextWindowPolicy as V, type WireFamily as W, type ModelsDevPayload as a, type ResolvedModel as b, type MCPServerConfig as c, type ModelMatrixEntry as d, type ModelsDevModel as e, type HookMatcher as f, type HookEntry as g, type ContextWindowPolicy as h, type Config as i, type ConfigStore as j, type ConfigLoader as k, type SyncConfig as l, type HookInput as m, type HookOutcome as n, CONTEXT_WINDOW_MODES as o, type CircuitBreakerRuntimeConfig as p, type ContextConfig as q, type ContextWindowConfigLike as r, type ContextWindowMode as s, type ContextWindowModeId as t, type ContextWindowThresholds as u, type CustomModelDefinition as v, type IndexingConfig as w, type LogConfig as x, type ModelsDevProvider as y, type PluginConfig as z };
830
+ export { normalizeTokenSavingTier as $, type AutonomyConfig as A, MAX_TUI_THINKING_WORD_LENGTH as B, type ContextWindowAggressiveOn as C, DEFAULT_CONTEXT_WINDOW_MODE_ID as D, type ModelRuntimeCacheConfig as E, type FeaturesConfig as F, type ModelRuntimeConfig as G, type HookEvent as H, type InProcessHook as I, type ModelRuntimeReasoningConfig as J, type ModelsDevProvider as K, type LaunchConfig as L, type ModelsRegistry as M, type PluginConfig as N, type ProviderApiKey as O, type ProviderConfig as P, type SessionLoggingConfig as Q, type ResolvedProvider as R, type ShellHook as S, type TokenSavingTier as T, type SyncCategory as U, type ToolsConfig as V, type WireFamily as W, formatContextWindowModeList as X, getContextWindowMode as Y, isContextWindowModeId as Z, listContextWindowModes as _, type ModelsDevPayload as a, normalizeTuiThinkingWord as a0, resolveContextWindowPolicy as a1, type ResolvedModel as b, type MCPServerConfig as c, type ModelMatrixEntry as d, type ModelsDevModel as e, type HookMatcher as f, type HookEntry as g, type ContextWindowPolicy as h, type Config as i, type ConfigStore as j, type ConfigLoader as k, type SyncConfig as l, type HookInput as m, type HookOutcome as n, CONTEXT_WINDOW_MODES as o, type CircuitBreakerRuntimeConfig as p, type ContextConfig as q, type ContextWindowConfigLike as r, type ContextWindowMode as s, type ContextWindowModeId as t, type ContextWindowThresholds as u, type CustomModelDefinition as v, DEFAULT_TUI_THINKING_WORD as w, type HqClientConfig as x, type IndexingConfig as y, type LogConfig as z };
@@ -481,6 +481,29 @@ interface ToolCallContext {
481
481
  ctx: Context;
482
482
  signal: AbortSignal;
483
483
  }
484
+ /**
485
+ * Error categories for tool execution failures.
486
+ * Used by the executor to classify errors and determine retry strategy.
487
+ */
488
+ declare enum ToolErrorCategory {
489
+ TRANSIENT = "transient",// ETIMEDOUT, ECONNRESET, network timeout, HTTP 429/503
490
+ NOT_FOUND = "not_found",// ENOENT, ENOTDIR, HTTP 404
491
+ PERMISSION = "permission",// EACCES, EPERM, HTTP 401/403
492
+ VALIDATION = "validation",// schema validation error, HTTP 400
493
+ FATAL = "fatal"
494
+ }
495
+ /**
496
+ * Structured tool error information for the LLM and retry logic.
497
+ */
498
+ interface ToolErrorInfo {
499
+ readonly category: ToolErrorCategory;
500
+ /** Whether the operation can be retried automatically. */
501
+ readonly retryable: boolean;
502
+ /** User-facing message describing the error. */
503
+ readonly userMessage: string;
504
+ /** Optional technical detail for debugging. */
505
+ readonly detail?: string;
506
+ }
484
507
 
485
508
  /**
486
509
  * Token usage for a single provider call, normalized across providers.
@@ -502,11 +525,32 @@ interface ToolCallContext {
502
525
  * invariant — a TOTAL `input` plus a separate `cacheRead` count would bill
503
526
  * cached tokens twice and skew cache-hit-ratio reporting.
504
527
  */
528
+ type ReasoningEffort = 'none' | 'minimal' | 'low' | 'medium' | 'high' | 'xhigh' | 'max';
529
+ type CacheTtl = '5m' | '1h';
505
530
  interface Usage {
506
531
  input: number;
507
532
  output: number;
508
533
  cacheRead?: number | undefined;
534
+ /** Back-compat aggregate of all cache-write tokens. Prefer TTL-specific fields when present. */
509
535
  cacheWrite?: number | undefined;
536
+ cacheWrite5m?: number | undefined;
537
+ cacheWrite1h?: number | undefined;
538
+ }
539
+ interface ReasoningRequest {
540
+ enabled?: boolean | undefined;
541
+ effort?: ReasoningEffort | undefined;
542
+ preserve?: boolean | undefined;
543
+ display?: 'summarized' | 'omitted' | undefined;
544
+ }
545
+ interface RequestCacheControl {
546
+ ttl?: CacheTtl | undefined;
547
+ }
548
+ interface ReasoningConfig {
549
+ default: 'enabled' | 'disabled' | 'adaptive' | 'always_on';
550
+ disableSupported: boolean;
551
+ effortSupported: boolean;
552
+ effortLevels: ReasoningEffort[];
553
+ preserveThinking: 'unsupported' | 'optional' | 'always_on';
510
554
  }
511
555
  interface Capabilities {
512
556
  tools: boolean;
@@ -533,6 +577,8 @@ interface Request {
533
577
  type: 'tool' | undefined;
534
578
  name: string;
535
579
  };
580
+ reasoning?: ReasoningRequest | undefined;
581
+ cache?: RequestCacheControl | undefined;
536
582
  }
537
583
  type StopReason = 'end_turn' | 'tool_use' | 'max_tokens' | 'stop_sequence' | 'refusal';
538
584
  interface Response {
@@ -1503,4 +1549,4 @@ declare class Context implements RunEnv {
1503
1549
  usage(): Usage;
1504
1550
  }
1505
1551
 
1506
- export { type StopReason as $, AgentError as A, type ContextRepeatedReadEvidence as B, Context as C, type ErrorCode as D, ERROR_CODES as E, type ErrorSeverity as F, type ErrorSubsystem as G, type FileSnapshot as H, FsError as I, type JSONSchema as J, type ImageBlock as K, type MessageRole as L, type Message as M, PluginError as N, type ProviderErrorBody as O, type Provider as P, type ReadonlyConversationState as Q, type Request as R, type SessionEvent as S, type Tool as T, type Usage as U, type RiskTier as V, type RunEnv as W, SddError as X, SessionError as Y, type StateChange as Z, type StateChangeHandler as _, type SessionWriter as a, type StreamEvent as a0, StreamHangError as a1, type ThinkingBlock as a2, type ToolCallContext as a3, ToolError as a4, type ToolEvidenceStatus as a5, type ToolFinalEvent as a6, type ToolIconId as a7, type ToolStreamEvent as a8, WrongStackError as a9, asBlocks as aa, asText as ab, extractRunEnv as ac, isAgentError as ad, isConfigError as ae, isFsError as af, isImageBlock as ag, isPluginError as ah, isSddError as ai, isSessionError as aj, isTextBlock as ak, isThinkingBlock as al, isToolError as am, isToolResultBlock as an, isToolUseBlock as ao, isWrongStackError as ap, toWrongStackError as aq, wrapAsState as ar, type Response as b, type TokenCounter as c, type CacheStats as d, ProviderError as e, type Permission as f, type ContentBlock as g, type SessionMetadata as h, type SessionStore as i, type ToolProgressEvent as j, type ToolOutputMetadata as k, type Capabilities as l, type ToolUseBlock as m, type ToolResultBlock as n, type TextBlock as o, type RunOptions as p, type ResumedSession as q, type SessionData as r, type SessionSummary as s, type TodoItem as t, ConversationState as u, ConfigError as v, type ContextEvidenceState as w, type ContextFileEvidence as x, type ContextInit as y, type ContextIntentEvidence as z };
1552
+ export { type RunEnv as $, AgentError as A, type ContextFileEvidence as B, Context as C, type ContextInit as D, type ContextIntentEvidence as E, type ContextRepeatedReadEvidence as F, ERROR_CODES as G, type ErrorCode as H, type ErrorSeverity as I, type JSONSchema as J, type ErrorSubsystem as K, type FileSnapshot as L, type Message as M, FsError as N, type ImageBlock as O, type Provider as P, type MessageRole as Q, type Request as R, type SessionEvent as S, type Tool as T, type Usage as U, PluginError as V, type ProviderErrorBody as W, type ReadonlyConversationState as X, type ReasoningRequest as Y, type RequestCacheControl as Z, type RiskTier as _, type SessionWriter as a, SddError as a0, SessionError as a1, type StateChange as a2, type StateChangeHandler as a3, type StopReason as a4, type StreamEvent as a5, StreamHangError as a6, type ThinkingBlock as a7, type ToolCallContext as a8, ToolError as a9, ToolErrorCategory as aa, type ToolErrorInfo as ab, type ToolEvidenceStatus as ac, type ToolFinalEvent as ad, type ToolIconId as ae, type ToolStreamEvent as af, WrongStackError as ag, asBlocks as ah, asText as ai, extractRunEnv as aj, isAgentError as ak, isConfigError as al, isFsError as am, isImageBlock as an, isPluginError as ao, isSddError as ap, isSessionError as aq, isTextBlock as ar, isThinkingBlock as as, isToolError as at, isToolResultBlock as au, isToolUseBlock as av, isWrongStackError as aw, toWrongStackError as ax, wrapAsState as ay, type Response as b, type TokenCounter as c, type CacheStats as d, ProviderError as e, type Permission as f, type ContentBlock as g, type SessionMetadata as h, type SessionStore as i, type ToolProgressEvent as j, type ToolOutputMetadata as k, type ReasoningConfig as l, type Capabilities as m, type ReasoningEffort as n, type CacheTtl as o, type TextBlock as p, type ToolUseBlock as q, type ToolResultBlock as r, type RunOptions as s, type ResumedSession as t, type SessionData as u, type SessionSummary as v, type TodoItem as w, ConversationState as x, ConfigError as y, type ContextEvidenceState as z };
@@ -1,23 +1,25 @@
1
- import { E as EventBus, B as BrainArbiter, f as BrainDecisionOption, k as BrainRisk, h as BrainDecisionRequest, e as BrainDecision, i as BrainDecisionSource } from '../brain-Cdg77tVN.js';
2
- export { g as BrainDecisionQueue, j as BrainFallback, D as DefaultBrainArbiter, l as DefaultBrainArbiterOptions, H as HumanEscalatingBrainArbiter, O as ObservableBrainArbiter, w as formatHumanPrompt } from '../brain-Cdg77tVN.js';
3
- import { H as FleetManager, s as Director } from '../null-fleet-bus-CnXa5oTH.js';
4
- export { A as ACP_AGENTS, a as AGENTS_BY_PHASE, b as AGENT_CATALOG, c as ALL_AGENT_DEFINITIONS, d as ALL_FLEET_AGENTS, e as AUDIT_LOG_AGENT, f as AutoExtendCeiling, g as AutoExtendPolicy, B as BUG_HUNTER_AGENT, h as BugFinding, C as CollabBudgetConfig, i as CollabBudgetOverrides, j as CollabBudgetWarningPayload, k as CollabDebugReport, l as CollabSession, m as CollabSessionOptions, n as CreateDelegateToolOptions, o as CriticConcern, p as CriticEvaluation, D as DEFAULT_DIRECTOR_PREAMBLE, q as DEFAULT_SUBAGENT_BASELINE, r as DelegateHost, t as DirectorAlert, u as DirectorAlertLevel, v as DirectorCancelCollabPayload, w as DirectorPromptParts, x as DirectorSessionFactory, y as DirectorSessionFactoryOptions, F as FLEET_ROSTER, z as FLEET_ROSTER_BUDGETS, E as FLEET_ROSTER_WITHACP, G as FleetCostCapError, I as FleetManagerOptions, J as FleetRosterBudget, K as FleetSpawnBudgetError, L as ICoordinator, M as IFleetManager, N as LargeAnswerStore, O as NULL_FLEET_BUS, R as REFACTOR_PLANNER_AGENT, P as RefactorPhase, Q as RefactorPlan, S as SECURITY_SCANNER_AGENT, T as SharedFileEntry, U as SharedFileSnapshot, V as SubagentPromptParts, W as applyRosterBudget, X as attachAutoExtend, Y as composeDirectorPrompt, Z as composeSubagentPrompt, _ as createDelegateTool, $ as getAgentDefinition, a0 as makeAskResultTool, a1 as makeAskTool, a2 as makeAssignTool, a3 as makeAwaitTasksTool, a4 as makeCollabDebugTool, a5 as makeDirectorSessionFactory, a6 as makeFleetEmitTool, a7 as makeFleetHealthTool, a8 as makeFleetSessionTool, a9 as makeFleetStatusTool, aa as makeFleetUsageTool, ab as makeRollUpTool, ac as makeSpawnTool, ad as makeTerminateTool, ae as makeWorkCompleteTool, af as rosterSummaryFromConfigs } from '../null-fleet-bus-CnXa5oTH.js';
5
- import { b as AgentDefinition } from '../multi-agent-coordinator-B8R43uPz.js';
6
- export { T as AGENT_TOOL_PRESETS, c as AgentBudgetTier, d as AgentCapability, A as AgentPhase, e as DEFAULT_DISPATCH_ROLE, a as DefaultMultiAgentCoordinator, f as DispatchCandidate, D as DispatchClassifier, g as DispatchMethod, h as DispatchOptions, i as DispatchResult, H as HEAVY_BUDGET, L as LIGHT_BUDGET, M as MEDIUM_BUDGET, j as MultiAgentCoordinatorOptions, k as dispatchAgent, m as makeLLMClassifier, s as scoreAgents } from '../multi-agent-coordinator-B8R43uPz.js';
7
- import { F as FleetBus } from '../agent-subagent-runner-CzPGP3jA.js';
8
- export { h as AgentFactory, v as AgentFactoryResult, w as AgentRunnerOptions, x as BudgetExceededError, y as BudgetKind, z as BudgetLimits, E as BudgetNegotiationMode, G as BudgetThresholdDecision, H as BudgetThresholdHandler, I as BudgetThresholdSignal, J as BudgetUsage, L as DECISION_TIMEOUT_MS, N as FleetEvent, O as FleetHandler, i as FleetUsage, j as FleetUsageAggregator, Q as SubagentBudget, Y as SubagentUsageSnapshot, Z as TIMEOUT_PREEMPT_FRACTION, $ as makeAgentSubagentRunner, a0 as withDisabledToolFiltering } from '../agent-subagent-runner-CzPGP3jA.js';
9
- export { I as InMemoryAgentBridge, a as InMemoryBridgeTransport, c as createMessage } from '../agent-bridge-STJ3JwwK.js';
10
- import { c as Mailbox, k as MailboxSendInput, d as MailboxMessage, j as MailboxQuery, g as MailboxAckInput, s as MailboxAckBatchInput, h as MailboxAgentStatus, e as AgentRegistrationInput, A as AgentHeartbeatInput, t as PurgeOptions, u as PurgeResult, v as ClientRegistrationInput, w as ClientHeartbeatInput, x as ClientStatus } from '../pipeline-BfD2k1rT.js';
11
- export { i as MailboxMessageType, l as MailboxTaskContext, o as ReadReceipts, p as RegisteredAgent, r as normalizeRecipient } from '../pipeline-BfD2k1rT.js';
12
- import { C as Context, T as Tool } from '../context-dT5Ueund.js';
1
+ import { E as EventBus, B as BrainArbiter, f as BrainDecisionOption, k as BrainRisk, h as BrainDecisionRequest, e as BrainDecision, i as BrainDecisionSource } from '../brain-BYcK__Ym.js';
2
+ export { g as BrainDecisionQueue, j as BrainFallback, D as DefaultBrainArbiter, l as DefaultBrainArbiterOptions, H as HumanEscalatingBrainArbiter, O as ObservableBrainArbiter, w as formatHumanPrompt } from '../brain-BYcK__Ym.js';
3
+ import { H as FleetManager, s as Director } from '../null-fleet-bus-QVshIsDx.js';
4
+ export { A as ACP_AGENTS, a as AGENTS_BY_PHASE, b as AGENT_CATALOG, c as ALL_AGENT_DEFINITIONS, d as ALL_FLEET_AGENTS, e as AUDIT_LOG_AGENT, f as AutoExtendCeiling, g as AutoExtendPolicy, B as BUG_HUNTER_AGENT, h as BugFinding, C as CollabBudgetConfig, i as CollabBudgetOverrides, j as CollabBudgetWarningPayload, k as CollabDebugReport, l as CollabSession, m as CollabSessionOptions, n as CreateDelegateToolOptions, o as CriticConcern, p as CriticEvaluation, D as DEFAULT_DIRECTOR_PREAMBLE, q as DEFAULT_SUBAGENT_BASELINE, r as DelegateHost, t as DirectorAlert, u as DirectorAlertLevel, v as DirectorCancelCollabPayload, w as DirectorPromptParts, x as DirectorSessionFactory, y as DirectorSessionFactoryOptions, F as FLEET_ROSTER, z as FLEET_ROSTER_BUDGETS, E as FLEET_ROSTER_WITHACP, G as FleetCostCapError, I as FleetManagerOptions, J as FleetRosterBudget, K as FleetSpawnBudgetError, L as ICoordinator, M as IFleetManager, N as LargeAnswerStore, O as NULL_FLEET_BUS, R as REFACTOR_PLANNER_AGENT, P as RefactorPhase, Q as RefactorPlan, S as SECURITY_SCANNER_AGENT, T as SharedFileEntry, U as SharedFileSnapshot, V as SubagentPromptParts, W as applyRosterBudget, X as attachAutoExtend, Y as composeDirectorPrompt, Z as composeSubagentPrompt, _ as createDelegateTool, $ as getAgentDefinition, a0 as makeAskResultTool, a1 as makeAskTool, a2 as makeAssignTool, a3 as makeAwaitTasksTool, a4 as makeCollabDebugTool, a5 as makeDirectorSessionFactory, a6 as makeFleetEmitTool, a7 as makeFleetHealthTool, a8 as makeFleetSessionTool, a9 as makeFleetStatusTool, aa as makeFleetUsageTool, ab as makeRollUpTool, ac as makeSpawnTool, ad as makeTerminateTool, ae as makeWorkCompleteTool, af as rosterSummaryFromConfigs } from '../null-fleet-bus-QVshIsDx.js';
5
+ import { b as AgentDefinition } from '../multi-agent-coordinator-CJSpTe5O.js';
6
+ export { T as AGENT_TOOL_PRESETS, c as AgentBudgetTier, d as AgentCapability, A as AgentPhase, e as DEFAULT_DISPATCH_ROLE, a as DefaultMultiAgentCoordinator, f as DispatchCandidate, D as DispatchClassifier, g as DispatchMethod, h as DispatchOptions, i as DispatchResult, H as HEAVY_BUDGET, L as LIGHT_BUDGET, M as MEDIUM_BUDGET, j as MultiAgentCoordinatorOptions, k as dispatchAgent, m as makeLLMClassifier, s as scoreAgents } from '../multi-agent-coordinator-CJSpTe5O.js';
7
+ import { F as FleetBus } from '../agent-subagent-runner-SHJW7t8q.js';
8
+ export { h as AgentFactory, v as AgentFactoryResult, w as AgentRunnerOptions, x as BudgetExceededError, y as BudgetKind, z as BudgetLimits, E as BudgetNegotiationMode, G as BudgetThresholdDecision, H as BudgetThresholdHandler, I as BudgetThresholdSignal, J as BudgetUsage, L as DECISION_TIMEOUT_MS, N as FleetEvent, O as FleetHandler, i as FleetUsage, j as FleetUsageAggregator, Q as SubagentBudget, Y as SubagentUsageSnapshot, Z as TIMEOUT_PREEMPT_FRACTION, $ as makeAgentSubagentRunner, a0 as withDisabledToolFiltering } from '../agent-subagent-runner-SHJW7t8q.js';
9
+ export { I as InMemoryAgentBridge, a as InMemoryBridgeTransport, c as createMessage } from '../agent-bridge-PcHQl_UQ.js';
10
+ import { b as Mailbox, c as MailboxSendInput, M as MailboxMessage, d as MailboxQuery, e as MailboxAckInput, f as MailboxAckBatchInput, a as MailboxAgentStatus, A as AgentRegistrationInput, g as AgentHeartbeatInput, P as PurgeOptions, j as PurgeResult, C as ClientRegistrationInput, h as ClientHeartbeatInput, i as ClientStatus } from '../mailbox-types-Ct2hJq0P.js';
11
+ export { k as MailboxMessageType, l as MailboxTaskContext, R as ReadReceipts, m as RegisteredAgent, n as normalizeRecipient } from '../mailbox-types-Ct2hJq0P.js';
12
+ export { G as GlobalMailbox, al as resolveProjectDir } from '../global-mailbox-Bvrz1P3f.js';
13
+ import { C as Context, T as Tool } from '../context-Dp87Bcaq.js';
13
14
  import 'node:events';
14
15
  import '../logger-B63L5bTg.js';
15
16
  import '../director-state-BfeCUbmk.js';
16
- import '../config-Du3pYYln.js';
17
- import '../index-Bms0m4oy.js';
17
+ import '../config-C_ae2k86.js';
18
+ import '../index-W4VJCzHa.js';
19
+ import '../pipeline-l_zzFRh3.js';
18
20
  import '../observability-D-HZN_mF.js';
19
- import '../permission-B75JAi3-.js';
20
- import '../retry-policy-BilV1ujH.js';
21
+ import '../permission-CvYQNUqZ.js';
22
+ import '../retry-policy-CtFhfwa8.js';
21
23
 
22
24
  /** Phase 1 · Discovery — map the territory before any work begins. */
23
25
  declare const DISCOVERY_AGENTS: AgentDefinition[];
@@ -60,6 +62,9 @@ declare const META_AGENTS: AgentDefinition[];
60
62
 
61
63
  declare class DefaultMailbox implements Mailbox {
62
64
  private readonly filePath;
65
+ private _messageCache;
66
+ private _messageCacheMtime;
67
+ private _messageCacheSize;
63
68
  constructor(sessionDir: string);
64
69
  get mailboxPath(): string;
65
70
  send(input: MailboxSendInput): Promise<MailboxMessage>;
@@ -78,6 +83,9 @@ declare class DefaultMailbox implements Mailbox {
78
83
  clientHeartbeat(_input: ClientHeartbeatInput): Promise<void>;
79
84
  getClientStatuses(): Promise<ClientStatus[]>;
80
85
  private _readAll;
86
+ private _readAllCached;
87
+ private _setMessageCache;
88
+ private _pushToCache;
81
89
  }
82
90
 
83
91
  /**
@@ -151,145 +159,6 @@ declare class BrainMonitor {
151
159
  private maybeIntervene;
152
160
  }
153
161
 
154
- /**
155
- * GlobalMailbox — project-level inter-agent mailbox with cross-session support.
156
- *
157
- * Stores messages at `~/.wrongstack/projects/<slug>/_mailbox.jsonl` so all
158
- * sessions (terminals, WebUIs) working on the same project share one inbox.
159
- *
160
- * Features:
161
- * - Agent registration + heartbeat (agents go stale after 60s without heartbeat)
162
- * - Per-recipient read receipts (readBy[agentId] = ISO8601)
163
- * - Atomic file-locking for concurrent multi-process writes
164
- * - Unread count for new-mail notifications
165
- * - Online agent list
166
- *
167
- * @module GlobalMailbox
168
- */
169
-
170
- /**
171
- * Derive the project-level mailbox directory path.
172
- *
173
- * Delegates to the CANONICAL `projectSlug()` from wstack-paths so every
174
- * surface (CLI, TUI, WebUI, mailbox tool, loop checker) lands in the exact
175
- * same `~/.wrongstack/projects/<slug>/` directory. A previous inline copy
176
- * skipped the leading/trailing-hyphen strip, which silently split agents
177
- * working on projects with non-alphanumeric name edges into TWO mailboxes.
178
- *
179
- * @param projectRoot — absolute path to the project root
180
- * @param globalRoot — `~/.wrongstack` (or custom global root)
181
- */
182
- declare function resolveProjectDir(projectRoot: string, globalRoot: string): string;
183
- declare class GlobalMailbox implements Mailbox {
184
- /** Path to the JSONL message file. */
185
- readonly messagePath: string;
186
- /** Path to the JSON agent registry file. */
187
- readonly registryPath: string;
188
- /** Path to the JSON client registry file. */
189
- readonly clientRegistryPath: string;
190
- /** Optional event bus for emitting agent registration/heartbeat events. */
191
- private readonly _events?;
192
- /**
193
- * Local cache of the agent registry to avoid re-reading on every call.
194
- * Time-bounded: the registry file is shared ACROSS PROCESSES (that's the
195
- * whole point of GlobalMailbox), so a cache served forever would never see
196
- * agents registered by other sessions. Writers always bypass it.
197
- */
198
- private _registryCache;
199
- /** When the registry cache was last refreshed from disk (epoch ms). */
200
- private _registryCacheAt;
201
- /**
202
- * Local cache of the client registry to avoid re-reading on every call.
203
- * Same reasoning as agent registry cache.
204
- */
205
- private _clientRegistryCache;
206
- /** When the client registry cache was last refreshed from disk (epoch ms). */
207
- private _clientRegistryCacheAt;
208
- /** Last time each local agent sent a heartbeat (throttle). */
209
- private _lastHeartbeat;
210
- /** Last time each local client sent a heartbeat (throttle). */
211
- private _lastClientHeartbeat;
212
- /**
213
- * In-memory mirror of the JSONL message file. The mailbox is shared
214
- * ACROSS PROCESSES, so reads cannot trust the cache blindly — we pair it
215
- * with an mtime check. The file lock serializes every write, so a
216
- * changed mtimeMs is a definitive signal that another process (or this
217
- * one) wrote; an unchanged mtimeMs guarantees no write happened and the
218
- * cache is current. This collapses the per-iteration `query()` cost from
219
- * O(file_size) disk + parse to O(messages) in memory.
220
- */
221
- private _messageCache;
222
- /** mtimeMs of the file when `_messageCache` was populated. */
223
- private _messageCacheMtime;
224
- /** Size of the file when `_messageCache` was populated (extra guard). */
225
- private _messageCacheSize;
226
- /**
227
- * @param projectDir — `~/.wrongstack/projects/<slug>/`
228
- * @param events — optional EventBus for real-time TUI/WebUI notifications
229
- */
230
- constructor(projectDir: string, events?: EventBus);
231
- send(input: MailboxSendInput): Promise<MailboxMessage>;
232
- query(q: MailboxQuery): Promise<MailboxMessage[]>;
233
- ack(input: MailboxAckInput): Promise<MailboxMessage | null>;
234
- ackMany(input: MailboxAckBatchInput): Promise<MailboxMessage[]>;
235
- unreadCount(forAgentId: string): Promise<number>;
236
- registerAgent(input: AgentRegistrationInput): Promise<void>;
237
- heartbeat(input: AgentHeartbeatInput): Promise<void>;
238
- getAgentStatuses(): Promise<MailboxAgentStatus[]>;
239
- getOnlineAgents(): Promise<MailboxAgentStatus[]>;
240
- registerClient(input: ClientRegistrationInput): Promise<void>;
241
- clientHeartbeat(input: ClientHeartbeatInput): Promise<void>;
242
- getClientStatuses(): Promise<ClientStatus[]>;
243
- close(): Promise<void>;
244
- clearAll(): Promise<void>;
245
- purgeStale(opts?: PurgeOptions): Promise<PurgeResult>;
246
- /**
247
- * Read all messages from the JSONL file. Always reads + parses the file.
248
- * Callers that can tolerate a stale-by-mtime view should use
249
- * {@link _readMessagesCached}; writers that need the post-lock truth
250
- * should call this directly (it's what {@link _readMessagesFresh} aliases).
251
- */
252
- private _readMessages;
253
- /**
254
- * Read messages, then adopt the result as the in-memory cache. Use this
255
- * from writers that just took the file lock — the read reflects the
256
- * authoritative post-lock state and should be served to subsequent
257
- * queries without re-reading.
258
- */
259
- private _readMessagesFresh;
260
- /**
261
- * Read messages, consulting the mtime-bounded in-memory cache first.
262
- * The mailbox file is shared across processes; every `send`/`ack`/
263
- * `clearAll`/`purgeStale` takes the file lock, so writes are serialized
264
- * and a changed mtimeMs is a definitive freshness signal. When the
265
- * stat matches the cached mtime+size we return the cached array — no
266
- * file read and no JSON.parse — collapsing the per-iteration query
267
- * cost on the mailbox-loop hot path.
268
- */
269
- private _readMessagesCached;
270
- /**
271
- * Replace the in-memory cache. Caller is responsible for guaranteeing
272
- * that `messages` reflects the current on-disk state (e.g. they just
273
- * read or wrote it under the file lock).
274
- */
275
- private _setMessageCache;
276
- /**
277
- * Append a single just-sent message to the in-memory cache without
278
- * re-reading the file. The caller must hold the file lock (or have
279
- * just released it after a successful append) so the cache stays
280
- * consistent with on-disk state.
281
- */
282
- private _pushToCache;
283
- private _ensureRegistry;
284
- private _readRegistry;
285
- private _pruneStaleInPlace;
286
- private _writeRegistry;
287
- private _ensureClientRegistry;
288
- private _readClientRegistry;
289
- private _pruneStaleClientsInPlace;
290
- private _writeClientRegistry;
291
- }
292
-
293
162
  /**
294
163
  * mailbox-tool — Tool that exposes the inter-agent mailbox to agents.
295
164
  *
@@ -1166,17 +1035,17 @@ declare class ConsensusProtocol {
1166
1035
  * Initiate a vote on a proposed change. Updates the change node's status
1167
1036
  * to 'proposed' and notifies eligible voters via FleetBus.
1168
1037
  */
1169
- initiateVote(changeId: string): void;
1038
+ initiateVote(changeId: string): Promise<void>;
1170
1039
  /**
1171
1040
  * Cast a vote. Updates the change node in the graph and re-evaluates
1172
1041
  * consensus. If the vote triggers a resolution, updates the change status.
1173
1042
  */
1174
- castVote(changeId: string, voterId: string, value: VoteValue, rationale?: string): ConsensusResult;
1043
+ castVote(changeId: string, voterId: string, value: VoteValue, rationale?: string): Promise<ConsensusResult>;
1175
1044
  /**
1176
1045
  * Resolve the current vote without waiting for all eligible voters.
1177
1046
  * Useful when a timeout fires or an agent decides to finalize early.
1178
1047
  */
1179
- resolveNow(changeId: string): ConsensusResult;
1048
+ resolveNow(changeId: string): Promise<ConsensusResult>;
1180
1049
  /**
1181
1050
  * Register or update a voter's configuration.
1182
1051
  */
@@ -1760,6 +1629,8 @@ declare class AutonomousCoordinator {
1760
1629
  private readonly onCoordinatorEvent?;
1761
1630
  private running;
1762
1631
  private iterationCount;
1632
+ private lastSyncAt;
1633
+ private static readonly SYNC_INTERVAL_MS;
1763
1634
  /** Tasks already handled by _onSubagentTerminated (to avoid double goal:failed on fleet event). */
1764
1635
  private readonly _handledBySubagent;
1765
1636
  /** FleetBus subscription disposers, detached in dispose(). */
@@ -1772,6 +1643,27 @@ declare class AutonomousCoordinator {
1772
1643
  run(opts?: RunOptions): Promise<CoordinatorStats>;
1773
1644
  /** Stop the autonomous loop. */
1774
1645
  stop(): void;
1646
+ /**
1647
+ * Report that a terminal worker (not a Director subagent) completed a claimed
1648
+ * task. This updates the auction, DAG, publishes a task-result fact, and
1649
+ * extracts follow-up goals — the same path as subagent completion.
1650
+ */
1651
+ reportTaskCompletion(taskId: string, result: string): Promise<void>;
1652
+ /**
1653
+ * Report that a terminal worker failed a claimed task.
1654
+ */
1655
+ reportTaskFailure(taskId: string, error: string): Promise<void>;
1656
+ /**
1657
+ * Reload the KnowledgeGraph from disk and sync the in-memory DAG with any
1658
+ * changes published by other terminal sessions. New goals are added to the
1659
+ * DAG; existing goals whose status changed (e.g. completed by another
1660
+ * terminal) are transitioned accordingly.
1661
+ *
1662
+ * Safe to call at any time — also used internally by the run loop.
1663
+ */
1664
+ syncFromGraph(): Promise<void>;
1665
+ private _syncDagStatuses;
1666
+ private _maybeSyncFromGraph;
1775
1667
  /**
1776
1668
  * Tear down the coordinator for good: stop the loop and detach all FleetBus
1777
1669
  * subscriptions (this coordinator's + the auctioneer's) plus any open bid
@@ -1805,9 +1697,20 @@ declare class AutonomousCoordinator {
1805
1697
  deps?: string[];
1806
1698
  tags?: string[];
1807
1699
  }): Promise<GoalNode>;
1700
+ private _waitForDagProgress;
1701
+ private _dagProgressKey;
1702
+ private _rebuildDagFromGraph;
1703
+ private _rebuildDagNode;
1808
1704
  private _decomposeGoal;
1809
1705
  private _inferCategory;
1810
1706
  private _processGoal;
1707
+ private _stringifyTaskResult;
1708
+ private _completeTask;
1709
+ private _publishTaskResultFact;
1710
+ private _createFollowUpGoalsFromResult;
1711
+ private _extractFollowUps;
1712
+ private _failTask;
1713
+ private _recordTaskFailed;
1811
1714
  private _handlePendingChange;
1812
1715
  private _onDagEvent;
1813
1716
  private _onSubagentTerminated;
@@ -1815,10 +1718,9 @@ declare class AutonomousCoordinator {
1815
1718
  private _buildVoters;
1816
1719
  private _goalToOptions;
1817
1720
  private _optionToGoal;
1818
- private _dagPriorityToGoal;
1819
1721
  private _mailboxBroadcast;
1820
1722
  /** Emit a CoordinatorEvent to the subscriber (e.g. TUI panel timeline). */
1821
1723
  private _emit;
1822
1724
  }
1823
1725
 
1824
- export { AgentDefinition, AgentHeartbeatInput, AgentRegistrationInput, type ApplyResult, type ApprovalDecision, AutonomousBrain, type AutonomousBrainOptions, AutonomousCoordinator, type AutonomousCoordinatorOptions, type AutonomousDecisionRequest, type AutonomousDecisionType, BUILD_AGENTS, BrainArbiter, BrainDecision, BrainDecisionOption, BrainDecisionRequest, BrainDecisionSource, type BrainInterventionInput, BrainMonitor, type BrainMonitorOptions, BrainRisk, type ChangeFile, ChangeManager, type ChangeManagerOptions, type ChangeNode, type ChangeProposal, type ChangeStatus, type ConsensusOptions, ConsensusProtocol, type ConsensusResult, type CoordinatorEvent, type CoordinatorStats, type DAGEdgeEvent, type DAGEdgeHandler, type DAGNode, type DAGNodeStatus, DEFAULT_QUALITY_CHECKS, DELIVERY_AGENTS, DEPENDENCY_FILE_PATTERNS, DISCOVERY_AGENTS, DOMAIN_AGENTS, type DecisionNode, type DecisionPrompt, DefaultMailbox, type DepWatchEntry, type DepWatcherBridgeOptions, type DependencyWatcherConfig, Director, type EscalationDecision, type FactCategory, type FactNode, FleetBus, FleetManager, GlobalMailbox, type GoalNode, type GoalPriority, type GoalStatus, type GraphSubscription, KNOWLEDGE_AGENTS, KnowledgeGraph, type LLMProvider, META_AGENTS, type MailToolsOptions, Mailbox, MailboxAckInput, MailboxAgentStatus, type MailboxHooksOptions, MailboxMessage, MailboxQuery, type MailboxResolver, MailboxSendInput, type MailboxToolOptions, type NodeFilter, type NodeType, type OutdatedNotifyMessage, PLANNING_AGENTS, type PackageAuthorEntry, type PackageAuthorLog, type PackageAuthorTrackerOptions, type PackageOutdatedEntry, type PackageOutdatedResult, type PackageOutdatedWatcherOptions, type PrioritizationDecision, type QualityCheck, type QualityGateChecks, type QualityGateResult, type QuorumRule, REVIEW_AGENTS, type RollbackResult, type RunOptions, type RunnablesHandler, type SpawnDecision, type TaskAuctionOptions, TaskAuctioneer, type TaskBid, TaskDAG, VERIFY_AGENTS, type VoteNode, type VoteRecord, type VoteValue, type VoterConfig, attachDepWatcherBridge, createMailboxHooks, detectEcosystem, getFullPackageLog, getManifestPackages, getPackageAuthor, getPackagesByAgent, mailboxSessionTag, makeDependencyWatcherConfig, makeMailInboxTool, makeMailSendTool, makeMailboxTool, recordPackageAction, resolveMailboxIdentity, resolveProjectDir, startPackageOutdatedWatcher, updatePackageOutdatedStatus };
1726
+ export { AgentDefinition, AgentHeartbeatInput, AgentRegistrationInput, type ApplyResult, type ApprovalDecision, AutonomousBrain, type AutonomousBrainOptions, AutonomousCoordinator, type AutonomousCoordinatorOptions, type AutonomousDecisionRequest, type AutonomousDecisionType, BUILD_AGENTS, BrainArbiter, BrainDecision, BrainDecisionOption, BrainDecisionRequest, BrainDecisionSource, type BrainInterventionInput, BrainMonitor, type BrainMonitorOptions, BrainRisk, type ChangeFile, ChangeManager, type ChangeManagerOptions, type ChangeNode, type ChangeProposal, type ChangeStatus, type ConsensusOptions, ConsensusProtocol, type ConsensusResult, type CoordinatorEvent, type CoordinatorStats, type DAGEdgeEvent, type DAGEdgeHandler, type DAGNode, type DAGNodeStatus, DEFAULT_QUALITY_CHECKS, DELIVERY_AGENTS, DEPENDENCY_FILE_PATTERNS, DISCOVERY_AGENTS, DOMAIN_AGENTS, type DecisionNode, type DecisionPrompt, DefaultMailbox, type DepWatchEntry, type DepWatcherBridgeOptions, type DependencyWatcherConfig, Director, type EscalationDecision, type FactCategory, type FactNode, FleetBus, FleetManager, type GoalNode, type GoalPriority, type GoalStatus, type GraphSubscription, KNOWLEDGE_AGENTS, KnowledgeGraph, type LLMProvider, META_AGENTS, type MailToolsOptions, Mailbox, MailboxAckInput, MailboxAgentStatus, type MailboxHooksOptions, MailboxMessage, MailboxQuery, type MailboxResolver, MailboxSendInput, type MailboxToolOptions, type NodeFilter, type NodeType, type OutdatedNotifyMessage, PLANNING_AGENTS, type PackageAuthorEntry, type PackageAuthorLog, type PackageAuthorTrackerOptions, type PackageOutdatedEntry, type PackageOutdatedResult, type PackageOutdatedWatcherOptions, type PrioritizationDecision, type QualityCheck, type QualityGateChecks, type QualityGateResult, type QuorumRule, REVIEW_AGENTS, type RollbackResult, type RunOptions, type RunnablesHandler, type SpawnDecision, type TaskAuctionOptions, TaskAuctioneer, type TaskBid, TaskDAG, VERIFY_AGENTS, type VoteNode, type VoteRecord, type VoteValue, type VoterConfig, attachDepWatcherBridge, createMailboxHooks, detectEcosystem, getFullPackageLog, getManifestPackages, getPackageAuthor, getPackagesByAgent, mailboxSessionTag, makeDependencyWatcherConfig, makeMailInboxTool, makeMailSendTool, makeMailboxTool, recordPackageAction, resolveMailboxIdentity, startPackageOutdatedWatcher, updatePackageOutdatedStatus };