@wrongstack/core 0.32.0 → 0.41.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 (33) hide show
  1. package/dist/{agent-subagent-runner-DpZTLdBe.d.ts → agent-subagent-runner-C66vi4Gq.d.ts} +1 -1
  2. package/dist/{config-BUEGM4JP.d.ts → config-ZRCf7sTu.d.ts} +21 -1
  3. package/dist/coordination/index.d.ts +7 -7
  4. package/dist/coordination/index.js +3028 -2976
  5. package/dist/coordination/index.js.map +1 -1
  6. package/dist/defaults/index.d.ts +8 -8
  7. package/dist/defaults/index.js +1166 -1104
  8. package/dist/defaults/index.js.map +1 -1
  9. package/dist/execution/index.d.ts +5 -5
  10. package/dist/extension/index.d.ts +2 -2
  11. package/dist/{index-ysfO_DlX.d.ts → index-6_csX32J.d.ts} +1 -1
  12. package/dist/{index-pXJdVLe0.d.ts → index-DkVgH3wC.d.ts} +31 -1
  13. package/dist/index.d.ts +135 -15
  14. package/dist/index.js +1467 -1214
  15. package/dist/index.js.map +1 -1
  16. package/dist/infrastructure/index.d.ts +2 -2
  17. package/dist/infrastructure/index.js +17 -3
  18. package/dist/infrastructure/index.js.map +1 -1
  19. package/dist/kernel/index.d.ts +2 -2
  20. package/dist/{mcp-servers-BzB3r7_c.d.ts → mcp-servers-DONdo-XM.d.ts} +1 -1
  21. package/dist/{multi-agent-coordinator-DOXSgtom.d.ts → multi-agent-coordinator-BUsjiRWl.d.ts} +1 -1
  22. package/dist/{null-fleet-bus-DLsUjOyB.d.ts → null-fleet-bus-FvgHnZah.d.ts} +150 -131
  23. package/dist/{plan-templates-BZMi-VpU.d.ts → plan-templates-DYCeRCDN.d.ts} +1 -1
  24. package/dist/sdd/index.d.ts +3 -3
  25. package/dist/storage/index.d.ts +2 -2
  26. package/dist/{tool-executor-BAi4WI2d.d.ts → tool-executor-BpK-SWtJ.d.ts} +1 -1
  27. package/dist/types/index.d.ts +3 -3
  28. package/dist/types/index.js +17 -3
  29. package/dist/types/index.js.map +1 -1
  30. package/dist/utils/index.d.ts +107 -1
  31. package/dist/utils/index.js +53 -2
  32. package/dist/utils/index.js.map +1 -1
  33. package/package.json +1 -1
@@ -1,9 +1,10 @@
1
- import { c as AgentPhase, b as AgentDefinition, d as DefaultMultiAgentCoordinator, f as DispatchClassifier } from './multi-agent-coordinator-DOXSgtom.js';
1
+ import { c as AgentPhase, b as AgentDefinition, d as DefaultMultiAgentCoordinator, f as DispatchClassifier } from './multi-agent-coordinator-BUsjiRWl.js';
2
2
  import { n as SubagentConfig, u as TaskResult, k as CoordinatorStatus, v as TaskSpec, M as MultiAgentConfig, t as SubagentRunner } from './multi-agent-C8Z1i__e.js';
3
3
  import { B as SessionWriter, Q as Tool, y as SessionStore } from './context-7u93AcGD.js';
4
- import { F as FleetBus, e as FleetUsage, f as FleetUsageAggregator } from './agent-subagent-runner-DpZTLdBe.js';
4
+ import { F as FleetBus, e as FleetUsage, f as FleetUsageAggregator } from './agent-subagent-runner-C66vi4Gq.js';
5
5
  import { EventEmitter } from 'node:events';
6
6
  import { a as DirectorStateSnapshot } from './director-state-BmYi3DGA.js';
7
+ import { k as ModelMatrixEntry } from './config-ZRCf7sTu.js';
7
8
  import { I as InMemoryAgentBridge } from './agent-bridge-D_XcS2HL.js';
