@wrongstack/core 0.273.0 → 0.273.1

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 (60) hide show
  1. package/dist/{agent-bridge-BZ2enORi.d.ts → agent-bridge-DpKIxHhE.d.ts} +1 -1
  2. package/dist/{agent-subagent-runner-ehb4xGvd.d.ts → agent-subagent-runner-Dx7fZ1bE.d.ts} +7 -7
  3. package/dist/{brain-BxN2k2HP.d.ts → brain-BDcQaku-.d.ts} +11 -5
  4. package/dist/{compactor-72ug-ZRB.d.ts → compactor-BuSdj3fq.d.ts} +1 -1
  5. package/dist/{config-C8IYxlO8.d.ts → config-CR2yoG8c.d.ts} +54 -4
  6. package/dist/{context-Dw55zZ_Q.d.ts → context-DulAr8Zo.d.ts} +24 -0
  7. package/dist/coordination/index.d.ts +23 -16
  8. package/dist/coordination/index.js +113 -13
  9. package/dist/coordination/index.js.map +1 -1
  10. package/dist/defaults/index.d.ts +26 -26
  11. package/dist/defaults/index.js +405 -8
  12. package/dist/defaults/index.js.map +1 -1
  13. package/dist/execution/index.d.ts +15 -15
  14. package/dist/execution/index.js +75 -1
  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/{global-mailbox-C9dsc9Y_.d.ts → global-mailbox-CwcubDkA.d.ts} +1 -1
  19. package/dist/{goal-preamble-NhflDjYb.d.ts → goal-preamble-Bu0a2uCG.d.ts} +9 -9
  20. package/dist/{goal-store-Cx363x7Z.d.ts → goal-store-CTmFuZ8J.d.ts} +1 -1
  21. package/dist/hq/index.d.ts +5 -5
  22. package/dist/{index-B7fHDt0B.d.ts → index-CTq5wU3m.d.ts} +5 -5
  23. package/dist/{index-BbVprU-9.d.ts → index-CxP-HBhX.d.ts} +2 -2
  24. package/dist/index.d.ts +63 -42
  25. package/dist/index.js +598 -56
  26. package/dist/index.js.map +1 -1
  27. package/dist/infrastructure/index.d.ts +6 -6
  28. package/dist/kernel/index.d.ts +11 -11
  29. package/dist/kernel/index.js.map +1 -1
  30. package/dist/{mcp-servers-B6fSRNC1.d.ts → mcp-servers-BQaOE71z.d.ts} +3 -3
  31. package/dist/models/index.d.ts +5 -5
  32. package/dist/{models-registry-4C6Wr91w.d.ts → models-registry-BEcny4kP.d.ts} +1 -1
  33. package/dist/{multi-agent-coordinator-q1skFeNP.d.ts → multi-agent-coordinator-Bx8EFkv2.d.ts} +1 -1
  34. package/dist/{null-fleet-bus-C9rrgQwc.d.ts → null-fleet-bus-BC5ZXCQw.d.ts} +6 -6
  35. package/dist/observability/index.d.ts +2 -2
  36. package/dist/{parallel-eternal-engine-CtXly2Sf.d.ts → parallel-eternal-engine-C345TI3n.d.ts} +9 -9
  37. package/dist/{path-resolver-Bim6G5Jz.d.ts → path-resolver-C-W_wzkF.d.ts} +3 -3
  38. package/dist/{permission-CC7XFYWG.d.ts → permission-CsBGZkxp.d.ts} +1 -1
  39. package/dist/{permission-policy-cYR4RJmw.d.ts → permission-policy-g3Sg0GdZ.d.ts} +2 -2
  40. package/dist/{pipeline-CNVKuQDQ.d.ts → pipeline-xnw_24Z8.d.ts} +2 -2
  41. package/dist/{plan-templates-C4wXMmiM.d.ts → plan-templates-DGaiYEcS.d.ts} +31 -5
  42. package/dist/{provider-model-resolve-DFd3IPpw.d.ts → provider-model-resolve-Cz6OlIOp.d.ts} +3 -3
  43. package/dist/{provider-runner-BpM0mdBE.d.ts → provider-runner-7J0HqF6B.d.ts} +3 -3
  44. package/dist/{retry-policy-BV7nzeAd.d.ts → retry-policy-kqXJOVkX.d.ts} +1 -1
  45. package/dist/sdd/index.d.ts +9 -9
  46. package/dist/{secret-vault-eMBKfheR.d.ts → secret-vault-CMQUr-eB.d.ts} +1 -1
  47. package/dist/security/index.d.ts +5 -5
  48. package/dist/{selector-C4ORTOid.d.ts → selector-B4r34PWR.d.ts} +1 -1
  49. package/dist/{session-event-bridge-CeNpUL9w.d.ts → session-event-bridge-BD3LoyLC.d.ts} +1 -1
  50. package/dist/{session-reader-BepLSnGL.d.ts → session-reader-DjrKGD9c.d.ts} +1 -1
  51. package/dist/storage/index.d.ts +11 -11
  52. package/dist/storage/index.js +377 -11
  53. package/dist/storage/index.js.map +1 -1
  54. package/dist/tools/index.d.ts +2 -2
  55. package/dist/types/index.d.ts +19 -19
  56. package/dist/types/index.js +28 -0
  57. package/dist/types/index.js.map +1 -1
  58. package/dist/utils/index.d.ts +2 -2
  59. package/dist/{worktree-manager-BDuXTaWL.d.ts → worktree-manager-DHdrWQ_7.d.ts} +1 -1
  60. package/package.json +1 -1
@@ -1,45 +1,45 @@
1
1
  export { D as DefaultLogger, a as DefaultLoggerOptions, L as LogFormat } from '../logger-DmmQhf4P.js';
