@wrongstack/core 0.9.19 → 0.9.20

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 (63) hide show
  1. package/dist/{agent-bridge-DMVOX0cF.d.ts → agent-bridge-Dti3KXGk.d.ts} +1 -1
  2. package/dist/{agent-subagent-runner-C4qt9e5Y.d.ts → agent-subagent-runner-U-rs7kk7.d.ts} +3 -4
  3. package/dist/compactor-D7X96RLZ.d.ts +41 -0
  4. package/dist/{config-CWva0qoL.d.ts → config-CLXMDOSs.d.ts} +1 -1
  5. package/dist/{context-BRNbHmRM.d.ts → context-zkZeILpr.d.ts} +46 -0
  6. package/dist/coordination/index.d.ts +13 -13
  7. package/dist/coordination/index.js +660 -146
  8. package/dist/coordination/index.js.map +1 -1
  9. package/dist/defaults/index.d.ts +20 -20
  10. package/dist/defaults/index.js +918 -350
  11. package/dist/defaults/index.js.map +1 -1
  12. package/dist/{events-CiG9qUM_.d.ts → events-DH-9r-_C.d.ts} +42 -1
  13. package/dist/execution/index.d.ts +41 -30
  14. package/dist/execution/index.js +358 -112
  15. package/dist/execution/index.js.map +1 -1
  16. package/dist/extension/index.d.ts +6 -6
  17. package/dist/extension/index.js.map +1 -1
  18. package/dist/{index-aizK8olO.d.ts → index-BIHJ4uII.d.ts} +11 -8
  19. package/dist/{index-p95HQ22A.d.ts → index-CFO9QmJo.d.ts} +8 -8
  20. package/dist/index.d.ts +311 -35
  21. package/dist/index.js +1933 -512
  22. package/dist/index.js.map +1 -1
  23. package/dist/infrastructure/index.d.ts +6 -6
  24. package/dist/infrastructure/index.js +36 -0
  25. package/dist/infrastructure/index.js.map +1 -1
  26. package/dist/kernel/index.d.ts +9 -9
  27. package/dist/kernel/index.js.map +1 -1
  28. package/dist/{mcp-servers-BkVEqkRe.d.ts → mcp-servers-DkESgh0G.d.ts} +25 -3
  29. package/dist/models/index.d.ts +2 -2
  30. package/dist/models/index.js +1 -1
  31. package/dist/models/index.js.map +1 -1
  32. package/dist/{multi-agent-3ZnTB1aT.d.ts → multi-agent-DNp6lAzg.d.ts} +35 -23
  33. package/dist/{multi-agent-coordinator-bRaI_aD1.d.ts → multi-agent-coordinator-CAhsegPz.d.ts} +20 -2
  34. package/dist/{null-fleet-bus-DKM3Iy9d.d.ts → null-fleet-bus-Dnl19vmf.d.ts} +411 -110
  35. package/dist/observability/index.d.ts +2 -2
  36. package/dist/{path-resolver-TcJfc29Y.d.ts → path-resolver-CHiBL0DD.d.ts} +2 -2
  37. package/dist/{permission-bPuzAy4x.d.ts → permission-H35s9Evv.d.ts} +1 -1
  38. package/dist/{permission-policy-BUQSutpl.d.ts → permission-policy-CT-nRmTn.d.ts} +2 -2
  39. package/dist/{plan-templates-fkQTyz3U.d.ts → plan-templates-Bs8iRwi6.d.ts} +4 -4
  40. package/dist/{provider-runner-BEpikbbN.d.ts → provider-runner-BZdDrWrS.d.ts} +3 -3
  41. package/dist/{retry-policy-BYkq0ugs.d.ts → retry-policy-J9N_PM40.d.ts} +1 -1
  42. package/dist/sdd/index.d.ts +9 -10
  43. package/dist/sdd/index.js +224 -68
  44. package/dist/sdd/index.js.map +1 -1
  45. package/dist/security/index.d.ts +3 -3
  46. package/dist/{selector-pox8abg0.d.ts → selector-CFTh3Z6p.d.ts} +1 -1
  47. package/dist/{session-reader-CSWcb5Ga.d.ts → session-reader-C7JJlxOw.d.ts} +2 -2
  48. package/dist/skills/index.d.ts +1 -1
  49. package/dist/skills/index.js +1 -1
  50. package/dist/skills/index.js.map +1 -1
  51. package/dist/storage/index.d.ts +390 -6
  52. package/dist/storage/index.js +672 -35
  53. package/dist/storage/index.js.map +1 -1
  54. package/dist/{system-prompt-Bs-Wliab.d.ts → system-prompt-CneIxVip.d.ts} +1 -1
  55. package/dist/{tool-executor-Boo3dekH.d.ts → tool-executor-flTuxsqO.d.ts} +9 -4
  56. package/dist/types/index.d.ts +14 -14
  57. package/dist/types/index.js +60 -0
  58. package/dist/types/index.js.map +1 -1
  59. package/dist/utils/index.d.ts +18 -6
  60. package/dist/utils/index.js +61 -56
  61. package/dist/utils/index.js.map +1 -1
  62. package/package.json +1 -1
  63. package/dist/compactor-DVTKL7XD.d.ts +0 -23
