@wrongstack/core 0.291.2 → 0.292.1

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 (136) hide show
  1. package/dist/coordination/director-tools.d.ts.map +1 -1
  2. package/dist/coordination/index.d.ts +1 -1
  3. package/dist/coordination/index.d.ts.map +1 -1
  4. package/dist/coordination/index.js +276 -152
  5. package/dist/coordination/index.js.map +4 -4
  6. package/dist/coordination/mailbox-http-router.d.ts +38 -0
  7. package/dist/coordination/mailbox-http-router.d.ts.map +1 -1
  8. package/dist/coordination/provider-status-tracker.d.ts.map +1 -1
  9. package/dist/core/agent-loop.d.ts.map +1 -1
  10. package/dist/core/agent-response.d.ts.map +1 -1
  11. package/dist/core/context.d.ts +10 -0
  12. package/dist/core/context.d.ts.map +1 -1
  13. package/dist/core/fallback-model.d.ts.map +1 -1
  14. package/dist/core/system-prompt-builder.d.ts +20 -1
  15. package/dist/core/system-prompt-builder.d.ts.map +1 -1
  16. package/dist/defaults/index.d.ts +1 -0
  17. package/dist/defaults/index.d.ts.map +1 -1
  18. package/dist/defaults/index.js +3137 -2441
  19. package/dist/defaults/index.js.map +4 -4
  20. package/dist/execution/auto-compaction-middleware.d.ts +34 -2
  21. package/dist/execution/auto-compaction-middleware.d.ts.map +1 -1
  22. package/dist/execution/compaction-core.d.ts +59 -0
  23. package/dist/execution/compaction-core.d.ts.map +1 -1
  24. package/dist/execution/compactor.d.ts.map +1 -1
  25. package/dist/execution/error-handler.d.ts +7 -0
  26. package/dist/execution/error-handler.d.ts.map +1 -1
  27. package/dist/execution/index.d.ts +1 -0
  28. package/dist/execution/index.d.ts.map +1 -1
  29. package/dist/execution/index.js +4684 -3924
  30. package/dist/execution/index.js.map +4 -4
  31. package/dist/execution/intelligent-compactor.d.ts.map +1 -1
  32. package/dist/execution/model-runtime.d.ts.map +1 -1
  33. package/dist/execution/one-shot-llm.d.ts.map +1 -1
  34. package/dist/execution/selective-compactor.d.ts +10 -0
  35. package/dist/execution/selective-compactor.d.ts.map +1 -1
  36. package/dist/execution/subagent-compaction.d.ts +24 -0
  37. package/dist/execution/subagent-compaction.d.ts.map +1 -0
  38. package/dist/hq/alerts.d.ts +5 -0
  39. package/dist/hq/alerts.d.ts.map +1 -1
  40. package/dist/hq/auth-audit.d.ts +115 -0
  41. package/dist/hq/auth-audit.d.ts.map +1 -0
  42. package/dist/hq/auth-store.d.ts +98 -2
  43. package/dist/hq/auth-store.d.ts.map +1 -1
  44. package/dist/hq/brain-bridge.d.ts +2 -8
  45. package/dist/hq/brain-bridge.d.ts.map +1 -1
  46. package/dist/hq/bridge-context.d.ts +74 -0
  47. package/dist/hq/bridge-context.d.ts.map +1 -0
  48. package/dist/hq/cost-bridge.d.ts +4 -10
  49. package/dist/hq/cost-bridge.d.ts.map +1 -1
  50. package/dist/hq/fleet-bridge.d.ts +2 -8
  51. package/dist/hq/fleet-bridge.d.ts.map +1 -1
  52. package/dist/hq/index.d.ts +2 -0
  53. package/dist/hq/index.d.ts.map +1 -1
  54. package/dist/hq/index.js +358 -222
  55. package/dist/hq/index.js.map +4 -4
  56. package/dist/hq/protocol/session.d.ts +13 -0
  57. package/dist/hq/protocol/session.d.ts.map +1 -1
  58. package/dist/hq/tool-bridge.d.ts +2 -8
  59. package/dist/hq/tool-bridge.d.ts.map +1 -1
  60. package/dist/hq/worktree-bridge.d.ts +2 -8
  61. package/dist/hq/worktree-bridge.d.ts.map +1 -1
  62. package/dist/index.d.ts +4 -2
  63. package/dist/index.d.ts.map +1 -1
  64. package/dist/index.js +6332 -4853
  65. package/dist/index.js.map +4 -4
  66. package/dist/infrastructure/index.js +32 -15
  67. package/dist/infrastructure/index.js.map +2 -2
  68. package/dist/infrastructure/provider-cache-ledger.d.ts +48 -0
  69. package/dist/infrastructure/provider-cache-ledger.d.ts.map +1 -0
  70. package/dist/infrastructure/token-counter.d.ts +4 -2
  71. package/dist/infrastructure/token-counter.d.ts.map +1 -1
  72. package/dist/kernel/events/brain-events.d.ts +2 -0
  73. package/dist/kernel/events/brain-events.d.ts.map +1 -1
  74. package/dist/kernel/events/memory-events.d.ts +102 -0
  75. package/dist/kernel/events/memory-events.d.ts.map +1 -1
  76. package/dist/kernel/events/session-events.d.ts +35 -0
  77. package/dist/kernel/events/session-events.d.ts.map +1 -1
  78. package/dist/models/index.js +161 -78
  79. package/dist/models/index.js.map +3 -3
  80. package/dist/models/llm-selector.d.ts.map +1 -1
  81. package/dist/notifications/index.d.ts +40 -0
  82. package/dist/notifications/index.d.ts.map +1 -0
  83. package/dist/notifications/notifier-impl.d.ts +34 -0
  84. package/dist/notifications/notifier-impl.d.ts.map +1 -0
  85. package/dist/notifications/notifier.d.ts +95 -0
  86. package/dist/notifications/notifier.d.ts.map +1 -0
  87. package/dist/notifications/types.d.ts +111 -0
  88. package/dist/notifications/types.d.ts.map +1 -0
  89. package/dist/plugin/api.d.ts +10 -1
  90. package/dist/plugin/api.d.ts.map +1 -1
  91. package/dist/registry/provider-registry.d.ts +1 -1
  92. package/dist/registry/provider-registry.d.ts.map +1 -1
  93. package/dist/security/index.js +15 -15
  94. package/dist/security/index.js.map +3 -3
  95. package/dist/skills/index.js +80 -80
  96. package/dist/skills/index.js.map +3 -3
  97. package/dist/storage/config-loader.d.ts +3 -5
  98. package/dist/storage/config-loader.d.ts.map +1 -1
  99. package/dist/storage/index.js +325 -259
  100. package/dist/storage/index.js.map +4 -4
  101. package/dist/storage/memory-consolidator.d.ts +14 -2
  102. package/dist/storage/memory-consolidator.d.ts.map +1 -1
  103. package/dist/storage/queue-store.d.ts +2 -0
  104. package/dist/storage/queue-store.d.ts.map +1 -1
  105. package/dist/tools/index.js +14 -7
  106. package/dist/tools/index.js.map +3 -3
  107. package/dist/tools/mcp-control.d.ts +1 -1
  108. package/dist/types/config.d.ts +64 -20
  109. package/dist/types/config.d.ts.map +1 -1
  110. package/dist/types/index.js +65 -35
  111. package/dist/types/index.js.map +3 -3
  112. package/dist/types/plugin.d.ts +11 -0
  113. package/dist/types/plugin.d.ts.map +1 -1
  114. package/dist/types/provider.d.ts +31 -0
  115. package/dist/types/provider.d.ts.map +1 -1
  116. package/dist/types/token-counter.d.ts +8 -1
  117. package/dist/types/token-counter.d.ts.map +1 -1
  118. package/dist/utils/cache-key.d.ts +19 -0
  119. package/dist/utils/cache-key.d.ts.map +1 -0
  120. package/dist/utils/compaction-preview.d.ts +8 -0
  121. package/dist/utils/compaction-preview.d.ts.map +1 -0
  122. package/dist/utils/connectivity.d.ts +36 -0
  123. package/dist/utils/connectivity.d.ts.map +1 -0
  124. package/dist/utils/context-breakdown.d.ts +59 -0
  125. package/dist/utils/context-breakdown.d.ts.map +1 -0
  126. package/dist/utils/context-evidence.d.ts +22 -0
  127. package/dist/utils/context-evidence.d.ts.map +1 -1
  128. package/dist/utils/index.d.ts +3 -0
  129. package/dist/utils/index.d.ts.map +1 -1
  130. package/dist/utils/index.js +1761 -1541
  131. package/dist/utils/index.js.map +4 -4
  132. package/dist/utils/token-estimate.d.ts +27 -0
  133. package/dist/utils/token-estimate.d.ts.map +1 -1
  134. package/instructions/llm/memory-consolidator.md +19 -3
  135. package/instructions/system.md +10 -2
  136. package/package.json +2 -2
