pi-agent-ide 0.7.1 → 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 +37 -0
- package/dist/chunk-6U5OU77O.js +3 -0
- package/dist/chunk-EURHXLN3.js +2 -0
- package/dist/{chunk-WMO6RNE2.js → chunk-F6IWZKOG.js} +6 -6
- package/dist/{chunk-HZEY4GT4.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-PKKDDIWW.js → chunk-KOVPDKSJ.js} +1 -1
- package/dist/chunk-MXLSGMRZ.js +3 -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-QUYXINGZ.js +7 -0
- package/dist/{chunk-OMVRLWMX.js → chunk-SBP3ABH4.js} +1 -1
- package/dist/{chunk-4GCWGE2C.js → chunk-SJ4UZ4GU.js} +1 -1
- package/dist/{chunk-2TRHFMCZ.js → chunk-SNF7PDDX.js} +1 -1
- package/dist/{chunk-YP46DVVP.js → chunk-STBJO3Z3.js} +1 -1
- package/dist/{chunk-76ZK5ODR.js → chunk-TQGE7RH6.js} +13 -13
- package/dist/{chunk-LEEQIQ7D.js → chunk-XDG7EQRN.js} +6 -6
- 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 +1 -1
- package/dist/entry-26.js +1 -1
- package/dist/entry-27.js +1 -1
- 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 +2 -1
- package/dist/entry-37.js +2 -2
- package/dist/entry-42.js +1 -1
- package/dist/entry-44.js +1 -1
- package/dist/entry-45.js +20 -12
- 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 +7 -6
- 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-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 -42
- package/dist/entry-78.js +14 -14
- package/dist/entry-79.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 +34 -11
- package/docs/agent-guides/editing.md +5 -5
- package/docs/agent-guides/git-changes.md +10 -0
- package/docs/agent-guides/read-resources.md +9 -46
- package/docs/agent-guides/search-code.md +7 -1
- package/docs/agent-guides/select-code.md +1 -0
- 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 +2 -2
- package/docs/tools.md +10 -2
- 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/package.json +7 -7
- package/node_modules/pi-agent-filesystem-image/package.json +3 -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 +0 -2
- package/node_modules/pi-agent-ide-ast/src/overflow-handler.ts +2 -2
- package/node_modules/pi-agent-ide-ast/src/search-resolver.ts +0 -3
- package/node_modules/pi-agent-ide-ast/src/select-schema.ts +8 -6
- package/node_modules/pi-agent-ide-ast/src/tool-select.ts +13 -5
- 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/package.json +9 -9
- package/node_modules/pi-agent-ide-lsp/src/search-resolver.ts +0 -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/read-parameters.ts +3 -3
- package/node_modules/pi-agent-read/src/api/tools/read.ts +11 -0
- package/node_modules/pi-agent-read/src/core/extension.ts +1 -1
- package/node_modules/pi-agent-read/src/core/read-core.ts +5 -1
- 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/tool-read.ts +99 -44
- 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 +6 -3
- 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-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 +2 -2
- 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/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/package.json +3 -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 +1 -2
- 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/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 -151
- 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 +14 -13
- 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 +381 -187
- package/node_modules/pi-agent-text-editor/src/tools/text-tool-schema-properties.ts +4 -2
- package/node_modules/pi-agent-text-editor/src/tools/tool-text-copy.ts +9 -2
- 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-replace.ts +2 -3
- 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-ui/package.json +1 -1
- 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 +158 -7
- 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/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/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/read-parameters.ts +3 -3
- package/src/extensions/pi-agent-read/src/api/tools/read.ts +11 -0
- package/src/extensions/pi-agent-read/src/core/extension.ts +1 -1
- package/src/extensions/pi-agent-read/src/core/read-core.ts +5 -1
- 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/tool-read.ts +99 -44
- package/src/extensions/pi-agent-search/package.json +5 -5
- 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 +2 -2
- 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/package.json +3 -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 +1 -2
- 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/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 -151
- 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 +14 -13
- 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 +381 -187
- package/src/extensions/pi-agent-text-editor/src/tools/text-tool-schema-properties.ts +4 -2
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-copy.ts +9 -2
- 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-replace.ts +2 -3
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-write.ts +10 -4
- package/src/pi-agent-ide.ts +11 -0
- package/src/plugins/pi-agent-ide-ast/package.json +13 -13
- package/src/plugins/pi-agent-ide-ast/src/extension.ts +0 -2
- package/src/plugins/pi-agent-ide-ast/src/overflow-handler.ts +2 -2
- package/src/plugins/pi-agent-ide-ast/src/search-resolver.ts +0 -3
- package/src/plugins/pi-agent-ide-ast/src/select-schema.ts +8 -6
- package/src/plugins/pi-agent-ide-ast/src/tool-select.ts +13 -5
- 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 +17 -7
- 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 +3 -2
- 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/package.json +9 -9
- package/src/plugins/pi-agent-ide-lsp/src/search-resolver.ts +0 -1
- package/src/plugins/pi-agent-ide-terminal/src/output-limits.ts +3 -3
- package/src/plugins/pi-agent-ide-terminal/src/tools.ts +3 -3
- package/src/plugins/pi-agent-ide-vision/index.ts +1 -0
- package/src/post-edit/gate.ts +13 -2
- package/dist/chunk-4XMY4H4V.js +0 -1
- package/dist/chunk-64M3SQPG.js +0 -3
- package/dist/chunk-CWD4O5PM.js +0 -3
- package/dist/chunk-D3WTDA6V.js +0 -2
- package/dist/chunk-EAZGN5ND.js +0 -7
- package/dist/chunk-GXEGY7GV.js +0 -1
- package/dist/chunk-MBUXFKIW.js +0 -3
- package/dist/chunk-PGIVHICI.js +0 -1
- package/dist/chunk-VMTR74FF.js +0 -2
- package/dist/chunk-WU6ZK6YD.js +0 -1
- package/src/extensions/pi-agent-read/src/core/tools/read/temp-resource-store.ts +0 -105
|
@@ -254,18 +254,27 @@ export function createSearchCore(): SearchCore {
|
|
|
254
254
|
const missingAdapter = data === undefined;
|
|
255
255
|
return withStructuredResult(
|
|
256
256
|
{
|
|
257
|
-
content:
|
|
258
|
-
entry.registration.fallback && protocolLike
|
|
257
|
+
content: [
|
|
258
|
+
...(entry.registration.fallback && protocolLike
|
|
259
259
|
? [
|
|
260
260
|
{
|
|
261
|
-
type: "text",
|
|
261
|
+
type: "text" as const,
|
|
262
262
|
text: emptyProtocol
|
|
263
263
|
? "Search fallback: empty protocol query; searched the original text."
|
|
264
264
|
: "Search fallback: unhandled protocol query; searched the original text.",
|
|
265
265
|
},
|
|
266
266
|
...formatted.content,
|
|
267
267
|
]
|
|
268
|
-
: formatted.content,
|
|
268
|
+
: formatted.content),
|
|
269
|
+
...(isRecord(data) && data.complete === false
|
|
270
|
+
? [
|
|
271
|
+
{
|
|
272
|
+
type: "text" as const,
|
|
273
|
+
text: "Search coverage is incomplete. Do not conclude absence or use this result as an edit scope.",
|
|
274
|
+
},
|
|
275
|
+
]
|
|
276
|
+
: []),
|
|
277
|
+
],
|
|
269
278
|
details: { resolverId: resolver.id, payload: formatted.details },
|
|
270
279
|
...(audience === "script" && {
|
|
271
280
|
script: {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-agent-text-editor",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"imports": {
|
|
6
6
|
"#src/*": "./src/*"
|
|
@@ -79,14 +79,14 @@
|
|
|
79
79
|
"fs-extra": "^11.4.0",
|
|
80
80
|
"oxfmt": "0.64.0",
|
|
81
81
|
"partial-json": "^0.1.7",
|
|
82
|
-
"pi-agent-documentation": "0.7.
|
|
83
|
-
"pi-agent-invariant": "0.7.
|
|
84
|
-
"pi-agent-read": "0.7.
|
|
85
|
-
"pi-agent-resource": "0.7.
|
|
86
|
-
"pi-agent-search": "0.7.
|
|
87
|
-
"pi-agent-text": "0.7.
|
|
88
|
-
"pi-agent-tool-call-interception": "0.7.
|
|
89
|
-
"pi-agent-tool-ui": "0.7.
|
|
82
|
+
"pi-agent-documentation": "0.7.2",
|
|
83
|
+
"pi-agent-invariant": "0.7.2",
|
|
84
|
+
"pi-agent-read": "0.7.2",
|
|
85
|
+
"pi-agent-resource": "0.7.2",
|
|
86
|
+
"pi-agent-search": "0.7.2",
|
|
87
|
+
"pi-agent-text": "0.7.2",
|
|
88
|
+
"pi-agent-tool-call-interception": "0.7.2",
|
|
89
|
+
"pi-agent-tool-ui": "0.7.2",
|
|
90
90
|
"typebox-guard": "npm:typebox@^1.1.38"
|
|
91
91
|
},
|
|
92
92
|
"pi": {
|
package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-constant/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-agent-text-anchor-constant",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"imports": {
|
|
6
6
|
"#src/*": "./src/*"
|
|
7
7
|
},
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"pi-agent-text": "0.7.
|
|
10
|
-
"pi-agent-text-editor": "0.7.
|
|
9
|
+
"pi-agent-text": "0.7.2",
|
|
10
|
+
"pi-agent-text-editor": "0.7.2"
|
|
11
11
|
},
|
|
12
12
|
"pi": {
|
|
13
13
|
"extensions": [
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-agent-text-anchor-exact",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"imports": {
|
|
6
6
|
"#src/*": "./src/*"
|
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
15
|
"fast-fuzzy": "1.12.0",
|
|
16
|
-
"pi-agent-text": "0.7.
|
|
17
|
-
"pi-agent-text-editor": "0.7.
|
|
16
|
+
"pi-agent-text": "0.7.2",
|
|
17
|
+
"pi-agent-text-editor": "0.7.2"
|
|
18
18
|
},
|
|
19
19
|
"pi": {
|
|
20
20
|
"extensions": [
|
package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-agent-text-anchor-line-hash",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"imports": {
|
|
6
6
|
"#src/*": "./src/*"
|
|
@@ -12,10 +12,10 @@
|
|
|
12
12
|
}
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"pi-agent-invariant": "0.7.
|
|
16
|
-
"pi-agent-read": "0.7.
|
|
17
|
-
"pi-agent-text": "0.7.
|
|
18
|
-
"pi-agent-text-editor": "0.7.
|
|
15
|
+
"pi-agent-invariant": "0.7.2",
|
|
16
|
+
"pi-agent-read": "0.7.2",
|
|
17
|
+
"pi-agent-text": "0.7.2",
|
|
18
|
+
"pi-agent-text-editor": "0.7.2"
|
|
19
19
|
},
|
|
20
20
|
"pi": {
|
|
21
21
|
"extensions": [
|
package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/package.json
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-agent-text-editor-renderer",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"imports": {
|
|
6
6
|
"#src/*": "./src/*"
|
|
7
7
|
},
|
|
8
8
|
"dependencies": {
|
|
9
9
|
"diff": "^9.0.0",
|
|
10
|
-
"pi-agent-invariant": "0.7.
|
|
11
|
-
"pi-agent-text-editor": "0.7.
|
|
12
|
-
"pi-agent-tool-call-interception": "0.7.
|
|
13
|
-
"pi-agent-tool-ui": "0.7.
|
|
10
|
+
"pi-agent-invariant": "0.7.2",
|
|
11
|
+
"pi-agent-text-editor": "0.7.2",
|
|
12
|
+
"pi-agent-tool-call-interception": "0.7.2",
|
|
13
|
+
"pi-agent-tool-ui": "0.7.2",
|
|
14
14
|
"vscode-diff": "3.0.1"
|
|
15
15
|
},
|
|
16
16
|
"pi": {
|
|
@@ -317,6 +317,17 @@ function renderTail(
|
|
|
317
317
|
: `Formatted ${grouped.formatted.length} files by ${by}`;
|
|
318
318
|
statuses.unshift(theme.fg("success", label.replace(/[\u0000-\u001f\u007f-\u009f]/g, " ")));
|
|
319
319
|
}
|
|
320
|
+
if (grouped.alreadyFormatted.length > 0) {
|
|
321
|
+
const by =
|
|
322
|
+
grouped.unchangedFormatters.length === 1
|
|
323
|
+
? grouped.unchangedFormatters[0]
|
|
324
|
+
: `${grouped.unchangedFormatters.length} formatters`;
|
|
325
|
+
const label =
|
|
326
|
+
resources.length === 1
|
|
327
|
+
? `Already formatted (${by})`
|
|
328
|
+
: `Already formatted ${grouped.alreadyFormatted.length} files by ${by}`;
|
|
329
|
+
statuses.unshift(theme.fg("success", label.replace(/[\u0000-\u001f\u007f-\u009f]/g, " ")));
|
|
330
|
+
}
|
|
320
331
|
const text = [counts, ...statuses]
|
|
321
332
|
.filter((item) => item !== undefined)
|
|
322
333
|
.join(theme.fg("dim", " · "));
|
package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/renderer.ts
CHANGED
|
@@ -251,7 +251,17 @@ function createRenderer(
|
|
|
251
251
|
options.expanded,
|
|
252
252
|
theme,
|
|
253
253
|
);
|
|
254
|
-
return new Text(
|
|
254
|
+
return new Text(
|
|
255
|
+
registration.name === "copy" &&
|
|
256
|
+
typeof result.details.metadata?.targetUnavailable === "string"
|
|
257
|
+
? theme.fg(
|
|
258
|
+
"muted",
|
|
259
|
+
"No verified text selection. Read the destination before further edits.",
|
|
260
|
+
)
|
|
261
|
+
: "",
|
|
262
|
+
0,
|
|
263
|
+
0,
|
|
264
|
+
);
|
|
255
265
|
}
|
|
256
266
|
|
|
257
267
|
clearTypingRuntime(state);
|
|
@@ -272,14 +282,28 @@ function createRenderer(
|
|
|
272
282
|
state.panel?.setPreviewResources([]);
|
|
273
283
|
|
|
274
284
|
if (!context.isError && result.details.metadata?.emptyTargets === true) {
|
|
275
|
-
return new Text(
|
|
285
|
+
return new Text(
|
|
286
|
+
theme.fg(
|
|
287
|
+
"muted",
|
|
288
|
+
registration.name === "copy"
|
|
289
|
+
? "No changes: empty selection."
|
|
290
|
+
: "No changes · empty target set",
|
|
291
|
+
),
|
|
292
|
+
0,
|
|
293
|
+
0,
|
|
294
|
+
);
|
|
276
295
|
}
|
|
277
296
|
const wholeFileSucceeded = wholeFileOperationSucceeded(result.details);
|
|
278
297
|
if (wholeFileSucceeded !== undefined) {
|
|
279
298
|
return new Text(
|
|
280
299
|
theme.fg(
|
|
281
300
|
wholeFileSucceeded ? "success" : "error",
|
|
282
|
-
wholeFileSucceeded
|
|
301
|
+
wholeFileSucceeded
|
|
302
|
+
? registration.name === "copy" &&
|
|
303
|
+
typeof result.details.metadata?.targetUnavailable === "string"
|
|
304
|
+
? "✓ Applied · no verified text selection; read destination before further edits"
|
|
305
|
+
: "✓ Applied"
|
|
306
|
+
: "✗ Not applied",
|
|
283
307
|
),
|
|
284
308
|
0,
|
|
285
309
|
0,
|
|
@@ -292,7 +316,19 @@ function createRenderer(
|
|
|
292
316
|
)
|
|
293
317
|
.map((item) => item.text)
|
|
294
318
|
.join("\n");
|
|
295
|
-
const
|
|
319
|
+
const rollback =
|
|
320
|
+
registration.name === "copy" ? result.details.metadata?.copyRollback : undefined;
|
|
321
|
+
const uncertainExecution =
|
|
322
|
+
registration.name === "copy" && result.details.metadata?.copyExecution === "uncertain";
|
|
323
|
+
const displayedOutput = context.isError
|
|
324
|
+
? uncertainExecution
|
|
325
|
+
? "Copy failed · effects uncertain; read destination before retrying"
|
|
326
|
+
: rollback === "restored"
|
|
327
|
+
? "Copy failed · changes rolled back"
|
|
328
|
+
: rollback === "failed"
|
|
329
|
+
? "Copy failed · rollback failed; read destination before retrying"
|
|
330
|
+
: userFacingFailure(output, result.details)
|
|
331
|
+
: output;
|
|
296
332
|
return new Text(
|
|
297
333
|
displayedOutput.length === 0
|
|
298
334
|
? ""
|
|
@@ -868,7 +904,20 @@ function wholeFileOperationSucceeded(details: unknown): boolean | undefined {
|
|
|
868
904
|
: undefined;
|
|
869
905
|
}
|
|
870
906
|
|
|
871
|
-
function userFacingFailure(
|
|
907
|
+
function userFacingFailure(
|
|
908
|
+
agentOutput: string,
|
|
909
|
+
details: FileMutationBatchResult | undefined,
|
|
910
|
+
): string {
|
|
911
|
+
const rollback = details?.results?.find((result) => result.data.rollback !== undefined)?.data
|
|
912
|
+
.rollback;
|
|
913
|
+
if (rollback !== undefined) {
|
|
914
|
+
return rollback.failedSources.length === 0
|
|
915
|
+
? "Rolled back · write failed"
|
|
916
|
+
: "State unknown · rollback failed";
|
|
917
|
+
}
|
|
918
|
+
if (details?.effect === "unknown") return "Effects unknown · edit failed";
|
|
919
|
+
if (details?.effect === "applied") return "Saved · post-write step failed";
|
|
920
|
+
if (details?.metadata?.rollback === "restored") return "Rolled back · edit failed";
|
|
872
921
|
if (/\banchor\b[\s\S]*\bis ambiguous\./iu.test(agentOutput)) {
|
|
873
922
|
return "Not changed · selection is ambiguous";
|
|
874
923
|
}
|
|
@@ -9,12 +9,25 @@ export function summarizeStatuses(
|
|
|
9
9
|
) {
|
|
10
10
|
const formatted = new Set<string>();
|
|
11
11
|
const formatters = new Set<string>();
|
|
12
|
+
const alreadyFormatted = new Set<string>();
|
|
13
|
+
const unchangedFormatters = new Set<string>();
|
|
12
14
|
const remaining = new Map<string, { status: MutationDiffStatus; paths: Set<string> }>();
|
|
13
15
|
for (const resource of resources)
|
|
14
16
|
for (const status of resource.diffStatuses ?? []) {
|
|
15
|
-
if (
|
|
16
|
-
|
|
17
|
-
|
|
17
|
+
if (
|
|
18
|
+
status.formatter !== undefined &&
|
|
19
|
+
status.tone === "success" &&
|
|
20
|
+
(status.formattingStatus === undefined ||
|
|
21
|
+
status.formattingStatus === "changed" ||
|
|
22
|
+
status.formattingStatus === "unchanged")
|
|
23
|
+
) {
|
|
24
|
+
if (status.formattingStatus === "unchanged") {
|
|
25
|
+
alreadyFormatted.add(resource.path);
|
|
26
|
+
unchangedFormatters.add(status.formatter);
|
|
27
|
+
} else {
|
|
28
|
+
formatted.add(resource.path);
|
|
29
|
+
formatters.add(status.formatter);
|
|
30
|
+
}
|
|
18
31
|
continue;
|
|
19
32
|
}
|
|
20
33
|
const key = JSON.stringify([status.text, status.tone]);
|
|
@@ -28,6 +41,8 @@ export function summarizeStatuses(
|
|
|
28
41
|
return {
|
|
29
42
|
formatted: [...formatted],
|
|
30
43
|
formatters: [...formatters],
|
|
44
|
+
alreadyFormatted: [...alreadyFormatted],
|
|
45
|
+
unchangedFormatters: [...unchangedFormatters],
|
|
31
46
|
statuses: [...remaining.values()].map(({ status, paths }) => ({ status, paths: [...paths] })),
|
|
32
47
|
};
|
|
33
48
|
}
|
package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-stale-anchor/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-agent-text-editor-stale-anchor",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"dependencies": {
|
|
6
|
-
"pi-agent-invariant": "0.7.
|
|
7
|
-
"pi-agent-read": "0.7.
|
|
8
|
-
"pi-agent-text-editor": "0.7.
|
|
6
|
+
"pi-agent-invariant": "0.7.2",
|
|
7
|
+
"pi-agent-read": "0.7.2",
|
|
8
|
+
"pi-agent-text-editor": "0.7.2"
|
|
9
9
|
},
|
|
10
10
|
"pi": {
|
|
11
11
|
"extensions": [
|
|
@@ -3,8 +3,8 @@ import type { TextDocument } from "pi-agent-text";
|
|
|
3
3
|
export type TextEditIntent = "edit" | "restore" | "mixed";
|
|
4
4
|
|
|
5
5
|
export interface TextEditCompletion {
|
|
6
|
-
/**
|
|
7
|
-
readonly postProcessing?: "deferred" | "final" | "complete";
|
|
6
|
+
/** Saved bytes remain observable even when post-edit work is deferred or interrupted. */
|
|
7
|
+
readonly postProcessing?: "deferred" | "final" | "complete" | "interrupted";
|
|
8
8
|
readonly source: string;
|
|
9
9
|
readonly resourceSource: string;
|
|
10
10
|
readonly resolvedBy: string;
|
|
@@ -28,8 +28,7 @@ export { type ChangedRange, computeChangedRanges } from "#src/core/mutation-resu
|
|
|
28
28
|
export {
|
|
29
29
|
mutationDataSchema,
|
|
30
30
|
mutationResultSchema,
|
|
31
|
-
|
|
32
|
-
type FlushData,
|
|
31
|
+
type BatchMutationData,
|
|
33
32
|
structuredMutation,
|
|
34
33
|
type MutationData,
|
|
35
34
|
} from "#src/core/structured-result.js";
|
|
@@ -5,6 +5,10 @@ import type { FileMutationBatchResult } from "./mutation-result.js";
|
|
|
5
5
|
export interface NativeEditBatchEvent {
|
|
6
6
|
readonly parentToolCallId: string;
|
|
7
7
|
readonly calls: readonly string[];
|
|
8
|
+
/** Successful Copy calls that retained identical destination text without a write. */
|
|
9
|
+
readonly unchangedCopyCalls?: readonly string[];
|
|
10
|
+
/** Per-call Copy receipts keep destination authority and rollback evidence. */
|
|
11
|
+
readonly copyResults?: ReadonlyMap<string, AgentToolResult<FileMutationBatchResult>>;
|
|
8
12
|
readonly result: AgentToolResult<FileMutationBatchResult>;
|
|
9
13
|
}
|
|
10
14
|
|
|
@@ -14,7 +14,7 @@ export function formatStaleAnchorMessage(
|
|
|
14
14
|
): string {
|
|
15
15
|
const context = details.context === undefined ? "" : `\n\n${details.context}`;
|
|
16
16
|
return (
|
|
17
|
-
`[SYSTEM] ${details.toolName} blocked: ${details.field} anchor "${details.anchor}" is stale. ` +
|
|
17
|
+
`[SYSTEM] ${details.toolName} blocked: ${details.field === "anchor" ? "anchor" : `${details.field} anchor`} "${details.anchor}" is stale. ` +
|
|
18
18
|
`If the required line is represented by one of the context lines below, use that anchor. Otherwise, reread only the relevant section of "${details.path}" and regenerate the anchor. (${reason})${context}`
|
|
19
19
|
);
|
|
20
20
|
}
|
|
@@ -33,10 +33,42 @@ export const diffDataSchema = Type.Object(
|
|
|
33
33
|
);
|
|
34
34
|
export const diffOutputSchema = structuredResultSchema(diffDataSchema);
|
|
35
35
|
|
|
36
|
-
const
|
|
36
|
+
const comparisonReadParameters = {
|
|
37
|
+
...readParameters,
|
|
38
|
+
properties: {
|
|
39
|
+
...readParameters.properties,
|
|
40
|
+
path: {
|
|
41
|
+
...readParameters.properties.path,
|
|
42
|
+
description:
|
|
43
|
+
"Text-readable source accepted by Read, such as a file path, URL, temp: reference, SEARCH# or RESULT# reference, or registered resource. Supply a path.",
|
|
44
|
+
},
|
|
45
|
+
offset: {
|
|
46
|
+
...readParameters.properties.offset,
|
|
47
|
+
description:
|
|
48
|
+
"First text line to compare, numbered from 1. Omit or use 0 to start at line 1; negative offsets count from the end. For path#anchor, SEARCH# or RESULT# selections, count from the containing line: omitted, 0 or 1 starts there, 2 starts one line later, -1 one line earlier.",
|
|
49
|
+
},
|
|
50
|
+
limit: {
|
|
51
|
+
...readParameters.properties.limit,
|
|
52
|
+
description:
|
|
53
|
+
"Maximum text lines to compare from the selected starting position. Omit to compare all resolved text in the selected range. Read's display limits do not shorten the comparison inputs.",
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
};
|
|
57
|
+
const source = Type.Union([Type.String({ minLength: 1 }), comparisonReadParameters]);
|
|
37
58
|
/** Each side accepts a source string or the same request object as read. */
|
|
38
59
|
export const diffParameters = Type.Object(
|
|
39
|
-
{
|
|
60
|
+
{
|
|
61
|
+
before: {
|
|
62
|
+
...source,
|
|
63
|
+
description:
|
|
64
|
+
"Source for the removed (-) side. Supply a non-empty source reference string or a Read request object. Strings identify sources, not literal text.",
|
|
65
|
+
},
|
|
66
|
+
after: {
|
|
67
|
+
...source,
|
|
68
|
+
description:
|
|
69
|
+
"Source for the added (+) side. Supply a non-empty source reference string or a Read request object. Strings identify sources, not literal text.",
|
|
70
|
+
},
|
|
71
|
+
},
|
|
40
72
|
{ additionalProperties: false },
|
|
41
73
|
);
|
|
42
74
|
export type DiffRequest = Static<typeof diffParameters>;
|
|
@@ -107,13 +139,21 @@ export function comparisonText(data: ReadScriptData, requested: string): Compari
|
|
|
107
139
|
};
|
|
108
140
|
}
|
|
109
141
|
if (data.kind === "bytes")
|
|
110
|
-
throw Object.assign(
|
|
111
|
-
|
|
112
|
-
|
|
142
|
+
throw Object.assign(
|
|
143
|
+
new Error(
|
|
144
|
+
`Byte sources are not text: ${data.source}\nIf this is a text file, use its path without raw:.`,
|
|
145
|
+
),
|
|
146
|
+
{
|
|
147
|
+
code: "UNSUPPORTED_CONTENT",
|
|
148
|
+
},
|
|
149
|
+
);
|
|
113
150
|
if (data.blocks.length === 0 || data.blocks.some((block) => block.type !== "text"))
|
|
114
|
-
throw Object.assign(
|
|
115
|
-
|
|
116
|
-
|
|
151
|
+
throw Object.assign(
|
|
152
|
+
new Error(`Source is not text: ${data.source}\nUse a source that Read resolves to text.`),
|
|
153
|
+
{
|
|
154
|
+
code: "UNSUPPORTED_CONTENT",
|
|
155
|
+
},
|
|
156
|
+
);
|
|
117
157
|
return {
|
|
118
158
|
source: data.source,
|
|
119
159
|
sources: [data.source],
|
|
@@ -166,8 +206,7 @@ export function registerDiff(
|
|
|
166
206
|
parameters: diffParameters,
|
|
167
207
|
outputSchema: diffOutputSchema,
|
|
168
208
|
promptSnippet: "Compare two text-readable sources",
|
|
169
|
-
description:
|
|
170
|
-
"Use diff to compare two sources. before and after accept a source string or a read request {path, offset?, limit?, views?}. Use any source that read can resolve as text. Omit limit to compare complete resolved text; read presentation limits do not clip comparison inputs. Multiple resolved resources are joined with one newline separator in resolver order. Diff line numbers are relative to each selected text, not the original file when a window is selected. Native non-text content is rejected. Output uses the existing text diff and a shared output budget; oversized output has a full temporary reference.",
|
|
209
|
+
description: "Use diff to compare two text-readable sources without changing them.",
|
|
171
210
|
renderCall(_args, theme) {
|
|
172
211
|
return new Text(theme.fg("toolTitle", theme.bold("Diff")), 0, 0);
|
|
173
212
|
},
|
|
@@ -195,7 +234,10 @@ export function registerDiff(
|
|
|
195
234
|
const full = diffText(comparison);
|
|
196
235
|
const bounded = truncateHead(full);
|
|
197
236
|
const temporarySource = bounded.truncated ? await read.saveTemporary(full) : undefined;
|
|
198
|
-
const footer =
|
|
237
|
+
const footer =
|
|
238
|
+
temporarySource === undefined
|
|
239
|
+
? ""
|
|
240
|
+
: `\nDiff output is truncated; the comparison used the complete resolved inputs.\nUse read with path "${temporarySource}" for the full diff.`;
|
|
199
241
|
return withStructuredResult(
|
|
200
242
|
{
|
|
201
243
|
content: [
|
|
@@ -205,7 +247,7 @@ export function registerDiff(
|
|
|
205
247
|
temporarySource === undefined
|
|
206
248
|
? full
|
|
207
249
|
: truncateHead(full, {
|
|
208
|
-
maxLines: DEFAULT_MAX_LINES -
|
|
250
|
+
maxLines: DEFAULT_MAX_LINES - footer.split("\n").length,
|
|
209
251
|
maxBytes: DEFAULT_MAX_BYTES - Buffer.byteLength(footer),
|
|
210
252
|
}).content + footer,
|
|
211
253
|
},
|
|
@@ -4,5 +4,5 @@ export const EDITING_GUIDELINES = [
|
|
|
4
4
|
"Use an available anchor when it selects exactly the intended text; otherwise use minimal unique exact text. Keep the edit limited to the intended content.",
|
|
5
5
|
"When search broadens to separate words, treat its results as location hints. Refine the query before using those matches for replacement.",
|
|
6
6
|
"Use standalone mutation tools in one assistant-response batch when each change is known in advance and does not depend on another change. This is the default for several independent edits in one file or across files. Every call is evaluated against the original file snapshots. Combine overlapping changes into one mutation. Use native Codemode for computed or dependent tool composition; it keeps the same tool contracts and does not add grouped rollback. Check each batch result and retry only unapplied changes.",
|
|
7
|
-
"Inside
|
|
7
|
+
"Inside Codemode, run independent edits on different resources concurrently; run edits on the same resource in order. Check the final Codemode result and retry only unapplied changes. Read docs:editing when you need a write report inside the script.",
|
|
8
8
|
] as const;
|
package/src/extensions/pi-agent-text-editor/src/core/mutation-result/file-mutation-agent-result.ts
CHANGED
|
@@ -287,6 +287,27 @@ export class FileMutationAgentResult {
|
|
|
287
287
|
|
|
288
288
|
// ── Success formatting ────────────────────────────────────────────────
|
|
289
289
|
|
|
290
|
+
private formatFormatting(formatting: FileMutationResult["data"]["formatting"]): string {
|
|
291
|
+
const by = formatting?.formatter === undefined ? "" : ` (${formatting.formatter})`;
|
|
292
|
+
switch (formatting?.status) {
|
|
293
|
+
case "changed": {
|
|
294
|
+
return `Formatted${by}.`;
|
|
295
|
+
}
|
|
296
|
+
case "unchanged": {
|
|
297
|
+
return `Already formatted${by}.`;
|
|
298
|
+
}
|
|
299
|
+
case "unavailable": {
|
|
300
|
+
return "No formatter is available for this file.";
|
|
301
|
+
}
|
|
302
|
+
case "failed": {
|
|
303
|
+
return `Formatting failed${by}. Read the saved file before retrying.`;
|
|
304
|
+
}
|
|
305
|
+
default: {
|
|
306
|
+
return `Formatting: ${formatting?.status ?? "not-reported"}${by}.`;
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
|
|
290
311
|
private formatSuccess(fmr: FileMutationResult): string {
|
|
291
312
|
const operations = fmr.data.operations ?? [];
|
|
292
313
|
const verbs: Record<string, string> = {
|
|
@@ -295,7 +316,6 @@ export class FileMutationAgentResult {
|
|
|
295
316
|
delete: "Deleted selected text",
|
|
296
317
|
copy: "Copied selected text",
|
|
297
318
|
move: "Moved selected text",
|
|
298
|
-
write: "Wrote file content",
|
|
299
319
|
undo: "Restored file content",
|
|
300
320
|
stage: "Staged selected changes",
|
|
301
321
|
unstage: "Unstaged selected changes",
|
|
@@ -304,15 +324,24 @@ export class FileMutationAgentResult {
|
|
|
304
324
|
operations.length === 0
|
|
305
325
|
? "Changes applied."
|
|
306
326
|
: operations
|
|
307
|
-
.map(
|
|
308
|
-
|
|
309
|
-
|
|
327
|
+
.map(({ operation, changes }) =>
|
|
328
|
+
operation === "write"
|
|
329
|
+
? "Saved file."
|
|
330
|
+
: `${verbs[operation] ?? `Applied ${operation}`}: ${changes} text change(s) in this file.`,
|
|
310
331
|
)
|
|
311
332
|
.join("\n"),
|
|
312
|
-
|
|
333
|
+
this.formatFormatting(fmr.data.formatting),
|
|
313
334
|
];
|
|
314
335
|
|
|
315
|
-
for (const status of fmr.data.diffStatuses ?? [])
|
|
336
|
+
for (const status of fmr.data.diffStatuses ?? []) {
|
|
337
|
+
if (
|
|
338
|
+
status.formattingStatus !== undefined &&
|
|
339
|
+
status.formattingStatus === fmr.data.formatting?.status &&
|
|
340
|
+
status.formatter === fmr.data.formatting.formatter
|
|
341
|
+
)
|
|
342
|
+
continue;
|
|
343
|
+
blocks.push(status.text);
|
|
344
|
+
}
|
|
316
345
|
for (const diff of fmr.diffs) {
|
|
317
346
|
const path = /^--- (.+)$/m.exec(diff)?.[1] ?? fmr.path ?? "<unknown file>";
|
|
318
347
|
blocks.push(renderFinalStateFragment(fmr, path).join("\n"));
|
package/src/extensions/pi-agent-text-editor/src/core/mutation-result/file-mutation-result.ts
CHANGED
|
@@ -29,6 +29,8 @@ export interface MutationFormatting {
|
|
|
29
29
|
export interface MutationDiffStatus {
|
|
30
30
|
/** Formatter identity allows multi-file summaries without parsing display text. */
|
|
31
31
|
readonly formatter?: string;
|
|
32
|
+
/** Observed formatter state for this label, kept distinct from file edit counts. */
|
|
33
|
+
readonly formattingStatus?: MutationFormatting["status"];
|
|
32
34
|
readonly text: string;
|
|
33
35
|
readonly tone?: "muted" | "success" | "warning" | "error";
|
|
34
36
|
}
|
|
@@ -236,6 +238,8 @@ export interface FileMutationData {
|
|
|
236
238
|
|
|
237
239
|
staleDiagnostic?: StaleAnchorDiagnostic | undefined;
|
|
238
240
|
fileChangedStatement?: string | undefined;
|
|
241
|
+
/** Failed rollback resources; an empty list means all attempted writes were restored. */
|
|
242
|
+
rollback?: { readonly failedSources: readonly string[] } | undefined;
|
|
239
243
|
|
|
240
244
|
// ── Transient engine fields ──
|
|
241
245
|
snapshot?: MutationSnapshot | undefined;
|
|
@@ -325,7 +329,21 @@ export class FileMutationResult {
|
|
|
325
329
|
readonly data: FileMutationData;
|
|
326
330
|
|
|
327
331
|
public constructor(data?: FileMutationData) {
|
|
328
|
-
|
|
332
|
+
const formatting = data?.formatting;
|
|
333
|
+
this.data =
|
|
334
|
+
formatting === undefined || data?.diffStatuses === undefined
|
|
335
|
+
? (data ?? {})
|
|
336
|
+
: {
|
|
337
|
+
...data,
|
|
338
|
+
diffStatuses: data.diffStatuses.map((status) =>
|
|
339
|
+
status.formattingStatus !== undefined ||
|
|
340
|
+
formatting.formatter === undefined ||
|
|
341
|
+
status.formatter !== formatting.formatter ||
|
|
342
|
+
(status.tone !== "success" && status.tone !== "error")
|
|
343
|
+
? status
|
|
344
|
+
: { ...status, formattingStatus: formatting.status },
|
|
345
|
+
),
|
|
346
|
+
};
|
|
329
347
|
}
|
|
330
348
|
|
|
331
349
|
// ── Getters ──
|