@wrongstack/core 0.264.0 → 0.267.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 (90) hide show
  1. package/dist/{agent-bridge-D8sa1vtv.d.ts → agent-bridge-STJ3JwwK.d.ts} +1 -1
  2. package/dist/{agent-subagent-runner-c9DLkaas.d.ts → agent-subagent-runner-CzPGP3jA.d.ts} +131 -11
  3. package/dist/{brain-O1IdKPaK.d.ts → brain-Cdg77tVN.d.ts} +103 -2
  4. package/dist/{compactor-BBy0rCtB.d.ts → compactor-iMZ84CXq.d.ts} +19 -1
  5. package/dist/{config-Dz2F3H2K.d.ts → config-Du3pYYln.d.ts} +132 -13
  6. package/dist/{context-BGSpZNSE.d.ts → context-dT5Ueund.d.ts} +90 -12
  7. package/dist/coordination/index.d.ts +78 -22
  8. package/dist/coordination/index.js +695 -273
  9. package/dist/coordination/index.js.map +1 -1
  10. package/dist/{default-config-CXsDvOmP.d.ts → default-config-B0cj-Hry.d.ts} +11 -1
  11. package/dist/defaults/index.d.ts +28 -28
  12. package/dist/defaults/index.js +2327 -965
  13. package/dist/defaults/index.js.map +1 -1
  14. package/dist/execution/index.d.ts +16 -16
  15. package/dist/execution/index.js +1500 -371
  16. package/dist/execution/index.js.map +1 -1
  17. package/dist/execution/prompt-enhancer.d.ts +2 -2
  18. package/dist/execution/prompt-enhancer.js +1 -1
  19. package/dist/execution/prompt-enhancer.js.map +1 -1
  20. package/dist/extension/index.d.ts +6 -6
  21. package/dist/{goal-preamble-DzjFuN3p.d.ts → goal-preamble-SulMTowG.d.ts} +33 -12
  22. package/dist/{goal-store-CxWmCGbH.d.ts → goal-store-CABDwdFE.d.ts} +1 -1
  23. package/dist/{index-CbLSI66_.d.ts → index-Bms0m4oy.d.ts} +5 -5
  24. package/dist/{index-CYIQrXVF.d.ts → index-DtCVWel4.d.ts} +8 -8
  25. package/dist/index-IEuxQd-E.d.ts +82 -0
  26. package/dist/index.d.ts +261 -57
  27. package/dist/index.js +4799 -2212
  28. package/dist/index.js.map +1 -1
  29. package/dist/infrastructure/index.d.ts +6 -6
  30. package/dist/infrastructure/index.js +84 -9
  31. package/dist/infrastructure/index.js.map +1 -1
  32. package/dist/kernel/index.d.ts +9 -9
  33. package/dist/kernel/index.js +1 -1
  34. package/dist/kernel/index.js.map +1 -1
  35. package/dist/{mcp-servers-DC4QRPUI.d.ts → mcp-servers-C2cBTxUR.d.ts} +3 -3
  36. package/dist/models/index.d.ts +5 -5
  37. package/dist/models/index.js +104 -31
  38. package/dist/models/index.js.map +1 -1
  39. package/dist/{models-registry-B_siPxqN.d.ts → models-registry-BqGZNJQ-.d.ts} +1 -1
  40. package/dist/{multi-agent-coordinator-CK5Jdj9K.d.ts → multi-agent-coordinator-B8R43uPz.d.ts} +1 -1
  41. package/dist/{null-fleet-bus-DgvD4SCO.d.ts → null-fleet-bus-CnXa5oTH.d.ts} +14 -9
  42. package/dist/observability/index.d.ts +2 -2
  43. package/dist/{parallel-eternal-engine-bK0JQBR_.d.ts → parallel-eternal-engine-DdNnw9BQ.d.ts} +11 -9
  44. package/dist/{path-resolver-BPEDlN38.d.ts → path-resolver-COIMLCQL.d.ts} +3 -3
  45. package/dist/{permission-4yvGmMRB.d.ts → permission-B75JAi3-.d.ts} +1 -1
  46. package/dist/{permission-policy-C6XpsBOy.d.ts → permission-policy-DlR9eJAM.d.ts} +2 -2
  47. package/dist/{pipeline-CXCeMz8J.d.ts → pipeline-BfD2k1rT.d.ts} +3 -3
  48. package/dist/{plan-templates-BvzRBkJc.d.ts → plan-templates-DSIKCXZN.d.ts} +32 -8
  49. package/dist/provider-model-resolve-BNRsNuJx.d.ts +107 -0
  50. package/dist/{provider-runner-C5aQpDWE.d.ts → provider-runner-CX7iIvox.d.ts} +3 -3
  51. package/dist/{retry-policy-CFhdtRzz.d.ts → retry-policy-BilV1ujH.d.ts} +1 -1
  52. package/dist/sdd/index.d.ts +8 -8
  53. package/dist/sdd/index.js +286 -105
  54. package/dist/sdd/index.js.map +1 -1
  55. package/dist/secret-vault-BAKpgFw_.d.ts +57 -0
  56. package/dist/{secret-vault-CxiVLbt1.d.ts → secret-vault-gkvEZZfE.d.ts} +43 -4
  57. package/dist/security/index.d.ts +6 -68
  58. package/dist/security/index.js +296 -95
  59. package/dist/security/index.js.map +1 -1
  60. package/dist/{selector-gIuhRTkN.d.ts → selector-Bc7eWtT3.d.ts} +1 -1
  61. package/dist/{session-event-bridge-DkvvrpDt.d.ts → session-event-bridge-D-araDEz.d.ts} +1 -1
  62. package/dist/{session-reader-KdfVwkKP.d.ts → session-reader-D7Dapswh.d.ts} +1 -1
  63. package/dist/storage/index.d.ts +112 -15
  64. package/dist/storage/index.js +491 -156
  65. package/dist/storage/index.js.map +1 -1
  66. package/dist/tools/index.d.ts +4 -2
  67. package/dist/tools/index.js.map +1 -1
  68. package/dist/types/index.d.ts +21 -21
  69. package/dist/types/index.js +1523 -450
  70. package/dist/types/index.js.map +1 -1
  71. package/dist/utils/index.d.ts +455 -407
  72. package/dist/utils/index.js +2191 -1203
  73. package/dist/utils/index.js.map +1 -1
  74. package/dist/{wstack-paths-CJjEwPXn.d.ts → wstack-paths-hOpNLmvf.d.ts} +2 -0
  75. package/package.json +1 -1
  76. package/skills/api-design/SKILL.md +1 -1
  77. package/skills/audit-log/SKILL.md +6 -6
  78. package/skills/bug-hunter/SKILL.md +5 -5
  79. package/skills/chimera/SKILL.md +4 -4
  80. package/skills/docker-deploy/SKILL.md +1 -1
  81. package/skills/git-flow/SKILL.md +3 -3
  82. package/skills/multi-agent/SKILL.md +3 -3
  83. package/skills/node-modern/SKILL.md +1 -0
  84. package/skills/observability/SKILL.md +2 -2
  85. package/skills/output-standards/SKILL.md +51 -28
  86. package/skills/refactor-planner/SKILL.md +3 -3
  87. package/skills/security-scanner/SKILL.md +4 -3
  88. package/skills/tech-stack/SKILL.md +1 -2
  89. package/dist/llm-selector-DzxuZnNz.d.ts +0 -58
  90. package/dist/secret-vault-BJDY28ev.d.ts +0 -25
