@wrongstack/core 0.6.7 → 0.7.2

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 (56) hide show
  1. package/dist/{agent-bridge-BCVxmrOn.d.ts → agent-bridge-Bji75Iv9.d.ts} +1 -1
  2. package/dist/{compactor-BUJ8550X.d.ts → compactor-BFKGzKd5.d.ts} +1 -1
  3. package/dist/{config-BHkYGzUT.d.ts → config-BXAhlqJb.d.ts} +1 -1
  4. package/dist/{context-C8mBUzBv.d.ts → context-BwxhvyW8.d.ts} +75 -3
  5. package/dist/coordination/index.d.ts +42 -12
  6. package/dist/coordination/index.js +2573 -40
  7. package/dist/coordination/index.js.map +1 -1
  8. package/dist/default-config-DvRSTELf.d.ts +20 -0
  9. package/dist/defaults/index.d.ts +21 -20
  10. package/dist/defaults/index.js +2896 -243
  11. package/dist/defaults/index.js.map +1 -1
  12. package/dist/{director-state-BmYi3DGA.d.ts → director-state-BUB7JRUr.d.ts} +1 -1
  13. package/dist/{events-DounT6pP.d.ts → events-AjrvHJ9V.d.ts} +25 -1
  14. package/dist/execution/index.d.ts +42 -13
  15. package/dist/execution/index.js +2497 -40
  16. package/dist/execution/index.js.map +1 -1
  17. package/dist/extension/index.d.ts +6 -6
  18. package/dist/extension/index.js +3 -1
  19. package/dist/extension/index.js.map +1 -1
  20. package/dist/{index-DiIGZh5I.d.ts → index-B2WWETRP.d.ts} +6 -6
  21. package/dist/index.d.ts +36 -27
  22. package/dist/index.js +2863 -137
  23. package/dist/index.js.map +1 -1
  24. package/dist/infrastructure/index.d.ts +6 -6
  25. package/dist/infrastructure/index.js +12 -0
  26. package/dist/infrastructure/index.js.map +1 -1
  27. package/dist/kernel/index.d.ts +9 -9
  28. package/dist/kernel/index.js +20 -4
  29. package/dist/kernel/index.js.map +1 -1
  30. package/dist/{mcp-servers-CXFfDN_d.d.ts → mcp-servers-BDM2Leff.d.ts} +3 -3
  31. package/dist/models/index.d.ts +2 -2
  32. package/dist/{multi-agent-Iy8YUe3v.d.ts → multi-agent-DenFfUv5.d.ts} +11 -3
  33. package/dist/multi-agent-coordinator-DGUn-5Bb.d.ts +448 -0
  34. package/dist/{index-BlVITqm-.d.ts → null-fleet-bus-DJMbqYhL.d.ts} +105 -107
  35. package/dist/observability/index.d.ts +2 -2
  36. package/dist/{path-resolver-DwJO5XBn.d.ts → path-resolver-C1NM67-u.d.ts} +2 -2
  37. package/dist/{plan-templates-CG_pInJV.d.ts → plan-templates-CNY6f82B.d.ts} +4 -4
  38. package/dist/{provider-runner-DoohzfyD.d.ts → provider-runner-Cmuevptw.d.ts} +3 -3
  39. package/dist/{retry-policy-DOnwHAyz.d.ts → retry-policy-mEBn5qpv.d.ts} +1 -1
  40. package/dist/sdd/index.d.ts +3 -3
  41. package/dist/{secret-scrubber-DcTK9JHC.d.ts → secret-scrubber-BmiGszvl.d.ts} +1 -1
  42. package/dist/{secret-scrubber-C9UJxFCJ.d.ts → secret-scrubber-bZ5AyhwJ.d.ts} +1 -1
  43. package/dist/security/index.d.ts +3 -3
  44. package/dist/{selector-DVo3eT-P.d.ts → selector-BmUma5iG.d.ts} +1 -1
  45. package/dist/{session-reader-BXWxFAhS.d.ts → session-reader-g-FKCyBw.d.ts} +1 -1
  46. package/dist/storage/index.d.ts +6 -6
  47. package/dist/storage/index.js +101 -14
  48. package/dist/storage/index.js.map +1 -1
  49. package/dist/{system-prompt-BBGles-N.d.ts → system-prompt-BKrzd_ci.d.ts} +1 -1
  50. package/dist/{tool-executor-CwpjhwHC.d.ts → tool-executor-BoM0U0qn.d.ts} +6 -5
  51. package/dist/types/index.d.ts +16 -15
  52. package/dist/types/index.js +130 -20
  53. package/dist/types/index.js.map +1 -1
  54. package/dist/utils/index.d.ts +1 -1
  55. package/package.json +1 -1
  56. package/dist/agent-subagent-runner-BTloSwjE.d.ts +0 -174
