@oh-my-pi/pi-coding-agent 14.1.0 → 14.1.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 (82) hide show
  1. package/CHANGELOG.md +79 -0
  2. package/package.json +8 -8
  3. package/src/async/job-manager.ts +43 -10
  4. package/src/commit/agentic/tools/analyze-file.ts +1 -2
  5. package/src/config/mcp-schema.json +1 -1
  6. package/src/config/model-equivalence.ts +1 -0
  7. package/src/config/model-registry.ts +63 -34
  8. package/src/config/model-resolver.ts +111 -15
  9. package/src/config/settings-schema.ts +4 -3
  10. package/src/config/settings.ts +1 -1
  11. package/src/cursor.ts +64 -23
  12. package/src/edit/index.ts +254 -89
  13. package/src/edit/modes/chunk.ts +336 -57
  14. package/src/edit/modes/hashline.ts +51 -26
  15. package/src/edit/modes/patch.ts +16 -10
  16. package/src/edit/modes/replace.ts +15 -7
  17. package/src/edit/renderer.ts +248 -94
  18. package/src/export/html/template.generated.ts +1 -1
  19. package/src/export/html/template.js +6 -4
  20. package/src/extensibility/custom-tools/types.ts +0 -3
  21. package/src/extensibility/extensions/loader.ts +16 -0
  22. package/src/extensibility/extensions/runner.ts +2 -7
  23. package/src/extensibility/extensions/types.ts +8 -4
  24. package/src/internal-urls/docs-index.generated.ts +3 -3
  25. package/src/ipy/executor.ts +447 -52
  26. package/src/ipy/kernel.ts +39 -13
  27. package/src/lsp/client.ts +54 -0
  28. package/src/lsp/index.ts +8 -0
  29. package/src/lsp/types.ts +6 -0
  30. package/src/main.ts +0 -1
  31. package/src/modes/acp/acp-agent.ts +4 -1
  32. package/src/modes/components/bash-execution.ts +16 -4
  33. package/src/modes/components/status-line/presets.ts +17 -6
  34. package/src/modes/components/status-line/segments.ts +15 -0
  35. package/src/modes/components/status-line-segment-editor.ts +1 -0
  36. package/src/modes/components/status-line.ts +7 -1
  37. package/src/modes/components/tool-execution.ts +145 -75
  38. package/src/modes/controllers/command-controller.ts +24 -1
  39. package/src/modes/controllers/event-controller.ts +4 -1
  40. package/src/modes/controllers/extension-ui-controller.ts +28 -5
  41. package/src/modes/controllers/input-controller.ts +9 -3
  42. package/src/modes/controllers/selector-controller.ts +4 -1
  43. package/src/modes/interactive-mode.ts +19 -3
  44. package/src/modes/print-mode.ts +13 -4
  45. package/src/modes/prompt-action-autocomplete.ts +3 -5
  46. package/src/modes/rpc/rpc-mode.ts +8 -2
  47. package/src/modes/shared.ts +2 -2
  48. package/src/modes/types.ts +1 -0
  49. package/src/modes/utils/ui-helpers.ts +1 -0
  50. package/src/prompts/tools/bash.md +2 -2
  51. package/src/prompts/tools/chunk-edit.md +191 -163
  52. package/src/prompts/tools/hashline.md +11 -11
  53. package/src/prompts/tools/patch.md +10 -5
  54. package/src/prompts/tools/{await.md → poll.md} +1 -1
  55. package/src/prompts/tools/read-chunk.md +3 -3
  56. package/src/prompts/tools/task.md +2 -2
  57. package/src/prompts/tools/vim.md +98 -0
  58. package/src/sdk.ts +754 -724
  59. package/src/session/agent-session.ts +164 -34
  60. package/src/session/session-manager.ts +50 -4
  61. package/src/slash-commands/builtin-registry.ts +17 -0
  62. package/src/task/executor.ts +4 -4
  63. package/src/task/index.ts +3 -5
  64. package/src/task/types.ts +2 -2
  65. package/src/tools/bash.ts +26 -8
  66. package/src/tools/find.ts +5 -2
  67. package/src/tools/grep.ts +77 -8
  68. package/src/tools/index.ts +48 -19
  69. package/src/tools/{await-tool.ts → poll-tool.ts} +36 -30
  70. package/src/tools/python.ts +293 -278
  71. package/src/tools/submit-result.ts +5 -2
  72. package/src/tools/todo-write.ts +8 -2
  73. package/src/tools/vim.ts +966 -0
  74. package/src/utils/edit-mode.ts +2 -1
  75. package/src/utils/session-color.ts +55 -0
  76. package/src/utils/title-generator.ts +15 -6
  77. package/src/vim/buffer.ts +309 -0
  78. package/src/vim/commands.ts +382 -0
  79. package/src/vim/engine.ts +2426 -0
  80. package/src/vim/parser.ts +151 -0
  81. package/src/vim/render.ts +252 -0
  82. package/src/vim/types.ts +197 -0
