@wrongstack/core 0.306.3 → 0.307.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 (114) hide show
  1. package/dist/chronicle/index.js +957 -953
  2. package/dist/chronicle/metrics-ingest.d.ts +55 -0
  3. package/dist/chronicle/metrics-schema.d.ts +86 -0
  4. package/dist/chronicle/metrics-store.d.ts +5 -120
  5. package/dist/chronicle/project-server.js +1083 -1084
  6. package/dist/chronicle/sqlite-journal-quota.d.ts +39 -0
  7. package/dist/chronicle/sqlite-journal-schema.d.ts +25 -0
  8. package/dist/chronicle/sqlite-journal.d.ts +12 -177
  9. package/dist/coordination/agents/index.js +1738 -1690
  10. package/dist/coordination/agents/project-agent-capture.d.ts +48 -0
  11. package/dist/coordination/agents/project-agent-identity.d.ts +3 -129
  12. package/dist/coordination/agents/project-agent-roster.d.ts +17 -0
  13. package/dist/coordination/index.js +6103 -5890
  14. package/dist/coordination/mailbox-http-actor-query.d.ts +16 -0
  15. package/dist/coordination/mailbox-http-router.d.ts +0 -48
  16. package/dist/coordination/mailbox-http-sse.d.ts +12 -0
  17. package/dist/coordination/mailbox-message-types.d.ts +71 -0
  18. package/dist/coordination/mailbox-predicates.d.ts +13 -0
  19. package/dist/coordination/mailbox-project-server.js +1 -1
  20. package/dist/coordination/mailbox-session-sync.d.ts +8 -0
  21. package/dist/coordination/mailbox-types.d.ts +6 -793
  22. package/dist/core/agent-loop-context.d.ts +28 -0
  23. package/dist/core/agent-loop-detector.d.ts +25 -0
  24. package/dist/core/conversation-state.d.ts +1 -2
  25. package/dist/core/fallback-doctor.d.ts +72 -0
  26. package/dist/core/fallback-model.d.ts +19 -1
  27. package/dist/core/fallback-profile-manager.d.ts +21 -3
  28. package/dist/core/index.d.ts +2 -1
  29. package/dist/core/index.js +1143 -766
  30. package/dist/defaults/index.js +3833 -3595
  31. package/dist/execution/auto-compaction-middleware.d.ts +64 -0
  32. package/dist/execution/autonomy-brain-llm.d.ts +55 -0
  33. package/dist/execution/autonomy-brain.d.ts +3 -156
  34. package/dist/execution/compaction-budget.d.ts +38 -0
  35. package/dist/execution/compaction-core.d.ts +3 -166
  36. package/dist/execution/compaction-elision.d.ts +58 -0
  37. package/dist/execution/council-orchestrator-helpers.d.ts +39 -0
  38. package/dist/execution/council-orchestrator.d.ts +3 -42
  39. package/dist/execution/council-response-parser.d.ts +56 -0
  40. package/dist/execution/index.d.ts +1 -1
  41. package/dist/execution/index.js +10016 -9903
  42. package/dist/execution/prompt-enhancer.js +11 -3
  43. package/dist/execution/retry-policy.d.ts +27 -0
  44. package/dist/execution/tool-executor-guard.d.ts +18 -0
  45. package/dist/execution/tool-executor-runner.d.ts +12 -0
  46. package/dist/execution/tool-executor.d.ts +0 -75
  47. package/dist/goal/index.js +19 -6
  48. package/dist/hq/index.js +58 -17
  49. package/dist/index.d.ts +2 -1
  50. package/dist/index.js +8731 -7756
  51. package/dist/infrastructure/index.js +24 -1
  52. package/dist/kernel/events/agent-events.d.ts +2 -0
  53. package/dist/kernel/events/provider-events.d.ts +13 -0
  54. package/dist/plugin/index.js +2123 -1918
  55. package/dist/plugins/auto-review-config.d.ts +53 -0
  56. package/dist/plugins/auto-review-git.d.ts +19 -0
  57. package/dist/plugins/auto-review-plugin.d.ts +2 -140
  58. package/dist/plugins/review-finding-verification.d.ts +7 -0
  59. package/dist/prompts/index.d.ts +1 -0
  60. package/dist/prompts/prompt-journal.d.ts +94 -0
  61. package/dist/security/index.js +677 -667
  62. package/dist/security/permission-explain.d.ts +19 -0
  63. package/dist/security/permission-policy.d.ts +0 -101
  64. package/dist/security/yolo-risk.d.ts +5 -4
  65. package/dist/session-catalog/index.js +270 -227
  66. package/dist/session-catalog/project-server.js +277 -234
  67. package/dist/session-catalog/store-rebuild.d.ts +9 -0
  68. package/dist/session-catalog/store-schema.d.ts +48 -0
  69. package/dist/session-catalog/store.d.ts +0 -17
  70. package/dist/storage/cloud-config-sync/sanitize.d.ts +18 -0
  71. package/dist/storage/cloud-config-sync.d.ts +1 -1
  72. package/dist/storage/director-state.d.ts +6 -0
  73. package/dist/storage/file-session-writer.d.ts +2 -58
  74. package/dist/storage/index.d.ts +2 -1
  75. package/dist/storage/index.js +2121 -1736
  76. package/dist/storage/orphan-lock-cleaner.d.ts +15 -0
  77. package/dist/storage/provider-config-watcher.d.ts +9 -0
  78. package/dist/storage/session-recovery.d.ts +9 -0
  79. package/dist/storage/session-store/rename-session.d.ts +16 -0
  80. package/dist/storage/session-store/resume-session.d.ts +26 -0
  81. package/dist/storage/session-store/session-store-clear.d.ts +11 -0
  82. package/dist/storage/session-store/session-store-index.d.ts +13 -0
  83. package/dist/storage/session-store/strict-empty-check.d.ts +7 -0
  84. package/dist/storage/session-store.d.ts +2 -129
  85. package/dist/storage/session-summary-tracker.d.ts +39 -0
  86. package/dist/storage/session-write-buffer.d.ts +43 -0
  87. package/dist/storage/session-writer/session-writer-flush.d.ts +4 -0
  88. package/dist/storage/session-writer/session-writer-summary-tracker.d.ts +28 -0
  89. package/dist/tools/fallback-agent-model-assign-tool.d.ts +18 -0
  90. package/dist/tools/fallback-leader-model-set-tool.d.ts +18 -0
  91. package/dist/tools/fallback-manage-tools.d.ts +8 -45
  92. package/dist/tools/fallback-profile-manage-tool.d.ts +16 -0
  93. package/dist/tools/fallback-provider-key-set-tool.d.ts +17 -0
  94. package/dist/tools/fallback-provider-manage-tool.d.ts +26 -0
  95. package/dist/tools/index.d.ts +1 -1
  96. package/dist/tools/index.js +5150 -5090
  97. package/dist/types/config/root.d.ts +21 -2
  98. package/dist/types/default-config.d.ts +1 -1
  99. package/dist/types/index.d.ts +54 -55
  100. package/dist/types/index.js +953 -932
  101. package/dist/types/runtime-capability-manifest.d.ts +5 -5
  102. package/dist/types/session-markers.d.ts +12 -0
  103. package/dist/types/session-markers.js +19 -0
  104. package/dist/types/session.d.ts +7 -0
  105. package/dist/worktree/worktree-manager.d.ts +1 -1
  106. package/instructions/coordination/subagent-baseline.md +2 -2
  107. package/instructions/llm/prompt-enhancer.md +2 -1
  108. package/instructions/sections/tool/common-patterns.md +21 -0
  109. package/instructions/sections/tool/delegation-compact.md +3 -1
  110. package/instructions/sections/tool/delegation-full.md +5 -1
  111. package/instructions/system-lite.md +28 -3
  112. package/instructions/system-pro.md +37 -8
  113. package/instructions/system.md +4 -2
  114. package/package.json +5 -5
