@wrongstack/core 0.265.1 → 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 (69) hide show
  1. package/dist/{agent-bridge-DrkBxszZ.d.ts → agent-bridge-STJ3JwwK.d.ts} +1 -1
  2. package/dist/{agent-subagent-runner-DM2pP-B6.d.ts → agent-subagent-runner-CzPGP3jA.d.ts} +25 -7
  3. package/dist/{brain-BXd_61kQ.d.ts → brain-Cdg77tVN.d.ts} +73 -1
  4. package/dist/{compactor-B8pOf45Y.d.ts → compactor-iMZ84CXq.d.ts} +19 -1
  5. package/dist/{config-BMCj_XDs.d.ts → config-Du3pYYln.d.ts} +54 -3
  6. package/dist/{context-MRk5PhNv.d.ts → context-dT5Ueund.d.ts} +65 -1
  7. package/dist/coordination/index.d.ts +17 -17
  8. package/dist/coordination/index.js +138 -114
  9. package/dist/coordination/index.js.map +1 -1
  10. package/dist/defaults/index.d.ts +25 -25
  11. package/dist/defaults/index.js +1729 -781
  12. package/dist/defaults/index.js.map +1 -1
  13. package/dist/execution/index.d.ts +15 -15
  14. package/dist/execution/index.js +1119 -229
  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 +6 -6
  18. package/dist/{goal-preamble-DvHDSKSe.d.ts → goal-preamble-SulMTowG.d.ts} +28 -11
  19. package/dist/{goal-store-DtLMySNb.d.ts → goal-store-CABDwdFE.d.ts} +1 -1
  20. package/dist/{index-CEDeNodM.d.ts → index-Bms0m4oy.d.ts} +5 -5
  21. package/dist/{index-B-ch8K9C.d.ts → index-DtCVWel4.d.ts} +8 -8
  22. package/dist/index-IEuxQd-E.d.ts +82 -0
  23. package/dist/index.d.ts +118 -45
  24. package/dist/index.js +3083 -1602
  25. package/dist/index.js.map +1 -1
  26. package/dist/infrastructure/index.d.ts +6 -6
  27. package/dist/infrastructure/index.js +72 -1
  28. package/dist/infrastructure/index.js.map +1 -1
  29. package/dist/kernel/index.d.ts +9 -9
  30. package/dist/kernel/index.js.map +1 -1
  31. package/dist/{mcp-servers-2x4w6Jn9.d.ts → mcp-servers-C2cBTxUR.d.ts} +3 -3
  32. package/dist/models/index.d.ts +5 -5
  33. package/dist/models/index.js +30 -1
  34. package/dist/models/index.js.map +1 -1
  35. package/dist/{models-registry-DmJlKuNp.d.ts → models-registry-BqGZNJQ-.d.ts} +1 -1
  36. package/dist/{multi-agent-coordinator-DyCkCZnU.d.ts → multi-agent-coordinator-B8R43uPz.d.ts} +1 -1
  37. package/dist/{null-fleet-bus-CG9QY2aP.d.ts → null-fleet-bus-CnXa5oTH.d.ts} +14 -9
  38. package/dist/observability/index.d.ts +2 -2
  39. package/dist/{parallel-eternal-engine-Jw9uhEoT.d.ts → parallel-eternal-engine-DdNnw9BQ.d.ts} +11 -9
  40. package/dist/{path-resolver-Dy2ej-gE.d.ts → path-resolver-COIMLCQL.d.ts} +3 -3
  41. package/dist/{permission-B9SB45lp.d.ts → permission-B75JAi3-.d.ts} +1 -1
  42. package/dist/{permission-policy-CkjSXabK.d.ts → permission-policy-DlR9eJAM.d.ts} +2 -2
  43. package/dist/{pipeline-DPDxH_7m.d.ts → pipeline-BfD2k1rT.d.ts} +2 -2
  44. package/dist/{plan-templates-CzD9GnAU.d.ts → plan-templates-DSIKCXZN.d.ts} +5 -5
  45. package/dist/{llm-selector-C0tfTCUe.d.ts → provider-model-resolve-BNRsNuJx.d.ts} +40 -3
  46. package/dist/{provider-runner-DMa70ODu.d.ts → provider-runner-CX7iIvox.d.ts} +3 -3
  47. package/dist/{retry-policy-CN0khdlj.d.ts → retry-policy-BilV1ujH.d.ts} +1 -1
  48. package/dist/sdd/index.d.ts +8 -8
  49. package/dist/sdd/index.js +12 -12
  50. package/dist/sdd/index.js.map +1 -1
  51. package/dist/{secret-vault-B2yw84VT.d.ts → secret-vault-gkvEZZfE.d.ts} +2 -2
  52. package/dist/security/index.d.ts +5 -67
  53. package/dist/security/index.js +96 -76
  54. package/dist/security/index.js.map +1 -1
  55. package/dist/{selector-CzHh_igB.d.ts → selector-Bc7eWtT3.d.ts} +1 -1
  56. package/dist/{session-event-bridge-BUI6Jf-4.d.ts → session-event-bridge-D-araDEz.d.ts} +1 -1
  57. package/dist/{session-reader-CMgdMSRP.d.ts → session-reader-D7Dapswh.d.ts} +1 -1
  58. package/dist/storage/index.d.ts +11 -11
  59. package/dist/storage/index.js +81 -84
  60. package/dist/storage/index.js.map +1 -1
  61. package/dist/tools/index.d.ts +4 -2
  62. package/dist/tools/index.js.map +1 -1
  63. package/dist/types/index.d.ts +19 -19
  64. package/dist/types/index.js +1265 -400
  65. package/dist/types/index.js.map +1 -1
  66. package/dist/utils/index.d.ts +454 -406
  67. package/dist/utils/index.js +2191 -1201
  68. package/dist/utils/index.js.map +1 -1
  69. package/package.json +1 -1
