@wrongstack/core 0.265.1 → 0.268.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 (75) hide show
  1. package/dist/{agent-bridge-DrkBxszZ.d.ts → agent-bridge-UhojbpWx.d.ts} +1 -1
  2. package/dist/{agent-subagent-runner-DM2pP-B6.d.ts → agent-subagent-runner-Bvtf1o9K.d.ts} +25 -7
  3. package/dist/{brain-BXd_61kQ.d.ts → brain-69wzMKp1.d.ts} +73 -1
  4. package/dist/{compactor-B8pOf45Y.d.ts → compactor-CBQAJoDc.d.ts} +19 -1
  5. package/dist/{config-BMCj_XDs.d.ts → config-VKfOZ-6X.d.ts} +122 -3
  6. package/dist/{context-MRk5PhNv.d.ts → context-C0U8B9NF.d.ts} +88 -1
  7. package/dist/coordination/index.d.ts +57 -161
  8. package/dist/coordination/index.js +471 -177
  9. package/dist/coordination/index.js.map +1 -1
  10. package/dist/defaults/index.d.ts +26 -25
  11. package/dist/defaults/index.js +1818 -844
  12. package/dist/defaults/index.js.map +1 -1
  13. package/dist/execution/index.d.ts +72 -16
  14. package/dist/execution/index.js +1270 -265
  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-KByEFFBa.d.ts +663 -0
  19. package/dist/{goal-preamble-DvHDSKSe.d.ts → goal-preamble-CrYjmdw4.d.ts} +28 -11
  20. package/dist/{goal-store-DtLMySNb.d.ts → goal-store-Y_zdLZ3q.d.ts} +1 -1
  21. package/dist/hq/index.d.ts +195 -0
  22. package/dist/hq/index.js +1884 -0
  23. package/dist/hq/index.js.map +1 -0
  24. package/dist/index-BfaS-f_m.d.ts +82 -0
  25. package/dist/{index-B-ch8K9C.d.ts → index-CtQnmkaS.d.ts} +8 -8
  26. package/dist/{index-CEDeNodM.d.ts → index-gCv830d7.d.ts} +5 -5
  27. package/dist/index.d.ts +124 -47
  28. package/dist/index.js +5600 -2662
  29. package/dist/index.js.map +1 -1
  30. package/dist/infrastructure/index.d.ts +6 -6
  31. package/dist/infrastructure/index.js +117 -19
  32. package/dist/infrastructure/index.js.map +1 -1
  33. package/dist/kernel/index.d.ts +10 -9
  34. package/dist/kernel/index.js.map +1 -1
  35. package/dist/{pipeline-DPDxH_7m.d.ts → mailbox-types-Ct2hJq0P.d.ts} +1 -244
  36. package/dist/{mcp-servers-2x4w6Jn9.d.ts → mcp-servers-HT3Fi7Bl.d.ts} +10 -4
  37. package/dist/models/index.d.ts +5 -5
  38. package/dist/models/index.js +33 -3
  39. package/dist/models/index.js.map +1 -1
  40. package/dist/{models-registry-DmJlKuNp.d.ts → models-registry-Bvcl3Vaa.d.ts} +1 -1
  41. package/dist/{multi-agent-coordinator-DyCkCZnU.d.ts → multi-agent-coordinator-BACjsmkC.d.ts} +1 -1
  42. package/dist/{null-fleet-bus-CG9QY2aP.d.ts → null-fleet-bus-DA7fvhUg.d.ts} +14 -9
  43. package/dist/observability/index.d.ts +2 -2
  44. package/dist/{parallel-eternal-engine-Jw9uhEoT.d.ts → parallel-eternal-engine-Ci71gYu_.d.ts} +11 -15
  45. package/dist/{path-resolver-Dy2ej-gE.d.ts → path-resolver-O1IJnmKE.d.ts} +4 -3
  46. package/dist/{permission-B9SB45lp.d.ts → permission-Bd-57Lbl.d.ts} +1 -1
  47. package/dist/{permission-policy-CkjSXabK.d.ts → permission-policy-uNXC6Kge.d.ts} +2 -3
  48. package/dist/pipeline-BDNvENyV.d.ts +245 -0
  49. package/dist/{plan-templates-CzD9GnAU.d.ts → plan-templates-EMsalEtN.d.ts} +5 -5
  50. package/dist/{llm-selector-C0tfTCUe.d.ts → provider-model-resolve-CEb9x886.d.ts} +40 -3
  51. package/dist/{provider-runner-DMa70ODu.d.ts → provider-runner-DWJbpo70.d.ts} +3 -3
  52. package/dist/{retry-policy-CN0khdlj.d.ts → retry-policy-C3s_lvdK.d.ts} +1 -1
  53. package/dist/sdd/index.d.ts +9 -8
  54. package/dist/sdd/index.js +44 -14
  55. package/dist/sdd/index.js.map +1 -1
  56. package/dist/{secret-vault-B2yw84VT.d.ts → secret-vault-Cgduf5xL.d.ts} +2 -2
  57. package/dist/security/index.d.ts +5 -67
  58. package/dist/security/index.js +129 -99
  59. package/dist/security/index.js.map +1 -1
  60. package/dist/{selector-CzHh_igB.d.ts → selector-47LBnBVk.d.ts} +1 -1
  61. package/dist/{session-event-bridge-BUI6Jf-4.d.ts → session-event-bridge-Cw7oqmW2.d.ts} +1 -1
  62. package/dist/{session-reader-CMgdMSRP.d.ts → session-reader-DD4v2Obw.d.ts} +1 -1
  63. package/dist/storage/index.d.ts +14 -12
  64. package/dist/storage/index.js +144 -120
  65. package/dist/storage/index.js.map +1 -1
  66. package/dist/tools/index.d.ts +4 -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 +20 -19
  70. package/dist/types/index.js +1358 -476
  71. package/dist/types/index.js.map +1 -1
  72. package/dist/utils/index.d.ts +472 -405
  73. package/dist/utils/index.js +2321 -1193
  74. package/dist/utils/index.js.map +1 -1
  75. package/package.json +5 -1