8
9
  import { E as EventBus } from './events-BrQiweXN.js';
9
10
 
@@ -281,135 +282,6 @@ declare class CollabSession extends EventEmitter {
281
282
  private cleanup;
282
283
  }
283
284
 
284
- declare class LargeAnswerStore {
285
- /**
286
- * Responses above this size (in characters) are stored out-of-context.
287
- * Below this, the full answer is returned inline (no overhead).
288
- * Default: 2000 chars ≈ 400-600 tokens.
289
- */
290
- readonly sizeThreshold: number;
291
- private readonly store;
292
- constructor(sizeThreshold?: number);
293
- /**
294
- * Store a value, returning a summary + key for inline use.
295
- * If the value is below sizeThreshold, returns it as-is (no store entry).
296
- */
297
- storeAnswer(value: unknown): {
298
- key?: string;
299
- summary: string;
300
- inline: boolean;
301
- };
302
- /**
303
- * Retrieve a previously stored answer by its key.
304
- * Returns undefined if the key is unknown or the store was cleared.
305
- */
306
- retrieveAnswer(key: string): unknown | undefined;
307
- /**
308
- * Check if a key exists in the store.
309
- */
310
- hasAnswer(key: string): boolean;
311
- /** Number of stored entries. */
312
- get size(): number;
313
- /** Total characters stored. */
314
- get totalChars(): number;
315
- /** Clear all stored entries. Call at the end of a director run. */
316
- clear(): void;
317
- }
318
-
319
- /**
320
- * Interface for a fleet coordinator. Implemented by both `Director`
321
- * (full LLM-driven orchestration with fleet policy) and
322
- * `DefaultMultiAgentCoordinator` (direct API-driven, no fleet policy).
323
- *
324
- * External callers — CLI slash commands, tests, the delegate tool —
325
- * use this to stay agnostic to the orchestration mode.
326
- *
327
- * The interface captures the **orchestration contract**: spawn, assign,
328
- * terminate, await, and query. Fleet-level policy (cost caps, manifest
329
- * writing, checkpointing) lives behind this surface and is optional
330
- * from the caller's perspective.
331
- *
332
- * @example
333
- * ```typescript
334
- * let coordinator: ICoordinator = isDirectorMode
335
- * ? new Director({ config, ... })
336
- * : new DefaultMultiAgentCoordinator(config);
337
- * const id = await coordinator.spawn({ name: 'worker', role: 'researcher' });
338
- * await coordinator.assign({ id: 't-1', description: 'research X', subagentId: id });
339
- * const results = await coordinator.awaitTasks(['t-1']);
340
- * ```
341
- */
342
- interface ICoordinator {
343
- /** Stable identifier for this coordinator instance. */
344
- readonly coordinatorId: string;
345
- /**
346
- * Spawn a new subagent and return its id. In director mode this
347
- * enforces fleet-wide spawn caps and cost limits; in raw coordinator
348
- * mode it is a direct pass-through.
349
- */
350
- spawn(config: SubagentConfig): Promise<string>;
351
- /**
352
- * Assign a task to a subagent (or to the fleet for auto-routing).
353
- * Returns the assigned task id.
354
- */
355
- assign(task: {
356
- id: string;
357
- description: string;
358
- subagentId?: string;
359
- }): Promise<string>;
360
- /**
361
- * Synchronously ask a subagent something via the in-memory bridge.
362
- * The subagent must have been spawned and must handle `bridge.subscribe()`
363
- * in its task loop. Returns the reply payload or throws on timeout.
364
- *
365
- * Only available in director mode — raw coordinator has no bridge.
366
- */
367
- ask<T = unknown>(subagentId: string, payload: unknown, timeoutMs?: number): Promise<T>;
368
- /**
369
- * Wait for one or more tasks to complete and return their results.
370
- * If a task is already done when called, returns immediately.
371
- * Resolves to an array in the same order as `taskIds`.
372
- */
373
- awaitTasks(taskIds: string[]): Promise<TaskResult[]>;
374
- /**
375
- * Gracefully stop a single subagent. The subagent finishes its current
376
- * in-flight work and exits cleanly — it does not hard-kill.
377
- */
378
- terminate(subagentId: string): Promise<void>;
379
- /**
380
- * Stop all subagents. In-flight tasks are allowed to complete;
381
- * no new tasks are dispatched.
382
- */
383
- terminateAll(): Promise<void>;
384
- /**
385
- * Stop a subagent and remove it from the coordinator. Releases all
386
- * associated resources (AbortController, budget state). The subagent
387
- * entry is deleted so the id can be reused in a future spawn.
388
- */
389
- remove(subagentId: string): Promise<void>;
390
- /**
391
- * Live coordinator status — subagent list, pending task count,
392
- * completed task count, iteration totals.
393
- */
394
- status(): CoordinatorStatus;
395
- /**
396
- * Snapshot of completed task results. In director mode this returns
397
- * every `TaskResult` from the fleet; in raw coordinator mode this
398
- * may return an empty array if the coordinator doesn't cache results.
399
- */
400
- completedResults(): TaskResult[];
401
- /**
402
- * Subscribe to coordinator lifecycle events. Currently supports
403
- * `task.completed` — the payload carries the task spec and result.
404
- *
405
- * Returns a disposer function; call it to unsubscribe.
406
- */
407
- on(event: 'task.completed', handler: (payload: {
408
- task: TaskSpec;
409
- result: TaskResult;
410
- }) => void): () => void;
411
- }
412
-
413
285
  /**
414
286
  * Interface for fleet-level lifecycle and policy. Covers:
415
287
  * - Spawn lifecycle hooks (canSpawn check, recordSpawn after-effects)
@@ -774,6 +646,135 @@ declare class FleetManager implements IFleetManager {
774
646
  dispose(): void;
775
647
  }
776
648
 
649
+ /**
650
+ * Interface for a fleet coordinator. Implemented by both `Director`
651
+ * (full LLM-driven orchestration with fleet policy) and
652
+ * `DefaultMultiAgentCoordinator` (direct API-driven, no fleet policy).
653
+ *
654
+ * External callers — CLI slash commands, tests, the delegate tool —
655
+ * use this to stay agnostic to the orchestration mode.
656
+ *
657
+ * The interface captures the **orchestration contract**: spawn, assign,
658
+ * terminate, await, and query. Fleet-level policy (cost caps, manifest
659
+ * writing, checkpointing) lives behind this surface and is optional
660
+ * from the caller's perspective.
661
+ *
662
+ * @example
663
+ * ```typescript
664
+ * let coordinator: ICoordinator = isDirectorMode
665
+ * ? new Director({ config, ... })
666
+ * : new DefaultMultiAgentCoordinator(config);
667
+ * const id = await coordinator.spawn({ name: 'worker', role: 'researcher' });
668
+ * await coordinator.assign({ id: 't-1', description: 'research X', subagentId: id });
669
+ * const results = await coordinator.awaitTasks(['t-1']);
670
+ * ```
671
+ */
672
+ interface ICoordinator {
673
+ /** Stable identifier for this coordinator instance. */
674
+ readonly coordinatorId: string;
675
+ /**
676
+ * Spawn a new subagent and return its id. In director mode this
677
+ * enforces fleet-wide spawn caps and cost limits; in raw coordinator
678
+ * mode it is a direct pass-through.
679
+ */
680
+ spawn(config: SubagentConfig): Promise<string>;
681
+ /**
682
+ * Assign a task to a subagent (or to the fleet for auto-routing).
683
+ * Returns the assigned task id.
684
+ */
685
+ assign(task: {
686
+ id: string;
687
+ description: string;
688
+ subagentId?: string;
689
+ }): Promise<string>;
690
+ /**
691
+ * Synchronously ask a subagent something via the in-memory bridge.
692
+ * The subagent must have been spawned and must handle `bridge.subscribe()`
693
+ * in its task loop. Returns the reply payload or throws on timeout.
694
+ *
695
+ * Only available in director mode — raw coordinator has no bridge.
696
+ */
697
+ ask<T = unknown>(subagentId: string, payload: unknown, timeoutMs?: number): Promise<T>;
698
+ /**
699
+ * Wait for one or more tasks to complete and return their results.
700
+ * If a task is already done when called, returns immediately.
701
+ * Resolves to an array in the same order as `taskIds`.
702
+ */
703
+ awaitTasks(taskIds: string[]): Promise<TaskResult[]>;
704
+ /**
705
+ * Gracefully stop a single subagent. The subagent finishes its current
706
+ * in-flight work and exits cleanly — it does not hard-kill.
707
+ */
708
+ terminate(subagentId: string): Promise<void>;
709
+ /**
710
+ * Stop all subagents. In-flight tasks are allowed to complete;
711
+ * no new tasks are dispatched.
712
+ */
713
+ terminateAll(): Promise<void>;
714
+ /**
715
+ * Stop a subagent and remove it from the coordinator. Releases all
716
+ * associated resources (AbortController, budget state). The subagent
717
+ * entry is deleted so the id can be reused in a future spawn.
718
+ */
719
+ remove(subagentId: string): Promise<void>;
720
+ /**
721
+ * Live coordinator status — subagent list, pending task count,
722
+ * completed task count, iteration totals.
723
+ */
724
+ status(): CoordinatorStatus;
725
+ /**
726
+ * Snapshot of completed task results. In director mode this returns
727
+ * every `TaskResult` from the fleet; in raw coordinator mode this
728
+ * may return an empty array if the coordinator doesn't cache results.
729
+ */
730
+ completedResults(): TaskResult[];
731
+ /**
732
+ * Subscribe to coordinator lifecycle events. Currently supports
733
+ * `task.completed` — the payload carries the task spec and result.
734
+ *
735
+ * Returns a disposer function; call it to unsubscribe.
736
+ */
737
+ on(event: 'task.completed', handler: (payload: {
738
+ task: TaskSpec;
739
+ result: TaskResult;
740
+ }) => void): () => void;
741
+ }
742
+
743
+ declare class LargeAnswerStore {
744
+ /**
745
+ * Responses above this size (in characters) are stored out-of-context.
746
+ * Below this, the full answer is returned inline (no overhead).
747
+ * Default: 2000 chars ≈ 400-600 tokens.
748
+ */
749
+ readonly sizeThreshold: number;
750
+ private readonly store;
751
+ constructor(sizeThreshold?: number);
752
+ /**
753
+ * Store a value, returning a summary + key for inline use.
754
+ * If the value is below sizeThreshold, returns it as-is (no store entry).
755
+ */
756
+ storeAnswer(value: unknown): {
757
+ key?: string;
758
+ summary: string;
759
+ inline: boolean;
760
+ };
761
+ /**
762
+ * Retrieve a previously stored answer by its key.
763
+ * Returns undefined if the key is unknown or the store was cleared.
764
+ */
765
+ retrieveAnswer(key: string): unknown | undefined;
766
+ /**
767
+ * Check if a key exists in the store.
768
+ */
769
+ hasAnswer(key: string): boolean;
770
+ /** Number of stored entries. */
771
+ get size(): number;
772
+ /** Total characters stored. */
773
+ get totalChars(): number;
774
+ /** Clear all stored entries. Call at the end of a director run. */
775
+ clear(): void;
776
+ }
777
+
777
778
  /**
778
779
  * Director — high-level orchestrator that owns a `MultiAgentCoordinator`,
779
780
  * a `FleetBus`, and a `FleetUsageAggregator`. Exposes a small imperative
@@ -959,7 +960,22 @@ interface DirectorOptions {
959
960
  * Only used when no `fleetManager` is provided (inline mode).
960
961
  */
