reasonix 0.12.16 → 0.12.19
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/cli/index.js +442 -190
- package/dist/cli/index.js.map +1 -1
- package/dist/index.d.ts +62 -1
- package/dist/index.js +346 -145
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -392,6 +392,13 @@ interface HookOutcome {
|
|
|
392
392
|
/** Captured stderr (trimmed). The block / warn message comes from here. */
|
|
393
393
|
stderr: string;
|
|
394
394
|
durationMs: number;
|
|
395
|
+
/**
|
|
396
|
+
* True when stdout or stderr crossed the per-stream byte cap and was
|
|
397
|
+
* truncated. The hook still completed; the loop just sees a clipped
|
|
398
|
+
* view of its output. Surfaced via `formatHookOutcomeMessage` so the
|
|
399
|
+
* user knows their script wrote more than Reasonix kept.
|
|
400
|
+
*/
|
|
401
|
+
truncated?: boolean;
|
|
395
402
|
}
|
|
396
403
|
/** Aggregate report for `runHooks`. */
|
|
397
404
|
interface HookReport {
|
|
@@ -455,6 +462,14 @@ interface HookSpawnResult {
|
|
|
455
462
|
timedOut: boolean;
|
|
456
463
|
/** True iff spawn() itself failed (ENOENT, EACCES, …). */
|
|
457
464
|
spawnError?: Error;
|
|
465
|
+
/**
|
|
466
|
+
* True iff stdout or stderr was capped at the byte limit. The hook
|
|
467
|
+
* still ran to completion / timeout, but downstream consumers see a
|
|
468
|
+
* truncated view of its output. Surface this in the UI so a hook
|
|
469
|
+
* author who relies on long output knows the loop didn't see all
|
|
470
|
+
* of it.
|
|
471
|
+
*/
|
|
472
|
+
truncated?: boolean;
|
|
458
473
|
}
|
|
459
474
|
type HookSpawner = (input: HookSpawnInput) => Promise<HookSpawnResult>;
|
|
460
475
|
/**
|
|
@@ -502,6 +517,23 @@ declare class ImmutablePrefix {
|
|
|
502
517
|
*/
|
|
503
518
|
private _toolSpecs;
|
|
504
519
|
readonly fewShots: readonly ChatMessage[];
|
|
520
|
+
/**
|
|
521
|
+
* Cached SHA-256 of the prefix payload. Computed lazily on first
|
|
522
|
+
* `fingerprint` access, invalidated only by mutations that go
|
|
523
|
+
* through `addTool` (the one legitimate post-construction mutation
|
|
524
|
+
* path). The TUI reads `fingerprint` on every render — without the
|
|
525
|
+
* cache, that means a fresh `JSON.stringify` + sha256 over the
|
|
526
|
+
* full prefix (system prompt + tools list + few-shots, typically
|
|
527
|
+
* 5-10KB) on every keystroke.
|
|
528
|
+
*
|
|
529
|
+
* The lazy-init also acts as a cheap drift guard: if some future
|
|
530
|
+
* code path mutates `_toolSpecs` directly without going through
|
|
531
|
+
* `addTool`, `fingerprint` will return the stale cached value
|
|
532
|
+
* while the actual prefix sent to DeepSeek diverges — the cache
|
|
533
|
+
* miss would be the first symptom. {@link verifyFingerprint}
|
|
534
|
+
* lets dev / test code assert the cache matches reality.
|
|
535
|
+
*/
|
|
536
|
+
private _fingerprintCache;
|
|
505
537
|
constructor(opts: ImmutablePrefixOptions);
|
|
506
538
|
get toolSpecs(): readonly ToolSpec[];
|
|
507
539
|
toMessages(): ChatMessage[];
|
|
@@ -514,6 +546,16 @@ declare class ImmutablePrefix {
|
|
|
514
546
|
*/
|
|
515
547
|
addTool(spec: ToolSpec): boolean;
|
|
516
548
|
get fingerprint(): string;
|
|
549
|
+
/**
|
|
550
|
+
* Recompute the fingerprint from scratch and assert it matches the
|
|
551
|
+
* cached value. Returns the freshly-computed hash on success; throws
|
|
552
|
+
* with a diff if the cache drifted, which always indicates a bug —
|
|
553
|
+
* either a non-`addTool` mutation path was added, or `addTool`
|
|
554
|
+
* forgot to invalidate the cache. Dev / test only; the live loop
|
|
555
|
+
* doesn't call this on the hot path.
|
|
556
|
+
*/
|
|
557
|
+
verifyFingerprint(): string;
|
|
558
|
+
private computeFingerprint;
|
|
517
559
|
}
|
|
518
560
|
declare class AppendOnlyLog {
|
|
519
561
|
private _entries;
|
|
@@ -1435,6 +1477,19 @@ interface FileWithStats {
|
|
|
1435
1477
|
* recency sort).
|
|
1436
1478
|
*/
|
|
1437
1479
|
declare function listFilesWithStatsSync(root: string, opts?: ListFilesOptions): FileWithStats[];
|
|
1480
|
+
/**
|
|
1481
|
+
* Async variant of {@link listFilesWithStatsSync}. Same walk semantics
|
|
1482
|
+
* (DFS, alphabetical, respects ignore + maxResults), but each
|
|
1483
|
+
* directory's entries are stat'd in parallel via `Promise.all`,
|
|
1484
|
+
* which slashes wall-clock time on Windows where individual stat
|
|
1485
|
+
* syscalls are 3-5x slower than Linux.
|
|
1486
|
+
*
|
|
1487
|
+
* Use this from the TUI mount path so a 500-file repo doesn't add
|
|
1488
|
+
* 200-300ms of synchronous block to first paint. Sync variant is
|
|
1489
|
+
* kept for paths where the caller can't `await` (server APIs,
|
|
1490
|
+
* test scaffolding).
|
|
1491
|
+
*/
|
|
1492
|
+
declare function listFilesWithStatsAsync(root: string, opts?: ListFilesOptions): Promise<FileWithStats[]>;
|
|
1438
1493
|
/**
|
|
1439
1494
|
* Prefix pattern used by the `@` picker to detect an IN-PROGRESS
|
|
1440
1495
|
* mention at the END of the input buffer. Captures the partial path
|
|
@@ -3873,6 +3928,12 @@ interface AppendUsageInput {
|
|
|
3873
3928
|
* Returns the record that was written (or would have been written
|
|
3874
3929
|
* if the disk had cooperated) so tests / callers can assert on the
|
|
3875
3930
|
* computed cost fields without a round trip through the log file.
|
|
3931
|
+
*
|
|
3932
|
+
* On every Nth append the log is checked for size; if it crosses
|
|
3933
|
+
* {@link USAGE_COMPACTION_THRESHOLD_BYTES} we drop records older
|
|
3934
|
+
* than {@link USAGE_RETENTION_DAYS}. Cheaper than a startup-time
|
|
3935
|
+
* scan because most processes don't reach the threshold; the size
|
|
3936
|
+
* check is one statSync regardless.
|
|
3876
3937
|
*/
|
|
3877
3938
|
declare function appendUsage(input: AppendUsageInput): UsageRecord;
|
|
3878
3939
|
/**
|
|
@@ -3962,4 +4023,4 @@ declare function aggregateUsage(records: UsageRecord[], opts?: AggregateOptions)
|
|
|
3962
4023
|
/** File-size helper for the stats header — "1.2 MB" etc. Returns "" if missing. */
|
|
3963
4024
|
declare function formatLogSize(path?: string): string;
|
|
3964
4025
|
|
|
3965
|
-
export { AT_MENTION_PATTERN, AT_PICKER_PREFIX, type AggregateOptions, AppendOnlyLog, type AppendUsageInput, type ApplyResult, type ApplyStatus, type AtMentionExpansion, type AtMentionOptions, type BranchOptions, type BranchProgress, type BranchResult, type BranchSample, type BranchSelector, type BranchSummary, type BridgeOptions, type BridgeResult, CODE_SYSTEM_PROMPT, CacheFirstLoop, type CacheFirstLoopOptions, type CallToolResult, type ChatMessage, type ChatResponse, type ChoiceOption, ChoiceRequestedError, type ChoiceToolOptions, DEFAULT_AT_MENTION_MAX_BYTES, DEFAULT_MAX_RESULT_CHARS, DEFAULT_MAX_RESULT_TOKENS, DEFAULT_PICKER_IGNORE_DIRS, DeepSeekClient, type DeepSeekClientOptions, type RenderOptions as DiffRenderOptions, type DiffReport, type DiffSide, type EditBlock, type EditSnapshot, type EventRole, type FileWithStats, type FilesystemToolsOptions, type FlattenDecision, type FlattenOptions, type GetLatestVersionOptions, type GetPromptResult, HOOK_EVENTS, HOOK_SETTINGS_DIRNAME, HOOK_SETTINGS_FILENAME, type HarvestOptions, type HookConfig, type HookEvent, type HookOutcome, type HookPayload, type HookReport, type HookScope, type HookSettings, type HookSpawnInput, type HookSpawnResult, type HookSpawner, ImmutablePrefix, type ImmutablePrefixOptions, type InitializeResult, type InspectionReport, type JSONSchema, type JsonRpcMessage, type JsonRpcRequest, type JsonRpcResponse, LATEST_CACHE_TTL_MS, LATEST_FETCH_TIMEOUT_MS, type ListFilesOptions, type ListPromptsResult, type ListResourcesResult, type ListToolsResult, type LoadHookSettingsOptions, type LoopEvent, MCP_PROTOCOL_VERSION, MEMORY_INDEX_FILE, MEMORY_INDEX_MAX_CHARS, McpClient, type McpClientOptions, type McpContentBlock, type McpProgressHandler, type McpProgressInfo, type McpPrompt, type McpPromptArgument, type McpPromptMessage, type McpPromptResourceBlock, type McpResource, type McpResourceContents, type McpResourceContentsBlob, type McpResourceContentsText, type McpSpec, type McpTool, type McpToolSchema, type McpTransport, type MemoryEntry, type MemoryScope, MemoryStore, type MemoryStoreOptions, type MemoryToolsOptions, type MemoryType, type WriteInput as MemoryWriteInput, NeedsConfirmationError, PROJECT_MEMORY_FILE, PROJECT_MEMORY_MAX_CHARS, type PageContent, type PickerCandidate, PlanCheckpointError, PlanProposedError, PlanRevisionProposedError, type PlanStep, type PlanStepRisk, type PlanToolOptions, type ProgressNotificationParams, type ProjectMemory, type RankPickerOptions, type ReadResourceResult, type ReadTranscriptResult, type ReasonixConfig, type ReconfigurableOptions, type RepairReport, type ReplayStats, type ResolvedHook, type RetryInfo, type RetryOptions, type Role, type RunCommandResult, type RunHooksOptions, type ScavengeOptions, type ScavengeResult, type SearchResult, type SectionResult, type SessionInfo, SessionStats, type SessionSummary, type ShellToolsOptions, type SseMcpSpec, SseTransport, type SseTransportOptions, type StdioMcpSpec, StdioTransport, type StdioTransportOptions, type StepCompletion, StormBreaker, type StreamChunk, type StreamableHttpMcpSpec, StreamableHttpTransport, type StreamableHttpTransportOptions, type SubagentEvent, type SubagentSink, type SubagentToolOptions, type ToolCall, type ToolCallContext, ToolCallRepair, type ToolCallRepairOptions, type ToolDefinition, type ToolFunctionSpec, ToolRegistry, type ToolSpec, type TranscriptMeta, type TranscriptRecord, type TruncationRepairResult, type TurnPair, type TurnStats, type TypedPlanState, USER_MEMORY_DIR, Usage, type UsageAggregate, type UsageBucket, type UsageRecord, VERSION, VolatileScratch, type WebFetchOptions, type WebSearchOptions, type WebToolsOptions, aggregateBranchUsage, aggregateUsage, analyzeSchema, appendSessionMessage, appendUsage, applyEditBlock, applyEditBlocks, applyMemoryStack, applyProjectMemory, applyUserMemory, bridgeMcpTools, bucketCacheHitRatio, bucketSavingsFraction, claudeEquivalentCost, codeSystemPrompt, compareVersions, computeReplayStats, costUsd, decideOutcome, defaultConfigPath, defaultSelector, defaultUsageLogPath, deleteSession, detectAtPicker, detectShellOperator, diffTranscripts, emptyPlanState, expandAtMentions, fetchWithRetry, fixToolCallPairing, flattenMcpResult, flattenSchema, forkRegistryExcluding, formatCommandResult, formatHookOutcomeMessage, formatLogSize, formatLoopError, formatSearchResults, getLatestVersion, globalSettingsPath, harvest, healLoadedMessages, healLoadedMessagesByTokens, htmlToText, injectPowerShellUtf8, inputCostUsd, inspectMcpServer, isAllowed, isJsonRpcError, isNpxInstall, isPlanStateEmpty, isPlausibleKey, listFilesSync, listFilesWithStatsSync, listSessions, loadApiKey, loadDotenv, loadHooks, loadSessionMessages, matchesTool, memoryEnabled, nestArguments, openTranscriptFile, outputCostUsd, parseEditBlocks, parseMcpSpec, parseMojeekResults, parseTranscript, prepareSpawn, projectHash, projectSettingsPath, quoteForCmdExe, rankPickerCandidates, readConfig, readProjectMemory, readTranscript, readUsageLog, recordFromLoopEvent, redactKey, registerChoiceTool, registerFilesystemTools, registerMemoryTools, registerPlanTool, registerShellTools, registerSubagentTool, registerWebTools, renderMarkdown as renderDiffMarkdown, renderSummaryTable as renderDiffSummary, repairTruncatedJson, replayFromFile, resolveExecutable, restoreSnapshots, runBranches, runCommand, runHooks, sanitizeMemoryName, sanitizeName as sanitizeSessionName, saveApiKey, scavengeToolCalls, sessionPath, sessionsDir, similarity, snapshotBeforeEdits, stripHallucinatedToolMarkup, tokenizeCommand, truncateForModel, truncateForModelByTokens, webFetch, webSearch, withUtf8Codepage, writeConfig, writeMeta, writeRecord };
|
|
4026
|
+
export { AT_MENTION_PATTERN, AT_PICKER_PREFIX, type AggregateOptions, AppendOnlyLog, type AppendUsageInput, type ApplyResult, type ApplyStatus, type AtMentionExpansion, type AtMentionOptions, type BranchOptions, type BranchProgress, type BranchResult, type BranchSample, type BranchSelector, type BranchSummary, type BridgeOptions, type BridgeResult, CODE_SYSTEM_PROMPT, CacheFirstLoop, type CacheFirstLoopOptions, type CallToolResult, type ChatMessage, type ChatResponse, type ChoiceOption, ChoiceRequestedError, type ChoiceToolOptions, DEFAULT_AT_MENTION_MAX_BYTES, DEFAULT_MAX_RESULT_CHARS, DEFAULT_MAX_RESULT_TOKENS, DEFAULT_PICKER_IGNORE_DIRS, DeepSeekClient, type DeepSeekClientOptions, type RenderOptions as DiffRenderOptions, type DiffReport, type DiffSide, type EditBlock, type EditSnapshot, type EventRole, type FileWithStats, type FilesystemToolsOptions, type FlattenDecision, type FlattenOptions, type GetLatestVersionOptions, type GetPromptResult, HOOK_EVENTS, HOOK_SETTINGS_DIRNAME, HOOK_SETTINGS_FILENAME, type HarvestOptions, type HookConfig, type HookEvent, type HookOutcome, type HookPayload, type HookReport, type HookScope, type HookSettings, type HookSpawnInput, type HookSpawnResult, type HookSpawner, ImmutablePrefix, type ImmutablePrefixOptions, type InitializeResult, type InspectionReport, type JSONSchema, type JsonRpcMessage, type JsonRpcRequest, type JsonRpcResponse, LATEST_CACHE_TTL_MS, LATEST_FETCH_TIMEOUT_MS, type ListFilesOptions, type ListPromptsResult, type ListResourcesResult, type ListToolsResult, type LoadHookSettingsOptions, type LoopEvent, MCP_PROTOCOL_VERSION, MEMORY_INDEX_FILE, MEMORY_INDEX_MAX_CHARS, McpClient, type McpClientOptions, type McpContentBlock, type McpProgressHandler, type McpProgressInfo, type McpPrompt, type McpPromptArgument, type McpPromptMessage, type McpPromptResourceBlock, type McpResource, type McpResourceContents, type McpResourceContentsBlob, type McpResourceContentsText, type McpSpec, type McpTool, type McpToolSchema, type McpTransport, type MemoryEntry, type MemoryScope, MemoryStore, type MemoryStoreOptions, type MemoryToolsOptions, type MemoryType, type WriteInput as MemoryWriteInput, NeedsConfirmationError, PROJECT_MEMORY_FILE, PROJECT_MEMORY_MAX_CHARS, type PageContent, type PickerCandidate, PlanCheckpointError, PlanProposedError, PlanRevisionProposedError, type PlanStep, type PlanStepRisk, type PlanToolOptions, type ProgressNotificationParams, type ProjectMemory, type RankPickerOptions, type ReadResourceResult, type ReadTranscriptResult, type ReasonixConfig, type ReconfigurableOptions, type RepairReport, type ReplayStats, type ResolvedHook, type RetryInfo, type RetryOptions, type Role, type RunCommandResult, type RunHooksOptions, type ScavengeOptions, type ScavengeResult, type SearchResult, type SectionResult, type SessionInfo, SessionStats, type SessionSummary, type ShellToolsOptions, type SseMcpSpec, SseTransport, type SseTransportOptions, type StdioMcpSpec, StdioTransport, type StdioTransportOptions, type StepCompletion, StormBreaker, type StreamChunk, type StreamableHttpMcpSpec, StreamableHttpTransport, type StreamableHttpTransportOptions, type SubagentEvent, type SubagentSink, type SubagentToolOptions, type ToolCall, type ToolCallContext, ToolCallRepair, type ToolCallRepairOptions, type ToolDefinition, type ToolFunctionSpec, ToolRegistry, type ToolSpec, type TranscriptMeta, type TranscriptRecord, type TruncationRepairResult, type TurnPair, type TurnStats, type TypedPlanState, USER_MEMORY_DIR, Usage, type UsageAggregate, type UsageBucket, type UsageRecord, VERSION, VolatileScratch, type WebFetchOptions, type WebSearchOptions, type WebToolsOptions, aggregateBranchUsage, aggregateUsage, analyzeSchema, appendSessionMessage, appendUsage, applyEditBlock, applyEditBlocks, applyMemoryStack, applyProjectMemory, applyUserMemory, bridgeMcpTools, bucketCacheHitRatio, bucketSavingsFraction, claudeEquivalentCost, codeSystemPrompt, compareVersions, computeReplayStats, costUsd, decideOutcome, defaultConfigPath, defaultSelector, defaultUsageLogPath, deleteSession, detectAtPicker, detectShellOperator, diffTranscripts, emptyPlanState, expandAtMentions, fetchWithRetry, fixToolCallPairing, flattenMcpResult, flattenSchema, forkRegistryExcluding, formatCommandResult, formatHookOutcomeMessage, formatLogSize, formatLoopError, formatSearchResults, getLatestVersion, globalSettingsPath, harvest, healLoadedMessages, healLoadedMessagesByTokens, htmlToText, injectPowerShellUtf8, inputCostUsd, inspectMcpServer, isAllowed, isJsonRpcError, isNpxInstall, isPlanStateEmpty, isPlausibleKey, listFilesSync, listFilesWithStatsAsync, listFilesWithStatsSync, listSessions, loadApiKey, loadDotenv, loadHooks, loadSessionMessages, matchesTool, memoryEnabled, nestArguments, openTranscriptFile, outputCostUsd, parseEditBlocks, parseMcpSpec, parseMojeekResults, parseTranscript, prepareSpawn, projectHash, projectSettingsPath, quoteForCmdExe, rankPickerCandidates, readConfig, readProjectMemory, readTranscript, readUsageLog, recordFromLoopEvent, redactKey, registerChoiceTool, registerFilesystemTools, registerMemoryTools, registerPlanTool, registerShellTools, registerSubagentTool, registerWebTools, renderMarkdown as renderDiffMarkdown, renderSummaryTable as renderDiffSummary, repairTruncatedJson, replayFromFile, resolveExecutable, restoreSnapshots, runBranches, runCommand, runHooks, sanitizeMemoryName, sanitizeName as sanitizeSessionName, saveApiKey, scavengeToolCalls, sessionPath, sessionsDir, similarity, snapshotBeforeEdits, stripHallucinatedToolMarkup, tokenizeCommand, truncateForModel, truncateForModelByTokens, webFetch, webSearch, withUtf8Codepage, writeConfig, writeMeta, writeRecord };
|