@herbertgao/pi-extensions 2026.10.19 → 2026.11.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 +759 -0
- package/README.md +21 -6
- package/THIRD_PARTY_NOTICES.md +53 -2
- package/extensions/clef.mjs +1 -1
- package/node_modules/@herbertgao/pi-agency/CHANGELOG.md +19 -0
- package/node_modules/@herbertgao/pi-agency/package.json +4 -2
- package/node_modules/@herbertgao/pi-agency/src/index.ts +1 -1
- package/node_modules/@herbertgao/pi-bark/CHANGELOG.md +52 -0
- package/node_modules/@herbertgao/pi-bark/package.json +2 -1
- package/node_modules/@herbertgao/pi-cc-extensions/CHANGELOG.md +207 -0
- package/node_modules/@herbertgao/pi-cc-extensions/README.en.md +7 -5
- package/node_modules/@herbertgao/pi-cc-extensions/README.md +10 -7
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/config/config.ts +20 -0
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/config/panel.ts +61 -6
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/agent-summary/core.ts +11 -16
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/agent-summary/index.ts +60 -11
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/compact-thinking.ts +29 -11
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/shell/footer-layout.ts +54 -6
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/shell/footer.ts +23 -5
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/shell/session-tokens.ts +52 -0
- package/node_modules/@herbertgao/pi-cc-extensions/package.json +5 -4
- package/node_modules/@herbertgao/pi-impeccable/CHANGELOG.md +13 -0
- package/node_modules/@herbertgao/pi-impeccable/package.json +2 -1
- 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/@herbertgao/sol-pi/CHANGELOG.md +84 -0
- package/node_modules/@herbertgao/sol-pi/README.md +3 -3
- package/node_modules/@herbertgao/sol-pi/THIRD_PARTY_NOTICES.md +4 -4
- package/node_modules/@herbertgao/sol-pi/agents-install.md +3 -3
- package/node_modules/@herbertgao/sol-pi/docs/compatibility.md +1 -1
- package/node_modules/@herbertgao/sol-pi/package.json +2 -1
- 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 +375 -12
- package/node_modules/pi-provider-qoder/package.json +5 -2
- package/package.json +17 -13
- 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
|
@@ -0,0 +1,397 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* task-store.ts — File-backed task store with CRUD, dependency management, and file locking.
|
|
3
|
+
*
|
|
4
|
+
* Session-scoped (default): in-memory Map — no disk I/O.
|
|
5
|
+
* Shared (PI_TASK_LIST_ID set): ~/.pi/tasks/<listId>.json with file locking.
|
|
6
|
+
*/
|
|
7
|
+
import { randomUUID } from "node:crypto";
|
|
8
|
+
import { existsSync, mkdirSync, readFileSync, renameSync, unlinkSync, writeFileSync } from "node:fs";
|
|
9
|
+
import { homedir } from "node:os";
|
|
10
|
+
import { dirname, isAbsolute, join } from "node:path";
|
|
11
|
+
import { sortTasks } from "./task-sort.js";
|
|
12
|
+
const TASKS_DIR = join(homedir(), ".pi", "tasks");
|
|
13
|
+
const LOCK_RETRY_MS = 50;
|
|
14
|
+
const LOCK_MAX_RETRIES = 100; // 5s max
|
|
15
|
+
/**
|
|
16
|
+
* Simple file-based locking. Returns the token written into the lock file, which
|
|
17
|
+
* must be handed back to `releaseLock`.
|
|
18
|
+
*
|
|
19
|
+
* The token is `<pid>:<uuid>`: the PID prefix is what the staleness check below
|
|
20
|
+
* parses, and the UUID suffix makes it unique so a holder can tell its own lock
|
|
21
|
+
* from a successor's. Both halves matter — see `releaseLock`.
|
|
22
|
+
*/
|
|
23
|
+
function acquireLock(lockPath) {
|
|
24
|
+
mkdirSync(dirname(lockPath), { recursive: true });
|
|
25
|
+
const token = `${process.pid}:${randomUUID()}`;
|
|
26
|
+
for (let i = 0; i < LOCK_MAX_RETRIES; i++) {
|
|
27
|
+
try {
|
|
28
|
+
// O_EXCL: fail if file exists
|
|
29
|
+
writeFileSync(lockPath, token, { flag: "wx" });
|
|
30
|
+
return token;
|
|
31
|
+
}
|
|
32
|
+
catch (e) {
|
|
33
|
+
if (e.code === "EEXIST") {
|
|
34
|
+
// Check for stale lock (process no longer running)
|
|
35
|
+
try {
|
|
36
|
+
const pid = parseInt(readFileSync(lockPath, "utf-8"), 10);
|
|
37
|
+
// A lock naming a dead process is stale. So is one with no readable PID,
|
|
38
|
+
// but only after a couple of polls: the file is created before the PID is
|
|
39
|
+
// written to it, so a live acquirer can look unparseable for a moment —
|
|
40
|
+
// one that crashed in that window looks that way forever.
|
|
41
|
+
if (pid > 0 ? !isProcessRunning(pid) : i >= 2) {
|
|
42
|
+
unlinkSync(lockPath);
|
|
43
|
+
continue;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
catch { /* ignore read errors */ }
|
|
47
|
+
// Wait and retry
|
|
48
|
+
const start = Date.now();
|
|
49
|
+
while (Date.now() - start < LOCK_RETRY_MS) { /* busy wait */ }
|
|
50
|
+
continue;
|
|
51
|
+
}
|
|
52
|
+
throw e;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
throw new Error(`Failed to acquire lock: ${lockPath}`);
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Release a lock, but only if we still hold it. A lock can be reclaimed out from
|
|
59
|
+
* under a live holder — `isProcessRunning` answers from the local process table,
|
|
60
|
+
* so a session in another PID namespace (container, or a list shared over NFS)
|
|
61
|
+
* can read our PID as dead. Without the token check we would then delete the
|
|
62
|
+
* successor's lock and two sessions would write the file at once.
|
|
63
|
+
*/
|
|
64
|
+
function releaseLock(lockPath, token) {
|
|
65
|
+
try {
|
|
66
|
+
if (readFileSync(lockPath, "utf-8") === token)
|
|
67
|
+
unlinkSync(lockPath);
|
|
68
|
+
}
|
|
69
|
+
catch { /* ignore — already gone */ }
|
|
70
|
+
}
|
|
71
|
+
function isProcessRunning(pid) {
|
|
72
|
+
try {
|
|
73
|
+
process.kill(pid, 0);
|
|
74
|
+
return true;
|
|
75
|
+
}
|
|
76
|
+
catch {
|
|
77
|
+
return false;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Fill defaults for tasks persisted by older versions. Task files written
|
|
82
|
+
* before the blocking feature have no `blockedBy`/`blocks`/`metadata`, so
|
|
83
|
+
* consumers that read those fields unguarded (e.g. `task.blockedBy.length`)
|
|
84
|
+
* would throw. Normalizing at the load boundary lets every consumer trust the
|
|
85
|
+
* shape. Also guards against wrong types in hand-edited files.
|
|
86
|
+
*/
|
|
87
|
+
function normalizeTask(t) {
|
|
88
|
+
const now = Date.now();
|
|
89
|
+
return {
|
|
90
|
+
...t,
|
|
91
|
+
metadata: t.metadata && typeof t.metadata === "object" && !Array.isArray(t.metadata) ? t.metadata : {},
|
|
92
|
+
blocks: Array.isArray(t.blocks) ? t.blocks : [],
|
|
93
|
+
blockedBy: Array.isArray(t.blockedBy) ? t.blockedBy : [],
|
|
94
|
+
createdAt: typeof t.createdAt === "number" ? t.createdAt : now,
|
|
95
|
+
updatedAt: typeof t.updatedAt === "number" ? t.updatedAt : now,
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
export class TaskStore {
|
|
99
|
+
filePath;
|
|
100
|
+
lockPath;
|
|
101
|
+
// In-memory state (always kept in sync)
|
|
102
|
+
nextId = 1;
|
|
103
|
+
tasks = new Map();
|
|
104
|
+
constructor(listIdOrPath) {
|
|
105
|
+
if (!listIdOrPath)
|
|
106
|
+
return;
|
|
107
|
+
const isAbsPath = isAbsolute(listIdOrPath);
|
|
108
|
+
const filePath = isAbsPath ? listIdOrPath : join(TASKS_DIR, `${listIdOrPath}.json`);
|
|
109
|
+
// Directory is created lazily on the first write (acquireLock/save both
|
|
110
|
+
// mkdir it), so a session that never persists a task leaves no .pi/tasks/.
|
|
111
|
+
this.filePath = filePath;
|
|
112
|
+
this.lockPath = filePath + ".lock";
|
|
113
|
+
this.load();
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Read store from disk (file-backed mode only).
|
|
117
|
+
*
|
|
118
|
+
* `normalizeTask` hardens each record; this hardens the envelope around them.
|
|
119
|
+
* A truncated write, a bad merge or a hand edit can leave a file that parses
|
|
120
|
+
* but has no `tasks` array or no usable `nextId`, and both used to corrupt the
|
|
121
|
+
* store: the missing array threw mid-load and left it wiped, and the missing
|
|
122
|
+
* counter produced the task ID "NaN", then IDs restarting at "0" and colliding
|
|
123
|
+
* with live tasks. Anything unusable now leaves the current state alone.
|
|
124
|
+
*/
|
|
125
|
+
load() {
|
|
126
|
+
if (!this.filePath)
|
|
127
|
+
return;
|
|
128
|
+
if (!existsSync(this.filePath))
|
|
129
|
+
return;
|
|
130
|
+
try {
|
|
131
|
+
const data = JSON.parse(readFileSync(this.filePath, "utf-8"));
|
|
132
|
+
if (!data || typeof data !== "object")
|
|
133
|
+
return;
|
|
134
|
+
const { nextId, tasks } = data;
|
|
135
|
+
if (!Array.isArray(tasks))
|
|
136
|
+
return;
|
|
137
|
+
// Build the replacement before touching the live state, so a bad record
|
|
138
|
+
// can't leave the store half-loaded.
|
|
139
|
+
const loaded = new Map();
|
|
140
|
+
let maxId = 0;
|
|
141
|
+
for (const t of tasks) {
|
|
142
|
+
if (!t || typeof t !== "object" || typeof t.id !== "string")
|
|
143
|
+
continue;
|
|
144
|
+
loaded.set(t.id, normalizeTask(t));
|
|
145
|
+
const numericId = Number(t.id);
|
|
146
|
+
if (Number.isFinite(numericId) && numericId > maxId)
|
|
147
|
+
maxId = numericId;
|
|
148
|
+
}
|
|
149
|
+
this.tasks = loaded;
|
|
150
|
+
// Every future task ID comes from this counter, so it has to clear the IDs
|
|
151
|
+
// already in use — whether the file omitted it or recorded a stale one.
|
|
152
|
+
this.nextId = typeof nextId === "number" && Number.isInteger(nextId) && nextId > maxId ? nextId : maxId + 1;
|
|
153
|
+
}
|
|
154
|
+
catch { /* unreadable or not JSON — keep the state we have */ }
|
|
155
|
+
}
|
|
156
|
+
/** Write store to disk atomically (file-backed mode only). */
|
|
157
|
+
save() {
|
|
158
|
+
if (!this.filePath)
|
|
159
|
+
return;
|
|
160
|
+
const data = {
|
|
161
|
+
nextId: this.nextId,
|
|
162
|
+
tasks: Array.from(this.tasks.values()),
|
|
163
|
+
};
|
|
164
|
+
mkdirSync(dirname(this.filePath), { recursive: true });
|
|
165
|
+
const tmpPath = this.filePath + ".tmp";
|
|
166
|
+
writeFileSync(tmpPath, JSON.stringify(data, null, 2));
|
|
167
|
+
renameSync(tmpPath, this.filePath);
|
|
168
|
+
}
|
|
169
|
+
/** Execute a mutation with file locking (if file-backed). */
|
|
170
|
+
withLock(fn) {
|
|
171
|
+
if (!this.lockPath)
|
|
172
|
+
return fn();
|
|
173
|
+
const token = acquireLock(this.lockPath);
|
|
174
|
+
try {
|
|
175
|
+
this.load(); // Re-read latest state
|
|
176
|
+
const result = fn();
|
|
177
|
+
this.save();
|
|
178
|
+
return result;
|
|
179
|
+
}
|
|
180
|
+
finally {
|
|
181
|
+
releaseLock(this.lockPath, token);
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
create(subject, description, activeForm, metadata) {
|
|
185
|
+
return this.withLock(() => {
|
|
186
|
+
const now = Date.now();
|
|
187
|
+
const task = {
|
|
188
|
+
id: String(this.nextId++),
|
|
189
|
+
subject,
|
|
190
|
+
description,
|
|
191
|
+
status: "pending",
|
|
192
|
+
activeForm,
|
|
193
|
+
owner: undefined,
|
|
194
|
+
metadata: metadata ?? {},
|
|
195
|
+
blocks: [],
|
|
196
|
+
blockedBy: [],
|
|
197
|
+
createdAt: now,
|
|
198
|
+
updatedAt: now,
|
|
199
|
+
};
|
|
200
|
+
this.tasks.set(task.id, task);
|
|
201
|
+
return task;
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
get(id) {
|
|
205
|
+
if (this.filePath)
|
|
206
|
+
this.load();
|
|
207
|
+
return this.tasks.get(id);
|
|
208
|
+
}
|
|
209
|
+
/** List all tasks, sorted by the given order (defaults to ID ascending). */
|
|
210
|
+
list(sortOrder = "id") {
|
|
211
|
+
if (this.filePath)
|
|
212
|
+
this.load();
|
|
213
|
+
return sortTasks(Array.from(this.tasks.values()), sortOrder);
|
|
214
|
+
}
|
|
215
|
+
update(id, fields) {
|
|
216
|
+
return this.withLock(() => {
|
|
217
|
+
const task = this.tasks.get(id);
|
|
218
|
+
if (!task)
|
|
219
|
+
return { task: undefined, changedFields: [], warnings: [] };
|
|
220
|
+
const changedFields = [];
|
|
221
|
+
const warnings = [];
|
|
222
|
+
// Handle deletion
|
|
223
|
+
if (fields.status === "deleted") {
|
|
224
|
+
this.tasks.delete(id);
|
|
225
|
+
// Clean up dependency edges pointing to this task
|
|
226
|
+
for (const t of this.tasks.values()) {
|
|
227
|
+
t.blocks = t.blocks.filter(bid => bid !== id);
|
|
228
|
+
t.blockedBy = t.blockedBy.filter(bid => bid !== id);
|
|
229
|
+
}
|
|
230
|
+
return { task: undefined, changedFields: ["deleted"], warnings: [] };
|
|
231
|
+
}
|
|
232
|
+
const prevStatus = task.status;
|
|
233
|
+
if (fields.status !== undefined) {
|
|
234
|
+
task.status = fields.status;
|
|
235
|
+
changedFields.push("status");
|
|
236
|
+
}
|
|
237
|
+
if (fields.subject !== undefined) {
|
|
238
|
+
task.subject = fields.subject;
|
|
239
|
+
changedFields.push("subject");
|
|
240
|
+
}
|
|
241
|
+
if (fields.description !== undefined) {
|
|
242
|
+
task.description = fields.description;
|
|
243
|
+
changedFields.push("description");
|
|
244
|
+
}
|
|
245
|
+
if (fields.activeForm !== undefined) {
|
|
246
|
+
task.activeForm = fields.activeForm;
|
|
247
|
+
changedFields.push("activeForm");
|
|
248
|
+
}
|
|
249
|
+
if (fields.owner !== undefined) {
|
|
250
|
+
task.owner = fields.owner;
|
|
251
|
+
changedFields.push("owner");
|
|
252
|
+
}
|
|
253
|
+
// Metadata: shallow merge, null deletes keys
|
|
254
|
+
if (fields.metadata !== undefined) {
|
|
255
|
+
for (const [key, value] of Object.entries(fields.metadata)) {
|
|
256
|
+
if (value === null) {
|
|
257
|
+
delete task.metadata[key];
|
|
258
|
+
}
|
|
259
|
+
else {
|
|
260
|
+
task.metadata[key] = value;
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
changedFields.push("metadata");
|
|
264
|
+
}
|
|
265
|
+
// Bidirectional dependency edges
|
|
266
|
+
if (fields.addBlocks && fields.addBlocks.length > 0) {
|
|
267
|
+
for (const targetId of fields.addBlocks) {
|
|
268
|
+
if (!task.blocks.includes(targetId)) {
|
|
269
|
+
task.blocks.push(targetId);
|
|
270
|
+
}
|
|
271
|
+
const target = this.tasks.get(targetId);
|
|
272
|
+
if (target && !target.blockedBy.includes(id)) {
|
|
273
|
+
target.blockedBy.push(id);
|
|
274
|
+
target.updatedAt = Date.now();
|
|
275
|
+
}
|
|
276
|
+
// Warnings for problematic edges
|
|
277
|
+
if (targetId === id) {
|
|
278
|
+
warnings.push(`#${id} blocks itself`);
|
|
279
|
+
}
|
|
280
|
+
else if (!target) {
|
|
281
|
+
warnings.push(`#${targetId} does not exist`);
|
|
282
|
+
}
|
|
283
|
+
else if (target.blocks.includes(id)) {
|
|
284
|
+
warnings.push(`cycle: #${id} and #${targetId} block each other`);
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
changedFields.push("blocks");
|
|
288
|
+
}
|
|
289
|
+
if (fields.addBlockedBy && fields.addBlockedBy.length > 0) {
|
|
290
|
+
for (const targetId of fields.addBlockedBy) {
|
|
291
|
+
if (!task.blockedBy.includes(targetId)) {
|
|
292
|
+
task.blockedBy.push(targetId);
|
|
293
|
+
}
|
|
294
|
+
const target = this.tasks.get(targetId);
|
|
295
|
+
if (target && !target.blocks.includes(id)) {
|
|
296
|
+
target.blocks.push(id);
|
|
297
|
+
target.updatedAt = Date.now();
|
|
298
|
+
}
|
|
299
|
+
// Warnings for problematic edges
|
|
300
|
+
if (targetId === id) {
|
|
301
|
+
warnings.push(`#${id} blocks itself`);
|
|
302
|
+
}
|
|
303
|
+
else if (!target) {
|
|
304
|
+
warnings.push(`#${targetId} does not exist`);
|
|
305
|
+
}
|
|
306
|
+
else if (task.blocks.includes(targetId)) {
|
|
307
|
+
warnings.push(`cycle: #${id} and #${targetId} block each other`);
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
changedFields.push("blockedBy");
|
|
311
|
+
}
|
|
312
|
+
// Warn when manually moving a task into an active/done state while it still has
|
|
313
|
+
// open blockers — TaskExecute refuses this, but TaskUpdate is a manual override, so
|
|
314
|
+
// it is stored with a warning rather than blocked. Checked after edge edits so a
|
|
315
|
+
// combined status + addBlockedBy call sees the final blocker set.
|
|
316
|
+
if ((fields.status === "in_progress" || fields.status === "completed") && fields.status !== prevStatus) {
|
|
317
|
+
const open = task.blockedBy.filter(bid => this.tasks.get(bid)?.status !== "completed");
|
|
318
|
+
if (open.length > 0) {
|
|
319
|
+
warnings.push(`#${id} set to ${fields.status} with open blockers: ${open.map(b => "#" + b).join(", ")}`);
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
task.updatedAt = Date.now();
|
|
323
|
+
return { task, changedFields, warnings };
|
|
324
|
+
});
|
|
325
|
+
}
|
|
326
|
+
/** Delete a task by ID. Returns true if deleted. */
|
|
327
|
+
delete(id) {
|
|
328
|
+
return this.withLock(() => {
|
|
329
|
+
if (!this.tasks.has(id))
|
|
330
|
+
return false;
|
|
331
|
+
this.tasks.delete(id);
|
|
332
|
+
// Clean up dependency edges
|
|
333
|
+
for (const t of this.tasks.values()) {
|
|
334
|
+
t.blocks = t.blocks.filter(bid => bid !== id);
|
|
335
|
+
t.blockedBy = t.blockedBy.filter(bid => bid !== id);
|
|
336
|
+
}
|
|
337
|
+
return true;
|
|
338
|
+
});
|
|
339
|
+
}
|
|
340
|
+
/** Remove all tasks. */
|
|
341
|
+
clearAll() {
|
|
342
|
+
return this.withLock(() => {
|
|
343
|
+
const count = this.tasks.size;
|
|
344
|
+
this.tasks.clear();
|
|
345
|
+
return count;
|
|
346
|
+
});
|
|
347
|
+
}
|
|
348
|
+
/** Capture full store state — used to carry tasks into a forked session. */
|
|
349
|
+
snapshot() {
|
|
350
|
+
if (this.filePath)
|
|
351
|
+
this.load();
|
|
352
|
+
return { nextId: this.nextId, tasks: Array.from(this.tasks.values()) };
|
|
353
|
+
}
|
|
354
|
+
/** Seed an empty store from a snapshot. No-op if the store already has tasks,
|
|
355
|
+
* so re-pointing to an already-seeded fork file never duplicates. */
|
|
356
|
+
seed(data) {
|
|
357
|
+
if (this.tasks.size > 0)
|
|
358
|
+
return;
|
|
359
|
+
this.withLock(() => {
|
|
360
|
+
this.nextId = data.nextId;
|
|
361
|
+
this.tasks.clear();
|
|
362
|
+
for (const t of data.tasks)
|
|
363
|
+
this.tasks.set(t.id, t);
|
|
364
|
+
});
|
|
365
|
+
}
|
|
366
|
+
/** Delete the backing file (if file-backed and empty). */
|
|
367
|
+
deleteFileIfEmpty() {
|
|
368
|
+
if (!this.filePath || this.tasks.size > 0)
|
|
369
|
+
return false;
|
|
370
|
+
try {
|
|
371
|
+
unlinkSync(this.filePath);
|
|
372
|
+
}
|
|
373
|
+
catch { /* ignore */ }
|
|
374
|
+
return true;
|
|
375
|
+
}
|
|
376
|
+
/** Remove all completed tasks. */
|
|
377
|
+
clearCompleted() {
|
|
378
|
+
return this.withLock(() => {
|
|
379
|
+
let count = 0;
|
|
380
|
+
for (const [id, task] of this.tasks) {
|
|
381
|
+
if (task.status === "completed") {
|
|
382
|
+
this.tasks.delete(id);
|
|
383
|
+
count++;
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
// Clean up dependency edges for deleted tasks
|
|
387
|
+
if (count > 0) {
|
|
388
|
+
const validIds = new Set(this.tasks.keys());
|
|
389
|
+
for (const t of this.tasks.values()) {
|
|
390
|
+
t.blocks = t.blocks.filter(bid => validIds.has(bid));
|
|
391
|
+
t.blockedBy = t.blockedBy.filter(bid => validIds.has(bid));
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
return count;
|
|
395
|
+
});
|
|
396
|
+
}
|
|
397
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { TaskGlyphsConfig } from "./task-glyphs.js";
|
|
2
|
+
import type { TaskSortOrder } from "./task-sort.js";
|
|
3
|
+
export interface TasksConfig {
|
|
4
|
+
taskScope?: "memory" | "session" | "session-global" | "project";
|
|
5
|
+
autoCascade?: boolean;
|
|
6
|
+
autoClearCompleted?: "never" | "on_list_complete" | "on_task_complete";
|
|
7
|
+
collapseCompleted?: boolean;
|
|
8
|
+
showAll?: boolean;
|
|
9
|
+
maxVisible?: number;
|
|
10
|
+
sortOrder?: TaskSortOrder;
|
|
11
|
+
hiddenAt?: "top" | "bottom";
|
|
12
|
+
glyphs?: TaskGlyphsConfig;
|
|
13
|
+
}
|
|
14
|
+
export declare function loadGlobalTasksConfig(agentDir?: string): TasksConfig;
|
|
15
|
+
export declare function loadTasksConfig(cwd: string, agentDir?: string): TasksConfig;
|
|
16
|
+
export declare function saveTasksConfig(config: TasksConfig, cwd: string, agentDir?: string): void;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
// <agent-dir>/tasks-config.json provides global defaults.
|
|
2
|
+
// <cwd>/.pi/tasks-config.json provides project overrides.
|
|
3
|
+
//
|
|
4
|
+
// Configuration is data, never code: there is deliberately no executable config
|
|
5
|
+
// file, because `.pi/` lives inside cloned repositories. Custom sort orders are
|
|
6
|
+
// expressed as JSON sort specs — see task-sort.ts; the glyphs tasks are drawn with
|
|
7
|
+
// are plain JSON strings — see task-glyphs.ts.
|
|
8
|
+
import { mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
9
|
+
import { dirname, join } from "node:path";
|
|
10
|
+
import { getAgentDir } from "@earendil-works/pi-coding-agent";
|
|
11
|
+
const differs = (a, b) => JSON.stringify(a) !== JSON.stringify(b);
|
|
12
|
+
function readTasksConfig(configPath) {
|
|
13
|
+
try {
|
|
14
|
+
const parsed = JSON.parse(readFileSync(configPath, "utf-8"));
|
|
15
|
+
return parsed !== null && typeof parsed === "object" && !Array.isArray(parsed) ? parsed : {};
|
|
16
|
+
}
|
|
17
|
+
catch {
|
|
18
|
+
return {};
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
export function loadGlobalTasksConfig(agentDir = getAgentDir()) {
|
|
22
|
+
return readTasksConfig(join(agentDir, "tasks-config.json"));
|
|
23
|
+
}
|
|
24
|
+
export function loadTasksConfig(cwd, agentDir = getAgentDir()) {
|
|
25
|
+
const globalConfig = loadGlobalTasksConfig(agentDir);
|
|
26
|
+
const projectConfig = readTasksConfig(join(cwd, ".pi", "tasks-config.json"));
|
|
27
|
+
const merged = { ...globalConfig, ...projectConfig };
|
|
28
|
+
// `glyphs` is a group of independent settings, not one value, so it merges a level
|
|
29
|
+
// deeper than the rest: a project file overriding one glyph keeps the global ones.
|
|
30
|
+
// Guarded, so a config with no glyphs at all does not grow an empty object that
|
|
31
|
+
// saveTasksConfig would then write out as a project override.
|
|
32
|
+
if (globalConfig.glyphs || projectConfig.glyphs) {
|
|
33
|
+
merged.glyphs = { ...globalConfig.glyphs, ...projectConfig.glyphs };
|
|
34
|
+
}
|
|
35
|
+
return merged;
|
|
36
|
+
}
|
|
37
|
+
export function saveTasksConfig(config, cwd, agentDir = getAgentDir()) {
|
|
38
|
+
const configPath = join(cwd, ".pi", "tasks-config.json");
|
|
39
|
+
const globalConfig = loadGlobalTasksConfig(agentDir);
|
|
40
|
+
// Compared as JSON so that object-valued settings (a custom sortOrder spec) are
|
|
41
|
+
// matched by value; for the primitives this config holds it is equivalent to !==.
|
|
42
|
+
const projectOverrides = Object.fromEntries(Object.entries(config).filter(([key, value]) => key !== "glyphs" && differs(globalConfig[key], value)));
|
|
43
|
+
// Glyphs are diffed one by one to match how they are merged. Comparing the group
|
|
44
|
+
// as one value would write every inherited glyph into the project file as soon as
|
|
45
|
+
// a single one differed.
|
|
46
|
+
const glyphOverrides = Object.entries(config.glyphs ?? {}).filter(([name, glyph]) => differs(globalConfig.glyphs?.[name], glyph));
|
|
47
|
+
if (glyphOverrides.length > 0)
|
|
48
|
+
projectOverrides.glyphs = Object.fromEntries(glyphOverrides);
|
|
49
|
+
mkdirSync(dirname(configPath), { recursive: true });
|
|
50
|
+
writeFileSync(configPath, JSON.stringify(projectOverrides, null, 2));
|
|
51
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* types.ts — Type definitions for the task management system.
|
|
3
|
+
*/
|
|
4
|
+
export type TaskStatus = "pending" | "in_progress" | "completed";
|
|
5
|
+
export interface Task {
|
|
6
|
+
id: string;
|
|
7
|
+
subject: string;
|
|
8
|
+
description: string;
|
|
9
|
+
status: TaskStatus;
|
|
10
|
+
activeForm?: string;
|
|
11
|
+
owner?: string;
|
|
12
|
+
metadata: Record<string, any>;
|
|
13
|
+
blocks: string[];
|
|
14
|
+
blockedBy: string[];
|
|
15
|
+
createdAt: number;
|
|
16
|
+
updatedAt: number;
|
|
17
|
+
}
|
|
18
|
+
/** Serialized store format on disk. */
|
|
19
|
+
export interface TaskStoreData {
|
|
20
|
+
nextId: number;
|
|
21
|
+
tasks: Task[];
|
|
22
|
+
}
|
|
23
|
+
/** Background process associated with a task. */
|
|
24
|
+
export interface BackgroundProcess {
|
|
25
|
+
taskId: string;
|
|
26
|
+
pid: number;
|
|
27
|
+
command?: string;
|
|
28
|
+
output: string[];
|
|
29
|
+
status: "running" | "completed" | "error" | "stopped";
|
|
30
|
+
exitCode?: number;
|
|
31
|
+
startedAt: number;
|
|
32
|
+
completedAt?: number;
|
|
33
|
+
proc: import("node:child_process").ChildProcess;
|
|
34
|
+
abortController: AbortController;
|
|
35
|
+
waiters: Array<() => void>;
|
|
36
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* settings-menu.ts — Polished settings panel for /tasks → Settings.
|
|
3
|
+
*
|
|
4
|
+
* Uses ui.custom() + SettingsList for native TUI rendering with keyboard
|
|
5
|
+
* navigation, live toggle, and per-row descriptions — matching pi-coding-agent's
|
|
6
|
+
* own settings panel style.
|
|
7
|
+
*/
|
|
8
|
+
import { type TasksConfig } from "../tasks-config.js";
|
|
9
|
+
export type SettingsUI = {
|
|
10
|
+
custom<T>(factory: (tui: any, theme: any, keybindings: any, done: (result: T) => void) => any, options?: {
|
|
11
|
+
overlay?: boolean;
|
|
12
|
+
overlayOptions?: any;
|
|
13
|
+
}): Promise<T>;
|
|
14
|
+
};
|
|
15
|
+
export declare function openSettingsMenu(ui: SettingsUI, cfg: TasksConfig, onBack: () => Promise<void>, clearDelayTurns: number, cwd: string): Promise<void>;
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* settings-menu.ts — Polished settings panel for /tasks → Settings.
|
|
3
|
+
*
|
|
4
|
+
* Uses ui.custom() + SettingsList for native TUI rendering with keyboard
|
|
5
|
+
* navigation, live toggle, and per-row descriptions — matching pi-coding-agent's
|
|
6
|
+
* own settings panel style.
|
|
7
|
+
*/
|
|
8
|
+
import { getSettingsListTheme } from "@earendil-works/pi-coding-agent";
|
|
9
|
+
import { Container, SettingsList, Spacer, Text } from "@earendil-works/pi-tui";
|
|
10
|
+
import { BUILT_IN_SORT_ORDERS } from "../task-sort.js";
|
|
11
|
+
import { saveTasksConfig } from "../tasks-config.js";
|
|
12
|
+
// ── Settings panel ──────────────────────────────────────────────────────────
|
|
13
|
+
export async function openSettingsMenu(ui, cfg, onBack, clearDelayTurns, cwd) {
|
|
14
|
+
await ui.custom((_tui, theme, _kb, done) => {
|
|
15
|
+
// A sort spec can't be reconstructed by cycling a menu value, so it is shown
|
|
16
|
+
// read-only; picking a preset is the deliberate way to drop it.
|
|
17
|
+
const customSort = Array.isArray(cfg.sortOrder);
|
|
18
|
+
const items = [
|
|
19
|
+
{
|
|
20
|
+
id: "taskScope",
|
|
21
|
+
label: "Task storage",
|
|
22
|
+
description: "memory: tasks live only in memory, lost when session ends. " +
|
|
23
|
+
"session: persisted per session in the workspace (.pi/tasks/tasks-<sessionId>.json), survives resume. " +
|
|
24
|
+
"session-global: same, but kept outside the workspace under pi's agent directory. " +
|
|
25
|
+
"project: shared across all sessions (tasks.json). " +
|
|
26
|
+
"Takes effect on next session start.",
|
|
27
|
+
currentValue: cfg.taskScope ?? "session",
|
|
28
|
+
values: ["memory", "session", "session-global", "project"],
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
id: "autoCascade",
|
|
32
|
+
label: "Auto-cascade agent tasks",
|
|
33
|
+
description: "When ON: pending agent tasks start automatically once their dependencies complete. " +
|
|
34
|
+
"When OFF: use TaskExecute to launch them manually.",
|
|
35
|
+
currentValue: (cfg.autoCascade ?? false) ? "on" : "off",
|
|
36
|
+
values: ["on", "off"],
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
id: "collapseCompleted",
|
|
40
|
+
label: "Collapse completed tasks",
|
|
41
|
+
description: "When ON, completed tasks are replaced by a single 'N completed' line and the " +
|
|
42
|
+
"visible limit applies only to the tasks left. When OFF, they are listed individually.",
|
|
43
|
+
currentValue: (cfg.collapseCompleted ?? false) ? "on" : "off",
|
|
44
|
+
values: ["on", "off"],
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
id: "showAll",
|
|
48
|
+
label: "Show all tasks in widget",
|
|
49
|
+
description: "When ON, every listed task is shown regardless of the visible limit. " +
|
|
50
|
+
"When OFF, the list is capped by 'Max visible tasks'.",
|
|
51
|
+
currentValue: (cfg.showAll ?? false) ? "on" : "off",
|
|
52
|
+
values: ["on", "off"],
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
id: "maxVisible",
|
|
56
|
+
label: "Max visible tasks in widget",
|
|
57
|
+
description: "Only applies when 'Show all tasks' is OFF. " +
|
|
58
|
+
"Caps how many task lines the widget shows.",
|
|
59
|
+
currentValue: String(cfg.maxVisible ?? 10),
|
|
60
|
+
values: ["5", "10", "15", "20", "30", "50", "100"],
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
id: "sortOrder",
|
|
64
|
+
label: "Widget sort order",
|
|
65
|
+
description: '"active" groups by in-progress → pending → completed; "status" is the reverse. ' +
|
|
66
|
+
'"id" sorts by creation order. A custom sort spec in tasks-config.json shows as ' +
|
|
67
|
+
'"custom" and can only be changed there.',
|
|
68
|
+
currentValue: customSort ? "custom" : (cfg.sortOrder ?? "id"),
|
|
69
|
+
// "custom" is shown but deliberately left out of the cycle: cycling away from
|
|
70
|
+
// a spec replaces it, and there is no value to cycle back to.
|
|
71
|
+
values: [...BUILT_IN_SORT_ORDERS],
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
id: "hiddenAt",
|
|
75
|
+
label: "Hidden tasks position",
|
|
76
|
+
description: '"bottom" hides tasks from the end of the list. ' +
|
|
77
|
+
'"top" hides tasks from the start (useful with status sort to collapse completed tasks).',
|
|
78
|
+
currentValue: cfg.hiddenAt ?? "bottom",
|
|
79
|
+
values: ["bottom", "top"],
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
id: "autoClearCompleted",
|
|
83
|
+
label: "Auto-clear completed tasks",
|
|
84
|
+
description: "never: completed tasks stay visible until manually cleared. " +
|
|
85
|
+
"on_list_complete: cleared automatically after all tasks are done. " +
|
|
86
|
+
"on_task_complete: each task cleared shortly after it completes. " +
|
|
87
|
+
`Clearing lags ~${clearDelayTurns} turns, or happens right away when a later batch of work starts.`,
|
|
88
|
+
currentValue: cfg.autoClearCompleted ?? "on_list_complete",
|
|
89
|
+
values: ["never", "on_list_complete", "on_task_complete"],
|
|
90
|
+
},
|
|
91
|
+
];
|
|
92
|
+
const list = new SettingsList(items,
|
|
93
|
+
/* maxVisible */ 10, getSettingsListTheme(),
|
|
94
|
+
/* onChange */ (id, newValue) => {
|
|
95
|
+
if (id === "autoCascade") {
|
|
96
|
+
cfg.autoCascade = newValue === "on";
|
|
97
|
+
saveTasksConfig(cfg, cwd);
|
|
98
|
+
}
|
|
99
|
+
if (id === "taskScope") {
|
|
100
|
+
cfg.taskScope = newValue;
|
|
101
|
+
saveTasksConfig(cfg, cwd);
|
|
102
|
+
}
|
|
103
|
+
if (id === "autoClearCompleted") {
|
|
104
|
+
cfg.autoClearCompleted = newValue;
|
|
105
|
+
saveTasksConfig(cfg, cwd);
|
|
106
|
+
}
|
|
107
|
+
if (id === "collapseCompleted") {
|
|
108
|
+
cfg.collapseCompleted = newValue === "on";
|
|
109
|
+
saveTasksConfig(cfg, cwd);
|
|
110
|
+
}
|
|
111
|
+
if (id === "showAll") {
|
|
112
|
+
cfg.showAll = newValue === "on";
|
|
113
|
+
saveTasksConfig(cfg, cwd);
|
|
114
|
+
}
|
|
115
|
+
if (id === "maxVisible") {
|
|
116
|
+
cfg.maxVisible = Number(newValue);
|
|
117
|
+
saveTasksConfig(cfg, cwd);
|
|
118
|
+
}
|
|
119
|
+
if (id === "sortOrder") {
|
|
120
|
+
cfg.sortOrder = newValue;
|
|
121
|
+
saveTasksConfig(cfg, cwd);
|
|
122
|
+
}
|
|
123
|
+
if (id === "hiddenAt") {
|
|
124
|
+
cfg.hiddenAt = newValue;
|
|
125
|
+
saveTasksConfig(cfg, cwd);
|
|
126
|
+
}
|
|
127
|
+
},
|
|
128
|
+
/* onCancel */ () => done(undefined));
|
|
129
|
+
// Container doesn't forward handleInput to children — subclass to fix.
|
|
130
|
+
class SettingsPanel extends Container {
|
|
131
|
+
handleInput(data) { list.handleInput(data); }
|
|
132
|
+
}
|
|
133
|
+
const root = new SettingsPanel();
|
|
134
|
+
root.addChild(new Text(theme.bold(theme.fg("accent", "⚙ Task Settings")), 0, 0));
|
|
135
|
+
root.addChild(new Spacer(1));
|
|
136
|
+
root.addChild(list);
|
|
137
|
+
return root;
|
|
138
|
+
});
|
|
139
|
+
return onBack();
|
|
140
|
+
}
|