961
962
  maxContext?: number;
963
+ /**
964
+ * Per-task model matrix (Config.modelMatrix). When set, a spawn whose
965
+ * config has no explicit `model` is resolved against this matrix by role
966
+ * (→ phase → `*`) before the subagent is built — so the spawned event,
967
+ * manifest, and the agent itself all run the matched model. Explicit
968
+ * per-spawn `model` overrides always win.
969
+ *
970
+ * Pass a **function** (not a snapshot) when the matrix can change at
971
+ * runtime (the CLI passes `() => configStore.get().modelMatrix`) so a
972
+ * mid-session `/setmodel` takes effect on the next spawn. A static record
973
+ * is also accepted for tests and one-shot runs.
974
+ */
975
+ modelMatrix?: ModelMatrixSource;
962
976
  }
977
+ /** Either a static matrix or a live getter (re-read on every spawn). */
978
+ type ModelMatrixSource = Record<string, ModelMatrixEntry> | (() => Record<string, ModelMatrixEntry> | undefined);
963
979
  /**
964
980
  * Thrown by `Director.spawn()` when a configured spawn cap (`maxSpawns`,
965
981
  * `maxSpawnDepth`) is hit. Distinct error class so callers — including
@@ -1105,6 +1121,9 @@ declare class Director implements ICoordinator {
1105
1121
  private readonly maxLeaderContextLoad;
1106
1122
  /** Provider's max context window in tokens. */
