@wrongstack/core 0.6.6 → 0.6.7

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 (48) hide show
  1. package/dist/{agent-bridge-BBXK_ppx.d.ts → agent-bridge-BCVxmrOn.d.ts} +1 -1
  2. package/dist/{agent-subagent-runner-DsSm9lKN.d.ts → agent-subagent-runner-BTloSwjE.d.ts} +3 -3
  3. package/dist/{compactor-C8NhpSt5.d.ts → compactor-BUJ8550X.d.ts} +1 -1
  4. package/dist/{config-DfC6g6KV.d.ts → config-BHkYGzUT.d.ts} +1 -1
  5. package/dist/{context-DN5v-uQX.d.ts → context-C8mBUzBv.d.ts} +3 -5
  6. package/dist/coordination/index.d.ts +10 -10
  7. package/dist/coordination/index.js +62 -30
  8. package/dist/coordination/index.js.map +1 -1
  9. package/dist/defaults/index.d.ts +19 -19
  10. package/dist/defaults/index.js +94 -32
  11. package/dist/defaults/index.js.map +1 -1
  12. package/dist/{events-CJqwQl8G.d.ts → events-DounT6pP.d.ts} +10 -1
  13. package/dist/execution/index.d.ts +20 -12
  14. package/dist/execution/index.js +59 -18
  15. package/dist/execution/index.js.map +1 -1
  16. package/dist/extension/index.d.ts +6 -6
  17. package/dist/{index-CXnWsGBp.d.ts → index-BlVITqm-.d.ts} +6 -9
  18. package/dist/{index-DcnXDPdY.d.ts → index-DiIGZh5I.d.ts} +20 -5
  19. package/dist/index.d.ts +26 -26
  20. package/dist/index.js +212 -127
  21. package/dist/index.js.map +1 -1
  22. package/dist/infrastructure/index.d.ts +6 -6
  23. package/dist/kernel/index.d.ts +9 -9
  24. package/dist/kernel/index.js.map +1 -1
  25. package/dist/{mcp-servers-CevFHHM1.d.ts → mcp-servers-CXFfDN_d.d.ts} +3 -3
  26. package/dist/models/index.d.ts +2 -2
  27. package/dist/{multi-agent-D5IbASk_.d.ts → multi-agent-Iy8YUe3v.d.ts} +4 -4
  28. package/dist/observability/index.d.ts +2 -2
  29. package/dist/{path-resolver-CBx_q1HA.d.ts → path-resolver-DwJO5XBn.d.ts} +2 -2
  30. package/dist/{plan-templates-BEOllUJV.d.ts → plan-templates-CG_pInJV.d.ts} +4 -4
  31. package/dist/{provider-runner-Byh5TcJs.d.ts → provider-runner-DoohzfyD.d.ts} +3 -3
  32. package/dist/{retry-policy-BZSIMxrJ.d.ts → retry-policy-DOnwHAyz.d.ts} +1 -1
  33. package/dist/sdd/index.d.ts +3 -3
  34. package/dist/{secret-scrubber-CT7wefiO.d.ts → secret-scrubber-C9UJxFCJ.d.ts} +1 -1
  35. package/dist/{secret-scrubber-I0QHY_ob.d.ts → secret-scrubber-DcTK9JHC.d.ts} +1 -1
  36. package/dist/security/index.d.ts +3 -3
  37. package/dist/{selector-DDb_mq9X.d.ts → selector-DVo3eT-P.d.ts} +1 -1
  38. package/dist/{session-reader-B9nVkziM.d.ts → session-reader-BXWxFAhS.d.ts} +1 -1
  39. package/dist/storage/index.d.ts +5 -5
  40. package/dist/storage/index.js +1 -1
  41. package/dist/storage/index.js.map +1 -1
  42. package/dist/{system-prompt-gL06H9P4.d.ts → system-prompt-BBGles-N.d.ts} +1 -1
  43. package/dist/{tool-executor-BF7QfYVE.d.ts → tool-executor-CwpjhwHC.d.ts} +4 -4
  44. package/dist/types/index.d.ts +15 -15
  45. package/dist/types/index.js +1 -3
  46. package/dist/types/index.js.map +1 -1
  47. package/dist/utils/index.d.ts +1 -1
  48. package/package.json +1 -1
@@ -1,4 +1,4 @@
1
- import { U as Usage, a2 as Context, z as ToolProgressEvent, v as Tool } from './context-DN5v-uQX.js';
1
+ import { U as Usage, a2 as Context, z as ToolProgressEvent, v as Tool } from './context-C8mBUzBv.js';
2
2
 