@@ -238,6 +238,86 @@ function expectDefined(value, label) {
238
238
  return value;
239
239
  }
240
240
 
241
+ // src/skills/limits.ts
242
+ var SKILL_LIMITS = {
243
+ /**
244
+ * Per-skill body cap when injecting a full skill body into the system prompt
245
+ * (eager mode), and when returning a skill body from the `skill` tool.
246
+ * ~4k tokens. Oversized bodies are truncated at a paragraph boundary.
247
+ *
248
+ * Consumers: `system-prompt-builder.capSkillBody`, `skill` tool body return.
249
+ */
250
+ MAX_SKILL_BODY_CHARS: 16e3,
251
+ /**
252
+ * Per-resource cap when the `skill` tool loads a bundled file
253
+ * (`scripts/`, `references/`, `assets/`). ~8k tokens.
254
+ *
255
+ * Consumer: `skill` tool `loadResource`.
256
+ */
257
+ MAX_RESOURCE_CHARS: 32e3,
258
+ /**
259
+ * Maximum number of bundled resource paths the `skill` tool lists in one
260
+ * response. Caps a pathological skill (huge `assets/` tree) from blowing up
261
+ * the tool result.
262
+ *
263
+ * Consumer: `skill` tool resource listing.
264
+ */
265
+ MAX_LISTED_RESOURCES: 100,
266
+ /**
267
+ * Max size of a single installed skill file (SKILL.md or a bundled resource).
268
+ * Guards against a malicious registry skill shipping a multi-MB blob that
269
+ * then flows into the prompt. 100KB.
270
+ *
271
+ * Consumer: `SkillInstaller.install` / `importFromDir`.
272
+ */
273
+ MAX_SKILL_FILE_SIZE: 100 * 1024,
274
+ /**
275
+ * Max size of a GitHub tarball downloaded by the skill installer. Guards
276
+ * against a repo accidentally (or maliciously) shipping a giant tarball that
277
+ * would be extracted into a temp dir. 50MB.
278
+ *
279
+ * Consumer: `downloadGitHubTarball`.
280
+ */
281
+ MAX_TARBALL_SIZE: 50 * 1024 * 1024,
282
+ /**
283
+ * Default total char budget for skill bodies injected in eager mode when
284
+ * `config.skills.eagerMaxChars` is unset. ~6k tokens. Skills are injected
285
+ * highest-priority first; once the budget is exhausted the remaining skills
286
+ * are listed as a manifest the agent loads via the `skill` tool. Set very
287
+ * high to effectively disable budgeting.
288
+ *
289
+ * Consumer: `DefaultSystemPromptBuilder.buildMemoryAndSkills` (default for
290
+ * `skillEagerMaxChars`).
291
+ */
292
+ EAGER_DEFAULT_MAX_CHARS: 24e3,
293
+ /**
294
+ * Auto-compact body limits (the token-saving fallback used when a skill has
295
+ * no hand-crafted `SKILL.save.md`). The Overview and Rules sections are
296
+ * extracted and trimmed to these char budgets, then the total is capped.
297
+ *
298
+ * Consumer: `DefaultSkillLoader.compactSkillBody`.
299
+ */
300
+ COMPACT_OVERVIEW_MAX: 200,
301
+ COMPACT_RULES_MAX: 350,
302
+ COMPACT_TOTAL_MAX: 450,
303
+ /**
304
+ * Max length of a skill name (agentskills.io spec). Enforced by the
305
+ * frontmatter validator's format regex plus this length bound.
306
+ *
307
+ * Consumer: `isValidSkillNameFormat`.
308
+ */
309
+ SKILL_NAME_MAX_LEN: 64,
310
+ /**
311
+ * Soft line limit for a SKILL.md body, per the bundled `skill-creator` rule.
312
+ * Not enforced in code (a skill can exceed it) — surfaced by `/skill-gen
313
+ * validate` and the `skill-creator` skill as guidance to move deep material
314
+ * into `references/`.
315
+ *
316
+ * Consumer: `skill-creator` skill, `/skill-gen validate` advisory.
317
+ */
318
+ SKILL_BODY_LINE_LIMIT: 500
319
+ };
320
+
241
321
  // src/types/errors.ts
