@wrongstack/core 0.299.0 → 0.301.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 (165) hide show
  1. package/dist/chronicle/index.d.ts +2 -0
  2. package/dist/chronicle/index.js +297 -10
  3. package/dist/chronicle/project-server.js +253 -15
  4. package/dist/chronicle/sqlite-compaction.d.ts +20 -0
  5. package/dist/chronicle/sqlite-journal.d.ts +57 -0
  6. package/dist/coordination/agents/capability-manifest.d.ts +7 -0
  7. package/dist/coordination/agents/index.d.ts +3 -2
  8. package/dist/coordination/agents/index.js +818 -570
  9. package/dist/coordination/agents/project-agent-identity.d.ts +6 -6
  10. package/dist/coordination/agents/role-skills.d.ts +1 -1
  11. package/dist/coordination/agents/types.d.ts +6 -0
  12. package/dist/coordination/director.d.ts +10 -2
  13. package/dist/coordination/fleet-manager.d.ts +48 -3
  14. package/dist/coordination/ifleet-manager.d.ts +2 -0
  15. package/dist/coordination/index.js +6880 -6440
  16. package/dist/coordination/mail-tools.d.ts +3 -3
  17. package/dist/coordination/mailbox-project-server.js +3 -4
  18. package/dist/coordination/mailbox-types.d.ts +6 -0
  19. package/dist/coordination/multi-agent-coordinator.d.ts +1 -0
  20. package/dist/core/agent-response.d.ts +5 -1
  21. package/dist/core/agent-tools.d.ts +3 -0
  22. package/dist/core/context.d.ts +20 -0
  23. package/dist/core/fallback-model.d.ts +48 -0
  24. package/dist/core/index.d.ts +11 -9
  25. package/dist/core/index.js +1119 -310
  26. package/dist/core/instruction-template.d.ts +83 -0
  27. package/dist/core/next-steps-slot.d.ts +88 -0
  28. package/dist/core/system-prompt-blocks.d.ts +10 -1
  29. package/dist/core/system-prompt-builder.d.ts +40 -4
  30. package/dist/core/system-prompt-memory-skills.d.ts +1 -0
  31. package/dist/core/system-prompt-skill-bodies.d.ts +3 -3
  32. package/dist/defaults/index.js +9805 -8767
  33. package/dist/design/index.js +11 -3
  34. package/dist/execution/auto-compaction-middleware.d.ts +17 -0
  35. package/dist/execution/autonomy-brain.d.ts +15 -2
  36. package/dist/execution/brain-runtime.d.ts +3 -1
  37. package/dist/execution/compaction-core.d.ts +41 -2
  38. package/dist/execution/council-brain.d.ts +47 -1
  39. package/dist/execution/council-orchestrator.d.ts +25 -6
  40. package/dist/execution/council-prompts.d.ts +12 -1
  41. package/dist/execution/index.d.ts +11 -10
  42. package/dist/execution/index.js +10507 -9189
  43. package/dist/execution/tool-executor.d.ts +4 -1
  44. package/dist/execution/topic-shift-advisor.d.ts +53 -0
  45. package/dist/extension/index.js +8 -2
  46. package/dist/extension/registry.d.ts +8 -1
  47. package/dist/fleet-notifier.d.ts +9 -2
  48. package/dist/goal/index.js +11 -3
  49. package/dist/hooks/index.js +50 -13
  50. package/dist/hooks/runner.d.ts +12 -1
  51. package/dist/hq/index.js +59 -21
  52. package/dist/hq/protocol/fleet.d.ts +20 -0
  53. package/dist/hq/protocol.js +10 -0
  54. package/dist/hq/publisher.d.ts +21 -3
  55. package/dist/index.d.ts +22 -20
  56. package/dist/index.js +12211 -8572
  57. package/dist/infrastructure/index.js +108 -21
  58. package/dist/kernel/events/brain-events.d.ts +9 -0
  59. package/dist/kernel/events/provider-events.d.ts +42 -1
  60. package/dist/kernel/events/session-events.d.ts +13 -0
  61. package/dist/kernel/events/tool-events.d.ts +3 -3
  62. package/dist/models/index.d.ts +1 -0
  63. package/dist/models/index.js +18 -1
  64. package/dist/models/provider-credentials.d.ts +54 -0
  65. package/dist/plugin/api.d.ts +6 -0
  66. package/dist/plugin/config.d.ts +55 -0
  67. package/dist/plugin/index.d.ts +2 -1
  68. package/dist/plugin/index.js +2179 -544
  69. package/dist/plugins/auto-review-plugin.d.ts +3 -0
  70. package/dist/plugins/cloud-config-sync-plugin.d.ts +22 -0
  71. package/dist/plugins/review-claim-registry.d.ts +23 -8
  72. package/dist/plugins/review-types.d.ts +2 -0
  73. package/dist/registry/index.js +109 -74
  74. package/dist/registry/tool-registry.d.ts +15 -0
  75. package/dist/security/capabilities.d.ts +2 -0
  76. package/dist/security/index.d.ts +2 -2
  77. package/dist/security/index.js +166 -44
  78. package/dist/security/permission-helpers.d.ts +23 -6
  79. package/dist/security/permission-policy.d.ts +16 -0
  80. package/dist/security/readonly-permission-policy.d.ts +20 -0
  81. package/dist/security/totp.d.ts +14 -0
  82. package/dist/session-registry-atomic-file.d.ts +32 -5
  83. package/dist/skills/frontmatter.d.ts +6 -0
  84. package/dist/skills/index.js +22 -5
  85. package/dist/storage/cloud-config-sync/sanitize.d.ts +54 -0
  86. package/dist/storage/cloud-config-sync.d.ts +87 -0
  87. package/dist/storage/director-state.d.ts +7 -0
  88. package/dist/storage/index.d.ts +1 -0
  89. package/dist/storage/index.js +887 -74
  90. package/dist/tools/fallback-system-config-view-tool.d.ts +1 -1
  91. package/dist/tools/index.d.ts +1 -1
  92. package/dist/tools/index.js +898 -335
  93. package/dist/tools/one-shot-llm-tool.d.ts +1 -0
  94. package/dist/tools/plugin-manager.d.ts +27 -0
  95. package/dist/types/config/mcp-features.d.ts +18 -11
  96. package/dist/types/config/root.d.ts +8 -1
  97. package/dist/types/config/runtime.d.ts +20 -6
  98. package/dist/types/config/skills-fleet-brain.d.ts +12 -4
  99. package/dist/types/config/tools.d.ts +16 -0
  100. package/dist/types/context-window.d.ts +1 -0
  101. package/dist/types/council.d.ts +11 -0
  102. package/dist/types/hooks.d.ts +14 -0
  103. package/dist/types/index.d.ts +3 -3
  104. package/dist/types/index.js +1 -0
  105. package/dist/types/multi-agent.d.ts +12 -0
  106. package/dist/types/one-shot-llm.d.ts +25 -0
  107. package/dist/types/plugin.d.ts +28 -0
  108. package/dist/types/provider.d.ts +16 -0
  109. package/dist/types/runtime-capability-manifest.d.ts +168 -0
  110. package/dist/types/skill.d.ts +5 -0
  111. package/dist/types/system-prompt.d.ts +3 -1
  112. package/dist/types/tool-executor.d.ts +8 -1
  113. package/dist/utils/context-breakdown.d.ts +8 -2
  114. package/dist/utils/index.d.ts +1 -1
  115. package/dist/utils/index.js +141 -31
  116. package/dist/utils/regex-guard.d.ts +16 -2
  117. package/dist/utils/sage-output-block.d.ts +7 -10
  118. package/dist/utils/wstack-paths.d.ts +11 -3
  119. package/dist/worktree/index.js +4 -4
  120. package/instructions/agents/browser.md +1 -4
  121. package/instructions/agents/e2e.md +17 -15
  122. package/instructions/agents/ios.md +3 -3
  123. package/instructions/agents/search.md +1 -1
  124. package/instructions/autonomy/goal-preamble.md +4 -4
  125. package/instructions/coordination/director-preamble.md +2 -3
  126. package/instructions/coordination/subagent-baseline.md +3 -1
  127. package/instructions/leader-after-task.md +12 -0
  128. package/instructions/llm/chimera-review.md +1 -1
  129. package/instructions/modes/audit-lite.md +1 -1
  130. package/instructions/sections/tool/common-patterns.md +18 -2
  131. package/instructions/sections/tool/mailbox-compact.md +1 -1
  132. package/instructions/sections/tool/mailbox-full.md +1 -1
  133. package/instructions/system-lite.md +91 -3
  134. package/instructions/system-pro.md +296 -102
  135. package/instructions/system.md +248 -92
  136. package/package.json +3 -3
  137. package/skills/api-design/SKILL.md +3 -0
  138. package/skills/audit-log/SKILL.md +2 -0
  139. package/skills/auto-review/SKILL.md +6 -1
  140. package/skills/bug-hunter/SKILL.md +4 -1
  141. package/skills/chimera/SKILL.md +3 -0
  142. package/skills/data-governance/SKILL.md +3 -0
  143. package/skills/design-system/SKILL.md +5 -2
  144. package/skills/docker-deploy/SKILL.md +2 -0
  145. package/skills/git-flow/SKILL.md +2 -0
  146. package/skills/mailbox-bridge/SKILL.md +3 -0
  147. package/skills/mnemosyne/SKILL.md +2 -0
  148. package/skills/multi-agent/SKILL.md +4 -1
  149. package/skills/node-modern/SKILL.md +4 -1
  150. package/skills/observability/SKILL.md +3 -0
  151. package/skills/output-standards/SKILL.md +2 -0
  152. package/skills/plugin-author/SKILL.md +4 -1
  153. package/skills/prompt-engineering/SKILL.md +3 -1
  154. package/skills/react-modern/SKILL.md +6 -3
  155. package/skills/refactor-planner/SKILL.md +2 -0
  156. package/skills/research-web/SKILL.md +3 -0
  157. package/skills/sdd/SKILL.md +3 -1
  158. package/skills/security-scanner/SKILL.md +3 -0
  159. package/skills/skill-creator/SKILL.md +2 -0
  160. package/skills/tech-stack/SKILL.md +3 -0
  161. package/skills/testing/SKILL.md +4 -1
  162. package/skills/typescript-strict/SKILL.md +4 -1
  163. package/skills/wrongstack-kanban/SKILL.md +6 -3
  164. package/skills/wrongstack-mailbox/SKILL.md +4 -1
  165. package/skills/wrongstack-mailbox-mcp/SKILL.md +10 -8
