reasonix 0.4.20 → 0.4.22

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.
@@ -2,9 +2,9 @@
2
2
  import {
3
3
  CODE_SYSTEM_PROMPT,
4
4
  codeSystemPrompt
5
- } from "./chunk-DDIKQZVD.js";
5
+ } from "./chunk-K6MR4SWS.js";
6
6
  export {
7
7
  CODE_SYSTEM_PROMPT,
8
8
  codeSystemPrompt
9
9
  };
10
- //# sourceMappingURL=prompt-YEJEJ3IZ.js.map
10
+ //# sourceMappingURL=prompt-VDN5U3YE.js.map
package/dist/index.d.ts CHANGED
@@ -918,9 +918,12 @@ declare function applyUserMemory(basePrompt: string, opts?: {
918
918
  projectRoot?: string;
919
919
  }): string;
920
920
  /**
921
- * Compose REASONIX.md + user memory in one call. Drop-in replacement
922
- * for `applyProjectMemory` at CLI entry points preserves the existing
923
- * REASONIX_PROJECT block order, then appends the two user-memory blocks.
921
+ * Compose every lazy-loaded prefix block in one call: REASONIX.md,
922
+ * user memory (global + project), and the skills index. Drop-in
923
+ * replacement for `applyProjectMemory` at CLI entry points. Stacking
924
+ * order is stable — the prefix hash only changes when block *content*
925
+ * changes, not when this helper is called a second time with the same
926
+ * filesystem state.
924
927
  */
925
928
  declare function applyMemoryStack(basePrompt: string, rootDir: string): string;
926
929
 
