@oh-my-pi/pi-coding-agent 15.3.2 → 15.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (193) hide show
  1. package/CHANGELOG.md +110 -0
  2. package/dist/types/cli/file-processor.d.ts +1 -1
  3. package/dist/types/config/settings-schema.d.ts +45 -3
  4. package/dist/types/config/settings.d.ts +1 -1
  5. package/dist/types/debug/raw-sse.d.ts +2 -0
  6. package/dist/types/edit/file-read-cache.d.ts +15 -4
  7. package/dist/types/edit/index.d.ts +3 -8
  8. package/dist/types/edit/renderer.d.ts +1 -2
  9. package/dist/types/eval/__tests__/shared-executors.test.d.ts +1 -0
  10. package/dist/types/eval/js/shared/local-module-loader.d.ts +16 -0
  11. package/dist/types/eval/js/shared/rewrite-imports.d.ts +4 -0
  12. package/dist/types/eval/js/shared/runtime.d.ts +14 -8
  13. package/dist/types/eval/py/executor.d.ts +1 -2
  14. package/dist/types/eval/py/kernel.d.ts +6 -0
  15. package/dist/types/eval/py/tool-bridge.d.ts +1 -5
  16. package/dist/types/eval/session-id.d.ts +3 -0
  17. package/dist/types/extensibility/extensions/types.d.ts +1 -3
  18. package/dist/types/hashline/anchors.d.ts +15 -9
  19. package/dist/types/hashline/constants.d.ts +0 -2
  20. package/dist/types/hashline/diff.d.ts +1 -2
  21. package/dist/types/hashline/executor.d.ts +52 -0
  22. package/dist/types/hashline/hash.d.ts +44 -93
  23. package/dist/types/hashline/index.d.ts +2 -1
  24. package/dist/types/hashline/input.d.ts +2 -9
  25. package/dist/types/hashline/recovery.d.ts +3 -9
  26. package/dist/types/hashline/tokenizer.d.ts +91 -0
  27. package/dist/types/hashline/types.d.ts +5 -7
  28. package/dist/types/modes/components/extensions/types.d.ts +0 -4
  29. package/dist/types/modes/types.d.ts +1 -0
  30. package/dist/types/modes/utils/ui-helpers.d.ts +1 -0
  31. package/dist/types/sdk.d.ts +2 -0
  32. package/dist/types/session/agent-session.d.ts +11 -15
  33. package/dist/types/session/agent-storage.d.ts +11 -10
  34. package/dist/types/slash-commands/acp-builtins.d.ts +3 -3
  35. package/dist/types/slash-commands/types.d.ts +0 -5
  36. package/dist/types/task/executor.d.ts +2 -0
  37. package/dist/types/tool-discovery/tool-index.d.ts +0 -50
  38. package/dist/types/tools/index.d.ts +2 -8
  39. package/dist/types/tools/match-line-format.d.ts +4 -4
  40. package/dist/types/tools/output-schema-validator.d.ts +64 -0
  41. package/dist/types/tools/review.d.ts +13 -0
  42. package/dist/types/tools/search-tool-bm25.d.ts +1 -1
  43. package/dist/types/tools/search.d.ts +4 -3
  44. package/dist/types/utils/edit-mode.d.ts +1 -1
  45. package/dist/types/web/kagi.d.ts +4 -2
  46. package/dist/types/web/parallel.d.ts +4 -3
  47. package/dist/types/web/scrapers/types.d.ts +2 -1
  48. package/dist/types/web/search/index.d.ts +12 -4
  49. package/dist/types/web/search/provider.d.ts +2 -1
  50. package/dist/types/web/search/providers/anthropic.d.ts +9 -4
  51. package/dist/types/web/search/providers/base.d.ts +34 -2
  52. package/dist/types/web/search/providers/brave.d.ts +8 -1
  53. package/dist/types/web/search/providers/codex.d.ts +13 -9
  54. package/dist/types/web/search/providers/exa.d.ts +10 -1
  55. package/dist/types/web/search/providers/gemini.d.ts +20 -23
  56. package/dist/types/web/search/providers/jina.d.ts +2 -1
  57. package/dist/types/web/search/providers/kagi.d.ts +4 -1
  58. package/dist/types/web/search/providers/kimi.d.ts +10 -1
  59. package/dist/types/web/search/providers/parallel.d.ts +3 -2
  60. package/dist/types/web/search/providers/perplexity.d.ts +5 -2
  61. package/dist/types/web/search/providers/searxng.d.ts +2 -1
  62. package/dist/types/web/search/providers/synthetic.d.ts +5 -8
  63. package/dist/types/web/search/providers/tavily.d.ts +11 -4
  64. package/dist/types/web/search/providers/utils.d.ts +8 -6
  65. package/dist/types/web/search/providers/zai.d.ts +12 -3
  66. package/package.json +7 -7
  67. package/src/cli/file-processor.ts +12 -2
  68. package/src/cli.ts +0 -8
  69. package/src/commands/commit.ts +8 -8
  70. package/src/config/prompt-templates.ts +6 -6
  71. package/src/config/settings-schema.ts +47 -3
  72. package/src/config/settings.ts +5 -5
  73. package/src/debug/raw-sse.ts +68 -3
  74. package/src/edit/file-read-cache.ts +68 -25
  75. package/src/edit/index.ts +6 -37
  76. package/src/edit/renderer.ts +9 -47
  77. package/src/edit/streaming.ts +43 -56
  78. package/src/eval/__tests__/shared-executors.test.ts +520 -0
  79. package/src/eval/js/context-manager.ts +64 -53
  80. package/src/eval/js/shared/local-module-loader.ts +265 -0
  81. package/src/eval/js/shared/prelude.txt +4 -0
  82. package/src/eval/js/shared/rewrite-imports.ts +85 -0
  83. package/src/eval/js/shared/runtime.ts +129 -86
  84. package/src/eval/js/worker-core.ts +23 -38
  85. package/src/eval/py/executor.ts +155 -84
  86. package/src/eval/py/kernel.ts +10 -1
  87. package/src/eval/py/prelude.py +22 -24
  88. package/src/eval/py/runner.py +203 -85
  89. package/src/eval/py/tool-bridge.ts +17 -10
  90. package/src/eval/session-id.ts +8 -0
  91. package/src/exec/bash-executor.ts +27 -16
  92. package/src/extensibility/extensions/runner.ts +0 -1
  93. package/src/extensibility/extensions/types.ts +1 -3
  94. package/src/hashline/anchors.ts +56 -65
  95. package/src/hashline/apply.ts +29 -31
  96. package/src/hashline/constants.ts +0 -3
  97. package/src/hashline/diff-preview.ts +4 -5
  98. package/src/hashline/diff.ts +30 -4
  99. package/src/hashline/execute.ts +91 -26
  100. package/src/hashline/executor.ts +239 -0
  101. package/src/hashline/grammar.lark +12 -10
  102. package/src/hashline/hash.ts +69 -114
  103. package/src/hashline/index.ts +2 -1
  104. package/src/hashline/input.ts +48 -41
  105. package/src/hashline/prefixes.ts +21 -11
  106. package/src/hashline/recovery.ts +63 -71
  107. package/src/hashline/stream.ts +2 -2
  108. package/src/hashline/tokenizer.ts +467 -0
  109. package/src/hashline/types.ts +6 -8
  110. package/src/internal-urls/docs-index.generated.ts +7 -7
  111. package/src/modes/components/extensions/types.ts +0 -5
  112. package/src/modes/components/session-observer-overlay.ts +11 -2
  113. package/src/modes/components/settings-selector.ts +10 -1
  114. package/src/modes/components/tree-selector.ts +10 -2
  115. package/src/modes/controllers/command-controller.ts +1 -3
  116. package/src/modes/controllers/extension-ui-controller.ts +10 -11
  117. package/src/modes/controllers/selector-controller.ts +5 -5
  118. package/src/modes/theme/theme.ts +4 -2
  119. package/src/modes/types.ts +4 -1
  120. package/src/modes/utils/ui-helpers.ts +4 -0
  121. package/src/prompts/agents/explore.md +1 -1
  122. package/src/prompts/tools/ast-edit.md +1 -1
  123. package/src/prompts/tools/ast-grep.md +1 -1
  124. package/src/prompts/tools/eval.md +1 -1
  125. package/src/prompts/tools/hashline.md +73 -94
  126. package/src/prompts/tools/read.md +4 -4
  127. package/src/prompts/tools/search.md +3 -3
  128. package/src/sdk.ts +33 -26
  129. package/src/session/agent-session.ts +59 -66
  130. package/src/session/agent-storage.ts +13 -14
  131. package/src/slash-commands/acp-builtins.ts +3 -3
  132. package/src/slash-commands/types.ts +0 -6
  133. package/src/task/executor.ts +26 -57
  134. package/src/task/index.ts +8 -4
  135. package/src/tool-discovery/tool-index.ts +0 -134
  136. package/src/tools/ast-edit.ts +36 -13
  137. package/src/tools/ast-grep.ts +45 -4
  138. package/src/tools/browser/tab-worker.ts +3 -2
  139. package/src/tools/eval.ts +2 -1
  140. package/src/tools/fetch.ts +23 -14
  141. package/src/tools/index.ts +2 -8
  142. package/src/tools/irc.ts +59 -5
  143. package/src/tools/match-line-format.ts +5 -7
  144. package/src/tools/output-schema-validator.ts +132 -0
  145. package/src/tools/read.ts +142 -31
  146. package/src/tools/review.ts +23 -0
  147. package/src/tools/search-tool-bm25.ts +3 -30
  148. package/src/tools/search.ts +48 -16
  149. package/src/tools/write.ts +3 -3
  150. package/src/tools/yield.ts +32 -41
  151. package/src/utils/edit-mode.ts +1 -2
  152. package/src/utils/file-mentions.ts +2 -2
  153. package/src/web/kagi.ts +15 -6
  154. package/src/web/parallel.ts +9 -6
  155. package/src/web/scrapers/types.ts +7 -1
  156. package/src/web/scrapers/youtube.ts +13 -7
  157. package/src/web/search/index.ts +37 -11
  158. package/src/web/search/provider.ts +5 -3
  159. package/src/web/search/providers/anthropic.ts +30 -21
  160. package/src/web/search/providers/base.ts +35 -2
  161. package/src/web/search/providers/brave.ts +4 -4
  162. package/src/web/search/providers/codex.ts +118 -89
  163. package/src/web/search/providers/exa.ts +3 -2
  164. package/src/web/search/providers/gemini.ts +58 -155
  165. package/src/web/search/providers/jina.ts +4 -4
  166. package/src/web/search/providers/kagi.ts +17 -11
  167. package/src/web/search/providers/kimi.ts +29 -13
  168. package/src/web/search/providers/parallel.ts +171 -23
  169. package/src/web/search/providers/perplexity.ts +38 -37
  170. package/src/web/search/providers/searxng.ts +3 -1
  171. package/src/web/search/providers/synthetic.ts +16 -19
  172. package/src/web/search/providers/tavily.ts +23 -18
  173. package/src/web/search/providers/utils.ts +11 -17
  174. package/src/web/search/providers/zai.ts +16 -8
  175. package/dist/types/hashline/parser.d.ts +0 -7
  176. package/dist/types/mcp/discoverable-tool-metadata.d.ts +0 -7
  177. package/dist/types/tools/vim.d.ts +0 -58
  178. package/dist/types/vim/buffer.d.ts +0 -41
  179. package/dist/types/vim/commands.d.ts +0 -6
  180. package/dist/types/vim/engine.d.ts +0 -47
  181. package/dist/types/vim/parser.d.ts +0 -3
  182. package/dist/types/vim/render.d.ts +0 -25
  183. package/dist/types/vim/types.d.ts +0 -182
  184. package/src/hashline/parser.ts +0 -246
  185. package/src/mcp/discoverable-tool-metadata.ts +0 -24
  186. package/src/prompts/tools/vim.md +0 -98
  187. package/src/tools/vim.ts +0 -949
  188. package/src/vim/buffer.ts +0 -309
  189. package/src/vim/commands.ts +0 -382
  190. package/src/vim/engine.ts +0 -2409
  191. package/src/vim/parser.ts +0 -134
  192. package/src/vim/render.ts +0 -252
  193. package/src/vim/types.ts +0 -197
