@wrongstack/core 0.275.1 → 0.276.3

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 (83) hide show
  1. package/dist/{agent-bridge-D9JkPvJ0.d.ts → agent-bridge-D7A-eu3C.d.ts} +1 -1
  2. package/dist/{agent-subagent-runner-CArSFKFl.d.ts → agent-subagent-runner-CEuw4ATz.d.ts} +16 -10
  3. package/dist/{brain-DCkB5_e7.d.ts → brain-BLOyN5ZP.d.ts} +127 -1
  4. package/dist/{compactor-CzSvxM1g.d.ts → compactor-DcBpaJsI.d.ts} +1 -1
  5. package/dist/{config-BzFRKkg7.d.ts → config-Bf5mj-ad.d.ts} +20 -2
  6. package/dist/{context-BrLe8pJy.d.ts → context-CLnUMW5g.d.ts} +40 -2
  7. package/dist/coordination/index.d.ts +43 -24
  8. package/dist/coordination/index.js +849 -648
  9. package/dist/coordination/index.js.map +1 -1
  10. package/dist/defaults/index.d.ts +28 -28
  11. package/dist/defaults/index.js +1636 -845
  12. package/dist/defaults/index.js.map +1 -1
  13. package/dist/execution/index.d.ts +16 -16
  14. package/dist/execution/index.js +218 -49
  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 +7 -7
  18. package/dist/extension/index.js.map +1 -1
  19. package/dist/{global-mailbox-CXkugtNQ.d.ts → global-mailbox-Iqfkgmwu.d.ts} +3 -3
  20. package/dist/{goal-store-DUwdbdoY.d.ts → goal-store-DGb6b5Ed.d.ts} +1 -1
  21. package/dist/hq/index.d.ts +6 -6
  22. package/dist/hq/index.js +178 -75
  23. package/dist/hq/index.js.map +1 -1
  24. package/dist/{index-CtlizLTK.d.ts → index-Cn0NOshr.d.ts} +10 -5
  25. package/dist/{index-neOCEy6q.d.ts → index-L4RZN9jJ.d.ts} +2 -2
  26. package/dist/index.d.ts +56 -48
  27. package/dist/index.js +2789 -1546
  28. package/dist/index.js.map +1 -1
  29. package/dist/infrastructure/index.d.ts +6 -6
  30. package/dist/infrastructure/index.js +26 -7
  31. package/dist/infrastructure/index.js.map +1 -1
  32. package/dist/kernel/index.d.ts +20 -12
  33. package/dist/kernel/index.js +55 -9
  34. package/dist/kernel/index.js.map +1 -1
  35. package/dist/{mailbox-types-_7gaY0Rl.d.ts → mailbox-types-DTl7bRH3.d.ts} +3 -1
  36. package/dist/{mcp-servers-MLL6bMlv.d.ts → mcp-servers-CuZGf9fI.d.ts} +4 -4
  37. package/dist/models/index.d.ts +5 -5
  38. package/dist/models/index.js +223 -139
  39. package/dist/models/index.js.map +1 -1
  40. package/dist/{models-registry-CrkcxQ-g.d.ts → models-registry-8XOdxWQu.d.ts} +16 -1
  41. package/dist/{multi-agent-coordinator-Dc_HuG9p.d.ts → multi-agent-coordinator-CiRtKVTk.d.ts} +8 -1
  42. package/dist/{null-fleet-bus-BMZwMin7.d.ts → null-fleet-bus-d9G-bVy9.d.ts} +26 -22
  43. package/dist/observability/index.d.ts +2 -2
  44. package/dist/{path-resolver-uVK4BatM.d.ts → path-resolver-BhIb6mtd.d.ts} +8 -3
  45. package/dist/{permission-CJR1qfOi.d.ts → permission-BCbQDR2s.d.ts} +1 -1
  46. package/dist/{permission-policy-DLVKKk4w.d.ts → permission-policy-C0ikndX_.d.ts} +2 -18
  47. package/dist/{pipeline-BYR-Vdau.d.ts → pipeline-Dl6XbfE7.d.ts} +10 -6
  48. package/dist/{provider-model-resolve-iREK_1lG.d.ts → provider-model-resolve-B70epO19.d.ts} +3 -3
  49. package/dist/{provider-runner-i7SQXZuC.d.ts → provider-runner-DZ808MSM.d.ts} +3 -3
  50. package/dist/{retry-policy-BmY5ooh3.d.ts → retry-policy-Dt3_z8Aj.d.ts} +1 -1
  51. package/dist/sdd/index.d.ts +19 -10
  52. package/dist/sdd/index.js +411 -240
  53. package/dist/sdd/index.js.map +1 -1
  54. package/dist/{secret-vault-C9leEMzr.d.ts → secret-vault-BUJ2d1gB.d.ts} +1 -1
  55. package/dist/security/index.d.ts +5 -5
  56. package/dist/security/index.js +30 -6
  57. package/dist/security/index.js.map +1 -1
  58. package/dist/{selector-qjpee9BF.d.ts → selector-BCkWgdwy.d.ts} +1 -1
  59. package/dist/{session-event-bridge-m7y--I-H.d.ts → session-event-bridge-CMvIO59_.d.ts} +1 -1
  60. package/dist/{session-reader-BjLH4V9n.d.ts → session-reader-C8aiChUu.d.ts} +1 -1
  61. package/dist/skills/index.js +1 -0
  62. package/dist/skills/index.js.map +1 -1
  63. package/dist/storage/index.d.ts +68 -30
  64. package/dist/storage/index.js +839 -528
  65. package/dist/storage/index.js.map +1 -1
  66. package/dist/{strategy-compactor-C2bmlWYg.d.ts → strategy-compactor-DI1OHVbB.d.ts} +10 -10
  67. package/dist/{todos-checkpoint-oDS9IBNS.d.ts → todos-checkpoint-Ddd2CGr0.d.ts} +56 -9
  68. package/dist/{tool-executor-D4YdaJ-M.d.ts → tool-executor-Bmd5Ygoo.d.ts} +45 -10
  69. package/dist/tools/index.d.ts +2 -2
  70. package/dist/tools/index.js.map +1 -1
  71. package/dist/types/index.d.ts +20 -20
  72. package/dist/types/index.js +331 -98
  73. package/dist/types/index.js.map +1 -1
  74. package/dist/utils/index.d.ts +16 -3
  75. package/dist/utils/index.js +159 -83
  76. package/dist/utils/index.js.map +1 -1
  77. package/dist/{worktree-manager-A1Efnvs0.d.ts → worktree-manager-DBdl_5rs.d.ts} +4 -1
  78. package/instructions/agents/shadow-agent.md +3 -3
  79. package/instructions/coordination/director-preamble.md +3 -3
  80. package/instructions/modes/research-web.md +4 -4
  81. package/package.json +1 -1
  82. package/skills/research-web/SKILL.md +26 -26
  83. package/skills/research-web/SKILL.save.md +1 -1