@@ -105,4 +105,4 @@ declare class DirectorStateCheckpoint {
105
105
  private persist;
106
106
  }
107
107
 
108
- export { DirectorStateCheckpoint as D, type DirectorStateSnapshot as a, type DirectorSubagentState as b, type DirectorTaskState as c, loadDirectorState as l };
108
+ export { type DirectorStateSnapshot as D, DirectorStateCheckpoint as a, type DirectorSubagentState as b, type DirectorTaskState as c, loadDirectorState as l };
@@ -1,4 +1,4 @@
1
- import { U as Usage, a2 as Context, z as ToolProgressEvent, v as Tool } from './context-C8mBUzBv.js';
1
+ import { U as Usage, a5 as Context, D as ToolProgressEvent, x as Tool } from './context-BwxhvyW8.js';
2
2
 
3
3
  /**
4
4
  * EventBus — observe-only typed event bus.
@@ -281,6 +281,21 @@ interface EventMap {
281
281
  used: number;
282
282
  limit: number;
283
283
  };
284
+ /**
285
+ * Emitted when the coordinator/director actually GRANTS a budget
286
+ * extension to a subagent (the resolution of a `budget.threshold_reached`
287
+ * negotiation). Distinct from `subagent.budget_warning`, which fires when
288
+ * a limit is merely *hit*. UIs use this to render a persistent "⚡ extended
289
+ * ×N" badge so users can see how often an agent self-extended to stay
290
+ * alive. `totalExtensions` is the cumulative count for this subagent across
291
+ * all kinds; `newLimit` is the patched value for `kind`.
292
+ */
293
+ 'subagent.budget_extended': {
294
+ subagentId: string;
295
+ kind: string;
296
+ newLimit: number;
297
+ totalExtensions: number;
298
+ };
284
299
  /**
285
300
  * Per-tool-call event re-emitted from a subagent's own EventBus
286
301
  * onto the host EventBus, so the TUI / non-director surfaces can
@@ -433,6 +448,15 @@ declare class EventBus {
433
448
  * Number of wildcard listeners currently registered.
434
449
  */
435
450
  wildcardCount(): number;
451
+ /**
452
+ * True if anything would receive an emit for `event` — a named listener
453
+ * OR a wildcard/regex pattern that matches the event name. Unlike
454
+ * `listenerCount`, this DOES account for wildcards, so callers that gate
455
+ * behavior on "is anyone listening?" (e.g. SubagentBudget deciding whether
456
+ * to negotiate a soft limit vs hard-stop) don't misfire when the only
457
+ * subscriber is a pattern listener like the FleetBus's `onPattern('*')`.
458
+ */
459
+ hasListenerFor(event: string): boolean;
436
460
  }