@@ -3,56 +3,37 @@
3
3
  * and prompt helpers.
4
4
  */
5
5
  /**
6
- * 647 single-token BPE bigrams for hashline anchors. Every entry tokenizes as
7
- * exactly one token in modern BPE vocabularies (cl100k / o200k / Claude family),
8
- * so a hashline anchor built from one bigram is exactly 1 token.
9
- *
10
- * This is the complete set of 2-letter lowercase combinations that are single
11
- * tokens — the 29 missing combinations are rare-letter pairs (q/x/z heavy)
12
- * that no major BPE vocabulary merges into a single token.
13
- *
14
- * Order is stable forever — changing it would invalidate every saved
15
- * `LINE+ID` reference in transcripts and prompts.
16
- */
17
- export declare const HL_BIGRAMS: readonly string[];
18
- export declare const HL_BIGRAMS_COUNT: number;
19
- /**
20
- * Decoration prefix that may precede a `LINE+HASH` anchor in tool output:
6
+ * Decoration prefix that may precede a line number in tool output:
21
7
  * `>` (context line in grep), `+` (added line in diff), `-` (removed line),
22
8
  * `*` (match line). Any combination, in any order, surrounded by optional
23
- * whitespace. Output formatters emit at most one decoration per anchor; the
24
- * regex stays liberal because anchor-ref parsers accept whatever the model
25
- * echoes back.
9
+ * whitespace. Output formatters emit at most one decoration per line; the
10
+ * parser stays liberal because it accepts whatever the model echoes back.
26
11
  */