@@ -0,0 +1,98 @@
1
+ Vim-style `edit` mode. The tool name stays `edit`; every call requires `file`, and the buffer loads automatically on first use.
2
+ - `{"file": "path"}` - view file
3
+ - `{"file": "path", "steps": [{"kbd": ["…"], "insert": "…"}]}` - edit file
4
+
5
+ **Multi-location edits: always edit highest line number first (bottom-up).** Each insert shifts lines below it.
6
+
7
+ ## steps vs kbd vs insert
8
+
9
+ `steps` = ordered editing steps. Each step runs `kbd`, then optionally types `insert`.
10
+ `kbd` = Vim commands only (`dd`, `G`, `o`, `cc`, `gg`, etc.).
11
+ `insert` = raw text content to type into the buffer.
12
+ `o`/`O` already create a new line — do not start `insert` with `\n`. A trailing `\n` in `insert` adds an extra blank line.
13
+
14
+ Never put text content in `kbd`. Only Vim keystrokes go there.
15
+ - BAD: `{"steps": [{"kbd": ["1Gohello world<Esc>"]}]}`
16
+ - BAD: `{"steps": [{"kbd": ["1Go", "hello world"]}]}`
17
+ - BAD: `{"steps": [{"kbd": ["1Ao"], "insert": "text"}]}`
18
+ - GOOD: `{"steps": [{"kbd": ["1Go"], "insert": "hello world"}]}`
19
+
20
+ If a step uses `insert`, the last `kbd` entry in that step must leave INSERT mode active (`o`, `O`, `i`, `a`, `A`, `cc`, `C`, `s`, `S`).
21
+
22
+ Each non-final `kbd` entry inside a step must end in NORMAL mode (add `<Esc>`).
23
+
24
+ Between steps, the tool auto-exits INSERT mode.
25
+
26
+ Whitespace in `kbd` is literal. Do not use spaces as separators between keys; `ggdGi` is one sequence, not `ggdG i`.
27
+
28
+ Common mistake: `Ni` means "insert N copies", NOT "insert at line N". To insert at line N, use `NGo` (below) or `NGO` (above).
29
+ ## Editing patterns
30
+
31
+ `NGo` = new line BELOW line N. `NGO` = new line ABOVE line N.
32
+
33
+ Insert new line after line 3:
34
+ ```json
35
+ {"file": "f.py", "steps": [{"kbd": ["3Go"], "insert": " new line here"}]}
36
+ ```
37
+
38
+ Insert new line before line 3:
39
+ ```json
40
+ {"file": "f.py", "steps": [{"kbd": ["3GO"], "insert": " new line here"}]}
41
+ ```
42
+
43
+ Replace line N:
44
+ ```json
45
+ {"file": "f.py", "steps": [{"kbd": ["5Gcc"], "insert": " replacement content"}]}
46
+ ```
47
+
48
+ Replace entire file. `ggdGi` = go to top, delete all, enter INSERT. Use that exact sequence when rewriting the whole file:
49
+ ```json
50
+ {"file": "f.py", "steps": [{"kbd": ["ggdGi"], "insert": "entire new file content"}]}
51
+ ```
52
+
53
+ Multi-location edit — edit **highest line number first** (bottom-up) so inserts don't shift later targets:
54
+ ```json
55
+ {"file": "f.py", "steps": [
56
+ {"kbd": ["8Go"], "insert": " print(result)"},
57
+ {"kbd": ["3Go"], "insert": "def helper(x):\n return x + 1"}
58
+ ]}
59
+ ```
60
+ Each `o`/`O` insert adds lines, shifting everything below. Bottom-up order keeps all line numbers valid. Use `\n` within `insert` for multi-line content.
61
+
62
+ Navigation or search step without insert:
63
+ ```json
64
+ {"file": "f.py", "steps": [{"kbd": ["/pattern<CR>"]}]}
65
+ ```
66
+
67
+ Find and replace:
68
+ ```json
69
+ {"file": "f.py", "steps": [{"kbd": [":%s/old/new/g<CR>"]}]}
70
+ ```
71
+
72
+ Delete line range:
73
+ ```json
74
+ {"file": "f.py", "steps": [{"kbd": [":3,5d<CR>"]}]}
75
+ ```
76
+ Ex commands always start with `:` and end with `<CR>`. `3,5d` without `:` is NOT an ex command — it is interpreted as normal-mode keystrokes and will fail.
77
+
78
+ ## Undo mistakes
79
+ - `{"file": "f.py", "steps": [{"kbd": ["u"]}]}` - undo last change
80
+ - `{"file": "f.py", "steps": [{"kbd": ["3u"]}]}` - undo last 3 changes
81
+
82
+ `:e!` reloads from disk. Warning: because non-paused calls auto-save, `:e!` reloads your last saved state, not the original file. Use `u` to undo instead. If stuck, use `ggdGi` with the full desired file content.
83
+
84
+ ## Session persistence
85
+
86
+ The edit buffer in vim mode persists across tool calls. Cursor position, undo history, and file state are maintained until you close the buffer. Auto-save happens once after all steps in a non-paused call complete.
87
+
88
+ ## Supported
89
+
90
+ Keys: `<Esc>` `<CR>` `<BS>` `<Tab>` `<C-d>` `<C-u>` `<C-r>` `<C-w>` `<C-o>`
91
+ Motions: `h j k l <Space> w b e 0 $ ^ + - _ gg G { } f F t T % H M L ; ,` with counts
92
+ Operators: `d c y p` with motions and text objects (`iw aw ip ap i" a" i( a( i{ a{`)
93
+ Insert: `i a o O I A cc C s S R` - these all enter INSERT mode; do not add another `i` after them
94
+ Visual: `v V` with `d y c > < ~ r u U p P o J`
95
+ Other: `.` repeat, `u`/`<C-r>` undo/redo, `/pattern<CR>` search, `n N * #`, `gv` `gJ` `gU` `gu` `ZZ` `ZQ`
96
+ Ex: `:w` `:q` `:wq` `:e` `:e!` `:N` `:s///` `:%s///` `:N,Md` `:%d` `:N,Mt N` `:sort` `:j` `:j!` `:g/pattern/d` `:v/pattern/d`
97
+ Addresses: absolute line numbers, `.`, `$`, and `+N`/`-N` relative offsets, including ranges like `:.,$d` and `:.+2,$g/pattern/d`
98
+ More ex: `:up` `:N,My` `:put` `:put!` `:N,Mco $` `:N,Mm $`