pi-agent-ide 0.7.0 → 0.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +44 -0
- package/dist/chunk-6U5OU77O.js +3 -0
- package/dist/{chunk-6CZO43OH.js → chunk-BU7IZLKB.js} +1 -1
- package/dist/chunk-EURHXLN3.js +2 -0
- package/dist/{chunk-PYPPV2F5.js → chunk-F6IWZKOG.js} +6 -6
- package/dist/{chunk-GBLKIB6O.js → chunk-H445SHSJ.js} +2 -2
- package/dist/chunk-IG56UGSO.js +2 -0
- package/dist/chunk-IICJXZBU.js +6 -0
- package/dist/{chunk-XYS4FSCC.js → chunk-IM24DB3K.js} +1 -1
- package/dist/{chunk-YRF7OATP.js → chunk-KOVPDKSJ.js} +1 -1
- package/dist/chunk-MXLSGMRZ.js +3 -0
- package/dist/chunk-NRZO5KJT.js +9 -0
- package/dist/chunk-OB46OPMZ.js +1 -0
- package/dist/chunk-PKSQT6TC.js +1 -0
- package/dist/{chunk-PNU3E7IO.js → chunk-Q6CZ6GBR.js} +2 -2
- package/dist/{chunk-EDURPQAV.js → chunk-QRJLIV6P.js} +6 -6
- package/dist/chunk-QUYXINGZ.js +7 -0
- package/dist/{chunk-OBNING2A.js → chunk-S5PL5DFQ.js} +1 -1
- package/dist/chunk-SBP3ABH4.js +5 -0
- package/dist/{chunk-FXNKMNSJ.js → chunk-SJ4UZ4GU.js} +1 -1
- package/dist/chunk-SNF7PDDX.js +11 -0
- package/dist/{chunk-AJRIASPQ.js → chunk-STBJO3Z3.js} +1 -1
- package/dist/{chunk-3HYXQ4YA.js → chunk-TQGE7RH6.js} +13 -13
- package/dist/{chunk-S5LXX32D.js → chunk-XDG7EQRN.js} +3 -3
- package/dist/{chunk-F5YZG77W.js → chunk-XH5WN5XA.js} +1 -1
- package/dist/chunk-YWQS33DF.js +1 -0
- package/dist/chunk-ZIWPKIBZ.js +1 -0
- 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 +15 -13
- package/dist/entry-33.js +2 -1
- package/dist/entry-37.js +6 -6
- package/dist/entry-41.js +1 -1
- package/dist/entry-42.js +1 -1
- package/dist/entry-43.js +1 -1
- package/dist/entry-44.js +1 -1
- package/dist/entry-45.js +20 -13
- 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 +8 -7
- package/dist/entry-52.js +1 -1
- 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-66.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 +51 -43
- package/dist/entry-78.js +14 -14
- package/dist/entry-79.js +1 -1
- package/dist/entry-80.js +1 -1
- package/dist/entry-82.js +5 -5
- 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 +37 -9
- package/docs/agent-guides/editing.md +35 -46
- package/docs/agent-guides/git-changes.md +10 -0
- package/docs/agent-guides/read-resources.md +9 -50
- package/docs/agent-guides/search-code.md +18 -17
- package/docs/agent-guides/select-code.md +62 -140
- package/docs/agent-guides/terminal.md +9 -1
- package/docs/configuration.md +1 -1
- package/docs/releases.md +4 -0
- package/docs/research/native-codemode-batch-decision.md +2 -0
- package/docs/structured-results.md +27 -62
- package/docs/tools.md +15 -11
- 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-jq/src/jq.ts +4 -1
- 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 +5 -4
- package/node_modules/pi-agent-ide-ast/src/overflow-handler.ts +2 -2
- package/node_modules/pi-agent-ide-ast/src/search-resolver.ts +35 -9
- package/node_modules/pi-agent-ide-ast/src/select-presentation.ts +1 -1
- package/node_modules/pi-agent-ide-ast/src/select-schema.ts +10 -8
- package/node_modules/pi-agent-ide-ast/src/tool-select.ts +28 -3
- 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-changes/src/tool-index-change.ts +66 -4
- package/node_modules/pi-agent-ide-changes/src/tool-text-undo.ts +8 -11
- 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 -2
- 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 +18 -1
- package/node_modules/pi-agent-read/src/core/extension.ts +8 -2
- package/node_modules/pi-agent-read/src/core/read-core.ts +54 -35
- package/node_modules/pi-agent-read/src/core/tools/read/output-truncation.ts +91 -18
- package/node_modules/pi-agent-read/src/core/tools/read/raw-read.ts +8 -2
- package/node_modules/pi-agent-read/src/core/tools/read/read-renderer.ts +38 -1
- package/node_modules/pi-agent-read/src/core/tools/read/read-result.ts +57 -2
- 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 +108 -46
- package/node_modules/pi-agent-resource/package.json +1 -1
- package/node_modules/pi-agent-resource/src/index.ts +1 -0
- package/node_modules/pi-agent-resource/src/result-targets.ts +186 -9
- package/node_modules/{pi-agent-read/src/core/tools/read → pi-agent-resource/src}/temp-resource-store.ts +17 -7
- 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/fuzzy.ts +5 -1
- package/node_modules/pi-agent-search/src/api/search-parameters.ts +3 -3
- package/node_modules/pi-agent-search/src/core/extension.ts +2 -1
- package/node_modules/pi-agent-search/src/core/search-core.ts +13 -4
- 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-search-text/src/resolvers.ts +11 -1
- package/node_modules/pi-agent-search-text/src/scoped-search.ts +1 -1
- package/node_modules/pi-agent-search-text/src/search-presentation.ts +42 -32
- package/node_modules/pi-agent-search-text/src/search-recipe.ts +1 -1
- package/node_modules/pi-agent-search-text/src/search-renderer.ts +6 -0
- package/node_modules/pi-agent-search-text/src/search-result.ts +17 -3
- 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/edit-completion.ts +2 -2
- package/node_modules/pi-agent-text-editor/src/api/mutation-result.ts +2 -1
- package/node_modules/pi-agent-text-editor/src/api/native-edit-batch-event.ts +4 -0
- package/node_modules/pi-agent-text-editor/src/api/stale-anchor-message.ts +1 -1
- package/node_modules/pi-agent-text-editor/src/core/diff-tool.ts +54 -12
- package/node_modules/pi-agent-text-editor/src/core/editing-guidelines.ts +1 -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/mutation-result/file-mutation-agent-result.ts +35 -6
- package/node_modules/pi-agent-text-editor/src/core/mutation-result/file-mutation-result.ts +19 -1
- package/node_modules/pi-agent-text-editor/src/core/mutation-result-targets.ts +132 -11
- package/node_modules/pi-agent-text-editor/src/core/native-text-edit-batch.ts +232 -144
- package/node_modules/pi-agent-text-editor/src/core/post-edit-scope.ts +34 -10
- package/node_modules/pi-agent-text-editor/src/core/result-input.ts +24 -4
- package/node_modules/pi-agent-text-editor/src/core/result-transfer.ts +7 -2
- package/node_modules/pi-agent-text-editor/src/core/structured-result.ts +49 -214
- package/node_modules/pi-agent-text-editor/src/core/text-change-engine.ts +5 -1
- package/node_modules/pi-agent-text-editor/src/core/text-edit-batch-registrar.ts +152 -22
- package/node_modules/pi-agent-text-editor/src/core/text-edit-batch.ts +4 -0
- package/node_modules/pi-agent-text-editor/src/core/text-editor-core.ts +76 -32
- package/node_modules/pi-agent-text-editor/src/core/text-mutation.ts +409 -209
- 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 +6 -9
- package/node_modules/pi-agent-text-editor/src/tools/tool-text-copy.ts +10 -3
- package/node_modules/pi-agent-text-editor/src/tools/tool-text-delete.ts +9 -4
- package/node_modules/pi-agent-text-editor/src/tools/tool-text-insert.ts +7 -8
- 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 +3 -4
- package/node_modules/pi-agent-text-editor/src/tools/tool-text-write.ts +10 -4
- package/node_modules/pi-agent-text-editor-renderer/package.json +5 -5
- package/node_modules/pi-agent-text-editor-renderer/src/mutation-panel.ts +11 -0
- package/node_modules/pi-agent-text-editor-renderer/src/renderer.ts +54 -5
- package/node_modules/pi-agent-text-editor-renderer/src/status-summary.ts +18 -3
- 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/src/resolver.ts +11 -13
- 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/nested-tool-rendering.ts +64 -6
- package/src/composite/output-limits.ts +125 -0
- package/src/composite/responses-tools.ts +25 -0
- package/src/composite/text-results.ts +372 -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-jq/src/jq.ts +4 -1
- 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/extensions/pi-agent-web/src/resolver.ts +11 -13
- 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 +18 -1
- package/src/extensions/pi-agent-read/src/core/extension.ts +8 -2
- package/src/extensions/pi-agent-read/src/core/read-core.ts +54 -35
- package/src/extensions/pi-agent-read/src/core/tools/read/output-truncation.ts +91 -18
- package/src/extensions/pi-agent-read/src/core/tools/read/raw-read.ts +8 -2
- package/src/extensions/pi-agent-read/src/core/tools/read/read-renderer.ts +38 -1
- package/src/extensions/pi-agent-read/src/core/tools/read/read-result.ts +57 -2
- 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 +108 -46
- 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/plugins/pi-agent-search-text/src/resolvers.ts +11 -1
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/scoped-search.ts +1 -1
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-presentation.ts +42 -32
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-recipe.ts +1 -1
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-renderer.ts +6 -0
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-result.ts +17 -3
- package/src/extensions/pi-agent-search/src/api/fuzzy.ts +5 -1
- package/src/extensions/pi-agent-search/src/api/search-parameters.ts +3 -3
- package/src/extensions/pi-agent-search/src/core/extension.ts +2 -1
- package/src/extensions/pi-agent-search/src/core/search-core.ts +13 -4
- 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-renderer/src/mutation-panel.ts +11 -0
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/renderer.ts +54 -5
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/status-summary.ts +18 -3
- 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/edit-completion.ts +2 -2
- package/src/extensions/pi-agent-text-editor/src/api/mutation-result.ts +2 -1
- package/src/extensions/pi-agent-text-editor/src/api/native-edit-batch-event.ts +4 -0
- package/src/extensions/pi-agent-text-editor/src/api/stale-anchor-message.ts +1 -1
- package/src/extensions/pi-agent-text-editor/src/core/diff-tool.ts +54 -12
- package/src/extensions/pi-agent-text-editor/src/core/editing-guidelines.ts +1 -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/mutation-result/file-mutation-agent-result.ts +35 -6
- package/src/extensions/pi-agent-text-editor/src/core/mutation-result/file-mutation-result.ts +19 -1
- package/src/extensions/pi-agent-text-editor/src/core/mutation-result-targets.ts +132 -11
- package/src/extensions/pi-agent-text-editor/src/core/native-text-edit-batch.ts +232 -144
- package/src/extensions/pi-agent-text-editor/src/core/post-edit-scope.ts +34 -10
- package/src/extensions/pi-agent-text-editor/src/core/result-input.ts +24 -4
- package/src/extensions/pi-agent-text-editor/src/core/result-transfer.ts +7 -2
- package/src/extensions/pi-agent-text-editor/src/core/structured-result.ts +49 -214
- package/src/extensions/pi-agent-text-editor/src/core/text-change-engine.ts +5 -1
- package/src/extensions/pi-agent-text-editor/src/core/text-edit-batch-registrar.ts +152 -22
- package/src/extensions/pi-agent-text-editor/src/core/text-edit-batch.ts +4 -0
- package/src/extensions/pi-agent-text-editor/src/core/text-editor-core.ts +76 -32
- package/src/extensions/pi-agent-text-editor/src/core/text-mutation.ts +409 -209
- 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 +6 -9
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-copy.ts +10 -3
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-delete.ts +9 -4
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-insert.ts +7 -8
- 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 +3 -4
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-write.ts +10 -4
- package/src/pi-agent-ide.ts +15 -1
- package/src/plugins/pi-agent-ide-ast/package.json +13 -13
- package/src/plugins/pi-agent-ide-ast/src/extension.ts +5 -4
- package/src/plugins/pi-agent-ide-ast/src/overflow-handler.ts +2 -2
- package/src/plugins/pi-agent-ide-ast/src/search-resolver.ts +35 -9
- package/src/plugins/pi-agent-ide-ast/src/select-presentation.ts +1 -1
- package/src/plugins/pi-agent-ide-ast/src/select-schema.ts +10 -8
- package/src/plugins/pi-agent-ide-ast/src/tool-select.ts +28 -3
- 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-changes/src/tool-index-change.ts +66 -4
- package/src/plugins/pi-agent-ide-changes/src/tool-text-undo.ts +8 -11
- package/src/plugins/pi-agent-ide-debugger/index.ts +22 -10
- package/src/plugins/pi-agent-ide-debugger/src/dap-client.ts +5 -0
- package/src/plugins/pi-agent-ide-debugger/src/session-manager.ts +93 -38
- package/src/plugins/pi-agent-ide-diagnostics/src/extension.ts +6 -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 -2
- package/src/plugins/pi-agent-ide-terminal/src/output-limits.ts +3 -3
- package/src/plugins/pi-agent-ide-terminal/src/resources.ts +8 -6
- package/src/plugins/pi-agent-ide-terminal/src/tools.ts +3 -3
- package/src/plugins/pi-agent-ide-vision/index.ts +13 -4
- package/src/post-edit/gate.ts +13 -2
- package/dist/chunk-3JO7QFIL.js +0 -1
- package/dist/chunk-4NIFBFFR.js +0 -11
- package/dist/chunk-64M3SQPG.js +0 -3
- package/dist/chunk-7LZKOHH2.js +0 -1
- package/dist/chunk-EAZGN5ND.js +0 -7
- package/dist/chunk-FK42RSF4.js +0 -1
- package/dist/chunk-KBP3QUDT.js +0 -2
- package/dist/chunk-KR36BT5E.js +0 -1
- package/dist/chunk-MBUXFKIW.js +0 -3
- 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
- package/src/extensions/pi-agent-read/src/core/tools/read/temp-resource-store.ts +0 -105
package/dist/pi-agent-ide.js
CHANGED
|
@@ -1,15 +1,43 @@
|
|
|
1
|
-
import{a as
|
|
2
|
-
`)})}
|
|
3
|
-
`)}],details:void 0,isError:
|
|
1
|
+
import{a as j,b as B,c as L,d as ee,e as te,f as O}from"./chunk-W7CASEO3.js";import{f as q}from"./chunk-IM24DB3K.js";import{a as Z}from"./chunk-YGGKGZO2.js";import"./chunk-QUYXINGZ.js";import"./chunk-PKSQT6TC.js";import{a as Y}from"./chunk-BU7IZLKB.js";import{a as H,b as X}from"./chunk-S5PL5DFQ.js";import{J as Q,d as K}from"./chunk-6U5OU77O.js";import"./chunk-ZC65Z3CK.js";import{a as f}from"./chunk-EI7MMDWY.js";var G={"ide.core":["IDE services","Shared services used by language, formatting and diagnostic modules."],"ide.tips":["Getting started tips","Show contextual guidance while setting up a project."],"ide.documentation":["Progressive agent documentation","Expose packaged guides and attach them on first relevant tool use."],"ide.doctor":["Setup doctor","Check external tools and help configure project support."],"ide.languages":["Language setup","Discover languages and their recommended toolchains."],"ide.processes":["Agent IDE processes","Show active terminal and debugger sessions in one shared process surface."],"ide.vision":["Agent vision","Inspect process metadata and capture supported windows and web pages as images."],"ide.debugger":["Debugger sessions","Debug local programs through addressable DAP sessions and anchored breakpoints."],"ide.terminal":["Terminal sessions","Run and manage local interactive and background terminal processes."],"read.core":["Read tools","Read sources through the configured readers and views."],"read.filesystem":["Local files","Resolve files and folders from the local filesystem."],"read.filesystem.jq":["JSON queries","Query local JSON files through jq read views."],"read.filesystem.image":["Local images","Read local images as visual content."],"read.filesystem.pdf":["Local PDFs","Extract readable content from local PDF documents."],"read.filesystem.text":["Local text","Read local text files with their source coordinates."],"read.web":["Web sources","Read remote sources over HTTP and HTTPS."],"read.web.html":["Web pages","Extract readable content from HTML pages."],"read.web.image":["Web images","Read remote images as visual content."],"read.web.pdf":["Web PDFs","Extract text from remote PDF documents."],"read.web.text":["Web text","Read remote plain-text sources."],"search.core":["Search tools","Run searches through the configured search providers."],"search.text":["Text search","Find text and files and register reusable search selections."],"editor.core":["Editing tools","Make guarded text and whole-file changes, directly or through native Codemode."],"editor.renderer":["Edit previews","Display changes in the shared colored diff panels."],"editor.anchor.constant":["File boundary selectors","Use begin and end to select file boundaries."],"editor.anchor.line-hash":["Checked line selectors","Select lines with hashes that detect stale content."],"editor.anchor.exact":["Exact text selectors","Locate edit ranges using unique source text."],"editor.stale-anchor":["Stale selection recovery","Provide recovery guidance when an edit selection is outdated."],"ide.ast":["Structural code support","Read code outlines and search or edit exact syntax-tree nodes."],"ide.formatter":["Code formatting","Run configured formatters after edits."],"ide.lint":["Lint checks","Run configured linters and collect their findings."],"ide.changes":["Git changes","Inspect and manage uncommitted changes and undo history."],"ide.lsp":["Language servers","Resolve symbols, rename references and collect language-server diagnostics."],"ide.diagnostics":["Diagnostic views","Show diagnostic findings through read views and sources."]};var M=[T("ide.core",()=>import("./chunk-F6IWZKOG.js")),T("ide.tips",()=>import("./chunk-BMOJTJJJ.js")),T("ide.doctor",()=>import("./chunk-5JELU6RV.js")),T("ide.languages",()=>import("./entry-35.js"),["ide.doctor"]),T("read.core",()=>import("./entry-45.js")),T("ide.documentation",()=>import("./chunk-NRZO5KJT.js"),["read.core"]),T("read.filesystem",()=>import("./entry-25.js"),["read.core","editor.core"]),T("read.filesystem.jq",()=>import("./entry-27.js"),["read.filesystem","ide.documentation","ide.doctor"]),T("read.filesystem.image",()=>import("./entry-26.js"),["read.filesystem"]),T("read.filesystem.pdf",()=>import("./entry-28.js"),["read.filesystem"]),T("read.filesystem.text",()=>import("./entry-29.js"),["read.filesystem"]),T("read.web",()=>import("./entry-82.js"),["read.core"]),T("read.web.html",()=>import("./entry-83.js"),["read.web"]),T("read.web.image",()=>import("./entry-84.js"),["read.web"]),T("read.web.pdf",()=>import("./entry-85.js"),["read.web"]),T("read.web.text",()=>import("./entry-86.js"),["read.web"]),T("search.core",()=>import("./entry-50.js")),T("search.text",()=>import("./entry-51.js"),["search.core"]),T("editor.renderer",()=>import("./entry-78.js"),["editor.core"]),T("editor.core",()=>import("./entry-77.js")),T("editor.anchor.constant",()=>import("./entry-56.js"),["read.core","editor.core"]),T("editor.anchor.line-hash",()=>import("./entry-60.js"),["read.core","editor.core"]),T("editor.anchor.exact",()=>import("./entry-58.js"),["editor.core"]),T("editor.stale-anchor",()=>import("./entry-79.js"),["editor.core"]),T("ide.ast",()=>import("./entry-31.js"),["ide.core","read.core","search.core","editor.core"]),T("ide.formatter",()=>import("./entry-34.js"),["ide.core"]),T("ide.lint",()=>import("./entry-36.js"),["ide.core"]),T("ide.changes",()=>import("./entry-33.js"),["ide.core","read.core","editor.core"]),T("ide.lsp",()=>import("./entry-37.js"),["ide.core","read.core","search.core"]),T("ide.processes",()=>import("./chunk-S6QRG3TQ.js")),T("ide.vision",()=>import("./chunk-SBP3ABH4.js"),["ide.processes","read.core","search.core"]),T("ide.debugger",()=>import("./chunk-TQGE7RH6.js"),["ide.processes","read.core","editor.core"]),T("ide.terminal",()=>import("./chunk-XDG7EQRN.js"),["ide.processes","read.core","search.core","editor.core","editor.anchor.constant"]),T("ide.diagnostics",()=>import("./chunk-EURHXLN3.js"),["ide.core","read.core"])];function T(e,u,g=[],d=!0){return{id:e,name:G[e][0],description:G[e][1],dependencies:g,async register(i,m){await(await u()).default(i,m)},...d?{}:{defaultEnabled:!1}}}f(T,"builtin");function F(e,u,g){return{kind:"choice",id:e,name:u,description:g,default:"compact",group:"ui",values:[{value:"full",label:"Full"},{value:"compact",label:"Compact"},{value:"disabled",label:"Disabled"}]}}f(F,"presentationPreference");var ne=[F("ui.diffs","Diffs","Choose how mutation and comparison diffs are displayed."),F("ui.read","Read","Choose how Read calls and results are displayed."),F("ui.search","Search","Choose how Search calls and results are displayed."),F("ui.terminal","Terminal","Choose how shell commands and terminal output are displayed."),{kind:"choice",id:"processes.activity",name:"Active Agent IDE processes",description:"Choose detailed process cards, a compact active count, or no persistent Agent IDE process UI.",default:"detailed",group:"ui",values:[{value:"detailed",label:"Detailed cards"},{value:"compact",label:"Compact count"},{value:"off",label:"Off"}]},{kind:"text",id:"vision.sequenceDurationSeconds",name:"Vision sequence duration",description:"Default sequence duration in seconds. Requests may override it, up to 10 seconds.",default:"2",group:"features"},{kind:"text",id:"vision.sequenceIntervalSeconds",name:"Vision sequence interval",description:"Default seconds between sequence frames. A sequence may contain at most 20 frames.",default:"0.5",group:"features"},{kind:"text",id:"vision.imageScale",name:"Vision image scale",description:"Default image downscale from greater than 0 through 1.",default:"0.5",group:"features"},{kind:"text",id:"vision.allowedExecutables",name:"Vision allowed executables",description:"Comma-separated executable file names that may be captured without arbitrary-window access.",default:"",group:"features",placeholder:"Unity.exe,UnrealEditor.exe"}];function U(e,u,g=[]){let d=new Map;for(let l of e){if(d.has(l.id))throw new Error(`Duplicate Pi Agent IDE extension ID: ${l.id}`);d.set(l.id,l)}for(let l of e)for(let w of l.dependencies)if(!d.has(w))throw new Error(`Pi Agent IDE extension ${l.id} has unknown dependency ${w}`);let i=new Set;for(let l of u)d.has(l)&&i.add(l);for(let l of g)if(!d.has(l))throw new Error(`Unknown Pi Agent IDE extension ID in enabled: ${l}`);let m=Ie(d,g,i),h=new Set;for(let l of e)(l.defaultEnabled===!1&&!m.has(l.id)||i.has(l.id))&&h.add(l.id);let v=!0;for(;v;){v=!1;for(let l of e)h.has(l.id)||l.dependencies.every(w=>!h.has(w))||(h.add(l.id),v=!0)}return{enabled:e.filter(l=>!h.has(l.id)),disabled:h}}f(U,"selectBuiltinExtensions");function Ie(e,u,g){let d=new Set,i=[...u];for(;i.length>0;){let m=i.pop();if(!(d.has(m)||g.has(m))){d.add(m);for(let h of e.get(m)?.dependencies??[])d.has(h)||i.push(h)}}return d}f(Ie,"collectForcedOn");import{Input as ke}from"@earendil-works/pi-tui";import{mkdir as Ae,readFile as Te,writeFile as ve}from"node:fs/promises";import Se from"node:path";import{withFileMutationQueue as Re}from"@earendil-works/pi-coding-agent";async function oe(e,u,g=new Map,d=new Map,i){await Re(e,async()=>{let m=await O(e),h={};try{h=JSON.parse(await Te(e,"utf8"))}catch(t){if(!(t instanceof Error&&"code"in t&&t.code==="ENOENT"))throw t}let v=new Set(m.disabled),l=new Set(m.enabled);for(let[t,s]of u)v.delete(t),l.delete(t),s==="disabled"&&v.add(t),s==="enabled"&&l.add(t);let w={...m.preferences};for(let[t,s]of d)s===void 0?delete w[t]:w[t]=s;let p={...m.flags};for(let[t,s]of g)t==="pi-agent-ide-no-animations"&&delete h.noAnimations,t==="pi-agent-ide-no-post-processing"&&delete h.noPostProcessing,s===void 0?delete p[t]:p[t]=s;await Ae(Se.dirname(e),{recursive:!0}),await ve(e,`${JSON.stringify({...h,disabled:[...v],enabled:[...l],...i===void 0?{}:{preset:i},...g.size>0?{flags:p}:{},...d.size>0?{preferences:w}:{}},null,2)}
|
|
2
|
+
`)})}f(oe,"saveModuleChoices");import{getSettingsListTheme as Pe}from"@earendil-works/pi-coding-agent";import{matchesKey as W,SettingsList as Ce,truncateToWidth as se,visibleWidth as re}from"@earendil-works/pi-tui";function ie(e,u,g,d,i=""){let m=["extensions","behavior","ui"],h="extensions",v=f(o=>o==="extensions"?"modules":o==="behavior"?"features":"ui","itemKey"),l=f(o=>o==="extensions"?"modules":o==="behavior"?"features":"ui","changeKey"),w=f(()=>{let o=v(h),a=u()[o]??[];return new Ce(a,12,Pe(),(r,c)=>{g(l(h),r,c);for(let E of u()[o]??[]){let b=a.find(x=>x.id===E.id);b&&Object.assign(b,E)}},()=>d(!1),{enableSearch:!0})},"createList"),p=w(),t=f(o=>e.fg("borderMuted",o),"border"),s=f((o,a)=>{if(a<=1)return t("\u2502");let r=a-2,c=se(o,r);return`${t("\u2502")}${c}${" ".repeat(Math.max(0,r-re(c)))}${t("\u2502")}`},"row"),n=f(o=>t(o<=1?"\u251C":`\u251C${"\u2500".repeat(Math.max(0,o-2))}\u2524`),"rule");return{render(o){let a=Math.max(1,o),r=Math.max(1,a-4),c=` Agent IDE settings${i?` \xB7 ${i}`:""} `,E=a<=1?t("\u256D"):`${t("\u256D\u2500")}${e.fg("accent",e.bold(se(c,Math.max(0,a-3),"")))}${t(`${"\u2500".repeat(Math.max(0,a-re(c)-3))}\u256E`)}`,b={extensions:"Features",behavior:"Behavior",ui:"UI"},x=m.map(A=>A===h?e.fg("accent",e.bold(`[ ${b[A]} ]`)):e.fg("dim",` ${b[A]} `)).join(" "),I=p.render(r).map(A=>s(` ${A} `,a)),R=e.fg("dim"," Tab switch \xB7 Enter change \xB7 Ctrl+S save \xB7 Esc cancel ");return[E,s(` ${x} `,a),n(a),...I,n(a),s(R,a),t(a<=1?"\u2570":`\u2570${"\u2500".repeat(Math.max(0,a-2))}\u256F`)]},invalidate(){p.invalidate()},handleInput(o){W(o,"tab")||W(o,"shift+tab")?(h=m[(m.indexOf(h)+(W(o,"shift+tab")?2:1))%m.length]??"extensions",p=w()):W(o,"ctrl+s")?d(!0):p.handleInput(o)}}}f(ie,"createSettingsPanel");function ae(e,u=[],g=[]){e.registerCommand("agent-ide-settings",{description:"Configure Agent IDE modules and features",async handler(d,i){if(i.hasUI)try{let m=await i.ui.select("Agent IDE settings \u2014 save scope",["Project","Global"]);if(m===void 0)return;let h=L(process.env,void 0,i.cwd),v=m==="Project"?h.projectPath:h.globalPath,l=await O(v),w=await O(m==="Project"?h.globalPath:h.projectPath),p=new Map,t=new Map,s=new Map,n;if(!await i.ui.custom((a,r,c,E)=>{let b=ie(r,()=>{let x=new Set(l.disabled),I=new Set(l.enabled);for(let[P,y]of p)x.delete(P),I.delete(P),y==="disabled"&&x.add(P),y==="enabled"&&I.add(P);let R=U(M,[...B(M,n??l.preset??"full"),...x,...B(M,w.preset??"full"),...w.disabled],[...I,...w.enabled]);return{modules:M.map(P=>({id:P.id,label:P.name??P.id,description:`${P.description??""} Effective: ${R.disabled.has(P.id)?"off":"on"}.${w.disabled.includes(P.id)?" Disabled in the other scope.":P.dependencies.some(y=>R.disabled.has(y))?" A dependency is disabled.":""}`,currentValue:p.get(P.id)??(l.disabled.includes(P.id)?"disabled":l.enabled.includes(P.id)?"enabled":"default"),values:["default","enabled","disabled"]})),features:[A(),...k("features"),...S("features")],ui:[...k("ui"),...S("ui")]};function A(){let P=n??l.preset??"full";return{id:"preset",label:"Preset",description:"Choose the built-in Agent IDE capability set. Reload required.",currentValue:j.find(y=>y.value===P)?.label??P,values:j.map(y=>y.label)}}function S(P){return g.filter(y=>y.group===P).map(y=>{let C=s.has(y.id)?s.get(y.id):l.preferences?.[y.id];return{id:y.id,label:y.name,description:`${y.description} Default: ${y.kind==="choice"?y.values.find(_=>_.value===y.default)?.label??y.default:y.default||"empty"}.`,currentValue:C===void 0?"default":y.kind==="choice"?y.values.find(_=>_.value===C)?.label??C:C,...y.kind==="choice"?{values:["default",...y.values.map(_=>_.label)]}:{submenu:f((_,z)=>{let $=new ke,V=_==="default"?y.default:_;return V.length>0&&$.handleInput(V),$.focused=!0,$.onSubmit=Ee=>z(Ee),$.onEscape=()=>z(),$},"submenu")}}})}function k(P){return u.filter(y=>(y.group??"features")===P).map(y=>{let C=t.has(y.id)?t.get(y.id):te(l)[y.id];return{id:y.id,label:y.name,description:y.description,currentValue:C===void 0?"default":C?y.labels?.on??"enabled":y.labels?.off??"disabled",values:["default",y.labels?.off??"disabled",y.labels?.on??"enabled"]}})}},(x,I,R)=>{if(x==="modules")p.set(I,R);else if(I==="preset")n=j.find(A=>A.label===R)?.value;else if(g.some(A=>A.id===I)){let A=g.find(S=>S.id===I);s.set(I,R==="default"||R.length===0?void 0:A?.kind==="choice"?A.values.find(S=>S.label===R)?.value:R)}else t.set(I,R==="default"?void 0:R===(u.find(A=>A.id===I)?.labels?.on??"enabled"))},E,m);return{render:f(x=>b.render(x),"render"),invalidate:f(()=>b.invalidate(),"invalidate"),handleInput(x){b.handleInput(x),a.requestRender()}}})||p.size+t.size+s.size+(n===void 0?0:1)===0)return;if(await oe(v,p,t,s,n),i.ui.notify(`Saved ${m.toLowerCase()} Agent IDE settings. Reload required.`,"info"),await i.ui.confirm("Reload Pi?","Reload extensions to apply settings. In-memory extension state may reset.")){await i.reload();return}}catch(m){i.ui.notify(m instanceof Error?m.message:String(m),"error")}}})}f(ae,"registerModuleSettings");function de(e,u){let g=[];return{definitions:g,register(d){if(g.some(i=>i.id===d.id))throw new Error(`Duplicate feature flag: ${d.id}`);g.push(d),e.registerFlag(d.id,{type:"boolean",description:d.description,default:u[d.id]??d.default})}}}f(de,"createFeatureFlags");function le(e){let u=new Map,g=new Set;return{api:{...e,registerTool:f(i=>{i.namespace?.name.startsWith("ide_")===!0&&u.set(i.name,{hide:f(()=>e.registerTool({...i,get description(){return i.description},get promptGuidelines(){return i.promptGuidelines},exposure:"hidden"}),"hide"),restore:f(()=>e.registerTool(i),"restore")}),g.has(i.name)?u.get(i.name)?.hide():e.registerTool(i)},"registerTool")},reconcile(i=!1,m=[]){let h=new Set,v=new Set;for(let s of e.getSettings().defaultTools??[])if(s.startsWith("-"))h.add(s.slice(1)),v.delete(s.slice(1));else{let n=s.startsWith("+")?s.slice(1):s;h.delete(n),v.add(n)}for(let[s,n]of u)h.has(s)!==g.has(s)&&(h.has(s)?(n.hide(),g.add(s)):(n.restore(),g.delete(s)));let l=e.getAllTools().filter(s=>s.exposure!=="hidden"),w=new Set(e.getActiveTools());for(let s of l)i&&u.has(s.name)&&(v.has(s.name)||s.exposure==="deferred"&&m.includes(s.name))&&w.add(s.name);i&&!h.has("tool_search")&&l.some(s=>s.name==="tool_search")&&l.some(s=>u.has(s.name)&&s.exposure==="deferred")&&w.add("tool_search");let p=e.getActiveTools(),t=[...w].filter(s=>!g.has(s));(t.length!==p.length||t.some(s=>!p.includes(s)))&&e.setActiveTools(t)}}}f(le,"createIdeToolAvailability");import{ToolExecutionComponent as ce}from"@earendil-works/pi-coding-agent";import{Container as _e,Spacer as Ne,Text as ue}from"@earendil-works/pi-tui";var J="ide-nested-results",Me=256,fe=512*1024,De=8*1024,$e=32*1024;function pe(e){let u=new Map,g=new Map,d=new Map,i,m=new WeakMap,h=f((p,t,s)=>{t.result=s;try{let o=JSON.stringify(p);if(Buffer.byteLength(o)<=fe){t.result=JSON.parse(JSON.stringify(s));return}}catch{}let n=s.details&&typeof s.details=="object"?Object.entries(s.details).filter(([o,a])=>(o==="source"||o==="fullOutputPath")&&typeof a=="string").map(([o,a])=>`${o}: ${String(a)}`):[];t.result={content:[{type:"text",text:["Result presentation omitted (history size limit or unsupported payload).",...n].join(`
|
|
3
|
+
`)}],details:void 0,isError:s.isError},t.omitted=!0,p.complete=!1},"retainResult"),v=f(()=>{g.clear(),d.clear()},"clear");e.on("session_start",(p,t)=>{v(),t.mode==="tui"&&t.ui.setWidget(J,s=>(i=s,{render:f(()=>[],"render"),invalidate:f(()=>{},"invalidate")}))}),e.on("session_tree",v),e.on("session_shutdown",v),e.on("tool_execution_start",(p,t)=>{if(p.parentToolCallId===void 0)return;let s=g.get(p.parentToolCallId)??p.parentToolCallId;if(g.set(p.toolCallId,s),!u.has(p.toolName))return;let n=d.get(s);if(n||(n={parentToolCallId:s,cwd:t.cwd,calls:[],complete:!0},d.set(s,n)),n.calls.length>=Me){n.complete=!1;return}let o=JSON.stringify(p.args),a=$e-n.calls.reduce((b,x)=>b+Buffer.byteLength(JSON.stringify(x.args)),0),r=Buffer.byteLength(o)>Math.min(De,a),c=r?Object.fromEntries(Object.entries(p.args).map(([b,x])=>[b,typeof x=="string"?x.slice(0,200)+(x.length>200?"\u2026 [omitted]":""):"[omitted]"])):JSON.parse(o),E=Buffer.byteLength(JSON.stringify(c))<=a?c:{};n.calls.push({id:p.toolCallId,name:p.toolName,args:E}),r&&(n.complete=!1)}),e.on("tool_execution_end",p=>{let t=g.get(p.toolCallId);if(t===void 0)return;g.delete(p.toolCallId);let s=d.get(t),n=s?.calls.find(o=>o.id===p.toolCallId);if(s&&n){let o=p.result;h(s,n,{content:o.content.filter(a=>a.type!=="text"||!a.text.startsWith(`
|
|
4
4
|
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
# Guide:`)),details:
|
|
8
|
-
${
|
|
9
|
-
`)}`}],details:void 0,isError:
|
|
10
|
-
|
|
7
|
+
# Guide:`)),details:o.details,isError:p.isError})}}),e.on("message_end",p=>{if(p.message.role!=="toolResult")return;let t=d.get(p.message.toolCallId);if(!t)return;d.delete(p.message.toolCallId);for(let[o,a]of g)a===t.parentToolCallId&&g.delete(o);let s={...t,calls:[],complete:t.complete},n=0;for(let o of t.calls){if(o.batched)continue;let a=JSON.stringify(o);if(n+=Buffer.byteLength(a),n>fe){s.complete=!1;break}s.calls.push(JSON.parse(a)),o.result||(s.complete=!1)}e.appendEntry(J,s)}),e.registerEntryRenderer(J,f(function p(t,s,n){if(!Array.isArray(t.data?.calls))return;if(!i)return{render:f(r=>i?p(t,s,n)?.render(r)??[]:[],"render"),invalidate:f(()=>{t.data&&m.get(t.data)?.invalidate()},"invalidate")};let o=m.get(t.data);if(!o){o=new _e;for(let r of t.data.calls){let c=new ce(r.name,r.id,r.renderArgs??r.args,{showImages:!0},r.omitted||!r.result?void 0:u.get(r.name),i,t.data.cwd);r.result?c.updateResult(r.result):c.updateResult({content:[{type:"text",text:"Result unavailable; history is incomplete."}],isError:!0}),o.addChild(new Ne(1)),o.addChild(c)}t.data.complete||o.addChild(new ue(n.fg("warning","Incomplete nested IDE presentation; some results were not retained."),0,0)),m.set(t.data,o)}let a=o.children.at(-1);!t.data.complete&&a instanceof ue&&a.setText(n.fg("warning","Incomplete nested IDE presentation; some results were not retained."));for(let r of o.children)r instanceof ce&&r.setExpanded(s.expanded);return o},"renderEntry"));let l=f(()=>{e.events.on(Z,p=>{let t=p,s=d.get(t.parentToolCallId);if(!s)return;let n=q(t.result.details),o=t.calls.findLast(r=>!t.unchangedCopyCalls?.includes(r)),a="callIdsByResult"in n&&Array.isArray(n.callIdsByResult)?n.callIdsByResult:[];for(let r of t.calls){let c=s.calls.find(I=>I.id===r);if(!c)continue;let E=n.results?.filter((I,R)=>(a[R]===r||a.length===0&&t.calls.length===1)&&I.data.errors?.some(A=>A.code==="POST_WRITE_FAILED"||A.code==="POST_EDIT_FAILED"))??[];if(c.postWriteFailure=E.length>0,c.postWriteFailure){c.batched=!1,delete c.renderArgs,h(s,c,{content:t.result.content,details:{results:E,effect:"applied"},isError:!0});continue}let b=t.copyResults?.get(r),x=b?.details.metadata?.copyRollback;if(c.name==="copy"&&b&&(x==="restored"||x==="failed")){c.copyRollback=x,c.batched=!1,h(s,c,{content:b.content,details:q(b.details),isError:!0});continue}c.unchangedCopy=c.name==="copy"&&t.unchangedCopyCalls?.includes(r)===!0,c.batched=!c.unchangedCopy&&r!==o,c.unchangedCopy?h(s,c,{content:[{type:"text",text:"No changes: destination already has this text."}],details:{},isError:!1}):c.batched?c.result=void 0:(new Set(n.mutationRender?.map(I=>I.path)).size>1&&(c.renderArgs={}),c.rollback=n.results?.some(I=>I.data.rollback!==void 0)===!0,h(s,c,{content:t.result.content,details:n,isError:t.result.isError===!0||c.rollback}))}}),e.on("tool_result",p=>{let t=p.details,s=d.get(p.toolCallId);if(s&&t&&typeof t=="object"&&"editorBatchResults"in t&&Array.isArray(t.editorBatchResults))for(let n of t.editorBatchResults)for(let o of n.data?.operations??[]){let a=s.calls.find(c=>c.id===o.id);if(!a)continue;let r=o.errors.map(c=>c.message);a.rollback||a.postWriteFailure||a.copyRollback!==void 0||a.unchangedCopy&&r.length===0&&o.effect==="not-applied"||(r.length>0||o.effect!=="applied")&&(a.batched=!1,delete a.renderArgs,h(s,a,{content:[{type:"text",text:`${a.name}: ${o.effect}.
|
|
8
|
+
${r.join(`
|
|
9
|
+
`)}`}],details:void 0,isError:r.length>0||o.effect==="unknown"}))}})},"finalize");return{api:{...e,registerTool:f(p=>{u.set(p.name,p),e.registerTool(p)},"registerTool")},finalize:l}}f(pe,"createNestedIdeRendering");import{createCanvas as Be,loadImage as Oe}from"@napi-rs/canvas";import{DEFAULT_MAX_BYTES as je,DEFAULT_MAX_LINES as Le,truncateHead as Fe}from"@earendil-works/pi-coding-agent";var N={bytes:je,lines:Le,pixels:4e6,images:20,imageBytes:20*1024*1024};async function D(e,u="",g){let d=typeof u=="string"?[u]:u,i=[],m=e.flatMap(r=>{if(r.type!=="text")return[];let c=d.find(E=>E.length>0&&r.text.endsWith(E));return c?(i.push(c),[r.text.slice(0,-c.length)]):[r.text]}).join(`
|
|
10
|
+
`),h=i.join(""),v=Fe(m,{maxBytes:N.bytes,maxLines:N.lines}),l=[],w;if(v.truncated&&g!==void 0)try{w=await g(m)}catch{l.push("[Full output could not be saved. Narrow the request to inspect it.]")}v.truncated&&l.push(`[Output truncated: useful content is limited to ${N.bytes} bytes / ${N.lines} lines. Narrow the request or read a smaller source range.]`),w!==void 0&&l.push(`[Full output: ${JSON.stringify(w)}. Read with offset/limit, or read ${JSON.stringify("raw:"+w)} for byte ranges. Available until this runtime is disposed.]`);let p=e.filter(r=>r.type==="image"),t=p.slice(0,N.images),s=[],n=Math.floor(N.pixels/Math.max(1,t.length)),o=0,a=p.length-t.length;for(let[r,c]of t.entries())try{let E=Buffer.from(c.data,"base64"),b=await Oe(E),x=Math.min(1,Math.sqrt(n/(b.width*b.height))),I=Math.min(n,Math.max(1,Math.floor(b.height*x))),R=Math.min(Math.floor(n/I),Math.max(1,Math.floor(b.width*x))),A=E,S=c.mimeType;if(x<1||o+A.byteLength>N.imageBytes){let k=Be(R,I);k.getContext("2d").drawImage(b,0,0,R,I),A=await k.encode("png"),S="image/png"}if(o+A.byteLength>N.imageBytes){a++;continue}o+=A.byteLength,s.push({type:"image",data:A.toString("base64"),mimeType:S}),x<1&&l.push(`[Image ${r+1} resized from ${b.width}x${b.height} to ${R}x${I} to fit the shared media budget.]`)}catch{a++,l.push(`[Image ${r+1} could not be decoded and was not returned.]`)}return a>0&&l.push(`[${a} images omitted from the result. Read fewer frames or a smaller image region.]`),{text:v.firstLineExceedsLimit?Ue(m):v.content,textTruncated:v.truncated,images:s,notices:l,metadataSuffix:h,fullOutput:w}}f(D,"limitIdeOutput");function Ue(e){let u=0,g=0;for(let d of e){let i=Buffer.byteLength(d);if(u+i>N.bytes)break;u+=i,g+=d.length}return e.slice(0,g)}f(Ue,"bytePrefix");var ge={read:["path"],search:["path"],select:["path"],replace:["path"],insert:["path"],delete:["path"],write:["path"],copy:["path","target"],move:["path","target"],undo:["file"],diff:["before","after"]};function me(e){let u=Q(e),g=new Set,d=new K,i=f(n=>d.saveFile(n),"saveFullOutput"),m=new Set,h=new Map;Y(e,{protocol:H,apiVersion:X,id:"ide-output-retention",setup(n){n.setOutputSaver(i)}}),e.on("session_shutdown",()=>d.dispose());let v=f((n,o)=>{let a=o;return n!=="tool_call"?e.on(n,a):e.on("tool_call",async(r,c)=>{let E=await a(r,c);if(!E?.block||!g.has(r.toolName)||E.reason===void 0)return E;let b=await D([{type:"text",text:E.reason}],"",i);return m.add(r.toolCallId),{...E,reason:b.text+(b.notices.length?`
|
|
11
|
+
|
|
12
|
+
${b.notices.join(`
|
|
13
|
+
`)}`:"")}})},"on"),l=new Map,w=new Map,p=f(()=>{l.clear(),w.clear(),m.clear(),h.clear()},"clear");e.on("session_start",p),e.on("session_shutdown",p),e.on("before_agent_start",n=>({systemPrompt:`${n.systemPrompt}
|
|
14
|
+
|
|
15
|
+
<ide_results>
|
|
16
|
+
IDE tools return readable text. The leading system-result envelope is an internal reference, not file content; do not edit it. Compose tools by passing the unchanged result to a source parameter. Outside Codemode, pass the same text or its UUID. Store/load preserves these strings within the session. Use returned anchors to choose individual selections. Changed snapshots and previous sessions cannot be reused.
|
|
17
|
+
</ide_results>`})),e.on("tool_execution_start",n=>{n.parentToolCallId!==void 0&&l.set(n.toolCallId,l.get(n.parentToolCallId)??n.parentToolCallId)}),v("tool_call",(n,o)=>{if(!g.has(n.toolName))return;let a={...n.input};try{for(let r of ge[n.toolName]??[]){let c=a[r];if(c!==void 0)if(n.toolName==="diff"&&c!==null&&typeof c=="object"&&"path"in c)a[r]={...c,path:u.source(c.path,o.cwd,!0)};else{let E=u.source(c,o.cwd,n.toolName==="read"?!0:["write","insert","delete"].includes(n.toolName)?"live":!1);if(n.toolName==="read"&&Array.isArray(E)){let b=u.resolve(E,o.cwd);a[r]=u.register(b.targets,o.cwd,b.complete)}else a[r]=E}}n.toolName==="select"&&a.operation&&typeof a.operation=="object"&&"scopes"in a.operation&&(a.operation={...a.operation,scopes:u.source(a.operation.scopes,o.cwd)});for(let r of["text","content"]){let c=a[r];if(typeof c=="string"&&(c.trimStart().startsWith("<system-result")||/<system-result\b[^>]*><uuid>[a-f\d-]{36}<\/uuid><\/system-result>/iu.test(c)))return{block:!0,reason:"A system result reference is not file content. Do not insert it into a file."}}Object.assign(n.input,a)}catch(r){return{block:!0,reason:r instanceof Error?r.message:String(r)}}});let t=f(n=>{g.add(n.name);let o={},a=Object.getOwnPropertyDescriptors(n);delete a.outputSchema;let r=f(async(...b)=>{let x=await n.execute(...b).catch(async A=>{let S=await D([{type:"text",text:A instanceof Error?A.message:String(A)}],"",i);throw m.add(b[0]),S.notices.length===0?A:new Error(S.text+`
|
|
18
|
+
|
|
19
|
+
${S.notices.join(`
|
|
20
|
+
`)}`,{cause:A})}),I=await D(x.content,he(x.details),i),R=I.text+I.metadataSuffix;return{...x,content:[{type:"text",text:R+(I.notices.length?`
|
|
21
|
+
|
|
22
|
+
${I.notices.join(`
|
|
23
|
+
`)}`:"")},...I.images]}},"execute");a.execute={value:r,enumerable:!0,configurable:!0,writable:!0};let c=n.renderCall;if(c){let b=f((x,I,R)=>c(We(n.name,x),I,R),"renderCall");a.renderCall={value:b,enumerable:!0,configurable:!0,writable:!0}}let E=n.renderResult;if(E){let b=f((x,I,R,A)=>E({...x,content:x.content.map(S=>S.type==="text"?{...S,text:S.text.replace(/^<system-result\b[^>]*><uuid>[a-f\d-]{36}<\/uuid><\/system-result>\n/u,"")}:S)},I,R,A),"renderer");a.renderResult={value:b,enumerable:!0,configurable:!0,writable:!0}}Object.defineProperties(o,a),e.registerTool(o)},"registerTool"),s=f(()=>{e.on("context",async n=>({messages:await Promise.all(n.messages.map(async o=>{if(o.role!=="toolResult"||!o.isError||!g.has(o.toolName)||m.has(o.toolCallId)||o.content.some(r=>r.type==="text"&&r.text.startsWith("<system-result")))return o;let a=h.get(o.toolCallId);return a===void 0&&(a=D(o.content,"",i).then(r=>[{type:"text",text:r.text+(r.notices.length?`
|
|
24
|
+
|
|
25
|
+
${r.notices.join(`
|
|
26
|
+
`)}`:"")},...r.images]),h.set(o.toolCallId,a)),{...o,content:await a}}))})),e.on("tool_result",async(n,o)=>{if(n.toolName==="codemode"){u.refreshAll();let S=w.get(n.toolCallId)??[];w.delete(n.toolCallId);for(let[C,_]of l)_===n.toolCallId&&l.delete(C);let k=n.content.filter(C=>C.type==="text"&&C.text.startsWith(`
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
# Guide:`)),P=n.content.filter(C=>!k.includes(C)),y=await D([...P,...S],"",i);return{content:[...y.textTruncated?[{type:"text",text:y.text}]:P.filter(C=>C.type==="text"),...y.images,...y.notices.length?[{type:"text",text:`
|
|
31
|
+
|
|
32
|
+
${y.notices.join(`
|
|
33
|
+
`)}`}]:[],...k]}}if(!g.has(n.toolName))return;let a=n.content.filter(S=>S.type==="text").map(S=>S.text).join(`
|
|
34
|
+
`),r=n.structuredContent,c=r!==null&&typeof r=="object"&&"data"in r?r:{status:n.isError?"error":"success",data:r},E=c.data,b=E!==null&&typeof E=="object"&&"effect"in E&&E.effect==="applied"&&"targetUnavailable"in E&&typeof E.targetUnavailable=="string"?E.targetUnavailable:void 0,x=b===void 0?a:`${a}
|
|
35
|
+
|
|
36
|
+
This result has no verified text selection: ${b}
|
|
37
|
+
Read/Search the file before the next edit; do not repeat the applied edit.`,I=ye(c),R=u.publish(c,x,o.cwd,I),A=l.get(n.toolCallId);if(l.delete(n.toolCallId),A!==void 0){let S=n.content.filter(k=>k.type==="image");S.length&&w.set(A,[...w.get(A)??[],...S])}return{content:[{type:"text",text:R},...n.content.filter(S=>S.type!=="text")]}})},"finalize");return{api:{...e,on:v,registerTool:t},finalize:s}}f(me,"createIdeTextResults");function he(e){if(e===null||typeof e!="object")return[];let u="outputNotice"in e&&typeof e.outputNotice=="string"?[e.outputNotice]:[];if("resources"in e&&Array.isArray(e.resources)){let g=e.resources;for(let d of g)d!==null&&typeof d=="object"&&"details"in d&&u.push(...he(d.details))}return u}f(he,"outputNotices");function We(e,u){let g=f(i=>{if(Array.isArray(i))return i.map(g);if(typeof i!="string")return i;let m=/^<system-result\b[^>]*><uuid>([a-f\d-]{36})<\/uuid>/u.exec(i)?.[1];return m?`RESULT#${m}`:i},"label"),d={...u};for(let i of ge[e]??[])Object.assign(d,{[i]:g(u[i])});return d}f(We,"displaySources");function ye(e){if(e===null||typeof e!="object"||!("data"in e))return[];let u=e.data;return u===null||typeof u!="object"?[]:"resources"in u&&Array.isArray(u.resources)?u.resources.flatMap(d=>ye({data:d})):"files"in u&&Array.isArray(u.files)?u.files.flatMap(d=>d!==null&&typeof d=="object"&&"source"in d&&typeof d.source=="string"&&/^(?:shell|debug):/u.test(d.source)?[d.source]:[]):"source"in u&&typeof u.source=="string"?[u.source]:[]}f(ye,"resultResources");function be(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}f(be,"isRecord");function we(e,u){if(!be(e)||!Array.isArray(e.tools))return e;let g=e.tools,d=g.map(i=>!be(i)||i.type!=="function"||typeof i.name!="string"||!u.has(i.name)||i.strict!==void 0?i:{...i,strict:!1});return d.some((i,m)=>i!==g[m])?{...e,tools:d}:e}f(we,"preserveResponsesToolOmission");import{VERSION as qe}from"@earendil-works/pi-coding-agent";import{getCurrentTools as Ge}from"@earendil-works/pi-ai";function xe(e){let u=/^(\d+)\.(\d+)\.(\d+)(-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?$/u.exec(e),g=[0,99,1],i=u?.slice(1,4).map(Number)?.map((m,h)=>m-(g[h]??0)).find(m=>m!==0)??0;if(u===null||i<0||i===0&&u[4]!==void 0)throw new Error(`Pi Agent IDE requires Pi 0.99.1 or newer; this host is ${e}. Update Pi before loading the extension.`)}f(xe,"assertSupportedHost");async function Je(e){xe(qe);let u=pe(e),g=me(u.api),d=le(g.api);e.on("before_provider_request",(l,w)=>{if(w.model?.api!=="openai-responses")return;let p=new Set(e.getAllTools().filter(t=>t.namespace?.name.startsWith("ide_")).map(t=>t.name));return we(l.payload,p)}),e.on("session_start",(l,w)=>{let p=l.reason==="reload"?[]:Ge(w.sessionManager.getBranch().flatMap(t=>t.type==="message"?[t.message]:[])).map(t=>t.name);d.reconcile(!0,p)}),e.on("before_agent_start",l=>{d.reconcile();let w=l.systemPrompt.replace("- bash: Execute bash commands (ls, grep, find, etc.)","- bash: Execute Bash commands").replace(`- Use bash for file operations like ls, rg, find
|
|
38
|
+
`,""),p=e.getAllTools().filter(r=>r.exposure!=="hidden"),t=e.getActiveTools(),s=t.includes("tool_search")?"Use tool_search to find":t.includes("codemode")?"Use searchTools inside codemode to find":"Enable native tool_search to find",n=p.filter(r=>r.namespace?.name==="ide_git").map(r=>r.name),o=[...n.length===0?[]:[`${s} ${n.join(" and ")} in ide_git when staging or unstaging selected Git changes.`],...p.some(r=>r.name==="debug"&&r.namespace?.name==="ide_debug")?[`${s} debug in ide_debug when creating a debugger session.`]:[]],a=o.length===0?w:`${w}
|
|
11
39
|
|
|
12
40
|
<ide_discovery>
|
|
13
|
-
${
|
|
41
|
+
${o.join(`
|
|
14
42
|
`)}
|
|
15
|
-
</ide_discovery>`;return
|
|
43
|
+
</ide_discovery>`;return a===l.systemPrompt?void 0:{systemPrompt:a}});let i=await ee(L()),m=de(e,{"pi-agent-ide-no-animations":i.noAnimations??!1,"pi-agent-ide-no-post-processing":i.noPostProcessing??!1,...i.flags});m.register({id:"pi-agent-ide-no-animations",name:"Static edit previews",group:"ui",description:"Show edit results immediately, without animated playback.",default:!1}),m.register({id:"pi-agent-ide-no-post-processing",name:"Skip automatic post-processing",description:"Skip automatic formatting and diagnostics after edits. Explicit diagnostic reads still work.",default:!1}),m.register({id:"pi-agent-ide-vision-arbitrary-windows",name:"Capture arbitrary windows",description:"Allow window:PID capture for processes not owned by Agent IDE. Keep disabled unless the agent may inspect other desktop apps.",default:!1}),m.register({id:"pi-agent-ide-vision-displays",name:"Capture full displays",description:"Allow display screenshots through display: and display:#N resources. Keep disabled unless the agent may inspect the full desktop.",default:!1}),m.register({id:"pi-agent-ide-no-diagnostic-buffer",name:"Immediate diagnostic notices",description:"Send findings immediately instead of combining reports received over five seconds.",group:"ui",default:!1}),m.register({id:"pi-agent-ide-code-review",name:"Jev code review",description:"Review saved edit fragments against project YAML rules in the background. Sends code to a connected Jev provider.",default:!1}),m.register({id:"pi-agent-ide-code-review-capture",name:"Capture code-review rules",description:"Use the packaged skill to propose reusable rules from user review feedback. Save only after confirmation.",default:!1}),ae(e,m.definitions,ne);let h=B(M,i.preset??"full"),{enabled:v}=U(M,[...h,...i.disabled],i.enabled);for(let l of v)await l.register(d.api,{preferences:i.preferences??{}});u.finalize(),g.finalize()}f(Je,"registerUnifiedPiAgentIde");export{Je as default};
|
|
@@ -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
|
+
When Write changes or creates a file, it saves the file and finishes post-edit processing before returning, including in Codemode. If an existing file already matches the supplied content, Write returns its whole-file selection without writing or running post-edit handlers. Earlier pending edits commit before Write. Other eligible text edits keep their pending-batch behavior.
|
|
53
46
|
|
|
54
|
-
|
|
47
|
+
Independent calls share the original snapshots. Combine overlapping edits into one mutation. A rejected call does not cancel successful peers; retry only unapplied changes.
|
|
55
48
|
|
|
56
|
-
|
|
49
|
+
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.
|
|
57
50
|
|
|
58
|
-
|
|
51
|
+
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.
|
|
59
52
|
|
|
60
|
-
|
|
53
|
+
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.
|
|
61
54
|
|
|
62
|
-
|
|
55
|
+
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. Read the affected files when the result cannot confirm their final state.
|
|
63
56
|
|
|
64
|
-
|
|
57
|
+
After an interruption, read the affected files before retrying. 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.
|
|
@@ -2,4 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
Read a tracked file with `views: ["changes"]` to see staged and unstaged hunks and current `CHANGE#` anchors. Stage or unstage only the selected current change. Anchors are revision-sensitive, so re-read after index or worktree changes.
|
|
4
4
|
|
|
5
|
+
If an unstage anchor is stale, read the file again with `views: ["changes"]` and select a current change.
|
|
6
|
+
|
|
7
|
+
After a failed or interrupted unstage call, inspect the index with `git diff --cached -- <file>` before retrying. Do not assume the error means the index stayed unchanged.
|
|
8
|
+
|
|
5
9
|
Use a `CHANGE#` anchor to restore that selected Git change to `HEAD` in both worktree and index. Use `last` with a file only for that file's latest text-editor transaction. Inspect current changes before destructive restoration.
|
|
10
|
+
|
|
11
|
+
Undo applies the restore before returning, including in Codemode. Earlier pending edits commit before Undo runs. Formatting and registered post-edit handlers run at script end in Codemode; read the file again if they change its bytes.
|
|
12
|
+
|
|
13
|
+
`last` restores one saved transaction, not an undo history or redo. A successful restore clears that saved transaction.
|
|
14
|
+
|
|
15
|
+
After a failed or interrupted Git restore, read the file and inspect the index with `git diff --cached -- <file>` before retrying. Text restoration can succeed before an index update fails. Retry only the work that remains unapplied.
|
|
@@ -1,58 +1,17 @@
|
|
|
1
|
-
# Read
|
|
1
|
+
# Read results and selections
|
|
2
2
|
|
|
3
|
-
##
|
|
3
|
+
## Preserve source boundaries
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
A Read result retains the requested source window. When reading a selection, Read may display surrounding whole lines. That context does not widen the selection used by later tools.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
Read-only views, bytes, images and directory listings do not grant text-edit authority. Read the original text source when you need an editable selection.
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
- `docs:` and `docs:<id>` — packaged agent guidance.
|
|
11
|
-
- `ast:<path>` — compact syntax outline.
|
|
12
|
-
- `symbol:<file>#<selector>` — one declaration.
|
|
13
|
-
- `graph:<file>` and `graph:<file>#<selector>` — declarations and relationships.
|
|
14
|
-
- `diagnostics:<path>` — lint and language-server findings.
|
|
15
|
-
- `process:<PID>` — process metadata.
|
|
16
|
-
- `window:<PID>` and `display:` — visual capture when enabled.
|
|
17
|
-
- `shell:<session>` — terminal state and retained output.
|
|
18
|
-
- `debug:<session>` — debugger state.
|
|
9
|
+
## Continue with another tool
|
|
19
10
|
|
|
20
|
-
|
|
11
|
+
Search a Read result to look only inside its selection. Use Select to derive new boundaries before editing.
|
|
21
12
|
|
|
22
|
-
|
|
13
|
+
Read `docs:select-code` for selection workflows and `docs:editing` for using results in mutations.
|
|
23
14
|
|
|
24
|
-
|
|
15
|
+
## Comparing text sources
|
|
25
16
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
Temporary resources remain available only in their owning runtime.
|
|
29
|
-
|
|
30
|
-
## Native Codemode data
|
|
31
|
-
|
|
32
|
-
Check `status` before reading `data`. Use text `data.lines` and their `anchors` without parsing display rows. Use source-level `data.references` for actions such as Git changes. Follow `data.continuation` as a complete next Read request; its offset is absolute on its returned source. Check `data.truncated` and `data.fullResult` when present.
|
|
33
|
-
|
|
34
|
-
Use `data.bytes` for `raw:` reads. Forward a native image from `data.blocks` with `image(block)`. Keep multi-source `data.resources` separate instead of joining unrelated ranges.
|
|
35
|
-
|
|
36
|
-
## Reusing source windows
|
|
37
|
-
|
|
38
|
-
Exact filesystem text reads expose `data.target`. Pass the successful result, its data, or that `RESULT#` reference as `search.path` or `replace.path` to reuse the requested window, not just its shortened preview. Read-only derived views, bytes, images, and directory listings do not gain text-edit authority.
|
|
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.
|
|
43
|
-
|
|
44
|
-
## Views
|
|
45
|
-
|
|
46
|
-
Views request source-specific presentations without changing the selected resource. Common views include:
|
|
47
|
-
|
|
48
|
-
- `anchors` — editable `LINE#HASH` references.
|
|
49
|
-
- `ast` — syntax-scope boundaries.
|
|
50
|
-
- `changes` — staged and unstaged Git changes with `CHANGE#` anchors.
|
|
51
|
-
- `diagnostics` — findings beside source text.
|
|
52
|
-
- `breakpoints` — current debugger breakpoint locations.
|
|
53
|
-
- `image` — one visual frame or terminal screen.
|
|
54
|
-
- `sequence` — several ordered visual frames.
|
|
55
|
-
|
|
56
|
-
Combine views only when both presentations are needed. Read the smallest useful source window and treat unsupported source/view combinations as errors rather than silently substituting another resource.
|
|
57
|
-
|
|
58
|
-
For image grid selection, `limit` is the square cell size in output pixels and `offset` is the zero-based row-major cell number. `limit` without `offset` selects cell zero; `offset` without `limit` is invalid.
|
|
17
|
+
When a Diff source resolves to several resources, their text is joined with one newline separator in resolver order. Diff line numbers refer to each compared text, not original source line numbers when a window is selected.
|
|
@@ -12,13 +12,19 @@ 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
|
+
|
|
23
|
+
If Search fails, fix the reported input, scope or provider problem before retrying. Keep the intended search scope; do not treat the failure as zero matches.
|
|
24
|
+
|
|
25
|
+
If Search is interrupted or cancelled, do not treat it as zero matches or completed coverage. Do not use its unfinished result as an edit scope. Retry only when the search is still wanted, and use the new result.
|
|
26
|
+
|
|
27
|
+
If a result has no local edit references, use its locations to inspect the source, not as an edit scope. For changed local files, repeat Search or Read to obtain a current selection before editing.
|
|
22
28
|
|
|
23
29
|
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
30
|
|
|
@@ -26,40 +32,35 @@ A single-result reference becomes stale after its file changes. Re-run the searc
|
|
|
26
32
|
|
|
27
33
|
## Searching returned scopes
|
|
28
34
|
|
|
29
|
-
Pass
|
|
35
|
+
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
36
|
|
|
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
|
|
37
|
+
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
38
|
|
|
33
|
-
|
|
39
|
+
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
40
|
|
|
35
|
-
|
|
41
|
+
Incomplete registered result scopes cannot authorize edits, even through non-empty subsets. A numbered local text Search reference remains editable while its file snapshot is current, even if collection was incomplete. Use it only for its containing line or exact match, not as a complete match set. 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
42
|
|
|
37
43
|
## AST search
|
|
38
44
|
|
|
39
45
|
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
46
|
|
|
41
|
-
|
|
47
|
+
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
48
|
|
|
43
49
|
```js
|
|
44
50
|
const window = await tools.read({ path: "client.ts", offset: 10, limit: 4 });
|
|
45
|
-
if (window.status !== "success") throw Error(JSON.stringify(window.errors));
|
|
46
51
|
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);
|
|
52
|
+
text(calls);
|
|
54
53
|
```
|
|
55
54
|
|
|
55
|
+
Use its displayed OPTIONS reference in the next call. Store/load keeps these result strings across Codemode scripts within the same session.
|
|
56
|
+
|
|
56
57
|
## Symbols and graphs
|
|
57
58
|
|
|
58
59
|
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
60
|
|
|
60
|
-
Pass a result scope to `symbols:` for strict discovery inside its exact ranges.
|
|
61
|
+
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
62
|
|
|
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.
|
|
63
|
+
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
64
|
|
|
64
65
|
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
66
|
|