@@ -1,4 +1,4 @@
1
- import { b as BridgeTransport, B as BridgeMessage, A as AgentBridge, a as AgentBridgeConfig } from './multi-agent-3ZnTB1aT.js';
1
+ import { b as BridgeTransport, B as BridgeMessage, A as AgentBridge, a as AgentBridgeConfig } from './multi-agent-DNp6lAzg.js';
2
2
 
3
3
  /**
4
4
  * In-memory pub/sub transport for agent-to-agent messaging.
@@ -1,6 +1,6 @@
1
- import { c as Agent, f as AgentInput } from './index-aizK8olO.js';
2
- import { E as EventBus } from './events-CiG9qUM_.js';
3
- import { n as SubagentConfig, v as TaskSpec, t as SubagentRunner } from './multi-agent-3ZnTB1aT.js';
1
+ import { c as Agent, f as AgentInput } from './index-BIHJ4uII.js';
2
+ import { E as EventBus } from './events-DH-9r-_C.js';
3
+ import { n as SubagentConfig, v as TaskSpec, t as SubagentRunner } from './multi-agent-DNp6lAzg.js';
4
4
 
5
5
  /**
6
6
  * Single fleet-wide event with subagent attribution. Whatever a child
@@ -91,7 +91,6 @@ interface SubagentUsageSnapshot {
91
91
  * each subagent's per-token rates from the models registry.
92
92
  */