2
- export { A as AbandonedSession, a as AttachmentStoreOptions, C as ConfigLoaderOptions, b as ConfigMigration, c as ConfigMigrationError, d as ConfigSource, D as DEFAULT_CONFIG_MIGRATIONS, e as DefaultAttachmentStore, f as DefaultConfigLoader, g as DefaultConfigStore, h as DefaultMemoryStore, i as DefaultSessionStore, k as MemoryStoreOptions, l as MigrationContext, m as MigrationResult, P as PersistedQueueItem, n as PlanFile, o as PlanItem, p as PlanTemplate, Q as QueueStore, R as RecoveryLock, q as RecoveryLockOptions, S as SessionAnalyzer, r as SessionStoreOptions, T as TodosCheckpointFile, s as addPlanItem, t as attachPlanCheckpoint, u as attachTodosCheckpoint, v as clearPlan, w as deriveTodosFromPlanItem, x as emptyPlan, y as formatPlan, z as formatPlanTemplates, B as getPlanTemplate, E as listPlanTemplates, G as loadPlan, H as loadTodosCheckpoint, K as removePlanItem, L as runConfigMigrations, N as savePlan, O as saveTodosCheckpoint, U as setPlanItemStatus } from '../plan-templates-C4wXMmiM.js';
3
- export { D as DefaultSessionReader } from '../session-reader-BepLSnGL.js';
4
- export { A as AuditLevel, S as SessionEventBridge, b as SessionEventBridgeOptions, c as SessionSamplingOptions, T as ToolProgressSamplingOptions, d as createSessionEventBridge, r as resolveAuditLevel, e as resolveSessionLoggingConfig } from '../session-event-bridge-CeNpUL9w.js';
2
+ export { A as AbandonedSession, a as AttachmentStoreOptions, C as ConfigLoaderOptions, b as ConfigMigration, c as ConfigMigrationError, d as ConfigSource, D as DEFAULT_CONFIG_MIGRATIONS, e as DefaultAttachmentStore, f as DefaultConfigLoader, g as DefaultConfigStore, h as DefaultMemoryStore, i as DefaultSessionStore, k as MemoryStoreOptions, l as MigrationContext, m as MigrationResult, P as PersistedQueueItem, n as PlanFile, o as PlanItem, p as PlanTemplate, Q as QueueStore, R as RecoveryLock, q as RecoveryLockOptions, S as SessionAnalyzer, r as SessionStoreOptions, T as TodosCheckpointFile, s as addPlanItem, t as attachPlanCheckpoint, u as attachTodosCheckpoint, v as clearPlan, w as deriveTodosFromPlanItem, x as emptyPlan, y as formatPlan, z as formatPlanTemplates, B as getPlanTemplate, E as listPlanTemplates, G as loadPlan, H as loadTodosCheckpoint, K as removePlanItem, L as runConfigMigrations, N as savePlan, O as saveTodosCheckpoint, U as setPlanItemStatus } from '../plan-templates-DGaiYEcS.js';
3
+ export { D as DefaultSessionReader } from '../session-reader-DjrKGD9c.js';
4
+ export { A as AuditLevel, S as SessionEventBridge, b as SessionEventBridgeOptions, c as SessionSamplingOptions, T as ToolProgressSamplingOptions, d as createSessionEventBridge, r as resolveAuditLevel, e as resolveSessionLoggingConfig } from '../session-event-bridge-BD3LoyLC.js';
5
5
  export { a as DirectorStateCheckpoint, D as DirectorStateSnapshot, b as DirectorSubagentState, c as DirectorTaskState, l as loadDirectorState } from '../director-state-BfeCUbmk.js';