@@ -1,4 +1,4 @@
1
- import { M as ModelsRegistry, a as ModelsDevPayload, R as ResolvedProvider, b as ResolvedModel, W as WireFamily } from './config-Dz2F3H2K.js';
1
+ import { M as ModelsRegistry, a as ModelsDevPayload, R as ResolvedProvider, b as ResolvedModel, W as WireFamily } from './config-Du3pYYln.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-c9DLkaas.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-CzPGP3jA.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-CK5Jdj9K.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-c9DLkaas.js';
3
- import { a as SessionWriter, T as Tool, i as SessionStore } from './context-BGSpZNSE.js';
4
- import { B as BrainArbiter, E as EventBus } from './brain-O1IdKPaK.js';
1
+ import { A as AgentPhase, b as AgentDefinition, a as DefaultMultiAgentCoordinator, D as DispatchClassifier } from './multi-agent-coordinator-B8R43uPz.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-CzPGP3jA.js';
3
+ import { a as SessionWriter, T as Tool, i as SessionStore } from './context-dT5Ueund.js';
4
+ import { B as BrainArbiter, E as EventBus } from './brain-Cdg77tVN.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-Dz2F3H2K.js';
8
- import { I as InMemoryAgentBridge } from './agent-bridge-D8sa1vtv.js';
8
+ import { d as ModelMatrixEntry } from './config-Du3pYYln.js';
9
+ import { I as InMemoryAgentBridge } from './agent-bridge-STJ3JwwK.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-O1IdKPaK.js';
3
- import '../context-BGSpZNSE.js';
2
+ import { E as EventBus } from '../brain-Cdg77tVN.js';
3
+ import '../context-dT5Ueund.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-BGSpZNSE.js';
2
- import { R as RetryPolicy, E as ErrorHandler, a as RecoveryDecision } from './retry-policy-CFhdtRzz.js';
3
- import { C as Compactor, a as CompactReport } from './compactor-BBy0rCtB.js';
4
- import { M as ModelsRegistry } from './config-Dz2F3H2K.js';
5
- import { T as ToolExecutorOptions, a as ToolExecutorStrategy, b as ToolBatchResult } from './index-CbLSI66_.js';
6
- import { g as Agent, h as AgentFactory } from './agent-subagent-runner-c9DLkaas.js';
7
- import { B as BrainArbiter, E as EventBus } from './brain-O1IdKPaK.js';
8
- import { J as JournalEntry } from './goal-store-CxWmCGbH.js';
9
- import { D as DispatchClassifier, a as DefaultMultiAgentCoordinator } from './multi-agent-coordinator-CK5Jdj9K.js';
1
+ import { e as ProviderError, C as Context, T as Tool, m as ToolUseBlock, n as ToolResultBlock } from './context-dT5Ueund.js';
2
+ import { R as RetryPolicy, E as ErrorHandler, a as RecoveryDecision } from './retry-policy-BilV1ujH.js';
3
+ import { C as Compactor, a as CompactReport } from './compactor-iMZ84CXq.js';
4
+ import { M as ModelsRegistry } from './config-Du3pYYln.js';
5
+ import { T as ToolExecutorOptions, a as ToolExecutorStrategy, b as ToolBatchResult } from './index-Bms0m4oy.js';
6
+ import { g as Agent, h as AgentFactory } from './agent-subagent-runner-CzPGP3jA.js';
7
+ import { B as BrainArbiter, E as EventBus } from './brain-Cdg77tVN.js';
8
+ import { J as JournalEntry } from './goal-store-CABDwdFE.js';
9
+ import { D as DispatchClassifier, a as DefaultMultiAgentCoordinator } from './multi-agent-coordinator-B8R43uPz.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;
@@ -1,6 +1,6 @@
1
- import { E as EventBus } from './brain-O1IdKPaK.js';
2
- import { M as ModelsRegistry, b as ResolvedModel } from './config-Dz2F3H2K.js';
3
- import { c as TokenCounter, U as Usage, d as CacheStats } from './context-BGSpZNSE.js';
1
+ import { E as EventBus } from './brain-Cdg77tVN.js';
2
+ import { M as ModelsRegistry, b as ResolvedModel } from './config-Du3pYYln.js';
3
+ import { c as TokenCounter, U as Usage, d as CacheStats } from './context-dT5Ueund.js';
4
4
  import { P as PathResolver } from './path-resolver-CPRj4bFY.js';