3
3
  /**
4
4
  * EventBus — observe-only typed event bus.
@@ -341,6 +341,15 @@ interface EventMap {
341
341
  };
342
342
  };
343
343
  };
344
+ /**
345
+ * Fired by the delegate tool when a subagent finishes. The agent's run
346
+ * loop listens for this to collect `delegateSummaries` for the RunResult,
347
+ * so the CLI/TUI can render flashy completion banners.
348
+ */
349
+ 'subagent.done': {
350
+ summary: string;
351
+ ok: boolean;
352
+ };
344
353
  'mcp.server.connected': {
345
354
  name: string;
346
355
  toolCount: number;
@@ -1,21 +1,21 @@
1
- export { C as CompactorOptions, a as DefaultErrorHandler, b as DefaultRetryPolicy, H as HybridCompactor, T as ToolExecutor } from '../tool-executor-BF7QfYVE.js';
2
- import { g as Provider, a2 as Context } from '../context-DN5v-uQX.js';
3
- import { a as Compactor, C as CompactReport } from '../compactor-C8NhpSt5.js';
4
- import { M as MessageSelector } from '../selector-DDb_mq9X.js';
5
- import { E as EventBus } from '../events-CJqwQl8G.js';
6
- import { c as MiddlewareHandler } from '../system-prompt-gL06H9P4.js';
7
- import { e as ContextWindowAggressiveOn, i as ContextWindowPolicy } from '../config-DfC6g6KV.js';
8
- import { A as Agent, R as RunResult, j as SystemPromptContributor } from '../index-DcnXDPdY.js';
9
- import { D as DoneCondition } from '../multi-agent-D5IbASk_.js';
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';
10
10
  import { J as JournalEntry } from '../goal-store-HHgaq5ue.js';
11
- import { A as AgentFactory } from '../agent-subagent-runner-DsSm9lKN.js';
11
+ import { A as AgentFactory } from '../agent-subagent-runner-BTloSwjE.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-BZSIMxrJ.js';
14
+ import '../retry-policy-DOnwHAyz.js';
15
15
  import '../models-registry-Y2xbog0E.js';
16
16
  import '../logger-BMQgxvdy.js';
17
17
  import '../observability-BhnVLBLS.js';
18
- import '../secret-scrubber-CT7wefiO.js';
18
+ import '../secret-scrubber-C9UJxFCJ.js';
19
19
 
20
20
  interface SkillLoaderOptions {
21
21
  paths: WstackPaths;
@@ -387,6 +387,8 @@ interface EternalAutonomyOptions {
387
387
  transientBackoffBaseMs?: number;
388
388
  /** Ceiling for the exponential backoff. Default 60_000 (60 s). */
389
389
  transientBackoffMaxMs?: number;
390
+ /** Called when the eternal loop stops for any reason (manual stop, goal complete, etc.). */
391
+ onEternalStop?: () => void;
390
392
  }
391
393
  type EternalEngineState = 'idle' | 'running' | 'stopped';
392
394
  /**
@@ -511,6 +513,12 @@ declare class EternalAutonomyEngine {
511
513
  * goal is already `completed`.
512
514
  */
513
515
  private markGoalCompleted;
516
+ /**
517
+ * Manually clear the goal — equivalent to `/goal clear` typed by the user.
518
+ * Sets goalState to `abandoned`, removes the goal file, and fires
519
+ * `onEternalStop` so the REPL returns to normal mode.
520
+ */
521
+ private clearGoalManually;
514
522
  private appendFailure;
515
523
  private persistEngineState;
516
524
  }
@@ -1707,7 +1707,8 @@ function appendJournal(goal, entry) {
1707
1707
  // src/execution/eternal-autonomy.ts
1708
1708
  var execFileP = promisify(execFile);
1709
1709
  var BRAINSTORM_DONE = /* @__PURE__ */ Symbol("brainstorm-done");
1710
- var GOAL_COMPLETE_MARKER = /^\s*\[goal[_\s-]?complete\]\s*$/im;
1710
+ var GOAL_COMPLETE_MARKER = /^\s*\[goal[_\s-]*complete\]\s*$/im;
1711
+ var GOAL_CLEAR_MARKER = /^\s*\[\/?goal\s*clear\]\s*$/im;
1711
1712
  var EternalAutonomyEngine = class {
1712
1713
  constructor(opts) {
1713
1714
  this.opts = opts;
@@ -1933,7 +1934,12 @@ var EternalAutonomyEngine = class {
1933
1934
  emit({ phase: "sleep", ms: cycleGapMs });
1934
1935
  await sleep(cycleGapMs);
1935
1936
  if (GOAL_COMPLETE_MARKER.test(finalText)) {
1936
- await this.markGoalCompleted(action, finalText);
1937
+ await this.clearGoalManually(finalText);
1938
+ this.stopRequested = true;
1939
+ return true;
1940
+ }
1941
+ if (GOAL_CLEAR_MARKER.test(finalText)) {
1942
+ await this.clearGoalManually(finalText);
1937
1943
  this.stopRequested = true;
1938
1944
  return true;
1939
1945
  }
@@ -2233,6 +2239,30 @@ ${recentJournal}` : "No prior iterations.",
2233
2239
  });
2234
2240
  await saveGoal(this.goalPath, withEntry);
2235
2241
  }
2242
+ /**
2243
+ * Manually clear the goal — equivalent to `/goal clear` typed by the user.
2244
+ * Sets goalState to `abandoned`, removes the goal file, and fires
2245
+ * `onEternalStop` so the REPL returns to normal mode.
2246
+ */
2247
+ async clearGoalManually(note) {
2248
+ const current = await loadGoal(this.goalPath);
2249
+ if (current) {
2250
+ const abandoned = { ...current, goalState: "abandoned" };
2251
+ await saveGoal(this.goalPath, abandoned);
2252
+ }
2253
+ try {
2254
+ const { unlink: unlink2 } = await import('fs/promises');
2255
+ await unlink2(this.goalPath);
2256
+ } catch {
2257
+ }
2258
+ this.opts.onEternalStop?.();
2259
+ void this.appendIterationEntry({
2260
+ source: "manual",
2261
+ task: "goal cleared",
2262
+ status: "success",
2263
+ note: note.slice(0, 240)
2264
+ });
2265
+ }
2236
2266
  async appendFailure(task, note) {
2237
2267
  await this.appendIterationEntry({ source: "manual", task, status: "failure", note });
2238
2268
  }
@@ -2300,10 +2330,10 @@ var SubagentBudget = class _SubagentBudget {
2300
2330
  * or hung listener (Director not built / event filter detached mid-run)
2301
2331
  * leaves the budget over-limit and never enforces anything, since
2302
2332
  * `checkLimit` returns synchronously via `void this.checkLimitAsync`.
2303
- * Hardcoded for now most fleets set their own per-task timeout that
2304
- * dwarfs this anyway. 30 s matches the existing event-emit timeoutMs.
2333
+ * Raised from 30s to 60s to give subagents more headroom before
2334
+ * the threshold negotiation times out and triggers a hard stop.
2305
2335
  */
2306
- static DECISION_TIMEOUT_MS = 3e4;
2336
+ static DECISION_TIMEOUT_MS = 6e4;
2307
2337
  /**
2308
2338
  * Injected by the runner when wiring the budget to its EventBus.
2309
2339
  * Used by `checkLimitAsync` to emit `budget.threshold_reached` events.
@@ -2733,13 +2763,19 @@ function providerStatusToCode(status, type) {
2733
2763
  return "PROVIDER_INVALID_REQUEST";
2734
2764
  }
2735
2765
  var FLEET_ROSTER_BUDGETS = {
2736
- "audit-log": { timeoutMs: 8 * 60 * 1e3, maxIterations: 150, maxToolCalls: 500 },
2737
- "bug-hunter": { timeoutMs: 15 * 60 * 1e3, maxIterations: 200, maxToolCalls: 600 },
2738
- "refactor-planner": { timeoutMs: 12 * 60 * 1e3, maxIterations: 180, maxToolCalls: 550 },
2739
- "security-scanner": { timeoutMs: 15 * 60 * 1e3, maxIterations: 200, maxToolCalls: 600 }
2766
+ "audit-log": { timeoutMs: 7.5 * 60 * 60 * 1e3, maxIterations: 5e3, maxToolCalls: 15e3 },
2767
+ "bug-hunter": { timeoutMs: 10 * 60 * 60 * 1e3, maxIterations: 8e3, maxToolCalls: 2e4 },
2768
+ "refactor-planner": { timeoutMs: 7.5 * 60 * 60 * 1e3, maxIterations: 6e3, maxToolCalls: 18e3 },
2769
+ "security-scanner": { timeoutMs: 10 * 60 * 60 * 1e3, maxIterations: 8e3, maxToolCalls: 2e4 }
2770
+ };
2771
+ var GENERIC_SUBAGENT_BUDGET = {
2772
+ timeoutMs: 3 * 60 * 60 * 1e3,
2773
+ maxIterations: 5e3,
2774
+ maxToolCalls: 15e3
2740
2775
  };
2741
2776
  function applyRosterBudget(cfg) {
2742
- const defaultBudget = FLEET_ROSTER_BUDGETS[cfg.role ?? ""];
2777
+ const roleBudget = cfg.role ? FLEET_ROSTER_BUDGETS[cfg.role] : void 0;
2778
+ const defaultBudget = roleBudget ?? (cfg.name ? GENERIC_SUBAGENT_BUDGET : void 0);
2743
2779
  if (!defaultBudget) return cfg;
2744
2780
  return {
2745
2781
  ...cfg,
@@ -2810,7 +2846,7 @@ var DefaultMultiAgentCoordinator = class extends EventEmitter {
2810
2846
  // hasParentBridge() — the type now reflects this.
2811
2847
  parentBridge: null,
2812
2848
  doneCondition: this.config.doneCondition,
2813
- maxConcurrent: this.config.maxConcurrent ?? 4
2849
+ maxConcurrent: this.config.maxConcurrent ?? 16
2814
2850
  };
2815
2851
  this.subagents.set(id, {
2816
2852
  config: { ...subagent, id },
@@ -2937,7 +2973,7 @@ var DefaultMultiAgentCoordinator = class extends EventEmitter {
2937
2973
  }
2938
2974
  }
2939
2975
  canDispatch() {
2940
- const max = this.config.maxConcurrent ?? 4;
2976
+ const max = this.config.maxConcurrent ?? 16;
2941
2977
  return this.inFlight < max && this.pendingTasks.length > 0;
2942
2978
  }
2943
2979
  takeNextDispatchableTask() {
@@ -3031,13 +3067,18 @@ var DefaultMultiAgentCoordinator = class extends EventEmitter {
3031
3067
  task.subagentId = subagentId;
3032
3068
  subagent.context.tasks.push(task);
3033
3069
  this.emit("task.assigned", { task, subagentId });
3070
+ const rawMaxIterations = subagent.config.maxIterations;
3071
+ const rawMaxToolCalls = subagent.config.maxToolCalls;
3072
+ const rawMaxTokens = subagent.config.maxTokens;
3073
+ const rawMaxCostUsd = subagent.config.maxCostUsd;
3074
+ const rawTimeoutMs = subagent.config.timeoutMs;
3034
3075
  const configWithRosterDefaults = applyRosterBudget(subagent.config);
3035
3076
  const budget = new SubagentBudget({
3036
- maxIterations: configWithRosterDefaults.maxIterations ?? this.config.defaultBudget?.maxIterations,
3037
- maxToolCalls: task.maxToolCalls ?? configWithRosterDefaults.maxToolCalls ?? this.config.defaultBudget?.maxToolCalls,
3038
- maxTokens: configWithRosterDefaults.maxTokens ?? this.config.defaultBudget?.maxTokens,
3039
- maxCostUsd: configWithRosterDefaults.maxCostUsd ?? this.config.defaultBudget?.maxCostUsd,
3040
- timeoutMs: task.timeoutMs ?? configWithRosterDefaults.timeoutMs ?? this.config.defaultBudget?.timeoutMs
3077
+ maxIterations: rawMaxIterations ?? this.config.defaultBudget?.maxIterations ?? configWithRosterDefaults.maxIterations,
3078
+ maxToolCalls: rawMaxToolCalls ?? this.config.defaultBudget?.maxToolCalls ?? configWithRosterDefaults.maxToolCalls,
3079
+ maxTokens: rawMaxTokens ?? this.config.defaultBudget?.maxTokens ?? configWithRosterDefaults.maxTokens,
3080
+ maxCostUsd: rawMaxCostUsd ?? this.config.defaultBudget?.maxCostUsd ?? configWithRosterDefaults.maxCostUsd,
3081
+ timeoutMs: rawTimeoutMs ?? this.config.defaultBudget?.timeoutMs ?? configWithRosterDefaults.timeoutMs
3041
3082
  });
3042
3083
  subagent.activeBudget = budget;
3043
3084
  if (!this.runner) {
@@ -3108,7 +3149,7 @@ var DefaultMultiAgentCoordinator = class extends EventEmitter {
3108
3149
  kind: "timeout",
3109
3150
  used: elapsed,
3110
3151
  limit,
3111
- timeoutMs: 3e4,
3152
+ timeoutMs: 6e4,
3112
3153
  extend: (extra) => resolveDecision({ extend: extra }),
3113
3154
  deny: () => resolveDecision("stop")
3114
3155
  });