@@ -1,4 +1,4 @@
1
- import { B as BridgeTransport, a as BridgeMessage, A as AgentBridge, b as AgentBridgeConfig } from './agent-subagent-runner-DM2pP-B6.js';
1
+ import { B as BridgeTransport, a as BridgeMessage, A as AgentBridge, b as AgentBridgeConfig } from './agent-subagent-runner-CzPGP3jA.js';
2
2
 
3
3
  /**
4
4
  * In-memory pub/sub transport for agent-to-agent messaging.
@@ -1,12 +1,12 @@
1
- import { c as ToolCallPipelinePayload, d as ToolWrapper, E as ExtensionRegistry, S as SystemPromptContributor, e as ToolRegistry, P as ProviderRegistry, A as AgentPipelines, f as ToolExecutorLike, g as AgentInit, h as AgentInput, R as RunResult } from './index-CEDeNodM.js';
2
- import { C as Container, R as ReadonlyPipeline, a as Renderer } from './pipeline-DPDxH_7m.js';
3
- import { E as EventBus, a as EventName, L as Listener } from './brain-BXd_61kQ.js';
4
- import { R as RetryPolicy, E as ErrorHandler } from './retry-policy-CN0khdlj.js';
1
+ import { c as ToolCallPipelinePayload, d as ToolWrapper, E as ExtensionRegistry, S as SystemPromptContributor, e as ToolRegistry, P as ProviderRegistry, A as AgentPipelines, f as ToolExecutorLike, g as AgentInit, h as AgentInput, R as RunResult } from './index-Bms0m4oy.js';
2
+ import { C as Container, R as ReadonlyPipeline, a as Renderer } from './pipeline-BfD2k1rT.js';
3
+ import { E as EventBus, a as EventName, L as Listener } from './brain-Cdg77tVN.js';
4
+ import { R as RetryPolicy, E as ErrorHandler } from './retry-policy-BilV1ujH.js';
5
5
  import { L as Logger } from './logger-B63L5bTg.js';
6
6
  import { T as Tracer } from './observability-D-HZN_mF.js';
7
- import { P as PermissionPolicy } from './permission-B9SB45lp.js';
8
- import { U as Usage, C as Context, J as JSONSchema, R as Request, b as Response, g as ContentBlock, n as TextBlock, T as Tool, P as Provider, o as RunOptions } from './context-MRk5PhNv.js';
9
- import { W as WireFamily, H as HookEvent, e as HookMatcher, I as InProcessHook, h as Config } from './config-BMCj_XDs.js';
7
+ import { P as PermissionPolicy } from './permission-B75JAi3-.js';
8
+ import { U as Usage, C as Context, J as JSONSchema, R as Request, b as Response, g as ContentBlock, o as TextBlock, T as Tool, P as Provider, p as RunOptions } from './context-dT5Ueund.js';
9
+ import { W as WireFamily, H as HookEvent, f as HookMatcher, I as InProcessHook, i as Config } from './config-Du3pYYln.js';
10
10
 
11
11
  /**
12
12
  * Single fleet-wide event with subagent attribution. Whatever a child
@@ -510,6 +510,17 @@ interface SubagentConfig {
510
510
  * fully enforce (e.g., preventing delegation by removing the delegate tool).
511
511
  */
512
512
  disabledTools?: string[] | undefined;
513
+ /**
514
+ * Capability allowlist for this subagent's `AutoApprovePermissionPolicy`.
515
+ * Subagents run non-interactively, so the policy auto-approves only tools
516
+ * whose declared capabilities intersect this list; everything else is
517
+ * denied by the subagent guard. Defaults (when omitted) to the read-only
518
+ * safe set `['fs.read', 'net.outbound']`. Widen it per-spawn when a task
519
+ * legitimately needs more — e.g. `/techstack` adds `'fs.write'` so the
520
+ * subagent can write its report. Never grant `shell.*` unless the task
521
+ * truly requires arbitrary command execution.
522
+ */
523
+ allowedCapabilities?: readonly string[] | undefined;
513
524
  model?: string | undefined;
514
525
  priority?: number | undefined;
515
526
  /**
@@ -819,6 +830,13 @@ interface SlashCommand {
819
830
  * If absent, `/help <name>` falls back to `description`.
820
831
  */
821
832
  help?: string | undefined;