6
- export { a as DefaultSecretScrubber, D as DefaultSecretVault, S as SecretVaultOptions, d as decryptConfigSecrets, e as encryptConfigSecrets, m as migratePlaintextSecrets, r as rewriteConfigEncrypted } from '../secret-vault-eMBKfheR.js';
7
- export { A as AutoApprovePermissionPolicy, D as DefaultPermissionPolicy, P as PermissionPolicyOptions } from '../permission-policy-cYR4RJmw.js';
8
- export { C as CompactorOptions, a as DefaultErrorHandler, b as DefaultRetryPolicy, E as EternalAutonomyEngine, c as EternalAutonomyOptions, d as EternalEngineState, H as HybridCompactor, I as IterationStage, P as ParallelEngineState, e as ParallelEternalEngine, f as ParallelEternalOptions, g as ParallelIterationStage, T as ToolExecutor } from '../parallel-eternal-engine-CtXly2Sf.js';
9
- export { A as AutoCompactionMiddleware, a as AutonomousRunner, b as AutonomousRunnerOptions, c as AutonomyPromptContributorOptions, C as CompactorStrategy, D as DefaultSkillLoader, d as DoneCheckResult, e as DoneConditionChecker, I as IntelligentCompactor, f as IntelligentCompactorOptions, S as SelectiveCompactor, g as SelectiveCompactorOptions, h as SkillLoaderOptions, i as StrategyCompactorOptions, j as buildGoalPreamble, k as createStrategyCompactor, m as makeAutonomyPromptContributor } from '../goal-preamble-NhflDjYb.js';
10
- import { P as ProviderRunner, R as RunProviderOptions } from '../provider-runner-BpM0mdBE.js';
11
- import { d as Response } from '../context-Dw55zZ_Q.js';
12
- export { 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, n as CreateDelegateToolOptions, D as DEFAULT_DIRECTOR_PREAMBLE, q as DEFAULT_SUBAGENT_BASELINE, r as DelegateHost, s as Director, w as DirectorPromptParts, x as DirectorSessionFactory, y as DirectorSessionFactoryOptions, F as FLEET_ROSTER, z as FLEET_ROSTER_BUDGETS, J as FleetRosterBudget, K as FleetSpawnBudgetError, L as ICoordinator, M as IFleetManager, O as NULL_FLEET_BUS, R as REFACTOR_PLANNER_AGENT, S as SECURITY_SCANNER_AGENT, V as SubagentPromptParts, W as applyRosterBudget, X as attachAutoExtend, Y as composeDirectorPrompt, Z as composeSubagentPrompt, _ as createDelegateTool, $ as getAgentDefinition, 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, af as rosterSummaryFromConfigs } from '../null-fleet-bus-C9rrgQwc.js';
13
- export { c as AgentBudgetTier, d as AgentCapability, b as AgentDefinition, 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, j as MultiAgentCoordinatorOptions, k as dispatchAgent, m as makeLLMClassifier, s as scoreAgents } from '../multi-agent-coordinator-q1skFeNP.js';
14
- export { h as AgentFactory, v as AgentFactoryResult, w as AgentRunnerOptions, x as BudgetExceededError, y as BudgetKind, z as BudgetLimits, J as BudgetUsage, F as FleetBus, N as FleetEvent, O as FleetHandler, i as FleetUsage, j as FleetUsageAggregator, Q as SubagentBudget, Y as SubagentUsageSnapshot, $ as makeAgentSubagentRunner } from '../agent-subagent-runner-ehb4xGvd.js';
15
- export { I as InMemoryAgentBridge, a as InMemoryBridgeTransport, c as createMessage } from '../agent-bridge-BZ2enORi.js';
16
- export { D as DefaultModelsRegistry, a as DefaultModelsRegistryOptions, c as classifyFamily } from '../models-registry-4C6Wr91w.js';
17
- export { D as DefaultModeStore, L as LLMSelector, a as LLMSelectorOptions, M as ModeLoaderOptions, P as ProviderModelDescriptor, d as describeCatalogModel, l as loadProjectModes, b as loadUserModes, r as resolveProviderModelList } from '../provider-model-resolve-DFd3IPpw.js';
6
+ export { a as DefaultSecretScrubber, D as DefaultSecretVault, S as SecretVaultOptions, d as decryptConfigSecrets, e as encryptConfigSecrets, m as migratePlaintextSecrets, r as rewriteConfigEncrypted } from '../secret-vault-CMQUr-eB.js';
7
+ export { A as AutoApprovePermissionPolicy, D as DefaultPermissionPolicy, P as PermissionPolicyOptions } from '../permission-policy-g3Sg0GdZ.js';
8
+ export { C as CompactorOptions, a as DefaultErrorHandler, b as DefaultRetryPolicy, E as EternalAutonomyEngine, c as EternalAutonomyOptions, d as EternalEngineState, H as HybridCompactor, I as IterationStage, P as ParallelEngineState, e as ParallelEternalEngine, f as ParallelEternalOptions, g as ParallelIterationStage, T as ToolExecutor } from '../parallel-eternal-engine-C345TI3n.js';
9
+ export { A as AutoCompactionMiddleware, a as AutonomousRunner, b as AutonomousRunnerOptions, c as AutonomyPromptContributorOptions, C as CompactorStrategy, D as DefaultSkillLoader, d as DoneCheckResult, e as DoneConditionChecker, I as IntelligentCompactor, f as IntelligentCompactorOptions, S as SelectiveCompactor, g as SelectiveCompactorOptions, h as SkillLoaderOptions, i as StrategyCompactorOptions, j as buildGoalPreamble, k as createStrategyCompactor, m as makeAutonomyPromptContributor } from '../goal-preamble-Bu0a2uCG.js';
10
+ import { P as ProviderRunner, R as RunProviderOptions } from '../provider-runner-7J0HqF6B.js';
11
+ import { d as Response } from '../context-DulAr8Zo.js';
12
+ export { 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, n as CreateDelegateToolOptions, D as DEFAULT_DIRECTOR_PREAMBLE, q as DEFAULT_SUBAGENT_BASELINE, r as DelegateHost, s as Director, w as DirectorPromptParts, x as DirectorSessionFactory, y as DirectorSessionFactoryOptions, F as FLEET_ROSTER, z as FLEET_ROSTER_BUDGETS, J as FleetRosterBudget, K as FleetSpawnBudgetError, L as ICoordinator, M as IFleetManager, O as NULL_FLEET_BUS, R as REFACTOR_PLANNER_AGENT, S as SECURITY_SCANNER_AGENT, V as SubagentPromptParts, W as applyRosterBudget, X as attachAutoExtend, Y as composeDirectorPrompt, Z as composeSubagentPrompt, _ as createDelegateTool, $ as getAgentDefinition, 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, af as rosterSummaryFromConfigs } from '../null-fleet-bus-BC5ZXCQw.js';
13
+ export { c as AgentBudgetTier, d as AgentCapability, b as AgentDefinition, 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, j as MultiAgentCoordinatorOptions, k as dispatchAgent, m as makeLLMClassifier, s as scoreAgents } from '../multi-agent-coordinator-Bx8EFkv2.js';
14
+ export { h as AgentFactory, v as AgentFactoryResult, w as AgentRunnerOptions, x as BudgetExceededError, y as BudgetKind, z as BudgetLimits, J as BudgetUsage, F as FleetBus, N as FleetEvent, O as FleetHandler, i as FleetUsage, j as FleetUsageAggregator, Q as SubagentBudget, Y as SubagentUsageSnapshot, $ as makeAgentSubagentRunner } from '../agent-subagent-runner-Dx7fZ1bE.js';
15
+ export { I as InMemoryAgentBridge, a as InMemoryBridgeTransport, c as createMessage } from '../agent-bridge-DpKIxHhE.js';
16
+ export { D as DefaultModelsRegistry, a as DefaultModelsRegistryOptions, c as classifyFamily } from '../models-registry-BEcny4kP.js';
17
+ export { D as DefaultModeStore, L as LLMSelector, a as LLMSelectorOptions, M as ModeLoaderOptions, P as ProviderModelDescriptor, d as describeCatalogModel, l as loadProjectModes, b as loadUserModes, r as resolveProviderModelList } from '../provider-model-resolve-Cz6OlIOp.js';
18
18
  export { AISpecBuilder, AISpecBuilderOptions, AISpecPhase, AISpecSession, AutoExecutor, AutoExecutorOptions, BottleneckTask, CollectedAnswer, CommandVerifierOptions, ConflictSide, CriticalPathAnalysis, DefaultTaskStore, DestroySddProjectOptions, DestroySddProjectResult, ExecutionSummary, GeneratedTask, LlmConflictResolverOptions, RollbackFromDiskOptions, RunResult, SPEC_TEMPLATES, SddBoardColumn, SddBoardEvent, SddBoardFeedEntry, SddBoardIndexEntry, SddBoardProjector, SddBoardProjectorOptions, SddBoardSnapshot, SddBoardStatus, SddBoardStore, SddBoardStoreOptions, SddBoardTask, SddDeadlockChain, SddIngestResult, SddInterviewDriver, SddInterviewDriverOptions, SddInterviewSnapshot, SddParallelRun, SddParallelRunOptions, SddProgress, SddRunControl, SddRunHandle, SddRunRegistry, SddSubtaskSpec, SddSupervisor, SddSupervisorOptions, SddSupervisorVerdict, SddTaskDecomposer, SddTaskDecomposerOptions, SddTaskDisplayStatus, SpecDiff, SpecDrivenDev, SpecDrivenDevOptions, SpecIndexEntry, SpecParser, SpecStore, SpecStoreOptions, SpecVersion, SpecVersioning, StartSddRunOptions, SubtaskGeneratorOptions, TaskBatch, TaskExecutionContext, TaskExecutionResult, TaskFlow, TaskFlowEventMap, TaskFlowEventName, TaskFlowExecutionContext, TaskFlowOptions, TaskFlowPhase, TaskGenerator, TaskGeneratorOptions, TaskGraphIndexEntry, TaskGraphStore, TaskGraphStoreOptions, TaskStore, TaskTracker, TaskTrackerOptions, TaskTransition, WaveResult, analyzeCriticalPath, buildBoardSnapshot, buildBoardTasks, cleanupSddWorktrees, createAutoExecutor, destroySddProject, extractVerificationCommand, getTemplate, hasConflictMarkers, isExplanatoryText, listTemplates, makeCommandVerifier, makeLlmConflictResolver, makeLlmSubtaskGenerator, makePreferSideConflictResolver, renderProgress, renderSpecAnalysis, renderTaskGraph, renderTaskList, resolveConflictText, rollbackSddRunFromDisk, shortIdMap, startSddRun, templateToMarkdown } from '../sdd/index.js';
