@wrongstack/core 0.10.2 → 0.24.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 (44) hide show
  1. package/dist/{agent-bridge-DBBGP5O4.d.ts → agent-bridge-D_XcS2HL.d.ts} +3 -1
  2. package/dist/{agent-subagent-runner-KwufTWwn.d.ts → agent-subagent-runner-DpZTLdBe.d.ts} +13 -3
  3. package/dist/{config-CJXBka2r.d.ts → config-BUEGM4JP.d.ts} +2 -0
  4. package/dist/coordination/index.d.ts +9 -9
  5. package/dist/coordination/index.js +83 -21
  6. package/dist/coordination/index.js.map +1 -1
  7. package/dist/defaults/index.d.ts +13 -13
  8. package/dist/defaults/index.js +89 -23
  9. package/dist/defaults/index.js.map +1 -1
  10. package/dist/{events-Bw1K5E6K.d.ts → events-BrQiweXN.d.ts} +1 -1
  11. package/dist/execution/index.d.ts +7 -7
  12. package/dist/execution/index.js +32 -10
  13. package/dist/execution/index.js.map +1 -1
  14. package/dist/extension/index.d.ts +3 -3
  15. package/dist/{index-DIt5TIaF.d.ts → index-pXJdVLe0.d.ts} +3 -3
  16. package/dist/{index-DgQWnZxP.d.ts → index-ysfO_DlX.d.ts} +2 -2
  17. package/dist/index.d.ts +20 -20
  18. package/dist/index.js +226 -101
  19. package/dist/index.js.map +1 -1
  20. package/dist/infrastructure/index.d.ts +4 -4
  21. package/dist/kernel/index.d.ts +4 -4
  22. package/dist/kernel/index.js.map +1 -1
  23. package/dist/{mcp-servers-BgINZzuo.d.ts → mcp-servers-BzB3r7_c.d.ts} +1 -1
  24. package/dist/{multi-agent-C1O8EFzb.d.ts → multi-agent-C8Z1i__e.d.ts} +2 -2
  25. package/dist/{multi-agent-coordinator-DoVSBFNx.d.ts → multi-agent-coordinator-Dcsc5t4-.d.ts} +8 -3
  26. package/dist/{null-fleet-bus-T-s3JaOt.d.ts → null-fleet-bus-Cq4YKOiW.d.ts} +28 -23
  27. package/dist/observability/index.d.ts +1 -1
  28. package/dist/{path-resolver-BfyK-I7w.d.ts → path-resolver-DumKAi0n.d.ts} +1 -1
  29. package/dist/{plan-templates-BWs6Je7j.d.ts → plan-templates-BZMi-VpU.d.ts} +3 -3
  30. package/dist/{provider-runner-BmPe2RuU.d.ts → provider-runner-Dlv8Fvw9.d.ts} +1 -1
  31. package/dist/sdd/index.d.ts +5 -5
  32. package/dist/sdd/index.js +30 -8
  33. package/dist/sdd/index.js.map +1 -1
  34. package/dist/security/index.js +3 -3
  35. package/dist/security/index.js.map +1 -1
  36. package/dist/{session-reader-CCSBfQmd.d.ts → session-reader-bfgsy2a0.d.ts} +7 -3
  37. package/dist/storage/index.d.ts +30 -11
  38. package/dist/storage/index.js +131 -65
  39. package/dist/storage/index.js.map +1 -1
  40. package/dist/{tool-executor-D7RxLtg4.d.ts → tool-executor-BAi4WI2d.d.ts} +1 -1
  41. package/dist/types/index.d.ts +9 -9
  42. package/dist/types/index.js +25 -5
  43. package/dist/types/index.js.map +1 -1
  44. package/package.json +1 -1