27
12
  export declare const HL_ANCHOR_DECORATION_RE_RAW = "\\s*[>+\\-*]*\\s*";
13
+ /** Capture-group regex source for a decorated bare line-number anchor. */
14
+ export declare const HL_ANCHOR_RE_RAW = "\\s*[>+\\-*]*\\s*(\\d+)";
15
+ /** Bare positive line-number Lid (no decorations, no captures, no anchors). */
16
+ export declare const HL_LINE_RE_RAW = "[1-9]\\d*";
17
+ /** Capture-group form of {@link HL_LINE_RE_RAW}. */
18
+ export declare const HL_LINE_CAPTURE_RE_RAW = "([1-9]\\d*)";
19
+ /** Four-hex-character file hash carried by a hashline section header. */
20
+ export declare const HL_FILE_HASH_RE_RAW = "[0-9a-f]{4}";
21
+ /** Capture-group form of {@link HL_FILE_HASH_RE_RAW}. */
22
+ export declare const HL_FILE_HASH_CAPTURE_RE_RAW = "([0-9a-f]{4})";
23
+ /** Separator between a hashline file path and its file hash. */
24
+ export declare const HL_FILE_HASH_SEP = "#";
25
+ /** Separator between a line number and displayed line content in hashline mode. */
26
+ export declare const HL_LINE_BODY_SEP = ":";
27
+ /** Regex-escaped form of {@link HL_LINE_BODY_SEP}, safe for embedding inside a regex. */
28
+ export declare const HL_LINE_BODY_SEP_RE_RAW: string;
28
29
  /**
29
- * Capture-group regex source for a decorated `LINE+HASH` anchor. Group 1
30
- * captures the line number (digits only); group 2 captures the hash. The
31
- * source is intentionally unanchored — anchoring with `^` (or composing into a
32
- * larger pattern) is the caller's responsibility.
33
- */
34
- export declare const HL_ANCHOR_RE_RAW = "\\s*[>+\\-*]*\\s*(\\d+)([a-z]{2})";
35
- /**
36
- * Bare `LINE+HASH` Lid (no decorations, no captures, no anchors). Use for
37
- * embedding inside larger patterns where the line+hash unit appears as a
38
- * literal (e.g. range bounds, alternation arms, op-line heuristics).
39
- */
40
- export declare const HL_HASH_RE_RAW = "[1-9]\\d*[a-z]{2}";
41
- /**
42
- * Capture-group form of {@link HL_HASH_RE_RAW}: group 1 captures the
43
- * line number, group 2 captures the hash.
44
- */
45
- export declare const HL_HASH_CAPTURE_RE_RAW = "([1-9]\\d*)([a-z]{2})";
46
- /** Width of a hash in display characters. */
47
- export declare const HL_HASH_WIDTH = 2;
48
- /**
49
- * Representative hash suffixes for use in user-facing error messages and
50
- * prompt examples.
30
+ * Representative file hashes for use in user-facing error messages and prompt
31
+ * examples.
51
32
  */
52
- export declare const HL_HASH_EXAMPLES: readonly ["sr", "ab", "th"];
33
+ export declare const HL_FILE_HASH_EXAMPLES: readonly ["1a2b", "3c4d", "9f3e"];
53
34
  /**
54
35
  * Format a comma-separated list of example anchors with an optional line-number
55
- * prefix, quoted for inclusion in error messages: `"160sr", "160ab", "160th"`.
36
+ * prefix, quoted for inclusion in error messages: `"160", "42", "7"`.
56
37
  */
57
38
  export declare function describeAnchorExamples(linePrefix?: string): string;
58
39
  /**
@@ -61,63 +42,33 @@ export declare function describeAnchorExamples(linePrefix?: string): string;
61
42
  * pass through unchanged.
62
43
  */
63
44
  export declare function resolveHashlineGrammarPlaceholders(grammar: string): string;
64
- /** @deprecated Use {@link resolveHashlineGrammarPlaceholders}. */
65
- export declare const resolveLarkLidPlaceholders: typeof resolveHashlineGrammarPlaceholders;
66
45
  /**
67
- * Hashline edit input markers. File section headers start with {@link HL_FILE_PREFIX};
68
- * op lines start with a direction/action sigil: {@link HL_OP_INSERT_BEFORE},
69
- * {@link HL_OP_INSERT_AFTER}, or {@link HL_OP_REPLACE}. Payload lines are
70
- * verbatim file content and have no per-line marker.
46
+ * op lines have an `ANCHOR<SIGIL>[INLINE_PAYLOAD]` shape, where SIGIL is one of
47
+ * {@link HL_OP_INSERT_BEFORE}, {@link HL_OP_INSERT_AFTER}, {@link HL_OP_REPLACE},
48
+ * or {@link HL_OP_DELETE}.
49
+ * Multi-line payloads follow on subsequent lines as verbatim file content with no
50
+ * per-line marker.
71
51
  *
72
52
  * These constants are the single source of truth for the edit parser, grammar,
73
53
  * renderer, and prompt.
74
54
  */