833
+ /**
834
+ * When true, this command does not appear in the slash-picker list
835
+ * triggered by typing `/` alone. It is still dispatchable and
836
+ * searchable when the user types a matching prefix (e.g. `/f`).
837
+ * Defaults to false.
838
+ */
839
+ hidden?: boolean | undefined;
822
840
  /**
823
841
  * Execute the command.
824
842
  * @param args Everything after the command name (trimmed by dispatch).
@@ -1,4 +1,4 @@
1
- import { U as Usage, C as Context, j as ToolProgressEvent, T as Tool } from './context-MRk5PhNv.js';
1
+ import { U as Usage, C as Context, j as ToolProgressEvent, T as Tool, k as ToolOutputMetadata } from './context-dT5Ueund.js';
2
2
 
3
3
  type MemoryScope = 'project-agents' | 'project-memory' | 'user-memory';
4
4
  type MemoryType = 'fact' | 'decision' | 'convention' | 'preference' | 'reference' | 'anti_pattern';
@@ -287,6 +287,43 @@ interface EventMap {
287
287
  pattern: string;
288
288
  decision: 'always' | 'deny';
289
289
  };
290
+ /**
291
+ * Fired when the agent loop detects that the model is repeating the same
292
+ * response shape over and over — a tight loop that would otherwise burn
293
+ * iterations indefinitely. The loop breaks with status `max_iterations`
294
+ * after `repeatCount` consecutive identical iterations.
295
+ *
296
+ * Two flavours caught by the same safety valve:
297
+ * - `kind: 'tool'` — the same tool(s) called with effectively the same
298
+ * inputs (catches k2p7's tendency to retry identical tool calls when
299
+ * a tool returns an unexpected empty result).
300
+ * - `kind: 'message'` — the same assistant text repeated, with no tool
301
+ * calls. K2P7 and other weak-instruction-following models can echo
302
+ * their last assistant turn verbatim across many iterations in
303
+ * autonomous-continue mode. The fingerprint also matches this case
304
+ * so the safety valve catches it too.
305
+ * - `kind: 'mixed'` — both: the response contains tool calls AND text,
306
+ * and the combined fingerprint (tool names + text) repeats.
307
+ *
308
+ * UIs can render a warning chip. The `kind` field is additive — older
309
+ * subscribers that only read `tools` continue to work.
310
+ */
311
+ 'tool.loop_detected': {
312
+ ctx: Context;
313
+ /** Comma-separated tool names involved in the loop, or empty string for pure message loops. */
314
+ tools: string;
315
+ /** Number of consecutive identical iterations detected. */
316
+ repeatCount: number;
317
+ /** 0-based iteration index where the loop was detected. */
318
+ iteration: number;
319
+ /**
320
+ * Shape of the loop. `tool` = identical tool calls; `message` = identical
321
+ * text-only response; `mixed` = both tool calls and text repeated.
322
+ * Defaults to `tool` for backward compatibility with subscribers that
323
+ * pre-date the field.
324
+ */
325
+ kind?: 'tool' | 'message' | 'mixed' | undefined;
326
+ };
290
327
  /**
291
328
  * `output` is a truncated preview of the tool's serialized result text
292
329
  * (capped at ~400 chars by the emitter). UIs render this inline in the
@@ -326,6 +363,13 @@ interface EventMap {
326
363
  * actual lines the model received and forwards it here. Undefined
327
364
  * for tools without a meaningful line count. */
328
365
  outputLines?: number | undefined;
366
+ /**
367
+ * Parsed context-management metadata for the result the model saw. This is
368
+ * intentionally compact: file/symbol/error/path-integrity hints, not the
369
+ * full output body. Compaction uses it to distinguish seen information from
370
+ * information later referenced by the assistant.
371
+ */
372
+ metadata?: ToolOutputMetadata | undefined;
329
373
  };
330
374
  /**
331
375
  * Fired by the `delegate` tool right before it hands work to a subagent
@@ -453,6 +497,21 @@ interface EventMap {
453
497
  load: number;
454
498
  /** Provider's max context window in tokens. */
455
499
  maxContext: number;
500
+ /** Budget snapshot used for the compaction decision. */
501
+ budget?: {
502
+ maxContext: number;
503
+ inputTokens: number;
504
+ availableInputTokens: number;
505
+ remainingInputTokens: number;
506
+ reservedOutputTokens: number;
507
+ reservedSafetyTokens: number;
508
+ load: number;
509
+ overflowTokens: number;
510
+ } | undefined;
511
+ /** Adaptive trigger signals observed alongside token pressure. */
512
+ signals?: {
513
+ repeatedReadCount?: number | undefined;
514
+ } | undefined;
456
515
  /** Full compaction report from the compactor. */