@@ -1092,8 +1095,14 @@ interface ShellToolsOptions {
1092
1095
  /**
1093
1096
  * Extra command-name prefixes the user explicitly trusts. Added on
1094
1097
  * top of the built-in allowlist. Examples: `["my-ci-script", "lint"]`.
1098
+ *
1099
+ * Accepts either a fixed array (captured once at registration) or a
1100
+ * getter called on every dispatch. The getter form is load-bearing:
1101
+ * when the TUI's `ShellConfirm` writes a new prefix to config mid-
1102
+ * session, the running `run_command` must pick it up immediately —
1103
+ * otherwise the same command gets re-prompted until the next launch.
1095
1104
  */
1096
- extraAllowed?: string[];
1105
+ extraAllowed?: readonly string[] | (() => readonly string[]);
1097
1106
  /**
1098
1107
  * When true, skip the allowlist entirely and auto-run every command.
1099
1108
  * Off by default — this is an escape hatch for non-interactive use
@@ -2299,8 +2308,85 @@ declare function isPlausibleKey(key: string): boolean;
2299
2308
  /** Mask a key for display: `sk-abcd...wxyz`. */
2300
2309
  declare function redactKey(key: string): string;
2301
2310
 
2302
- /** Reasonix — DeepSeek-native agent framework. Library entry point. */
2303
-
2304
- declare const VERSION = "0.4.20";
2311
+ /**
2312
+ * Version module.
2313
+ *
2314
+ * Two jobs:
2315
+ *
2316
+ * 1. Expose `VERSION` sourced from the real `package.json` so the
2317
+ * constant never drifts from what npm publishes. Works in dev
2318
+ * (`tsx src/...`) AND after `tsup` bundles to `dist/` — both
2319
+ * layouts sit two levels below the manifest, so a short
2320
+ * walk-up finds it.
2321
+ *
2322
+ * 2. Offer an opt-in `getLatestVersion()` that hits the npm
2323
+ * registry with a bounded timeout and a 24-hour on-disk
2324
+ * cache at `~/.reasonix/version-cache.json`. Returns `null`
2325
+ * on any failure — offline / restricted-network launches
2326
+ * should stay silent rather than nag the user.
2327
+ *
2328
+ * The CLI wires `getLatestVersion` asynchronously at App mount
2329
+ * (never in a hot path) and renders the outcome in the stats
2330
+ * panel when there's a newer published version.
2331
+ */
2332
+ /** TTL for the on-disk cache entry. 24h keeps noise low; users who
2333
+ * want a fresh check can run `reasonix update` which passes
2334
+ * `force: true`. */
2335
+ declare const LATEST_CACHE_TTL_MS: number;
2336
+ /** Network timeout. Short — we never block the UI waiting on this. */
2337
+ declare const LATEST_FETCH_TIMEOUT_MS = 2000;
2338
+ declare const VERSION: string;
2339
+ interface GetLatestVersionOptions {
2340
+ /** Ignore the cached entry and always fetch fresh. Used by `reasonix update`. */
2341
+ force?: boolean;
2342
+ /** Registry URL override (tests). */
2343
+ registryUrl?: string;
2344
+ /** Home-directory override (tests). */
2345
+ homeDir?: string;
2346
+ /** Fetch implementation override (tests). Defaults to `globalThis.fetch`. */
2347
+ fetchImpl?: typeof fetch;
2348
+ /** TTL override (tests). */
2349
+ ttlMs?: number;
2350
+ /** Network timeout override (tests). */
2351
+ timeoutMs?: number;
2352
+ }
2353
+ /**
2354
+ * Resolve the latest published `reasonix` version from the npm registry.
2355
+ *
2356
+ * Returns `null` on any network / parse failure. Callers treat `null`
2357
+ * as "don't know, don't nag the user." The cache entry is only
2358
+ * written on a successful fetch — a bad registry response won't
2359
+ * poison the cache.
2360
+ */
2361
+ declare function getLatestVersion(opts?: GetLatestVersionOptions): Promise<string | null>;
2362
+ /**
2363
+ * Semver compare. Returns a negative number when `a < b`, positive
2364
+ * when `a > b`, zero when equal.
2365
+ *
2366
+ * Minimal pre-release handling: when the CORE (`x.y.z`) parts match,
2367
+ * any version WITH a suffix (`-rc.1`, `-alpha.4`) compares LOWER
2368
+ * than the bare version. That matches npm's dist-tag semantics —
2369
+ * `reasonix@latest` resolves to a real release, not a pre-release.
2370
+ *
2371
+ * We're deliberately not pulling in `semver` (~50KB). The three
2372
+ * cases we care about are: current > latest (future build, no
2373
+ * prompt), current < latest (prompt), current === latest (no prompt).
2374
+ */
2375
+ declare function compareVersions(a: string, b: string): number;
2376
+ /**
2377
+ * Heuristic: did this process launch via `npx` / `pnpm dlx` instead
2378
+ * of a global install? The update command takes different advice in
2379
+ * each case — a global install can `npm i -g reasonix@latest`, while
2380
+ * npx just needs its cache to roll over on next launch.
2381
+ *
2382
+ * Signals checked, in order:
2383
+ * - `process.argv[1]` contains `_npx` (npm's ephemeral dir name)
2384
+ * - `process.argv[1]` contains `.pnpm` + `dlx`
2385
+ * - `npm_config_user_agent` contains `npx/`
2386
+ *
2387
+ * Any one hit → npx. False negatives are safe (worst case we suggest
2388
+ * `npm i -g` to an npx user, which is a valid way to upgrade too).
2389
+ */
2390
+ declare function isNpxInstall(): boolean;
2305
2391
 
2306
- export { AppendOnlyLog, type ApplyResult, type ApplyStatus, 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, DEFAULT_MAX_RESULT_CHARS, DeepSeekClient, type DeepSeekClientOptions, type RenderOptions as DiffRenderOptions, type DiffReport, type DiffSide, type EditBlock, type EditSnapshot, type EventRole, type FilesystemToolsOptions, type FlattenDecision, type FlattenOptions, type GetPromptResult, type HarvestOptions, ImmutablePrefix, type ImmutablePrefixOptions, type InitializeResult, type InspectionReport, type JSONSchema, type JsonRpcMessage, type JsonRpcRequest, type JsonRpcResponse, type ListPromptsResult, type ListResourcesResult, type ListToolsResult, 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, PlanProposedError, type PlanToolOptions, type ProgressNotificationParams, type ProjectMemory, type ReadResourceResult, type ReadTranscriptResult, type ReasonixConfig, type ReconfigurableOptions, type RepairReport, type ReplayStats, type RetryInfo, type RetryOptions, type Role, type RunCommandResult, 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, StormBreaker, type StreamChunk, 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, VERSION, VolatileScratch, type WebFetchOptions, type WebSearchOptions, type WebToolsOptions, aggregateBranchUsage, analyzeSchema, appendSessionMessage, applyEditBlock, applyEditBlocks, applyMemoryStack, applyProjectMemory, applyUserMemory, bridgeMcpTools, claudeEquivalentCost, codeSystemPrompt, computeReplayStats, costUsd, defaultConfigPath, defaultSelector, deleteSession, diffTranscripts, emptyPlanState, fetchWithRetry, flattenMcpResult, flattenSchema, formatCommandResult, formatLoopError, formatSearchResults, harvest, healLoadedMessages, htmlToText, inputCostUsd, inspectMcpServer, isAllowed, isJsonRpcError, isPlanStateEmpty, isPlausibleKey, listSessions, loadApiKey, loadDotenv, loadSessionMessages, memoryEnabled, nestArguments, openTranscriptFile, outputCostUsd, parseEditBlocks, parseMcpSpec, parseMojeekResults, parseTranscript, prepareSpawn, projectHash, quoteForCmdExe, readConfig, readProjectMemory, readTranscript, recordFromLoopEvent, redactKey, registerFilesystemTools, registerMemoryTools, registerPlanTool, registerShellTools, registerWebTools, renderMarkdown as renderDiffMarkdown, renderSummaryTable as renderDiffSummary, repairTruncatedJson, replayFromFile, resolveExecutable, restoreSnapshots, runBranches, runCommand, sanitizeMemoryName, sanitizeName as sanitizeSessionName, saveApiKey, scavengeToolCalls, sessionPath, sessionsDir, similarity, snapshotBeforeEdits, stripHallucinatedToolMarkup, tokenizeCommand, truncateForModel, webFetch, webSearch, writeConfig, writeMeta, writeRecord };
2392
+ export { AppendOnlyLog, type ApplyResult, type ApplyStatus, 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, DEFAULT_MAX_RESULT_CHARS, DeepSeekClient, type DeepSeekClientOptions, type RenderOptions as DiffRenderOptions, type DiffReport, type DiffSide, type EditBlock, type EditSnapshot, type EventRole, type FilesystemToolsOptions, type FlattenDecision, type FlattenOptions, type GetLatestVersionOptions, type GetPromptResult, type HarvestOptions, ImmutablePrefix, type ImmutablePrefixOptions, type InitializeResult, type InspectionReport, type JSONSchema, type JsonRpcMessage, type JsonRpcRequest, type JsonRpcResponse, LATEST_CACHE_TTL_MS, LATEST_FETCH_TIMEOUT_MS, type ListPromptsResult, type ListResourcesResult, type ListToolsResult, 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, PlanProposedError, type PlanToolOptions, type ProgressNotificationParams, type ProjectMemory, type ReadResourceResult, type ReadTranscriptResult, type ReasonixConfig, type ReconfigurableOptions, type RepairReport, type ReplayStats, type RetryInfo, type RetryOptions, type Role, type RunCommandResult, 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, StormBreaker, type StreamChunk, 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, VERSION, VolatileScratch, type WebFetchOptions, type WebSearchOptions, type WebToolsOptions, aggregateBranchUsage, analyzeSchema, appendSessionMessage, applyEditBlock, applyEditBlocks, applyMemoryStack, applyProjectMemory, applyUserMemory, bridgeMcpTools, claudeEquivalentCost, codeSystemPrompt, compareVersions, computeReplayStats, costUsd, defaultConfigPath, defaultSelector, deleteSession, diffTranscripts, emptyPlanState, fetchWithRetry, flattenMcpResult, flattenSchema, formatCommandResult, formatLoopError, formatSearchResults, getLatestVersion, harvest, healLoadedMessages, htmlToText, inputCostUsd, inspectMcpServer, isAllowed, isJsonRpcError, isNpxInstall, isPlanStateEmpty, isPlausibleKey, listSessions, loadApiKey, loadDotenv, loadSessionMessages, memoryEnabled, nestArguments, openTranscriptFile, outputCostUsd, parseEditBlocks, parseMcpSpec, parseMojeekResults, parseTranscript, prepareSpawn, projectHash, quoteForCmdExe, readConfig, readProjectMemory, readTranscript, recordFromLoopEvent, redactKey, registerFilesystemTools, registerMemoryTools, registerPlanTool, registerShellTools, registerWebTools, renderMarkdown as renderDiffMarkdown, renderSummaryTable as renderDiffSummary, repairTruncatedJson, replayFromFile, resolveExecutable, restoreSnapshots, runBranches, runCommand, sanitizeMemoryName, sanitizeName as sanitizeSessionName, saveApiKey, scavengeToolCalls, sessionPath, sessionsDir, similarity, snapshotBeforeEdits, stripHallucinatedToolMarkup, tokenizeCommand, truncateForModel, webFetch, webSearch, writeConfig, writeMeta, writeRecord };