pi-agent-ide 0.7.0 → 0.7.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 +7 -0
- package/dist/chunk-2TRHFMCZ.js +11 -0
- package/dist/{chunk-FXNKMNSJ.js → chunk-4GCWGE2C.js} +1 -1
- package/dist/chunk-4XMY4H4V.js +1 -0
- package/dist/{chunk-3HYXQ4YA.js → chunk-76ZK5ODR.js} +2 -2
- package/dist/{chunk-6CZO43OH.js → chunk-BU7IZLKB.js} +1 -1
- package/dist/chunk-CWD4O5PM.js +3 -0
- package/dist/chunk-D3WTDA6V.js +2 -0
- package/dist/chunk-GXEGY7GV.js +1 -0
- package/dist/{chunk-GBLKIB6O.js → chunk-HZEY4GT4.js} +1 -1
- package/dist/{chunk-S5LXX32D.js → chunk-LEEQIQ7D.js} +6 -6
- package/dist/chunk-NRZO5KJT.js +9 -0
- package/dist/chunk-OMVRLWMX.js +5 -0
- package/dist/{chunk-KR36BT5E.js → chunk-PGIVHICI.js} +1 -1
- package/dist/{chunk-YRF7OATP.js → chunk-PKKDDIWW.js} +1 -1
- package/dist/{chunk-EDURPQAV.js → chunk-QRJLIV6P.js} +6 -6
- package/dist/{chunk-OBNING2A.js → chunk-S5PL5DFQ.js} +1 -1
- package/dist/chunk-VMTR74FF.js +2 -0
- package/dist/{chunk-PYPPV2F5.js → chunk-WMO6RNE2.js} +1 -1
- package/dist/{chunk-3JO7QFIL.js → chunk-WU6ZK6YD.js} +1 -1
- package/dist/{chunk-F5YZG77W.js → chunk-XH5WN5XA.js} +1 -1
- package/dist/{chunk-AJRIASPQ.js → chunk-YP46DVVP.js} +1 -1
- package/dist/entry-11.js +1 -1
- package/dist/entry-13.js +1 -1
- package/dist/entry-14.js +1 -1
- package/dist/entry-15.js +1 -1
- package/dist/entry-17.js +1 -1
- package/dist/entry-25.js +2 -2
- package/dist/entry-26.js +1 -1
- package/dist/entry-27.js +2 -2
- package/dist/entry-28.js +1 -1
- package/dist/entry-29.js +1 -1
- package/dist/entry-31.js +13 -12
- package/dist/entry-33.js +1 -1
- package/dist/entry-37.js +6 -6
- package/dist/entry-41.js +1 -1
- package/dist/entry-43.js +1 -1
- package/dist/entry-44.js +1 -1
- package/dist/entry-45.js +13 -14
- package/dist/entry-46.js +1 -1
- package/dist/entry-49.js +1 -1
- package/dist/entry-50.js +1 -1
- package/dist/entry-51.js +2 -2
- package/dist/entry-53.js +1 -1
- package/dist/entry-54.js +1 -1
- package/dist/entry-56.js +1 -1
- package/dist/entry-57.js +1 -1
- package/dist/entry-58.js +1 -1
- package/dist/entry-60.js +1 -1
- package/dist/entry-62.js +1 -1
- package/dist/entry-65.js +1 -1
- package/dist/entry-68.js +1 -1
- package/dist/entry-70.js +1 -1
- package/dist/entry-75.js +1 -1
- package/dist/entry-77.js +33 -34
- package/dist/entry-78.js +1 -1
- package/dist/entry-79.js +1 -1
- package/dist/entry-80.js +1 -1
- package/dist/entry-82.js +2 -2
- package/dist/entry-83.js +1 -1
- package/dist/entry-84.js +1 -1
- package/dist/entry-85.js +1 -1
- package/dist/entry-86.js +1 -1
- package/dist/pi-agent-ide.js +14 -9
- package/docs/agent-guides/editing.md +35 -46
- package/docs/agent-guides/read-resources.md +5 -9
- package/docs/agent-guides/search-code.md +12 -17
- package/docs/agent-guides/select-code.md +61 -140
- package/docs/structured-results.md +27 -62
- package/docs/tools.md +6 -10
- package/node_modules/pi-agent-doctor/package.json +1 -1
- package/node_modules/pi-agent-documentation/package.json +1 -1
- package/node_modules/pi-agent-filesystem/index.ts +7 -6
- package/node_modules/pi-agent-filesystem/package.json +7 -7
- package/node_modules/pi-agent-filesystem-image/package.json +3 -3
- package/node_modules/pi-agent-filesystem-jq/index.ts +4 -3
- package/node_modules/pi-agent-filesystem-jq/package.json +5 -5
- package/node_modules/pi-agent-filesystem-pdf/package.json +3 -3
- package/node_modules/pi-agent-filesystem-text/package.json +3 -3
- package/node_modules/pi-agent-ide-ast/package.json +13 -13
- package/node_modules/pi-agent-ide-ast/src/extension.ts +7 -4
- package/node_modules/pi-agent-ide-ast/src/search-resolver.ts +35 -6
- package/node_modules/pi-agent-ide-ast/src/select-presentation.ts +1 -1
- package/node_modules/pi-agent-ide-ast/src/select-schema.ts +2 -2
- package/node_modules/pi-agent-ide-ast/src/tool-select.ts +18 -1
- package/node_modules/pi-agent-ide-changes/index.ts +4 -3
- package/node_modules/pi-agent-ide-changes/package.json +8 -8
- package/node_modules/pi-agent-ide-formatter/package.json +3 -3
- package/node_modules/pi-agent-ide-languages/package.json +2 -2
- package/node_modules/pi-agent-ide-lint/package.json +7 -7
- package/node_modules/pi-agent-ide-lsp/index.ts +3 -3
- package/node_modules/pi-agent-ide-lsp/package.json +9 -9
- package/node_modules/pi-agent-ide-lsp/src/search-resolver.ts +5 -1
- package/node_modules/pi-agent-image/package.json +2 -2
- package/node_modules/pi-agent-invariant/package.json +1 -1
- package/node_modules/pi-agent-pdf/package.json +2 -2
- package/node_modules/pi-agent-read/package.json +7 -7
- package/node_modules/pi-agent-read/src/api/plugin-protocol.ts +1 -1
- package/node_modules/pi-agent-read/src/api/read-parameters.ts +38 -1
- package/node_modules/pi-agent-read/src/api/tools/read.ts +7 -1
- package/node_modules/pi-agent-read/src/core/extension.ts +7 -1
- package/node_modules/pi-agent-read/src/core/read-core.ts +50 -35
- package/node_modules/pi-agent-read/src/core/tools/read/structured-result.ts +3 -3
- package/node_modules/pi-agent-read/src/core/tools/tool-read.ts +9 -2
- package/node_modules/pi-agent-resource/package.json +1 -1
- package/node_modules/pi-agent-resource/src/result-targets.ts +183 -9
- package/node_modules/pi-agent-resource/src/tool-result.ts +13 -1
- package/node_modules/pi-agent-search/package.json +5 -5
- package/node_modules/pi-agent-search/src/api/search-parameters.ts +1 -1
- package/node_modules/pi-agent-search-text/index.ts +1 -1
- package/node_modules/pi-agent-search-text/package.json +7 -7
- package/node_modules/pi-agent-text/package.json +2 -2
- package/node_modules/pi-agent-text-anchor-constant/package.json +3 -3
- package/node_modules/pi-agent-text-anchor-exact/index.ts +65 -4
- package/node_modules/pi-agent-text-anchor-exact/package.json +3 -3
- package/node_modules/pi-agent-text-anchor-exact/src/anchor.ts +12 -2
- package/node_modules/pi-agent-text-anchor-line-hash/index.ts +4 -3
- package/node_modules/pi-agent-text-anchor-line-hash/package.json +5 -5
- package/node_modules/pi-agent-text-editor/package.json +9 -9
- package/node_modules/pi-agent-text-editor/src/api/mutation-result.ts +3 -1
- package/node_modules/pi-agent-text-editor/src/core/extension.ts +10 -3
- package/node_modules/pi-agent-text-editor/src/core/file-operations.ts +3 -13
- package/node_modules/pi-agent-text-editor/src/core/native-text-edit-batch.ts +18 -11
- package/node_modules/pi-agent-text-editor/src/core/structured-result.ts +43 -209
- package/node_modules/pi-agent-text-editor/src/core/text-mutation.ts +37 -31
- package/node_modules/pi-agent-text-editor/src/core/tool-call-interceptor/coordinator.ts +1 -1
- package/node_modules/pi-agent-text-editor/src/tools/text-tool-schema-properties.ts +2 -7
- package/node_modules/pi-agent-text-editor/src/tools/tool-text-copy.ts +1 -1
- package/node_modules/pi-agent-text-editor/src/tools/tool-text-delete.ts +2 -2
- package/node_modules/pi-agent-text-editor/src/tools/tool-text-move.ts +1 -1
- package/node_modules/pi-agent-text-editor/src/tools/tool-text-replace.ts +1 -1
- package/node_modules/pi-agent-text-editor-renderer/package.json +5 -5
- package/node_modules/pi-agent-text-editor-stale-anchor/package.json +4 -4
- package/node_modules/pi-agent-tool-call-interception/package.json +2 -2
- package/node_modules/pi-agent-tool-call-interception/src/index.ts +3 -0
- package/node_modules/pi-agent-tool-ui/package.json +1 -1
- package/node_modules/pi-agent-web/index.ts +4 -3
- package/node_modules/pi-agent-web/package.json +7 -7
- package/node_modules/pi-agent-web-html/package.json +2 -2
- package/node_modules/pi-agent-web-image/package.json +3 -3
- package/node_modules/pi-agent-web-pdf/package.json +3 -3
- package/node_modules/pi-agent-web-text/package.json +3 -3
- package/package.json +35 -35
- package/src/composite/text-results.ts +221 -0
- package/src/documentation/extension.ts +11 -9
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/index.ts +7 -6
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/package.json +7 -7
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-image/package.json +3 -3
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-jq/index.ts +4 -3
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-jq/package.json +5 -5
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-pdf/package.json +3 -3
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-text/package.json +3 -3
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/index.ts +4 -3
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/package.json +7 -7
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-html/package.json +2 -2
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-image/package.json +3 -3
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-pdf/package.json +3 -3
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-text/package.json +3 -3
- package/src/extensions/pi-agent-read/package.json +7 -7
- package/src/extensions/pi-agent-read/src/api/plugin-protocol.ts +1 -1
- package/src/extensions/pi-agent-read/src/api/read-parameters.ts +38 -1
- package/src/extensions/pi-agent-read/src/api/tools/read.ts +7 -1
- package/src/extensions/pi-agent-read/src/core/extension.ts +7 -1
- package/src/extensions/pi-agent-read/src/core/read-core.ts +50 -35
- package/src/extensions/pi-agent-read/src/core/tools/read/structured-result.ts +3 -3
- package/src/extensions/pi-agent-read/src/core/tools/tool-read.ts +9 -2
- package/src/extensions/pi-agent-search/package.json +5 -5
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/index.ts +1 -1
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/package.json +7 -7
- package/src/extensions/pi-agent-search/src/api/search-parameters.ts +1 -1
- package/src/extensions/pi-agent-text-editor/package.json +9 -9
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-constant/package.json +3 -3
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/index.ts +65 -4
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/package.json +3 -3
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/src/anchor.ts +12 -2
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/index.ts +4 -3
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/package.json +5 -5
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/package.json +5 -5
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-stale-anchor/package.json +4 -4
- package/src/extensions/pi-agent-text-editor/src/api/mutation-result.ts +3 -1
- package/src/extensions/pi-agent-text-editor/src/core/extension.ts +10 -3
- package/src/extensions/pi-agent-text-editor/src/core/file-operations.ts +3 -13
- package/src/extensions/pi-agent-text-editor/src/core/native-text-edit-batch.ts +18 -11
- package/src/extensions/pi-agent-text-editor/src/core/structured-result.ts +43 -209
- package/src/extensions/pi-agent-text-editor/src/core/text-mutation.ts +37 -31
- package/src/extensions/pi-agent-text-editor/src/core/tool-call-interceptor/coordinator.ts +1 -1
- package/src/extensions/pi-agent-text-editor/src/tools/text-tool-schema-properties.ts +2 -7
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-copy.ts +1 -1
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-delete.ts +2 -2
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-move.ts +1 -1
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-replace.ts +1 -1
- package/src/pi-agent-ide.ts +4 -1
- package/src/plugins/pi-agent-ide-ast/package.json +13 -13
- package/src/plugins/pi-agent-ide-ast/src/extension.ts +7 -4
- package/src/plugins/pi-agent-ide-ast/src/search-resolver.ts +35 -6
- package/src/plugins/pi-agent-ide-ast/src/select-presentation.ts +1 -1
- package/src/plugins/pi-agent-ide-ast/src/select-schema.ts +2 -2
- package/src/plugins/pi-agent-ide-ast/src/tool-select.ts +18 -1
- package/src/plugins/pi-agent-ide-changes/index.ts +4 -3
- package/src/plugins/pi-agent-ide-changes/package.json +8 -8
- package/src/plugins/pi-agent-ide-debugger/index.ts +5 -3
- package/src/plugins/pi-agent-ide-diagnostics/src/extension.ts +5 -3
- package/src/plugins/pi-agent-ide-formatter/package.json +3 -3
- package/src/plugins/pi-agent-ide-languages/package.json +2 -2
- package/src/plugins/pi-agent-ide-lint/package.json +7 -7
- package/src/plugins/pi-agent-ide-lsp/index.ts +3 -3
- package/src/plugins/pi-agent-ide-lsp/package.json +9 -9
- package/src/plugins/pi-agent-ide-lsp/src/search-resolver.ts +5 -1
- package/src/plugins/pi-agent-ide-terminal/src/resources.ts +8 -6
- package/src/plugins/pi-agent-ide-vision/index.ts +12 -4
- package/dist/chunk-4NIFBFFR.js +0 -11
- package/dist/chunk-7LZKOHH2.js +0 -1
- package/dist/chunk-FK42RSF4.js +0 -1
- package/dist/chunk-KBP3QUDT.js +0 -2
- package/dist/chunk-OE7QVAI2.js +0 -5
- package/dist/chunk-SILJ3OL4.js +0 -9
- package/dist/chunk-SQKAXYIR.js +0 -2
- package/dist/chunk-VCGNVTXQ.js +0 -1
|
@@ -1,76 +1,65 @@
|
|
|
1
1
|
# Precise text editing
|
|
2
2
|
|
|
3
|
-
Use standalone `replace`, `insert`, `delete`, `copy`, and `move`
|
|
3
|
+
Use standalone `replace`, `insert`, `delete`, `copy`, and `move` when each change is known in advance and does not depend on another change. Submit independent calls together in one response. Use native Codemode for computed or dependent composition; it does not add grouped rollback.
|
|
4
4
|
|
|
5
|
-
Use
|
|
5
|
+
Use `write` only to create a file or deliberately replace all its contents. Use `diff` for read-only comparison.
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
## Selecting text
|
|
7
|
+
## Select the intended text
|
|
10
8
|
|
|
11
9
|
Use a returned anchor when it identifies the intended text. Otherwise use the smallest unique exact string.
|
|
12
10
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
- `
|
|
16
|
-
- `
|
|
17
|
-
-
|
|
18
|
-
- `SEARCH#...:match` — only the exact search match.
|
|
19
|
-
- `begin` and `end` — the first and last existing source lines.
|
|
20
|
-
- A unique exact string — that text fragment itself.
|
|
21
|
-
|
|
22
|
-
With an `end` selector, the operation covers complete lines from the first line containing `start` through the last line containing `end`, inclusive. Without `end`, an exact string targets only that fragment, while a line or structured anchor targets its selected line or range.
|
|
11
|
+
- `LINE#HASH` selects a current source line from the `anchors` view.
|
|
12
|
+
- `scope-begin-HASH` and `scope-end-HASH` mark syntax boundaries from the `ast` view.
|
|
13
|
+
- `SEARCH#...:line` selects a complete containing line; `SEARCH#...:match` selects the exact match.
|
|
14
|
+
- `begin` and `end` select the first and last existing lines.
|
|
15
|
+
- A unique exact string selects that fragment.
|
|
23
16
|
|
|
24
|
-
|
|
17
|
+
With `end`, the operation covers complete lines from the first line containing `start` through the last line containing `end`, inclusive. Without `end`, an exact string selects just that fragment.
|
|
25
18
|
|
|
26
|
-
|
|
19
|
+
After an exact-text selector fails, exact-text edits are blocked for that file. Find the intended location among the returned current anchors, or use Read/Search for another section. Edit with its anchor. After that edit succeeds, exact text is available again. Do not retry a guessed string.
|
|
27
20
|
|
|
28
|
-
|
|
21
|
+
Re-read after a mutation before reusing line, scope, or individual Search anchors. Complete `SEARCH#...:all` selections retain their existing query-refresh behavior.
|
|
29
22
|
|
|
30
|
-
|
|
31
|
-
- `write.path` and `undo.file` require one whole-file target. Partial and multi-file scopes are rejected, not widened.
|
|
32
|
-
- `copy.path` / `move.path` select source ranges; `target` selects exact destination ranges. A zero-width destination inserts. Structured source/destination arrays pair in declared order with equal counts; duplicates are removed. Unequal counts and overlapping moves are rejected.
|
|
33
|
-
- With an ordinary string destination and no text selectors, copy/move require one whole-file source and keep byte-preserving file behavior. String destinations with `targetStart` / `targetEnd` keep their line-based semantics.
|
|
34
|
-
- `insert` still uses its string path and anchors; it does not accept an arbitrary structured input.
|
|
23
|
+
## Compose results
|
|
35
24
|
|
|
36
|
-
|
|
25
|
+
Results are readable text with a leading system-result envelope. The envelope is an internal reference, not file content. Do not edit it or write it into a file. Pass the unchanged result to another source parameter; outside Codemode you can also pass its UUID. Store/load keeps the same string in the current session. No internal fields need to be inspected.
|
|
37
26
|
|
|
38
|
-
|
|
27
|
+
Read results select their requested source windows. Search results select exact matches. Select derives new boundaries. A displayed item reference selects that item; the whole result retains all selections, including those omitted from its preview.
|
|
39
28
|
|
|
40
|
-
|
|
29
|
+
- `replace.path` replaces selected ranges. `delete.path` removes selected text but keeps the file, even for a whole-file selection.
|
|
30
|
+
- `write.path` and `undo.file` require one whole-file selection. Partial and multi-file scopes are rejected, not widened.
|
|
31
|
+
- `copy.path` / `move.path` select source ranges; `target` selects destination ranges. A zero-width destination inserts. Arrays pair in declared order, with equal counts and duplicates removed. Unequal counts and overlapping moves are rejected.
|
|
32
|
+
- Ordinary destination file paths without text selectors require one whole-file source and keep byte-preserving file transfer behavior.
|
|
33
|
+
- `insert` uses line-based insertion before or after its selected containing lines.
|
|
41
34
|
|
|
42
|
-
|
|
35
|
+
Replace/insert results select their resulting text, including supplied line separators. Empty replacement selects the resulting position, not removed text. Copy/move results select only destination text. Whole-file transfers and write select the whole destination; undo selects restored files. Delete and binary operations provide no reusable text selection. If a result cannot supply a verified selection, inspect the file instead.
|
|
43
36
|
|
|
44
|
-
|
|
37
|
+
Results are strict snapshots. Changed files permanently retire their old IDs, even if the old bytes are restored later. Session changes and reloads also retire IDs. Empty selections are valid no-ops; incomplete or expired selections cannot authorize edits. Diff text and invented coordinates do not grant source authority.
|
|
45
38
|
|
|
46
|
-
|
|
39
|
+
## Line separation
|
|
47
40
|
|
|
48
|
-
|
|
41
|
+
Use `separation: "blank-line"` for a separate paragraph or section; use default line mode for adjacent code, list items, or a continuation. Inserting `X` after `A` in `A\nB` with blank-line separation produces `A\n\nX\n\nB`.
|
|
49
42
|
|
|
50
|
-
|
|
43
|
+
## Writes and failures
|
|
51
44
|
|
|
52
|
-
|
|
45
|
+
Independent calls share the original snapshots. Combine overlapping edits into one mutation. A rejected call does not cancel successful peers; retry only unapplied changes.
|
|
53
46
|
|
|
54
|
-
|
|
47
|
+
An omitted path can inherit the file identified by an anchor, the last read, or the preceding edit in the batch. Supply the path when that would be ambiguous.
|
|
55
48
|
|
|
56
|
-
|
|
49
|
+
An ordinary `delete.path` without selectors deletes a complete regular file. A result input removes only selected text. Ordinary copy/move paths without selectors transfer whole files and replace an existing regular destination file.
|
|
57
50
|
|
|
58
|
-
|
|
51
|
+
Inside Codemode, await independent edits on disjoint resources concurrently and overlapping resources in order. Pass a pending edit result directly to another source tool for dependent work; that boundary commits the batch before consuming the result. Await `tools.flush({})` when you need a committed receipt. Its text reports file and operation effects. A failed flush never replays edits.
|
|
59
52
|
|
|
60
|
-
|
|
53
|
+
Failed tools reject in Codemode. Use try/catch or Promise.allSettled when independent calls may fail. Inspect the parent result for actual committed effects: an acceptance is not proof of writing, and an error is not proof of rollback.
|
|
61
54
|
|
|
62
|
-
Formatting and registered
|
|
55
|
+
Formatting and registered post-edit handlers run once per surviving resource at script end, not at flush or dependency boundaries. Reads inside the script see written but not yet formatted text. If final processing changes bytes, repeat Read/Search. Standalone edits finish post-edit work immediately.
|
|
63
56
|
|
|
64
|
-
|
|
57
|
+
Ordinary script errors keep accepted edits. Abort or deadline discards pending writes, not batches that already committed. Inspect final results and retry only unapplied edits.
|
|
65
58
|
|
|
66
59
|
## Specialized resources
|
|
67
60
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
- `
|
|
71
|
-
- `debug:<session>` — `insert` controls the debugger and `delete` removes a breakpoint or terminates the session.
|
|
72
|
-
- `symbol:<file>#<selector>#name` — `replace` performs a native language-server rename when available.
|
|
73
|
-
|
|
74
|
-
Read `docs:terminal`, `docs:debugger`, or `docs:search-code` before using those specialized resources.
|
|
61
|
+
- `shell:<session>`: write sends exact input, insert sends keys, delete terminates the session.
|
|
62
|
+
- `debug:<session>`: insert controls the debugger; delete removes a breakpoint or terminates it.
|
|
63
|
+
- `symbol:<file>#<selector>#name`: replace performs a native language-server rename when available.
|
|
75
64
|
|
|
76
|
-
Never guess after a stale snapshot,
|
|
65
|
+
Read `docs:terminal`, `docs:debugger`, or `docs:search-code` before using these resources. Never guess after a stale snapshot, ambiguous target, incomplete selection, or unknown rollback effect.
|
|
@@ -27,19 +27,15 @@ For `raw:` resources, offsets and limits count bytes. A negative offset counts f
|
|
|
27
27
|
|
|
28
28
|
Temporary resources remain available only in their owning runtime.
|
|
29
29
|
|
|
30
|
-
##
|
|
30
|
+
## Readable results and composition
|
|
31
31
|
|
|
32
|
-
|
|
32
|
+
Read returns the same file text or requested views in direct calls and Codemode. It adds a leading system-result envelope with a UUID. The envelope is an internal reference, not file content; do not edit or insert it into a file. Follow the displayed continuation offset or temp reference for more output. Raw reads show hexadecimal bytes. Nested image reads also deliver their images on the parent Codemode result.
|
|
33
33
|
|
|
34
|
-
|
|
34
|
+
Pass an unchanged result as `read.path`, `search.path`, `select.path` or a supported edit source parameter. Outside Codemode, its UUID works too. Store/load retains these strings within the session. Read results keep their requested source windows, not just the shortened preview. Read-only derived views, bytes, images and directory listings do not gain text-edit authority.
|
|
35
35
|
|
|
36
|
-
|
|
36
|
+
Read of a selected result may show surrounding whole-line context, but later tools remain restricted to its original exact selection. Context does not grant wider edit authority.
|
|
37
37
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
Pass a stored `RESULT#` reference as `read.path` to inspect an exact source selection. Read may show surrounding whole-line context, but its returned target intersects that window with the original selection and keeps input completeness. Context does not grant wider edit authority.
|
|
41
|
-
|
|
42
|
-
Check that a target was returned before composing source operations. Obtain a fresh Read/Search after source bytes change, the session changes, or Pi reloads. New result targets never silently refresh.
|
|
38
|
+
Changed snapshots permanently retire their old IDs, even if the file is restored later. Obtain a fresh Read/Search after changes, session switches or reloads. Unsupported and expired references are errors, not empty results.
|
|
43
39
|
|
|
44
40
|
## Views
|
|
45
41
|
|
|
@@ -12,13 +12,13 @@ Use `files:<pattern>` for paths. Slash-containing globs match workspace-relative
|
|
|
12
12
|
|
|
13
13
|
Use possible-name groups as spelling hints, not synonyms or proof of equivalent behavior. Inspect the candidate source before choosing an edit. The original match list stays empty; each group is a separate exact alternative in the same scope.
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
Inspect the displayed possible-name groups and their completeness separately. The whole Search result still selects the original empty match set, not a suggested alternative. Use the chosen group's returned references to inspect or edit that alternative. A candidate all-reference refreshes only its exact alternative, not the fuzzy ranking. For URL groups, read the returned URL and line range; no editable Search references exist. Result-scoped queries stay exact and do not run this extra branch.
|
|
16
16
|
|
|
17
17
|
If the extra branch reports a budget skip, narrow `path` rather than treating the skip as proof that no nearby name exists. Keep quoted exact queries, Boolean queries, and explicit protocols exact.
|
|
18
18
|
|
|
19
19
|
## Search resources
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
Search returns readable matches and references in direct calls and Codemode. An empty successful search is not an error. Incomplete results say so; do not treat their zero matches as proof of absence.
|
|
22
22
|
|
|
23
23
|
Local text results expose `SEARCH#HASH:N:line` for its containing line and `SEARCH#HASH:N:match` for the exact match. Complete selections use `:all:line` or `:all:match`. Pass these references directly to read or editing tools; omit the file path when an all-selection spans files.
|
|
24
24
|
|
|
@@ -26,40 +26,35 @@ A single-result reference becomes stale after its file changes. Re-run the searc
|
|
|
26
26
|
|
|
27
27
|
## Searching returned scopes
|
|
28
28
|
|
|
29
|
-
Pass
|
|
29
|
+
Pass an unchanged Read/Search/Select/edit result, its UUID or a `RESULT#` reference as `path`. Arrays of registered results also work. Local text, `regex:`, `ast:`, and `symbols:` queries search their exact ranges. Sparse ranges and files stay separate; gaps and neighboring text are not searched.
|
|
30
30
|
|
|
31
|
-
A replace/insert result searches only that call's resulting text, including an empty resulting position. Copy/move search only destination text; whole-file transfers, write and undo search whole resulting files. Delete and restored absence have no live text target. In
|
|
31
|
+
A replace/insert result searches only that call's resulting text, including an empty resulting position. Copy/move search only destination text; whole-file transfers, write and undo search whole resulting files. Delete and restored absence have no live text target. In Codemode, passing a pending result commits the batch first. Final formatting runs at script end; results from before changed formatting become stale, not silently rebound.
|
|
32
32
|
|
|
33
|
-
|
|
33
|
+
Use a displayed item or capture reference for a subset. The whole result retains its complete stored scope; editing copied preview text never narrows that scope.
|
|
34
34
|
|
|
35
|
-
|
|
35
|
+
Incomplete scopes cannot authorize edits, even through non-empty subsets. Empty arrays select no sources; they do not default to the workspace. Result-scoped text Boolean queries and text include/exclude globs remain unsupported. AST and LSP providers retain their own path/glob filters. File/process and unsupported provider scopes fail without widening the scope.
|
|
36
36
|
|
|
37
37
|
## AST search
|
|
38
38
|
|
|
39
39
|
Use `ast:<pattern>` for syntax-aware matching. `$NAME` captures one syntax node and `$$$BODY` captures several nodes. Returned search references can select multiline matches for read, replace, copy, move, and delete. An incomplete result does not provide a complete all-selection. Text replacement through an AST selection does not update imports or references automatically.
|
|
40
40
|
|
|
41
|
-
|
|
41
|
+
Use the displayed `capture NAME: RESULT#...` reference to Search or edit a capture without Select. It belongs to that parent match and retains every captured node, including punctuation. Its node count does not change the selection. An empty capture selects nothing; an absent capture has no reference. AST matches and captures must be wholly contained in one requested region; they are not clipped at a scope boundary.
|
|
42
42
|
|
|
43
43
|
```js
|
|
44
44
|
const window = await tools.read({ path: "client.ts", offset: 10, limit: 4 });
|
|
45
|
-
if (window.status !== "success") throw Error(JSON.stringify(window.errors));
|
|
46
45
|
const calls = await tools.search({ path: window, query: "ast:request($OPTIONS)" });
|
|
47
|
-
|
|
48
|
-
const options = calls.data.matches[0]?.captures.OPTIONS;
|
|
49
|
-
if (options === undefined) throw Error("No captured options");
|
|
50
|
-
const values = await tools.search({ path: options, query: "1000" });
|
|
51
|
-
if (values.status !== "success") throw Error(JSON.stringify(values.errors));
|
|
52
|
-
const changed = await tools.replace({ path: values, text: "2000" });
|
|
53
|
-
text(changed);
|
|
46
|
+
text(calls);
|
|
54
47
|
```
|
|
55
48
|
|
|
49
|
+
Use its displayed OPTIONS reference in the next call. Store/load keeps these result strings across Codemode scripts within the same session.
|
|
50
|
+
|
|
56
51
|
## Symbols and graphs
|
|
57
52
|
|
|
58
53
|
Use `symbols:<query>` to locate declarations and references when the source file is unknown. Use `symbol:<file>#<selector>` to read one declaration. Use `graph:<file>` for the file's top-level declarations and relationships, or `graph:<file>#<selector>` for incoming and outgoing references of one declaration.
|
|
59
54
|
|
|
60
|
-
Pass a result scope to `symbols:` for strict discovery inside its exact ranges.
|
|
55
|
+
Pass a result scope to `symbols:` for strict discovery inside its exact ranges. Read the displayed definition/reference and symbol information. Name equality alone does not establish reference identity.
|
|
61
56
|
|
|
62
|
-
Use `navigation: "references"` only when following symbols represented inside the input scope to references outside it. Navigation stays within the workspace. Path and globs define the seed scope in this mode, not the destination references. Omit navigation for strict discovery.
|
|
57
|
+
Use `navigation: "references"` only when following symbols represented inside the input scope to references outside it. Navigation stays within the workspace. Path and globs define the seed scope in this mode, not the destination references. Omit navigation for strict discovery. Incomplete, failed or unavailable provider results do not prove absence. Text replacement through an LSP match changes only that range; it is not semantic rename.
|
|
63
58
|
|
|
64
59
|
Append `#name` to an exact symbol resource only for a native language-server rename across references. If semantic support is unavailable, use a precise text or AST operation instead of pretending it was a semantic rename. Pending or empty language-server output does not prove that no declaration or reference exists.
|
|
65
60
|
|
|
@@ -1,151 +1,101 @@
|
|
|
1
1
|
# Select source boundaries
|
|
2
2
|
|
|
3
|
-
Use Search
|
|
3
|
+
Use Search for predicates and existing captures. Use Select to derive new text or syntax boundaries. Pass the unchanged Read/Search/Select/edit result as `path`; ordinary paths and returned item references also work. Outside Codemode, you can pass the result's UUID.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Select returns readable selected text with item references. The whole result retains all selected ranges, even when its preview is shortened. Use a displayed item reference when you need only that item. Do not build a selection from copied preview text or invented coordinates.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
## Syntax operations
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
Syntax operations support JavaScript (.js/.mjs/.cjs) and TypeScript (.ts/.mts/.cts), without JSX/TSX. Missing providers and syntax errors are errors, not evidence of absence. Text operations need no parser.
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
### Enclosing constructs
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
`{kind:"object", object:"function"}` selects the nearest function containing the entire seed. An exact function selects itself. `level:2` selects the next outer function; levels count only the requested category. A seed crossing separate constructs is rejected. Enclosing can expand outside the original window and reports that expansion.
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
- call: calls and new expressions.
|
|
17
|
-
- class, if, switch, loop (for/for-in/for-of/while/do), try and catch.
|
|
18
|
-
- binding: a variable declarator, not the surrounding const/let/var statement. assignment: ordinary and compound assignment expressions.
|
|
19
|
-
- object/array: literals and destructuring patterns; property: key/value pairs and shorthand object properties.
|
|
20
|
-
- return and throw.
|
|
15
|
+
Supported categories: function, call, class, if, switch, loop, try, catch, binding, assignment, object, property, array, return and throw. Call includes new expressions. Function includes methods, arrows, async/generator forms and bodyless TS signatures. Default parameter expressions belong to their function. Binding selects one variable declarator, not the whole declaration statement.
|
|
21
16
|
|
|
22
|
-
These are syntax categories, not
|
|
17
|
+
These are syntax categories, not semantic identities. Parser-only wrappers, punctuation, comments, class fields, JSX/TSX and unlisted forms do not become extra categories. `ownBody` is not implemented.
|
|
23
18
|
|
|
24
19
|
### Navigate
|
|
25
20
|
|
|
26
|
-
|
|
21
|
+
`{kind:"navigate", relation:"parent"}` requires an exact named syntax node and skips parser-only wrappers. Exact parts and captures work; first use enclosing when a range cuts through a node. A whole-file seed is not implicitly split into functions.
|
|
27
22
|
|
|
28
|
-
- parent
|
|
29
|
-
- ancestors
|
|
30
|
-
- children
|
|
31
|
-
- siblings
|
|
23
|
+
- parent selects the nearest normalized ancestor, excluding the starting node.
|
|
24
|
+
- ancestors selects all normalized ancestors in source order.
|
|
25
|
+
- children selects nearest nested constructs; descendants selects all nested constructs.
|
|
26
|
+
- siblings selects other constructs with the same normalized parent. previous/next selects the immediate neighbor; all selects every sibling. Missing neighbors are valid absence.
|
|
32
27
|
|
|
33
|
-
|
|
28
|
+
An `object` filter is applied after navigation; it never changes topology. Parent with object:function does not jump past an intervening call. Children with object:call does not jump through an if. Use ancestors/descendants for deeper matches.
|
|
34
29
|
|
|
35
|
-
Ancestors and descendants can overlap.
|
|
30
|
+
Ancestors and descendants can overlap. Narrow to disjoint targets before editing; edit tools reject overlapping writes.
|
|
36
31
|
|
|
37
32
|
### Named parts
|
|
38
33
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
| Construct
|
|
42
|
-
|
|
|
43
|
-
| function
|
|
44
|
-
| call/new
|
|
45
|
-
| class
|
|
46
|
-
| if
|
|
47
|
-
| switch
|
|
48
|
-
| classic for
|
|
49
|
-
| for-in / for-of
|
|
50
|
-
| while / do
|
|
51
|
-
| try
|
|
52
|
-
| catch
|
|
53
|
-
| finally clause
|
|
54
|
-
| binding
|
|
55
|
-
| assignment
|
|
56
|
-
| property
|
|
57
|
-
| return / throw
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
Structural items include parser-derived syntax.object and, for part selections, syntax.part where a normalized owner exists. These labels are descriptive, not editable authority. Read takes the item's target string; its displayed line context never widens the exact part's source scope.
|
|
34
|
+
`{kind:"part", part:"arguments"}` requires an exact construct. Parts keep their delimiters: block bodies include braces, argument/parameter lists include parentheses, annotations include colons, and else/finalizer clauses include their keywords. Expression arrow bodies are exact expressions.
|
|
35
|
+
|
|
36
|
+
| Construct | Supported parts |
|
|
37
|
+
| --------------- | ---------------------------------------------------------- |
|
|
38
|
+
| function | name, parameters, returnType, body |
|
|
39
|
+
| call/new | callee, arguments |
|
|
40
|
+
| class | name, body |
|
|
41
|
+
| if | condition, then, else |
|
|
42
|
+
| switch | condition, body |
|
|
43
|
+
| classic for | initializer, condition, update, body |
|
|
44
|
+
| for-in / for-of | left, iterable, body |
|
|
45
|
+
| while / do | condition, body |
|
|
46
|
+
| try | body, handler, finalizer |
|
|
47
|
+
| catch | parameter, body |
|
|
48
|
+
| finally clause | body |
|
|
49
|
+
| binding | name, type, value |
|
|
50
|
+
| assignment | left, right |
|
|
51
|
+
| property | key, value; shorthand selects the same identifier for both |
|
|
52
|
+
| return / throw | value |
|
|
53
|
+
|
|
54
|
+
An absent optional part produces no selection. An unsupported part reports available names. Objects and arrays do not invent body or arguments parts.
|
|
62
55
|
|
|
63
56
|
```js
|
|
64
57
|
const found = await tools.search({ path: "client.ts", query: "ast:send($$$ARGS)" });
|
|
65
58
|
const call = await tools.select({ path: found, operation: { kind: "object", object: "call" } });
|
|
66
59
|
const args = await tools.select({ path: call, operation: { kind: "part", part: "arguments" } });
|
|
67
|
-
await tools.read({ path: args
|
|
60
|
+
text(await tools.read({ path: args }));
|
|
68
61
|
const number = await tools.search({ path: args, query: "10" });
|
|
69
62
|
await tools.replace({ path: number, text: "20" });
|
|
70
63
|
```
|
|
71
64
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
Use `{kind:"elementExtent", extent:"inside"}` on an exact direct JS/TS call/new argument or parenthesized function/method/arrow parameter. AST captures can provide those element targets. Variadic captures may also contain punctuation; choose the element items in JavaScript before passing them here. Commas themselves are not elements. A typed/default parameter must include its type/default, not just its name. Partial expressions, whole lists, array/object elements and unparenthesized arrow parameters are unsupported; this operation never silently selects an enclosing element.
|
|
75
|
-
|
|
76
|
-
`inside` keeps only the element. `around` adds owned comma/whitespace, reports expansion and preserves list parentheses:
|
|
65
|
+
### List element extents
|
|
77
66
|
|
|
78
|
-
|
|
79
|
-
| ----------------------------------- | -------------------------------------------------------------------------------------- |
|
|
80
|
-
| First or middle with a next element | Element through the next element's start, including the following comma and whitespace |
|
|
81
|
-
| Last with a trailing comma | Element through the closing parenthesis, excluding the parenthesis |
|
|
82
|
-
| Last without a trailing comma | Previous element's end through this element's end; keeps closing whitespace |
|
|
83
|
-
| Only element | Entire list interior, including leading/trailing whitespace and any trailing comma |
|
|
67
|
+
`{kind:"elementExtent", extent:"inside"}` requires an exact direct call/new argument or parenthesized function parameter. Use a displayed Search capture reference for that element. Variadic captures can include punctuation; punctuation is not an element. Typed/default parameters must include their type/default.
|
|
84
68
|
|
|
85
|
-
|
|
69
|
+
Inside keeps the element. Around adds owned comma/whitespace and preserves list parentheses. First/middle elements own the following gap. A last element with a trailing comma owns that following gap; without one it owns the preceding gap. An only element owns the whole list interior.
|
|
86
70
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
Copy/move transports precisely the selected bytes, not a refactoring. A following-comma extent can be inserted before an existing destination element; a preceding-comma extent can be inserted after one. Destination syntax, parameter ordering and semantic validity are the caller's responsibility. Read the extent's target to preview it before editing. No new edit input contract or implicit syntax repair is provided.
|
|
90
|
-
|
|
91
|
-
```js
|
|
92
|
-
const found = await tools.search({ path: "client.ts", query: "ast:send($FIRST, $MIDDLE, $LAST)" });
|
|
93
|
-
const element = await tools.select({
|
|
94
|
-
path: found.data.matches[0].captures.MIDDLE,
|
|
95
|
-
operation: { kind: "elementExtent", extent: "around" },
|
|
96
|
-
});
|
|
97
|
-
await tools.read({ path: element.data.target });
|
|
98
|
-
await tools.delete({ path: element });
|
|
99
|
-
```
|
|
71
|
+
Adjacent comments make around ambiguous; inside remains available. Several around extents may overlap, so do not assume bulk deletion repairs syntax. Copy/move transports exact selected bytes, not a refactoring. Destination syntax and parameter ordering remain the caller's responsibility. Arrays, objects, partial expressions, whole lists and unparenthesized arrow parameters are unsupported here.
|
|
100
72
|
|
|
101
73
|
## Text operations
|
|
102
74
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
-
|
|
106
|
-
-
|
|
107
|
-
-
|
|
108
|
-
-
|
|
109
|
-
-
|
|
110
|
-
-
|
|
111
|
-
-
|
|
112
|
-
- `position` with edge before/after returns each region's zero-width start/end. Use a whole-file Read for file edges.
|
|
113
|
-
- `columns` with from/to returns the exclusive UTF-16 column interval on each touched line, without line endings. Every interval must fit both its line and input scope.
|
|
114
|
-
|
|
115
|
-
Except for range/lines, apply each operation independently to every input region. Keep files and sparse gaps separate; markers or delimiters cannot span those gaps. Invalid bounds, short-line columns and boundaries inside surrogate pairs or CRLF are errors, not clipped ranges. Preserve original CRLF/LF/bare-CR endings and unterminated EOF. Only linesOf and between/lines explicitly expand text input and report expansion.
|
|
116
|
-
|
|
117
|
-
Resolve registered anchors through existing Read inputs, then pass their verified target to Select. Use Search for regex captures rather than a second regex language inside Select. Use JavaScript array slice/filter to choose items; use sliceText to derive source boundaries.
|
|
118
|
-
|
|
119
|
-
```js
|
|
120
|
-
const source = await tools.read({ path: "notes.txt", offset: 2, limit: 1 });
|
|
121
|
-
const inside = await tools.select({
|
|
122
|
-
path: source,
|
|
123
|
-
operation: { kind: "between", start: "<", end: ">", extent: "inside" },
|
|
124
|
-
});
|
|
125
|
-
const value = await tools.select({
|
|
126
|
-
path: inside,
|
|
127
|
-
operation: { kind: "trim", side: "both" },
|
|
128
|
-
});
|
|
129
|
-
await tools.read({ path: value.data.target });
|
|
130
|
-
await tools.replace({ path: value, text: "new value" });
|
|
131
|
-
```
|
|
75
|
+
- range: absolute startLine/startColumn/endLine/endColumn in one source; lines are one-based, columns UTF-16, end exclusive. Must fit one input region.
|
|
76
|
+
- lines: inclusive first/last complete source lines, including existing endings; must fit one region.
|
|
77
|
+
- between: pairs each non-empty start marker with the nearest following end, without nesting, then resumes after the pair. Extent inside excludes markers, around includes them, lines expands to containing lines. Unmatched openings are errors; no openings is valid absence.
|
|
78
|
+
- sliceText: relative UTF-16 from/to in each region; to is exclusive and defaults to its end. Equal offsets select a point.
|
|
79
|
+
- trim: removes whitespace from start/end/both edges. Whitespace-only input selects a point at its end.
|
|
80
|
+
- split: divides by a non-empty literal delimiter, excluding delimiters and retaining empty segments as points.
|
|
81
|
+
- linesOf: expands to complete containing lines. An exclusive end at next-line column zero does not include that line.
|
|
82
|
+
- position: before/after points of each region. Use a whole-file Read for file edges.
|
|
83
|
+
- columns: exclusive from/to columns on each touched line, excluding endings. Every interval must fit its line and input scope.
|
|
132
84
|
|
|
133
|
-
|
|
85
|
+
Except for range/lines, operations apply independently to each region. Sparse gaps stay separate. Markers cannot cross gaps. Bounds inside surrogate pairs or CRLF are errors; ranges are never silently clipped. Only linesOf and between/lines explicitly expand text input.
|
|
134
86
|
|
|
135
87
|
## Range sets
|
|
136
88
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
- within retains a complete candidate only when one scope contains it. It does not clip or join adjacent scopes for containment.
|
|
140
|
-
- intersection clips each candidate to the union of comparison scopes.
|
|
141
|
-
- difference subtracts the union of scopes from each candidate and returns separate surviving fragments.
|
|
142
|
-
- merge explicitly joins overlapping candidates. Set adjacent:true to also join touching nonempty ranges; default false. Never fill a real gap.
|
|
89
|
+
Pass candidates in `path` and comparison results in `operation.scopes`. Both accept unchanged results, issued references or arrays. Match by source and snapshot, not array order. Every input is verified, even without a counterpart.
|
|
143
90
|
|
|
144
|
-
|
|
91
|
+
- within retains a candidate only if one scope contains it; no clipping or joining for containment.
|
|
92
|
+
- intersection clips each candidate to the union of scopes.
|
|
93
|
+
- difference subtracts scopes and retains separate surviving fragments.
|
|
94
|
+
- merge joins overlapping candidates. adjacent:true also joins touching nonempty ranges, never real gaps.
|
|
145
95
|
|
|
146
|
-
|
|
96
|
+
Points belong to a nonempty range at its included start, not its excluded end. Equal points match. Intersection with a contained point keeps it; touching ranges do not create points. Difference removes covered candidate points but point scopes do not cut text. Merge absorbs covered points without extending ranges. EOF points are outside a range ending at EOF.
|
|
147
97
|
|
|
148
|
-
Empty
|
|
98
|
+
Empty scopes make within/intersection empty and difference unchanged. Incomplete inputs cannot establish absence or authorize edits. Select never writes or formats.
|
|
149
99
|
|
|
150
100
|
```js
|
|
151
101
|
const candidates = await tools.search({ path: "notes.txt", query: "regex:<[^>]+>" });
|
|
@@ -158,37 +108,8 @@ const found = await tools.search({ path: editable, query: "old" });
|
|
|
158
108
|
await tools.replace({ path: found, text: "new" });
|
|
159
109
|
```
|
|
160
110
|
|
|
161
|
-
##
|
|
162
|
-
|
|
163
|
-
path accepts compatible Read/Search/mutation/Select results, their data, RESULT# references and arrays of returned items. A file path obtains a fresh whole-file Read snapshot; the chosen operation still must make sense for that entire seed. A multi-function file is not implicitly split into functions.
|
|
164
|
-
|
|
165
|
-
The result has kind selection, a complete stored target, items with individual targets, exact ranges and original-input associations, complete, totalItems, missingInputs and truncated. Lines are one-based and columns are UTF-16; character ends are exclusive. Identical output geometry is deduplicated while origins retain the separate input ranges. Empty results remain valid source sets. Unsupported part inputs, ambiguity and stale/expired inputs are errors.
|
|
166
|
-
|
|
167
|
-
Items are limited to 100 and each text preview to 1000 UTF-16 code units. truncated describes presentation, not execution completeness. The top-level target retains all selected ranges. complete inherits input completeness; an incomplete result cannot establish absence or safely authorize edits. Source snapshots stay strict: refresh Read/Search after edits, session changes or reload. Select never writes or runs formatting.
|
|
168
|
-
|
|
169
|
-
## Compose with existing tools
|
|
170
|
-
|
|
171
|
-
```js
|
|
172
|
-
const calls = await tools.search({ path: "client.ts", query: "ast:legacyRequest($OPTIONS)" });
|
|
173
|
-
const owners = await tools.select({
|
|
174
|
-
path: calls,
|
|
175
|
-
operation: {
|
|
176
|
-
kind: "object",
|
|
177
|
-
object: "function",
|
|
178
|
-
relation: "enclosing",
|
|
179
|
-
level: 1,
|
|
180
|
-
extent: "around",
|
|
181
|
-
},
|
|
182
|
-
});
|
|
183
|
-
const body = await tools.select({
|
|
184
|
-
path: owners.data.items[0],
|
|
185
|
-
operation: { kind: "part", part: "body" },
|
|
186
|
-
});
|
|
187
|
-
const retry = await tools.search({ path: body, query: "ast:retry($$$ARGS)" });
|
|
188
|
-
```
|
|
189
|
-
|
|
190
|
-
A body includes nested functions. To test for retry in that function's own body, select each retry call's nearest enclosing function and compare its source/range to the original owner. This keeps outer retry calls containing callbacks while excluding calls in nested functions or their default parameters. Do not establish absence from incomplete Search or clipped items.
|
|
111
|
+
## Composition limits
|
|
191
112
|
|
|
192
|
-
|
|
113
|
+
Read may show whole-line context around a selection, but later tools remain within its exact selected ranges. Whole-file write/undo reject partial selections. Insert remains line-based. Changed files, new sessions and reloads retire IDs; final Codemode formatting may also retire earlier results.
|
|
193
114
|
|
|
194
|
-
|
|
115
|
+
A function body includes nested functions. To check a call in a function's own body, compare the call's nearest enclosing function with the original owner using their source-local selections. Syntax names alone do not establish semantic identity. Do not establish absence from incomplete results.
|