@wrongstack/core 0.280.1 → 0.281.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.
- package/dist/{agent-subagent-runner-PoqNKiR4.d.ts → agent-subagent-runner-DyOSK2Wy.d.ts} +39 -8
- package/dist/{compactor-U3agvUIG.d.ts → compactor-BxddyCFu.d.ts} +1 -1
- package/dist/{config-Cr3312zc.d.ts → config-CN-vdDEI.d.ts} +82 -2
- package/dist/coordination/index.d.ts +203 -20
- package/dist/coordination/index.js +981 -52
- package/dist/coordination/index.js.map +1 -1
- package/dist/defaults/index.d.ts +26 -30
- package/dist/defaults/index.js +382 -30
- package/dist/defaults/index.js.map +1 -1
- package/dist/{events-Bs2fmldo.d.ts → events-C5hLU0AT.d.ts} +38 -2
- package/dist/execution/index.d.ts +16 -16
- package/dist/execution/index.js +161 -18
- package/dist/execution/index.js.map +1 -1
- package/dist/execution/prompt-enhancer.d.ts +1 -1
- package/dist/execution/prompt-enhancer.js +12 -3
- package/dist/execution/prompt-enhancer.js.map +1 -1
- package/dist/extension/index.d.ts +6 -6
- package/dist/{global-mailbox-Ct7IorLJ.d.ts → global-mailbox-CHM1QkCi.d.ts} +5 -2
- package/dist/{goal-store-C4F6DjC0.d.ts → goal-store-BLGZq16t.d.ts} +1 -1
- package/dist/hq/index.d.ts +6 -6
- package/dist/hq/index.js +35 -13
- package/dist/hq/index.js.map +1 -1
- package/dist/{index-nP09-oP2.d.ts → index-BEFWNZYs.d.ts} +1 -2
- package/dist/{index-kidebiDh.d.ts → index-C1E-_71T.d.ts} +6 -6
- package/dist/index.d.ts +44 -48
- package/dist/index.js +14855 -13944
- package/dist/index.js.map +1 -1
- package/dist/infrastructure/index.d.ts +60 -8
- package/dist/infrastructure/index.js.map +1 -1
- package/dist/kernel/index.d.ts +11 -11
- package/dist/kernel/index.js.map +1 -1
- package/dist/{mcp-servers-D910X5_r.d.ts → mcp-servers-EKRAcJDi.d.ts} +97 -4
- package/dist/models/index.d.ts +4 -5
- package/dist/models/index.js +22 -5
- package/dist/models/index.js.map +1 -1
- package/dist/{multi-agent-coordinator-CieyUoEL.d.ts → multi-agent-coordinator-IpHCuHUa.d.ts} +29 -1
- package/dist/{null-fleet-bus-DkdmZJ_W.d.ts → null-fleet-bus-ZBkKGR9j.d.ts} +105 -7
- package/dist/observability/index.d.ts +3 -3
- package/dist/{tool-executor-SiE1wlZo.d.ts → parallel-eternal-engine-Cc2CNgmv.d.ts} +6 -202
- package/dist/path-resolver-CMS5307d.d.ts +13 -0
- package/dist/{permission-Dx6dIqS2.d.ts → permission-B6YAtNFz.d.ts} +1 -1
- package/dist/{pipeline-BwAP21_4.d.ts → pipeline-E7_jqGyV.d.ts} +2 -2
- package/dist/{provider-model-resolve-CwQNZWt_.d.ts → provider-model-resolve-KgIdiEQ6.d.ts} +118 -5
- package/dist/{provider-runner-CYHFImzV.d.ts → provider-runner-DxWXNHL1.d.ts} +3 -3
- package/dist/{retry-policy-D4feSLk3.d.ts → retry-policy-V67lBOJz.d.ts} +2 -2
- package/dist/sdd/index.d.ts +9 -9
- package/dist/sdd/index.js +94 -10
- package/dist/sdd/index.js.map +1 -1
- package/dist/{permission-policy-C8vJcnX5.d.ts → secret-vault-D7jeyXUQ.d.ts} +119 -3
- package/dist/security/index.d.ts +5 -6
- package/dist/security/index.js +4 -1
- package/dist/security/index.js.map +1 -1
- package/dist/{selector-Dy-MzKp1.d.ts → selector-Bx2HgUkU.d.ts} +1 -1
- package/dist/{session-event-bridge-CqdiGnfU.d.ts → session-event-bridge-vA2fLV58.d.ts} +1 -1
- package/dist/{session-reader-Hk0WbNm9.d.ts → session-reader-B-Fi9L6I.d.ts} +1 -1
- package/dist/session-registry-Dvg7i_IA.d.ts +129 -0
- package/dist/storage/index.d.ts +71 -142
- package/dist/storage/index.js +161 -13
- package/dist/storage/index.js.map +1 -1
- package/dist/{todos-checkpoint-Bk2uP7Ex.d.ts → todos-checkpoint-B1QVkoa8.d.ts} +23 -5
- package/dist/{tool-BkOgs_KL.d.ts → tool-LVSLiE1s.d.ts} +18 -4
- package/dist/{strategy-compactor-CQwhbErd.d.ts → tool-executor-BWtYwuPI.d.ts} +210 -12
- package/dist/tools/index.d.ts +2 -2
- package/dist/tools/index.js.map +1 -1
- package/dist/types/index.d.ts +17 -41
- package/dist/types/index.js +182 -5085
- package/dist/types/index.js.map +1 -1
- package/dist/utils/index.d.ts +3 -3
- package/dist/utils/index.js +6 -1
- package/dist/utils/index.js.map +1 -1
- package/dist/{worktree-manager-BjOFF6bt.d.ts → worktree-manager-C6CIilTT.d.ts} +1 -1
- package/dist/{wstack-paths-CMl_cYgq.d.ts → wstack-paths-C3K40Qst.d.ts} +2 -0
- package/instructions/agents/shadow-agent.md +23 -84
- package/instructions/coordination/director-preamble.md +12 -3
- package/instructions/coordination/subagent-baseline.md +39 -46
- package/instructions/leader-after-task.md +10 -28
- package/instructions/llm/llm-selector.md +1 -2
- package/instructions/modes/brief-system.md +7 -33
- package/instructions/modes/brief.md +5 -20
- package/instructions/modes/teach-system.md +12 -72
- package/instructions/modes/teach.md +12 -49
- package/instructions/sections/tool/commit-hygiene.md +5 -5
- package/instructions/sections/tool/context-management-full.md +6 -6
- package/instructions/sections/tool/delegation-compact.md +1 -1
- package/instructions/sections/tool/delegation-full.md +19 -23
- package/instructions/sections/tool/mailbox-full.md +11 -31
- package/instructions/sections/tool/mcp-full-control.md +5 -7
- package/instructions/sections/tool/mcp-full-use.md +7 -7
- package/instructions/system.md +22 -38
- package/package.json +1 -29
- package/dist/agent-bridge-DXC6QDJ4.d.ts +0 -35
- package/dist/logger-D3lV0cUZ.d.ts +0 -101
- package/dist/models-registry-CLkoOcHk.d.ts +0 -108
- package/dist/path-resolver-XfZ9eLxG.d.ts +0 -67
- package/dist/secret-vault-CImt2XrR.d.ts +0 -118
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { A as AttachmentStore, a as AddAttachmentInput, b as AttachmentRef, c as Attachment } from './session-reader-
|
|
2
|
-
import { i as ContentBlock,
|
|
3
|
-
import { E as EventBus, M as MemoryScope, b as MemoryEntry, c as MemoryStore, d as MemoryRelevanceContext, S as ScoredEntry } from './events-
|
|
4
|
-
import { C as Config,
|
|
1
|
+
import { A as AttachmentStore, a as AddAttachmentInput, b as AttachmentRef, c as Attachment } from './session-reader-B-Fi9L6I.js';
|
|
2
|
+
import { i as ContentBlock, u as ConversationState, k as SessionStore, S as SessionEvent, j as SessionMetadata, b as SessionWriter, v as ResumedSession, w as SessionData, x as SessionSummary, y as TodoItem } from './tool-LVSLiE1s.js';
|
|
3
|
+
import { E as EventBus, M as MemoryScope, b as MemoryEntry, c as MemoryStore, d as MemoryRelevanceContext, S as ScoredEntry } from './events-C5hLU0AT.js';
|
|
4
|
+
import { C as Config, i as ConfigLoader, j as SyncConfig, k as ConfigStore } from './config-CN-vdDEI.js';
|
|
5
5
|
import { S as SecretVault } from './secret-vault-BAKpgFw_.js';
|
|
6
|
-
import { W as WstackPaths } from './wstack-paths-
|
|
6
|
+
import { W as WstackPaths } from './wstack-paths-C3K40Qst.js';
|
|
7
7
|
import { S as SecretScrubber } from './secret-scrubber-3MHDDAtm.js';
|
|
8
8
|
|
|
9
9
|
interface AttachmentStoreOptions {
|
|
@@ -617,11 +617,22 @@ interface SessionStoreOptions {
|
|
|
617
617
|
* conversation-turn gap (finding F-06).
|
|
618
618
|
*/
|
|
619
619
|
secretScrubber?: SecretScrubber | undefined;
|
|
620
|
+
/**
|
|
621
|
+
* Optional guard consulted by {@link DefaultSessionStore.delete} before
|
|
622
|
+
* removing a session. Returns `true` if the session is currently in use by
|
|
623
|
+
* any live process (e.g. it is the active session of another terminal, TUI,
|
|
624
|
+
* or WebUI in this project). The store ALWAYS also checks `active.json`
|
|
625
|
+
* directly; this callback widens the check to cross-process live sessions
|
|
626
|
+
* via the SessionRegistry. When omitted, only the `active.json` check runs.
|
|
627
|
+
* Resolves to a human-readable reason when in use, or `null` when safe.
|
|
628
|
+
*/
|
|
629
|
+
isSessionInUse?: ((sessionId: string) => Promise<string | null>) | undefined;
|
|
620
630
|
}
|
|
621
631
|
declare class DefaultSessionStore implements SessionStore {
|
|
622
632
|
private readonly dir;
|
|
623
633
|
private readonly events?;
|
|
624
634
|
private readonly secretScrubber?;
|
|
635
|
+
private readonly isSessionInUse?;
|
|
625
636
|
/**
|
|
626
637
|
* In-memory cache for load() results, keyed by session ID. The cache is
|
|
627
638
|
* invalidated when the file's mtimeMs or size changes (indicating the
|
|
@@ -777,7 +788,14 @@ declare class DefaultSessionStore implements SessionStore {
|
|
|
777
788
|
* to the caller so prune() can report it.
|
|
778
789
|
*/
|
|
779
790
|
private deleteSession;
|
|
791
|
+
/**
|
|
792
|
+
* Read the session id currently marked active in `active.json`, or `null`
|
|
793
|
+
* when the lock is absent/unreadable. Shared by {@link delete} and
|
|
794
|
+
* {@link prune} to avoid clobbering a session a live process is writing to.
|
|
795
|
+
*/
|
|
796
|
+
private readActiveSessionId;
|
|
780
797
|
delete(id: string): Promise<void>;
|
|
798
|
+
rename(id: string, name: string): Promise<SessionSummary>;
|
|
781
799
|
prune(maxAgeDays?: number): Promise<number>;
|
|
782
800
|
clearHistory(id: string): Promise<void>;
|
|
783
801
|
private summarize;
|
|
@@ -73,7 +73,6 @@ declare function isTextBlock(b: ContentBlock): b is TextBlock;
|
|
|
73
73
|
declare function isToolUseBlock(b: ContentBlock): b is ToolUseBlock;
|
|
74
74
|
declare function isToolResultBlock(b: ContentBlock): b is ToolResultBlock;
|
|
75
75
|
declare function isImageBlock(b: ContentBlock): b is ImageBlock;
|
|
76
|
-
declare function isThinkingBlock(b: ContentBlock): b is ThinkingBlock;
|
|
77
76
|
|
|
78
77
|
/**
|
|
79
78
|
* Side-effect risk classification for structured audit recording (P2 #5).
|
|
@@ -131,8 +130,6 @@ interface Message {
|
|
|
131
130
|
*/
|
|
132
131
|
_estTokens?: number | undefined;
|
|
133
132
|
}
|
|
134
|
-
declare function asBlocks(content: string | ContentBlock[]): ContentBlock[];
|
|
135
|
-
declare function asText(content: string | ContentBlock[]): string;
|
|
136
133
|
|
|
137
134
|
/**
|
|
138
135
|
* WrongStack error hierarchy.
|
|
@@ -1056,6 +1053,15 @@ type FileSnapshot = {
|
|
|
1056
1053
|
interface SessionSummary {
|
|
1057
1054
|
id: string;
|
|
1058
1055
|
title: string;
|
|
1056
|
+
/**
|
|
1057
|
+
* Optional user-supplied name for the session. Unlike {@link title} (which
|
|
1058
|
+
* is auto-derived from the first user message and overwritten on every
|
|
1059
|
+
* rebuild), `name` is set explicitly via {@link SessionStore.rename} and
|
|
1060
|
+
* persisted in the `.summary.json` sidecar and `_index.jsonl`. Listings
|
|
1061
|
+
* should prefer `name` over `title` when present; `title` remains the
|
|
1062
|
+
* fallback and stays in sync as the conversation evolves.
|
|
1063
|
+
*/
|
|
1064
|
+
name?: string | undefined;
|
|
1059
1065
|
startedAt: string;
|
|
1060
1066
|
/** When the session finished (null if still running / crashed). */
|
|
1061
1067
|
endedAt?: string | undefined;
|
|
@@ -1108,6 +1114,14 @@ interface SessionStore {
|
|
|
1108
1114
|
*/
|
|
1109
1115
|
resume(id: string): Promise<ResumedSession>;
|
|
1110
1116
|
list(limit?: number): Promise<SessionSummary[]>;
|
|
1117
|
+
/**
|
|
1118
|
+
* Set or clear a user-supplied name on a session. An empty/whitespace
|
|
1119
|
+
* `name` clears the field (the summary's auto-derived `title` remains).
|
|
1120
|
+
* Persists the change to the `.summary.json` sidecar and updates the
|
|
1121
|
+
* `_index.jsonl` cache so subsequent `list()` calls reflect it.
|
|
1122
|
+
* Returns the refreshed summary. Throws if the session does not exist.
|
|
1123
|
+
*/
|
|
1124
|
+
rename(id: string, name: string): Promise<SessionSummary>;
|
|
1111
1125
|
delete(id: string): Promise<void>;
|
|
1112
1126
|
/**
|
|
1113
1127
|
* Rewrite the session JSONL file to contain only a fresh session_start
|
|
@@ -1974,4 +1988,4 @@ interface ToolErrorInfo {
|
|
|
1974
1988
|
readonly detail?: string;
|
|
1975
1989
|
}
|
|
1976
1990
|
|
|
1977
|
-
export { type MessageRole as $, type
|
|
1991
|
+
export { type MessageRole as $, type ToolResultBlock as A, AgentError as B, type CacheStats as C, type CompletedWorkEvidence as D, type CompletedWorkSource as E, ConfigError as F, type ContextEvidenceState as G, type ContextFileEvidence as H, type ContextInit as I, type JSONSchema as J, type ContextIntentEvidence as K, type ContextRepeatedReadEvidence as L, type Message as M, ERROR_CODES as N, type ErrorCode as O, type Provider as P, type ErrorSeverity as Q, type ReasoningRequest as R, type SessionEvent as S, type TokenCounter as T, type Usage as U, type ErrorSubsystem as V, FetchError as W, type FileSnapshot as X, FsError as Y, type ImageBlock as Z, type JsonSchemaSpec as _, type ReasoningConfig as a, ParseError as a0, PluginError as a1, type ProviderErrorBody as a2, type ReadonlyConversationState as a3, type RequestCacheControl as a4, type ResponseFormat as a5, type RunEnv as a6, type SafetySetting as a7, SddError as a8, SessionError as a9, isSessionError as aA, isTextBlock as aB, isToolError as aC, isToolResultBlock as aD, isToolUseBlock as aE, isToolValidationError as aF, isWrongStackError as aG, toWrongStackError as aH, wrapAsState as aI, type SideEffect as aa, type SideEffectRisk as ab, type StateChange as ac, type StateChangeHandler as ad, type StopReason as ae, type StreamEvent as af, StreamHangError as ag, type ThinkingBlock as ah, type ToolCallContext as ai, ToolError as aj, type ToolErrorInfo as ak, type ToolEvidenceStatus as al, type ToolFinalEvent as am, type ToolIconId as an, type ToolStreamEvent as ao, ToolValidationError as ap, WrongStackError as aq, extractRunEnv as ar, isAgentError as as, isConfigError as at, isFetchError as au, isFsError as av, isImageBlock as aw, isParseError as ax, isPluginError as ay, isSddError as az, type SessionWriter as b, type Request as c, Context as d, type Response as e, type Permission as f, type Tool as g, ProviderError as h, type ContentBlock as i, type SessionMetadata as j, type SessionStore as k, ToolErrorCategory as l, type ToolProgressEvent as m, type RiskTier as n, type ToolOutputMetadata as o, type ReasoningEffort as p, type CacheTtl as q, type Capabilities as r, type TextBlock as s, type RunOptions as t, ConversationState as u, type ResumedSession as v, type SessionData as w, type SessionSummary as x, type TodoItem as y, type ToolUseBlock as z };
|
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { E as EventBus } from './events-
|
|
3
|
-
import { M as MiddlewareHandler, b as Middleware } from './pipeline-
|
|
4
|
-
import { S as SessionEventBridge } from './session-event-bridge-
|
|
5
|
-
import { C as Compactor, a as CompactReport } from './compactor-
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { R as RunResult, S as SystemPromptContributor, A as AgentPipelines,
|
|
9
|
-
import { D as DesignStack, a as DesignStudioState, b as DesignKitLoader, c as DesignKitManifest, d as DesignKitEntry, e as DesignKitTokens } from './
|
|
10
|
-
import {
|
|
1
|
+
import { d as Context, c as Request, P as Provider, h as ProviderError, g as Tool, z as ToolUseBlock, A as ToolResultBlock } from './tool-LVSLiE1s.js';
|
|
2
|
+
import { E as EventBus } from './events-C5hLU0AT.js';
|
|
3
|
+
import { M as MiddlewareHandler, b as Middleware } from './pipeline-E7_jqGyV.js';
|
|
4
|
+
import { S as SessionEventBridge } from './session-event-bridge-vA2fLV58.js';
|
|
5
|
+
import { C as Compactor, a as CompactReport } from './compactor-BxddyCFu.js';
|
|
6
|
+
import { l as ContextWindowAggressiveOn, m as ContextWindowPolicy, M as ModelsRegistry, C as Config } from './config-CN-vdDEI.js';
|
|
7
|
+
import { A as Agent, D as DoneCondition } from './agent-subagent-runner-DyOSK2Wy.js';
|
|
8
|
+
import { R as RunResult, S as SystemPromptContributor, A as AgentPipelines, T as ToolCallPipelinePayload, U as UserInputPayload, f as ToolExecutorOptions, g as ToolExecutorStrategy, h as ToolBatchResult } from './index-C1E-_71T.js';
|
|
9
|
+
import { D as DesignStack, a as DesignStudioState, b as DesignKitLoader, c as DesignKitManifest, d as DesignKitEntry, e as DesignKitTokens } from './parallel-eternal-engine-Cc2CNgmv.js';
|
|
10
|
+
import { E as ErrorHandler, a as RecoveryDecision, R as RetryPolicy } from './retry-policy-V67lBOJz.js';
|
|
11
|
+
import { M as MessageSelector } from './selector-Bx2HgUkU.js';
|
|
11
12
|
import { S as SkillLoader, a as SkillManifest, b as SkillEntry } from './skill-DHniprNl.js';
|
|
12
|
-
import { W as WstackPaths } from './wstack-paths-
|
|
13
|
+
import { W as WstackPaths } from './wstack-paths-C3K40Qst.js';
|
|
13
14
|
import { P as PromptLoader, a as PromptEntry, b as PromptSearchOptions, c as PromptCategoryCount } from './prompt-DLd35n4Q.js';
|
|
14
15
|
|
|
15
16
|
interface ContextWindowBudgetSnapshot {
|
|
@@ -219,6 +220,52 @@ interface AutonomyPromptContributorOptions {
|
|
|
219
220
|
*/
|
|
220
221
|
declare function makeAutonomyPromptContributor(opts: AutonomyPromptContributorOptions): SystemPromptContributor;
|
|
221
222
|
|
|
223
|
+
interface CompactorOptions {
|
|
224
|
+
preserveK?: number | undefined;
|
|
225
|
+
eliseThreshold?: number | undefined;
|
|
226
|
+
/**
|
|
227
|
+
* Enable content-aware digest mode. When true, `collapseAncientTurns` uses
|
|
228
|
+
* `buildSmartDigest` which scores messages by importance: critical content
|
|
229
|
+
* (errors, corrections, decisions) is kept verbatim; normal exchanges get
|
|
230
|
+
* first-sentence summaries; large tool outputs and repeated failures are
|
|
231
|
+
* aggressively compressed. Defaults to false (lossless digest).
|
|
232
|
+
*/
|
|
233
|
+
smart?: boolean | undefined;
|
|
234
|
+
/**
|
|
235
|
+
* @deprecated Ignored. Token estimation is centralized in
|
|
236
|
+
* `compaction-core`/`token-estimate` so all compactors and the context-pressure
|
|
237
|
+
* monitor agree on one number. Kept only for backward-compatible call sites.
|
|
238
|
+
*/
|
|
239
|
+
estimator?: (((text: string) => number)) | undefined;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
declare class HybridCompactor implements Compactor {
|
|
243
|
+
private readonly preserveK;
|
|
244
|
+
private readonly eliseThreshold;
|
|
245
|
+
private readonly smart;
|
|
246
|
+
constructor(opts?: CompactorOptions);
|
|
247
|
+
compact(ctx: Context, opts?: {
|
|
248
|
+
aggressive?: boolean | undefined;
|
|
249
|
+
}): Promise<CompactReport>;
|
|
250
|
+
/**
|
|
251
|
+
* Estimate the full API request token count: messages + systemPrompt + toolDefs.
|
|
252
|
+
* This is the accurate figure for context-window pressure monitoring.
|
|
253
|
+
*/
|
|
254
|
+
private estimateFullRequest;
|
|
255
|
+
/**
|
|
256
|
+
* Lossless rule-based collapse of ancient turns into a single digest message.
|
|
257
|
+
*
|
|
258
|
+
* Preserves ALL textual content of the collapsed range — user instructions,
|
|
259
|
+
* assistant decisions/conclusions, and any prior digests (chained forward so
|
|
260
|
+
* the digest stays lossless across repeated compactions). Only `tool_use` /
|
|
261
|
+
* `tool_result` protocol blocks are dropped and replaced with a count marker;
|
|
262
|
+
* their full payload already lives in the session log. No sub-LLM call.
|
|
263
|
+
*
|
|
264
|
+
* Returns the token savings and the digest text (for audit logging).
|
|
265
|
+
*/
|
|
266
|
+
private collapseAncientTurns;
|
|
267
|
+
}
|
|
268
|
+
|
|
222
269
|
/**
|
|
223
270
|
* Design Studio detection + injection middleware.
|
|
224
271
|
*
|
|
@@ -420,6 +467,38 @@ declare function clearPersistedActiveKit(projectRoot: string): Promise<void>;
|
|
|
420
467
|
/** Test helper — clears the rules cache. */
|
|
421
468
|
declare function _resetDesignRulesCache(): void;
|
|
422
469
|
|
|
470
|
+
/**
|
|
471
|
+
* Tiered error recovery strategies.
|
|
472
|
+
* Each strategy is attempted in order until one returns a decision.
|
|
473
|
+
*/
|
|
474
|
+
interface RecoveryStrategy {
|
|
475
|
+
/** Human-readable label for logs. */
|
|
476
|
+
label: string;
|
|
477
|
+
/** Optional compactor for context_overflow recovery. */
|
|
478
|
+
compactor?: Compactor | undefined;
|
|
479
|
+
/** Returns an explicit recovery decision, or null to fall through. */
|
|
480
|
+
attempt: (err: unknown, ctx: Context) => Promise<RecoveryDecision | null>;
|
|
481
|
+
}
|
|
482
|
+
/**
|
|
483
|
+
* Builds the ordered list of recovery strategies used by DefaultErrorHandler.
|
|
484
|
+
* Exported so callers can customise or extend the strategy chain.
|
|
485
|
+
*/
|
|
486
|
+
declare function buildRecoveryStrategies(opts?: {
|
|
487
|
+
compactor?: Compactor | undefined;
|
|
488
|
+
modelsRegistry?: ModelsRegistry | undefined;
|
|
489
|
+
getConfig?: (() => Config) | undefined;
|
|
490
|
+
}): RecoveryStrategy[];
|
|
491
|
+
declare const DEFAULT_RECOVERY_STRATEGIES: RecoveryStrategy[];
|
|
492
|
+
declare class DefaultErrorHandler implements ErrorHandler {
|
|
493
|
+
private readonly strategies;
|
|
494
|
+
constructor(strategies?: RecoveryStrategy[]);
|
|
495
|
+
classify(err: unknown): {
|
|
496
|
+
kind: 'rate_limit' | 'overloaded' | 'server' | 'client' | 'network' | 'abort' | 'context_overflow' | 'unknown';
|
|
497
|
+
retryable: boolean;
|
|
498
|
+
};
|
|
499
|
+
recover(err: unknown, ctx: Context): Promise<RecoveryDecision | null>;
|
|
500
|
+
}
|
|
501
|
+
|
|
423
502
|
declare function buildGoalPreamble(goal: string, deliverables?: string[]): string;
|
|
424
503
|
|
|
425
504
|
/**
|
|
@@ -485,6 +564,26 @@ declare class IntelligentCompactor implements Compactor {
|
|
|
485
564
|
private messagesToText;
|
|
486
565
|
}
|
|
487
566
|
|
|
567
|
+
declare class DefaultRetryPolicy implements RetryPolicy {
|
|
568
|
+
shouldRetry(err: Error | ProviderError, attempt: number): boolean;
|
|
569
|
+
maxAttempts(err: Error | ProviderError): number;
|
|
570
|
+
/**
|
|
571
|
+
* Compute the retry delay.
|
|
572
|
+
*
|
|
573
|
+
* Precedence:
|
|
574
|
+
* 1. If `err` is a `ProviderError` with a populated
|
|
575
|
+
* `body.retryAfterMs`, honour it — clamped into
|
|
576
|
+
* [0, MAX_RETRY_AFTER_MS]. The provider told us exactly when
|
|
577
|
+
* to come back; we should listen.
|
|
578
|
+
* 2. Otherwise fall through to the exponential-with-jitter
|
|
579
|
+
* schedule (`1000 * 2^attempt + jitter`, capped at 30s).
|
|
580
|
+
*
|
|
581
|
+
* `err` is optional for back-compat with the existing interface;
|
|
582
|
+
* callers should pass it whenever available.
|
|
583
|
+
*/
|
|
584
|
+
delayMs(attempt: number, err?: Error | ProviderError): number;
|
|
585
|
+
}
|
|
586
|
+
|
|
488
587
|
/**
|
|
489
588
|
* Options for SelectiveCompactor — the most configurable compactor.
|
|
490
589
|
*/
|
|
@@ -708,4 +807,103 @@ interface StrategyCompactorOptions {
|
|
|
708
807
|
*/
|
|
709
808
|
declare function createStrategyCompactor(opts?: StrategyCompactorOptions): Compactor;
|
|
710
809
|
|
|
711
|
-
|
|
810
|
+
declare class ToolExecutor {
|
|
811
|
+
private readonly registry;
|
|
812
|
+
private opts;
|
|
813
|
+
/** Minimum gap between coalesced `partial_output` tool.progress emits. */
|
|
814
|
+
static readonly PROGRESS_EMIT_INTERVAL_MS = 100;
|
|
815
|
+
/** Max chars of accumulated stream text carried per coalesced emit (tail). */
|
|
816
|
+
static readonly PROGRESS_TAIL_CHARS = 16384;
|
|
817
|
+
/** Max chars of the head (beginning of output) kept alongside the tail. */
|
|
818
|
+
static readonly PROGRESS_HEAD_CHARS = 16384;
|
|
819
|
+
private readonly serializer;
|
|
820
|
+
private readonly iterationTimeoutMs;
|
|
821
|
+
private readonly maxToolTimeoutMs;
|
|
822
|
+
constructor(registry: {
|
|
823
|
+
get(name: string): Tool | undefined;
|
|
824
|
+
list(): Tool[];
|
|
825
|
+
}, opts: ToolExecutorOptions);
|
|
826
|
+
/**
|
|
827
|
+
* Clear the interactive confirm awaiter so the executor returns
|
|
828
|
+
* `ToolConfirmPendingResult` instead of blocking on stdin. Used by
|
|
829
|
+
* the CLI to switch from inline prompts (REPL) to event-driven
|
|
830
|
+
* confirmation (TUI) at runtime.
|
|
831
|
+
*/
|
|
832
|
+
clearConfirmAwaiter(): void;
|
|
833
|
+
/**
|
|
834
|
+
* Push the tool's per-tool result-render mode into the renderer as the
|
|
835
|
+
* next-result render mode. The config key is `tools.resultRenderMode[name]`
|
|
836
|
+
* — independent of the LLM-side `descriptionMode` so the two can be
|
|
837
|
+
* toggled separately (`/tool read desc simple` vs `/tool read result
|
|
838
|
+
* simple`). Defaults to `extend` when no entry is set.
|
|
839
|
+
*
|
|
840
|
+
* The hint is one-shot: the renderer consumes it on the next
|
|
841
|
+
* `writeToolResult` call so an unset follow-up doesn't inherit a
|
|
842
|
+
* previous tool's mode. Safe no-op when the renderer doesn't implement
|
|
843
|
+
* `setResultRenderMode` (e.g. headless/test renderers).
|
|
844
|
+
*/
|
|
845
|
+
private hintRenderMode;
|
|
846
|
+
private toolLogBase;
|
|
847
|
+
private logToolSuccess;
|
|
848
|
+
private logToolFailure;
|
|
849
|
+
/**
|
|
850
|
+
* Execute a batch of tool uses using the configured strategy.
|
|
851
|
+
* Returns the execution results and the remaining output budget.
|
|
852
|
+
*/
|
|
853
|
+
executeBatch(toolUses: ToolUseBlock[], ctx: Context, strategy: ToolExecutorStrategy): Promise<ToolBatchResult>;
|
|
854
|
+
/**
|
|
855
|
+
* Execute a single tool with timeout, permission check, and output capping.
|
|
856
|
+
* Emits `tool.started` via the injected EventBus (if any) right before
|
|
857
|
+
* invoking the tool — closes the observability gap between "model decided
|
|
858
|
+
* to call a tool" and "tool.executed".
|
|
859
|
+
*/
|
|
860
|
+
executeTool(tool: Tool, use: ToolUseBlock, ctx: Context, budget: number): Promise<{
|
|
861
|
+
block: ToolResultBlock;
|
|
862
|
+
bytes: number;
|
|
863
|
+
}>;
|
|
864
|
+
/**
|
|
865
|
+
* Async "produce" phase: run the tool, serialize, scrub, and spill an
|
|
866
|
+
* oversized output to a disk artifact. Returns the pre-cap text. This is
|
|
867
|
+
* the long-running, concurrency-safe part — it touches NO shared budget
|
|
868
|
+
* state, so multiple invocations can run in parallel without racing.
|
|
869
|
+
*
|
|
870
|
+
* The `budgetHint` only gates the disk-spill threshold (a heuristic for
|
|
871
|
+
* "is this output large enough to persist"); it is NOT the output cap.
|
|
872
|
+
* The authoritative cap is applied synchronously in settleToolOutput()
|
|
873
|
+
* against the live budget.
|
|
874
|
+
*/
|
|
875
|
+
private produceToolOutput;
|
|
876
|
+
/**
|
|
877
|
+
* Synchronous "settle" phase: enforce the output cap against the CURRENT
|
|
878
|
+
* budget, render, and build the result block. This MUST stay synchronous
|
|
879
|
+
* (no awaits) so that, in the parallel/smart strategies, two tools settling
|
|
880
|
+
* one after another against the shared closure budget can't interleave a
|
|
881
|
+
* stale read with a write. The first to settle consumes its bytes; the next
|
|
882
|
+
* settles against the reduced budget; once the budget hits 0, enforceCap
|
|
883
|
+
* truncates — making the per-iteration cap genuinely CUMULATIVE across
|
|
884
|
+
* parallel tools instead of degrading into a per-tool cap.
|
|
885
|
+
*/
|
|
886
|
+
private settleToolOutput;
|
|
887
|
+
private runWithTimeout;
|
|
888
|
+
/** Best-effort tool cleanup; never let it mask the original error. */
|
|
889
|
+
private runToolCleanup;
|
|
890
|
+
private runStreamedTool;
|
|
891
|
+
private unknownToolResult;
|
|
892
|
+
private malformedInputResult;
|
|
893
|
+
private deniedResult;
|
|
894
|
+
private blockedByHookResult;
|
|
895
|
+
/**
|
|
896
|
+
* Subtract a string-content result's UTF-8 byte length from the
|
|
897
|
+
* iteration output budget. Used for synthesized results (unknown tool,
|
|
898
|
+
* validation error, blocked, threw) where the content is a small
|
|
899
|
+
* string built in the executor. The success path no longer goes
|
|
900
|
+
* through here — `executeTool` carries the exact byte count it spent
|
|
901
|
+
* in its return value, derived from `enforceCap`'s `newBudget`.
|
|
902
|
+
*
|
|
903
|
+
* Floors the result at 0 to match the pre-fix `decrementBudget`
|
|
904
|
+
* semantics (over-budget spends don't underflow the running total).
|
|
905
|
+
*/
|
|
906
|
+
private budgetForString;
|
|
907
|
+
}
|
|
908
|
+
|
|
909
|
+
export { DEFAULT_RECOVERY_STRATEGIES as $, AutoCompactionMiddleware as A, detectFrontendIntent as B, type CompactorOptions as C, DefaultDesignKitLoader as D, getDesignKitLoader as E, getDesignState as F, installDesignStudioMiddleware as G, HybridCompactor as H, IntelligentCompactor as I, loadActiveKit as J, loadProjectDesignRules as K, makeAutonomyPromptContributor as L, makeDesignDetectToolCallMiddleware as M, makeDesignDetectUserInputMiddleware as N, makeDesignStudioRequestMiddleware as O, type PersistedActiveKit as P, makeDesignVerifyToolCallMiddleware as Q, recordKitChoice as R, SelectiveCompactor as S, ToolExecutor as T, recordOverrides as U, renderPrompt as V, resolveBundledDesignKitsDir as W, setActiveKit as X, setDesignOverrides as Y, type ContextWindowBudgetSnapshot as Z, _resetDesignKitLoaderMemo as _, AutonomousRunner as a, type RecoveryStrategy as a0, buildRecoveryStrategies as a1, type AutonomousRunnerOptions as b, type AutonomyPromptContributorOptions as c, type CompactorStrategy as d, DefaultErrorHandler as e, DefaultPromptLoader as f, DefaultRetryPolicy as g, DefaultSkillLoader as h, type DesignKitLoaderOptions as i, type DesignOverrides as j, type DoneCheckResult as k, DoneConditionChecker as l, type IntelligentCompactorOptions as m, type PromptLoaderOptions as n, type SelectiveCompactorOptions as o, type SkillLoaderOptions as p, type StrategyCompactorOptions as q, _resetDesignRulesCache as r, activateDesign as s, applyTokenOverrides as t, buildGoalPreamble as u, clearActiveKit as v, clearPersistedActiveKit as w, createStrategyCompactor as x, designProjectDir as y, detectFrontendFile as z };
|
package/dist/tools/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { g as Tool } from '../tool-LVSLiE1s.js';
|
|
2
|
+
import { b as MCPServerConfig, C as Config } from '../config-CN-vdDEI.js';
|
|
3
3
|
import '../dispatcher-types.d-BBeXBQgS.js';
|
|
4
4
|
import 'node:https';
|
|
5
5
|
import 'undici';
|