@wrongstack/core 0.300.0 → 0.302.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 (146) 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 +2 -2
  13. package/dist/coordination/index.js +6787 -6447
  14. package/dist/coordination/mail-tools.d.ts +3 -3
  15. package/dist/coordination/mailbox-project-server.js +3 -4
  16. package/dist/coordination/mailbox-types.d.ts +6 -0
  17. package/dist/core/agent-response.d.ts +5 -1
  18. package/dist/core/agent-tools.d.ts +3 -0
  19. package/dist/core/context.d.ts +20 -0
  20. package/dist/core/index.d.ts +8 -7
  21. package/dist/core/index.js +893 -284
  22. package/dist/core/instruction-template.d.ts +6 -3
  23. package/dist/core/next-steps-slot.d.ts +88 -0
  24. package/dist/core/system-prompt-builder.d.ts +5 -3
  25. package/dist/core/system-prompt-memory-skills.d.ts +1 -0
  26. package/dist/core/system-prompt-skill-bodies.d.ts +3 -3
  27. package/dist/defaults/index.js +9797 -8898
  28. package/dist/design/index.js +11 -3
  29. package/dist/execution/auto-compaction-middleware.d.ts +17 -0
  30. package/dist/execution/autonomy-brain.d.ts +8 -2
  31. package/dist/execution/brain-runtime.d.ts +3 -1
  32. package/dist/execution/compaction-core.d.ts +41 -2
  33. package/dist/execution/council-brain.d.ts +37 -2
  34. package/dist/execution/council-orchestrator.d.ts +2 -2
  35. package/dist/execution/index.d.ts +11 -10
  36. package/dist/execution/index.js +5179 -4078
  37. package/dist/execution/tool-executor.d.ts +4 -1
  38. package/dist/execution/topic-shift-advisor.d.ts +53 -0
  39. package/dist/extension/index.js +8 -2
  40. package/dist/extension/registry.d.ts +8 -1
  41. package/dist/goal/index.js +11 -3
  42. package/dist/hooks/index.js +42 -9
  43. package/dist/hooks/runner.d.ts +12 -1
  44. package/dist/hq/index.js +41 -17
  45. package/dist/hq/publisher.d.ts +21 -3
  46. package/dist/index.d.ts +21 -20
  47. package/dist/index.js +10901 -8067
  48. package/dist/infrastructure/index.js +108 -21
  49. package/dist/kernel/events/session-events.d.ts +13 -0
  50. package/dist/kernel/events/tool-events.d.ts +3 -3
  51. package/dist/models/index.d.ts +1 -0
  52. package/dist/models/index.js +17 -0
  53. package/dist/models/provider-credentials.d.ts +54 -0
  54. package/dist/plugin/index.d.ts +1 -0
  55. package/dist/plugin/index.js +2024 -502
  56. package/dist/plugins/auto-review-plugin.d.ts +3 -0
  57. package/dist/plugins/cloud-config-sync-plugin.d.ts +22 -0
  58. package/dist/plugins/review-claim-registry.d.ts +23 -8
  59. package/dist/plugins/review-types.d.ts +2 -0
  60. package/dist/registry/index.js +109 -74
  61. package/dist/registry/tool-registry.d.ts +15 -0
  62. package/dist/security/capabilities.d.ts +2 -0
  63. package/dist/security/index.d.ts +1 -1
  64. package/dist/security/index.js +9 -2
  65. package/dist/security/readonly-permission-policy.d.ts +20 -0
  66. package/dist/session-registry-atomic-file.d.ts +32 -5
  67. package/dist/session-registry-types.d.ts +17 -0
  68. package/dist/session-registry.d.ts +1 -1
  69. package/dist/skills/frontmatter.d.ts +6 -0
  70. package/dist/skills/index.js +22 -5
  71. package/dist/storage/cloud-config-sync/sanitize.d.ts +54 -0
  72. package/dist/storage/cloud-config-sync.d.ts +87 -0
  73. package/dist/storage/index.d.ts +2 -1
  74. package/dist/storage/index.js +854 -66
  75. package/dist/tools/index.d.ts +1 -1
  76. package/dist/tools/index.js +511 -234
  77. package/dist/tools/one-shot-llm-tool.d.ts +1 -0
  78. package/dist/tools/plugin-manager.d.ts +27 -0
  79. package/dist/types/config/mcp-features.d.ts +18 -11
  80. package/dist/types/config/root.d.ts +8 -1
  81. package/dist/types/config/runtime.d.ts +20 -6
  82. package/dist/types/config/skills-fleet-brain.d.ts +12 -4
  83. package/dist/types/config/tools.d.ts +16 -0
  84. package/dist/types/context-window.d.ts +1 -0
  85. package/dist/types/hooks.d.ts +14 -0
  86. package/dist/types/index.d.ts +2 -2
  87. package/dist/types/index.js +1 -0
  88. package/dist/types/multi-agent.d.ts +2 -0
  89. package/dist/types/one-shot-llm.d.ts +16 -0
  90. package/dist/types/provider.d.ts +16 -0
  91. package/dist/types/runtime-capability-manifest.d.ts +168 -0
  92. package/dist/types/skill.d.ts +5 -0
  93. package/dist/types/system-prompt.d.ts +3 -1
  94. package/dist/types/tool-executor.d.ts +8 -1
  95. package/dist/utils/context-breakdown.d.ts +8 -2
  96. package/dist/utils/index.d.ts +1 -1
  97. package/dist/utils/index.js +141 -31
  98. package/dist/utils/regex-guard.d.ts +16 -2
  99. package/dist/utils/sage-output-block.d.ts +7 -10
  100. package/dist/utils/wstack-paths.d.ts +11 -3
  101. package/instructions/agents/browser.md +1 -4
  102. package/instructions/agents/e2e.md +17 -15
  103. package/instructions/agents/ios.md +3 -3
  104. package/instructions/agents/search.md +1 -1
  105. package/instructions/autonomy/goal-preamble.md +4 -4
  106. package/instructions/coordination/director-preamble.md +2 -3
  107. package/instructions/coordination/subagent-baseline.md +3 -1
  108. package/instructions/leader-after-task.md +12 -0
  109. package/instructions/llm/chimera-review.md +1 -1
  110. package/instructions/modes/audit-lite.md +1 -1
  111. package/instructions/sections/tool/common-patterns.md +18 -2
  112. package/instructions/sections/tool/mailbox-compact.md +1 -1
  113. package/instructions/sections/tool/mailbox-full.md +1 -1
  114. package/instructions/system-lite.md +10 -0
  115. package/instructions/system-pro.md +23 -14
  116. package/instructions/system.md +22 -13
  117. package/package.json +3 -3
  118. package/skills/api-design/SKILL.md +3 -0
  119. package/skills/audit-log/SKILL.md +2 -0
  120. package/skills/auto-review/SKILL.md +6 -1
  121. package/skills/bug-hunter/SKILL.md +4 -1
  122. package/skills/chimera/SKILL.md +3 -0
  123. package/skills/data-governance/SKILL.md +3 -0
  124. package/skills/design-system/SKILL.md +5 -2
  125. package/skills/docker-deploy/SKILL.md +2 -0
  126. package/skills/git-flow/SKILL.md +2 -0
  127. package/skills/mailbox-bridge/SKILL.md +3 -0
  128. package/skills/mnemosyne/SKILL.md +2 -0
  129. package/skills/multi-agent/SKILL.md +4 -1
  130. package/skills/node-modern/SKILL.md +4 -1
  131. package/skills/observability/SKILL.md +3 -0
  132. package/skills/output-standards/SKILL.md +2 -0
  133. package/skills/plugin-author/SKILL.md +4 -1
  134. package/skills/prompt-engineering/SKILL.md +3 -1
  135. package/skills/react-modern/SKILL.md +6 -3
  136. package/skills/refactor-planner/SKILL.md +2 -0
  137. package/skills/research-web/SKILL.md +3 -0
  138. package/skills/sdd/SKILL.md +3 -1
  139. package/skills/security-scanner/SKILL.md +3 -0
  140. package/skills/skill-creator/SKILL.md +2 -0
  141. package/skills/tech-stack/SKILL.md +3 -0
  142. package/skills/testing/SKILL.md +4 -1
  143. package/skills/typescript-strict/SKILL.md +4 -1
  144. package/skills/wrongstack-kanban/SKILL.md +6 -3
  145. package/skills/wrongstack-mailbox/SKILL.md +4 -1
  146. package/skills/wrongstack-mailbox-mcp/SKILL.md +10 -8
