@humain/humain-code 0.8.2 → 0.8.4
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 +152 -0
- package/dist/bundle/agent-monitor.js +1 -1
- package/dist/bundle/chunks/anthropic-messages-42CGJCSR.js +82 -0
- package/dist/bundle/chunks/ask-VH7GNX75.js +97 -0
- package/dist/bundle/chunks/azure-openai-responses-DOKKMBUN.js +15 -0
- package/dist/bundle/chunks/bedrock-converse-stream.js +200 -179
- package/dist/bundle/chunks/bowser-UX7KDMIY.js +92 -0
- package/dist/bundle/chunks/{chunk-46C6D7UC.js → chunk-2CYGUEQO.js} +1 -1
- package/dist/bundle/chunks/chunk-3RXT35Y3.js +3 -0
- package/dist/bundle/chunks/chunk-4BNDLR6C.js +177 -0
- package/dist/bundle/chunks/{chunk-MPRAQ6ZI.js → chunk-4LGBXPUD.js} +1 -1
- package/dist/bundle/chunks/chunk-4SL6URR3.js +90 -0
- package/dist/bundle/chunks/{chunk-PJXBU6CR.js → chunk-52642TYH.js} +394 -204
- package/dist/bundle/chunks/{chunk-LSRXA7OS.js → chunk-5C5K4EVJ.js} +3 -3
- package/dist/bundle/chunks/{chunk-2JNJJ6SZ.js → chunk-5KUCY54O.js} +3 -3
- package/dist/bundle/chunks/{chunk-4TDNOR36.js → chunk-625QJSFJ.js} +1 -1
- package/dist/bundle/chunks/chunk-73YX5XGR.js +2461 -0
- package/dist/bundle/chunks/chunk-7DIRHF4H.js +17 -0
- package/dist/bundle/chunks/{chunk-QJB5YI3I.js → chunk-7PAXKU7M.js} +1 -1
- package/dist/bundle/chunks/{chunk-R2KD2HFT.js → chunk-7YB3HRRN.js} +83 -196
- package/dist/bundle/chunks/{chunk-DCXHRP6C.js → chunk-A2UZYK23.js} +13 -13
- package/dist/bundle/chunks/chunk-A5ZMBTTM.js +12 -0
- package/dist/bundle/chunks/{chunk-JKX5EGOT.js → chunk-AER66CNP.js} +13 -13
- package/dist/bundle/chunks/chunk-ARTF7ZMQ.js +5 -0
- package/dist/bundle/chunks/chunk-B3FT6L6S.js +131 -0
- package/dist/bundle/chunks/chunk-BIC5BSNX.js +13 -0
- package/dist/bundle/chunks/{chunk-JSHKS7VH.js → chunk-BNZZJ4LO.js} +1 -1
- package/dist/bundle/chunks/{chunk-4MKATHT2.js → chunk-CG43CMFH.js} +1 -1
- package/dist/bundle/chunks/{chunk-EFY2QPVP.js → chunk-CIAXW64K.js} +16 -16
- package/dist/bundle/chunks/{chunk-VFLVWPLZ.js → chunk-CKFLQGJN.js} +20 -16
- package/dist/bundle/chunks/chunk-D4UCXXDP.js +115 -0
- package/dist/bundle/chunks/{chunk-HQMUDHC3.js → chunk-D6ZWWDW5.js} +6 -5
- package/dist/bundle/chunks/{chunk-U4EAJPMO.js → chunk-EVDQRT3I.js} +252 -371
- package/dist/bundle/chunks/{chunk-FJIISX5W.js → chunk-F74XLJPC.js} +195 -192
- package/dist/bundle/chunks/chunk-FDRBTGFJ.js +4 -0
- package/dist/bundle/chunks/{chunk-E4VUW4RI.js → chunk-FLWO3H5J.js} +12 -12
- package/dist/bundle/chunks/{chunk-KLSRGGOH.js → chunk-G2PFPQX7.js} +2 -2
- package/dist/bundle/chunks/chunk-GMPJWLZS.js +57 -0
- package/dist/bundle/chunks/{chunk-M5TVWJ5T.js → chunk-H35P7ROY.js} +462 -441
- package/dist/bundle/chunks/chunk-HCHCYBNK.js +2 -0
- package/dist/bundle/chunks/{chunk-7WE77IE3.js → chunk-HRNYDRL7.js} +1 -1
- package/dist/bundle/chunks/chunk-HWFAAGYK.js +23 -0
- package/dist/bundle/chunks/{chunk-G2QMON4O.js → chunk-HWXQCJDP.js} +408 -392
- package/dist/bundle/chunks/{chunk-PVNXN2TC.js → chunk-II5C7G67.js} +1 -1
- package/dist/bundle/chunks/{chunk-F2H47FRF.js → chunk-IMRZP5SC.js} +182 -137
- package/dist/bundle/chunks/{chunk-H2B3WLIM.js → chunk-J5YFXMTM.js} +4 -4
- package/dist/bundle/chunks/chunk-J64VNQ6D.js +13 -0
- package/dist/bundle/chunks/{chunk-65FLSKDA.js → chunk-K5EFEIFP.js} +5 -4
- package/dist/bundle/chunks/{chunk-KI7CHPWC.js → chunk-KJ3QRSSY.js} +46 -43
- package/dist/bundle/chunks/{cli-6DJO467D.js → chunk-KSEO2LRK.js} +12 -10
- package/dist/bundle/chunks/{chunk-HHWVVNGG.js → chunk-MA2WCMSN.js} +2 -2
- package/dist/bundle/chunks/{chunk-L4J7SMJB.js → chunk-MAEKQSFU.js} +1 -1
- package/dist/bundle/chunks/chunk-MHQNLTZR.js +8 -0
- package/dist/bundle/chunks/chunk-MLOUZAVZ.js +122 -0
- package/dist/bundle/chunks/chunk-MQYR4Q6X.js +5 -0
- package/dist/bundle/chunks/chunk-MXF3KYLZ.js +4 -0
- package/dist/bundle/chunks/{chunk-GY663MNP.js → chunk-MZRTVX7F.js} +1 -1
- package/dist/bundle/chunks/chunk-MZYHSWHX.js +59 -0
- package/dist/bundle/chunks/{chunk-6HTHDVJC.js → chunk-NPVRWPGX.js} +1 -1
- package/dist/bundle/chunks/{chunk-BRSLXHED.js → chunk-O44A4E4K.js} +1 -1
- package/dist/bundle/chunks/{chunk-T2ZGMEMV.js → chunk-OADQOW67.js} +175 -260
- package/dist/bundle/chunks/chunk-OTVHRZ67.js +17 -0
- package/dist/bundle/chunks/{chunk-J4GII2EE.js → chunk-P7SLTLSZ.js} +51 -46
- package/dist/bundle/chunks/{chunk-7OZNMWAJ.js → chunk-PPGSQZZF.js} +1 -1
- package/dist/bundle/chunks/chunk-PYX6ZCC7.js +29 -0
- package/dist/bundle/chunks/chunk-PZ7NYBHJ.js +8 -0
- package/dist/bundle/chunks/{chunk-VCMXBP5S.js → chunk-QESIDBMW.js} +1 -7
- package/dist/bundle/chunks/chunk-QUWVILLB.js +3 -0
- package/dist/bundle/chunks/chunk-QZWUXGY7.js +99 -0
- package/dist/bundle/chunks/{chunk-MIAXMK5F.js → chunk-QZXLTW7V.js} +8 -7
- package/dist/bundle/chunks/chunk-RP6MWUAP.js +4 -0
- package/dist/bundle/chunks/chunk-S2US54IU.js +37 -0
- package/dist/bundle/chunks/{chunk-H7UPU2SH.js → chunk-SOE25WIS.js} +1218 -1239
- package/dist/bundle/chunks/{chunk-JSZBTGI6.js → chunk-SZZ5PNP6.js} +2 -2
- package/dist/bundle/chunks/chunk-T5WECB2D.js +7 -0
- package/dist/bundle/chunks/{chunk-2NVGOSBN.js → chunk-T7F2TEIS.js} +37 -13
- package/dist/bundle/chunks/{chunk-ZSWU5KKA.js → chunk-UOSJTMCL.js} +7 -3
- package/dist/bundle/chunks/{chunk-6P6MMQUH.js → chunk-UTRUALFN.js} +3 -3
- package/dist/bundle/chunks/{chunk-PWFM6AQQ.js → chunk-V2HTCZRF.js} +70 -67
- package/dist/bundle/chunks/{chunk-JX6YIPNK.js → chunk-WCKS2DPT.js} +1 -1
- package/dist/bundle/chunks/chunk-XGOJCV6Z.js +2 -0
- package/dist/bundle/chunks/chunk-XGSJX23G.js +1151 -0
- package/dist/bundle/chunks/{chunk-7WETECIB.js → chunk-Z7BWHPJ2.js} +1 -1
- package/dist/bundle/chunks/chunk-ZFFDBTG3.js +17 -0
- package/dist/bundle/chunks/cli-NJLV3XDZ.js +3 -0
- package/dist/bundle/chunks/{cloudflare-workers-ai-system-one-JEZVYITT.js → cloudflare-workers-ai-system-one-ZAZW4M4B.js} +1 -1
- package/dist/bundle/chunks/{compat-ELBUCH6U.js → compat-7UJJAO4E.js} +12 -12
- package/dist/bundle/chunks/{curator-server-QB4GITGS.js → curator-server-MW645JI3.js} +2 -2
- package/dist/bundle/chunks/{dist-NERIS6SW.js → dist-7PCCEUQF.js} +2 -2
- package/dist/bundle/chunks/{dist-QSYDYE3Y.js → dist-I53JI67E.js} +9 -9
- package/dist/bundle/chunks/{dist-35STTNYA.js → dist-NI2PTSLH.js} +1 -1
- package/dist/bundle/chunks/{dist-CBODG4CA.js → dist-VXQT3DQY.js} +6 -6
- package/dist/bundle/chunks/{dist-cjs-EROMDUKS.js → dist-cjs-4JQA6W3S.js} +31 -31
- package/dist/bundle/chunks/doctor-KJVAYG3F.js +83 -0
- package/dist/bundle/chunks/{easter-egg-3d-VZC5WOYV.js → easter-egg-3d-Z24JLXD4.js} +1 -1
- package/dist/bundle/chunks/entry-3EL6GOWK.js +2 -0
- package/dist/bundle/chunks/{entry-SRYLSS5P.js → entry-4IMREZBD.js} +80 -79
- package/dist/bundle/chunks/{execute-6MEJJF2T.js → execute-C4BZQRPQ.js} +23 -22
- package/dist/bundle/chunks/{extract-L373D6O7.js → extract-XVQCIS7D.js} +5 -5
- package/dist/bundle/chunks/{flow-implementer-3P3BHQ7E.js → flow-implementer-GE2ARQKR.js} +5 -5
- package/dist/bundle/chunks/github-copilot.js +57 -56
- package/dist/bundle/chunks/google-generative-ai-P2P45MYP.js +22 -0
- package/dist/bundle/chunks/google-vertex-SHY4IS5F.js +26 -0
- package/dist/bundle/chunks/{host-WOLZCWQQ.js → host-YESS2VAB.js} +1 -1
- package/dist/bundle/chunks/{index.bundle-HONF3PUD.js → index.bundle-TZT64KLH.js} +102 -89
- package/dist/bundle/chunks/{inprocess-3PDJKE5F.js → inprocess-MGMVI6HN.js} +6 -6
- package/dist/bundle/chunks/interactive-mode-HHWOE4FD.js +5 -0
- package/dist/bundle/chunks/{llama-cpp-classify-KYZT532X.js → llama-cpp-classify-RSRH4KV2.js} +5 -5
- package/dist/bundle/chunks/mistral-conversations-YTMJKHHI.js +42 -0
- package/dist/bundle/chunks/{node-N7TPBUJB.js → node-FF6QQQLH.js} +1 -1
- package/dist/bundle/chunks/openai-codex-responses-NUCJOJSZ.js +97 -0
- package/dist/bundle/chunks/openai-completions-E5NRJUHA.js +91 -0
- package/dist/bundle/chunks/{openai-decisions-JMSDGR7K.js → openai-decisions-342J5ZYG.js} +1 -1
- package/dist/bundle/chunks/openai-responses-BN5Z4HFI.js +26 -0
- package/dist/bundle/chunks/openrouter-images-7RNG3JVF.js +12 -0
- package/dist/bundle/chunks/{pdfjs-FE3L72A6.js → pdfjs-LSTLRXQW.js} +1415 -1416
- package/dist/bundle/chunks/pi-messages-2L7FV5OK.js +22 -0
- package/dist/bundle/chunks/questionnaire-session-XEVAK7JS.js +123 -0
- package/dist/bundle/chunks/runtime-2FSZRUG5.js +2 -0
- package/dist/bundle/chunks/session-picker-666KJIVM.js +4 -0
- package/dist/bundle/chunks/startup-ui-INEVSNGK.js +3 -0
- package/dist/bundle/chunks/{trace-command-VM7FBWPE.js → trace-command-BCVMZ5ZD.js} +4 -4
- package/dist/bundle/chunks/typesafe-system-one-UJUNSZG4.js +3 -0
- package/dist/bundle/chunks/{undici-WVNE45GY.js → undici-7IGAYA4S.js} +1 -1
- package/dist/bundle/chunks/virtual-modules-UXSSFNV5.js +29 -0
- package/dist/bundle/cli-runtime.js +5 -5
- package/dist/bundle/flow/package.json +3 -3
- package/dist/bundle/index.js +13 -13
- package/dist/bundle/orchestrate/package.json +1 -1
- package/dist/bundle/rpc-entry.js +5 -4
- package/dist/cli/agent-dir-arg.d.ts +12 -0
- package/dist/cli/agent-dir-arg.d.ts.map +1 -0
- package/dist/cli/agent-dir-arg.js +15 -0
- package/dist/cli/agent-dir-arg.js.map +1 -0
- package/dist/cli/args.d.ts +9 -0
- package/dist/cli/args.d.ts.map +1 -1
- package/dist/cli/args.js +19 -5
- package/dist/cli/args.js.map +1 -1
- package/dist/cli/auth-check.d.ts +1 -1
- package/dist/cli/auth-check.d.ts.map +1 -1
- package/dist/cli/auth-check.js +4 -2
- package/dist/cli/auth-check.js.map +1 -1
- package/dist/cli/doctor-config.d.ts +14 -0
- package/dist/cli/doctor-config.d.ts.map +1 -0
- package/dist/cli/doctor-config.js +92 -0
- package/dist/cli/doctor-config.js.map +1 -0
- package/dist/cli/doctor-system.d.ts +12 -0
- package/dist/cli/doctor-system.d.ts.map +1 -0
- package/dist/cli/doctor-system.js +109 -0
- package/dist/cli/doctor-system.js.map +1 -0
- package/dist/cli/doctor.d.ts +11 -0
- package/dist/cli/doctor.d.ts.map +1 -0
- package/dist/cli/doctor.js +323 -0
- package/dist/cli/doctor.js.map +1 -0
- package/dist/cli/doctor.lazy.d.ts +3 -0
- package/dist/cli/doctor.lazy.d.ts.map +1 -0
- package/dist/cli/doctor.lazy.js +3 -0
- package/dist/cli/doctor.lazy.js.map +1 -0
- package/dist/cli/list-models.d.ts.map +1 -1
- package/dist/cli/list-models.js +0 -4
- package/dist/cli/list-models.js.map +1 -1
- package/dist/cli/project-trust.d.ts.map +1 -1
- package/dist/cli/project-trust.js +6 -6
- package/dist/cli/project-trust.js.map +1 -1
- package/dist/cli/startup-ui.d.ts +3 -2
- package/dist/cli/startup-ui.d.ts.map +1 -1
- package/dist/cli/startup-ui.js +23 -10
- package/dist/cli/startup-ui.js.map +1 -1
- package/dist/config.d.ts +5 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +13 -3
- package/dist/config.js.map +1 -1
- package/dist/coordination/adapter/delivery.d.ts +27 -0
- package/dist/coordination/adapter/delivery.d.ts.map +1 -1
- package/dist/coordination/adapter/delivery.js +164 -4
- package/dist/coordination/adapter/delivery.js.map +1 -1
- package/dist/coordination/adapter/index.d.ts.map +1 -1
- package/dist/coordination/adapter/index.js +31 -5
- package/dist/coordination/adapter/index.js.map +1 -1
- package/dist/coordination/adapter/presence.d.ts +5 -0
- package/dist/coordination/adapter/presence.d.ts.map +1 -1
- package/dist/coordination/adapter/presence.js +25 -3
- package/dist/coordination/adapter/presence.js.map +1 -1
- package/dist/coordination/adapter/question-routing.d.ts +7 -0
- package/dist/coordination/adapter/question-routing.d.ts.map +1 -0
- package/dist/coordination/adapter/question-routing.js +40 -0
- package/dist/coordination/adapter/question-routing.js.map +1 -0
- package/dist/coordination/adapter/receipts.d.ts +7 -0
- package/dist/coordination/adapter/receipts.d.ts.map +1 -1
- package/dist/coordination/adapter/receipts.js +25 -2
- package/dist/coordination/adapter/receipts.js.map +1 -1
- package/dist/coordination/adapter/tool.d.ts +19 -3
- package/dist/coordination/adapter/tool.d.ts.map +1 -1
- package/dist/coordination/adapter/tool.js +93 -19
- package/dist/coordination/adapter/tool.js.map +1 -1
- package/dist/coordination/broker/broker.d.ts +3 -3
- package/dist/coordination/broker/broker.d.ts.map +1 -1
- package/dist/coordination/broker/broker.js +15 -7
- package/dist/coordination/broker/broker.js.map +1 -1
- package/dist/coordination/client/client.d.ts +2 -2
- package/dist/coordination/client/client.d.ts.map +1 -1
- package/dist/coordination/client/client.js +4 -0
- package/dist/coordination/client/client.js.map +1 -1
- package/dist/coordination/transport/protocol.d.ts.map +1 -1
- package/dist/coordination/transport/protocol.js +23 -0
- package/dist/coordination/transport/protocol.js.map +1 -1
- package/dist/coordination/transport/types.d.ts +11 -1
- package/dist/coordination/transport/types.d.ts.map +1 -1
- package/dist/coordination/transport/types.js.map +1 -1
- package/dist/core/acceptance-command.d.ts +6 -3
- package/dist/core/acceptance-command.d.ts.map +1 -1
- package/dist/core/acceptance-command.js +43 -12
- package/dist/core/acceptance-command.js.map +1 -1
- package/dist/core/acceptance-ledger.d.ts +2 -0
- package/dist/core/acceptance-ledger.d.ts.map +1 -1
- package/dist/core/acceptance-ledger.js +14 -3
- package/dist/core/acceptance-ledger.js.map +1 -1
- package/dist/core/agent-session-runtime.d.ts +11 -4
- package/dist/core/agent-session-runtime.d.ts.map +1 -1
- package/dist/core/agent-session-runtime.js +13 -4
- package/dist/core/agent-session-runtime.js.map +1 -1
- package/dist/core/agent-session-services.d.ts.map +1 -1
- package/dist/core/agent-session-services.js +6 -0
- package/dist/core/agent-session-services.js.map +1 -1
- package/dist/core/agent-session.d.ts +19 -1
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +131 -36
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/auth-storage.d.ts.map +1 -1
- package/dist/core/auth-storage.js +7 -1
- package/dist/core/auth-storage.js.map +1 -1
- package/dist/core/bash-executor.d.ts +3 -1
- package/dist/core/bash-executor.d.ts.map +1 -1
- package/dist/core/bash-executor.js +18 -8
- package/dist/core/bash-executor.js.map +1 -1
- package/dist/core/compaction/branch-summarization.d.ts +2 -2
- package/dist/core/compaction/branch-summarization.d.ts.map +1 -1
- package/dist/core/compaction/branch-summarization.js +9 -15
- package/dist/core/compaction/branch-summarization.js.map +1 -1
- package/dist/core/compaction/compaction.d.ts.map +1 -1
- package/dist/core/compaction/compaction.js +3 -0
- package/dist/core/compaction/compaction.js.map +1 -1
- package/dist/core/export-html/index.d.ts.map +1 -1
- package/dist/core/export-html/index.js +12 -10
- package/dist/core/export-html/index.js.map +1 -1
- package/dist/core/export-html/template.js +23 -1
- package/dist/core/extensions/runner.d.ts.map +1 -1
- package/dist/core/extensions/runner.js +13 -2
- package/dist/core/extensions/runner.js.map +1 -1
- package/dist/core/extensions/types.d.ts +9 -1
- package/dist/core/extensions/types.d.ts.map +1 -1
- package/dist/core/extensions/types.js.map +1 -1
- package/dist/core/footer-data-provider.d.ts.map +1 -1
- package/dist/core/footer-data-provider.js +2 -4
- package/dist/core/footer-data-provider.js.map +1 -1
- package/dist/core/http-dispatcher.d.ts +5 -2
- package/dist/core/http-dispatcher.d.ts.map +1 -1
- package/dist/core/http-dispatcher.js +6 -3
- package/dist/core/http-dispatcher.js.map +1 -1
- package/dist/core/keybindings.d.ts +20 -0
- package/dist/core/keybindings.d.ts.map +1 -1
- package/dist/core/keybindings.js +4 -1
- package/dist/core/keybindings.js.map +1 -1
- package/dist/core/mcp-servers.d.ts +29 -0
- package/dist/core/mcp-servers.d.ts.map +1 -1
- package/dist/core/mcp-servers.js +63 -17
- package/dist/core/mcp-servers.js.map +1 -1
- package/dist/core/messages.d.ts +4 -0
- package/dist/core/messages.d.ts.map +1 -1
- package/dist/core/messages.js +10 -2
- package/dist/core/messages.js.map +1 -1
- package/dist/core/model-config.d.ts +36 -0
- package/dist/core/model-config.d.ts.map +1 -1
- package/dist/core/model-resolver.js +1 -1
- package/dist/core/model-resolver.js.map +1 -1
- package/dist/core/model-runtime.d.ts.map +1 -1
- package/dist/core/model-runtime.js +20 -10
- package/dist/core/model-runtime.js.map +1 -1
- package/dist/core/nested-tool-calls.d.ts +6 -5
- package/dist/core/nested-tool-calls.d.ts.map +1 -1
- package/dist/core/nested-tool-calls.js +1 -3
- package/dist/core/nested-tool-calls.js.map +1 -1
- package/dist/core/oauth-account-pool.d.ts +14 -0
- package/dist/core/oauth-account-pool.d.ts.map +1 -1
- package/dist/core/oauth-account-pool.js +166 -14
- package/dist/core/oauth-account-pool.js.map +1 -1
- package/dist/core/os-secret-store.js +1 -1
- package/dist/core/os-secret-store.js.map +1 -1
- package/dist/core/package-manager.d.ts +3 -1
- package/dist/core/package-manager.d.ts.map +1 -1
- package/dist/core/package-manager.js +25 -4
- package/dist/core/package-manager.js.map +1 -1
- package/dist/core/pi-ai-schemas.d.ts +4 -0
- package/dist/core/pi-ai-schemas.d.ts.map +1 -1
- package/dist/core/project-trust.d.ts.map +1 -1
- package/dist/core/project-trust.js +1 -1
- package/dist/core/project-trust.js.map +1 -1
- package/dist/core/provider-composer.d.ts +1 -0
- package/dist/core/provider-composer.d.ts.map +1 -1
- package/dist/core/provider-composer.js +1 -0
- package/dist/core/provider-composer.js.map +1 -1
- package/dist/core/resolve-config-value.d.ts +4 -0
- package/dist/core/resolve-config-value.d.ts.map +1 -1
- package/dist/core/resolve-config-value.js +14 -3
- package/dist/core/resolve-config-value.js.map +1 -1
- package/dist/core/resource-loader.d.ts.map +1 -1
- package/dist/core/resource-loader.js +40 -2
- package/dist/core/resource-loader.js.map +1 -1
- package/dist/core/run-outcome.d.ts +1 -1
- package/dist/core/run-outcome.d.ts.map +1 -1
- package/dist/core/run-outcome.js +2 -2
- package/dist/core/run-outcome.js.map +1 -1
- package/dist/core/run-preflight.d.ts.map +1 -1
- package/dist/core/run-preflight.js +15 -8
- package/dist/core/run-preflight.js.map +1 -1
- package/dist/core/runtime-credentials.d.ts.map +1 -1
- package/dist/core/runtime-credentials.js +11 -7
- package/dist/core/runtime-credentials.js.map +1 -1
- package/dist/core/sdk.d.ts.map +1 -1
- package/dist/core/sdk.js +8 -4
- package/dist/core/sdk.js.map +1 -1
- package/dist/core/session-manager.d.ts +22 -1
- package/dist/core/session-manager.d.ts.map +1 -1
- package/dist/core/session-manager.js +227 -37
- package/dist/core/session-manager.js.map +1 -1
- package/dist/core/settings-defaults.d.ts +10 -1
- package/dist/core/settings-defaults.d.ts.map +1 -1
- package/dist/core/settings-defaults.js +7 -1
- package/dist/core/settings-defaults.js.map +1 -1
- package/dist/core/settings-manager.d.ts +14 -4
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js +48 -15
- package/dist/core/settings-manager.js.map +1 -1
- package/dist/core/settings-schema.d.ts +20 -2
- package/dist/core/settings-schema.d.ts.map +1 -1
- package/dist/core/settings-schema.js +27 -4
- package/dist/core/settings-schema.js.map +1 -1
- package/dist/core/slash-commands.d.ts.map +1 -1
- package/dist/core/slash-commands.js +2 -0
- package/dist/core/slash-commands.js.map +1 -1
- package/dist/core/tools/bash-jobs.js +2 -2
- package/dist/core/tools/bash-jobs.js.map +1 -1
- package/dist/core/tools/bash.d.ts +3 -0
- package/dist/core/tools/bash.d.ts.map +1 -1
- package/dist/core/tools/bash.js +78 -46
- package/dist/core/tools/bash.js.map +1 -1
- package/dist/core/tools/edit-diff.d.ts +7 -1
- package/dist/core/tools/edit-diff.d.ts.map +1 -1
- package/dist/core/tools/edit-diff.js +139 -75
- package/dist/core/tools/edit-diff.js.map +1 -1
- package/dist/core/tools/edit.d.ts.map +1 -1
- package/dist/core/tools/edit.js +4 -1
- package/dist/core/tools/edit.js.map +1 -1
- package/dist/core/tools/output-accumulator.d.ts +21 -6
- package/dist/core/tools/output-accumulator.d.ts.map +1 -1
- package/dist/core/tools/output-accumulator.js +90 -76
- package/dist/core/tools/output-accumulator.js.map +1 -1
- package/dist/core/tools/render-utils.d.ts +7 -2
- package/dist/core/tools/render-utils.d.ts.map +1 -1
- package/dist/core/tools/render-utils.js +14 -1
- package/dist/core/tools/render-utils.js.map +1 -1
- package/dist/core/tools/renderers/bash.d.ts.map +1 -1
- package/dist/core/tools/renderers/bash.js +9 -3
- package/dist/core/tools/renderers/bash.js.map +1 -1
- package/dist/core/tools/truncate.d.ts +1 -1
- package/dist/core/tools/truncate.d.ts.map +1 -1
- package/dist/core/tools/truncate.js +16 -7
- package/dist/core/tools/truncate.js.map +1 -1
- package/dist/core/tools/write.d.ts.map +1 -1
- package/dist/core/tools/write.js +2 -0
- package/dist/core/tools/write.js.map +1 -1
- package/dist/core/trust-manager.d.ts +2 -0
- package/dist/core/trust-manager.d.ts.map +1 -1
- package/dist/core/trust-manager.js +5 -4
- package/dist/core/trust-manager.js.map +1 -1
- package/dist/core/usage-totals.d.ts.map +1 -1
- package/dist/core/usage-totals.js +3 -0
- package/dist/core/usage-totals.js.map +1 -1
- package/dist/extensions/codemode/execute.d.ts.map +1 -1
- package/dist/extensions/codemode/execute.js +64 -20
- package/dist/extensions/codemode/execute.js.map +1 -1
- package/dist/extensions/codemode/renderer.d.ts.map +1 -1
- package/dist/extensions/codemode/renderer.js +8 -3
- package/dist/extensions/codemode/renderer.js.map +1 -1
- package/dist/extensions/codemode/tool.d.ts +5 -0
- package/dist/extensions/codemode/tool.d.ts.map +1 -1
- package/dist/extensions/codemode/tool.js.map +1 -1
- package/dist/extensions/llama/client.d.ts.map +1 -1
- package/dist/extensions/llama/client.js +3 -13
- package/dist/extensions/llama/client.js.map +1 -1
- package/dist/extensions/llama/ui.d.ts.map +1 -1
- package/dist/extensions/llama/ui.js +2 -1
- package/dist/extensions/llama/ui.js.map +1 -1
- package/dist/extensions/mcp/cli.d.ts +7 -0
- package/dist/extensions/mcp/cli.d.ts.map +1 -1
- package/dist/extensions/mcp/cli.js +35 -8
- package/dist/extensions/mcp/cli.js.map +1 -1
- package/dist/extensions/mcp/config.d.ts +33 -0
- package/dist/extensions/mcp/config.d.ts.map +1 -1
- package/dist/extensions/mcp/config.js +11 -2
- package/dist/extensions/mcp/config.js.map +1 -1
- package/dist/extensions/mcp/index.d.ts +8 -0
- package/dist/extensions/mcp/index.d.ts.map +1 -1
- package/dist/extensions/mcp/index.js +16 -0
- package/dist/extensions/mcp/index.js.map +1 -1
- package/dist/extensions/mcp/resources.d.ts +1 -1
- package/dist/extensions/mcp/resources.d.ts.map +1 -1
- package/dist/extensions/mcp/resources.js +4 -3
- package/dist/extensions/mcp/resources.js.map +1 -1
- package/dist/extensions/mcp/runtime.d.ts +1 -1
- package/dist/extensions/mcp/runtime.d.ts.map +1 -1
- package/dist/extensions/mcp/runtime.js +15 -14
- package/dist/extensions/mcp/runtime.js.map +1 -1
- package/dist/extensions/mcp/tools.d.ts +1 -24
- package/dist/extensions/mcp/tools.d.ts.map +1 -1
- package/dist/extensions/mcp/tools.js +10 -163
- package/dist/extensions/mcp/tools.js.map +1 -1
- package/dist/humain/ask-user-question/index.d.ts +4 -0
- package/dist/humain/ask-user-question/index.d.ts.map +1 -0
- package/dist/humain/ask-user-question/index.js +18 -0
- package/dist/humain/ask-user-question/index.js.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/answer-channel.d.ts +38 -0
- package/dist/humain/ask-user-question/vendor/ask/answer-channel.d.ts.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/answer-channel.js +97 -0
- package/dist/humain/ask-user-question/vendor/ask/answer-channel.js.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/ask-user-question.d.ts +41 -0
- package/dist/humain/ask-user-question/vendor/ask/ask-user-question.d.ts.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/ask-user-question.js +441 -0
- package/dist/humain/ask-user-question/vendor/ask/ask-user-question.js.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/config.d.ts +39 -0
- package/dist/humain/ask-user-question/vendor/ask/config.d.ts.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/config.js +95 -0
- package/dist/humain/ask-user-question/vendor/ask/config.js.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/events.d.ts +132 -0
- package/dist/humain/ask-user-question/vendor/ask/events.d.ts.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/events.js +50 -0
- package/dist/humain/ask-user-question/vendor/ask/events.js.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/index.d.ts +5 -0
- package/dist/humain/ask-user-question/vendor/ask/index.d.ts.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/index.js +15 -0
- package/dist/humain/ask-user-question/vendor/ask/index.js.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/presentation.d.ts +81 -0
- package/dist/humain/ask-user-question/vendor/ask/presentation.d.ts.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/presentation.js +105 -0
- package/dist/humain/ask-user-question/vendor/ask/presentation.js.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/reconcile.d.ts +28 -0
- package/dist/humain/ask-user-question/vendor/ask/reconcile.d.ts.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/reconcile.js +45 -0
- package/dist/humain/ask-user-question/vendor/ask/reconcile.js.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/rpc-fallback.d.ts +41 -0
- package/dist/humain/ask-user-question/vendor/ask/rpc-fallback.d.ts.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/rpc-fallback.js +166 -0
- package/dist/humain/ask-user-question/vendor/ask/rpc-fallback.js.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/state/build-questionnaire.d.ts +46 -0
- package/dist/humain/ask-user-question/vendor/ask/state/build-questionnaire.d.ts.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/state/build-questionnaire.js +247 -0
- package/dist/humain/ask-user-question/vendor/ask/state/build-questionnaire.js.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/state/external-editor.d.ts +11 -0
- package/dist/humain/ask-user-question/vendor/ask/state/external-editor.d.ts.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/state/external-editor.js +56 -0
- package/dist/humain/ask-user-question/vendor/ask/state/external-editor.js.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/state/i18n-bridge.d.ts +6 -0
- package/dist/humain/ask-user-question/vendor/ask/state/i18n-bridge.d.ts.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/state/i18n-bridge.js +10 -0
- package/dist/humain/ask-user-question/vendor/ask/state/i18n-bridge.js.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/state/key-router.d.ts +57 -0
- package/dist/humain/ask-user-question/vendor/ask/state/key-router.d.ts.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/state/key-router.js +357 -0
- package/dist/humain/ask-user-question/vendor/ask/state/key-router.js.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/state/questionnaire-session.d.ts +112 -0
- package/dist/humain/ask-user-question/vendor/ask/state/questionnaire-session.d.ts.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/state/questionnaire-session.js +240 -0
- package/dist/humain/ask-user-question/vendor/ask/state/questionnaire-session.js.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/state/row-intent.d.ts +87 -0
- package/dist/humain/ask-user-question/vendor/ask/state/row-intent.d.ts.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/state/row-intent.js +79 -0
- package/dist/humain/ask-user-question/vendor/ask/state/row-intent.js.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/state/selectors/contract.d.ts +22 -0
- package/dist/humain/ask-user-question/vendor/ask/state/selectors/contract.d.ts.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/state/selectors/contract.js +2 -0
- package/dist/humain/ask-user-question/vendor/ask/state/selectors/contract.js.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/state/selectors/derivations.d.ts +27 -0
- package/dist/humain/ask-user-question/vendor/ask/state/selectors/derivations.d.ts.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/state/selectors/derivations.js +48 -0
- package/dist/humain/ask-user-question/vendor/ask/state/selectors/derivations.js.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/state/selectors/focus.d.ts +13 -0
- package/dist/humain/ask-user-question/vendor/ask/state/selectors/focus.d.ts.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/state/selectors/focus.js +15 -0
- package/dist/humain/ask-user-question/vendor/ask/state/selectors/focus.js.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/state/selectors/projections.d.ts +14 -0
- package/dist/humain/ask-user-question/vendor/ask/state/selectors/projections.d.ts.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/state/selectors/projections.js +96 -0
- package/dist/humain/ask-user-question/vendor/ask/state/selectors/projections.js.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/state/state-reducer.d.ts +58 -0
- package/dist/humain/ask-user-question/vendor/ask/state/state-reducer.d.ts.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/state/state-reducer.js +310 -0
- package/dist/humain/ask-user-question/vendor/ask/state/state-reducer.js.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/state/state.d.ts +68 -0
- package/dist/humain/ask-user-question/vendor/ask/state/state.d.ts.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/state/state.js +2 -0
- package/dist/humain/ask-user-question/vendor/ask/state/state.js.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/tool/external-answer.d.ts +24 -0
- package/dist/humain/ask-user-question/vendor/ask/tool/external-answer.d.ts.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/tool/external-answer.js +114 -0
- package/dist/humain/ask-user-question/vendor/ask/tool/external-answer.js.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/tool/format-answer.d.ts +18 -0
- package/dist/humain/ask-user-question/vendor/ask/tool/format-answer.d.ts.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/tool/format-answer.js +29 -0
- package/dist/humain/ask-user-question/vendor/ask/tool/format-answer.js.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/tool/normalize-params.d.ts +41 -0
- package/dist/humain/ask-user-question/vendor/ask/tool/normalize-params.d.ts.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/tool/normalize-params.js +99 -0
- package/dist/humain/ask-user-question/vendor/ask/tool/normalize-params.js.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/tool/response-envelope.d.ts +37 -0
- package/dist/humain/ask-user-question/vendor/ask/tool/response-envelope.d.ts.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/tool/response-envelope.js +70 -0
- package/dist/humain/ask-user-question/vendor/ask/tool/response-envelope.js.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/tool/types.d.ts +129 -0
- package/dist/humain/ask-user-question/vendor/ask/tool/types.d.ts.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/tool/types.js +76 -0
- package/dist/humain/ask-user-question/vendor/ask/tool/types.js.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/tool/validate-questionnaire.d.ts +21 -0
- package/dist/humain/ask-user-question/vendor/ask/tool/validate-questionnaire.d.ts.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/tool/validate-questionnaire.js +49 -0
- package/dist/humain/ask-user-question/vendor/ask/tool/validate-questionnaire.js.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/view/component-binding.d.ts +23 -0
- package/dist/humain/ask-user-question/vendor/ask/view/component-binding.d.ts.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/view/component-binding.js +16 -0
- package/dist/humain/ask-user-question/vendor/ask/view/component-binding.js.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/view/components/inline-input.d.ts +21 -0
- package/dist/humain/ask-user-question/vendor/ask/view/components/inline-input.d.ts.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/view/components/inline-input.js +49 -0
- package/dist/humain/ask-user-question/vendor/ask/view/components/inline-input.js.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/view/components/multi-select-view.d.ts +43 -0
- package/dist/humain/ask-user-question/vendor/ask/view/components/multi-select-view.d.ts.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/view/components/multi-select-view.js +130 -0
- package/dist/humain/ask-user-question/vendor/ask/view/components/multi-select-view.js.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/view/components/option-list-view.d.ts +45 -0
- package/dist/humain/ask-user-question/vendor/ask/view/components/option-list-view.d.ts.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/view/components/option-list-view.js +39 -0
- package/dist/humain/ask-user-question/vendor/ask/view/components/option-list-view.js.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/view/components/preview/markdown-content-cache.d.ts +36 -0
- package/dist/humain/ask-user-question/vendor/ask/view/components/preview/markdown-content-cache.d.ts.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/view/components/preview/markdown-content-cache.js +72 -0
- package/dist/humain/ask-user-question/vendor/ask/view/components/preview/markdown-content-cache.js.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/view/components/preview/preview-block-renderer.d.ts +61 -0
- package/dist/humain/ask-user-question/vendor/ask/view/components/preview/preview-block-renderer.d.ts.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/view/components/preview/preview-block-renderer.js +108 -0
- package/dist/humain/ask-user-question/vendor/ask/view/components/preview/preview-block-renderer.js.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/view/components/preview/preview-box-renderer.d.ts +39 -0
- package/dist/humain/ask-user-question/vendor/ask/view/components/preview/preview-box-renderer.d.ts.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/view/components/preview/preview-box-renderer.js +76 -0
- package/dist/humain/ask-user-question/vendor/ask/view/components/preview/preview-box-renderer.js.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/view/components/preview/preview-layout-decider.d.ts +123 -0
- package/dist/humain/ask-user-question/vendor/ask/view/components/preview/preview-layout-decider.d.ts.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/view/components/preview/preview-layout-decider.js +180 -0
- package/dist/humain/ask-user-question/vendor/ask/view/components/preview/preview-layout-decider.js.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/view/components/preview/preview-pane.d.ts +108 -0
- package/dist/humain/ask-user-question/vendor/ask/view/components/preview/preview-pane.d.ts.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/view/components/preview/preview-pane.js +235 -0
- package/dist/humain/ask-user-question/vendor/ask/view/components/preview/preview-pane.js.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/view/components/submit-picker.d.ts +37 -0
- package/dist/humain/ask-user-question/vendor/ask/view/components/submit-picker.d.ts.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/view/components/submit-picker.js +47 -0
- package/dist/humain/ask-user-question/vendor/ask/view/components/submit-picker.js.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/view/components/tab-bar.d.ts +31 -0
- package/dist/humain/ask-user-question/vendor/ask/view/components/tab-bar.d.ts.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/view/components/tab-bar.js +35 -0
- package/dist/humain/ask-user-question/vendor/ask/view/components/tab-bar.js.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/view/components/wrapping-select.d.ts +124 -0
- package/dist/humain/ask-user-question/vendor/ask/view/components/wrapping-select.d.ts.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/view/components/wrapping-select.js +205 -0
- package/dist/humain/ask-user-question/vendor/ask/view/components/wrapping-select.js.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/view/dialog-builder.d.ts +83 -0
- package/dist/humain/ask-user-question/vendor/ask/view/dialog-builder.d.ts.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/view/dialog-builder.js +186 -0
- package/dist/humain/ask-user-question/vendor/ask/view/dialog-builder.js.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/view/dialog-copy.d.ts +47 -0
- package/dist/humain/ask-user-question/vendor/ask/view/dialog-copy.d.ts.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/view/dialog-copy.js +48 -0
- package/dist/humain/ask-user-question/vendor/ask/view/dialog-copy.js.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/view/props-adapter.d.ts +58 -0
- package/dist/humain/ask-user-question/vendor/ask/view/props-adapter.d.ts.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/view/props-adapter.js +84 -0
- package/dist/humain/ask-user-question/vendor/ask/view/props-adapter.js.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/view/scroll-window.d.ts +20 -0
- package/dist/humain/ask-user-question/vendor/ask/view/scroll-window.d.ts.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/view/scroll-window.js +55 -0
- package/dist/humain/ask-user-question/vendor/ask/view/scroll-window.js.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/view/stateful-view.d.ts +23 -0
- package/dist/humain/ask-user-question/vendor/ask/view/stateful-view.d.ts.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/view/stateful-view.js +2 -0
- package/dist/humain/ask-user-question/vendor/ask/view/stateful-view.js.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/view/tab-components.d.ts +15 -0
- package/dist/humain/ask-user-question/vendor/ask/view/tab-components.d.ts.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/view/tab-components.js +2 -0
- package/dist/humain/ask-user-question/vendor/ask/view/tab-components.js.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/view/tab-content-strategy.d.ts +98 -0
- package/dist/humain/ask-user-question/vendor/ask/view/tab-content-strategy.d.ts.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/view/tab-content-strategy.js +248 -0
- package/dist/humain/ask-user-question/vendor/ask/view/tab-content-strategy.js.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/view/transcript.d.ts +23 -0
- package/dist/humain/ask-user-question/vendor/ask/view/transcript.d.ts.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/view/transcript.js +131 -0
- package/dist/humain/ask-user-question/vendor/ask/view/transcript.js.map +1 -0
- package/dist/humain/ask-user-question/vendor/config/config.d.ts +132 -0
- package/dist/humain/ask-user-question/vendor/config/config.d.ts.map +1 -0
- package/dist/humain/ask-user-question/vendor/config/config.js +286 -0
- package/dist/humain/ask-user-question/vendor/config/config.js.map +1 -0
- package/dist/humain/ask-user-question/vendor/config/index.d.ts +2 -0
- package/dist/humain/ask-user-question/vendor/config/index.d.ts.map +1 -0
- package/dist/humain/ask-user-question/vendor/config/index.js +2 -0
- package/dist/humain/ask-user-question/vendor/config/index.js.map +1 -0
- package/dist/humain/ask-user-question/vendor/i18n/i18n.d.ts +64 -0
- package/dist/humain/ask-user-question/vendor/i18n/i18n.d.ts.map +1 -0
- package/dist/humain/ask-user-question/vendor/i18n/i18n.js +185 -0
- package/dist/humain/ask-user-question/vendor/i18n/i18n.js.map +1 -0
- package/dist/humain/ask-user-question/vendor/i18n/loader.d.ts +44 -0
- package/dist/humain/ask-user-question/vendor/i18n/loader.d.ts.map +1 -0
- package/dist/humain/ask-user-question/vendor/i18n/loader.js +55 -0
- package/dist/humain/ask-user-question/vendor/i18n/loader.js.map +1 -0
- package/dist/humain/bedrock-provider/vendor/index.bundle.mjs +26 -16
- package/dist/humain/brand-logo.d.ts +2 -0
- package/dist/humain/brand-logo.d.ts.map +1 -1
- package/dist/humain/brand-logo.js +4 -0
- package/dist/humain/brand-logo.js.map +1 -1
- package/dist/humain/bundled-extension-names.d.ts +1 -0
- package/dist/humain/bundled-extension-names.d.ts.map +1 -1
- package/dist/humain/bundled-extension-names.js +1 -0
- package/dist/humain/bundled-extension-names.js.map +1 -1
- package/dist/humain/checklist/footer-progress.d.ts +7 -0
- package/dist/humain/checklist/footer-progress.d.ts.map +1 -0
- package/dist/humain/checklist/footer-progress.js +15 -0
- package/dist/humain/checklist/footer-progress.js.map +1 -0
- package/dist/humain/checklist/glyphs.d.ts +7 -0
- package/dist/humain/checklist/glyphs.d.ts.map +1 -0
- package/dist/humain/checklist/glyphs.js +8 -0
- package/dist/humain/checklist/glyphs.js.map +1 -0
- package/dist/humain/checklist/index.d.ts +6 -0
- package/dist/humain/checklist/index.d.ts.map +1 -0
- package/dist/humain/checklist/index.js +37 -0
- package/dist/humain/checklist/index.js.map +1 -0
- package/dist/humain/checklist/progress.d.ts +37 -0
- package/dist/humain/checklist/progress.d.ts.map +1 -0
- package/dist/humain/checklist/progress.js +234 -0
- package/dist/humain/checklist/progress.js.map +1 -0
- package/dist/humain/checklist/projector.d.ts +53 -0
- package/dist/humain/checklist/projector.d.ts.map +1 -0
- package/dist/humain/checklist/projector.js +198 -0
- package/dist/humain/checklist/projector.js.map +1 -0
- package/dist/humain/checklist/sidebar.d.ts +18 -0
- package/dist/humain/checklist/sidebar.d.ts.map +1 -0
- package/dist/humain/checklist/sidebar.js +38 -0
- package/dist/humain/checklist/sidebar.js.map +1 -0
- package/dist/humain/checklist/status-segment.d.ts +19 -0
- package/dist/humain/checklist/status-segment.d.ts.map +1 -0
- package/dist/humain/checklist/status-segment.js +59 -0
- package/dist/humain/checklist/status-segment.js.map +1 -0
- package/dist/humain/checklist/vendor/add-task-dialog.d.ts +54 -0
- package/dist/humain/checklist/vendor/add-task-dialog.d.ts.map +1 -0
- package/dist/humain/checklist/vendor/add-task-dialog.js +238 -0
- package/dist/humain/checklist/vendor/add-task-dialog.js.map +1 -0
- package/dist/humain/checklist/vendor/commands.d.ts +38 -0
- package/dist/humain/checklist/vendor/commands.d.ts.map +1 -0
- package/dist/humain/checklist/vendor/commands.js +193 -0
- package/dist/humain/checklist/vendor/commands.js.map +1 -0
- package/dist/humain/checklist/vendor/index.d.ts +3 -0
- package/dist/humain/checklist/vendor/index.d.ts.map +1 -0
- package/dist/humain/checklist/vendor/index.js +276 -0
- package/dist/humain/checklist/vendor/index.js.map +1 -0
- package/dist/humain/checklist/vendor/render.d.ts +97 -0
- package/dist/humain/checklist/vendor/render.d.ts.map +1 -0
- package/dist/humain/checklist/vendor/render.js +354 -0
- package/dist/humain/checklist/vendor/render.js.map +1 -0
- package/dist/humain/checklist/vendor/settings.d.ts +11 -0
- package/dist/humain/checklist/vendor/settings.d.ts.map +1 -0
- package/dist/humain/checklist/vendor/settings.js +8 -0
- package/dist/humain/checklist/vendor/settings.js.map +1 -0
- package/dist/humain/checklist/vendor/store.d.ts +120 -0
- package/dist/humain/checklist/vendor/store.d.ts.map +1 -0
- package/dist/humain/checklist/vendor/store.js +990 -0
- package/dist/humain/checklist/vendor/store.js.map +1 -0
- package/dist/humain/checklist/vendor/tools.d.ts +21 -0
- package/dist/humain/checklist/vendor/tools.d.ts.map +1 -0
- package/dist/humain/checklist/vendor/tools.js +162 -0
- package/dist/humain/checklist/vendor/tools.js.map +1 -0
- package/dist/humain/checklist/vendor/types.d.ts +188 -0
- package/dist/humain/checklist/vendor/types.d.ts.map +1 -0
- package/dist/humain/checklist/vendor/types.js +32 -0
- package/dist/humain/checklist/vendor/types.js.map +1 -0
- package/dist/humain/gateway/catalog.d.ts +1 -0
- package/dist/humain/gateway/catalog.d.ts.map +1 -1
- package/dist/humain/gateway/catalog.js +1 -0
- package/dist/humain/gateway/catalog.js.map +1 -1
- package/dist/humain/gateway/client.d.ts +1 -0
- package/dist/humain/gateway/client.d.ts.map +1 -1
- package/dist/humain/gateway/client.js +8 -1
- package/dist/humain/gateway/client.js.map +1 -1
- package/dist/humain/gateway/http.d.ts.map +1 -1
- package/dist/humain/gateway/http.js +11 -3
- package/dist/humain/gateway/http.js.map +1 -1
- package/dist/humain/gateway/images.d.ts +3 -0
- package/dist/humain/gateway/images.d.ts.map +1 -0
- package/dist/humain/gateway/images.js +73 -0
- package/dist/humain/gateway/images.js.map +1 -0
- package/dist/humain/gateway/provider.js +1 -1
- package/dist/humain/gateway/provider.js.map +1 -1
- package/dist/humain/hcode/account-store.d.ts.map +1 -1
- package/dist/humain/hcode/account-store.js +3 -1
- package/dist/humain/hcode/account-store.js.map +1 -1
- package/dist/humain/hcode/account.d.ts.map +1 -1
- package/dist/humain/hcode/account.js +23 -13
- package/dist/humain/hcode/account.js.map +1 -1
- package/dist/humain/hcode/images.d.ts.map +1 -1
- package/dist/humain/hcode/images.js +19 -13
- package/dist/humain/hcode/images.js.map +1 -1
- package/dist/humain/hcode/login-failure.d.ts +1 -0
- package/dist/humain/hcode/login-failure.d.ts.map +1 -1
- package/dist/humain/hcode/login-failure.js +1 -0
- package/dist/humain/hcode/login-failure.js.map +1 -1
- package/dist/humain/hcode/provider.d.ts.map +1 -1
- package/dist/humain/hcode/provider.js +2 -1
- package/dist/humain/hcode/provider.js.map +1 -1
- package/dist/humain/hcode/run-credential.d.ts +1 -0
- package/dist/humain/hcode/run-credential.d.ts.map +1 -1
- package/dist/humain/hcode/run-credential.js +12 -4
- package/dist/humain/hcode/run-credential.js.map +1 -1
- package/dist/humain/index.d.ts.map +1 -1
- package/dist/humain/index.js +4 -0
- package/dist/humain/index.js.map +1 -1
- package/dist/humain/node-provider.d.ts.map +1 -1
- package/dist/humain/node-provider.js +37 -8
- package/dist/humain/node-provider.js.map +1 -1
- package/dist/main.d.ts +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +38 -26
- package/dist/main.js.map +1 -1
- package/dist/modes/interactive/chat-viewport.js +1 -1
- package/dist/modes/interactive/chat-viewport.js.map +1 -1
- package/dist/modes/interactive/components/bash-execution.d.ts +2 -1
- package/dist/modes/interactive/components/bash-execution.d.ts.map +1 -1
- package/dist/modes/interactive/components/bash-execution.js +7 -4
- package/dist/modes/interactive/components/bash-execution.js.map +1 -1
- package/dist/modes/interactive/components/config-selector.js +1 -1
- package/dist/modes/interactive/components/config-selector.js.map +1 -1
- package/dist/modes/interactive/components/custom-editor.d.ts +2 -0
- package/dist/modes/interactive/components/custom-editor.d.ts.map +1 -1
- package/dist/modes/interactive/components/custom-editor.js +20 -1
- package/dist/modes/interactive/components/custom-editor.js.map +1 -1
- package/dist/modes/interactive/components/extension-editor.d.ts +1 -1
- package/dist/modes/interactive/components/extension-editor.js +2 -2
- package/dist/modes/interactive/components/extension-editor.js.map +1 -1
- package/dist/modes/interactive/components/footer.d.ts +7 -0
- package/dist/modes/interactive/components/footer.d.ts.map +1 -1
- package/dist/modes/interactive/components/footer.js +74 -1
- package/dist/modes/interactive/components/footer.js.map +1 -1
- package/dist/modes/interactive/components/mermaid.d.ts.map +1 -1
- package/dist/modes/interactive/components/mermaid.js +11 -4
- package/dist/modes/interactive/components/mermaid.js.map +1 -1
- package/dist/modes/interactive/components/model-selector.d.ts +2 -0
- package/dist/modes/interactive/components/model-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/model-selector.js +56 -8
- package/dist/modes/interactive/components/model-selector.js.map +1 -1
- package/dist/modes/interactive/components/oauth-selector.d.ts +13 -1
- package/dist/modes/interactive/components/oauth-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/oauth-selector.js +10 -9
- package/dist/modes/interactive/components/oauth-selector.js.map +1 -1
- package/dist/modes/interactive/components/session-selector.js +3 -3
- package/dist/modes/interactive/components/session-selector.js.map +1 -1
- package/dist/modes/interactive/components/settings-selector.d.ts +4 -3
- package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/settings-selector.js +83 -37
- package/dist/modes/interactive/components/settings-selector.js.map +1 -1
- package/dist/modes/interactive/components/settings-submenu.d.ts.map +1 -1
- package/dist/modes/interactive/components/settings-submenu.js +3 -3
- package/dist/modes/interactive/components/settings-submenu.js.map +1 -1
- package/dist/modes/interactive/components/status-indicator.d.ts +18 -7
- package/dist/modes/interactive/components/status-indicator.d.ts.map +1 -1
- package/dist/modes/interactive/components/status-indicator.js +70 -24
- package/dist/modes/interactive/components/status-indicator.js.map +1 -1
- package/dist/modes/interactive/components/status-line.d.ts +16 -0
- package/dist/modes/interactive/components/status-line.d.ts.map +1 -0
- package/dist/modes/interactive/components/status-line.js +51 -0
- package/dist/modes/interactive/components/status-line.js.map +1 -0
- package/dist/modes/interactive/components/tool-execution.d.ts +5 -0
- package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
- package/dist/modes/interactive/components/tool-execution.js +8 -1
- package/dist/modes/interactive/components/tool-execution.js.map +1 -1
- package/dist/modes/interactive/components/visual-truncate.d.ts.map +1 -1
- package/dist/modes/interactive/components/visual-truncate.js +11 -3
- package/dist/modes/interactive/components/visual-truncate.js.map +1 -1
- package/dist/modes/interactive/external-editor.d.ts.map +1 -1
- package/dist/modes/interactive/external-editor.js +13 -3
- package/dist/modes/interactive/external-editor.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts +17 -1
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +232 -108
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/interactive/program-status-reporter.d.ts +2 -0
- package/dist/modes/interactive/program-status-reporter.d.ts.map +1 -1
- package/dist/modes/interactive/program-status-reporter.js +4 -0
- package/dist/modes/interactive/program-status-reporter.js.map +1 -1
- package/dist/modes/interactive/session-share.d.ts.map +1 -1
- package/dist/modes/interactive/session-share.js +9 -1
- package/dist/modes/interactive/session-share.js.map +1 -1
- package/dist/modes/print-mode.d.ts.map +1 -1
- package/dist/modes/print-mode.js +34 -7
- package/dist/modes/print-mode.js.map +1 -1
- package/dist/modes/rpc/jsonl.js +6 -5
- package/dist/modes/rpc/jsonl.js.map +1 -1
- package/dist/modes/rpc/rpc-client.d.ts +2 -0
- package/dist/modes/rpc/rpc-client.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-client.js +9 -2
- package/dist/modes/rpc/rpc-client.js.map +1 -1
- package/dist/modes/rpc/rpc-mode.d.ts +2 -1
- package/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-mode.js +113 -13
- package/dist/modes/rpc/rpc-mode.js.map +1 -1
- package/dist/modes/rpc/rpc-types.d.ts +22 -1
- package/dist/modes/rpc/rpc-types.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-types.js.map +1 -1
- package/dist/modes/uncaught-errors.d.ts +20 -0
- package/dist/modes/uncaught-errors.d.ts.map +1 -0
- package/dist/modes/uncaught-errors.js +56 -0
- package/dist/modes/uncaught-errors.js.map +1 -0
- package/dist/package-manager-cli.d.ts.map +1 -1
- package/dist/package-manager-cli.js +10 -1
- package/dist/package-manager-cli.js.map +1 -1
- package/dist/utils/clipboard-image.js +1 -1
- package/dist/utils/clipboard-image.js.map +1 -1
- package/dist/utils/clipboard.js +2 -2
- package/dist/utils/clipboard.js.map +1 -1
- package/dist/utils/image-process.d.ts +5 -0
- package/dist/utils/image-process.d.ts.map +1 -1
- package/dist/utils/image-process.js +22 -4
- package/dist/utils/image-process.js.map +1 -1
- package/dist/utils/output-files.d.ts +44 -7
- package/dist/utils/output-files.d.ts.map +1 -1
- package/dist/utils/output-files.js +206 -12
- package/dist/utils/output-files.js.map +1 -1
- package/dist/utils/piped-stdin.d.ts +21 -0
- package/dist/utils/piped-stdin.d.ts.map +1 -0
- package/dist/utils/piped-stdin.js +60 -0
- package/dist/utils/piped-stdin.js.map +1 -0
- package/dist/utils/shell.d.ts +5 -2
- package/dist/utils/shell.d.ts.map +1 -1
- package/dist/utils/shell.js +77 -8
- package/dist/utils/shell.js.map +1 -1
- package/dist/utils/syntax-highlight.d.ts +33 -2
- package/dist/utils/syntax-highlight.d.ts.map +1 -1
- package/dist/utils/syntax-highlight.js +77 -10
- package/dist/utils/syntax-highlight.js.map +1 -1
- package/dist/utils/tools-manager.d.ts +1 -0
- package/dist/utils/tools-manager.d.ts.map +1 -1
- package/dist/utils/tools-manager.js +9 -8
- package/dist/utils/tools-manager.js.map +1 -1
- package/dist/utils/wsl.d.ts +8 -2
- package/dist/utils/wsl.d.ts.map +1 -1
- package/dist/utils/wsl.js +12 -3
- package/dist/utils/wsl.js.map +1 -1
- package/docs/cli.md +45 -3
- package/docs/codemode.md +7 -3
- package/docs/compaction.md +1 -1
- package/docs/coordination.md +16 -4
- package/docs/development.md +6 -0
- package/docs/environment-variables.md +5 -3
- package/docs/extensions.md +19 -5
- package/docs/keybindings.md +2 -0
- package/docs/llama-cpp.md +2 -2
- package/docs/message-types.md +1 -0
- package/docs/models-configuration.md +14 -3
- package/docs/models.md +29 -7
- package/docs/providers.md +25 -3
- package/docs/rpc-commands.md +25 -2
- package/docs/rpc.md +20 -0
- package/docs/run-preflight.md +2 -2
- package/docs/session-format.md +9 -0
- package/docs/settings.md +35 -5
- package/docs/shell-aliases.md +1 -1
- package/docs/slash-commands.md +3 -1
- package/docs/terminal-setup.md +25 -0
- package/docs/windows.md +2 -1
- package/examples/extensions/custom-provider-anthropic/package-lock.json +4 -4
- package/examples/extensions/custom-provider-anthropic/package.json +1 -1
- package/examples/rpc-extension-ui.ts +8 -7
- package/npm-shrinkwrap.json +209 -180
- package/package.json +26 -20
- package/schemas/keybindings.schema.json +12 -0
- package/schemas/models.schema.json +20 -7
- package/schemas/settings.schema.json +43 -5
- package/src/coordination/UPSTREAM.md +27 -1
- package/src/coordination/upstream.json +3 -3
- package/src/humain/ask-user-question/UPSTREAM.md +31 -0
- package/src/humain/ask-user-question/upstream.json +258 -0
- package/src/humain/ask-user-question/vendor/ask/LICENSE +21 -0
- package/src/humain/ask-user-question/vendor/ask/locales/de.json +38 -0
- package/src/humain/ask-user-question/vendor/ask/locales/en.json +41 -0
- package/src/humain/ask-user-question/vendor/ask/locales/es.json +38 -0
- package/src/humain/ask-user-question/vendor/ask/locales/fr.json +38 -0
- package/src/humain/ask-user-question/vendor/ask/locales/pt-BR.json +38 -0
- package/src/humain/ask-user-question/vendor/ask/locales/pt.json +38 -0
- package/src/humain/ask-user-question/vendor/ask/locales/ru.json +38 -0
- package/src/humain/ask-user-question/vendor/ask/locales/uk.json +38 -0
- package/src/humain/ask-user-question/vendor/ask/locales/zh.json +40 -0
- package/src/humain/ask-user-question/vendor/config/LICENSE +21 -0
- package/src/humain/ask-user-question/vendor/i18n/LICENSE +21 -0
- package/src/humain/caveman/UPSTREAM.md +44 -11
- package/src/humain/caveman/upstream.json +3 -3
- package/src/humain/caveman/vendor/NOTICE +4 -0
- package/dist/bundle/chunks/anthropic-messages-XFCDMGD6.js +0 -77
- package/dist/bundle/chunks/azure-openai-responses-F4KQM3NK.js +0 -15
- package/dist/bundle/chunks/bowser-DXKSTXFQ.js +0 -89
- package/dist/bundle/chunks/chunk-3E37CJCE.js +0 -34
- package/dist/bundle/chunks/chunk-3HVHETMU.js +0 -18
- package/dist/bundle/chunks/chunk-3PJ7NPWN.js +0 -80
- package/dist/bundle/chunks/chunk-6JTCRCNF.js +0 -74
- package/dist/bundle/chunks/chunk-F77J5EQZ.js +0 -3
- package/dist/bundle/chunks/chunk-GPLWWO5Q.js +0 -121
- package/dist/bundle/chunks/chunk-GV5OVRKK.js +0 -4
- package/dist/bundle/chunks/chunk-JBSWWCT5.js +0 -12
- package/dist/bundle/chunks/chunk-JQBZUFH7.js +0 -3580
- package/dist/bundle/chunks/chunk-JWOPWHVH.js +0 -51
- package/dist/bundle/chunks/chunk-KRBELWQH.js +0 -7
- package/dist/bundle/chunks/chunk-PFBAIRCY.js +0 -56
- package/dist/bundle/chunks/chunk-Q5RKNQ2T.js +0 -73
- package/dist/bundle/chunks/chunk-QFDZEUFU.js +0 -12
- package/dist/bundle/chunks/chunk-SKCJ25SX.js +0 -24
- package/dist/bundle/chunks/chunk-UEW6TUSP.js +0 -36
- package/dist/bundle/chunks/chunk-UZOIHLNU.js +0 -23
- package/dist/bundle/chunks/chunk-YSWDFV2L.js +0 -11
- package/dist/bundle/chunks/chunk-YZMQXAJM.js +0 -8
- package/dist/bundle/chunks/entry-2GZ3PTWQ.js +0 -2
- package/dist/bundle/chunks/google-generative-ai-WIASMWS3.js +0 -22
- package/dist/bundle/chunks/google-vertex-WSPHRZIZ.js +0 -25
- package/dist/bundle/chunks/interactive-mode-SDUO5OLD.js +0 -5
- package/dist/bundle/chunks/mistral-conversations-7JYDDRUT.js +0 -43
- package/dist/bundle/chunks/openai-codex-responses-7PAML4NF.js +0 -102
- package/dist/bundle/chunks/openai-completions-UJDAIGTK.js +0 -87
- package/dist/bundle/chunks/openai-responses-2WNCE6AY.js +0 -26
- package/dist/bundle/chunks/openrouter-images-V3UCCO6X.js +0 -8
- package/dist/bundle/chunks/pi-messages-TQ7LJUNQ.js +0 -28
- package/dist/bundle/chunks/runtime-H7LYNKCZ.js +0 -2
- package/dist/bundle/chunks/session-picker-EYKCMFQR.js +0 -4
- package/dist/bundle/chunks/startup-ui-7ODOR34R.js +0 -3
- package/dist/bundle/chunks/typesafe-system-one-YP7GGN4C.js +0 -3
- package/dist/bundle/chunks/virtual-modules-IU5KWB2C.js +0 -28
|
@@ -0,0 +1,990 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure checklist store: state machine, FNV-1a 3-char id allocation,
|
|
3
|
+
* cycle detection, ready/blockedBy views, replace/append, reconstruct.
|
|
4
|
+
*
|
|
5
|
+
* No pi / TUI imports — testable with plain node.
|
|
6
|
+
*/
|
|
7
|
+
import { CHECKLIST_TOOLS, isChecklistSnapshot, isDisplayMode, isStatusStyle, isUsageMode, } from "./types.js";
|
|
8
|
+
const ID_PATTERN = /^[a-z0-9]{3}$/;
|
|
9
|
+
const ALPHABET = "0123456789abcdefghijklmnopqrstuvwxyz"; // 36
|
|
10
|
+
const RESERVED_IDS = new Set(["all"]);
|
|
11
|
+
const TASK_STATUSES = ["planned", "ongoing", "done", "cancelled"];
|
|
12
|
+
/** Session checklists stay deliberately small and scannable. */
|
|
13
|
+
export const MAX_CHECKLIST_TASKS = 10;
|
|
14
|
+
/** Preview-gated subtasks stay even smaller: a fixed cap per parent task,
|
|
15
|
+
* not user-changeable (like MAX_CHECKLIST_TASKS). */
|
|
16
|
+
export const MAX_SUBTASKS_PER_TASK = 3;
|
|
17
|
+
/** Error thrown when a subtask payload arrives while the preview is off. */
|
|
18
|
+
function subtasksPreviewError() {
|
|
19
|
+
return new Error("subtasks are a preview feature (disabled): enable them with /checklist settings subtasks before adding or editing subtasks");
|
|
20
|
+
}
|
|
21
|
+
// ---------------------------------------------------------------------------
|
|
22
|
+
// Task meta (preview): flat key → string | number | boolean
|
|
23
|
+
// ---------------------------------------------------------------------------
|
|
24
|
+
/** Meta stays tiny on purpose: it is prompt/dialog-visible, not a database. */
|
|
25
|
+
export const MAX_META_KEYS = 10;
|
|
26
|
+
export const MAX_META_KEY_LENGTH = 40;
|
|
27
|
+
export const MAX_META_STRING_LENGTH = 200;
|
|
28
|
+
/** Error thrown when a non-empty `meta` payload arrives while the preview is off. */
|
|
29
|
+
function metaPreviewError() {
|
|
30
|
+
return new Error("task meta is a preview feature (disabled): enable it with /checklist settings meta before setting meta");
|
|
31
|
+
}
|
|
32
|
+
function isPlainObject(raw) {
|
|
33
|
+
return typeof raw === "object" && raw !== null && !Array.isArray(raw);
|
|
34
|
+
}
|
|
35
|
+
/** Reject a meta payload while the preview is off (`undefined` and `{}` are no-ops). */
|
|
36
|
+
function assertMetaAllowed(raw, enabled) {
|
|
37
|
+
if (raw === undefined || enabled)
|
|
38
|
+
return;
|
|
39
|
+
if (isPlainObject(raw) && Object.keys(raw).length === 0)
|
|
40
|
+
return;
|
|
41
|
+
throw metaPreviewError();
|
|
42
|
+
}
|
|
43
|
+
function normalizeMetaKey(rawKey, label) {
|
|
44
|
+
const key = rawKey.trim();
|
|
45
|
+
if (key.length === 0 || key.length > MAX_META_KEY_LENGTH || key === "__proto__") {
|
|
46
|
+
throw new Error(`${label} meta key ${JSON.stringify(rawKey)} is invalid: use 1–${MAX_META_KEY_LENGTH} chars (not "__proto__")`);
|
|
47
|
+
}
|
|
48
|
+
return key;
|
|
49
|
+
}
|
|
50
|
+
function checkMetaValue(value, key, label) {
|
|
51
|
+
if (typeof value === "string") {
|
|
52
|
+
if (value.length > MAX_META_STRING_LENGTH) {
|
|
53
|
+
throw new Error(`${label} meta "${key}" is too long: string values are limited to ${MAX_META_STRING_LENGTH} chars`);
|
|
54
|
+
}
|
|
55
|
+
return value;
|
|
56
|
+
}
|
|
57
|
+
if (typeof value === "number" && Number.isFinite(value))
|
|
58
|
+
return value;
|
|
59
|
+
if (typeof value === "boolean")
|
|
60
|
+
return value;
|
|
61
|
+
throw new Error(`${label} meta "${key}" must be a string, number or boolean (null deletes the key on update); got ${JSON.stringify(value) ?? String(value)}`);
|
|
62
|
+
}
|
|
63
|
+
/** Merge a meta patch into `existing`: new keys set, existing overwritten,
|
|
64
|
+
* `null` deletes. Pure — returns a fresh object (or `undefined` when empty)
|
|
65
|
+
* plus human-readable change parts (`k=v` / `-k`). Deleting an absent key is
|
|
66
|
+
* a no-op, so create (existing = undefined) simply skips nulls. */
|
|
67
|
+
export function mergeMeta(existing, raw, label) {
|
|
68
|
+
if (!isPlainObject(raw)) {
|
|
69
|
+
throw new Error(`${label} meta must be an object of key/value pairs (string, number or boolean values; null deletes a key)`);
|
|
70
|
+
}
|
|
71
|
+
const out = { ...(existing ?? {}) };
|
|
72
|
+
const parts = [];
|
|
73
|
+
for (const [rawKey, value] of Object.entries(raw)) {
|
|
74
|
+
const key = normalizeMetaKey(rawKey, label);
|
|
75
|
+
if (value === null) {
|
|
76
|
+
if (Object.hasOwn(out, key)) {
|
|
77
|
+
delete out[key];
|
|
78
|
+
parts.push(`-${key}`);
|
|
79
|
+
}
|
|
80
|
+
continue;
|
|
81
|
+
}
|
|
82
|
+
out[key] = checkMetaValue(value, key, label);
|
|
83
|
+
parts.push(`${key}=${JSON.stringify(out[key])}`);
|
|
84
|
+
}
|
|
85
|
+
if (Object.keys(out).length > MAX_META_KEYS) {
|
|
86
|
+
throw new Error(`${label} meta supports at most ${MAX_META_KEYS} keys: delete some (key: null) first`);
|
|
87
|
+
}
|
|
88
|
+
return { meta: Object.keys(out).length > 0 ? out : undefined, parts };
|
|
89
|
+
}
|
|
90
|
+
/** Compact `{k="v", n=1}` text for LLM-facing output. */
|
|
91
|
+
export function formatMeta(meta) {
|
|
92
|
+
if (!meta)
|
|
93
|
+
return "";
|
|
94
|
+
const entries = Object.entries(meta);
|
|
95
|
+
if (entries.length === 0)
|
|
96
|
+
return "";
|
|
97
|
+
return `{${entries.map(([k, v]) => `${k}=${JSON.stringify(v)}`).join(", ")}}`;
|
|
98
|
+
}
|
|
99
|
+
// ---------------------------------------------------------------------------
|
|
100
|
+
// Id allocation (FNV-1a of normalized title, base36, salt on collision)
|
|
101
|
+
// ---------------------------------------------------------------------------
|
|
102
|
+
function fnv1a(s) {
|
|
103
|
+
let h = 0x811c9dc5;
|
|
104
|
+
for (let i = 0; i < s.length; i++) {
|
|
105
|
+
h ^= s.charCodeAt(i);
|
|
106
|
+
h = Math.imul(h, 0x01000193);
|
|
107
|
+
}
|
|
108
|
+
return h >>> 0;
|
|
109
|
+
}
|
|
110
|
+
function encode3(n) {
|
|
111
|
+
let x = n >>> 0;
|
|
112
|
+
let out = "";
|
|
113
|
+
for (let i = 0; i < 3; i++) {
|
|
114
|
+
out = ALPHABET[x % 36] + out;
|
|
115
|
+
x = Math.floor(x / 36);
|
|
116
|
+
}
|
|
117
|
+
return out;
|
|
118
|
+
}
|
|
119
|
+
function normalizeTitleKey(title) {
|
|
120
|
+
return title
|
|
121
|
+
.toLowerCase()
|
|
122
|
+
.replace(/[^a-z0-9]+/g, " ")
|
|
123
|
+
.trim();
|
|
124
|
+
}
|
|
125
|
+
function allocId(title, used) {
|
|
126
|
+
const key = normalizeTitleKey(title);
|
|
127
|
+
for (let salt = 0; salt < 64; salt++) {
|
|
128
|
+
const id = encode3(fnv1a(salt === 0 ? key : `${key}\0${salt}`));
|
|
129
|
+
if (!used.has(id) && !RESERVED_IDS.has(id))
|
|
130
|
+
return id;
|
|
131
|
+
}
|
|
132
|
+
throw new Error("could not allocate a free 3-char id (list is nearly full)");
|
|
133
|
+
}
|
|
134
|
+
/** Validate a caller-supplied id; returns the lowercased id. Throws on invalid. */
|
|
135
|
+
function normalizeId(raw) {
|
|
136
|
+
if (typeof raw !== "string" || !ID_PATTERN.test(raw.toLowerCase())) {
|
|
137
|
+
throw new Error(`invalid task id ${JSON.stringify(raw)}: must be exactly 3 alphanumeric chars [a-z0-9] (e.g. "k7q")`);
|
|
138
|
+
}
|
|
139
|
+
const id = raw.toLowerCase();
|
|
140
|
+
if (RESERVED_IDS.has(id)) {
|
|
141
|
+
throw new Error(`invalid task id "all": reserved word`);
|
|
142
|
+
}
|
|
143
|
+
return id;
|
|
144
|
+
}
|
|
145
|
+
/** Coerce dependsOn (string | string[] | undefined) to a lowercased string[]. */
|
|
146
|
+
function coerceDependsOn(raw) {
|
|
147
|
+
if (raw === undefined)
|
|
148
|
+
return [];
|
|
149
|
+
const arr = typeof raw === "string" ? [raw] : raw;
|
|
150
|
+
if (!Array.isArray(arr) || !arr.every((v) => typeof v === "string")) {
|
|
151
|
+
throw new Error(`invalid dependsOn ${JSON.stringify(raw)}: must be a 3-char id or an array of 3-char ids`);
|
|
152
|
+
}
|
|
153
|
+
return arr.map((v) => normalizeId(v));
|
|
154
|
+
}
|
|
155
|
+
// ---------------------------------------------------------------------------
|
|
156
|
+
// State machine
|
|
157
|
+
// ---------------------------------------------------------------------------
|
|
158
|
+
const ALLOWED = new Set([
|
|
159
|
+
"planned>ongoing",
|
|
160
|
+
"planned>done",
|
|
161
|
+
"planned>cancelled",
|
|
162
|
+
"ongoing>done",
|
|
163
|
+
"ongoing>cancelled",
|
|
164
|
+
"ongoing>planned",
|
|
165
|
+
"cancelled>planned",
|
|
166
|
+
]);
|
|
167
|
+
function canTransition(from, to) {
|
|
168
|
+
if (from === to)
|
|
169
|
+
return true; // no-op
|
|
170
|
+
return ALLOWED.has(`${from}>${to}`);
|
|
171
|
+
}
|
|
172
|
+
function assertTransition(from, to, id) {
|
|
173
|
+
if (from === to)
|
|
174
|
+
return;
|
|
175
|
+
if (from === "done") {
|
|
176
|
+
throw new Error(`task ${id} is done (terminal in v1): cannot move done → ${to}; create a new task instead`);
|
|
177
|
+
}
|
|
178
|
+
if (!canTransition(from, to)) {
|
|
179
|
+
throw new Error(`illegal transition for task ${id}: ${from} → ${to}`);
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
// ---------------------------------------------------------------------------
|
|
183
|
+
// Display mode (statusbar | end-of-turn | hidden)
|
|
184
|
+
// ---------------------------------------------------------------------------
|
|
185
|
+
/** Resolve the effective display mode, migrating legacy widgetVisible. */
|
|
186
|
+
export function resolveDisplayMode(snapshot) {
|
|
187
|
+
if (isDisplayMode(snapshot.displayMode))
|
|
188
|
+
return snapshot.displayMode;
|
|
189
|
+
if (snapshot.widgetVisible === false)
|
|
190
|
+
return "hidden";
|
|
191
|
+
return "statusbar";
|
|
192
|
+
}
|
|
193
|
+
/** Resolve the effective status style. Default "pill" preserves the
|
|
194
|
+
* long-standing status-word look (now rendered on a colored background). */
|
|
195
|
+
export function resolveStatusStyle(snapshot) {
|
|
196
|
+
if (isStatusStyle(snapshot.statusStyle))
|
|
197
|
+
return snapshot.statusStyle;
|
|
198
|
+
return "pill";
|
|
199
|
+
}
|
|
200
|
+
/** Resolve the effective usage-guidance mode. Default "moderate". */
|
|
201
|
+
export function resolveUsage(snapshot) {
|
|
202
|
+
if (isUsageMode(snapshot.usage))
|
|
203
|
+
return snapshot.usage;
|
|
204
|
+
return "moderate";
|
|
205
|
+
}
|
|
206
|
+
/** Resolve whether the subtasks preview is enabled. Default `false`.
|
|
207
|
+
* Precedence is handled by the caller (global prefs file > snapshot). */
|
|
208
|
+
export function resolveSubtasksEnabled(snapshot) {
|
|
209
|
+
return snapshot.subtasksEnabled === true;
|
|
210
|
+
}
|
|
211
|
+
/** Resolve whether the task meta preview is enabled. Default `false`.
|
|
212
|
+
* Precedence is handled by the caller (global prefs file > snapshot). */
|
|
213
|
+
export function resolveMetaEnabled(snapshot) {
|
|
214
|
+
return snapshot.metaEnabled === true;
|
|
215
|
+
}
|
|
216
|
+
// ---------------------------------------------------------------------------
|
|
217
|
+
// Views
|
|
218
|
+
// ---------------------------------------------------------------------------
|
|
219
|
+
function toView(task, byId) {
|
|
220
|
+
const blockedBy = task.dependsOn.filter((dep) => byId.get(dep)?.status !== "done");
|
|
221
|
+
const subs = task.subtasks ?? [];
|
|
222
|
+
const sibById = new Map(subs.map((s) => [s.id, s]));
|
|
223
|
+
return {
|
|
224
|
+
...task,
|
|
225
|
+
dependsOn: [...task.dependsOn],
|
|
226
|
+
subtasks: subs.map((s) => ({ ...s, dependsOn: [...s.dependsOn], ...(s.meta ? { meta: { ...s.meta } } : {}) })),
|
|
227
|
+
...(task.meta ? { meta: { ...task.meta } } : {}),
|
|
228
|
+
ready: task.status === "planned" && blockedBy.length === 0,
|
|
229
|
+
blockedBy,
|
|
230
|
+
blocked: blockedBy.length > 0,
|
|
231
|
+
subtaskViews: subs.map((s) => toSubtaskView(s, sibById, blockedBy)),
|
|
232
|
+
};
|
|
233
|
+
}
|
|
234
|
+
/** Effective subtask view: `blockedBy` is sibling deps not done PLUS the
|
|
235
|
+
* parent's own `blockedBy` when the parent is blocked (primitive S3 —
|
|
236
|
+
* subtasks inherit the parent's blocked state). */
|
|
237
|
+
function toSubtaskView(sub, sibById, parentBlockedBy) {
|
|
238
|
+
const sibBlocked = sub.dependsOn.filter((dep) => sibById.get(dep)?.status !== "done");
|
|
239
|
+
const blockedBy = [...sibBlocked, ...parentBlockedBy.filter((d) => !sibBlocked.includes(d))];
|
|
240
|
+
return {
|
|
241
|
+
...sub,
|
|
242
|
+
dependsOn: [...sub.dependsOn],
|
|
243
|
+
...(sub.meta ? { meta: { ...sub.meta } } : {}),
|
|
244
|
+
ready: sub.status === "planned" && blockedBy.length === 0,
|
|
245
|
+
blockedBy,
|
|
246
|
+
blocked: blockedBy.length > 0,
|
|
247
|
+
};
|
|
248
|
+
}
|
|
249
|
+
export function viewsOf(checklist) {
|
|
250
|
+
const byId = new Map(checklist.tasks.map((t) => [t.id, t]));
|
|
251
|
+
return checklist.tasks.map((t) => toView(t, byId));
|
|
252
|
+
}
|
|
253
|
+
/** Sort order: ongoing, ready planned, blocked planned, done, cancelled. */
|
|
254
|
+
export function sortViews(views) {
|
|
255
|
+
const rank = (v) => {
|
|
256
|
+
if (v.status === "ongoing")
|
|
257
|
+
return 0;
|
|
258
|
+
if (v.status === "planned" && !v.blocked)
|
|
259
|
+
return 1;
|
|
260
|
+
if (v.status === "planned")
|
|
261
|
+
return 2;
|
|
262
|
+
if (v.status === "done")
|
|
263
|
+
return 3;
|
|
264
|
+
return 4;
|
|
265
|
+
};
|
|
266
|
+
return [...views].sort((a, b) => rank(a) - rank(b) || a.createdAt - b.createdAt);
|
|
267
|
+
}
|
|
268
|
+
// ---------------------------------------------------------------------------
|
|
269
|
+
// Cycle detection
|
|
270
|
+
// ---------------------------------------------------------------------------
|
|
271
|
+
/** True if the dep graph (id → dependsOn) contains a cycle. */
|
|
272
|
+
function hasCycle(graph) {
|
|
273
|
+
const state = new Map(); // 1 = in stack, 2 = done
|
|
274
|
+
const visit = (id) => {
|
|
275
|
+
const s = state.get(id);
|
|
276
|
+
if (s === 1)
|
|
277
|
+
return true;
|
|
278
|
+
if (s === 2)
|
|
279
|
+
return false;
|
|
280
|
+
state.set(id, 1);
|
|
281
|
+
for (const dep of graph.get(id) ?? []) {
|
|
282
|
+
if (visit(dep))
|
|
283
|
+
return true;
|
|
284
|
+
}
|
|
285
|
+
state.set(id, 2);
|
|
286
|
+
return false;
|
|
287
|
+
};
|
|
288
|
+
for (const id of graph.keys()) {
|
|
289
|
+
if (visit(id))
|
|
290
|
+
return true;
|
|
291
|
+
}
|
|
292
|
+
return false;
|
|
293
|
+
}
|
|
294
|
+
/** Build + validate a parent's subtasks (create path). Ids are allocated
|
|
295
|
+
* from the shared checklist-wide `used` set (unique across tasks AND
|
|
296
|
+
* subtasks); `dependsOn` must stay inside the sibling set. */
|
|
297
|
+
function buildSubtasks(parentId, raw, used, taskIdSet, subtasksEnabled, metaEnabled, now) {
|
|
298
|
+
if (raw === undefined)
|
|
299
|
+
return [];
|
|
300
|
+
if (!Array.isArray(raw)) {
|
|
301
|
+
throw new Error(`task ${parentId} subtasks must be an array`);
|
|
302
|
+
}
|
|
303
|
+
if (raw.length === 0)
|
|
304
|
+
return [];
|
|
305
|
+
if (!subtasksEnabled)
|
|
306
|
+
throw subtasksPreviewError();
|
|
307
|
+
if (raw.length > MAX_SUBTASKS_PER_TASK) {
|
|
308
|
+
throw new Error(`task ${parentId} supports at most ${MAX_SUBTASKS_PER_TASK} subtasks (preview): got ${raw.length}`);
|
|
309
|
+
}
|
|
310
|
+
// Pass 1: explicit ids first (same-batch DAGs), then hashed titles.
|
|
311
|
+
const ids = new Array(raw.length);
|
|
312
|
+
raw.forEach((s, i) => {
|
|
313
|
+
if (typeof s !== "object" || s === null)
|
|
314
|
+
throw new Error(`subtask at index ${i} of task ${parentId} must be an object`);
|
|
315
|
+
const rawId = s.id;
|
|
316
|
+
if (rawId !== undefined) {
|
|
317
|
+
const id = normalizeId(rawId);
|
|
318
|
+
if (used.has(id))
|
|
319
|
+
throw new Error(`duplicate subtask id "${id}" (task ${parentId}, index ${i})`);
|
|
320
|
+
used.add(id);
|
|
321
|
+
ids[i] = id;
|
|
322
|
+
}
|
|
323
|
+
});
|
|
324
|
+
raw.forEach((s, i) => {
|
|
325
|
+
if (ids[i] !== undefined)
|
|
326
|
+
return;
|
|
327
|
+
const title = requireTitle(s.title, i);
|
|
328
|
+
const id = allocId(`${parentId} ${title}`, used);
|
|
329
|
+
used.add(id);
|
|
330
|
+
ids[i] = id;
|
|
331
|
+
});
|
|
332
|
+
// Pass 2: resolve sibling dependsOn, build subtasks.
|
|
333
|
+
const sibSet = new Set(ids);
|
|
334
|
+
const fresh = raw.map((s, i) => {
|
|
335
|
+
const sub = s;
|
|
336
|
+
const title = requireTitle(sub.title, i);
|
|
337
|
+
const id = ids[i];
|
|
338
|
+
if (sub !== null &&
|
|
339
|
+
typeof sub === "object" &&
|
|
340
|
+
"status" in sub &&
|
|
341
|
+
sub.status !== undefined) {
|
|
342
|
+
throw new Error(`subtask ${id} (task ${parentId}) is born planned: omit status at create, start it via checklist_update`);
|
|
343
|
+
}
|
|
344
|
+
const dependsOn = coerceDependsOn(sub.dependsOn);
|
|
345
|
+
assertSiblingDeps(parentId, id, dependsOn, sibSet, used, taskIdSet);
|
|
346
|
+
let notes;
|
|
347
|
+
if (sub.notes !== undefined) {
|
|
348
|
+
if (typeof sub.notes !== "string")
|
|
349
|
+
throw new Error(`subtask ${id} notes must be a string`);
|
|
350
|
+
notes = sub.notes;
|
|
351
|
+
}
|
|
352
|
+
const built = { id, title, status: "planned", dependsOn, createdAt: now, updatedAt: now };
|
|
353
|
+
if (notes !== undefined)
|
|
354
|
+
built.notes = notes;
|
|
355
|
+
assertMetaAllowed(sub.meta, metaEnabled);
|
|
356
|
+
if (sub.meta !== undefined) {
|
|
357
|
+
const { meta } = mergeMeta(undefined, sub.meta, `subtask ${id}`);
|
|
358
|
+
if (meta)
|
|
359
|
+
built.meta = meta;
|
|
360
|
+
}
|
|
361
|
+
return built;
|
|
362
|
+
});
|
|
363
|
+
assertAcyclic(new Map(fresh.map((s) => [s.id, [...s.dependsOn]])), `subtask cycle in task ${parentId} detected: dependsOn would create a loop`);
|
|
364
|
+
return fresh;
|
|
365
|
+
}
|
|
366
|
+
/** Validate a subtask dep list against its sibling set. Refs to task ids,
|
|
367
|
+
* other parents' subtasks, or totally unknown ids are rejected — subtasks
|
|
368
|
+
* may only depend on siblings within the same parent task. */
|
|
369
|
+
function assertSiblingDeps(parentId, subId, dependsOn, sibSet, used, taskIdSet) {
|
|
370
|
+
if (dependsOn.includes(subId))
|
|
371
|
+
throw new Error(`subtask ${subId} cannot depend on itself`);
|
|
372
|
+
for (const dep of dependsOn) {
|
|
373
|
+
if (sibSet.has(dep))
|
|
374
|
+
continue;
|
|
375
|
+
if (used.has(dep) || taskIdSet.has(dep)) {
|
|
376
|
+
throw new Error(`subtask ${subId} depends on "${dep}" outside task ${parentId}: subtasks may only depend on siblings within the same parent task`);
|
|
377
|
+
}
|
|
378
|
+
throw new Error(`subtask ${subId} depends on unknown subtask "${dep}" (task ${parentId})`);
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
function assertAcyclic(graph, message = "dependency cycle detected: dependsOn would create a loop") {
|
|
382
|
+
if (hasCycle(graph)) {
|
|
383
|
+
throw new Error(message);
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
// ---------------------------------------------------------------------------
|
|
387
|
+
// Create / append (two-pass: explicit ids, then hashed titles)
|
|
388
|
+
// ---------------------------------------------------------------------------
|
|
389
|
+
function requireTitle(raw, index) {
|
|
390
|
+
if (typeof raw !== "string" || raw.trim().length === 0) {
|
|
391
|
+
throw new Error(`task at index ${index} needs a non-empty title`);
|
|
392
|
+
}
|
|
393
|
+
return raw.trim();
|
|
394
|
+
}
|
|
395
|
+
export function createOrAppend(current, input, now = Date.now(), opts) {
|
|
396
|
+
const mode = input.mode ?? "replace";
|
|
397
|
+
if (mode !== "replace" && mode !== "append") {
|
|
398
|
+
throw new Error(`invalid mode ${JSON.stringify(input.mode)}: use "replace" or "append"`);
|
|
399
|
+
}
|
|
400
|
+
if (!Array.isArray(input.tasks)) {
|
|
401
|
+
throw new Error(`invalid tasks: must be an array`);
|
|
402
|
+
}
|
|
403
|
+
const base = mode === "append" && current ? current.tasks.map((t) => ({ ...t, dependsOn: [...t.dependsOn] })) : [];
|
|
404
|
+
if (base.length + input.tasks.length > MAX_CHECKLIST_TASKS) {
|
|
405
|
+
throw new Error(`checklists support at most ${MAX_CHECKLIST_TASKS} tasks; this ${mode} request would create ${base.length + input.tasks.length}`);
|
|
406
|
+
}
|
|
407
|
+
const baseTaskIds = base.map((t) => t.id);
|
|
408
|
+
const used = new Set(baseTaskIds);
|
|
409
|
+
// Ids are unique across tasks AND subtasks: existing subtask ids are taken too.
|
|
410
|
+
for (const t of base)
|
|
411
|
+
for (const s of t.subtasks ?? [])
|
|
412
|
+
used.add(s.id);
|
|
413
|
+
// Pass 1: allocate ids (explicit first, then hashed).
|
|
414
|
+
const ids = new Array(input.tasks.length);
|
|
415
|
+
input.tasks.forEach((t, i) => {
|
|
416
|
+
if (typeof t !== "object" || t === null)
|
|
417
|
+
throw new Error(`task at index ${i} must be an object`);
|
|
418
|
+
const title = requireTitle(t.title, i);
|
|
419
|
+
void title;
|
|
420
|
+
const rawId = t.id;
|
|
421
|
+
if (rawId !== undefined) {
|
|
422
|
+
const id = normalizeId(rawId);
|
|
423
|
+
if (used.has(id))
|
|
424
|
+
throw new Error(`duplicate task id "${id}" (task at index ${i})`);
|
|
425
|
+
used.add(id);
|
|
426
|
+
ids[i] = id;
|
|
427
|
+
}
|
|
428
|
+
});
|
|
429
|
+
input.tasks.forEach((t, i) => {
|
|
430
|
+
if (ids[i] !== undefined)
|
|
431
|
+
return;
|
|
432
|
+
const title = requireTitle(t.title, i);
|
|
433
|
+
const id = allocId(title, used);
|
|
434
|
+
used.add(id);
|
|
435
|
+
ids[i] = id;
|
|
436
|
+
});
|
|
437
|
+
// Pass 2: resolve dependsOn against existing + new ids, build tasks.
|
|
438
|
+
// taskIdSet stays task-only: tasks may not depend on subtasks.
|
|
439
|
+
const taskIdSet = new Set([...baseTaskIds, ...ids]);
|
|
440
|
+
const subtasksEnabled = opts?.subtasksEnabled === true;
|
|
441
|
+
const metaEnabled = opts?.metaEnabled === true;
|
|
442
|
+
const fresh = input.tasks.map((t, i) => {
|
|
443
|
+
const task = t;
|
|
444
|
+
const title = requireTitle(task.title, i);
|
|
445
|
+
const id = ids[i];
|
|
446
|
+
const dependsOn = coerceDependsOn(task.dependsOn);
|
|
447
|
+
if (dependsOn.includes(id))
|
|
448
|
+
throw new Error(`task ${id} cannot depend on itself`);
|
|
449
|
+
for (const dep of dependsOn) {
|
|
450
|
+
if (used.has(dep) && !taskIdSet.has(dep)) {
|
|
451
|
+
throw new Error(`task ${id} depends on "${dep}": tasks cannot depend on subtasks`);
|
|
452
|
+
}
|
|
453
|
+
if (!taskIdSet.has(dep))
|
|
454
|
+
throw new Error(`task ${id} depends on unknown task "${dep}"`);
|
|
455
|
+
}
|
|
456
|
+
let notes;
|
|
457
|
+
if (task.notes !== undefined) {
|
|
458
|
+
if (typeof task.notes !== "string")
|
|
459
|
+
throw new Error(`task ${id} notes must be a string`);
|
|
460
|
+
notes = task.notes;
|
|
461
|
+
}
|
|
462
|
+
const subs = buildSubtasks(id, task.subtasks, used, taskIdSet, subtasksEnabled, metaEnabled, now);
|
|
463
|
+
const built = { id, title, status: "planned", dependsOn, createdAt: now, updatedAt: now };
|
|
464
|
+
if (notes !== undefined)
|
|
465
|
+
built.notes = notes;
|
|
466
|
+
assertMetaAllowed(task.meta, metaEnabled);
|
|
467
|
+
if (task.meta !== undefined) {
|
|
468
|
+
const { meta } = mergeMeta(undefined, task.meta, `task ${id}`);
|
|
469
|
+
if (meta)
|
|
470
|
+
built.meta = meta;
|
|
471
|
+
}
|
|
472
|
+
if (subs.length > 0)
|
|
473
|
+
built.subtasks = subs;
|
|
474
|
+
return built;
|
|
475
|
+
});
|
|
476
|
+
const tasks = [...base, ...fresh];
|
|
477
|
+
assertAcyclic(new Map(tasks.map((t) => [t.id, [...t.dependsOn]])));
|
|
478
|
+
let title = mode === "append" ? current?.title : undefined;
|
|
479
|
+
if (input.title !== undefined) {
|
|
480
|
+
if (typeof input.title !== "string")
|
|
481
|
+
throw new Error(`invalid title: must be a string`);
|
|
482
|
+
title = input.title.trim() ? input.title.trim() : undefined;
|
|
483
|
+
}
|
|
484
|
+
const checklist = { tasks, updatedAt: now };
|
|
485
|
+
if (title !== undefined)
|
|
486
|
+
checklist.title = title;
|
|
487
|
+
return {
|
|
488
|
+
checklist,
|
|
489
|
+
assigned: fresh.map((t) => ({ id: t.id, title: t.title })),
|
|
490
|
+
};
|
|
491
|
+
}
|
|
492
|
+
/** Every task and subtask id in use. */
|
|
493
|
+
function usedIds(current) {
|
|
494
|
+
const used = new Set();
|
|
495
|
+
for (const t of current?.tasks ?? []) {
|
|
496
|
+
used.add(t.id);
|
|
497
|
+
for (const s of t.subtasks ?? [])
|
|
498
|
+
used.add(s.id);
|
|
499
|
+
}
|
|
500
|
+
return used;
|
|
501
|
+
}
|
|
502
|
+
/** A random free 3-char id (not used by any task or subtask, not reserved).
|
|
503
|
+
* `rng` is injectable for tests. */
|
|
504
|
+
export function suggestTaskId(current, rng = Math.random) {
|
|
505
|
+
const used = usedIds(current);
|
|
506
|
+
for (let attempt = 0; attempt < 256; attempt++) {
|
|
507
|
+
let id = "";
|
|
508
|
+
for (let i = 0; i < 3; i++)
|
|
509
|
+
id += ALPHABET[Math.min(35, Math.floor(rng() * 36))];
|
|
510
|
+
if (!used.has(id) && !RESERVED_IDS.has(id))
|
|
511
|
+
return id;
|
|
512
|
+
}
|
|
513
|
+
return allocId("task", used);
|
|
514
|
+
}
|
|
515
|
+
/** Basic state validation for a manually added task. Checks that the draft is
|
|
516
|
+
* well formed and fits the checklist. It deliberately does NOT look at
|
|
517
|
+
* dependency status: depending on planned/ongoing/blocked tasks is allowed
|
|
518
|
+
* (the new task is simply born `planned` and blocked until they finish). */
|
|
519
|
+
export function validateAddTask(current, draft) {
|
|
520
|
+
const errors = {};
|
|
521
|
+
const tasks = current?.tasks ?? [];
|
|
522
|
+
if (tasks.length >= MAX_CHECKLIST_TASKS) {
|
|
523
|
+
errors.form = `the checklist is full (${tasks.length}/${MAX_CHECKLIST_TASKS} tasks)`;
|
|
524
|
+
}
|
|
525
|
+
const id = typeof draft.id === "string" ? draft.id.trim().toLowerCase() : "";
|
|
526
|
+
if (!ID_PATTERN.test(id)) {
|
|
527
|
+
errors.id = "the id must be exactly 3 characters: a–z and 0–9";
|
|
528
|
+
}
|
|
529
|
+
else if (RESERVED_IDS.has(id)) {
|
|
530
|
+
errors.id = `"${id}" is a reserved word`;
|
|
531
|
+
}
|
|
532
|
+
else {
|
|
533
|
+
const owner = tasks.find((t) => t.id === id) ?? tasks.find((t) => (t.subtasks ?? []).some((s) => s.id === id));
|
|
534
|
+
if (owner) {
|
|
535
|
+
errors.id =
|
|
536
|
+
owner.id === id
|
|
537
|
+
? `id "${id}" is already used by a task`
|
|
538
|
+
: `id "${id}" is already used by a subtask of ${owner.id}`;
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
if (typeof draft.title !== "string" || draft.title.trim().length === 0) {
|
|
542
|
+
errors.title = "the task text can't be empty";
|
|
543
|
+
}
|
|
544
|
+
const taskIds = new Set(tasks.map((t) => t.id));
|
|
545
|
+
const missing = (Array.isArray(draft.dependsOn) ? draft.dependsOn : []).filter((d) => !taskIds.has(String(d).toLowerCase()));
|
|
546
|
+
if (missing.length > 0) {
|
|
547
|
+
errors.dependsOn = `unknown task${missing.length > 1 ? "s" : ""}: ${missing.join(", ")}`;
|
|
548
|
+
}
|
|
549
|
+
return errors;
|
|
550
|
+
}
|
|
551
|
+
/** Validate and append one manually entered task (born `planned`). */
|
|
552
|
+
export function addTask(current, draft, now = Date.now(), opts) {
|
|
553
|
+
const errors = validateAddTask(current, draft);
|
|
554
|
+
if (Object.keys(errors).length > 0)
|
|
555
|
+
return { ok: false, errors };
|
|
556
|
+
try {
|
|
557
|
+
const dependsOn = [...new Set(draft.dependsOn.map((d) => d.toLowerCase()))];
|
|
558
|
+
const { checklist } = createOrAppend(current, { mode: "append", tasks: [{ id: draft.id.trim().toLowerCase(), title: draft.title, dependsOn }] }, now, opts);
|
|
559
|
+
return { ok: true, checklist, task: checklist.tasks[checklist.tasks.length - 1] };
|
|
560
|
+
}
|
|
561
|
+
catch (err) {
|
|
562
|
+
// validateAddTask covers the expected cases; this keeps any other store
|
|
563
|
+
// rule (e.g. a future one) from escaping as an exception into the TUI.
|
|
564
|
+
return { ok: false, errors: { form: err instanceof Error ? err.message : String(err) } };
|
|
565
|
+
}
|
|
566
|
+
}
|
|
567
|
+
export function applyUpdates(current, updates, now = Date.now(), opts) {
|
|
568
|
+
if (!current || current.tasks.length === 0) {
|
|
569
|
+
throw new Error("no checklist yet: use checklist_create first");
|
|
570
|
+
}
|
|
571
|
+
if (!Array.isArray(updates) || updates.length === 0) {
|
|
572
|
+
throw new Error("invalid updates: must be a non-empty array");
|
|
573
|
+
}
|
|
574
|
+
// Validate everything against a working copy, then commit.
|
|
575
|
+
// Subtasks are deep-copied too: staging mutates them before the batch commits.
|
|
576
|
+
const next = current.tasks.map((t) => ({
|
|
577
|
+
...t,
|
|
578
|
+
dependsOn: [...t.dependsOn],
|
|
579
|
+
...(t.subtasks ? { subtasks: t.subtasks.map((s) => ({ ...s, dependsOn: [...s.dependsOn] })) } : {}),
|
|
580
|
+
}));
|
|
581
|
+
// meta objects are replaced (never mutated in place) by mergeMeta, so the
|
|
582
|
+
// shallow copies above are safe to stage against.
|
|
583
|
+
const metaEnabled = opts?.metaEnabled === true;
|
|
584
|
+
const byId = new Map(next.map((t) => [t.id, t]));
|
|
585
|
+
const changes = [];
|
|
586
|
+
// Normalize inputs first (ids lowercased, dependsOn coerced) so validation
|
|
587
|
+
// sees exactly what would be applied.
|
|
588
|
+
const normalized = updates.map((u, i) => {
|
|
589
|
+
if (typeof u !== "object" || u === null)
|
|
590
|
+
throw new Error(`update at index ${i} must be an object`);
|
|
591
|
+
const id = normalizeId(u.id);
|
|
592
|
+
const task = byId.get(id);
|
|
593
|
+
if (!task)
|
|
594
|
+
throw new Error(`unknown task id "${id}" (update at index ${i})`);
|
|
595
|
+
return { index: i, id, task, update: u };
|
|
596
|
+
});
|
|
597
|
+
// Duplicate ids in one batch touch the same task twice — reject, since
|
|
598
|
+
// per-update transition checks would otherwise see intermediate states.
|
|
599
|
+
const seen = new Set();
|
|
600
|
+
for (const n of normalized) {
|
|
601
|
+
if (seen.has(n.id))
|
|
602
|
+
throw new Error(`duplicate update for task "${n.id}": send one update per task`);
|
|
603
|
+
seen.add(n.id);
|
|
604
|
+
}
|
|
605
|
+
// Field edits + status checks (status guard needs final deps, so dep edits
|
|
606
|
+
// are staged first, then status transitions are checked last).
|
|
607
|
+
const statusMoves = [];
|
|
608
|
+
for (const n of normalized) {
|
|
609
|
+
const { task, update, index } = n;
|
|
610
|
+
assertMetaAllowed(update.meta, metaEnabled);
|
|
611
|
+
if (task.status === "done") {
|
|
612
|
+
const touchesStatus = update.status !== undefined && update.status !== "done";
|
|
613
|
+
if (touchesStatus ||
|
|
614
|
+
update.title !== undefined ||
|
|
615
|
+
update.notes !== undefined ||
|
|
616
|
+
update.dependsOn !== undefined ||
|
|
617
|
+
update.meta !== undefined) {
|
|
618
|
+
throw new Error(`task ${n.id} is done (frozen in v1): cannot edit; create a new task instead (update at index ${index})`);
|
|
619
|
+
}
|
|
620
|
+
continue;
|
|
621
|
+
}
|
|
622
|
+
if (update.title !== undefined) {
|
|
623
|
+
if (typeof update.title !== "string" || update.title.trim().length === 0) {
|
|
624
|
+
throw new Error(`task ${n.id} title must be a non-empty string`);
|
|
625
|
+
}
|
|
626
|
+
if (update.title.trim() !== task.title) {
|
|
627
|
+
changes.push(`${n.id} retitled "${task.title}" → "${update.title.trim()}"`);
|
|
628
|
+
task.title = update.title.trim();
|
|
629
|
+
}
|
|
630
|
+
}
|
|
631
|
+
if (update.notes !== undefined) {
|
|
632
|
+
if (typeof update.notes !== "string")
|
|
633
|
+
throw new Error(`task ${n.id} notes must be a string`);
|
|
634
|
+
task.notes = update.notes;
|
|
635
|
+
changes.push(`${n.id} notes updated`);
|
|
636
|
+
}
|
|
637
|
+
if (update.meta !== undefined) {
|
|
638
|
+
const { meta, parts } = mergeMeta(task.meta, update.meta, `task ${n.id}`);
|
|
639
|
+
if (meta)
|
|
640
|
+
task.meta = meta;
|
|
641
|
+
else
|
|
642
|
+
delete task.meta;
|
|
643
|
+
if (parts.length > 0)
|
|
644
|
+
changes.push(`${n.id} meta ${parts.join(", ")}`);
|
|
645
|
+
}
|
|
646
|
+
if (update.dependsOn !== undefined) {
|
|
647
|
+
const deps = coerceDependsOn(update.dependsOn);
|
|
648
|
+
if (deps.includes(n.id))
|
|
649
|
+
throw new Error(`task ${n.id} cannot depend on itself`);
|
|
650
|
+
for (const dep of deps) {
|
|
651
|
+
if (!byId.has(dep))
|
|
652
|
+
throw new Error(`task ${n.id} depends on unknown task "${dep}"`);
|
|
653
|
+
}
|
|
654
|
+
task.dependsOn = deps;
|
|
655
|
+
changes.push(`${n.id} dependsOn → [${deps.join(", ")}]`);
|
|
656
|
+
}
|
|
657
|
+
if (update.status !== undefined) {
|
|
658
|
+
if (!TASK_STATUSES.includes(update.status)) {
|
|
659
|
+
throw new Error(`task ${n.id} has invalid status ${JSON.stringify(update.status)}`);
|
|
660
|
+
}
|
|
661
|
+
assertTransition(task.status, update.status, n.id);
|
|
662
|
+
if (task.status !== update.status) {
|
|
663
|
+
statusMoves.push({ task, from: task.status, to: update.status });
|
|
664
|
+
}
|
|
665
|
+
}
|
|
666
|
+
task.updatedAt = now;
|
|
667
|
+
}
|
|
668
|
+
// Subtask staging (adds + field edits + status intents). Runs after the
|
|
669
|
+
// task field loop so parent dep edits are already final in the working
|
|
670
|
+
// copy; status moves commit later (subtasks before tasks — see below).
|
|
671
|
+
const subtasksEnabled = opts?.subtasksEnabled === true;
|
|
672
|
+
const subtaskMoves = [];
|
|
673
|
+
const stagedParentMove = new Map(statusMoves.map((m) => [m.task.id, m.to]));
|
|
674
|
+
// Checklist-wide id space (tasks + existing subtasks) for alloc + scope checks.
|
|
675
|
+
const usedAll = new Set();
|
|
676
|
+
for (const t of next) {
|
|
677
|
+
usedAll.add(t.id);
|
|
678
|
+
for (const s of t.subtasks ?? [])
|
|
679
|
+
usedAll.add(s.id);
|
|
680
|
+
}
|
|
681
|
+
const taskOnlySet = new Set(next.map((t) => t.id));
|
|
682
|
+
for (const n of normalized) {
|
|
683
|
+
const rawSubs = n.update.subtasks;
|
|
684
|
+
if (rawSubs === undefined)
|
|
685
|
+
continue;
|
|
686
|
+
if (!Array.isArray(rawSubs) || rawSubs.length === 0) {
|
|
687
|
+
if (Array.isArray(rawSubs))
|
|
688
|
+
continue;
|
|
689
|
+
throw new Error(`task ${n.id} subtasks must be an array`);
|
|
690
|
+
}
|
|
691
|
+
if (!subtasksEnabled)
|
|
692
|
+
throw subtasksPreviewError();
|
|
693
|
+
const parent = n.task;
|
|
694
|
+
if (parent.status === "done") {
|
|
695
|
+
throw new Error(`task ${n.id} is done (frozen in v1): cannot edit its subtasks; create a new task instead (update at index ${n.index})`);
|
|
696
|
+
}
|
|
697
|
+
if (parent.status === "cancelled") {
|
|
698
|
+
throw new Error(`task ${n.id} is cancelled: revive it (cancelled → planned) before editing its subtasks (update at index ${n.index})`);
|
|
699
|
+
}
|
|
700
|
+
// A parent finishing alongside its subtasks is the headline batch: it
|
|
701
|
+
// rides in ONE entry ({ status: "done", subtasks: [...] }) — the
|
|
702
|
+
// subtask moves commit first and S1 validates the parent at commit.
|
|
703
|
+
// Cancelling owns the subtasks via the cascade, so mixing any subtask
|
|
704
|
+
// edits with →cancelled is always rejected.
|
|
705
|
+
if (stagedParentMove.get(n.id) === "cancelled") {
|
|
706
|
+
throw new Error(`task ${n.id} moves to cancelled in this batch: drop the subtask edits — the cancel cascade owns the subtasks`);
|
|
707
|
+
}
|
|
708
|
+
const existing = parent.subtasks ?? [];
|
|
709
|
+
const bySubId = new Map(existing.map((s) => [s.id, s]));
|
|
710
|
+
// Classify: id matching an existing subtask = patch; otherwise an add
|
|
711
|
+
// (explicit id when given, hashed title when omitted).
|
|
712
|
+
const addEntries = [];
|
|
713
|
+
const patchEntries = [];
|
|
714
|
+
rawSubs.forEach((e, si) => {
|
|
715
|
+
if (typeof e !== "object" || e === null) {
|
|
716
|
+
throw new Error(`subtask update at index ${si} of task ${n.id} must be an object`);
|
|
717
|
+
}
|
|
718
|
+
const entry = e;
|
|
719
|
+
if (entry.id === undefined) {
|
|
720
|
+
addEntries.push({ entry });
|
|
721
|
+
return;
|
|
722
|
+
}
|
|
723
|
+
const sid = normalizeId(entry.id);
|
|
724
|
+
if (bySubId.has(sid)) {
|
|
725
|
+
if (patchEntries.some((p) => p.sid === sid)) {
|
|
726
|
+
throw new Error(`duplicate update for subtask "${sid}" of task ${n.id}: send one update per subtask`);
|
|
727
|
+
}
|
|
728
|
+
patchEntries.push({ entry, sid });
|
|
729
|
+
}
|
|
730
|
+
else {
|
|
731
|
+
addEntries.push({ entry, explicitId: sid });
|
|
732
|
+
}
|
|
733
|
+
});
|
|
734
|
+
if (existing.length + addEntries.length > MAX_SUBTASKS_PER_TASK) {
|
|
735
|
+
throw new Error(`task ${n.id} supports at most ${MAX_SUBTASKS_PER_TASK} subtasks (preview): this update would create ${existing.length + addEntries.length}`);
|
|
736
|
+
}
|
|
737
|
+
const sibSet = new Set(existing.map((s) => s.id));
|
|
738
|
+
for (const a of addEntries) {
|
|
739
|
+
if (a.explicitId === undefined)
|
|
740
|
+
continue;
|
|
741
|
+
if (usedAll.has(a.explicitId))
|
|
742
|
+
throw new Error(`duplicate subtask id "${a.explicitId}" (task ${n.id})`);
|
|
743
|
+
usedAll.add(a.explicitId);
|
|
744
|
+
sibSet.add(a.explicitId);
|
|
745
|
+
}
|
|
746
|
+
for (const a of addEntries) {
|
|
747
|
+
if (a.explicitId !== undefined)
|
|
748
|
+
continue;
|
|
749
|
+
const title = requireTitle(a.entry.title, 0);
|
|
750
|
+
const id = allocId(`${n.id} ${title}`, usedAll);
|
|
751
|
+
usedAll.add(id);
|
|
752
|
+
a.explicitId = id;
|
|
753
|
+
sibSet.add(id);
|
|
754
|
+
}
|
|
755
|
+
const builtAdds = addEntries.map((a) => {
|
|
756
|
+
const title = requireTitle(a.entry.title, 0);
|
|
757
|
+
const sid = a.explicitId;
|
|
758
|
+
if (a.entry.status !== undefined) {
|
|
759
|
+
throw new Error(`new subtask ${sid} (task ${n.id}) is born planned: omit status, start it via a later update`);
|
|
760
|
+
}
|
|
761
|
+
const deps = coerceDependsOn(a.entry.dependsOn);
|
|
762
|
+
assertSiblingDeps(n.id, sid, deps, sibSet, usedAll, taskOnlySet);
|
|
763
|
+
let notes;
|
|
764
|
+
if (a.entry.notes !== undefined) {
|
|
765
|
+
if (typeof a.entry.notes !== "string")
|
|
766
|
+
throw new Error(`subtask ${sid} notes must be a string`);
|
|
767
|
+
notes = a.entry.notes;
|
|
768
|
+
}
|
|
769
|
+
const built = { id: sid, title, status: "planned", dependsOn: deps, createdAt: now, updatedAt: now };
|
|
770
|
+
if (notes !== undefined)
|
|
771
|
+
built.notes = notes;
|
|
772
|
+
assertMetaAllowed(a.entry.meta, metaEnabled);
|
|
773
|
+
if (a.entry.meta !== undefined) {
|
|
774
|
+
const { meta } = mergeMeta(undefined, a.entry.meta, `subtask ${sid}`);
|
|
775
|
+
if (meta)
|
|
776
|
+
built.meta = meta;
|
|
777
|
+
}
|
|
778
|
+
changes.push(`${sid} (subtask of ${n.id}) added "${title}"`);
|
|
779
|
+
return built;
|
|
780
|
+
});
|
|
781
|
+
parent.subtasks = [...existing, ...builtAdds];
|
|
782
|
+
for (const { entry, sid } of patchEntries) {
|
|
783
|
+
const sub = bySubId.get(sid);
|
|
784
|
+
assertMetaAllowed(entry.meta, metaEnabled);
|
|
785
|
+
if (sub.status === "done") {
|
|
786
|
+
const touchesStatus = entry.status !== undefined && entry.status !== "done";
|
|
787
|
+
if (touchesStatus ||
|
|
788
|
+
entry.title !== undefined ||
|
|
789
|
+
entry.notes !== undefined ||
|
|
790
|
+
entry.dependsOn !== undefined ||
|
|
791
|
+
entry.meta !== undefined) {
|
|
792
|
+
throw new Error(`subtask ${sid} (task ${n.id}) is done (frozen in v1): cannot edit; create a new task instead`);
|
|
793
|
+
}
|
|
794
|
+
continue;
|
|
795
|
+
}
|
|
796
|
+
if (entry.title !== undefined) {
|
|
797
|
+
if (typeof entry.title !== "string" || entry.title.trim().length === 0) {
|
|
798
|
+
throw new Error(`subtask ${sid} (task ${n.id}) title must be a non-empty string`);
|
|
799
|
+
}
|
|
800
|
+
if (entry.title.trim() !== sub.title) {
|
|
801
|
+
changes.push(`${sid} (subtask of ${n.id}) retitled "${sub.title}" → "${entry.title.trim()}"`);
|
|
802
|
+
sub.title = entry.title.trim();
|
|
803
|
+
}
|
|
804
|
+
}
|
|
805
|
+
if (entry.notes !== undefined) {
|
|
806
|
+
if (typeof entry.notes !== "string")
|
|
807
|
+
throw new Error(`subtask ${sid} (task ${n.id}) notes must be a string`);
|
|
808
|
+
sub.notes = entry.notes;
|
|
809
|
+
changes.push(`${sid} (subtask of ${n.id}) notes updated`);
|
|
810
|
+
}
|
|
811
|
+
if (entry.meta !== undefined) {
|
|
812
|
+
const { meta, parts } = mergeMeta(sub.meta, entry.meta, `subtask ${sid}`);
|
|
813
|
+
if (meta)
|
|
814
|
+
sub.meta = meta;
|
|
815
|
+
else
|
|
816
|
+
delete sub.meta;
|
|
817
|
+
if (parts.length > 0)
|
|
818
|
+
changes.push(`${sid} (subtask of ${n.id}) meta ${parts.join(", ")}`);
|
|
819
|
+
}
|
|
820
|
+
if (entry.dependsOn !== undefined) {
|
|
821
|
+
const deps = coerceDependsOn(entry.dependsOn);
|
|
822
|
+
assertSiblingDeps(n.id, sid, deps, sibSet, usedAll, taskOnlySet);
|
|
823
|
+
sub.dependsOn = deps;
|
|
824
|
+
changes.push(`${sid} (subtask of ${n.id}) dependsOn → [${deps.join(", ")}]`);
|
|
825
|
+
}
|
|
826
|
+
if (entry.status !== undefined) {
|
|
827
|
+
if (!TASK_STATUSES.includes(entry.status)) {
|
|
828
|
+
throw new Error(`subtask ${sid} (task ${n.id}) has invalid status ${JSON.stringify(entry.status)}`);
|
|
829
|
+
}
|
|
830
|
+
assertTransition(sub.status, entry.status, `${sid} (subtask of ${n.id})`);
|
|
831
|
+
if (sub.status !== entry.status) {
|
|
832
|
+
subtaskMoves.push({ parent, sub, from: sub.status, to: entry.status });
|
|
833
|
+
}
|
|
834
|
+
}
|
|
835
|
+
sub.updatedAt = now;
|
|
836
|
+
}
|
|
837
|
+
}
|
|
838
|
+
// Dep guards for moves into ongoing/done from planned, against final deps.
|
|
839
|
+
const finalById = new Map(next.map((t) => [t.id, t]));
|
|
840
|
+
// Commit subtask moves FIRST (primitive S3: sibling + inherited-parent
|
|
841
|
+
// guards) so the S1/S5 task guards below see final subtask states — a
|
|
842
|
+
// batch that finishes the last subtask and the parent together succeeds
|
|
843
|
+
// regardless of entry order.
|
|
844
|
+
const startedParents = new Map(); // parentId → started subtask ids (S2)
|
|
845
|
+
for (const m of subtaskMoves) {
|
|
846
|
+
if (m.from === "planned" && (m.to === "ongoing" || m.to === "done")) {
|
|
847
|
+
const sibById = new Map((m.parent.subtasks ?? []).map((s) => [s.id, s]));
|
|
848
|
+
const sibBlocked = m.sub.dependsOn.filter((dep) => sibById.get(dep)?.status !== "done");
|
|
849
|
+
if (sibBlocked.length > 0) {
|
|
850
|
+
throw new Error(`subtask ${m.sub.id} (task ${m.parent.id}) is blocked by [${sibBlocked.join(", ")}]: cannot move planned → ${m.to} until every sibling dependency is done`);
|
|
851
|
+
}
|
|
852
|
+
const parentBlocked = m.parent.dependsOn.filter((dep) => finalById.get(dep)?.status !== "done");
|
|
853
|
+
if (parentBlocked.length > 0) {
|
|
854
|
+
throw new Error(`subtask ${m.sub.id} inherits parent ${m.parent.id}'s block [${parentBlocked.join(", ")}]: cannot move planned → ${m.to} until the parent is unblocked`);
|
|
855
|
+
}
|
|
856
|
+
}
|
|
857
|
+
m.sub.status = m.to;
|
|
858
|
+
m.sub.updatedAt = now;
|
|
859
|
+
changes.push(`${m.sub.id} (subtask of ${m.parent.id}) ${m.from} → ${m.to}`);
|
|
860
|
+
if (m.from === "planned" && (m.to === "ongoing" || m.to === "done")) {
|
|
861
|
+
const arr = startedParents.get(m.parent.id) ?? [];
|
|
862
|
+
arr.push(m.sub.id);
|
|
863
|
+
startedParents.set(m.parent.id, arr);
|
|
864
|
+
}
|
|
865
|
+
}
|
|
866
|
+
for (const m of statusMoves) {
|
|
867
|
+
if (m.from === "planned" && (m.to === "ongoing" || m.to === "done")) {
|
|
868
|
+
const blockedBy = m.task.dependsOn.filter((dep) => finalById.get(dep)?.status !== "done");
|
|
869
|
+
if (blockedBy.length > 0) {
|
|
870
|
+
throw new Error(`task ${m.task.id} is blocked by [${blockedBy.join(", ")}]: cannot move planned → ${m.to} until every dependency is done`);
|
|
871
|
+
}
|
|
872
|
+
}
|
|
873
|
+
// S1 completion guard: no done parent with open subtasks. Cancelled
|
|
874
|
+
// counts as resolved (otherwise a dropped subtask would brick the parent).
|
|
875
|
+
if (m.to === "done") {
|
|
876
|
+
const open = (m.task.subtasks ?? [])
|
|
877
|
+
.filter((s) => s.status !== "done" && s.status !== "cancelled")
|
|
878
|
+
.map((s) => s.id);
|
|
879
|
+
if (open.length > 0) {
|
|
880
|
+
throw new Error(`task ${m.task.id} has open subtasks [${open.join(", ")}]: finish every subtask (done) before completing the parent`);
|
|
881
|
+
}
|
|
882
|
+
}
|
|
883
|
+
// S5 step-back guard: an ongoing child implies a non-planned parent.
|
|
884
|
+
if (m.from === "ongoing" && m.to === "planned") {
|
|
885
|
+
const running = (m.task.subtasks ?? []).filter((s) => s.status === "ongoing").map((s) => s.id);
|
|
886
|
+
if (running.length > 0) {
|
|
887
|
+
throw new Error(`task ${m.task.id} has ongoing subtasks [${running.join(", ")}]: move them back to planned before moving the parent back to planned`);
|
|
888
|
+
}
|
|
889
|
+
}
|
|
890
|
+
m.task.status = m.to;
|
|
891
|
+
m.task.updatedAt = now;
|
|
892
|
+
changes.push(`${m.task.id} ${m.from} → ${m.to}`);
|
|
893
|
+
// S4 cancel cascade: open subtasks die with the parent. Reviving the
|
|
894
|
+
// parent later does NOT revive them (explicit re-plan required).
|
|
895
|
+
if (m.to === "cancelled") {
|
|
896
|
+
for (const s of m.task.subtasks ?? []) {
|
|
897
|
+
if (s.status === "planned" || s.status === "ongoing") {
|
|
898
|
+
const prev = s.status;
|
|
899
|
+
s.status = "cancelled";
|
|
900
|
+
s.updatedAt = now;
|
|
901
|
+
changes.push(`${s.id} (subtask of ${m.task.id}) ${prev} → cancelled (parent cancelled)`);
|
|
902
|
+
}
|
|
903
|
+
}
|
|
904
|
+
}
|
|
905
|
+
}
|
|
906
|
+
// S2 auto-progress: a subtask that started pulls a planned parent along.
|
|
907
|
+
// (Blocked parents can't appear here — S3 rejects starting their subtasks.)
|
|
908
|
+
for (const task of next) {
|
|
909
|
+
if (task.status !== "planned")
|
|
910
|
+
continue;
|
|
911
|
+
const started = startedParents.get(task.id);
|
|
912
|
+
if (started && started.length > 0) {
|
|
913
|
+
task.status = "ongoing";
|
|
914
|
+
task.updatedAt = now;
|
|
915
|
+
changes.push(`${task.id} planned → ongoing (subtask ${started[0]} started)`);
|
|
916
|
+
}
|
|
917
|
+
}
|
|
918
|
+
assertAcyclic(new Map(next.map((t) => [t.id, [...t.dependsOn]])));
|
|
919
|
+
for (const t of next) {
|
|
920
|
+
const subs = t.subtasks ?? [];
|
|
921
|
+
if (subs.length > 0) {
|
|
922
|
+
assertAcyclic(new Map(subs.map((s) => [s.id, [...s.dependsOn]])), `subtask cycle in task ${t.id} detected: dependsOn would create a loop`);
|
|
923
|
+
}
|
|
924
|
+
}
|
|
925
|
+
return { checklist: { title: current.title, tasks: next, updatedAt: now }, changes };
|
|
926
|
+
}
|
|
927
|
+
export function loadFromBranch(branch) {
|
|
928
|
+
let found = { v: 1, checklist: null };
|
|
929
|
+
for (const entry of branch) {
|
|
930
|
+
if (!entry || typeof entry !== "object")
|
|
931
|
+
continue;
|
|
932
|
+
if (entry.type === "custom" && entry.customType === "pi-checklist" && isChecklistSnapshot(entry.data)) {
|
|
933
|
+
found = entry.data;
|
|
934
|
+
}
|
|
935
|
+
else if (entry.type === "message" &&
|
|
936
|
+
entry.message?.role === "toolResult" &&
|
|
937
|
+
typeof entry.message.toolName === "string" &&
|
|
938
|
+
CHECKLIST_TOOLS.has(entry.message.toolName) &&
|
|
939
|
+
isChecklistSnapshot(entry.message.details)) {
|
|
940
|
+
found = entry.message.details;
|
|
941
|
+
}
|
|
942
|
+
}
|
|
943
|
+
return found;
|
|
944
|
+
}
|
|
945
|
+
// ---------------------------------------------------------------------------
|
|
946
|
+
// Text summaries (LLM-facing) and the before_agent_start snippet
|
|
947
|
+
// ---------------------------------------------------------------------------
|
|
948
|
+
export function countsOf(checklist) {
|
|
949
|
+
const views = viewsOf(checklist);
|
|
950
|
+
const billable = views.filter((v) => v.status !== "cancelled");
|
|
951
|
+
return {
|
|
952
|
+
done: billable.filter((v) => v.status === "done").length,
|
|
953
|
+
total: billable.length,
|
|
954
|
+
ongoing: views.filter((v) => v.status === "ongoing").length,
|
|
955
|
+
ready: views.filter((v) => v.ready).length,
|
|
956
|
+
blocked: views.filter((v) => v.status === "planned" && v.blocked).length,
|
|
957
|
+
};
|
|
958
|
+
}
|
|
959
|
+
export function formatTaskLine(v, showMeta = false) {
|
|
960
|
+
const dep = v.blockedBy.length > 0 ? ` blocked ← ${v.blockedBy.join(", ")}` : "";
|
|
961
|
+
const ready = v.ready ? " ready" : "";
|
|
962
|
+
const notes = v.notes ? ` — ${v.notes}` : "";
|
|
963
|
+
const metaText = showMeta ? formatMeta(v.meta) : "";
|
|
964
|
+
const meta = metaText ? ` ${metaText}` : "";
|
|
965
|
+
const head = `${v.id} [${v.status}]${ready}${dep} "${v.title}"${notes}${meta}`;
|
|
966
|
+
const subs = (v.subtaskViews ?? []).map((s) => {
|
|
967
|
+
const sdep = s.blockedBy.length > 0 ? ` blocked ← ${s.blockedBy.join(", ")}` : "";
|
|
968
|
+
const sready = s.ready ? " ready" : "";
|
|
969
|
+
const sMetaText = showMeta ? formatMeta(s.meta) : "";
|
|
970
|
+
const smeta = sMetaText ? ` ${sMetaText}` : "";
|
|
971
|
+
return `\n ↳ ${s.id} [${s.status}]${sready}${sdep} "${s.title}"${smeta}`;
|
|
972
|
+
});
|
|
973
|
+
return head + subs.join("");
|
|
974
|
+
}
|
|
975
|
+
/** Compact snippet re-injected on before_agent_start so compaction can't hide the list. */
|
|
976
|
+
export function buildInjectSnippet(checklist) {
|
|
977
|
+
const c = countsOf(checklist);
|
|
978
|
+
const views = sortViews(viewsOf(checklist)).filter((v) => v.status !== "done" && v.status !== "cancelled");
|
|
979
|
+
const parts = views.slice(0, 8).map((v) => {
|
|
980
|
+
if (v.status === "ongoing")
|
|
981
|
+
return `${v.id} ongoing "${v.title}"`;
|
|
982
|
+
if (v.blocked)
|
|
983
|
+
return `${v.id} blocked ← ${v.blockedBy.join(",")}`;
|
|
984
|
+
return `${v.id} ready "${v.title}"`;
|
|
985
|
+
});
|
|
986
|
+
const extra = views.length > 8 ? ` (+${views.length - 8} more)` : "";
|
|
987
|
+
return (`Current checklist (${c.done}/${c.total} done): ${parts.join("; ")}${extra}. ` +
|
|
988
|
+
`Use checklist_update as work progresses. Do not start blocked tasks. Copy 3-char ids; never invent them.`);
|
|
989
|
+
}
|
|
990
|
+
//# sourceMappingURL=store.js.map
|