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
|
@@ -24,6 +24,10 @@ interface ChildPanel {
|
|
|
24
24
|
renderArgs?: unknown;
|
|
25
25
|
omitted?: boolean;
|
|
26
26
|
batched?: boolean;
|
|
27
|
+
rollback?: boolean;
|
|
28
|
+
postWriteFailure?: boolean;
|
|
29
|
+
unchangedCopy?: boolean;
|
|
30
|
+
copyRollback?: "restored" | "failed";
|
|
27
31
|
result?: { content: AgentToolResult<unknown>["content"]; details: unknown; isError: boolean };
|
|
28
32
|
}
|
|
29
33
|
interface BatchReport {
|
|
@@ -106,8 +110,7 @@ export function createNestedIdeRendering(pi: ExtensionAPI) {
|
|
|
106
110
|
if (event.parentToolCallId === undefined) return;
|
|
107
111
|
const root = parents.get(event.parentToolCallId) ?? event.parentToolCallId;
|
|
108
112
|
parents.set(event.toolCallId, root);
|
|
109
|
-
|
|
110
|
-
if (event.toolName === "flush" || !definitions.has(event.toolName)) return;
|
|
113
|
+
if (!definitions.has(event.toolName)) return;
|
|
111
114
|
let group = groups.get(root);
|
|
112
115
|
if (!group) {
|
|
113
116
|
group = { parentToolCallId: root, cwd: context.cwd, calls: [], complete: true };
|
|
@@ -238,20 +241,71 @@ export function createNestedIdeRendering(pi: ExtensionAPI) {
|
|
|
238
241
|
const group = groups.get(batch.parentToolCallId);
|
|
239
242
|
if (!group) return;
|
|
240
243
|
const details = compactMutationDetails(batch.result.details);
|
|
244
|
+
const lastChangedCall = batch.calls.findLast((id) => !batch.unchangedCopyCalls?.includes(id));
|
|
245
|
+
const callIdsByResult: readonly unknown[] =
|
|
246
|
+
"callIdsByResult" in details && Array.isArray(details.callIdsByResult)
|
|
247
|
+
? details.callIdsByResult
|
|
248
|
+
: [];
|
|
241
249
|
for (const id of batch.calls) {
|
|
242
250
|
const call = group.calls.find((call) => call.id === id);
|
|
243
251
|
if (!call) continue;
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
252
|
+
const postWriteResults =
|
|
253
|
+
details.results?.filter(
|
|
254
|
+
(result, index) =>
|
|
255
|
+
(callIdsByResult[index] === id ||
|
|
256
|
+
(callIdsByResult.length === 0 && batch.calls.length === 1)) &&
|
|
257
|
+
result.data.errors?.some(
|
|
258
|
+
(error) => error.code === "POST_WRITE_FAILED" || error.code === "POST_EDIT_FAILED",
|
|
259
|
+
),
|
|
260
|
+
) ?? [];
|
|
261
|
+
call.postWriteFailure = postWriteResults.length > 0;
|
|
262
|
+
if (call.postWriteFailure) {
|
|
263
|
+
call.batched = false;
|
|
264
|
+
delete call.renderArgs;
|
|
265
|
+
retainResult(group, call, {
|
|
266
|
+
content: batch.result.content,
|
|
267
|
+
details: { results: postWriteResults, effect: "applied" },
|
|
268
|
+
isError: true,
|
|
269
|
+
});
|
|
270
|
+
continue;
|
|
271
|
+
}
|
|
272
|
+
const copyResult = batch.copyResults?.get(id);
|
|
273
|
+
const rollback = copyResult?.details.metadata?.copyRollback;
|
|
274
|
+
if (
|
|
275
|
+
call.name === "copy" &&
|
|
276
|
+
copyResult &&
|
|
277
|
+
(rollback === "restored" || rollback === "failed")
|
|
278
|
+
) {
|
|
279
|
+
call.copyRollback = rollback;
|
|
280
|
+
call.batched = false;
|
|
281
|
+
retainResult(group, call, {
|
|
282
|
+
content: copyResult.content,
|
|
283
|
+
details: compactMutationDetails(copyResult.details),
|
|
284
|
+
isError: true,
|
|
285
|
+
});
|
|
286
|
+
continue;
|
|
287
|
+
}
|
|
288
|
+
// Keep no-op Copy outcomes; changed peers share the final batch diff.
|
|
289
|
+
call.unchangedCopy =
|
|
290
|
+
call.name === "copy" && batch.unchangedCopyCalls?.includes(id) === true;
|
|
291
|
+
call.batched = !call.unchangedCopy && id !== lastChangedCall;
|
|
292
|
+
if (call.unchangedCopy) {
|
|
293
|
+
retainResult(group, call, {
|
|
294
|
+
content: [{ type: "text", text: "No changes: destination already has this text." }],
|
|
295
|
+
details: {},
|
|
296
|
+
isError: false,
|
|
297
|
+
});
|
|
298
|
+
} else if (call.batched) call.result = undefined;
|
|
247
299
|
else {
|
|
248
300
|
// A multi-file batch has no single source: let the existing renderer label each file.
|
|
249
301
|
if (new Set(details.mutationRender?.map((resource) => resource.path)).size > 1)
|
|
250
302
|
call.renderArgs = {};
|
|
303
|
+
call.rollback =
|
|
304
|
+
details.results?.some((result) => result.data.rollback !== undefined) === true;
|
|
251
305
|
retainResult(group, call, {
|
|
252
306
|
content: batch.result.content,
|
|
253
307
|
details,
|
|
254
|
-
isError: batch.result.isError === true,
|
|
308
|
+
isError: batch.result.isError === true || call.rollback,
|
|
255
309
|
});
|
|
256
310
|
}
|
|
257
311
|
}
|
|
@@ -271,6 +325,10 @@ export function createNestedIdeRendering(pi: ExtensionAPI) {
|
|
|
271
325
|
const call = group.calls.find((call) => call.id === operation.id);
|
|
272
326
|
if (!call) continue;
|
|
273
327
|
const errors = operation.errors.map((error) => error.message);
|
|
328
|
+
// Keep precise failure effects and their custom error panels.
|
|
329
|
+
if (call.rollback || call.postWriteFailure || call.copyRollback !== undefined) continue;
|
|
330
|
+
if (call.unchangedCopy && errors.length === 0 && operation.effect === "not-applied")
|
|
331
|
+
continue;
|
|
274
332
|
if (errors.length > 0 || operation.effect !== "applied") {
|
|
275
333
|
call.batched = false;
|
|
276
334
|
delete call.renderArgs;
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { createCanvas, loadImage } from "@napi-rs/canvas";
|
|
2
|
+
import {
|
|
3
|
+
DEFAULT_MAX_BYTES,
|
|
4
|
+
DEFAULT_MAX_LINES,
|
|
5
|
+
truncateHead,
|
|
6
|
+
type AgentToolResult,
|
|
7
|
+
} from "@earendil-works/pi-coding-agent";
|
|
8
|
+
|
|
9
|
+
type Content = AgentToolResult<unknown>["content"];
|
|
10
|
+
|
|
11
|
+
/** Shared useful-content budgets. Notices and composition metadata are added afterward. */
|
|
12
|
+
export const IDE_OUTPUT_LIMITS = {
|
|
13
|
+
bytes: DEFAULT_MAX_BYTES,
|
|
14
|
+
lines: DEFAULT_MAX_LINES,
|
|
15
|
+
pixels: 4_000_000,
|
|
16
|
+
images: 20,
|
|
17
|
+
imageBytes: 20 * 1024 * 1024,
|
|
18
|
+
} as const;
|
|
19
|
+
|
|
20
|
+
/** Bound the complete useful payload, not each individual content block. */
|
|
21
|
+
export async function limitIdeOutput(
|
|
22
|
+
content: Content,
|
|
23
|
+
metadata: string | readonly string[] = "",
|
|
24
|
+
saveFullOutput?: (text: string) => Promise<string>,
|
|
25
|
+
) {
|
|
26
|
+
const suffixes = typeof metadata === "string" ? [metadata] : metadata;
|
|
27
|
+
const retained: string[] = [];
|
|
28
|
+
const text = content
|
|
29
|
+
.flatMap((block) => {
|
|
30
|
+
if (block.type !== "text") return [];
|
|
31
|
+
const suffix = suffixes.find(
|
|
32
|
+
(candidate) => candidate.length > 0 && block.text.endsWith(candidate),
|
|
33
|
+
);
|
|
34
|
+
if (!suffix) return [block.text];
|
|
35
|
+
retained.push(suffix);
|
|
36
|
+
return [block.text.slice(0, -suffix.length)];
|
|
37
|
+
})
|
|
38
|
+
.join("\n");
|
|
39
|
+
const metadataSuffix = retained.join("");
|
|
40
|
+
const truncated = truncateHead(text, {
|
|
41
|
+
maxBytes: IDE_OUTPUT_LIMITS.bytes,
|
|
42
|
+
maxLines: IDE_OUTPUT_LIMITS.lines,
|
|
43
|
+
});
|
|
44
|
+
const notices: string[] = [];
|
|
45
|
+
let fullOutput: string | undefined;
|
|
46
|
+
if (truncated.truncated && saveFullOutput !== undefined) {
|
|
47
|
+
try {
|
|
48
|
+
fullOutput = await saveFullOutput(text);
|
|
49
|
+
} catch {
|
|
50
|
+
notices.push("[Full output could not be saved. Narrow the request to inspect it.]");
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
if (truncated.truncated)
|
|
54
|
+
notices.push(
|
|
55
|
+
`[Output truncated: useful content is limited to ${IDE_OUTPUT_LIMITS.bytes} bytes / ${IDE_OUTPUT_LIMITS.lines} lines. Narrow the request or read a smaller source range.]`,
|
|
56
|
+
);
|
|
57
|
+
if (fullOutput !== undefined)
|
|
58
|
+
notices.push(
|
|
59
|
+
`[Full output: ${JSON.stringify(fullOutput)}. Read with offset/limit, or read ${JSON.stringify("raw:" + fullOutput)} for byte ranges. Available until this runtime is disposed.]`,
|
|
60
|
+
);
|
|
61
|
+
const candidates = content.filter((block) => block.type === "image");
|
|
62
|
+
const selected = candidates.slice(0, IDE_OUTPUT_LIMITS.images);
|
|
63
|
+
const images: Content = [];
|
|
64
|
+
const pixelShare = Math.floor(IDE_OUTPUT_LIMITS.pixels / Math.max(1, selected.length));
|
|
65
|
+
let bytes = 0;
|
|
66
|
+
let omitted = candidates.length - selected.length;
|
|
67
|
+
for (const [index, block] of selected.entries()) {
|
|
68
|
+
try {
|
|
69
|
+
const original = Buffer.from(block.data, "base64");
|
|
70
|
+
const decoded = await loadImage(original);
|
|
71
|
+
const scale = Math.min(1, Math.sqrt(pixelShare / (decoded.width * decoded.height)));
|
|
72
|
+
const height = Math.min(pixelShare, Math.max(1, Math.floor(decoded.height * scale)));
|
|
73
|
+
const width = Math.min(
|
|
74
|
+
Math.floor(pixelShare / height),
|
|
75
|
+
Math.max(1, Math.floor(decoded.width * scale)),
|
|
76
|
+
);
|
|
77
|
+
let data: Buffer = original;
|
|
78
|
+
let mimeType = block.mimeType;
|
|
79
|
+
if (scale < 1 || bytes + data.byteLength > IDE_OUTPUT_LIMITS.imageBytes) {
|
|
80
|
+
const canvas = createCanvas(width, height);
|
|
81
|
+
canvas.getContext("2d").drawImage(decoded, 0, 0, width, height);
|
|
82
|
+
data = await canvas.encode("png");
|
|
83
|
+
mimeType = "image/png";
|
|
84
|
+
}
|
|
85
|
+
if (bytes + data.byteLength > IDE_OUTPUT_LIMITS.imageBytes) {
|
|
86
|
+
omitted++;
|
|
87
|
+
continue;
|
|
88
|
+
}
|
|
89
|
+
bytes += data.byteLength;
|
|
90
|
+
images.push({ type: "image", data: data.toString("base64"), mimeType });
|
|
91
|
+
if (scale < 1)
|
|
92
|
+
notices.push(
|
|
93
|
+
`[Image ${index + 1} resized from ${decoded.width}x${decoded.height} to ${width}x${height} to fit the shared media budget.]`,
|
|
94
|
+
);
|
|
95
|
+
} catch {
|
|
96
|
+
omitted++;
|
|
97
|
+
notices.push(`[Image ${index + 1} could not be decoded and was not returned.]`);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
if (omitted > 0)
|
|
101
|
+
notices.push(
|
|
102
|
+
`[${omitted} images omitted from the result. Read fewer frames or a smaller image region.]`,
|
|
103
|
+
);
|
|
104
|
+
return {
|
|
105
|
+
text: truncated.firstLineExceedsLimit ? bytePrefix(text) : truncated.content,
|
|
106
|
+
textTruncated: truncated.truncated,
|
|
107
|
+
images,
|
|
108
|
+
notices,
|
|
109
|
+
metadataSuffix,
|
|
110
|
+
fullOutput,
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/** Keep complete UTF-8 code points when even one output line exceeds the shared budget. */
|
|
115
|
+
function bytePrefix(text: string): string {
|
|
116
|
+
let bytes = 0;
|
|
117
|
+
let end = 0;
|
|
118
|
+
for (const character of text) {
|
|
119
|
+
const size = Buffer.byteLength(character);
|
|
120
|
+
if (bytes + size > IDE_OUTPUT_LIMITS.bytes) break;
|
|
121
|
+
bytes += size;
|
|
122
|
+
end += character.length;
|
|
123
|
+
}
|
|
124
|
+
return text.slice(0, end);
|
|
125
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
function isRecord(value: unknown): value is Record<string, unknown> {
|
|
2
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
/** Opt IDE function tools out of implicit Responses strictness without changing their schemas. */
|
|
6
|
+
export function preserveResponsesToolOmission(
|
|
7
|
+
payload: unknown,
|
|
8
|
+
names: ReadonlySet<string>,
|
|
9
|
+
): unknown {
|
|
10
|
+
if (!isRecord(payload) || !Array.isArray(payload.tools)) return payload;
|
|
11
|
+
const original = payload.tools;
|
|
12
|
+
const tools = original.map((tool: unknown) => {
|
|
13
|
+
if (
|
|
14
|
+
!isRecord(tool) ||
|
|
15
|
+
tool.type !== "function" ||
|
|
16
|
+
typeof tool.name !== "string" ||
|
|
17
|
+
!names.has(tool.name) ||
|
|
18
|
+
tool.strict !== undefined
|
|
19
|
+
)
|
|
20
|
+
return tool;
|
|
21
|
+
// Responses can make every optional property required when strict is omitted.
|
|
22
|
+
return { ...tool, strict: false };
|
|
23
|
+
});
|
|
24
|
+
return tools.some((tool, index) => tool !== original[index]) ? { ...payload, tools } : payload;
|
|
25
|
+
}
|
|
@@ -1,5 +1,14 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
1
|
+
import type {
|
|
2
|
+
ExtensionAPI,
|
|
3
|
+
ExtensionHandler,
|
|
4
|
+
ToolCallEvent,
|
|
5
|
+
ToolCallEventResult,
|
|
6
|
+
AgentToolResult,
|
|
7
|
+
} from "@earendil-works/pi-coding-agent";
|
|
8
|
+
import { connectResultTargets, TempResourceStore } from "pi-agent-resource";
|
|
9
|
+
import { connectReadPlugin } from "pi-agent-read/api/connect-plugin";
|
|
10
|
+
import { READ_PROTOCOL, READ_API_VERSION } from "pi-agent-read/api/plugin-protocol";
|
|
11
|
+
import { limitIdeOutput } from "./output-limits.js";
|
|
3
12
|
|
|
4
13
|
const sourceFields: Record<string, readonly string[]> = {
|
|
5
14
|
read: ["path"],
|
|
@@ -19,6 +28,39 @@ const sourceFields: Record<string, readonly string[]> = {
|
|
|
19
28
|
export function createIdeTextResults(pi: ExtensionAPI) {
|
|
20
29
|
const store = connectResultTargets(pi);
|
|
21
30
|
const names = new Set<string>();
|
|
31
|
+
const outputs = new TempResourceStore();
|
|
32
|
+
const saveFullOutput = (text: string) => outputs.saveFile(text);
|
|
33
|
+
const boundedErrors = new Set<string>();
|
|
34
|
+
const contextErrors = new Map<string, Promise<AgentToolResult<unknown>["content"]>>();
|
|
35
|
+
// Read core owns deferred registration and reports setup failures.
|
|
36
|
+
void connectReadPlugin(pi, {
|
|
37
|
+
protocol: READ_PROTOCOL,
|
|
38
|
+
apiVersion: READ_API_VERSION,
|
|
39
|
+
id: "ide-output-retention",
|
|
40
|
+
setup(api) {
|
|
41
|
+
api.setOutputSaver(saveFullOutput);
|
|
42
|
+
},
|
|
43
|
+
});
|
|
44
|
+
pi.on("session_shutdown", () => outputs.dispose());
|
|
45
|
+
const on: ExtensionAPI["on"] = (event, handler) => {
|
|
46
|
+
// The SDK overloads describe event/handler pairs; forwarding keeps the original pair.
|
|
47
|
+
const toolCallHandler = handler as ExtensionHandler<ToolCallEvent, ToolCallEventResult>;
|
|
48
|
+
if (event !== "tool_call") return pi.on(event as "tool_call", toolCallHandler);
|
|
49
|
+
return pi.on("tool_call", async (call, context) => {
|
|
50
|
+
const result = await toolCallHandler(call, context);
|
|
51
|
+
if (!result?.block || !names.has(call.toolName) || result.reason === undefined) return result;
|
|
52
|
+
const limited = await limitIdeOutput(
|
|
53
|
+
[{ type: "text", text: result.reason }],
|
|
54
|
+
"",
|
|
55
|
+
saveFullOutput,
|
|
56
|
+
);
|
|
57
|
+
boundedErrors.add(call.toolCallId);
|
|
58
|
+
return {
|
|
59
|
+
...result,
|
|
60
|
+
reason: limited.text + (limited.notices.length ? `\n\n${limited.notices.join("\n")}` : ""),
|
|
61
|
+
};
|
|
62
|
+
});
|
|
63
|
+
};
|
|
22
64
|
const parents = new Map<string, string>();
|
|
23
65
|
const images = new Map<
|
|
24
66
|
string,
|
|
@@ -27,6 +69,8 @@ export function createIdeTextResults(pi: ExtensionAPI) {
|
|
|
27
69
|
const clear = () => {
|
|
28
70
|
parents.clear();
|
|
29
71
|
images.clear();
|
|
72
|
+
boundedErrors.clear();
|
|
73
|
+
contextErrors.clear();
|
|
30
74
|
};
|
|
31
75
|
pi.on("session_start", clear);
|
|
32
76
|
pi.on("session_shutdown", clear);
|
|
@@ -37,7 +81,7 @@ export function createIdeTextResults(pi: ExtensionAPI) {
|
|
|
37
81
|
if (event.parentToolCallId !== undefined)
|
|
38
82
|
parents.set(event.toolCallId, parents.get(event.parentToolCallId) ?? event.parentToolCallId);
|
|
39
83
|
});
|
|
40
|
-
|
|
84
|
+
on("tool_call", (event, context) => {
|
|
41
85
|
if (!names.has(event.toolName)) return;
|
|
42
86
|
const input: Record<string, unknown> = { ...event.input };
|
|
43
87
|
try {
|
|
@@ -101,6 +145,35 @@ export function createIdeTextResults(pi: ExtensionAPI) {
|
|
|
101
145
|
const publicDefinition = {} as typeof definition;
|
|
102
146
|
const descriptors = Object.getOwnPropertyDescriptors(definition);
|
|
103
147
|
delete descriptors.outputSchema;
|
|
148
|
+
const execute: typeof definition.execute = async (...args) => {
|
|
149
|
+
const result = await definition.execute(...args).catch(async (error: unknown) => {
|
|
150
|
+
const limited = await limitIdeOutput(
|
|
151
|
+
[{ type: "text", text: error instanceof Error ? error.message : String(error) }],
|
|
152
|
+
"",
|
|
153
|
+
saveFullOutput,
|
|
154
|
+
);
|
|
155
|
+
boundedErrors.add(args[0]);
|
|
156
|
+
if (limited.notices.length === 0) throw error;
|
|
157
|
+
throw new Error(limited.text + `\n\n${limited.notices.join("\n")}`, { cause: error });
|
|
158
|
+
});
|
|
159
|
+
const limited = await limitIdeOutput(
|
|
160
|
+
result.content,
|
|
161
|
+
outputNotices(result.details),
|
|
162
|
+
saveFullOutput,
|
|
163
|
+
);
|
|
164
|
+
const text = limited.text + limited.metadataSuffix;
|
|
165
|
+
return {
|
|
166
|
+
...result,
|
|
167
|
+
content: [
|
|
168
|
+
{
|
|
169
|
+
type: "text",
|
|
170
|
+
text: text + (limited.notices.length ? `\n\n${limited.notices.join("\n")}` : ""),
|
|
171
|
+
},
|
|
172
|
+
...limited.images,
|
|
173
|
+
],
|
|
174
|
+
};
|
|
175
|
+
};
|
|
176
|
+
descriptors.execute = { value: execute, enumerable: true, configurable: true, writable: true };
|
|
104
177
|
const render = definition.renderCall;
|
|
105
178
|
if (render) {
|
|
106
179
|
const renderCall: typeof render = (args, theme, context) =>
|
|
@@ -145,14 +218,62 @@ export function createIdeTextResults(pi: ExtensionAPI) {
|
|
|
145
218
|
pi.registerTool(publicDefinition);
|
|
146
219
|
};
|
|
147
220
|
const finalize = () => {
|
|
148
|
-
|
|
221
|
+
// Host argument validation can fail before tool_call, execute and tool_result run.
|
|
222
|
+
// Bound those unpublished errors at the provider boundary; keep saved records unchanged.
|
|
223
|
+
pi.on("context", async (event) => ({
|
|
224
|
+
messages: await Promise.all(
|
|
225
|
+
event.messages.map(async (message) => {
|
|
226
|
+
if (
|
|
227
|
+
message.role !== "toolResult" ||
|
|
228
|
+
!message.isError ||
|
|
229
|
+
!names.has(message.toolName) ||
|
|
230
|
+
boundedErrors.has(message.toolCallId) ||
|
|
231
|
+
message.content.some(
|
|
232
|
+
(block) => block.type === "text" && block.text.startsWith("<system-result"),
|
|
233
|
+
)
|
|
234
|
+
)
|
|
235
|
+
return message;
|
|
236
|
+
let content = contextErrors.get(message.toolCallId);
|
|
237
|
+
if (content === undefined) {
|
|
238
|
+
content = limitIdeOutput(message.content, "", saveFullOutput).then((limited) => [
|
|
239
|
+
{
|
|
240
|
+
type: "text" as const,
|
|
241
|
+
text:
|
|
242
|
+
limited.text +
|
|
243
|
+
(limited.notices.length ? `\n\n${limited.notices.join("\n")}` : ""),
|
|
244
|
+
},
|
|
245
|
+
...limited.images,
|
|
246
|
+
]);
|
|
247
|
+
contextErrors.set(message.toolCallId, content);
|
|
248
|
+
}
|
|
249
|
+
return { ...message, content: await content };
|
|
250
|
+
}),
|
|
251
|
+
),
|
|
252
|
+
}));
|
|
253
|
+
pi.on("tool_result", async (event, context) => {
|
|
149
254
|
if (event.toolName === "codemode") {
|
|
150
255
|
store.refreshAll();
|
|
151
256
|
const generated = images.get(event.toolCallId) ?? [];
|
|
152
257
|
images.delete(event.toolCallId);
|
|
153
258
|
for (const [child, parent] of parents)
|
|
154
259
|
if (parent === event.toolCallId) parents.delete(child);
|
|
155
|
-
|
|
260
|
+
const metadata = event.content.filter(
|
|
261
|
+
(block) => block.type === "text" && block.text.startsWith("\n\n---\n\n# Guide:"),
|
|
262
|
+
);
|
|
263
|
+
const content = event.content.filter((block) => !metadata.includes(block));
|
|
264
|
+
const limited = await limitIdeOutput([...content, ...generated], "", saveFullOutput);
|
|
265
|
+
return {
|
|
266
|
+
content: [
|
|
267
|
+
...(limited.textTruncated
|
|
268
|
+
? [{ type: "text" as const, text: limited.text }]
|
|
269
|
+
: content.filter((block) => block.type === "text")),
|
|
270
|
+
...limited.images,
|
|
271
|
+
...(limited.notices.length
|
|
272
|
+
? [{ type: "text" as const, text: `\n\n${limited.notices.join("\n")}` }]
|
|
273
|
+
: []),
|
|
274
|
+
...metadata,
|
|
275
|
+
],
|
|
276
|
+
};
|
|
156
277
|
}
|
|
157
278
|
if (!names.has(event.toolName)) return;
|
|
158
279
|
const original = event.content
|
|
@@ -164,8 +285,22 @@ export function createIdeTextResults(pi: ExtensionAPI) {
|
|
|
164
285
|
record !== null && typeof record === "object" && "data" in record
|
|
165
286
|
? record
|
|
166
287
|
: { status: event.isError ? "error" : "success", data: record };
|
|
288
|
+
const data = outcome.data;
|
|
289
|
+
const targetUnavailable =
|
|
290
|
+
data !== null &&
|
|
291
|
+
typeof data === "object" &&
|
|
292
|
+
"effect" in data &&
|
|
293
|
+
data.effect === "applied" &&
|
|
294
|
+
"targetUnavailable" in data &&
|
|
295
|
+
typeof data.targetUnavailable === "string"
|
|
296
|
+
? data.targetUnavailable
|
|
297
|
+
: undefined;
|
|
298
|
+
const readable =
|
|
299
|
+
targetUnavailable === undefined
|
|
300
|
+
? original
|
|
301
|
+
: `${original}\n\nThis result has no verified text selection: ${targetUnavailable}\nRead/Search the file before the next edit; do not repeat the applied edit.`;
|
|
167
302
|
const resources = resultResources(outcome);
|
|
168
|
-
const shown = store.publish(outcome,
|
|
303
|
+
const shown = store.publish(outcome, readable, context.cwd, resources);
|
|
169
304
|
const parent = parents.get(event.toolCallId);
|
|
170
305
|
parents.delete(event.toolCallId);
|
|
171
306
|
if (parent !== undefined) {
|
|
@@ -180,9 +315,25 @@ export function createIdeTextResults(pi: ExtensionAPI) {
|
|
|
180
315
|
};
|
|
181
316
|
});
|
|
182
317
|
};
|
|
183
|
-
return { api: { ...pi, registerTool }, finalize };
|
|
318
|
+
return { api: { ...pi, on, registerTool }, finalize };
|
|
184
319
|
}
|
|
185
320
|
|
|
321
|
+
/** Read range notices belong to metadata, including reads spanning several resources. */
|
|
322
|
+
function outputNotices(details: unknown): string[] {
|
|
323
|
+
if (details === null || typeof details !== "object") return [];
|
|
324
|
+
const notices =
|
|
325
|
+
"outputNotice" in details && typeof details.outputNotice === "string"
|
|
326
|
+
? [details.outputNotice]
|
|
327
|
+
: [];
|
|
328
|
+
if ("resources" in details && Array.isArray(details.resources)) {
|
|
329
|
+
const resources: unknown[] = details.resources;
|
|
330
|
+
for (const result of resources) {
|
|
331
|
+
if (result !== null && typeof result === "object" && "details" in result)
|
|
332
|
+
notices.push(...outputNotices(result.details));
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
return notices;
|
|
336
|
+
}
|
|
186
337
|
/** Keep opaque result bodies out of user-facing tool titles without changing execution inputs. */
|
|
187
338
|
function displaySources<Args extends Record<string, unknown>>(name: string, args: Args): Args {
|
|
188
339
|
const label = (value: unknown): unknown => {
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-agent-filesystem",
|
|
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-image": "0.7.
|
|
10
|
-
"pi-agent-invariant": "0.7.
|
|
11
|
-
"pi-agent-read": "0.7.
|
|
12
|
-
"pi-agent-resource": "0.7.
|
|
13
|
-
"pi-agent-text": "0.7.
|
|
14
|
-
"pi-agent-text-editor": "0.7.
|
|
9
|
+
"pi-agent-image": "0.7.2",
|
|
10
|
+
"pi-agent-invariant": "0.7.2",
|
|
11
|
+
"pi-agent-read": "0.7.2",
|
|
12
|
+
"pi-agent-resource": "0.7.2",
|
|
13
|
+
"pi-agent-text": "0.7.2",
|
|
14
|
+
"pi-agent-text-editor": "0.7.2"
|
|
15
15
|
},
|
|
16
16
|
"pi": {
|
|
17
17
|
"extensions": [
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-agent-filesystem-image",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"imports": {
|
|
6
6
|
"#extension": "./index.ts"
|
|
7
7
|
},
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"pi-agent-image": "0.7.
|
|
10
|
-
"pi-agent-resource": "0.7.
|
|
9
|
+
"pi-agent-image": "0.7.2",
|
|
10
|
+
"pi-agent-resource": "0.7.2"
|
|
11
11
|
},
|
|
12
12
|
"pi": {
|
|
13
13
|
"extensions": [
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-agent-filesystem-jq",
|
|
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
|
"cross-spawn": "^7.0.6",
|
|
10
|
-
"pi-agent-doctor": "0.7.
|
|
11
|
-
"pi-agent-documentation": "0.7.
|
|
12
|
-
"pi-agent-read": "0.7.
|
|
13
|
-
"pi-agent-text": "0.7.
|
|
10
|
+
"pi-agent-doctor": "0.7.2",
|
|
11
|
+
"pi-agent-documentation": "0.7.2",
|
|
12
|
+
"pi-agent-read": "0.7.2",
|
|
13
|
+
"pi-agent-text": "0.7.2"
|
|
14
14
|
},
|
|
15
15
|
"pi": {
|
|
16
16
|
"extensions": [
|
|
@@ -16,7 +16,10 @@ export function parseJqView(views: readonly string[] | undefined): JqView | unde
|
|
|
16
16
|
const jqViews = views?.filter((view) => view === "jq" || view.startsWith("jq:")) ?? [];
|
|
17
17
|
if (jqViews.length === 0) return undefined;
|
|
18
18
|
if (jqViews.length > 1) throw new Error("Read accepts only one jq view");
|
|
19
|
-
if (views?.length !== 1)
|
|
19
|
+
if (views?.length !== 1)
|
|
20
|
+
throw new Error(
|
|
21
|
+
"The jq view cannot be combined with other views. Keep only one jq:<filter> in views.",
|
|
22
|
+
);
|
|
20
23
|
const selected = jqViews[0];
|
|
21
24
|
if (selected === undefined || selected === "jq" || selected.slice(3).trim().length === 0)
|
|
22
25
|
throw new Error('The jq view requires a filter, for example views: ["jq:.scripts"]');
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-agent-filesystem-pdf",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"dependencies": {
|
|
6
|
-
"pi-agent-pdf": "0.7.
|
|
7
|
-
"pi-agent-resource": "0.7.
|
|
6
|
+
"pi-agent-pdf": "0.7.2",
|
|
7
|
+
"pi-agent-resource": "0.7.2"
|
|
8
8
|
},
|
|
9
9
|
"pi": {
|
|
10
10
|
"extensions": [
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-agent-filesystem-text",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"imports": {
|
|
6
6
|
"#extension": "./index.ts"
|
|
7
7
|
},
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"pi-agent-resource": "0.7.
|
|
10
|
-
"pi-agent-text": "0.7.
|
|
9
|
+
"pi-agent-resource": "0.7.2",
|
|
10
|
+
"pi-agent-text": "0.7.2"
|
|
11
11
|
},
|
|
12
12
|
"pi": {
|
|
13
13
|
"extensions": [
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-agent-web",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"imports": {
|
|
6
6
|
"#src/*": "./src/*"
|
|
@@ -8,12 +8,12 @@
|
|
|
8
8
|
"dependencies": {
|
|
9
9
|
"defuddle": "^0.19.1",
|
|
10
10
|
"linkedom": "^0.18.12",
|
|
11
|
-
"pi-agent-doctor": "0.7.
|
|
12
|
-
"pi-agent-image": "0.7.
|
|
13
|
-
"pi-agent-read": "0.7.
|
|
14
|
-
"pi-agent-resource": "0.7.
|
|
15
|
-
"pi-agent-search": "0.7.
|
|
16
|
-
"pi-agent-text": "0.7.
|
|
11
|
+
"pi-agent-doctor": "0.7.2",
|
|
12
|
+
"pi-agent-image": "0.7.2",
|
|
13
|
+
"pi-agent-read": "0.7.2",
|
|
14
|
+
"pi-agent-resource": "0.7.2",
|
|
15
|
+
"pi-agent-search": "0.7.2",
|
|
16
|
+
"pi-agent-text": "0.7.2",
|
|
17
17
|
"playwright-core": "^1.62.1"
|
|
18
18
|
},
|
|
19
19
|
"pi": {
|
package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-html/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-agent-web-html",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"imports": {
|
|
6
6
|
"#src/*": "./src/*"
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"dependencies": {
|
|
9
9
|
"defuddle": "^0.19.1",
|
|
10
10
|
"linkedom": "^0.18.12",
|
|
11
|
-
"pi-agent-resource": "0.7.
|
|
11
|
+
"pi-agent-resource": "0.7.2"
|
|
12
12
|
},
|
|
13
13
|
"pi": {
|
|
14
14
|
"extensions": [
|
package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-image/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-agent-web-image",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"dependencies": {
|
|
6
|
-
"pi-agent-image": "0.7.
|
|
7
|
-
"pi-agent-resource": "0.7.
|
|
6
|
+
"pi-agent-image": "0.7.2",
|
|
7
|
+
"pi-agent-resource": "0.7.2"
|
|
8
8
|
},
|
|
9
9
|
"pi": {
|
|
10
10
|
"extensions": [
|
package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-pdf/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-agent-web-pdf",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"dependencies": {
|
|
6
|
-
"pi-agent-pdf": "0.7.
|
|
7
|
-
"pi-agent-resource": "0.7.
|
|
6
|
+
"pi-agent-pdf": "0.7.2",
|
|
7
|
+
"pi-agent-resource": "0.7.2"
|
|
8
8
|
},
|
|
9
9
|
"pi": {
|
|
10
10
|
"extensions": [
|