5
5
 
6
6
  /**
@@ -1,4 +1,4 @@
1
- import { T as Tool, C as Context, f as Permission } from './context-BGSpZNSE.js';
1
+ import { T as Tool, C as Context, f as Permission } from './context-dT5Ueund.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-BGSpZNSE.js';
1
+ import { T as Tool, C as Context } from './context-dT5Ueund.js';
2
2
  import { I as InputReader } from './input-reader-E-ffP2ee.js';
3
- import { P as PermissionPolicy, a as PermissionDecision } from './permission-4yvGmMRB.js';
3
+ import { P as PermissionPolicy, a as PermissionDecision } from './permission-B75JAi3-.js';
4
4
 
5
5
  interface PermissionPolicyOptions {
6
6
  trustFile: string;
@@ -1,5 +1,5 @@
1
- import { T as Tool, n as TextBlock, g as ContentBlock } from './context-BGSpZNSE.js';
2
- import { H as HookEvent, e as HookMatcher, I as InProcessHook, S as ShellHook, f as HookEntry } from './config-Dz2F3H2K.js';
1
+ import { T as Tool, o as TextBlock, g as ContentBlock } from './context-dT5Ueund.js';
2
+ import { H as HookEvent, f as HookMatcher, I as InProcessHook, S as ShellHook, g as HookEntry } from './config-Du3pYYln.js';
3
3
 
4
4
  /**
5
5
  * Mailbox — persistent inter-agent messaging system with cross-session support.
@@ -27,7 +27,7 @@ import { H as HookEvent, e as HookMatcher, I as InProcessHook, S as ShellHook, f
27
27
  *
28
28
  * @module mailbox-types
29
29
  */