75
- export declare const HL_OP_INSERT_BEFORE = "\u00AB";
76
- export declare const HL_OP_INSERT_AFTER = "\u00BB";
77
- export declare const HL_OP_REPLACE = "\u2254";
55
+ export declare const HL_OP_INSERT_BEFORE = "\u2191";
56
+ export declare const HL_OP_INSERT_AFTER = "\u2193";
57
+ export declare const HL_OP_REPLACE = ":";
58
+ export declare const HL_OP_DELETE = "!";
78
59
  /** All hashline edit op sigils, concatenated for fast membership tests. */
79
- export declare const HL_OP_CHARS = "\u00AB\u00BB\u2254";
60
+ export declare const HL_OP_CHARS = "\u2191\u2193:!";
80
61
  /** Hashline edit file section header marker. */
81
- export declare const HL_FILE_PREFIX = "\u00A7";
82
- /** Stable separator for read/search/hashline display output. Intentionally not configurable. */
83
- export declare const HL_BODY_SEP = "|";
84
- /** Regex-escaped form of {@link HL_BODY_SEP}, safe for embedding inside a regex. */
85
- export declare const HL_BODY_SEP_RE_RAW: string;
62
+ export declare const HL_FILE_PREFIX = "\u00B6";
86
63
  /**
87
- * Compute a 2-character hash of a single line via xxHash32 mod 647 over
88
- * {@link HL_BIGRAMS}. The hash depends only on the line's content (after
89
- * stripping CR and trailing whitespace); the `idx` parameter is accepted
90
- * for call-site symmetry with line numbers but is intentionally unused so
91
- * that anchors remain stable across line shifts caused by sibling edits.
92
- *
93
- * The line input should not include a trailing newline.
94
- */
95
- export declare function computeLineHash(idx: number, line: string): string;
96
- /**
97
- * Formats an anchor reference given a line number and its text.
98
- * Returns `LINE+ID` (e.g., `42sr`) — no separator between
99
- * number and hash.
100
- */
101
- export declare function formatLineHash(line: number, lines: string): string;
102
- /**
103
- * Formats a single line with a hashline anchor.
104
- * Returns `LINE+ID|TEXT` (e.g., `42sr|function hi() {`, `3ab|}`).
105
- */
106
- export declare function formatHashLine(lineNumber: number, line: string): string;
107
- /**
108
- * Format file text with hashline prefixes for display.
109
- *
110
- * Each line becomes `LINE+ID|TEXT` where LINENUM is 1-indexed.
111
- * No padding on line numbers; pipe separator between anchor and content.
112
- *
113
- * @param text - Raw file text string
114
- * @param startLine - First line number (1-indexed, defaults to 1)
115
- * @returns Formatted string with one hashline-prefixed line per input line
116
- *
117
- * @example
118
- * ```
119
- * formatHashLines("function hi() {\n return;\n}")
120
- * // "1bm|function hi() {\n2er| return;\n3ab|}"
121
- * ```
64
+ * Compute the 4-hex-character hash carried by a hashline section header.
65
+ * The hash normalizes CR characters and trailing whitespace before hashing so
66
+ * platform line endings and display-trimmed lines do not invalidate anchors.
122
67
  */
123
- export declare function formatHashLines(text: string, startLine?: number): string;
68
+ export declare function computeFileHash(text: string): string;
69
+ /** Format a hashline section header for a file path and file hash. */
70
+ export declare function formatHashlineHeader(filePath: string, fileHash: string): string;
71
+ /** Formats a single numbered line as `LINE:TEXT`. */
72
+ export declare function formatNumberedLine(lineNumber: number, line: string): string;
73
+ /** Format file text with hashline-mode line-number prefixes for display. */
74
+ export declare function formatNumberedLines(text: string, startLine?: number): string;
@@ -4,10 +4,11 @@ export * from "./constants";
4
4
  export * from "./diff";
5
5
  export * from "./diff-preview";
6
6
  export * from "./execute";
7
+ export * from "./executor";
7
8
  export * from "./hash";
8
9
  export * from "./input";
9
- export * from "./parser";
10
10
  export * from "./prefixes";
11
11
  export * from "./recovery";
12
12
  export * from "./stream";
13
+ export * from "./tokenizer";
13
14
  export * from "./types";
@@ -1,11 +1,4 @@
1
- import type { SplitHashlineOptions } from "./types";
2
- export interface HashlineInputSection {
3
- path: string;
4
- diff: string;
5
- }
1
+ import type { HashlineInputSection, SplitHashlineOptions } from "./types";
6
2
  export declare function containsRecognizableHashlineOperations(input: string): boolean;
7
- export declare function splitHashlineInput(input: string, options?: SplitHashlineOptions): {
8
- path: string;
9
- diff: string;
10
- };
3
+ export declare function splitHashlineInput(input: string, options?: SplitHashlineOptions): HashlineInputSection;
11
4
  export declare function splitHashlineInputs(input: string, options?: SplitHashlineOptions): HashlineInputSection[];
@@ -4,6 +4,7 @@ export interface HashlineRecoveryArgs {
4
4
  cache: FileReadCache;
5
5
  absolutePath: string;
6
6
  currentText: string;
7
+ fileHash: string;
7
8
  edits: HashlineEdit[];
8
9
  options: HashlineApplyOptions;
9
10
  }
@@ -13,15 +14,8 @@ export interface HashlineRecoveryResult {
13
14
  warnings: string[];
14
15
  }
15
16
  /**
16
- * Attempt to recover from a `HashlineMismatchError` by replaying the edits
17
+ * Attempt to recover from a section file-hash mismatch by replaying the edits
17
18
  * against a cached pre-edit snapshot of the file and 3-way-merging the result
18
- * onto the current on-disk content. Returns `null` when no recovery is
19
- * possible — callers should propagate the original mismatch error in that
20
- * case.
21
- *
22
- * Recovery is gated on a strict precondition: every line the model anchored
23
- * MUST be present in the cached snapshot AND its content MUST hash to the
24
- * model-supplied hash. This prevents 3-way merges from silently sliding onto
25
- * the wrong site when only tangential parts of the file went stale.
19
+ * onto the current on-disk content. Returns `null` when no recovery is possible.
26
20
  */