1107
1123
  private readonly maxContext;
1124
+ /** Per-task model matrix (static record or live getter); resolved
1125
+ * per-spawn when no explicit model is set. */
1126
+ private readonly modelMatrix?;
1108
1127
  /**
1109
1128
  * When set by `workComplete()`, the director stops dispatching new tasks
1110
1129
  * and terminates all running subagents. Used when the director's LLM decides
@@ -4,7 +4,7 @@ import { y as SessionStore, x as SessionMetadata, B as SessionWriter, r as Resum
4
4
  import { e as AttachmentStore, A as AddAttachmentInput, d as AttachmentRef, a as Attachment } from './session-reader-bfgsy2a0.js';
5
5
  import { b as MemoryStore, a as MemoryScope } from './memory-CEXuo7sz.js';
6
6
  import { a as WstackPaths } from './wstack-paths-eMXnY1_X.js';
7
- import { c as ConfigStore, a as Config, b as ConfigLoader, n as SyncConfig } from './config-BUEGM4JP.js';
7
+ import { c as ConfigStore, a as Config, b as ConfigLoader, o as SyncConfig } from './config-ZRCf7sTu.js';
8
8
  import { S as SecretVault } from './secret-vault-DoISxaKO.js';
9
9
 
10
10
  interface SessionStoreOptions {
@@ -1,15 +1,15 @@
1
1
  import { h as Specification, S as SpecAnalysis, g as SpecValidationResult, l as TaskGraph, m as TaskNode, k as TaskFilter, p as TaskSort, o as TaskProgress, r as TaskType, n as TaskPriority, e as SpecStatus, f as SpecTemplate, b as SpecRequirement } from '../task-graph-D1YQbpxF.js';
2
2
  import { E as EventBus } from '../events-BrQiweXN.js';
3
3
  import { D as DoneCondition, u as TaskResult } from '../multi-agent-C8Z1i__e.js';
4
- import { c as Agent } from '../index-ysfO_DlX.js';
5
- import { A as AgentFactory } from '../agent-subagent-runner-DpZTLdBe.js';
4
+ import { c as Agent } from '../index-6_csX32J.js';
5
+ import { A as AgentFactory } from '../agent-subagent-runner-C66vi4Gq.js';
6
6
  import '../context-7u93AcGD.js';
7
7
  import '../logger-DDd5C--Z.js';
8
8
  import '../system-prompt-CM6zOhd2.js';
9
9
  import '../observability-BhnVLBLS.js';
10
10
  import '../secret-scrubber-3MHDDAtm.js';
11
11
  import '../permission-B6sldrSp.js';
12
- import '../config-BUEGM4JP.js';
12
+ import '../config-ZRCf7sTu.js';
13
13
  import '../models-registry-BcYJDKLm.js';
14
14
 
15
15
  declare class SpecParser {
@@ -1,11 +1,11 @@
1
- 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';
1
+ 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-DYCeRCDN.js';
2
2
  export { D as DefaultSessionReader, f as DefaultSessionReaderOptions, S as SessionReader } from '../session-reader-bfgsy2a0.js';
3
3
  import { p as Request, q as Response, w as SessionEvent } from '../context-7u93AcGD.js';
4
4
  import { S as SessionRewinder, C as CheckpointInfo, a as RewindResultExtended } from '../session-rewinder-C9HnMkhP.js';
5
5
  export { D as DirectorStateCheckpoint, a as DirectorStateSnapshot, b as DirectorSubagentState, c as DirectorTaskState, l as loadDirectorState } from '../director-state-BmYi3DGA.js';
6
6
  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';
7
7
  import { a as WstackPaths } from '../wstack-paths-eMXnY1_X.js';
8
- import { m as SyncCategory, n as SyncConfig } from '../config-BUEGM4JP.js';
8
+ import { n as SyncCategory, o as SyncConfig } from '../config-ZRCf7sTu.js';
9
9
  import '../events-BrQiweXN.js';
10
10
  import '../secret-scrubber-3MHDDAtm.js';
11
11
  import '../memory-CEXuo7sz.js';
@@ -2,7 +2,7 @@ import { d as Context, n as ProviderError, Q as Tool, _ as ToolUseBlock, Y as To
2
2
  import { a as Compactor, C as CompactReport } from './compactor-D1RHFRmF.js';
3
3
  import { R as RecoveryDecision, E as ErrorHandler, a as RetryPolicy } from './retry-policy-KF18W4dg.js';
4
4
  import { b as ModelsRegistry } from './models-registry-BcYJDKLm.js';
5
- import { y as ToolExecutorOptions, z as ToolExecutorStrategy, T as ToolBatchResult } from './index-ysfO_DlX.js';
5
+ import { y as ToolExecutorOptions, z as ToolExecutorStrategy, T as ToolBatchResult } from './index-6_csX32J.js';
6
6
 
7
7
  interface CompactorOptions {
8
8
  preserveK?: number;
@@ -1,6 +1,6 @@
1
1
  export { A as AgentError, a as Capabilities, b as ConfigError, c as ContentBlock, 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, m as Provider, n as ProviderError, o as ProviderErrorBody, p as Request, q as Response, r as ResumedSession, s as RiskTier, S as SessionData, v as SessionError, w as SessionEvent, x as SessionMetadata, y as SessionStore, z as SessionSummary, B as SessionWriter, H as StopReason, K as StreamEvent, T as TextBlock, L as ThinkingBlock, Q as Tool, 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, 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 } from '../context-7u93AcGD.js';
2
2
  export { P as ProviderRunner, R as RunProviderOptions } from '../provider-runner-Dlv8Fvw9.js';
3
- export { A as AutonomyConfig, C as CONTEXT_WINDOW_MODES, a as Config, b as ConfigLoader, c as ConfigStore, 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, M as MCPServerConfig, 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';
3
+ export { A as AutonomyConfig, C as CONTEXT_WINDOW_MODES, a as Config, b as ConfigLoader, c as ConfigStore, 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, M as MCPServerConfig, k as ModelMatrixEntry, 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';
4
4
  export { C as CompactReport, a as Compactor } from '../compactor-D1RHFRmF.js';
5
5
  export { P as PermissionDecision, a as PermissionPolicy, T as TrustPolicy } from '../permission-B6sldrSp.js';
6
6
  export { C as CheckpointInfo, R as RewindResult, a as RewindResultExtended, S as SessionRewinder } from '../session-rewinder-C9HnMkhP.js';
@@ -10,11 +10,11 @@ export { D as DefaultSecretScrubber, a as DefaultSecretVault, S as SecretVaultOp
10
10
  export { D as DefaultLogger, a as DefaultLoggerOptions } from '../logger-bOzkF5LL.js';
11
11
  export { D as DefaultPathResolver, a as DefaultTokenCounter } from '../path-resolver-DumKAi0n.js';
12
12
  export { M as MemoryEntry, a as MemoryScope, b as MemoryStore } from '../memory-CEXuo7sz.js';
13
- 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';
13
+ 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-BpK-SWtJ.js';
14
14
  export { S as SkillEntry, a as SkillLoader, b as SkillManifest } from '../skill-CxuWrsKK.js';
15
15
  export { a as BuildContext, c as ModelCapabilities, e as Renderer, S as SystemPromptBuilder } from '../system-prompt-CM6zOhd2.js';
16
16
  export { I as InputReader, P as PromptOption } from '../input-reader-E-ffP2ee.js';
17
- export { M as MCPRegistryView, j as MetricsSinkView, P as Plugin, k as PluginAPI, l as PluginCapabilities, m as PluginDependency, n as PluginPipelines, o as ProviderFactory, r as ProviderRegistryView, S as SessionWriterView, u as SlashCommand, v as SlashCommandRegistryView, w as SystemPromptContributor, F as ToolRegistryView } from '../index-ysfO_DlX.js';
17
+ export { M as MCPRegistryView, j as MetricsSinkView, P as Plugin, k as PluginAPI, l as PluginCapabilities, m as PluginDependency, n as PluginPipelines, o as ProviderFactory, r as ProviderRegistryView, S as SessionWriterView, u as SlashCommand, v as SlashCommandRegistryView, w as SystemPromptContributor, F as ToolRegistryView } from '../index-6_csX32J.js';
18
18
  export { D as DefaultModelsRegistry, a as DefaultModelsRegistryOptions, c as classifyFamily } from '../models-registry-gwMAo6E3.js';
19
19
  export { D as DEFAULT_MODES, M as Mode, a as ModeConfig, b as ModeManifest, c as ModeStore } from '../mode-CV077NjV.js';
20
20
  export { I as InMemoryAgentBridge, a as InMemoryBridgeTransport, c as createMessage } from '../agent-bridge-D_XcS2HL.js';
@@ -598,11 +598,25 @@ function deepMerge(a, b) {
598
598
  return out;
599
599
  }
600
600
 
601
+ // src/utils/term.ts
602
+ var hasStdout = () => typeof process !== "undefined" && !!process.stdout;
603
+ function isStdoutTTY() {
604
+ return hasStdout() && Boolean(process.stdout.isTTY);
605
+ }
606
+ function writeTo(s, stream) {
607
+ if (!stream || typeof stream.write !== "function") return false;
608
+ stream.write(s);
609
+ return true;
610
+ }
611
+ function writeErr(s, stream = process.stderr) {
612
+ return writeTo(s, stream);
613
+ }
614
+
601
615
  // src/utils/color.ts
602
616
  var isColorTty = () => {
603
617
  if (process.env.NO_COLOR) return false;
604
618
  if (process.env.FORCE_COLOR) return true;
605
- return Boolean(process.stdout?.isTTY);
619
+ return isStdoutTTY();
606
620
  };
607
621
  var COLOR = isColorTty();
608
622
  var wrap = (open2, close) => (s) => COLOR ? `\x1B[${open2}m${s}\x1B[${close}m` : s;
@@ -699,10 +713,10 @@ var DefaultLogger = class _DefaultLogger {
699
713
  if (r <= LEVEL_RANK.warn || this.level === "debug" || this.level === "trace") {
700
714
  const head = `${color.dim(ts)} ${COLORS[level](level.toUpperCase().padEnd(5))} ${msg}`;
701
715
  if (ctx !== void 0) {
702
- process.stderr.write(`${head} ${formatCtx(ctx)}
716
+ writeErr(`${head} ${formatCtx(ctx)}
703
717
  `);
704
718
  } else {
705
- process.stderr.write(`${head}
719
+ writeErr(`${head}
706
720
  `);
707
721
  }
708
722
  }