93
93
  declare class FleetUsageAggregator {
94
- private readonly bus;
95
94
  private readonly priceLookup?;
96
95
  private readonly metaLookup?;
97
96
  private readonly perSubagent;
@@ -0,0 +1,41 @@
1
+ import { d as Context } from './context-zkZeILpr.js';
2
+
3
+ interface CompactRepairReport {
4
+ removedToolUses: string[];
5
+ removedToolResults: string[];
6
+ removedMessages: number;
7
+ }
8
+ interface CompactReport {
9
+ /**
10
+ * Token count of messages only (pre-compaction).
11
+ * Use `fullRequestTokensBefore` for accurate context-window load calculations.
12
+ */
13
+ before: number;
14
+ /**
15
+ * Token count of messages only (post-compaction).
16
+ * Use `fullRequestTokensAfter` for accurate context-window load calculations.
17
+ */
18
+ after: number;
19
+ /**
20
+ * Full API request token count before compaction: messages + systemPrompt + toolDefs.
21
+ * This is the accurate figure for context-window pressure monitoring.
22
+ */
23
+ fullRequestTokensBefore: number;
24
+ /**
25
+ * Full API request token count after compaction: messages + systemPrompt + toolDefs.
26
+ * This is the accurate figure for context-window pressure monitoring.
27
+ */
28
+ fullRequestTokensAfter: number;
29
+ reductions: {
30
+ phase: 'elision' | 'summary' | 'selective';
31
+ saved: number;
32
+ }[];
33
+ repaired?: CompactRepairReport;
34
+ }
35
+ interface Compactor {
36
+ compact(ctx: Context, opts?: {
37
+ aggressive?: boolean;
38
+ }): Promise<CompactReport>;
39
+ }
40
+
41
+ export type { CompactReport as C, Compactor as a };
@@ -1,5 +1,5 @@
1
1
  import { W as WireFamily } from './models-registry-BcYJDKLm.js';
2
- import { P as Permission } from './context-BRNbHmRM.js';
2
+ import { P as Permission } from './context-zkZeILpr.js';
3
3
 
4
4
  type ContextWindowModeId = 'balanced' | 'frugal' | 'deep' | 'archival';
5
5
  type ContextWindowAggressiveOn = 'hard' | 'soft' | 'warn';
@@ -730,6 +730,29 @@ type SessionEvent = {
730
730
  ts: string;
731
731
  toPromptIndex: number;
732
732
  revertedFiles: string[];
733
+ } | {
734
+ /**
735
+ * Idea #1 from IDEAS.md — Stateful Session Recovery.
736
+ *
737
+ * Marks the start of "the process is currently working on this
738
+ * point in the log". If the process exits cleanly, a matching
739
+ * `in_flight_end` follows. If the process dies (crash, OOM,
740
+ * machine sleep, SIGKILL) the marker is the last event in the
741
+ * file — and `SessionRecovery.detectStale` flags the session
742
+ * as resumable.
743
+ *
744
+ * `context` is a free-form description of the current
745
+ * operation (e.g. "iteration 14 / tool: read / id: tu-7") so
746
+ * the recovery UI can show "what was the agent doing when it
747
+ * died?".
748
+ */
749
+ type: 'in_flight_start';
750
+ ts: string;
751
+ context: string;
752
+ } | {
753
+ type: 'in_flight_end';
754
+ ts: string;
755
+ reason: 'clean' | 'aborted' | 'recovered';
733
756
  };
734
757
  type FileSnapshot = {
735
758
  path: string;
@@ -821,6 +844,29 @@ interface SessionWriter {
821
844
  * Called by /clear to wipe chat history from persistent storage.
822
845
  */
823
846
  clearSession(): Promise<void>;
847
+ /**
848
+ * Idea #1 from IDEAS.md — Stateful Session Recovery.
849
+ *
850
+ * Writes an `in_flight_start` event at the current point in the
851
+ * log. The agent loop should call this at the start of every
852
+ * long-running operation (an iteration, a tool execution, a
853
+ * streaming LLM call) so that a crashed process leaves a
854
+ * visible "what was I doing?" marker. Pair with
855
+ * `clearInFlightMarker` on clean shutdown.
856
+ *
857
+ * The `context` string is surfaced verbatim by
858
+ * `SessionRecovery.detectStale` and the `/resume --incomplete`
859
+ * CLI command, so prefer something a human can read at a glance:
860
+ * "iteration 14 / tool: read / id: tu-7"
861
+ */
862
+ writeInFlightMarker(context: string): Promise<void>;
863
+ /**
864
+ * Writes an `in_flight_end` event. Call on every clean exit
865
+ * point (after a successful iteration, after the user issues
866
+ * /exit, after a graceful SIGINT, etc.). The `reason` is
867
+ * surfaced in the session log for postmortem review.
868
+ */
869
+ clearInFlightMarker(reason: 'clean' | 'aborted' | 'recovered'): Promise<void>;
824
870
  }
825
871
 
826
872
  interface CacheStats {
@@ -1,20 +1,20 @@
1
- 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, C as CreateDelegateToolOptions, D as DEFAULT_DIRECTOR_PREAMBLE, h as DEFAULT_SUBAGENT_BASELINE, i as DelegateHost, j as Director, k as DirectorPromptParts, l as DirectorSessionFactory, m as DirectorSessionFactoryOptions, F as FLEET_ROSTER, n as FLEET_ROSTER_BUDGETS, o as FLEET_ROSTER_WITHACP, p as FleetCostCapError, q as FleetManager, r as FleetManagerOptions, s as FleetRosterBudget, t as FleetSpawnBudgetError, I as ICoordinator, u as IFleetManager, N 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, E as createDelegateTool, G as getAgentDefinition, H as makeAskTool, J as makeAssignTool, K as makeAwaitTasksTool, L as makeCollabDebugTool, M as makeDirectorSessionFactory, O as makeFleetEmitTool, P as makeFleetHealthTool, Q as makeFleetSessionTool, T as makeFleetStatusTool, U as makeFleetUsageTool, V as makeRollUpTool, W as makeSpawnTool, X as makeTerminateTool, Y as rosterSummaryFromConfigs } from '../null-fleet-bus-DKM3Iy9d.js';
2
- import { b as AgentDefinition } from '../multi-agent-coordinator-bRaI_aD1.js';
3
- export { T as AGENT_TOOL_PRESETS, A as AgentBudgetTier, a as AgentCapability, c as AgentPhase, D as DEFAULT_DISPATCH_ROLE, d as DefaultMultiAgentCoordinator, e as DispatchCandidate, f 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-bRaI_aD1.js';
4
- export { c as BudgetExceededError, d as BudgetKind, e as BudgetLimits, f as BudgetNegotiationMode, g as BudgetThresholdDecision, h as BudgetThresholdHandler, i as BudgetThresholdSignal, j as BudgetUsage, m as SubagentBudget } from '../multi-agent-3ZnTB1aT.js';
5
- export { A as AgentFactory, a as AgentFactoryResult, b as AgentRunnerOptions, F as FleetBus, c as FleetEvent, d as FleetHandler, e as FleetUsage, f as FleetUsageAggregator, S as SubagentUsageSnapshot, m as makeAgentSubagentRunner } from '../agent-subagent-runner-C4qt9e5Y.js';
6
- export { I as InMemoryAgentBridge, a as InMemoryBridgeTransport, c as createMessage } from '../agent-bridge-DMVOX0cF.js';
7
- import '../context-BRNbHmRM.js';
8
- import '../director-state-BmYi3DGA.js';
9
- import '../events-CiG9qUM_.js';
1
+ 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, s as Director, 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, H as FleetManager, I as FleetManagerOptions, J as FleetRosterBudget, K as FleetSpawnBudgetError, L as ICoordinator, M as IFleetManager, N as NULL_FLEET_BUS, R as REFACTOR_PLANNER_AGENT, O as RefactorPhase, P as RefactorPlan, S as SECURITY_SCANNER_AGENT, Q as SharedFileEntry, T as SharedFileSnapshot, U as SubagentPromptParts, V as applyRosterBudget, W as attachAutoExtend, X as composeDirectorPrompt, Y as composeSubagentPrompt, Z as createDelegateTool, _ as getAgentDefinition, $ as makeAskTool, a0 as makeAssignTool, a1 as makeAwaitTasksTool, a2 as makeCollabDebugTool, a3 as makeDirectorSessionFactory, a4 as makeFleetEmitTool, a5 as makeFleetHealthTool, a6 as makeFleetSessionTool, a7 as makeFleetStatusTool, a8 as makeFleetUsageTool, a9 as makeRollUpTool, aa as makeSpawnTool, ab as makeTerminateTool, ac as makeWorkCompleteTool, ad as rosterSummaryFromConfigs } from '../null-fleet-bus-Dnl19vmf.js';
2
+ import { b as AgentDefinition } from '../multi-agent-coordinator-CAhsegPz.js';
3
+ export { T as AGENT_TOOL_PRESETS, A as AgentBudgetTier, a as AgentCapability, c as AgentPhase, D as DEFAULT_DISPATCH_ROLE, d as DefaultMultiAgentCoordinator, e as DispatchCandidate, f 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-CAhsegPz.js';
4
+ export { c as BudgetExceededError, d as BudgetKind, e as BudgetLimits, f as BudgetNegotiationMode, g as BudgetThresholdDecision, h as BudgetThresholdHandler, i as BudgetThresholdSignal, j as BudgetUsage, m as SubagentBudget } from '../multi-agent-DNp6lAzg.js';
5
+ export { A as AgentFactory, a as AgentFactoryResult, b as AgentRunnerOptions, F as FleetBus, c as FleetEvent, d as FleetHandler, e as FleetUsage, f as FleetUsageAggregator, S as SubagentUsageSnapshot, m as makeAgentSubagentRunner } from '../agent-subagent-runner-U-rs7kk7.js';
6
+ export { I as InMemoryAgentBridge, a as InMemoryBridgeTransport, c as createMessage } from '../agent-bridge-Dti3KXGk.js';
7
+ import '../context-zkZeILpr.js';
10
8
  import 'node:events';
11
- import '../index-aizK8olO.js';
9
+ import '../director-state-BmYi3DGA.js';
10
+ import '../events-DH-9r-_C.js';
11
+ import '../index-BIHJ4uII.js';
12
12
  import '../logger-DDd5C--Z.js';
13
- import '../system-prompt-Bs-Wliab.js';
13
+ import '../system-prompt-CneIxVip.js';
14
14
  import '../observability-BhnVLBLS.js';
15
15
  import '../secret-scrubber-3MHDDAtm.js';
16
- import '../permission-bPuzAy4x.js';
17
- import '../config-CWva0qoL.js';
16
+ import '../permission-H35s9Evv.js';
17
+ import '../config-CLXMDOSs.js';
18
18
  import '../models-registry-BcYJDKLm.js';
19
19
 
20
20
  /** Phase 1 · Discovery — map the territory before any work begins. */