@@ -190,7 +190,7 @@ interface EventMap {
190
190
  * runner/budget classes.
191
191
  */
192
192
  'budget.threshold_reached': {
193
- kind: 'iterations' | 'tool_calls' | 'tokens' | 'cost' | 'timeout';
193
+ kind: 'iterations' | 'tool_calls' | 'tokens' | 'cost' | 'timeout' | 'idle_timeout';
194
194
  used: number;
195
195
  limit: number;
196
196
  /**
@@ -1,15 +1,15 @@
1
- export { C as CompactorOptions, a as DefaultErrorHandler, b as DefaultRetryPolicy, H as HybridCompactor, T as ToolExecutor } from '../tool-executor-D7RxLtg4.js';
1
+ export { C as CompactorOptions, a as DefaultErrorHandler, b as DefaultRetryPolicy, H as HybridCompactor, T as ToolExecutor } from '../tool-executor-BAi4WI2d.js';
2
2
  import { m as Provider, d as Context } from '../context-7u93AcGD.js';
3
3
  import { a as Compactor, C as CompactReport } from '../compactor-D1RHFRmF.js';
4
4
  import { M as MessageSelector } from '../selector-DmXxpFyM.js';
5
- import { E as EventBus } from '../events-Bw1K5E6K.js';
5
+ import { E as EventBus } from '../events-BrQiweXN.js';
6
6
  import { b as MiddlewareHandler } from '../system-prompt-CM6zOhd2.js';
7
7
  import { a as SessionEventBridge, J as JournalEntry } from '../goal-store-BeRsj7YX.js';
8
- import { e as ContextWindowAggressiveOn, i as ContextWindowPolicy } from '../config-CJXBka2r.js';
9
- import { c as Agent, R as RunResult, w as SystemPromptContributor } from '../index-DgQWnZxP.js';
10
- import { D as DoneCondition } from '../multi-agent-C1O8EFzb.js';
11
- import { A as AgentFactory } from '../agent-subagent-runner-KwufTWwn.js';
12
- import { f as DispatchClassifier, d as DefaultMultiAgentCoordinator } from '../multi-agent-coordinator-DoVSBFNx.js';
8
+ import { e as ContextWindowAggressiveOn, i as ContextWindowPolicy } from '../config-BUEGM4JP.js';
9
+ import { c as Agent, R as RunResult, w as SystemPromptContributor } from '../index-ysfO_DlX.js';
10
+ import { D as DoneCondition } from '../multi-agent-C8Z1i__e.js';
11
+ import { A as AgentFactory } from '../agent-subagent-runner-DpZTLdBe.js';
12
+ import { f as DispatchClassifier, d as DefaultMultiAgentCoordinator } from '../multi-agent-coordinator-Dcsc5t4-.js';
13
13
  import { a as SkillLoader, b as SkillManifest, S as SkillEntry } from '../skill-CxuWrsKK.js';
14
14
  import { a as WstackPaths } from '../wstack-paths-eMXnY1_X.js';
15
15
  import '../retry-policy-KF18W4dg.js';
@@ -1282,13 +1282,13 @@ var DANGEROUS_FOR_SUBAGENTS = [
1282
1282
  function hasDangerousCapabilityForSubagents(toolOrCaps) {
1283
1283
  if (!toolOrCaps) return false;
1284
1284
  const input = toolOrCaps;
1285
- const caps = Array.isArray(input) ? input : input?.capabilities ?? [];
1285
+ const caps = Array.isArray(toolOrCaps) ? toolOrCaps : input.capabilities ?? [];
1286
1286
  return caps.some((c) => DANGEROUS_FOR_SUBAGENTS.includes(c));
1287
1287
  }
1288
1288
  function getDangerousCapabilities(toolOrCaps) {
1289
1289
  if (!toolOrCaps) return [];
1290
1290
  const input = toolOrCaps;
1291
- const caps = Array.isArray(input) ? input : input?.capabilities ?? [];
1291
+ const caps = Array.isArray(toolOrCaps) ? toolOrCaps : input.capabilities ?? [];
1292
1292
  return caps.filter(
1293
1293
  (c) => DANGEROUS_FOR_SUBAGENTS.includes(c)
1294
1294
  );
@@ -2825,8 +2825,9 @@ var SubagentBudget = class _SubagentBudget {
2825
2825
  if (elapsedMs !== void 0) {
2826
2826
  const idle = this.idleMs();
2827
2827
  if (this.limits.idleTimeoutMs !== void 0 && idle > this.limits.idleTimeoutMs) {
2828
- exceeded.push({ kind: "timeout", used: idle, limit: this.limits.idleTimeoutMs });
2829
- } else if (this.limits.timeoutMs !== void 0 && elapsedMs > this.limits.timeoutMs) {
2828
+ exceeded.push({ kind: "idle_timeout", used: idle, limit: this.limits.idleTimeoutMs });
2829
+ }
2830
+ if (this.limits.timeoutMs !== void 0 && elapsedMs > this.limits.timeoutMs) {
2830
2831
  exceeded.push({ kind: "timeout", used: elapsedMs, limit: this.limits.timeoutMs });
2831
2832
  }
2832
2833
  }
@@ -5861,10 +5862,6 @@ var DefaultMultiAgentCoordinator = class extends EventEmitter {
5861
5862
  this.drainPendingAsAborted("Coordinator stopAll() drained the pending queue");
5862
5863
  await Promise.allSettled([...this.subagents.keys()].map((id) => this.stop(id)));
5863
5864
  }
5864
- async remove(subagentId) {
5865
- await this.stop(subagentId);
5866
- this.subagents.delete(subagentId);
5867
- }
5868
5865
  /**
5869
5866
  * Get current coordinator stats for monitoring/debugging.
5870
5867
  */
@@ -6130,7 +6127,7 @@ var DefaultMultiAgentCoordinator = class extends EventEmitter {
6130
6127
  durationMs: Date.now() - startTime
6131
6128
  };
6132
6129
  } catch (err) {
6133
- const status = err instanceof BudgetExceededError && err.kind === "timeout" ? "timeout" : subagent.abortController.signal.aborted ? "stopped" : "failed";
6130
+ const status = err instanceof BudgetExceededError && (err.kind === "timeout" || err.kind === "idle_timeout") ? "timeout" : subagent.abortController.signal.aborted ? "stopped" : "failed";
6134
6131
  const usage = budget.usage();
6135
6132
  result = {
6136
6133
  subagentId,
@@ -6284,6 +6281,30 @@ var DefaultMultiAgentCoordinator = class extends EventEmitter {
6284
6281
  });
6285
6282
  }
6286
6283
  }