30
- type MailboxMessageType = 'note' | 'ask' | 'assign' | 'steer' | 'btw' | 'broadcast' | 'status' | 'result';
30
+ type MailboxMessageType = 'note' | 'ask' | 'assign' | 'steer' | 'btw' | 'broadcast' | 'status' | 'result' | 'control';
31
31
  /**
32
32
  * Per-recipient read status. `readBy` maps agentId → ISO8601 timestamp of
33
33
  * when that agent first read the message. An empty map means unread by all.
@@ -1,10 +1,10 @@
1
- import { E as EventBus, M as MemoryScope, b as MemoryEntry, c as MemoryStore, d as MemoryRelevanceContext, S as ScoredEntry } from './brain-O1IdKPaK.js';
2
- import { S as SecretScrubber } from './permission-4yvGmMRB.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-BGSpZNSE.js';
4
- import { A as AttachmentStore, a as AddAttachmentInput, b as AttachmentRef, c as Attachment } from './session-reader-KdfVwkKP.js';
5
- import { W as WstackPaths } from './wstack-paths-CJjEwPXn.js';
6
- import { i as ConfigStore, h as Config, j as ConfigLoader, k as SyncConfig } from './config-Dz2F3H2K.js';
7
- import { S as SecretVault } from './secret-vault-BJDY28ev.js';
1
+ import { E as EventBus, M as MemoryScope, b as MemoryEntry, c as MemoryStore, d as MemoryRelevanceContext, S as ScoredEntry } from './brain-Cdg77tVN.js';
2
+ import { S as SecretScrubber } from './permission-B75JAi3-.js';
3
+ import { i as SessionStore, h as SessionMetadata, a as SessionWriter, q as ResumedSession, r as SessionData, s as SessionSummary, g as ContentBlock, S as SessionEvent, t as TodoItem, u as ConversationState } from './context-dT5Ueund.js';
4
+ import { A as AttachmentStore, a as AddAttachmentInput, b as AttachmentRef, c as Attachment } from './session-reader-D7Dapswh.js';
5
+ import { W as WstackPaths } from './wstack-paths-hOpNLmvf.js';
6
+ import { j as ConfigStore, i as Config, k as ConfigLoader, l as SyncConfig } from './config-Du3pYYln.js';
7
+ import { S as SecretVault } from './secret-vault-BAKpgFw_.js';
8
8
 
9
9
  interface SessionStoreOptions {
10
10
  dir: string;
@@ -24,7 +24,24 @@ declare class DefaultSessionStore implements SessionStore {
24
24
  private readonly dir;
25
25
  private readonly events?;
26
26
  private readonly secretScrubber?;
27
+ /**
28
+ * In-memory cache for load() results, keyed by session ID. The cache is
29
+ * invalidated when the file's mtimeMs or size changes (indicating the
30
+ * file was written to). This eliminates redundant full-file reads and
31
+ * JSON parses when the same session is loaded multiple times within the
32
+ * store's lifetime (e.g., webui session detail views, list() fallbacks).
33
+ *
34
+ * Max size is capped to prevent unbounded memory growth in long-running
35
+ * processes. When the limit is reached, the oldest entry is evicted.
36
+ */
37
+ private readonly _loadCache;
38
+ private static readonly LOAD_CACHE_MAX_ENTRIES;
27
39
  constructor(opts: SessionStoreOptions);