@@ -3158,7 +3158,9 @@ var DEFAULT_TOOLS_CONFIG = Object.freeze({
3158
3158
  perIterationOutputCapBytes: 1e5,
3159
3159
  descriptionMode: Object.freeze({}),
3160
3160
  disabledTools: Object.freeze([]),
3161
- autoExtendLimit: true,
3161
+ // Extension requires an explicit host/user policy. Without that boundary a
3162
+ // nominal maxIterations cap can grow forever in autonomous sessions.
3163
+ autoExtendLimit: false,
3162
3164
  restrictToProjectRoot: true,
3163
3165
  // Off by default: the board is a record of the work, not a permit for it.
3164
3166
  // See ToolsConfig.kanbanGovernance for what turning it on costs and gates.
@@ -3456,6 +3458,10 @@ var IN_PROJECT_ALLOWED_KEYS = /* @__PURE__ */ new Set([
3456
3458
  "fallbackModels",
3457
3459
  "fallbackBridge",
3458
3460
  "fallbackProfiles",
3461
+ // The profile SELECTOR. No broader than its siblings: a repo that can write
3462
+ // `fallbackModels` and `fallbackProfiles` already controls the chain outright,
3463
+ // and this one can only name a profile the user already defined.
3464
+ "fallbackProfile",
3459
3465
  "favoriteModels",
3460
3466
  "favoriteModelsOnly",
3461
3467
  "modelAvailabilitySchedule",
@@ -3503,6 +3509,10 @@ var KNOWN_DENIED_IN_PROJECT = [
3503
3509
  {
3504
3510
  key: "git",
3505
3511
  reason: "Carries git.identity (GIT_AUTHOR_*/GIT_COMMITTER_* injection): a repo-committed config could spoof the author identity written into the victim's commit history (impersonation)."
3512
+ },
3513
+ {
3514
+ key: "fallbackMaxLastResortCandidates",
3515
+ reason: "Bounds how many of the user's OTHER configured providers may be swept in as last-resort failover. Setting it to 0 from a repo-committed config would silently strip that depth during an outage. It was already stripped in practice (absent from the allow-list) but was missing from the key registry, so this gate never checked it."
3506
3516
  }
3507
3517
  ];
3508
3518
  var KNOWN_CONFIG_TOP_LEVEL_KEYS = /* @__PURE__ */ new Set([
@@ -3523,11 +3533,13 @@ var KNOWN_CONFIG_TOP_LEVEL_KEYS = /* @__PURE__ */ new Set([
3523
3533
  "fallbackModels",
3524
3534
  "fallbackBridge",
3525
3535
  "fallbackProfiles",
3536
+ "fallbackProfile",
3526
3537
  "favoriteModels",
3527
3538
  "favoriteModelsOnly",
3528
3539
  "modelAvailabilitySchedule",
3529
3540
  "fallbackAuto",
3530
3541
  "fallbackStickiness",
3542
+ "fallbackMaxLastResortCandidates",
3531
3543
  "hooks",
3532
3544
  "plugins",
3533
3545
  "pluginManager",
@@ -3613,6 +3625,17 @@ var IN_PROJECT_DENIED_PATHS = [
3613
3625
  // operator owns, not the checked-out repository.
3614
3626
  path: "tools.kanbanGovernance",
3615
3627
  reason: "Repo-committed config could disable a Kanban governance gate the operator switched on, letting product mutations run outside any managed card."
3628
+ },
3629
+ {
3630
+ // The bridge spawn path resolves the CLI entry by walking UP from the
3631
+ // project root, so a repo that ships its own `packages/cli/dist/index.js`
3632
+ // gets that file spawned with `process.execPath` on WebUI boot — no
3633
+ // prompt, no banner. Turning the feature on is therefore equivalent to
3634
+ // arbitrary code execution for a hostile checkout, which makes this an
3635
+ // operator-owned switch and never a repo-owned one.
3636
+ // See discover-mailbox-bridge.ts:findWorkspaceCliEntry.
3637
+ path: "features.mailboxBridge",
3638
+ reason: "Enables the mailbox bridge, whose CLI-entry resolution walks up from the project root \u2014 a repo-supplied packages/cli/dist/index.js would be spawned on WebUI boot."
3616
3639
  }
3617
3640
  ];
3618
3641
  function deleteNestedPath(target, path13) {
@@ -40,6 +40,8 @@ export interface AgentEventMap {
40
40
  target: string;
41
41
  /** The task instruction handed to the subagent (untruncated — UIs trim). */
42
42
  task: string;
43
+ /** Runtime identity for the spawned delegate, when creation succeeded. */
44
+ subagentId?: string | undefined;
43
45
  };
44
46
  /**
45
47
  * Fired by the `delegate` tool once the subagent settles (success,
@@ -168,6 +168,19 @@ export interface ProviderEventMap {
168
168
  currentTokens?: number | undefined;
169
169
  } | undefined;
170
170
  };
171
+ /**
172
+ * The fallback extension deferred a half-open primary recovery probe because
173
+ * the target model's known context window cannot fit the current request.
174
+ * The active fallback stays selected; no doomed primary request is sent.
175
+ */
176
+ 'provider.primary_probe_context_blocked': {
177
+ sessionId?: string | undefined;
178
+ providerId: string;
179
+ model: string;
180
+ currentTokens: number;
181
+ maxContext: number;
182
+ timestamp: number;
183
+ };
171
184
  /**
172
185
  * Fired by the fallback gate function (supplied to the fallback-model
173
186
  * extension via `FallbackModelDeps.fallbackGate`) when the chain is about