@oh-my-pi/pi-coding-agent 13.0.2 → 13.1.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 +22 -0
- package/package.json +7 -7
- package/src/patch/index.ts +9 -9
- package/src/patch/shared.ts +2 -3
- package/src/prompts/system/system-prompt.md +8 -8
- package/src/prompts/tools/ask.md +3 -18
- package/src/prompts/tools/{poll-jobs.md → await.md} +1 -1
- package/src/prompts/tools/bash.md +3 -2
- package/src/prompts/tools/browser.md +11 -18
- package/src/prompts/tools/fetch.md +2 -5
- package/src/prompts/tools/find.md +1 -1
- package/src/prompts/tools/grep.md +1 -4
- package/src/prompts/tools/hashline.md +19 -18
- package/src/prompts/tools/lsp.md +6 -16
- package/src/prompts/tools/read.md +3 -6
- package/src/prompts/tools/task.md +93 -275
- package/src/prompts/tools/web-search.md +0 -7
- package/src/prompts/tools/write.md +0 -5
- package/src/sdk.ts +12 -2
- package/src/system-prompt.ts +5 -0
- package/src/tools/{poll-jobs.ts → await-tool.ts} +19 -19
- package/src/tools/bash-skill-urls.ts +28 -3
- package/src/tools/bash.ts +5 -1
- package/src/tools/browser.ts +18 -4
- package/src/tools/index.ts +3 -3
- package/src/tools/notebook.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,28 @@
|
|
|
2
2
|
|
|
3
3
|
## [Unreleased]
|
|
4
4
|
|
|
5
|
+
## [13.1.1] - 2026-02-23
|
|
6
|
+
|
|
7
|
+
### Fixed
|
|
8
|
+
|
|
9
|
+
- Fixed bash internal URL expansion to resolve `local://` targets to concrete filesystem paths, including newly created destination files for commands like `mv src.json local://dest.json`
|
|
10
|
+
- Fixed bash local URL resolution to create missing parent directories under the session local root before command execution, preventing `mv` destination failures for new paths
|
|
11
|
+
## [13.1.0] - 2026-02-23
|
|
12
|
+
### Breaking Changes
|
|
13
|
+
|
|
14
|
+
- Renamed `file` parameter to `path` in replace, patch, and hashline edit operations
|
|
15
|
+
|
|
16
|
+
### Added
|
|
17
|
+
|
|
18
|
+
- Added clarification in hashline edit documentation that the `end` tag must include closing braces/brackets when replacing blocks to prevent syntax errors
|
|
19
|
+
|
|
20
|
+
### Changed
|
|
21
|
+
|
|
22
|
+
- Restructured task tool documentation for clarity, moving parameter definitions into a dedicated section and consolidating guidance on context, assignments, and parallelization
|
|
23
|
+
- Reformatted system prompt template to use markdown headings instead of XML tags for skills, preloaded skills, and rules sections
|
|
24
|
+
- Renamed `deviceScaleFactor` parameter to `device_scale_factor` in browser viewport configuration for consistency with snake_case naming convention
|
|
25
|
+
- Moved intent field documentation from per-tool JSON schema descriptions into a single system prompt block, reducing token overhead proportional to tool count
|
|
26
|
+
|
|
5
27
|
## [13.0.1] - 2026-02-22
|
|
6
28
|
### Changed
|
|
7
29
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"type": "module",
|
|
3
3
|
"name": "@oh-my-pi/pi-coding-agent",
|
|
4
|
-
"version": "13.
|
|
4
|
+
"version": "13.1.1",
|
|
5
5
|
"description": "Coding agent CLI with read, bash, edit, write tools and session management",
|
|
6
6
|
"homepage": "https://github.com/can1357/oh-my-pi",
|
|
7
7
|
"author": "Can Boluk",
|
|
@@ -41,12 +41,12 @@
|
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
43
|
"@mozilla/readability": "^0.6",
|
|
44
|
-
"@oh-my-pi/omp-stats": "13.
|
|
45
|
-
"@oh-my-pi/pi-agent-core": "13.
|
|
46
|
-
"@oh-my-pi/pi-ai": "13.
|
|
47
|
-
"@oh-my-pi/pi-natives": "13.
|
|
48
|
-
"@oh-my-pi/pi-tui": "13.
|
|
49
|
-
"@oh-my-pi/pi-utils": "13.
|
|
44
|
+
"@oh-my-pi/omp-stats": "13.1.1",
|
|
45
|
+
"@oh-my-pi/pi-agent-core": "13.1.1",
|
|
46
|
+
"@oh-my-pi/pi-ai": "13.1.1",
|
|
47
|
+
"@oh-my-pi/pi-natives": "13.1.1",
|
|
48
|
+
"@oh-my-pi/pi-tui": "13.1.1",
|
|
49
|
+
"@oh-my-pi/pi-utils": "13.1.1",
|
|
50
50
|
"@sinclair/typebox": "^0.34",
|
|
51
51
|
"@xterm/headless": "^6.0",
|
|
52
52
|
"ajv": "^8.18",
|
package/src/patch/index.ts
CHANGED
|
@@ -108,14 +108,14 @@ export { ApplyPatchError, EditMatchError, ParseError } from "./types";
|
|
|
108
108
|
// ═══════════════════════════════════════════════════════════════════════════
|
|
109
109
|
|
|
110
110
|
const replaceEditSchema = Type.Object({
|
|
111
|
-
|
|
111
|
+
path: Type.String({ description: "File path (relative or absolute)" }),
|
|
112
112
|
old_text: Type.String({ description: "Text to find (fuzzy whitespace matching enabled)" }),
|
|
113
113
|
new_text: Type.String({ description: "Replacement text" }),
|
|
114
114
|
all: Type.Optional(Type.Boolean({ description: "Replace all occurrences (default: unique match required)" })),
|
|
115
115
|
});
|
|
116
116
|
|
|
117
117
|
const patchEditSchema = Type.Object({
|
|
118
|
-
|
|
118
|
+
path: Type.String({ description: "File path" }),
|
|
119
119
|
op: Type.Optional(
|
|
120
120
|
StringEnum(["create", "delete", "update"], {
|
|
121
121
|
description: "Operation (default: update)",
|
|
@@ -192,10 +192,10 @@ const hashlineEditSchema = Type.Object(
|
|
|
192
192
|
|
|
193
193
|
const hashlineEditParamsSchema = Type.Object(
|
|
194
194
|
{
|
|
195
|
-
|
|
196
|
-
edits: Type.Array(hashlineEditSchema, { description: "edits over $
|
|
197
|
-
delete: Type.Optional(Type.Boolean({ description: "If true, delete $
|
|
198
|
-
move: Type.Optional(Type.String({ description: "If set, move $
|
|
195
|
+
path: Type.String({ description: "path" }),
|
|
196
|
+
edits: Type.Array(hashlineEditSchema, { description: "edits over $path" }),
|
|
197
|
+
delete: Type.Optional(Type.Boolean({ description: "If true, delete $path" })),
|
|
198
|
+
move: Type.Optional(Type.String({ description: "If set, move $path to $move" })),
|
|
199
199
|
},
|
|
200
200
|
{ additionalProperties: false },
|
|
201
201
|
);
|
|
@@ -489,7 +489,7 @@ export class EditTool implements AgentTool<TInput> {
|
|
|
489
489
|
// Hashline mode execution
|
|
490
490
|
// ─────────────────────────────────────────────────────────────────
|
|
491
491
|
if (this.mode === "hashline") {
|
|
492
|
-
const {
|
|
492
|
+
const { path, edits, delete: deleteFile, move } = params as HashlineParams;
|
|
493
493
|
|
|
494
494
|
enforcePlanModeWrite(this.session, path, { op: deleteFile ? "delete" : "update", move });
|
|
495
495
|
|
|
@@ -659,7 +659,7 @@ export class EditTool implements AgentTool<TInput> {
|
|
|
659
659
|
// Patch mode execution
|
|
660
660
|
// ─────────────────────────────────────────────────────────────────
|
|
661
661
|
if (this.mode === "patch") {
|
|
662
|
-
const {
|
|
662
|
+
const { path, op: rawOp, rename, diff } = params as PatchParams;
|
|
663
663
|
|
|
664
664
|
// Normalize unrecognized operations to "update"
|
|
665
665
|
const op: Operation = rawOp === "create" || rawOp === "delete" ? rawOp : "update";
|
|
@@ -741,7 +741,7 @@ export class EditTool implements AgentTool<TInput> {
|
|
|
741
741
|
// ─────────────────────────────────────────────────────────────────
|
|
742
742
|
// Replace mode execution
|
|
743
743
|
// ─────────────────────────────────────────────────────────────────
|
|
744
|
-
const {
|
|
744
|
+
const { path, old_text, new_text, all } = params as ReplaceParams;
|
|
745
745
|
|
|
746
746
|
enforcePlanModeWrite(this.session, path);
|
|
747
747
|
|
package/src/patch/shared.ts
CHANGED
|
@@ -71,7 +71,6 @@ export interface EditToolDetails {
|
|
|
71
71
|
interface EditRenderArgs {
|
|
72
72
|
path?: string;
|
|
73
73
|
file_path?: string;
|
|
74
|
-
file?: string;
|
|
75
74
|
oldText?: string;
|
|
76
75
|
newText?: string;
|
|
77
76
|
patch?: string;
|
|
@@ -220,7 +219,7 @@ export const editToolRenderer = {
|
|
|
220
219
|
mergeCallAndResult: true,
|
|
221
220
|
|
|
222
221
|
renderCall(args: EditRenderArgs, options: RenderResultOptions, uiTheme: Theme): Component {
|
|
223
|
-
const rawPath = args.file_path || args.path ||
|
|
222
|
+
const rawPath = args.file_path || args.path || "";
|
|
224
223
|
const filePath = shortenPath(rawPath);
|
|
225
224
|
const editLanguage = getLanguageFromPath(rawPath) ?? "text";
|
|
226
225
|
const editIcon = uiTheme.fg("muted", uiTheme.getLangIcon(editLanguage));
|
|
@@ -275,7 +274,7 @@ export const editToolRenderer = {
|
|
|
275
274
|
uiTheme: Theme,
|
|
276
275
|
args?: EditRenderArgs,
|
|
277
276
|
): Component {
|
|
278
|
-
const rawPath = args?.file_path || args?.path ||
|
|
277
|
+
const rawPath = args?.file_path || args?.path || "";
|
|
279
278
|
const filePath = shortenPath(rawPath);
|
|
280
279
|
const editLanguage = getLanguageFromPath(rawPath) ?? "text";
|
|
281
280
|
const editIcon = uiTheme.fg("muted", uiTheme.getLangIcon(editLanguage));
|
|
@@ -100,6 +100,10 @@ You MUST NOT open a file hoping. Hope is not a strategy.
|
|
|
100
100
|
{{#has tools "grep"}}- Known territory → `grep` to locate target{{/has}}
|
|
101
101
|
{{#has tools "read"}}- Known location → `read` with offset/limit, not whole file{{/has}}
|
|
102
102
|
{{/ifAny}}
|
|
103
|
+
|
|
104
|
+
{{#if intentTracing}}
|
|
105
|
+
Every tool has a required `{{intentField}}` parameter. Describe intent as one sentence in present participle form (e.g., Inserting comment before the function) with no trailing period.
|
|
106
|
+
{{/if}}
|
|
103
107
|
</tools>
|
|
104
108
|
|
|
105
109
|
<procedure>
|
|
@@ -215,30 +219,26 @@ Match skill descriptions to the task domain. If a skill is relevant, you MUST re
|
|
|
215
219
|
Relative paths in skill files resolve against the skill directory.
|
|
216
220
|
|
|
217
221
|
{{#list skills join="\n"}}
|
|
218
|
-
|
|
222
|
+
### {{name}}
|
|
219
223
|
{{description}}
|
|
220
|
-
</skill>
|
|
221
224
|
{{/list}}
|
|
222
225
|
</skills>
|
|
223
226
|
{{/if}}
|
|
224
227
|
{{#if preloadedSkills.length}}
|
|
225
|
-
<
|
|
228
|
+
<skills>
|
|
226
229
|
{{#list preloadedSkills join="\n"}}
|
|
227
230
|
<skill name="{{name}}">
|
|
228
231
|
{{content}}
|
|
229
232
|
</skill>
|
|
230
233
|
{{/list}}
|
|
231
|
-
</
|
|
234
|
+
</skills>
|
|
232
235
|
{{/if}}
|
|
233
236
|
{{#if rules.length}}
|
|
234
237
|
<rules>
|
|
235
238
|
Read `rule://<name>` when working in matching domain.
|
|
236
|
-
|
|
237
239
|
{{#list rules join="\n"}}
|
|
238
|
-
|
|
240
|
+
### {{name}} (Glob: {{#list globs join=", "}}{{this}}{{/list}})
|
|
239
241
|
{{description}}
|
|
240
|
-
{{#list globs join="\n"}}<glob>{{this}}</glob>{{/list}}
|
|
241
|
-
</rule>
|
|
242
242
|
{{/list}}
|
|
243
243
|
</rules>
|
|
244
244
|
{{/if}}
|
package/src/prompts/tools/ask.md
CHANGED
|
@@ -12,33 +12,18 @@ Ask user when you need clarification or input during task execution.
|
|
|
12
12
|
- Set `multi: true` on question to allow multiple selections
|
|
13
13
|
</instruction>
|
|
14
14
|
|
|
15
|
-
<output>
|
|
16
|
-
Returns selected option(s) as text. For multi-part questions, returns map of question IDs to selected values.
|
|
17
|
-
</output>
|
|
18
|
-
|
|
19
15
|
<caution>
|
|
20
16
|
- Provide 2-5 concise, distinct options
|
|
21
17
|
</caution>
|
|
22
18
|
|
|
23
19
|
<critical>
|
|
24
|
-
**Default to action.
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
3. **If multiple choices are acceptable**, you MUST pick the most conservative/standard option and proceed; state the choice.
|
|
28
|
-
4. You MUST **only ask when options have materially different tradeoffs and the user must decide.**
|
|
29
|
-
**You MUST NOT include "Other" option in your options array.** UI automatically adds "Other (type your own)" to every question; adding your own creates duplicates.
|
|
20
|
+
- **Default to action.** Resolve ambiguity yourself using repo conventions, existing patterns, and reasonable defaults. Exhaust existing sources (code, configs, docs, history) before asking. Only ask when options have materially different tradeoffs the user must decide.
|
|
21
|
+
- **If multiple choices are acceptable**, pick the most conservative/standard option and proceed; state the choice.
|
|
22
|
+
- **Do NOT include "Other" option** — UI automatically adds "Other (type your own)" to every question.
|
|
30
23
|
</critical>
|
|
31
24
|
|
|
32
25
|
<example name="single">
|
|
33
26
|
question: "Which authentication method should this API use?"
|
|
34
27
|
options: [{"label": "JWT"}, {"label": "OAuth2"}, {"label": "Session cookies"}]
|
|
35
28
|
recommended: 0
|
|
36
|
-
</example>
|
|
37
|
-
|
|
38
|
-
<example name="multi-part">
|
|
39
|
-
questions: [
|
|
40
|
-
{"id": "auth", "question": "Which auth method?", "options": [{"label": "JWT"}, {"label": "OAuth2"}], "recommended": 0},
|
|
41
|
-
{"id": "cache", "question": "Enable caching?", "options": [{"label": "Yes"}, {"label": "No"}]},
|
|
42
|
-
{"id": "features", "question": "Which features to include?", "options": [{"label": "Logging"}, {"label": "Metrics"}, {"label": "Tracing"}], "multi": true}
|
|
43
|
-
]
|
|
44
29
|
</example>
|
|
@@ -13,17 +13,18 @@ Executes bash command in shell session for terminal operations like git, bun, ca
|
|
|
13
13
|
{{#if asyncEnabled}}
|
|
14
14
|
- Use `async: true` for long-running commands when you don't need immediate output; the call returns a background job ID and the result is delivered automatically as a follow-up.
|
|
15
15
|
- Use `read jobs://` to inspect all background jobs and `read jobs://<job-id>` for detailed status/output when needed.
|
|
16
|
-
- When you need to wait for async results before continuing,
|
|
16
|
+
- When you need to wait for async results before continuing, call `await` — it blocks until jobs complete. Do NOT poll `read jobs://` in a loop or yield and hope for delivery.
|
|
17
17
|
{{/if}}
|
|
18
18
|
</instruction>
|
|
19
19
|
|
|
20
20
|
<output>
|
|
21
21
|
Returns the output, and an exit code from command execution.
|
|
22
|
+
- If output truncated, full output can be retrieved from `artifact://<id>`, linked in metadata
|
|
22
23
|
- Exit codes shown on non-zero exit
|
|
23
24
|
</output>
|
|
24
25
|
|
|
25
26
|
<critical>
|
|
26
27
|
- You MUST NOT use Bash for these operations like read, grep, find, edit, write, where specialized tools exist.
|
|
27
|
-
- You MUST NOT use `2>&1`
|
|
28
|
+
- You MUST NOT use `2>&1` pattern, stdout and stderr are already merged.
|
|
28
29
|
- You MUST NOT use `| head -n 50` or `| tail -n 100` pattern, use `head` and `tail` parameters instead.
|
|
29
30
|
</critical>
|
|
@@ -1,24 +1,17 @@
|
|
|
1
1
|
# Browser
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Navigate, click, type, scroll, drag, query DOM content, and capture screenshots.
|
|
4
4
|
|
|
5
5
|
<instruction>
|
|
6
|
-
-
|
|
7
|
-
-
|
|
8
|
-
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
-
|
|
12
|
-
|
|
13
|
-
-
|
|
14
|
-
-
|
|
15
|
-
- Use `action: "evaluate"` with `script` to run a JavaScript expression in the page context
|
|
16
|
-
- Use `action: "get_text"`, `"get_html"`, or `"get_attribute"` for DOM queries
|
|
17
|
-
- For batch queries, pass `args: [{ selector, attribute? }]` to get an array of results (attribute required for `get_attribute`)
|
|
18
|
-
- Use `action: "extract_readable"` to return reader-mode content (title/byline/excerpt/text or markdown)
|
|
19
|
-
- Set `format` to `"markdown"` (default) or `"text"`
|
|
20
|
-
- Use `action: "screenshot"` to capture images (optionally with `selector` to capture a single element)
|
|
21
|
-
- Use `action: "close"` to release the browser when done
|
|
6
|
+
- `"open"` starts a headless session (or implicitly on first action); `"goto"` navigates to `url`; `"close"` releases the browser
|
|
7
|
+
- `"observe"` captures a numbered accessibility snapshot — prefer `click_id`/`type_id`/`fill_id` using returned `element_id` values; flags: `include_all`, `viewport_only`
|
|
8
|
+
- `"click"`, `"type"`, `"fill"`, `"press"`, `"scroll"`, `"drag"` for selector-based interactions — prefer ARIA/text selectors (`p-aria/[name="Sign in"]`, `p-text/Continue`) over brittle CSS
|
|
9
|
+
- `"click_id"`, `"type_id"`, `"fill_id"` to interact with observed elements without selectors
|
|
10
|
+
- `"wait_for_selector"` before interacting when the page is dynamic
|
|
11
|
+
- `"evaluate"` runs a JS expression in page context
|
|
12
|
+
- `"get_text"`, `"get_html"`, `"get_attribute"` for DOM queries — batch via `args: [{ selector, attribute? }]`
|
|
13
|
+
- `"extract_readable"` returns reader-mode content; `format`: `"markdown"` (default) or `"text"`
|
|
14
|
+
- `"screenshot"` captures images (optionally with `selector`); can save to disk via `path`
|
|
22
15
|
</instruction>
|
|
23
16
|
|
|
24
17
|
<critical>
|
|
@@ -29,5 +22,5 @@ Use this tool to navigate, click, type, scroll, drag, query DOM content, and cap
|
|
|
29
22
|
</critical>
|
|
30
23
|
|
|
31
24
|
<output>
|
|
32
|
-
|
|
25
|
+
Text for navigation/DOM queries, images for screenshots.
|
|
33
26
|
</output>
|
|
@@ -3,14 +3,11 @@
|
|
|
3
3
|
Retrieves content from a URL and returns it in a clean, readable format.
|
|
4
4
|
|
|
5
5
|
<instruction>
|
|
6
|
-
- Extract information from web pages
|
|
7
|
-
- Analyze GitHub issues, PRs, or repository content
|
|
8
|
-
- Retrieve from Stack Overflow, Wikipedia, Reddit, NPM, arXiv, technical blogs
|
|
9
|
-
- Access RSS/Atom feeds or JSON endpoints
|
|
6
|
+
- Extract information from web pages, GitHub issues/PRs, Stack Overflow, Wikipedia, Reddit, NPM, arXiv, technical blogs, RSS/Atom feeds, JSON endpoints
|
|
10
7
|
- Read PDF or DOCX files hosted at a URL
|
|
11
8
|
- Use `raw: true` for untouched HTML or debugging
|
|
12
9
|
</instruction>
|
|
13
10
|
|
|
14
11
|
<output>
|
|
15
|
-
Returns processed, readable content
|
|
12
|
+
Returns processed, readable content. HTML transformed to remove boilerplate. PDF/DOCX converted to text. JSON returned formatted. With `raw: true`, returns untransformed HTML.
|
|
16
13
|
</output>
|
|
@@ -10,7 +10,7 @@ Fast file pattern matching that works with any codebase size.
|
|
|
10
10
|
</instruction>
|
|
11
11
|
|
|
12
12
|
<output>
|
|
13
|
-
Matching file paths sorted by modification time (most recent first).
|
|
13
|
+
Matching file paths sorted by modification time (most recent first). Truncated at 1000 entries or 50KB (configurable via `limit`).
|
|
14
14
|
</output>
|
|
15
15
|
|
|
16
16
|
<example name="find files">
|
|
@@ -3,16 +3,13 @@
|
|
|
3
3
|
Powerful search tool built on ripgrep.
|
|
4
4
|
|
|
5
5
|
<instruction>
|
|
6
|
-
- Supports full regex syntax (e.g., `log.*Error`, `function\\s+\\w+`)
|
|
6
|
+
- Supports full regex syntax (e.g., `log.*Error`, `function\\s+\\w+`); literal braces need escaping (`interface\\{\\}` for `interface{}` in Go)
|
|
7
7
|
- Filter files with `glob` (e.g., `*.js`, `**/*.tsx`) or `type` (e.g., `js`, `py`, `rust`)
|
|
8
|
-
- Pattern syntax uses ripgrep—literal braces need escaping (`interface\\{\\}` to find `interface{}` in Go)
|
|
9
8
|
- For cross-line patterns like `struct \\{[\\s\\S]*?field`, set `multiline: true` if needed
|
|
10
9
|
- If the pattern contains a literal `\n`, multiline defaults to true
|
|
11
10
|
</instruction>
|
|
12
11
|
|
|
13
12
|
<output>
|
|
14
|
-
- Results are always content mode.
|
|
15
|
-
- Results grouped by directory (`# dir`) and file (`## └─ file`) headings
|
|
16
13
|
{{#if IS_HASHLINE_MODE}}
|
|
17
14
|
- Text output is CID prefixed: `LINE#ID:content`
|
|
18
15
|
{{else}}
|
|
@@ -22,20 +22,20 @@ Every edit has `op`, `pos`, and `lines`. Range replaces also have `end`. Both `p
|
|
|
22
22
|
- `null` or `[]` — **delete** the line(s) entirely
|
|
23
23
|
|
|
24
24
|
### Line or range replace/delete
|
|
25
|
-
- `{
|
|
26
|
-
- `{
|
|
27
|
-
- `{
|
|
28
|
-
- `{
|
|
25
|
+
- `{ path: "…", edits: [{ op: "replace", pos: "N#ID", lines: null }] }` — delete one line
|
|
26
|
+
- `{ path: "…", edits: [{ op: "replace", pos: "N#ID", end: "M#ID", lines: null }] }` — delete a range
|
|
27
|
+
- `{ path: "…", edits: [{ op: "replace", pos: "N#ID", lines: […] }] }` — replace one line
|
|
28
|
+
- `{ path: "…", edits: [{ op: "replace", pos: "N#ID", end: "M#ID", lines: […] }] }` — replace a range
|
|
29
29
|
|
|
30
30
|
### Insert new lines
|
|
31
|
-
- `{
|
|
32
|
-
- `{
|
|
33
|
-
- `{
|
|
34
|
-
- `{
|
|
31
|
+
- `{ path: "…", edits: [{ op: "prepend", pos: "N#ID", lines: […] }] }` — insert before tagged line
|
|
32
|
+
- `{ path: "…", edits: [{ op: "prepend", lines: […] }] }` — insert at beginning of file (no tag)
|
|
33
|
+
- `{ path: "…", edits: [{ op: "append", pos: "N#ID", lines: […] }] }` — insert after tagged line
|
|
34
|
+
- `{ path: "…", edits: [{ op: "append", lines: […] }] }` — insert at end of file (no tag)
|
|
35
35
|
|
|
36
36
|
### File-level controls
|
|
37
|
-
- `{
|
|
38
|
-
- `{
|
|
37
|
+
- `{ path: "…", delete: true, edits: [] }` — delete the file
|
|
38
|
+
- `{ path: "…", move: "new/path.ts", edits: […] }` — move file to new path (edits applied first)
|
|
39
39
|
**Atomicity:** all ops in one call validate against the same pre-edit snapshot; tags reference the last `read`. Edits are applied bottom-up, so earlier tags stay valid even when later ops add or remove lines.
|
|
40
40
|
</operations>
|
|
41
41
|
|
|
@@ -44,6 +44,7 @@ Every edit has `op`, `pos`, and `lines`. Range replaces also have `end`. Both `p
|
|
|
44
44
|
2. **No no-ops:** replacement MUST differ from current.
|
|
45
45
|
3. **Prefer insertion over neighbor rewrites:** You SHOULD anchor on structural boundaries (`}`, `]`, `},`), not interior lines.
|
|
46
46
|
4. **For swaps/moves:** You SHOULD prefer one range op over multiple single-line ops.
|
|
47
|
+
5. **Range end tag:** When replacing a block (e.g., an `if` body), the `end` tag MUST include the block's closing brace/bracket — not just the last interior line. Verify the `end` tag covers all lines being logically removed, including trailing `}`, `]`, or `)`. An off-by-one on `end` orphans a brace and breaks syntax.
|
|
47
48
|
</rules>
|
|
48
49
|
|
|
49
50
|
<recovery>
|
|
@@ -57,7 +58,7 @@ Every edit has `op`, `pos`, and `lines`. Range replaces also have `end`. Both `p
|
|
|
57
58
|
```
|
|
58
59
|
```
|
|
59
60
|
{
|
|
60
|
-
|
|
61
|
+
path: "…",
|
|
61
62
|
edits: [{
|
|
62
63
|
op: "replace",
|
|
63
64
|
pos: "{{hlineref 23 " const timeout: number = 5000;"}}",
|
|
@@ -71,7 +72,7 @@ Every edit has `op`, `pos`, and `lines`. Range replaces also have `end`. Both `p
|
|
|
71
72
|
Single line — `lines: null` deletes entirely:
|
|
72
73
|
```
|
|
73
74
|
{
|
|
74
|
-
|
|
75
|
+
path: "…",
|
|
75
76
|
edits: [{
|
|
76
77
|
op: "replace",
|
|
77
78
|
pos: "{{hlineref 7 "// @ts-ignore"}}",
|
|
@@ -82,7 +83,7 @@ Single line — `lines: null` deletes entirely:
|
|
|
82
83
|
Range — add `end`:
|
|
83
84
|
```
|
|
84
85
|
{
|
|
85
|
-
|
|
86
|
+
path: "…",
|
|
86
87
|
edits: [{
|
|
87
88
|
op: "replace",
|
|
88
89
|
pos: "{{hlineref 80 " // TODO: remove after migration"}}",
|
|
@@ -99,7 +100,7 @@ Range — add `end`:
|
|
|
99
100
|
```
|
|
100
101
|
```
|
|
101
102
|
{
|
|
102
|
-
|
|
103
|
+
path: "…",
|
|
103
104
|
edits: [{
|
|
104
105
|
op: "replace",
|
|
105
106
|
pos: "{{hlineref 14 " placeholder: \"DO NOT SHIP\","}}",
|
|
@@ -118,7 +119,7 @@ Range — add `end`:
|
|
|
118
119
|
```
|
|
119
120
|
```
|
|
120
121
|
{
|
|
121
|
-
|
|
122
|
+
path: "…",
|
|
122
123
|
edits: [{
|
|
123
124
|
op: "replace",
|
|
124
125
|
pos: "{{hlineref 60 " } catch (err) {"}}",
|
|
@@ -141,7 +142,7 @@ Range — add `end`:
|
|
|
141
142
|
```
|
|
142
143
|
```
|
|
143
144
|
{
|
|
144
|
-
|
|
145
|
+
path: "…",
|
|
145
146
|
edits: [{
|
|
146
147
|
op: "prepend",
|
|
147
148
|
pos: "{{hlineref 45 " \"test\": \"bun test\""}}",
|
|
@@ -168,7 +169,7 @@ Bad — append after "}"
|
|
|
168
169
|
Good — anchors to structural line:
|
|
169
170
|
```
|
|
170
171
|
{
|
|
171
|
-
|
|
172
|
+
path: "…",
|
|
172
173
|
edits: [{
|
|
173
174
|
op: "prepend",
|
|
174
175
|
pos: "{{hlineref 103 "export function serialize(data: unknown): string {"}}",
|
|
@@ -184,7 +185,7 @@ Good — anchors to structural line:
|
|
|
184
185
|
</example>
|
|
185
186
|
|
|
186
187
|
<critical>
|
|
187
|
-
- Edit payload: `{
|
|
188
|
+
- Edit payload: `{ path, edits[] }`. Each entry: `op`, `lines`, optional `pos`/`end`. No extra keys.
|
|
188
189
|
- Every tag MUST be copied exactly from fresh tool result as `N#ID`.
|
|
189
190
|
- You MUST re-read after each edit call before issuing another on same file.
|
|
190
191
|
</critical>
|
package/src/prompts/tools/lsp.md
CHANGED
|
@@ -3,25 +3,15 @@
|
|
|
3
3
|
Interact with Language Server Protocol servers for code intelligence.
|
|
4
4
|
|
|
5
5
|
<operations>
|
|
6
|
-
- `definition`: Go to symbol definition
|
|
7
|
-
- `references`: Find all references
|
|
8
|
-
- `hover`: Get type info and documentation
|
|
9
|
-
- `symbols`: List symbols in file, or search workspace (with query, no file)
|
|
10
|
-
- `rename`: Rename symbol across codebase
|
|
11
|
-
- `diagnostics`: Get errors/warnings for file, or check entire project (no file)
|
|
6
|
+
- `definition`: Go to symbol definition → file path + position
|
|
7
|
+
- `references`: Find all references → list of locations (file + position)
|
|
8
|
+
- `hover`: Get type info and documentation → type signature + docs
|
|
9
|
+
- `symbols`: List symbols in file, or search workspace (with query, no file) → names, kinds, locations
|
|
10
|
+
- `rename`: Rename symbol across codebase → confirmation of changes
|
|
11
|
+
- `diagnostics`: Get errors/warnings for file, or check entire project (no file) → list with severity + message
|
|
12
12
|
- `reload`: Restart the language server
|
|
13
13
|
</operations>
|
|
14
14
|
|
|
15
|
-
<output>
|
|
16
|
-
- `definition`: File path and position of definition
|
|
17
|
-
- `references`: List of locations (file + position) where symbol used
|
|
18
|
-
- `hover`: Type signature and documentation text
|
|
19
|
-
- `symbols`: List of symbol names, kinds, locations
|
|
20
|
-
- `rename`: Confirmation of changes made across files
|
|
21
|
-
- `diagnostics`: List of errors/warnings with file, line, severity, message
|
|
22
|
-
- `reload`: Confirmation of server restart
|
|
23
|
-
</output>
|
|
24
|
-
|
|
25
15
|
<caution>
|
|
26
16
|
- Requires running LSP server for target language
|
|
27
17
|
- Some operations require file to be saved to disk
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Read
|
|
2
2
|
|
|
3
|
-
Reads files from local filesystem or
|
|
3
|
+
Reads files from local filesystem or internal URLs.
|
|
4
4
|
|
|
5
5
|
<instruction>
|
|
6
6
|
- Reads up to {{DEFAULT_MAX_LINES}} lines default
|
|
@@ -14,13 +14,10 @@ Reads files from local filesystem or harness URLs.
|
|
|
14
14
|
{{/if}}
|
|
15
15
|
- Supports images (PNG, JPG) and PDFs
|
|
16
16
|
- For directories, returns formatted listing with modification times
|
|
17
|
-
-
|
|
17
|
+
- Parallelize reads when exploring related files
|
|
18
18
|
</instruction>
|
|
19
19
|
|
|
20
20
|
<output>
|
|
21
|
-
- Returns file content as text
|
|
22
|
-
- Images: returns visual content for analysis
|
|
23
|
-
- PDFs: returns extracted text
|
|
21
|
+
- Returns file content as text; images return visual content; PDFs return extracted text
|
|
24
22
|
- Missing files: returns closest filename matches for correction
|
|
25
|
-
- Internal URLs: returns resolved content with pagination support
|
|
26
23
|
</output>
|