reasonix 0.4.16 → 0.4.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/README.md +64 -0
- package/dist/cli/chunk-HNEWBEWZ.js +152 -0
- package/dist/cli/chunk-HNEWBEWZ.js.map +1 -0
- package/dist/cli/index.js +701 -238
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/{prompt-MMANQ36Z.js → prompt-JNNNJLYF.js} +2 -2
- package/dist/index.d.ts +217 -4
- package/dist/index.js +276 -24
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/cli/chunk-2P2MZLCE.js +0 -81
- package/dist/cli/chunk-2P2MZLCE.js.map +0 -1
- /package/dist/cli/{prompt-MMANQ36Z.js.map → prompt-JNNNJLYF.js.map} +0 -0
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
import {
|
|
3
3
|
CODE_SYSTEM_PROMPT,
|
|
4
4
|
codeSystemPrompt
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-HNEWBEWZ.js";
|
|
6
6
|
export {
|
|
7
7
|
CODE_SYSTEM_PROMPT,
|
|
8
8
|
codeSystemPrompt
|
|
9
9
|
};
|
|
10
|
-
//# sourceMappingURL=prompt-
|
|
10
|
+
//# sourceMappingURL=prompt-JNNNJLYF.js.map
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { SpawnOptions } from 'node:child_process';
|
|
1
2
|
import { WriteStream } from 'node:fs';
|
|
2
3
|
|
|
3
4
|
/**
|
|
@@ -392,6 +393,14 @@ declare class ToolCallRepair {
|
|
|
392
393
|
private readonly storm;
|
|
393
394
|
private readonly opts;
|
|
394
395
|
constructor(opts: ToolCallRepairOptions);
|
|
396
|
+
/**
|
|
397
|
+
* Drop the StormBreaker's sliding window of recent (name, args)
|
|
398
|
+
* signatures. Called at the start of every user turn — a fresh user
|
|
399
|
+
* message is a new intent, so carrying old repetition state into it
|
|
400
|
+
* would turn a valid "try again with different input" flow into a
|
|
401
|
+
* false-positive block.
|
|
402
|
+
*/
|
|
403
|
+
resetStorm(): void;
|
|
395
404
|
process(declaredCalls: ToolCall[], reasoningContent: string | null, content?: string | null): {
|
|
396
405
|
calls: ToolCall[];
|
|
397
406
|
report: RepairReport;
|
|
@@ -462,6 +471,25 @@ interface ToolDefinition<A = any, R = any> {
|
|
|
462
471
|
name: string;
|
|
463
472
|
description?: string;
|
|
464
473
|
parameters?: JSONSchema;
|
|
474
|
+
/**
|
|
475
|
+
* Marks a tool as read-only: safe to invoke during plan mode. `true`
|
|
476
|
+
* for tools that only observe (read_file, list_directory, search, web
|
|
477
|
+
* fetch/search). Leave undefined / `false` for anything that can write,
|
|
478
|
+
* execute, or mutate state.
|
|
479
|
+
*
|
|
480
|
+
* The registry enforces this at dispatch: non-readonly tools called
|
|
481
|
+
* while `planMode` is on return a refusal string the model can
|
|
482
|
+
* learn from, instead of actually running.
|
|
483
|
+
*/
|
|
484
|
+
readOnly?: boolean;
|
|
485
|
+
/**
|
|
486
|
+
* Dynamic read-only check for tools whose safety depends on arguments
|
|
487
|
+
* — `run_command` with an allowlisted argv is safe, `run_command
|
|
488
|
+
* rm -rf` isn't. Called with the parsed arguments; `true` means "treat
|
|
489
|
+
* as read-only for plan mode". Takes precedence over `readOnly` when
|
|
490
|
+
* both are set.
|
|
491
|
+
*/
|
|
492
|
+
readOnlyCheck?: (args: A) => boolean;
|
|
465
493
|
fn: (args: A, ctx?: ToolCallContext) => R | Promise<R>;
|
|
466
494
|
}
|
|
467
495
|
interface ToolRegistryOptions {
|
|
@@ -475,7 +503,19 @@ interface ToolRegistryOptions {
|
|
|
475
503
|
declare class ToolRegistry {
|
|
476
504
|
private readonly _tools;
|
|
477
505
|
private readonly _autoFlatten;
|
|
506
|
+
/**
|
|
507
|
+
* When true, `dispatch` refuses any tool whose `readOnly` flag isn't
|
|
508
|
+
* set (and whose `readOnlyCheck` doesn't pass on the specific args).
|
|
509
|
+
* Drives `reasonix code`'s Plan Mode — the model can still explore
|
|
510
|
+
* via read tools but its writes and non-allowlisted shell calls are
|
|
511
|
+
* bounced until the user approves a submitted plan.
|
|
512
|
+
*/
|
|
513
|
+
private _planMode;
|
|
478
514
|
constructor(opts?: ToolRegistryOptions);
|
|
515
|
+
/** Enable / disable plan-mode enforcement at dispatch. */
|
|
516
|
+
setPlanMode(on: boolean): void;
|
|
517
|
+
/** True when the registry is currently refusing non-readonly calls. */
|
|
518
|
+
get planMode(): boolean;
|
|
479
519
|
register<A, R>(def: ToolDefinition<A, R>): this;
|
|
480
520
|
has(name: string): boolean;
|
|
481
521
|
get(name: string): ToolDefinition | undefined;
|
|
@@ -718,6 +758,61 @@ declare function healLoadedMessages(messages: ChatMessage[], maxChars: number):
|
|
|
718
758
|
*/
|
|
719
759
|
declare function formatLoopError(err: Error): string;
|
|
720
760
|
|
|
761
|
+
/**
|
|
762
|
+
* Project memory — a user-authored `REASONIX.md` in the project root
|
|
763
|
+
* that gets pinned into the immutable-prefix system prompt.
|
|
764
|
+
*
|
|
765
|
+
* Design notes:
|
|
766
|
+
*
|
|
767
|
+
* - The file lands in `ImmutablePrefix.system`, so the whole memory
|
|
768
|
+
* block is hashed into the cache prefix fingerprint. Editing the
|
|
769
|
+
* file invalidates the prefix; unchanged memory across sessions
|
|
770
|
+
* keeps the DeepSeek prefix cache warm. That matches Pillar 1 —
|
|
771
|
+
* memory is a deliberate, stable prefix, not per-turn drift.
|
|
772
|
+
* - Only one source: the working-root `REASONIX.md`. No parent walk,
|
|
773
|
+
* no `~/.reasonix/REASONIX.md`, no CLAUDE.md fallback. User-global
|
|
774
|
+
* memory can come later; for v1 one file == one mental model.
|
|
775
|
+
* - Truncated at 8 000 chars (≈ 2k tokens). `.gitignore` gets 2 000
|
|
776
|
+
* because it's a constraint dump; memory gets more headroom because
|
|
777
|
+
* it's deliberate instructions.
|
|
778
|
+
* - Opt-out via `REASONIX_MEMORY=off|false|0`. No CLI flag — memory
|
|
779
|
+
* is a file, `rm REASONIX.md` is the other opt-out.
|
|
780
|
+
*/
|
|
781
|
+
declare const PROJECT_MEMORY_FILE = "REASONIX.md";
|
|
782
|
+
declare const PROJECT_MEMORY_MAX_CHARS = 8000;
|
|
783
|
+
interface ProjectMemory {
|
|
784
|
+
/** Absolute path the memory was read from. */
|
|
785
|
+
path: string;
|
|
786
|
+
/** Post-truncation content (may include a "… (truncated N chars)" marker). */
|
|
787
|
+
content: string;
|
|
788
|
+
/** Original byte length before truncation. */
|
|
789
|
+
originalChars: number;
|
|
790
|
+
/** True iff `originalChars > PROJECT_MEMORY_MAX_CHARS`. */
|
|
791
|
+
truncated: boolean;
|
|
792
|
+
}
|
|
793
|
+
/**
|
|
794
|
+
* Read `REASONIX.md` from `rootDir`. Returns `null` when the file is
|
|
795
|
+
* missing, unreadable, or empty (whitespace-only counts as empty — an
|
|
796
|
+
* empty memory file shouldn't perturb the cache prefix).
|
|
797
|
+
*/
|
|
798
|
+
declare function readProjectMemory(rootDir: string): ProjectMemory | null;
|
|
799
|
+
/**
|
|
800
|
+
* Resolve whether project memory should be read. Default: on.
|
|
801
|
+
* `REASONIX_MEMORY=off|false|0` turns it off (CI, reproducing issues,
|
|
802
|
+
* intentional offline runs).
|
|
803
|
+
*/
|
|
804
|
+
declare function memoryEnabled(): boolean;
|
|
805
|
+
/**
|
|
806
|
+
* Return `basePrompt` with the project's `REASONIX.md` appended as a
|
|
807
|
+
* "Project memory" section. No-op when the file is absent, empty, or
|
|
808
|
+
* memory is disabled via env.
|
|
809
|
+
*
|
|
810
|
+
* The appended block is deterministic — identical input ⇒ identical
|
|
811
|
+
* output — so every session that opens against the same memory file
|
|
812
|
+
* gets the same prefix hash.
|
|
813
|
+
*/
|
|
814
|
+
declare function applyProjectMemory(basePrompt: string, rootDir: string): string;
|
|
815
|
+
|
|
721
816
|
/**
|
|
722
817
|
* Built-in filesystem tools for `reasonix code`.
|
|
723
818
|
*
|
|
@@ -762,6 +857,65 @@ interface FilesystemToolsOptions {
|
|
|
762
857
|
}
|
|
763
858
|
declare function registerFilesystemTools(registry: ToolRegistry, opts: FilesystemToolsOptions): ToolRegistry;
|
|
764
859
|
|
|
860
|
+
/**
|
|
861
|
+
* Plan Mode — read-only exploration phase for `reasonix code`.
|
|
862
|
+
*
|
|
863
|
+
* Shape (mirrors claude-code's plan/act split, adapted for Reasonix):
|
|
864
|
+
*
|
|
865
|
+
* 1. User types `/plan` → registry switches to plan-mode enforcement
|
|
866
|
+
* (write tools refused at dispatch; reads + allowlisted shell
|
|
867
|
+
* still work).
|
|
868
|
+
* 2. Model explores, then calls `submit_plan` with a markdown plan.
|
|
869
|
+
* 3. `submit_plan` throws `PlanProposedError`, which the TUI renders
|
|
870
|
+
* as a picker: Approve / Refine / Cancel.
|
|
871
|
+
* 4. Approve → registry leaves plan mode, a synthetic user message
|
|
872
|
+
* "The plan has been approved. Implement it now." is pushed into
|
|
873
|
+
* the loop so the next turn executes.
|
|
874
|
+
*
|
|
875
|
+
* The read-only enforcement lives in `ToolRegistry.dispatch` via
|
|
876
|
+
* `readOnly` / `readOnlyCheck`; this file only ships the `submit_plan`
|
|
877
|
+
* escape hatch and the error type that carries the plan out of the
|
|
878
|
+
* registry without stuffing it into the message.
|
|
879
|
+
*
|
|
880
|
+
* We do not change `ImmutablePrefix.toolSpecs` when plan mode toggles —
|
|
881
|
+
* that would break Pillar 1's prefix cache. Instead the same full spec
|
|
882
|
+
* list stays pinned, and the registry enforces mode at dispatch time.
|
|
883
|
+
* The refusal string teaches the model the rule; cache hits stay
|
|
884
|
+
* intact.
|
|
885
|
+
*/
|
|
886
|
+
|
|
887
|
+
/**
|
|
888
|
+
* Thrown by `submit_plan` when plan mode is active, carrying the plan
|
|
889
|
+
* text the TUI will render for the user's approval.
|
|
890
|
+
*
|
|
891
|
+
* Implements the `toToolResult` protocol so `ToolRegistry.dispatch`
|
|
892
|
+
* serializes the full plan into the tool-result JSON (not just the
|
|
893
|
+
* error message). The TUI parses `{ error, plan }` from the tool event
|
|
894
|
+
* and mounts the `PlanConfirm` picker.
|
|
895
|
+
*/
|
|
896
|
+
declare class PlanProposedError extends Error {
|
|
897
|
+
readonly plan: string;
|
|
898
|
+
constructor(plan: string);
|
|
899
|
+
/**
|
|
900
|
+
* Structured tool-result shape. Consumed by the TUI to extract the
|
|
901
|
+
* plan without regex-scraping the error message.
|
|
902
|
+
*/
|
|
903
|
+
toToolResult(): {
|
|
904
|
+
error: string;
|
|
905
|
+
plan: string;
|
|
906
|
+
};
|
|
907
|
+
}
|
|
908
|
+
interface PlanToolOptions {
|
|
909
|
+
/**
|
|
910
|
+
* Optional side-channel callback fired when the model submits a plan.
|
|
911
|
+
* The TUI uses this to preview the plan in real time (the tool-result
|
|
912
|
+
* event is also emitted; this is just earlier and friendlier to
|
|
913
|
+
* test harnesses that don't want to parse JSON).
|
|
914
|
+
*/
|
|
915
|
+
onPlanSubmitted?: (plan: string) => void;
|
|
916
|
+
}
|
|
917
|
+
declare function registerPlanTool(registry: ToolRegistry, opts?: PlanToolOptions): ToolRegistry;
|
|
918
|
+
|
|
765
919
|
/**
|
|
766
920
|
* Native shell tool — lets the model run commands inside the sandbox
|
|
767
921
|
* root so it can actually verify its own work (run tests, check git
|
|
@@ -839,6 +993,64 @@ declare function runCommand(cmd: string, opts: {
|
|
|
839
993
|
maxOutputChars?: number;
|
|
840
994
|
signal?: AbortSignal;
|
|
841
995
|
}): Promise<RunCommandResult>;
|
|
996
|
+
/**
|
|
997
|
+
* Test/override hooks for {@link resolveExecutable}. Omitting any field
|
|
998
|
+
* falls through to the real process globals — the runtime call path
|
|
999
|
+
* uses defaults; tests inject `platform` + `env` + `isFile` to exercise
|
|
1000
|
+
* Windows-specific lookup from a Linux CI runner without touching
|
|
1001
|
+
* actual fs.
|
|
1002
|
+
*/
|
|
1003
|
+
interface ResolveExecutableOptions {
|
|
1004
|
+
platform?: NodeJS.Platform;
|
|
1005
|
+
env?: {
|
|
1006
|
+
PATH?: string;
|
|
1007
|
+
PATHEXT?: string;
|
|
1008
|
+
};
|
|
1009
|
+
/** Predicate swapped in by tests to avoid creating real files. */
|
|
1010
|
+
isFile?: (path: string) => boolean;
|
|
1011
|
+
/** Path.join used for the lookup. Defaults to Windows semantics on Windows. */
|
|
1012
|
+
pathDelimiter?: string;
|
|
1013
|
+
}
|
|
1014
|
+
/**
|
|
1015
|
+
* Resolve a bare command name (e.g. `npm`) to its on-disk path via
|
|
1016
|
+
* PATH × PATHEXT on Windows. Returns the input unchanged on non-Windows
|
|
1017
|
+
* platforms, when the input is already a path (contains `/`, `\`, or is
|
|
1018
|
+
* absolute), or when no match is found in PATH × PATHEXT (caller gets a
|
|
1019
|
+
* natural ENOENT from spawn, which surfaces cleanly).
|
|
1020
|
+
*
|
|
1021
|
+
* Why this exists: `child_process.spawn` with `shell: false` invokes
|
|
1022
|
+
* Windows `CreateProcess`, which does not honor `PATHEXT` and does not
|
|
1023
|
+
* search for `.cmd` / `.bat` wrappers. Node-ecosystem tools ship as
|
|
1024
|
+
* `npm.cmd`, `npx.cmd`, `yarn.cmd`, etc., so a bare `npm` fails with
|
|
1025
|
+
* ENOENT under `shell: false`. Flipping to `shell: true` would work
|
|
1026
|
+
* but reintroduces shell-expansion (pipes, redirects, chained cmds)
|
|
1027
|
+
* that the tool was explicitly designed to forbid. This resolver
|
|
1028
|
+
* threads the needle.
|
|
1029
|
+
*/
|
|
1030
|
+
declare function resolveExecutable(cmd: string, opts?: ResolveExecutableOptions): string;
|
|
1031
|
+
/**
|
|
1032
|
+
* Prepare `(bin, args, spawnOpts)` for the runCommand spawn call,
|
|
1033
|
+
* applying Windows-specific workarounds for (a) PATHEXT lookup and
|
|
1034
|
+
* (b) the CVE-2024-27980 prohibition on direct `.cmd`/`.bat` spawns.
|
|
1035
|
+
*
|
|
1036
|
+
* Exported so tests can assert the transformation without booting an
|
|
1037
|
+
* actual child process.
|
|
1038
|
+
*/
|
|
1039
|
+
declare function prepareSpawn(argv: readonly string[], opts?: ResolveExecutableOptions): {
|
|
1040
|
+
bin: string;
|
|
1041
|
+
args: string[];
|
|
1042
|
+
spawnOverrides: SpawnOptions;
|
|
1043
|
+
};
|
|
1044
|
+
/**
|
|
1045
|
+
* Quote an argument so cmd.exe parses it back as a single token. We
|
|
1046
|
+
* always wrap in double quotes when the arg contains whitespace or
|
|
1047
|
+
* any cmd.exe metacharacter, doubling embedded quotes per cmd.exe's
|
|
1048
|
+
* `""` escape rule. Bare alphanumeric args pass through unquoted for
|
|
1049
|
+
* readability in logs.
|
|
1050
|
+
*
|
|
1051
|
+
* Exported for test coverage of the quoting semantics.
|
|
1052
|
+
*/
|
|
1053
|
+
declare function quoteForCmdExe(arg: string): string;
|
|
842
1054
|
/** Error thrown by `run_command` when the command isn't allowlisted. */
|
|
843
1055
|
declare class NeedsConfirmationError extends Error {
|
|
844
1056
|
readonly command: string;
|
|
@@ -1872,14 +2084,15 @@ declare function restoreSnapshots(snapshots: EditSnapshot[], rootDir: string): A
|
|
|
1872
2084
|
* the Cache-First Loop is trying to conserve. The SEARCH/REPLACE spec
|
|
1873
2085
|
* is the one unavoidable bloat; we trim everything else.
|
|
1874
2086
|
*/
|
|
1875
|
-
declare const CODE_SYSTEM_PROMPT = "You are Reasonix Code, a coding assistant. You have filesystem tools (read_file, write_file, list_directory, search_files, etc.) rooted at the user's working directory.\n\n# When to edit vs. when to explore\n\nOnly propose edits when the user explicitly asks you to change, fix, add, remove, refactor, or write something. Do NOT propose edits when the user asks you to:\n- analyze, read, explore, describe, or summarize a project\n- explain how something works\n- answer a question about the code\n\nIn those cases, use tools to gather what you need, then reply in prose. No SEARCH/REPLACE blocks, no file changes. If you're unsure what the user wants, ask.\n\nWhen you do propose edits, the user will review them and decide whether to `/apply` or `/discard`. Don't assume they'll accept \u2014 write as if each edit will be audited, because it will.\n\n# Editing files\n\nWhen you've been asked to change a file, output one or more SEARCH/REPLACE blocks in this exact format:\n\npath/to/file.ext\n<<<<<<< SEARCH\nexact existing lines from the file, including whitespace\n=======\nthe new lines\n>>>>>>> REPLACE\n\nRules:\n- Always read_file first so your SEARCH matches byte-for-byte. If it doesn't match, the edit is rejected and you'll have to retry with the exact current content.\n- One edit per block. Multiple blocks in one response are fine.\n- To create a new file, leave SEARCH empty:\n path/to/new.ts\n <<<<<<< SEARCH\n =======\n (whole file content here)\n >>>>>>> REPLACE\n- Do NOT use write_file to change existing files \u2014 the user reviews your edits as SEARCH/REPLACE. write_file is only for files you explicitly want to overwrite wholesale (rare).\n- Paths are relative to the working directory. Don't use absolute paths.\n\n# Exploration\n\n- Avoid listing or reading inside these common dependency / build directories unless the user explicitly asks about them: node_modules, dist, build, out, .next, .nuxt, .svelte-kit, .git, .venv, venv, __pycache__, target, coverage, .turbo, .cache. They're expensive and usually irrelevant.\n- Prefer search_files / grep over list_directory when you know roughly what you're looking for \u2014 it saves context and avoids enumerating huge trees.\n\n# Style\n\n- Show edits; don't narrate them in prose. \"Here's the fix:\" is enough.\n- One short paragraph explaining *why*, then the blocks.\n- If you need to explore first (list / grep / read), do it with tool calls before writing any prose \u2014 silence while exploring is fine.\n";
|
|
2087
|
+
declare const CODE_SYSTEM_PROMPT = "You are Reasonix Code, a coding assistant. You have filesystem tools (read_file, write_file, list_directory, search_files, etc.) rooted at the user's working directory.\n\n# When to propose a plan (submit_plan)\n\nYou have a `submit_plan` tool that shows the user a markdown plan and lets them Approve / Refine / Cancel before you execute. Use it proactively when the task is large enough to deserve a review gate:\n\n- Multi-file refactors or renames.\n- Architecture changes (moving modules, splitting / merging files, new abstractions).\n- Anything where \"undo\" after the fact would be expensive \u2014 migrations, destructive cleanups, API shape changes.\n- When the user's request is ambiguous and multiple reasonable interpretations exist \u2014 propose your reading as a plan and let them confirm.\n\nSkip submit_plan for small, obvious changes: one-line typo, clear bug with a clear fix, adding a missing import, renaming a local variable. Just do those.\n\nPlan body: one-sentence summary, then a file-by-file breakdown of what you'll change and why, and any risks or open questions. If some decisions are genuinely up to the user (naming, tradeoffs, out-of-scope possibilities), list them in an \"Open questions\" or \"\u5F85\u786E\u8BA4\" section \u2014 the user sees the plan in a picker and has a text input to answer your questions before approving. Don't pretend certainty you don't have; flagged questions are how the user tells you what they care about. After calling submit_plan, STOP \u2014 don't call any more tools, wait for the user's verdict.\n\n# Plan mode (/plan)\n\nThe user can ALSO enter \"plan mode\" via /plan, which is a stronger, explicit constraint:\n- Write tools (edit_file, write_file, create_directory, move_file) and non-allowlisted run_command calls are BOUNCED at dispatch \u2014 you'll get a tool result like \"unavailable in plan mode\". Don't retry them.\n- Read tools (read_file, list_directory, search_files, directory_tree, get_file_info) and allowlisted shell (git status/log/diff, ls, cat, grep, cargo check, npm test) still work \u2014 use them to investigate.\n- You MUST call submit_plan before anything will execute. Approve exits plan mode; Refine stays in; Cancel exits without implementing.\n\n\n# When to edit vs. when to explore\n\nOnly propose edits when the user explicitly asks you to change, fix, add, remove, refactor, or write something. Do NOT propose edits when the user asks you to:\n- analyze, read, explore, describe, or summarize a project\n- explain how something works\n- answer a question about the code\n\nIn those cases, use tools to gather what you need, then reply in prose. No SEARCH/REPLACE blocks, no file changes. If you're unsure what the user wants, ask.\n\nWhen you do propose edits, the user will review them and decide whether to `/apply` or `/discard`. Don't assume they'll accept \u2014 write as if each edit will be audited, because it will.\n\n# Editing files\n\nWhen you've been asked to change a file, output one or more SEARCH/REPLACE blocks in this exact format:\n\npath/to/file.ext\n<<<<<<< SEARCH\nexact existing lines from the file, including whitespace\n=======\nthe new lines\n>>>>>>> REPLACE\n\nRules:\n- Always read_file first so your SEARCH matches byte-for-byte. If it doesn't match, the edit is rejected and you'll have to retry with the exact current content.\n- One edit per block. Multiple blocks in one response are fine.\n- To create a new file, leave SEARCH empty:\n path/to/new.ts\n <<<<<<< SEARCH\n =======\n (whole file content here)\n >>>>>>> REPLACE\n- Do NOT use write_file to change existing files \u2014 the user reviews your edits as SEARCH/REPLACE. write_file is only for files you explicitly want to overwrite wholesale (rare).\n- Paths are relative to the working directory. Don't use absolute paths.\n\n# Exploration\n\n- Avoid listing or reading inside these common dependency / build directories unless the user explicitly asks about them: node_modules, dist, build, out, .next, .nuxt, .svelte-kit, .git, .venv, venv, __pycache__, target, coverage, .turbo, .cache. They're expensive and usually irrelevant.\n- Prefer search_files / grep over list_directory when you know roughly what you're looking for \u2014 it saves context and avoids enumerating huge trees.\n\n# Style\n\n- Show edits; don't narrate them in prose. \"Here's the fix:\" is enough.\n- One short paragraph explaining *why*, then the blocks.\n- If you need to explore first (list / grep / read), do it with tool calls before writing any prose \u2014 silence while exploring is fine.\n";
|
|
1876
2088
|
/**
|
|
1877
2089
|
* Inject the project's `.gitignore` content into the system prompt as a
|
|
1878
2090
|
* "respect this on top of the built-in denylist" hint. We don't parse
|
|
1879
2091
|
* the file — we hand it to the model as-is. Truncate long ones so we
|
|
1880
2092
|
* don't eat context budget on huge generated ignore lists.
|
|
1881
2093
|
*
|
|
1882
|
-
*
|
|
2094
|
+
* Stacking order (stable for cache prefix):
|
|
2095
|
+
* base prompt → project memory (REASONIX.md) → .gitignore block
|
|
1883
2096
|
*/
|
|
1884
2097
|
declare function codeSystemPrompt(rootDir: string): string;
|
|
1885
2098
|
|
|
@@ -1953,6 +2166,6 @@ declare function redactKey(key: string): string;
|
|
|
1953
2166
|
|
|
1954
2167
|
/** Reasonix — DeepSeek-native agent framework. Library entry point. */
|
|
1955
2168
|
|
|
1956
|
-
declare const VERSION = "0.4.
|
|
2169
|
+
declare const VERSION = "0.4.19";
|
|
1957
2170
|
|
|
1958
|
-
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, 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, NeedsConfirmationError, type PageContent, type ProgressNotificationParams, 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, Usage, VERSION, VolatileScratch, type WebFetchOptions, type WebSearchOptions, type WebToolsOptions, aggregateBranchUsage, analyzeSchema, appendSessionMessage, applyEditBlock, applyEditBlocks, 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, nestArguments, openTranscriptFile, outputCostUsd, parseEditBlocks, parseMcpSpec, parseMojeekResults, parseTranscript, readConfig, readTranscript, recordFromLoopEvent, redactKey, registerFilesystemTools, registerShellTools, registerWebTools, renderMarkdown as renderDiffMarkdown, renderSummaryTable as renderDiffSummary, repairTruncatedJson, replayFromFile, restoreSnapshots, runBranches, runCommand, sanitizeName as sanitizeSessionName, saveApiKey, scavengeToolCalls, sessionPath, sessionsDir, similarity, snapshotBeforeEdits, stripHallucinatedToolMarkup, tokenizeCommand, truncateForModel, webFetch, webSearch, writeConfig, writeMeta, writeRecord };
|
|
2171
|
+
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, 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, 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, Usage, VERSION, VolatileScratch, type WebFetchOptions, type WebSearchOptions, type WebToolsOptions, aggregateBranchUsage, analyzeSchema, appendSessionMessage, applyEditBlock, applyEditBlocks, applyProjectMemory, 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, quoteForCmdExe, readConfig, readProjectMemory, readTranscript, recordFromLoopEvent, redactKey, registerFilesystemTools, registerPlanTool, registerShellTools, registerWebTools, renderMarkdown as renderDiffMarkdown, renderSummaryTable as renderDiffSummary, repairTruncatedJson, replayFromFile, resolveExecutable, restoreSnapshots, runBranches, runCommand, sanitizeName as sanitizeSessionName, saveApiKey, scavengeToolCalls, sessionPath, sessionsDir, similarity, snapshotBeforeEdits, stripHallucinatedToolMarkup, tokenizeCommand, truncateForModel, webFetch, webSearch, writeConfig, writeMeta, writeRecord };
|