@@ -1,9 +1,9 @@
1
1
  export { D as DefaultLogger, a as DefaultLoggerOptions, L as LogFormat } from '../logger-D3lV0cUZ.js';
2
- export { D as DefaultPathResolver, a as DefaultTokenCounter } from '../path-resolver-uVK4BatM.js';
3
- 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-MLL6bMlv.js';
2
+ export { D as DefaultPathResolver, a as DefaultTokenCounter } from '../path-resolver-BhIb6mtd.js';
3
+ 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-CuZGf9fI.js';
4
4
  import '../logger-B63L5bTg.js';
5
- import '../brain-DCkB5_e7.js';
6
- import '../context-BrLe8pJy.js';
7
- import '../config-BzFRKkg7.js';
5
+ import '../brain-BLOyN5ZP.js';
6
+ import '../context-CLnUMW5g.js';
7
+ import '../config-Bf5mj-ad.js';
8
8
  import '../path-resolver-CPRj4bFY.js';
9
- import '../compactor-CzSvxM1g.js';
9
+ import '../compactor-DcBpaJsI.js';
@@ -319,6 +319,7 @@ var DefaultTokenCounter = class {
319
319
  registry;
320
320
  providerId;
321
321
  events;
322
+ sessionId;
322
323
  priceCache = /* @__PURE__ */ new Map();
323
324
  /** Most recently accounted request's tokens. Used for per-request context pressure. */
324
325
  lastInput = 0;
@@ -327,8 +328,13 @@ var DefaultTokenCounter = class {
327
328
  this.registry = opts.registry;
328
329
  this.providerId = opts.providerId;
329
330
  this.events = opts.events;
331
+ this.sessionId = opts.sessionId;
332
+ }
333
+ setSessionId(sessionId) {
334
+ this.sessionId = sessionId;
330
335
  }
331
336
  account(usage, model) {
337
+ const eventSessionId = this.currentSessionId();
332
338
  this.input += usage.input;
333
339
  this.output += usage.output;
334
340
  this.cacheRead += usage.cacheRead ?? 0;
@@ -338,7 +344,7 @@ var DefaultTokenCounter = class {
338
344
  const price = model ? this.priceCache.get(model) : void 0;
339
345
  if (price) {
340
346
  this.applyPrice(usage, price);
341
- this.emitAccounted();
347
+ this.emitAccounted(eventSessionId);
342
348
  return;
343
349
  }
344
350
  if (this.registry && this.providerId && model) {
@@ -352,18 +358,22 @@ var DefaultTokenCounter = class {
352
358
  this.priceCache.set(model, p);
353
359
  this.applyPrice(usage, p);
354
360
  }
355
- this.emitAccounted();
361
+ this.emitAccounted(eventSessionId);
356
362
  }).catch(() => {
357
- this.events?.emit("token.cost_estimate_unavailable", { model: model ?? "<unknown>" });
358
- this.emitAccounted();
363
+ this.events?.emit("token.cost_estimate_unavailable", {
364
+ ...eventSessionId ? { sessionId: eventSessionId } : {},
365
+ model: model ?? "<unknown>"
366
+ });
367
+ this.emitAccounted(eventSessionId);
359
368
  return void 0;
360
369
  });
361
370
  return;
362
371
  }
363
- this.emitAccounted();
372
+ this.emitAccounted(eventSessionId);
364
373
  }
