pi-agent-ide 0.8.0 → 0.8.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 +26 -40
- package/README.md +12 -7
- package/dist/{chunk-MOJ5RR35.js → chunk-246NTPOS.js} +1 -1
- package/dist/{chunk-NULNW6GK.js → chunk-2ITKAXHO.js} +1 -1
- package/dist/{chunk-SBNR4WZF.js → chunk-3WO2NOEQ.js} +1 -1
- package/dist/{chunk-N7LMRL64.js → chunk-47SPPIXK.js} +1 -1
- package/dist/{chunk-EY65TFHJ.js → chunk-4HWKBCBH.js} +1 -1
- package/dist/{chunk-JMVDFOTQ.js → chunk-57F5GTHO.js} +1 -1
- package/dist/{chunk-KL776TGR.js → chunk-7LOVUWNI.js} +1 -1
- package/dist/{chunk-7JV4VN73.js → chunk-A64JRDZK.js} +1 -1
- package/dist/{chunk-Z3PGADVA.js → chunk-AIT3YWR5.js} +1 -1
- package/dist/{chunk-E4HPRLRB.js → chunk-AKNHSDGV.js} +1 -1
- package/dist/{chunk-4XPUN4QN.js → chunk-AUL5FGGK.js} +1 -1
- package/dist/chunk-BB4A5UI3.js +5 -0
- package/dist/{chunk-CTJV77FR.js → chunk-BQAKA3FU.js} +1 -1
- package/dist/{chunk-PNP2KNGP.js → chunk-BR7GRH4A.js} +1 -1
- package/dist/{chunk-4OYVLXWD.js → chunk-D4IA2MTA.js} +1 -1
- package/dist/{chunk-R5XJSEOE.js → chunk-DXONCYWF.js} +3 -3
- package/dist/{chunk-TWWND6NI.js → chunk-E2PHA4SQ.js} +1 -1
- package/dist/{chunk-MZXX353D.js → chunk-EMRJP6EM.js} +1 -1
- package/dist/{chunk-7HDK3NRQ.js → chunk-GEMDU6XW.js} +1 -1
- package/dist/chunk-GNACBJM3.js +1 -0
- package/dist/{chunk-3G54ZL2L.js → chunk-HCK7OIQ3.js} +1 -1
- package/dist/chunk-HFJGCYFO.js +11 -0
- package/dist/{chunk-CSXHCSTH.js → chunk-ID4RJIVZ.js} +1 -1
- package/dist/{chunk-SBLKPTL3.js → chunk-JKMXND6V.js} +1 -1
- package/dist/{chunk-WE42GBGU.js → chunk-LAJQSHEI.js} +1 -1
- package/dist/{chunk-HCN5W76B.js → chunk-LLRUJD62.js} +1 -1
- package/dist/{chunk-2K65BSXS.js → chunk-M4TVRCMZ.js} +1 -1
- package/dist/{chunk-IUSLSROY.js → chunk-N56WAVYA.js} +1 -1
- package/dist/chunk-OI3HBIPK.js +2 -0
- package/dist/{chunk-GW6NZQTQ.js → chunk-PRLIHLCS.js} +1 -1
- package/dist/{chunk-7TJ6DWW3.js → chunk-Q5X6OXNS.js} +1 -1
- package/dist/{chunk-75SWXD2Z.js → chunk-SWA5B5B2.js} +1 -1
- package/dist/chunk-T7MWQQIF.js +3 -0
- package/dist/{chunk-ICDI27GZ.js → chunk-TGC2ZACO.js} +1 -1
- package/dist/{chunk-7NS3QUIE.js → chunk-TXG2H7YQ.js} +1 -1
- package/dist/{chunk-RAZP42IQ.js → chunk-VAXLSPPU.js} +1 -1
- package/dist/chunk-VMGZMXEM.js +10 -0
- package/dist/{chunk-CPZJPGLG.js → chunk-VNTY7BKC.js} +1 -1
- package/dist/chunk-W3YFF6OO.js +1 -0
- package/dist/{chunk-OLI3JPHJ.js → chunk-W7M3V7FR.js} +1 -1
- package/dist/{chunk-UUJJRXHG.js → chunk-WMHSVEIT.js} +1 -1
- package/dist/{chunk-OJX3RJ5A.js → chunk-WPBQ45ZL.js} +1 -1
- package/dist/{chunk-XZDOVPRC.js → chunk-WXGTU2M6.js} +1 -1
- package/dist/{chunk-3ZGDMTMD.js → chunk-XSIKDVAR.js} +1 -1
- package/dist/{chunk-QP2QSQ4U.js → chunk-YHREORHH.js} +1 -1
- package/dist/chunk-YTYLS2UM.js +1 -0
- package/dist/chunk-Z2QGNTGQ.js +1 -0
- package/dist/{chunk-UBH6X3D3.js → chunk-ZV5ETNLQ.js} +1 -1
- package/dist/entry-11.js +1 -1
- package/dist/entry-13.js +1 -1
- package/dist/entry-14.js +1 -1
- package/dist/entry-15.js +1 -1
- package/dist/entry-16.js +1 -1
- package/dist/entry-17.js +1 -1
- package/dist/entry-18.js +1 -0
- package/dist/entry-20.js +1 -1
- package/dist/entry-21.js +1 -1
- package/dist/entry-22.js +1 -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 -2
- package/dist/entry-27.js +2 -1
- package/dist/entry-28.js +1 -4
- package/dist/entry-29.js +4 -1
- package/dist/entry-30.js +1 -1
- package/dist/entry-31.js +1 -1
- package/dist/entry-32.js +1 -18
- package/dist/entry-33.js +18 -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 -1
- package/dist/entry-41.js +1 -1
- package/dist/entry-42.js +1 -1
- package/dist/entry-43.js +1 -1
- package/dist/entry-44.js +1 -1
- package/dist/entry-45.js +1 -1
- package/dist/entry-46.js +1 -25
- package/dist/entry-47.js +25 -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 -3
- package/dist/entry-52.js +3 -13
- package/dist/entry-53.js +13 -1
- package/dist/entry-54.js +1 -1
- package/dist/entry-55.js +1 -1
- package/dist/entry-56.js +1 -1
- package/dist/entry-57.js +1 -1
- package/dist/entry-58.js +1 -1
- package/dist/entry-59.js +1 -1
- package/dist/entry-6.js +1 -1
- package/dist/entry-60.js +1 -1
- package/dist/entry-61.js +1 -1
- package/dist/entry-62.js +1 -0
- package/dist/entry-63.js +0 -1
- package/dist/entry-64.js +1 -0
- package/dist/entry-65.js +0 -1
- package/dist/entry-66.js +1 -1
- package/dist/entry-67.js +1 -1
- package/dist/entry-68.js +1 -1
- package/dist/entry-69.js +1 -1
- package/dist/entry-7.js +1 -1
- package/dist/entry-70.js +1 -1
- package/dist/entry-71.js +1 -1
- package/dist/entry-72.js +1 -0
- package/dist/entry-73.js +0 -1
- package/dist/entry-74.js +1 -0
- package/dist/entry-75.js +0 -1
- package/dist/entry-76.js +1 -1
- package/dist/entry-77.js +1 -1
- package/dist/entry-78.js +1 -80
- package/dist/entry-79.js +76 -17
- package/dist/entry-80.js +22 -2
- package/dist/entry-81.js +2 -1
- package/dist/entry-82.js +1 -1
- package/dist/entry-83.js +1 -1
- package/dist/entry-84.js +1 -3
- package/dist/entry-85.js +3 -1
- package/dist/entry-86.js +1 -1
- package/dist/entry-87.js +1 -1
- package/dist/entry-88.js +1 -0
- package/dist/pi-agent-ide.js +53 -24
- package/docs/agent-guides/search-code.md +3 -1
- package/docs/agent-guides/ssh.md +1 -1
- package/docs/configuration.md +18 -6
- package/docs/development.md +1 -13
- package/docs/extensions.md +1 -1
- package/docs/releases.md +1 -1
- package/docs/settings-help.md +39 -0
- package/docs/tools.md +1 -0
- package/docs/user-hooks.md +3 -1
- package/node_modules/pi-agent-doctor/package.json +7 -10
- package/node_modules/pi-agent-documentation/package.json +2 -2
- package/node_modules/pi-agent-documentation/runtime/entry-26.js +1 -0
- package/node_modules/pi-agent-filesystem/package.json +8 -8
- package/node_modules/pi-agent-filesystem-image/package.json +4 -4
- package/node_modules/pi-agent-filesystem-jq/package.json +6 -7
- 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-31.js +2 -0
- package/node_modules/pi-agent-ide-ast/package.json +15 -41
- package/node_modules/pi-agent-ide-ast/runtime/entry-32.js +0 -1
- package/node_modules/pi-agent-ide-ast/runtime/entry-33.js +2 -0
- package/node_modules/pi-agent-ide-changes/package.json +10 -11
- package/node_modules/pi-agent-ide-changes/runtime/entry-34.js +0 -1
- package/node_modules/pi-agent-ide-formatter/package.json +4 -4
- package/node_modules/pi-agent-ide-languages/package.json +3 -3
- package/node_modules/pi-agent-ide-lint/package.json +8 -8
- package/node_modules/pi-agent-ide-lsp/package.json +10 -13
- package/node_modules/pi-agent-ide-lsp/runtime/entry-39.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 -4
- package/node_modules/pi-agent-read/package.json +12 -12
- package/node_modules/pi-agent-read/runtime/entry-46.js +0 -1
- package/node_modules/pi-agent-read/runtime/entry-47.js +2 -0
- package/node_modules/pi-agent-resource/package.json +2 -2
- package/node_modules/pi-agent-resource/src/result-targets.ts +9 -0
- package/node_modules/pi-agent-search/package.json +9 -9
- package/node_modules/pi-agent-search/runtime/entry-51.js +0 -1
- package/node_modules/pi-agent-search/src/api/plugin-protocol.ts +1 -1
- package/node_modules/pi-agent-search/src/api/presentation.ts +10 -2
- package/node_modules/pi-agent-search/src/api/search-parameters.ts +1 -1
- package/node_modules/pi-agent-search/src/api/search.ts +7 -0
- package/node_modules/pi-agent-search/src/core/search-core.ts +23 -3
- package/node_modules/pi-agent-search-text/index.ts +2 -0
- package/node_modules/pi-agent-search-text/package.json +14 -14
- package/node_modules/pi-agent-search-text/runtime/entry-53.js +1 -0
- package/node_modules/pi-agent-search-text/src/search-backend.ts +18 -10
- package/node_modules/pi-agent-search-text/src/search-session.ts +68 -9
- package/node_modules/pi-agent-text/package.json +3 -3
- package/node_modules/pi-agent-text/runtime/entry-57.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-58.js +2 -0
- package/node_modules/pi-agent-text-anchor-exact/package.json +5 -6
- package/node_modules/pi-agent-text-anchor-exact/runtime/entry-59.js +0 -1
- package/node_modules/pi-agent-text-anchor-exact/runtime/entry-60.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-61.js +0 -1
- package/node_modules/pi-agent-text-anchor-line-hash/runtime/entry-62.js +2 -0
- package/node_modules/pi-agent-text-editor/package.json +26 -34
- package/node_modules/pi-agent-text-editor/runtime/entry-78.js +0 -1
- package/node_modules/pi-agent-text-editor/src/api/delete-guard.ts +1 -1
- package/node_modules/pi-agent-text-editor/src/api/native-edit-batch-event.ts +2 -2
- package/node_modules/pi-agent-text-editor/src/core/delete-policy.ts +6 -12
- package/node_modules/pi-agent-text-editor/src/core/extension.ts +1 -0
- package/node_modules/pi-agent-text-editor/src/core/file-operation-tools.ts +49 -21
- package/node_modules/pi-agent-text-editor/src/core/mutation-result/grouped-replacements.ts +18 -9
- package/node_modules/pi-agent-text-editor/src/core/native-text-edit-batch.ts +2 -2
- package/node_modules/pi-agent-text-editor/src/core/temporary-directories.ts +13 -9
- package/node_modules/pi-agent-text-editor/src/core/text-edit-batch-coordinator.ts +16 -8
- package/node_modules/pi-agent-text-editor/src/core/text-edit-batch-registrar.ts +118 -36
- package/node_modules/pi-agent-text-editor/src/core/text-edit-batch.ts +7 -4
- package/node_modules/pi-agent-text-editor/src/core/text-mutation.ts +6 -8
- package/node_modules/pi-agent-text-editor/src/core/tool-call-interceptor/coordinator.ts +22 -1
- package/node_modules/pi-agent-text-editor-renderer/package.json +6 -8
- package/node_modules/pi-agent-text-editor-renderer/src/renderer.ts +22 -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-81.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-83.js +1 -0
- package/node_modules/pi-agent-web/package.json +8 -11
- package/node_modules/pi-agent-web-html/package.json +3 -5
- 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-88.js +2 -0
- package/package.json +43 -39
- package/skills/configure-agent-ide/SKILL.md +38 -0
- package/src/api/content.ts +6 -0
- package/src/api/tips.ts +3 -0
- package/src/composite/nested-tool-rendering.ts +16 -5
- package/src/composite/preferences.ts +13 -0
- package/src/composite/settings-documentation.ts +59 -0
- package/src/composite/settings-help.ts +106 -0
- package/src/composite/text-results.ts +50 -22
- package/src/documentation/extension.ts +12 -0
- package/src/documentation/search.ts +166 -0
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/package.json +8 -8
- 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-jq/package.json +6 -7
- 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-31.js +2 -0
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/runtime/entry-27.js +2 -0
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/package.json +8 -11
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-html/package.json +3 -5
- 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-88.js +2 -0
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/runtime/entry-84.js +2 -0
- package/src/extensions/pi-agent-read/package.json +12 -12
- package/src/extensions/pi-agent-read/runtime/entry-46.js +0 -1
- package/src/extensions/pi-agent-read/runtime/entry-47.js +2 -0
- package/src/extensions/pi-agent-search/package.json +9 -9
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/index.ts +2 -0
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/package.json +14 -14
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/runtime/entry-53.js +1 -0
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/runtime/entry-56.js +1 -0
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-backend.ts +18 -10
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-session.ts +68 -9
- package/src/extensions/pi-agent-search/runtime/entry-51.js +0 -1
- package/src/extensions/pi-agent-search/runtime/entry-52.js +2 -0
- package/src/extensions/pi-agent-search/src/api/plugin-protocol.ts +1 -1
- package/src/extensions/pi-agent-search/src/api/presentation.ts +10 -2
- package/src/extensions/pi-agent-search/src/api/search-parameters.ts +1 -1
- package/src/extensions/pi-agent-search/src/api/search.ts +7 -0
- package/src/extensions/pi-agent-search/src/core/search-core.ts +23 -3
- package/src/extensions/pi-agent-text-editor/package.json +26 -34
- 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-58.js +2 -0
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/package.json +5 -6
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/runtime/entry-59.js +0 -1
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/runtime/entry-60.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-61.js +0 -1
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/runtime/entry-62.js +2 -0
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/package.json +6 -8
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/renderer.ts +22 -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-81.js +2 -0
- package/src/extensions/pi-agent-text-editor/runtime/entry-78.js +0 -1
- package/src/extensions/pi-agent-text-editor/runtime/entry-79.js +2 -0
- package/src/extensions/pi-agent-text-editor/src/api/delete-guard.ts +1 -1
- package/src/extensions/pi-agent-text-editor/src/api/native-edit-batch-event.ts +2 -2
- package/src/extensions/pi-agent-text-editor/src/core/delete-policy.ts +6 -12
- package/src/extensions/pi-agent-text-editor/src/core/extension.ts +1 -0
- package/src/extensions/pi-agent-text-editor/src/core/file-operation-tools.ts +49 -21
- package/src/extensions/pi-agent-text-editor/src/core/mutation-result/grouped-replacements.ts +18 -9
- package/src/extensions/pi-agent-text-editor/src/core/native-text-edit-batch.ts +2 -2
- package/src/extensions/pi-agent-text-editor/src/core/temporary-directories.ts +13 -9
- package/src/extensions/pi-agent-text-editor/src/core/text-edit-batch-coordinator.ts +16 -8
- package/src/extensions/pi-agent-text-editor/src/core/text-edit-batch-registrar.ts +118 -36
- package/src/extensions/pi-agent-text-editor/src/core/text-edit-batch.ts +7 -4
- package/src/extensions/pi-agent-text-editor/src/core/text-mutation.ts +6 -8
- package/src/extensions/pi-agent-text-editor/src/core/tool-call-interceptor/coordinator.ts +22 -1
- package/src/pi-agent-ide.ts +14 -2
- package/src/plugins/pi-agent-ide-ast/package.json +15 -41
- package/src/plugins/pi-agent-ide-ast/runtime/entry-32.js +0 -1
- package/src/plugins/pi-agent-ide-ast/runtime/entry-33.js +2 -0
- package/src/plugins/pi-agent-ide-changes/package.json +10 -11
- package/src/plugins/pi-agent-ide-changes/runtime/entry-34.js +0 -1
- package/src/plugins/pi-agent-ide-formatter/package.json +4 -4
- package/src/plugins/pi-agent-ide-languages/package.json +3 -3
- package/src/plugins/pi-agent-ide-lint/package.json +8 -8
- package/src/plugins/pi-agent-ide-lsp/package.json +10 -13
- package/src/plugins/pi-agent-ide-lsp/runtime/entry-39.js +2 -0
- package/src/tips/core.ts +5 -2
- package/src/tips/extension.ts +30 -2
- package/src/tips/persistence.ts +29 -27
- package/src/tips/setup-hint.ts +19 -0
- package/dist/chunk-5KFVDYCI.js +0 -1
- package/dist/chunk-ABFCAOU5.js +0 -1
- package/dist/chunk-BIG45IPN.js +0 -2
- package/dist/chunk-BMOJTJJJ.js +0 -3
- package/dist/chunk-BQ67M4NC.js +0 -3
- package/dist/chunk-IH5NW5JX.js +0 -11
- package/dist/chunk-NRZO5KJT.js +0 -9
- package/dist/chunk-O36UC74T.js +0 -1
- package/dist/chunk-SSWUUBIR.js +0 -1
- package/dist/entry-19.js +0 -1
- package/docs/research/apply-native-capability-matrix.md +0 -174
- package/docs/research/apply-read-latency.md +0 -221
- package/docs/research/codemode-write-context.md +0 -56
- package/docs/research/lpt-393-fuzzy-results/file.json +0 -152
- package/docs/research/lpt-393-fuzzy-results/repo.json +0 -122
- package/docs/research/lpt-393-search-fuzzy-fallback.md +0 -97
- package/docs/research/native-codemode-batch-decision.md +0 -31
- package/docs/research/native-codemode-batching.md +0 -65
- package/node_modules/pi-agent-doctor/runtime/entry-19.js +0 -1
- package/node_modules/pi-agent-filesystem/runtime/entry-26.js +0 -2
- package/node_modules/pi-agent-ide-ast/runtime/entry-31.js +0 -1
- package/node_modules/pi-agent-ide-changes/runtime/entry-33.js +0 -1
- package/node_modules/pi-agent-image/runtime/entry-39.js +0 -1
- package/node_modules/pi-agent-resource/runtime/entry-47.js +0 -1
- package/node_modules/pi-agent-text-anchor-constant/runtime/entry-57.js +0 -2
- package/node_modules/pi-agent-text-anchor-exact/runtime/entry-58.js +0 -1
- package/node_modules/pi-agent-text-anchor-line-hash/runtime/entry-60.js +0 -1
- package/node_modules/pi-agent-text-editor/runtime/entry-62.js +0 -1
- package/node_modules/pi-agent-tool-call-interception/runtime/entry-81.js +0 -1
- package/node_modules/pi-agent-web/runtime/entry-83.js +0 -2
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-image/runtime/entry-27.js +0 -2
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/runtime/entry-26.js +0 -2
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-html/runtime/entry-84.js +0 -2
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/runtime/entry-83.js +0 -2
- package/src/extensions/pi-agent-read/runtime/entry-42.js +0 -1
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/runtime/entry-52.js +0 -2
- package/src/extensions/pi-agent-search/runtime/entry-48.js +0 -1
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-constant/runtime/entry-57.js +0 -2
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/runtime/entry-58.js +0 -1
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/runtime/entry-60.js +0 -1
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/runtime/entry-79.js +0 -2
- package/src/extensions/pi-agent-text-editor/runtime/entry-62.js +0 -1
- package/src/plugins/pi-agent-ide-ast/runtime/entry-31.js +0 -1
- package/src/plugins/pi-agent-ide-changes/runtime/entry-33.js +0 -1
- /package/node_modules/{pi-agent-documentation → pi-agent-doctor}/runtime/entry-25.js +0 -0
- /package/node_modules/{pi-agent-filesystem-image → pi-agent-filesystem}/runtime/entry-27.js +0 -0
- /package/node_modules/{pi-agent-filesystem-jq → pi-agent-filesystem-image}/runtime/entry-28.js +0 -0
- /package/node_modules/{pi-agent-filesystem-pdf → pi-agent-filesystem-jq}/runtime/entry-29.js +0 -0
- /package/node_modules/{pi-agent-filesystem-text → pi-agent-filesystem-pdf}/runtime/entry-30.js +0 -0
- /package/node_modules/{pi-agent-ide-formatter → pi-agent-ide-changes}/runtime/entry-35.js +0 -0
- /package/node_modules/{pi-agent-ide-languages → pi-agent-ide-formatter}/runtime/entry-36.js +0 -0
- /package/node_modules/{pi-agent-ide-lint → pi-agent-ide-languages}/runtime/entry-37.js +0 -0
- /package/node_modules/{pi-agent-ide-lsp → pi-agent-ide-lint}/runtime/entry-38.js +0 -0
- /package/node_modules/{pi-agent-invariant → pi-agent-image}/runtime/entry-40.js +0 -0
- /package/node_modules/{pi-agent-pdf → pi-agent-invariant}/runtime/entry-41.js +0 -0
- /package/node_modules/{pi-agent-read → pi-agent-pdf}/runtime/entry-42.js +0 -0
- /package/node_modules/{pi-agent-search → pi-agent-resource}/runtime/entry-48.js +0 -0
- /package/node_modules/{pi-agent-search-text → pi-agent-search}/runtime/entry-52.js +0 -0
- /package/node_modules/{pi-agent-text → pi-agent-search-text}/runtime/entry-56.js +0 -0
- /package/node_modules/{pi-agent-text-editor-renderer → pi-agent-text-editor}/runtime/entry-79.js +0 -0
- /package/node_modules/{pi-agent-text-editor-stale-anchor → pi-agent-text-editor-renderer}/runtime/entry-80.js +0 -0
- /package/node_modules/{pi-agent-tool-ui → pi-agent-tool-call-interception}/runtime/entry-82.js +0 -0
- /package/node_modules/{pi-agent-web-html → pi-agent-web}/runtime/entry-84.js +0 -0
- /package/node_modules/{pi-agent-web-image → pi-agent-web-html}/runtime/entry-85.js +0 -0
- /package/node_modules/{pi-agent-web-pdf → pi-agent-web-image}/runtime/entry-86.js +0 -0
- /package/node_modules/{pi-agent-web-text → pi-agent-web-pdf}/runtime/entry-87.js +0 -0
- /package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/{pi-agent-filesystem-jq → pi-agent-filesystem-image}/runtime/entry-28.js +0 -0
- /package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/{pi-agent-filesystem-pdf → pi-agent-filesystem-jq}/runtime/entry-29.js +0 -0
- /package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/{pi-agent-filesystem-text → pi-agent-filesystem-pdf}/runtime/entry-30.js +0 -0
- /package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/{pi-agent-web-image → pi-agent-web-html}/runtime/entry-85.js +0 -0
- /package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/{pi-agent-web-pdf → pi-agent-web-image}/runtime/entry-86.js +0 -0
- /package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/{pi-agent-web-text → pi-agent-web-pdf}/runtime/entry-87.js +0 -0
- /package/src/extensions/pi-agent-text-editor/plugins/{pi-agent-text-editor-stale-anchor → pi-agent-text-editor-renderer}/runtime/entry-80.js +0 -0
- /package/src/plugins/{pi-agent-ide-formatter → pi-agent-ide-changes}/runtime/entry-35.js +0 -0
- /package/src/plugins/{pi-agent-ide-languages → pi-agent-ide-formatter}/runtime/entry-36.js +0 -0
- /package/src/plugins/{pi-agent-ide-lint → pi-agent-ide-languages}/runtime/entry-37.js +0 -0
- /package/src/plugins/{pi-agent-ide-lsp → pi-agent-ide-lint}/runtime/entry-38.js +0 -0
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-agent-ide-lint",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"dependencies": {
|
|
6
|
-
"pi-agent-doctor": "0.8.
|
|
7
|
-
"pi-agent-invariant": "0.8.
|
|
8
|
-
"pi-agent-read": "0.8.
|
|
9
|
-
"pi-agent-resource": "0.8.
|
|
10
|
-
"pi-agent-text": "0.8.
|
|
6
|
+
"pi-agent-doctor": "0.8.1",
|
|
7
|
+
"pi-agent-invariant": "0.8.1",
|
|
8
|
+
"pi-agent-read": "0.8.1",
|
|
9
|
+
"pi-agent-resource": "0.8.1",
|
|
10
|
+
"pi-agent-text": "0.8.1"
|
|
11
11
|
},
|
|
12
12
|
"pi": {
|
|
13
13
|
"extensions": [
|
|
14
|
-
"./runtime/entry-
|
|
14
|
+
"./runtime/entry-38.js"
|
|
15
15
|
]
|
|
16
16
|
},
|
|
17
17
|
"peerDependencies": {
|
|
18
18
|
"@earendil-works/pi-coding-agent": "*",
|
|
19
|
-
"pi-agent-ide": "0.8.
|
|
19
|
+
"pi-agent-ide": "0.8.1"
|
|
20
20
|
},
|
|
21
21
|
"peerDependenciesMeta": {
|
|
22
22
|
"pi-agent-ide": {
|
|
@@ -1,27 +1,24 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-agent-ide-lsp",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"dependencies": {
|
|
6
|
-
"
|
|
7
|
-
"pi-agent-
|
|
8
|
-
"pi-agent-
|
|
9
|
-
"pi-agent-
|
|
10
|
-
"pi-agent-
|
|
11
|
-
"pi-agent-
|
|
12
|
-
"pi-agent-text": "0.8.
|
|
13
|
-
"pi-agent-text-editor": "0.8.0",
|
|
14
|
-
"vscode-jsonrpc": "^9.0.0",
|
|
15
|
-
"vscode-uri": "^3.1.0"
|
|
6
|
+
"pi-agent-doctor": "0.8.1",
|
|
7
|
+
"pi-agent-invariant": "0.8.1",
|
|
8
|
+
"pi-agent-read": "0.8.1",
|
|
9
|
+
"pi-agent-resource": "0.8.1",
|
|
10
|
+
"pi-agent-search": "0.8.1",
|
|
11
|
+
"pi-agent-text": "0.8.1",
|
|
12
|
+
"pi-agent-text-editor": "0.8.1"
|
|
16
13
|
},
|
|
17
14
|
"pi": {
|
|
18
15
|
"extensions": [
|
|
19
|
-
"./runtime/entry-
|
|
16
|
+
"./runtime/entry-39.js"
|
|
20
17
|
]
|
|
21
18
|
},
|
|
22
19
|
"peerDependencies": {
|
|
23
20
|
"@earendil-works/pi-coding-agent": "*",
|
|
24
|
-
"pi-agent-ide": "0.8.
|
|
21
|
+
"pi-agent-ide": "0.8.1"
|
|
25
22
|
},
|
|
26
23
|
"peerDependenciesMeta": {
|
|
27
24
|
"pi-agent-ide": {
|
package/src/tips/core.ts
CHANGED
|
@@ -74,13 +74,16 @@ async function collectTip(provider: TipProvider, context: TipContext): Promise<T
|
|
|
74
74
|
}
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
-
function isTip(
|
|
77
|
+
function isTip(input: unknown): input is Tip {
|
|
78
|
+
if (typeof input !== "object" || input === null) return false;
|
|
79
|
+
const value = input as Record<string, unknown>;
|
|
78
80
|
return (
|
|
79
81
|
typeof value.id === "string" &&
|
|
80
82
|
/^[a-z0-9][a-z0-9.-]*$/u.test(value.id) &&
|
|
81
83
|
typeof value.title === "string" &&
|
|
82
84
|
value.title.trim().length > 0 &&
|
|
83
85
|
typeof value.body === "string" &&
|
|
84
|
-
value.body.trim().length > 0
|
|
86
|
+
value.body.trim().length > 0 &&
|
|
87
|
+
(value.scope === undefined || value.scope === "project" || value.scope === "global")
|
|
85
88
|
);
|
|
86
89
|
}
|
package/src/tips/extension.ts
CHANGED
|
@@ -12,12 +12,39 @@ import type { TipContext } from "#src/api/tips.js";
|
|
|
12
12
|
import { TipCallout } from "./tip-callout.js";
|
|
13
13
|
import { TipCore } from "./core.js";
|
|
14
14
|
import { normalizeProjectPath, TipStateStore } from "./persistence.js";
|
|
15
|
+
import { createSetupHintProvider } from "./setup-hint.js";
|
|
15
16
|
|
|
16
17
|
const TIP_ENTRY_TYPE = "pi-agent-ide-startup-tip";
|
|
17
18
|
|
|
18
19
|
/** Registers the built-in startup-tip core and passive TUI renderer. */
|
|
19
|
-
export default function registerTips(pi: ExtensionAPI): void {
|
|
20
|
+
export default async function registerTips(pi: ExtensionAPI): Promise<void> {
|
|
20
21
|
const core = new TipCore();
|
|
22
|
+
const setupHint = createSetupHintProvider(() =>
|
|
23
|
+
pi
|
|
24
|
+
.getCommands()
|
|
25
|
+
.some(
|
|
26
|
+
(command) => command.source === "skill" && command.name === "skill:configure-agent-ide",
|
|
27
|
+
),
|
|
28
|
+
);
|
|
29
|
+
await core.registerProvider(setupHint);
|
|
30
|
+
if (pi.getFlag("pi-agent-ide-developer-mode") === true) {
|
|
31
|
+
pi.registerCommand("agent-ide-tip", {
|
|
32
|
+
description: "Show the Agent IDE setup hint again without resetting its one-time state",
|
|
33
|
+
async handler(_args, context) {
|
|
34
|
+
if (context.mode !== "tui" || !context.hasUI) return;
|
|
35
|
+
const tip = await setupHint.getTip({
|
|
36
|
+
cwd: context.cwd,
|
|
37
|
+
mode: context.mode,
|
|
38
|
+
hasUI: context.hasUI,
|
|
39
|
+
signal: context.signal,
|
|
40
|
+
reason: "startup",
|
|
41
|
+
});
|
|
42
|
+
if (tip) pi.appendEntry(TIP_ENTRY_TYPE, tip);
|
|
43
|
+
else
|
|
44
|
+
context.ui.notify("The Agent IDE setup skill is not available in this session.", "info");
|
|
45
|
+
},
|
|
46
|
+
});
|
|
47
|
+
}
|
|
21
48
|
const state = new TipStateStore();
|
|
22
49
|
pi.registerEntryRenderer(TIP_ENTRY_TYPE, (entry, _options, theme) => {
|
|
23
50
|
const tip = entry.data as { readonly title?: string; readonly body?: string };
|
|
@@ -86,8 +113,9 @@ async function displayTip(
|
|
|
86
113
|
return;
|
|
87
114
|
}
|
|
88
115
|
|
|
89
|
-
const project = normalizeProjectPath(context.cwd);
|
|
90
116
|
for (const contribution of contributions) {
|
|
117
|
+
const project =
|
|
118
|
+
contribution.tip.scope === "global" ? undefined : normalizeProjectPath(context.cwd);
|
|
91
119
|
const identity = tipIdentity(contribution.providerId, contribution.tip.id);
|
|
92
120
|
if (!(await state.claimIfUnseen(project, identity, contribution.tip.id))) {
|
|
93
121
|
continue;
|
package/src/tips/persistence.ts
CHANGED
|
@@ -13,6 +13,7 @@ let writeQueue = Promise.resolve();
|
|
|
13
13
|
interface TipState {
|
|
14
14
|
readonly version: 1;
|
|
15
15
|
readonly projects: Record<string, readonly string[]>;
|
|
16
|
+
readonly global?: readonly string[];
|
|
16
17
|
}
|
|
17
18
|
|
|
18
19
|
/** Returns the global, configurable startup-tip state path. */
|
|
@@ -27,15 +28,15 @@ Stores shown tips globally while treating malformed or unwritable state as empty
|
|
|
27
28
|
export class TipStateStore {
|
|
28
29
|
public constructor(private readonly statePath = resolveTipStatePath()) {}
|
|
29
30
|
|
|
30
|
-
/** Returns IDs
|
|
31
|
-
public async shownFor(project
|
|
31
|
+
/** Returns IDs shown for a project, or across the installation when omitted. */
|
|
32
|
+
public async shownFor(project?: string): Promise<ReadonlySet<string>> {
|
|
32
33
|
const state = await readState(this.statePath);
|
|
33
|
-
return new Set(state
|
|
34
|
+
return new Set(shownIds(state, project));
|
|
34
35
|
}
|
|
35
36
|
|
|
36
|
-
/** Claims a
|
|
37
|
+
/** Claims a tip for a project, or across the installation when project is undefined. */
|
|
37
38
|
public async claimIfUnseen(
|
|
38
|
-
project: string,
|
|
39
|
+
project: string | undefined,
|
|
39
40
|
tipIdentity: string,
|
|
40
41
|
legacyTipId?: string,
|
|
41
42
|
): Promise<boolean> {
|
|
@@ -43,7 +44,7 @@ export class TipStateStore {
|
|
|
43
44
|
try {
|
|
44
45
|
return await withStateLock(this.statePath, async () => {
|
|
45
46
|
const state = await readState(this.statePath);
|
|
46
|
-
const existing = new Set(state
|
|
47
|
+
const existing = new Set(shownIds(state, project));
|
|
47
48
|
if (
|
|
48
49
|
existing.has(tipIdentity) ||
|
|
49
50
|
(legacyTipId !== undefined && existing.has(legacyTipId))
|
|
@@ -52,11 +53,7 @@ export class TipStateStore {
|
|
|
52
53
|
}
|
|
53
54
|
|
|
54
55
|
existing.add(tipIdentity);
|
|
55
|
-
|
|
56
|
-
version: STATE_VERSION,
|
|
57
|
-
projects: { ...state.projects, [project]: [...existing] },
|
|
58
|
-
};
|
|
59
|
-
await writeState(this.statePath, next);
|
|
56
|
+
await writeState(this.statePath, withShown(state, project, [...existing]));
|
|
60
57
|
return true;
|
|
61
58
|
});
|
|
62
59
|
} catch {
|
|
@@ -71,8 +68,8 @@ export class TipStateStore {
|
|
|
71
68
|
return claim;
|
|
72
69
|
}
|
|
73
70
|
|
|
74
|
-
/**
|
|
75
|
-
public async markShown(project: string, tipIds: readonly string[]): Promise<void> {
|
|
71
|
+
/** Records shown IDs in the chosen scope; persistence failures are ignored. */
|
|
72
|
+
public async markShown(project: string | undefined, tipIds: readonly string[]): Promise<void> {
|
|
76
73
|
if (tipIds.length === 0) {
|
|
77
74
|
return;
|
|
78
75
|
}
|
|
@@ -80,16 +77,12 @@ export class TipStateStore {
|
|
|
80
77
|
const update = writeQueue.then(async () => {
|
|
81
78
|
await withStateLock(this.statePath, async () => {
|
|
82
79
|
const state = await readState(this.statePath);
|
|
83
|
-
const existing = new Set(state
|
|
80
|
+
const existing = new Set(shownIds(state, project));
|
|
84
81
|
for (const tipId of tipIds) {
|
|
85
82
|
existing.add(tipId);
|
|
86
83
|
}
|
|
87
84
|
|
|
88
|
-
|
|
89
|
-
version: STATE_VERSION,
|
|
90
|
-
projects: { ...state.projects, [project]: [...existing] },
|
|
91
|
-
};
|
|
92
|
-
await writeState(this.statePath, next);
|
|
85
|
+
await writeState(this.statePath, withShown(state, project, [...existing]));
|
|
93
86
|
});
|
|
94
87
|
});
|
|
95
88
|
writeQueue = update.catch(() => {});
|
|
@@ -97,21 +90,17 @@ export class TipStateStore {
|
|
|
97
90
|
}
|
|
98
91
|
|
|
99
92
|
/** Removes a failed claim without blocking startup when persistence is unavailable. */
|
|
100
|
-
public async unmarkShown(project: string, tipIdentity: string): Promise<void> {
|
|
93
|
+
public async unmarkShown(project: string | undefined, tipIdentity: string): Promise<void> {
|
|
101
94
|
const update = writeQueue.then(async () => {
|
|
102
95
|
try {
|
|
103
96
|
await withStateLock(this.statePath, async () => {
|
|
104
97
|
const state = await readState(this.statePath);
|
|
105
|
-
const existing = new Set(state
|
|
98
|
+
const existing = new Set(shownIds(state, project));
|
|
106
99
|
if (!existing.delete(tipIdentity)) {
|
|
107
100
|
return;
|
|
108
101
|
}
|
|
109
102
|
|
|
110
|
-
|
|
111
|
-
version: STATE_VERSION,
|
|
112
|
-
projects: { ...state.projects, [project]: [...existing] },
|
|
113
|
-
};
|
|
114
|
-
await writeState(this.statePath, next);
|
|
103
|
+
await writeState(this.statePath, withShown(state, project, [...existing]));
|
|
115
104
|
});
|
|
116
105
|
} catch {
|
|
117
106
|
// State is an optimization. Never block startup on a failed cleanup.
|
|
@@ -122,6 +111,16 @@ export class TipStateStore {
|
|
|
122
111
|
}
|
|
123
112
|
}
|
|
124
113
|
|
|
114
|
+
function shownIds(state: TipState, project: string | undefined): readonly string[] {
|
|
115
|
+
return project === undefined ? (state.global ?? []) : (state.projects[project] ?? []);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
function withShown(state: TipState, project: string | undefined, ids: readonly string[]): TipState {
|
|
119
|
+
return project === undefined
|
|
120
|
+
? { ...state, global: ids }
|
|
121
|
+
: { ...state, projects: { ...state.projects, [project]: ids } };
|
|
122
|
+
}
|
|
123
|
+
|
|
125
124
|
/** Normalizes a project path for use as a state key. */
|
|
126
125
|
export function normalizeProjectPath(project: string): string {
|
|
127
126
|
return path.resolve(project);
|
|
@@ -214,7 +213,10 @@ function isState(value: unknown): value is TipState {
|
|
|
214
213
|
if (
|
|
215
214
|
record.version !== STATE_VERSION ||
|
|
216
215
|
typeof record.projects !== "object" ||
|
|
217
|
-
record.projects === null
|
|
216
|
+
record.projects === null ||
|
|
217
|
+
Array.isArray(record.projects) ||
|
|
218
|
+
(record.global !== undefined &&
|
|
219
|
+
(!Array.isArray(record.global) || !record.global.every((tip) => typeof tip === "string")))
|
|
218
220
|
) {
|
|
219
221
|
return false;
|
|
220
222
|
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { TIP_API_VERSION, TIP_PROTOCOL, type TipProvider } from "#src/api/tips.js";
|
|
2
|
+
|
|
3
|
+
/** Creates a global setup hint when the setup skill is available in an interactive session. */
|
|
4
|
+
export function createSetupHintProvider(hasSkill: () => boolean): TipProvider {
|
|
5
|
+
return {
|
|
6
|
+
protocol: TIP_PROTOCOL,
|
|
7
|
+
apiVersion: TIP_API_VERSION,
|
|
8
|
+
id: "agent-setup",
|
|
9
|
+
getTip(context) {
|
|
10
|
+
if (context.mode !== "tui" || !context.hasUI || !hasSkill()) return undefined;
|
|
11
|
+
return {
|
|
12
|
+
id: "agent-setup-v1",
|
|
13
|
+
scope: "global",
|
|
14
|
+
title: "Agent-assisted setup",
|
|
15
|
+
body: "You can ask your agent to configure Pi Agent IDE.\nTry: “Help me configure Pi Agent IDE for this project.”\nOr open /agent-ide-settings.",
|
|
16
|
+
};
|
|
17
|
+
},
|
|
18
|
+
};
|
|
19
|
+
}
|
package/dist/chunk-5KFVDYCI.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a}from"./chunk-7TJ6DWW3.js";import"./chunk-EY65TFHJ.js";import"./chunk-R5XJSEOE.js";import"./chunk-EI7MMDWY.js";export{a as startSshProcess};
|
package/dist/chunk-ABFCAOU5.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a}from"./chunk-XZDOVPRC.js";import"./chunk-7TJ6DWW3.js";import"./chunk-EY65TFHJ.js";import"./chunk-R5XJSEOE.js";import"./chunk-EI7MMDWY.js";export{a as runOwnedSshCommand};
|
package/dist/chunk-BIG45IPN.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{b as k,e as f}from"./chunk-SSWUUBIR.js";import{a as v,b}from"./chunk-PS2B6THP.js";import{a as s}from"./chunk-EI7MMDWY.js";import h from"node:path";import{pathToFileURL as T}from"node:url";function $(e,n,t,o,i,a=[],l=[]){let c=a.map(r=>({kind:"note",text:r}));c.push(...b(e.flatMap(r=>{let p=h.isAbsolute(r.source),D=p&&i?h.relative(i,r.source)||h.basename(r.source):r.source,z=p?T(r.source).href:/^https?:/iu.test(r.source)?r.source:void 0,x=r.endLineNumber??r.lineNumber;return(x===r.lineNumber?[r.lineText]:[r.lineText,...r.matchedText.split(/\r\n|\n|\r/u).slice(1)]).slice(0,20).map((R,m)=>({source:r.source,label:D,...z===void 0?{}:{link:z},...p?{}:{badge:/^https?:/iu.test(r.source)?"WEB":"SH"},lineNumber:r.lineNumber+m,text:R,ranges:[{from:m?0:r.startColumn,to:r.lineNumber+m===x?r.endColumn:R.length}]}))}))),e.length||c.push({kind:"note",text:"No matches found"}),e.some(r=>(r.endLineNumber??r.lineNumber)-r.lineNumber>=20)&&c.push({kind:"note",text:"\u2026 source preview shortened"}),c.push(...l.map(r=>({kind:"note",text:r,expandedOnly:!0})));let u=`${e.length}${n?"":"+"}`,y=new Set(e.map(r=>r.source)),F=e.every(r=>h.isAbsolute(r.source));return new v({summary:`${u} ${e.length===1?"match":"matches"} in ${y.size} ${F?y.size===1?"file":"files":y.size===1?"source":"sources"}`,rows:c},t,o)}s($,"renderSearchMatches");function P(e,n){return e.targets.some(t=>t.source===n.source&&t.ranges.some(o=>(o.start.lineNumber<n.lineNumber||o.start.lineNumber===n.lineNumber&&o.start.column<=n.startColumn)&&(o.end.lineNumber>(n.endLineNumber??n.lineNumber)||o.end.lineNumber===(n.endLineNumber??n.lineNumber)&&o.end.column>=n.endColumn)))}s(P,"containsSearchMatch");import{Value as N}from"typebox/value";var d={candidates:5,previewMatches:3,identifiers:2e4,identifierLength:80,vocabularyBytes:8*1024*1024,matchesPerCandidate:200,verificationBytes:4*1024*1024,timeoutMs:2e3};function I(e){return N.Check(k,e)}s(I,"isFuzzyResultData");function g(e){return e.length>=5&&e.length<=d.identifierLength&&/^[A-Za-z_$][A-Za-z0-9_$]*$/u.test(e)&&/[A-Za-z]/u.test(e)}s(g,"isFuzzyQuery");var S=class{static{s(this,"FuzzyVocabulary")}names=new Set;bytes=0;limited=!1;account(n){return this.bytes+=n,this.bytes>d.vocabularyBytes&&(this.limited=!0),!this.limited}add(n){if(!(this.limited||!g(n)||this.names.has(n))){if(this.names.size===d.identifiers){this.limited=!0;return}this.names.add(n)}}addText(n){if(this.account(Buffer.byteLength(n))){for(let t of n.matchAll(/[A-Za-z_$][A-Za-z0-9_$]*/gu))if(this.add(t[0]),this.limited)break}}};function w(e){return e.replace(/([A-Z]+)([A-Z][a-z])/gu,"$1 $2").replace(/([a-z0-9])([A-Z])/gu,"$1 $2").split(/[^A-Za-z0-9]+/u).filter(Boolean).map(n=>n.toLowerCase())}s(w,"splitName");function C(e,n){return e.length===n.length&&e.every((t,o)=>t===n[o])}s(C,"same");function L(e,n){if(e.length<5||n.length<5||Math.abs(e.length-n.length)>1||/\d/u.test(e+n))return!1;let t=0;for(;t<Math.min(e.length,n.length)&&e[t]===n[t];)t++;if(e.length===n.length)return e.slice(t+1)===n.slice(t+1)||e[t]===n[t+1]&&e[t+1]===n[t]&&e.slice(t+2)===n.slice(t+2);let o=e.length<n.length?e:n,i=e.length<n.length?n:e;return o.slice(t)===i.slice(t+1)}s(L,"oneTypo");function M(e,n){if(e.join("")===n.join(""))return{kind:"normalized",reason:"same spelling with different case or separators"};let t=e.length<n.length?e:n,o=e.length<n.length?n:e;if(o.length===t.length+1&&t.length>=2&&t.every(l=>l.length>=3)){let l=C(t,o.slice(1)),c=C(t,o.slice(0,-1));if(l||c)return{kind:"component",reason:`${e.length>n.length?"remove":"add"} ${l?"leading":"trailing"} component '${l?o[0]:o.at(-1)}'`}}if(e.length!==n.length)return;let i=e.flatMap((l,c)=>{let u=n[c];return u!==void 0&&l!==u?[{word:l,other:u}]:[]}),a=i[0];if(!(i.length!==1||!a||!L(a.word,a.other)))return{kind:"typo",reason:`one character edit: '${a.word}' \u2192 '${a.other}'`}}s(M,"relation");var A={normalized:0,component:1,typo:2};function E(e,n){if(!g(e))return[];let t=w(e);if(t.length===0)return[];let o=[];for(let i of new Set(n)){if(i===e||!g(i))continue;let a=M(t,w(i));a&&o.push({identifier:i,...a})}return o.sort((i,a)=>A[i.kind]-A[a.kind]||(i.identifier<a.identifier?-1:i.identifier>a.identifier?1:0)).slice(0,d.candidates)}s(E,"rankFuzzyIdentifiers");function _(e,n,t){return{identifier:e.identifier,kind:e.kind,reason:e.reason,matchCount:e.matches.length,fileCount:new Set(e.matches.map(o=>o.source)).size,selection:{...f(e.matches.slice(0,d.previewMatches),e.complete,n,t),truncated:e.matches.length>d.previewMatches}}}s(_,"fuzzyCandidateData");function O(e){let n=e.selection.complete?"":"+",t=e.selection.all?.line??e.selection.matches[0]?.references?.line,o=e.selection.matches[0],i=t??o?.source;return[`Possible name: ${e.identifier} (${e.reason})`,`${e.matchCount}${n} ${e.matchCount===1&&e.selection.complete?"match":"matches"} in ${e.fileCount}${n} ${e.fileCount===1&&e.selection.complete?"file":"files"}`,`Exact alternative: ${JSON.stringify(e.identifier)} (case-sensitive, whole identifier)`,...e.selection.complete?[]:["Capture limit reached; no complete all reference. Inspect the returned location; do not treat this candidate as a complete match set."],...i?[`Read: ${i}${t||!o?"":` \xB7 line ${o.range.startLine}`}`]:[]].join(`
|
|
2
|
-
`)}s(O,"formatFuzzyCandidate");export{$ as a,P as b,d as c,I as d,g as e,S as f,E as g,_ as h,O as i};
|
package/dist/chunk-BMOJTJJJ.js
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{b as v,c as E,d as S,e as I,g as _}from"./chunk-JMVDFOTQ.js";import{a as s}from"./chunk-EI7MMDWY.js";import{truncateToWidth as k,wrapTextWithAnsi as R}from"@earendil-works/pi-tui";var O="PI AGENT IDE",N=/\/[a-z][\w-]*/giu,m=class{constructor(t,r){this.tip=t;this.theme=r}static{s(this,"TipCallout")}cached;render(t){if(this.cached?.width===t)return this.cached.lines;let r=L(this.tip,this.theme,t);return this.cached={width:t,lines:r},r}invalidate(){this.cached=void 0}};function L(e,t,r){if(r<=0)return[];if(r<=2)return[t.fg("accent",r===1?"\u2502":"\u2502 ")];let i=r-2,n=t.fg("accent",t.bold(O))+t.fg("dim"," \xB7 ")+t.bold(e.title),o=e.body.split(`
|
|
2
|
-
`).map(c=>c.length===0?"":$(c,t)),a=[n,...o].flatMap(c=>D(c,i)),d=t.fg("accent","\u2502");return a.map(c=>k(`${d} ${c}`,r))}s(L,"renderTip");function D(e,t){return e.length===0?[""]:R(e,t)}s(D,"wrapLine");function $(e,t){let r="",i=0;for(let n of e.matchAll(N)){let o=n.index;r+=t.fg("muted",e.slice(i,o)),r+=t.fg("accent",t.bold(n[0])),i=o+n[0].length}return r+t.fg("muted",e.slice(i))}s($,"styleBodyLine");var y=class{static{s(this,"TipCore")}providers=new Map;registerProvider(t){if(!/^[a-z0-9][a-z0-9.-]*$/u.test(t.id))return Promise.reject(new Error(`Invalid tip provider ID: ${t.id}`));let r=this.providers.get(t.id);return r!==void 0?r===t?Promise.resolve():Promise.reject(new Error(`Tip provider ${t.id} is already registered`)):(this.providers.set(t.id,t),Promise.resolve())}get isEmpty(){return this.providers.size===0}async collectTips(t){let r=[];for(let i of this.providers.values()){if(t.signal?.aborted)break;try{let n=await M(i,t);n!==void 0&&z(n)&&r.push({providerId:i.id,tip:n})}catch{}}return r}};async function M(e,t){let r=t.signal;if(r===void 0)return e.getTip(t);if(r.aborted)return;let i=s(()=>{},"abort"),n=new Promise(o=>{i=s(()=>o(void 0),"abort"),r.addEventListener("abort",i,{once:!0})});try{return await Promise.race([e.getTip(t),n])}finally{r.removeEventListener("abort",i)}}s(M,"collectTip");function z(e){return typeof e.id=="string"&&/^[a-z0-9][a-z0-9.-]*$/u.test(e.id)&&typeof e.title=="string"&&e.title.trim().length>0&&typeof e.body=="string"&&e.body.trim().length>0}s(z,"isTip");import{randomUUID as U}from"node:crypto";import{mkdir as P,readFile as V,rename as G,rm as b,stat as J,writeFile as Y}from"node:fs/promises";import{setTimeout as F}from"node:timers/promises";import{homedir as K}from"node:os";import f from"node:path";var l=1,W=10,B=5e3,Q=6e4,u=Promise.resolve();function X(e=process.env){let t=e.PI_CODING_AGENT_DIR??f.join(K(),".pi","agent");return f.join(t,"pi-agent-ide","tips.json")}s(X,"resolveTipStatePath");var h=class{constructor(t=X()){this.statePath=t}static{s(this,"TipStateStore")}async shownFor(t){let r=await g(this.statePath);return new Set(r.projects[t]??[])}async claimIfUnseen(t,r,i){let n=u.then(async()=>{try{return await w(this.statePath,async()=>{let o=await g(this.statePath),a=new Set(o.projects[t]??[]);if(a.has(r)||i!==void 0&&a.has(i))return!1;a.add(r);let d={version:l,projects:{...o.projects,[t]:[...a]}};return await T(this.statePath,d),!0})}catch{return!0}});return u=n.then(()=>{},()=>{}),n}async markShown(t,r){if(r.length===0)return;u=u.then(async()=>{await w(this.statePath,async()=>{let n=await g(this.statePath),o=new Set(n.projects[t]??[]);for(let d of r)o.add(d);let a={version:l,projects:{...n.projects,[t]:[...o]}};await T(this.statePath,a)})}).catch(()=>{}),await u}async unmarkShown(t,r){u=u.then(async()=>{try{await w(this.statePath,async()=>{let n=await g(this.statePath),o=new Set(n.projects[t]??[]);if(!o.delete(r))return;let a={version:l,projects:{...n.projects,[t]:[...o]}};await T(this.statePath,a)})}catch{}}).catch(()=>{}),await u}};function j(e){return f.resolve(e)}s(j,"normalizeProjectPath");async function g(e){try{let t=JSON.parse(await V(e,"utf8"));return H(t)?t:C()}catch{return C()}}s(g,"readState");async function w(e,t){let r=`${e}.lock`;await P(f.dirname(e),{recursive:!0});let i=Date.now();for(;;)try{await P(r);break}catch(n){if(q(n)!=="EEXIST")throw n;try{if(Date.now()-(await J(r)).mtimeMs>Q){await b(r,{recursive:!0,force:!0});continue}}catch{}if(Date.now()-i>=B)throw new Error(`Timed out waiting for startup-tip state lock: ${r}`,{cause:n});await F(W)}try{return await t()}finally{await b(r,{recursive:!0,force:!0})}}s(w,"withStateLock");function q(e){return typeof e=="object"&&e!==null&&"code"in e?String(e.code):void 0}s(q,"errorCode");async function T(e,t){try{await P(f.dirname(e),{recursive:!0});let r=`${e}.${process.pid}.${U()}.tmp`;try{await Y(r,`${JSON.stringify(t,null,2)}
|
|
3
|
-
`,"utf8"),await G(r,e)}finally{await b(r,{force:!0})}}catch{}}s(T,"writeState");function C(){return{version:l,projects:{}}}s(C,"emptyState");function H(e){if(typeof e!="object"||e===null||Array.isArray(e))return!1;let t=e;return t.version!==l||typeof t.projects!="object"||t.projects===null?!1:Object.values(t.projects).every(r=>Array.isArray(r)&&r.every(i=>typeof i=="string"))}s(H,"isState");var A="pi-agent-ide-startup-tip";function Z(e){let t=new y,r=new h;e.registerEntryRenderer(A,(a,d,p)=>{let c=a.data;if(!(typeof c.title!="string"||typeof c.body!="string"))return new m({title:c.title,body:c.body},p)});let i=e.events.on(I,a=>{if(!_(a))throw new Error("Invalid tip provider registration request");a.accept(t.registerProvider(a.provider))});e.on("session_shutdown",i);let n,o=Promise.resolve();e.on("session_start",(a,d)=>{n?.abort(),n=new AbortController;let p=n.signal;o=o.then(()=>tt(e,t,r,a.reason,d,p)).catch(()=>{})}),e.on("session_shutdown",async()=>{n?.abort(),await o}),e.events.emit(S,{protocol:v,apiVersion:E})}s(Z,"registerTips");async function tt(e,t,r,i,n,o){if(n.mode!=="tui"||(o.throwIfAborted(),t.isEmpty))return;let a=await t.collectTips({cwd:n.cwd,mode:n.mode,hasUI:n.hasUI,signal:o,reason:i});if(o.throwIfAborted(),a.length===0)return;let d=j(n.cwd);for(let p of a){let c=et(p.providerId,p.tip.id);if(await r.claimIfUnseen(d,c,p.tip.id)){if(o.aborted){await r.unmarkShown(d,c);return}try{e.appendEntry(A,p.tip);return}catch(x){throw await r.unmarkShown(d,c),x}}}}s(tt,"displayTip");function et(e,t){return JSON.stringify([e,t])}s(et,"tipIdentity");export{Z as default};
|
package/dist/chunk-BQ67M4NC.js
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{a as X}from"./chunk-PLKYHUNT.js";import{m as k}from"./chunk-ZPT5D4VP.js";import{a as w}from"./chunk-ZC65Z3CK.js";import{a as l}from"./chunk-EI7MMDWY.js";import{createHash as Ae}from"node:crypto";import{open as Ee,readFile as Ne}from"node:fs/promises";import x from"node:path";import{spawn as be}from"node:child_process";import{stat as xe}from"node:fs/promises";import E from"node:path";import{createInterface as we}from"node:readline";import{existsSync as pe}from"node:fs";import me from"node:os";import Y from"node:path";function Z(e=process.env.PI_CODING_AGENT_DIR??Y.join(me.homedir(),".pi","agent"),t=process.platform){let r=Y.join(e,"bin",t==="win32"?"rg.exe":"rg");return pe(r)?r:"rg"}l(Z,"resolveRipgrepExecutable");function D(e,t=!1){let r=$(e);return I(r)?W(P(new B(e,r).parse(),t)):t?e:Q(e)}l(D,"compileSearchQuery");function J(e,t=!1){let r=$(e);return I(r)?P(new B(e,r).parse(),t):void 0}l(J,"compileSearchCondition");function A(e,t){if(e.kind==="term")return t(e.value);let r=A(e.left,t);if(e.kind==="or")return r||A(e.right,t);let n=A(e.right,t);return r&&(e.kind==="not"?!n:n)}l(A,"satisfiesSearchCondition");function te(e){if(I($(e)))return;let t=[...new Set(e.trim().split(/\s+/u).filter(Boolean))];return t.length>1?`(?:${t.map(Q).join("|")})`:void 0}l(te,"compileSearchFallbackQuery");function I(e){return e.some(t=>t.quoted===!0||t.type==="and"||t.type==="or"||t.type==="not")}l(I,"containsBooleanSyntax");var B=class{static{l(this,"BooleanQueryParser")}#t;#n;#i=0;constructor(t,r){this.#t=t,this.#n=r}parse(){let t=this.#a(),r=this.#e();if(r.type!=="end"){let n=r.type==="right"?"unexpected ')'.":`unexpected ${ye(r)}.`;throw R(r.offset,n)}return t}#a(){let t=this.#r();for(;this.#e().type==="or";){let r=this.#o(),n=this.#s(`after ${r.value}`);t={kind:"or",left:t,right:this.#c(n)}}return t}#r(){return this.#c(this.#s())}#c(t){let r=t;for(;;){let n=this.#e();if(n.type==="and"||n.type==="not"){this.#o();let o=this.#s(`after ${n.value}`);r={kind:n.type,left:r,right:o};continue}if(n.type==="term"||n.type==="left"){r={kind:"and",left:r,right:this.#s()};continue}return r}}#s(t){let r=this.#e();if(r.type==="term")return this.#o(),{kind:"term",value:r.value,quoted:r.quoted};if(r.type==="left"){if(this.#o(),this.#e().type==="right"||this.#e().type==="end")throw R(this.#e().offset,"expected a term after '('.");let o=this.#a();if(this.#e().type!=="right")throw R(this.#e().offset,"expected ')'.");return this.#o(),o}if(t===void 0&&(r.type==="and"||r.type==="or"||r.type==="not"))throw R(r.offset,`expected a term before ${r.value}.`);let n=t===void 0?"":` ${t}`;throw R(r.offset,`expected a term${n}.`)}#e(){return this.#n[this.#i]??{type:"end",value:"",offset:this.#t.length}}#o(){let t=this.#e();return this.#i+=1,t}};function $(e){let t=[],r=0;for(;r<e.length;){let n=e.charAt(r);if(/\s/u.test(n)){r+=1;continue}if(n==="("&&ge(e,r)){t.push({type:"left",value:n,offset:r}),r+=1;continue}if(n===")"){t.push({type:"right",value:n,offset:r}),r+=1;continue}if(ee(e,r)){let s=e.charAt(r+1)==="|"?2:1;t.push({type:"or",value:e.slice(r,r+s),offset:r}),r+=s;continue}if(n==="'"||n==='"'){let s=r,u=n,i="";for(r+=1;r<e.length&&e.charAt(r)!==u;)e.charAt(r)==="\\"&&(e.charAt(r+1)===u||e.charAt(r+1)==="\\")&&(r+=1),i+=e.charAt(r++);if(r>=e.length)throw R(s,`unterminated ${u==="'"?"single":"double"}-quoted term.`);if(r+=1,i.length===0)throw R(s,"quoted terms must not be empty.");t.push({type:"term",value:i,offset:s,quoted:!0});continue}let o=r;for(;r<e.length;){let s=e.charAt(r);if(/\s/u.test(s)||s===")"||ee(e,r))break;s==="\\"&&r+1<e.length?r+=2:s==="["||s==="("?r=z(e,r)??r+1:r+=1}let a=e.slice(o,r);t.push({type:Se(a),value:a,offset:o})}return t.push({type:"end",value:"",offset:e.length}),t}l($,"tokenize");function ee(e,t){return e.charAt(t)==="|"&&(e.charAt(t+1)==="|"||/\s/u.test(e.charAt(t-1))&&/\s/u.test(e.charAt(t+1)))}l(ee,"isBooleanPipe");function z(e,t){let r=e.charAt(t)==="["?"]":")",n=t+1;for(;n<e.length;){let o=e.charAt(n);if(o==="\\")n+=2;else{if(o===r)return n+1;if(r===")"&&(o==="("||o==="[")){let a=z(e,n);if(a===void 0)return;n=a}else n+=1}}}l(z,"regexBlockEnd");function ge(e,t){let r=z(e,t);if(r===void 0)return!0;let n=e.slice(t+1,r-1);return n.trim().length===0?!0:I($(n))}l(ge,"isBooleanGroup");function Se(e){return e==="AND"?"and":e==="OR"?"or":e==="NOT"?"not":"term"}l(Se,"operatorType");function ye(e){return e.value.length>0?JSON.stringify(e.value):"the end of the query"}l(ye,"quoteToken");function R(e,t){return new SyntaxError(`Invalid Boolean search query at column ${String(e+1)}: ${t}`)}l(R,"syntaxError");function P(e,t){return e.kind==="term"?{kind:"term",value:t&&!e.quoted?e.value:Q(e.value)}:{kind:e.kind,left:P(e.left,t),right:P(e.right,t)}}l(P,"compileTerms");function W(e){if(e.kind==="term")return e.value;let t=W(e.left);return e.kind==="not"?t:`(?:${t}|${W(e.right)})`}l(W,"matchPattern");function Q(e){return e.replace(/[\\^$.*+?()[\]{}|]/gu,"\\$&")}l(Q,"escapeRegex");async function j(e,t,r,n,o){if(e.query.length===0)throw new Error("Search query must not be empty.");if(/\r|\n/u.test(e.query))throw new Error("Search supports one-line patterns only.");return e.condition!==void 0?Re(e,t,r,o):oe(e,t,r,void 0,n,o)}l(j,"searchText");async function Te(e,t,r,n){if(r===void 0&&(e.path?.includes("://")||t.includes("://")))throw new Error("No search environment owns this scope.");let o=r?.resolve(t,ne(e.path??"."))??E.resolve(t,ne(e.path??".")),a=r===void 0?(await xe(o)).isDirectory():await r.isDirectory(o,n);return{cwd:a?o:r?.dirname(o)??E.dirname(o),target:a?".":`./${r?.basename(o)??E.basename(o)}`,arguments:["--no-config","--no-ignore-parent","--color=never",...re(e.include).flatMap(s=>["--glob",s]),...re(e.exclude).flatMap(s=>["--glob",`!${s}`])]}}l(Te,"ripgrepScope");async function Ye(e,t,r,n){if(e.condition!==void 0)throw new Error("Boolean scoped search is not available yet.");if(/\r|\n/u.test(e.query))throw new Error("Search supports one-line patterns only.");let o=await L(["--json","--no-config","--color=never","--with-filename","--line-number",...e.regex===!0?["--engine","auto"]:["--fixed-strings"],e.caseSensitive===!0?"--case-sensitive":"--ignore-case",...e.wholeWord===!0?["--word-regexp"]:[],"--",e.query,"-"],r,n,void 0,void 0,t.length===0?`
|
|
2
|
-
`:t);return t.length===0?{...o,matches:o.matches.filter(a=>a.lineNumber===1&&a.startColumn===0&&a.endColumn===0)}:o}l(Ye,"searchTextContent");async function oe(e,t,r,n,o,a){let s=await Te(e,t,a,r),u=s.cwd,i=["--json","--with-filename","--line-number",e.caseSensitive===!0?"--case-sensitive":"--ignore-case",...e.wholeWord===!0?["--word-regexp"]:[],...s.arguments,"--",e.query,s.target];if(e.regex!==!0)return L(["--fixed-strings",...i],u,r,n,o,void 0,a);try{return await L(["--engine","auto",...i],u,r,n,o,void 0,a)}catch(c){if(!ve(c))throw c instanceof Error&&/PCRE2 is not available|does not support PCRE2/iu.test(c.message)?new Error("This regex requires PCRE2. Install ripgrep with PCRE2 support or simplify the regex.",{cause:c}):c;try{return await L(["--engine","default",...i],u,r,n,o,void 0,a)}catch(d){throw r?.aborted?d:new AggregateError([c,d],"Regex exceeded the PCRE2 match limit and cannot run with the default engine. Narrow the search or simplify the regex.",{cause:d})}}}l(oe,"searchPattern");async function Re(e,t,r,n){let o=e.condition;if(o===void 0)throw new Error("Boolean search requires a line condition.");let a=new Set;function s(f){if(f.kind==="term"){a.add(f.value);return}s(f.left),s(f.right)}l(s,"collect"),s(o);let{condition:u,...i}=e,c=new Map,d=l(f=>JSON.stringify([f.source,f.lineNumber]),"lineKey");for(let f of a){r?.throwIfAborted();let S=new Set;await oe({...i,query:f,regex:!0,wholeWord:!1},t,r,(b,T)=>S.add(JSON.stringify([b,T])),void 0,n),c.set(f,S)}let h=await j(i,t,r,void 0,n),p=new Set,g=h.matches.filter(f=>{let S=d(f);return p.has(S)||!A(o,b=>c.get(b)?.has(S)===!0)?!1:(p.add(S),!0)});return{...h,matches:g}}l(Re,"searchBoolean");function L(e,t,r,n,o,a,s){return s!==void 0?ke(e,t,s,r,n,o):new Promise((u,i)=>{let c=be(Z(),e,{stdio:["pipe","pipe","pipe"],cwd:t}),d=0,h=!1;o!==void 0&&c.stdout.on("data",m=>{d+=m.length,d>o.bytes&&(h=!0,c.kill())});let p=we({input:c.stdout});c.stdin.on("error",()=>{}),c.stdin.end(a);let g=[],f="",S,b=l(()=>{c.kill()},"abort"),T=l(()=>{r?.removeEventListener("abort",b),p.close()},"cleanup");c.stderr.setEncoding("utf8"),c.stderr.on("data",m=>{f+=m}),p.on("line",m=>{if(!(h||S!==void 0||m.length===0))try{let y=JSON.parse(m);if(y.type!=="match")return;if(n!==void 0){let{path:M,line_number:V}=y.data;M.text!==void 0&&Number.isSafeInteger(V)&&n(E.resolve(t,M.text),V);return}for(let M of ie(y,t)){if(o!==void 0&&g.length===o.matches){h=!0,c.kill();break}g.push(M)}}catch(y){S=y,c.kill()}}),c.once("error",m=>{T(),i(m)}),c.once("close",m=>{if(T(),r?.aborted===!0){let y=new Error("Search was aborted.");y.name="AbortError",i(y);return}if(S!==void 0){i(new Error("Unable to parse ripgrep search output.",{cause:S}));return}if(!h&&m!==0&&m!==1){i(new Error(f.trim()||`ripgrep exited with code ${String(m)}.`));return}g.sort(ae),u({matches:g,complete:!h})}),r?.addEventListener("abort",b,{once:!0}),r?.aborted===!0&&b()})}l(L,"runRipgrep");async function ke(e,t,r,n,o,a){let s=[],u=new AbortController,i=l(()=>u.abort(n?.reason),"abort");n?.addEventListener("abort",i,{once:!0}),n?.aborted&&i();let c=0,d={limited:!1};try{let h=await r.runLines(e,t,p=>{if(d.limited||!p.length)return;if(c+=Buffer.byteLength(p)+1,a!==void 0&&c>a.bytes){d.limited=!0,u.abort();return}let g=JSON.parse(p);if(g.type==="match"){if(o!==void 0){let f=g.data.path.text;f!==void 0&&Number.isSafeInteger(g.data.line_number)&&o(r.resolve(t,f),g.data.line_number);return}for(let f of ie(g,t,r)){if(a!==void 0&&s.length>=a.matches){d.limited=!0,u.abort();break}s.push(f)}}},u.signal);if(h.code!==0&&h.code!==1)throw new Error(h.stderr.trim()||"Ripgrep failed.")}catch(h){if(n?.throwIfAborted(),!d.limited)throw h}finally{n?.removeEventListener("abort",i)}return n?.throwIfAborted(),s.sort(ae),{matches:s,complete:!d.limited}}l(ke,"runOwnedRipgrep");function ve(e){return e instanceof Error&&/PCRE2: error matching: match limit exceeded/iu.test(e.message)}l(ve,"isPcre2MatchLimitError");function ie(e,t,r){let n=e.data.path.text,o=e.data.lines.text;if(n===void 0||o===void 0||!Number.isSafeInteger(e.data.line_number))return[];let a=o.replace(/(?:\r\n|\n)$/u,""),s=Buffer.from(o),u=[];for(let i of e.data.submatches){if(i.start<0||i.end<i.start||i.end>s.length)continue;let c=s.subarray(0,i.start).toString("utf8").length,d=s.subarray(0,i.end).toString("utf8").length;u.push({source:r?.resolve(t,n)??E.resolve(t,n),lineNumber:e.data.line_number,startColumn:c,endColumn:d,matchedText:a.slice(c,d),lineText:a})}return u}l(ie,"matchesFromEvent");function re(e){if(e===void 0)return[];let t=[],r=0,n="";for(let o of e){if(o==="{"?r+=1:o==="}"&&(r=Math.max(0,r-1)),r===0&&(o===","||/\s/u.test(o))){n.length>0&&(t.push(n),n="");continue}n+=o}return n.length>0&&t.push(n),t}l(re,"splitGlobList");function ne(e){return e.startsWith("@")?e.slice(1):e}l(ne,"stripFilePrefix");function ae(e,t){return e.source.localeCompare(t.source)||e.lineNumber-t.lineNumber||e.startColumn-t.startColumn||e.endColumn-t.endColumn}l(ae,"compareMatches");function nt(e){let t=D(e.query),r=D(e.query,!0),n=te(e.query),o=[],a=J(e.query),s=J(e.query,!0);return(r!==t||JSON.stringify(a)!==JSON.stringify(s))&&o.push({query:r,mode:"regex",condition:s}),n!==void 0&&n!==t&&n!==r&&o.push({query:n,mode:"words"}),{...e,query:t,regex:!0,condition:a,fallbacks:o}}l(nt,"createSearchRecipe");async function G(e,t,r,n){let o=e.query,a=await j(e,t,r,void 0,n),s=[];for(let u of e.fallbacks??[]){if(a.matches.length>0||!a.complete)break;r?.throwIfAborted();try{a=await j({...e,query:u.query,regex:!0,condition:u.condition},t,r,void 0,n),o=u.query,s.push(u.mode==="regex"?"Search fallback: no literal matches; tried unquoted terms as regex.":"Search fallback: no matches in earlier modes; tried separate words. Use these matches as location hints; refine the query before editing.")}catch(i){if(u.mode!=="regex"||!Ce(i)||r?.aborted)throw i;s.push("Search fallback: invalid regex skipped; literal search found no matches.")}}return{...a,query:o,notices:s}}l(G,"runSearchRecipe");function Ce(e){return e instanceof Error&&/regex parse error:|PCRE2: error compiling pattern/iu.test(e.message)}l(Ce,"isRegexSyntaxError");var Me=/^SEARCH#([A-F0-9]{4,64}):(all|[1-9]\d*):(line|match)$/u,ue=4;function ft(e,t,r,n){return de(e,t,r,n).slice(0,ue)}l(ft,"createSearchSessionId");function de(e,t,r,n){let o=r===void 0?Oe(t.map(i=>i.source)):C(r),a=t.map(i=>({match:i,source:i.source.includes("://")?C(i.source):x.relative(o,x.resolve(i.source))})).sort((i,c)=>i.source.localeCompare(c.source)||K(i.match,c.match)).map(({match:i,source:c})=>[c,i.lineNumber,i.startColumn,i.endLineNumber??i.lineNumber,i.endColumn,i.matchedText,i.lineText]),{limit:s,...u}=he(n??{query:e,regex:!0},o);return Ae("sha256").update(JSON.stringify([e,o,u,a])).digest("hex").toUpperCase()}l(de,"createSearchSessionIdentity");function Be(e,t){if(!/^[A-F0-9]{64}$/u.test(e))throw new Error("Search session identity must be a 64-character uppercase hexadecimal value.");for(let r=ue;r<=e.length;r+=1){let n=e.slice(0,r);if(!t.has(n))return n}throw new Error("Could not allocate a unique search session id.")}l(Be,"allocateSearchSessionId");function he(e,t){return{query:e.query,path:je(t,e.path??"."),include:e.include??"",exclude:e.exclude??"",caseSensitive:e.caseSensitive===!0,wholeWord:e.wholeWord===!0,limit:e.limit??50,regex:e.regex===!0,condition:e.condition,fallbacks:e.fallbacks??[]}}l(he,"normalizeRecipe");var F=class extends Error{static{l(this,"SearchSnapshotChangedError")}constructor(t){super(`Search result in ${t} changed before its anchors were registered.`),this.name="SearchSnapshotChangedError"}},se=class{constructor(t=de,r,n){this.createIdentity=t;this.resultTargets=r;this.readSource=n}static{l(this,"SearchSessionStore")}#t=new Map;#n=new Map;async register(t,r,n,o,a,s={query:t,regex:!0},u,i,c){let d=r.map(m=>({...m,source:C(m.source)})).sort(K),h=this.readSource,p=h===void 0?void 0:(m,y)=>h(m,o,y),g=await ce(d,a,i,c,p),f=this.createIdentity(t,d,o,s),b=this.#n.get(f)??Be(f,new Set(this.#t.keys())),T={id:b,query:t,matches:d,complete:n,contentBySource:g,read:p,...Pe(this.resultTargets,d,g,o,n,(m,y)=>_(m,y,c,p)),...i===void 0?{}:{snapshotByteBudget:i},recipe:s,environment:c,...u!==void 0&&{refresh:u},cwd:C(o)};return this.#n.set(f,b),this.#t.set(b,T),T}async registerIfCurrent(t,r,n,o,a,s,u,i,c){try{return await this.register(t,r,n,o,a,s,u,i,c)}catch(d){if(d instanceof F)return;throw d}}async observeAfterEdit(t,r){let n=new Set(t.flatMap(a=>{let s=typeof a=="string"?O(a):void 0;return s===void 0?[]:[s.id]})),o=[];for(let a of n){let s=this.#t.get(a);if(s===void 0)continue;let u={sessionId:a,query:s.recipe.originalQuery??s.query,scope:he(s.recipe,s.cwd)};try{let i=s.refresh===void 0?await G(s.recipe,s.cwd,r,s.environment):await s.refresh(r);o.push({...u,matches:i.matches.length,complete:i.complete,notices:i.notices})}catch(i){o.push({...u,error:i instanceof Error?i.message:String(i)})}}return o}anchorResolver(){return{id:"search",description:["`SEARCH#HASH:N:line` selects one result's full line; `SEARCH#HASH:N:match` selects its exact match.","`SEARCH#HASH:all:line` selects each unique containing line; `SEARCH#HASH:all:match` selects every exact match.","Omit `path` when `all` spans files."].join(`
|
|
3
|
-
`),renderFull(t){return t},renderCompact(t){let r=O(t);return r===void 0?"selected result":r.selector==="all"?r.mode==="match"?"all matches":"all lines":r.mode==="match"?`match ${String(r.selector)}`:`line ${String(r.selector)}`},tryResolve:l((t,r)=>this.#i(t,r.source,r.signal),"tryResolve")}}resourceResolver(){return{id:"search-targets",tryResolve:l((t,r)=>this.#a(t,r.cwd),"tryResolve")}}async#i(t,r,n){let o=O(t);if(o===void 0)return{kind:"not-handled"};let a=this.#t.get(o.id);if(a===void 0)return N();if(o.selector==="all"&&!a.complete)return v();let s=C(r),u=a;if(o.selector==="all"){if(a.refreshedComplete?.complete===!0)u=a.refreshedComplete;else if(a.refreshedComplete!==void 0&&(u=await this.#r(a,n),!u.complete))return v()}let i=H(u,o.selector,o.mode),c=i.filter(p=>p.source===s);if(c.length===0)return{kind:"rejected",rejection:{code:"missing",reason:"search anchor does not select this resource"}};let d=await U(s,n,a.environment,a.read);if(d===void 0)return N(w(c[0]).lineNumber);if(o.selector==="all"&&d!==u.contentBySource.get(s)){if(u=await this.#r(a,n),!u.complete)return v();i=H(u,o.selector,o.mode),c=i.filter(p=>p.source===s)}if(c.length===0)return{kind:"rejected",rejection:{code:"missing",reason:"search anchor does not select this resource"}};if(o.selector!=="all"&&d!==a.contentBySource.get(s))return N(w(c[0]).lineNumber);let h=k(s,d);return{kind:"resolved",anchor:new X(t,s,c.map(p=>q(h,p,o.mode)))}}async#a(t,r){let n=O(t);if(n===void 0)return{kind:"not-handled"};let o=this.#t.get(n.id);if(o===void 0)return N();if(n.selector==="all"&&!o.complete)return v();let a=o;if(n.selector==="all"){if(o.refreshedComplete?.complete===!0)a=o.refreshedComplete;else if(o.refreshedComplete!==void 0&&(a=await this.#r(o),!a.complete))return v();let c=new Set(H(a,n.selector,n.mode).map(d=>d.source));for(let d of c)if(await U(d,void 0,o.environment,o.read)!==a.contentBySource.get(d)){if(a=await this.#r(o),!a.complete)return v();break}}let s=H(a,n.selector,n.mode);if(n.selector!=="all"){let c=s[0]?.source;if(c!==void 0&&await U(c,void 0,o.environment,o.read)!==a.contentBySource.get(c))return N(s[0]?.lineNumber)}let u=new Map;for(let c of s){let d=u.get(c.source)??[];d.push(q(k(c.source,a.contentBySource.get(c.source)??c.lineText),c,n.mode)),u.set(c.source,d)}let i=[...u].map(([c,d])=>({source:c,ranges:d,expectedContent:a.contentBySource.get(c)}));return i.length===0?{kind:"rejected",rejection:{code:"missing",reason:"search anchor has no matches"}}:{kind:"resolved",targets:i}}async#r(t,r){let n=t.refresh===void 0?await G(t.recipe,t.cwd,r,t.environment):await t.refresh(r),o=n.matches.map(s=>({...s,source:C(s.source)})).sort(K),a={matches:o,complete:n.complete,contentBySource:await ce(o,r,t.snapshotByteBudget,t.environment,t.read)};return this.#t.set(t.id,{...t,refreshedComplete:a}),a}};function Pe(e,t,r,n,o,a){if(e===void 0)return{};let s=new Map([...r].map(([i,c])=>[i,k(i,c)])),u=t.map(i=>({source:i.source,expectedContent:w(r.get(i.source)),ranges:[q(w(s.get(i.source)),i,"match")],readCurrent:l(c=>a(i.source,c),"readCurrent")}));return{target:e.register(u,n,o),matchTargets:u.slice(0,100).map(i=>e.register([i],n,o))}}l(Pe,"registerResultReferences");function O(e){let t=Me.exec(e);if(t!==null)return{id:w(t[1]),selector:t[2]==="all"?"all":Number(t[2]),mode:t[3]==="line"?"line":"match"}}l(O,"parseSearchAnchor");function H(e,t,r){let n=t==="all"?e.matches:[e.matches[t-1]].filter(Ie);if(r==="match"||t!=="all")return n;let o=new Set;return n.flatMap(a=>{let s=k(a.source,e.contentBySource.get(a.source)??a.lineText),u=fe(a);return s.lines.slice(a.lineNumber-1,u).flatMap(i=>{let c=`${a.source}\0${String(i.lineNumber)}`;return o.has(c)?[]:(o.add(c),[{...a,lineNumber:i.lineNumber,endLineNumber:i.lineNumber,startColumn:0,endColumn:i.content.length,lineText:i.content,matchedText:i.content}])})})}l(H,"selectMatches");function Ie(e){return e!==void 0}l(Ie,"isMatch");function fe(e){let t=e.endLineNumber??e.lineNumber;return t>e.lineNumber&&e.endColumn===0?t-1:t}l(fe,"lastContainingLine");function q(e,t,r){if(r==="match")return{start:{lineNumber:t.lineNumber,column:t.startColumn},end:{lineNumber:t.endLineNumber??t.lineNumber,column:t.endColumn}};let n=fe(t),o=w(e.lines[n-1]);return{start:{lineNumber:t.lineNumber,column:0},end:{lineNumber:n+(o.lineEnding.length>0?1:0),column:o.lineEnding.length>0?0:o.content.length},linewise:!0}}l(q,"selectionRange");function $e(e,t){let r=t.endLineNumber??t.lineNumber;return e.lines.slice(t.lineNumber-1,r).map(n=>{let o=n.lineNumber===t.lineNumber?t.startColumn:0,a=n.lineNumber===r?t.endColumn:n.content.length;return n.content.slice(o,a)+(n.lineNumber===r?"":n.lineEnding)}).join("")}l($e,"matchedSourceText");async function ce(e,t,r,n,o){let a=[...new Set(e.map(i=>i.source))];if(r!==void 0){let i=new Map,c=r;for(let d of a){let h=await Le(d,c,t,n,o);c-=Buffer.byteLength(h),le(d,h,e),i.set(d,h)}return i}let s=await Promise.allSettled(a.map(async i=>{let c=await _(i,t,n,o);return le(i,c,e),[i,c]})),u=new Map;for(let i of s){if(i.status==="rejected")throw i.reason;u.set(...i.value)}return u}l(ce,"snapshotContents");function le(e,t,r){let n=k(e,t);for(let o of r.filter(a=>a.source===e))if(n.lines[o.lineNumber-1]?.content!==o.lineText||$e(n,o)!==o.matchedText)throw new F(e)}l(le,"validateSnapshot");async function Le(e,t,r,n,o){if(r?.throwIfAborted(),e.includes("://")){let s=await _(e,r,n,o);if(Buffer.byteLength(s)>t)throw new Error("Candidate snapshot byte budget reached.");return s}let a=await Ee(e,"r");try{let s=await a.stat();if(!s.isFile()||s.size>t)throw new Error("Candidate snapshot byte budget reached.");let u=Buffer.alloc(Math.min(s.size+1,t+1)),i=0;for(;i<u.length;){r?.throwIfAborted();let c=await a.read(u,i,u.length-i,i);if(c.bytesRead===0)break;i+=c.bytesRead}if(r?.throwIfAborted(),i>s.size||i>t)throw new Error("Candidate file grew during snapshot capture.");return u.subarray(0,i).toString("utf8")}finally{await a.close()}}l(Le,"readBoundedSnapshot");async function U(e,t,r,n){try{return await _(e,t,r,n)}catch{return}}l(U,"readCurrent");function C(e){return e.includes("://")?e:x.resolve(e)}l(C,"canonicalSource");function je(e,t){return t.includes("://")?t:e.includes("://")?new URL(t,e.endsWith("/")?e:e+"/").href:x.resolve(e,t)}l(je,"resolveScope");async function _(e,t,r,n){if(t?.throwIfAborted(),n!==void 0)return n(e,t);if(r!==void 0)return r.readText(e,t);if(e.includes("://"))throw new Error("No search snapshot owner for this source.");return Ne(e,{encoding:"utf8",...t!==void 0&&{signal:t}})}l(_,"readOwnedText");function N(e=1){return{kind:"rejected",rejection:{code:"stale",reason:"search anchor is stale",contextRange:{offset:Math.max(1,e-2),limit:5}}}}l(N,"staleAnchor");function v(){return{kind:"rejected",rejection:{code:"missing",reason:"search did not register an all anchor because its result was limited"}}}l(v,"missingCompleteAnchor");function Oe(e){if(e.length===0)return".";let t=x.dirname(x.resolve(w(e[0])));for(let r of e.slice(1)){let n=x.resolve(r);for(;!He(t,n);){let o=x.dirname(t);if(o===t)return t;t=o}}return t}l(Oe,"commonSourceDirectory");function He(e,t){let r=x.relative(e,t);return r!==".."&&!r.startsWith(`..${x.sep}`)&&!x.isAbsolute(r)}l(He,"isWithin");function K(e,t){return e.source.localeCompare(t.source)||e.lineNumber-t.lineNumber||e.startColumn-t.startColumn||(e.endLineNumber??e.lineNumber)-(t.endLineNumber??t.lineNumber)||e.endColumn-t.endColumn}l(K,"compareMatches");export{Z as a,j as b,Te as c,Ye as d,nt as e,G as f,ft as g,de as h,Be as i,F as j,se as k};
|
package/dist/chunk-IH5NW5JX.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import{d as B,h as M}from"./chunk-XH5WN5XA.js";import{a as N}from"./chunk-GW6NZQTQ.js";import{i as w,j as P}from"./chunk-R5XJSEOE.js";import{a as y}from"./chunk-EI7MMDWY.js";import{Allow as $}from"partial-json";import{Guard as f}from"typebox-guard/guard";import{Allow as F,parse as H}from"partial-json";function _(o,e=F.ALL){if(!(!o||o.trim().length===0))try{let t=H(o,e);return t==null||typeof t!="object"||Array.isArray(t)?void 0:t}catch{return}}y(_,"resolvePartial");var R=class{static{y(this,"PartialToolRecoveryRegistry")}registrations=new Map;states=new Map;register(e){this.registrations.set(e.recoveryKey??e.toolName,e)}unregister(e){for(let[t,n]of this.registrations)(n.toolName===e||t===e)&&this.registrations.delete(t)}recoveryKeyFor(e){for(let[t,n]of this.registrations)if(n.toolName===e||n.toolNames?.includes(e)||t===e)return t}async recover(e){let t=this.states.get(e.contentIndex);if(t?.status==="done")return t.result;if(t?.status==="running")return t.promise;let n=this.registrations.get(e.recoveryKey??e.toolName);if(!n)return;let r=this.run(n,e);this.states.set(e.contentIndex,{status:"running",promise:r});let a=await r;return this.states.set(e.contentIndex,{status:"done",result:a}),a}cancel(e){this.states.delete(e)}cleanup(e){this.states.delete(e)}cleanupAll(){this.states.clear()}async run(e,t){let n=[],r=new Set(t.completedEntryIndexes),a=new Set(t.blockedEntryIndexes),i=e.extractEntries(t).filter(c=>{if(r.has(c.index))return n.push({index:c.index,reason:"entry already completed before recovery"}),!1;if(a.has(c.index))return n.push({index:c.index,reason:"entry was blocked by a guard"}),!1;let g=e.isCompleteEntry?.(c,t)??c.complete;return g||n.push({index:c.index,reason:t.recoverCompleteBatch?"entry was incomplete in the recovered batch":"entry was incomplete before the stale entry"}),!t.recoverCompleteBatch&&t.staleEntryIndex!==void 0&&c.index>=t.staleEntryIndex?!1:g}),s=e.filterEntries?.(i,t)??i,d=new Set(s.map(c=>c.index));for(let c of i)d.has(c.index)||n.push({index:c.index,reason:"entry was excluded by recovery filtering"});let u=[];for(let c of s)try{e.validateEntry?.(c,t),u.push(c)}catch(g){n.push({index:c.index,reason:g instanceof Error?g.message:String(g)})}let m={toolName:t.toolName,contentIndex:t.contentIndex,...t.staleEntryIndex!==void 0&&{staleEntryIndex:t.staleEntryIndex},staleDetails:t.staleDetails};if(u.length===0)return{...m,status:"skipped",appliedEntries:[],skippedEntries:n};try{let c=e.buildParams(u,t),g=await e.execute(c,{contentIndex:t.contentIndex,toolCallId:t.toolCallId,toolName:t.toolName,cwd:t.cwd,ctx:t.ctx,signal:new AbortController().signal});return{...m,status:"recovered",appliedEntries:e.getAppliedEntries?.(g,u,t)??u.map(b=>b.index),skippedEntries:n,normalResult:g}}catch(c){return{...m,status:"failed",appliedEntries:[],skippedEntries:n,error:c instanceof Error?c.message:String(c)}}}};import{createAssistantMessageEventStream as W}from"@earendil-works/pi-ai";var O=Symbol.for("pi-agent-text-editor.tool-call-interceptor.streaming-provider.state");function K(o,e,t,n){let r=new Map,a={context:void 0,processStreamEvent:e,markStreamEventProcessed:t,finalizeStreamInterception:n},l=y((i,s)=>{if(!i)return;let d=s.modelRegistry.getProvider(i.provider);if(!d)return;let u=r.get(i.provider);if(u){if(u.subscribers.add(a),u.api===i.api&&d.streamSimple===u.wrapper)return;u.api=i.api;let p=s.modelRegistry.getRegisteredProviderConfig(i.provider);o.registerProvider(i.provider,{...p,api:i.api,streamSimple:u.wrapper});return}let m=d.streamSimple[O];if(m){if(m.subscribers.add(a),r.set(i.provider,m),m.api===i.api)return;m.api=i.api;let p=s.modelRegistry.getRegisteredProviderConfig(i.provider);o.registerProvider(i.provider,{...p,api:i.api,streamSimple:m.wrapper});return}let c=d.streamSimple.bind(d),g=new Set([a]),b=y((p,v,C)=>U(c,p,v,C,g),"wrapper"),E={api:i.api,delegate:c,wrapper:b,subscribers:g};b[O]=E;let h=s.modelRegistry.getRegisteredProviderConfig(i.provider);o.registerProvider(i.provider,{...h,api:i.api,streamSimple:b}),r.set(i.provider,E)},"install");o.on("before_provider_request",(i,s)=>{a.context=s,l(s.model,s)}),o.on("turn_start",(i,s)=>{a.context=s,l(s.model,s)}),o.on("agent_start",(i,s)=>{a.context=s,l(s.model,s)}),o.on("session_start",(i,s)=>{a.context=s,l(s.model,s)}),o.on("model_select",(i,s)=>{a.context=s,l(i.model,s)}),o.on("session_shutdown",()=>{for(let[i,s]of r)s.subscribers.delete(a),s.subscribers.size===0&&o.unregisterProvider(i);r.clear(),a.context=void 0})}y(K,"registerStreamingInterceptorProvider");function U(o,e,t,n,r){let a=W(),l=new AbortController,i=n?.signal,s=!1,d=Y(e),u=new Set,m=new Set,c=new Set,g=new Set,b=y(h=>{for(let p of r)p.markStreamEventProcessed(h)},"markStreamEventProcessed"),E=y(()=>{l.abort()},"abortFromParent");return i&&(i.aborted?l.abort():i.addEventListener("abort",E,{once:!0})),(async()=>{try{let h=o(e,t,{...n,signal:l.signal});for await(let p of h){if(s)continue;p.type==="done"?d=structuredClone(p.message):p.type==="error"?d=structuredClone(p.error):d=structuredClone(p.partial),Q(p,u);let v;for(let C of r){let I=C.context;if(I){let T=await C.processStreamEvent(p,I);v??=T}}if(b(p),q(p,m,c,g),a.push(structuredClone(p)),v){if(p.type==="toolcall_delta"||p.type==="toolcall_end")for(let x of r)x.finalizeStreamInterception(p.contentIndex);s=!0,l.abort();let C=p.type==="toolcall_delta"||p.type==="toolcall_end"?p.contentIndex:void 0,I={...d,content:d.content.filter((x,A)=>u.has(A)&&(C===void 0||A<=C||g.has(A))).map(x=>x.type==="toolCall"&&x.id===v.toolCallId?{...x,arguments:structuredClone(v.arguments)}:x)};V(a,b,I,u,m,c,g);let{errorMessage:T,...L}=I;a.push({type:"done",reason:"toolUse",message:{...L,stopReason:"toolUse"}}),a.end();continue}if(p.type==="done"||p.type==="error"){a.end();return}}}catch(h){if(s)return;let p=d,v=i?.aborted===!0?"aborted":"error",C={...p,stopReason:v,errorMessage:h instanceof Error?h.message:String(h)};a.push({type:"error",reason:v,error:C}),a.end()}finally{i?.removeEventListener("abort",E)}})(),a}y(U,"wrapStream");function Q(o,e){(o.type==="text_start"||o.type==="thinking_start"||o.type==="toolcall_start")&&e.add(o.contentIndex)}y(Q,"rememberStartEvent");function q(o,e,t,n){switch(o.type){case"text_end":{e.add(o.contentIndex);break}case"thinking_end":{t.add(o.contentIndex);break}case"toolcall_end":{n.add(o.contentIndex);break}}}y(q,"rememberEndEvent");function V(o,e,t,n,r,a,l){for(let[i,s]of t.content.entries())if(n.has(i)){if(s.type==="text"&&!r.has(i)){let d={type:"text_end",contentIndex:i,content:s.text,partial:t};e(d),o.push(d)}else if(s.type==="thinking"&&!a.has(i)){let d={type:"thinking_end",contentIndex:i,content:s.thinking,partial:t};e(d),o.push(d)}else if(s.type==="toolCall"&&!l.has(i)){let d={type:"toolcall_end",contentIndex:i,toolCall:s,partial:t};e(d),o.push(d)}}}y(V,"emitMissingEndEvents");function Y(o){return{role:"assistant",content:[],api:o.api,provider:o.provider,model:o.id,usage:{input:0,output:0,cacheRead:0,cacheWrite:0,totalTokens:0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}},stopReason:"toolUse",timestamp:Date.now()}}y(Y,"emptyAssistantMessage");var Z="agentic-ide-partial-tool-recovery",G="pi-agent-text-editor/tool-call-annotation",S=new WeakMap,k=class{constructor(e){this.pi=e;e.on("tool_call",t=>{let n=this.toolCallRecords.get(t.toolCallId),r=n?.blockExecution?n.guardResult:void 0;return r?{block:!0,reason:r.content.filter(l=>l.type==="text").map(l=>l.text).join(`
|
|
2
|
-
`)||`Tool call ${t.toolName} was blocked by a streaming interceptor.`}:void 0}),e.on("tool_result",t=>{let n=this.toolCallBatchEntryIndexes.get(t.toolCallId);n!==void 0&&this.completedBatchEntryIndexes.add(n);let r=this.toolCallRecords.get(t.toolCallId)?.guardResult;if(this.toolCallRecords.delete(t.toolCallId),r){let a=r.details,l=typeof a=="object"&&a!==null&&"effect"in a&&(a.effect==="not-applied"||a.effect==="applied")?a.effect:"unknown",i=r.content.flatMap(s=>s.type==="text"?[s.text]:[]).join(`
|
|
3
|
-
`);return P({content:r.content,details:a},N(t.toolName),{status:"error",errors:[w(i,"INTERCEPTED")],data:{operation:t.toolName,operationId:t.toolCallId,effect:l,files:[]}})}}),e.on("message_update",async(t,n)=>{let r=t.assistantMessageEvent;this.consumeProcessedStreamEvent(r)||await this.processStreamEvent(r,n)}),e.on("message_end",async t=>{if(await this.finalizeRecovery(),this.annotateIncompleteCalls(),t.message.role!=="assistant")return;let n=this.pendingAbortReason;if(this.pendingAbortReason=void 0,!(n===void 0||t.message.stopReason!=="aborted"))return{message:{...t.message,errorMessage:n}}}),e.on("agent_end",async()=>{await this.finalizeRecovery(),this.annotateIncompleteCalls(),this.cleanupAll()})}static{y(this,"InterceptorImpl")}handlers=new Map;recoveryRegistry=new R;pendingRecoveryBlocks=[];pendingAbortReason;recoveryAppliedBatchIndexes=new Set;partialBuffers=new Map;completeArgumentContentIndices=new Set;streamedBatchEntries=new Map;batchEntryIndexes=new Map;toolCallBatchEntryIndexes=new Map;completedBatchEntryIndexes=new Set;nextBatchEntryIndex=0;contentNames=new Map;contentToolCallIds=new Map;pendingToolCallAnnotations=new Map;emittedToolCallAnnotationKinds=new Map;abortedContentIndices=new Set;dispatchQueues=new Map;abortCleanups=new Map;processedStreamEvents=new WeakSet;processedStreamEventKeys=new Map;toolCallRecords=new Map;blockedCallSink;processStreamEvent(e,t){if(e.type==="toolcall_start"){let n=e.partial.content[e.contentIndex];if(n?.type==="toolCall"){let r=this.getOrCreateBatchEntryIndex(e.contentIndex);this.contentNames.set(e.contentIndex,n.name),typeof n.id=="string"&&this.bindToolCallId(e.contentIndex,n.id),this.partialBuffers.set(e.contentIndex,""),this.streamedBatchEntries.set(e.contentIndex,{index:r,toolName:n.name,args:{},complete:!1}),this.installAbortCleanup(e.contentIndex,t.signal)}return Promise.resolve(void 0)}return e.type==="toolcall_delta"?this.enqueue(e.contentIndex,async()=>{let n=this.contentNames.get(e.contentIndex),r=this.contentToolCallIds.get(e.contentIndex);if(!n)return;let a=(this.partialBuffers.get(e.contentIndex)??"")+e.delta;this.partialBuffers.set(e.contentIndex,a),this.installAbortCleanup(e.contentIndex,t.signal);let l=_(a,$.OBJ|$.ARR)??{},i=ee(a),s=this.getOrCreateBatchEntryIndex(e.contentIndex);this.streamedBatchEntries.set(e.contentIndex,{index:s,toolName:n,args:l,complete:i!==void 0});let d=this.handlers.get(n);if(!r||!d||d.length===0||!i&&Object.keys(l).length===0)return;let u=i!==void 0;if(u&&this.completeArgumentContentIndices.has(e.contentIndex))return;u&&this.completeArgumentContentIndices.add(e.contentIndex);let m=i??l,c=await this.dispatchHandlers(d,{toolCall:{id:r,name:n,arguments:m},args:m,...!u&&{partialArgs:l},batchEntryIndex:s,batchEntries:this.getBatchEntries(s),contentIndex:e.contentIndex,cwd:t.cwd,signal:t.signal,ctx:t});return c&&this.rememberOriginalArguments(c.toolCallId,c.arguments),c}):e.type==="toolcall_end"?this.enqueue(e.contentIndex,async()=>{let n=e.toolCall.name,r=this.handlers.get(n),a=this.getOrCreateBatchEntryIndex(e.contentIndex);this.bindToolCallId(e.contentIndex,e.toolCall.id);let l=this.toolCallRecords.get(e.toolCall.id);this.toolCallRecords.set(e.toolCall.id,{originalArguments:structuredClone(e.toolCall.arguments),...l?.guardResult&&{guardResult:l.guardResult},...l?.blockExecution&&{blockExecution:!0}}),this.streamedBatchEntries.set(e.contentIndex,{index:a,toolName:n,args:e.toolCall.arguments,complete:!1});let i=!this.completeArgumentContentIndices.has(e.contentIndex),s;i&&(this.completeArgumentContentIndices.add(e.contentIndex),s=r&&r.length>0?await this.dispatchHandlers(r,{toolCall:e.toolCall,args:e.toolCall.arguments,batchEntryIndex:a,batchEntries:this.getBatchEntries(a),contentIndex:e.contentIndex,cwd:t.cwd,signal:t.signal,ctx:t}):void 0);let d=this.streamedBatchEntries.get(e.contentIndex);return d&&this.streamedBatchEntries.set(e.contentIndex,{...d,complete:!0}),this.cleanupContent(e.contentIndex,n),s}):Promise.resolve(void 0)}markStreamEventProcessed(e){this.processedStreamEvents.add(e);let t=j(e);t!==void 0&&this.processedStreamEventKeys.set(t,(this.processedStreamEventKeys.get(t)??0)+1)}consumeProcessedStreamEvent(e){let t=this.processedStreamEvents.delete(e),n=j(e);if(n===void 0)return t;let r=this.processedStreamEventKeys.get(n)??0;return r===0?t:(r===1?this.processedStreamEventKeys.delete(n):this.processedStreamEventKeys.set(n,r-1),!0)}finalizeStreamInterception(e){this.cleanupTransientContent(e,void 0,!0)}getToolCallRecord(e){return this.toolCallRecords.get(e)}rememberOriginalArguments(e,t){let n=this.toolCallRecords.get(e);n&&this.toolCallRecords.set(e,{originalArguments:structuredClone(t),...n.guardResult&&{guardResult:n.guardResult},...n.blockExecution&&{blockExecution:!0}})}async dispatchHandlers(e,t){for(let n of e){let r=await n.intercept(t);if(r!==void 0){this.pendingRecoveryBlocks.push({blocked:r,ctx:t});let a={content:[{type:"text",text:r.message.content}],details:r.message.details??null};return this.blockedCallSink?.({callId:t.toolCall.id,toolName:t.toolCall.name,arguments:structuredClone(t.args),...t.contentIndex!==void 0&&{contentIndex:t.contentIndex},...t.batchEntryIndex!==void 0&&{batchEntryIndex:t.batchEntryIndex},...r.message.details!==void 0&&{details:r.message.details},result:a,nativeExecutionBlocked:n.blockExecution===!0}),{toolCallId:t.toolCall.id,arguments:structuredClone(t.args),result:this.abortToolCall(r,t,n.name,n.blockExecution===!0)}}}}annotateIncompleteCalls(){for(let[e,t]of this.streamedBatchEntries)!t.complete&&this.contentNames.has(e)&&!this.recoveryAppliedBatchIndexes.has(t.index)&&!this.emittedToolCallAnnotationKinds.get(e)?.has("stale-anchor")&&this.annotateContent(e,{kind:"aborted"})}bindToolCallId(e,t){this.contentToolCallIds.set(e,t);let n=this.batchEntryIndexes.get(e);n!==void 0&&this.toolCallBatchEntryIndexes.set(t,n);let r=this.pendingToolCallAnnotations.get(e);if(r){for(let a of r)this.emitToolCallAnnotation(t,a);this.pendingToolCallAnnotations.delete(e)}}annotateContent(e,t){let n=this.emittedToolCallAnnotationKinds.get(e)??new Set;if(n.has(t.kind))return;n.add(t.kind),this.emittedToolCallAnnotationKinds.set(e,n);let r=this.contentToolCallIds.get(e);if(r){this.emitToolCallAnnotation(r,t);return}let a=this.pendingToolCallAnnotations.get(e)??[];a.push(t),this.pendingToolCallAnnotations.set(e,a)}emitToolCallAnnotation(e,t){let n={toolCallId:e,annotation:t};this.pi.events.emit(G,n)}getOrCreateBatchEntryIndex(e){let t=this.batchEntryIndexes.get(e);if(t!==void 0)return t;let n=this.nextBatchEntryIndex;return this.nextBatchEntryIndex+=1,this.batchEntryIndexes.set(e,n),n}getBatchEntries(e){return[...this.streamedBatchEntries.values()].filter(t=>t.index<=e).sort((t,n)=>t.index-n.index)}getAllBatchEntries(){return[...this.streamedBatchEntries.values()].sort((e,t)=>e.index-t.index)}abortToolCall(e,t,n,r){let a=X(e,n),l=e.annotation?e.annotation.kind==="aborted"&&e.annotation.label===void 0?{...e.annotation,label:a}:e.annotation:e.message.customType==="text-editor-stale-anchor-block"?{kind:"stale-anchor",label:a}:{kind:"aborted",label:a,color:"error"};t.contentIndex!==void 0&&(this.abortedContentIndices.add(t.contentIndex),this.annotateContent(t.contentIndex,l));let i={content:[{type:"text",text:e.message.content}],details:B(e.message.details,l,a)};return this.toolCallRecords.set(t.toolCall.id,{originalArguments:structuredClone(t.args),guardResult:i,...r&&{blockExecution:!0}}),i}async finalizeRecovery(){let e=this.pendingRecoveryBlocks.splice(0);if(e.length===0)return;let t=new Map;for(let n of e){let r=this.recoveryRegistry.recoveryKeyFor(n.ctx.toolCall.name);if(r===void 0)continue;let a=t.get(r)??[];a.push(n),t.set(r,a)}for(let n of t.values()){let r=n[0];if(!r)continue;let a=await this.recoverIfNeeded(r.blocked,r.ctx,this.getAllBatchEntries(),n);if(a===r.blocked)continue;let l=a.message.details,s=(f.IsObjectNotArray(l)&&f.IsObjectNotArray(l.recovery)?l.recovery:void 0)?.appliedEntries;if(Array.isArray(s))for(let d of s)typeof d=="number"&&this.recoveryAppliedBatchIndexes.add(d)}}async recoverIfNeeded(e,t,n,r){if(t.contentIndex===void 0)return e;let a=e.message.details,l=f.IsObjectNotArray(a)&&typeof a.entryIndex=="number"?a.entryIndex:void 0,i=[...new Set(r.map(g=>g.ctx.batchEntryIndex).filter(g=>g!==void 0))],s=[...new Set(r.map(g=>g.ctx.toolCall.id))],d=r.map(g=>g.blocked.message.details),u=r[0],m=u?this.recoveryRegistry.recoveryKeyFor(u.ctx.toolCall.name):void 0;if(!m)return e;let c=await this.recoveryRegistry.recover({contentIndex:t.contentIndex,toolCallId:t.toolCall.id,toolName:t.toolCall.name,...l!==void 0&&{staleEntryIndex:l},staleDetails:a,...t.partialArgs&&{partialArgs:t.partialArgs},args:t.args,batchEntries:n,...t.batchEntryIndex!==void 0&&{batchEntryIndex:t.batchEntryIndex},recoverCompleteBatch:!0,completedEntryIndexes:[...this.completedBatchEntryIndexes],blockedEntryIndexes:i,blockedToolCallIds:s,blockedDetails:d,recoveryKey:m,cwd:t.cwd,ctx:t.ctx});return c&&(c.appliedEntries.length>0||c.skippedEntries.length>0)?re(e,c):e}async enqueue(e,t){let r=(this.dispatchQueues.get(e)??Promise.resolve()).catch(()=>{}).then(t);this.dispatchQueues.set(e,r);try{return await r}finally{this.dispatchQueues.get(e)===r&&this.dispatchQueues.delete(e)}}installAbortCleanup(e,t){if(!t||this.abortCleanups.has(e))return;let n=y(()=>{let r=this.contentNames.get(e),a=r?this.handlers.get(r):void 0;for(let l of a??[])l.onAbort?.(e)},"listener");t.addEventListener("abort",n,{once:!0}),this.abortCleanups.set(e,()=>{t.removeEventListener("abort",n)})}cleanupContent(e,t){this.cleanupTransientContent(e,t),this.recoveryRegistry.cleanup(e)}cleanupTransientContent(e,t,n=!1){let r=t??this.contentNames.get(e),a=r?this.handlers.get(r):void 0;for(let l of a??[])n&&l.onAbort?.(e),l.onContentEnd?.(e);this.abortCleanups.get(e)?.(),this.abortCleanups.delete(e),this.contentNames.delete(e),this.contentToolCallIds.delete(e),this.pendingToolCallAnnotations.delete(e),this.emittedToolCallAnnotationKinds.delete(e),this.completeArgumentContentIndices.delete(e),this.partialBuffers.delete(e),this.abortedContentIndices.delete(e)}cleanupAll(){for(let e of this.handlers.values())for(let t of e)t.onAgentEnd?.();for(let e of this.abortCleanups.values())e();this.abortCleanups.clear(),this.contentNames.clear(),this.contentToolCallIds.clear(),this.pendingToolCallAnnotations.clear(),this.completeArgumentContentIndices.clear(),this.emittedToolCallAnnotationKinds.clear(),this.partialBuffers.clear(),this.streamedBatchEntries.clear(),this.batchEntryIndexes.clear(),this.toolCallBatchEntryIndexes.clear(),this.toolCallRecords.clear(),this.completedBatchEntryIndexes.clear(),this.nextBatchEntryIndex=0,this.abortedContentIndices.clear(),this.pendingAbortReason=void 0,this.dispatchQueues.clear(),this.processedStreamEventKeys.clear(),this.recoveryRegistry.cleanupAll(),this.pendingRecoveryBlocks.length=0,this.recoveryAppliedBatchIndexes.clear()}registerRecovery(e){this.recoveryRegistry.register(e)}unregisterRecovery(e){this.recoveryRegistry.unregister(e)}registerBlockedCallSink(e){this.blockedCallSink=e}register(e){let t=new Set(e.toolNames);for(let[n,r]of this.handlers){let a=r.findIndex(l=>l.name===e.name);a!==-1&&(t.has(n)?(r[a]=e,t.delete(n)):r.splice(a,1))}for(let n of t){let r=this.handlers.get(n)??[];r.push(e),this.handlers.set(n,r)}}unregister(e){for(let[t,n]of this.handlers)this.handlers.set(t,n.filter(r=>r.name!==e))}};function j(o){if(o.type==="toolcall_end")return`${o.type}\0${o.contentIndex}\0${o.toolCall.id}`;if(o.type!=="toolcall_start"&&o.type!=="toolcall_delta")return;let e=o.partial.content[o.contentIndex],t=e?.type==="toolCall"?e.id:"",n=o.type==="toolcall_delta"?o.delta:"";return`${o.type}\0${o.contentIndex}\0${t}\0${n}`}y(j,"toolStreamEventKey");function X(o,e){return o.annotation?.reason?o.annotation.reason:o.annotation?.label?o.annotation.label:o.message.customType==="text-editor-stale-anchor-block"?"Stale Anchor":e.replace(/[-_]+/g," ").replace(/([a-z])([A-Z])/g,"$1 $2").replace(/\s+/g," ").trim().replace(/\b\w/g,t=>t.toUpperCase())||"Blocked"}y(X,"abortReason");function ee(o){try{let e=JSON.parse(o);return f.IsObjectNotArray(e)?e:void 0}catch{return}}y(ee,"parseCompleteArguments");function te(o){let e=o.normalResult;if(!f.IsObjectNotArray(e)||!f.IsObjectNotArray(e.details))return[];let t=e.details.results;if(!Array.isArray(t))return[];let n=f.IsObjectNotArray(o.staleDetails)&&typeof o.staleDetails.path=="string"?o.staleDetails.path:void 0,r=t.filter(f.IsObjectNotArray).map(s=>f.IsObjectNotArray(s.data)?s.data:s),a=n===void 0?r:r.filter(s=>s.path===n),i=(a.length>0?a:r).flatMap(s=>{let d=s.freshAnchors;return Array.isArray(d)?d.filter(u=>typeof u=="string"):[]});return[...new Set(i)]}y(te,"freshAnchorsAfterRecovery");function ne(o,e){let n=o.indexOf(`
|
|
4
|
-
|
|
5
|
-
Current nearby anchors:`);return`${n===-1?o:o.slice(0,n)}
|
|
6
|
-
|
|
7
|
-
Current nearby anchors:
|
|
8
|
-
${e.map(a=>` ${a}`).join(`
|
|
9
|
-
`)}`}y(ne,"replaceCurrentAnchors");function re(o,e){let t=e.appliedEntries.length,n=t>0?`${t} (indices: ${e.appliedEntries.join(", ")})`:"0",r=e.skippedEntries.length>0?e.skippedEntries.map(u=>`${u.index} (${u.reason})`).join(", "):"none",a=e.error?`Recovery execution failed: ${e.error}.`:"Recovery execution completed.",l=te(e),i=l.length>0&&f.IsObjectNotArray(o.message.details)?{...o.message.details,freshAnchors:l}:o.message.details,s=l.length>0?ne(o.message.content,l):o.message.content,d=l.length>0&&f.IsObjectNotArray(e.staleDetails)?{...e,staleDetails:{...e.staleDetails,freshAnchors:l}}:e;return{message:{customType:Z,content:`${s}
|
|
10
|
-
|
|
11
|
-
[RECOVERY] Status: ${e.status}. Applied entries: ${n}. Skipped entries: ${r}. ${a}`,display:!1,details:{blocked:i,recovery:d}}}}y(re,"makeRecoveryResult");var D=new WeakMap;function z(o){let e=D.get(o);if(e)return e;let t=new k(o);return D.set(o,t),K(o,(n,r)=>t.processStreamEvent(n,r),n=>{t.markStreamEventProcessed(n)},n=>{t.finalizeStreamInterception(n)}),t}y(z,"coordinatorFor");function oe(o,e){z(o).register(e)}y(oe,"registerToolCallInterceptor");function ae(o,e){if(S.get(o)?.(),S.delete(o),e===void 0)return;let t=o.events.on(G,n=>{!f.IsObjectNotArray(n)||typeof n.toolCallId!="string"||!M(n.annotation)||e(n.toolCallId,n.annotation)});S.set(o,t)}y(ae,"registerToolCallAnnotationSink");function Ee(o,e){z(o).registerBlockedCallSink(e)}y(Ee,"registerBlockedToolCallSink");export{oe as a,ae as b,Ee as c};
|
package/dist/chunk-NRZO5KJT.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import"./chunk-MPT3R4BL.js";import{a as y,b as A,c as D,d as k}from"./chunk-T7I2VX3J.js";import{a as I}from"./chunk-BU7IZLKB.js";import{a as E,b as P}from"./chunk-S5PL5DFQ.js";import{a as s}from"./chunk-EI7MMDWY.js";var N=/^[a-z0-9]+(?:[.-][a-z0-9]+)*$/,h=class{static{s(this,"AgentDocumentationRegistry")}#e=new Map;register(n){let o=new Set(this.#e.keys());for(let i of n)_(i,o),o.add(i.id);for(let i of n)this.#e.set(i.id,T(i))}list(){return[...this.#e.values()].sort((n,o)=>n.id.localeCompare(o.id))}get(n){return this.#e.get(n)}matching(n,o){let i=v(o);return i?.startsWith("docs:")===!0?[]:this.list().filter(d=>d.triggers.some(a=>{if(a.tool!==n)return!1;let l=a.resourcePrefixes===void 0||i!==void 0&&a.resourcePrefixes.some(r=>i.startsWith(r)),t=a.viewPrefixes===void 0||b(o).some(r=>a.viewPrefixes?.some(u=>r.startsWith(u)));return l&&t}))}};function _(e,n){if(!N.test(e.id))throw new Error(`Invalid documentation ID: ${e.id}`);if(e.description.trim().length===0)throw new Error(`Documentation ${e.id} has no description`);if(e.markdown.trim().length===0)throw new Error(`Documentation ${e.id} has no Markdown content`);if(e.triggers.length===0||e.triggers.some(o=>o.tool.trim().length===0||o.resourcePrefixes?.some(i=>i.length===0)===!0||o.viewPrefixes?.some(i=>i.length===0)===!0))throw new Error(`Documentation ${e.id} has no valid triggers`);if(n.has(e.id))throw new Error(`Documentation ${e.id} is already registered`)}s(_,"validateDocument");function T(e){return Object.freeze({...e,triggers:Object.freeze(e.triggers.map(n=>Object.freeze({...n,...n.resourcePrefixes===void 0?{}:{resourcePrefixes:Object.freeze([...n.resourcePrefixes])},...n.viewPrefixes===void 0?{}:{viewPrefixes:Object.freeze([...n.viewPrefixes])}})))})}s(T,"freezeDocument");function b(e){if(typeof e!="object"||e===null)return[];let n=e.views;return Array.isArray(n)?n.filter(o=>typeof o=="string"):[]}s(b,"readViews");function v(e){if(typeof e!="object"||e===null)return;let n=e.path;return typeof n=="string"?n:void 0}s(v,"readPath");var R="agent-documentation-read";async function M(e){let n=new h,o=new Set,i=new Map,d=new Map,a=s(t=>{let r=t.filter(u=>!o.has(u));if(r.length!==0){e.appendEntry(R,{ids:r});for(let u of r)o.add(u)}},"remember"),l=e.events.on(k,t=>{if(!z(t))throw new Error("Invalid agent documentation registration");n.register(t.documents)});e.on("session_shutdown",l),await I(e,{protocol:E,apiVersion:P,id:"agent-documentation",setup(t){t.addResolver({resolver:{id:"agent-documentation",tryResolve(r){if(!r.startsWith("docs:"))return Promise.resolve({kind:"not-handled"});let u=r.slice(5),m=u.length===0?void 0:n.get(u),g=u.length===0?$(n.list()):m?.markdown;return g===void 0?Promise.resolve({kind:"failed",error:new Error(`Unknown documentation ID: ${u}`)}):Promise.resolve({kind:"resolved",resource:{source:r,read:s(()=>Promise.resolve([{type:"text",text:g}]),"read")}})}}}),t.describe({path:s(()=>n.list().length===0?void 0:"docs: lists packaged agent guidance; docs:<id> reads a listed guide.","path")}),t.addPromptGuideline(()=>j(n.list()))}}),e.on("session_start",(t,r)=>{p(r.sessionManager.getBranch(),n,o)}),e.on("session_tree",(t,r)=>{p(r.sessionManager.getBranch(),n,o)}),e.on("session_compact",(t,r)=>{p(r.sessionManager.getBranch(),n,o)}),e.on("tool_call",t=>{t.toolCallId.includes("-preflight-")||t.parentToolCallId!==void 0&&i.set(t.toolCallId,t.parentToolCallId)}),e.on("tool_result",t=>{if(t.toolCallId.includes("-preflight-"))return;let r=i.get(t.toolCallId);i.delete(t.toolCallId);let u=d.get(t.toolCallId)??[];d.delete(t.toolCallId);let m=t.toolName==="read"?S(t.input):void 0;if(m!==void 0){let c=m.slice(5),C=c.length===0||n.get(c)!==void 0,w=n.get(c);return w!==void 0&&!t.isError&&O(t.content,w)&&a([c]),{content:t.content,structuredContent:t.structuredContent,details:{...f(t.details)?t.details:{},documentation:C?c.length===0?{kind:"list",ids:n.list().map(x=>x.id)}:{kind:"document",id:c}:{kind:"error",code:"UNKNOWN_DOCUMENTATION",id:c}},isError:t.isError}}let g=[...u,...n.matching(t.toolName,t.input).filter(c=>!o.has(c.id))];if(g.length!==0){if(a(g.map(c=>c.id)),r!==void 0){d.set(r,[...d.get(r)??[],...g]);return}return{content:[...t.content,...g.map(c=>({type:"text",text:`
|
|
2
|
-
|
|
3
|
-
---
|
|
4
|
-
|
|
5
|
-
# Guide: ${c.id}
|
|
6
|
-
|
|
7
|
-
${c.markdown.trim()}`}))],structuredContent:t.structuredContent,details:{...f(t.details)?t.details:{},documentation:{kind:"attachment",ids:g.map(c=>c.id)}},isError:t.isError}}}),e.events.emit(D,{protocol:y,apiVersion:A})}s(M,"registerProgressiveDocumentation");function $(e){return e.length===0?"No agent documentation is currently available.":["# Available agent documentation","",...e.map(n=>`- \`${n.id}\` \u2014 ${n.description}`)].join(`
|
|
8
|
-
`)}s($,"renderListing");function j(e){if(e.length!==0)return["Read the matching docs:<id> before using any tool or feature with packaged guidance, including tools discovered later or called through Codemode. Read each guide once per branch. Tool descriptions and docs: listings do not replace the full guide.","If a result includes a Guide, read it before your next use. The call has already run: do not repeat it just to obtain documentation. Nested calls keep their guides on the parent result, even when the script does not print the child output.","Available documents:",...e.map(n=>` - ${n.id} \u2014 ${n.description}`)].join(`
|
|
9
|
-
`)}s(j,"renderPromptGuideline");function p(e,n,o){o.clear();for(let d of e){if(!f(d))continue;if(d.type==="custom"&&d.customType===R&&f(d.data)){i(d.data.ids);continue}if(d.type!=="message"||!f(d.message))continue;let a=d.message;if(a.role!=="toolResult"||!f(a.details))continue;let l=a.details.documentation;if(f(l)&&(l.kind==="attachment"&&i(l.ids),l.kind==="document"&&!a.isError&&typeof l.id=="string")){let t=n.get(l.id);t!==void 0&&O(a.content,t)&&i([t.id])}}function i(d){if(Array.isArray(d))for(let a of d)typeof a=="string"&&n.get(a)!==void 0&&o.add(a)}s(i,"addIds")}s(p,"restoreClaims");function O(e,n){return Array.isArray(e)&&e.some(o=>f(o)&&o.type==="text"&&typeof o.text=="string"&&o.text.includes(n.markdown.trim()))}s(O,"containsFullGuide");function S(e){if(!(!f(e)||typeof e.path!="string"||!e.path.startsWith("docs:")))return e.path}s(S,"documentationSource");function z(e){return f(e)&&Array.isArray(e.documents)}s(z,"isRegistrationRequest");function f(e){return typeof e=="object"&&e!==null}s(f,"isRecord");export{M as default};
|
package/dist/chunk-O36UC74T.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{b as n}from"./chunk-TWWND6NI.js";import"./chunk-SBLKPTL3.js";import"./chunk-XZDOVPRC.js";import{a as o,b as t,c as i}from"./chunk-HCN5W76B.js";import"./chunk-7TJ6DWW3.js";import"./chunk-EY65TFHJ.js";import{b as s}from"./chunk-Z3PGADVA.js";import"./chunk-VDP5CQHM.js";import{c as r}from"./chunk-W7CASEO3.js";import"./chunk-YJ6T3PEP.js";import"./chunk-S72FVLUX.js";import"./chunk-NNCZYO4Q.js";import"./chunk-IICJXZBU.js";import"./chunk-BU7IZLKB.js";import"./chunk-S5PL5DFQ.js";import"./chunk-N7LMRL64.js";import"./chunk-RAZP42IQ.js";import"./chunk-BIG45IPN.js";import"./chunk-SSWUUBIR.js";import"./chunk-PS2B6THP.js";import"./chunk-R5XJSEOE.js";import"./chunk-ZPT5D4VP.js";import"./chunk-756K3LJY.js";import"./chunk-ZC65Z3CK.js";import{a as e}from"./chunk-EI7MMDWY.js";async function g(a){let m=new i(await t(o(r())));await s(a,f=>n(f,m))}e(g,"registerOwnedWeb");export{g as default};
|
package/dist/chunk-SSWUUBIR.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{H as d,f as c}from"./chunk-R5XJSEOE.js";import{a as s}from"./chunk-EI7MMDWY.js";import{Type as t}from"typebox";var b=t.Object({query:t.String({minLength:1,description:"Text to find or a Boolean expression. Quote text to keep it literal. Use regex:<pattern> for regular expressions, files:<pattern> for file paths, ast:<pattern> for syntax patterns, symbols:<query> for language symbols, or process:<query> for running processes."}),path:t.Optional({...d,description:"File, directory, URL, unchanged Read/Search/Select/edit result, its UUID, or an array of such results. Results select only their registered ranges unless symbols: navigation follows external references."}),navigation:t.Optional(t.Literal("references",{description:"Only for symbols: queries. Explicitly follow symbols represented inside path to their references outside that scope. Without navigation, all returned ranges stay inside path."})),include:t.Optional(t.String({description:"Optional include glob for local or SSH files"})),exclude:t.Optional(t.String({description:"Optional exclude glob for local or SSH files"})),caseSensitive:t.Optional(t.Boolean({description:"Match letter case"})),wholeWord:t.Optional(t.Boolean({description:"Match complete words"})),limit:t.Optional(t.Integer({minimum:1,maximum:1e3,description:"Maximum displayed items, including compact file summaries (default 50)."}))},{additionalProperties:!1});import{Type as e}from"typebox";var u=e.Object({startLine:e.Integer(),startColumn:e.Integer(),endLine:e.Integer(),endColumn:e.Integer()},{additionalProperties:!1}),m=e.Object({line:e.Optional(e.String()),match:e.Optional(e.String())},{additionalProperties:!1}),p={source:e.String(),target:e.Optional(e.String()),range:u,matchedText:e.Optional(e.String()),textTruncated:e.Optional(e.Boolean()),references:e.Optional(m)},f=e.Object({...p,captures:e.Optional(e.Record(e.String(),e.Array(e.Object(p,{additionalProperties:!1})))),role:e.Optional(e.Union([e.Literal("definition"),e.Literal("reference")])),symbol:e.Optional(e.Object({id:e.String(),name:e.String(),kind:e.String(),source:e.String(),range:u},{additionalProperties:!1}))},{additionalProperties:!1}),g={target:e.Optional(e.String()),kind:e.Literal("matches"),truncated:e.Optional(e.Boolean()),fullResult:e.Optional(e.String()),complete:e.Boolean(),matches:e.Array(f),all:e.Optional(m),notices:e.Optional(e.Array(e.String()))},O=e.Object({status:e.Union([e.Literal("ready"),e.Literal("skipped")]),message:e.Optional(e.String()),candidates:e.Array(e.Object({identifier:e.String(),kind:e.Union([e.Literal("normalized"),e.Literal("component"),e.Literal("typo")]),reason:e.String(),matchCount:e.Integer(),fileCount:e.Integer(),selection:e.Object(g,{additionalProperties:!1})},{additionalProperties:!1}))},{additionalProperties:!1}),h=e.Union([e.Object({...g,fuzzy:e.Optional(O)},{additionalProperties:!1}),e.Object({kind:e.Literal("files"),complete:e.Boolean(),files:e.Array(e.String())},{additionalProperties:!1}),e.Object({kind:e.Literal("custom"),resolverId:e.String(),value:e.Unknown()},{additionalProperties:!1})]),P=c(h);function T(o,l,r,i){return{kind:"matches",...i?.target===void 0?{}:{target:i.target},truncated:o.length>100,complete:l,matches:o.slice(0,100).map((n,a)=>({source:n.source,...i?.matchTargets?.[a]===void 0?{}:{target:i.matchTargets[a]},range:{startLine:n.lineNumber,startColumn:n.startColumn,endLine:n.endLineNumber??n.lineNumber,endColumn:n.endColumn},...Buffer.byteLength(n.matchedText)<=4096?{matchedText:n.matchedText}:{textTruncated:!0},...r===void 0?{}:{references:{line:`SEARCH#${r}:${a+1}:line`,match:`SEARCH#${r}:${a+1}:match`}}})),...l&&r!==void 0?{all:{line:`SEARCH#${r}:all:line`,match:`SEARCH#${r}:all:match`}}:{}}}s(T,"selectionData");export{b as a,O as b,h as c,P as d,T as e};
|
package/dist/entry-19.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import"./chunk-K4ZMRDEI.js";
|