@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.
- package/CHANGELOG.md +79 -0
- package/package.json +8 -8
- package/src/async/job-manager.ts +43 -10
- package/src/commit/agentic/tools/analyze-file.ts +1 -2
- package/src/config/mcp-schema.json +1 -1
- package/src/config/model-equivalence.ts +1 -0
- package/src/config/model-registry.ts +63 -34
- package/src/config/model-resolver.ts +111 -15
- package/src/config/settings-schema.ts +4 -3
- package/src/config/settings.ts +1 -1
- package/src/cursor.ts +64 -23
- package/src/edit/index.ts +254 -89
- package/src/edit/modes/chunk.ts +336 -57
- package/src/edit/modes/hashline.ts +51 -26
- package/src/edit/modes/patch.ts +16 -10
- package/src/edit/modes/replace.ts +15 -7
- package/src/edit/renderer.ts +248 -94
- package/src/export/html/template.generated.ts +1 -1
- package/src/export/html/template.js +6 -4
- package/src/extensibility/custom-tools/types.ts +0 -3
- package/src/extensibility/extensions/loader.ts +16 -0
- package/src/extensibility/extensions/runner.ts +2 -7
- package/src/extensibility/extensions/types.ts +8 -4
- package/src/internal-urls/docs-index.generated.ts +3 -3
- package/src/ipy/executor.ts +447 -52
- package/src/ipy/kernel.ts +39 -13
- package/src/lsp/client.ts +54 -0
- package/src/lsp/index.ts +8 -0
- package/src/lsp/types.ts +6 -0
- package/src/main.ts +0 -1
- package/src/modes/acp/acp-agent.ts +4 -1
- package/src/modes/components/bash-execution.ts +16 -4
- package/src/modes/components/status-line/presets.ts +17 -6
- package/src/modes/components/status-line/segments.ts +15 -0
- package/src/modes/components/status-line-segment-editor.ts +1 -0
- package/src/modes/components/status-line.ts +7 -1
- package/src/modes/components/tool-execution.ts +145 -75
- package/src/modes/controllers/command-controller.ts +24 -1
- package/src/modes/controllers/event-controller.ts +4 -1
- package/src/modes/controllers/extension-ui-controller.ts +28 -5
- package/src/modes/controllers/input-controller.ts +9 -3
- package/src/modes/controllers/selector-controller.ts +4 -1
- package/src/modes/interactive-mode.ts +19 -3
- package/src/modes/print-mode.ts +13 -4
- package/src/modes/prompt-action-autocomplete.ts +3 -5
- package/src/modes/rpc/rpc-mode.ts +8 -2
- package/src/modes/shared.ts +2 -2
- package/src/modes/types.ts +1 -0
- package/src/modes/utils/ui-helpers.ts +1 -0
- package/src/prompts/tools/bash.md +2 -2
- package/src/prompts/tools/chunk-edit.md +191 -163
- package/src/prompts/tools/hashline.md +11 -11
- package/src/prompts/tools/patch.md +10 -5
- package/src/prompts/tools/{await.md → poll.md} +1 -1
- package/src/prompts/tools/read-chunk.md +3 -3
- package/src/prompts/tools/task.md +2 -2
- package/src/prompts/tools/vim.md +98 -0
- package/src/sdk.ts +754 -724
- package/src/session/agent-session.ts +164 -34
- package/src/session/session-manager.ts +50 -4
- package/src/slash-commands/builtin-registry.ts +17 -0
- package/src/task/executor.ts +4 -4
- package/src/task/index.ts +3 -5
- package/src/task/types.ts +2 -2
- package/src/tools/bash.ts +26 -8
- package/src/tools/find.ts +5 -2
- package/src/tools/grep.ts +77 -8
- package/src/tools/index.ts +48 -19
- package/src/tools/{await-tool.ts → poll-tool.ts} +36 -30
- package/src/tools/python.ts +293 -278
- package/src/tools/submit-result.ts +5 -2
- package/src/tools/todo-write.ts +8 -2
- package/src/tools/vim.ts +966 -0
- package/src/utils/edit-mode.ts +2 -1
- package/src/utils/session-color.ts +55 -0
- package/src/utils/title-generator.ts +15 -6
- package/src/vim/buffer.ts +309 -0
- package/src/vim/commands.ts +382 -0
- package/src/vim/engine.ts +2426 -0
- package/src/vim/parser.ts +151 -0
- package/src/vim/render.ts +252 -0
- 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 $`
|