40
+ /**
41
+ * Clear the load() cache. Useful for testing or when the caller knows
42
+ * the file has changed externally (e.g., another process wrote to it).
43
+ */
44
+ clearLoadCache(sessionId?: string): void;
28
45
  private emitRead;
29
46
  private emitWrite;
30
47
  private emitError;
@@ -608,7 +625,14 @@ interface PlanFile {
608
625
  items: PlanItem[];
609
626
  }
610
627
  declare function loadPlan(filePath: string, events?: EventBus): Promise<PlanFile | null>;
611
- declare function savePlan(filePath: string, plan: PlanFile, events?: EventBus): Promise<void>;
628
+ /**
629
+ * Persist a plan. Returns `true` on success, `false` if the write failed
630
+ * (still emits `storage.error` + warns — it does NOT throw, so callers that
631
+ * treat a lost plan-save as non-fatal keep working). `mutatePlan` inspects the
632
+ * result and throws so the plan TOOL can report `ok:false` instead of falsely
633
+ * claiming the plan was persisted.
634
+ */
635
+ declare function savePlan(filePath: string, plan: PlanFile, events?: EventBus): Promise<boolean>;
612
636
  /** Create a new PlanFile when none exists on disk. */
613
637
  declare function emptyPlan(sessionId: string, title?: string): PlanFile;