27
21
  export declare function tryRecoverHashlineWithCache(args: HashlineRecoveryArgs): HashlineRecoveryResult | null;
@@ -0,0 +1,91 @@
1
+ import type { Anchor, HashlineCursor } from "./types";
2
+ /**
3
+ * Split a hashline diff into individual lines without losing the trailing
4
+ * empty line that callers may rely on for explicit blank payloads. CRLF pairs
5
+ * are normalized to a single line break.
6
+ *
7
+ * This mirrors the line-splitting performed by {@link HashlineTokenizer}'s
8
+ * streaming drain loop and is kept for non-streaming callers that prefer
9
+ * a single-shot split.
10
+ */
11
+ export declare function splitHashlineLines(text: string): string[];
12
+ export declare function cloneCursor(cursor: HashlineCursor): HashlineCursor;
13
+ /** Parse a bare line-number anchor (used by insert ops). Throws on malformed input. */
14
+ export declare function parseLid(raw: string, lineNum: number): Anchor;
15
+ export interface ParsedRange {
16
+ start: Anchor;
17
+ end: Anchor;
18
+ }
19
+ /**
20
+ * Returns true when the line scans as `LINE!payload` (delete sigil followed by
21
+ * additional content). The executor uses this for the dedicated "deletes only"
22
+ * diagnostic, separate from the standard "unrecognized op" path.
23
+ */
24
+ export declare function isDeleteOpWithPayload(line: string): boolean;
25
+ interface TokenBase {
26
+ /** 1-indexed line number in the original input stream. */
27
+ lineNum: number;
28
+ }
29
+ export type HashlineToken = (TokenBase & {
30
+ kind: "blank";
31
+ }) | (TokenBase & {
32
+ kind: "envelope-begin";
33
+ }) | (TokenBase & {
34
+ kind: "envelope-end";
35
+ }) | (TokenBase & {
36
+ kind: "abort";
37
+ }) | (TokenBase & {
38
+ kind: "header";
39
+ path: string;
40
+ fileHash?: string;
41
+ }) | (TokenBase & {
42
+ kind: "op-insert";
43
+ cursor: HashlineCursor;
44
+ inlineBody: string | undefined;
45
+ }) | (TokenBase & {
46
+ kind: "op-replace";
47
+ range: ParsedRange;
48
+ inlineBody: string | undefined;
49
+ }) | (TokenBase & {
50
+ kind: "op-delete";
51
+ range: ParsedRange;
52
+ trailingPayload: boolean;
53
+ }) | (TokenBase & {
54
+ kind: "payload";
55
+ text: string;
56
+ });
57
+ /**
58
+ * Stateful, line-oriented classifier for hashline diff text. Use the streaming
59
+ * {@link feed}/{@link end} pair to ingest text in chunks (each completed line
60
+ * emits exactly one token; a trailing partial line stays buffered until the
61
+ * next chunk or {@link end}). Use the stateless {@link tokenize}/predicate
62
+ * methods for callers that already hold whole lines and only need
63
+ * classification without buffering.
64
+ */
65
+ export declare class HashlineTokenizer {
66
+ #private;
67
+ /**
68
+ * Ingest a chunk of input text. Each newline-terminated line in the
69
+ * combined buffer produces one token. A trailing partial line (no `\n`
70
+ * yet, possibly ending in a lone `\r`) stays buffered until the next
71
+ * `feed`/`end` call so CRLF pairs that straddle chunk boundaries are
72
+ * still normalized correctly.
73
+ */
74
+ feed(chunk: string): HashlineToken[];
75
+ /**
76
+ * Flush any buffered residual line (the last line of input when it lacks
77
+ * a trailing newline) and mark the tokenizer closed. Calling `end` a
78
+ * second time returns `[]`; reuse requires `reset`.
79
+ */
80
+ end(): HashlineToken[];
81
+ /** Discard any buffered text and reset the line counter to 1. */
82
+ reset(): void;
83
+ /** Convenience: feed an entire text and immediately flush. */
84
+ tokenizeAll(text: string): HashlineToken[];
85
+ /** Stateless one-shot classification. Does not touch the streaming buffer. */
86
+ tokenize(line: string, lineNum?: number): HashlineToken;
87
+ isOp(line: string): boolean;
88
+ isHeader(line: string): boolean;
89
+ isEnvelopeMarker(line: string): boolean;
90
+ }
91
+ export {};
@@ -2,15 +2,8 @@ import * as z from "zod/v4";
2
2
  import type { LspBatchRequest } from "../edit/renderer";
3
3
  import type { WritethroughCallback, WritethroughDeferredHandle } from "../lsp";
4
4
  import type { ToolSession } from "../tools";
5
- export interface HashMismatch {
6
- line: number;
7
- expected: string;
8
- actual: string;
9
- }
10
5
  export type Anchor = {
11
6
  line: number;
12
- hash: string;
13
- contentHint?: string;
14
7
  };