437
461
  /**
438
462
  * A decorator over `EventBus` that records every listener registration
@@ -1,21 +1,22 @@
1
- export { C as CompactorOptions, a as DefaultErrorHandler, b as DefaultRetryPolicy, H as HybridCompactor, T as ToolExecutor } from '../tool-executor-CwpjhwHC.js';
2
- import { g as Provider, a2 as Context } from '../context-C8mBUzBv.js';
3
- import { a as Compactor, C as CompactReport } from '../compactor-BUJ8550X.js';
4
- import { M as MessageSelector } from '../selector-DVo3eT-P.js';
5
- import { E as EventBus } from '../events-DounT6pP.js';
6
- import { c as MiddlewareHandler } from '../system-prompt-BBGles-N.js';
7
- import { e as ContextWindowAggressiveOn, i as ContextWindowPolicy } from '../config-BHkYGzUT.js';
8
- import { A as Agent, R as RunResult, j as SystemPromptContributor } from '../index-DiIGZh5I.js';
9
- import { D as DoneCondition } from '../multi-agent-Iy8YUe3v.js';
1
+ export { C as CompactorOptions, a as DefaultErrorHandler, b as DefaultRetryPolicy, H as HybridCompactor, T as ToolExecutor } from '../tool-executor-BoM0U0qn.js';
2
+ import { i as Provider, a5 as Context } from '../context-BwxhvyW8.js';
3
+ import { a as Compactor, C as CompactReport } from '../compactor-BFKGzKd5.js';
4
+ import { M as MessageSelector } from '../selector-BmUma5iG.js';
5
+ import { E as EventBus } from '../events-AjrvHJ9V.js';
6
+ import { c as MiddlewareHandler } from '../system-prompt-BKrzd_ci.js';
7
+ import { e as ContextWindowAggressiveOn, i as ContextWindowPolicy } from '../config-BXAhlqJb.js';
8
+ import { A as Agent, R as RunResult, j as SystemPromptContributor } from '../index-B2WWETRP.js';
9
+ import { D as DoneCondition } from '../multi-agent-DenFfUv5.js';
10
10
  import { J as JournalEntry } from '../goal-store-HHgaq5ue.js';
11
- import { A as AgentFactory } from '../agent-subagent-runner-BTloSwjE.js';
11
+ import { c as AgentFactory, i as DispatchClassifier, g as DefaultMultiAgentCoordinator } from '../multi-agent-coordinator-DGUn-5Bb.js';
12
12
  import { a as SkillLoader, b as SkillManifest, S as SkillEntry } from '../skill-CxuWrsKK.js';
13
13
  import { W as WstackPaths } from '../wstack-paths-86YPFktR.js';
14
- import '../retry-policy-DOnwHAyz.js';
14
+ import '../retry-policy-mEBn5qpv.js';
15
15
  import '../models-registry-Y2xbog0E.js';
16
16
  import '../logger-BMQgxvdy.js';
17
17
  import '../observability-BhnVLBLS.js';
18
- import '../secret-scrubber-C9UJxFCJ.js';
18
+ import '../secret-scrubber-bZ5AyhwJ.js';
19
+ import 'node:events';
19
20
 
20
21
  interface SkillLoaderOptions {
21
22
  paths: WstackPaths;
@@ -201,6 +202,13 @@ declare class AutoCompactionMiddleware {
201
202
  private readonly events?;
202
203
  private readonly failureMode;
203
204
  private readonly policyProvider?;
205
+ /**
206
+ * Overhead factor applied to the rough message-token estimate to produce a
207
+ * figure comparable to the real API request size (system prompt + tool defs).
208
+ * Without this factor, raw message tokens undercount real load by 15-50% in
209
+ * short conversations, causing premature compaction triggers.
210
+ */
211
+ private static readonly OVERHEAD_FACTOR;
204
212
  /**
205
213
  * @param compactor Compactor to use for compaction.
206
214
  * @param maxContext Provider's max context window in tokens.
@@ -301,7 +309,8 @@ interface EternalAutonomyOptions {
301
309
  * Maximum number of internal agent.run iterations the engine grants per
302
310
  * eternal-loop tick. The engine sets `autonomousContinue: true` so the
303
311
  * agent can run multi-step tasks end-to-end within one tick instead of
304
- * bouncing back to the engine after every single tool call. Default 50.
312
+ * bouncing back to the engine after every single tool call. Default 500.
313
+ * Previous 50 was far too low — agents hit the limit and restart constantly.
305
314
  */
306
315
  iterationMaxAgentSteps?: number;
307
316
  /**
@@ -546,6 +555,20 @@ interface ParallelEternalOptions {
546
555
  maxContextTokens?: number;
547
556
  /** Override the default agent factory (uses main agent if not provided). */
548
557
  subagentFactory?: AgentFactory;
558
+ /**
559
+ * Route each decomposed slot task to the best-fit catalog agent via the
560
+ * smart dispatcher (heuristic keyword scoring). When enabled (default), each
561
+ * slot spawns in-role — the role's budget tier applies and a persona line is
562
+ * injected into the task — instead of as a faceless generic worker. Set
563
+ * false to keep the legacy generic spawn.
564
+ */
565
+ dispatch?: boolean;
566
+ /**
567
+ * Optional LLM fallback for ambiguous tasks. Passed straight to
568
+ * `dispatchAgent`; when omitted, routing is pure heuristic (instant, no
569
+ * provider call — preferred for a continuously-ticking autonomous loop).
570
+ */
571
+ dispatchClassifier?: DispatchClassifier;
549
572
  }
550
573
  /**
551
574
  * Sense → Decide → Fan-out (4–8 parallel agents) → Aggregate → Loop.
@@ -571,8 +594,14 @@ declare class ParallelEternalEngine {
571
594
  private readonly timeoutMs;
572
595
  private coordinator;
573
596
  private agentFactory;
597
+ private readonly dispatchEnabled;
598
+ private readonly dispatchClassifier?;
574
599
  constructor(opts: ParallelEternalOptions);
575
600
  get currentState(): ParallelEngineState;
601
+ /**
602
+ * Get the underlying coordinator for stats/monitoring.
603
+ */
604
+ getCoordinator(): DefaultMultiAgentCoordinator | null;
576
605
  stop(): void;
577
606
  prime(): Promise<void>;
578
607
  run(): Promise<void>;