614
638
  declare function addPlanItem(plan: PlanFile, title: string, details?: string | undefined): {
@@ -0,0 +1,107 @@
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-dT5Ueund.js';
3
+ import { M as MessageSelector, S as SelectorResult } from './selector-Bc7eWtT3.js';
4
+ import { e as ModelsDevModel, R as ResolvedProvider } from './config-Du3pYYln.js';
5
+
6
+ declare class DefaultModeStore implements ModeStore {
7
+ private activeModeId;
8
+ private modes;
9
+ private configDir;
10
+ constructor(config: ModeConfig);
11
+ getActiveMode(): Promise<Mode | null>;
12
+ setActiveMode(modeId: string | null): Promise<void>;
13
+ listModes(): Promise<Mode[]>;
14
+ getMode(modeId: string): Promise<Mode | null>;
15
+ addMode(mode: Mode): Promise<void>;
16
+ removeMode(modeId: string): Promise<void>;
17
+ private loadActiveMode;
18
+ private saveActiveMode;
19
+ }
20
+ interface ModeLoaderOptions {
21
+ projectModesDir?: string | undefined;
22
+ userModesDir?: string | undefined;
23
+ }
24
+ declare function loadProjectModes(modesDir: string): Promise<Mode[]>;
25
+ declare function loadUserModes(modesDir: string): Promise<Mode[]>;
26
+
27
+ interface LLMSelectorOptions {
28
+ /** Provider used for the selector LLM call. Required. */
29
+ provider: Provider;
30
+ /** Model for the selector. Defaults to the provider's default model. */
31
+ model?: string | undefined;
32
+ /**
33
+ * Maximum tokens to keep in context (target budget).
34
+ * Selector will aim to keep total content below this.
35
+ */
36
+ maxContextTokens?: number | undefined;
37
+ /**
38
+ * Prompt instructing the selector how to behave.
39
+ * Should guide the LLM on importance tiers and output format.
40
+ */
41
+ systemPrompt?: string | undefined;
42
+ /**
43
+ * Maximum output tokens for the selector LLM call.
44
+ * Controls both the JSON response budget and the token reservation for the
45
+ * history text budget calculation (default: 1024).
46
+ */
47
+ maxOutputTokens?: number | undefined;
48
+ }
49
+ /**
50
+ * LLM-powered message selector. Calls a sub-LLM to analyze the
51
+ * message history and produce a keep/collapse plan — more surgical
52
+ * than fixed-window rules.
53
+ */
54
+ declare class LLMSelector implements MessageSelector {
55
+ private readonly provider;
56
+ private readonly model;
57
+ private readonly maxContextTokens;
58
+ private readonly systemPrompt;
59
+ private readonly maxOutputTokens;
60
+ constructor(opts: LLMSelectorOptions);
61
+ select(messages: Message[], maxToKeep: number): Promise<SelectorResult>;
62
+ private fallbackSelect;
63
+ /**
64
+ * Parse and validate the raw LLM output into a SelectorResult.
65
+ * Falls back to recency-based selection if the LLM output is malformed,
66
+ * out-of-bounds, or internally inconsistent.
67
+ */
68
+ private parseSelectorOutput;
69
+ }
70
+
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-O1IdKPaK.js';
1
+ import { E as EventBus } from './brain-Cdg77tVN.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-BGSpZNSE.js';
5
- import { R as RetryPolicy } from './retry-policy-CFhdtRzz.js';
4
+ import { P as Provider, R as Request, C as Context, b as Response } from './context-dT5Ueund.js';
5
+ import { R as RetryPolicy } from './retry-policy-BilV1ujH.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-BGSpZNSE.js';
1
+ import { C as Context, b as Response, e as ProviderError } from './context-dT5Ueund.js';
2
2
 
3
3
  type RecoveryDecision = {
4
4
  /**
@@ -1,15 +1,15 @@
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-O1IdKPaK.js';
4
- import { D as DoneCondition, g as Agent, h as AgentFactory, f as TaskResult } from '../agent-subagent-runner-c9DLkaas.js';
5
- import '../context-BGSpZNSE.js';
6
- import '../index-CbLSI66_.js';
3
+ import { E as EventBus } from '../brain-Cdg77tVN.js';
4
+ import { D as DoneCondition, g as Agent, h as AgentFactory, f as TaskResult } from '../agent-subagent-runner-CzPGP3jA.js';
5
+ import '../context-dT5Ueund.js';
6
+ import '../index-Bms0m4oy.js';
7
7
  import '../logger-B63L5bTg.js';
8
- import '../pipeline-CXCeMz8J.js';
9
- import '../config-Dz2F3H2K.js';
8
+ import '../pipeline-BfD2k1rT.js';
9
+ import '../config-Du3pYYln.js';
10
10
  import '../observability-D-HZN_mF.js';
11
- import '../permission-4yvGmMRB.js';
12
- import '../retry-policy-CFhdtRzz.js';
11
+ import '../permission-B75JAi3-.js';
12
+ import '../retry-policy-BilV1ujH.js';
13
13
 
14
14
  declare class SpecParser {
15
15
  parse(content: string): Specification;