@oh-my-pi/pi-coding-agent 14.5.14 → 14.6.1
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 +49 -0
- package/package.json +7 -7
- package/src/autoresearch/command-resume.md +5 -8
- package/src/autoresearch/git.ts +41 -51
- package/src/autoresearch/helpers.ts +43 -359
- package/src/autoresearch/index.ts +281 -273
- package/src/autoresearch/prompt-setup.md +43 -0
- package/src/autoresearch/prompt.md +52 -193
- package/src/autoresearch/resume-message.md +2 -8
- package/src/autoresearch/state.ts +59 -166
- package/src/autoresearch/storage.ts +687 -0
- package/src/autoresearch/tools/init-experiment.ts +201 -290
- package/src/autoresearch/tools/log-experiment.ts +304 -517
- package/src/autoresearch/tools/run-experiment.ts +117 -296
- package/src/autoresearch/tools/update-notes.ts +116 -0
- package/src/autoresearch/types.ts +16 -66
- package/src/cli/list-models.ts +66 -0
- package/src/config/settings-schema.ts +1 -1
- package/src/config/settings.ts +20 -1
- package/src/cursor.ts +1 -1
- package/src/edit/index.ts +9 -31
- package/src/edit/line-hash.ts +70 -43
- package/src/edit/modes/hashline.lark +26 -0
- package/src/edit/modes/hashline.ts +898 -1099
- package/src/edit/modes/patch.ts +0 -7
- package/src/edit/modes/replace.ts +0 -4
- package/src/edit/renderer.ts +22 -20
- package/src/edit/streaming.ts +8 -28
- package/src/eval/eval.lark +24 -30
- package/src/eval/js/context-manager.ts +5 -162
- package/src/eval/js/prelude.txt +0 -12
- package/src/eval/parse.ts +129 -129
- package/src/eval/py/prelude.py +1 -219
- package/src/export/html/template.generated.ts +1 -1
- package/src/export/html/template.js +2 -2
- package/src/internal-urls/docs-index.generated.ts +2 -2
- package/src/main.ts +18 -3
- package/src/modes/components/session-observer-overlay.ts +5 -2
- package/src/modes/components/status-line/segments.ts +1 -1
- package/src/modes/components/status-line.ts +3 -5
- package/src/modes/components/tree-selector.ts +4 -5
- package/src/modes/components/welcome.ts +11 -1
- package/src/modes/controllers/command-controller.ts +2 -6
- package/src/modes/controllers/event-controller.ts +7 -5
- package/src/modes/controllers/extension-ui-controller.ts +3 -15
- package/src/modes/controllers/input-controller.ts +0 -1
- package/src/modes/controllers/selector-controller.ts +1 -1
- package/src/modes/interactive-mode.ts +5 -7
- package/src/prompts/system/system-prompt.md +14 -38
- package/src/prompts/tools/ast-edit.md +8 -8
- package/src/prompts/tools/ast-grep.md +10 -10
- package/src/prompts/tools/eval.md +13 -31
- package/src/prompts/tools/find.md +2 -1
- package/src/prompts/tools/hashline.md +66 -57
- package/src/prompts/tools/search.md +2 -2
- package/src/session/agent-session.ts +1 -1
- package/src/session/session-manager.ts +17 -13
- package/src/tools/ast-edit.ts +141 -44
- package/src/tools/ast-grep.ts +112 -36
- package/src/tools/eval.ts +2 -53
- package/src/tools/find.ts +16 -15
- package/src/tools/gh-renderer.ts +184 -59
- package/src/tools/path-utils.ts +36 -196
- package/src/tools/search.ts +56 -35
- package/src/utils/edit-mode.ts +2 -11
- package/src/utils/file-display-mode.ts +1 -1
- package/src/utils/git.ts +59 -24
- package/src/utils/session-color.ts +0 -12
- package/src/utils/title-generator.ts +22 -38
- package/src/autoresearch/apply-contract-to-state.ts +0 -24
- package/src/autoresearch/contract.ts +0 -288
- package/src/edit/modes/atom.lark +0 -29
- package/src/edit/modes/atom.ts +0 -1773
- package/src/prompts/tools/atom.md +0 -150
|
@@ -1,150 +0,0 @@
|
|
|
1
|
-
Your patch language is a compact, line-anchored edit format.
|
|
2
|
-
|
|
3
|
-
A patch contains one or more file sections. The first non-blank line of every section **MUST** be `---PATH`.
|
|
4
|
-
A "Lid" is a per-line anchor emitted by `read`, `grep`, etc. — `<lineNumber><2-letter-hash>`, e.g. `5th`, `123ab`. You **MUST** copy a Lid verbatim from the latest output for the file you're editing.
|
|
5
|
-
|
|
6
|
-
This format is purely textual. The tool has NO awareness of language, indentation, brackets, fences, or table widths. You are responsible for emitting valid syntax in your replacements/insertions.
|
|
7
|
-
|
|
8
|
-
<ops>
|
|
9
|
-
---PATH start a section editing PATH; cursor begins at EOF
|
|
10
|
-
^ move cursor to BOF (before line 1)
|
|
11
|
-
$ move cursor to EOF (after the last line)
|
|
12
|
-
@Lid move cursor to AFTER the anchored line (does not modify the file)
|
|
13
|
-
^Lid move cursor to BEFORE the anchored line (does not modify the file)
|
|
14
|
-
+TEXT insert one line containing TEXT at the cursor
|
|
15
|
-
+ insert one blank line at the cursor
|
|
16
|
-
Lid=TEXT replace the anchored line with TEXT
|
|
17
|
-
LidA..LidB=TEXT replace the range with one line; following `\TEXT` lines append literal lines to the replacement
|
|
18
|
-
\TEXT append literal TEXT to the active replacement (after `Lid=…` or `LidA..LidB=…`)
|
|
19
|
-
\ append a blank line to the active replacement
|
|
20
|
-
Lid= blank the anchored line's content but KEEP the line (results in an empty line, NOT a removed line; use `-Lid` to remove)
|
|
21
|
-
-Lid delete the anchored line (repeat for multi-line delete)
|
|
22
|
-
-LidA..LidB delete the contiguous line range LidA..LidB (inclusive)
|
|
23
|
-
!rm delete the section's PATH (**MUST** be the only op in the section)
|
|
24
|
-
!mv DEST rename the section's PATH to DEST (**MUST** be the only op in the section)
|
|
25
|
-
</ops>
|
|
26
|
-
|
|
27
|
-
<rules>
|
|
28
|
-
- Cursor-only ops (`^`, `$`, `@Lid`, `^Lid`) reposition without modifying. To insert anything you **MUST** follow them with `+TEXT` (or `+` for a blank).
|
|
29
|
-
- TEXT in `+TEXT`, `Lid=TEXT`, and `\TEXT` is literal line content, INCLUDING leading whitespace. You **MUST NOT** trim or re-indent it.
|
|
30
|
-
- Consecutive `+TEXT` ops produce consecutive lines in the order written. You **MUST NOT** separate them with a stray `+` unless you intend to insert a blank line.
|
|
31
|
-
- `Lid=TEXT` rewrites ONE line. To rewrite K adjacent lines, you **MUST** use `LidA..LidB=FIRST_LINE` followed immediately by `\NEXT_LINE` continuation lines (canonical form for any block replacement). You **MUST** use bare `\` for blank replacement lines.
|
|
32
|
-
- You **MUST** prefix every replacement continuation line with `\`, especially when the replacement line starts with edit syntax characters such as `#`, `+`, `-`, `@`, `$`, `^`, `!`, or a Lid-shaped token.
|
|
33
|
-
- `\TEXT` **MUST** appear only immediately after an active `Lid=…` or `LidA..LidB=…` replacement. It **MUST NOT** be used as a general insert operator.
|
|
34
|
-
- A `\TEXT` line **MUST** be the immediate continuation of a `Lid=…` or `LidA..LidB=…` op on the line above (or another `\` line rooted in one). If the line above is `+TEXT`, a bare Lid, a cursor op, or whitespace, the `\` is invalid and the tool will not interpret it as part of a replacement.
|
|
35
|
-
- The legacy `-LidA..LidB` + `+TEXT…` block-rewrite form also works.
|
|
36
|
-
- To insert ABOVE a line, you **MUST** use `^Lid` then `+TEXT`. To insert above line 1, you **MUST** use `^` (BOF) then `+TEXT`. To insert below a line, you **MUST** use `@Lid` then `+TEXT`.
|
|
37
|
-
- Multiple `---PATH` sections **MAY** appear in one input; each section is applied in order.
|
|
38
|
-
- `!rm` / `!mv DEST` **MUST NOT** be combined with line edits in the same section.
|
|
39
|
-
- Lids contain a content hash. If a line has changed since you read it, the tool rejects the edit and shows the current content; you **MUST** re-read and retry with fresh Lids.
|
|
40
|
-
- After `+TEXT` (or `+`) the cursor advances past the inserted line, so consecutive `+TEXT` ops stack in order. After `Lid=TEXT` the cursor sits on the modified anchor; after `-Lid` it sits on the slot the deleted line vacated. You **MUST** use a fresh `@Lid` / `^Lid` / `^` / `$` to reposition.
|
|
41
|
-
- The tool is syntax-blind: it will not check brackets, indentation, table column counts, or fence integrity. You **MUST** verify indentation-sensitive or structured files after editing (Python, Markdown tables/fences).
|
|
42
|
-
- A section whose PATH does not yet exist creates the file from your `+TEXT` lines (use `^` or `$` then `+TEXT…`). No separate "create file" op is needed.
|
|
43
|
-
</rules>
|
|
44
|
-
|
|
45
|
-
<case file="a.ts">
|
|
46
|
-
{{hline 1 "const DEF = \"guest\";"}}
|
|
47
|
-
{{hline 2 ""}}
|
|
48
|
-
{{hline 3 "export function label(name) {"}}
|
|
49
|
-
{{hline 4 "\tconst clean = name || DEF;"}}
|
|
50
|
-
{{hline 5 "\treturn clean.trim();"}}
|
|
51
|
-
{{hline 6 "}"}}
|
|
52
|
-
</case>
|
|
53
|
-
|
|
54
|
-
<examples>
|
|
55
|
-
# Replace one line (preserve the leading tab from the original)
|
|
56
|
-
---a.ts
|
|
57
|
-
{{hrefr 5}}= return clean.trim().toUpperCase();
|
|
58
|
-
|
|
59
|
-
# Rewrite multiple adjacent lines (delete each, then insert new content)
|
|
60
|
-
---a.ts
|
|
61
|
-
-{{hrefr 3}}
|
|
62
|
-
-{{hrefr 4}}
|
|
63
|
-
-{{hrefr 5}}
|
|
64
|
-
-{{hrefr 6}}
|
|
65
|
-
+export function label(name: string): string {
|
|
66
|
-
+ return (name || DEF).trim().toUpperCase();
|
|
67
|
-
+}
|
|
68
|
-
|
|
69
|
-
# Same rewrite using a range (equivalent to four `-Lid` lines)
|
|
70
|
-
---a.ts
|
|
71
|
-
-{{hrefr 3}}..{{hrefr 6}}
|
|
72
|
-
+export function label(name: string): string {
|
|
73
|
-
+ return (name || DEF).trim().toUpperCase();
|
|
74
|
-
+}
|
|
75
|
-
|
|
76
|
-
# Replace a contiguous range with one line (range-replace shorthand)
|
|
77
|
-
---a.ts
|
|
78
|
-
{{hrefr 3}}..{{hrefr 6}}=export const label = (name: string) => (name || DEF).trim().toUpperCase();
|
|
79
|
-
|
|
80
|
-
# Replace a contiguous range with multiple lines (continuation form)
|
|
81
|
-
---a.ts
|
|
82
|
-
{{hrefr 3}}..{{hrefr 6}}=export function label(name: string): string {
|
|
83
|
-
\ return (name || DEF).trim().toUpperCase();
|
|
84
|
-
\}
|
|
85
|
-
|
|
86
|
-
# Replace one contiguous block when the existing lines themselves change; the replacement may have more/fewer lines than the selected range
|
|
87
|
-
---a.ts
|
|
88
|
-
{{hrefr 3}}..{{hrefr 6}}=/** Format a display label, falling back to DEF when empty. */
|
|
89
|
-
\export function label(name: string): string {
|
|
90
|
-
\ const clean = (name || DEF).trim();
|
|
91
|
-
\
|
|
92
|
-
\ if (clean.length === 0) return DEF;
|
|
93
|
-
\ return clean.toUpperCase();
|
|
94
|
-
\}
|
|
95
|
-
|
|
96
|
-
# Insert ABOVE a line
|
|
97
|
-
---a.ts
|
|
98
|
-
^{{hrefr 5}}
|
|
99
|
-
+ const debug = false;
|
|
100
|
-
|
|
101
|
-
# Insert BELOW a line
|
|
102
|
-
---a.ts
|
|
103
|
-
@{{hrefr 4}}
|
|
104
|
-
+ const debug = false;
|
|
105
|
-
|
|
106
|
-
# Insert above the first line (use BOF)
|
|
107
|
-
---a.ts
|
|
108
|
-
^
|
|
109
|
-
+// Copyright (c) 2026
|
|
110
|
-
+
|
|
111
|
-
|
|
112
|
-
# Append at end of file
|
|
113
|
-
---a.ts
|
|
114
|
-
$
|
|
115
|
-
+export { DEF };
|
|
116
|
-
|
|
117
|
-
# Delete a single line
|
|
118
|
-
---a.ts
|
|
119
|
-
-{{hrefr 2}}
|
|
120
|
-
|
|
121
|
-
# Delete the file (no other ops in the section)
|
|
122
|
-
---a.ts
|
|
123
|
-
!rm
|
|
124
|
-
|
|
125
|
-
# Rename a file
|
|
126
|
-
---a.ts
|
|
127
|
-
!mv b.ts
|
|
128
|
-
|
|
129
|
-
# Multi-file edit in one input
|
|
130
|
-
---a.ts
|
|
131
|
-
{{hrefr 1}}=const DEF = "user";
|
|
132
|
-
---other.ts
|
|
133
|
-
$
|
|
134
|
-
+// new footer
|
|
135
|
-
</examples>
|
|
136
|
-
|
|
137
|
-
<critical>
|
|
138
|
-
- You **MUST** copy Lids EXACTLY from the latest read/grep output. You **MUST NOT** guess, shorten, drop letters, or invent line numbers.
|
|
139
|
-
- Current/added preview lines include fresh `LINE+hash|content` anchors. Removed preview lines show deleted content and **MUST NOT** be reused as anchors.
|
|
140
|
-
- You **MUST** emit only lines that change. You **MUST NOT** echo unchanged context; the anchor implies position.
|
|
141
|
-
- You **MUST NOT** write `Lid=<sameTextThatIsAlreadyOnThatLine>`; the tool reports a no-op (no change applied). Emit `Lid=TEXT` only when TEXT differs.
|
|
142
|
-
- You **MUST NOT** use `Lid=<originalLineContent>` + `\continuations` as an "insert after" idiom. That form is a *replacement*: its first line lands at the anchor, and its continuations push the original next line down. When the anchor is a closing brace and your continuations also end in `}`, the original line below — often itself `}` (a sibling block, mod, or impl closer) — sits adjacent to yours and you ship a duplicate `}`. For pure insertion, use `@Lid` + `+TEXT…` (after) or `^Lid` + `+TEXT…` (before). Never re-state the anchor's content as the first line of a replacement.
|
|
143
|
-
- A line of the form `Lid|content` (a Lid, then `|`, then text, with NO leading `+`/`-`/`^`/`@`/`\`/`=`/`..`) is **FORBIDDEN**. That shape only appears in `read`/`grep` output as an anchor for *you*; it is never an edit op. If you copy a `Lid|content` line verbatim from a read into a patch, you have made an error — every edit op must start with `+`, `-`, `^`, `@`, `\`, `$`, `!`, or a Lid immediately followed by `=` or `..`.
|
|
144
|
-
- To replace a contiguous block with new content, the canonical form is `LidA..LidB=FIRST_LINE` + `\NEXT_LINE…`. You **MUST NOT** write the old block and then the new block — that is unified-diff thinking and the tool does not understand it. If you find yourself emitting pre-image lines (with or without operators) before your new content, STOP and rewrite the section as a single range-replace.
|
|
145
|
-
- TEXT after `=`, `+`, or `\` includes leading whitespace verbatim. You **MUST NOT** trim or re-indent it.
|
|
146
|
-
- This is NOT unified diff. You **MUST NOT** write `@@` headers, `-OLD`/`+NEW` pairs, context lines, or `+Lid|…` (bad: `+5th|new text`; good: `5th=new text`).
|
|
147
|
-
- You **MUST NOT** split `Lid=TEXT` across two physical lines.
|
|
148
|
-
- For a contiguous range replacement, you **MAY** use either `Lid=FIRST_LINE` + `\NEXT_LINE…` (extends one anchor) or `LidA..LidB=FIRST_LINE` + `\NEXT_LINE…` (collapses an existing range), or fall back to `-LidA..LidB` + `+TEXT…` (delete + insert).
|
|
149
|
-
- The tool is syntax-blind. Indentation, brackets, fences, table widths — you remain responsible.
|
|
150
|
-
</critical>
|