242
322
  var ERROR_CODES = {
243
323
  // Provider
@@ -372,86 +452,6 @@ var ParseError = class extends WrongStackError {
372
452
  }
373
453
  };
374
454
 
375
- // src/skills/limits.ts
376
- var SKILL_LIMITS = {
377
- /**
378
- * Per-skill body cap when injecting a full skill body into the system prompt
379
- * (eager mode), and when returning a skill body from the `skill` tool.
380
- * ~4k tokens. Oversized bodies are truncated at a paragraph boundary.
381
- *
382
- * Consumers: `system-prompt-builder.capSkillBody`, `skill` tool body return.
383
- */
384
- MAX_SKILL_BODY_CHARS: 16e3,
385
- /**
386
- * Per-resource cap when the `skill` tool loads a bundled file
387
- * (`scripts/`, `references/`, `assets/`). ~8k tokens.
388
- *
389
- * Consumer: `skill` tool `loadResource`.
390
- */
391
- MAX_RESOURCE_CHARS: 32e3,
392
- /**
393
- * Maximum number of bundled resource paths the `skill` tool lists in one
394
- * response. Caps a pathological skill (huge `assets/` tree) from blowing up
395
- * the tool result.
396
- *
397
- * Consumer: `skill` tool resource listing.
398
- */
399
- MAX_LISTED_RESOURCES: 100,
400
- /**
401
- * Max size of a single installed skill file (SKILL.md or a bundled resource).
402
- * Guards against a malicious registry skill shipping a multi-MB blob that
403
- * then flows into the prompt. 100KB.
404
- *
405
- * Consumer: `SkillInstaller.install` / `importFromDir`.
406
- */
407
- MAX_SKILL_FILE_SIZE: 100 * 1024,
408
- /**
409
- * Max size of a GitHub tarball downloaded by the skill installer. Guards
410
- * against a repo accidentally (or maliciously) shipping a giant tarball that
411
- * would be extracted into a temp dir. 50MB.
412
- *
413
- * Consumer: `downloadGitHubTarball`.
414
- */
415
- MAX_TARBALL_SIZE: 50 * 1024 * 1024,
416
- /**
417
- * Default total char budget for skill bodies injected in eager mode when
418
- * `config.skills.eagerMaxChars` is unset. ~6k tokens. Skills are injected
419
- * highest-priority first; once the budget is exhausted the remaining skills
420
- * are listed as a manifest the agent loads via the `skill` tool. Set very
421
- * high to effectively disable budgeting.
422
- *
423
- * Consumer: `DefaultSystemPromptBuilder.buildMemoryAndSkills` (default for
424
- * `skillEagerMaxChars`).
425
- */
426
- EAGER_DEFAULT_MAX_CHARS: 24e3,
427
- /**
428
- * Auto-compact body limits (the token-saving fallback used when a skill has
429
- * no hand-crafted `SKILL.save.md`). The Overview and Rules sections are
430
- * extracted and trimmed to these char budgets, then the total is capped.
431
- *
432
- * Consumer: `DefaultSkillLoader.compactSkillBody`.
433
- */
434
- COMPACT_OVERVIEW_MAX: 200,
435
- COMPACT_RULES_MAX: 350,
436
- COMPACT_TOTAL_MAX: 450,
437
- /**
438
- * Max length of a skill name (agentskills.io spec). Enforced by the
439
- * frontmatter validator's format regex plus this length bound.
440
- *
441
- * Consumer: `isValidSkillNameFormat`.
442
- */
443
- SKILL_NAME_MAX_LEN: 64,
444
- /**
445
- * Soft line limit for a SKILL.md body, per the bundled `skill-creator` rule.
446
- * Not enforced in code (a skill can exceed it) — surfaced by `/skill-gen
447
- * validate` and the `skill-creator` skill as guidance to move deep material
448
- * into `references/`.
449
- *
450
- * Consumer: `skill-creator` skill, `/skill-gen validate` advisory.
451
- */
452
- SKILL_BODY_LINE_LIMIT: 500
453
- };
454
-
455
455
  // src/skills/github-fetcher.ts
456
456
  function parseSkillRef(input) {
457
457
  const trimmed = input.trim().replace(/^https?:\/\/github\.com\//, "").replace(/\.git$/, "");