@@ -18,6 +18,7 @@ export interface CreateOneShotLLMToolOptions {
18
18
  fallbackProfileManager: OneShotOrchestratorOptions['fallbackProfileManager'];
19
19
  modelRouter?: OneShotOrchestratorOptions['modelRouter'];
20
20
  logger?: OneShotOrchestratorOptions['logger'];
21
+ wrapProviderCall?: OneShotOrchestratorOptions['wrapProviderCall'];
21
22
  /**
22
23
  * Default provider to use when the caller doesn't specify one.
23
24
  * When absent, callers MUST provide `providerId` explicitly.
@@ -16,6 +16,25 @@ export interface PluginManagerMutationResult {
16
16
  message: string;
17
17
  restartRequired?: boolean | undefined;
18
18
  }
19
+ /**
20
+ * Structural view of the session's PreToolUse hook pipeline — satisfied by
21
+ * `HookRunner` without depending on the class. `use` runs the pipeline
22
+ * before a nested `execute()` so policy hooks (path-guard & co.) rule on
23
+ * plugin-tool calls exactly as they would on the direct path.
24
+ */
25
+ export interface PluginManagerHookRunner {
26
+ preToolUse(toolName: string, toolInput: Record<string, unknown>, env: {
27
+ cwd: string;
28
+ signal?: AbortSignal | undefined;
29
+ }, toolMeta?: {
30
+ capabilities?: readonly string[] | undefined;
31
+ mutating?: boolean | undefined;
32
+ }): Promise<{
33
+ block?: boolean | undefined;
34
+ reason?: string | undefined;
35
+ input?: Record<string, unknown>;
36
+ }>;
37
+ }
19
38
  export interface CreatePluginManagerToolOptions {
20
39
  /** Re-read on every call so config changes made during the session are visible. */
21
40
  getConfig: () => Config;
@@ -25,6 +44,14 @@ export interface CreatePluginManagerToolOptions {
25
44
  toolRegistry: ToolRegistry;
26
45
  /** Persist an enable/disable decision in the host's active config. */
27
46
  setEnabled: (plugin: string, enabled: boolean) => Promise<PluginManagerMutationResult>;
47
+ /**
48
+ * Late-bound source for the session's policy-hook runner, resolved on
49
+ * every `use` call. Late-bound because the hook pipeline is wired after
50
+ * the management tools register (same pattern as OneShotOrchestrator's
51
+ * `wrapProviderCall`); optional so minimal hosts and tests without a
52
+ * hook pipeline keep the previous behavior bit-for-bit.
53
+ */
54
+ getHookRunner?: (() => PluginManagerHookRunner | null | undefined) | undefined;
28
55
  }
29
56
  export declare function createPluginManagerTool(opts: CreatePluginManagerToolOptions): Tool;
30
57
  //# sourceMappingURL=plugin-manager.d.ts.map
@@ -162,15 +162,22 @@ export interface FeaturesConfig {
162
162
  allowOutsideProjectRoot?: boolean | undefined;
163
163
  /**
164
164
  * Auto-bootstrap the mailbox HTTP bridge from any WrongStack surface
165
- * (REPL/TUI/WebUI/eternal). When 'auto' (the default), the first
166
- * surface to come up for a given project joins or spawns the bridge
167
- * so external agents can connect without the user running
168
- * `wstack mailbox serve` themselves. 'off' disables this operators
169
- * must start the bridge explicitly (e.g. via the `/mailbox-serve`
170
- * slash command or the standalone `wstack mailbox serve` subcommand).
171
- * The per-project lock + token-persistence model means a second
172
- * surface on the same project joins the first's bridge rather than
173
- * spawning a duplicate.
165
+ * (REPL/TUI/WebUI/eternal).
166
+ *
167
+ * **Default: 'off'.** The bridge is a loopback HTTP façade that exists
168
+ * only so EXTERNAL agents (Claude Code, Aider, scripts) can reach the
169
+ * project mailbox. No WrongStack-internal surface consumes it every
170
+ * in-process caller goes through `RemoteMailbox` over IPC — so booting
171
+ * it by default bought nothing and cost a full detached CLI process
172
+ * (~130 MB resident, with no idle shutdown) per project, forever.
173
+ *
174
+ * Set 'auto' to restore boot-time bootstrap: the first surface to come
175
+ * up for a given project joins or spawns the bridge. The per-project
176
+ * lock + token-persistence model means a second surface on the same
177
+ * project joins the first's bridge rather than spawning a duplicate.
178
+ *
179
+ * Either way the bridge can always be started on demand via the
180
+ * `/mailbox-serve` slash command or `wstack mailbox serve`.
174
181
  */
175
182
  mailboxBridge?: 'auto' | 'off' | undefined;
176
183
  }
@@ -200,9 +207,9 @@ export interface SageConfig {
200
207
  * the result they get appended to.
201
208
  */
202
209
  taskAware?: boolean | undefined;
203
- /** Maximum diverse, structurally related hints appended to a single tool result. Default: 8. */
210
+ /** Maximum diverse, structurally related hints selected for one tool-memory evidence slot. Default: 8. */
204
211
  maxHintsPerTool?: number | undefined;
205
- /** Maximum characters appended to a single tool result. Default: 2800. */
212
+ /** Maximum characters retained in the tool-memory evidence slot. Default: 2800. */
206
213
  maxCharsPerTool?: number | undefined;
207
214
  /** Maximum memories appended to ordinary turn context. Default: 8. */
208
215
  maxTurnMemories?: number | undefined;
@@ -3,7 +3,7 @@ import type { AutonomyConfig, ChronicleConfig, IndexingConfig, LaunchConfig, Ses
3
3
  import type { AdaptiveConcurrencyConfig, CircuitBreakerRuntimeConfig, ContextConfig } from './context.js';
4
4
  import type { FeaturesConfig, LogConfig, MCPServerConfig, PluginConfig, PluginManagerConfig, SageConfig } from './mcp-features.js';
5
5
  import type { CustomModelDefinition, ModelMatrixEntry, ProviderConfig } from './providers.js';
6
- import type { HqClientConfig, ModelRuntimeConfig, SystemPromptConfig } from './runtime.js';
6
+ import type { CloudSyncConfig, HqClientConfig, ModelRuntimeConfig, SystemPromptConfig } from './runtime.js';
7
7
  import type { BrainConfig, FleetConfig, SkillsConfig } from './skills-fleet-brain.js';
8
8
  import type { ToolsConfig } from './tools.js';
9
9
  export interface GitBehaviorConfig {
@@ -225,6 +225,13 @@ export interface Config {
225
225
  * accidentally committing the GitHub token to project configs.
226
226
  */
227
227
  sync?: SyncConfig | undefined;
228
+ /**
229
+ * my.wrongstack.com config synchronization (namespaced sync API v1).
230
+ * SECURITY: in the in-project config DENY list — carries the machine
231
+ * bearer token credential and the portal endpoint URL. Only honoured
232
+ * from the user's active-profile config.
233
+ */
234
+ cloudSync?: CloudSyncConfig | undefined;
228
235
  /**
229
236
  * Git behavior overrides for agent-run git commands.
230
237
  *
@@ -91,6 +91,22 @@ export interface HqClientConfig {
91
91
  /** Override project display name in HQ. */
92
92
  projectAlias?: string | undefined;
93
93
  }
94
+ /**
95
+ * Cloud config-sync settings for my.wrongstack.com (the account portal —
96
+ * distinct from the local HQ command center configured via `hq`). The full
97
+ * client contract, including which config sections sync and which stay
98
+ * local, is the server repo's docs/CLIENT_SYNC_CONTRACT.md.
99
+ */
100
+ export interface CloudSyncConfig {
101
+ /** Enable background config synchronization. */
102
+ enabled?: boolean | undefined;
103
+ /** Portal base URL, e.g. https://my.wrongstack.com. */
104
+ url?: string | undefined;
105
+ /** Machine bearer token (wst_…). Stored encrypted by SecretVault when persisted. */
106
+ token?: string | undefined;
107
+ /** Seconds between background sync passes. Default 300, minimum 60. */
108
+ intervalSeconds?: number | undefined;
109
+ }
94
110
  /**
95
111
  * Token-saving mode tier levels. Controls how aggressively the system prompt
96
112
  * is compacted to reduce per-request token consumption.
@@ -115,12 +131,10 @@ export type ConcreteTokenSavingTier = Exclude<TokenSavingTier, 'auto'>;
115
131
  * Normalize a TokenSavingTier value, handling backward-compatible boolean inputs.
116
132
  * - `true` → 'medium' (existing behavior)
117
133
  * - `false` → 'off'
118
- * - `'auto'` → `'off'` — the `'auto'` sentinel is window-dependent, so EVERY
119
- * consumer that isn't the prompt builder (tool selection, lazy-load gate, TUI
120
- * display) must treat it as the safe no-op `'off'`: it must NOT reduce the
121
- * registered tool set or enable lazy loading on its own. Only the prompt
122
- * builder expands `'auto'` — via {@link resolveTokenSavingTier} — and only for
123
- * the (cache-stable) prompt prose. This keeps auto-tiering capability-neutral.
134
+ * - `'auto'` → `'medium'` — consumers without model-window context use a stable,
135
+ * useful development baseline instead of silently expanding to the full tool
136
+ * catalog. The prompt builder may refine `'auto'` with
137
+ * {@link resolveTokenSavingTier} when the model window is known.
124
138
  * - other valid strings are returned as-is; `undefined`/invalid → 'off'
125
139
  */
126
140
  export declare function normalizeTokenSavingTier(val?: TokenSavingTier | boolean): ConcreteTokenSavingTier;
@@ -18,9 +18,9 @@ export interface SkillsConfig {
18
18
  foreignSources?: boolean | string[] | undefined;
19
19
  /**
20
20
  * How skill bodies reach the system prompt.
21
- * - `'eager'` (default): inject every discovered skill body into the prompt.
22
- * - `'progressive'`: inject only the metadata manifest; the agent loads a
21
+ * - `'progressive'` (default): inject only the metadata manifest; the agent loads a
23
22
  * skill body on demand via the `skill` tool (the agentskills.io model).
23
+ * - `'eager'`: inject discovered skill bodies up to `eagerMaxChars`.
24
24
  */
25
25
  mode?: 'eager' | 'progressive' | undefined;
26
26
  /**
@@ -203,8 +203,9 @@ export interface BrainCouncilConfig {
203
203
  approval?: number | undefined;
204
204
  /**
205
205
  * Per-seat completion timeout (ms). Defaults to `brain.decisionTimeoutMs`,
206
- * then 15000set it when council seats need a longer budget than the
207
- * single-LLM tier.
206
+ * then 45000the council convenes for high-stakes decisions only, and
207
+ * reasoning models often need well over the single-LLM tier's 15s before
208
+ * their first token.
208
209
  */
209
210
  perCallTimeoutMs?: number | undefined;
210
211
  /** Seats polled concurrently, 1..8. Default 3. */
@@ -216,6 +217,13 @@ export interface BrainCouncilConfig {
216
217
  * independence.
217
218
  */
218
219
  distinctness?: 'none' | 'model' | 'provider' | undefined;
220
+ /**
221
+ * Output budget per voter seat call. Default 2000. Reasoning models spend
222
+ * their thinking tokens from this same budget, so a small value starves
223
+ * them into `invalid` votes (empty or truncated JSON) — raise it if seat
224
+ * errors report "response truncated at maxTokens".
225
+ */
226
+ voterMaxTokens?: number | undefined;
219
227
  /** Output budget for the judge call. Default follows the seat budget. */
220
228
  judgeMaxTokens?: number | undefined;
221
229
  /**
@@ -76,6 +76,22 @@ export interface ToolsConfig {
76
76
  * defaults (see DEFAULT_TOOLS_CONFIG.loopDetection).
77
77
  */
78
78
  loopDetection?: LoopDetectionConfig | undefined;
79
+ /**
80
+ * Opt-in `nextsteps` tool — a structured alternative to typing a
81
+ * `<nextsteps>` block into the final message. Both routes stay valid and
82
+ * produce identical results; the tool merely lets the schema enforce the
83
+ * shape. Disabled by default, so the prompt contract and every suggestion
84
+ * surface behave exactly as before unless the user turns it on.
85
+ *
86
+ * Registered for the leader only, and read at boot — a change takes effect
87
+ * in the next session (same as `features.tokenSavingMode`).
88
+ */
89
+ nextsteps?: NextStepsToolConfig | undefined;
90
+ }
91
+ /** Opt-in switch for the agent-callable `nextsteps` tool (`tools.nextsteps`). */
92
+ export interface NextStepsToolConfig {
93
+ /** Register the tool for the leader agent. Default: false. */
94
+ enabled?: boolean | undefined;
79
95
  }
80
96
  /** Tuning for the agent-loop repetition detector (`tools.loopDetection`). */
81
97
  export interface LoopDetectionConfig {
@@ -29,6 +29,7 @@ export interface ContextWindowMode {
29
29
  thresholds: ContextWindowThresholds;
30
30
  aggressiveOn: ContextWindowAggressiveOn;
31
31
  preserveK: number;
32
+ /** Per-block elision baseline used to derive the bounded recent raw tool-I/O window. */
32
33
  eliseThreshold: number;
33
34
  targetLoad: number;
34
35
  }
@@ -69,6 +69,20 @@ export interface HookInput {
69
69
  toolName?: string | undefined;
70
70
  /** Tool arguments (PreToolUse / PostToolUse). */
71
71
  toolInput?: unknown | undefined;
72
+ /**
73
+ * The tool's declared capabilities (PreToolUse), so a policy hook can key on
74
+ * WHAT a tool does instead of what it is called.
75
+ *
76
+ * `matcher` is a list of tool names, which is the only vocabulary a hook had
77
+ * for "tools that write". `path-guard` matched `write|edit|bash|exec` and
78
+ * therefore never saw `patch`, `scaffold`, or any plugin- or MCP-registered
79
+ * writer — a protected path was guarded through four doors and open through
80
+ * the rest. Names cannot be enumerated ahead of a plugin that has not been
81
+ * written yet; capabilities can.
82
+ */
83
+ toolCapabilities?: readonly string[] | undefined;
84
+ /** The tool's `mutating` flag (PreToolUse). See `toolCapabilities`. */
85
+ toolMutating?: boolean | undefined;
72
86
  /** Tool result preview (PostToolUse only). */
73
87
  toolResult?: {
74
88
  content: string;
@@ -10,11 +10,11 @@ export type { SideEffect, SideEffectRisk } from './side-effect.js';
10
10
  export type { SecretScrubber } from './secret-scrubber.js';
11
11
  export type { FileEventRecord } from './file-event-record.js';
12
12
  export { ProviderError, classifyProviderError, effectiveInputTokens, isContextOverflowShaped, isFallbackWorthy, isRetryableKind } from './provider.js';
13
- export type { CacheTtl, Capabilities, JsonSchemaSpec, Provider, ProviderErrorBody, ProviderErrorKind, ReasoningConfig, ReasoningEffort, ReasoningRequest, Request, RequestCacheControl, Response, ResponseFormat, SafetySetting, StopReason, StreamEvent, Usage } from './provider.js';
13
+ export type { CacheTtl, Capabilities, JsonSchemaSpec, Provider, ProviderContextLimit, ProviderErrorBody, ProviderErrorKind, ReasoningConfig, ReasoningEffort, ReasoningRequest, Request, RequestCacheControl, Response, ResponseFormat, SafetySetting, StopReason, StreamEvent, Usage } from './provider.js';
14
14
  export { StreamHangError } from './provider.js';
15
15
  export type { ProviderRunner, RunProviderOptions } from './provider-runner.js';
16
16
  export { DEFAULT_TUI_THINKING_WORD, FLEET_CHAT_VERBOSITY_VALUES, MAX_TUI_THINKING_WORD_LENGTH, normalizeTokenSavingTier, normalizeTuiThinkingWord, resolveFleetChatVerbosity, resolveTokenSavingTier } from './config.js';
17
- export type { AdaptiveConcurrencyConfig, AutonomyConfig, BrainConfig, BrainCouncilConfig, BrainCouncilVoterConfig, BrainModelEntry, CircuitBreakerRuntimeConfig, ConcreteTokenSavingTier, Config, ConfigLoader, ConfigStore, ContextConfig, CouncilPersonaDefinition, CouncilToolConfig, CouncilToolProfileDefinition, CustomModelDefinition, ExecDangerConfig, ExecToolConfig, FeaturesConfig, FleetChatVerbosity, FleetConfig, FleetSupervisorConfig, GitBehaviorConfig, HqClientConfig, IndexingConfig, InputHistoryConfig, LaunchConfig, LaunchMenuChoice, LogConfig, LoopDetectionConfig, MCPHealthConfig, MCPHealthThresholds, MCPServerConfig, ModelMatrixEntry, ModelRuntimeCacheConfig, ModelRuntimeConfig, ModelRuntimeParametersConfig, ModelRuntimeReasoningConfig, PluginConfig, PluginManagerConfig, ProviderApiKey, ProviderConfig, SageConfig, SessionLoggingConfig, SkillsConfig, SyncCategory, SyncConfig, TokenSavingTier, ToolDescriptionMode, ToolDescriptionModeConfig, ToolResultRenderMode, ToolResultRenderModeConfig, ToolsConfig } from './config.js';
17
+ export type { AdaptiveConcurrencyConfig, AutonomyConfig, BrainConfig, BrainCouncilConfig, BrainCouncilVoterConfig, BrainModelEntry, CircuitBreakerRuntimeConfig, ConcreteTokenSavingTier, Config, ConfigLoader, ConfigStore, ContextConfig, CouncilPersonaDefinition, CouncilToolConfig, CouncilToolProfileDefinition, CustomModelDefinition, ExecDangerConfig, ExecToolConfig, FeaturesConfig, FleetChatVerbosity, FleetConfig, FleetSupervisorConfig, GitBehaviorConfig, HqClientConfig, IndexingConfig, InputHistoryConfig, LaunchConfig, LaunchMenuChoice, LogConfig, LoopDetectionConfig, MCPHealthConfig, MCPHealthThresholds, MCPServerConfig, ModelMatrixEntry, ModelRuntimeCacheConfig, ModelRuntimeConfig, ModelRuntimeParametersConfig, ModelRuntimeReasoningConfig, NextStepsToolConfig, PluginConfig, PluginManagerConfig, ProviderApiKey, ProviderConfig, SageConfig, SessionLoggingConfig, SkillsConfig, SyncCategory, SyncConfig, TokenSavingTier, ToolDescriptionMode, ToolDescriptionModeConfig, ToolResultRenderMode, ToolResultRenderModeConfig, ToolsConfig } from './config.js';
18
18
  export type { AnyHookOutcome, ConfiguredHook, HookEntry, HookEvent, HookFailurePolicy, HookInput, HookInvocationContext, HookMatcher, HookOutcome, HookRegistrationOptions, HttpHook, InProcessHook, PreToolUseOutcome, PreToolUseStage, ShellHook } from './hooks.js';
19
19
  export type { Compactor, CompactReport } from './compactor.js';
20
20
  export type { DirectoryPolicy, DirectoryRule, PermissionDecision, PermissionPolicy, PermissionTrace, PermissionTraceStep, TrustPolicy } from './permission.js';
@@ -542,6 +542,7 @@ function resolveFleetChatVerbosity(autonomy) {
542
542
  function normalizeTokenSavingTier(val) {
543
543
  if (val === void 0) return "off";
544
544
  if (typeof val === "boolean") return val ? "medium" : "off";
545
+ if (val === "auto") return "medium";
545
546
  const validTiers = /* @__PURE__ */ new Set([
546
547
  "off",
547
548
  "minimal",
@@ -44,6 +44,8 @@ export interface SubagentConfig {
44
44
  * higher values fire closer to the deadline. Ignored when `timeoutMs` is unset.
45
45
  */
46
46
  preemptFraction?: number | undefined;
47
+ /** Stable capability ids resolved to the host's concrete tool surface. */
48
+ capabilities?: string[] | undefined;
47
49
  tools?: string[] | undefined;
48
50
  /**
49
51
  * Tools to explicitly disable for this subagent. These tools will be
@@ -161,5 +161,21 @@ export interface OneShotOrchestratorOptions {
161
161
  * fallback chain.
162
162
  */
163
163
  statusTracker?: import('../coordination/provider-status-tracker.js').ProviderModelStatusTracker | undefined;
164
+ /**
165
+ * The host's composed `wrapProviderRunner` chain, if it has one.
166
+ *
167
+ * The agent loop runs every provider call through
168
+ * `extensions.wrapProviderRunner(...)`; this orchestrator called
169
+ * `provider.complete()` directly, so `api.llm`, the `one_shot_llm` tool and
170
+ * the council each reached a third-party provider with the chain skipped.
171
+ * That chain is where `prompt-firewall` redacts credentials, where
172
+ * `llm-cache` short-circuits, where `model-router` re-routes and where the
173
+ * token budgeter throttles — none of which applied to a plugin's own
174
+ * completions.
175
+ *
176
+ * Optional because a host may have no extension registry (focused tests,
177
+ * minimal embeddings). Absent, behaviour is exactly as before.
178
+ */
179
+ wrapProviderCall?: ((request: import('./provider.js').Request, inner: (request: import('./provider.js').Request) => Promise<import('./provider.js').Response>) => Promise<import('./provider.js').Response>) | undefined;
164
180
  }
165
181
  //# sourceMappingURL=one-shot-llm.d.ts.map
@@ -284,9 +284,25 @@ export type StreamEvent = {
284
284
  stopReason: StopReason;
285
285
  usage: Usage;
286
286
  };
287
+ export interface ProviderContextLimit {
288
+ /** Provider-authoritative context ceiling for the selected route/model. */
289
+ maxContext: number;
290
+ /** Origin of the live value, surfaced in diagnostics and UI warnings. */
291
+ source: 'provider';
292
+ }
287
293
  export interface Provider {
288
294
  readonly id: string;
289
295
  readonly capabilities: Capabilities;
296
+ /**
297
+ * Optional live capability probe. The agent calls this at request boundaries
298
+ * before context-window middleware runs, allowing a provider-side limit
299
+ * decrease to trigger compaction before the oversized request is sent.
300
+ * Implementations must fail open (return undefined) on transient discovery
301
+ * failures and retain their last verified value locally.
302
+ */
303
+ refreshContextLimit?(model: string, opts: {
304
+ signal: AbortSignal;
305
+ }): Promise<ProviderContextLimit | undefined>;
290
306
  /** Canonical streaming entry point. `complete()` defaults to a wrapper that
291
307
  * aggregates this stream — providers may override for non-streaming wires. */
292
308
  stream(req: Request, opts: {
@@ -0,0 +1,168 @@
1
+ /**
2
+ * Stable runtime capabilities for roster agents and prompt contracts.
3
+ *
4
+ * Agent definitions refer to these capability ids; concrete tool names remain
5
+ * an implementation detail of the active host. Optional providers (MCP,
6
+ * browser automation, plugins) are represented by their stable gateway tools
7
+ * instead of server-specific names.
8
+ */
9
+ export type RuntimeCapabilityPack = 'core' | 'development' | 'memory' | 'fleet' | 'browser' | 'mcp' | 'admin';
10
+ export type RuntimeCapabilityExposure = 'direct' | 'on-demand' | 'internal';
11
+ export interface RuntimeCapabilityDefinition {
12
+ id: string;
13
+ pack: RuntimeCapabilityPack;
14
+ exposure: RuntimeCapabilityExposure;
15
+ tools: readonly string[];
16
+ aliases?: Readonly<Record<string, string>> | undefined;
17
+ }
18
+ export declare const RUNTIME_CAPABILITY_MANIFEST: readonly [{
19
+ readonly id: 'filesystem.read';
20
+ readonly pack: 'core';
21
+ readonly exposure: 'direct';
22
+ readonly tools: readonly ["read", "grep", "glob", "tree"];
23
+ }, {
24
+ readonly id: 'code.inspect';
25
+ readonly pack: 'core';
26
+ readonly exposure: 'direct';
27
+ readonly tools: readonly ["codebase-stats", "codebase-search", "codebase-incoming-calls", "codebase-outgoing-calls", "codebase-index", "dead-code-scan", "diff", "json", "logs"];
28
+ }, {
29
+ readonly id: 'filesystem.write';
30
+ readonly pack: 'development';
31
+ readonly exposure: 'direct';
32
+ readonly tools: readonly ["write", "edit", "replace", "patch"];
33
+ }, {
34
+ readonly id: 'execution.shell';
35
+ readonly pack: 'development';
36
+ readonly exposure: 'direct';
37
+ readonly tools: readonly ["bash", "exec", "language", "language_info", "language_package"];
38
+ }, {
39
+ readonly id: 'verification.run';
40
+ readonly pack: 'development';
41
+ readonly exposure: 'direct';
42
+ readonly tools: readonly ["lint", "format", "typecheck", "test", "e2e_plan"];
43
+ }, {
44
+ readonly id: 'version-control.manage';
45
+ readonly pack: 'development';
46
+ readonly exposure: 'direct';
47
+ readonly tools: readonly ["git"];
48
+ }, {
49
+ readonly id: 'dependencies.manage';
50
+ readonly pack: 'development';
51
+ readonly exposure: 'on-demand';
52
+ readonly tools: readonly ["install", "outdated", "audit"];
53
+ }, {
54
+ readonly id: 'documentation.author';
55
+ readonly pack: 'development';
56
+ readonly exposure: 'on-demand';
57
+ readonly tools: readonly ["document", "design", "scaffold"];
58
+ }, {
59
+ readonly id: 'web.research';
60
+ readonly pack: 'core';
61
+ readonly exposure: 'direct';
62
+ readonly tools: readonly ["search", "fetch"];
63
+ }, {
64
+ readonly id: 'work.plan';
65
+ readonly pack: 'core';
66
+ readonly exposure: 'direct';
67
+ readonly tools: readonly ["todo", "plan", "task", "kanban", "nextsteps"];
68
+ }, {
69
+ readonly id: 'coordination.mailbox';
70
+ readonly pack: 'fleet';
71
+ readonly exposure: 'direct';
72
+ readonly tools: readonly ["mailbox", "mail_send", "mail_inbox", "fleet_status"];
73
+ }, {
74
+ readonly id: 'fleet.delegate';
75
+ readonly pack: 'fleet';
76
+ readonly exposure: 'on-demand';
77
+ readonly tools: readonly ["delegate", "spawn_subagent", "assign_task", "kanban_queue", "await_tasks", "ask_subagent", "ask_result", "roll_up", "quality_gate", "terminate_subagent", "terminate_all", "work_complete", "collab_debug", "fleet_emit", "fleet"];
78
+ }, {
79
+ readonly id: 'reasoning.oneshot';
80
+ readonly pack: 'core';
81
+ readonly exposure: 'on-demand';
82
+ readonly tools: readonly ["llm", "council"];
83
+ }, {
84
+ readonly id: 'memory.manage';
85
+ readonly pack: 'memory';
86
+ readonly exposure: 'on-demand';
87
+ readonly tools: readonly ["remember", "search_memory", "find_related_memories", "forget"];
88
+ }, {
89
+ readonly id: 'memory.curate';
90
+ readonly pack: 'memory';
91
+ readonly exposure: 'on-demand';
92
+ readonly tools: readonly ["memory_candidates", "memory_update", "memory_delete", "memory_recover", "memory_backfill_recoverable", "memory_for_file", "memory_for_path", "memory_search", "memory_graph", "memory_gather_batch", "memory_verify", "memory_hygiene"];
93
+ }, {
94
+ readonly id: 'browser.interact';
95
+ readonly pack: 'browser';
96
+ readonly exposure: 'on-demand';
97
+ readonly tools: readonly ["browser_open", "browser_status", "browser_list", "browser_navigate", "browser_snapshot", "browser_screenshot", "browser_click", "browser_type", "browser_select", "browser_press", "browser_hover", "browser_drag", "browser_wait", "browser_evaluate", "browser_upload", "browser_close"];
98
+ readonly aliases: {
99
+ readonly playwright_navigate: 'browser_navigate';
100
+ readonly playwright_screenshot: 'browser_screenshot';
101
+ readonly playwright_click: 'browser_click';
102
+ readonly playwright_type: 'browser_type';
103
+ readonly playwright_evaluate: 'browser_evaluate';
104
+ readonly playwright_select_option: 'browser_select';
105
+ readonly playwright_hover: 'browser_hover';
106
+ readonly playwright_fill_form: 'browser_type';
107
+ readonly playwright_wait_for: 'browser_wait';
108
+ readonly playwright_press_key: 'browser_press';
109
+ readonly playwright_drag: 'browser_drag';
110
+ };
111
+ }, {
112
+ readonly id: 'mcp.dynamic';
113
+ readonly pack: 'mcp';
114
+ readonly exposure: 'on-demand';
115
+ readonly tools: readonly ["mcp_use"];
116
+ }, {
117
+ readonly id: 'automation.manage';
118
+ readonly pack: 'admin';
119
+ readonly exposure: 'on-demand';
120
+ readonly tools: readonly ["cron_schedule", "cron_list", "cron_cancel", "watch_start", "watch_list", "watch_stop"];
121
+ }, {
122
+ readonly id: 'context.pin';
123
+ readonly pack: 'admin';
124
+ readonly exposure: 'on-demand';
125
+ readonly tools: readonly ["pin_add", "pin_list", "pin_remove"];
126
+ }, {
127
+ readonly id: 'quality.analyze';
128
+ readonly pack: 'development';
129
+ readonly exposure: 'on-demand';
130
+ readonly tools: readonly ["dead_code_scan", "detect_duplicate_code", "secret_scanner_test", "error_lens_history"];
131
+ }, {
132
+ readonly id: 'release.manage';
133
+ readonly pack: 'development';
134
+ readonly exposure: 'on-demand';
135
+ readonly tools: readonly ["git_autocommit", "semver_current", "semver_bump", "semver_changelog"];
136
+ }, {
137
+ readonly id: 'messaging.telegram';
138
+ readonly pack: 'fleet';
139
+ readonly exposure: 'on-demand';
140
+ readonly tools: readonly ["telegram_send", "telegram_read", "telegram_approve"];
141
+ }, {
142
+ readonly id: 'tools.discover';
143
+ readonly pack: 'admin';
144
+ readonly exposure: 'direct';
145
+ readonly tools: readonly ["tool_search", "tool_use", "tool_help", "batch_tool_use"];
146
+ }, {
147
+ readonly id: 'runtime.admin';
148
+ readonly pack: 'admin';
149
+ readonly exposure: 'internal';
150
+ readonly tools: readonly ["set_working_dir", "context_manager", "mode", "skill", "mcp_control"];
151
+ }];
152
+ export type RuntimeCapabilityId = (typeof RUNTIME_CAPABILITY_MANIFEST)[number]['id'];
153
+ export declare function toolsForRuntimeCapabilities(capabilityIds: readonly RuntimeCapabilityId[]): string[];
154
+ export declare function normalizeRuntimeToolName(name: string): string;
155
+ export declare function runtimeCapabilityForTool(name: string): RuntimeCapabilityId | undefined;
156
+ export declare function isKnownRuntimeCapability(id: string): id is RuntimeCapabilityId;
157
+ export declare function inferRuntimeCapabilities(toolNames: readonly string[]): RuntimeCapabilityId[];
158
+ export declare function missingRuntimeCapabilities(required: readonly string[] | undefined, toolNames: readonly string[]): string[];
159
+ export declare function missingRequiredRuntimeTools(required: readonly string[] | undefined, toolNames: readonly string[]): string[];
160
+ /**
161
+ * Extract tool-shaped references from skill/instruction prose. Canonical names
162
+ * are recognized anywhere inside inline code. Unknown names are included only
163
+ * when the prose presents them imperatively or explicitly calls them a tool,
164
+ * avoiding false positives for ordinary APIs and config fields.
165
+ */
166
+ export declare function runtimeToolReferencesFromText(text: string): string[];
167
+ export declare function isDeprecatedRuntimeToolAlias(name: string): boolean;
168
+ //# sourceMappingURL=runtime-capability-manifest.d.ts.map
@@ -19,6 +19,11 @@ export interface SkillManifest {
19
19
  * grants nor restricts any tool.
20
20
  */
21
21
  allowedTools?: string[] | undefined;
22
+ /** Stable WrongStack runtime capabilities required to activate this skill. */
23
+ requiredCapabilities?: string[] | undefined;
24
+ requiredTools?: string[] | undefined;
25
+ /** Optional capabilities; the skill must remain useful when these are absent. */
26
+ optionalCapabilities?: string[] | undefined;
22
27
  path: string;
23
28
  /**
24
29
  * Discovery layer the skill came from. `claude-*`, `foreign`, and `extra` are
@@ -1,6 +1,6 @@
1
+ import type { MailboxAgentStatus } from '../coordination/mailbox-types.js';
1
2
  import type { TextBlock } from './blocks.js';
2
3
  import type { Tool } from './tool.js';
3
- import type { MailboxAgentStatus } from '../coordination/mailbox-types.js';
4
4
  /** Model capabilities relevant to prompt composition. */
5
5
  export interface ModelCapabilities {
6
6
  maxContextTokens: number;
@@ -12,6 +12,8 @@ export interface BuildContext {
12
12
  cwd: string;
13
13
  projectRoot: string;
14
14
  tools: Tool[];
15
+ /** Complete enabled catalog, including tools reachable only through lazy gateways. */
16
+ catalogTools?: Tool[] | undefined;
15
17
  /** Provider id (e.g. "anthropic", "minimax-coding-plan"). */
16
18
  provider?: string | undefined;
17
19
  /** Model id (e.g. "configured-model", "MiniMax-M2.7"). */
@@ -102,6 +102,10 @@ export interface ToolConfirmPendingResult {
102
102
  toolUseId: string;
103
103
  toolName: string;
104
104
  input: unknown;
105
+ preToolContext?: {
106
+ text: string;
107
+ contextAs: 'inline' | 'separate';
108
+ } | undefined;
105
109
  suggestedPattern: string;
106
110
  decisionSource?: import('./permission.js').PermissionDecision['source'] | undefined;
107
111
  riskTier?: import('./tool.js').RiskTier | undefined;
@@ -139,7 +143,10 @@ export interface ToolExecutorLike {
139
143
  * `bytes` from the running budget — no second `Buffer.byteLength`
140
144
  * walk, and no `JSON.stringify` fallback for structured results.
141
145
  */
142
- executeTool(tool: Tool, use: ToolUseBlock, ctx: import('../core/context.js').Context, budget: number): Promise<{
146
+ executeTool(tool: Tool, use: ToolUseBlock, ctx: import('../core/context.js').Context, budget: number, preToolContext?: {
147
+ text: string;
148
+ contextAs: 'inline' | 'separate';
149
+ }): Promise<{
143
150
  block: ToolResultBlock;
144
151
  bytes: number;
145
152
  }>;
@@ -1,5 +1,5 @@
1
- import { type SystemBlockSource } from '../core/system-prompt-builder.js';
2
1
  import type { Context } from '../core/context.js';
2
+ import { type SystemBlockSource } from '../core/system-prompt-builder.js';
3
3
  /**
4
4
  * Real, per-category token accounting for the live context window — the data
5
5
  * behind an honest `/context` display. Every number is measured from the actual
@@ -25,10 +25,16 @@ export interface ContextBreakdown {
25
25
  };
26
26
  history: {
27
27
  total: number;
28
- /** User/assistant text + tool_use inputs + thinking. */
28
+ /** User/assistant/system text only. */
29
29
  text: number;
30
+ /** Serialized tool_use arguments. Optional for backward-compatible UI snapshots. */
31
+ toolInputs?: number | undefined;
30
32
  /** tool_result output content. */
31
33
  toolResults: number;
34
+ /** Preserved provider reasoning/thinking blocks. */
35
+ thinking?: number | undefined;
36
+ /** Images and future/unknown content block kinds. */
37
+ other?: number | undefined;
32
38
  messageCount: number;
33
39
  };
34
40
  volatile: {
@@ -32,7 +32,7 @@ export { getPerfProfile, indexParallelBatchSize, isFrugalPerf, type PerfProfile,
32
32
  export { isPidAlive } from './pid.js';
33
33
  export * from './project-identity.js';
34
34
  export { type ProjectWatchEvent, type ProjectWatchSubscription, watchProjectTree, } from './project-watch.js';
35
- export { type CompileFail, type CompileResult, compileUserRegex } from './regex-guard.js';
35
+ export { capSubject, type CompileFail, type CompileResult, compileUserRegex, MAX_SUBJECT_LEN, } from './regex-guard.js';
36
36
  export * from './safe-json.js';
37
37
  export { sessionScopedPath } from './session-scoped-path.js';
38
38
  export * from './sleep.js';