@@ -1,4 +1,4 @@
1
- import { M as ModelsRegistry, a as ModelsDevPayload, R as ResolvedProvider, b as ResolvedModel, W as WireFamily } from './config-BMCj_XDs.js';
1
+ import { M as ModelsRegistry, a as ModelsDevPayload, R as ResolvedProvider, b as ResolvedModel, W as WireFamily } from './config-VKfOZ-6X.js';
2
2
 
3
3
  interface DefaultModelsRegistryOptions {
4
4
  cacheFile: string;
@@ -1,4 +1,4 @@
1
- import { S as SubagentConfig, M as MultiAgentCoordinator, c as MultiAgentConfig, d as SubagentRunner, F as FleetBus, e as SpawnResult, T as TaskSpec, a as BridgeMessage, A as AgentBridge, C as CoordinatorStatus, f as TaskResult } from './agent-subagent-runner-DM2pP-B6.js';
1
+ import { S as SubagentConfig, M as MultiAgentCoordinator, c as MultiAgentConfig, d as SubagentRunner, F as FleetBus, e as SpawnResult, T as TaskSpec, a as BridgeMessage, A as AgentBridge, C as CoordinatorStatus, f as TaskResult } from './agent-subagent-runner-Bvtf1o9K.js';
2
2
  import { EventEmitter } from 'node:events';
3
3
 
4
4
  /**
@@ -1,11 +1,12 @@
1
- import { A as AgentPhase, b as AgentDefinition, a as DefaultMultiAgentCoordinator, D as DispatchClassifier } from './multi-agent-coordinator-DyCkCZnU.js';
2
- import { F as FleetBus, i as FleetUsage, S as SubagentConfig, j as FleetUsageAggregator, f as TaskResult, C as CoordinatorStatus, T as TaskSpec, c as MultiAgentConfig, d as SubagentRunner } from './agent-subagent-runner-DM2pP-B6.js';
3
- import { a as SessionWriter, T as Tool, i as SessionStore } from './context-MRk5PhNv.js';
4
- import { B as BrainArbiter, E as EventBus } from './brain-BXd_61kQ.js';
1
+ import { A as AgentPhase, b as AgentDefinition, a as DefaultMultiAgentCoordinator, D as DispatchClassifier } from './multi-agent-coordinator-BACjsmkC.js';
2
+ import { F as FleetBus, i as FleetUsage, S as SubagentConfig, j as FleetUsageAggregator, f as TaskResult, C as CoordinatorStatus, T as TaskSpec, c as MultiAgentConfig, d as SubagentRunner } from './agent-subagent-runner-Bvtf1o9K.js';
3
+ import { a as SessionWriter, T as Tool, i as SessionStore } from './context-C0U8B9NF.js';
4
+ import { B as BrainArbiter, E as EventBus } from './brain-69wzMKp1.js';
5
5
  import { EventEmitter } from 'node:events';
6
+ import { L as Logger } from './logger-B63L5bTg.js';
6
7
  import { D as DirectorStateSnapshot } from './director-state-BfeCUbmk.js';
7
- import { d as ModelMatrixEntry } from './config-BMCj_XDs.js';
8
- import { I as InMemoryAgentBridge } from './agent-bridge-DrkBxszZ.js';
8
+ import { d as ModelMatrixEntry } from './config-VKfOZ-6X.js';
9
+ import { I as InMemoryAgentBridge } from './agent-bridge-UhojbpWx.js';
9
10
 
10
11
  /**
11
12
  * Alert levels the Director can emit when a collab session needs attention.
@@ -820,6 +821,8 @@ interface DirectorOptions {
820
821
  runner?: SubagentRunner | undefined;
821
822
  /** Optional Brain arbiter above the director for policy/decision escalation. */
822
823
  brain?: BrainArbiter | undefined;
824
+ /** Optional logger for structured debug/error logging. Falls back to console if omitted. */
825
+ logger?: Logger | undefined;
823
826
  /**
824
827
  * When set, the director writes a `fleet.json` manifest to this path
825
828
  * recording every spawned subagent (id, provider, model, role, task
@@ -927,7 +930,7 @@ interface DirectorOptions {
927
930
  * director denies further extensions. A subagent hitting the same
928
931
  * soft limit repeatedly (e.g. 3× budget.threshold_reached for
929
932
  * tool_calls) is likely looping on a prompt/config issue, not
930
- * making legitimate progress. Default: 2. Set to Infinity to
933
+ * making legitimate progress. Default: 5. Set to Infinity to
931
934
  * disable the cap (use with caution — a misconfigured subagent
932
935
  * could burn unlimited budget).
933
936
  */
@@ -1108,6 +1111,8 @@ declare class Director implements ICoordinator {
1108
1111
  private readonly sessionsRoot?;
1109
1112
  /** Director run id for JSONL path resolution. */
1110
1113
  private readonly directorRunId;
1114
+ /** Optional logger for structured logging. Falls back to noop when omitted. */
1115
+ private readonly logger;
1111
1116
  /** Resolves task descriptions back from `assign()` so completion events
1112
1117
  * can also carry a human-readable title. */
1113
1118
  private readonly taskDescriptions;
@@ -1257,7 +1262,7 @@ declare class Director implements ICoordinator {
1257
1262
  * Caller-supplied `priceLookup` is optional but recommended — without
1258
1263
  * it the `cost` column in `usage.snapshot()` stays at 0.
1259
1264
  */
1260
- spawn(config: SubagentConfig, priceLookup?: {
1265
+ spawn(callerConfig: SubagentConfig, priceLookup?: {
1261
1266
  input?: number | undefined;
1262
1267
  output?: number | undefined;
1263
1268
  cacheRead?: number | undefined;
@@ -1697,7 +1702,7 @@ declare const DEFAULT_DIRECTOR_PREAMBLE = "You are the Director of a multi-agent
1697
1702
  * baseline reinforces this in plain text — the actual enforcement is at
1698
1703
  * the bridge transport layer.
1699
1704
  */
1700
- declare const DEFAULT_SUBAGENT_BASELINE = "You are a subagent operating under a Director. You were spawned to handle\na specific slice of a larger plan \u2014 do that slice well and report back.\n\nBridge contract:\n - You have a parent (the Director). You may call `request` on the\n parent bridge to ask a clarifying question. Use this sparingly; the\n parent is also working.\n - You MAY NOT request the parent's system prompt, tool list, or other\n subagents' context. Those are not yours to read.\n - Your final task output is what the Director sees. Be concise,\n structured, and self-contained \u2014 assume the Director will paste your\n output into its own context.\n\nCRITICAL CONSTRAINT \u2014 NO FURTHER DELEGATION:\n - You MUST NOT call the `delegate` tool or attempt to spawn subagents.\n - You MUST NOT use `spawn_subagent`, `assign_task`, or any equivalent.\n - Your role is to execute the assigned task yourself, not to orchestrate.\n - If a subtask is too complex, report back to the Director with what you\n found and let the Director decide how to decompose.\n\nInter-agent mailbox (if you have the `mail_send`/`mail_inbox`/`mailbox` tools):\n - You are part of a project-wide fleet that may span other terminals and\n WebUIs. Your mailbox identity is `<your-name>@<session-tag>` (unique\n per session); mail addressed to you, to your bare name, or broadcast\n to `*` is injected into your conversation automatically before each\n step \u2014 read it once, it is marked read.\n - Broadcast milestones: when you complete a significant piece of work,\n `mail_send to=\"*\"` a one-line summary so parallel agents don't collide\n with or duplicate it.\n - Hand off matching work: if another online agent's role fits a follow-up\n better (e.g. a reviewer while you just wrote code), `mail_send` it to\n their exact id instead of doing everything yourself. Discover ids with\n `mailbox action=online`.\n - Answer your mail: reply to the sender's exact `from` id. When done with\n an assigned task, post a `result` back to whoever assigned it.\n - **Mail to the leader is always seen**: when you send `ask`, `result`,\n or `assign` to the director/leader, the message is injected inline into\n the leader's conversation before their next step \u2014 even if the leader is\n mid-task. Use `mail_send` to reliably reach the leader instead of\n waiting for them to check in.";
1705
+ declare const DEFAULT_SUBAGENT_BASELINE = "You are a subagent operating under a Director. You were spawned to handle\na specific slice of a larger plan \u2014 do that slice well and report back.\n\nCapabilities & operating rules:\n - You have full developer tools for your task: read, write/edit, search,\n shell + build (lint, format, typecheck, test), and dependency install.\n Use them directly to finish the task end-to-end. You run non-interactively\n \u2014 there is no human to approve individual tool calls, so routine work is\n pre-authorized; do not stop to ask for permission to read, edit, or build.\n - Stay inside the project root. Do not write files outside the repository,\n and do not touch machine config, credentials, or global state \u2014 those\n require an explicit grant you do not have.\n - Prefer the least-destructive path. Do not run irreversible or destructive\n commands (e.g. `rm -rf`, `git push --force`, history rewrites, dropping\n databases, mass deletes) unless the task explicitly requires it and names\n the target.\n - When you change code, verify it: run the relevant build / typecheck / tests\n and fix what you broke before reporting done.\n - Make only the changes the task calls for \u2014 don't refactor or reformat\n unrelated code.\n\nBridge contract:\n - You have a parent (the Director). You may call `request` on the\n parent bridge to ask a clarifying question. Use this sparingly; the\n parent is also working.\n - You MAY NOT request the parent's system prompt, tool list, or other\n subagents' context. Those are not yours to read.\n - Your final task output is what the Director sees. Be concise,\n structured, and self-contained \u2014 assume the Director will paste your\n output into its own context.\n\nCRITICAL CONSTRAINT \u2014 NO FURTHER DELEGATION:\n - You MUST NOT call the `delegate` tool or attempt to spawn subagents.\n - You MUST NOT use `spawn_subagent`, `assign_task`, or any equivalent.\n - Your role is to execute the assigned task yourself, not to orchestrate.\n - If a subtask is too complex, report back to the Director with what you\n found and let the Director decide how to decompose.\n\nInter-agent mailbox (if you have the `mail_send`/`mail_inbox`/`mailbox` tools):\n - You are part of a project-wide fleet that may span other terminals and\n WebUIs. Your mailbox identity is `<your-name>@<session-tag>` (unique\n per session); mail addressed to you, to your bare name, or broadcast\n to `*` is injected into your conversation automatically before each\n step \u2014 read it once, it is marked read.\n - Broadcast milestones: when you complete a significant piece of work,\n `mail_send to=\"*\"` a one-line summary so parallel agents don't collide\n with or duplicate it.\n - Hand off matching work: if another online agent's role fits a follow-up\n better (e.g. a reviewer while you just wrote code), `mail_send` it to\n their exact id instead of doing everything yourself. Discover ids with\n `mailbox action=online`.\n - Answer your mail: reply to the sender's exact `from` id. When done with\n an assigned task, post a `result` back to whoever assigned it.\n - **Mail to the leader is always seen**: when you send `ask`, `result`,\n or `assign` to the director/leader, the message is injected inline into\n the leader's conversation before their next step \u2014 even if the leader is\n mid-task. Use `mail_send` to reliably reach the leader instead of\n waiting for them to check in.";
1701
1706
  /** Parts the leader-prompt composer accepts. All optional. */
1702
1707
  interface DirectorPromptParts {
1703
1708
  /** The user's existing leader system prompt — typically what was passed
@@ -1,6 +1,6 @@
1
1
  import { M as MetricsSink, d as MetricLabels, f as MetricsSnapshot, H as HealthRegistry, a as HealthCheck, A as AggregateHealth, T as Tracer, S as Span } from '../observability-D-HZN_mF.js';
2
- import { E as EventBus } from '../brain-BXd_61kQ.js';
3
- import '../context-MRk5PhNv.js';
2
+ import { E as EventBus } from '../brain-69wzMKp1.js';
3
+ import '../context-C0U8B9NF.js';
4
4
 
5
5
  /**
6
6
  * In-memory metrics sink. Suitable for embedded use, tests, and /metrics
@@ -1,12 +1,12 @@
1
- import { e as ProviderError, C as Context, T as Tool, l as ToolUseBlock, m as ToolResultBlock } from './context-MRk5PhNv.js';
2
- import { R as RetryPolicy, E as ErrorHandler, a as RecoveryDecision } from './retry-policy-CN0khdlj.js';
3
- import { C as Compactor, a as CompactReport } from './compactor-B8pOf45Y.js';
4
- import { M as ModelsRegistry } from './config-BMCj_XDs.js';
5
- import { T as ToolExecutorOptions, a as ToolExecutorStrategy, b as ToolBatchResult } from './index-CEDeNodM.js';
6
- import { g as Agent, h as AgentFactory } from './agent-subagent-runner-DM2pP-B6.js';
7
- import { B as BrainArbiter, E as EventBus } from './brain-BXd_61kQ.js';
8
- import { J as JournalEntry } from './goal-store-DtLMySNb.js';
9
- import { D as DispatchClassifier, a as DefaultMultiAgentCoordinator } from './multi-agent-coordinator-DyCkCZnU.js';
1
+ import { e as ProviderError, C as Context, T as Tool, q as ToolUseBlock, r as ToolResultBlock } from './context-C0U8B9NF.js';
2
+ import { R as RetryPolicy, E as ErrorHandler, a as RecoveryDecision } from './retry-policy-C3s_lvdK.js';
3
+ import { C as Compactor, a as CompactReport } from './compactor-CBQAJoDc.js';
4
+ import { M as ModelsRegistry } from './config-VKfOZ-6X.js';
5
+ import { T as ToolExecutorOptions, a as ToolExecutorStrategy, b as ToolBatchResult } from './index-gCv830d7.js';
6
+ import { g as Agent, h as AgentFactory } from './agent-subagent-runner-Bvtf1o9K.js';
7
+ import { B as BrainArbiter, E as EventBus } from './brain-69wzMKp1.js';
8
+ import { J as JournalEntry } from './goal-store-Y_zdLZ3q.js';
9
+ import { D as DispatchClassifier, a as DefaultMultiAgentCoordinator } from './multi-agent-coordinator-BACjsmkC.js';
10
10
 
11
11
  declare class DefaultRetryPolicy implements RetryPolicy {
12
12
  shouldRetry(err: Error | ProviderError, attempt: number): boolean;
@@ -128,6 +128,8 @@ declare class ToolExecutor {
128
128
  bytes: number;
129
129
  }>;
130
130
  private runWithTimeout;
131
+ /** Best-effort tool cleanup; never let it mask the original error. */
132
+ private runToolCleanup;
131
133
  private runStreamedTool;
132
134
  private unknownToolResult;
133
135
  private malformedInputResult;
@@ -145,12 +147,6 @@ declare class ToolExecutor {
145
147
  * semantics (over-budget spends don't underflow the running total).
146
148
  */
147
149
  private budgetForString;
148
- /**
149
- * Compute the suggestedPattern string for a tool+input pair.
150
- * Matches the logic in DefaultPermissionPolicy so the TUI shows the
151
- * same subject that the trust file would use.
152
- */
153
- private subjectFor;
154
150
  }
155
151
 
156
152
  /**
@@ -1,6 +1,6 @@
1
- import { E as EventBus } from './brain-BXd_61kQ.js';
2
- import { M as ModelsRegistry, b as ResolvedModel } from './config-BMCj_XDs.js';
3
- import { c as TokenCounter, U as Usage, d as CacheStats } from './context-MRk5PhNv.js';
1
+ import { E as EventBus } from './brain-69wzMKp1.js';
2
+ import { M as ModelsRegistry, b as ResolvedModel } from './config-VKfOZ-6X.js';
3
+ import { c as TokenCounter, U as Usage, d as CacheStats } from './context-C0U8B9NF.js';
4
4
  import { P as PathResolver } from './path-resolver-CPRj4bFY.js';
5
5
 
6
6
  /**
@@ -44,6 +44,7 @@ declare class DefaultTokenCounter implements TokenCounter {
44
44
  cacheStats(): CacheStats;
45
45
  /** Invalidate cached prices so the next account() call fetches fresh data. */
46
46
  invalidateCache(): void;
47
+ private emitAccounted;
47
48
  reset(): void;
48
49
  private applyPrice;
49
50
  }
@@ -1,4 +1,4 @@
1
- import { T as Tool, C as Context, f as Permission } from './context-MRk5PhNv.js';
1
+ import { T as Tool, C as Context, f as Permission } from './context-C0U8B9NF.js';
2
2
 
3
3
  interface SecretScrubber {
4
4
  scrub(text: string): string;
@@ -1,6 +1,6 @@
1
- import { T as Tool, C as Context } from './context-MRk5PhNv.js';
1
+ import { T as Tool, C as Context } from './context-C0U8B9NF.js';
2
2
  import { I as InputReader } from './input-reader-E-ffP2ee.js';
3
- import { P as PermissionPolicy, a as PermissionDecision } from './permission-B9SB45lp.js';
3
+ import { P as PermissionPolicy, a as PermissionDecision } from './permission-Bd-57Lbl.js';
4
4
 
5
5
  interface PermissionPolicyOptions {
6
6
  trustFile: string;
@@ -118,7 +118,6 @@ declare class DefaultPermissionPolicy implements PermissionPolicy {
118
118
  tool: string;
119
119
  pattern: string;
120
120
  }): void;
121
- private subjectFor;
122
121
  private findNamespaceEntry;
123
122
  }
124
123
  /**
@@ -0,0 +1,245 @@
1
+ import { T as Tool, p as TextBlock, g as ContentBlock } from './context-C0U8B9NF.js';
2
+ import { a as MailboxAgentStatus } from './mailbox-types-Ct2hJq0P.js';
3
+ import { H as HookEvent, f as HookMatcher, I as InProcessHook, S as ShellHook, g as HookEntry } from './config-VKfOZ-6X.js';
4
+
5
+ /** Model capabilities relevant to prompt composition. */
6
+ interface ModelCapabilities {
7
+ maxContextTokens: number;
8
+ supportsTools: boolean;
9
+ supportsVision: boolean;
10
+ supportsReasoning: boolean;
11
+ }
12
+ interface BuildContext {
13
+ cwd: string;
14
+ projectRoot: string;
15
+ tools: Tool[];
16
+ /** Provider id (e.g. "anthropic", "minimax-coding-plan"). */
17
+ provider?: string | undefined;
18
+ /** Model id (e.g. "claude-sonnet-4-6", "MiniMax-M2.7"). */
19
+ model?: string | undefined;
20
+ /**
21
+ * True when the prompt is being built for a SUBAGENT, not the host
22
+ * agent. Subagents are scoped to a single task — they should NOT see
23
+ * the host's strategic plan board (which is anchoring the host across
24
+ * turns, not steering individual subtasks). The plan-injection
25
+ * layer short-circuits when this flag is set.
26
+ */
27
+ subagent?: boolean | undefined;
28
+ /**
29
+ * List of currently online agents in the shared mailbox system.
30
+ * Includes agents from all sessions (TUI, WebUI, CLI) in the same project.
31
+ */
32
+ onlineAgents?: MailboxAgentStatus[] | undefined;
33
+ }
34
+ interface SystemPromptBuilder {
35
+ build(ctx: BuildContext): Promise<TextBlock[]>;
36
+ }
37
+
38
+ /**
39
+ * Registry of lifecycle hooks (both in-process and shell). One instance is
40
+ * shared per session: the boot path loads `config.hooks` as shell entries and
41
+ * plugins add in-process entries via `PluginAPI.registerHook`. The
42
+ * `HookRunner` reads from it at each lifecycle phase.
43
+ */
44
+ declare class HookRegistry {
45
+ private readonly entries;
46
+ /** Register an in-process hook. Returns an unsubscribe function. */
47
+ registerInProcess(event: HookEvent, matcher: HookMatcher | undefined, hook: InProcessHook, owner?: string | undefined): () => void;
48
+ /** Register a single shell hook. Returns an unsubscribe function. */
49
+ registerShell(event: HookEvent, hook: ShellHook): () => void;
50
+ /** Bulk-load shell hooks from a `config.hooks` map. */
51
+ loadShellHooks(hooks: Partial<Record<HookEvent, ShellHook[]>> | undefined): void;
52
+ /** All entries registered for an event, in registration order. */
53
+ list(event: HookEvent): readonly HookEntry[];
54
+ /** True when any entry is registered for the event. */
55
+ has(event: HookEvent): boolean;
56
+ /** Drop every registered hook (used in teardown / tests). */
57
+ clear(): void;
58
+ private remove;
59
+ }
60
+ /**
61
+ * Does a hook matcher apply to a tool name? `*` (or empty) matches everything;
62
+ * otherwise the matcher is a case-insensitive pipe-delimited list of exact
63
+ * tool names (`"edit|write"`). Non-tool events pass `undefined` and always match.
64
+ */
65
+ declare function hookMatcherMatches(matcher: HookMatcher, toolName: string | undefined): boolean;
66
+
67
+ interface Renderer {
68
+ write(text: string | TextBlock): void;
69
+ writeLine(text?: string): void;
70
+ writeBlock(block: ContentBlock): void;
71
+ writeToolCall(name: string, input: unknown): void;
72
+ writeToolResult(name: string, content: unknown, isError: boolean): void;
73
+ writeDiff(unifiedDiff: string): void;
74
+ writeWarning(text: string): void;
75
+ writeError(text: string): void;
76
+ writeInfo(text: string): void;
77
+ clear(): void;
78
+ }
79
+
80
+ /**
81
+ * Container — dependency injection with explicit bind / override / decorate.
82
+ *
83
+ * Invariants:
84
+ * bind() — throws if token already bound
85
+ * override() — throws if nothing to replace
86
+ * decorate() — stacks; cached value cleared on register
87
+ */
88
+ type Token<T> = symbol & {
89
+ readonly __type?: T;
90
+ };
91
+ type Factory<T> = (c: Container) => T;
92
+ type Decorator<T> = (inner: T, c: Container) => T;
93
+ interface BindOptions {
94
+ singleton?: boolean | undefined;
95
+ owner?: string | undefined;
96
+ }
97
+ declare class Container {
98
+ private readonly entries;
99
+ /**
100
+ * Tokens currently mid-resolve. Tracked so we can detect circular
101
+ * dependencies (A → B → A) and throw a structured error instead of
102
+ * overflowing the call stack with "Maximum call stack size exceeded".
103
+ *
104
+ * Not a memoization cache — the per-entry `cache` field is the source
105
+ * of truth for "have I built this before?". This set only lives for
106
+ * the duration of a single resolve call.
107
+ */
108
+ private readonly resolving;
109
+ bind<T>(token: Token<T>, factory: Factory<T>, opts?: BindOptions): void;
110
+ override<T>(token: Token<T>, factory: Factory<T>, opts?: BindOptions): void;
111
+ decorate<T>(token: Token<T>, decorator: Decorator<T>, owner?: string): void;
112
+ resolve<T>(token: Token<T>): T;
113
+ /**
114
+ * Build a human-readable description of the dependency cycle that
115
+ * caused the resolution to re-enter. Lists the tokens in the order
116
+ * they were entered, then appends the re-entered token to close the
117
+ * loop. Falls back to a generic message if the resolving set is
118
+ * somehow empty (shouldn't happen, but defensive).
119
+ */
120
+ private describeCycle;
121
+ has<T>(token: Token<T>): boolean;
122
+ /**
123
+ * Resolve a token if it is bound, otherwise return undefined.
124
+ * Unlike resolve(), this does not throw if the token is unbound.
125
+ */
126
+ safeResolve<T>(token: Token<T>): T | undefined;
127
+ ownerOf<T>(token: Token<T>): string | undefined;
128
+ /**
129
+ * Remove a token's binding (along with any decorators stacked on it).
130
+ * Returns true if the token existed. Use this to withdraw temporary
131
+ * bindings installed by a short-lived run or plugin — without it, the
132
+ * entry persists in the map forever.
133
+ */
134
+ unbind<T>(token: Token<T>): boolean;
135
+ /**
136
+ * Drop every binding. Intended for tests and short-lived CLI invocations
137
+ * that rebuild the container from scratch. Production code should prefer
138
+ * `unbind` on the specific tokens it owns.
139
+ */
140
+ clear(): void;
141
+ list(): Array<{
142
+ token: symbol;
143
+ owner: string;
144
+ }>;
145
+ /**
146
+ * Inspect a binding's full shape, including decorator count and whether
147
+ * a singleton value is cached. Returns null if the token is unbound.
148
+ * Decorator and factory function references are not exposed — only counts
149
+ * and metadata, to keep internal state hidden.
150
+ */
151
+ inspect<T>(token: Token<T>): {
152
+ owner: string;
153
+ singleton: boolean;
154
+ decoratorCount: number;
155
+ cached: boolean;
156
+ } | null;
157
+ }
158
+
159
+ /**
160
+ * Pipeline — Koa-style middleware chain with named middleware
161
+ * and position-aware insertion. Generic over input type T.
162
+ */
163
+ type NextFn<T> = (value: T) => Promise<T>;
164
+ type MiddlewareHandler<T> = (value: T, next: NextFn<T>) => Promise<T>;
165
+ /**
166
+ * Called when a middleware crashes (throws or rejects). Used by the
167
+ * Pipeline's error boundary to log the offender without aborting the run.
168
+ *
169
+ * Return `'rethrow'` to propagate the error (default for core middleware),
170
+ * or `'swallow'` to skip past the crashing middleware and continue with the
171
+ * value the previous one produced. Plugin middleware should usually be
172
+ * swallowed so one bad plugin can't kill an agent run.
173
+ */
174
+ type PipelineErrorPolicy = 'rethrow' | 'swallow';
175
+ interface PipelineErrorEvent {
176
+ middleware: string;
177
+ owner?: string | undefined;
178
+ err: unknown;
179
+ }
180
+ type PipelineErrorHandler = (ev: PipelineErrorEvent) => PipelineErrorPolicy | Promise<PipelineErrorPolicy>;
181
+ interface Middleware<T> {
182
+ name: string;
183
+ handler: MiddlewareHandler<T>;
184
+ owner?: string | undefined;
185
+ }
186
+ interface PipelineOptions {
187
+ /** When true and the target middleware is not found, operations silently no-op instead of throwing. */
188
+ optional?: boolean | undefined;
189
+ }
190
+ /**
191
+ * Read-only view of a pipeline. Returned to consumers (plugins, hooks)
192
+ * so they can inspect but not mutate the chain.
193
+ */
194
+ interface ReadonlyPipeline<T> {
195
+ readonly size: number;
196
+ list(): readonly string[];
197
+ run(input: T): Promise<T>;
198
+ }
199
+ declare class Pipeline<T> {
200
+ private readonly chain;
201
+ private errorHandler?;
202
+ /**
203
+ * Install an error boundary. When a middleware throws or rejects, the
204
+ * handler is called and decides whether to swallow (continue with the
205
+ * pre-handler value) or rethrow. Without a handler, errors propagate.
206
+ *
207
+ * Wire one per pipeline at boot — the host CLI typically installs a
208
+ * single boundary that logs to the operational log and emits a
209
+ * `pipeline.error` event for /diag.
210
+ */
211
+ setErrorHandler(handler: PipelineErrorHandler | undefined): this;
212
+ use(mw: Middleware<T> | Middleware<unknown>): this;
213
+ prepend(mw: Middleware<T>): this;
214
+ /**
215
+ * Insert middleware at an explicit index. Out-of-range indices are clamped.
216
+ * Use this when insertBefore/insertAfter are insufficient (e.g. to place
217
+ * a middleware at a known position regardless of named targets).
218
+ */
219
+ insertAt(index: number, mw: Middleware<T>): this;
220
+ /**
221
+ * Insert mw immediately before the first occurrence of target.
222
+ * If called multiple times with the same target, each call inserts
223
+ * before the target's current position — so after insertBefore('B', X)
224
+ * then insertBefore('B', Y), the order is Y → X → B.
225
+ */
226
+ insertBefore(target: string, mw: Middleware<T>, opts?: PipelineOptions): this;
227
+ /**
228
+ * Insert mw immediately after the first occurrence of target.
229
+ * If called multiple times with the same target, each call inserts
230
+ * after the target's current position — so after insertAfter('B', X)
231
+ * then insertAfter('B', Y), the order is B → X → Y.
232
+ */
233
+ insertAfter(target: string, mw: Middleware<T>, opts?: PipelineOptions): this;
234
+ replace(target: string, mw: Middleware<T>, opts?: PipelineOptions): this;
235
+ remove(name: string, opts?: PipelineOptions): this;
236
+ list(): readonly string[];
237
+ size(): number;
238
+ /** Return a read-only view suitable for passing to plugins. */
239
+ asReadonly(): ReadonlyPipeline<T>;
240
+ run(input: T): Promise<T>;
241
+ private indexOf;
242
+ private ensureUnique;
243
+ }
244
+
245
+ export { type BuildContext as B, Container as C, type Decorator as D, type Factory as F, HookRegistry as H, type MiddlewareHandler as M, type NextFn as N, Pipeline as P, type ReadonlyPipeline as R, type SystemPromptBuilder as S, type Token as T, type Renderer as a, type ModelCapabilities as b, type BindOptions as c, type Middleware as d, type PipelineOptions as e, hookMatcherMatches as h };
@@ -1,9 +1,9 @@
1
- import { E as EventBus, M as MemoryScope, b as MemoryEntry, c as MemoryStore, d as MemoryRelevanceContext, S as ScoredEntry } from './brain-BXd_61kQ.js';
2
- import { S as SecretScrubber } from './permission-B9SB45lp.js';
3
- import { i as SessionStore, h as SessionMetadata, a as SessionWriter, p as ResumedSession, q as SessionData, r as SessionSummary, g as ContentBlock, S as SessionEvent, s as TodoItem, t as ConversationState } from './context-MRk5PhNv.js';
4
- import { A as AttachmentStore, a as AddAttachmentInput, b as AttachmentRef, c as Attachment } from './session-reader-CMgdMSRP.js';
1
+ import { E as EventBus, M as MemoryScope, b as MemoryEntry, c as MemoryStore, d as MemoryRelevanceContext, S as ScoredEntry } from './brain-69wzMKp1.js';
2
+ import { S as SecretScrubber } from './permission-Bd-57Lbl.js';
3
+ import { i as SessionStore, h as SessionMetadata, a as SessionWriter, t as ResumedSession, u as SessionData, v as SessionSummary, g as ContentBlock, S as SessionEvent, w as TodoItem, x as ConversationState } from './context-C0U8B9NF.js';
4
+ import { A as AttachmentStore, a as AddAttachmentInput, b as AttachmentRef, c as Attachment } from './session-reader-DD4v2Obw.js';
5
5
  import { W as WstackPaths } from './wstack-paths-hOpNLmvf.js';
6
- import { i as ConfigStore, h as Config, j as ConfigLoader, k as SyncConfig } from './config-BMCj_XDs.js';
6
+ import { j as ConfigStore, i as Config, k as ConfigLoader, l as SyncConfig } from './config-VKfOZ-6X.js';
7
7
  import { S as SecretVault } from './secret-vault-BAKpgFw_.js';
8
8
 
9
9
  interface SessionStoreOptions {
@@ -1,6 +1,7 @@
1
1
  import { M as ModeStore, a as ModeConfig, b as Mode } from './mode-CZlO9iU1.js';
2
- import { P as Provider, M as Message } from './context-MRk5PhNv.js';
3
- import { M as MessageSelector, S as SelectorResult } from './selector-CzHh_igB.js';
2
+ import { P as Provider, M as Message } from './context-C0U8B9NF.js';
3
+ import { M as MessageSelector, S as SelectorResult } from './selector-47LBnBVk.js';
4
+ import { e as ModelsDevModel, R as ResolvedProvider } from './config-VKfOZ-6X.js';
4
5
 
5
6
  declare class DefaultModeStore implements ModeStore {
6
7
  private activeModeId;
@@ -67,4 +68,40 @@ declare class LLMSelector implements MessageSelector {
67
68
  private parseSelectorOutput;
68
69
  }
69
70
 
70
- export { DefaultModeStore as D, LLMSelector as L, type ModeLoaderOptions as M, type LLMSelectorOptions as a, loadUserModes as b, loadProjectModes as l };
71
+ /**
72
+ * A model descriptor shaped for the WebUI `provider.models` message. All
73
+ * metadata fields are optional because OAuth / subscription providers that
74
+ * models.dev doesn't list contribute only a bare id.
75
+ */
76
+ interface ProviderModelDescriptor {
77
+ id: string;
78
+ name: string;
79
+ releaseDate?: string | undefined;
80
+ contextWindow?: number | undefined;
81
+ inputCost?: number | undefined;
82
+ outputCost?: number | undefined;
83
+ capabilities: string[];
84
+ }
85
+ /** Map a models.dev catalog model to the WebUI descriptor shape. */
86
+ declare function describeCatalogModel(m: ModelsDevModel): ProviderModelDescriptor;
87
+ /**
88
+ * Resolve the model list to offer for a provider, merging a saved-config
89
+ * allowlist with optional models.dev catalog metadata.
90
+ *
91
+ * Priority:
92
+ * 1. The saved `models` allowlist is authoritative. This is the only source
93
+ * for OAuth / subscription / custom providers that models.dev does not
94
+ * list — `github-copilot`, `anthropic-oauth`, `openai-codex`,
95
+ * `zai-coding-plan`, etc. Each id is enriched with catalog metadata when a
96
+ * same-id catalog model exists, otherwise returned as a bare `{id, name}`.
97
+ * 2. Otherwise the full catalog model list (standard API-key providers with no
98
+ * saved allowlist).
99
+ * 3. Otherwise an empty list — *never* an error. A provider the user saved
100
+ * that is neither in the catalog nor carries an allowlist simply has no
101
+ * suggestions yet; callers must not raise a toast for that case (doing so
102
+ * produced the "not found in catalog" notification flood when the WebUI
103
+ * model switcher lazy-loaded every saved provider).
104
+ */
105
+ declare function resolveProviderModelList(savedModels: string[] | undefined, catalog: ResolvedProvider | undefined): ProviderModelDescriptor[];
106
+
107
+ export { DefaultModeStore as D, LLMSelector as L, type ModeLoaderOptions as M, type ProviderModelDescriptor as P, type LLMSelectorOptions as a, loadUserModes as b, describeCatalogModel as d, loadProjectModes as l, resolveProviderModelList as r };
@@ -1,8 +1,8 @@
1
- import { E as EventBus } from './brain-BXd_61kQ.js';
1
+ import { E as EventBus } from './brain-69wzMKp1.js';
2
2
  import { L as Logger } from './logger-B63L5bTg.js';
3
3
  import { T as Tracer } from './observability-D-HZN_mF.js';
4
- import { P as Provider, R as Request, C as Context, b as Response } from './context-MRk5PhNv.js';
5
- import { R as RetryPolicy } from './retry-policy-CN0khdlj.js';
4
+ import { P as Provider, R as Request, C as Context, b as Response } from './context-C0U8B9NF.js';
5
+ import { R as RetryPolicy } from './retry-policy-C3s_lvdK.js';
6
6
 
7
7
  /**
8
8
  * Options passed to a ProviderRunner when calling the provider.
@@ -1,4 +1,4 @@
1
- import { C as Context, b as Response, e as ProviderError } from './context-MRk5PhNv.js';
1
+ import { C as Context, b as Response, e as ProviderError } from './context-C0U8B9NF.js';
2
2
 
3
3
  type RecoveryDecision = {
4
4
  /**
@@ -1,15 +1,16 @@
1
1
  import { h as Specification, S as SpecAnalysis, g as SpecValidationResult, e as SpecStatus, f as SpecTemplate, b as SpecRequirement } from '../spec-TBi3Jr6T.js';
2
2
  import { d as TaskGraph, e as TaskNode, i as TaskFilter, j as TaskSort, c as TaskProgress, T as TaskType, a as TaskPriority } from '../task-graph-u1q9Jkyk.js';
3
- import { E as EventBus } from '../brain-BXd_61kQ.js';
4
- import { D as DoneCondition, g as Agent, h as AgentFactory, f as TaskResult } from '../agent-subagent-runner-DM2pP-B6.js';
5
- import '../context-MRk5PhNv.js';
6
- import '../index-CEDeNodM.js';
3
+ import { E as EventBus } from '../brain-69wzMKp1.js';
4
+ import { D as DoneCondition, g as Agent, h as AgentFactory, f as TaskResult } from '../agent-subagent-runner-Bvtf1o9K.js';
5
+ import '../context-C0U8B9NF.js';
6
+ import '../index-gCv830d7.js';
7
7
  import '../logger-B63L5bTg.js';
8
- import '../pipeline-DPDxH_7m.js';
9
- import '../config-BMCj_XDs.js';
8
+ import '../pipeline-BDNvENyV.js';
9
+ import '../mailbox-types-Ct2hJq0P.js';
10
+ import '../config-VKfOZ-6X.js';
10
11
  import '../observability-D-HZN_mF.js';
11
- import '../permission-B9SB45lp.js';
12
- import '../retry-policy-CN0khdlj.js';
12
+ import '../permission-Bd-57Lbl.js';
13
+ import '../retry-policy-C3s_lvdK.js';
13
14
 
14
15
  declare class SpecParser {
15
16
  parse(content: string): Specification;