19
19
  export { DefaultHealthRegistry, InMemoryMetricsSink, MetricsServerHandle, MetricsServerOptions, NoopMetricsSink, NoopTracer, OTelTracer, OtlpMetricsExporterHandle, OtlpMetricsExporterOptions, OtlpTraceExporterHandle, OtlpTraceExporterOptions, PROMETHEUS_CONTENT_TYPE, buildOtlpMetricsRequest, buildOtlpTracesRequest, renderPrometheus, startMetricsServer, startOtlpMetricsExporter, startOtlpTraceExporter, wireMetricsToEvents } from '../observability/index.js';
20
- export { C as ContextManagerAction, a as ContextManagerInput, b as ContextManagerResult, c as ContextManagerToolOptions, d as allServers, e as awsServer, f as blockServer, g as braveSearchServer, h as context7Server, i as contextManagerTool, j as createContextManagerTool, k as everArtServer, l as filesystemServer, m as githubServer, n as googleMapsServer, o as miniMaxVisionServer, p as playwrightServer, s as sentinelServer, q as slackServer, r as sshManagerServer, z as zaiVisionServer } from '../mcp-servers-B6fSRNC1.js';
20
+ export { C as ContextManagerAction, a as ContextManagerInput, b as ContextManagerResult, c as ContextManagerToolOptions, d as allServers, e as awsServer, f as blockServer, g as braveSearchServer, h as context7Server, i as contextManagerTool, j as createContextManagerTool, k as everArtServer, l as filesystemServer, m as githubServer, n as googleMapsServer, o as miniMaxVisionServer, p as playwrightServer, s as sentinelServer, q as slackServer, r as sshManagerServer, z as zaiVisionServer } from '../mcp-servers-BQaOE71z.js';
21
21
  export { D as DEFAULT_AUTONOMY_CONFIG, b as DEFAULT_CONTEXT_CONFIG, e as DEFAULT_TOOLS_CONFIG } from '../default-config-BbX4ojZs.js';
22
22
  import '../logger-B63L5bTg.js';
23
- import '../brain-BxN2k2HP.js';
24
- import '../permission-CC7XFYWG.js';
23
+ import '../brain-BDcQaku-.js';
24
+ import '../permission-CsBGZkxp.js';
25
25
  import '../wstack-paths-BqkDAkoh.js';
26
- import '../config-C8IYxlO8.js';
26
+ import '../config-CR2yoG8c.js';
27
27
  import '../secret-vault-BAKpgFw_.js';
28
28
  import '../input-reader-E-ffP2ee.js';
29
- import '../retry-policy-BV7nzeAd.js';
30
- import '../compactor-72ug-ZRB.js';
31
- import '../index-B7fHDt0B.js';
32
- import '../pipeline-CNVKuQDQ.js';
29
+ import '../retry-policy-kqXJOVkX.js';
30
+ import '../compactor-BuSdj3fq.js';
31
+ import '../index-CTq5wU3m.js';
32
+ import '../pipeline-xnw_24Z8.js';
33
33
  import '../mailbox-types-Ct2hJq0P.js';
34
34
  import '../observability-D-HZN_mF.js';
35
- import '../goal-store-Cx363x7Z.js';
35
+ import '../goal-store-CTmFuZ8J.js';
36
36
  import '../skill-DGIXCtdv.js';
37
- import '../selector-C4ORTOid.js';
37
+ import '../selector-B4r34PWR.js';
38
38
  import 'node:events';
39
39
  import '../mode-CZlO9iU1.js';
40
40
  import '../spec-TBi3Jr6T.js';
41
41
  import '../task-graph-u1q9Jkyk.js';
42
- import '../worktree-manager-BDuXTaWL.js';
42
+ import '../worktree-manager-DHdrWQ_7.js';
43
43
 