365
374
  /** Synchronous variant for code paths that have already resolved the model. */
366
375
  accountWithModel(usage, resolved) {
376
+ const eventSessionId = this.currentSessionId();
367
377
  this.input += usage.input;
368
378
  this.output += usage.output;
369
379
  this.cacheRead += usage.cacheRead ?? 0;
@@ -377,7 +387,7 @@ var DefaultTokenCounter = class {
377
387
  }
378
388
  this.priceCache.set(resolved.modelId, price);
379
389
  this.applyPrice(usage, price);
380
- this.emitAccounted();
390
+ this.emitAccounted(eventSessionId);
381
391
  }
382
392
  total() {
383
393
  return {
@@ -390,6 +400,10 @@ var DefaultTokenCounter = class {
390
400
  currentRequestTokens() {
391
401
  return { input: this.lastInput, cacheRead: this.lastCacheRead };
392
402
  }
403
+ setCurrentRequestTokens(input, cacheRead) {
404
+ this.lastInput = input;
405
+ this.lastCacheRead = cacheRead ?? 0;
406
+ }
393
407
  estimateCost() {
394
408
  return {
395
409
  input: round4(this.costInput),
@@ -410,12 +424,17 @@ var DefaultTokenCounter = class {
410
424
  invalidateCache() {
411
425
  this.priceCache.clear();
412
426
  }
413
- emitAccounted() {
427
+ emitAccounted(sessionId = this.currentSessionId()) {
414
428
  this.events?.emit("token.accounted", {
429
+ ...sessionId ? { sessionId } : {},
415
430
  usage: this.total(),
416
431
  cost: { input: this.costInput, output: this.costOutput, total: this.costInput + this.costOutput }
417
432
  });
418
433
  }
434
+ currentSessionId() {
435
+ const value = typeof this.sessionId === "function" ? this.sessionId() : this.sessionId;
436
+ return typeof value === "string" && value.length > 0 ? value : void 0;
437
+ }
419
438
  reset() {
420
439
  this.input = 0;
421
440
  this.output = 0;