15
8
  export type HashlineCursor = {
16
9
  kind: "bof";
@@ -36,6 +29,11 @@ export type HashlineEdit = {
36
29
  index: number;
37
30
  oldAssertion?: string;
38
31
  };
32
+ export interface HashlineInputSection {
33
+ path: string;
34
+ fileHash?: string;
35
+ diff: string;
36
+ }
39
37
  /** `path` is accepted by the edit tool runtime; other extra keys are preserved. */
40
38
  export declare const hashlineEditParamsSchema: z.ZodObject<{
41
39
  input: z.ZodString;
@@ -119,10 +119,6 @@ export interface DashboardState {
119
119
  /** Currently selected extension for inspector */
120
120
  selected: Extension | null;
121
121
  }
122
- /**
123
- * @deprecated Use FocusRegion instead
124
- */
125
- export type FocusPane = "sidebar" | "main" | "inspector";
126
122
  /**
127
123
  * Callbacks from dashboard to parent.
128
124
  */
@@ -170,6 +170,7 @@ export interface InteractiveModeContext {
170
170
  }): void;
171
171
  renderInitialMessages(prebuiltContext?: SessionContext, options?: {
172
172
  preserveExistingChat?: boolean;
173
+ clearTerminalHistory?: boolean;
173
174
  }): void;
174
175
  getUserMessageText(message: Message): string;
175
176
  findLastAssistantMessage(): AssistantMessage | undefined;
@@ -5,6 +5,7 @@ import type { InteractiveModeContext } from "../../modes/types";
5
5
  import type { SessionContext } from "../../session/session-manager";
6
6
  interface RenderInitialMessagesOptions {
7
7
  preserveExistingChat?: boolean;
8
+ clearTerminalHistory?: boolean;
8
9
  }
9
10
  export declare class UiHelpers {
10
11
  #private;
@@ -105,6 +105,8 @@ export interface CreateAgentSessionOptions {
105
105
  agentRegistry?: AgentRegistry;
106
106
  /** Parent task ID prefix for nested artifact naming (e.g., "6-Extensions") */
107
107
  parentTaskPrefix?: string;
108
+ /** Inherited eval executor session id for subagents sharing parent eval state. */
109
+ parentEvalSessionId?: string;
108
110
  /** Session manager. Default: session stored under the configured agentDir sessions root */
109
111
  sessionManager?: SessionManager;
110
112
  /** Override local:// protocol options for subagent local:// sharing. Default: uses the session's own artifacts dir and session ID. */
@@ -34,7 +34,6 @@ import { type FileSlashCommand } from "../extensibility/slash-commands";
34
34
  import { GoalRuntime } from "../goals/runtime";
35
35
  import type { Goal, GoalModeState } from "../goals/state";
36
36
  import type { HindsightSessionState } from "../hindsight/state";
37
- import { type DiscoverableMCPSearchIndex, type DiscoverableMCPTool } from "../mcp/discoverable-tool-metadata";
38
37
  import type { PlanModeState } from "../plan-mode/state";
39
38
  import { type AgentRegistry } from "../registry/agent-registry";
40
39
  import { type SecretObfuscator } from "../secrets/obfuscator";
@@ -182,6 +181,8 @@ export interface AgentSessionConfig {
182
181
  ttsrManager?: TtsrManager;
183
182
  /** Secret obfuscator for deobfuscating streaming edit content */
184
183
  obfuscator?: SecretObfuscator;
184
+ /** Inherited eval executor session id from a parent agent. */
185
+ parentEvalSessionId?: string;
185
186
  /** Logical owner for retained Python kernels created by this session. */
186
187
  evalKernelOwnerId?: string;
187
188
  /**
@@ -375,12 +376,6 @@ export declare class AgentSession {
375
376
  */
376
377
  getAllToolNames(): string[];
377
378
  isMCPDiscoveryEnabled(): boolean;
378
- /** @deprecated Use {@link getDiscoverableTools} with `{ source: "mcp" }` instead.
379
- * Preserves the legacy `description`-bearing MCP shape for back-compat callers. */
380
- getDiscoverableMCPTools(): DiscoverableMCPTool[];
381
- /** @deprecated Use {@link getDiscoverableToolSearchIndex} instead.
382
- * Returns the legacy MCP search index whose documents expose `tool.description`. */
383
- getDiscoverableMCPSearchIndex(): DiscoverableMCPSearchIndex;
384
379
  getSelectedMCPToolNames(): string[];
385
380
  activateDiscoveredMCPTools(toolNames: string[]): Promise<string[]>;
386
381
  isToolDiscoveryEnabled(): boolean;
@@ -443,6 +438,7 @@ export declare class AgentSession {
443
438
  get sessionFile(): string | undefined;
444
439
  /** Current session ID */
445
440
  get sessionId(): string;
441
+ getEvalSessionId(): string | null;
446
442
  /** Current session display name, if set */
447
443
  get sessionName(): string | undefined;
448
444
  /** Scoped models for cycling (from --models flag) */
@@ -518,11 +514,11 @@ export declare class AgentSession {
518
514
  deliverAs?: "steer" | "followUp" | "nextTurn";
519
515
  }): Promise<void>;
520
516
  /**
521
- * Send a user message to the agent. Always triggers a turn.
522
- * When the agent is streaming, use deliverAs to specify how to queue the message.
517
+ * Send a user message to the agent.
518
+ * When deliverAs is set, queue the message instead of starting a new turn.
523
519
  *
524
520
  * @param content User message content (string or content array)
525
- * @param options.deliverAs Delivery mode when streaming: "steer" or "followUp"
521
+ * @param options.deliverAs Delivery mode: "steer" or "followUp"
526
522
  */
527
523
  sendUserMessage(content: string | (TextContent | ImageContent)[], options?: {
528
524
  deliverAs?: "steer" | "followUp";
@@ -783,11 +779,11 @@ export declare class AgentSession {
783
779
  * Generate an ephemeral reply to a background message (e.g. an IRC ping from
784
780
  * another agent) using this session's current model + system prompt + history.
785
781
  *
786
- * The reply is computed via a side-channel `streamSimple` call (analogous to
787
- * `/btw`) so it never blocks on the recipient's in-flight tool calls. After
788
- * the reply is generated, both the incoming question and the auto-reply are
789
- * queued for injection into the recipient's persisted history so the model
790
- * sees the exchange on its next turn. Injection happens immediately when the
782
+ * The incoming message is queued for injection into the recipient's persisted
783
+ * history immediately so timeouts/abort still preserve delivery. The reply is
784
+ * computed via a side-channel `streamSimple` call (analogous to `/btw`) so it
785
+ * never blocks on the recipient's in-flight tool calls. When a reply is
786
+ * generated, it is queued separately. Injection happens immediately when the
791
787
  * session is idle, otherwise it is deferred until streaming ends.
792
788
  */
793
789
  respondAsBackground(args: {
@@ -1,4 +1,4 @@
1
- import { type AuthCredential, type StoredAuthCredential } from "@oh-my-pi/pi-ai";
1
+ import { type AuthCredential, type AuthCredentialStore, type StoredAuthCredential } from "@oh-my-pi/pi-ai";
2
2
  import type { RawSettings as Settings } from "../config/settings";
3
3
  /**
4
4
  * Unified SQLite storage for agent settings, model usage, and auth credentials.
@@ -16,18 +16,12 @@ export declare class AgentStorage {
16
16
  */
17
17
  static open(dbPath?: string): Promise<AgentStorage>;
18
18
  /**
19
- * Retrieves all settings from storage (legacy, for migration only).
20
- * Settings are now stored in config.yml. This method is only used
21
- * during migration from agent.db to config.yml.
19
+ * Reads legacy settings persisted in the agent.db `settings` table.
20
+ * The canonical settings store is `config.yml`; this accessor only
21
+ * exists so the config loader can migrate values from older installs.
22
22
  * @returns Settings object, or null if no settings are stored
23
- * @deprecated Use config.yml instead. This is only for migration.
24
23
  */
25
24
  getSettings(): Settings | null;
26
- /**
27
- * @deprecated Settings are now stored in config.yml, not agent.db.
28
- * This method is kept for backward compatibility but does nothing.
29
- */
30
- saveSettings(settings: Settings): void;
31
25
  /**
32
26
  * Records model usage, updating the last-used timestamp.
33
27
  * @param modelKey - Model key in "provider/modelId" format
@@ -44,6 +38,13 @@ export declare class AgentStorage {
44
38
  * @returns True if at least one credential is stored
45
39
  */
46
40
  hasAuthCredentials(): boolean;
41
+ /**
42
+ * Returns the underlying {@link AuthCredentialStore} so callers that need
43
+ * the lower-level pi-ai abstraction (e.g. `findAnthropicAuth(store)`) can
44
+ * reuse this storage's open database connection instead of opening their
45
+ * own.
46
+ */
47
+ get authStore(): AuthCredentialStore;
47
48
  /**
48
49
  * Lists auth credentials, optionally filtered by provider.
49
50
  * Only returns active (non-disabled) credentials by default.
@@ -1,6 +1,6 @@
1
1
  import type { AvailableCommand } from "@agentclientprotocol/sdk";
2
- import type { AcpBuiltinCommandRuntime, AcpBuiltinSlashCommandResult } from "./types";
3
- export type { AcpBuiltinCommandRuntime, AcpBuiltinSlashCommandResult } from "./types";
2
+ import type { AcpBuiltinSlashCommandResult, SlashCommandRuntime } from "./types";
3
+ export type { AcpBuiltinSlashCommandResult } from "./types";
4
4
  /**
5
5
  * Commands advertised to ACP clients. Entries without a text-mode `handle`
6
6
  * (e.g. `/quit`, `/login`, dashboards) are filtered out so the client doesn't
@@ -15,4 +15,4 @@ export declare const ACP_BUILTIN_SLASH_COMMANDS: AvailableCommand[];
15
15
  * - `{ prompt }` when the command was handled but a residual prompt should be
16
16
  * sent to the model.
17
17
  */
18
- export declare function executeAcpBuiltinSlashCommand(text: string, runtime: AcpBuiltinCommandRuntime): Promise<AcpBuiltinSlashCommandResult>;
18
+ export declare function executeAcpBuiltinSlashCommand(text: string, runtime: SlashCommandRuntime): Promise<AcpBuiltinSlashCommandResult>;
@@ -106,11 +106,6 @@ export interface SlashCommandSpec extends BuiltinSlashCommand {
106
106
  */
107
107
  handleTui?: (command: ParsedSlashCommand, runtime: TuiSlashCommandRuntime) => Promise<SlashCommandResult> | SlashCommandResult;
108
108
  }
109
- /**
110
- * @deprecated Use `SlashCommandRuntime` directly. Retained as an alias so
111
- * downstream code that imported the ACP-specific name keeps compiling.
112
- */
113
- export type AcpBuiltinCommandRuntime = SlashCommandRuntime;
114
109
  /** Result returned by `executeAcpBuiltinSlashCommand`. */
115
110
  export type AcpBuiltinSlashCommandResult = false | {
116
111
  consumed: true;
@@ -64,6 +64,8 @@ export interface ExecutorOptions {
64
64
  */
65
65
  parentArtifactManager?: ArtifactManager;
66
66
  parentHindsightSessionState?: HindsightSessionState;
67
+ /** Parent agent's eval executor session id. Subagents reuse it so eval state is shared. */
68
+ parentEvalSessionId?: string;
67
69
  /**
68
70
  * Parent agent's OpenTelemetry configuration. When defined, the subagent's
69
71
  * loop is started with the same tracer/hooks but its own agent identity
@@ -34,39 +34,6 @@ export interface DiscoverableToolSearchResult {
34
34
  tool: DiscoverableTool;
35
35
  score: number;
36
36
  }
37
- /** @deprecated Use DiscoverableTool with source === "mcp" */
38
- export type DiscoverableMCPTool = Pick<DiscoverableTool, "name" | "label" | "schemaKeys" | "serverName" | "mcpToolName"> & {
39
- description: string;
40
- };
41
- /** @deprecated Use DiscoverableToolServerSummary */
42
- export type DiscoverableMCPToolServerSummary = DiscoverableToolServerSummary;
43
- /** @deprecated Use DiscoverableToolSummary */
44
- export type DiscoverableMCPToolSummary = DiscoverableToolSummary;
45
- /** Tool object stored on legacy MCP index documents. Carries both legacy `description` and the
46
- * generic `summary`/`source` so the legacy index is structurally assignable to
47
- * DiscoverableToolSearchIndex (search functions read termFrequencies, not the tool fields). */
48
- export type DiscoverableMCPSearchTool = DiscoverableTool & {
49
- description: string;
50
- };
51
- /** @deprecated Use DiscoverableToolSearchDocument */
52
- export interface DiscoverableMCPSearchDocument {
53
- tool: DiscoverableMCPSearchTool;
54
- termFrequencies: Map<string, number>;
55
- length: number;
56
- }
57
- /** @deprecated Use DiscoverableToolSearchIndex.
58
- * Documents on this index expose `tool.description` (legacy MCP shape) while still being
59
- * searchable via `searchDiscoverableTools`. */
60
- export interface DiscoverableMCPSearchIndex {
61
- documents: DiscoverableMCPSearchDocument[];
62
- averageLength: number;
63
- documentFrequencies: Map<string, number>;
64
- }
65
- /** @deprecated Use DiscoverableToolSearchResult */
66
- export interface DiscoverableMCPSearchResult {
67
- tool: DiscoverableMCPSearchTool;
68
- score: number;
69
- }
70
37
  export declare function isMCPToolName(name: string): boolean;
71
38
  /**
72
39
  * Convert a raw AgentTool into a DiscoverableTool generic descriptor.
@@ -88,20 +55,3 @@ export declare function selectDiscoverableToolNamesByServer(tools: Iterable<Disc
88
55
  export declare function summarizeDiscoverableTools(tools: DiscoverableTool[]): DiscoverableToolSummary;
89
56
  export declare function buildDiscoverableToolSearchIndex(tools: Iterable<DiscoverableTool>): DiscoverableToolSearchIndex;
90
57
  export declare function searchDiscoverableTools(index: DiscoverableToolSearchIndex, query: string, limit: number): DiscoverableToolSearchResult[];
91
- /** @deprecated Use getDiscoverableTool */
92
- export declare function getDiscoverableMCPTool(tool: AgentTool): DiscoverableMCPTool | null;
93
- /** @deprecated Use collectDiscoverableTools with source filter */
94
- export declare function collectDiscoverableMCPTools(tools: Iterable<AgentTool>): DiscoverableMCPTool[];
95
- /** @deprecated Use selectDiscoverableToolNamesByServer */
96
- export declare function selectDiscoverableMCPToolNamesByServer(tools: Iterable<DiscoverableMCPTool>, serverNames: ReadonlySet<string>): string[];
97
- /** @deprecated Use summarizeDiscoverableTools */
98
- export declare function summarizeDiscoverableMCPTools(tools: DiscoverableMCPTool[]): DiscoverableMCPToolSummary;
99
- /** @deprecated Use buildDiscoverableToolSearchIndex.
100
- * Builds an index whose documents preserve the legacy `description` field on each tool while
101
- * also carrying the generic `summary` (set from `description`) so the index remains usable
102
- * with `searchDiscoverableTools`. */
103
- export declare function buildDiscoverableMCPSearchIndex(tools: Iterable<DiscoverableMCPTool>): DiscoverableMCPSearchIndex;
104
- /** @deprecated Use searchDiscoverableTools */
105
- export declare function searchDiscoverableMCPTools(index: DiscoverableMCPSearchIndex | DiscoverableToolSearchIndex, query: string, limit: number): DiscoverableMCPSearchResult[];
106
- /** @deprecated Use formatDiscoverableToolServerSummary */
107
- export declare const formatDiscoverableMCPToolServerSummary: typeof formatDiscoverableToolServerSummary;
@@ -53,7 +53,6 @@ export * from "./search";
53
53
  export * from "./search-tool-bm25";
54
54
  export * from "./ssh";
55
55
  export * from "./todo-write";
56
- export * from "./vim";
57
56
  export * from "./write";
58
57
  export * from "./yield";
59
58
  /** Tool type (AgentTool from pi-ai) */
@@ -63,7 +62,6 @@ export type ContextFileEntry = {
63
62
  content: string;
64
63
  depth?: number;
65
64
  };
66
- export type { DiscoverableMCPTool } from "../mcp/discoverable-tool-metadata";
67
65
  export type { DiscoverableTool, DiscoverableToolSearchIndex, DiscoverableToolSearchResult, DiscoverableToolSource, } from "../tool-discovery/tool-index";
68
66
  /** Session context for tool factories */
69
67
  export interface ToolSession {
@@ -93,6 +91,8 @@ export interface ToolSession {
93
91
  requireYieldTool?: boolean;
94
92
  /** Task recursion depth (0 = top-level, 1 = first child, etc.) */
95
93
  taskDepth?: number;
94
+ /** Get shared eval executor session ID. Subagents inherit this to share JS/Python state. */
95
+ getEvalSessionId?: () => string | null;
96
96
  /** Get session file */
97
97
  getSessionFile: () => string | null;
98
98
  /** Get eval kernel owner ID for session-scoped retained-kernel cleanup. */
@@ -150,12 +150,6 @@ export interface ToolSession {
150
150
  setTodoPhases?: (phases: TodoPhase[]) => void;
151
151
  /** Whether MCP tool discovery is active for this session. */
152
152
  isMCPDiscoveryEnabled?: () => boolean;
153
- /** Get hidden-but-discoverable MCP tools for search_tool_bm25 prompts and fallbacks.
154
- * @deprecated Use getDiscoverableTools with source filter instead. */
155
- getDiscoverableMCPTools?: () => import("../mcp/discoverable-tool-metadata").DiscoverableMCPTool[];
156
- /** Get the cached discoverable MCP search index for search_tool_bm25 execution.
157
- * @deprecated Use getDiscoverableToolSearchIndex instead. */
158
- getDiscoverableMCPSearchIndex?: () => import("../tool-discovery/tool-index").DiscoverableMCPSearchIndex;
159
153
  /** Get MCP tools activated by prior search_tool_bm25 calls. */
160
154
  getSelectedMCPToolNames?: () => string[];
161
155
  /** Merge MCP tool selections into the active session tool set. */
@@ -1,10 +1,10 @@
1
1
  /**
2
2
  * Format a single line of match output for grep/ast-grep style results.
3
3
  *
4
- * The anchor/content separator is always `|`. Matched lines are prefixed
5
- * with `*`; context lines are prefixed with a single space so anchors
6
- * align in column. In hashline mode the anchor is `LINE+ID` (no `#`); in
7
- * plain mode it is just the line number. Line numbers are never padded.
4
+ * Matched lines are prefixed with `*`; context lines are prefixed with a single
5
+ * space so line numbers align in column. In hashline mode the line uses the
6
+ * editable `LINE:content` shape under a file-hash header; in plain mode it keeps
7
+ * the legacy `LINE|content` display-only shape. Line numbers are never padded.
8
8
  */
9
9
  export declare function formatMatchLine(lineNumber: number, line: string, isMatch: boolean, options: {
10
10
  useHashLines: boolean;