pi-agent-ide 0.4.0 → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +41 -0
- package/README.md +74 -22
- package/assets/gallery/apply-editing.png +0 -0
- package/assets/gallery/debugging.png +0 -0
- package/assets/gallery/read-web.png +0 -0
- package/assets/gallery/search-replace.png +0 -0
- package/assets/gallery/terminal.png +0 -0
- package/assets/gallery/tool-editing.png +0 -0
- package/dist/chunk-25CZ5ZIU.js +3 -0
- package/dist/chunk-526E364R.js +3 -0
- package/dist/chunk-5PLV4HLG.js +1 -0
- package/dist/chunk-5QQABP47.js +14 -0
- package/dist/{chunk-72EEL2DW.js → chunk-6CZO43OH.js} +1 -1
- package/dist/chunk-7ALCBKCW.js +26 -0
- package/dist/chunk-AWXVJ5AC.js +1 -0
- package/dist/{chunk-GFW5QPQV.js → chunk-DQXPQOF7.js} +1 -1
- package/dist/chunk-ESPNEJHK.js +1 -0
- package/dist/chunk-G725MARR.js +16 -0
- package/dist/{chunk-M5L42DWE.js → chunk-HKXDP2FD.js} +2 -2
- package/dist/chunk-IQD6PON5.js +0 -0
- package/dist/chunk-IRECDTJG.js +27 -0
- package/dist/chunk-J4RTW44E.js +1 -0
- package/dist/{chunk-HGPUI7F3.js → chunk-KII2JQC5.js} +1 -1
- package/dist/{chunk-TI5GMJ7Q.js → chunk-L7JMDDSD.js} +1 -1
- package/dist/{chunk-6DZA4CLO.js → chunk-LY6U5EAD.js} +1 -1
- package/dist/{chunk-ERVMDQGX.js → chunk-MGCHOGQD.js} +1 -1
- package/dist/chunk-NZYDMBM6.js +1 -0
- package/dist/{chunk-Y7ZMR4LT.js → chunk-O6LE42GK.js} +1 -1
- package/dist/{chunk-KAB3AYA2.js → chunk-OBNING2A.js} +1 -1
- package/dist/chunk-P7XO5CIP.js +2 -0
- package/dist/{chunk-VFBLX4TG.js → chunk-T6LX2RX5.js} +1 -1
- package/dist/{chunk-AADJ2KIB.js → chunk-U22JNO6N.js} +1 -1
- package/dist/chunk-U2JKHKLK.js +0 -0
- package/dist/{chunk-DQF5QMJ2.js → chunk-WGGIQ7IJ.js} +1 -1
- package/dist/entry-10.js +1 -1
- package/dist/entry-11.js +1 -1
- package/dist/entry-12.js +1 -1
- package/dist/entry-13.js +1 -1
- package/dist/entry-14.js +1 -1
- package/dist/entry-15.js +1 -0
- package/dist/entry-17.js +1 -1
- package/dist/entry-18.js +1 -1
- package/dist/entry-19.js +1 -1
- package/dist/entry-20.js +1 -1
- package/dist/entry-21.js +1 -2
- package/dist/entry-22.js +2 -1
- package/dist/entry-23.js +1 -1
- package/dist/entry-24.js +1 -1
- package/dist/entry-25.js +1 -1
- package/dist/entry-26.js +1 -12
- package/dist/entry-27.js +12 -1
- package/dist/entry-28.js +1 -1
- package/dist/entry-29.js +1 -1
- package/dist/entry-30.js +1 -1
- package/dist/entry-31.js +1 -4
- package/dist/entry-32.js +3 -8
- package/dist/entry-33.js +9 -1
- package/dist/entry-34.js +1 -1
- package/dist/entry-35.js +1 -1
- package/dist/entry-36.js +1 -1
- package/dist/entry-37.js +1 -1
- package/dist/entry-38.js +1 -1
- package/dist/entry-39.js +1 -1
- package/dist/entry-40.js +1 -18
- package/dist/entry-41.js +18 -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 +1 -7
- package/dist/entry-46.js +7 -11
- package/dist/entry-47.js +11 -1
- package/dist/entry-48.js +1 -1
- package/dist/entry-49.js +1 -1
- package/dist/entry-50.js +1 -1
- package/dist/entry-51.js +1 -1
- package/dist/entry-52.js +1 -1
- package/dist/entry-53.js +1 -1
- package/dist/entry-54.js +1 -1
- package/dist/entry-55.js +1 -0
- package/dist/entry-56.js +0 -1
- package/dist/entry-57.js +1 -0
- package/dist/entry-58.js +0 -1
- package/dist/entry-59.js +1 -1
- package/dist/entry-60.js +1 -1
- package/dist/entry-61.js +1 -1
- package/dist/entry-62.js +1 -1
- package/dist/entry-63.js +1 -1
- package/dist/entry-64.js +1 -0
- package/dist/entry-65.js +0 -1
- package/dist/entry-66.js +1 -0
- package/dist/entry-67.js +0 -1
- package/dist/entry-68.js +1 -1
- package/dist/entry-69.js +1 -1
- package/dist/entry-70.js +1 -123
- package/dist/entry-71.js +198 -25
- package/dist/entry-72.js +30 -2
- package/dist/entry-73.js +2 -1
- package/dist/entry-74.js +1 -1
- package/dist/entry-75.js +1 -1
- package/dist/entry-76.js +3 -3
- package/dist/entry-77.js +3 -1
- package/dist/entry-78.js +1 -1
- package/dist/entry-79.js +1 -1
- package/dist/entry-8.js +1 -1
- package/dist/entry-80.js +1 -0
- package/dist/entry-9.js +1 -1
- package/dist/pi-agent-ide.js +3 -3
- package/docs/configuration.md +1 -1
- package/docs/development.md +0 -6
- package/docs/user-hooks.md +68 -0
- package/node_modules/pi-agent-doctor/package.json +6 -6
- package/node_modules/pi-agent-doctor/runtime/entry-21.js +1 -0
- package/node_modules/pi-agent-doctor/src/catalog.ts +9 -1
- package/node_modules/pi-agent-doctor/src/plugin-protocol.ts +5 -0
- package/node_modules/pi-agent-filesystem/package.json +7 -7
- package/node_modules/pi-agent-filesystem-image/package.json +4 -4
- package/node_modules/pi-agent-filesystem-pdf/package.json +4 -4
- package/node_modules/pi-agent-filesystem-text/package.json +4 -4
- package/node_modules/pi-agent-filesystem-text/runtime/entry-25.js +2 -0
- package/node_modules/pi-agent-ide-ast/package.json +32 -11
- package/node_modules/pi-agent-ide-ast/runtime/entry-26.js +0 -1
- package/node_modules/pi-agent-ide-ast/runtime/entry-27.js +2 -0
- package/node_modules/pi-agent-ide-ast/src/ast/manager.ts +16 -8
- package/node_modules/pi-agent-ide-ast/src/ast/native-parser.ts +151 -0
- package/node_modules/pi-agent-ide-ast/src/ast/outline.ts +22 -17
- package/node_modules/pi-agent-ide-ast/src/ast/syntax-tree.ts +25 -0
- package/node_modules/pi-agent-ide-ast/src/doctor-plugin.ts +52 -1
- package/node_modules/pi-agent-ide-ast/src/search-resolver.ts +4 -1
- package/node_modules/pi-agent-ide-changes/index.ts +3 -1
- package/node_modules/pi-agent-ide-changes/package.json +8 -8
- package/node_modules/pi-agent-ide-changes/runtime/entry-28.js +0 -1
- package/node_modules/pi-agent-ide-changes/src/tool-text-undo.ts +42 -9
- package/node_modules/pi-agent-ide-formatter/package.json +9 -4
- package/node_modules/pi-agent-ide-languages/package.json +3 -3
- package/node_modules/pi-agent-ide-lint/package.json +13 -8
- package/node_modules/pi-agent-ide-lsp/index.ts +4 -1
- package/node_modules/pi-agent-ide-lsp/package.json +15 -10
- package/node_modules/pi-agent-ide-lsp/runtime/entry-33.js +2 -0
- package/node_modules/pi-agent-image/package.json +3 -3
- package/node_modules/pi-agent-invariant/package.json +2 -2
- package/node_modules/pi-agent-pdf/package.json +3 -3
- package/node_modules/pi-agent-read/package.json +11 -11
- package/node_modules/pi-agent-read/runtime/entry-40.js +0 -1
- package/node_modules/pi-agent-read/runtime/entry-41.js +2 -0
- package/node_modules/pi-agent-read/src/api/plugin-protocol.ts +1 -1
- package/node_modules/pi-agent-read/src/api/rendering.ts +1 -1
- package/node_modules/pi-agent-read/src/api/tools/read.ts +32 -0
- package/node_modules/pi-agent-read/src/core/read-core.ts +8 -0
- package/node_modules/pi-agent-read/src/core/tools/read/raw-read.ts +38 -4
- package/node_modules/pi-agent-read/src/core/tools/read/read-renderer.ts +63 -4
- package/node_modules/pi-agent-read/src/core/tools/tool-read.ts +105 -5
- package/node_modules/pi-agent-resource/package.json +2 -2
- package/node_modules/pi-agent-search/package.json +7 -7
- package/node_modules/pi-agent-search/runtime/entry-45.js +0 -1
- package/node_modules/pi-agent-search/src/api/search-parameters.ts +5 -1
- package/node_modules/pi-agent-search-text/index.ts +1 -1
- package/node_modules/pi-agent-search-text/package.json +9 -9
- package/node_modules/pi-agent-search-text/runtime/entry-47.js +1 -0
- package/node_modules/pi-agent-search-text/src/resolvers.ts +72 -39
- package/node_modules/pi-agent-search-text/src/search-backend.ts +6 -15
- package/node_modules/pi-agent-search-text/src/search-presentation.ts +80 -0
- package/node_modules/pi-agent-search-text/src/search-renderer.ts +17 -1
- package/node_modules/pi-agent-search-text/src/search-result.ts +32 -12
- package/node_modules/pi-agent-search-text/src/search-session.ts +33 -4
- package/node_modules/pi-agent-text/package.json +3 -3
- package/node_modules/pi-agent-text/runtime/entry-49.js +1 -0
- package/node_modules/pi-agent-text-anchor-constant/package.json +4 -4
- package/node_modules/pi-agent-text-anchor-constant/runtime/entry-50.js +2 -0
- package/node_modules/pi-agent-text-anchor-exact/package.json +5 -5
- package/node_modules/pi-agent-text-anchor-exact/runtime/entry-51.js +0 -1
- package/node_modules/pi-agent-text-anchor-exact/runtime/entry-52.js +2 -0
- package/node_modules/pi-agent-text-anchor-line-hash/package.json +7 -7
- package/node_modules/pi-agent-text-anchor-line-hash/runtime/entry-53.js +0 -1
- package/node_modules/pi-agent-text-anchor-line-hash/runtime/entry-54.js +2 -0
- package/node_modules/pi-agent-text-editor/package.json +25 -25
- package/node_modules/pi-agent-text-editor/runtime/entry-70.js +0 -1
- package/node_modules/pi-agent-text-editor/src/api/edit-completion.ts +7 -1
- package/node_modules/pi-agent-text-editor/src/api/edit-pipeline.ts +3 -0
- package/node_modules/pi-agent-text-editor/src/api/mutation-guard.ts +1 -0
- package/node_modules/pi-agent-text-editor/src/api/mutation-tool.ts +47 -0
- package/node_modules/pi-agent-text-editor/src/api/plugin-protocol.ts +6 -1
- package/node_modules/pi-agent-text-editor/src/core/apply/apply-undo-store.ts +155 -0
- package/node_modules/pi-agent-text-editor/src/core/apply/execution.ts +56 -77
- package/node_modules/pi-agent-text-editor/src/core/apply/mixed-source.ts +7 -12
- package/node_modules/pi-agent-text-editor/src/core/apply/mutation-outcome.ts +2 -0
- package/node_modules/pi-agent-text-editor/src/core/apply/output.ts +37 -8
- package/node_modules/pi-agent-text-editor/src/core/apply/prompt.ts +42 -37
- package/node_modules/pi-agent-text-editor/src/core/apply/renderer.ts +51 -15
- package/node_modules/pi-agent-text-editor/src/core/apply/runtime.ts +119 -20
- package/node_modules/pi-agent-text-editor/src/core/apply/tool.ts +28 -7
- package/node_modules/pi-agent-text-editor/src/core/apply/transaction.ts +387 -0
- package/node_modules/pi-agent-text-editor/src/core/extension.ts +3 -2
- package/node_modules/pi-agent-text-editor/src/core/file-operation-tools.ts +68 -71
- package/node_modules/pi-agent-text-editor/src/core/file-operations.ts +4 -4
- package/node_modules/pi-agent-text-editor/src/core/text-edit-batch-registrar.ts +11 -0
- 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 +141 -6
- package/node_modules/pi-agent-text-editor/src/core/text-mutation.ts +123 -4
- package/node_modules/pi-agent-text-editor/src/tools/tool-text-copy.ts +9 -4
- package/node_modules/pi-agent-text-editor/src/tools/tool-text-delete.ts +3 -2
- package/node_modules/pi-agent-text-editor/src/tools/tool-text-move.ts +9 -4
- package/node_modules/pi-agent-text-editor-renderer/index.ts +5 -0
- package/node_modules/pi-agent-text-editor-renderer/package.json +6 -6
- package/node_modules/pi-agent-text-editor-renderer/src/renderer.ts +59 -0
- package/node_modules/pi-agent-text-editor-stale-anchor/package.json +5 -5
- package/node_modules/pi-agent-text-editor-stale-anchor/runtime/entry-73.js +2 -0
- package/node_modules/pi-agent-tool-call-interception/package.json +3 -3
- package/node_modules/pi-agent-tool-ui/package.json +2 -2
- package/node_modules/pi-agent-tool-ui/runtime/entry-75.js +1 -0
- package/node_modules/pi-agent-web/package.json +7 -7
- package/node_modules/pi-agent-web/src/resolver.ts +128 -1
- package/node_modules/pi-agent-web-html/package.json +3 -3
- package/node_modules/pi-agent-web-image/package.json +4 -4
- package/node_modules/pi-agent-web-pdf/package.json +4 -4
- package/node_modules/pi-agent-web-text/package.json +4 -4
- package/node_modules/pi-agent-web-text/runtime/entry-80.js +2 -0
- package/package.json +59 -39
- package/src/api/hooks.ts +168 -0
- package/src/api/text-editor.ts +2 -0
- package/src/composite/builtin-extensions.ts +7 -0
- package/src/composite/module-labels.ts +8 -0
- package/src/composite/preferences.ts +3 -3
- package/src/core/reload-resource-store.ts +34 -0
- package/src/doctor/tip-provider.ts +1 -0
- 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 +4 -4
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-pdf/package.json +4 -4
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-text/package.json +4 -4
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-text/runtime/entry-25.js +2 -0
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/runtime/entry-22.js +2 -0
- 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 +3 -3
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-image/package.json +4 -4
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-pdf/package.json +4 -4
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-text/package.json +4 -4
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-text/runtime/entry-80.js +2 -0
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/runtime/entry-76.js +2 -0
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/src/resolver.ts +128 -1
- package/src/extensions/pi-agent-read/package.json +11 -11
- package/src/extensions/pi-agent-read/runtime/entry-40.js +0 -1
- package/src/extensions/pi-agent-read/runtime/entry-41.js +2 -0
- package/src/extensions/pi-agent-read/src/api/plugin-protocol.ts +1 -1
- package/src/extensions/pi-agent-read/src/api/rendering.ts +1 -1
- package/src/extensions/pi-agent-read/src/api/tools/read.ts +32 -0
- package/src/extensions/pi-agent-read/src/core/read-core.ts +8 -0
- package/src/extensions/pi-agent-read/src/core/tools/read/raw-read.ts +38 -4
- package/src/extensions/pi-agent-read/src/core/tools/read/read-renderer.ts +63 -4
- package/src/extensions/pi-agent-read/src/core/tools/tool-read.ts +105 -5
- package/src/extensions/pi-agent-search/package.json +7 -7
- 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 +9 -9
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/runtime/entry-47.js +1 -0
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/runtime/entry-48.js +1 -0
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/resolvers.ts +72 -39
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-backend.ts +6 -15
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-presentation.ts +80 -0
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-renderer.ts +17 -1
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-result.ts +32 -12
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-session.ts +33 -4
- package/src/extensions/pi-agent-search/runtime/entry-45.js +0 -1
- package/src/extensions/pi-agent-search/runtime/entry-46.js +2 -0
- package/src/extensions/pi-agent-search/src/api/search-parameters.ts +5 -1
- package/src/extensions/pi-agent-text-editor/package.json +25 -25
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-constant/package.json +4 -4
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-constant/runtime/entry-50.js +2 -0
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/package.json +5 -5
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/runtime/entry-51.js +0 -1
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/runtime/entry-52.js +2 -0
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/package.json +7 -7
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/runtime/entry-53.js +0 -1
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/runtime/entry-54.js +2 -0
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/index.ts +5 -0
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/package.json +6 -6
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/renderer.ts +59 -0
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-stale-anchor/package.json +5 -5
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-stale-anchor/runtime/entry-73.js +2 -0
- package/src/extensions/pi-agent-text-editor/runtime/entry-70.js +0 -1
- package/src/extensions/pi-agent-text-editor/runtime/entry-71.js +2 -0
- package/src/extensions/pi-agent-text-editor/src/api/edit-completion.ts +7 -1
- package/src/extensions/pi-agent-text-editor/src/api/edit-pipeline.ts +3 -0
- package/src/extensions/pi-agent-text-editor/src/api/mutation-guard.ts +1 -0
- package/src/extensions/pi-agent-text-editor/src/api/mutation-tool.ts +47 -0
- package/src/extensions/pi-agent-text-editor/src/api/plugin-protocol.ts +6 -1
- package/src/extensions/pi-agent-text-editor/src/core/apply/apply-undo-store.ts +155 -0
- package/src/extensions/pi-agent-text-editor/src/core/apply/execution.ts +56 -77
- package/src/extensions/pi-agent-text-editor/src/core/apply/mixed-source.ts +7 -12
- package/src/extensions/pi-agent-text-editor/src/core/apply/mutation-outcome.ts +2 -0
- package/src/extensions/pi-agent-text-editor/src/core/apply/output.ts +37 -8
- package/src/extensions/pi-agent-text-editor/src/core/apply/prompt.ts +42 -37
- package/src/extensions/pi-agent-text-editor/src/core/apply/renderer.ts +51 -15
- package/src/extensions/pi-agent-text-editor/src/core/apply/runtime.ts +119 -20
- package/src/extensions/pi-agent-text-editor/src/core/apply/tool.ts +28 -7
- package/src/extensions/pi-agent-text-editor/src/core/apply/transaction.ts +387 -0
- package/src/extensions/pi-agent-text-editor/src/core/extension.ts +3 -2
- package/src/extensions/pi-agent-text-editor/src/core/file-operation-tools.ts +68 -71
- package/src/extensions/pi-agent-text-editor/src/core/file-operations.ts +4 -4
- package/src/extensions/pi-agent-text-editor/src/core/text-edit-batch-registrar.ts +11 -0
- 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 +141 -6
- package/src/extensions/pi-agent-text-editor/src/core/text-mutation.ts +123 -4
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-copy.ts +9 -4
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-delete.ts +3 -2
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-move.ts +9 -4
- package/src/plugins/pi-agent-ide-ast/package.json +32 -11
- package/src/plugins/pi-agent-ide-ast/runtime/entry-26.js +0 -1
- package/src/plugins/pi-agent-ide-ast/runtime/entry-27.js +2 -0
- package/src/plugins/pi-agent-ide-ast/src/ast/manager.ts +16 -8
- package/src/plugins/pi-agent-ide-ast/src/ast/native-parser.ts +151 -0
- package/src/plugins/pi-agent-ide-ast/src/ast/outline.ts +22 -17
- package/src/plugins/pi-agent-ide-ast/src/ast/syntax-tree.ts +25 -0
- package/src/plugins/pi-agent-ide-ast/src/doctor-plugin.ts +52 -1
- package/src/plugins/pi-agent-ide-ast/src/search-resolver.ts +4 -1
- package/src/plugins/pi-agent-ide-changes/index.ts +3 -1
- package/src/plugins/pi-agent-ide-changes/package.json +8 -8
- package/src/plugins/pi-agent-ide-changes/runtime/entry-28.js +0 -1
- package/src/plugins/pi-agent-ide-changes/src/tool-text-undo.ts +42 -9
- package/src/plugins/pi-agent-ide-debugger/index.ts +573 -0
- package/src/plugins/pi-agent-ide-debugger/src/breakpoint-view.ts +73 -0
- package/src/plugins/pi-agent-ide-debugger/src/catalog.ts +306 -0
- package/src/plugins/pi-agent-ide-debugger/src/dap-client.ts +338 -0
- package/src/plugins/pi-agent-ide-debugger/src/doctor-plugin.ts +349 -0
- package/src/plugins/pi-agent-ide-debugger/src/process-provider.ts +39 -0
- package/src/plugins/pi-agent-ide-debugger/src/renderer.ts +152 -0
- package/src/plugins/pi-agent-ide-debugger/src/session-manager.ts +1344 -0
- package/src/plugins/pi-agent-ide-debugger/src/ui.ts +14 -0
- package/src/plugins/pi-agent-ide-formatter/package.json +9 -4
- package/src/plugins/pi-agent-ide-languages/package.json +3 -3
- package/src/plugins/pi-agent-ide-lint/package.json +13 -8
- package/src/plugins/pi-agent-ide-lsp/index.ts +4 -1
- package/src/plugins/pi-agent-ide-lsp/package.json +15 -10
- package/src/plugins/pi-agent-ide-lsp/runtime/entry-33.js +2 -0
- package/src/plugins/pi-agent-ide-processes/index.ts +28 -0
- package/src/plugins/pi-agent-ide-processes/src/registry.ts +83 -0
- package/src/plugins/pi-agent-ide-processes/src/ui.ts +260 -0
- package/src/plugins/pi-agent-ide-terminal/index.ts +19 -13
- package/src/plugins/pi-agent-ide-terminal/src/output-limits.ts +52 -0
- package/src/plugins/pi-agent-ide-terminal/src/process-provider.ts +31 -0
- package/src/plugins/pi-agent-ide-terminal/src/renderer.ts +24 -58
- package/src/plugins/pi-agent-ide-terminal/src/resources.ts +5 -14
- package/src/plugins/pi-agent-ide-terminal/src/search.ts +32 -2
- package/src/plugins/pi-agent-ide-terminal/src/session-manager.ts +114 -1
- package/src/plugins/pi-agent-ide-terminal/src/tools.ts +23 -29
- package/src/plugins/pi-agent-ide-terminal/src/types.ts +14 -1
- package/src/plugins/pi-agent-ide-terminal/src/ui.ts +116 -240
- package/dist/chunk-3SE372WC.js +0 -3
- package/dist/chunk-5MSNYFDE.js +0 -1
- package/dist/chunk-7JYQMAEL.js +0 -14
- package/dist/chunk-B5KB2I7J.js +0 -3
- package/dist/chunk-NMFQGKPE.js +0 -2
- package/dist/chunk-OVUYPHDE.js +0 -1
- package/dist/chunk-TPIHQYK2.js +0 -14
- package/dist/chunk-XSTHESNR.js +0 -25
- package/dist/entry-16.js +0 -1
- package/docs/evaluation.md +0 -14
- package/node_modules/pi-agent-doctor/runtime/entry-16.js +0 -1
- package/node_modules/pi-agent-filesystem/runtime/entry-21.js +0 -2
- package/node_modules/pi-agent-ide-ast/runtime/entry-25.js +0 -1
- package/node_modules/pi-agent-ide-changes/runtime/entry-27.js +0 -1
- package/node_modules/pi-agent-image/runtime/entry-33.js +0 -1
- package/node_modules/pi-agent-resource/runtime/entry-41.js +0 -1
- package/node_modules/pi-agent-text-anchor-constant/runtime/entry-49.js +0 -2
- package/node_modules/pi-agent-text-anchor-exact/runtime/entry-50.js +0 -1
- package/node_modules/pi-agent-text-anchor-line-hash/runtime/entry-52.js +0 -1
- package/node_modules/pi-agent-text-editor/runtime/entry-54.js +0 -1
- package/node_modules/pi-agent-tool-call-interception/runtime/entry-73.js +0 -1
- package/node_modules/pi-agent-web/runtime/entry-75.js +0 -2
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-image/runtime/entry-22.js +0 -2
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/runtime/entry-21.js +0 -2
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-html/runtime/entry-76.js +0 -2
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/runtime/entry-75.js +0 -2
- package/src/extensions/pi-agent-read/runtime/entry-36.js +0 -1
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/runtime/entry-46.js +0 -2
- package/src/extensions/pi-agent-search/runtime/entry-42.js +0 -1
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-constant/runtime/entry-49.js +0 -2
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/runtime/entry-50.js +0 -1
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/runtime/entry-52.js +0 -1
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/runtime/entry-71.js +0 -2
- package/src/extensions/pi-agent-text-editor/runtime/entry-54.js +0 -1
- package/src/plugins/pi-agent-ide-ast/runtime/entry-25.js +0 -1
- package/src/plugins/pi-agent-ide-changes/runtime/entry-27.js +0 -1
- /package/node_modules/{pi-agent-filesystem-image → pi-agent-filesystem}/runtime/entry-22.js +0 -0
- /package/node_modules/{pi-agent-filesystem-pdf → pi-agent-filesystem-image}/runtime/entry-23.js +0 -0
- /package/node_modules/{pi-agent-filesystem-text → pi-agent-filesystem-pdf}/runtime/entry-24.js +0 -0
- /package/node_modules/{pi-agent-ide-formatter → pi-agent-ide-changes}/runtime/entry-29.js +0 -0
- /package/node_modules/{pi-agent-ide-languages → pi-agent-ide-formatter}/runtime/entry-30.js +0 -0
- /package/node_modules/{pi-agent-ide-lint → pi-agent-ide-languages}/runtime/entry-31.js +0 -0
- /package/node_modules/{pi-agent-ide-lsp → pi-agent-ide-lint}/runtime/entry-32.js +0 -0
- /package/node_modules/{pi-agent-invariant → pi-agent-image}/runtime/entry-34.js +0 -0
- /package/node_modules/{pi-agent-pdf → pi-agent-invariant}/runtime/entry-35.js +0 -0
- /package/node_modules/{pi-agent-read → pi-agent-pdf}/runtime/entry-36.js +0 -0
- /package/node_modules/{pi-agent-search → pi-agent-resource}/runtime/entry-42.js +0 -0
- /package/node_modules/{pi-agent-search-text → pi-agent-search}/runtime/entry-46.js +0 -0
- /package/node_modules/{pi-agent-text → pi-agent-search-text}/runtime/entry-48.js +0 -0
- /package/node_modules/{pi-agent-text-editor-renderer → pi-agent-text-editor}/runtime/entry-71.js +0 -0
- /package/node_modules/{pi-agent-text-editor-stale-anchor → pi-agent-text-editor-renderer}/runtime/entry-72.js +0 -0
- /package/node_modules/{pi-agent-tool-ui → pi-agent-tool-call-interception}/runtime/entry-74.js +0 -0
- /package/node_modules/{pi-agent-web-html → pi-agent-web}/runtime/entry-76.js +0 -0
- /package/node_modules/{pi-agent-web-image → pi-agent-web-html}/runtime/entry-77.js +0 -0
- /package/node_modules/{pi-agent-web-pdf → pi-agent-web-image}/runtime/entry-78.js +0 -0
- /package/node_modules/{pi-agent-web-text → pi-agent-web-pdf}/runtime/entry-79.js +0 -0
- /package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/{pi-agent-filesystem-pdf → pi-agent-filesystem-image}/runtime/entry-23.js +0 -0
- /package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/{pi-agent-filesystem-text → pi-agent-filesystem-pdf}/runtime/entry-24.js +0 -0
- /package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/{pi-agent-web-image → pi-agent-web-html}/runtime/entry-77.js +0 -0
- /package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/{pi-agent-web-pdf → pi-agent-web-image}/runtime/entry-78.js +0 -0
- /package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/{pi-agent-web-text → pi-agent-web-pdf}/runtime/entry-79.js +0 -0
- /package/src/extensions/pi-agent-text-editor/plugins/{pi-agent-text-editor-stale-anchor → pi-agent-text-editor-renderer}/runtime/entry-72.js +0 -0
- /package/src/plugins/{pi-agent-ide-formatter → pi-agent-ide-changes}/runtime/entry-29.js +0 -0
- /package/src/plugins/{pi-agent-ide-languages → pi-agent-ide-formatter}/runtime/entry-30.js +0 -0
- /package/src/plugins/{pi-agent-ide-lint → pi-agent-ide-languages}/runtime/entry-31.js +0 -0
- /package/src/plugins/{pi-agent-ide-lsp → pi-agent-ide-lint}/runtime/entry-32.js +0 -0
package/src/api/hooks.ts
ADDED
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
|
2
|
+
import { connectReadPlugin, READ_API_VERSION, READ_PROTOCOL, type ReadRequest } from "./read.js";
|
|
3
|
+
import {
|
|
4
|
+
connectTextEditorPlugin,
|
|
5
|
+
TEXT_EDITOR_API_VERSION,
|
|
6
|
+
TEXT_EDITOR_PROTOCOL,
|
|
7
|
+
type AppliedTextChange,
|
|
8
|
+
type TextDocument,
|
|
9
|
+
} from "./text-editor.js";
|
|
10
|
+
|
|
11
|
+
/** The decision returned by a file policy hook. */
|
|
12
|
+
export type FileHookDecision =
|
|
13
|
+
| { readonly decision: "allow" }
|
|
14
|
+
| { readonly decision: "deny"; readonly reason: string };
|
|
15
|
+
|
|
16
|
+
/** A resolved Resource that is about to be read. */
|
|
17
|
+
export interface BeforeReadEvent {
|
|
18
|
+
readonly requestedSource: string;
|
|
19
|
+
readonly resourceSource: string;
|
|
20
|
+
readonly resolvedBy: string;
|
|
21
|
+
readonly cwd: string;
|
|
22
|
+
readonly request: ReadRequest;
|
|
23
|
+
readonly audience: "agent" | "script";
|
|
24
|
+
readonly signal?: AbortSignal;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export interface BeforeReadHook {
|
|
28
|
+
readonly id: string;
|
|
29
|
+
run(event: BeforeReadEvent): FileHookDecision | Promise<FileHookDecision>;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/** A complete, resolved mutation plan before its first write. */
|
|
33
|
+
export interface BeforeEditEvent {
|
|
34
|
+
readonly cwd: string;
|
|
35
|
+
readonly intent: "edit" | "restore" | "mixed";
|
|
36
|
+
readonly resources: readonly {
|
|
37
|
+
readonly resourceSource: string;
|
|
38
|
+
readonly existed: boolean;
|
|
39
|
+
readonly before: TextDocument;
|
|
40
|
+
readonly after: TextDocument;
|
|
41
|
+
readonly changes: readonly AppliedTextChange[];
|
|
42
|
+
}[];
|
|
43
|
+
readonly signal?: AbortSignal;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export interface BeforeEditHook {
|
|
47
|
+
readonly id: string;
|
|
48
|
+
run(event: BeforeEditEvent): FileHookDecision | Promise<FileHookDecision>;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/** A final saved Resource after post-processing and rereading. */
|
|
52
|
+
export interface AfterEditEvent {
|
|
53
|
+
readonly source: string;
|
|
54
|
+
readonly resourceSource: string;
|
|
55
|
+
readonly resolvedBy: string;
|
|
56
|
+
readonly cwd: string;
|
|
57
|
+
readonly existed: boolean;
|
|
58
|
+
readonly before: TextDocument;
|
|
59
|
+
readonly after: TextDocument;
|
|
60
|
+
readonly intent: "edit" | "restore" | "mixed";
|
|
61
|
+
readonly signal?: AbortSignal;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export type AfterEditResult = void | {
|
|
65
|
+
readonly feedback: string;
|
|
66
|
+
readonly tone?: "info" | "warning" | "error";
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
export interface AfterEditHook {
|
|
70
|
+
readonly id: string;
|
|
71
|
+
run(event: AfterEditEvent): AfterEditResult | Promise<AfterEditResult>;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/** Register a fail-closed policy over resolved Resources before content is read. */
|
|
75
|
+
export function connectBeforeReadHook(
|
|
76
|
+
pi: ExtensionAPI,
|
|
77
|
+
hook: BeforeReadHook,
|
|
78
|
+
): void | Promise<void> {
|
|
79
|
+
assertHook(hook);
|
|
80
|
+
return connectReadPlugin(pi, {
|
|
81
|
+
protocol: READ_PROTOCOL,
|
|
82
|
+
apiVersion: READ_API_VERSION,
|
|
83
|
+
id: `hook/before-read/${hook.id}`,
|
|
84
|
+
setup(api) {
|
|
85
|
+
api.addResourceGuard({
|
|
86
|
+
id: hook.id,
|
|
87
|
+
async guard(event) {
|
|
88
|
+
const result = await hook.run(event);
|
|
89
|
+
return result.decision === "allow"
|
|
90
|
+
? { kind: "accepted" }
|
|
91
|
+
: { kind: "rejected", reason: result.reason };
|
|
92
|
+
},
|
|
93
|
+
});
|
|
94
|
+
},
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/** Register a fail-closed policy over complete mutation plans before writing. */
|
|
99
|
+
export function connectBeforeEditHook(
|
|
100
|
+
pi: ExtensionAPI,
|
|
101
|
+
hook: BeforeEditHook,
|
|
102
|
+
): void | Promise<void> {
|
|
103
|
+
assertHook(hook);
|
|
104
|
+
return connectTextEditorPlugin(pi, {
|
|
105
|
+
protocol: TEXT_EDITOR_PROTOCOL,
|
|
106
|
+
apiVersion: TEXT_EDITOR_API_VERSION,
|
|
107
|
+
id: `hook/before-edit/${hook.id}`,
|
|
108
|
+
setup(api) {
|
|
109
|
+
api.addMutationGuard({
|
|
110
|
+
id: hook.id,
|
|
111
|
+
async guard(plan, context) {
|
|
112
|
+
const decision = await hook.run({
|
|
113
|
+
cwd: context.cwd,
|
|
114
|
+
intent: context.intent ?? "edit",
|
|
115
|
+
resources: plan.resources.map((resource) => ({
|
|
116
|
+
resourceSource: resource.source,
|
|
117
|
+
existed: resource.existed,
|
|
118
|
+
before: resource.before,
|
|
119
|
+
after: resource.after,
|
|
120
|
+
changes: resource.changes,
|
|
121
|
+
})),
|
|
122
|
+
...(context.signal !== undefined && { signal: context.signal }),
|
|
123
|
+
});
|
|
124
|
+
return decision.decision === "allow"
|
|
125
|
+
? { kind: "accepted" }
|
|
126
|
+
: {
|
|
127
|
+
kind: "rejected",
|
|
128
|
+
rejection: {
|
|
129
|
+
code: "MUTATION_REJECTED",
|
|
130
|
+
reason: decision.reason,
|
|
131
|
+
message: `Edit blocked by hook ${hook.id}: ${decision.reason}`,
|
|
132
|
+
effect: "not-applied",
|
|
133
|
+
},
|
|
134
|
+
};
|
|
135
|
+
},
|
|
136
|
+
});
|
|
137
|
+
},
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
/** Register an advisory check over final saved edits. Feedback never rolls back the write. */
|
|
142
|
+
export function connectAfterEditHook(pi: ExtensionAPI, hook: AfterEditHook): void | Promise<void> {
|
|
143
|
+
assertHook(hook);
|
|
144
|
+
return connectTextEditorPlugin(pi, {
|
|
145
|
+
protocol: TEXT_EDITOR_PROTOCOL,
|
|
146
|
+
apiVersion: TEXT_EDITOR_API_VERSION,
|
|
147
|
+
id: `hook/after-edit/${hook.id}`,
|
|
148
|
+
setup(api) {
|
|
149
|
+
api.onDidEdit(async (completion) => {
|
|
150
|
+
if (completion.postProcessing === "deferred") return;
|
|
151
|
+
try {
|
|
152
|
+
return await hook.run(completion);
|
|
153
|
+
} catch (error) {
|
|
154
|
+
return {
|
|
155
|
+
feedback: `After-edit hook ${hook.id} failed after the edit was saved: ${error instanceof Error ? error.message : String(error)}`,
|
|
156
|
+
tone: "error" as const,
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
});
|
|
160
|
+
},
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
function assertHook(hook: { readonly id: string; readonly run: unknown }): void {
|
|
165
|
+
if (hook.id.trim().length === 0 || typeof hook.run !== "function") {
|
|
166
|
+
throw new TypeError("A file hook needs a non-empty id and run function");
|
|
167
|
+
}
|
|
168
|
+
}
|
package/src/api/text-editor.ts
CHANGED
|
@@ -11,3 +11,5 @@ export {
|
|
|
11
11
|
type TextPostEditStatusContribution,
|
|
12
12
|
} from "pi-agent-text-editor/api/post-edit";
|
|
13
13
|
export type { MutationDiffStatus } from "pi-agent-text-editor/api/mutation-result";
|
|
14
|
+
export type { TextDocument } from "pi-agent-text";
|
|
15
|
+
export type { AppliedTextChange } from "pi-agent-text-editor/api/mutation-guard";
|
|
@@ -122,7 +122,14 @@ export const BUILTIN_EXTENSIONS: readonly BuiltinExtension[] = [
|
|
|
122
122
|
"read.core",
|
|
123
123
|
"search.core",
|
|
124
124
|
]),
|
|
125
|
+
builtin("ide.processes", () => import("#src/plugins/pi-agent-ide-processes/index.js")),
|
|
126
|
+
builtin("ide.debugger", () => import("#src/plugins/pi-agent-ide-debugger/index.js"), [
|
|
127
|
+
"ide.processes",
|
|
128
|
+
"read.core",
|
|
129
|
+
"editor.core",
|
|
130
|
+
]),
|
|
125
131
|
builtin("ide.terminal", () => import("#src/plugins/pi-agent-ide-terminal/index.js"), [
|
|
132
|
+
"ide.processes",
|
|
126
133
|
"read.core",
|
|
127
134
|
"search.core",
|
|
128
135
|
"editor.core",
|
|
@@ -7,6 +7,14 @@ export const moduleLabels = {
|
|
|
7
7
|
"ide.tips": ["Getting started tips", "Show contextual guidance while setting up a project."],
|
|
8
8
|
"ide.doctor": ["Setup doctor", "Check external tools and help configure project support."],
|
|
9
9
|
"ide.languages": ["Language setup", "Discover languages and their recommended toolchains."],
|
|
10
|
+
"ide.processes": [
|
|
11
|
+
"Agent IDE processes",
|
|
12
|
+
"Show active terminal and debugger sessions in one shared process surface.",
|
|
13
|
+
],
|
|
14
|
+
"ide.debugger": [
|
|
15
|
+
"Debugger sessions",
|
|
16
|
+
"Debug local programs through addressable DAP sessions and anchored breakpoints.",
|
|
17
|
+
],
|
|
10
18
|
"ide.terminal": [
|
|
11
19
|
"Terminal sessions",
|
|
12
20
|
"Run and manage local interactive and background terminal processes.",
|
|
@@ -11,10 +11,10 @@ export interface AgentIdePreference {
|
|
|
11
11
|
/** Registered presentation preferences. */
|
|
12
12
|
export const AGENT_IDE_PREFERENCES: readonly AgentIdePreference[] = [
|
|
13
13
|
{
|
|
14
|
-
id: "
|
|
15
|
-
name: "Active
|
|
14
|
+
id: "processes.activity",
|
|
15
|
+
name: "Active Agent IDE processes",
|
|
16
16
|
description:
|
|
17
|
-
"Choose detailed
|
|
17
|
+
"Choose detailed process cards, a compact active count, or no persistent Agent IDE process UI.",
|
|
18
18
|
default: "detailed",
|
|
19
19
|
group: "ui",
|
|
20
20
|
values: [
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
const reloadResourceStoreKey = Symbol.for("pi-agent-ide.reload-resource-store");
|
|
2
|
+
|
|
3
|
+
type ReloadResourceStore = Map<string, unknown>;
|
|
4
|
+
type GlobalWithReloadResources = typeof globalThis & {
|
|
5
|
+
[reloadResourceStoreKey]?: ReloadResourceStore;
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
function store(): ReloadResourceStore {
|
|
9
|
+
const sharedGlobal = globalThis as GlobalWithReloadResources;
|
|
10
|
+
const existing = sharedGlobal[reloadResourceStoreKey];
|
|
11
|
+
if (existing !== undefined) return existing;
|
|
12
|
+
const created = new Map<string, unknown>();
|
|
13
|
+
sharedGlobal[reloadResourceStoreKey] = created;
|
|
14
|
+
return created;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/** Retain one live resource owner while extension modules reload in this process. */
|
|
18
|
+
export function retainReloadResource(key: string, value: unknown): void {
|
|
19
|
+
store().set(key, value);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/** Transfer a retained resource owner to the newly loaded extension instance. */
|
|
23
|
+
export function takeReloadResource(key: string): unknown {
|
|
24
|
+
const resources = store();
|
|
25
|
+
const value = resources.get(key);
|
|
26
|
+
resources.delete(key);
|
|
27
|
+
return value;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/** Remove a retained owner only when it is the expected instance. */
|
|
31
|
+
export function forgetReloadResource(key: string, value: unknown): void {
|
|
32
|
+
const resources = store();
|
|
33
|
+
if (resources.get(key) === value) resources.delete(key);
|
|
34
|
+
}
|
|
@@ -72,6 +72,7 @@ function setupItems(result: DoctorSetupRun): readonly SetupItem[] {
|
|
|
72
72
|
.filter((language) => result.detectedLanguages.has(language))
|
|
73
73
|
.join(", ");
|
|
74
74
|
const capability = {
|
|
75
|
+
debugger: "debugging",
|
|
75
76
|
formatter: "formatting",
|
|
76
77
|
linter: "linting",
|
|
77
78
|
lsp: "language support",
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-agent-filesystem",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"imports": {
|
|
6
6
|
"#src/*": "./src/*"
|
|
7
7
|
},
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"pi-agent-image": "0.
|
|
10
|
-
"pi-agent-read": "0.
|
|
11
|
-
"pi-agent-resource": "0.
|
|
12
|
-
"pi-agent-text": "0.
|
|
13
|
-
"pi-agent-text-editor": "0.
|
|
9
|
+
"pi-agent-image": "0.5.1",
|
|
10
|
+
"pi-agent-read": "0.5.1",
|
|
11
|
+
"pi-agent-resource": "0.5.1",
|
|
12
|
+
"pi-agent-text": "0.5.1",
|
|
13
|
+
"pi-agent-text-editor": "0.5.1"
|
|
14
14
|
},
|
|
15
15
|
"pi": {
|
|
16
16
|
"extensions": [
|
|
17
|
-
"./runtime/entry-
|
|
17
|
+
"./runtime/entry-22.js"
|
|
18
18
|
]
|
|
19
19
|
},
|
|
20
20
|
"peerDependencies": {
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-agent-filesystem-image",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"imports": {
|
|
6
6
|
"#extension": "./index.ts"
|
|
7
7
|
},
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"pi-agent-image": "0.
|
|
10
|
-
"pi-agent-resource": "0.
|
|
9
|
+
"pi-agent-image": "0.5.1",
|
|
10
|
+
"pi-agent-resource": "0.5.1"
|
|
11
11
|
},
|
|
12
12
|
"pi": {
|
|
13
13
|
"extensions": [
|
|
14
|
-
"./runtime/entry-
|
|
14
|
+
"./runtime/entry-23.js"
|
|
15
15
|
]
|
|
16
16
|
},
|
|
17
17
|
"peerDependencies": {
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-agent-filesystem-pdf",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"dependencies": {
|
|
6
|
-
"pi-agent-pdf": "0.
|
|
7
|
-
"pi-agent-resource": "0.
|
|
6
|
+
"pi-agent-pdf": "0.5.1",
|
|
7
|
+
"pi-agent-resource": "0.5.1"
|
|
8
8
|
},
|
|
9
9
|
"pi": {
|
|
10
10
|
"extensions": [
|
|
11
|
-
"./runtime/entry-
|
|
11
|
+
"./runtime/entry-24.js"
|
|
12
12
|
]
|
|
13
13
|
},
|
|
14
14
|
"peerDependencies": {
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-agent-filesystem-text",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"imports": {
|
|
6
6
|
"#extension": "./index.ts"
|
|
7
7
|
},
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"pi-agent-resource": "0.
|
|
10
|
-
"pi-agent-text": "0.
|
|
9
|
+
"pi-agent-resource": "0.5.1",
|
|
10
|
+
"pi-agent-text": "0.5.1"
|
|
11
11
|
},
|
|
12
12
|
"pi": {
|
|
13
13
|
"extensions": [
|
|
14
|
-
"./runtime/entry-
|
|
14
|
+
"./runtime/entry-25.js"
|
|
15
15
|
]
|
|
16
16
|
},
|
|
17
17
|
"peerDependencies": {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-agent-web",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"imports": {
|
|
6
6
|
"#src/*": "./src/*"
|
|
@@ -8,16 +8,16 @@
|
|
|
8
8
|
"dependencies": {
|
|
9
9
|
"defuddle": "^0.19.1",
|
|
10
10
|
"linkedom": "^0.18.12",
|
|
11
|
-
"pi-agent-doctor": "0.
|
|
12
|
-
"pi-agent-image": "0.
|
|
13
|
-
"pi-agent-read": "0.
|
|
14
|
-
"pi-agent-resource": "0.
|
|
15
|
-
"pi-agent-text": "0.
|
|
11
|
+
"pi-agent-doctor": "0.5.1",
|
|
12
|
+
"pi-agent-image": "0.5.1",
|
|
13
|
+
"pi-agent-read": "0.5.1",
|
|
14
|
+
"pi-agent-resource": "0.5.1",
|
|
15
|
+
"pi-agent-text": "0.5.1",
|
|
16
16
|
"playwright-core": "^1.62.1"
|
|
17
17
|
},
|
|
18
18
|
"pi": {
|
|
19
19
|
"extensions": [
|
|
20
|
-
"./runtime/entry-
|
|
20
|
+
"./runtime/entry-76.js"
|
|
21
21
|
]
|
|
22
22
|
},
|
|
23
23
|
"peerDependencies": {
|
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.
|
|
3
|
+
"version": "0.5.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"imports": {
|
|
6
6
|
"#src/*": "./src/*"
|
|
@@ -8,11 +8,11 @@
|
|
|
8
8
|
"dependencies": {
|
|
9
9
|
"defuddle": "^0.19.1",
|
|
10
10
|
"linkedom": "^0.18.12",
|
|
11
|
-
"pi-agent-resource": "0.
|
|
11
|
+
"pi-agent-resource": "0.5.1"
|
|
12
12
|
},
|
|
13
13
|
"pi": {
|
|
14
14
|
"extensions": [
|
|
15
|
-
"./runtime/entry-
|
|
15
|
+
"./runtime/entry-77.js"
|
|
16
16
|
]
|
|
17
17
|
},
|
|
18
18
|
"peerDependencies": {
|
package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-image/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-agent-web-image",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"dependencies": {
|
|
6
|
-
"pi-agent-image": "0.
|
|
7
|
-
"pi-agent-resource": "0.
|
|
6
|
+
"pi-agent-image": "0.5.1",
|
|
7
|
+
"pi-agent-resource": "0.5.1"
|
|
8
8
|
},
|
|
9
9
|
"pi": {
|
|
10
10
|
"extensions": [
|
|
11
|
-
"./runtime/entry-
|
|
11
|
+
"./runtime/entry-78.js"
|
|
12
12
|
]
|
|
13
13
|
},
|
|
14
14
|
"peerDependencies": {
|
package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-pdf/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-agent-web-pdf",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"dependencies": {
|
|
6
|
-
"pi-agent-pdf": "0.
|
|
7
|
-
"pi-agent-resource": "0.
|
|
6
|
+
"pi-agent-pdf": "0.5.1",
|
|
7
|
+
"pi-agent-resource": "0.5.1"
|
|
8
8
|
},
|
|
9
9
|
"pi": {
|
|
10
10
|
"extensions": [
|
|
11
|
-
"./runtime/entry-
|
|
11
|
+
"./runtime/entry-79.js"
|
|
12
12
|
]
|
|
13
13
|
},
|
|
14
14
|
"peerDependencies": {
|
package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-text/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-agent-web-text",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"dependencies": {
|
|
6
|
-
"pi-agent-resource": "0.
|
|
7
|
-
"pi-agent-text": "0.
|
|
6
|
+
"pi-agent-resource": "0.5.1",
|
|
7
|
+
"pi-agent-text": "0.5.1"
|
|
8
8
|
},
|
|
9
9
|
"pi": {
|
|
10
10
|
"extensions": [
|
|
11
|
-
"./runtime/entry-
|
|
11
|
+
"./runtime/entry-80.js"
|
|
12
12
|
]
|
|
13
13
|
},
|
|
14
14
|
"peerDependencies": {
|
|
@@ -9,6 +9,8 @@ import { type BrowserHtmlLoader, createSystemBrowserHtmlLoader } from "./browser
|
|
|
9
9
|
|
|
10
10
|
type WebContentHost = Pick<ContentHost, "convert">;
|
|
11
11
|
|
|
12
|
+
const BINARY_PREVIEW_BYTES = 4096;
|
|
13
|
+
|
|
12
14
|
/** HTTP timeout, transport, and internal browser fallback settings. */
|
|
13
15
|
export interface WebResolverOptions {
|
|
14
16
|
readonly timeoutMs?: number;
|
|
@@ -115,10 +117,20 @@ async function readWebContent(
|
|
|
115
117
|
throw new Error(`HTTP ${response.status}: ${response.statusText}`);
|
|
116
118
|
}
|
|
117
119
|
|
|
120
|
+
const mediaType = response.headers.get("content-type") ?? undefined;
|
|
121
|
+
if (isUnsupportedBinaryMediaType(mediaType) && !hasSupportedDocumentExtension(url)) {
|
|
122
|
+
const preview = await readBoundedBody(response, BINARY_PREVIEW_BYTES, operation.signal);
|
|
123
|
+
return [
|
|
124
|
+
{
|
|
125
|
+
type: "text",
|
|
126
|
+
text: formatUnsupportedBinaryResponse(url, response, mediaType, preview),
|
|
127
|
+
},
|
|
128
|
+
];
|
|
129
|
+
}
|
|
130
|
+
|
|
118
131
|
const bytes = new Uint8Array(await response.arrayBuffer());
|
|
119
132
|
operation.signal.throwIfAborted();
|
|
120
133
|
const source = response.url.length === 0 ? url.href : response.url;
|
|
121
|
-
const mediaType = response.headers.get("content-type") ?? undefined;
|
|
122
134
|
const input = {
|
|
123
135
|
source,
|
|
124
136
|
bytes,
|
|
@@ -191,6 +203,121 @@ async function loadAndConvertBrowser(
|
|
|
191
203
|
);
|
|
192
204
|
}
|
|
193
205
|
|
|
206
|
+
function isUnsupportedBinaryMediaType(mediaType: string | undefined): boolean {
|
|
207
|
+
if (mediaType === undefined) return false;
|
|
208
|
+
const type = mediaType.split(";", 1)[0]?.trim().toLowerCase() ?? "";
|
|
209
|
+
return !(
|
|
210
|
+
type.startsWith("text/") ||
|
|
211
|
+
type.startsWith("image/") ||
|
|
212
|
+
type === "application/json" ||
|
|
213
|
+
type.endsWith("+json") ||
|
|
214
|
+
type === "application/xml" ||
|
|
215
|
+
type.endsWith("+xml") ||
|
|
216
|
+
type === "application/xhtml+xml" ||
|
|
217
|
+
type === "application/pdf"
|
|
218
|
+
);
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
function hasSupportedDocumentExtension(url: URL): boolean {
|
|
222
|
+
return /\.(?:avif|bmp|gif|jpe?g|pdf|png|webp)$/iu.test(url.pathname);
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
async function readBoundedBody(
|
|
226
|
+
response: Response,
|
|
227
|
+
limit: number,
|
|
228
|
+
signal: AbortSignal,
|
|
229
|
+
): Promise<Uint8Array> {
|
|
230
|
+
if (response.body === null) return new Uint8Array();
|
|
231
|
+
const reader = response.body.getReader();
|
|
232
|
+
const chunks: Uint8Array[] = [];
|
|
233
|
+
let length = 0;
|
|
234
|
+
try {
|
|
235
|
+
while (length < limit) {
|
|
236
|
+
signal.throwIfAborted();
|
|
237
|
+
const part = await reader.read();
|
|
238
|
+
if (part.done) break;
|
|
239
|
+
const remaining = limit - length;
|
|
240
|
+
const chunk = part.value.subarray(0, remaining);
|
|
241
|
+
chunks.push(chunk);
|
|
242
|
+
length += chunk.length;
|
|
243
|
+
if (part.value.length > remaining) break;
|
|
244
|
+
}
|
|
245
|
+
} finally {
|
|
246
|
+
await reader.cancel().catch(() => undefined);
|
|
247
|
+
}
|
|
248
|
+
const preview = new Uint8Array(length);
|
|
249
|
+
let offset = 0;
|
|
250
|
+
for (const chunk of chunks) {
|
|
251
|
+
preview.set(chunk, offset);
|
|
252
|
+
offset += chunk.length;
|
|
253
|
+
}
|
|
254
|
+
return preview;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
function formatUnsupportedBinaryResponse(
|
|
258
|
+
requestedUrl: URL,
|
|
259
|
+
response: Response,
|
|
260
|
+
mediaType: string | undefined,
|
|
261
|
+
preview: Uint8Array,
|
|
262
|
+
): string {
|
|
263
|
+
const lines = [
|
|
264
|
+
"Binary response",
|
|
265
|
+
`URL: ${requestedUrl.href}`,
|
|
266
|
+
`HTTP: ${response.status} ${response.statusText}`.trimEnd(),
|
|
267
|
+
`Content-Type: ${mediaType ?? "unknown"}`,
|
|
268
|
+
];
|
|
269
|
+
const disposition = response.headers.get("content-disposition");
|
|
270
|
+
const filename = disposition === null ? undefined : attachmentFilename(disposition);
|
|
271
|
+
if (filename !== undefined) lines.push(`Filename: ${filename}`);
|
|
272
|
+
const length = response.headers.get("content-length");
|
|
273
|
+
if (length !== null) lines.push(`Content-Length: ${length}`);
|
|
274
|
+
lines.push("", "Headers:");
|
|
275
|
+
for (const [name, value] of [...response.headers].sort(([left], [right]) =>
|
|
276
|
+
left.localeCompare(right),
|
|
277
|
+
)) {
|
|
278
|
+
if (isSensitiveRedirectHeader(name)) continue;
|
|
279
|
+
lines.push(`${name}: ${value}`);
|
|
280
|
+
}
|
|
281
|
+
lines.push(
|
|
282
|
+
"",
|
|
283
|
+
`Preview: first ${preview.length} bytes (hex); the remaining body was not downloaded`,
|
|
284
|
+
formatHexPreview(preview),
|
|
285
|
+
);
|
|
286
|
+
return lines.join("\n");
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
function attachmentFilename(disposition: string): string | undefined {
|
|
290
|
+
const encoded = /filename\*=UTF-8''([^;]+)/iu.exec(disposition)?.[1];
|
|
291
|
+
if (encoded !== undefined) {
|
|
292
|
+
try {
|
|
293
|
+
return decodeURIComponent(encoded).replaceAll(/[\r\n]/gu, "");
|
|
294
|
+
} catch {
|
|
295
|
+
return encoded.replaceAll(/[\r\n]/gu, "");
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
return /filename=(?:"([^"]+)"|([^;]+))/iu.exec(disposition)?.slice(1).find(Boolean)?.trim();
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
function isSensitiveRedirectHeader(name: string): boolean {
|
|
302
|
+
return ["content-location", "link", "location", "refresh", "set-cookie"].includes(
|
|
303
|
+
name.toLowerCase(),
|
|
304
|
+
);
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
function formatHexPreview(bytes: Uint8Array): string {
|
|
308
|
+
if (bytes.length === 0) return "(empty body)";
|
|
309
|
+
const rows: string[] = [];
|
|
310
|
+
for (let offset = 0; offset < bytes.length; offset += 16) {
|
|
311
|
+
const chunk = bytes.subarray(offset, offset + 16);
|
|
312
|
+
const hex = [...chunk].map((byte) => byte.toString(16).padStart(2, "0")).join(" ");
|
|
313
|
+
const text = [...chunk]
|
|
314
|
+
.map((byte) => (byte >= 32 && byte <= 126 ? String.fromCodePoint(byte) : "."))
|
|
315
|
+
.join("");
|
|
316
|
+
rows.push(`${offset.toString(16).padStart(8, "0")} ${hex.padEnd(47)} |${text}|`);
|
|
317
|
+
}
|
|
318
|
+
return rows.join("\n");
|
|
319
|
+
}
|
|
320
|
+
|
|
194
321
|
function isHtml(bytes: Uint8Array, mediaType: string | undefined): boolean {
|
|
195
322
|
const normalizedMediaType = mediaType?.split(";", 1)[0]?.trim().toLowerCase();
|
|
196
323
|
|