@@ -15,6 +15,8 @@ export interface AutoReviewConfig {
15
15
  * omitted), and the remaining entries form the fallback chain.
16
16
  */
17
17
  fallbackProfile?: string | undefined;
18
+ /** How each review chooses its starting model from the resolved profile pool. */
19
+ modelSelection?: 'round-robin' | 'random' | undefined;
18
20
  /** Debounce window in ms — wait for quiet before firing review (default 15000). */
19
21
  debounceMs?: number | undefined;
20
22
  /** Max files per review batch (default 15). */
@@ -40,6 +42,7 @@ export interface ResolvedAutoReviewConfig {
40
42
  provider: string;
41
43
  model: string;
42
44
  fallbackModels: string[];
45
+ modelSelection: 'round-robin' | 'random';
43
46
  debounceMs: number;
44
47
  maxFilesPerBatch: number;
45
48
  maxConcurrentReviews: number;
@@ -0,0 +1,22 @@
1
+ import type { ConfigStore } from '../types/config.js';
2
+ import type { Plugin } from '../types/plugin.js';
3
+ import type { SecretVault } from '../types/secret-vault.js';
4
+ import type { WstackPaths } from '../utils/wstack-paths.js';
5
+ interface CloudConfigSyncPluginOptions {
6
+ paths?: WstackPaths | undefined;
7
+ configStore?: ConfigStore | undefined;
8
+ vault?: SecretVault | undefined;
9
+ appVersion?: string | undefined;
10
+ }
11
+ /**
12
+ * CloudConfigSyncPlugin — background config synchronization with my.wrongstack.com.
13
+ *
14
+ * Registers `/cloudsync` and, while enabled, runs a pull-then-push pass every
15
+ * `cloudSync.intervalSeconds` (default 300). Distinct from `wstack-sync` (the legacy
16
+ * GitHub category sync): this speaks the portal's namespaced, schema-validated,
17
+ * secret-free sync API v1 and never uploads credential material — the sanitizer in
18
+ * `storage/cloud-config-sync/sanitize.ts` is the client half of the server's contract.
19
+ */
20
+ export declare function createCloudConfigSyncPlugin(opts?: CloudConfigSyncPluginOptions): Plugin;
21
+ export {};
22
+ //# sourceMappingURL=cloud-config-sync-plugin.d.ts.map
@@ -1,24 +1,39 @@
1
1
  import type { EventBus } from '../kernel/events.js';
2
2
  import type { PluginAPI } from '../types/plugin.js';
3
3
  import type { ReviewContextBundle } from './review-types.js';
4
+ export interface ClaimStoreOptions {
5
+ /**
6
+ * Override the shared claim-ledger directory. Defaults to `<cwd>/.wrongstack`
7
+ * (git-ignored, shared by every session on the same working tree). Tests
8
+ * inject a temp dir; two EventBuses sharing one dir dedupe like two hosts.
9
+ */
10
+ storeDir?: string | undefined;
11
+ /** Claim lifetime in ms before it is treated as stale (default 30 min). */
12
+ ttlMs?: number | undefined;
13
+ /** Ledger compaction threshold in lines (default 10,000). Test override. */
14
+ maxLedgerLines?: number | undefined;
15
+ }
16
+ export declare function breakStaleLock(lockPath: string): Promise<boolean>;
4
17
  /**
5
18
  * Record review events emitted outside the automatic plugin paths, such as
6
19
  * `/review`, so the post-session pass also avoids repeating those files.
7
20
  */
8
- export declare function recordStartedReview(events: EventBus, payload: unknown): void;
21
+ export declare function recordStartedReview(events: EventBus, payload: unknown, opts?: ClaimStoreOptions | undefined): Promise<void>;
9
22
  /**
10
23
  * Release the exact claims associated with a completed review bundle. Bundle
11
24
  * identity prevents an older completion from removing newer in-flight claims.
12
25
  */
13
- export declare function recordCompletedReview(events: EventBus, payload: unknown): void;
26
+ export declare function recordCompletedReview(events: EventBus, payload: unknown): Promise<void>;
14
27
  /**
15
28
  * Atomically claim review inputs and emit only files whose exact content does
16
- * not already have a review in progress. The returned bundle contains only
17
- * claimed files and may be a strict subset of the input.
29
+ * not already have a review in progress across every session sharing the
30
+ * working tree. The returned bundle contains only claimed files and may be a
31
+ * strict subset of the input.
18
32
  *
19
- * Claims are installed immediately before the synchronous event emission, so
20
- * concurrent mid/post-session handlers cannot enqueue the same content twice.
21
- * A synchronous emit failure rolls the claims back.
33
+ * Claims are installed in the shared ledger (under its exclusive lock) before
34
+ * the event emission, so concurrent mid/post-session handlers in this
35
+ * process or another cannot enqueue the same content twice. A synchronous
36
+ * emit failure rolls the claims back.
22
37
  */
23
- export declare function emitReviewIfChanged(api: Pick<PluginAPI, 'events' | 'emitCustom'>, bundle: ReviewContextBundle): ReviewContextBundle | null;
38
+ export declare function emitReviewIfChanged(api: Pick<PluginAPI, 'events' | 'emitCustom'>, bundle: ReviewContextBundle, opts?: ClaimStoreOptions | undefined): Promise<ReviewContextBundle | null>;
24
39
  //# sourceMappingURL=review-claim-registry.d.ts.map
@@ -45,6 +45,8 @@ export interface ReviewContextBundle {
45
45
  * Absent for ordinary Chimera and manual review triggers.
46
46
  */
47
47
  reviewFallbackModels?: string[] | undefined;
48
+ /** Selection policy for the resolved auto-review profile pool. */
49
+ reviewModelSelection?: 'round-robin' | 'random' | undefined;
48
50
  /**
49
51
  * Cascade severity threshold from the auto-review plugin config.
50
52
  * When the review subagent finds findings at or above this level, a
@@ -269,80 +269,6 @@ function formatContext(ctx) {
269
269
  return parts.length > 0 ? `[${parts.join(" ")}]` : "";
270
270
  }
271
271
 
272
- // src/utils/tool-description-mode.ts
273
- var ORIGINAL_TOOL_DESCRIPTION = /* @__PURE__ */ Symbol.for("wrongstack.tool.originalDescription");
274
- function normalizeToolDescriptionMode(value) {
275
- if (typeof value !== "string") return void 0;
276
- const raw = value.trim().toLowerCase();
277
- if (raw === "extend" || raw === "extended" || raw === "full") return "extend";
278
- if (raw === "simple" || raw === "short" || raw === "brief") return "simple";
279
- return void 0;
280
- }
281
- function simplifyToolDescription(text, opts = {}) {
282
- const maxSentences = Math.max(1, opts.maxSentences ?? 2);
283
- const maxChars = Math.max(40, opts.maxChars ?? 180);
284
- const normalized = text.replace(/\r\n?/g, "\n").split("\n").map((line) => line.trim()).filter(Boolean).join(" ").replace(/\s+/g, " ").trim();
285
- if (normalized.length <= maxChars) return normalized;
286
- const sentences = normalized.match(/[^.!?]+[.!?]+(?=\s|$)|[^.!?]+$/g) ?? [normalized];
287
- const selected = [];
288
- for (const sentence of sentences) {
289
- selected.push(sentence.trim());
290
- const candidate = selected.join(" ");
291
- if (selected.length >= maxSentences || candidate.length >= maxChars) break;
292
- }
293
- const summary = selected.join(" ").trim() || normalized;
294
- if (summary.length <= maxChars) return summary;
295
- const hardLimit = maxChars - 4;
296
- const boundary = findWordBoundary(summary, hardLimit);
297
- return `${summary.slice(0, boundary > 0 ? boundary : hardLimit).trimEnd()} ...`;
298
- }
299
- function applyToolDescriptionModeToTool(tool, mode) {
300
- const existingOriginal = getOriginalDescription(tool);
301
- if (mode === "extend" && !existingOriginal) return tool;
302
- const original = existingOriginal ?? {
303
- description: tool.description,
304
- usageHint: tool.usageHint
305
- };
306
- const next = mode === "simple" ? withDescription(tool, {
307
- description: simplifyToolDescription(original.description),
308
- usageHint: original.usageHint === void 0 ? void 0 : simplifyToolDescription(original.usageHint)
309
- }) : withDescription(tool, original);
310
- return attachOriginalDescription(next, original);
311
- }
312
- function getOriginalDescription(tool) {
313
- return tool[ORIGINAL_TOOL_DESCRIPTION];
314
- }
315
- function attachOriginalDescription(tool, original) {
316
- Object.defineProperty(tool, ORIGINAL_TOOL_DESCRIPTION, {
317
- configurable: true,
318
- enumerable: false,
319
- value: original,
320
- writable: true
321
- });
322
- return tool;
323
- }
324
- function withDescription(tool, next) {
325
- const copy = {
326
- ...tool,
327
- description: next.description,
328
- usageHint: next.usageHint
329
- };
330
- if (next.usageHint === void 0) {
331
- delete copy.usageHint;
332
- }
333
- return copy;
334
- }
335
- function findWordBoundary(text, limit) {
336
- const semantic = Math.max(
337
- text.lastIndexOf(". ", limit),
338
- text.lastIndexOf("; ", limit),
339
- text.lastIndexOf(", ", limit)
340
- );
341
- if (semantic > 40) return semantic + 1;
342
- const space = text.lastIndexOf(" ", limit);
343
- return space > 40 ? space : limit;
344
- }
345
-
346
272
  // src/utils/tool-wire-compact.ts
347
273
  var TOOL_DESCRIPTION_MAX_CHARS = 400;
348
274
  var SCHEMA_DESCRIPTION_MAX_CHARS = 120;
@@ -462,6 +388,80 @@ function estimateToolDefTokens(tool) {
462
388
  return RoughTokenEstimate(tool.name) + RoughTokenEstimate(compact.description) + RoughTokenEstimate(JSON.stringify(compact.inputSchema));
463
389
  }
464
390
 
391
+ // src/utils/tool-description-mode.ts
392
+ var ORIGINAL_TOOL_DESCRIPTION = /* @__PURE__ */ Symbol.for("wrongstack.tool.originalDescription");
393
+ function normalizeToolDescriptionMode(value) {
394
+ if (typeof value !== "string") return void 0;
395
+ const raw = value.trim().toLowerCase();
396
+ if (raw === "extend" || raw === "extended" || raw === "full") return "extend";
397
+ if (raw === "simple" || raw === "short" || raw === "brief") return "simple";
398
+ return void 0;
399
+ }
400
+ function simplifyToolDescription(text, opts = {}) {
401
+ const maxSentences = Math.max(1, opts.maxSentences ?? 2);
402
+ const maxChars = Math.max(40, opts.maxChars ?? 180);
403
+ const normalized = text.replace(/\r\n?/g, "\n").split("\n").map((line) => line.trim()).filter(Boolean).join(" ").replace(/\s+/g, " ").trim();
404
+ if (normalized.length <= maxChars) return normalized;
405
+ const sentences = normalized.match(/[^.!?]+[.!?]+(?=\s|$)|[^.!?]+$/g) ?? [normalized];
406
+ const selected = [];
407
+ for (const sentence of sentences) {
408
+ selected.push(sentence.trim());
409
+ const candidate = selected.join(" ");
410
+ if (selected.length >= maxSentences || candidate.length >= maxChars) break;
411
+ }
412
+ const summary = selected.join(" ").trim() || normalized;
413
+ if (summary.length <= maxChars) return summary;
414
+ const hardLimit = maxChars - 4;
415
+ const boundary = findWordBoundary(summary, hardLimit);
416
+ return `${summary.slice(0, boundary > 0 ? boundary : hardLimit).trimEnd()} ...`;
417
+ }
418
+ function applyToolDescriptionModeToTool(tool, mode) {
419
+ const existingOriginal = getOriginalDescription(tool);
420
+ if (mode === "extend" && !existingOriginal) return tool;
421
+ const original = existingOriginal ?? {
422
+ description: tool.description,
423
+ usageHint: tool.usageHint
424
+ };
425
+ const next = mode === "simple" ? withDescription(tool, {
426
+ description: simplifyToolDescription(original.description),
427
+ usageHint: original.usageHint === void 0 ? void 0 : simplifyToolDescription(original.usageHint)
428
+ }) : withDescription(tool, original);
429
+ return attachOriginalDescription(next, original);
430
+ }
431
+ function getOriginalDescription(tool) {
432
+ return tool[ORIGINAL_TOOL_DESCRIPTION];
433
+ }
434
+ function attachOriginalDescription(tool, original) {
435
+ Object.defineProperty(tool, ORIGINAL_TOOL_DESCRIPTION, {
436
+ configurable: true,
437
+ enumerable: false,
438
+ value: original,
439
+ writable: true
440
+ });
441
+ return tool;
442
+ }
443
+ function withDescription(tool, next) {
444
+ const copy = {
445
+ ...tool,
446
+ description: next.description,
447
+ usageHint: next.usageHint
448
+ };
449
+ if (next.usageHint === void 0) {
450
+ delete copy.usageHint;
451
+ }
452
+ return copy;
453
+ }
454
+ function findWordBoundary(text, limit) {
455
+ const semantic = Math.max(
456
+ text.lastIndexOf(". ", limit),
457
+ text.lastIndexOf("; ", limit),
458
+ text.lastIndexOf(", ", limit)
459
+ );
460
+ if (semantic > 40) return semantic + 1;
461
+ const space = text.lastIndexOf(" ", limit);
462
+ return space > 40 ? space : limit;
463
+ }
464
+
465
465
  // src/registry/tool-registry.ts
466
466
  var ToolRegistry = class _ToolRegistry {
467
467
  tools = /* @__PURE__ */ new Map();
@@ -477,6 +477,15 @@ var ToolRegistry = class _ToolRegistry {
477
477
  /** Cached `list()` result, frozen after build. Invalidated on _version change. */
478
478
  _listSnapshot;
479
479
  _listSnapshotVersion = -1;
480
+ /**
481
+ * Optional direct provider surface. `undefined` preserves the legacy
482
+ * behaviour (every enabled catalog tool is direct); when set, `list()` still
483
+ * exposes the complete executable catalog while `listForProvider()` returns
484
+ * only these names. This keeps lazy tools discoverable by tool_search/tool_use.
485
+ */
486
+ _providerToolNames;
487
+ _providerListSnapshot;
488
+ _providerListSnapshotVersion = -1;
480
489
  /** Pre-compute tool definition token estimate once at registration time. */
481
490
  _stampDefTokens(tool) {
482
491
  if (tool._estDefTokens === void 0) {
@@ -726,6 +735,30 @@ var ToolRegistry = class _ToolRegistry {
726
735
  this._listSnapshotVersion = this._version;
727
736
  return arr;
728
737
  }
738
+ /** Replace the direct provider surface. Pass `undefined` to expose the catalog. */
739
+ setProviderToolNames(names) {
740
+ this._providerToolNames = names ? new Set(names) : void 0;
741
+ this._version++;
742
+ }
743
+ /** Add registered or future tool names to the direct provider surface. */
744
+ exposeToProvider(names) {
745
+ if (!this._providerToolNames) return;
746
+ for (const name of typeof names === "string" ? [names] : names) {
747
+ this._providerToolNames.add(name);
748
+ }
749
+ this._version++;
750
+ }
751
+ /** Tools serialized into provider requests and described by the system prompt. */
752
+ listForProvider() {
753
+ if (!this._providerToolNames) return this.list();
754
+ if (this._providerListSnapshot && this._version === this._providerListSnapshotVersion) {
755
+ return this._providerListSnapshot;
756
+ }
757
+ const arr = Array.from(this.tools.entries()).filter(([name]) => !this._disabled.has(name) && this._providerToolNames?.has(name) === true).map(([, entry]) => entry.tool);
758
+ this._providerListSnapshot = arr;
759
+ this._providerListSnapshotVersion = this._version;
760
+ return arr;
761
+ }
729
762
  /**
730
763
  * Group tools by their `category` field. Tools without a category
731
764
  * are placed under the key `""` (empty string). Returns a Map of
@@ -752,6 +785,7 @@ var ToolRegistry = class _ToolRegistry {
752
785
  this.tools.clear();
753
786
  this.descriptionModes.clear();
754
787
  this._disabled.clear();
788
+ this._providerToolNames = void 0;
755
789
  this._version++;
756
790
  }
757
791
  /**
@@ -770,6 +804,7 @@ var ToolRegistry = class _ToolRegistry {
770
804
  for (const name of this._disabled) {
771
805
  copy._disabled.add(name);
772
806
  }
807
+ copy._providerToolNames = this._providerToolNames ? new Set(this._providerToolNames) : void 0;
773
808
  copy._version = this._version;
774
809
  return copy;
775
810
  }
@@ -36,6 +36,15 @@ export declare class ToolRegistry {
36
36
  /** Cached `list()` result, frozen after build. Invalidated on _version change. */
37
37
  private _listSnapshot;
38
38
  private _listSnapshotVersion;
39
+ /**
40
+ * Optional direct provider surface. `undefined` preserves the legacy
41
+ * behaviour (every enabled catalog tool is direct); when set, `list()` still
42
+ * exposes the complete executable catalog while `listForProvider()` returns
43
+ * only these names. This keeps lazy tools discoverable by tool_search/tool_use.
44
+ */
45
+ private _providerToolNames;
46
+ private _providerListSnapshot;
47
+ private _providerListSnapshotVersion;
39
48
  /** Pre-compute tool definition token estimate once at registration time. */
40
49
  private _stampDefTokens;
41
50
  /** Apply the description mode transform and stamp token estimates. */
@@ -134,6 +143,12 @@ export declare class ToolRegistry {
134
143
  owner: string;
135
144
  }[];
136
145
  list(): Tool[];
146
+ /** Replace the direct provider surface. Pass `undefined` to expose the catalog. */
147
+ setProviderToolNames(names: readonly string[] | undefined): void;
148
+ /** Add registered or future tool names to the direct provider surface. */
149
+ exposeToProvider(names: string | readonly string[]): void;
150
+ /** Tools serialized into provider requests and described by the system prompt. */
151
+ listForProvider(): Tool[];
137
152
  /**
138
153
  * Group tools by their `category` field. Tools without a category
139
154
  * are placed under the key `""` (empty string). Returns a Map of
@@ -45,6 +45,8 @@ export declare const ToolCapabilities: {
45
45
  readonly NET_OUTBOUND: 'net.outbound';
46
46
  /** Can mutate in-memory session todos only. */
47
47
  readonly SESSION_TODO: 'session.todo';
48
+ /** Can park after-task `<nextsteps>` suggestions for the current turn. */
49
+ readonly SESSION_NEXTSTEPS: 'session.nextsteps';
48
50
  /** Can mutate in-memory session mode only. */
49
51
  readonly SESSION_MODE: 'session.mode';
50
52
  /** Can inspect registered tool metadata. */
@@ -8,9 +8,9 @@ export { restrictDirPermissions, restrictFilePermissions, SECRET_DIR_MODE, SECRE
8
8
  export { evaluateToolKanbanBoundary, type ToolKanbanBoundaryEvaluation, } from './kanban-boundary.js';
9
9
  export { AutoApprovePermissionPolicy, alwaysAllowUnavailableReason, DefaultPermissionPolicy, type PermissionPolicyOptions, } from './permission-policy.js';
10
10
  export { TRUST_POLICY_JSON_SCHEMA, TRUST_POLICY_LIMITS, TRUST_POLICY_SCHEMA_VERSION, type TrustPolicyDiagnostic, type TrustPolicyDiagnosticCode, type TrustPolicyValidationResult, validateTrustPolicy, } from './permission-policy-schema.js';
11
- export { ReadOnlyPermissionPolicy } from './readonly-permission-policy.js';
11
+ export { ReadOnlyPermissionPolicy, toolMutates } from './readonly-permission-policy.js';
12
12
  export { DefaultSecretScrubber } from './secret-scrubber.js';
13
- export { base32Decode, base32Encode, buildOtpAuthUri, generateRecoveryCodes, generateTotpSecret, generateTotp, hashRecoveryCode, verifyRecoveryCode, verifyTotp, } from './totp.js';
13
+ export { base32Decode, base32Encode, buildOtpAuthUri, generateRecoveryCodes, generateTotpSecret, generateTotp, hashRecoveryCode, verifyRecoveryCode, verifyTotp, verifyTotpCounter, } from './totp.js';
14
14
  export { DefaultSecretVault, migratePlaintextSecrets, rewriteConfigEncrypted, rotateConfigKeys, type SecretVaultOptions, } from './secret-vault.js';
15
15
  export type { CompatibilityTrustBoundaryOptions, TrustActor, TrustActorKind, TrustAllowDecision, TrustAttribute, TrustAuthContext, TrustAuthMethod, TrustBoundary, TrustBoundaryAuditEntry, TrustBoundaryDecision, TrustBoundaryRequest, TrustConfirmDecision, TrustDecodeIssue, TrustDecodeResult, TrustDenyDecision, TrustRisk, TrustScope, TrustScopedTokenDecision, TrustSubject, TrustSurface, } from './trust-boundary.js';
16
16
  export { createCompatibilityTrustBoundary, decodeTrustBoundaryDecision, decodeTrustBoundaryRequest, isTrustDecisionAllowed, TRUST_BOUNDARY_VERSION, } from './trust-boundary.js';