@herbertgao/pi-extensions 2026.10.18 → 2026.11.0
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/README.md +19 -5
- package/THIRD_PARTY_NOTICES.md +53 -3
- package/node_modules/@herbertgao/pi-subagents/CHANGELOG.md +6 -0
- package/node_modules/@herbertgao/pi-subagents/README.md +142 -45
- package/node_modules/@herbertgao/pi-subagents/docs/rpc.md +17 -7
- package/node_modules/@herbertgao/pi-subagents/package.json +4 -4
- package/node_modules/@herbertgao/pi-subagents/src/agent-manager.ts +111 -59
- package/node_modules/@herbertgao/pi-subagents/src/agent-runner.ts +135 -117
- package/node_modules/@herbertgao/pi-subagents/src/cross-extension-rpc.ts +41 -14
- package/node_modules/@herbertgao/pi-subagents/src/index.ts +110 -19
- package/node_modules/@herbertgao/pi-subagents/src/nested-tools.ts +8 -0
- package/node_modules/@herbertgao/pi-subagents/src/prompts.ts +31 -0
- package/node_modules/@tintinweb/pi-tasks/CHANGELOG.md +270 -0
- package/node_modules/@tintinweb/pi-tasks/CONTRIBUTING.md +67 -0
- package/node_modules/@tintinweb/pi-tasks/CUSTOMIZING.md +289 -0
- package/node_modules/@tintinweb/pi-tasks/LICENSE +21 -0
- package/node_modules/@tintinweb/pi-tasks/README.md +417 -0
- package/node_modules/@tintinweb/pi-tasks/SECURITY.md +107 -0
- package/node_modules/@tintinweb/pi-tasks/dist/auto-clear.d.ts +64 -0
- package/node_modules/@tintinweb/pi-tasks/dist/auto-clear.js +129 -0
- package/node_modules/@tintinweb/pi-tasks/dist/index.d.ts +17 -0
- package/node_modules/@tintinweb/pi-tasks/dist/index.js +1338 -0
- package/node_modules/@tintinweb/pi-tasks/dist/process-tracker.d.ts +29 -0
- package/node_modules/@tintinweb/pi-tasks/dist/process-tracker.js +121 -0
- package/node_modules/@tintinweb/pi-tasks/dist/reminder-cadence.d.ts +39 -0
- package/node_modules/@tintinweb/pi-tasks/dist/reminder-cadence.js +61 -0
- package/node_modules/@tintinweb/pi-tasks/dist/task-glyphs.d.ts +48 -0
- package/node_modules/@tintinweb/pi-tasks/dist/task-glyphs.js +68 -0
- package/node_modules/@tintinweb/pi-tasks/dist/task-paths.d.ts +44 -0
- package/node_modules/@tintinweb/pi-tasks/dist/task-paths.js +60 -0
- package/node_modules/@tintinweb/pi-tasks/dist/task-sort.d.ts +23 -0
- package/node_modules/@tintinweb/pi-tasks/dist/task-sort.js +69 -0
- package/node_modules/@tintinweb/pi-tasks/dist/task-store.d.ts +61 -0
- package/node_modules/@tintinweb/pi-tasks/dist/task-store.js +397 -0
- package/node_modules/@tintinweb/pi-tasks/dist/tasks-config.d.ts +16 -0
- package/node_modules/@tintinweb/pi-tasks/dist/tasks-config.js +51 -0
- package/node_modules/@tintinweb/pi-tasks/dist/types.d.ts +36 -0
- package/node_modules/@tintinweb/pi-tasks/dist/types.js +4 -0
- package/node_modules/@tintinweb/pi-tasks/dist/ui/settings-menu.d.ts +15 -0
- package/node_modules/@tintinweb/pi-tasks/dist/ui/settings-menu.js +140 -0
- package/node_modules/@tintinweb/pi-tasks/dist/ui/task-widget.d.ts +69 -0
- package/node_modules/@tintinweb/pi-tasks/dist/ui/task-widget.js +278 -0
- package/node_modules/@tintinweb/pi-tasks/package.json +57 -0
- package/node_modules/@tintinweb/pi-tasks/src/auto-clear.ts +134 -0
- package/node_modules/@tintinweb/pi-tasks/src/index.ts +1417 -0
- package/node_modules/@tintinweb/pi-tasks/src/process-tracker.ts +140 -0
- package/node_modules/@tintinweb/pi-tasks/src/reminder-cadence.ts +90 -0
- package/node_modules/@tintinweb/pi-tasks/src/task-glyphs.ts +110 -0
- package/node_modules/@tintinweb/pi-tasks/src/task-paths.ts +65 -0
- package/node_modules/@tintinweb/pi-tasks/src/task-sort.ts +90 -0
- package/node_modules/@tintinweb/pi-tasks/src/task-store.ts +402 -0
- package/node_modules/@tintinweb/pi-tasks/src/tasks-config.ts +77 -0
- package/node_modules/@tintinweb/pi-tasks/src/types.ts +40 -0
- package/node_modules/@tintinweb/pi-tasks/src/ui/settings-menu.ts +174 -0
- package/node_modules/@tintinweb/pi-tasks/src/ui/task-widget.ts +325 -0
- package/node_modules/pi-commandcode-provider/CHANGELOG.md +330 -0
- package/node_modules/pi-commandcode-provider/CONTRIBUTING.md +192 -0
- package/node_modules/pi-commandcode-provider/LICENSE +21 -0
- package/node_modules/pi-commandcode-provider/README.md +243 -0
- package/node_modules/pi-commandcode-provider/RELEASE.md +194 -0
- package/node_modules/pi-commandcode-provider/index.ts +309 -0
- package/node_modules/pi-commandcode-provider/package.json +91 -0
- package/node_modules/pi-commandcode-provider/scripts/live-e2e-profile.mjs +87 -0
- package/node_modules/pi-commandcode-provider/scripts/pi-authenticated.mjs +50 -0
- package/node_modules/pi-commandcode-provider/scripts/pi-isolated.mjs +79 -0
- package/node_modules/pi-commandcode-provider/src/api-key.ts +69 -0
- package/node_modules/pi-commandcode-provider/src/auth-server.ts +229 -0
- package/node_modules/pi-commandcode-provider/src/commandcode-catalog-overrides.ts +28 -0
- package/node_modules/pi-commandcode-provider/src/commandcode-catalog.ts +260 -0
- package/node_modules/pi-commandcode-provider/src/converters.ts +477 -0
- package/node_modules/pi-commandcode-provider/src/core.ts +836 -0
- package/node_modules/pi-commandcode-provider/src/cost.ts +76 -0
- package/node_modules/pi-commandcode-provider/src/json-schema.ts +417 -0
- package/node_modules/pi-commandcode-provider/src/models.ts +515 -0
- package/node_modules/pi-commandcode-provider/src/oauth.ts +229 -0
- package/node_modules/pi-commandcode-provider/src/overflow.ts +120 -0
- package/node_modules/pi-commandcode-provider/src/pricing.ts +370 -0
- package/node_modules/pi-commandcode-provider/src/quota-command.ts +66 -0
- package/node_modules/pi-commandcode-provider/src/quota-format.ts +143 -0
- package/node_modules/pi-commandcode-provider/src/quota-types.ts +47 -0
- package/node_modules/pi-commandcode-provider/src/quota.ts +357 -0
- package/node_modules/pi-commandcode-provider/src/responses-stream.ts +249 -0
- package/node_modules/pi-commandcode-provider/src/runtime.ts +330 -0
- package/node_modules/pi-commandcode-provider/src/transcript.ts +56 -0
- package/node_modules/pi-commandcode-provider/src/transport.ts +147 -0
- package/node_modules/pi-commandcode-provider/src/types.ts +212 -0
- package/node_modules/pi-commandcode-provider/src/usage.ts +261 -0
- package/node_modules/pi-lens/CHANGELOG.md +149 -0
- package/node_modules/pi-lens/README.md +12 -2
- package/node_modules/pi-lens/config/markdownlint/run-no-fix.mjs +36 -0
- package/node_modules/pi-lens/dist/{chunk-WME2OQST.js → chunk-2453RRJ2.js} +11 -6
- package/node_modules/pi-lens/dist/{chunk-FZKFVUEC.js → chunk-2BKUFQKR.js} +276 -208
- package/node_modules/pi-lens/dist/chunk-2TS4GLOJ.js +31 -0
- package/node_modules/pi-lens/dist/{chunk-QHSNL7B2.js → chunk-2ZE3AUJQ.js} +12 -14
- package/node_modules/pi-lens/dist/{chunk-MPKRJBPK.js → chunk-35WKJWO5.js} +28 -30
- package/node_modules/pi-lens/dist/chunk-3JAHQBSY.js +27 -0
- package/node_modules/pi-lens/dist/{chunk-4LM3VAZH.js → chunk-3O5EII3W.js} +2 -2
- package/node_modules/pi-lens/dist/chunk-447YZL4S.js +25 -0
- package/node_modules/pi-lens/dist/{chunk-H7OR7DFZ.js → chunk-4B2YFN4U.js} +25 -21
- package/node_modules/pi-lens/dist/{chunk-OSTKYB55.js → chunk-4BKU7PV3.js} +1 -1
- package/node_modules/pi-lens/dist/{chunk-RRV3FNNM.js → chunk-4LL2VRNY.js} +27 -28
- package/node_modules/pi-lens/dist/{chunk-BZARLRJW.js → chunk-4NBWFYWW.js} +9 -9
- package/node_modules/pi-lens/dist/{chunk-KKCK636N.js → chunk-4QG55RRC.js} +12 -12
- package/node_modules/pi-lens/dist/{chunk-RQS4QQSD.js → chunk-4W52ZKZX.js} +2 -2
- package/node_modules/pi-lens/dist/{chunk-Z2XAOKHK.js → chunk-565VRUP4.js} +2 -2
- package/node_modules/pi-lens/dist/{chunk-HWDAVBFU.js → chunk-57X2CDRX.js} +23 -23
- package/node_modules/pi-lens/dist/{chunk-MB6PXBUA.js → chunk-5F3XF3SX.js} +7 -15
- package/node_modules/pi-lens/dist/{chunk-O4BJFESU.js → chunk-5RNB4HVK.js} +1 -1
- package/node_modules/pi-lens/dist/{chunk-ZMAUPOMG.js → chunk-5T5A6YAJ.js} +35 -34
- package/node_modules/pi-lens/dist/{chunk-4ZYJHQMB.js → chunk-6FIRFP6A.js} +12 -12
- package/node_modules/pi-lens/dist/{chunk-4YHYPW2G.js → chunk-6GMGEKQN.js} +9 -5
- package/node_modules/pi-lens/dist/{chunk-4LOE5R5P.js → chunk-6LJOJ6EO.js} +20 -15
- package/node_modules/pi-lens/dist/{chunk-3YY7IXIL.js → chunk-6YUNI7B5.js} +3 -3
- package/node_modules/pi-lens/dist/{chunk-PKES3ISE.js → chunk-7ANZ7XDD.js} +2 -2
- package/node_modules/pi-lens/dist/{chunk-FB5SCCPT.js → chunk-7CGIDRIK.js} +16 -15
- package/node_modules/pi-lens/dist/{chunk-L3CMBQMH.js → chunk-7MAD5ZAY.js} +16 -17
- package/node_modules/pi-lens/dist/{chunk-WDBICWH3.js → chunk-7TNILKGY.js} +1 -1
- package/node_modules/pi-lens/dist/{chunk-RORGS5II.js → chunk-A5GRLYPZ.js} +9 -9
- package/node_modules/pi-lens/dist/{chunk-MNJIXFX4.js → chunk-AGGUWKRK.js} +1 -1
- package/node_modules/pi-lens/dist/{chunk-ABPKUVA4.js → chunk-BBET6HD6.js} +1 -1
- package/node_modules/pi-lens/dist/{chunk-L5JYIU47.js → chunk-BHWW6FAX.js} +14 -13
- package/node_modules/pi-lens/dist/{chunk-URCQWAQ4.js → chunk-BOPDQ7AZ.js} +23 -21
- package/node_modules/pi-lens/dist/{chunk-KDX35VXP.js → chunk-BQG2QFVO.js} +158 -133
- package/node_modules/pi-lens/dist/{chunk-CB4WHS4H.js → chunk-BUZIQDFS.js} +3 -3
- package/node_modules/pi-lens/dist/{chunk-2PHMIAKO.js → chunk-CM73PPGD.js} +4 -4
- package/node_modules/pi-lens/dist/{chunk-DH5JPM3K.js → chunk-CUDD35TW.js} +10 -9
- package/node_modules/pi-lens/dist/{chunk-AWDSEDER.js → chunk-CZL44WFN.js} +2 -2
- package/node_modules/pi-lens/dist/{chunk-N5WSK2K7.js → chunk-DIWK3LBC.js} +12 -15
- package/node_modules/pi-lens/dist/{chunk-24BILSZW.js → chunk-DYRZGUMA.js} +2 -2
- package/node_modules/pi-lens/dist/{chunk-PR6PO3ES.js → chunk-FHEV6T4L.js} +22 -18
- package/node_modules/pi-lens/dist/{chunk-DQZFQSR5.js → chunk-FRLAUP2B.js} +4 -4
- package/node_modules/pi-lens/dist/{chunk-RZOXUSPC.js → chunk-G5GV2Q7K.js} +2 -2
- package/node_modules/pi-lens/dist/{chunk-EKWX4WD3.js → chunk-G6JKM4O7.js} +7 -7
- package/node_modules/pi-lens/dist/chunk-GGYOZWHW.js +27 -0
- package/node_modules/pi-lens/dist/{chunk-XT2HTCJ5.js → chunk-GIRBSBGL.js} +6 -5
- package/node_modules/pi-lens/dist/{chunk-PQJFG24Z.js → chunk-GMROJJRN.js} +1292 -946
- package/node_modules/pi-lens/dist/{chunk-U6VN4NVL.js → chunk-HHR7WGCI.js} +3 -3
- package/node_modules/pi-lens/dist/{chunk-TIQJPRDD.js → chunk-HKIL6DCL.js} +3 -2
- package/node_modules/pi-lens/dist/{chunk-SNDXCFRS.js → chunk-HUAM7QG3.js} +11 -11
- package/node_modules/pi-lens/dist/{chunk-QOE342SU.js → chunk-HXFUTMX2.js} +2 -2
- package/node_modules/pi-lens/dist/{chunk-U7BD2QL7.js → chunk-I22THIHI.js} +12 -12
- package/node_modules/pi-lens/dist/chunk-IE5D3RA5.js +58 -0
- package/node_modules/pi-lens/dist/{chunk-DPGEAHZT.js → chunk-IYVYZQRL.js} +10 -16
- package/node_modules/pi-lens/dist/{chunk-3F6BMY53.js → chunk-JBP7KESM.js} +1 -1
- package/node_modules/pi-lens/dist/{chunk-U5HPROLA.js → chunk-JE6HKLC7.js} +2 -2
- package/node_modules/pi-lens/dist/{chunk-ZE3KXHS7.js → chunk-JPRDTY5S.js} +85 -3
- package/node_modules/pi-lens/dist/{chunk-HO6LWE2E.js → chunk-JYLOYTZD.js} +17 -1
- package/node_modules/pi-lens/dist/{chunk-KW5JQPO5.js → chunk-JZRP4DGP.js} +2 -2
- package/node_modules/pi-lens/dist/{chunk-CPSR3AVL.js → chunk-KZ4ALBCH.js} +2 -2
- package/node_modules/pi-lens/dist/{chunk-6IR3ZYIB.js → chunk-L3CLUGDY.js} +3 -3
- package/node_modules/pi-lens/dist/{chunk-LV4UMYVH.js → chunk-L4NEVZ4T.js} +28 -27
- package/node_modules/pi-lens/dist/chunk-LPYTPNOJ.js +22 -0
- package/node_modules/pi-lens/dist/{chunk-WGRJOXED.js → chunk-LSFXZLPW.js} +1016 -636
- package/node_modules/pi-lens/dist/{chunk-LBLBAFG3.js → chunk-MC6VB2E5.js} +4 -4
- package/node_modules/pi-lens/dist/{chunk-U2SDMG7C.js → chunk-NM2NWH55.js} +5 -5
- package/node_modules/pi-lens/dist/{chunk-T7A2HK2B.js → chunk-NSPVR3FN.js} +19 -18
- package/node_modules/pi-lens/dist/{chunk-ZGSJDWQU.js → chunk-O2ARHQKF.js} +2 -2
- package/node_modules/pi-lens/dist/{chunk-OXOI55RU.js → chunk-O4N5BQ3T.js} +10 -10
- package/node_modules/pi-lens/dist/{chunk-3FRLWYBG.js → chunk-OC7VWJBZ.js} +39 -40
- package/node_modules/pi-lens/dist/chunk-OFNMHPBT.js +89 -0
- package/node_modules/pi-lens/dist/{chunk-HR3OJ3TH.js → chunk-OWTG6UMO.js} +21 -21
- package/node_modules/pi-lens/dist/{chunk-75GAYVNO.js → chunk-OY7WZI7Q.js} +6 -6
- package/node_modules/pi-lens/dist/{chunk-ZJTT47IG.js → chunk-OZWXLJMX.js} +2 -2
- package/node_modules/pi-lens/dist/{chunk-F6X3YJWD.js → chunk-PIQQM32Y.js} +2 -2
- package/node_modules/pi-lens/dist/chunk-PKLB2XJL.js +8 -0
- package/node_modules/pi-lens/dist/{chunk-EAOK7MIZ.js → chunk-PKSUMEPT.js} +17 -4
- package/node_modules/pi-lens/dist/{chunk-YISME6ON.js → chunk-PPKECBPP.js} +1 -1
- package/node_modules/pi-lens/dist/{chunk-4L36HG27.js → chunk-R2QQC33W.js} +14 -14
- package/node_modules/pi-lens/dist/{chunk-LUBPZN36.js → chunk-R4QWJQ2H.js} +11 -11
- package/node_modules/pi-lens/dist/{chunk-V63BC55Q.js → chunk-RGGH6M34.js} +1 -1
- package/node_modules/pi-lens/dist/{chunk-Y7F7IEE3.js → chunk-RZG472YW.js} +65 -7
- package/node_modules/pi-lens/dist/{chunk-PUZ3E2J4.js → chunk-SDFKOLSF.js} +6 -6
- package/node_modules/pi-lens/dist/{chunk-YHC2O2WO.js → chunk-SFLHSL5R.js} +9 -9
- package/node_modules/pi-lens/dist/{chunk-CCV2EU7T.js → chunk-SP4TFY5F.js} +14 -13
- package/node_modules/pi-lens/dist/{chunk-J6JP25XU.js → chunk-SQC7K3SP.js} +4 -3
- package/node_modules/pi-lens/dist/{chunk-3K2F6UDZ.js → chunk-T2S3FNNJ.js} +44 -42
- package/node_modules/pi-lens/dist/{chunk-2TF6RXWB.js → chunk-TV6RXRYH.js} +10 -10
- package/node_modules/pi-lens/dist/{chunk-GNSIWBAT.js → chunk-U3AS2FR6.js} +3 -3
- package/node_modules/pi-lens/dist/{chunk-F7K5IBZG.js → chunk-UHHLR2VY.js} +40 -40
- package/node_modules/pi-lens/dist/chunk-UYXV5NIS.js +20 -0
- package/node_modules/pi-lens/dist/{chunk-VSFLRN5Y.js → chunk-VLQ7UKZH.js} +1 -1
- package/node_modules/pi-lens/dist/{chunk-VUZWQ7UG.js → chunk-VN3L2JWZ.js} +46 -72
- package/node_modules/pi-lens/dist/{chunk-NA7SEXHE.js → chunk-VOP4PJKA.js} +7 -7
- package/node_modules/pi-lens/dist/{chunk-F5Z6URKM.js → chunk-VOXTCULR.js} +2 -2
- package/node_modules/pi-lens/dist/{chunk-LLS45EWB.js → chunk-VPLBLWFO.js} +6 -8
- package/node_modules/pi-lens/dist/chunk-W3BGKBBK.js +27 -0
- package/node_modules/pi-lens/dist/{chunk-ZKXQKGWZ.js → chunk-WC6WRNQT.js} +4 -3
- package/node_modules/pi-lens/dist/{chunk-YVHBNSME.js → chunk-WMDUT4KH.js} +1148 -1132
- package/node_modules/pi-lens/dist/{chunk-KXF5R4UN.js → chunk-WQV6BI4Q.js} +1 -1
- package/node_modules/pi-lens/dist/chunk-WXUDRAG6.js +24 -0
- package/node_modules/pi-lens/dist/{chunk-KPPJTH44.js → chunk-X35S7HSB.js} +28 -10
- package/node_modules/pi-lens/dist/{chunk-JMEKXFOL.js → chunk-X66YJ2SS.js} +40 -34
- package/node_modules/pi-lens/dist/{chunk-CE6VMBCB.js → chunk-XOMGO63G.js} +22 -21
- package/node_modules/pi-lens/dist/{chunk-LS3QJRUB.js → chunk-XWIME22V.js} +13 -13
- package/node_modules/pi-lens/dist/{chunk-R5MOQM2H.js → chunk-XYLC35E4.js} +119 -87
- package/node_modules/pi-lens/dist/{chunk-OE5ZBP7F.js → chunk-YHGYAEFH.js} +18 -18
- package/node_modules/pi-lens/dist/{chunk-7E2563GA.js → chunk-ZFORSIED.js} +13 -13
- package/node_modules/pi-lens/dist/{chunk-E7HJ56Y7.js → chunk-ZKLTNLAW.js} +64 -73
- package/node_modules/pi-lens/dist/chunk-ZONZ6YY3.js +74 -0
- package/node_modules/pi-lens/dist/chunk-ZSM35JF4.js +30 -0
- package/node_modules/pi-lens/dist/{chunk-RC2Z6K47.js → chunk-ZZDIOAAJ.js} +15 -6
- package/node_modules/pi-lens/dist/index.js +6993 -5396
- package/node_modules/pi-lens/dist/mcp/analyze-cli.js +10 -10
- package/node_modules/pi-lens/dist/mcp/cli.js +44 -42
- package/node_modules/pi-lens/dist/mcp/server.js +1627 -504
- package/node_modules/pi-lens/dist/mcp/worker.js +62 -61
- package/node_modules/pi-lens/dist/probes/installer.js +20 -19
- package/node_modules/pi-lens/docs/adr/0003-git-guard-latch-writer.md +11 -6
- package/node_modules/pi-lens/docs/agent-tools.md +18 -8
- package/node_modules/pi-lens/docs/alignment-families.md +29 -0
- package/node_modules/pi-lens/docs/ast-grep_rules_catalog.md +6 -4
- package/node_modules/pi-lens/docs/ci-bot-pr-checks.md +126 -0
- package/node_modules/pi-lens/docs/configuration.md +99 -3
- package/node_modules/pi-lens/docs/defect-shapes.md +55 -12
- package/node_modules/pi-lens/docs/engineering-principles.md +27 -2
- package/node_modules/pi-lens/docs/features.md +2 -2
- package/node_modules/pi-lens/docs/invariants/git-guard-host.md +7 -3
- package/node_modules/pi-lens/docs/invariants/language-config.md +15 -4
- package/node_modules/pi-lens/docs/invariants/lsp-trust-exec.md +16 -2
- package/node_modules/pi-lens/docs/invariants/paths-os.md +4 -2
- package/node_modules/pi-lens/docs/lsp-capability-matrix.md +119 -39
- package/node_modules/pi-lens/docs/merge-queue-rollout.md +1 -1
- package/node_modules/pi-lens/docs/pi-lens-fixer.md +24 -17
- package/node_modules/pi-lens/docs/pi-lens-merge-policy.md +20 -11
- package/node_modules/pi-lens/docs/pi-lens-monitor.md +9 -0
- package/node_modules/pi-lens/docs/pi-lens-orchestration.md +4 -1
- package/node_modules/pi-lens/docs/pi-lens-reviewer.md +5 -5
- package/node_modules/pi-lens/docs/pi-lens-subagent.md +6 -3
- package/node_modules/pi-lens/docs/public-api-stability.md +18 -2
- package/node_modules/pi-lens/docs/schema/pi-lens-config-v1.json +10 -0
- package/node_modules/pi-lens/docs/settings.md +10 -6
- package/node_modules/pi-lens/docs/word-index.md +17 -5
- package/node_modules/pi-lens/package.json +5 -3
- package/node_modules/pi-lens/rules/ast-grep-rules/rule-tests/no-accumulating-spread-js-test.yml +37 -0
- package/node_modules/pi-lens/rules/ast-grep-rules/rule-tests/ts-redundant-filter-map-test.yml +12 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/rule-tests-disabled/filter-then-map-js-test.yml +12 -0
- package/node_modules/pi-lens/rules/ast-grep-rules/rule-tests-disabled/filter-then-map-test.yml +25 -0
- package/node_modules/pi-lens/rules/ast-grep-rules/rules/no-accumulating-spread-js.yml +49 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/rules/ts-redundant-filter-map.yml +9 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/rules-disabled/filter-then-map-js.yml +17 -0
- package/node_modules/pi-lens/rules/ast-grep-rules/rules-disabled/filter-then-map.yml +36 -0
- package/node_modules/pi-lens/rules/ast-grep-rules/self-scan-baseline.json +1 -1
- package/node_modules/pi-provider-qoder/README.md +22 -0
- package/node_modules/pi-provider-qoder/dist/index.js +370 -11
- package/node_modules/pi-provider-qoder/package.json +5 -2
- package/package.json +11 -11
- package/node_modules/@tifan/pi-inline-skills/README.md +0 -41
- package/node_modules/@tifan/pi-inline-skills/package.json +0 -44
- package/node_modules/@tifan/pi-inline-skills/src/index.ts +0 -646
- package/node_modules/@tifan/pi-preferred-thinking/README.md +0 -54
- package/node_modules/@tifan/pi-preferred-thinking/package.json +0 -43
- package/node_modules/@tifan/pi-preferred-thinking/src/index.ts +0 -236
- package/node_modules/pi-lens/dist/chunk-46TNM7XZ.js +0 -88
- package/node_modules/pi-lens/dist/chunk-72OKUXSD.js +0 -31
- package/node_modules/pi-lens/dist/chunk-7GLOLOSH.js +0 -57
- package/node_modules/pi-lens/dist/chunk-AKUUMGD5.js +0 -26
- package/node_modules/pi-lens/dist/chunk-ASUXV767.js +0 -22
- package/node_modules/pi-lens/dist/chunk-CTADOKYM.js +0 -25
- package/node_modules/pi-lens/dist/chunk-JJ2RRESP.js +0 -58
- package/node_modules/pi-lens/dist/chunk-LSC3VADM.js +0 -23
- package/node_modules/pi-lens/dist/chunk-SHLDT3OI.js +0 -27
- package/node_modules/pi-lens/dist/chunk-UF7RTZSO.js +0 -27
- package/node_modules/pi-lens/dist/chunk-W4WP2ERB.js +0 -30
- package/node_modules/pi-lens/dist/chunk-YES5CACN.js +0 -73
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@tifan/pi-inline-skills",
|
|
3
|
-
"version": "1.0.7",
|
|
4
|
-
"description": "Inline /skill autocomplete in the pi editor.",
|
|
5
|
-
"keywords": [
|
|
6
|
-
"autocomplete",
|
|
7
|
-
"pi",
|
|
8
|
-
"pi-extension",
|
|
9
|
-
"pi-package",
|
|
10
|
-
"skills"
|
|
11
|
-
],
|
|
12
|
-
"homepage": "https://github.com/tifandotme/pi-extensions/tree/master/packages/pi-inline-skills#readme",
|
|
13
|
-
"bugs": "https://github.com/tifandotme/pi-extensions/issues",
|
|
14
|
-
"license": "MIT",
|
|
15
|
-
"author": "Tifan Dwi Avianto <hi@tifan.me>",
|
|
16
|
-
"repository": {
|
|
17
|
-
"type": "git",
|
|
18
|
-
"url": "git+https://github.com/tifandotme/pi-extensions.git",
|
|
19
|
-
"directory": "packages/pi-inline-skills"
|
|
20
|
-
},
|
|
21
|
-
"files": [
|
|
22
|
-
"src/**/*.ts",
|
|
23
|
-
"!src/**/*.test.ts",
|
|
24
|
-
"README.md",
|
|
25
|
-
"LICENSE"
|
|
26
|
-
],
|
|
27
|
-
"type": "module",
|
|
28
|
-
"publishConfig": {
|
|
29
|
-
"access": "public",
|
|
30
|
-
"provenance": true
|
|
31
|
-
},
|
|
32
|
-
"scripts": {
|
|
33
|
-
"test": "node --experimental-strip-types --test src/index.test.ts"
|
|
34
|
-
},
|
|
35
|
-
"engines": {
|
|
36
|
-
"node": ">=20"
|
|
37
|
-
},
|
|
38
|
-
"pi": {
|
|
39
|
-
"extensions": [
|
|
40
|
-
"./src/index.ts"
|
|
41
|
-
],
|
|
42
|
-
"image": "https://raw.githubusercontent.com/tifandotme/pi-extensions/refs/heads/master/packages/pi-inline-skills/assets/skills-selector-triggered-inline.webp"
|
|
43
|
-
}
|
|
44
|
-
}
|
|
@@ -1,646 +0,0 @@
|
|
|
1
|
-
import { existsSync, readFileSync, realpathSync } from "node:fs"
|
|
2
|
-
import { dirname, resolve } from "node:path"
|
|
3
|
-
import {
|
|
4
|
-
CustomEditor,
|
|
5
|
-
type ExtensionAPI,
|
|
6
|
-
type ExtensionContext,
|
|
7
|
-
SkillInvocationMessageComponent,
|
|
8
|
-
type ParsedSkillBlock,
|
|
9
|
-
} from "@earendil-works/pi-coding-agent"
|
|
10
|
-
import { Box, Container, Text } from "@earendil-works/pi-tui"
|
|
11
|
-
|
|
12
|
-
type AutocompleteItem = {
|
|
13
|
-
value: string
|
|
14
|
-
label: string
|
|
15
|
-
description?: string
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
type AutocompleteSuggestions = {
|
|
19
|
-
items: AutocompleteItem[]
|
|
20
|
-
prefix: string
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
type AutocompleteProvider = {
|
|
24
|
-
getSuggestions(
|
|
25
|
-
lines: string[],
|
|
26
|
-
cursorLine: number,
|
|
27
|
-
cursorCol: number,
|
|
28
|
-
options: { signal: AbortSignal; force?: boolean },
|
|
29
|
-
): Promise<AutocompleteSuggestions | null>
|
|
30
|
-
applyCompletion(
|
|
31
|
-
lines: string[],
|
|
32
|
-
cursorLine: number,
|
|
33
|
-
cursorCol: number,
|
|
34
|
-
item: AutocompleteItem,
|
|
35
|
-
prefix: string,
|
|
36
|
-
): { lines: string[]; cursorLine: number; cursorCol: number }
|
|
37
|
-
shouldTriggerFileCompletion?(
|
|
38
|
-
lines: string[],
|
|
39
|
-
cursorLine: number,
|
|
40
|
-
cursorCol: number,
|
|
41
|
-
): boolean
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
type SkillCommand = {
|
|
45
|
-
name: string
|
|
46
|
-
description?: string
|
|
47
|
-
source: string
|
|
48
|
-
sourceInfo: {
|
|
49
|
-
path: string
|
|
50
|
-
source: string
|
|
51
|
-
scope: "user" | "project" | "temporary"
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
type SkillInfo = {
|
|
56
|
-
name: string
|
|
57
|
-
description?: string
|
|
58
|
-
sourceInfo?: SkillCommand["sourceInfo"]
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
type LoadedSkillEntryData = {
|
|
62
|
-
name?: string
|
|
63
|
-
source?: "tool-result"
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
type InlineSkillMessageDetails = {
|
|
67
|
-
names?: string[]
|
|
68
|
-
skills?: ParsedSkillBlock[]
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
type InlineSkillSessionEntry = {
|
|
72
|
-
type: string
|
|
73
|
-
customType?: string
|
|
74
|
-
data?: LoadedSkillEntryData
|
|
75
|
-
details?: InlineSkillMessageDetails
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
const LOADED_SKILL_ENTRY_TYPE = "loaded-skill"
|
|
79
|
-
const INLINE_SKILL_MESSAGE_TYPE = "inline-skill"
|
|
80
|
-
const MAX_SUGGESTIONS = 30
|
|
81
|
-
const SKILL_TOKEN_RE =
|
|
82
|
-
/(^|[\s([{,])\/([a-z0-9][a-z0-9-]{0,63})(?![a-z0-9-]|[:/])/gi
|
|
83
|
-
const SLASH_SKILL_CONTEXT_RE = /(?:^|[\s([{,])\/[a-z0-9-]*$/i
|
|
84
|
-
|
|
85
|
-
function fuzzyScore(value: string, query: string): number {
|
|
86
|
-
const target = value.toLowerCase()
|
|
87
|
-
const needle = query.toLowerCase()
|
|
88
|
-
if (!needle) return 1
|
|
89
|
-
if (target === needle) return 1000
|
|
90
|
-
if (target.startsWith(needle)) return 800 - target.length
|
|
91
|
-
if (target.includes(needle))
|
|
92
|
-
return 600 - target.indexOf(needle) - target.length
|
|
93
|
-
|
|
94
|
-
let score = 0
|
|
95
|
-
let lastIndex = -1
|
|
96
|
-
for (const char of needle) {
|
|
97
|
-
const index = target.indexOf(char, lastIndex + 1)
|
|
98
|
-
if (index === -1) return 0
|
|
99
|
-
score += index === lastIndex + 1 ? 20 : 5
|
|
100
|
-
lastIndex = index
|
|
101
|
-
}
|
|
102
|
-
return score - target.length
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
function filterSkills(skills: SkillInfo[], query: string): SkillInfo[] {
|
|
106
|
-
return skills
|
|
107
|
-
.map((skill) => ({ skill, score: fuzzyScore(skill.name, query) }))
|
|
108
|
-
.filter((entry) => entry.score > 0)
|
|
109
|
-
.toSorted(
|
|
110
|
-
(a, b) => b.score - a.score || a.skill.name.localeCompare(b.skill.name),
|
|
111
|
-
)
|
|
112
|
-
.map((entry) => entry.skill)
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
function getAutocompleteSourceTag(
|
|
116
|
-
sourceInfo: SkillCommand["sourceInfo"] | undefined,
|
|
117
|
-
): string | undefined {
|
|
118
|
-
if (!sourceInfo) return undefined
|
|
119
|
-
|
|
120
|
-
const scopePrefix =
|
|
121
|
-
sourceInfo.scope === "user"
|
|
122
|
-
? "u"
|
|
123
|
-
: sourceInfo.scope === "project"
|
|
124
|
-
? "p"
|
|
125
|
-
: "t"
|
|
126
|
-
const source = sourceInfo.source.trim()
|
|
127
|
-
if (source === "auto" || source === "local" || source === "cli") {
|
|
128
|
-
return scopePrefix
|
|
129
|
-
}
|
|
130
|
-
if (source.startsWith("npm:")) return `${scopePrefix}:${source}`
|
|
131
|
-
return scopePrefix
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
function prefixAutocompleteDescription(skill: SkillInfo): string | undefined {
|
|
135
|
-
const sourceTag = getAutocompleteSourceTag(skill.sourceInfo)
|
|
136
|
-
if (!sourceTag) return skill.description
|
|
137
|
-
return skill.description
|
|
138
|
-
? `[${sourceTag}] ${skill.description}`
|
|
139
|
-
: `[${sourceTag}]`
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
function getSkills(pi: ExtensionAPI): SkillInfo[] {
|
|
143
|
-
return (pi.getCommands() as SkillCommand[])
|
|
144
|
-
.filter(
|
|
145
|
-
(command) =>
|
|
146
|
-
command.source === "skill" && command.name.startsWith("skill:"),
|
|
147
|
-
)
|
|
148
|
-
.map((command) => {
|
|
149
|
-
const skill: SkillInfo = {
|
|
150
|
-
name: command.name.slice("skill:".length),
|
|
151
|
-
sourceInfo: command.sourceInfo,
|
|
152
|
-
}
|
|
153
|
-
if (command.description) skill.description = command.description
|
|
154
|
-
return skill
|
|
155
|
-
})
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
function hasStartingCommandConflict(pi: ExtensionAPI, text: string): boolean {
|
|
159
|
-
const match = text.match(/^\/([a-z0-9][a-z0-9-]{0,63})(?![a-z0-9-]|[:/])/i)
|
|
160
|
-
if (!match?.[1]) return false
|
|
161
|
-
|
|
162
|
-
const name = match[1].toLowerCase()
|
|
163
|
-
return (pi.getCommands() as SkillCommand[]).some(
|
|
164
|
-
(command) =>
|
|
165
|
-
command.source !== "skill" && command.name.toLowerCase() === name,
|
|
166
|
-
)
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
function normalizePath(path: string, cwd: string): string {
|
|
170
|
-
const absolutePath = path.startsWith("/") ? path : resolve(cwd, path)
|
|
171
|
-
try {
|
|
172
|
-
if (existsSync(absolutePath)) return realpathSync.native(absolutePath)
|
|
173
|
-
} catch {
|
|
174
|
-
// Fall back to the resolved path below.
|
|
175
|
-
}
|
|
176
|
-
return absolutePath
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
function getCurrentSkillPathMap(
|
|
180
|
-
pi: ExtensionAPI,
|
|
181
|
-
cwd: string,
|
|
182
|
-
): Map<string, string> {
|
|
183
|
-
const skills = new Map<string, string>()
|
|
184
|
-
|
|
185
|
-
for (const command of pi.getCommands() as SkillCommand[]) {
|
|
186
|
-
if (command.source !== "skill") continue
|
|
187
|
-
if (!command.name?.startsWith("skill:")) continue
|
|
188
|
-
if (!command.sourceInfo?.path) continue
|
|
189
|
-
|
|
190
|
-
skills.set(
|
|
191
|
-
normalizePath(command.sourceInfo.path, cwd),
|
|
192
|
-
command.name.slice("skill:".length),
|
|
193
|
-
)
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
return skills
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
function restoreLoadedSkills(ctx: ExtensionContext): Set<string> {
|
|
200
|
-
const loadedSkills = new Set<string>()
|
|
201
|
-
|
|
202
|
-
for (const entry of ctx.sessionManager.getBranch() as InlineSkillSessionEntry[]) {
|
|
203
|
-
if (
|
|
204
|
-
entry.type === "custom" &&
|
|
205
|
-
entry.customType === LOADED_SKILL_ENTRY_TYPE
|
|
206
|
-
) {
|
|
207
|
-
const data = entry.data
|
|
208
|
-
if (
|
|
209
|
-
data?.source === "tool-result" &&
|
|
210
|
-
typeof data.name === "string" &&
|
|
211
|
-
data.name.trim()
|
|
212
|
-
) {
|
|
213
|
-
loadedSkills.add(data.name)
|
|
214
|
-
}
|
|
215
|
-
continue
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
if (
|
|
219
|
-
entry.type === "custom_message" &&
|
|
220
|
-
entry.customType === INLINE_SKILL_MESSAGE_TYPE
|
|
221
|
-
) {
|
|
222
|
-
for (const skill of entry.details?.skills ?? []) {
|
|
223
|
-
if (skill.name.trim()) loadedSkills.add(skill.name)
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
return loadedSkills
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
function stripFrontmatter(content: string): string {
|
|
232
|
-
if (!content.startsWith("---")) return content
|
|
233
|
-
|
|
234
|
-
const end = content.indexOf("\n---", 3)
|
|
235
|
-
if (end === -1) return content
|
|
236
|
-
|
|
237
|
-
const afterEnd = content.indexOf("\n", end + 4)
|
|
238
|
-
return afterEnd === -1 ? "" : content.slice(afterEnd + 1)
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
function escapeXmlAttribute(value: string): string {
|
|
242
|
-
return value
|
|
243
|
-
.replace(/&/g, "&")
|
|
244
|
-
.replace(/"/g, """)
|
|
245
|
-
.replace(/</g, "<")
|
|
246
|
-
.replace(/>/g, ">")
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
function buildSkillBlock(
|
|
250
|
-
skill: SkillInfo,
|
|
251
|
-
cwd: string,
|
|
252
|
-
): { text: string; skillBlock: ParsedSkillBlock } {
|
|
253
|
-
const skillPath = skill.sourceInfo?.path
|
|
254
|
-
if (!skillPath) {
|
|
255
|
-
throw new Error(`missing path for skill ${skill.name}`)
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
const normalizedPath = normalizePath(skillPath, cwd)
|
|
259
|
-
const content = readFileSync(normalizedPath, "utf-8")
|
|
260
|
-
const body = stripFrontmatter(content).trim()
|
|
261
|
-
const skillContent = `References are relative to ${dirname(normalizedPath)}.\n\n${body}`
|
|
262
|
-
return {
|
|
263
|
-
text: `<skill name="${escapeXmlAttribute(skill.name)}" location="${escapeXmlAttribute(normalizedPath)}">\n${skillContent}\n</skill>`,
|
|
264
|
-
skillBlock: {
|
|
265
|
-
name: skill.name,
|
|
266
|
-
location: normalizedPath,
|
|
267
|
-
content: skillContent,
|
|
268
|
-
userMessage: undefined,
|
|
269
|
-
},
|
|
270
|
-
}
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
function buildInlineSkillContent(
|
|
274
|
-
skills: SkillInfo[],
|
|
275
|
-
cwd: string,
|
|
276
|
-
): { content: string; skillBlocks: ParsedSkillBlock[] } {
|
|
277
|
-
const skillBlocks = skills.map((skill) => buildSkillBlock(skill, cwd))
|
|
278
|
-
const blocks = skillBlocks.map((skill) => skill.text).join("\n\n")
|
|
279
|
-
return {
|
|
280
|
-
content: `<inline_skills>\nThe following inline skill contents are already loaded. Do not load them again unless the user asks to inspect the source file.\n\n${blocks}\n</inline_skills>`,
|
|
281
|
-
skillBlocks: skillBlocks.map((skill) => skill.skillBlock),
|
|
282
|
-
}
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
function findInlineSkills(
|
|
286
|
-
text: string,
|
|
287
|
-
skills: SkillInfo[],
|
|
288
|
-
): { selected: SkillInfo[] } | undefined {
|
|
289
|
-
const byName = new Map(
|
|
290
|
-
skills.map((skill) => [skill.name.toLowerCase(), skill]),
|
|
291
|
-
)
|
|
292
|
-
const selected: SkillInfo[] = []
|
|
293
|
-
const seen = new Set<string>()
|
|
294
|
-
|
|
295
|
-
text.replace(
|
|
296
|
-
SKILL_TOKEN_RE,
|
|
297
|
-
(match, _boundary: string, skillName: string) => {
|
|
298
|
-
const skill = byName.get(skillName.toLowerCase())
|
|
299
|
-
if (!skill) return match
|
|
300
|
-
if (!seen.has(skill.name)) {
|
|
301
|
-
seen.add(skill.name)
|
|
302
|
-
selected.push(skill)
|
|
303
|
-
}
|
|
304
|
-
return match
|
|
305
|
-
},
|
|
306
|
-
)
|
|
307
|
-
|
|
308
|
-
if (selected.length === 0) return undefined
|
|
309
|
-
|
|
310
|
-
return { selected }
|
|
311
|
-
}
|
|
312
|
-
|
|
313
|
-
function extractSlashSkillPrefix(textBeforeCursor: string): string | undefined {
|
|
314
|
-
const match = textBeforeCursor.match(/(?:^|[\s([{,])\/([a-z0-9-]*)$/i)
|
|
315
|
-
return match?.[1]
|
|
316
|
-
}
|
|
317
|
-
|
|
318
|
-
function isPromptStartSlashToken(
|
|
319
|
-
lines: string[],
|
|
320
|
-
cursorLine: number,
|
|
321
|
-
textBeforeCursor: string,
|
|
322
|
-
prefix: string,
|
|
323
|
-
): boolean {
|
|
324
|
-
const slashPrefixStart = textBeforeCursor.length - prefix.length - 1
|
|
325
|
-
if (slashPrefixStart < 0) return false
|
|
326
|
-
const earlierLinesAreBlank = lines
|
|
327
|
-
.slice(0, cursorLine)
|
|
328
|
-
.every((line) => line.trim().length === 0)
|
|
329
|
-
return (
|
|
330
|
-
earlierLinesAreBlank &&
|
|
331
|
-
textBeforeCursor.slice(0, slashPrefixStart).trim() === ""
|
|
332
|
-
)
|
|
333
|
-
}
|
|
334
|
-
|
|
335
|
-
function mergeAutocompleteItems(options: {
|
|
336
|
-
current: AutocompleteSuggestions | null
|
|
337
|
-
skillItems: AutocompleteItem[]
|
|
338
|
-
preferCommands: boolean
|
|
339
|
-
prefix: string
|
|
340
|
-
}): AutocompleteSuggestions {
|
|
341
|
-
const currentItems = options.current?.items ?? []
|
|
342
|
-
const orderedItems = options.preferCommands
|
|
343
|
-
? [...currentItems, ...options.skillItems]
|
|
344
|
-
: [...options.skillItems, ...currentItems]
|
|
345
|
-
const seen = new Set<string>()
|
|
346
|
-
const items = orderedItems.filter((item) => {
|
|
347
|
-
const key = `${item.label}\u0000${item.value}`
|
|
348
|
-
if (seen.has(key)) return false
|
|
349
|
-
seen.add(key)
|
|
350
|
-
return true
|
|
351
|
-
})
|
|
352
|
-
|
|
353
|
-
return {
|
|
354
|
-
prefix: options.current?.prefix ?? `/${options.prefix}`,
|
|
355
|
-
items: items.slice(0, MAX_SUGGESTIONS),
|
|
356
|
-
}
|
|
357
|
-
}
|
|
358
|
-
|
|
359
|
-
function installSlashAutocompleteTrigger(): void {
|
|
360
|
-
const proto = CustomEditor.prototype as unknown as {
|
|
361
|
-
handleInput(data: string): void
|
|
362
|
-
inlineSkillsSlashTriggerInstalled?: boolean
|
|
363
|
-
}
|
|
364
|
-
if (proto.inlineSkillsSlashTriggerInstalled) return
|
|
365
|
-
|
|
366
|
-
const originalHandleInput = proto.handleInput
|
|
367
|
-
proto.handleInput = function patchedHandleInput(
|
|
368
|
-
this: unknown,
|
|
369
|
-
data: string,
|
|
370
|
-
): void {
|
|
371
|
-
const editor = this as {
|
|
372
|
-
isShowingAutocomplete?: () => boolean
|
|
373
|
-
state?: { cursorLine: number; cursorCol: number; lines: string[] }
|
|
374
|
-
tryTriggerAutocomplete?: () => void
|
|
375
|
-
}
|
|
376
|
-
|
|
377
|
-
originalHandleInput.call(this, data)
|
|
378
|
-
if (
|
|
379
|
-
editor.isShowingAutocomplete?.() ||
|
|
380
|
-
!editor.state ||
|
|
381
|
-
typeof editor.tryTriggerAutocomplete !== "function"
|
|
382
|
-
)
|
|
383
|
-
return
|
|
384
|
-
if (!/^[a-zA-Z0-9\-_/]$/.test(data)) return
|
|
385
|
-
|
|
386
|
-
const currentLine = editor.state.lines[editor.state.cursorLine] ?? ""
|
|
387
|
-
const textBeforeCursor = currentLine.slice(0, editor.state.cursorCol)
|
|
388
|
-
if (SLASH_SKILL_CONTEXT_RE.test(textBeforeCursor)) {
|
|
389
|
-
editor.tryTriggerAutocomplete()
|
|
390
|
-
}
|
|
391
|
-
}
|
|
392
|
-
proto.inlineSkillsSlashTriggerInstalled = true
|
|
393
|
-
}
|
|
394
|
-
|
|
395
|
-
function createSlashSkillAutocompleteProvider(
|
|
396
|
-
pi: ExtensionAPI,
|
|
397
|
-
current: AutocompleteProvider,
|
|
398
|
-
): AutocompleteProvider {
|
|
399
|
-
return {
|
|
400
|
-
async getSuggestions(
|
|
401
|
-
lines,
|
|
402
|
-
cursorLine,
|
|
403
|
-
cursorCol,
|
|
404
|
-
options,
|
|
405
|
-
): Promise<AutocompleteSuggestions | null> {
|
|
406
|
-
const currentLine = lines[cursorLine] ?? ""
|
|
407
|
-
const textBeforeCursor = currentLine.slice(0, cursorCol)
|
|
408
|
-
const query = extractSlashSkillPrefix(textBeforeCursor)
|
|
409
|
-
if (query === undefined || (query === "" && textBeforeCursor === "/")) {
|
|
410
|
-
return current.getSuggestions(lines, cursorLine, cursorCol, options)
|
|
411
|
-
}
|
|
412
|
-
|
|
413
|
-
const currentSuggestions = await current.getSuggestions(
|
|
414
|
-
lines,
|
|
415
|
-
cursorLine,
|
|
416
|
-
cursorCol,
|
|
417
|
-
options,
|
|
418
|
-
)
|
|
419
|
-
const skills = getSkills(pi)
|
|
420
|
-
if (options.signal.aborted || skills.length === 0) {
|
|
421
|
-
return currentSuggestions
|
|
422
|
-
}
|
|
423
|
-
|
|
424
|
-
const matches = query
|
|
425
|
-
? filterSkills(skills, query).slice(0, MAX_SUGGESTIONS)
|
|
426
|
-
: skills.slice(0, MAX_SUGGESTIONS)
|
|
427
|
-
|
|
428
|
-
if (matches.length === 0) return currentSuggestions
|
|
429
|
-
|
|
430
|
-
const skillItems = matches.map((skill): AutocompleteItem => {
|
|
431
|
-
const item: AutocompleteItem = {
|
|
432
|
-
value: `/${skill.name}`,
|
|
433
|
-
label: `skill:${skill.name}`,
|
|
434
|
-
}
|
|
435
|
-
const description = prefixAutocompleteDescription(skill)
|
|
436
|
-
if (description) item.description = description
|
|
437
|
-
return item
|
|
438
|
-
})
|
|
439
|
-
|
|
440
|
-
return mergeAutocompleteItems({
|
|
441
|
-
current: currentSuggestions,
|
|
442
|
-
skillItems,
|
|
443
|
-
preferCommands: isPromptStartSlashToken(
|
|
444
|
-
lines,
|
|
445
|
-
cursorLine,
|
|
446
|
-
textBeforeCursor,
|
|
447
|
-
query,
|
|
448
|
-
),
|
|
449
|
-
prefix: query,
|
|
450
|
-
})
|
|
451
|
-
},
|
|
452
|
-
|
|
453
|
-
applyCompletion(lines, cursorLine, cursorCol, item, prefix) {
|
|
454
|
-
const currentLine = lines[cursorLine] ?? ""
|
|
455
|
-
const prefixStart = cursorCol - prefix.length
|
|
456
|
-
const slashPrefixStart = prefix.startsWith("/")
|
|
457
|
-
? prefixStart
|
|
458
|
-
: prefixStart - 1
|
|
459
|
-
const isSlashSkillCompletion =
|
|
460
|
-
item.label.startsWith("skill:") &&
|
|
461
|
-
item.value.startsWith("/") &&
|
|
462
|
-
slashPrefixStart >= 0 &&
|
|
463
|
-
currentLine[slashPrefixStart] === "/"
|
|
464
|
-
|
|
465
|
-
if (!isSlashSkillCompletion) {
|
|
466
|
-
return current.applyCompletion(
|
|
467
|
-
lines,
|
|
468
|
-
cursorLine,
|
|
469
|
-
cursorCol,
|
|
470
|
-
item,
|
|
471
|
-
prefix,
|
|
472
|
-
)
|
|
473
|
-
}
|
|
474
|
-
|
|
475
|
-
const beforePrefix = currentLine.slice(0, slashPrefixStart)
|
|
476
|
-
const afterCursor = currentLine.slice(cursorCol)
|
|
477
|
-
const suffix = afterCursor.startsWith(" ") ? "" : " "
|
|
478
|
-
const nextLines = [...lines]
|
|
479
|
-
nextLines[cursorLine] =
|
|
480
|
-
`${beforePrefix}${item.value}${suffix}${afterCursor}`
|
|
481
|
-
return {
|
|
482
|
-
lines: nextLines,
|
|
483
|
-
cursorLine,
|
|
484
|
-
cursorCol: beforePrefix.length + item.value.length + suffix.length,
|
|
485
|
-
}
|
|
486
|
-
},
|
|
487
|
-
|
|
488
|
-
shouldTriggerFileCompletion(lines, cursorLine, cursorCol) {
|
|
489
|
-
return (
|
|
490
|
-
current.shouldTriggerFileCompletion?.(lines, cursorLine, cursorCol) ??
|
|
491
|
-
true
|
|
492
|
-
)
|
|
493
|
-
},
|
|
494
|
-
}
|
|
495
|
-
}
|
|
496
|
-
|
|
497
|
-
export default function (pi: ExtensionAPI): void {
|
|
498
|
-
let pendingInlineSkillContent: string | undefined
|
|
499
|
-
let pendingInlineSkillNames: string[] = []
|
|
500
|
-
let pendingInlineSkillBlocks: ParsedSkillBlock[] = []
|
|
501
|
-
let loadedSkills = new Set<string>()
|
|
502
|
-
|
|
503
|
-
installSlashAutocompleteTrigger()
|
|
504
|
-
|
|
505
|
-
pi.registerMessageRenderer(
|
|
506
|
-
INLINE_SKILL_MESSAGE_TYPE,
|
|
507
|
-
(message, { expanded }, theme) => {
|
|
508
|
-
const details = message.details as InlineSkillMessageDetails | undefined
|
|
509
|
-
const names = details?.names?.length ? details.names.join(", ") : "skill"
|
|
510
|
-
const label = theme.fg(
|
|
511
|
-
"customMessageLabel",
|
|
512
|
-
`\x1b[1m[${INLINE_SKILL_MESSAGE_TYPE}]\x1b[22m`,
|
|
513
|
-
)
|
|
514
|
-
|
|
515
|
-
if (details?.skills?.length) {
|
|
516
|
-
const container = new Container()
|
|
517
|
-
for (const skill of details.skills) {
|
|
518
|
-
const component = new SkillInvocationMessageComponent(skill)
|
|
519
|
-
component.setExpanded(expanded)
|
|
520
|
-
container.addChild(component)
|
|
521
|
-
}
|
|
522
|
-
return container
|
|
523
|
-
}
|
|
524
|
-
|
|
525
|
-
const box = new Box(1, 1, (text) => theme.bg("customMessageBg", text))
|
|
526
|
-
box.addChild(
|
|
527
|
-
new Text(
|
|
528
|
-
`${label} ${theme.fg("customMessageText", names)}${theme.fg("dim", " (ctrl+o to expand)")}`,
|
|
529
|
-
0,
|
|
530
|
-
0,
|
|
531
|
-
),
|
|
532
|
-
)
|
|
533
|
-
return box
|
|
534
|
-
},
|
|
535
|
-
)
|
|
536
|
-
|
|
537
|
-
pi.registerCommand("loaded-skills", {
|
|
538
|
-
description: "List skills loaded in this session",
|
|
539
|
-
handler: async (_args, ctx) => {
|
|
540
|
-
const names = [...restoreLoadedSkills(ctx)].toSorted((a, b) =>
|
|
541
|
-
a.localeCompare(b),
|
|
542
|
-
)
|
|
543
|
-
|
|
544
|
-
if (names.length === 0) {
|
|
545
|
-
ctx.ui.notify("No skills loaded yet", "info")
|
|
546
|
-
return
|
|
547
|
-
}
|
|
548
|
-
ctx.ui.notify(`Loaded skills: ${names.join(", ")}`, "info")
|
|
549
|
-
},
|
|
550
|
-
})
|
|
551
|
-
|
|
552
|
-
pi.on("session_start", async (_event, ctx) => {
|
|
553
|
-
loadedSkills = restoreLoadedSkills(ctx)
|
|
554
|
-
ctx.ui.addAutocompleteProvider((current) =>
|
|
555
|
-
createSlashSkillAutocompleteProvider(pi, current),
|
|
556
|
-
)
|
|
557
|
-
})
|
|
558
|
-
|
|
559
|
-
pi.on("session_tree", async (_event, ctx) => {
|
|
560
|
-
loadedSkills = restoreLoadedSkills(ctx)
|
|
561
|
-
})
|
|
562
|
-
|
|
563
|
-
pi.on("tool_result", async (event, ctx) => {
|
|
564
|
-
if (event.toolName !== "read" || event.isError) return
|
|
565
|
-
|
|
566
|
-
const input = event.input as { path?: unknown }
|
|
567
|
-
if (typeof input.path !== "string") return
|
|
568
|
-
|
|
569
|
-
const readPath = normalizePath(input.path, ctx.cwd)
|
|
570
|
-
const skillName = getCurrentSkillPathMap(pi, ctx.cwd).get(readPath)
|
|
571
|
-
if (!skillName || loadedSkills.has(skillName)) return
|
|
572
|
-
|
|
573
|
-
loadedSkills.add(skillName)
|
|
574
|
-
pi.appendEntry(LOADED_SKILL_ENTRY_TYPE, {
|
|
575
|
-
name: skillName,
|
|
576
|
-
source: "tool-result",
|
|
577
|
-
})
|
|
578
|
-
})
|
|
579
|
-
|
|
580
|
-
pi.on("input", async (event, ctx) => {
|
|
581
|
-
pendingInlineSkillContent = undefined
|
|
582
|
-
pendingInlineSkillNames = []
|
|
583
|
-
pendingInlineSkillBlocks = []
|
|
584
|
-
loadedSkills = restoreLoadedSkills(ctx)
|
|
585
|
-
if (event.source === "extension" || !event.text.includes("/")) {
|
|
586
|
-
return { action: "continue" }
|
|
587
|
-
}
|
|
588
|
-
if (hasStartingCommandConflict(pi, event.text)) {
|
|
589
|
-
return { action: "continue" }
|
|
590
|
-
}
|
|
591
|
-
|
|
592
|
-
const expanded = findInlineSkills(event.text, getSkills(pi))
|
|
593
|
-
if (!expanded) return { action: "continue" }
|
|
594
|
-
|
|
595
|
-
const skillsToInject = expanded.selected.filter(
|
|
596
|
-
(skill) => !loadedSkills.has(skill.name),
|
|
597
|
-
)
|
|
598
|
-
|
|
599
|
-
if (skillsToInject.length > 0) {
|
|
600
|
-
try {
|
|
601
|
-
const inlineSkillContent = buildInlineSkillContent(
|
|
602
|
-
skillsToInject,
|
|
603
|
-
ctx.cwd,
|
|
604
|
-
)
|
|
605
|
-
pendingInlineSkillContent = inlineSkillContent.content
|
|
606
|
-
pendingInlineSkillBlocks = inlineSkillContent.skillBlocks
|
|
607
|
-
pendingInlineSkillNames = skillsToInject.map((skill) => skill.name)
|
|
608
|
-
for (const skill of skillsToInject) {
|
|
609
|
-
loadedSkills.add(skill.name)
|
|
610
|
-
}
|
|
611
|
-
} catch (error) {
|
|
612
|
-
pendingInlineSkillContent = undefined
|
|
613
|
-
pendingInlineSkillNames = []
|
|
614
|
-
pendingInlineSkillBlocks = []
|
|
615
|
-
ctx.ui.notify(
|
|
616
|
-
`inline-skills: failed to load skill: ${error instanceof Error ? error.message : String(error)}`,
|
|
617
|
-
"error",
|
|
618
|
-
)
|
|
619
|
-
}
|
|
620
|
-
}
|
|
621
|
-
|
|
622
|
-
return {
|
|
623
|
-
action: "transform",
|
|
624
|
-
text: event.text,
|
|
625
|
-
...(event.images ? { images: event.images } : {}),
|
|
626
|
-
}
|
|
627
|
-
})
|
|
628
|
-
|
|
629
|
-
pi.on("before_agent_start", async () => {
|
|
630
|
-
if (!pendingInlineSkillContent) return
|
|
631
|
-
const content = pendingInlineSkillContent
|
|
632
|
-
const names = pendingInlineSkillNames
|
|
633
|
-
const skills = pendingInlineSkillBlocks
|
|
634
|
-
pendingInlineSkillContent = undefined
|
|
635
|
-
pendingInlineSkillNames = []
|
|
636
|
-
pendingInlineSkillBlocks = []
|
|
637
|
-
return {
|
|
638
|
-
message: {
|
|
639
|
-
customType: INLINE_SKILL_MESSAGE_TYPE,
|
|
640
|
-
content,
|
|
641
|
-
display: true,
|
|
642
|
-
details: { names, skills },
|
|
643
|
-
},
|
|
644
|
-
}
|
|
645
|
-
})
|
|
646
|
-
}
|