457
516
  report: {
458
517
  before: number;
@@ -478,6 +537,19 @@ interface EventMap {
478
537
  level: 'warn' | 'soft' | 'hard';
479
538
  tokens: number;
480
539
  maxContext: number;
540
+ budget?: {
541
+ maxContext: number;
542
+ inputTokens: number;
543
+ availableInputTokens: number;
544
+ remainingInputTokens: number;
545
+ reservedOutputTokens: number;
546
+ reservedSafetyTokens: number;
547
+ load: number;
548
+ overflowTokens: number;
549
+ } | undefined;
550
+ signals?: {
551
+ repeatedReadCount?: number | undefined;
552
+ } | undefined;
481
553
  load: number;
482
554
  fatal: boolean;
483
555
  };
@@ -1,4 +1,4 @@
1
- import { C as Context } from './context-MRk5PhNv.js';
1
+ import { C as Context } from './context-dT5Ueund.js';
2
2
 
3
3
  interface CompactRepairReport {
4
4
  removedToolUses: string[];
@@ -39,6 +39,24 @@ interface CompactReport {
39
39
  * session log). Undefined when no range was collapsed this pass.
40
40
  */
41
41
  collapsedDigest?: string | undefined;
42
+ /**
43
+ * Compact state digest derived from tool-output instrumentation. It carries
44
+ * intent, path integrity, referenced tool results, active errors and implicit
45
+ * facts without copying full tool outputs back into the context window.
46
+ */
47
+ evidenceDigest?: string | undefined;
48
+ /**
49
+ * Deterministic post-compaction sanity check. This is deliberately local and
50
+ * cheap; LLM self-verification can be layered on top, but the compactor still
51
+ * records whether the compacted context retained an intent anchor and path
52
+ * trail.
53
+ */
54
+ quality?: {
55
+ ok: boolean;
56
+ hasIntent: boolean;
57
+ hasPathTrail: boolean;
58
+ issues: string[];
59
+ } | undefined;
42
60
  }
43
61
  interface Compactor {
44
62
  compact(ctx: Context, opts?: {
@@ -1,4 +1,4 @@
1
- import { k as Capabilities, f as Permission } from './context-MRk5PhNv.js';
1
+ import { l as Capabilities, f as Permission } from './context-dT5Ueund.js';
2
2
 
3
3
  type ContextWindowModeId = 'balanced' | 'frugal' | 'deep' | 'archival';
4
4
  type ContextWindowAggressiveOn = 'hard' | 'soft' | 'warn';
@@ -181,7 +181,7 @@ type ModelsDevPayload = Record<string, ModelsDevProvider>;
181
181
  * Canonical wire-format families WrongStack knows how to speak natively.
182
182
  * Used by the provider registry to pick a transport.
183
183
  */
184
- type WireFamily = 'anthropic' | 'openai' | 'openai-compatible' | 'google' | 'unsupported';
184
+ type WireFamily = 'anthropic' | 'anthropic-oauth' | 'openai' | 'openai-compatible' | 'openai-codex' | 'github-copilot' | 'google' | 'unsupported';
185
185
  interface ResolvedProvider {
186
186
  id: string;
187
187
  name: string;
@@ -325,6 +325,32 @@ interface ProviderApiKey {
325
325
  apiKey: string;
326
326
  /** ISO-8601 timestamp the key was added. */
327
327
  createdAt: string;
328
+ /**
329
+ * How this credential was obtained.
330
+ * - `api_key` — manually pasted API key (default)
331
+ * - `oauth` — OAuth 2.0 device-code / authorization-code flow
332
+ * - `session_token` — extracted from browser session (ChatGPT web, etc.)
333
+ */
334
+ authMethod?: 'api_key' | 'oauth' | 'session_token' | undefined;
335
+ /** ISO-8601 expiry. When set, the token manager will refresh before this time. */
336
+ expiresAt?: string | undefined;
337
+ /**
338
+ * OAuth refresh token. Stored encrypted by the secret-vault walker because
339
+ * the field name contains `Token` (case-insensitive match by vault).
340
+ */
341
+ refreshToken?: string | undefined;
342
+ /** Token type as returned by the OAuth endpoint (e.g. "bearer"). */
343
+ tokenType?: string | undefined;
344
+ /** OAuth scope string (e.g. "openai.models.read openai.models.use"). */
345
+ scope?: string | undefined;
346
+ /**
347
+ * ChatGPT account id, extracted from the OAuth access-token JWT
348
+ * (`https://api.openai.com/auth`.chatgpt_account_id). Sent as the
349
+ * `chatgpt-account-id` header by the `openai-codex` wire family. Cached
350
+ * here for display/diagnostics; the provider re-derives it from the live
351
+ * token at request time so it can never go stale after a refresh.
352
+ */
353
+ accountId?: string | undefined;
328
354
  }
329
355
  interface ProviderConfig {
330
356
  type: string;
@@ -362,6 +388,23 @@ interface ProviderConfig {
362
388
  * capability overrides. The model id is the key, not a fully qualified id.
363
389
  */
364
390
  customModels?: Record<string, CustomModelDefinition>;
391
+ /**
392
+ * Per-provider OAuth configuration. When present, `wstack auth login <id>`
393
+ * uses this instead of prompting for a raw API key. Set by the catalog or
394
+ * by the user via `/settings`.
395
+ */
396
+ oauthConfig?: {
397
+ /** OAuth client id registered with the provider. */
398
+ clientId?: string | undefined;
399
+ /** Device authorization endpoint (RFC 8628). */
400
+ deviceCodeEndpoint?: string | undefined;
401
+ /** Token endpoint for code exchange and refresh. */
402
+ tokenEndpoint?: string | undefined;
403
+ /** Authorization server URL shown to the user for opening in browser. */
404
+ authorizationEndpoint?: string | undefined;
405
+ /** Default OAuth scopes to request. */
406
+ scopes?: string[] | undefined;
407
+ } | undefined;
365
408
  }
366
409
  /**
367
410
  * One entry in the per-task model matrix. Pins a catalog role, a phase, or
@@ -391,6 +434,14 @@ interface MCPServerConfig {
391
434
  permission?: Permission | undefined;
392
435
  startupTimeoutMs?: number | undefined;
393
436
  requestTimeoutMs?: number | undefined;
437
+ /**
438
+ * Lazy connect: when true, the server process is NOT spawned at boot. Its
439
+ * tools are registered from a cached manifest (discovered on the first ever
440
+ * connect) and the server only spawns when one of its tools is actually
441
+ * called, then auto-sleeps after an idle period. Default (false/undefined) =
442
+ * eager connect at boot.
443
+ */
444
+ lazy?: boolean | undefined;
394
445
  }
395
446
  interface LogConfig {
396
447
  level: 'error' | 'warn' | 'info' | 'debug' | 'trace';
@@ -699,4 +750,4 @@ interface ConfigStore {
699
750
  watch(cb: (next: Readonly<Config>, prev: Readonly<Config>) => void): () => void;
700
751
  }
701
752
 
702
- export { type AutonomyConfig as A, type ProviderApiKey as B, type ContextWindowAggressiveOn as C, DEFAULT_CONTEXT_WINDOW_MODE_ID as D, type SessionLoggingConfig as E, type FeaturesConfig as F, type SyncCategory as G, type HookEvent as H, type InProcessHook as I, type ToolsConfig as J, formatContextWindowModeList as K, type LaunchConfig as L, type ModelsRegistry as M, getContextWindowMode as N, isContextWindowModeId as O, type ProviderConfig as P, listContextWindowModes as Q, type ResolvedProvider as R, type ShellHook as S, type TokenSavingTier as T, normalizeTokenSavingTier as U, resolveContextWindowPolicy as V, type WireFamily as W, type ModelsDevPayload as a, type ResolvedModel as b, type MCPServerConfig as c, type ModelMatrixEntry as d, type HookMatcher as e, type HookEntry as f, type ContextWindowPolicy as g, type Config as h, type ConfigStore as i, type ConfigLoader as j, type SyncConfig as k, type HookInput as l, type HookOutcome as m, CONTEXT_WINDOW_MODES as n, type CircuitBreakerRuntimeConfig as o, type ContextConfig as p, type ContextWindowConfigLike as q, type ContextWindowMode as r, type ContextWindowModeId as s, type ContextWindowThresholds as t, type CustomModelDefinition as u, type IndexingConfig as v, type LogConfig as w, type ModelsDevModel as x, type ModelsDevProvider as y, type PluginConfig as z };
753
+ export { type AutonomyConfig as A, type ProviderApiKey as B, type ContextWindowAggressiveOn as C, DEFAULT_CONTEXT_WINDOW_MODE_ID as D, type SessionLoggingConfig as E, type FeaturesConfig as F, type SyncCategory as G, type HookEvent as H, type InProcessHook as I, type ToolsConfig as J, formatContextWindowModeList as K, type LaunchConfig as L, type ModelsRegistry as M, getContextWindowMode as N, isContextWindowModeId as O, type ProviderConfig as P, listContextWindowModes as Q, type ResolvedProvider as R, type ShellHook as S, type TokenSavingTier as T, normalizeTokenSavingTier as U, resolveContextWindowPolicy as V, type WireFamily as W, type ModelsDevPayload as a, type ResolvedModel as b, type MCPServerConfig as c, type ModelMatrixEntry as d, type ModelsDevModel as e, type HookMatcher as f, type HookEntry as g, type ContextWindowPolicy as h, type Config as i, type ConfigStore as j, type ConfigLoader as k, type SyncConfig as l, type HookInput as m, type HookOutcome as n, CONTEXT_WINDOW_MODES as o, type CircuitBreakerRuntimeConfig as p, type ContextConfig as q, type ContextWindowConfigLike as r, type ContextWindowMode as s, type ContextWindowModeId as t, type ContextWindowThresholds as u, type CustomModelDefinition as v, type IndexingConfig as w, type LogConfig as x, type ModelsDevProvider as y, type PluginConfig as z };
@@ -775,6 +775,21 @@ type SessionEvent = {
775
775
  phase: string;
776
776
  saved: number;
777
777
  }>;
778
+ /** Context budget snapshot used to trigger this compaction. */
779
+ budget?: {
780
+ maxContext: number;
781
+ inputTokens: number;
782
+ availableInputTokens: number;
783
+ remainingInputTokens: number;
784
+ reservedOutputTokens: number;
785
+ reservedSafetyTokens: number;
786
+ load: number;
787
+ overflowTokens: number;
788
+ } | undefined;
789
+ /** Adaptive trigger signals observed alongside token pressure. */
790
+ signals?: {
791
+ repeatedReadCount?: number | undefined;
792
+ } | undefined;
778
793
  /**
779
794
  * Lossless digest of the range collapsed during this compaction (text
780
795
  * content preserved; raw tool I/O omitted). Captures *what* was collapsed
@@ -1115,6 +1130,54 @@ interface SessionWriter {
1115
1130
  clearInFlightMarker(reason: 'clean' | 'aborted' | 'recovered'): Promise<void>;
1116
1131
  }
1117
1132
 
1133
+ type ToolEvidenceStatus = 'seen' | 'referenced';
1134
+ interface ToolOutputMetadata {
1135
+ toolUseId: string;
1136
+ toolName: string;
1137
+ ok: boolean;
1138
+ inputSummary?: string | undefined;
1139
+ summary: string;
1140
+ files: string[];
1141
+ symbols: string[];
1142
+ commands: string[];
1143
+ errors: string[];
1144
+ status: ToolEvidenceStatus;
1145
+ referenceCount: number;
1146
+ seenAt: number;
1147
+ referencedAt?: number | undefined;
1148
+ outputBytes?: number | undefined;
1149
+ outputTokens?: number | undefined;
1150
+ outputLines?: number | undefined;
1151
+ }
1152
+ interface ContextFileEvidence {
1153
+ path: string;
1154
+ reads: number;
1155
+ writes: number;
1156
+ tools: string[];
1157
+ referenced: boolean;
1158
+ lastToolUseId?: string | undefined;
1159
+ }
1160
+ interface ContextIntentEvidence {
1161
+ text: string;
1162
+ updatedAt: number;
1163
+ }
1164
+ interface ContextRepeatedReadEvidence {
1165
+ file: string;
1166
+ count: number;
1167
+ lastToolUseId: string;
1168
+ }
1169
+ interface ContextEvidenceState {
1170
+ currentIntent?: ContextIntentEvidence | undefined;
1171
+ sessionGoals: string[];
1172
+ implicitFacts: string[];
1173
+ activeErrors: string[];
1174
+ toolCalls: ToolOutputMetadata[];
1175
+ fileGraph: Record<string, ContextFileEvidence>;
1176
+ repeatedReads: ContextRepeatedReadEvidence[];
1177
+ lastReadPath?: string | undefined;
1178
+ updatedAt: number;
1179
+ }
1180
+
1118
1181
  interface CacheStats {
1119
1182
  /** Tokens served from cache (cheaper). */
1120
1183
  readTokens: number;
@@ -1340,6 +1403,7 @@ declare class Context implements RunEnv {
1340
1403
  todos: TodoItem[];
1341
1404
  readFiles: Set<string>;
1342
1405
  fileMtimes: Map<string, number>;
1406
+ contextEvidence: ContextEvidenceState;
1343
1407
  systemPrompt: TextBlock[];
1344
1408
  provider: Provider;
1345
1409
  session: SessionWriter;
@@ -1439,4 +1503,4 @@ declare class Context implements RunEnv {
1439
1503
  usage(): Usage;
1440
1504
  }
1441
1505
 
1442
- export { ToolError as $, AgentError as A, type MessageRole as B, Context as C, PluginError as D, ERROR_CODES as E, type FileSnapshot as F, type ProviderErrorBody as G, type ReadonlyConversationState as H, type ImageBlock as I, type JSONSchema as J, type RiskTier as K, type RunEnv as L, type Message as M, SddError as N, SessionError as O, type Provider as P, type StateChange as Q, type Request as R, type SessionEvent as S, type Tool as T, type Usage as U, type StateChangeHandler as V, type StopReason as W, type StreamEvent as X, StreamHangError as Y, type ThinkingBlock as Z, type ToolCallContext as _, type SessionWriter as a, type ToolFinalEvent as a0, type ToolIconId as a1, type ToolStreamEvent as a2, WrongStackError as a3, asBlocks as a4, asText as a5, extractRunEnv as a6, isAgentError as a7, isConfigError as a8, isFsError as a9, isImageBlock as aa, isPluginError as ab, isSddError as ac, isSessionError as ad, isTextBlock as ae, isThinkingBlock as af, isToolError as ag, isToolResultBlock as ah, isToolUseBlock as ai, isWrongStackError as aj, toWrongStackError as ak, wrapAsState as al, type Response as b, type TokenCounter as c, type CacheStats as d, ProviderError as e, type Permission as f, type ContentBlock as g, type SessionMetadata as h, type SessionStore as i, type ToolProgressEvent as j, type Capabilities as k, type ToolUseBlock as l, type ToolResultBlock as m, type TextBlock as n, type RunOptions as o, type ResumedSession as p, type SessionData as q, type SessionSummary as r, type TodoItem as s, ConversationState as t, ConfigError as u, type ContextInit as v, type ErrorCode as w, type ErrorSeverity as x, type ErrorSubsystem as y, FsError as z };
1506
+ export { type StopReason as $, AgentError as A, type ContextRepeatedReadEvidence as B, Context as C, type ErrorCode as D, ERROR_CODES as E, type ErrorSeverity as F, type ErrorSubsystem as G, type FileSnapshot as H, FsError as I, type JSONSchema as J, type ImageBlock as K, type MessageRole as L, type Message as M, PluginError as N, type ProviderErrorBody as O, type Provider as P, type ReadonlyConversationState as Q, type Request as R, type SessionEvent as S, type Tool as T, type Usage as U, type RiskTier as V, type RunEnv as W, SddError as X, SessionError as Y, type StateChange as Z, type StateChangeHandler as _, type SessionWriter as a, type StreamEvent as a0, StreamHangError as a1, type ThinkingBlock as a2, type ToolCallContext as a3, ToolError as a4, type ToolEvidenceStatus as a5, type ToolFinalEvent as a6, type ToolIconId as a7, type ToolStreamEvent as a8, WrongStackError as a9, asBlocks as aa, asText as ab, extractRunEnv as ac, isAgentError as ad, isConfigError as ae, isFsError as af, isImageBlock as ag, isPluginError as ah, isSddError as ai, isSessionError as aj, isTextBlock as ak, isThinkingBlock as al, isToolError as am, isToolResultBlock as an, isToolUseBlock as ao, isWrongStackError as ap, toWrongStackError as aq, wrapAsState as ar, type Response as b, type TokenCounter as c, type CacheStats as d, ProviderError as e, type Permission as f, type ContentBlock as g, type SessionMetadata as h, type SessionStore as i, type ToolProgressEvent as j, type ToolOutputMetadata as k, type Capabilities as l, type ToolUseBlock as m, type ToolResultBlock as n, type TextBlock as o, type RunOptions as p, type ResumedSession as q, type SessionData as r, type SessionSummary as s, type TodoItem as t, ConversationState as u, ConfigError as v, type ContextEvidenceState as w, type ContextFileEvidence as x, type ContextInit as y, type ContextIntentEvidence as z };
@@ -1,23 +1,23 @@
1
- import { E as EventBus, B as BrainArbiter, f as BrainDecisionOption, k as BrainRisk, h as BrainDecisionRequest, e as BrainDecision, i as BrainDecisionSource } from '../brain-BXd_61kQ.js';
2
- export { g as BrainDecisionQueue, j as BrainFallback, D as DefaultBrainArbiter, l as DefaultBrainArbiterOptions, H as HumanEscalatingBrainArbiter, O as ObservableBrainArbiter, w as formatHumanPrompt } from '../brain-BXd_61kQ.js';
3
- import { H as FleetManager, s as Director } from '../null-fleet-bus-CG9QY2aP.js';
4
- export { A as ACP_AGENTS, a as AGENTS_BY_PHASE, b as AGENT_CATALOG, c as ALL_AGENT_DEFINITIONS, d as ALL_FLEET_AGENTS, e as AUDIT_LOG_AGENT, f as AutoExtendCeiling, g as AutoExtendPolicy, B as BUG_HUNTER_AGENT, h as BugFinding, C as CollabBudgetConfig, i as CollabBudgetOverrides, j as CollabBudgetWarningPayload, k as CollabDebugReport, l as CollabSession, m as CollabSessionOptions, n as CreateDelegateToolOptions, o as CriticConcern, p as CriticEvaluation, D as DEFAULT_DIRECTOR_PREAMBLE, q as DEFAULT_SUBAGENT_BASELINE, r as DelegateHost, t as DirectorAlert, u as DirectorAlertLevel, v as DirectorCancelCollabPayload, w as DirectorPromptParts, x as DirectorSessionFactory, y as DirectorSessionFactoryOptions, F as FLEET_ROSTER, z as FLEET_ROSTER_BUDGETS, E as FLEET_ROSTER_WITHACP, G as FleetCostCapError, I as FleetManagerOptions, J as FleetRosterBudget, K as FleetSpawnBudgetError, L as ICoordinator, M as IFleetManager, N as LargeAnswerStore, O as NULL_FLEET_BUS, R as REFACTOR_PLANNER_AGENT, P as RefactorPhase, Q as RefactorPlan, S as SECURITY_SCANNER_AGENT, T as SharedFileEntry, U as SharedFileSnapshot, V as SubagentPromptParts, W as applyRosterBudget, X as attachAutoExtend, Y as composeDirectorPrompt, Z as composeSubagentPrompt, _ as createDelegateTool, $ as getAgentDefinition, a0 as makeAskResultTool, a1 as makeAskTool, a2 as makeAssignTool, a3 as makeAwaitTasksTool, a4 as makeCollabDebugTool, a5 as makeDirectorSessionFactory, a6 as makeFleetEmitTool, a7 as makeFleetHealthTool, a8 as makeFleetSessionTool, a9 as makeFleetStatusTool, aa as makeFleetUsageTool, ab as makeRollUpTool, ac as makeSpawnTool, ad as makeTerminateTool, ae as makeWorkCompleteTool, af as rosterSummaryFromConfigs } from '../null-fleet-bus-CG9QY2aP.js';
5
- import { b as AgentDefinition } from '../multi-agent-coordinator-DyCkCZnU.js';
6
- export { T as AGENT_TOOL_PRESETS, c as AgentBudgetTier, d as AgentCapability, A as AgentPhase, e as DEFAULT_DISPATCH_ROLE, a as DefaultMultiAgentCoordinator, f as DispatchCandidate, D as DispatchClassifier, g as DispatchMethod, h as DispatchOptions, i as DispatchResult, H as HEAVY_BUDGET, L as LIGHT_BUDGET, M as MEDIUM_BUDGET, j as MultiAgentCoordinatorOptions, k as dispatchAgent, m as makeLLMClassifier, s as scoreAgents } from '../multi-agent-coordinator-DyCkCZnU.js';
7
- import { F as FleetBus } from '../agent-subagent-runner-DM2pP-B6.js';
8
- export { h as AgentFactory, v as AgentFactoryResult, w as AgentRunnerOptions, x as BudgetExceededError, y as BudgetKind, z as BudgetLimits, E as BudgetNegotiationMode, G as BudgetThresholdDecision, H as BudgetThresholdHandler, I as BudgetThresholdSignal, J as BudgetUsage, L as DECISION_TIMEOUT_MS, N as FleetEvent, O as FleetHandler, i as FleetUsage, j as FleetUsageAggregator, Q as SubagentBudget, Y as SubagentUsageSnapshot, Z as TIMEOUT_PREEMPT_FRACTION, $ as makeAgentSubagentRunner, a0 as withDisabledToolFiltering } from '../agent-subagent-runner-DM2pP-B6.js';
9
- export { I as InMemoryAgentBridge, a as InMemoryBridgeTransport, c as createMessage } from '../agent-bridge-DrkBxszZ.js';
10
- import { c as Mailbox, k as MailboxSendInput, d as MailboxMessage, j as MailboxQuery, g as MailboxAckInput, s as MailboxAckBatchInput, h as MailboxAgentStatus, e as AgentRegistrationInput, A as AgentHeartbeatInput, t as PurgeOptions, u as PurgeResult, v as ClientRegistrationInput, w as ClientHeartbeatInput, x as ClientStatus } from '../pipeline-DPDxH_7m.js';
11
- export { i as MailboxMessageType, l as MailboxTaskContext, o as ReadReceipts, p as RegisteredAgent, r as normalizeRecipient } from '../pipeline-DPDxH_7m.js';
12
- import { C as Context, T as Tool } from '../context-MRk5PhNv.js';
1
+ import { E as EventBus, B as BrainArbiter, f as BrainDecisionOption, k as BrainRisk, h as BrainDecisionRequest, e as BrainDecision, i as BrainDecisionSource } from '../brain-Cdg77tVN.js';
2
+ export { g as BrainDecisionQueue, j as BrainFallback, D as DefaultBrainArbiter, l as DefaultBrainArbiterOptions, H as HumanEscalatingBrainArbiter, O as ObservableBrainArbiter, w as formatHumanPrompt } from '../brain-Cdg77tVN.js';
3
+ import { H as FleetManager, s as Director } from '../null-fleet-bus-CnXa5oTH.js';
4
+ export { A as ACP_AGENTS, a as AGENTS_BY_PHASE, b as AGENT_CATALOG, c as ALL_AGENT_DEFINITIONS, d as ALL_FLEET_AGENTS, e as AUDIT_LOG_AGENT, f as AutoExtendCeiling, g as AutoExtendPolicy, B as BUG_HUNTER_AGENT, h as BugFinding, C as CollabBudgetConfig, i as CollabBudgetOverrides, j as CollabBudgetWarningPayload, k as CollabDebugReport, l as CollabSession, m as CollabSessionOptions, n as CreateDelegateToolOptions, o as CriticConcern, p as CriticEvaluation, D as DEFAULT_DIRECTOR_PREAMBLE, q as DEFAULT_SUBAGENT_BASELINE, r as DelegateHost, t as DirectorAlert, u as DirectorAlertLevel, v as DirectorCancelCollabPayload, w as DirectorPromptParts, x as DirectorSessionFactory, y as DirectorSessionFactoryOptions, F as FLEET_ROSTER, z as FLEET_ROSTER_BUDGETS, E as FLEET_ROSTER_WITHACP, G as FleetCostCapError, I as FleetManagerOptions, J as FleetRosterBudget, K as FleetSpawnBudgetError, L as ICoordinator, M as IFleetManager, N as LargeAnswerStore, O as NULL_FLEET_BUS, R as REFACTOR_PLANNER_AGENT, P as RefactorPhase, Q as RefactorPlan, S as SECURITY_SCANNER_AGENT, T as SharedFileEntry, U as SharedFileSnapshot, V as SubagentPromptParts, W as applyRosterBudget, X as attachAutoExtend, Y as composeDirectorPrompt, Z as composeSubagentPrompt, _ as createDelegateTool, $ as getAgentDefinition, a0 as makeAskResultTool, a1 as makeAskTool, a2 as makeAssignTool, a3 as makeAwaitTasksTool, a4 as makeCollabDebugTool, a5 as makeDirectorSessionFactory, a6 as makeFleetEmitTool, a7 as makeFleetHealthTool, a8 as makeFleetSessionTool, a9 as makeFleetStatusTool, aa as makeFleetUsageTool, ab as makeRollUpTool, ac as makeSpawnTool, ad as makeTerminateTool, ae as makeWorkCompleteTool, af as rosterSummaryFromConfigs } from '../null-fleet-bus-CnXa5oTH.js';
5
+ import { b as AgentDefinition } from '../multi-agent-coordinator-B8R43uPz.js';
6
+ export { T as AGENT_TOOL_PRESETS, c as AgentBudgetTier, d as AgentCapability, A as AgentPhase, e as DEFAULT_DISPATCH_ROLE, a as DefaultMultiAgentCoordinator, f as DispatchCandidate, D as DispatchClassifier, g as DispatchMethod, h as DispatchOptions, i as DispatchResult, H as HEAVY_BUDGET, L as LIGHT_BUDGET, M as MEDIUM_BUDGET, j as MultiAgentCoordinatorOptions, k as dispatchAgent, m as makeLLMClassifier, s as scoreAgents } from '../multi-agent-coordinator-B8R43uPz.js';
7
+ import { F as FleetBus } from '../agent-subagent-runner-CzPGP3jA.js';
8
+ export { h as AgentFactory, v as AgentFactoryResult, w as AgentRunnerOptions, x as BudgetExceededError, y as BudgetKind, z as BudgetLimits, E as BudgetNegotiationMode, G as BudgetThresholdDecision, H as BudgetThresholdHandler, I as BudgetThresholdSignal, J as BudgetUsage, L as DECISION_TIMEOUT_MS, N as FleetEvent, O as FleetHandler, i as FleetUsage, j as FleetUsageAggregator, Q as SubagentBudget, Y as SubagentUsageSnapshot, Z as TIMEOUT_PREEMPT_FRACTION, $ as makeAgentSubagentRunner, a0 as withDisabledToolFiltering } from '../agent-subagent-runner-CzPGP3jA.js';
9
+ export { I as InMemoryAgentBridge, a as InMemoryBridgeTransport, c as createMessage } from '../agent-bridge-STJ3JwwK.js';
10
+ import { c as Mailbox, k as MailboxSendInput, d as MailboxMessage, j as MailboxQuery, g as MailboxAckInput, s as MailboxAckBatchInput, h as MailboxAgentStatus, e as AgentRegistrationInput, A as AgentHeartbeatInput, t as PurgeOptions, u as PurgeResult, v as ClientRegistrationInput, w as ClientHeartbeatInput, x as ClientStatus } from '../pipeline-BfD2k1rT.js';
11
+ export { i as MailboxMessageType, l as MailboxTaskContext, o as ReadReceipts, p as RegisteredAgent, r as normalizeRecipient } from '../pipeline-BfD2k1rT.js';
12
+ import { C as Context, T as Tool } from '../context-dT5Ueund.js';
13
13
  import 'node:events';
14
- import '../director-state-BfeCUbmk.js';
15
- import '../config-BMCj_XDs.js';
16
- import '../index-CEDeNodM.js';
17
14
  import '../logger-B63L5bTg.js';
15
+ import '../director-state-BfeCUbmk.js';
16
+ import '../config-Du3pYYln.js';
17
+ import '../index-Bms0m4oy.js';
18
18
  import '../observability-D-HZN_mF.js';
19
- import '../permission-B9SB45lp.js';
20
- import '../retry-policy-CN0khdlj.js';
19
+ import '../permission-B75JAi3-.js';
20
+ import '../retry-policy-BilV1ujH.js';
21
21
 
22
22
  /** Phase 1 · Discovery — map the territory before any work begins. */
23
23
  declare const DISCOVERY_AGENTS: AgentDefinition[];