44
44
  /**
45
45
  * Default ProviderRunner — thin adapter over `runProviderWithRetry`.
@@ -2519,6 +2519,91 @@ var DefaultSessionStore = class _DefaultSessionStore {
2519
2519
  }
2520
2520
  }
2521
2521
  }
2522
+ /**
2523
+ * Streaming search over a session's JSONL. Walks the file once, parses
2524
+ * each event lazily, and yields only the events that match `predicate`.
2525
+ * Stops as soon as `opts.limit` matches are collected.
2526
+ *
2527
+ * Why this exists: `load()` parses the entire file into memory and
2528
+ * rebuilds `messages`/`toolCallEnds` for every caller. `search()` only
2529
+ * needs to know which events contain matching text — a per-line
2530
+ * predicate is enough. The full parse work (and the `_loadCache` poll)
2531
+ * is wasted in that case.
2532
+ *
2533
+ * Memory: O(hits) regardless of file size. Disk: one linear scan,
2534
+ * terminated at `limit` if the caller asked for one.
2535
+ *
2536
+ * Errors: missing file yields []. Corrupt lines are skipped (same
2537
+ * policy as `load()`). Aborting via `signal` rejects with `AbortError`.
2538
+ */
2539
+ async searchEvents(id, predicate, opts) {
2540
+ const file = this.sessionPath(id, ".jsonl");
2541
+ const limit = opts?.limit;
2542
+ const signal = opts?.signal;
2543
+ const out = [];
2544
+ let stat6;
2545
+ try {
2546
+ stat6 = await fsp2.stat(file);
2547
+ } catch (err) {
2548
+ if (err.code === "ENOENT") return [];
2549
+ throw err;
2550
+ }
2551
+ if (stat6.size === 0) return [];
2552
+ let fh;
2553
+ try {
2554
+ fh = await fsp2.open(file, "r");
2555
+ const CHUNK = 64 * 1024;
2556
+ const buf = Buffer.alloc(CHUNK);
2557
+ let leftover = "";
2558
+ let eventIndex = 0;
2559
+ for (let position = 0; ; position += buf.byteLength) {
2560
+ if (signal?.aborted) {
2561
+ const reason = signal.reason ?? new DOMException("Aborted", "AbortError");
2562
+ throw reason;
2563
+ }
2564
+ const { bytesRead } = await fh.read(buf, 0, CHUNK, position);
2565
+ if (bytesRead === 0) break;
2566
+ const text = leftover + buf.subarray(0, bytesRead).toString("utf8");
2567
+ const parts = text.split("\n");
2568
+ leftover = parts.pop() ?? "";
2569
+ for (const line of parts) {
2570
+ if (!line) continue;
2571
+ let ev;
2572
+ try {
2573
+ const parsed = JSON.parse(line);
2574
+ if (parsed === null || typeof parsed !== "object" || typeof parsed.type !== "string" || typeof parsed.ts !== "string") {
2575
+ continue;
2576
+ }
2577
+ ev = parsed;
2578
+ } catch {
2579
+ continue;
2580
+ }
2581
+ if (predicate(ev, eventIndex, ev.ts)) {
2582
+ out.push({ event: ev, eventIndex, ts: ev.ts });
2583
+ if (limit !== void 0 && out.length >= limit) {
2584
+ return out;
2585
+ }
2586
+ }
2587
+ eventIndex++;
2588
+ }
2589
+ }
2590
+ if (leftover.trim()) {
2591
+ try {
2592
+ const parsed = JSON.parse(leftover);
2593
+ if (parsed !== null && typeof parsed === "object" && typeof parsed.type === "string" && typeof parsed.ts === "string") {
2594
+ const ev = parsed;
2595
+ if (predicate(ev, eventIndex, ev.ts)) {
2596
+ out.push({ event: ev, eventIndex, ts: ev.ts });
2597
+ }
2598
+ }
2599
+ } catch {
2600
+ }
2601
+ }
2602
+ return out;
2603
+ } finally {
2604
+ if (fh) await fh.close().catch(() => void 0);
2605
+ }
2606
+ }
2522
2607
  async list(limit = 20) {
2523
2608
  try {
2524
2609
  await ensureDir(this.dir);
@@ -5510,6 +5595,9 @@ function isContextWindowModeId(id) {
5510
5595
  return CONTEXT_WINDOW_MODES.some((m) => m.id === id);
5511
5596
  }
5512
5597
 
5598
+ // src/types/config.ts
5599
+ var DEFAULT_TUI_THINKING_WORD = "thinking";
5600
+
5513
5601
  // src/types/default-config.ts
5514
5602
  var DEFAULT_TOOLS_CONFIG = Object.freeze({
5515
5603
  defaultExecutionStrategy: "smart",
@@ -5528,6 +5616,10 @@ var DEFAULT_CONTEXT_CONFIG = Object.freeze({
5528
5616
  var DEFAULT_AUTONOMY_CONFIG = Object.freeze({
5529
5617
  autoProceedDelayMs: 45e3
5530
5618
  });
5619
+ var DEFAULT_CIRCUIT_BREAKER_CONFIG = Object.freeze({
5620
+ enabled: false,
5621
+ autoKillResetMs: 6e4
5622
+ });
5531
5623
  var DEFAULT_SESSION_LOGGING_CONFIG = Object.freeze({
5532
5624
  auditLevel: "standard",
5533
5625
  sampling: {
@@ -5554,7 +5646,8 @@ var BEHAVIOR_DEFAULTS = {
5554
5646
  hardThreshold: 0.9,
5555
5647
  autoCompact: true,
5556
5648
  preserveK: DEFAULT_CONTEXT_CONFIG.preserveK,
5557
- eliseThreshold: DEFAULT_CONTEXT_CONFIG.eliseThreshold
5649
+ eliseThreshold: DEFAULT_CONTEXT_CONFIG.eliseThreshold,
5650
+ strategy: "hybrid"
5558
5651
  },
5559
5652
  tools: {
5560
5653
  defaultExecutionStrategy: DEFAULT_TOOLS_CONFIG.defaultExecutionStrategy,
@@ -5577,6 +5670,13 @@ var BEHAVIOR_DEFAULTS = {
5577
5670
  allowOutsideProjectRoot: true
5578
5671
  },
5579
5672
  mcpServers: {},
5673
+ fallbackAuto: true,
5674
+ maxConcurrent: 4,
5675
+ yolo: false,
5676
+ nextPrediction: false,
5677
+ hints: true,
5678
+ debugStream: false,
5679
+ configScope: "global",
5580
5680
  indexing: {
5581
5681
  onSessionStart: true,
5582
5682
  onEdit: true,
@@ -5584,8 +5684,55 @@ var BEHAVIOR_DEFAULTS = {
5584
5684
  debounceMs: 400
5585
5685
  },
5586
5686
  session: { ...DEFAULT_SESSION_LOGGING_CONFIG },
5587
- autonomy: { autoProceedDelayMs: DEFAULT_AUTONOMY_CONFIG.autoProceedDelayMs }
5687
+ autonomy: {
5688
+ defaultMode: "off",
5689
+ autoProceedDelayMs: DEFAULT_AUTONOMY_CONFIG.autoProceedDelayMs,
5690
+ autoProceedMaxIterations: 50,
5691
+ autonomyNextPrompt: "auto {{suggestion}}",
5692
+ terminalTitleAnimation: true,
5693
+ yolo: false,
5694
+ streamFleet: true,
5695
+ chime: false,
5696
+ confirmExit: true,
5697
+ mouseMode: false,
5698
+ enhance: true,
5699
+ enhanceDelayMs: 6e4,
5700
+ enhanceLanguage: "original",
5701
+ statuslineMode: "detailed",
5702
+ thinkingWord: DEFAULT_TUI_THINKING_WORD
5703
+ },
5704
+ circuitBreaker: { ...DEFAULT_CIRCUIT_BREAKER_CONFIG },
5705
+ modelRuntime: {
5706
+ reasoning: { mode: "auto", effort: "high", preserve: false },
5707
+ cache: {}
5708
+ }
5588
5709
  };
5710
+ function isPlainRecord(value) {
5711
+ return typeof value === "object" && value !== null && !Array.isArray(value);
5712
+ }
5713
+ function cloneJsonValue(value) {
5714
+ return structuredClone(value);
5715
+ }
5716
+ function fillMissingDefaults(target, defaults) {
5717
+ const value = cloneJsonValue(target);
5718
+ const changed = fillMissingDefaultsInPlace(value, defaults);
5719
+ return { value, changed };
5720
+ }
5721
+ function fillMissingDefaultsInPlace(target, defaults) {
5722
+ let changed = false;
5723
+ for (const [key, defaultValue] of Object.entries(defaults)) {
5724
+ if (!Object.prototype.hasOwnProperty.call(target, key)) {
5725
+ target[key] = cloneJsonValue(defaultValue);
5726
+ changed = true;
5727
+ continue;
5728
+ }
5729
+ const current = target[key];
5730
+ if (isPlainRecord(current) && isPlainRecord(defaultValue)) {
5731
+ changed = fillMissingDefaultsInPlace(current, defaultValue) || changed;
5732
+ }
5733
+ }
5734
+ return changed;
5735
+ }
5589
5736
  function envBool(v) {
5590
5737
  return !/^(0|false|no|off)$/i.test(v.trim());
5591
5738
  }
@@ -5637,27 +5784,139 @@ var defaultIndexing = {
5637
5784
  watchExternal: true,
5638
5785
  debounceMs: 400
5639
5786
  };
5640
- var IN_PROJECT_FORBIDDEN_KEYS = /* @__PURE__ */ new Set([
5787
+ var IN_PROJECT_ALLOWED_KEYS = /* @__PURE__ */ new Set([
5788
+ "version",
5789
+ "model",
5790
+ "cwd",
5791
+ "context",
5792
+ "tools",
5793
+ "features",
5794
+ "autonomy",
5795
+ "indexing",
5796
+ "session",
5797
+ "log",
5798
+ "launch",
5799
+ "nextPrediction",
5800
+ "hints",
5801
+ "debugStream",
5802
+ "configScope",
5803
+ "maxConcurrent",
5804
+ "fallbackModels",
5805
+ "fallbackAuto",
5806
+ "models",
5807
+ "modelMatrix",
5808
+ "circuitBreaker",
5809
+ "adaptiveConcurrency",
5810
+ "modelRuntime"
5811
+ ]);
5812
+ var KNOWN_DENIED_IN_PROJECT = [
5813
+ { key: "provider", reason: "Provider id override; can intercept prompts/responses." },
5814
+ { key: "apiKey", reason: "Overrides user API key; exfiltrates prompts." },
5815
+ { key: "baseUrl", reason: "Redirects provider endpoint; leaks real API key." },
5816
+ { key: "providers", reason: "Per-provider apiKey/baseUrl/oauthConfig; same redirect/exfil." },
5817
+ { key: "mcpServers", reason: "Arbitrary command/args/env spawned at boot (RCE)." },
5818
+ { key: "hooks", reason: "Shell command arrays on lifecycle events (RCE)." },
5819
+ { key: "plugins", reason: "Dynamic npm package load at boot (RCE)." },
5820
+ { key: "sync", reason: "Carries githubToken credential and target repo." },
5821
+ { key: "yolo", reason: "Disables all permission confirmation prompts." },
5822
+ { key: "extensions", reason: "Per-plugin config can carry command/credential fields." },
5823
+ { key: "hq", reason: "Carries HQ client token credential and endpoint URL." }
5824
+ ];
5825
+ var KNOWN_CONFIG_TOP_LEVEL_KEYS = /* @__PURE__ */ new Set([
5826
+ "version",
5641
5827
  "provider",
5828
+ "model",
5642
5829
  "apiKey",
5643
5830
  "baseUrl",
5831
+ "maxConcurrent",
5644
5832
  "providers",
5833
+ "models",
5834
+ "modelMatrix",
5835
+ "context",
5836
+ "tools",
5645
5837
  "mcpServers",
5838
+ "fallbackModels",
5839
+ "fallbackAuto",
5646
5840
  "hooks",
5647
5841
  "plugins",
5648
- "sync",
5842
+ "log",
5843
+ "features",
5649
5844
  "yolo",
5845
+ "nextPrediction",
5846
+ "cwd",
5847
+ "autonomy",
5848
+ "hints",
5849
+ "debugStream",
5850
+ "configScope",
5851
+ "indexing",
5852
+ "circuitBreaker",
5853
+ "adaptiveConcurrency",
5854
+ "launch",
5855
+ "session",
5856
+ "modelRuntime",
5857
+ "hq",
5858
+ "sync",
5650
5859
  "extensions"
5651
5860
  ]);
5861
+ function assertInProjectAllowListComplete() {
5862
+ const missingFromBoth = [];
5863
+ for (const key of KNOWN_CONFIG_TOP_LEVEL_KEYS) {
5864
+ if (IN_PROJECT_ALLOWED_KEYS.has(key)) continue;
5865
+ const denied = KNOWN_DENIED_IN_PROJECT.find((d) => d.key === key);
5866
+ if (!denied) missingFromBoth.push(key);
5867
+ }
5868
+ const staleDenials = KNOWN_DENIED_IN_PROJECT.filter((d) => !KNOWN_CONFIG_TOP_LEVEL_KEYS.has(d.key)).map((d) => d.key);
5869
+ const duplicate = KNOWN_DENIED_IN_PROJECT.filter((d) => IN_PROJECT_ALLOWED_KEYS.has(d.key)).map((d) => d.key);
5870
+ const problems = [];
5871
+ if (missingFromBoth.length > 0) {
5872
+ problems.push(
5873
+ `new Config field(s) not classified as allowed or denied for in-project config: ` + missingFromBoth.join(", ") + ". Add each to IN_PROJECT_ALLOWED_KEYS (if safe) or KNOWN_DENIED_IN_PROJECT (with a reason)."
5874
+ );
5875
+ }
5876
+ if (staleDenials.length > 0) {
5877
+ problems.push(
5878
+ `KNOWN_DENIED_IN_PROJECT references keys that no longer exist on Config: ` + staleDenials.join(", ") + ". Remove them or restore the field on Config."
5879
+ );
5880
+ }
5881
+ if (duplicate.length > 0) {
5882
+ problems.push(
5883
+ `field(s) appear in BOTH IN_PROJECT_ALLOWED_KEYS and KNOWN_DENIED_IN_PROJECT: ` + duplicate.join(", ") + ". The allow-list wins at runtime; remove from one of the two."
5884
+ );
5885
+ }
5886
+ if (problems.length > 0) {
5887
+ throw new Error(
5888
+ `stripUnsafeInProjectFields drift check failed:
5889
+ - ${problems.join("\n - ")}`
5890
+ );
5891
+ }
5892
+ }
5893
+ var driftChecked = false;
5652
5894
  function stripUnsafeInProjectFields(inProject, sourcePath, warn = (msg) => console.warn(msg)) {
5895
+ if (!driftChecked) {
5896
+ assertInProjectAllowListComplete();
5897
+ driftChecked = true;
5898
+ }
5653
5899
  const stripped = [];
5654
5900
  const out = {};
5655
5901
  for (const [k, v] of Object.entries(inProject)) {
5656
- if (IN_PROJECT_FORBIDDEN_KEYS.has(k)) {
5657
- stripped.push(k);
5902
+ if (IN_PROJECT_ALLOWED_KEYS.has(k)) {
5903
+ out[k] = v;
5658
5904
  continue;
5659
5905
  }
5660
- out[k] = v;
5906
+ stripped.push(k);
5907
+ }
5908
+ const outTools = out["tools"];
5909
+ if (outTools && typeof outTools === "object") {
5910
+ const execCfg = outTools["exec"];
5911
+ if (execCfg && typeof execCfg === "object" && "allow" in execCfg) {
5912
+ const clonedExec = { ...execCfg };
5913
+ delete clonedExec["allow"];
5914
+ out["tools"] = {
5915
+ ...outTools,
5916
+ exec: clonedExec
5917
+ };
5918
+ stripped.push("tools.exec.allow");
5919
+ }
5661
5920
  }
5662
5921
  if (stripped.length > 0) {
5663
5922
  warn(
@@ -5666,7 +5925,7 @@ function stripUnsafeInProjectFields(inProject, sourcePath, warn = (msg) => conso
5666
5925
  event: "config.in_project_unsafe_fields_ignored",
5667
5926
  path: sourcePath,
5668
5927
  ignoredKeys: stripped,
5669
- message: `Ignored ${stripped.length} unsafe field(s) from the repo-committed config "${sourcePath}": ${stripped.join(", ")}. These can only be set in your personal ~/.wrongstack/config.json, not in a project-committed file.`,
5928
+ message: `Ignored ${stripped.length} field(s) from the repo-committed config "${sourcePath}": ${stripped.join(", ")}. Only a small allow-list of benign preferences (model, context, tools limits, features, \u2026) may be set by <project>/.wrongstack/config.json. Everything else must live in your personal ~/.wrongstack/config.json.`,
5670
5929
  timestamp: (/* @__PURE__ */ new Date()).toISOString()
5671
5930
  })
5672
5931
  );
@@ -5710,6 +5969,7 @@ var DefaultConfigLoader = class {
5710
5969
  }
5711
5970
  async load(opts = {}) {
5712
5971
  let cfg = { ...BEHAVIOR_DEFAULTS };
5972
+ await this.ensureGlobalDefaults();
5713
5973
  const inProjectCollides = samePath(this.paths.inProjectConfig, this.paths.globalConfig) || samePath(this.paths.inProjectConfig, this.paths.projectLocalConfig);
5714
5974
  const [global, local, inProject] = await Promise.all([
5715
5975
  this.readJson(this.paths.globalConfig),
@@ -5774,6 +6034,80 @@ var DefaultConfigLoader = class {
5774
6034
  }
5775
6035
  return Object.freeze(cfg);
5776
6036
  }
6037
+ async ensureGlobalDefaults() {
6038
+ const fp = this.paths.globalConfig;
6039
+ const t0 = Date.now();
6040
+ try {
6041
+ await withFileLock(fp, async () => {
6042
+ let parsed;
6043
+ try {
6044
+ const raw = await fsp2.readFile(fp, "utf8");
6045
+ const result = safeParse(raw);
6046
+ if (!result.ok || !isPlainRecord(result.value)) {
6047
+ return;
6048
+ }
6049
+ parsed = result.value;
6050
+ } catch (err) {
6051
+ if (err.code !== "ENOENT") {
6052
+ this.events?.emit("storage.error", {
6053
+ sessionId: "~config~",
6054
+ store: "config",
6055
+ filePath: fp,
6056
+ operation: "ensure_defaults",
6057
+ outcome: "failure",
6058
+ error: storageErrorString(err),
6059
+ recoverable: false,
6060
+ durationMs: Date.now() - t0,
6061
+ ...this.traceId !== void 0 ? { traceId: this.traceId } : {}
6062
+ });
6063
+ console.warn(JSON.stringify({
6064
+ level: "warn",
6065
+ event: "config.defaults_read_failed",
6066
+ path: fp,
6067
+ message: toErrorMessage(err),
6068
+ timestamp: (/* @__PURE__ */ new Date()).toISOString()
6069
+ }));
6070
+ return;
6071
+ }
6072
+ parsed = {};
6073
+ }
6074
+ const { value, changed } = fillMissingDefaults(
6075
+ parsed,
6076
+ BEHAVIOR_DEFAULTS
6077
+ );
6078
+ if (!changed) return;
6079
+ await atomicWrite(fp, JSON.stringify(value, null, 2), { mode: 384 });
6080
+ this.events?.emit("storage.write", {
6081
+ sessionId: "~config~",
6082
+ store: "config",
6083
+ filePath: fp,
6084
+ operation: "ensure_defaults",
6085
+ outcome: "success",
6086
+ durationMs: Date.now() - t0,
6087
+ ...this.traceId !== void 0 ? { traceId: this.traceId } : {}
6088
+ });
6089
+ });
6090
+ } catch (err) {
6091
+ this.events?.emit("storage.error", {
6092
+ sessionId: "~config~",
6093
+ store: "config",
6094
+ filePath: fp,
6095
+ operation: "ensure_defaults",
6096
+ outcome: "failure",
6097
+ error: storageErrorString(err),
6098
+ recoverable: false,
6099
+ durationMs: Date.now() - t0,
6100
+ ...this.traceId !== void 0 ? { traceId: this.traceId } : {}
6101
+ });
6102
+ console.warn(JSON.stringify({
6103
+ level: "warn",
6104
+ event: "config.defaults_write_failed",
6105
+ path: fp,
6106
+ message: toErrorMessage(err),
6107
+ timestamp: (/* @__PURE__ */ new Date()).toISOString()
6108
+ }));
6109
+ }
6110
+ }
5777
6111
  /**
5778
6112
  * Persist a sync config to ~/.wrongstack/sync.json, with the token encrypted
5779
6113
  * by the vault (if provided). The file is isolated from the main config
@@ -6239,6 +6573,34 @@ var DefaultSessionReader = class {
6239
6573
  ids = filtered.map((s) => s.id);
6240
6574
  }
6241
6575
  const hits = [];
6576
+ const streaming = this.store.searchEvents?.bind(this.store);
6577
+ if (streaming) {
6578
+ for (const id of ids) {
6579
+ const matched = await streaming(
6580
+ id,
6581
+ (ev) => {
6582
+ if (allowedTypes && !allowedTypes.has(ev.type)) return false;
6583
+ const text = eventText(ev);
6584
+ if (text === null) return false;
6585
+ return matcher(text) !== null;
6586
+ },
6587
+ { limit: limit - hits.length }
6588
+ );
6589
+ for (const m of matched) {
6590
+ const text = expectDefined(eventText(m.event));
6591
+ const hit = expectDefined(matcher(text));
6592
+ hits.push({
6593
+ sessionId: id,
6594
+ eventIndex: m.eventIndex,
6595
+ ts: m.ts,
6596
+ type: m.event.type,
6597
+ snippet: snippetOf(text, hit.start, hit.end)
6598
+ });
6599
+ if (hits.length >= limit) return hits;
6600
+ }
6601
+ }
6602
+ return hits;
6603
+ }
6242
6604
  for (const id of ids) {
6243
6605
  let data;
6244
6606
  try {
@@ -10052,6 +10414,7 @@ var AutoCompactionMiddleware = class _AutoCompactionMiddleware {
10052
10414
  level,
10053
10415
  tokens,
10054
10416
  load,
10417
+ hardThreshold: adaptiveThresholds.hard,
10055
10418
  budget,
10056
10419
  signals: { repeatedReadCount: repetition }
10057
10420
  });
@@ -10099,6 +10462,7 @@ var AutoCompactionMiddleware = class _AutoCompactionMiddleware {
10099
10462
  }
10100
10463
  }
10101
10464
  async compact(ctx, aggressive, pressure) {
10465
+ let postCompactionOverflow = null;
10102
10466
  try {
10103
10467
  const report = await this.compactor.compact(ctx, { aggressive });
10104
10468
  this.recordAttempt(pressure.level, pressure.tokens, report);
@@ -10128,6 +10492,38 @@ var AutoCompactionMiddleware = class _AutoCompactionMiddleware {
10128
10492
  ...report.collapsedDigest ? { digest: truncateDigest(report.collapsedDigest) } : {}
10129
10493
  });
10130
10494
  ctx.clearFileTracking();
10495
+ const afterTokens = report.fullRequestTokensAfter ?? report.after;
10496
+ const afterLoad = this._maxContext > 0 ? afterTokens / this._maxContext : 0;
10497
+ const stillHard = afterLoad >= pressure.hardThreshold;
10498
+ const fatal = stillHard && (this.failureMode === "throw" || this.failureMode === "throw_on_hard" && pressure.level === "hard");
10499
+ if (stillHard) {
10500
+ const error = new Error(
10501
+ `Auto-compaction left context above the hard threshold after ${pressure.level} compaction`
10502
+ );
10503
+ this.events?.emit("compaction.failed", {
10504
+ err: error,
10505
+ aggressive,
10506
+ level: pressure.level,
10507
+ tokens: afterTokens,
10508
+ maxContext: this._maxContext,
10509
+ budget: computeContextWindowBudget(ctx, afterTokens, this._maxContext),
10510
+ signals: pressure.signals,
10511
+ load: afterLoad,
10512
+ fatal
10513
+ });
10514
+ if (fatal) {
10515
+ postCompactionOverflow = new AgentError({
10516
+ message: `Auto-compaction did not reduce context below hard threshold`,
10517
+ code: ERROR_CODES.AGENT_CONTEXT_OVERFLOW,
10518
+ recoverable: true,
10519
+ context: {
10520
+ level: pressure.level,
10521
+ tokens: afterTokens,
10522
+ maxContext: this._maxContext
10523
+ }
10524
+ });
10525
+ }
10526
+ }
10131
10527
  } catch (err) {
10132
10528
  const error = err instanceof Error ? err : new Error(String(err));
10133
10529
  const fatal = this.failureMode === "throw" || this.failureMode === "throw_on_hard" && pressure.level === "hard";
@@ -10156,6 +10552,7 @@ var AutoCompactionMiddleware = class _AutoCompactionMiddleware {
10156
10552
  });
10157
10553
  }
10158
10554
  }
10555
+ if (postCompactionOverflow) throw postCompactionOverflow;
10159
10556
  }
10160
10557
  };
10161
10558
  function computeContextWindowBudget(ctx, inputTokens, maxContext) {