6284
+ /**
6285
+ * Stop a subagent and remove it from the coordinator. Releases all
6286
+ * associated resources (AbortController, context, budget state).
6287
+ * The subagent entry is deleted so the id can be reused in a future spawn.
6288
+ */
6289
+ async remove(subagentId) {
6290
+ const subagent = this.subagents.get(subagentId);
6291
+ if (!subagent) return;
6292
+ if (subagent.status === "running" || subagent.status === "idle") {
6293
+ this.terminating.add(subagentId);
6294
+ subagent.abortController.abort();
6295
+ subagent.status = "stopped";
6296
+ }
6297
+ this.subagents.delete(subagentId);
6298
+ this.terminating.delete(subagentId);
6299
+ this.pendingTasks = this.pendingTasks.filter((t) => t.subagentId !== subagentId);
6300
+ this.fleetBus?.emit({
6301
+ subagentId,
6302
+ ts: Date.now(),
6303
+ type: "subagent.removed",
6304
+ payload: { subagentId }
6305
+ });
6306
+ this.emitCoordinatorStats();
6307
+ }
6287
6308
  isDone() {
6288
6309
  if (this.config.doneCondition.type === "all_tasks_done") {
6289
6310
  return this.pendingTasks.length === 0 && this.inFlight === 0;
@@ -6307,7 +6328,8 @@ function classifySubagentError(err, hints = {}) {
6307
6328
  tool_calls: "budget_tool_calls",
6308
6329
  tokens: "budget_tokens",
6309
6330
  cost: "budget_cost",
6310
- timeout: "budget_timeout"
6331
+ timeout: "budget_timeout",
6332
+ idle_timeout: "budget_timeout"
6311
6333
  };
6312
6334
  return {
6313
6335
  kind: map[err.kind],